@angular-devkit/build-angular 12.0.0-rc.0 → 12.0.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/README.md +14 -13
- package/package.json +24 -24
- package/plugins/karma.d.ts +1 -1
- package/plugins/karma.js +1 -1
- package/src/app-shell/index.d.ts +7 -0
- package/src/app-shell/index.js +9 -7
- package/src/app-shell/schema.json +1 -4
- package/src/babel/babel-loader.d.ts +2 -1
- package/src/babel/presets/application.d.ts +7 -0
- package/src/babel/presets/application.js +3 -3
- package/src/babel/webpack-loader.d.ts +7 -0
- package/src/babel/webpack-loader.js +6 -5
- package/src/babel-bazel.d.ts +2 -1
- package/src/browser/index.d.ts +1 -1
- package/src/browser/index.js +34 -33
- package/src/browser/schema.d.ts +1 -5
- package/src/browser/schema.json +11 -57
- package/src/browser/tests/setup.d.ts +1 -1
- package/src/browser/tests/setup.js +7 -0
- package/src/dev-server/index.d.ts +1 -1
- package/src/dev-server/index.js +22 -15
- package/src/dev-server/schema.json +1 -3
- package/src/dev-server/tests/execute-fetch.d.ts +1 -1
- package/src/dev-server/tests/execute-fetch.js +4 -4
- package/src/dev-server/tests/setup.d.ts +7 -0
- package/src/dev-server/tests/setup.js +7 -0
- package/src/extract-i18n/index.d.ts +1 -1
- package/src/extract-i18n/index.js +10 -12
- package/src/extract-i18n/ivy-extract-loader.d.ts +7 -0
- package/src/extract-i18n/ivy-extract-loader.js +7 -6
- package/src/extract-i18n/schema.json +2 -14
- package/src/index.d.ts +6 -6
- package/src/index.js +1 -1
- package/src/karma/find-tests.d.ts +7 -0
- package/src/karma/find-tests.js +4 -4
- package/src/karma/index.d.ts +1 -1
- package/src/karma/index.js +21 -13
- package/src/karma/schema.json +7 -28
- package/src/ng-packagr/index.d.ts +1 -1
- package/src/ng-packagr/index.js +4 -4
- package/src/ng-packagr/schema.json +1 -3
- package/src/protractor/index.d.ts +1 -1
- package/src/protractor/index.js +8 -8
- package/src/protractor/schema.json +1 -3
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +6 -6
- package/src/server/schema.d.ts +1 -5
- package/src/server/schema.json +7 -35
- package/src/test-utils.d.ts +1 -1
- package/src/test-utils.js +4 -4
- package/src/testing/builder-harness.d.ts +2 -2
- package/src/testing/builder-harness.js +10 -8
- package/src/testing/file-watching.d.ts +1 -1
- package/src/testing/file-watching.js +7 -0
- package/src/testing/index.d.ts +1 -1
- package/src/testing/index.js +7 -0
- package/src/testing/jasmine-helpers.d.ts +2 -2
- package/src/testing/jasmine-helpers.js +7 -0
- package/src/transforms.d.ts +1 -1
- package/src/transforms.js +7 -0
- package/src/tslint/index.d.ts +7 -0
- package/src/tslint/index.js +10 -12
- package/src/tslint/schema.json +1 -1
- package/src/typings.d.ts +2 -1
- package/src/utils/action-cache.d.ts +7 -0
- package/src/utils/action-cache.js +6 -8
- package/src/utils/action-executor.d.ts +7 -0
- package/src/utils/action-executor.js +13 -28
- package/src/utils/build-browser-features.d.ts +1 -1
- package/src/utils/build-browser-features.js +3 -7
- package/src/utils/build-options.d.ts +1 -2
- package/src/utils/build-options.js +1 -1
- package/src/utils/bundle-calculator.d.ts +7 -0
- package/src/utils/bundle-calculator.js +32 -31
- package/src/utils/cache-path.d.ts +7 -0
- package/src/utils/cache-path.js +3 -3
- package/src/utils/check-port.d.ts +7 -0
- package/src/utils/check-port.js +4 -4
- package/src/utils/color.d.ts +1 -1
- package/src/utils/color.js +3 -3
- package/src/utils/copy-assets.d.ts +7 -0
- package/src/utils/copy-assets.js +3 -3
- package/src/utils/copy-file.d.ts +2 -2
- package/src/utils/copy-file.js +4 -4
- package/src/utils/default-progress.d.ts +1 -1
- package/src/utils/default-progress.js +1 -1
- package/src/utils/delete-output-dir.d.ts +7 -0
- package/src/utils/delete-output-dir.js +3 -3
- package/src/utils/empty.js +0 -1
- package/src/utils/environment-options.d.ts +7 -0
- package/src/utils/environment-options.js +3 -3
- package/src/utils/find-up.d.ts +7 -0
- package/src/utils/find-up.js +3 -3
- package/src/utils/i18n-inlining.d.ts +1 -1
- package/src/utils/i18n-inlining.js +8 -1
- package/src/utils/i18n-options.d.ts +1 -1
- package/src/utils/i18n-options.js +11 -3
- package/src/utils/index-file/augment-index-html.d.ts +1 -1
- package/src/utils/index-file/augment-index-html.js +6 -11
- package/src/utils/index-file/html-rewriting-stream.d.ts +1 -1
- package/src/utils/index-file/html-rewriting-stream.js +2 -2
- package/src/utils/index-file/index-html-generator.d.ts +1 -1
- package/src/utils/index-file/index-html-generator.js +7 -11
- package/src/utils/index-file/inline-critical-css.d.ts +1 -1
- package/src/utils/index-file/inline-critical-css.js +1 -1
- package/src/utils/index-file/inline-fonts.d.ts +1 -1
- package/src/utils/index-file/inline-fonts.js +18 -19
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.js +1 -1
- package/src/utils/is-directory.d.ts +1 -1
- package/src/utils/is-directory.js +2 -3
- package/src/utils/load-translations.d.ts +7 -0
- package/src/utils/load-translations.js +9 -19
- package/src/utils/normalize-asset-patterns.d.ts +1 -1
- package/src/utils/normalize-asset-patterns.js +6 -7
- package/src/utils/normalize-builder-schema.d.ts +1 -1
- package/src/utils/normalize-builder-schema.js +5 -6
- package/src/utils/normalize-file-replacements.d.ts +1 -1
- package/src/utils/normalize-file-replacements.js +2 -3
- package/src/utils/normalize-optimization.d.ts +1 -1
- package/src/utils/normalize-optimization.js +12 -8
- package/src/utils/normalize-source-maps.d.ts +1 -1
- package/src/utils/normalize-source-maps.js +3 -3
- package/src/utils/output-paths.d.ts +7 -0
- package/src/utils/output-paths.js +7 -4
- package/src/utils/package-chunk-sort.d.ts +1 -1
- package/src/utils/package-chunk-sort.js +10 -3
- package/src/utils/process-bundle-bootstrap.js +3 -2
- package/src/utils/process-bundle.d.ts +2 -2
- package/src/utils/process-bundle.js +31 -40
- package/src/utils/read-tsconfig.d.ts +1 -1
- package/src/utils/read-tsconfig.js +2 -4
- package/src/utils/run-module-as-observable-fork.d.ts +1 -1
- package/src/utils/run-module-as-observable-fork.js +9 -2
- package/src/utils/run-module-worker.js +1 -3
- package/src/utils/service-worker.d.ts +1 -1
- package/src/utils/service-worker.js +3 -3
- package/src/utils/spinner.d.ts +1 -1
- package/src/utils/spinner.js +1 -1
- package/src/utils/strip-bom.d.ts +1 -1
- package/src/utils/strip-bom.js +2 -3
- package/src/utils/tty.d.ts +1 -1
- package/src/utils/tty.js +1 -1
- package/src/utils/url.d.ts +1 -1
- package/src/utils/url.js +1 -1
- package/src/utils/version.d.ts +1 -1
- package/src/utils/version.js +3 -3
- package/src/utils/webpack-browser-config.d.ts +1 -1
- package/src/utils/webpack-browser-config.js +9 -2
- package/src/utils/webpack-diagnostics.d.ts +2 -2
- package/src/utils/webpack-diagnostics.js +4 -4
- package/src/utils/workers.d.ts +1 -1
- package/src/utils/workers.js +1 -1
- package/src/webpack/configs/browser.d.ts +7 -0
- package/src/webpack/configs/browser.js +3 -3
- package/src/webpack/configs/common.d.ts +7 -0
- package/src/webpack/configs/common.js +16 -19
- package/src/webpack/configs/dev-server.d.ts +1 -1
- package/src/webpack/configs/dev-server.js +7 -6
- package/src/webpack/configs/index.d.ts +1 -1
- package/src/webpack/configs/index.js +7 -7
- package/src/webpack/configs/server.d.ts +7 -0
- package/src/webpack/configs/server.js +4 -4
- package/src/webpack/configs/stats.d.ts +1 -1
- package/src/webpack/configs/stats.js +1 -1
- package/src/webpack/configs/styles.d.ts +7 -0
- package/src/webpack/configs/styles.js +6 -10
- package/src/webpack/configs/test.d.ts +1 -1
- package/src/webpack/configs/test.js +2 -5
- package/src/webpack/configs/typescript.d.ts +7 -0
- package/src/webpack/configs/typescript.js +4 -6
- package/src/webpack/configs/worker.d.ts +7 -0
- package/src/webpack/configs/worker.js +3 -3
- package/src/webpack/es5-jit-polyfills.js +2 -1
- package/src/webpack/es5-polyfills.js +2 -3
- package/src/webpack/jit-polyfills.js +2 -1
- package/src/webpack/plugins/analytics.d.ts +2 -2
- package/src/webpack/plugins/analytics.js +9 -9
- package/src/webpack/plugins/any-component-style-budget-checker.d.ts +1 -1
- package/src/webpack/plugins/any-component-style-budget-checker.js +3 -9
- package/src/webpack/plugins/builder-watch-plugin.d.ts +1 -1
- package/src/webpack/plugins/builder-watch-plugin.js +7 -0
- package/src/webpack/plugins/common-js-usage-warn-plugin.d.ts +1 -1
- package/src/webpack/plugins/common-js-usage-warn-plugin.js +10 -10
- package/src/webpack/plugins/dedupe-module-resolve-plugin.d.ts +1 -1
- package/src/webpack/plugins/dedupe-module-resolve-plugin.js +9 -2
- package/src/webpack/plugins/hmr/hmr-accept.d.ts +1 -1
- package/src/webpack/plugins/hmr/hmr-accept.js +6 -9
- package/src/webpack/plugins/hmr/hmr-loader.d.ts +1 -1
- package/src/webpack/plugins/hmr/hmr-loader.js +2 -2
- package/src/webpack/plugins/index-html-webpack-plugin.d.ts +7 -0
- package/src/webpack/plugins/index-html-webpack-plugin.js +6 -6
- package/src/webpack/plugins/index.d.ts +2 -2
- package/src/webpack/plugins/index.js +1 -1
- package/src/webpack/plugins/karma/karma-context.html +31 -30
- package/src/webpack/plugins/karma/karma-debug.html +34 -33
- package/src/webpack/plugins/karma/karma.d.ts +7 -0
- package/src/webpack/plugins/karma/karma.js +13 -11
- package/src/webpack/plugins/optimize-css-webpack-plugin.d.ts +7 -0
- package/src/webpack/plugins/optimize-css-webpack-plugin.js +18 -11
- package/src/webpack/plugins/postcss-cli-resources.d.ts +7 -0
- package/src/webpack/plugins/postcss-cli-resources.js +11 -9
- package/src/webpack/plugins/remove-hash-plugin.d.ts +1 -1
- package/src/webpack/plugins/remove-hash-plugin.js +9 -4
- package/src/webpack/plugins/scripts-webpack-plugin.d.ts +1 -1
- package/src/webpack/plugins/scripts-webpack-plugin.js +11 -10
- package/src/webpack/plugins/single-test-transform.d.ts +1 -1
- package/src/webpack/plugins/single-test-transform.js +5 -5
- package/src/webpack/plugins/suppress-entry-chunks-webpack-plugin.d.ts +1 -1
- package/src/webpack/plugins/suppress-entry-chunks-webpack-plugin.js +1 -1
- package/src/webpack/utils/async-chunks.d.ts +1 -1
- package/src/webpack/utils/async-chunks.js +9 -1
- package/src/webpack/utils/helpers.d.ts +1 -1
- package/src/webpack/utils/helpers.js +2 -2
- package/src/webpack/utils/stats.d.ts +1 -1
- package/src/webpack/utils/stats.js +39 -33
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
const path = require("path");
|
|
4
11
|
const glob = require("glob");
|
|
@@ -18,13 +25,13 @@ function addKarmaFiles(files, newFiles, prepend = false) {
|
|
|
18
25
|
const defaults = {
|
|
19
26
|
included: true,
|
|
20
27
|
served: true,
|
|
21
|
-
watched: true
|
|
28
|
+
watched: true,
|
|
22
29
|
};
|
|
23
30
|
const processedFiles = newFiles
|
|
24
31
|
// Remove globs that do not match any files, otherwise Karma will show a warning for these.
|
|
25
|
-
.filter(file => glob.sync(file.pattern, { nodir: true }).length != 0)
|
|
32
|
+
.filter((file) => glob.sync(file.pattern, { nodir: true }).length != 0)
|
|
26
33
|
// Fill in pattern properties with defaults.
|
|
27
|
-
.map(file => ({ ...defaults, ...file }));
|
|
34
|
+
.map((file) => ({ ...defaults, ...file }));
|
|
28
35
|
// It's important to not replace the array, because
|
|
29
36
|
// karma already has a reference to the existing array.
|
|
30
37
|
if (prepend) {
|
|
@@ -53,7 +60,7 @@ const init = (config, emitter) => {
|
|
|
53
60
|
const ksmsPath = path.dirname(require.resolve('karma-source-map-support'));
|
|
54
61
|
addKarmaFiles(config.files, [
|
|
55
62
|
{ pattern: path.join(smsPath, 'browser-source-map-support.js'), watched: false },
|
|
56
|
-
{ pattern: path.join(ksmsPath, 'client.js'), watched: false }
|
|
63
|
+
{ pattern: path.join(ksmsPath, 'client.js'), watched: false },
|
|
57
64
|
], true);
|
|
58
65
|
}
|
|
59
66
|
config.reporters.unshift('@angular-devkit/build-angular--event-reporter');
|
|
@@ -101,11 +108,6 @@ const init = (config, emitter) => {
|
|
|
101
108
|
config.beforeMiddleware.push('@angular-devkit/build-angular--blocker');
|
|
102
109
|
config.middleware = config.middleware || [];
|
|
103
110
|
config.middleware.push('@angular-devkit/build-angular--fallback');
|
|
104
|
-
// The webpack tier owns the watch behavior so we want to force it in the config.
|
|
105
|
-
// When not in watch mode, webpack-dev-middleware will call `compiler.watch` anyway.
|
|
106
|
-
// https://github.com/webpack/webpack-dev-middleware/blob/698c9ae5e9bb9a013985add6189ff21c1a1ec185/src/index.js#L65
|
|
107
|
-
// https://github.com/webpack/webpack/blob/cde1b73e12eb8a77eb9ba42e7920c9ec5d29c2c9/lib/Compiler.js#L379-L388
|
|
108
|
-
webpackConfig.watch = true;
|
|
109
111
|
if (config.singleRun) {
|
|
110
112
|
// There's no option to turn off file watching in webpack-dev-server, but
|
|
111
113
|
// we can override the file watcher instead.
|
|
@@ -136,7 +138,7 @@ const init = (config, emitter) => {
|
|
|
136
138
|
logger.error(stats_1.statsErrorsToString(statsJson, { colors: true }));
|
|
137
139
|
// Notify potential listeners of the compile error.
|
|
138
140
|
emitter.emit('compile_error', {
|
|
139
|
-
errors: (_a = statsJson.errors) === null || _a === void 0 ? void 0 : _a.map(e => e.message),
|
|
141
|
+
errors: (_a = statsJson.errors) === null || _a === void 0 ? void 0 : _a.map((e) => e.message),
|
|
140
142
|
});
|
|
141
143
|
// Finish Karma run early in case of compilation error.
|
|
142
144
|
emitter.emit('run_complete', [], { exitCode: 1 });
|
|
@@ -294,5 +296,5 @@ module.exports = {
|
|
|
294
296
|
'reporter:@angular-devkit/build-angular--sourcemap-reporter': ['type', sourceMapReporter],
|
|
295
297
|
'reporter:@angular-devkit/build-angular--event-reporter': ['type', eventReporter],
|
|
296
298
|
'middleware:@angular-devkit/build-angular--blocker': ['factory', requestBlocker],
|
|
297
|
-
'middleware:@angular-devkit/build-angular--fallback': ['factory', fallbackMiddleware]
|
|
299
|
+
'middleware:@angular-devkit/build-angular--fallback': ['factory', fallbackMiddleware],
|
|
298
300
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Compiler } from 'webpack';
|
|
2
9
|
export interface OptimizeCssWebpackPluginOptions {
|
|
3
10
|
sourceMap: boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OptimizeCssWebpackPlugin = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.OptimizeCssWebpackPlugin = void 0;
|
|
11
11
|
const cssNano = require("cssnano");
|
|
12
12
|
const webpack_1 = require("webpack");
|
|
13
13
|
const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
|
|
@@ -17,14 +17,14 @@ function hook(compiler, action) {
|
|
|
17
17
|
compilation.hooks.processAssets.tapPromise({
|
|
18
18
|
name: PLUGIN_NAME,
|
|
19
19
|
stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
20
|
-
}, assets => action(compilation, Object.keys(assets)));
|
|
20
|
+
}, (assets) => action(compilation, Object.keys(assets)));
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
class OptimizeCssWebpackPlugin {
|
|
24
24
|
constructor(options) {
|
|
25
25
|
this._options = {
|
|
26
26
|
sourceMap: false,
|
|
27
|
-
test: file => file.endsWith('.css'),
|
|
27
|
+
test: (file) => file.endsWith('.css'),
|
|
28
28
|
...options,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -32,14 +32,14 @@ class OptimizeCssWebpackPlugin {
|
|
|
32
32
|
hook(compiler, (compilation, assetsURI) => {
|
|
33
33
|
const files = [...compilation.additionalChunkAssets, ...assetsURI];
|
|
34
34
|
const actions = files
|
|
35
|
-
.filter(file => this._options.test(file))
|
|
35
|
+
.filter((file) => this._options.test(file))
|
|
36
36
|
.map(async (file) => {
|
|
37
37
|
const asset = compilation.assets[file];
|
|
38
38
|
if (!asset) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
let content;
|
|
42
|
-
//
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
43
|
let map;
|
|
44
44
|
if (this._options.sourceMap && asset.sourceAndMap) {
|
|
45
45
|
const sourceAndMap = asset.sourceAndMap({});
|
|
@@ -56,12 +56,17 @@ class OptimizeCssWebpackPlugin {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
const cssNanoOptions = {
|
|
59
|
-
preset: [
|
|
59
|
+
preset: [
|
|
60
|
+
'default',
|
|
61
|
+
{
|
|
60
62
|
// Disable SVG optimizations, as this can cause optimizations which are not compatible in all browsers.
|
|
61
63
|
svgo: false,
|
|
62
64
|
// Disable `calc` optimizations, due to several issues. #16910, #16875, #17890
|
|
63
65
|
calc: false,
|
|
64
|
-
|
|
66
|
+
// Disable CSS rules sorted due to several issues #20693, https://github.com/ionic-team/ionic-framework/issues/23266 and https://github.com/cssnano/cssnano/issues/1054
|
|
67
|
+
cssDeclarationSorter: false,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
65
70
|
};
|
|
66
71
|
const postCssOptions = {
|
|
67
72
|
from: file,
|
|
@@ -70,8 +75,9 @@ class OptimizeCssWebpackPlugin {
|
|
|
70
75
|
try {
|
|
71
76
|
const output = await new Promise((resolve, reject) => {
|
|
72
77
|
// @types/cssnano are not up to date with version 5.
|
|
73
|
-
//
|
|
74
|
-
cssNano(cssNanoOptions)
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
cssNano(cssNanoOptions)
|
|
80
|
+
.process(content, postCssOptions)
|
|
75
81
|
.then(resolve)
|
|
76
82
|
.catch((err) => reject(err));
|
|
77
83
|
});
|
|
@@ -92,6 +98,7 @@ class OptimizeCssWebpackPlugin {
|
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
94
100
|
});
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
95
102
|
return Promise.all(actions).then(() => { });
|
|
96
103
|
});
|
|
97
104
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Plugin } from 'postcss';
|
|
2
9
|
export interface PostcssCliResourcesOptions {
|
|
3
10
|
baseHref?: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postcss = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.postcss = void 0;
|
|
11
11
|
const loader_utils_1 = require("loader-utils");
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const url = require("url");
|
|
14
14
|
function wrapUrl(url) {
|
|
15
15
|
let wrappedUrl;
|
|
16
|
-
const hasSingleQuotes = url.indexOf('
|
|
16
|
+
const hasSingleQuotes = url.indexOf("'") >= 0;
|
|
17
17
|
if (hasSingleQuotes) {
|
|
18
18
|
wrappedUrl = `"${url}"`;
|
|
19
19
|
}
|
|
@@ -74,8 +74,10 @@ function default_1(options) {
|
|
|
74
74
|
reject(err);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
let outputPath = loader_utils_1.interpolateName({ resourcePath: result }, filename(result), {
|
|
78
|
-
|
|
77
|
+
let outputPath = loader_utils_1.interpolateName({ resourcePath: result }, filename(result), {
|
|
78
|
+
content,
|
|
79
|
+
context: loader.context || loader.rootContext,
|
|
80
|
+
}).replace(/\\|\//g, '-');
|
|
79
81
|
if (resourcesOutputPath) {
|
|
80
82
|
outputPath = path.posix.join(resourcesOutputPath, outputPath);
|
|
81
83
|
}
|
|
@@ -111,9 +113,9 @@ function default_1(options) {
|
|
|
111
113
|
let modified = false;
|
|
112
114
|
// We want to load it relative to the file that imports
|
|
113
115
|
const inputFile = decl.source && decl.source.input.file;
|
|
114
|
-
const context = inputFile && path.dirname(inputFile) || loader.context;
|
|
115
|
-
//
|
|
116
|
-
while (match = urlRegex.exec(value)) {
|
|
116
|
+
const context = (inputFile && path.dirname(inputFile)) || loader.context;
|
|
117
|
+
// eslint-disable-next-line no-cond-assign
|
|
118
|
+
while ((match = urlRegex.exec(value))) {
|
|
117
119
|
const originalUrl = match[1] || match[2] || match[3];
|
|
118
120
|
let processedUrl;
|
|
119
121
|
try {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.RemoveHashPlugin = void 0;
|
|
4
11
|
class RemoveHashPlugin {
|
|
@@ -6,16 +13,14 @@ class RemoveHashPlugin {
|
|
|
6
13
|
this.options = options;
|
|
7
14
|
}
|
|
8
15
|
apply(compiler) {
|
|
9
|
-
compiler.hooks.compilation.tap('remove-hash-plugin', compilation => {
|
|
16
|
+
compiler.hooks.compilation.tap('remove-hash-plugin', (compilation) => {
|
|
10
17
|
const assetPath = (path, data) => {
|
|
11
18
|
var _a;
|
|
12
19
|
const chunkName = (_a = data.chunk) === null || _a === void 0 ? void 0 : _a.name;
|
|
13
20
|
const { chunkNames, hashFormat } = this.options;
|
|
14
21
|
if (chunkName && (chunkNames === null || chunkNames === void 0 ? void 0 : chunkNames.includes(chunkName))) {
|
|
15
22
|
// Replace hash formats with empty strings.
|
|
16
|
-
return path
|
|
17
|
-
.replace(hashFormat.chunk, '')
|
|
18
|
-
.replace(hashFormat.extract, '');
|
|
23
|
+
return path.replace(hashFormat.chunk, '').replace(hashFormat.extract, '');
|
|
19
24
|
}
|
|
20
25
|
return path;
|
|
21
26
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -21,7 +21,6 @@ class ScriptsWebpackPlugin {
|
|
|
21
21
|
constructor(options) {
|
|
22
22
|
this.options = options;
|
|
23
23
|
}
|
|
24
|
-
// tslint:disable-next-line: no-any
|
|
25
24
|
async shouldSkip(compilation, scripts) {
|
|
26
25
|
if (this._lastBuildTime == undefined) {
|
|
27
26
|
this._lastBuildTime = Date.now();
|
|
@@ -34,7 +33,7 @@ class ScriptsWebpackPlugin {
|
|
|
34
33
|
reject(error);
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
|
-
resolve(
|
|
36
|
+
resolve(entry && typeof entry !== 'string' ? entry.safeTime : undefined);
|
|
38
37
|
});
|
|
39
38
|
});
|
|
40
39
|
if (!scriptTime || scriptTime > this._lastBuildTime) {
|
|
@@ -55,7 +54,7 @@ class ScriptsWebpackPlugin {
|
|
|
55
54
|
chunk.addGroup(entrypoint);
|
|
56
55
|
compilation.entrypoints.set(this.options.name, entrypoint);
|
|
57
56
|
compilation.chunks.add(chunk);
|
|
58
|
-
//
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
58
|
compilation.assets[filename] = source;
|
|
60
59
|
compilation.hooks.chunkAsset.call(chunk, filename);
|
|
61
60
|
}
|
|
@@ -64,9 +63,9 @@ class ScriptsWebpackPlugin {
|
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
66
65
|
const scripts = this.options.scripts
|
|
67
|
-
.filter(script => !!script)
|
|
68
|
-
.map(script => path.resolve(this.options.basePath || '', script));
|
|
69
|
-
compiler.hooks.thisCompilation.tap('scripts-webpack-plugin', compilation => {
|
|
66
|
+
.filter((script) => !!script)
|
|
67
|
+
.map((script) => path.resolve(this.options.basePath || '', script));
|
|
68
|
+
compiler.hooks.thisCompilation.tap('scripts-webpack-plugin', (compilation) => {
|
|
70
69
|
compilation.hooks.additionalAssets.tapPromise('scripts-webpack-plugin', async () => {
|
|
71
70
|
if (await this.shouldSkip(compilation, scripts)) {
|
|
72
71
|
if (this._cachedOutput) {
|
|
@@ -75,7 +74,7 @@ class ScriptsWebpackPlugin {
|
|
|
75
74
|
addDependencies(compilation, scripts);
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
|
-
const sourceGetters = scripts.map(fullPath => {
|
|
77
|
+
const sourceGetters = scripts.map((fullPath) => {
|
|
79
78
|
return new Promise((resolve, reject) => {
|
|
80
79
|
compilation.inputFileSystem.readFile(fullPath, (err, data) => {
|
|
81
80
|
var _a;
|
|
@@ -102,12 +101,14 @@ class ScriptsWebpackPlugin {
|
|
|
102
101
|
});
|
|
103
102
|
const sources = await Promise.all(sourceGetters);
|
|
104
103
|
const concatSource = new webpack_1.sources.ConcatSource();
|
|
105
|
-
sources.forEach(source => {
|
|
104
|
+
sources.forEach((source) => {
|
|
106
105
|
concatSource.add(source);
|
|
107
106
|
concatSource.add('\n;');
|
|
108
107
|
});
|
|
109
108
|
const combinedSource = new webpack_1.sources.CachedSource(concatSource);
|
|
110
|
-
const filename = loader_utils_1.interpolateName({ resourcePath: 'scripts.js' }, this.options.filename, {
|
|
109
|
+
const filename = loader_utils_1.interpolateName({ resourcePath: 'scripts.js' }, this.options.filename, {
|
|
110
|
+
content: combinedSource.source(),
|
|
111
|
+
});
|
|
111
112
|
const output = { filename, source: combinedSource };
|
|
112
113
|
this._insertOutput(compilation, output);
|
|
113
114
|
this._cachedOutput = output;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SingleTestTransformLoader = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SingleTestTransformLoader = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const loader_utils_1 = require("loader-utils");
|
|
13
13
|
const path_1 = require("path");
|
|
@@ -25,7 +25,7 @@ exports.SingleTestTransformLoader = __filename;
|
|
|
25
25
|
* Then it adds import statements for each file in the files options
|
|
26
26
|
* array to import them directly, and thus run the tests there.
|
|
27
27
|
*/
|
|
28
|
-
//
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
function loader(source) {
|
|
30
30
|
const { files = [], logger = console } = loader_utils_1.getOptions(this);
|
|
31
31
|
// signal the user that expected content is not present.
|
|
@@ -36,7 +36,7 @@ function loader(source) {
|
|
|
36
36
|
return source;
|
|
37
37
|
}
|
|
38
38
|
const targettedImports = files
|
|
39
|
-
.map(path => `require('./${path.replace('.' + path_1.extname(path), '')}');`)
|
|
39
|
+
.map((path) => `require('./${path.replace('.' + path_1.extname(path), '')}');`)
|
|
40
40
|
.join('\n');
|
|
41
41
|
const mockedRequireContext = 'Object.assign(() => { }, { keys: () => [], resolve: () => undefined });\n';
|
|
42
42
|
source = source.replace(/require\.context\(.*/, mockedRequireContext + targettedImports);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.markAsyncChunksNonInitial = void 0;
|
|
4
11
|
/**
|
|
@@ -17,7 +24,8 @@ function markAsyncChunksNonInitial(webpackStats, extraEntryPoints) {
|
|
|
17
24
|
.filter((entryPoint) => !entryPoint.inject)
|
|
18
25
|
.flatMap((entryPoint) => entryPoints[entryPoint.bundleName].chunks);
|
|
19
26
|
// Find chunks for each ID.
|
|
20
|
-
const asyncChunks = asyncChunkIds
|
|
27
|
+
const asyncChunks = asyncChunkIds
|
|
28
|
+
.map((chunkId) => {
|
|
21
29
|
const chunk = chunks.find((chunk) => chunk.id === chunkId);
|
|
22
30
|
if (!chunk) {
|
|
23
31
|
throw new Error(`Failed to find chunk (${chunkId}) in set:\n${JSON.stringify(chunks)}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -33,7 +33,7 @@ function getOutputHashFormat(option, length = 20) {
|
|
|
33
33
|
}
|
|
34
34
|
exports.getOutputHashFormat = getOutputHashFormat;
|
|
35
35
|
function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
|
|
36
|
-
return extraEntryPoints.map(entry => {
|
|
36
|
+
return extraEntryPoints.map((entry) => {
|
|
37
37
|
if (typeof entry === 'string') {
|
|
38
38
|
return { input: entry, inject: true, bundleName: defaultBundleName };
|
|
39
39
|
}
|