@angular-devkit/build-angular 14.1.0-next.3 → 14.1.0-next.4
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 +8 -8
- package/src/builders/app-shell/index.js +1 -1
- package/src/builders/browser/index.d.ts +1 -1
- package/src/builders/browser/index.js +5 -7
- package/src/builders/browser-esbuild/index.js +5 -1
- package/src/builders/browser-esbuild/stylesheets.d.ts +1 -1
- package/src/builders/karma/find-tests.js +2 -0
- package/src/utils/copy-assets.js +5 -4
- package/src/webpack/plugins/common-js-usage-warn-plugin.js +6 -1
- package/src/webpack/utils/helpers.d.ts +1 -1
- package/src/webpack/utils/helpers.js +3 -3
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "14.1.0-next.
|
|
3
|
+
"version": "14.1.0-next.4",
|
|
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.1401.0-next.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1401.0-next.
|
|
12
|
-
"@angular-devkit/core": "14.1.0-next.
|
|
10
|
+
"@angular-devkit/architect": "0.1401.0-next.4",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1401.0-next.4",
|
|
12
|
+
"@angular-devkit/core": "14.1.0-next.4",
|
|
13
13
|
"@babel/core": "7.18.6",
|
|
14
14
|
"@babel/generator": "7.18.7",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.18.6",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@babel/runtime": "7.18.6",
|
|
21
21
|
"@babel/template": "7.18.6",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "14.1.0-next.
|
|
23
|
+
"@ngtools/webpack": "14.1.0-next.4",
|
|
24
24
|
"ansi-colors": "4.1.3",
|
|
25
25
|
"babel-loader": "8.2.5",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"copy-webpack-plugin": "11.0.0",
|
|
30
30
|
"critters": "0.0.16",
|
|
31
31
|
"css-loader": "6.7.1",
|
|
32
|
-
"esbuild-wasm": "0.14.
|
|
32
|
+
"esbuild-wasm": "0.14.48",
|
|
33
33
|
"glob": "8.0.3",
|
|
34
34
|
"https-proxy-agent": "5.0.1",
|
|
35
35
|
"inquirer": "8.2.4",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"tslib": "2.4.0",
|
|
66
66
|
"webpack": "5.73.0",
|
|
67
67
|
"webpack-dev-middleware": "5.3.3",
|
|
68
|
-
"webpack-dev-server": "4.9.
|
|
68
|
+
"webpack-dev-server": "4.9.3",
|
|
69
69
|
"webpack-merge": "5.8.0",
|
|
70
70
|
"webpack-subresource-integrity": "5.1.0"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"esbuild": "0.14.
|
|
73
|
+
"esbuild": "0.14.48"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@angular/compiler-cli": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
|
|
@@ -96,7 +96,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
96
96
|
}
|
|
97
97
|
await fs.promises.writeFile(outputIndexPath, html);
|
|
98
98
|
if (browserOptions.serviceWorker) {
|
|
99
|
-
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath, baseHref, browserOptions.ngswConfigPath);
|
|
99
|
+
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath, baseHref !== null && baseHref !== void 0 ? baseHref : '/', browserOptions.ngswConfigPath);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return browserResult;
|
|
@@ -118,9 +118,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
118
118
|
}), (0, operators_1.switchMap)(
|
|
119
119
|
// eslint-disable-next-line max-lines-per-function
|
|
120
120
|
({ config, projectRoot, projectSourceRoot, i18n, target, cacheOptions }) => {
|
|
121
|
-
var _a;
|
|
122
121
|
const normalizedOptimization = (0, utils_1.normalizeOptimization)(options.optimization);
|
|
123
|
-
const defaultBaseHref = (_a = options.baseHref) !== null && _a !== void 0 ? _a : '/';
|
|
124
122
|
return (0, build_webpack_1.runWebpack)(config, context, {
|
|
125
123
|
webpackFactory: require('webpack'),
|
|
126
124
|
logging: transforms.logging ||
|
|
@@ -130,7 +128,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
130
128
|
}
|
|
131
129
|
}),
|
|
132
130
|
}).pipe((0, operators_1.concatMap)(async (buildEvent) => {
|
|
133
|
-
var _a, _b, _c, _d, _e, _f;
|
|
131
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
134
132
|
const spinner = new spinner_1.Spinner();
|
|
135
133
|
spinner.enabled = options.progress !== false;
|
|
136
134
|
const { success, emittedFiles = [], outputPath: webpackOutputPath } = buildEvent;
|
|
@@ -220,7 +218,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
220
218
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
221
219
|
try {
|
|
222
220
|
const { content, warnings, errors } = await indexHtmlGenerator.process({
|
|
223
|
-
baseHref: getLocaleBaseHref(i18n, locale)
|
|
221
|
+
baseHref: (_f = getLocaleBaseHref(i18n, locale)) !== null && _f !== void 0 ? _f : options.baseHref,
|
|
224
222
|
// i18nLocale is used when Ivy is disabled
|
|
225
223
|
lang: locale || undefined,
|
|
226
224
|
outputPath,
|
|
@@ -256,7 +254,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
256
254
|
spinner.start('Generating service worker...');
|
|
257
255
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
258
256
|
try {
|
|
259
|
-
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, context.workspaceRoot, outputPath, (
|
|
257
|
+
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, context.workspaceRoot, outputPath, (_h = (_g = getLocaleBaseHref(i18n, locale)) !== null && _g !== void 0 ? _g : options.baseHref) !== null && _h !== void 0 ? _h : '/', options.ngswConfigPath);
|
|
260
258
|
}
|
|
261
259
|
catch (error) {
|
|
262
260
|
spinner.fail('Service worker generation failed.');
|
|
@@ -280,11 +278,11 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
280
278
|
return ({
|
|
281
279
|
locale,
|
|
282
280
|
path,
|
|
283
|
-
baseHref: (_a = getLocaleBaseHref(i18n, locale)) !== null && _a !== void 0 ? _a :
|
|
281
|
+
baseHref: (_a = getLocaleBaseHref(i18n, locale)) !== null && _a !== void 0 ? _a : options.baseHref,
|
|
284
282
|
});
|
|
285
283
|
})) || {
|
|
286
284
|
path: baseOutputPath,
|
|
287
|
-
baseHref:
|
|
285
|
+
baseHref: options.baseHref,
|
|
288
286
|
},
|
|
289
287
|
})));
|
|
290
288
|
}));
|
|
@@ -263,7 +263,11 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
263
263
|
{
|
|
264
264
|
workspaceRoot,
|
|
265
265
|
optimization: !!optimizationOptions.styles.minify,
|
|
266
|
-
sourcemap:
|
|
266
|
+
sourcemap:
|
|
267
|
+
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
|
|
268
|
+
// the same as being disabled. Disabling has the advantage of avoiding the overhead
|
|
269
|
+
// of sourcemap processing.
|
|
270
|
+
!!sourcemapOptions.styles && (sourcemapOptions.hidden ? false : 'inline'),
|
|
267
271
|
outputNames,
|
|
268
272
|
}),
|
|
269
273
|
],
|
|
@@ -10,7 +10,7 @@ export interface BundleStylesheetOptions {
|
|
|
10
10
|
workspaceRoot?: string;
|
|
11
11
|
optimization: boolean;
|
|
12
12
|
preserveSymlinks?: boolean;
|
|
13
|
-
sourcemap: boolean | 'external';
|
|
13
|
+
sourcemap: boolean | 'external' | 'inline';
|
|
14
14
|
outputNames?: {
|
|
15
15
|
bundles?: string;
|
|
16
16
|
media?: string;
|
package/src/utils/copy-assets.js
CHANGED
|
@@ -37,17 +37,18 @@ exports.copyAssets = void 0;
|
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const glob_1 = __importDefault(require("glob"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
40
|
+
const util_1 = require("util");
|
|
41
|
+
const globPromise = (0, util_1.promisify)(glob_1.default);
|
|
43
42
|
async function copyAssets(entries, basePaths, root, changed) {
|
|
44
43
|
const defaultIgnore = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'];
|
|
45
44
|
for (const entry of entries) {
|
|
46
45
|
const cwd = path.resolve(root, entry.input);
|
|
47
|
-
const files = await
|
|
46
|
+
const files = await globPromise(entry.glob, {
|
|
48
47
|
cwd,
|
|
49
48
|
dot: true,
|
|
50
49
|
nodir: true,
|
|
50
|
+
root: cwd,
|
|
51
|
+
nomount: true,
|
|
51
52
|
ignore: entry.ignore ? defaultIgnore.concat(entry.ignore) : defaultIgnore,
|
|
52
53
|
follow: entry.followSymlinks,
|
|
53
54
|
});
|
|
@@ -12,7 +12,9 @@ const path_1 = require("path");
|
|
|
12
12
|
const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
|
|
13
13
|
// Webpack doesn't export these so the deep imports can potentially break.
|
|
14
14
|
const AMDDefineDependency = require('webpack/lib/dependencies/AMDDefineDependency');
|
|
15
|
+
const CommonJsExportsDependency = require('webpack/lib/dependencies/CommonJsExportsDependency');
|
|
15
16
|
const CommonJsRequireDependency = require('webpack/lib/dependencies/CommonJsRequireDependency');
|
|
17
|
+
const CommonJsSelfReferenceDependency = require('webpack/lib/dependencies/CommonJsSelfReferenceDependency');
|
|
16
18
|
class CommonJsUsageWarnPlugin {
|
|
17
19
|
constructor(options = {}) {
|
|
18
20
|
this.options = options;
|
|
@@ -81,7 +83,10 @@ class CommonJsUsageWarnPlugin {
|
|
|
81
83
|
}
|
|
82
84
|
hasCommonJsDependencies(compilation, dependencies, checkParentModules = false) {
|
|
83
85
|
for (const dep of dependencies) {
|
|
84
|
-
if (dep instanceof CommonJsRequireDependency ||
|
|
86
|
+
if (dep instanceof CommonJsRequireDependency ||
|
|
87
|
+
dep instanceof CommonJsExportsDependency ||
|
|
88
|
+
dep instanceof CommonJsSelfReferenceDependency ||
|
|
89
|
+
dep instanceof AMDDefineDependency) {
|
|
85
90
|
return true;
|
|
86
91
|
}
|
|
87
92
|
if (checkParentModules) {
|
|
@@ -21,7 +21,7 @@ export declare function getOutputHashFormat(outputHashing?: OutputHashing, lengt
|
|
|
21
21
|
export declare type NormalizedEntryPoint = Required<Exclude<ScriptElement | StyleElement, string>>;
|
|
22
22
|
export declare function normalizeExtraEntryPoints(extraEntryPoints: (ScriptElement | StyleElement)[], defaultBundleName: string): NormalizedEntryPoint[];
|
|
23
23
|
export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
|
|
24
|
-
export declare function getInstrumentationExcludedPaths(
|
|
24
|
+
export declare function getInstrumentationExcludedPaths(root: string, excludedPaths: string[]): Set<string>;
|
|
25
25
|
export declare function getCacheSettings(wco: WebpackConfigOptions, angularVersion: string): WebpackOptionsNormalized['cache'];
|
|
26
26
|
export declare function globalScriptsByBundleName(root: string, scripts: ScriptElement[]): {
|
|
27
27
|
bundleName: string;
|
|
@@ -121,12 +121,12 @@ function assetNameTemplateFactory(hashFormat) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
exports.assetNameTemplateFactory = assetNameTemplateFactory;
|
|
124
|
-
function getInstrumentationExcludedPaths(
|
|
124
|
+
function getInstrumentationExcludedPaths(root, excludedPaths) {
|
|
125
125
|
const excluded = new Set();
|
|
126
126
|
for (const excludeGlob of excludedPaths) {
|
|
127
127
|
glob_1.default
|
|
128
|
-
.sync(excludeGlob, { nodir: true, cwd:
|
|
129
|
-
.forEach((p) => excluded.add(path.join(
|
|
128
|
+
.sync(excludeGlob, { nodir: true, cwd: root, root, nomount: true })
|
|
129
|
+
.forEach((p) => excluded.add(path.join(root, p)));
|
|
130
130
|
}
|
|
131
131
|
return excluded;
|
|
132
132
|
}
|