Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

239
spa/node_modules/assets-webpack-plugin/changelog.md generated vendored Normal file
View File

@@ -0,0 +1,239 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning].
[Semantic Versioning]: http://semver.org/
## 7.0.0 - 2020-12-11
* Requires webpack 5 or greater as a peer dependency
* Closes [#322](https://github.com/ztoben/assets-webpack-plugin/issues/322)
## 6.1.2 - 2020-12-08
* Closes [#319](https://github.com/ztoben/assets-webpack-plugin/issues/319)
## 6.1.1 - 2020-12-03
* Adds the `includeDynamicImportedAssets` option
* Closes [#313](https://github.com/ztoben/assets-webpack-plugin/issues/313)
## 6.1.0 - 2020-12-03
* Closes [#312](https://github.com/ztoben/assets-webpack-plugin/issues/312)
## 6.0.6 - 2020-12-02
* Adds [#311](https://github.com/ztoben/assets-webpack-plugin/pull/311)
* Fixes issue where default path would not be set
## 6.0.5 - 2020-12-01
* Adds [#310](https://github.com/ztoben/assets-webpack-plugin/pull/310)
## 6.0.4 - 2020-11-13
* Adds the `includeAuxiliaryAssets` option
* Closes [#302](https://github.com/ztoben/assets-webpack-plugin/issues/302)
## 6.0.2 - 2020-10-16
* Closes [#279](https://github.com/ztoben/assets-webpack-plugin/issues/279)
## 6.0.1 - 2020-10-15
* Initial webpack 5 support
* Versions going forward will support webpack 5 only
## 6.0.0
* This release is deprecated.
## 5.1.2 - 2020-09-22
* Add a new option to include assets that aren't in any chunk using the `includeFilesWithoutChunk` option.
* Closes [#204](https://github.com/ztoben/assets-webpack-plugin/issues/204)
## 5.1.1 - 2020-08-17
* Allow more than one entry in `includeManifest`.
* Closes [#84](https://github.com/ztoben/assets-webpack-plugin/issues/84)
## 5.1.0 - 2020-08-17
* Implements using more relaxed dependencies.
* Fixes [#240](https://github.com/ztoben/assets-webpack-plugin/issues/240)
## 5.0.5 - 2020-08-17
* Plugin will now parse the `.mjs` file extension.
## 5.0.4 - 2020-08-14
* Fixes [#251](https://github.com/ztoben/assets-webpack-plugin/issues/251)
## 5.0.3 - 2020-07-09
* Bumps several dependencies.
## 5.0.2 - 2020-06-15
* Fixes an error when `keepInMemory` was turn on.
## 5.0.1 - 2020-06-15
* Fixes [#234](https://github.com/ztoben/assets-webpack-plugin/issues/234)
## 5.0.0 - 2020-06-11
* Unfortunately must bump to v5 instead of v4 due to an old botched release that can't be unpublished
* Major bump due to now requiring node 10
* Maintains the same changes as `3.10.0`, but properly warns when using an older version of node
## 3.10.0 - 2020-06-08 (Deprecated)
* Updates several dependencies
* Fixes [#226](https://github.com/ztoben/assets-webpack-plugin/issues/226)
## 3.9.10 - 2019-02-28
* Fixes [#169](https://github.com/ztoben/assets-webpack-plugin/issues/169)
## 3.9.9 - 2019-02-28
* Adds the `integrity` option to add output from webpack-subresource-integrity to the json file
* Fixes [#63](https://github.com/ztoben/assets-webpack-plugin/issues/63)
## 3.9.8 - 2019-02-27
* Dependency updates
* Fixes [#167](https://github.com/ztoben/assets-webpack-plugin/issues/167)
## 3.9.7 - 2018-10-04
* Allow webpack 4 entrypoints chunks
* Fixes [#108](https://github.com/ztoben/assets-webpack-plugin/issues/108)
## 3.9.6 - 2018-08-20
* Fixes [#125](https://github.com/ztoben/assets-webpack-plugin/issues/125)
## 3.9.5 - 2018-08-09
* Adds the `keepInMemory` option to toggle whether you want the assets file generated when running in `webpack-dev-server`.
## 3.9.4 - 2018-08-08
* Adds the `includeAllFileTypes`, and `fileTypes` options for controlling which files are included in the assets file.
## 3.9.3 - 2018-08-07
* Fixes an issue where `useCompilerPath` wasn't correctly resolving the path.
## 3.9.2 - 2018-08-07
* Reverts [#109](https://github.com/ztoben/assets-webpack-plugin/pull/109), fixes [#118](https://github.com/ztoben/assets-webpack-plugin/issues/118).
## 3.9.1 - 2018-08-06
* `useCompilerPath` option to override path with webpack output path set in config.
## 3.9.0 - 2018-08-06
* ~~Now supports webpack 4 entries with multiple chunks. See [#109](https://github.com/ztoben/assets-webpack-plugin/pull/109) for details.~~
* Use compiler.outputFileSystem for output.
* Fixes [#108](https://github.com/ztoben/assets-webpack-plugin/issues/108), [#111](https://github.com/ztoben/assets-webpack-plugin/issues/111), and [#92](https://github.com/ztoben/assets-webpack-plugin/issues/92).
## 3.8.4 - 2018-06-20
### Changed
* No code changed. Purely for testing tagged releases on git.
## 3.8.3 - 2018-06-18
### Changed
* Package json was pointing to the wrong index file.
## 3.8.2 - 2018-06-18
### Changed
* Add babel to the build process.
## 3.8.1 - 2018-06-18
### Changed
* Support for listing the manifest entry first when `manifestFirst` option is set. See [#66](https://github.com/ztoben/assets-webpack-plugin/issues/66) for details.
## 3.8.0 - 2018-06-15
### Changed
* Reverts [#90](https://github.com/ztoben/assets-webpack-plugin/pull/90), fixes [#93](https://github.com/ztoben/assets-webpack-plugin/issues/93) and [#92](https://github.com/ztoben/assets-webpack-plugin/issues/92)
## 3.7.2 - 2018-06-14
### Changed
* Reduces npm package size [#67](https://github.com/ztoben/assets-webpack-plugin/issues/67)
## 3.7.1 - 2018-06-13
### Changed
* Fixes a parsing error with the asset path introduced by the fix for [#88](https://github.com/ztoben/assets-webpack-plugin/issues/88)
## 3.7.0 - 2018-06-13
### Changed
* Adds all assets to the manifest that aren't in a chunk (kudos to [@Kronuz](https://github.com/Kronuz) see [#65](https://github.com/ztoben/assets-webpack-plugin/pull/65))
## 3.6.3 - 2018-06-13
### Changed
* Add support for multiple files of the same extension (kudos to [@aaronatmycujoo](https://github.com/aaronatmycujoo) see [#79](https://github.com/ztoben/assets-webpack-plugin/pull/79) and [@Kronuz](https://github.com/Kronuz) see [#64](https://github.com/ztoben/assets-webpack-plugin/pull/64))
## 3.6.2 - 2018-06-13
### Changed
* Fixed incorrect concatination of asset file names and directory path see [#88](https://github.com/ztoben/assets-webpack-plugin/issues/88)
## 3.6.1 - 2018-06-13
### Changed
* webpack-dev-server (which uses memory-fs) correctly generates the manifest inside the memory file system (kudos to [@Kronuz](https://github.com/Kronuz) see [#90](https://github.com/ztoben/assets-webpack-plugin/pull/90))
## 3.6.0 - 2018-05-29
### Changed
* webpack 4 support (kudos to [@ztoben](https://github.com/ztoben) and [@saveman71](https://github.com/saveman71) see [#89](https://github.com/ztoben/assets-webpack-plugin/pull/89))
## 3.5.1 - 2017-01-20
### Fixed
* Support for source maps when `includeManifest` option is set.
## 3.5.0 - 2016-10-21
### Added
* `includeManifest` option (kudos to Matt Krick [@mattkrick](https://github.com/mattkrick)).
[See docs](./README.md#includemanifest) for more details.
## 3.4.0 - 2016-03-09
### Changed
* Do not write to assets file if output hasn't changed.
## 3.2.0 - 2015-11-17
### Added
* `processOutput` option.
## 3.1.0 - 2015-10-24
### Added
* Config now accepts a `fullPath` option.

218
spa/node_modules/assets-webpack-plugin/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,218 @@
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
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); } }
var fs = require('fs');
var path = require('path');
var _ = require('lodash');
var getAssetKind = require('./lib/getAssetKind');
var isHMRUpdate = require('./lib/isHMRUpdate');
var isSourceMap = require('./lib/isSourceMap');
var getDynamicImportedChildAssets = require('./lib/getDynamicImportedChildAssets');
var createQueuedWriter = require('./lib/output/createQueuedWriter');
var createOutputWriter = require('./lib/output/createOutputWriter');
function AssetsWebpackPlugin(options) {
this.options = _.merge({}, {
filename: 'webpack-assets.json',
prettyPrint: false,
update: false,
fullPath: true,
manifestFirst: true,
useCompilerPath: false,
fileTypes: ['js', 'css'],
includeAllFileTypes: true,
includeFilesWithoutChunk: false,
includeAuxiliaryAssets: false,
includeDynamicImportedAssets: false,
keepInMemory: false,
integrity: false,
removeFullPathAutoPrefix: false
}, options);
}
AssetsWebpackPlugin.prototype = {
constructor: AssetsWebpackPlugin,
apply: function apply(compiler) {
var self = this;
self.options.path = path.resolve(self.options.useCompilerPath ? compiler.options.output.path || '.' : self.options.path || '.');
self.writer = createQueuedWriter(createOutputWriter(self.options));
var afterEmit = function afterEmit(compilation, callback) {
var options = compiler.options;
var stats = compilation.getStats().toJson({
hash: true,
publicPath: true,
assets: true,
chunks: false,
modules: false,
source: false,
errorDetails: false,
timings: false
});
var assetPath = stats.publicPath && self.options.fullPath ? stats.publicPath : '';
// assetsByChunkName contains a hash with the bundle names and the produced files
// e.g. { one: 'one-bundle.js', two: 'two-bundle.js' }
// in some cases (when using a plugin or source maps) it might contain an array of produced files
// e.g. {
// main:
// [ 'index-bundle-42b6e1ec4fa8c5f0303e.js',
// 'index-bundle-42b6e1ec4fa8c5f0303e.js.map' ]
// }
// starting with webpack 5, the public path is automatically determined when possible and the path is prefaced
// with `/auto/`, the `removeAutoPrefix` option can be set to turn this off
if (self.options.removeFullPathAutoPrefix) {
if (assetPath.startsWith('auto')) {
assetPath = assetPath.substring(4);
}
}
var seenAssets = {};
var chunks = void 0;
if (self.options.entrypoints) {
chunks = Object.keys(stats.entrypoints);
if (self.options.includeFilesWithoutChunk) {
chunks.push(''); // push "unnamed" chunk
}
} else {
chunks = Object.keys(stats.assetsByChunkName);
chunks.push(''); // push "unnamed" chunk
}
var output = chunks.reduce(function (chunkMap, chunkName) {
var assets = void 0;
if (self.options.entrypoints) {
assets = chunkName ? stats.entrypoints[chunkName].assets : stats.assets;
} else {
assets = chunkName ? stats.assetsByChunkName[chunkName] : stats.assets;
}
if (self.options.includeAuxiliaryAssets && chunkName && stats.entrypoints[chunkName].auxiliaryAssets) {
assets = [].concat(_toConsumableArray(assets), _toConsumableArray(stats.entrypoints[chunkName].auxiliaryAssets));
}
if (self.options.includeDynamicImportedAssets && chunkName && stats.entrypoints[chunkName].children) {
var dynamicImportedChildAssets = getDynamicImportedChildAssets(options, stats.entrypoints[chunkName].children);
assets = [].concat(_toConsumableArray(assets), _toConsumableArray(dynamicImportedChildAssets));
}
if (!Array.isArray(assets)) {
assets = [assets];
}
var added = false;
var typeMap = assets.reduce(function (typeMap, obj) {
var asset = obj.name || obj;
if (isHMRUpdate(options, asset) || isSourceMap(options, asset) || !chunkName && seenAssets[asset]) {
return typeMap;
}
var typeName = getAssetKind(options, asset);
if (self.options.includeAllFileTypes || self.options.fileTypes.includes(typeName)) {
var combinedPath = assetPath && assetPath.slice(-1) !== '/' ? assetPath + '/' + asset : assetPath + asset;
var type = _typeof(typeMap[typeName]);
var compilationAsset = compilation.assets[asset];
var integrity = compilationAsset && compilationAsset.integrity;
var loadingBehavior = obj.loadingBehavior;
if (type === 'undefined') {
typeMap[typeName] = combinedPath;
if (self.options.integrity && integrity) {
typeMap[typeName + 'Integrity'] = integrity;
}
} else {
if (type === 'string') {
typeMap[typeName] = [typeMap[typeName]];
}
if (self.options.includeDynamicImportedAssets && loadingBehavior) {
var typeNameWithLoadingBehavior = typeName + ':' + loadingBehavior;
typeMap[typeNameWithLoadingBehavior] = typeMap[typeNameWithLoadingBehavior] || [];
typeMap[typeNameWithLoadingBehavior].push(combinedPath);
} else {
typeMap[typeName].push(combinedPath);
}
}
added = true;
seenAssets[asset] = true;
}
return typeMap;
}, {});
if (added) {
chunkMap[chunkName] = typeMap;
}
return chunkMap;
}, {});
var manifestNames = self.options.includeManifest === true ? ['manifest'] : self.options.includeManifest;
if (typeof manifestNames === 'string') {
manifestNames = [manifestNames];
}
if (manifestNames) {
for (var i = 0; i < manifestNames.length; i++) {
var manifestName = manifestNames[i];
var manifestEntry = output[manifestName];
if (manifestEntry) {
var js = manifestEntry.js || manifestEntry.mjs;
if (!Array.isArray(js)) {
js = [js];
}
var manifestAssetKey = js[js.length - 1].substr(assetPath.length);
var parentSource = compilation.assets[manifestAssetKey];
var entryText = parentSource.source();
if (!entryText) {
throw new Error('Could not locate manifest function in source', parentSource);
}
manifestEntry.text = entryText;
}
}
}
if (self.options.metadata) {
output.metadata = self.options.metadata;
}
if (!compiler.outputFileSystem.readFile) {
compiler.outputFileSystem.readFile = fs.readFile.bind(fs);
}
if (!compiler.outputFileSystem.join) {
compiler.outputFileSystem.join = path.join.bind(path);
}
self.writer(compiler.outputFileSystem, output, function (err) {
if (err) {
compilation.errors.push(err);
}
callback();
});
};
if (compiler.hooks) {
var plugin = { name: 'AssetsWebpackPlugin' };
compiler.hooks.afterEmit.tapAsync(plugin, afterEmit);
} else {
compiler.plugin('after-emit', afterEmit);
}
}
};
module.exports = AssetsWebpackPlugin;

View File

@@ -0,0 +1,10 @@
'use strict';
var camelcase = require('camelcase');
var getFileExtension = require('./getFileExtension');
module.exports = function getAssetKind(options, asset) {
var ext = getFileExtension(asset);
return camelcase(ext);
};

View File

@@ -0,0 +1,38 @@
'use strict';
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); } }
var getAssetsFromChildChunk = function getAssetsFromChildChunk(options, chunk, loadingBehavior) {
var assets = [];
if (chunk.assets) {
chunk.assets.forEach(function (asset) {
asset.loadingBehavior = loadingBehavior;
assets.push(asset);
});
}
if (options.includeAuxiliaryAssets && chunk.auxiliaryAssets) {
chunk.auxiliaryAssets.forEach(function (asset) {
asset.loadingBehavior = loadingBehavior;
assets.push(asset);
});
}
return assets;
};
module.exports = function getDynamicImportedChildAssets(options, children) {
var loadingBehaviors = ['preload', 'prefetch'];
var assets = [];
loadingBehaviors.forEach(function (loadingBehavior) {
if (children[loadingBehavior]) {
children[loadingBehavior].forEach(function (childChunk) {
assets = [].concat(_toConsumableArray(assets), _toConsumableArray(getAssetsFromChildChunk(options, childChunk, loadingBehavior)));
});
}
});
return assets;
};

View File

@@ -0,0 +1,8 @@
'use strict';
module.exports = function getFileExtension(asset) {
var extRegex = /\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/i;
var ext = asset.match(extRegex);
return ext ? ext[0].slice(1) : '';
};

View File

@@ -0,0 +1,11 @@
'use strict';
var pathTemplate = require('./pathTemplate');
module.exports = function isHMRUpdate(options, asset) {
if (asset.includes('.hot-update.')) return true;
var hotUpdateChunkFilename = options.output.hotUpdateChunkFilename;
var hotUpdateTemplate = pathTemplate(hotUpdateChunkFilename);
return hotUpdateTemplate.matches(asset);
};

View File

@@ -0,0 +1,9 @@
'use strict';
var pathTemplate = require('./pathTemplate');
module.exports = function isSourceMap(options, asset) {
var sourceMapFilename = options.output.sourceMapFilename;
var sourcemapTemplate = pathTemplate(sourceMapFilename);
return sourcemapTemplate.matches(asset);
};

View File

@@ -0,0 +1,93 @@
'use strict';
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); } }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var path = require('path');
var fs = require('fs');
var _ = require('lodash');
var error = require('../utils/error');
function sortAssets(assets) {
return Object.keys(assets).map(function (i) {
return _defineProperty({}, i, assets[i]);
}).sort(function (a, b) {
if (a.manifest) {
return -1;
}
if (b.manifest) {
return 1;
}
return 0;
});
}
function orderAssets(assets, options) {
return options.manifestFirst ? Object.assign.apply(Object, [{}].concat(_toConsumableArray(sortAssets(assets)))) : assets;
}
module.exports = function (options) {
var update = options.update;
var firstRun = true;
options.processOutput = options.processOutput || function (assets) {
return JSON.stringify(assets, null, options.prettyPrint ? 2 : null);
};
return function writeOutput(fileStream, newAssets, next) {
// if options.update is false and we're on the first pass of a (possibly) multicompiler
var overwrite = !update && firstRun;
var localFs = options.keepInMemory ? fileStream : fs;
function mkdirCallback(err) {
if (err) handleMkdirError(err);
var outputPath = options.keepInMemory ? localFs.join(options.path, options.filename) : path.join(options.path, options.filename);
localFs.readFile(outputPath, 'utf8', function (err, data) {
// if file does not exist, just write data to it
if (err && err.code !== 'ENOENT') {
return next(error('Could not read output file ' + outputPath, err));
}
// if options.update is false and we're on first run, so start with empty data
data = overwrite ? '{}' : data || '{}';
var oldAssets = void 0;
try {
oldAssets = JSON.parse(data);
} catch (err) {
oldAssets = {};
}
var assets = orderAssets(_.merge({}, oldAssets, newAssets), options);
var output = options.processOutput(assets);
if (output !== data) {
localFs.writeFile(outputPath, output, function (err) {
if (err) {
return next(error('Unable to write to ' + outputPath, err));
}
firstRun = false;
next();
});
} else {
next();
}
});
}
function handleMkdirError(err) {
return next(error('Could not create output folder ' + options.path, err));
}
if (options.keepInMemory) {
localFs.mkdirp(options.path, mkdirCallback);
} else {
fs.mkdir(options.path, { recursive: true }, mkdirCallback);
}
};
};

View File

@@ -0,0 +1,34 @@
"use strict";
/**
* Takes in a processor function, and returns a writer function.
*
* @param {Function} processor
*
* @return {Function} queuedWriter
*/
module.exports = function createQueuedWriter(processor) {
var queue = [];
var iterator = function iterator(callback) {
return function (err) {
queue.shift();
callback(err);
var next = queue[0];
if (next) {
processor(next.fs, next.data, iterator(next.callback));
}
};
};
return function queuedWriter(fs, data, callback) {
var empty = !queue.length;
queue.push({ fs: fs, data: data, callback: callback });
if (empty) {
// start processing
processor(fs, data, iterator(callback));
}
};
};

View File

@@ -0,0 +1,168 @@
'use strict';
var escapeRegExp = require('escape-string-regexp');
var SIMPLE_PLACEHOLDER_RX = /^\[(id|name|file|query|filebase)]/i;
var HASH_PLACEHOLDER_RX = /^\[((?:full)?(?:chunk)?hash)(?::(\d+))?]/i;
var templateCache = Object.create(null);
module.exports = function createTemplate(str) {
if (!templateCache[str]) {
templateCache[str] = new PathTemplate(str);
}
return templateCache[str];
};
function PathTemplate(template) {
this.template = template;
this.fields = parseTemplate(template);
this.matcher = createTemplateMatcher(this.fields);
}
PathTemplate.prototype = {
constructor: PathTemplate,
/**
* Returns whether the given path matches this template.
*
* @param String data
*/
matches: function matches(path) {
return this.matcher.test(path);
},
/**
* Applies data to this template and outputs a filename.
*
* @param Object data
*/
resolve: function resolve(data) {
return this.fields.reduce(function (output, field) {
var replacement = '';
var placeholder = field.placeholder;
var width = field.width;
if (field.prefix) {
output += field.prefix;
}
if (placeholder) {
replacement = data[placeholder] || '';
if (width && (placeholder === 'hash' || placeholder === 'fullhash' || placeholder === 'chunkhash')) {
replacement = replacement.slice(0, width);
}
output += replacement;
}
return output;
}, '');
}
/**
* Loop over the template string and return an array of objects in the form:
* {
* prefix: 'literal text',
* placeholder: 'replacement field name'
* [, width: maximum hash length for hash & chunkhash placeholders]
* }
*
* The values in the object conceptually represent a span of literal text followed by a single replacement field.
* If there is no literal text (which can happen if two replacement fields occur consecutively),
* then prefix will be an empty string.
* If there is no replacement field, then the value of placeholder will be null.
* If the value of placeholder is either 'hash', 'fullhash', or 'chunkhash', then width will be a positive integer.
* Otherwise it will be left undefined.
*/
};function parseTemplate(str) {
var fields = [];
var char = '';
var pos = 0;
var prefix = '';
var match = null;
var input = void 0;
while (true) {
// eslint-disable-line no-constant-condition
char = str[pos];
if (!char) {
fields.push({
prefix: prefix,
placeholder: null
});
break;
} else if (char === '[') {
input = str.slice(pos);
match = SIMPLE_PLACEHOLDER_RX.exec(input);
if (match) {
fields.push({
prefix: prefix,
placeholder: match[1].toLowerCase()
});
pos += match[0].length;
prefix = '';
continue;
}
match = HASH_PLACEHOLDER_RX.exec(input);
if (match) {
fields.push({
prefix: prefix,
placeholder: match[1].toLowerCase(),
width: parseInt(match[2] || 0, 10)
});
pos += match[0].length;
prefix = '';
continue;
}
}
prefix += char;
pos++;
}
return fields;
}
/**
* Returns a RegExp which, given the replacement fields returned by parseTemplate(),
* can match a file path against a path template.
*/
function createTemplateMatcher(fields) {
var length = fields.length;
var pattern = fields.reduce(function (pattern, field, i) {
if (i === 0) {
pattern = '^';
}
if (field.prefix) {
pattern += '(' + escapeRegExp(field.prefix) + ')';
}
if (field.placeholder) {
switch (field.placeholder) {
case 'hash':
case 'fullhash':
case 'chunkhash':
pattern += '[0-9a-fA-F]';
pattern += field.width ? '{1,' + field.width + '}' : '+';
break;
case 'id':
case 'name':
case 'file':
case 'filebase':
pattern += '.+?';
break;
case 'query':
pattern += '(?:\\?.+?)?';
break;
}
}
if (i === length - 1) {
pattern += '$';
}
return pattern;
}, '');
return new RegExp(pattern);
}

View File

@@ -0,0 +1,9 @@
'use strict';
var _ = require('lodash');
module.exports = function pluginError(message, previousError) {
var err = new Error('[AssetsWebpackPlugin] ' + message);
return previousError ? _.assign(err, previousError) : err;
};

216
spa/node_modules/assets-webpack-plugin/index.js generated vendored Normal file
View File

@@ -0,0 +1,216 @@
const fs = require('fs')
const path = require('path')
const _ = require('lodash')
const getAssetKind = require('./lib/getAssetKind')
const isHMRUpdate = require('./lib/isHMRUpdate')
const isSourceMap = require('./lib/isSourceMap')
const getDynamicImportedChildAssets = require('./lib/getDynamicImportedChildAssets')
const createQueuedWriter = require('./lib/output/createQueuedWriter')
const createOutputWriter = require('./lib/output/createOutputWriter')
function AssetsWebpackPlugin (options) {
this.options = _.merge({}, {
filename: 'webpack-assets.json',
prettyPrint: false,
update: false,
fullPath: true,
manifestFirst: true,
useCompilerPath: false,
fileTypes: ['js', 'css'],
includeAllFileTypes: true,
includeFilesWithoutChunk: false,
includeAuxiliaryAssets: false,
includeDynamicImportedAssets: false,
keepInMemory: false,
integrity: false,
removeFullPathAutoPrefix: false
}, options)
}
AssetsWebpackPlugin.prototype = {
constructor: AssetsWebpackPlugin,
apply: function (compiler) {
const self = this
self.options.path = path.resolve(
self.options.useCompilerPath
? (compiler.options.output.path || '.')
: (self.options.path || '.')
)
self.writer = createQueuedWriter(createOutputWriter(self.options))
const afterEmit = (compilation, callback) => {
const options = compiler.options
const stats = compilation.getStats().toJson({
hash: true,
publicPath: true,
assets: true,
chunks: false,
modules: false,
source: false,
errorDetails: false,
timings: false
})
let assetPath = (stats.publicPath && self.options.fullPath) ? stats.publicPath : ''
// assetsByChunkName contains a hash with the bundle names and the produced files
// e.g. { one: 'one-bundle.js', two: 'two-bundle.js' }
// in some cases (when using a plugin or source maps) it might contain an array of produced files
// e.g. {
// main:
// [ 'index-bundle-42b6e1ec4fa8c5f0303e.js',
// 'index-bundle-42b6e1ec4fa8c5f0303e.js.map' ]
// }
// starting with webpack 5, the public path is automatically determined when possible and the path is prefaced
// with `/auto/`, the `removeAutoPrefix` option can be set to turn this off
if (self.options.removeFullPathAutoPrefix) {
if (assetPath.startsWith('auto')) {
assetPath = assetPath.substring(4)
}
}
const seenAssets = {}
let chunks
if (self.options.entrypoints) {
chunks = Object.keys(stats.entrypoints)
if (self.options.includeFilesWithoutChunk) {
chunks.push('') // push "unnamed" chunk
}
} else {
chunks = Object.keys(stats.assetsByChunkName)
chunks.push('') // push "unnamed" chunk
}
const output = chunks.reduce(function (chunkMap, chunkName) {
let assets
if (self.options.entrypoints) {
assets = chunkName ? stats.entrypoints[chunkName].assets : stats.assets
} else {
assets = chunkName ? stats.assetsByChunkName[chunkName] : stats.assets
}
if (self.options.includeAuxiliaryAssets && chunkName && stats.entrypoints[chunkName].auxiliaryAssets) {
assets = [...assets, ...stats.entrypoints[chunkName].auxiliaryAssets]
}
if (self.options.includeDynamicImportedAssets && chunkName && stats.entrypoints[chunkName].children) {
const dynamicImportedChildAssets = getDynamicImportedChildAssets(options, stats.entrypoints[chunkName].children)
assets = [...assets, ...dynamicImportedChildAssets]
}
if (!Array.isArray(assets)) {
assets = [assets]
}
let added = false
const typeMap = assets.reduce(function (typeMap, obj) {
const asset = obj.name || obj
if (isHMRUpdate(options, asset) || isSourceMap(options, asset) || (!chunkName && seenAssets[asset])) {
return typeMap
}
const typeName = getAssetKind(options, asset)
if (self.options.includeAllFileTypes || self.options.fileTypes.includes(typeName)) {
const combinedPath = assetPath && assetPath.slice(-1) !== '/' ? `${assetPath}/${asset}` : assetPath + asset
const type = typeof typeMap[typeName]
const compilationAsset = compilation.assets[asset]
const integrity = compilationAsset && compilationAsset.integrity
const loadingBehavior = obj.loadingBehavior
if (type === 'undefined') {
typeMap[typeName] = combinedPath
if (self.options.integrity && integrity) {
typeMap[typeName + 'Integrity'] = integrity
}
} else {
if (type === 'string') {
typeMap[typeName] = [typeMap[typeName]]
}
if (self.options.includeDynamicImportedAssets && loadingBehavior) {
const typeNameWithLoadingBehavior = typeName + ':' + loadingBehavior
typeMap[typeNameWithLoadingBehavior] = typeMap[typeNameWithLoadingBehavior] || []
typeMap[typeNameWithLoadingBehavior].push(combinedPath)
} else {
typeMap[typeName].push(combinedPath)
}
}
added = true
seenAssets[asset] = true
}
return typeMap
}, {})
if (added) {
chunkMap[chunkName] = typeMap
}
return chunkMap
}, {})
let manifestNames = self.options.includeManifest === true ? ['manifest'] : self.options.includeManifest
if (typeof manifestNames === 'string') {
manifestNames = [manifestNames]
}
if (manifestNames) {
for (let i = 0; i < manifestNames.length; i++) {
const manifestName = manifestNames[i]
const manifestEntry = output[manifestName]
if (manifestEntry) {
let js = manifestEntry.js || manifestEntry.mjs
if (!Array.isArray(js)) {
js = [js]
}
const manifestAssetKey = js[js.length - 1].substr(assetPath.length)
const parentSource = compilation.assets[manifestAssetKey]
const entryText = parentSource.source()
if (!entryText) {
throw new Error('Could not locate manifest function in source', parentSource)
}
manifestEntry.text = entryText
}
}
}
if (self.options.metadata) {
output.metadata = self.options.metadata
}
if (!compiler.outputFileSystem.readFile) {
compiler.outputFileSystem.readFile = fs.readFile.bind(fs)
}
if (!compiler.outputFileSystem.join) {
compiler.outputFileSystem.join = path.join.bind(path)
}
self.writer(compiler.outputFileSystem, output, function (err) {
if (err) {
compilation.errors.push(err)
}
callback()
})
}
if (compiler.hooks) {
const plugin = { name: 'AssetsWebpackPlugin' }
compiler.hooks.afterEmit.tapAsync(plugin, afterEmit)
} else {
compiler.plugin('after-emit', afterEmit)
}
}
}
module.exports = AssetsWebpackPlugin

21
spa/node_modules/assets-webpack-plugin/license.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Zach Toben
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.

58
spa/node_modules/assets-webpack-plugin/package.json generated vendored Normal file
View File

@@ -0,0 +1,58 @@
{
"name": "assets-webpack-plugin",
"version": "7.0.0",
"description": "Emits a json file with assets paths",
"main": "dist/index.js",
"engines": {
"node": ">=10.x.x"
},
"scripts": {
"lint": "standard --verbose | snazzy",
"fix-lint": "standard --fix",
"test": "mocha test",
"build": "babel index.js --out-dir dist && babel lib --out-dir dist/lib",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
"url": "https://github.com/ztoben/assets-webpack-plugin.git"
},
"keywords": [
"webpack",
"plugin",
"generate",
"assets",
"hashes"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/ztoben/assets-webpack-plugin/issues"
},
"homepage": "https://github.com/ztoben/assets-webpack-plugin",
"files": [
"index.js",
"dist/"
],
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
"babel-preset-env": "1.7.0",
"chai": "4.2.0",
"css-loader": "5.0.1",
"mini-css-extract-plugin": "1.3.3",
"mocha": "8.2.1",
"rimraf": "3.0.2",
"snazzy": "9.0.0",
"standard": "16.0.3",
"style-loader": "2.0.0",
"webpack": "5.10.0"
},
"dependencies": {
"camelcase": "^6.0.0",
"escape-string-regexp": "^4.0.0",
"lodash": "^4.17.20"
},
"peerDependencies": {
"webpack": ">=5.0.0"
}
}

443
spa/node_modules/assets-webpack-plugin/readme.md generated vendored Normal file
View File

@@ -0,0 +1,443 @@
# assets-webpack-plugin
[![version](https://img.shields.io/npm/v/assets-webpack-plugin.svg)](https://npmjs.org/package/assets-webpack-plugin)
[![downloads](https://img.shields.io/npm/dt/assets-webpack-plugin.svg)](https://npmjs.org/package/assets-webpack-plugin)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/ztoben/assets-webpack-plugin.svg?branch=master)](https://travis-ci.org/ztoben/assets-webpack-plugin)
[![Build status](https://ci.appveyor.com/api/projects/status/sbchndv12vk45mo3?svg=true)](https://ci.appveyor.com/project/ztoben/assets-webpack-plugin)
Webpack plugin that emits a json file with assets paths.
## Table of Contents
* [Install](#install)
* [Why Is This Useful?](#why-is-this-useful)
* [Example output:](#example-output)
* [Configuration](#configuration)
* [Options](#options)
* [`filename`](#filename)
* [`fullPath`](#fullpath)
* [`removeFullPathAutoPrefix`](#removefullpathautoprefix)
* [`includeManifest`](#includemanifest)
* [`manifestFirst`](#manifestfirst)
* [`path`](#path)
* [`useCompilerPath`](#usecompilerpath)
* [`prettyPrint`](#prettyprint)
* [`processOutput`](#processoutput)
* [`update`](#update)
* [`metadata`](#metadata)
* [`includeAllFileTypes`](#includeallfileTtypes)
* [`fileTypes`](#filetypes)
* [`keepInMemory`](#keepinmemory)
* [`integrity`](#integrity)
* [`entrypoints`](#entrypoints)
* [`includeFilesWithoutChunk`](#includefileswithoutchunk)
* [Using in multi-compiler mode](#using-in-multi-compiler-mode)
* [Using this with Rails](#using-this-with-rails)
* [Using this with ASP.NET Core](#using-this-with-aspnet-core)
* [Test](#test)
## Install
⚠️ Starting with version 6, this plugin works with Webpack 5+.
If you are working with an older version of Webpack, you can use the most recent 5.x.x release (`5.1.2`).
```sh
npm install assets-webpack-plugin --save-dev
```
If you're using Webpack 4 or below:
```sh
npm install webpack-assets-manifest@5.1.2 --save-dev
```
## Why Is This Useful?
When working with Webpack you might want to generate your bundles with a generated hash in them (for cache busting).
This plug-in outputs a json file with the paths of the generated assets so you can find them from somewhere else.
### Example output:
The output is a JSON object in the form:
```json
{
"bundle_name": {
"asset_kind": "/public/path/to/asset"
}
}
```
Where:
* `"bundle_name"` is the name of the bundle (the key of the entry object in your webpack config, or "main" if your entry is an array).
* `"asset_kind"` is the camel-cased file extension of the asset
For example, given the following webpack config:
```js
{
entry: {
one: ['src/one.js'],
two: ['src/two.js']
},
output: {
path: path.join(__dirname, "public", "js"),
publicPath: "/js/",
filename: '[name]_[hash].bundle.js'
}
}
```
The plugin will output the following json file:
```json
{
"one": {
"js": "/js/one_2bb80372ebe8047a68d4.bundle.js"
},
"two": {
"js": "/js/two_2bb80372ebe8047a68d4.bundle.js"
}
}
```
## Configuration
In your webpack config include the plug-in. And add it to your config:
```js
var path = require('path')
var AssetsPlugin = require('assets-webpack-plugin')
var assetsPluginInstance = new AssetsPlugin()
module.exports = {
// ...
output: {
path: path.join(__dirname, "public", "js"),
filename: "[name]-bundle-[hash].js",
publicPath: "/js/"
},
// ....
plugins: [assetsPluginInstance]
}
```
### Options
You can pass the following options:
#### `filename`
Optional. `webpack-assets.json` by default.
Name for the created json file.
```js
new AssetsPlugin({filename: 'assets.json'})
```
#### `fullPath`
Optional. `true` by default.
If `false` the output will not include the full path
of the generated file.
```js
new AssetsPlugin({fullPath: false})
```
e.g.
`/public/path/bundle.js` vs `bundle.js`
#### `removeFullPathAutoPrefix`
Optional. `false` by default.
If `true` the full path will automatically be stripped of the `/auto/` prefix generated by webpack.
```js
new AssetsPlugin({removeFullPathAutoPrefix: true})
```
e.g.
`/public/path/bundle.js` vs `bundle.js`
#### `includeManifest`
Optional. `false` by default.
Inserts the manifest javascript as a `text` property in your assets.
Accepts the name or names of your manifest chunk. A manifest is the last CommonChunk that
only contains the webpack bootstrap code. This is useful for production
use when you want to inline the manifest in your HTML skeleton for long-term caching.
See [issue #1315](https://github.com/webpack/webpack/issues/1315)
or [a blog post](https://medium.com/@matt.krick/a-production-ready-realtime-saas-with-webpack-7b11ba2fa5b0#.p1vvfr3bm)
to learn more.
```js
new AssetsPlugin({includeManifest: 'manifest'})
// assets.json:
// {entries: {manifest: {js: `hashed_manifest.js`, text: 'function(modules)...'}}}
//
// Your html template:
// <script>
// {assets.entries.manifest.text}
// </script>
```
The `includeManifest` option also accepts an array of manifests:
```js
new AssetsPlugin({includeManifest: ['manifest1', 'manifest2']})
// assets.json:
// {entries: {
// manifest1: {js: `hashed_manifest.js`, text: 'function(modules)...'},
// manifest2: {js: `hashed_manifest.js`, text: 'function(modules)...'}
// }}
```
#### `manifestFirst`
Optional. `false` by default.
Orders the assets output so that manifest is the first entry. This is useful for cases where script tags are generated
from the assets json output, and order of import is important.
```js
new AssetsPlugin({manifestFirst: true})
```
#### `path`
Optional. Defaults to the current directory.
Path where to save the created JSON file. Will default to the highest level of the project unless useCompilerPath is specified.
```js
new AssetsPlugin({path: path.join(__dirname, 'app', 'views')})
```
#### `useCompilerPath`
```js
new AssetsPlugin({useCompilerPath: true})
```
Will override the path to use the compiler output path set in your webpack config.
#### `prettyPrint`
Optional. `false` by default.
Whether to format the JSON output for readability.
```js
new AssetsPlugin({prettyPrint: true})
```
#### `processOutput`
Optional. Defaults is JSON stringify function.
Formats the assets output.
```js
new AssetsPlugin({
processOutput: function (assets) {
return 'window.staticMap = ' + JSON.stringify(assets)
}
})
```
#### `update`
Optional. `false` by default.
When set to `true`, the output JSON file will be updated instead of overwritten.
```js
new AssetsPlugin({update: true})
```
#### `metadata`
Inject metadata into the output file. All values will be injected into the key "metadata".
```js
new AssetsPlugin({metadata: {version: 123}})
// Manifest will now contain:
// {
// metadata: {version: 123}
// }
```
#### `includeAllFileTypes`
Optional. `true` by default.
When set false, falls back to the `fileTypes` option array to decide which file types to include in the assets file.
```js
new AssetsPlugin({includeAllFileTypes: false})
```
#### `fileTypes`
Optional. `['js', 'css']` by default.
When set and `includeAllFileTypes` is set false, only assets matching these types will be included in the assets file.
```js
new AssetsPlugin({fileTypes: ['js', 'jpg']})
```
#### `keepInMemory`
Optional. `false` by default.
When set the assets file will only be generated in memory while running `webpack-dev-server` and not written to disk.
```js
new AssetsPlugin({keepInMemory: true})
```
#### `integrity`
Optional. `false` by default.
When set the output from [webpack-subresource-integrity](https://github.com/waysact/webpack-subresource-integrity) is included in the assets file.
Please make sure you have `webpack-subresource-integrity` installed and included in your webpack plugins.
```js
new AssetsPlugin({integrity: true})
```
Output will now look like this:
```json
{
"main": {
"js": "/bundle.js",
"jsIntegrity": "sha256-ANGwtktWN96nvBI/cjekdTvd0Dwf7SciIFTQ2lpTxGc= sha384-Ly439pF3K+J8hnhk1BEcjKnv1R9BApFYVIVJvr64PcgBjdT4N7hfPzQynItHwcaO"
},
"vendors~main": {
"js": "/1.bundle.js",
"jsIntegrity": "sha256-yqNi1hgeAdkXVOORgmVMeX+cbuXikoj6I8qWZjPegsA= sha384-4X75tnsGDwnwL5kBUPsx2ko9DeWy0xM8BcDQdoR185yho+OnxjjPXl2wCdebLWTG"
}
}
```
#### `entrypoints`
Optional. `false` by default.
If the 'entrypoints' option is given, the output will be limited to the entrypoints and the chunks associated with them.
```js
new AssetsPlugin({entrypoints: true})
```
#### `includeFilesWithoutChunk`
Optional. `false` by default.
When set and `entrypoints` is set true, will output any files that are part of the unnamed chunk to an additional unnamed ("") entry.
```js
new AssetsPlugin({includeFilesWithoutChunk: true})
```
#### `includeAuxiliaryAssets`
Optional. `false` by default.
When set, will output any files that are part of the chunk and marked as auxiliary assets.
```js
new AssetsPlugin({includeAuxiliaryAssets: true})
```
#### `includeDynamicImportedAssets`
Optional. `false` by default.
When set, will output any files that are part of the chunk and marked as preloadable or prefechtable child assets via a dynamic import.
See: https://webpack.js.org/guides/code-splitting/#prefetchingpreloading-modules
```js
new AssetsPlugin({includeDynamicImportedAssets: true})
```
### Using in multi-compiler mode
If you use webpack multi-compiler mode and want your assets written to a single file,
you __must__ use the same instance of the plugin in the different configurations.
For example:
```js
var webpack = require('webpack')
var AssetsPlugin = require('assets-webpack-plugin')
var assetsPluginInstance = new AssetsPlugin()
webpack([
{
entry: {one: 'src/one.js'},
output: {path: 'build', filename: 'one-bundle.js'},
plugins: [assetsPluginInstance]
},
{
entry: {two:'src/two.js'},
output: {path: 'build', filename: 'two-bundle.js'},
plugins: [assetsPluginInstance]
}
])
```
### Using this with Rails
You can use this with Rails to find the bundled Webpack assets via Sprockets.
In `ApplicationController` you might have:
```ruby
def script_for(bundle)
path = Rails.root.join('app', 'views', 'webpack-assets.json') # This is the file generated by the plug-in
file = File.read(path)
json = JSON.parse(file)
json[bundle]['js']
end
```
Then in the actions:
```ruby
def show
@script = script_for('clients') # this will retrieve the bundle named 'clients'
end
```
And finally in the views:
```erb
<div id="app">
<script src="<%= @script %>"></script>
</div>
```
### Using this with ASP.NET Core
You can use this with ASP.NET Core via the [WebpackTag](https://d.sb/webpacktag) library.
## Test
```sh
npm test
```