@ngtools/webpack 12.0.2 → 12.0.3
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 +2 -2
- package/src/ivy/plugin.js +3 -2
- package/src/resource_loader.d.ts +0 -1
- package/src/resource_loader.js +5 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngtools/webpack",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"description": "Webpack plugin that AoT compiles your Angular components and modules.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"webpack": "^5.30.0"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": "^12.14.1 ||
|
|
36
|
+
"node": "^12.14.1 || >=14.0.0",
|
|
37
37
|
"npm": "^6.11.0 || ^7.5.6",
|
|
38
38
|
"yarn": ">= 1.13.0"
|
|
39
39
|
}
|
package/src/ivy/plugin.js
CHANGED
|
@@ -171,8 +171,9 @@ class AngularWebpackPlugin {
|
|
|
171
171
|
if (internalFiles === null || internalFiles === void 0 ? void 0 : internalFiles.has(sourceFile)) {
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
|
-
// Ensure all program files are considered part of the compilation and will be watched
|
|
175
|
-
|
|
174
|
+
// Ensure all program files are considered part of the compilation and will be watched.
|
|
175
|
+
// Webpack does not normalize paths. Therefore, we need to normalize the path with FS seperators.
|
|
176
|
+
compilation.fileDependencies.add(paths_1.externalizePath(sourceFile.fileName));
|
|
176
177
|
// Add all non-declaration files to the initial set of unused files. The set will be
|
|
177
178
|
// analyzed and pruned after all Webpack modules are finished building.
|
|
178
179
|
if (!sourceFile.isDeclarationFile) {
|
package/src/resource_loader.d.ts
CHANGED
package/src/resource_loader.js
CHANGED
|
@@ -21,7 +21,6 @@ class WebpackResourceLoader {
|
|
|
21
21
|
this.outputPathCounter = 1;
|
|
22
22
|
if (shouldCache) {
|
|
23
23
|
this.fileCache = new Map();
|
|
24
|
-
this.inlineCache = new Map();
|
|
25
24
|
this.assetCache = new Map();
|
|
26
25
|
}
|
|
27
26
|
}
|
|
@@ -70,12 +69,14 @@ class WebpackResourceLoader {
|
|
|
70
69
|
setAffectedResources(file, resources) {
|
|
71
70
|
this._reverseDependencies.set(file, new Set(resources));
|
|
72
71
|
}
|
|
73
|
-
async _compile(filePath, data, mimeType, resourceType,
|
|
72
|
+
async _compile(filePath, data, mimeType, resourceType, containingFile) {
|
|
74
73
|
if (!this._parentCompilation) {
|
|
75
74
|
throw new Error('WebpackResourceLoader cannot be used without parentCompilation');
|
|
76
75
|
}
|
|
77
76
|
// Create a special URL for reading the resource from memory
|
|
78
|
-
const entry = data
|
|
77
|
+
const entry = data
|
|
78
|
+
? `angular-resource:${resourceType},${crypto_1.createHash('md5').update(data).digest('hex')}`
|
|
79
|
+
: filePath;
|
|
79
80
|
if (!entry) {
|
|
80
81
|
throw new Error(`"filePath" or "data" must be specified.`);
|
|
81
82
|
}
|
|
@@ -245,18 +246,10 @@ class WebpackResourceLoader {
|
|
|
245
246
|
return compilationResult.content;
|
|
246
247
|
}
|
|
247
248
|
async process(data, mimeType, resourceType, containingFile) {
|
|
248
|
-
var _a;
|
|
249
249
|
if (data.trim().length === 0) {
|
|
250
250
|
return '';
|
|
251
251
|
}
|
|
252
|
-
const
|
|
253
|
-
let compilationResult = (_a = this.inlineCache) === null || _a === void 0 ? void 0 : _a.get(cacheKey);
|
|
254
|
-
if (compilationResult === undefined) {
|
|
255
|
-
compilationResult = await this._compile(undefined, data, mimeType, resourceType, cacheKey, containingFile);
|
|
256
|
-
if (this.inlineCache && compilationResult.success) {
|
|
257
|
-
this.inlineCache.set(cacheKey, compilationResult);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
252
|
+
const compilationResult = await this._compile(undefined, data, mimeType, resourceType, containingFile);
|
|
260
253
|
return compilationResult.content;
|
|
261
254
|
}
|
|
262
255
|
}
|