@angular-devkit/build-angular 14.0.0-next.0 → 14.0.0-next.11
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 +10 -10
- package/package.json +34 -35
- package/src/babel/plugins/pure-toplevel-functions.js +5 -1
- package/src/babel/presets/application.js +5 -1
- package/src/babel/webpack-loader.js +2 -22
- package/src/builders/app-shell/index.js +8 -4
- package/src/builders/app-shell/schema.d.ts +2 -2
- package/src/builders/app-shell/schema.json +2 -2
- package/src/builders/browser/index.d.ts +2 -3
- package/src/builders/browser/index.js +13 -10
- package/src/builders/browser/schema.d.ts +0 -1
- package/src/builders/browser/schema.json +2 -3
- package/src/builders/dev-server/index.d.ts +1 -1
- package/src/builders/dev-server/index.js +5 -1
- package/src/builders/dev-server/schema.d.ts +1 -1
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/extract-i18n/index.d.ts +1 -1
- package/src/builders/extract-i18n/index.js +5 -1
- package/src/builders/extract-i18n/ivy-extract-loader.js +5 -1
- package/src/builders/karma/find-tests.js +5 -1
- package/src/builders/karma/index.d.ts +1 -1
- package/src/builders/karma/index.js +10 -6
- package/src/builders/ng-packagr/index.js +5 -1
- package/src/builders/protractor/index.d.ts +2 -1
- package/src/builders/protractor/index.js +5 -1
- package/src/builders/server/index.d.ts +2 -3
- package/src/builders/server/index.js +5 -1
- package/src/builders/server/schema.json +1 -2
- package/src/index.js +5 -1
- package/src/typings.d.ts +0 -4
- package/src/utils/check-port.js +8 -4
- package/src/utils/color.js +5 -1
- package/src/utils/copy-assets.js +5 -1
- package/src/utils/delete-output-dir.js +6 -9
- package/src/utils/environment-options.d.ts +0 -1
- package/src/utils/environment-options.js +1 -13
- package/src/utils/i18n-inlining.js +5 -1
- package/src/utils/i18n-options.js +1 -8
- package/src/utils/index-file/html-rewriting-stream.js +5 -1
- package/src/utils/index-file/index-html-generator.js +5 -1
- package/src/utils/index-file/inline-critical-css.js +5 -1
- package/src/utils/index-file/inline-fonts.js +5 -1
- package/src/utils/index.js +5 -1
- package/src/utils/load-translations.js +5 -1
- package/src/utils/normalize-asset-patterns.d.ts +2 -2
- package/src/utils/normalize-asset-patterns.js +34 -10
- package/src/utils/normalize-builder-schema.d.ts +2 -2
- package/src/utils/normalize-builder-schema.js +5 -6
- package/src/utils/normalize-cache.js +0 -4
- package/src/utils/normalize-file-replacements.d.ts +4 -4
- package/src/utils/normalize-file-replacements.js +38 -18
- package/src/utils/process-bundle.js +6 -2
- package/src/utils/purge-cache.js +3 -8
- package/src/utils/read-tsconfig.js +5 -1
- package/src/utils/service-worker.d.ts +1 -2
- package/src/utils/service-worker.js +13 -11
- package/src/utils/webpack-browser-config.js +14 -12
- package/src/webpack/configs/analytics.js +1 -4
- package/src/webpack/configs/common.js +10 -12
- package/src/webpack/configs/dev-server.js +6 -2
- package/src/webpack/configs/index.js +5 -1
- package/src/webpack/configs/styles.js +14 -21
- package/src/webpack/plugins/analytics.d.ts +1 -2
- package/src/webpack/plugins/analytics.js +1 -3
- package/src/webpack/plugins/any-component-style-budget-checker.js +5 -1
- package/src/webpack/plugins/common-js-usage-warn-plugin.js +2 -2
- package/src/webpack/plugins/css-optimizer-plugin.js +7 -3
- package/src/webpack/plugins/esbuild-executor.d.ts +2 -2
- package/src/webpack/plugins/esbuild-executor.js +11 -17
- package/src/webpack/plugins/javascript-optimizer-plugin.js +8 -4
- package/src/webpack/plugins/json-stats-plugin.js +5 -1
- package/src/webpack/plugins/karma/karma.js +37 -42
- package/src/webpack/plugins/named-chunks-plugin.js +9 -0
- package/src/webpack/plugins/postcss-cli-resources.js +7 -3
- package/src/webpack/plugins/scripts-webpack-plugin.js +5 -1
- package/src/webpack/plugins/transfer-size-plugin.js +3 -2
- package/src/webpack/plugins/typescript.js +1 -2
- package/src/webpack/utils/helpers.js +5 -1
- package/src/webpack/utils/stats.js +5 -1
- package/esbuild-check.js +0 -16
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
+
import { json } from '@angular-devkit/core';
|
|
9
10
|
import { Schema as ProtractorBuilderOptions } from './schema';
|
|
10
11
|
export { ProtractorBuilderOptions };
|
|
11
12
|
/**
|
|
12
13
|
* @experimental Direct usage of this function is considered experimental.
|
|
13
14
|
*/
|
|
14
15
|
export declare function execute(options: ProtractorBuilderOptions, context: BuilderContext): Promise<BuilderOutput>;
|
|
15
|
-
declare const _default: import("@angular-devkit/architect/src/internal").Builder<ProtractorBuilderOptions &
|
|
16
|
+
declare const _default: import("@angular-devkit/architect/src/internal").Builder<ProtractorBuilderOptions & json.JsonObject>;
|
|
16
17
|
export default _default;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { Observable } from 'rxjs';
|
|
11
10
|
import webpack from 'webpack';
|
|
12
11
|
import { ExecutionTransformer } from '../../transforms';
|
|
@@ -14,7 +13,7 @@ import { Schema as ServerBuilderOptions } from './schema';
|
|
|
14
13
|
/**
|
|
15
14
|
* @experimental Direct usage of this type is considered experimental.
|
|
16
15
|
*/
|
|
17
|
-
export declare type ServerBuilderOutput =
|
|
16
|
+
export declare type ServerBuilderOutput = BuilderOutput & {
|
|
18
17
|
baseOutputPath: string;
|
|
19
18
|
outputPaths: string[];
|
|
20
19
|
/**
|
|
@@ -29,5 +28,5 @@ export { ServerBuilderOptions };
|
|
|
29
28
|
export declare function execute(options: ServerBuilderOptions, context: BuilderContext, transforms?: {
|
|
30
29
|
webpackConfiguration?: ExecutionTransformer<webpack.Configuration>;
|
|
31
30
|
}): Observable<ServerBuilderOutput>;
|
|
32
|
-
declare const _default: import("@angular-devkit/architect/src/internal").Builder<ServerBuilderOptions &
|
|
31
|
+
declare const _default: import("@angular-devkit/architect/src/internal").Builder<ServerBuilderOptions & import("@angular-devkit/core").JsonObject>;
|
|
33
32
|
export default _default;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -74,8 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"resourcesOutputPath": {
|
|
76
76
|
"type": "string",
|
|
77
|
-
"description": "The path where style resources will be placed, relative to outputPath."
|
|
78
|
-
"default": ""
|
|
77
|
+
"description": "The path where style resources will be placed, relative to outputPath."
|
|
79
78
|
},
|
|
80
79
|
"sourceMap": {
|
|
81
80
|
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/src/typings.d.ts
CHANGED
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
declare module '@discoveryjs/json-ext' {
|
|
10
|
-
export function stringifyStream(value: unknown): import('stream').Readable;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
declare module '@babel/helper-annotate-as-pure' {
|
|
14
10
|
export default function annotateAsPure(
|
|
15
11
|
pathOrNode: import('@babel/types').Node | { node: import('@babel/types').Node },
|
package/src/utils/check-port.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -27,7 +31,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
31
|
};
|
|
28
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
33
|
exports.checkPort = void 0;
|
|
30
|
-
const inquirer_1 = require("inquirer");
|
|
31
34
|
const net = __importStar(require("net"));
|
|
32
35
|
const tty_1 = require("./tty");
|
|
33
36
|
function createInUseError(port) {
|
|
@@ -49,12 +52,13 @@ async function checkPort(port, host) {
|
|
|
49
52
|
reject(createInUseError(port));
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
|
-
(
|
|
55
|
+
Promise.resolve().then(() => __importStar(require('inquirer'))).then(({ prompt }) => prompt({
|
|
53
56
|
type: 'confirm',
|
|
54
57
|
name: 'useDifferent',
|
|
55
58
|
message: `Port ${port} is already in use.\nWould you like to use a different port?`,
|
|
56
59
|
default: true,
|
|
57
|
-
})
|
|
60
|
+
}))
|
|
61
|
+
.then((answers) => (answers.useDifferent ? resolve(0) : reject(createInUseError(port))), () => reject(createInUseError(port)));
|
|
58
62
|
})
|
|
59
63
|
.once('listening', () => {
|
|
60
64
|
server.close();
|
package/src/utils/color.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/src/utils/copy-assets.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -37,13 +41,6 @@ function deleteOutputDir(root, outputPath) {
|
|
|
37
41
|
if (resolvedOutputPath === root) {
|
|
38
42
|
throw new Error('Output path MUST not be project root directory!');
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
const { rmSync, rmdirSync } = fs;
|
|
42
|
-
if (rmSync) {
|
|
43
|
-
rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
rmdirSync(resolvedOutputPath, { recursive: true, maxRetries: 3 });
|
|
47
|
-
}
|
|
44
|
+
fs.rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
|
|
48
45
|
}
|
|
49
46
|
exports.deleteOutputDir = deleteOutputDir;
|
|
@@ -7,8 +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.
|
|
11
|
-
const color_1 = require("./color");
|
|
10
|
+
exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
|
|
12
11
|
function isDisabled(variable) {
|
|
13
12
|
return variable === '0' || variable.toLowerCase() === 'false';
|
|
14
13
|
}
|
|
@@ -68,14 +67,3 @@ exports.allowMinify = debugOptimize.minify;
|
|
|
68
67
|
*/
|
|
69
68
|
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
70
69
|
exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
|
|
71
|
-
// Build cache
|
|
72
|
-
const cacheVariable = process.env['NG_BUILD_CACHE'];
|
|
73
|
-
exports.cachingDisabled = (() => {
|
|
74
|
-
if (!isPresent(cacheVariable)) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
// eslint-disable-next-line no-console
|
|
78
|
-
console.warn(color_1.colors.yellow(`Warning: 'NG_BUILD_CACHE' environment variable support will be removed in version 14.\n` +
|
|
79
|
-
`Configure 'cli.cache' in the workspace configuration instead.`));
|
|
80
|
-
return isDisabled(cacheVariable);
|
|
81
|
-
})();
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -203,15 +203,8 @@ function findLocaleDataPath(locale, resolver) {
|
|
|
203
203
|
}
|
|
204
204
|
/** Remove temporary directory used for i18n processing. */
|
|
205
205
|
function deleteTempDirectory(tempPath) {
|
|
206
|
-
// The below should be removed and replaced with just `rmSync` when support for Node.Js 12 is removed.
|
|
207
|
-
const { rmSync, rmdirSync } = fs_1.default;
|
|
208
206
|
try {
|
|
209
|
-
|
|
210
|
-
rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
|
|
214
|
-
}
|
|
207
|
+
fs_1.default.rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
|
|
215
208
|
}
|
|
216
209
|
catch { }
|
|
217
210
|
}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/src/utils/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -5,9 +5,9 @@
|
|
|
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 { BaseException
|
|
8
|
+
import { BaseException } from '@angular-devkit/core';
|
|
9
9
|
import { AssetPattern, AssetPatternClass } from '../builders/browser/schema';
|
|
10
10
|
export declare class MissingAssetSourceRootException extends BaseException {
|
|
11
11
|
constructor(path: String);
|
|
12
12
|
}
|
|
13
|
-
export declare function normalizeAssetPatterns(assetPatterns: AssetPattern[],
|
|
13
|
+
export declare function normalizeAssetPatterns(assetPatterns: AssetPattern[], workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined): AssetPatternClass[];
|
|
@@ -6,28 +6,52 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
9
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
33
|
exports.normalizeAssetPatterns = exports.MissingAssetSourceRootException = void 0;
|
|
11
34
|
const core_1 = require("@angular-devkit/core");
|
|
12
35
|
const fs_1 = require("fs");
|
|
36
|
+
const path = __importStar(require("path"));
|
|
13
37
|
class MissingAssetSourceRootException extends core_1.BaseException {
|
|
14
38
|
constructor(path) {
|
|
15
39
|
super(`The ${path} asset path must start with the project source root.`);
|
|
16
40
|
}
|
|
17
41
|
}
|
|
18
42
|
exports.MissingAssetSourceRootException = MissingAssetSourceRootException;
|
|
19
|
-
function normalizeAssetPatterns(assetPatterns,
|
|
20
|
-
// When sourceRoot is not available, we default to ${projectRoot}/src.
|
|
21
|
-
const sourceRoot = maybeSourceRoot || (0, core_1.join)(projectRoot, 'src');
|
|
22
|
-
const resolvedSourceRoot = (0, core_1.resolve)(root, sourceRoot);
|
|
43
|
+
function normalizeAssetPatterns(assetPatterns, workspaceRoot, projectRoot, projectSourceRoot) {
|
|
23
44
|
if (assetPatterns.length === 0) {
|
|
24
45
|
return [];
|
|
25
46
|
}
|
|
47
|
+
// When sourceRoot is not available, we default to ${projectRoot}/src.
|
|
48
|
+
const sourceRoot = projectSourceRoot || path.join(projectRoot, 'src');
|
|
49
|
+
const resolvedSourceRoot = path.resolve(workspaceRoot, sourceRoot);
|
|
26
50
|
return assetPatterns.map((assetPattern) => {
|
|
27
51
|
// Normalize string asset patterns to objects.
|
|
28
52
|
if (typeof assetPattern === 'string') {
|
|
29
|
-
const assetPath =
|
|
30
|
-
const resolvedAssetPath =
|
|
53
|
+
const assetPath = path.normalize(assetPattern);
|
|
54
|
+
const resolvedAssetPath = path.resolve(workspaceRoot, assetPath);
|
|
31
55
|
// Check if the string asset is within sourceRoot.
|
|
32
56
|
if (!resolvedAssetPath.startsWith(resolvedSourceRoot)) {
|
|
33
57
|
throw new MissingAssetSourceRootException(assetPattern);
|
|
@@ -35,7 +59,7 @@ function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoo
|
|
|
35
59
|
let glob, input;
|
|
36
60
|
let isDirectory = false;
|
|
37
61
|
try {
|
|
38
|
-
isDirectory = (0, fs_1.statSync)(
|
|
62
|
+
isDirectory = (0, fs_1.statSync)(resolvedAssetPath).isDirectory();
|
|
39
63
|
}
|
|
40
64
|
catch {
|
|
41
65
|
isDirectory = true;
|
|
@@ -48,12 +72,12 @@ function normalizeAssetPatterns(assetPatterns, root, projectRoot, maybeSourceRoo
|
|
|
48
72
|
}
|
|
49
73
|
else {
|
|
50
74
|
// Files are their own glob.
|
|
51
|
-
glob =
|
|
75
|
+
glob = path.basename(assetPath);
|
|
52
76
|
// Input directory is their original dirname.
|
|
53
|
-
input =
|
|
77
|
+
input = path.dirname(assetPath);
|
|
54
78
|
}
|
|
55
79
|
// Output directory for both is the relative path from source root to input.
|
|
56
|
-
const output =
|
|
80
|
+
const output = path.relative(resolvedSourceRoot, path.resolve(workspaceRoot, input));
|
|
57
81
|
// Return the asset pattern in object format.
|
|
58
82
|
return { glob, input, output };
|
|
59
83
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
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 {
|
|
8
|
+
import { json } from '@angular-devkit/core';
|
|
9
9
|
import { AssetPatternClass, Schema as BrowserBuilderSchema, SourceMapClass } from '../builders/browser/schema';
|
|
10
10
|
import { BuildOptions } from './build-options';
|
|
11
11
|
import { NormalizedFileReplacement } from './normalize-file-replacements';
|
|
@@ -19,4 +19,4 @@ export declare type NormalizedBrowserBuilderSchema = BrowserBuilderSchema & Buil
|
|
|
19
19
|
fileReplacements: NormalizedFileReplacement[];
|
|
20
20
|
optimization: NormalizedOptimizationOptions;
|
|
21
21
|
};
|
|
22
|
-
export declare function normalizeBrowserSchema(
|
|
22
|
+
export declare function normalizeBrowserSchema(workspaceRoot: string, projectRoot: string, projectSourceRoot: string | undefined, options: BrowserBuilderSchema, metadata: json.JsonObject): NormalizedBrowserBuilderSchema;
|
|
@@ -8,20 +8,19 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.normalizeBrowserSchema = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const normalize_asset_patterns_1 = require("./normalize-asset-patterns");
|
|
13
12
|
const normalize_cache_1 = require("./normalize-cache");
|
|
14
13
|
const normalize_file_replacements_1 = require("./normalize-file-replacements");
|
|
15
14
|
const normalize_optimization_1 = require("./normalize-optimization");
|
|
16
15
|
const normalize_source_maps_1 = require("./normalize-source-maps");
|
|
17
16
|
const supported_browsers_1 = require("./supported-browsers");
|
|
18
|
-
function normalizeBrowserSchema(
|
|
17
|
+
function normalizeBrowserSchema(workspaceRoot, projectRoot, projectSourceRoot, options, metadata) {
|
|
19
18
|
const normalizedSourceMapOptions = (0, normalize_source_maps_1.normalizeSourceMaps)(options.sourceMap || false);
|
|
20
19
|
return {
|
|
21
20
|
...options,
|
|
22
|
-
cache: (0, normalize_cache_1.normalizeCacheOptions)(metadata,
|
|
23
|
-
assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [],
|
|
24
|
-
fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [],
|
|
21
|
+
cache: (0, normalize_cache_1.normalizeCacheOptions)(metadata, workspaceRoot),
|
|
22
|
+
assets: (0, normalize_asset_patterns_1.normalizeAssetPatterns)(options.assets || [], workspaceRoot, projectRoot, projectSourceRoot),
|
|
23
|
+
fileReplacements: (0, normalize_file_replacements_1.normalizeFileReplacements)(options.fileReplacements || [], workspaceRoot),
|
|
25
24
|
optimization: (0, normalize_optimization_1.normalizeOptimization)(options.optimization),
|
|
26
25
|
sourceMap: normalizedSourceMapOptions,
|
|
27
26
|
preserveSymlinks: options.preserveSymlinks === undefined
|
|
@@ -38,7 +37,7 @@ function normalizeBrowserSchema(root, projectRoot, sourceRoot, options, metadata
|
|
|
38
37
|
// A value of 0 is falsy and will disable polling rather then enable
|
|
39
38
|
// 500 ms is a sensible default in this case
|
|
40
39
|
poll: options.poll === 0 ? 500 : options.poll,
|
|
41
|
-
supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)(
|
|
40
|
+
supportedBrowsers: (0, supported_browsers_1.getSupportedBrowsers)(projectRoot),
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
exports.normalizeBrowserSchema = normalizeBrowserSchema;
|
|
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
-
const environment_options_1 = require("./environment-options");
|
|
14
13
|
const package_version_1 = require("./package-version");
|
|
15
14
|
function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
16
15
|
var _a;
|
|
@@ -20,9 +19,6 @@ function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
|
20
19
|
const { enabled = true, environment = 'local', path = '.angular/cache' } = cacheMetadata;
|
|
21
20
|
const isCI = process.env['CI'] === '1' || ((_a = process.env['CI']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
|
|
22
21
|
let cacheEnabled = enabled;
|
|
23
|
-
if (environment_options_1.cachingDisabled !== null) {
|
|
24
|
-
cacheEnabled = !environment_options_1.cachingDisabled;
|
|
25
|
-
}
|
|
26
22
|
if (cacheEnabled) {
|
|
27
23
|
switch (environment) {
|
|
28
24
|
case 'ci':
|
|
@@ -5,13 +5,13 @@
|
|
|
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 { BaseException
|
|
8
|
+
import { BaseException } from '@angular-devkit/core';
|
|
9
9
|
import { FileReplacement } from '../builders/browser/schema';
|
|
10
10
|
export declare class MissingFileReplacementException extends BaseException {
|
|
11
11
|
constructor(path: String);
|
|
12
12
|
}
|
|
13
13
|
export interface NormalizedFileReplacement {
|
|
14
|
-
replace:
|
|
15
|
-
with:
|
|
14
|
+
replace: string;
|
|
15
|
+
with: string;
|
|
16
16
|
}
|
|
17
|
-
export declare function normalizeFileReplacements(fileReplacements: FileReplacement[],
|
|
17
|
+
export declare function normalizeFileReplacements(fileReplacements: FileReplacement[], workspaceRoot: string): NormalizedFileReplacement[];
|
|
@@ -6,27 +6,51 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
9
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
33
|
exports.normalizeFileReplacements = exports.MissingFileReplacementException = void 0;
|
|
11
34
|
const core_1 = require("@angular-devkit/core");
|
|
12
35
|
const fs_1 = require("fs");
|
|
36
|
+
const path = __importStar(require("path"));
|
|
13
37
|
class MissingFileReplacementException extends core_1.BaseException {
|
|
14
38
|
constructor(path) {
|
|
15
39
|
super(`The ${path} path in file replacements does not exist.`);
|
|
16
40
|
}
|
|
17
41
|
}
|
|
18
42
|
exports.MissingFileReplacementException = MissingFileReplacementException;
|
|
19
|
-
function normalizeFileReplacements(fileReplacements,
|
|
43
|
+
function normalizeFileReplacements(fileReplacements, workspaceRoot) {
|
|
20
44
|
if (fileReplacements.length === 0) {
|
|
21
45
|
return [];
|
|
22
46
|
}
|
|
23
|
-
const normalizedReplacement = fileReplacements.map((replacement) => normalizeFileReplacement(replacement,
|
|
47
|
+
const normalizedReplacement = fileReplacements.map((replacement) => normalizeFileReplacement(replacement, workspaceRoot));
|
|
24
48
|
for (const { replace, with: replacementWith } of normalizedReplacement) {
|
|
25
|
-
if (!(0, fs_1.existsSync)(
|
|
26
|
-
throw new MissingFileReplacementException(
|
|
49
|
+
if (!(0, fs_1.existsSync)(replacementWith)) {
|
|
50
|
+
throw new MissingFileReplacementException(replacementWith);
|
|
27
51
|
}
|
|
28
|
-
if (!(0, fs_1.existsSync)(
|
|
29
|
-
throw new MissingFileReplacementException(
|
|
52
|
+
if (!(0, fs_1.existsSync)(replace)) {
|
|
53
|
+
throw new MissingFileReplacementException(replace);
|
|
30
54
|
}
|
|
31
55
|
}
|
|
32
56
|
return normalizedReplacement;
|
|
@@ -36,22 +60,18 @@ function normalizeFileReplacement(fileReplacement, root) {
|
|
|
36
60
|
let replacePath;
|
|
37
61
|
let withPath;
|
|
38
62
|
if (fileReplacement.src && fileReplacement.replaceWith) {
|
|
39
|
-
replacePath =
|
|
40
|
-
withPath =
|
|
63
|
+
replacePath = fileReplacement.src;
|
|
64
|
+
withPath = fileReplacement.replaceWith;
|
|
41
65
|
}
|
|
42
66
|
else if (fileReplacement.replace && fileReplacement.with) {
|
|
43
|
-
replacePath =
|
|
44
|
-
withPath =
|
|
67
|
+
replacePath = fileReplacement.replace;
|
|
68
|
+
withPath = fileReplacement.with;
|
|
45
69
|
}
|
|
46
70
|
else {
|
|
47
71
|
throw new Error(`Invalid file replacement: ${JSON.stringify(fileReplacement)}`);
|
|
48
72
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
if (root) {
|
|
54
|
-
withPath = (0, core_1.join)(root, withPath);
|
|
55
|
-
}
|
|
56
|
-
return { replace: replacePath, with: withPath };
|
|
73
|
+
return {
|
|
74
|
+
replace: path.join(root, replacePath),
|
|
75
|
+
with: path.join(root, withPath),
|
|
76
|
+
};
|
|
57
77
|
}
|