diff options
Diffstat (limited to 'node_modules/cache-loader')
| -rw-r--r-- | node_modules/cache-loader/CHANGELOG.md | 127 | ||||
| -rw-r--r-- | node_modules/cache-loader/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/cache-loader/README.md | 210 | ||||
| -rw-r--r-- | node_modules/cache-loader/dist/cjs.js | 3 | ||||
| -rw-r--r-- | node_modules/cache-loader/dist/index.js | 227 | ||||
| -rw-r--r-- | node_modules/cache-loader/dist/options.json | 21 | ||||
| l--------- | node_modules/cache-loader/node_modules/.bin/mkdirp | 1 | ||||
| l--------- | node_modules/cache-loader/node_modules/.bin/webpack | 1 | ||||
| -rw-r--r-- | node_modules/cache-loader/package.json | 71 |
9 files changed, 0 insertions, 681 deletions
diff --git a/node_modules/cache-loader/CHANGELOG.md b/node_modules/cache-loader/CHANGELOG.md deleted file mode 100644 index b8214a65..00000000 --- a/node_modules/cache-loader/CHANGELOG.md +++ /dev/null @@ -1,127 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -<a name="1.2.5"></a> -## [1.2.5](https://github.com/webpack-contrib/cache-loader/compare/v1.2.4...v1.2.5) (2018-10-31) - - -### Bug Fixes - -* **index:** `this` of `stat` method is `undefined` ([#47](https://github.com/webpack-contrib/cache-loader/issues/47)) ([5c67ccd](https://github.com/webpack-contrib/cache-loader/commit/5c67ccd)) - - - -<a name="1.2.4"></a> -## [1.2.4](https://github.com/webpack-contrib/cache-loader/compare/v1.2.3...v1.2.4) (2018-10-31) - - -### Bug Fixes - -* **index:** fallback to `fs` if `this.fs` is `undefined` ([#45](https://github.com/webpack-contrib/cache-loader/issues/45)) ([b84d13e](https://github.com/webpack-contrib/cache-loader/commit/b84d13e)) - - - -<a name="1.2.3"></a> -## [1.2.3](https://github.com/webpack-contrib/cache-loader/compare/v1.2.2...v1.2.3) (2018-10-30) - - -### Performance Improvements - -* **index:** use the `compiler`'s cached `fs` for stats (`this.fs.stat`) ([#42](https://github.com/webpack-contrib/cache-loader/issues/42)) ([d8c630b](https://github.com/webpack-contrib/cache-loader/commit/d8c630b)) - - - -<a name="1.2.2"></a> -## [1.2.2](https://github.com/webpack-contrib/cache-loader/compare/v1.2.1...v1.2.2) (2018-02-27) - - -### Performance Improvements - -* use `neo-async` instead `async` ([#31](https://github.com/webpack-contrib/cache-loader/issues/31)) ([0851582](https://github.com/webpack-contrib/cache-loader/commit/0851582)) - - - -<a name="1.2.1"></a> -## [1.2.1](https://github.com/webpack-contrib/cache-loader/compare/v1.2.0...v1.2.1) (2018-02-26) - - -### Bug Fixes - -* **package:** add `webpack >= v4.0.0` (`peerDependencies`) ([#32](https://github.com/webpack-contrib/cache-loader/issues/32)) ([a5e921c](https://github.com/webpack-contrib/cache-loader/commit/a5e921c)) - - - -<a name="1.2.0"></a> -# [1.2.0](https://github.com/webpack-contrib/cache-loader/compare/v1.1.0...v1.2.0) (2017-11-17) - - -### Bug Fixes - -* **index:** check for inaccurate filesystem (`mtime`) ([f24f723](https://github.com/webpack-contrib/cache-loader/commit/f24f723)) - - -### Features - -* add `options` validation (`schema-utils`) ([#24](https://github.com/webpack-contrib/cache-loader/issues/24)) ([4ac7807](https://github.com/webpack-contrib/cache-loader/commit/4ac7807)) -* add support for custom cache stores (`options.read/options.write`) ([#19](https://github.com/webpack-contrib/cache-loader/issues/19)) ([060796b](https://github.com/webpack-contrib/cache-loader/commit/060796b)) - - - -<a name="1.1.0"></a> -# [1.1.0](https://github.com/webpack-contrib/cache-loader/compare/v1.0.3...v1.1.0) (2017-10-09) - - -### Bug Fixes - -* add `cacheIdentifier` to documentation ([9a18ba9](https://github.com/webpack-contrib/cache-loader/commit/9a18ba9)) -* upgrade webpack-defaults, add missing dependency ([5025869](https://github.com/webpack-contrib/cache-loader/commit/5025869)) - - -### Features - -* invalidate cache ([#9](https://github.com/webpack-contrib/cache-loader/issues/9)) ([663e18a](https://github.com/webpack-contrib/cache-loader/commit/663e18a)) - - -### Performance Improvements - -* throw early if file doesn't exists ([#5](https://github.com/webpack-contrib/cache-loader/issues/5)) ([a7f3449](https://github.com/webpack-contrib/cache-loader/commit/a7f3449)) - - - -<a name="1.0.3"></a> -## [1.0.3](https://github.com/webpack-contrib/cache-loader/compare/v1.0.2...v1.0.3) (2017-04-26) - - -### Bug Fixes - -* **readme:** remove typo and add additional note ([cc63a7f](https://github.com/webpack-contrib/cache-loader/commit/cc63a7f)) - - - -<a name="1.0.2"></a> -## [1.0.2](https://github.com/webpack-contrib/cache-loader/compare/v1.0.1...v1.0.2) (2017-04-26) - - -### Bug Fixes - -* **readme:** fill content into the README ([7b5d5fd](https://github.com/webpack-contrib/cache-loader/commit/7b5d5fd)) - - - -<a name="1.0.1"></a> -## 1.0.1 (2017-04-26) - - - -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -x.x.x / <year>-<month>-<day> -================== - - * Bug fix - - * Feature - - * Chore - - * Docs - diff --git a/node_modules/cache-loader/LICENSE b/node_modules/cache-loader/LICENSE deleted file mode 100644 index 8c11fc72..00000000 --- a/node_modules/cache-loader/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright JS Foundation and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/cache-loader/README.md b/node_modules/cache-loader/README.md deleted file mode 100644 index 327496aa..00000000 --- a/node_modules/cache-loader/README.md +++ /dev/null @@ -1,210 +0,0 @@ -[![npm][npm]][npm-url] -[![node][node]][node-url] -[![deps][deps]][deps-url] -[![test][test]][test-url] -[![coverage][cover]][cover-url] -[![chat][chat]][chat-url] - -<div align="center"> - <a href="https://webpack.js.org/"> - <img width="200" height="200" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg"> - </a> - <h1>Cache Loader</h1> - <p>Caches the result of following loaders on disk (default) or in the database</p> -</div> - -<h2 align="center">Install</h2> - -```bash -npm install --save-dev cache-loader -``` - -<h2 align="center">Usage</h2> - -Add this loader in front of other (expensive) loaders to cache the result on disk. - -**webpack.config.js** -```js -module.exports = { - module: { - rules: [ - { - test: /\.ext$/, - use: [ - 'cache-loader', - ...loaders - ], - include: path.resolve('src') - } - ] - } -} -``` - -> ⚠️ Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders. - -<h2 align="center">Options</h2> - -|Name|Type|Default|Description| -|:--:|:--:|:-----:|:----------| -|**`cacheKey`**|`{Function(options, request) -> {String}}`|`undefined`|Allows you to override default cache key generator| -|**`cacheDirectory`**|`{String}`|`path.resolve('.cache-loader')`|Provide a cache directory where cache items should be stored (used for default read/write implementation)| -|**`cacheIdentifier`**|`{String}`|`cache-loader:{version} {process.env.NODE_ENV}`|Provide an invalidation identifier which is used to generate the hashes. You can use it for extra dependencies of loaders (used for default read/write implementation)| -|**`write`**|`{Function(cacheKey, data, callback) -> {void}}`|`undefined`|Allows you to override default write cache data to file (e.g. Redis, memcached)| -|**`read`**|`{Function(cacheKey, callback) -> {void}}`|`undefined`|Allows you to override default read cache data from file| - -<h2 align="center">Examples</h2> - -**webpack.config.js** -```js -module.exports = { - module: { - rules: [ - { - test: /\.js$/, - use: [ - 'cache-loader', - 'babel-loader' - ], - include: path.resolve('src') - } - ] - } -} -``` - -### `Database Integration` - -**webpack.config.js** -```js -// Or different database client - memcached, mongodb, ... -const redis = require('redis'); -const crypto = require('crypto'); - -// ... -// connect to client -// ... - -const BUILD_CACHE_TIMEOUT = 24 * 3600; // 1 day - -function digest(str) { - return crypto.createHash('md5').update(str).digest('hex'); -} - -// Generate own cache key -function cacheKey(options, request) { - return `build:cache:${digest(request)}`; -} - - -// Read data from database and parse them -function read(key, callback) { - client.get(key, (err, result) => { - if (err) { - return callback(err); - } - - if (!result) { - return callback(new Error(`Key ${key} not found`)); - } - - try { - let data = JSON.parse(result); - callback(null, data); - } catch (e) { - callback(e); - } - }); -} - - -// Write data to database under cacheKey -function write(key, data, callback) { - client.set(key, JSON.stringify(data), 'EX', BUILD_CACHE_TIMEOUT, callback); -} - -module.exports = { - module: { - rules: [ - { - test: /\.js$/, - use: [ - { - loader: 'cache-loader', - options: { - cacheKey, - read, - write, - } - }, - 'babel-loader' - ], - include: path.resolve('src') - } - ] - } -} -``` - -<h2 align="center">Maintainers</h2> - -<table> - <tbody> - <tr> - <td align="center"> - <a href="https://github.com/sokra"> - <img width="150" height="150" src="https://github.com/sokra.png?size=150"> - </br> - Tobias Koppers - </a> - </td> - <td align="center"> - <a href="https://github.com/bebraw"> - <img width="150" height="150" src="https://github.com/bebraw.png?v=3&s=150"> - </br> - Juho Vepsäläinen - </a> - </td> - <td align="center"> - <a href="https://github.com/d3viant0ne"> - <img width="150" height="150" src="https://github.com/d3viant0ne.png?v=3&s=150"> - </br> - Joshua Wiens - </a> - </td> - <td align="center"> - <a href="https://github.com/michael-ciniawsky"> - <img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150"> - </br> - Michael Ciniawsky - </a> - </td> - <td align="center"> - <a href="https://github.com/evilebottnawi"> - <img width="150" height="150" src="https://github.com/evilebottnawi.png?v=3&s=150"> - </br> - Alexander Krasnoyarov - </a> - </td> - </tr> - <tbody> -</table> - - -[npm]: https://img.shields.io/npm/v/cache-loader.svg -[npm-url]: https://npmjs.com/package/cache-loader - -[node]: https://img.shields.io/node/v/cache-loader.svg -[node-url]: https://nodejs.org - -[deps]: https://david-dm.org/webpack-contrib/cache-loader.svg -[deps-url]: https://david-dm.org/webpack-contrib/cache-loader - -[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg -[chat-url]: https://gitter.im/webpack/webpack - -[test]: https://img.shields.io/travis/webpack-contrib/cache-loader.svg -[test-url]: https://travis-ci.org/webpack-contrib/cache-loader - -[cover]: https://codecov.io/gh/webpack-contrib/cache-loader/branch/master/graph/badge.svg -[cover-url]: https://codecov.io/gh/webpack-contrib/cache-loader diff --git a/node_modules/cache-loader/dist/cjs.js b/node_modules/cache-loader/dist/cjs.js deleted file mode 100644 index c2cb24a8..00000000 --- a/node_modules/cache-loader/dist/cjs.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./index');
\ No newline at end of file diff --git a/node_modules/cache-loader/dist/index.js b/node_modules/cache-loader/dist/index.js deleted file mode 100644 index 93cb6b96..00000000 --- a/node_modules/cache-loader/dist/index.js +++ /dev/null @@ -1,227 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -/* eslint-disable - import/order -*/ -var fs = require('fs'); -var path = require('path'); -var async = require('neo-async'); -var crypto = require('crypto'); -var mkdirp = require('mkdirp'); - -var _require = require('loader-utils'), - getOptions = _require.getOptions; - -var validateOptions = require('schema-utils'); - -var pkg = require('../package.json'); - -var env = process.env.NODE_ENV || 'development'; - -var schema = require('./options.json'); - -var defaults = { - cacheDirectory: path.resolve('.cache-loader'), - cacheIdentifier: `cache-loader:${pkg.version} ${env}`, - cacheKey, - read, - write -}; - -function loader() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var options = Object.assign({}, defaults, getOptions(this)); - - validateOptions(schema, options, 'Cache Loader'); - - var writeFn = options.write; - - - var callback = this.async(); - var data = this.data; - - var dependencies = this.getDependencies().concat(this.loaders.map(function (l) { - return l.path; - })); - var contextDependencies = this.getContextDependencies(); - - // Should the file get cached? - var cache = true; - // this.fs can be undefined - // e.g when using the thread-loader - // fallback to the fs module - var FS = this.fs || fs; - var toDepDetails = function toDepDetails(dep, mapCallback) { - FS.stat(dep, function (err, stats) { - if (err) { - mapCallback(err); - return; - } - - var mtime = stats.mtime.getTime(); - - if (mtime / 1000 >= Math.floor(data.startTime / 1000)) { - // Don't trust mtime. - // File was changed while compiling - // or it could be an inaccurate filesystem. - cache = false; - } - - mapCallback(null, { - path: dep, - mtime - }); - }); - }; - - async.parallel([function (cb) { - return async.mapLimit(dependencies, 20, toDepDetails, cb); - }, function (cb) { - return async.mapLimit(contextDependencies, 20, toDepDetails, cb); - }], function (err, taskResults) { - if (err) { - callback.apply(undefined, [null].concat(args)); - return; - } - if (!cache) { - callback.apply(undefined, [null].concat(args)); - return; - } - - var _taskResults = _slicedToArray(taskResults, 2), - deps = _taskResults[0], - contextDeps = _taskResults[1]; - - writeFn(data.cacheKey, { - remainingRequest: data.remainingRequest, - dependencies: deps, - contextDependencies: contextDeps, - result: args - }, function () { - // ignore errors here - callback.apply(undefined, [null].concat(args)); - }); - }); -} - -function pitch(remainingRequest, prevRequest, dataInput) { - var _this = this; - - var options = Object.assign({}, defaults, getOptions(this)); - - validateOptions(schema, options, 'Cache Loader (Pitch)'); - - var readFn = options.read, - cacheKeyFn = options.cacheKey; - - - var callback = this.async(); - var data = dataInput; - - data.remainingRequest = remainingRequest; - data.cacheKey = cacheKeyFn(options, remainingRequest); - readFn(data.cacheKey, function (readErr, cacheData) { - if (readErr) { - callback(); - return; - } - if (cacheData.remainingRequest !== remainingRequest) { - // in case of a hash conflict - callback(); - return; - } - var FS = _this.fs || fs; - async.each(cacheData.dependencies.concat(cacheData.contextDependencies), function (dep, eachCallback) { - FS.stat(dep.path, function (statErr, stats) { - if (statErr) { - eachCallback(statErr); - return; - } - if (stats.mtime.getTime() !== dep.mtime) { - eachCallback(true); - return; - } - eachCallback(); - }); - }, function (err) { - if (err) { - data.startTime = Date.now(); - callback(); - return; - } - cacheData.dependencies.forEach(function (dep) { - return _this.addDependency(dep.path); - }); - cacheData.contextDependencies.forEach(function (dep) { - return _this.addContextDependency(dep.path); - }); - callback.apply(undefined, [null].concat(_toConsumableArray(cacheData.result))); - }); - }); -} - -function digest(str) { - return crypto.createHash('md5').update(str).digest('hex'); -} - -var directories = new Set(); - -function write(key, data, callback) { - var dirname = path.dirname(key); - var content = JSON.stringify(data); - - if (directories.has(dirname)) { - // for performance skip creating directory - fs.writeFile(key, content, 'utf-8', callback); - } else { - mkdirp(dirname, function (mkdirErr) { - if (mkdirErr) { - callback(mkdirErr); - return; - } - - directories.add(dirname); - - fs.writeFile(key, content, 'utf-8', callback); - }); - } -} - -function read(key, callback) { - fs.readFile(key, 'utf-8', function (err, content) { - if (err) { - callback(err); - return; - } - - try { - var data = JSON.parse(content); - callback(null, data); - } catch (e) { - callback(e); - } - }); -} - -function cacheKey(options, request) { - var cacheIdentifier = options.cacheIdentifier, - cacheDirectory = options.cacheDirectory; - - var hash = digest(`${cacheIdentifier}\n${request}`); - - return path.join(cacheDirectory, `${hash}.json`); -} - -exports.default = loader; -exports.pitch = pitch;
\ No newline at end of file diff --git a/node_modules/cache-loader/dist/options.json b/node_modules/cache-loader/dist/options.json deleted file mode 100644 index 74f65bb8..00000000 --- a/node_modules/cache-loader/dist/options.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "object", - "properties": { - "cacheKey": { - "instanceof": "Function" - }, - "cacheIdentifier": { - "type": "string" - }, - "cacheDirectory": { - "type": "string" - }, - "read": { - "instanceof": "Function" - }, - "write": { - "instanceof": "Function" - } - }, - "additionalProperties": false -} diff --git a/node_modules/cache-loader/node_modules/.bin/mkdirp b/node_modules/cache-loader/node_modules/.bin/mkdirp deleted file mode 120000 index 91a5f623..00000000 --- a/node_modules/cache-loader/node_modules/.bin/mkdirp +++ /dev/null @@ -1 +0,0 @@ -../../../mkdirp/bin/cmd.js
\ No newline at end of file diff --git a/node_modules/cache-loader/node_modules/.bin/webpack b/node_modules/cache-loader/node_modules/.bin/webpack deleted file mode 120000 index 8a1900f6..00000000 --- a/node_modules/cache-loader/node_modules/.bin/webpack +++ /dev/null @@ -1 +0,0 @@ -../../../webpack/bin/webpack.js
\ No newline at end of file diff --git a/node_modules/cache-loader/package.json b/node_modules/cache-loader/package.json deleted file mode 100644 index 9be8b914..00000000 --- a/node_modules/cache-loader/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "cache-loader", - "version": "1.2.5", - "description": "Caches the result of following loaders on disk.", - "author": "Tobias Koppers @sokra", - "license": "MIT", - "main": "dist/cjs.js", - "files": [ - "dist" - ], - "scripts": { - "start": "npm run build -- -w", - "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files", - "clean": "del-cli dist", - "lint": "eslint --cache src test", - "lint-staged": "lint-staged", - "prebuild": "npm run clean", - "prepare": "npm run build", - "release": "standard-version", - "security": "npm audit", - "test": "jest", - "test:watch": "jest --watch", - "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", - "travis:coverage": "npm run test:coverage -- --runInBand", - "travis:lint": "npm run lint && npm run security", - "travis:test": "npm run test -- --runInBand", - "appveyor:test": "npm run test", - "defaults": "webpack-defaults", - "webpack-defaults": "webpack-defaults" - }, - "dependencies": { - "loader-utils": "^1.1.0", - "mkdirp": "^0.5.1", - "neo-async": "^2.5.0", - "schema-utils": "^0.4.2" - }, - "devDependencies": { - "babel-cli": "^6.0.0", - "babel-jest": "^21.0.0", - "babel-plugin-transform-object-rest-spread": "^6.0.0", - "babel-polyfill": "^6.0.0", - "babel-preset-env": "^1.6.0", - "cross-env": "^5.0.0", - "del-cli": "^1.0.0", - "eslint": "^4.0.0", - "eslint-config-webpack": "^1.0.0", - "eslint-plugin-import": "^2.0.0", - "jest": "^21.0.0", - "lint-staged": "^5.0.0", - "pre-commit": "^1.0.0", - "standard-version": "^4.0.0", - "webpack": "^3.0.0", - "webpack-defaults": "^1.6.0" - }, - "engines": { - "node": ">= 4.8 < 5.0.0 || >= 5.10" - }, - "peerDependencies": { - "webpack": "^2.0.0 || ^3.0.0 || ^4.0.0" - }, - "repository": "https://github.com/webpack-contrib/cache-loader.git", - "bugs": "https://github.com/webpack-contrib/cache-loader/issues", - "homepage": "https://github.com/webpack-contrib/cache-loader", - "pre-commit": "lint-staged", - "lint-staged": { - "*.js": [ - "eslint --fix", - "git add" - ] - } -} |
