@angular-devkit/build-angular 14.0.5 → 14.0.6

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.0.5",
3
+ "version": "14.0.6",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.2.0",
10
- "@angular-devkit/architect": "0.1400.5",
11
- "@angular-devkit/build-webpack": "0.1400.5",
12
- "@angular-devkit/core": "14.0.5",
10
+ "@angular-devkit/architect": "0.1400.6",
11
+ "@angular-devkit/build-webpack": "0.1400.6",
12
+ "@angular-devkit/core": "14.0.6",
13
13
  "@babel/core": "7.17.10",
14
14
  "@babel/generator": "7.17.10",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
@@ -20,7 +20,7 @@
20
20
  "@babel/runtime": "7.17.9",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.7",
23
- "@ngtools/webpack": "14.0.5",
23
+ "@ngtools/webpack": "14.0.6",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.5",
26
26
  "babel-plugin-istanbul": "6.1.1",
@@ -35,6 +35,10 @@ const loader_utils_1 = require("loader-utils");
35
35
  const path = __importStar(require("path"));
36
36
  const webpack_1 = require("webpack");
37
37
  const Entrypoint = require('webpack/lib/Entrypoint');
38
+ /**
39
+ * The name of the plugin provided to Webpack when tapping Webpack compiler hooks.
40
+ */
41
+ const PLUGIN_NAME = 'scripts-webpack-plugin';
38
42
  function addDependencies(compilation, scripts) {
39
43
  for (const script of scripts) {
40
44
  compilation.fileDependencies.add(script);
@@ -88,8 +92,8 @@ class ScriptsWebpackPlugin {
88
92
  const scripts = this.options.scripts
89
93
  .filter((script) => !!script)
90
94
  .map((script) => path.resolve(this.options.basePath || '', script));
91
- compiler.hooks.thisCompilation.tap('scripts-webpack-plugin', (compilation) => {
92
- compilation.hooks.additionalAssets.tapPromise('scripts-webpack-plugin', async () => {
95
+ compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
96
+ compilation.hooks.additionalAssets.tapPromise(PLUGIN_NAME, async () => {
93
97
  if (await this.shouldSkip(compilation, scripts)) {
94
98
  if (this._cachedOutput) {
95
99
  this._insertOutput(compilation, this._cachedOutput, true);
@@ -129,14 +133,24 @@ class ScriptsWebpackPlugin {
129
133
  concatSource.add('\n;');
130
134
  });
131
135
  const combinedSource = new webpack_1.sources.CachedSource(concatSource);
132
- const filename = (0, loader_utils_1.interpolateName)({ resourcePath: 'scripts.js' }, this.options.filename, {
133
- content: combinedSource.source(),
134
- });
135
- const output = { filename, source: combinedSource };
136
+ const output = { filename: this.options.filename, source: combinedSource };
136
137
  this._insertOutput(compilation, output);
137
138
  this._cachedOutput = output;
138
139
  addDependencies(compilation, scripts);
139
140
  });
141
+ compilation.hooks.processAssets.tapPromise({
142
+ name: PLUGIN_NAME,
143
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING,
144
+ }, async () => {
145
+ const assetName = this.options.filename;
146
+ const asset = compilation.getAsset(assetName);
147
+ if (asset) {
148
+ const interpolatedFilename = (0, loader_utils_1.interpolateName)({ resourcePath: 'scripts.js' }, assetName, { content: asset.source.source() });
149
+ if (assetName !== interpolatedFilename) {
150
+ compilation.renameAsset(assetName, interpolatedFilename);
151
+ }
152
+ }
153
+ });
140
154
  });
141
155
  }
142
156
  }