@angular-devkit/build-angular 18.0.0-next.3 → 18.0.0-next.5
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/builders.json +1 -5
- package/package.json +14 -13
- package/src/builders/app-shell/index.js +3 -5
- package/src/builders/browser/index.d.ts +1 -1
- package/src/builders/browser/index.js +8 -12
- package/src/builders/browser-esbuild/index.d.ts +2 -2
- package/src/builders/browser-esbuild/index.js +6 -9
- package/src/builders/dev-server/builder.d.ts +2 -2
- package/src/builders/dev-server/builder.js +11 -6
- package/src/builders/dev-server/index.d.ts +1 -1
- package/src/builders/dev-server/webpack-server.d.ts +1 -1
- package/src/builders/dev-server/webpack-server.js +3 -4
- package/src/builders/extract-i18n/application-extraction.js +2 -2
- package/src/builders/extract-i18n/builder.js +3 -4
- package/src/builders/extract-i18n/options.d.ts +1 -1
- package/src/builders/extract-i18n/options.js +2 -2
- package/src/builders/jest/index.js +2 -2
- package/src/builders/karma/index.js +3 -4
- package/src/builders/ng-packagr/index.js +8 -7
- package/src/builders/ng-packagr/schema.d.ts +4 -0
- package/src/builders/ng-packagr/schema.json +4 -0
- package/src/builders/prerender/index.js +2 -2
- package/src/builders/prerender/render-worker.js +1 -1
- package/src/builders/server/index.js +3 -4
- package/src/builders/server/platform-server-exports-loader.js +2 -1
- package/src/builders/ssr-dev-server/index.js +7 -7
- package/src/builders/web-test-runner/index.js +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -2
- package/src/tools/babel/presets/application.js +1 -1
- package/src/tools/webpack/configs/styles.js +2 -2
- package/src/tools/webpack/plugins/any-component-style-budget-checker.d.ts +1 -1
- package/src/tools/webpack/plugins/any-component-style-budget-checker.js +5 -5
- package/src/tools/webpack/plugins/css-optimizer-plugin.js +2 -2
- package/src/tools/webpack/plugins/index-html-webpack-plugin.d.ts +1 -1
- package/src/tools/webpack/plugins/index-html-webpack-plugin.js +2 -2
- package/src/tools/webpack/plugins/javascript-optimizer-plugin.js +2 -2
- package/src/tools/webpack/plugins/service-worker-plugin.js +2 -2
- package/src/tools/webpack/utils/stats.d.ts +1 -1
- package/src/tools/webpack/utils/stats.js +2 -2
- package/src/utils/i18n-webpack.d.ts +1 -1
- package/src/utils/i18n-webpack.js +5 -6
- package/src/utils/index.d.ts +1 -2
- package/src/utils/index.js +4 -2
- package/src/utils/normalize-builder-schema.js +2 -2
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/normalize-optimization.d.ts +1 -1
- package/src/utils/normalize-optimization.js +0 -2
- package/src/builders/application/build-action.d.ts +0 -33
- package/src/builders/application/build-action.js +0 -183
- package/src/builders/application/execute-build.d.ts +0 -11
- package/src/builders/application/execute-build.js +0 -125
- package/src/builders/application/execute-post-bundle.d.ts +0 -25
- package/src/builders/application/execute-post-bundle.js +0 -93
- package/src/builders/application/i18n.d.ts +0 -29
- package/src/builders/application/i18n.js +0 -128
- package/src/builders/application/index.d.ts +0 -57
- package/src/builders/application/index.js +0 -121
- package/src/builders/application/options.d.ts +0 -149
- package/src/builders/application/options.js +0 -369
- package/src/builders/application/schema.d.ts +0 -512
- package/src/builders/application/schema.js +0 -58
- package/src/builders/application/schema.json +0 -635
- package/src/builders/application/setup-bundling.d.ts +0 -19
- package/src/builders/application/setup-bundling.js +0 -71
- package/src/builders/dev-server/vite-server.d.ts +0 -30
- package/src/builders/dev-server/vite-server.js +0 -502
- package/src/tools/babel/plugins/adjust-static-class-members.d.ts +0 -27
- package/src/tools/babel/plugins/adjust-static-class-members.js +0 -351
- package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +0 -23
- package/src/tools/babel/plugins/adjust-typescript-enums.js +0 -113
- package/src/tools/babel/plugins/elide-angular-metadata.d.ts +0 -23
- package/src/tools/babel/plugins/elide-angular-metadata.js +0 -110
- package/src/tools/babel/plugins/index.d.ts +0 -11
- package/src/tools/babel/plugins/index.js +0 -21
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +0 -16
- package/src/tools/babel/plugins/pure-toplevel-functions.js +0 -90
- package/src/tools/esbuild/angular/angular-host.d.ts +0 -26
- package/src/tools/esbuild/angular/angular-host.js +0 -72
- package/src/tools/esbuild/angular/compilation/angular-compilation.d.ts +0 -42
- package/src/tools/esbuild/angular/compilation/angular-compilation.js +0 -94
- package/src/tools/esbuild/angular/compilation/aot-compilation.d.ts +0 -21
- package/src/tools/esbuild/angular/compilation/aot-compilation.js +0 -228
- package/src/tools/esbuild/angular/compilation/factory.d.ts +0 -16
- package/src/tools/esbuild/angular/compilation/factory.js +0 -56
- package/src/tools/esbuild/angular/compilation/index.d.ts +0 -10
- package/src/tools/esbuild/angular/compilation/index.js +0 -17
- package/src/tools/esbuild/angular/compilation/jit-compilation.d.ts +0 -21
- package/src/tools/esbuild/angular/compilation/jit-compilation.js +0 -106
- package/src/tools/esbuild/angular/compilation/noop-compilation.d.ts +0 -20
- package/src/tools/esbuild/angular/compilation/noop-compilation.js +0 -26
- package/src/tools/esbuild/angular/compilation/parallel-compilation.d.ts +0 -42
- package/src/tools/esbuild/angular/compilation/parallel-compilation.js +0 -123
- package/src/tools/esbuild/angular/compilation/parallel-worker.d.ts +0 -33
- package/src/tools/esbuild/angular/compilation/parallel-worker.js +0 -90
- package/src/tools/esbuild/angular/compilation-state.d.ts +0 -15
- package/src/tools/esbuild/angular/compilation-state.js +0 -44
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +0 -27
- package/src/tools/esbuild/angular/compiler-plugin.js +0 -441
- package/src/tools/esbuild/angular/component-stylesheets.d.ts +0 -44
- package/src/tools/esbuild/angular/component-stylesheets.js +0 -150
- package/src/tools/esbuild/angular/diagnostics.d.ts +0 -15
- package/src/tools/esbuild/angular/diagnostics.js +0 -69
- package/src/tools/esbuild/angular/file-reference-tracker.d.ts +0 -17
- package/src/tools/esbuild/angular/file-reference-tracker.js +0 -57
- package/src/tools/esbuild/angular/jit-plugin-callbacks.d.ts +0 -23
- package/src/tools/esbuild/angular/jit-plugin-callbacks.js +0 -117
- package/src/tools/esbuild/angular/jit-resource-transformer.d.ts +0 -17
- package/src/tools/esbuild/angular/jit-resource-transformer.js +0 -186
- package/src/tools/esbuild/angular/source-file-cache.d.ts +0 -18
- package/src/tools/esbuild/angular/source-file-cache.js +0 -65
- package/src/tools/esbuild/angular/uri.d.ts +0 -54
- package/src/tools/esbuild/angular/uri.js +0 -74
- package/src/tools/esbuild/angular/web-worker-transformer.d.ts +0 -17
- package/src/tools/esbuild/angular/web-worker-transformer.js +0 -94
- package/src/tools/esbuild/application-code-bundle.d.ts +0 -20
- package/src/tools/esbuild/application-code-bundle.js +0 -368
- package/src/tools/esbuild/budget-stats.d.ts +0 -19
- package/src/tools/esbuild/budget-stats.js +0 -59
- package/src/tools/esbuild/bundler-context.d.ts +0 -75
- package/src/tools/esbuild/bundler-context.js +0 -366
- package/src/tools/esbuild/bundler-execution-result.d.ts +0 -71
- package/src/tools/esbuild/bundler-execution-result.js +0 -131
- package/src/tools/esbuild/cache.d.ts +0 -88
- package/src/tools/esbuild/cache.js +0 -92
- package/src/tools/esbuild/commonjs-checker.d.ts +0 -28
- package/src/tools/esbuild/commonjs-checker.js +0 -151
- package/src/tools/esbuild/compiler-plugin-options.d.ts +0 -16
- package/src/tools/esbuild/compiler-plugin-options.js +0 -49
- package/src/tools/esbuild/external-packages-plugin.d.ts +0 -18
- package/src/tools/esbuild/external-packages-plugin.js +0 -70
- package/src/tools/esbuild/global-scripts.d.ts +0 -16
- package/src/tools/esbuild/global-scripts.js +0 -142
- package/src/tools/esbuild/global-styles.d.ts +0 -10
- package/src/tools/esbuild/global-styles.js +0 -74
- package/src/tools/esbuild/i18n-inliner-worker.d.ts +0 -42
- package/src/tools/esbuild/i18n-inliner-worker.js +0 -136
- package/src/tools/esbuild/i18n-inliner.d.ts +0 -44
- package/src/tools/esbuild/i18n-inliner.js +0 -150
- package/src/tools/esbuild/i18n-locale-plugin.d.ts +0 -22
- package/src/tools/esbuild/i18n-locale-plugin.js +0 -120
- package/src/tools/esbuild/index-html-generator.d.ts +0 -15
- package/src/tools/esbuild/index-html-generator.js +0 -81
- package/src/tools/esbuild/javascript-transformer-worker.d.ts +0 -19
- package/src/tools/esbuild/javascript-transformer-worker.js +0 -154
- package/src/tools/esbuild/javascript-transformer.d.ts +0 -54
- package/src/tools/esbuild/javascript-transformer.js +0 -147
- package/src/tools/esbuild/license-extractor.d.ts +0 -25
- package/src/tools/esbuild/license-extractor.js +0 -158
- package/src/tools/esbuild/load-result-cache.d.ts +0 -21
- package/src/tools/esbuild/load-result-cache.js +0 -75
- package/src/tools/esbuild/profiling.d.ts +0 -11
- package/src/tools/esbuild/profiling.js +0 -78
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.d.ts +0 -18
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.js +0 -44
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.d.ts +0 -17
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.js +0 -73
- package/src/tools/esbuild/stylesheets/bundle-options.d.ts +0 -35
- package/src/tools/esbuild/stylesheets/bundle-options.js +0 -64
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.d.ts +0 -25
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.js +0 -57
- package/src/tools/esbuild/stylesheets/css-language.d.ts +0 -9
- package/src/tools/esbuild/stylesheets/css-language.js +0 -15
- package/src/tools/esbuild/stylesheets/css-resource-plugin.d.ts +0 -18
- package/src/tools/esbuild/stylesheets/css-resource-plugin.js +0 -114
- package/src/tools/esbuild/stylesheets/less-language.d.ts +0 -9
- package/src/tools/esbuild/stylesheets/less-language.js +0 -155
- package/src/tools/esbuild/stylesheets/sass-language.d.ts +0 -10
- package/src/tools/esbuild/stylesheets/sass-language.js +0 -185
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +0 -58
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +0 -282
- package/src/tools/esbuild/utils.d.ts +0 -41
- package/src/tools/esbuild/utils.js +0 -378
- package/src/tools/esbuild/virtual-module-plugin.d.ts +0 -33
- package/src/tools/esbuild/virtual-module-plugin.js +0 -43
- package/src/tools/esbuild/watcher.d.ts +0 -25
- package/src/tools/esbuild/watcher.js +0 -118
- package/src/tools/sass/lexer.d.ts +0 -18
- package/src/tools/sass/lexer.js +0 -161
- package/src/tools/sass/rebasing-importer.d.ts +0 -101
- package/src/tools/sass/rebasing-importer.js +0 -334
- package/src/tools/sass/sass-service.d.ts +0 -72
- package/src/tools/sass/sass-service.js +0 -213
- package/src/tools/sass/worker.d.ts +0 -8
- package/src/tools/sass/worker.js +0 -192
- package/src/tools/vite/angular-memory-plugin.d.ts +0 -24
- package/src/tools/vite/angular-memory-plugin.js +0 -268
- package/src/tools/vite/i18n-locale-plugin.d.ts +0 -18
- package/src/tools/vite/i18n-locale-plugin.js +0 -55
- package/src/typings.d.ts +0 -21
- package/src/utils/bundle-calculator.d.ts +0 -44
- package/src/utils/bundle-calculator.js +0 -303
- package/src/utils/check-port.d.ts +0 -8
- package/src/utils/check-port.js +0 -58
- package/src/utils/delete-output-dir.d.ts +0 -11
- package/src/utils/delete-output-dir.js +0 -46
- package/src/utils/format-bytes.d.ts +0 -8
- package/src/utils/format-bytes.js +0 -22
- package/src/utils/i18n-options.d.ts +0 -33
- package/src/utils/i18n-options.js +0 -161
- package/src/utils/index-file/add-event-dispatch-contract.d.ts +0 -8
- package/src/utils/index-file/add-event-dispatch-contract.js +0 -28
- package/src/utils/index-file/augment-index-html.d.ts +0 -40
- package/src/utils/index-file/augment-index-html.js +0 -239
- package/src/utils/index-file/html-rewriting-stream.d.ts +0 -11
- package/src/utils/index-file/html-rewriting-stream.js +0 -28
- package/src/utils/index-file/index-html-generator.d.ts +0 -57
- package/src/utils/index-file/index-html-generator.js +0 -135
- package/src/utils/index-file/inline-critical-css.d.ts +0 -24
- package/src/utils/index-file/inline-critical-css.js +0 -179
- package/src/utils/index-file/inline-fonts.d.ts +0 -23
- package/src/utils/index-file/inline-fonts.js +0 -267
- package/src/utils/index-file/nonce.d.ts +0 -12
- package/src/utils/index-file/nonce.js +0 -55
- package/src/utils/load-proxy-config.d.ts +0 -8
- package/src/utils/load-proxy-config.js +0 -189
- package/src/utils/load-translations.d.ts +0 -16
- package/src/utils/load-translations.js +0 -84
- package/src/utils/postcss-configuration.d.ts +0 -17
- package/src/utils/postcss-configuration.js +0 -86
- package/src/utils/purge-cache.d.ts +0 -10
- package/src/utils/purge-cache.js +0 -40
- package/src/utils/resolve-assets.d.ts +0 -18
- package/src/utils/resolve-assets.js +0 -35
- package/src/utils/routes-extractor/extractor.d.ts +0 -15
- package/src/utils/routes-extractor/extractor.js +0 -97
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +0 -18
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +0 -129
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.d.ts +0 -8
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +0 -13
- package/src/utils/server-rendering/fetch-patch.d.ts +0 -8
- package/src/utils/server-rendering/fetch-patch.js +0 -66
- package/src/utils/server-rendering/load-esm-from-memory.d.ts +0 -10
- package/src/utils/server-rendering/load-esm-from-memory.js +0 -26
- package/src/utils/server-rendering/main-bundle-exports.d.ts +0 -27
- package/src/utils/server-rendering/main-bundle-exports.js +0 -9
- package/src/utils/server-rendering/prerender.d.ts +0 -23
- package/src/utils/server-rendering/prerender.js +0 -192
- package/src/utils/server-rendering/render-page.d.ts +0 -26
- package/src/utils/server-rendering/render-page.js +0 -110
- package/src/utils/server-rendering/render-worker.d.ts +0 -22
- package/src/utils/server-rendering/render-worker.js +0 -30
- package/src/utils/server-rendering/routes-extractor-worker.d.ts +0 -21
- package/src/utils/server-rendering/routes-extractor-worker.js +0 -53
- package/src/utils/service-worker.d.ts +0 -25
- package/src/utils/service-worker.js +0 -211
- package/src/utils/stats-table.d.ts +0 -20
- package/src/utils/stats-table.js +0 -205
- package/src/utils/supported-browsers.d.ts +0 -10
- package/src/utils/supported-browsers.js +0 -42
- package/src/utils/version.d.ts +0 -8
- package/src/utils/version.js +0 -59
|
@@ -1,189 +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
|
-
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
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.loadProxyConfiguration = void 0;
|
|
34
|
-
const fast_glob_1 = require("fast-glob");
|
|
35
|
-
const node_fs_1 = require("node:fs");
|
|
36
|
-
const promises_1 = require("node:fs/promises");
|
|
37
|
-
const node_path_1 = require("node:path");
|
|
38
|
-
const node_url_1 = require("node:url");
|
|
39
|
-
const picomatch_1 = require("picomatch");
|
|
40
|
-
const error_1 = require("./error");
|
|
41
|
-
const load_esm_1 = require("./load-esm");
|
|
42
|
-
async function loadProxyConfiguration(root, proxyConfig) {
|
|
43
|
-
if (!proxyConfig) {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
const proxyPath = (0, node_path_1.resolve)(root, proxyConfig);
|
|
47
|
-
if (!(0, node_fs_1.existsSync)(proxyPath)) {
|
|
48
|
-
throw new Error(`Proxy configuration file ${proxyPath} does not exist.`);
|
|
49
|
-
}
|
|
50
|
-
let proxyConfiguration;
|
|
51
|
-
switch ((0, node_path_1.extname)(proxyPath)) {
|
|
52
|
-
case '.json': {
|
|
53
|
-
const content = await (0, promises_1.readFile)(proxyPath, 'utf-8');
|
|
54
|
-
const { parse, printParseErrorCode } = await Promise.resolve().then(() => __importStar(require('jsonc-parser')));
|
|
55
|
-
const parseErrors = [];
|
|
56
|
-
proxyConfiguration = parse(content, parseErrors, { allowTrailingComma: true });
|
|
57
|
-
if (parseErrors.length > 0) {
|
|
58
|
-
let errorMessage = `Proxy configuration file ${proxyPath} contains parse errors:`;
|
|
59
|
-
for (const parseError of parseErrors) {
|
|
60
|
-
const { line, column } = getJsonErrorLineColumn(parseError.offset, content);
|
|
61
|
-
errorMessage += `\n[${line}, ${column}] ${printParseErrorCode(parseError.error)}`;
|
|
62
|
-
}
|
|
63
|
-
throw new Error(errorMessage);
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
case '.mjs':
|
|
68
|
-
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
69
|
-
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
70
|
-
// changed to a direct dynamic import.
|
|
71
|
-
proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath)))
|
|
72
|
-
.default;
|
|
73
|
-
break;
|
|
74
|
-
case '.cjs':
|
|
75
|
-
proxyConfiguration = require(proxyPath);
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
// The file could be either CommonJS or ESM.
|
|
79
|
-
// CommonJS is tried first then ESM if loading fails.
|
|
80
|
-
try {
|
|
81
|
-
proxyConfiguration = require(proxyPath);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
(0, error_1.assertIsError)(e);
|
|
86
|
-
if (e.code === 'ERR_REQUIRE_ESM') {
|
|
87
|
-
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
88
|
-
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
89
|
-
// changed to a direct dynamic import.
|
|
90
|
-
proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, node_url_1.pathToFileURL)(proxyPath)))
|
|
91
|
-
.default;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
throw e;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return normalizeProxyConfiguration(proxyConfiguration);
|
|
98
|
-
}
|
|
99
|
-
exports.loadProxyConfiguration = loadProxyConfiguration;
|
|
100
|
-
/**
|
|
101
|
-
* Converts glob patterns to regular expressions to support Vite's proxy option.
|
|
102
|
-
* Also converts the Webpack supported array form to an object form supported by both.
|
|
103
|
-
*
|
|
104
|
-
* @param proxy A proxy configuration object.
|
|
105
|
-
*/
|
|
106
|
-
function normalizeProxyConfiguration(proxy) {
|
|
107
|
-
let normalizedProxy;
|
|
108
|
-
if (Array.isArray(proxy)) {
|
|
109
|
-
// Construct an object-form proxy configuration from the array
|
|
110
|
-
normalizedProxy = {};
|
|
111
|
-
for (const proxyEntry of proxy) {
|
|
112
|
-
if (!('context' in proxyEntry)) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (!Array.isArray(proxyEntry.context)) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
// Array-form entries contain a context string array with the path(s)
|
|
119
|
-
// to use for the configuration entry.
|
|
120
|
-
const context = proxyEntry.context;
|
|
121
|
-
delete proxyEntry.context;
|
|
122
|
-
for (const contextEntry of context) {
|
|
123
|
-
if (typeof contextEntry !== 'string') {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
normalizedProxy[contextEntry] = proxyEntry;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
normalizedProxy = proxy;
|
|
132
|
-
}
|
|
133
|
-
// TODO: Consider upstreaming glob support
|
|
134
|
-
for (const key of Object.keys(normalizedProxy)) {
|
|
135
|
-
if (key[0] !== '^' && (0, fast_glob_1.isDynamicPattern)(key)) {
|
|
136
|
-
const pattern = (0, picomatch_1.makeRe)(key).source;
|
|
137
|
-
normalizedProxy[pattern] = normalizedProxy[key];
|
|
138
|
-
delete normalizedProxy[key];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Replace `pathRewrite` field with a `rewrite` function
|
|
142
|
-
for (const proxyEntry of Object.values(normalizedProxy)) {
|
|
143
|
-
if (typeof proxyEntry === 'object' &&
|
|
144
|
-
'pathRewrite' in proxyEntry &&
|
|
145
|
-
proxyEntry.pathRewrite &&
|
|
146
|
-
typeof proxyEntry.pathRewrite === 'object') {
|
|
147
|
-
// Preprocess path rewrite entries
|
|
148
|
-
const pathRewriteEntries = [];
|
|
149
|
-
for (const [pattern, value] of Object.entries(proxyEntry.pathRewrite)) {
|
|
150
|
-
pathRewriteEntries.push([new RegExp(pattern), value]);
|
|
151
|
-
}
|
|
152
|
-
proxyEntry.rewrite = pathRewriter.bind(undefined, pathRewriteEntries);
|
|
153
|
-
delete proxyEntry.pathRewrite;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return normalizedProxy;
|
|
157
|
-
}
|
|
158
|
-
function pathRewriter(pathRewriteEntries, path) {
|
|
159
|
-
for (const [pattern, value] of pathRewriteEntries) {
|
|
160
|
-
const updated = path.replace(pattern, value);
|
|
161
|
-
if (path !== updated) {
|
|
162
|
-
return updated;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return path;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Calculates the line and column for an error offset in the content of a JSON file.
|
|
169
|
-
* @param location The offset error location from the beginning of the content.
|
|
170
|
-
* @param content The full content of the file containing the error.
|
|
171
|
-
* @returns An object containing the line and column
|
|
172
|
-
*/
|
|
173
|
-
function getJsonErrorLineColumn(offset, content) {
|
|
174
|
-
if (offset === 0) {
|
|
175
|
-
return { line: 1, column: 1 };
|
|
176
|
-
}
|
|
177
|
-
let line = 0;
|
|
178
|
-
let position = 0;
|
|
179
|
-
// eslint-disable-next-line no-constant-condition
|
|
180
|
-
while (true) {
|
|
181
|
-
++line;
|
|
182
|
-
const nextNewline = content.indexOf('\n', position);
|
|
183
|
-
if (nextNewline === -1 || nextNewline > offset) {
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
position = nextNewline + 1;
|
|
187
|
-
}
|
|
188
|
-
return { line, column: offset - position + 1 };
|
|
189
|
-
}
|
|
@@ -1,16 +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 type { Diagnostics } from '@angular/localize/tools';
|
|
9
|
-
export type TranslationLoader = (path: string) => {
|
|
10
|
-
translations: Record<string, import('@angular/localize').ɵParsedTranslation>;
|
|
11
|
-
format: string;
|
|
12
|
-
locale?: string;
|
|
13
|
-
diagnostics: Diagnostics;
|
|
14
|
-
integrity: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function createTranslationLoader(): Promise<TranslationLoader>;
|
|
@@ -1,84 +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
|
-
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
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.createTranslationLoader = void 0;
|
|
34
|
-
const crypto_1 = require("crypto");
|
|
35
|
-
const fs = __importStar(require("fs"));
|
|
36
|
-
const load_esm_1 = require("./load-esm");
|
|
37
|
-
async function createTranslationLoader() {
|
|
38
|
-
const { parsers, diagnostics } = await importParsers();
|
|
39
|
-
return (path) => {
|
|
40
|
-
const content = fs.readFileSync(path, 'utf8');
|
|
41
|
-
const unusedParsers = new Map();
|
|
42
|
-
for (const [format, parser] of Object.entries(parsers)) {
|
|
43
|
-
const analysis = parser.analyze(path, content);
|
|
44
|
-
if (analysis.canParse) {
|
|
45
|
-
// Types don't overlap here so we need to use any.
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
-
const { locale, translations } = parser.parse(path, content, analysis.hint);
|
|
48
|
-
const integrity = 'sha256-' + (0, crypto_1.createHash)('sha256').update(content).digest('base64');
|
|
49
|
-
return { format, locale, translations, diagnostics, integrity };
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
unusedParsers.set(parser, analysis);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const messages = [];
|
|
56
|
-
for (const [parser, analysis] of unusedParsers.entries()) {
|
|
57
|
-
messages.push(analysis.diagnostics.formatDiagnostics(`*** ${parser.constructor.name} ***`));
|
|
58
|
-
}
|
|
59
|
-
throw new Error(`Unsupported translation file format in ${path}. The following parsers were tried:\n` +
|
|
60
|
-
messages.join('\n'));
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.createTranslationLoader = createTranslationLoader;
|
|
64
|
-
async function importParsers() {
|
|
65
|
-
try {
|
|
66
|
-
// Load ESM `@angular/localize/tools` using the TypeScript dynamic import workaround.
|
|
67
|
-
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
68
|
-
// changed to a direct dynamic import.
|
|
69
|
-
const { Diagnostics, ArbTranslationParser, SimpleJsonTranslationParser, Xliff1TranslationParser, Xliff2TranslationParser, XtbTranslationParser, } = await (0, load_esm_1.loadEsmModule)('@angular/localize/tools');
|
|
70
|
-
const diagnostics = new Diagnostics();
|
|
71
|
-
const parsers = {
|
|
72
|
-
arb: new ArbTranslationParser(),
|
|
73
|
-
json: new SimpleJsonTranslationParser(),
|
|
74
|
-
xlf: new Xliff1TranslationParser(),
|
|
75
|
-
xlf2: new Xliff2TranslationParser(),
|
|
76
|
-
// The name ('xmb') needs to match the AOT compiler option
|
|
77
|
-
xmb: new XtbTranslationParser(),
|
|
78
|
-
};
|
|
79
|
-
return { parsers, diagnostics };
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
throw new Error(`Unable to load translation file parsers. Please ensure '@angular/localize' is installed.`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,17 +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
|
-
export interface PostcssConfiguration {
|
|
9
|
-
plugins: [name: string, options?: object | string][];
|
|
10
|
-
}
|
|
11
|
-
export interface SearchDirectory {
|
|
12
|
-
root: string;
|
|
13
|
-
files: Set<string>;
|
|
14
|
-
}
|
|
15
|
-
export declare function generateSearchDirectories(roots: string[]): Promise<SearchDirectory[]>;
|
|
16
|
-
export declare function findTailwindConfiguration(searchDirectories: SearchDirectory[]): string | undefined;
|
|
17
|
-
export declare function loadPostcssConfiguration(searchDirectories: SearchDirectory[]): Promise<PostcssConfiguration | undefined>;
|
|
@@ -1,86 +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.loadPostcssConfiguration = exports.findTailwindConfiguration = exports.generateSearchDirectories = void 0;
|
|
11
|
-
const promises_1 = require("node:fs/promises");
|
|
12
|
-
const node_path_1 = require("node:path");
|
|
13
|
-
const postcssConfigurationFiles = ['postcss.config.json', '.postcssrc.json'];
|
|
14
|
-
const tailwindConfigFiles = [
|
|
15
|
-
'tailwind.config.js',
|
|
16
|
-
'tailwind.config.cjs',
|
|
17
|
-
'tailwind.config.mjs',
|
|
18
|
-
'tailwind.config.ts',
|
|
19
|
-
];
|
|
20
|
-
async function generateSearchDirectories(roots) {
|
|
21
|
-
return await Promise.all(roots.map((root) => (0, promises_1.readdir)(root, { withFileTypes: true }).then((entries) => ({
|
|
22
|
-
root,
|
|
23
|
-
files: new Set(entries.filter((entry) => entry.isFile()).map((entry) => entry.name)),
|
|
24
|
-
}))));
|
|
25
|
-
}
|
|
26
|
-
exports.generateSearchDirectories = generateSearchDirectories;
|
|
27
|
-
function findFile(searchDirectories, potentialFiles) {
|
|
28
|
-
for (const { root, files } of searchDirectories) {
|
|
29
|
-
for (const potential of potentialFiles) {
|
|
30
|
-
if (files.has(potential)) {
|
|
31
|
-
return (0, node_path_1.join)(root, potential);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
function findTailwindConfiguration(searchDirectories) {
|
|
38
|
-
return findFile(searchDirectories, tailwindConfigFiles);
|
|
39
|
-
}
|
|
40
|
-
exports.findTailwindConfiguration = findTailwindConfiguration;
|
|
41
|
-
async function readPostcssConfiguration(configurationFile) {
|
|
42
|
-
const data = await (0, promises_1.readFile)(configurationFile, 'utf-8');
|
|
43
|
-
const config = JSON.parse(data);
|
|
44
|
-
return config;
|
|
45
|
-
}
|
|
46
|
-
async function loadPostcssConfiguration(searchDirectories) {
|
|
47
|
-
const configPath = findFile(searchDirectories, postcssConfigurationFiles);
|
|
48
|
-
if (!configPath) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
const raw = await readPostcssConfiguration(configPath);
|
|
52
|
-
// If no plugins are defined, consider it equivalent to no configuration
|
|
53
|
-
if (!raw.plugins || typeof raw.plugins !== 'object') {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
// Normalize plugin array form
|
|
57
|
-
if (Array.isArray(raw.plugins)) {
|
|
58
|
-
if (raw.plugins.length < 1) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const config = { plugins: [] };
|
|
62
|
-
for (const element of raw.plugins) {
|
|
63
|
-
if (typeof element === 'string') {
|
|
64
|
-
config.plugins.push([element]);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
config.plugins.push(element);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return config;
|
|
71
|
-
}
|
|
72
|
-
// Normalize plugin object map form
|
|
73
|
-
const entries = Object.entries(raw.plugins);
|
|
74
|
-
if (entries.length < 1) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
const config = { plugins: [] };
|
|
78
|
-
for (const [name, options] of entries) {
|
|
79
|
-
if (!options || (typeof options !== 'object' && typeof options !== 'string')) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
config.plugins.push([name, options]);
|
|
83
|
-
}
|
|
84
|
-
return config;
|
|
85
|
-
}
|
|
86
|
-
exports.loadPostcssConfiguration = loadPostcssConfiguration;
|
|
@@ -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 { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
-
/** Delete stale cache directories used by previous versions of build-angular. */
|
|
10
|
-
export declare function purgeStaleBuildCache(context: BuilderContext): Promise<void>;
|
package/src/utils/purge-cache.js
DELETED
|
@@ -1,40 +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.purgeStaleBuildCache = void 0;
|
|
11
|
-
const promises_1 = require("node:fs/promises");
|
|
12
|
-
const node_path_1 = require("node:path");
|
|
13
|
-
const normalize_cache_1 = require("./normalize-cache");
|
|
14
|
-
/** Delete stale cache directories used by previous versions of build-angular. */
|
|
15
|
-
async function purgeStaleBuildCache(context) {
|
|
16
|
-
const projectName = context.target?.project;
|
|
17
|
-
if (!projectName) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const metadata = await context.getProjectMetadata(projectName);
|
|
21
|
-
const { basePath, path, enabled } = (0, normalize_cache_1.normalizeCacheOptions)(metadata, context.workspaceRoot);
|
|
22
|
-
if (!enabled) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
let baseEntries;
|
|
26
|
-
try {
|
|
27
|
-
baseEntries = await (0, promises_1.readdir)(basePath, { withFileTypes: true });
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// No purging possible if base path does not exist or cannot otherwise be accessed
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const entriesToDelete = baseEntries
|
|
34
|
-
.filter((d) => d.isDirectory())
|
|
35
|
-
.map((d) => (0, node_path_1.join)(basePath, d.name))
|
|
36
|
-
.filter((cachePath) => cachePath !== path)
|
|
37
|
-
.map((stalePath) => (0, promises_1.rm)(stalePath, { force: true, recursive: true, maxRetries: 3 }));
|
|
38
|
-
await Promise.allSettled(entriesToDelete);
|
|
39
|
-
}
|
|
40
|
-
exports.purgeStaleBuildCache = purgeStaleBuildCache;
|
|
@@ -1,18 +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
|
-
export declare function resolveAssets(entries: {
|
|
9
|
-
glob: string;
|
|
10
|
-
ignore?: string[];
|
|
11
|
-
input: string;
|
|
12
|
-
output: string;
|
|
13
|
-
flatten?: boolean;
|
|
14
|
-
followSymlinks?: boolean;
|
|
15
|
-
}[], root: string): Promise<{
|
|
16
|
-
source: string;
|
|
17
|
-
destination: string;
|
|
18
|
-
}[]>;
|
|
@@ -1,35 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.resolveAssets = void 0;
|
|
14
|
-
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
15
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
-
async function resolveAssets(entries, root) {
|
|
17
|
-
const defaultIgnore = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'];
|
|
18
|
-
const outputFiles = [];
|
|
19
|
-
for (const entry of entries) {
|
|
20
|
-
const cwd = node_path_1.default.resolve(root, entry.input);
|
|
21
|
-
const files = await (0, fast_glob_1.default)(entry.glob, {
|
|
22
|
-
cwd,
|
|
23
|
-
dot: true,
|
|
24
|
-
ignore: entry.ignore ? defaultIgnore.concat(entry.ignore) : defaultIgnore,
|
|
25
|
-
followSymbolicLinks: entry.followSymlinks,
|
|
26
|
-
});
|
|
27
|
-
for (const file of files) {
|
|
28
|
-
const src = node_path_1.default.join(cwd, file);
|
|
29
|
-
const filePath = entry.flatten ? node_path_1.default.basename(file) : file;
|
|
30
|
-
outputFiles.push({ source: src, destination: node_path_1.default.join(entry.output, filePath) });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return outputFiles;
|
|
34
|
-
}
|
|
35
|
-
exports.resolveAssets = resolveAssets;
|
|
@@ -1,15 +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 { ApplicationRef, Type } from '@angular/core';
|
|
9
|
-
interface RouterResult {
|
|
10
|
-
route: string;
|
|
11
|
-
success: boolean;
|
|
12
|
-
redirect: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function extractRoutes(bootstrapAppFnOrModule: (() => Promise<ApplicationRef>) | Type<unknown>, document: string): AsyncIterableIterator<RouterResult>;
|
|
15
|
-
export {};
|
|
@@ -1,97 +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 { ApplicationRef, Compiler, createPlatformFactory, platformCore, ɵwhenStable as whenStable, ɵConsole, } from '@angular/core';
|
|
9
|
-
import { INITIAL_CONFIG, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS, } from '@angular/platform-server';
|
|
10
|
-
import { Router, ɵloadChildren as loadChildrenHelper } from '@angular/router';
|
|
11
|
-
async function* getRoutesFromRouterConfig(routes, compiler, parentInjector, parentRoute = '') {
|
|
12
|
-
for (const route of routes) {
|
|
13
|
-
const { path, redirectTo, loadChildren, children } = route;
|
|
14
|
-
if (path === undefined) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const currentRoutePath = buildRoutePath(parentRoute, path);
|
|
18
|
-
if (redirectTo !== undefined) {
|
|
19
|
-
// TODO: handle `redirectTo`.
|
|
20
|
-
yield { route: currentRoutePath, success: false, redirect: true };
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (/[:*]/.test(path)) {
|
|
24
|
-
// TODO: handle parameterized routes population.
|
|
25
|
-
yield { route: currentRoutePath, success: false, redirect: false };
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
yield { route: currentRoutePath, success: true, redirect: false };
|
|
29
|
-
if (children?.length) {
|
|
30
|
-
yield* getRoutesFromRouterConfig(children, compiler, parentInjector, currentRoutePath);
|
|
31
|
-
}
|
|
32
|
-
if (loadChildren) {
|
|
33
|
-
const loadedChildRoutes = await loadChildrenHelper(route, compiler, parentInjector).toPromise();
|
|
34
|
-
if (loadedChildRoutes) {
|
|
35
|
-
const { routes: childRoutes, injector = parentInjector } = loadedChildRoutes;
|
|
36
|
-
yield* getRoutesFromRouterConfig(childRoutes, compiler, injector, currentRoutePath);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export async function* extractRoutes(bootstrapAppFnOrModule, document) {
|
|
42
|
-
const platformRef = createPlatformFactory(platformCore, 'server', [
|
|
43
|
-
{
|
|
44
|
-
provide: INITIAL_CONFIG,
|
|
45
|
-
useValue: { document, url: '' },
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
provide: ɵConsole,
|
|
49
|
-
/** An Angular Console Provider that does not print a set of predefined logs. */
|
|
50
|
-
useFactory: () => {
|
|
51
|
-
class Console extends ɵConsole {
|
|
52
|
-
ignoredLogs = new Set(['Angular is running in development mode.']);
|
|
53
|
-
log(message) {
|
|
54
|
-
if (!this.ignoredLogs.has(message)) {
|
|
55
|
-
super.log(message);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return new Console();
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
...INTERNAL_SERVER_PLATFORM_PROVIDERS,
|
|
63
|
-
])();
|
|
64
|
-
try {
|
|
65
|
-
let applicationRef;
|
|
66
|
-
if (isBootstrapFn(bootstrapAppFnOrModule)) {
|
|
67
|
-
applicationRef = await bootstrapAppFnOrModule();
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const moduleRef = await platformRef.bootstrapModule(bootstrapAppFnOrModule);
|
|
71
|
-
applicationRef = moduleRef.injector.get(ApplicationRef);
|
|
72
|
-
}
|
|
73
|
-
// Wait until the application is stable.
|
|
74
|
-
await whenStable(applicationRef);
|
|
75
|
-
const injector = applicationRef.injector;
|
|
76
|
-
const router = injector.get(Router);
|
|
77
|
-
if (router.config.length === 0) {
|
|
78
|
-
// In case there are no routes available
|
|
79
|
-
yield { route: '', success: true, redirect: false };
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const compiler = injector.get(Compiler);
|
|
83
|
-
// Extract all the routes from the config.
|
|
84
|
-
yield* getRoutesFromRouterConfig(router.config, compiler, injector);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
platformRef.destroy();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function isBootstrapFn(value) {
|
|
92
|
-
// We can differentiate between a module and a bootstrap function by reading compiler-generated `ɵmod` static property:
|
|
93
|
-
return typeof value === 'function' && !('ɵmod' in value);
|
|
94
|
-
}
|
|
95
|
-
function buildRoutePath(...routeParts) {
|
|
96
|
-
return routeParts.filter(Boolean).join('/');
|
|
97
|
-
}
|
|
@@ -1,18 +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
|
-
export interface ESMInMemoryFileLoaderWorkerData {
|
|
9
|
-
outputFiles: Record<string, string>;
|
|
10
|
-
workspaceRoot: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function initialize(data: ESMInMemoryFileLoaderWorkerData): void;
|
|
13
|
-
export declare function resolve(specifier: string, context: {
|
|
14
|
-
parentURL: undefined | string;
|
|
15
|
-
}, nextResolve: Function): any;
|
|
16
|
-
export declare function load(url: string, context: {
|
|
17
|
-
format?: string | null;
|
|
18
|
-
}, nextLoad: Function): Promise<any>;
|