@angular-devkit/build-angular 13.0.0-rc.1 → 13.1.0-next.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 +30 -30
- package/src/babel/presets/application.d.ts +8 -0
- package/src/babel/presets/application.js +18 -0
- package/src/babel/webpack-loader.d.ts +9 -0
- package/src/babel/webpack-loader.js +15 -24
- package/src/builders/browser/index.js +0 -4
- package/src/builders/browser/schema.json +1 -1
- package/src/builders/dev-server/index.js +0 -4
- package/src/builders/extract-i18n/index.js +11 -14
- package/src/builders/karma/index.d.ts +2 -2
- package/src/builders/karma/index.js +1 -7
- package/src/builders/server/index.js +1 -7
- package/src/sass/sass-service.js +2 -2
- package/src/sass/worker.js +0 -1
- package/src/utils/action-executor.js +4 -5
- package/src/utils/build-options.d.ts +0 -2
- package/src/utils/i18n-inlining.js +18 -2
- package/src/utils/normalize-optimization.js +2 -4
- package/src/webpack/configs/common.js +133 -156
- package/src/webpack/configs/dev-server.d.ts +2 -2
- package/src/webpack/configs/index.d.ts +0 -6
- package/src/webpack/configs/index.js +0 -6
- package/src/webpack/configs/styles.d.ts +2 -2
- package/src/webpack/plugins/index.d.ts +2 -0
- package/src/webpack/plugins/index.js +5 -1
- package/src/webpack/plugins/json-stats-plugin.d.ts +13 -0
- package/src/webpack/plugins/json-stats-plugin.js +54 -0
- package/src/webpack/{configs/worker.d.ts → plugins/progress-plugin.d.ts} +4 -3
- package/src/webpack/plugins/progress-plugin.js +38 -0
- package/src/webpack/{configs/browser.d.ts → plugins/typescript.d.ts} +2 -2
- package/src/webpack/{configs → plugins}/typescript.js +5 -24
- package/src/webpack/utils/helpers.d.ts +16 -5
- package/src/webpack/utils/helpers.js +174 -34
- package/src/webpack/utils/stats.js +1 -2
- package/src/webpack/configs/browser.js +0 -81
- package/src/webpack/configs/server.d.ts +0 -14
- package/src/webpack/configs/server.js +0 -72
- package/src/webpack/configs/stats.d.ts +0 -38
- package/src/webpack/configs/stats.js +0 -53
- package/src/webpack/configs/test.d.ts +0 -10
- package/src/webpack/configs/test.js +0 -98
- package/src/webpack/configs/typescript.d.ts +0 -12
- package/src/webpack/configs/worker.js +0 -22
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.createIvyPlugin = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const webpack_1 = require("@ngtools/webpack");
|
|
13
13
|
const typescript_1 = require("typescript");
|
|
@@ -22,6 +22,9 @@ function ensureIvy(wco) {
|
|
|
22
22
|
wco.tsConfig.options.enableIvy = true;
|
|
23
23
|
}
|
|
24
24
|
function createIvyPlugin(wco, aot, tsconfig) {
|
|
25
|
+
if (aot) {
|
|
26
|
+
ensureIvy(wco);
|
|
27
|
+
}
|
|
25
28
|
const { buildOptions } = wco;
|
|
26
29
|
const optimize = buildOptions.optimization.scripts;
|
|
27
30
|
const compilerOptions = {
|
|
@@ -69,26 +72,4 @@ function createIvyPlugin(wco, aot, tsconfig) {
|
|
|
69
72
|
inlineStyleFileExtension,
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
|
|
73
|
-
const { buildOptions: { aot = false, main, polyfills }, tsConfigPath, } = wco;
|
|
74
|
-
if (main || polyfills) {
|
|
75
|
-
ensureIvy(wco);
|
|
76
|
-
return {
|
|
77
|
-
module: {
|
|
78
|
-
rules: [
|
|
79
|
-
{
|
|
80
|
-
test: /\.[jt]sx?$/,
|
|
81
|
-
loader: webpack_1.AngularWebpackLoaderPath,
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
plugins: [createIvyPlugin(wco, aot, tsConfigPath)],
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
return {};
|
|
89
|
-
}
|
|
90
|
-
exports.getTypeScriptConfig = getTypeScriptConfig;
|
|
91
|
-
function getTypescriptWorkerPlugin(wco, workerTsConfigPath) {
|
|
92
|
-
return createIvyPlugin(wco, false, workerTsConfigPath);
|
|
93
|
-
}
|
|
94
|
-
exports.getTypescriptWorkerPlugin = getTypescriptWorkerPlugin;
|
|
75
|
+
exports.createIvyPlugin = createIvyPlugin;
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import type { ObjectPattern } from 'copy-webpack-plugin';
|
|
9
|
+
import type { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
10
|
+
import { AssetPatternClass, ExtraEntryPoint, ExtraEntryPointClass } from '../../builders/browser/schema';
|
|
11
|
+
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
10
12
|
export interface HashFormat {
|
|
11
13
|
chunk: string;
|
|
12
14
|
extract: string;
|
|
@@ -16,7 +18,16 @@ export interface HashFormat {
|
|
|
16
18
|
export declare function getOutputHashFormat(option: string, length?: number): HashFormat;
|
|
17
19
|
export declare type NormalizedEntryPoint = Required<ExtraEntryPointClass>;
|
|
18
20
|
export declare function normalizeExtraEntryPoints(extraEntryPoints: ExtraEntryPoint[], defaultBundleName: string): NormalizedEntryPoint[];
|
|
19
|
-
export declare function getSourceMapDevTool(scriptsSourceMap: boolean | undefined, stylesSourceMap: boolean | undefined, hiddenSourceMap?: boolean, inlineSourceMap?: boolean): SourceMapDevToolPlugin;
|
|
20
|
-
export declare function isPolyfillsEntry(name: string): boolean;
|
|
21
|
-
export declare function getWatchOptions(poll: number | undefined): NonNullable<Configuration['watchOptions']>;
|
|
22
21
|
export declare function assetNameTemplateFactory(hashFormat: HashFormat): (resourcePath: string) => string;
|
|
22
|
+
export declare function getInstrumentationExcludedPaths(sourceRoot: string, excludedPaths: string[]): Set<string>;
|
|
23
|
+
export declare function getCacheSettings(wco: WebpackConfigOptions, supportedBrowsers: string[], angularVersion: string): WebpackOptionsNormalized['cache'];
|
|
24
|
+
export declare function globalScriptsByBundleName(root: string, scripts: ExtraEntryPoint[]): {
|
|
25
|
+
bundleName: string;
|
|
26
|
+
inject: boolean;
|
|
27
|
+
paths: string[];
|
|
28
|
+
}[];
|
|
29
|
+
export declare function assetPatterns(root: string, assets: AssetPatternClass[]): ObjectPattern[];
|
|
30
|
+
export declare function externalizePackages(context: string, request: string | undefined, callback: (error?: Error, result?: string) => void): void;
|
|
31
|
+
declare type WebpackStatsOptions = Exclude<Configuration['stats'], string | boolean>;
|
|
32
|
+
export declare function getStatsOptions(verbose?: boolean): WebpackStatsOptions;
|
|
33
|
+
export {};
|
|
@@ -25,10 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
__setModuleDefault(result, mod);
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
28
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
32
|
+
exports.getStatsOptions = exports.externalizePackages = exports.assetPatterns = exports.globalScriptsByBundleName = exports.getCacheSettings = exports.getInstrumentationExcludedPaths = exports.assetNameTemplateFactory = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
|
|
33
|
+
const crypto_1 = require("crypto");
|
|
34
|
+
const fs_1 = require("fs");
|
|
35
|
+
const glob_1 = __importDefault(require("glob"));
|
|
30
36
|
const path = __importStar(require("path"));
|
|
31
|
-
const webpack_1 = require("webpack");
|
|
32
37
|
function getOutputHashFormat(option, length = 20) {
|
|
33
38
|
const hashFormats = {
|
|
34
39
|
none: { chunk: '', extract: '', file: '', script: '' },
|
|
@@ -70,38 +75,6 @@ function normalizeExtraEntryPoints(extraEntryPoints, defaultBundleName) {
|
|
|
70
75
|
});
|
|
71
76
|
}
|
|
72
77
|
exports.normalizeExtraEntryPoints = normalizeExtraEntryPoints;
|
|
73
|
-
function getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, hiddenSourceMap = false, inlineSourceMap = false) {
|
|
74
|
-
const include = [];
|
|
75
|
-
if (scriptsSourceMap) {
|
|
76
|
-
include.push(/js$/);
|
|
77
|
-
}
|
|
78
|
-
if (stylesSourceMap) {
|
|
79
|
-
include.push(/css$/);
|
|
80
|
-
}
|
|
81
|
-
return new webpack_1.SourceMapDevToolPlugin({
|
|
82
|
-
filename: inlineSourceMap ? undefined : '[file].map',
|
|
83
|
-
include,
|
|
84
|
-
// We want to set sourceRoot to `webpack:///` for non
|
|
85
|
-
// inline sourcemaps as otherwise paths to sourcemaps will be broken in browser
|
|
86
|
-
// `webpack:///` is needed for Visual Studio breakpoints to work properly as currently
|
|
87
|
-
// there is no way to set the 'webRoot'
|
|
88
|
-
sourceRoot: 'webpack:///',
|
|
89
|
-
moduleFilenameTemplate: '[resource-path]',
|
|
90
|
-
append: hiddenSourceMap ? false : undefined,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
exports.getSourceMapDevTool = getSourceMapDevTool;
|
|
94
|
-
function isPolyfillsEntry(name) {
|
|
95
|
-
return name === 'polyfills';
|
|
96
|
-
}
|
|
97
|
-
exports.isPolyfillsEntry = isPolyfillsEntry;
|
|
98
|
-
function getWatchOptions(poll) {
|
|
99
|
-
return {
|
|
100
|
-
poll,
|
|
101
|
-
ignored: poll === undefined ? '**/$_lazy_route_resources' : 'node_modules/**',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
exports.getWatchOptions = getWatchOptions;
|
|
105
78
|
function assetNameTemplateFactory(hashFormat) {
|
|
106
79
|
const visitedFiles = new Map();
|
|
107
80
|
return (resourcePath) => {
|
|
@@ -126,3 +99,170 @@ function assetNameTemplateFactory(hashFormat) {
|
|
|
126
99
|
};
|
|
127
100
|
}
|
|
128
101
|
exports.assetNameTemplateFactory = assetNameTemplateFactory;
|
|
102
|
+
function getInstrumentationExcludedPaths(sourceRoot, excludedPaths) {
|
|
103
|
+
const excluded = new Set();
|
|
104
|
+
for (const excludeGlob of excludedPaths) {
|
|
105
|
+
glob_1.default
|
|
106
|
+
.sync(path.join(sourceRoot, excludeGlob), { nodir: true })
|
|
107
|
+
.forEach((p) => excluded.add(path.normalize(p)));
|
|
108
|
+
}
|
|
109
|
+
return excluded;
|
|
110
|
+
}
|
|
111
|
+
exports.getInstrumentationExcludedPaths = getInstrumentationExcludedPaths;
|
|
112
|
+
function getCacheSettings(wco, supportedBrowsers, angularVersion) {
|
|
113
|
+
const { enabled, path: cacheDirectory } = wco.buildOptions.cache;
|
|
114
|
+
if (enabled) {
|
|
115
|
+
const packageVersion = require('../../../package.json').version;
|
|
116
|
+
return {
|
|
117
|
+
type: 'filesystem',
|
|
118
|
+
cacheDirectory: path.join(cacheDirectory, 'angular-webpack'),
|
|
119
|
+
maxMemoryGenerations: 1,
|
|
120
|
+
// We use the versions and build options as the cache name. The Webpack configurations are too
|
|
121
|
+
// dynamic and shared among different build types: test, build and serve.
|
|
122
|
+
// None of which are "named".
|
|
123
|
+
name: (0, crypto_1.createHash)('sha1')
|
|
124
|
+
.update(angularVersion)
|
|
125
|
+
.update(packageVersion)
|
|
126
|
+
.update(wco.projectRoot)
|
|
127
|
+
.update(JSON.stringify(wco.tsConfig))
|
|
128
|
+
.update(JSON.stringify({
|
|
129
|
+
...wco.buildOptions,
|
|
130
|
+
// Needed because outputPath changes on every build when using i18n extraction
|
|
131
|
+
// https://github.com/angular/angular-cli/blob/736a5f89deaca85f487b78aec9ff66d4118ceb6a/packages/angular_devkit/build_angular/src/utils/i18n-options.ts#L264-L265
|
|
132
|
+
outputPath: undefined,
|
|
133
|
+
}))
|
|
134
|
+
.update(supportedBrowsers.join(''))
|
|
135
|
+
.digest('hex'),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (wco.buildOptions.watch) {
|
|
139
|
+
return {
|
|
140
|
+
type: 'memory',
|
|
141
|
+
maxGenerations: 1,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
exports.getCacheSettings = getCacheSettings;
|
|
147
|
+
function globalScriptsByBundleName(root, scripts) {
|
|
148
|
+
return normalizeExtraEntryPoints(scripts, 'scripts').reduce((prev, curr) => {
|
|
149
|
+
const { bundleName, inject, input } = curr;
|
|
150
|
+
let resolvedPath = path.resolve(root, input);
|
|
151
|
+
if (!(0, fs_1.existsSync)(resolvedPath)) {
|
|
152
|
+
try {
|
|
153
|
+
resolvedPath = require.resolve(input, { paths: [root] });
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new Error(`Script file ${input} does not exist.`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const existingEntry = prev.find((el) => el.bundleName === bundleName);
|
|
160
|
+
if (existingEntry) {
|
|
161
|
+
if (existingEntry.inject && !inject) {
|
|
162
|
+
// All entries have to be lazy for the bundle to be lazy.
|
|
163
|
+
throw new Error(`The ${bundleName} bundle is mixing injected and non-injected scripts.`);
|
|
164
|
+
}
|
|
165
|
+
existingEntry.paths.push(resolvedPath);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
prev.push({
|
|
169
|
+
bundleName,
|
|
170
|
+
inject,
|
|
171
|
+
paths: [resolvedPath],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return prev;
|
|
175
|
+
}, []);
|
|
176
|
+
}
|
|
177
|
+
exports.globalScriptsByBundleName = globalScriptsByBundleName;
|
|
178
|
+
function assetPatterns(root, assets) {
|
|
179
|
+
return assets.map((asset, index) => {
|
|
180
|
+
// Resolve input paths relative to workspace root and add slash at the end.
|
|
181
|
+
// eslint-disable-next-line prefer-const
|
|
182
|
+
let { input, output, ignore = [], glob } = asset;
|
|
183
|
+
input = path.resolve(root, input).replace(/\\/g, '/');
|
|
184
|
+
input = input.endsWith('/') ? input : input + '/';
|
|
185
|
+
output = output.endsWith('/') ? output : output + '/';
|
|
186
|
+
if (output.startsWith('..')) {
|
|
187
|
+
throw new Error('An asset cannot be written to a location outside of the output path.');
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
context: input,
|
|
191
|
+
// Now we remove starting slash to make Webpack place it from the output root.
|
|
192
|
+
to: output.replace(/^\//, ''),
|
|
193
|
+
from: glob,
|
|
194
|
+
noErrorOnMissing: true,
|
|
195
|
+
force: true,
|
|
196
|
+
globOptions: {
|
|
197
|
+
dot: true,
|
|
198
|
+
followSymbolicLinks: !!asset.followSymlinks,
|
|
199
|
+
ignore: [
|
|
200
|
+
'.gitkeep',
|
|
201
|
+
'**/.DS_Store',
|
|
202
|
+
'**/Thumbs.db',
|
|
203
|
+
// Negate patterns needs to be absolute because copy-webpack-plugin uses absolute globs which
|
|
204
|
+
// causes negate patterns not to match.
|
|
205
|
+
// See: https://github.com/webpack-contrib/copy-webpack-plugin/issues/498#issuecomment-639327909
|
|
206
|
+
...ignore,
|
|
207
|
+
].map((i) => path.posix.join(input, i)),
|
|
208
|
+
},
|
|
209
|
+
priority: index,
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
exports.assetPatterns = assetPatterns;
|
|
214
|
+
function externalizePackages(context, request, callback) {
|
|
215
|
+
if (!request) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
// Absolute & Relative paths are not externals
|
|
219
|
+
if (request.startsWith('.') || path.isAbsolute(request)) {
|
|
220
|
+
callback();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
try {
|
|
224
|
+
require.resolve(request, { paths: [context] });
|
|
225
|
+
callback(undefined, request);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
// Node couldn't find it, so it must be user-aliased
|
|
229
|
+
callback();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.externalizePackages = externalizePackages;
|
|
233
|
+
function getStatsOptions(verbose = false) {
|
|
234
|
+
const webpackOutputOptions = {
|
|
235
|
+
all: false,
|
|
236
|
+
colors: true,
|
|
237
|
+
hash: true,
|
|
238
|
+
timings: true,
|
|
239
|
+
chunks: true,
|
|
240
|
+
builtAt: true,
|
|
241
|
+
warnings: true,
|
|
242
|
+
errors: true,
|
|
243
|
+
assets: true,
|
|
244
|
+
cachedAssets: true,
|
|
245
|
+
// Needed for markAsyncChunksNonInitial.
|
|
246
|
+
ids: true,
|
|
247
|
+
entrypoints: true,
|
|
248
|
+
};
|
|
249
|
+
const verboseWebpackOutputOptions = {
|
|
250
|
+
// The verbose output will most likely be piped to a file, so colors just mess it up.
|
|
251
|
+
colors: false,
|
|
252
|
+
usedExports: true,
|
|
253
|
+
optimizationBailout: true,
|
|
254
|
+
reasons: true,
|
|
255
|
+
children: true,
|
|
256
|
+
assets: true,
|
|
257
|
+
version: true,
|
|
258
|
+
chunkModules: true,
|
|
259
|
+
errorDetails: true,
|
|
260
|
+
moduleTrace: true,
|
|
261
|
+
logging: 'verbose',
|
|
262
|
+
modulesSpace: Infinity,
|
|
263
|
+
};
|
|
264
|
+
return verbose
|
|
265
|
+
? { ...webpackOutputOptions, ...verboseWebpackOutputOptions }
|
|
266
|
+
: webpackOutputOptions;
|
|
267
|
+
}
|
|
268
|
+
exports.getStatsOptions = getStatsOptions;
|
|
@@ -34,7 +34,6 @@ const core_1 = require("@angular-devkit/core");
|
|
|
34
34
|
const path = __importStar(require("path"));
|
|
35
35
|
const text_table_1 = __importDefault(require("text-table"));
|
|
36
36
|
const color_1 = require("../../utils/color");
|
|
37
|
-
const stats_1 = require("../configs/stats");
|
|
38
37
|
const async_chunks_1 = require("./async-chunks");
|
|
39
38
|
const helpers_1 = require("./helpers");
|
|
40
39
|
function formatSize(size) {
|
|
@@ -266,7 +265,7 @@ function createWebpackLoggingCallback(options, logger) {
|
|
|
266
265
|
if (verbose) {
|
|
267
266
|
logger.info(stats.toString(config.stats));
|
|
268
267
|
}
|
|
269
|
-
const rawStats = stats.toJson((0,
|
|
268
|
+
const rawStats = stats.toJson((0, helpers_1.getStatsOptions)(false));
|
|
270
269
|
const webpackStats = {
|
|
271
270
|
...rawStats,
|
|
272
271
|
chunks: (0, async_chunks_1.markAsyncChunksNonInitial)(rawStats, extraEntryPoints),
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.getBrowserConfig = void 0;
|
|
11
|
-
const webpack_subresource_integrity_1 = require("webpack-subresource-integrity");
|
|
12
|
-
const plugins_1 = require("../plugins");
|
|
13
|
-
const helpers_1 = require("../utils/helpers");
|
|
14
|
-
function getBrowserConfig(wco) {
|
|
15
|
-
const { buildOptions } = wco;
|
|
16
|
-
const { crossOrigin = 'none', subresourceIntegrity, vendorChunk, commonChunk, allowedCommonJsDependencies, } = buildOptions;
|
|
17
|
-
const extraPlugins = [];
|
|
18
|
-
const { styles: stylesSourceMap, scripts: scriptsSourceMap, hidden: hiddenSourceMap, } = buildOptions.sourceMap;
|
|
19
|
-
if (subresourceIntegrity) {
|
|
20
|
-
extraPlugins.push(new webpack_subresource_integrity_1.SubresourceIntegrityPlugin({
|
|
21
|
-
hashFuncNames: ['sha384'],
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
if (scriptsSourceMap || stylesSourceMap) {
|
|
25
|
-
extraPlugins.push((0, helpers_1.getSourceMapDevTool)(scriptsSourceMap, stylesSourceMap, hiddenSourceMap, false));
|
|
26
|
-
}
|
|
27
|
-
let crossOriginLoading = false;
|
|
28
|
-
if (subresourceIntegrity && crossOrigin === 'none') {
|
|
29
|
-
crossOriginLoading = 'anonymous';
|
|
30
|
-
}
|
|
31
|
-
else if (crossOrigin !== 'none') {
|
|
32
|
-
crossOriginLoading = crossOrigin;
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
devtool: false,
|
|
36
|
-
resolve: {
|
|
37
|
-
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
|
|
38
|
-
conditionNames: ['es2020', 'es2015', '...'],
|
|
39
|
-
},
|
|
40
|
-
output: {
|
|
41
|
-
crossOriginLoading,
|
|
42
|
-
trustedTypes: 'angular#bundler',
|
|
43
|
-
scriptType: 'module',
|
|
44
|
-
},
|
|
45
|
-
optimization: {
|
|
46
|
-
runtimeChunk: 'single',
|
|
47
|
-
splitChunks: {
|
|
48
|
-
maxAsyncRequests: Infinity,
|
|
49
|
-
cacheGroups: {
|
|
50
|
-
default: !!commonChunk && {
|
|
51
|
-
chunks: 'async',
|
|
52
|
-
minChunks: 2,
|
|
53
|
-
priority: 10,
|
|
54
|
-
},
|
|
55
|
-
common: !!commonChunk && {
|
|
56
|
-
name: 'common',
|
|
57
|
-
chunks: 'async',
|
|
58
|
-
minChunks: 2,
|
|
59
|
-
enforce: true,
|
|
60
|
-
priority: 5,
|
|
61
|
-
},
|
|
62
|
-
vendors: false,
|
|
63
|
-
defaultVendors: !!vendorChunk && {
|
|
64
|
-
name: 'vendor',
|
|
65
|
-
chunks: (chunk) => chunk.name === 'main',
|
|
66
|
-
enforce: true,
|
|
67
|
-
test: /[\\/]node_modules[\\/]/,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
plugins: [
|
|
73
|
-
new plugins_1.CommonJsUsageWarnPlugin({
|
|
74
|
-
allowedDependencies: allowedCommonJsDependencies,
|
|
75
|
-
}),
|
|
76
|
-
...extraPlugins,
|
|
77
|
-
],
|
|
78
|
-
node: false,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
exports.getBrowserConfig = getBrowserConfig;
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import { Configuration } from 'webpack';
|
|
9
|
-
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
10
|
-
/**
|
|
11
|
-
* Returns a partial Webpack configuration specific to creating a bundle for node
|
|
12
|
-
* @param wco Options which include the build options and app config
|
|
13
|
-
*/
|
|
14
|
-
export declare function getServerConfig(wco: WebpackConfigOptions): Configuration;
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.getServerConfig = void 0;
|
|
11
|
-
const path_1 = require("path");
|
|
12
|
-
const webpack_1 = require("webpack");
|
|
13
|
-
const helpers_1 = require("../utils/helpers");
|
|
14
|
-
/**
|
|
15
|
-
* Returns a partial Webpack configuration specific to creating a bundle for node
|
|
16
|
-
* @param wco Options which include the build options and app config
|
|
17
|
-
*/
|
|
18
|
-
function getServerConfig(wco) {
|
|
19
|
-
const { sourceMap, bundleDependencies, externalDependencies = [] } = wco.buildOptions;
|
|
20
|
-
const extraPlugins = [];
|
|
21
|
-
const { scripts, styles, hidden } = sourceMap;
|
|
22
|
-
if (scripts || styles) {
|
|
23
|
-
extraPlugins.push((0, helpers_1.getSourceMapDevTool)(scripts, styles, hidden));
|
|
24
|
-
}
|
|
25
|
-
const externals = [...externalDependencies];
|
|
26
|
-
if (!bundleDependencies) {
|
|
27
|
-
externals.push(({ context, request }, callback) => externalizePackages(context !== null && context !== void 0 ? context : wco.projectRoot, request, callback));
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
resolve: {
|
|
31
|
-
mainFields: ['es2020', 'es2015', 'main', 'module'],
|
|
32
|
-
},
|
|
33
|
-
output: {
|
|
34
|
-
libraryTarget: 'commonjs',
|
|
35
|
-
},
|
|
36
|
-
module: {
|
|
37
|
-
parser: {
|
|
38
|
-
javascript: {
|
|
39
|
-
worker: false,
|
|
40
|
-
url: false,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
plugins: [
|
|
45
|
-
// Fixes Critical dependency: the request of a dependency is an expression
|
|
46
|
-
new webpack_1.ContextReplacementPlugin(/@?hapi(\\|\/)/),
|
|
47
|
-
new webpack_1.ContextReplacementPlugin(/express(\\|\/)/),
|
|
48
|
-
...extraPlugins,
|
|
49
|
-
],
|
|
50
|
-
node: false,
|
|
51
|
-
externals,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.getServerConfig = getServerConfig;
|
|
55
|
-
function externalizePackages(context, request, callback) {
|
|
56
|
-
if (!request) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
// Absolute & Relative paths are not externals
|
|
60
|
-
if (request.startsWith('.') || (0, path_1.isAbsolute)(request)) {
|
|
61
|
-
callback();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
require.resolve(request, { paths: [context] });
|
|
66
|
-
callback(undefined, request);
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
// Node couldn't find it, so it must be user-aliased
|
|
70
|
-
callback();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
9
|
-
export declare function getWebpackStatsConfig(verbose?: boolean): {
|
|
10
|
-
all: boolean;
|
|
11
|
-
colors: boolean;
|
|
12
|
-
hash: boolean;
|
|
13
|
-
timings: boolean;
|
|
14
|
-
chunks: boolean;
|
|
15
|
-
builtAt: boolean;
|
|
16
|
-
warnings: boolean;
|
|
17
|
-
errors: boolean;
|
|
18
|
-
assets: boolean;
|
|
19
|
-
cachedAssets: boolean;
|
|
20
|
-
ids: boolean;
|
|
21
|
-
entrypoints: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare function getStatsConfig(wco: WebpackConfigOptions): {
|
|
24
|
-
stats: {
|
|
25
|
-
all: boolean;
|
|
26
|
-
colors: boolean;
|
|
27
|
-
hash: boolean;
|
|
28
|
-
timings: boolean;
|
|
29
|
-
chunks: boolean;
|
|
30
|
-
builtAt: boolean;
|
|
31
|
-
warnings: boolean;
|
|
32
|
-
errors: boolean;
|
|
33
|
-
assets: boolean;
|
|
34
|
-
cachedAssets: boolean;
|
|
35
|
-
ids: boolean;
|
|
36
|
-
entrypoints: boolean;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.getStatsConfig = exports.getWebpackStatsConfig = void 0;
|
|
11
|
-
const webpackOutputOptions = {
|
|
12
|
-
all: false,
|
|
13
|
-
colors: true,
|
|
14
|
-
hash: true,
|
|
15
|
-
timings: true,
|
|
16
|
-
chunks: true,
|
|
17
|
-
builtAt: true,
|
|
18
|
-
warnings: true,
|
|
19
|
-
errors: true,
|
|
20
|
-
assets: true,
|
|
21
|
-
cachedAssets: true,
|
|
22
|
-
// Needed for markAsyncChunksNonInitial.
|
|
23
|
-
ids: true,
|
|
24
|
-
entrypoints: true,
|
|
25
|
-
};
|
|
26
|
-
const verboseWebpackOutputOptions = {
|
|
27
|
-
// The verbose output will most likely be piped to a file, so colors just mess it up.
|
|
28
|
-
colors: false,
|
|
29
|
-
usedExports: true,
|
|
30
|
-
optimizationBailout: true,
|
|
31
|
-
reasons: true,
|
|
32
|
-
children: true,
|
|
33
|
-
assets: true,
|
|
34
|
-
version: true,
|
|
35
|
-
chunkModules: true,
|
|
36
|
-
errorDetails: true,
|
|
37
|
-
moduleTrace: true,
|
|
38
|
-
logging: 'verbose',
|
|
39
|
-
modulesSpace: Infinity,
|
|
40
|
-
};
|
|
41
|
-
function getWebpackStatsConfig(verbose = false) {
|
|
42
|
-
return verbose
|
|
43
|
-
? { ...webpackOutputOptions, ...verboseWebpackOutputOptions }
|
|
44
|
-
: webpackOutputOptions;
|
|
45
|
-
}
|
|
46
|
-
exports.getWebpackStatsConfig = getWebpackStatsConfig;
|
|
47
|
-
function getStatsConfig(wco) {
|
|
48
|
-
const verbose = !!wco.buildOptions.verbose;
|
|
49
|
-
return {
|
|
50
|
-
stats: getWebpackStatsConfig(verbose),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.getStatsConfig = getStatsConfig;
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import * as webpack from 'webpack';
|
|
9
|
-
import { WebpackConfigOptions, WebpackTestOptions } from '../../utils/build-options';
|
|
10
|
-
export declare function getTestConfig(wco: WebpackConfigOptions<WebpackTestOptions>): webpack.Configuration;
|