webpack-assets-manifest 5.0.6 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/WebpackAssetsManifest.js +19 -13
- package/src/helpers.js +4 -6
- package/src/options-schema.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-assets-manifest",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "This Webpack plugin will generate a JSON file that matches the original filename with the hashed version.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -65,30 +65,30 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/lodash.get": "^4.4.6",
|
|
67
67
|
"@types/lodash.has": "^4.5.6",
|
|
68
|
-
"@types/node": "^
|
|
68
|
+
"@types/node": "^17.0.8",
|
|
69
69
|
"@types/tapable": "^2.2.2",
|
|
70
|
-
"@types/webpack-sources": "^2.
|
|
71
|
-
"@webdeveric/eslint-config": "^0.
|
|
70
|
+
"@types/webpack-sources": "^3.2.0",
|
|
71
|
+
"@webdeveric/eslint-config": "^0.2.3",
|
|
72
72
|
"chai": "^4.3.0",
|
|
73
73
|
"chai-spies": "^1.0.0",
|
|
74
74
|
"compression-webpack-plugin": "^7.1.2",
|
|
75
75
|
"copy-webpack-plugin": "^8.1.1",
|
|
76
|
-
"cspell": "^5.
|
|
76
|
+
"cspell": "^5.5.2",
|
|
77
77
|
"css-loader": "^5.2.4",
|
|
78
|
-
"eslint": "^7.
|
|
78
|
+
"eslint": "^7.26.0",
|
|
79
79
|
"file-loader": "^6.2.0",
|
|
80
80
|
"fs-extra": "^9.1.0",
|
|
81
81
|
"husky": "^6.0.0",
|
|
82
82
|
"lint-staged": "^10.5.4",
|
|
83
83
|
"memory-fs": "^0.5.0",
|
|
84
|
-
"mini-css-extract-plugin": "^1.
|
|
84
|
+
"mini-css-extract-plugin": "^1.6.0",
|
|
85
85
|
"mkdirp": "^1.0.4",
|
|
86
|
-
"mocha": "^8.
|
|
86
|
+
"mocha": "^8.4.0",
|
|
87
87
|
"nyc": "^15.1.0",
|
|
88
88
|
"rimraf": "^3.0.2",
|
|
89
89
|
"superagent": "^6.1.0",
|
|
90
|
-
"typescript": "^4.2
|
|
91
|
-
"webpack": "^5.
|
|
90
|
+
"typescript": "^4.4.2",
|
|
91
|
+
"webpack": "^5.66.0",
|
|
92
92
|
"webpack-dev-server": "^3.11.2",
|
|
93
93
|
"webpack-subresource-integrity": "^1.5.2"
|
|
94
94
|
}
|
|
@@ -151,7 +151,7 @@ class WebpackAssetsManifest
|
|
|
151
151
|
replacer: null, // Its easier to use the transform hook instead.
|
|
152
152
|
space: 2,
|
|
153
153
|
writeToDisk: 'auto',
|
|
154
|
-
fileExtRegex: /\.\w{2,4}\.(?:map|gz)$|\.\w+$/i,
|
|
154
|
+
fileExtRegex: /\.\w{2,4}\.(?:map|gz|br)$|\.\w+$/i,
|
|
155
155
|
sortManifest: true,
|
|
156
156
|
merge: false,
|
|
157
157
|
publicPath: null,
|
|
@@ -172,6 +172,9 @@ class WebpackAssetsManifest
|
|
|
172
172
|
integrity: false,
|
|
173
173
|
integrityHashes: [ 'sha256', 'sha384', 'sha512' ],
|
|
174
174
|
integrityPropertyName: 'integrity',
|
|
175
|
+
|
|
176
|
+
// Store arbitrary data here for use in customize/transform
|
|
177
|
+
extra: Object.create(null),
|
|
175
178
|
};
|
|
176
179
|
}
|
|
177
180
|
|
|
@@ -386,7 +389,7 @@ class WebpackAssetsManifest
|
|
|
386
389
|
|
|
387
390
|
const deepmerge = require('deepmerge');
|
|
388
391
|
|
|
389
|
-
const arrayMerge = (
|
|
392
|
+
const arrayMerge = (_destArray, srcArray) => srcArray;
|
|
390
393
|
|
|
391
394
|
for ( const [ key, oldValue ] of Object.entries( data ) ) {
|
|
392
395
|
if ( this.has( key ) ) {
|
|
@@ -451,25 +454,28 @@ class WebpackAssetsManifest
|
|
|
451
454
|
handleProcessAssetsAnalyse( compilation /* , assets */ )
|
|
452
455
|
{
|
|
453
456
|
const { contextRelativeKeys } = this.options;
|
|
457
|
+
const { assetsInfo, chunkGraph, chunks, compiler, codeGenerationResults } = compilation;
|
|
454
458
|
|
|
455
|
-
for (
|
|
456
|
-
const modules =
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
459
|
+
for (const chunk of chunks) {
|
|
460
|
+
const modules = chunkGraph.getChunkModulesIterableBySourceType(chunk, 'asset');
|
|
461
|
+
|
|
462
|
+
if (modules) {
|
|
463
|
+
for (const module of modules) {
|
|
464
|
+
const codeGenData = codeGenerationResults.get(module, chunk.runtime).data;
|
|
460
465
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
466
|
+
const {
|
|
467
|
+
assetInfo = codeGenData.get('assetInfo'),
|
|
468
|
+
filename = codeGenData.get('filename'),
|
|
469
|
+
} = module.buildInfo;
|
|
464
470
|
|
|
465
471
|
const info = Object.assign(
|
|
466
472
|
{
|
|
467
|
-
sourceFilename: path.relative(
|
|
473
|
+
sourceFilename: path.relative(compiler.context, module.userRequest),
|
|
468
474
|
},
|
|
469
475
|
assetInfo,
|
|
470
476
|
);
|
|
471
477
|
|
|
472
|
-
|
|
478
|
+
assetsInfo.set(filename, info);
|
|
473
479
|
|
|
474
480
|
this.assetNames.set(
|
|
475
481
|
contextRelativeKeys ?
|
|
@@ -835,7 +841,7 @@ class WebpackAssetsManifest
|
|
|
835
841
|
return true;
|
|
836
842
|
}
|
|
837
843
|
|
|
838
|
-
return
|
|
844
|
+
return get(this, 'compiler.outputFileSystem.constructor.name') === 'MemoryFileSystem';
|
|
839
845
|
}
|
|
840
846
|
|
|
841
847
|
/**
|
package/src/helpers.js
CHANGED
|
@@ -72,7 +72,7 @@ function filterHashes( hashes )
|
|
|
72
72
|
/**
|
|
73
73
|
* See {@link https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity|Subresource Integrity} at MDN
|
|
74
74
|
*
|
|
75
|
-
* @param {
|
|
75
|
+
* @param {string[]} hashes - The algorithms you want to use when hashing `content`
|
|
76
76
|
* @param {string} content - File contents you want to hash
|
|
77
77
|
* @return {string} SRI hash
|
|
78
78
|
*/
|
|
@@ -88,14 +88,12 @@ function getSRIHash( hashes, content )
|
|
|
88
88
|
/**
|
|
89
89
|
* Get the data type of an argument.
|
|
90
90
|
*
|
|
91
|
-
* @param {*}
|
|
91
|
+
* @param {*} input - Some variable
|
|
92
92
|
* @return {string} Data type
|
|
93
93
|
*/
|
|
94
|
-
function varType(
|
|
94
|
+
function varType( input )
|
|
95
95
|
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return type;
|
|
96
|
+
return Object.prototype.toString.call(input).slice(8, -1);
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
/**
|
package/src/options-schema.json
CHANGED