@angular/build 18.0.0-next.3
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/LICENSE +21 -0
- package/README.md +5 -0
- package/builders.json +14 -0
- package/package.json +87 -0
- package/src/builders/application/build-action.d.ts +33 -0
- package/src/builders/application/build-action.js +183 -0
- package/src/builders/application/execute-build.d.ts +11 -0
- package/src/builders/application/execute-build.js +125 -0
- package/src/builders/application/execute-post-bundle.d.ts +25 -0
- package/src/builders/application/execute-post-bundle.js +93 -0
- package/src/builders/application/i18n.d.ts +29 -0
- package/src/builders/application/i18n.js +128 -0
- package/src/builders/application/index.d.ts +57 -0
- package/src/builders/application/index.js +121 -0
- package/src/builders/application/options.d.ts +149 -0
- package/src/builders/application/options.js +369 -0
- package/src/builders/application/schema.d.ts +512 -0
- package/src/builders/application/schema.js +58 -0
- package/src/builders/application/schema.json +635 -0
- package/src/builders/application/setup-bundling.d.ts +19 -0
- package/src/builders/application/setup-bundling.js +71 -0
- package/src/builders/dev-server/builder.d.ts +32 -0
- package/src/builders/dev-server/builder.js +70 -0
- package/src/builders/dev-server/index.d.ts +14 -0
- package/src/builders/dev-server/index.js +15 -0
- package/src/builders/dev-server/internal.d.ts +19 -0
- package/src/builders/dev-server/internal.js +29 -0
- package/src/builders/dev-server/options.d.ts +47 -0
- package/src/builders/dev-server/options.js +65 -0
- package/src/builders/dev-server/output.d.ts +16 -0
- package/src/builders/dev-server/output.js +9 -0
- package/src/builders/dev-server/schema.d.ts +118 -0
- package/src/builders/dev-server/schema.js +4 -0
- package/src/builders/dev-server/schema.json +131 -0
- package/src/builders/dev-server/vite-server.d.ts +31 -0
- package/src/builders/dev-server/vite-server.js +504 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +16 -0
- package/src/private.d.ts +35 -0
- package/src/private.js +70 -0
- package/src/tools/babel/plugins/adjust-static-class-members.d.ts +26 -0
- package/src/tools/babel/plugins/adjust-static-class-members.js +351 -0
- package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +22 -0
- package/src/tools/babel/plugins/adjust-typescript-enums.js +113 -0
- package/src/tools/babel/plugins/elide-angular-metadata.d.ts +22 -0
- package/src/tools/babel/plugins/elide-angular-metadata.js +110 -0
- package/src/tools/babel/plugins/index.d.ts +11 -0
- package/src/tools/babel/plugins/index.js +21 -0
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +15 -0
- package/src/tools/babel/plugins/pure-toplevel-functions.js +90 -0
- package/src/tools/babel/typings.d.ts +21 -0
- package/src/tools/esbuild/angular/angular-host.d.ts +26 -0
- package/src/tools/esbuild/angular/angular-host.js +134 -0
- package/src/tools/esbuild/angular/compilation/angular-compilation.d.ts +42 -0
- package/src/tools/esbuild/angular/compilation/angular-compilation.js +94 -0
- package/src/tools/esbuild/angular/compilation/aot-compilation.d.ts +21 -0
- package/src/tools/esbuild/angular/compilation/aot-compilation.js +224 -0
- package/src/tools/esbuild/angular/compilation/factory.d.ts +16 -0
- package/src/tools/esbuild/angular/compilation/factory.js +56 -0
- package/src/tools/esbuild/angular/compilation/index.d.ts +10 -0
- package/src/tools/esbuild/angular/compilation/index.js +17 -0
- package/src/tools/esbuild/angular/compilation/jit-bootstrap-transformer.d.ts +10 -0
- package/src/tools/esbuild/angular/compilation/jit-bootstrap-transformer.js +182 -0
- package/src/tools/esbuild/angular/compilation/jit-compilation.d.ts +21 -0
- package/src/tools/esbuild/angular/compilation/jit-compilation.js +106 -0
- package/src/tools/esbuild/angular/compilation/noop-compilation.d.ts +20 -0
- package/src/tools/esbuild/angular/compilation/noop-compilation.js +26 -0
- package/src/tools/esbuild/angular/compilation/parallel-compilation.d.ts +42 -0
- package/src/tools/esbuild/angular/compilation/parallel-compilation.js +123 -0
- package/src/tools/esbuild/angular/compilation/parallel-worker.d.ts +33 -0
- package/src/tools/esbuild/angular/compilation/parallel-worker.js +90 -0
- package/src/tools/esbuild/angular/compilation-state.d.ts +15 -0
- package/src/tools/esbuild/angular/compilation-state.js +44 -0
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +27 -0
- package/src/tools/esbuild/angular/compiler-plugin.js +441 -0
- package/src/tools/esbuild/angular/component-stylesheets.d.ts +44 -0
- package/src/tools/esbuild/angular/component-stylesheets.js +150 -0
- package/src/tools/esbuild/angular/diagnostics.d.ts +15 -0
- package/src/tools/esbuild/angular/diagnostics.js +69 -0
- package/src/tools/esbuild/angular/file-reference-tracker.d.ts +17 -0
- package/src/tools/esbuild/angular/file-reference-tracker.js +57 -0
- package/src/tools/esbuild/angular/jit-plugin-callbacks.d.ts +23 -0
- package/src/tools/esbuild/angular/jit-plugin-callbacks.js +117 -0
- package/src/tools/esbuild/angular/jit-resource-transformer.d.ts +17 -0
- package/src/tools/esbuild/angular/jit-resource-transformer.js +186 -0
- package/src/tools/esbuild/angular/source-file-cache.d.ts +18 -0
- package/src/tools/esbuild/angular/source-file-cache.js +65 -0
- package/src/tools/esbuild/angular/uri.d.ts +54 -0
- package/src/tools/esbuild/angular/uri.js +74 -0
- package/src/tools/esbuild/angular/web-worker-transformer.d.ts +17 -0
- package/src/tools/esbuild/angular/web-worker-transformer.js +94 -0
- package/src/tools/esbuild/application-code-bundle.d.ts +20 -0
- package/src/tools/esbuild/application-code-bundle.js +368 -0
- package/src/tools/esbuild/budget-stats.d.ts +19 -0
- package/src/tools/esbuild/budget-stats.js +59 -0
- package/src/tools/esbuild/bundler-context.d.ts +75 -0
- package/src/tools/esbuild/bundler-context.js +366 -0
- package/src/tools/esbuild/bundler-execution-result.d.ts +71 -0
- package/src/tools/esbuild/bundler-execution-result.js +131 -0
- package/src/tools/esbuild/cache.d.ts +88 -0
- package/src/tools/esbuild/cache.js +92 -0
- package/src/tools/esbuild/commonjs-checker.d.ts +28 -0
- package/src/tools/esbuild/commonjs-checker.js +151 -0
- package/src/tools/esbuild/compiler-plugin-options.d.ts +16 -0
- package/src/tools/esbuild/compiler-plugin-options.js +49 -0
- package/src/tools/esbuild/external-packages-plugin.d.ts +18 -0
- package/src/tools/esbuild/external-packages-plugin.js +70 -0
- package/src/tools/esbuild/global-scripts.d.ts +16 -0
- package/src/tools/esbuild/global-scripts.js +142 -0
- package/src/tools/esbuild/global-styles.d.ts +10 -0
- package/src/tools/esbuild/global-styles.js +74 -0
- package/src/tools/esbuild/i18n-inliner-worker.d.ts +42 -0
- package/src/tools/esbuild/i18n-inliner-worker.js +136 -0
- package/src/tools/esbuild/i18n-inliner.d.ts +44 -0
- package/src/tools/esbuild/i18n-inliner.js +150 -0
- package/src/tools/esbuild/i18n-locale-plugin.d.ts +22 -0
- package/src/tools/esbuild/i18n-locale-plugin.js +120 -0
- package/src/tools/esbuild/index-html-generator.d.ts +15 -0
- package/src/tools/esbuild/index-html-generator.js +81 -0
- package/src/tools/esbuild/javascript-transformer-worker.d.ts +19 -0
- package/src/tools/esbuild/javascript-transformer-worker.js +154 -0
- package/src/tools/esbuild/javascript-transformer.d.ts +54 -0
- package/src/tools/esbuild/javascript-transformer.js +147 -0
- package/src/tools/esbuild/license-extractor.d.ts +25 -0
- package/src/tools/esbuild/license-extractor.js +158 -0
- package/src/tools/esbuild/load-result-cache.d.ts +21 -0
- package/src/tools/esbuild/load-result-cache.js +75 -0
- package/src/tools/esbuild/profiling.d.ts +11 -0
- package/src/tools/esbuild/profiling.js +78 -0
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.d.ts +18 -0
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.js +44 -0
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.d.ts +17 -0
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.js +73 -0
- package/src/tools/esbuild/stylesheets/bundle-options.d.ts +35 -0
- package/src/tools/esbuild/stylesheets/bundle-options.js +64 -0
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.d.ts +25 -0
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.js +57 -0
- package/src/tools/esbuild/stylesheets/css-language.d.ts +9 -0
- package/src/tools/esbuild/stylesheets/css-language.js +15 -0
- package/src/tools/esbuild/stylesheets/css-resource-plugin.d.ts +18 -0
- package/src/tools/esbuild/stylesheets/css-resource-plugin.js +114 -0
- package/src/tools/esbuild/stylesheets/less-language.d.ts +9 -0
- package/src/tools/esbuild/stylesheets/less-language.js +155 -0
- package/src/tools/esbuild/stylesheets/sass-language.d.ts +10 -0
- package/src/tools/esbuild/stylesheets/sass-language.js +185 -0
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +58 -0
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +282 -0
- package/src/tools/esbuild/utils.d.ts +49 -0
- package/src/tools/esbuild/utils.js +392 -0
- package/src/tools/esbuild/virtual-module-plugin.d.ts +33 -0
- package/src/tools/esbuild/virtual-module-plugin.js +43 -0
- package/src/tools/esbuild/watcher.d.ts +25 -0
- package/src/tools/esbuild/watcher.js +118 -0
- package/src/tools/sass/lexer.d.ts +18 -0
- package/src/tools/sass/lexer.js +161 -0
- package/src/tools/sass/rebasing-importer.d.ts +101 -0
- package/src/tools/sass/rebasing-importer.js +334 -0
- package/src/tools/sass/sass-service.d.ts +72 -0
- package/src/tools/sass/sass-service.js +213 -0
- package/src/tools/sass/worker.d.ts +8 -0
- package/src/tools/sass/worker.js +192 -0
- package/src/tools/vite/angular-memory-plugin.d.ts +24 -0
- package/src/tools/vite/angular-memory-plugin.js +268 -0
- package/src/tools/vite/i18n-locale-plugin.d.ts +18 -0
- package/src/tools/vite/i18n-locale-plugin.js +55 -0
- package/src/utils/bundle-calculator.d.ts +44 -0
- package/src/utils/bundle-calculator.js +303 -0
- package/src/utils/check-port.d.ts +8 -0
- package/src/utils/check-port.js +58 -0
- package/src/utils/color.d.ts +10 -0
- package/src/utils/color.js +63 -0
- package/src/utils/delete-output-dir.d.ts +11 -0
- package/src/utils/delete-output-dir.js +46 -0
- package/src/utils/environment-options.d.ts +16 -0
- package/src/utils/environment-options.js +79 -0
- package/src/utils/error.d.ts +10 -0
- package/src/utils/error.js +21 -0
- package/src/utils/format-bytes.d.ts +8 -0
- package/src/utils/format-bytes.js +22 -0
- package/src/utils/i18n-options.d.ts +33 -0
- package/src/utils/i18n-options.js +161 -0
- package/src/utils/index-file/add-event-dispatch-contract.d.ts +8 -0
- package/src/utils/index-file/add-event-dispatch-contract.js +28 -0
- package/src/utils/index-file/augment-index-html.d.ts +40 -0
- package/src/utils/index-file/augment-index-html.js +239 -0
- package/src/utils/index-file/html-rewriting-stream.d.ts +11 -0
- package/src/utils/index-file/html-rewriting-stream.js +28 -0
- package/src/utils/index-file/index-html-generator.d.ts +57 -0
- package/src/utils/index-file/index-html-generator.js +135 -0
- package/src/utils/index-file/inline-critical-css.d.ts +24 -0
- package/src/utils/index-file/inline-critical-css.js +179 -0
- package/src/utils/index-file/inline-fonts.d.ts +23 -0
- package/src/utils/index-file/inline-fonts.js +267 -0
- package/src/utils/index-file/nonce.d.ts +12 -0
- package/src/utils/index-file/nonce.js +55 -0
- package/src/utils/index-file/style-nonce.d.ts +12 -0
- package/src/utils/index-file/style-nonce.js +55 -0
- package/src/utils/index.d.ts +11 -0
- package/src/utils/index.js +27 -0
- package/src/utils/load-esm.d.ts +20 -0
- package/src/utils/load-esm.js +31 -0
- package/src/utils/load-proxy-config.d.ts +8 -0
- package/src/utils/load-proxy-config.js +189 -0
- package/src/utils/load-translations.d.ts +16 -0
- package/src/utils/load-translations.js +84 -0
- package/src/utils/normalize-asset-patterns.d.ts +14 -0
- package/src/utils/normalize-asset-patterns.js +96 -0
- package/src/utils/normalize-cache.d.ts +16 -0
- package/src/utils/normalize-cache.js +44 -0
- package/src/utils/normalize-optimization.d.ts +13 -0
- package/src/utils/normalize-optimization.js +42 -0
- package/src/utils/normalize-source-maps.d.ts +9 -0
- package/src/utils/normalize-source-maps.js +23 -0
- package/src/utils/postcss-configuration.d.ts +17 -0
- package/src/utils/postcss-configuration.js +86 -0
- package/src/utils/purge-cache.d.ts +10 -0
- package/src/utils/purge-cache.js +40 -0
- package/src/utils/resolve-assets.d.ts +18 -0
- package/src/utils/resolve-assets.js +35 -0
- package/src/utils/routes-extractor/extractor.d.ts +15 -0
- package/src/utils/routes-extractor/extractor.js +97 -0
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +18 -0
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +129 -0
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.d.ts +8 -0
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +13 -0
- package/src/utils/server-rendering/fetch-patch.d.ts +8 -0
- package/src/utils/server-rendering/fetch-patch.js +66 -0
- package/src/utils/server-rendering/load-esm-from-memory.d.ts +10 -0
- package/src/utils/server-rendering/load-esm-from-memory.js +26 -0
- package/src/utils/server-rendering/main-bundle-exports.d.ts +27 -0
- package/src/utils/server-rendering/main-bundle-exports.js +9 -0
- package/src/utils/server-rendering/prerender.d.ts +23 -0
- package/src/utils/server-rendering/prerender.js +192 -0
- package/src/utils/server-rendering/render-page.d.ts +26 -0
- package/src/utils/server-rendering/render-page.js +110 -0
- package/src/utils/server-rendering/render-worker.d.ts +22 -0
- package/src/utils/server-rendering/render-worker.js +30 -0
- package/src/utils/server-rendering/routes-extractor-worker.d.ts +21 -0
- package/src/utils/server-rendering/routes-extractor-worker.js +53 -0
- package/src/utils/service-worker.d.ts +25 -0
- package/src/utils/service-worker.js +211 -0
- package/src/utils/spinner.d.ts +20 -0
- package/src/utils/spinner.js +55 -0
- package/src/utils/stats-table.d.ts +20 -0
- package/src/utils/stats-table.js +205 -0
- package/src/utils/supported-browsers.d.ts +10 -0
- package/src/utils/supported-browsers.js +42 -0
- package/src/utils/tty.d.ts +8 -0
- package/src/utils/tty.js +23 -0
- package/src/utils/url.d.ts +8 -0
- package/src/utils/url.js +18 -0
- package/src/utils/version.d.ts +8 -0
- package/src/utils/version.js +59 -0
|
@@ -0,0 +1,8 @@
|
|
|
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 checkPort(port: number, host: string): Promise<number>;
|
|
@@ -0,0 +1,58 @@
|
|
|
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.checkPort = void 0;
|
|
14
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
15
|
+
const node_net_1 = require("node:net");
|
|
16
|
+
const load_esm_1 = require("./load-esm");
|
|
17
|
+
const tty_1 = require("./tty");
|
|
18
|
+
function createInUseError(port) {
|
|
19
|
+
return new Error(`Port ${port} is already in use. Use '--port' to specify a different port.`);
|
|
20
|
+
}
|
|
21
|
+
async function checkPort(port, host) {
|
|
22
|
+
// Disabled due to Vite not handling port 0 and instead always using the default value (5173)
|
|
23
|
+
// TODO: Enable this again once Vite is fixed
|
|
24
|
+
// if (port === 0) {
|
|
25
|
+
// return 0;
|
|
26
|
+
// }
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const server = (0, node_net_1.createServer)();
|
|
29
|
+
server
|
|
30
|
+
.once('error', (err) => {
|
|
31
|
+
if (err.code !== 'EADDRINUSE') {
|
|
32
|
+
reject(err);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!tty_1.isTTY) {
|
|
36
|
+
reject(createInUseError(port));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
(0, load_esm_1.loadEsmModule)('inquirer')
|
|
40
|
+
.then(({ default: { prompt } }) => prompt({
|
|
41
|
+
type: 'confirm',
|
|
42
|
+
name: 'useDifferent',
|
|
43
|
+
message: `Port ${port} is already in use.\nWould you like to use a different port?`,
|
|
44
|
+
default: true,
|
|
45
|
+
}))
|
|
46
|
+
.then((answers) => answers.useDifferent ? resolve(checkPort(0, host)) : reject(createInUseError(port)), () => reject(createInUseError(port)));
|
|
47
|
+
})
|
|
48
|
+
.once('listening', () => {
|
|
49
|
+
// Get the actual address from the listening server instance
|
|
50
|
+
const address = server.address();
|
|
51
|
+
(0, node_assert_1.default)(address && typeof address !== 'string', 'Port check server address should always be an object.');
|
|
52
|
+
server.close();
|
|
53
|
+
resolve(address.port);
|
|
54
|
+
})
|
|
55
|
+
.listen(port, host);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.checkPort = checkPort;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ansiColors from 'ansi-colors';
|
|
9
|
+
declare const colors: typeof ansiColors;
|
|
10
|
+
export { colors };
|
|
@@ -0,0 +1,63 @@
|
|
|
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.colors = void 0;
|
|
34
|
+
const ansiColors = __importStar(require("ansi-colors"));
|
|
35
|
+
const node_tty_1 = require("node:tty");
|
|
36
|
+
function supportColor() {
|
|
37
|
+
if (process.env.FORCE_COLOR !== undefined) {
|
|
38
|
+
// 2 colors: FORCE_COLOR = 0 (Disables colors), depth 1
|
|
39
|
+
// 16 colors: FORCE_COLOR = 1, depth 4
|
|
40
|
+
// 256 colors: FORCE_COLOR = 2, depth 8
|
|
41
|
+
// 16,777,216 colors: FORCE_COLOR = 3, depth 16
|
|
42
|
+
// See: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_getcolordepth_env
|
|
43
|
+
// and https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/tty.js#L106;
|
|
44
|
+
switch (process.env.FORCE_COLOR) {
|
|
45
|
+
case '':
|
|
46
|
+
case 'true':
|
|
47
|
+
case '1':
|
|
48
|
+
case '2':
|
|
49
|
+
case '3':
|
|
50
|
+
return true;
|
|
51
|
+
default:
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (process.stdout instanceof node_tty_1.WriteStream) {
|
|
56
|
+
return process.stdout.hasColors();
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// Create a separate instance to prevent unintended global changes to the color configuration
|
|
61
|
+
const colors = ansiColors.create();
|
|
62
|
+
exports.colors = colors;
|
|
63
|
+
colors.enabled = supportColor();
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Delete an output directory, but error out if it's the root of the project.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deleteOutputDir(root: string, outputPath: string, emptyOnlyDirectories?: string[]): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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.deleteOutputDir = void 0;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
/**
|
|
14
|
+
* Delete an output directory, but error out if it's the root of the project.
|
|
15
|
+
*/
|
|
16
|
+
async function deleteOutputDir(root, outputPath, emptyOnlyDirectories) {
|
|
17
|
+
const resolvedOutputPath = (0, node_path_1.resolve)(root, outputPath);
|
|
18
|
+
if (resolvedOutputPath === root) {
|
|
19
|
+
throw new Error('Output path MUST not be project root directory!');
|
|
20
|
+
}
|
|
21
|
+
const directoriesToEmpty = emptyOnlyDirectories
|
|
22
|
+
? new Set(emptyOnlyDirectories.map((directory) => (0, node_path_1.join)(resolvedOutputPath, directory)))
|
|
23
|
+
: undefined;
|
|
24
|
+
// Avoid removing the actual directory to avoid errors in cases where the output
|
|
25
|
+
// directory is mounted or symlinked. Instead the contents are removed.
|
|
26
|
+
let entries;
|
|
27
|
+
try {
|
|
28
|
+
entries = await (0, promises_1.readdir)(resolvedOutputPath);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
const fullEntry = (0, node_path_1.join)(resolvedOutputPath, entry);
|
|
38
|
+
// Leave requested directories. This allows symlinks to continue to function.
|
|
39
|
+
if (directoriesToEmpty?.has(fullEntry)) {
|
|
40
|
+
await deleteOutputDir(resolvedOutputPath, fullEntry);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
await (0, promises_1.rm)(fullEntry, { force: true, recursive: true, maxRetries: 3 });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.deleteOutputDir = deleteOutputDir;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 const allowMangle: boolean;
|
|
9
|
+
export declare const shouldBeautify: boolean;
|
|
10
|
+
export declare const allowMinify: boolean;
|
|
11
|
+
export declare const maxWorkers: number;
|
|
12
|
+
export declare const useParallelTs: boolean;
|
|
13
|
+
export declare const debugPerformance: boolean;
|
|
14
|
+
export declare const shouldWatchRoot: boolean;
|
|
15
|
+
export declare const useTypeChecking: boolean;
|
|
16
|
+
export declare const useJSONBuildLogs: boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
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.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.useParallelTs = exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
|
|
11
|
+
function isDisabled(variable) {
|
|
12
|
+
return variable === '0' || variable.toLowerCase() === 'false';
|
|
13
|
+
}
|
|
14
|
+
function isEnabled(variable) {
|
|
15
|
+
return variable === '1' || variable.toLowerCase() === 'true';
|
|
16
|
+
}
|
|
17
|
+
function isPresent(variable) {
|
|
18
|
+
return typeof variable === 'string' && variable !== '';
|
|
19
|
+
}
|
|
20
|
+
// Optimization and mangling
|
|
21
|
+
const debugOptimizeVariable = process.env['NG_BUILD_DEBUG_OPTIMIZE'];
|
|
22
|
+
const debugOptimize = (() => {
|
|
23
|
+
if (!isPresent(debugOptimizeVariable) || isDisabled(debugOptimizeVariable)) {
|
|
24
|
+
return {
|
|
25
|
+
mangle: true,
|
|
26
|
+
minify: true,
|
|
27
|
+
beautify: false,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const debugValue = {
|
|
31
|
+
mangle: false,
|
|
32
|
+
minify: false,
|
|
33
|
+
beautify: true,
|
|
34
|
+
};
|
|
35
|
+
if (isEnabled(debugOptimizeVariable)) {
|
|
36
|
+
return debugValue;
|
|
37
|
+
}
|
|
38
|
+
for (const part of debugOptimizeVariable.split(',')) {
|
|
39
|
+
switch (part.trim().toLowerCase()) {
|
|
40
|
+
case 'mangle':
|
|
41
|
+
debugValue.mangle = true;
|
|
42
|
+
break;
|
|
43
|
+
case 'minify':
|
|
44
|
+
debugValue.minify = true;
|
|
45
|
+
break;
|
|
46
|
+
case 'beautify':
|
|
47
|
+
debugValue.beautify = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return debugValue;
|
|
52
|
+
})();
|
|
53
|
+
const mangleVariable = process.env['NG_BUILD_MANGLE'];
|
|
54
|
+
exports.allowMangle = isPresent(mangleVariable)
|
|
55
|
+
? !isDisabled(mangleVariable)
|
|
56
|
+
: debugOptimize.mangle;
|
|
57
|
+
exports.shouldBeautify = debugOptimize.beautify;
|
|
58
|
+
exports.allowMinify = debugOptimize.minify;
|
|
59
|
+
/**
|
|
60
|
+
* Some environments, like CircleCI which use Docker report a number of CPUs by the host and not the count of available.
|
|
61
|
+
* This cause `Error: Call retries were exceeded` errors when trying to use them.
|
|
62
|
+
*
|
|
63
|
+
* @see https://github.com/nodejs/node/issues/28762
|
|
64
|
+
* @see https://github.com/webpack-contrib/terser-webpack-plugin/issues/143
|
|
65
|
+
* @see https://ithub.com/angular/angular-cli/issues/16860#issuecomment-588828079
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
69
|
+
exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
|
|
70
|
+
const parallelTsVariable = process.env['NG_BUILD_PARALLEL_TS'];
|
|
71
|
+
exports.useParallelTs = !isPresent(parallelTsVariable) || !isDisabled(parallelTsVariable);
|
|
72
|
+
const debugPerfVariable = process.env['NG_BUILD_DEBUG_PERF'];
|
|
73
|
+
exports.debugPerformance = isPresent(debugPerfVariable) && isEnabled(debugPerfVariable);
|
|
74
|
+
const watchRootVariable = process.env['NG_BUILD_WATCH_ROOT'];
|
|
75
|
+
exports.shouldWatchRoot = isPresent(watchRootVariable) && isEnabled(watchRootVariable);
|
|
76
|
+
const typeCheckingVariable = process.env['NG_BUILD_TYPE_CHECK'];
|
|
77
|
+
exports.useTypeChecking = !isPresent(typeCheckingVariable) || !isDisabled(typeCheckingVariable);
|
|
78
|
+
const buildLogsJsonVariable = process.env['NG_BUILD_LOGS_JSON'];
|
|
79
|
+
exports.useJSONBuildLogs = isPresent(buildLogsJsonVariable) && isEnabled(buildLogsJsonVariable);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
export declare function assertIsError(value: unknown): asserts value is Error & {
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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.assertIsError = void 0;
|
|
14
|
+
const assert_1 = __importDefault(require("assert"));
|
|
15
|
+
function assertIsError(value) {
|
|
16
|
+
const isError = value instanceof Error ||
|
|
17
|
+
// The following is needing to identify errors coming from RxJs.
|
|
18
|
+
(typeof value === 'object' && value && 'name' in value && 'message' in value);
|
|
19
|
+
(0, assert_1.default)(isError, 'catch clause variable is not an Error instance');
|
|
20
|
+
}
|
|
21
|
+
exports.assertIsError = assertIsError;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 formatSize(size: number): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
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.formatSize = void 0;
|
|
11
|
+
function formatSize(size) {
|
|
12
|
+
if (size <= 0) {
|
|
13
|
+
return '0 bytes';
|
|
14
|
+
}
|
|
15
|
+
const abbreviations = ['bytes', 'kB', 'MB', 'GB'];
|
|
16
|
+
const index = Math.floor(Math.log(size) / Math.log(1024));
|
|
17
|
+
const roundedSize = size / Math.pow(1024, index);
|
|
18
|
+
// bytes don't have a fraction
|
|
19
|
+
const fractionDigits = index === 0 ? 0 : 2;
|
|
20
|
+
return `${roundedSize.toFixed(fractionDigits)} ${abbreviations[index]}`;
|
|
21
|
+
}
|
|
22
|
+
exports.formatSize = formatSize;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { TranslationLoader } from './load-translations';
|
|
9
|
+
export interface LocaleDescription {
|
|
10
|
+
files: {
|
|
11
|
+
path: string;
|
|
12
|
+
integrity?: string;
|
|
13
|
+
format?: string;
|
|
14
|
+
}[];
|
|
15
|
+
translation?: Record<string, unknown>;
|
|
16
|
+
dataPath?: string;
|
|
17
|
+
baseHref?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface I18nOptions {
|
|
20
|
+
inlineLocales: Set<string>;
|
|
21
|
+
sourceLocale: string;
|
|
22
|
+
locales: Record<string, LocaleDescription>;
|
|
23
|
+
flatOutput?: boolean;
|
|
24
|
+
readonly shouldInline: boolean;
|
|
25
|
+
hasDefinedSourceLocale?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function createI18nOptions(projectMetadata: {
|
|
28
|
+
i18n?: unknown;
|
|
29
|
+
}, inline?: boolean | string[]): I18nOptions;
|
|
30
|
+
export declare function loadTranslations(locale: string, desc: LocaleDescription, workspaceRoot: string, loader: TranslationLoader, logger: {
|
|
31
|
+
warn: (message: string) => void;
|
|
32
|
+
error: (message: string) => void;
|
|
33
|
+
}, usedFormats?: Set<string>, duplicateTranslation?: 'ignore' | 'error' | 'warning'): void;
|
|
@@ -0,0 +1,161 @@
|
|
|
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.loadTranslations = exports.createI18nOptions = void 0;
|
|
14
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
function normalizeTranslationFileOption(option, locale, expectObjectInError) {
|
|
16
|
+
if (typeof option === 'string') {
|
|
17
|
+
return [option];
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(option) && option.every((element) => typeof element === 'string')) {
|
|
20
|
+
return option;
|
|
21
|
+
}
|
|
22
|
+
let errorMessage = `Project i18n locales translation field value for '${locale}' is malformed. `;
|
|
23
|
+
if (expectObjectInError) {
|
|
24
|
+
errorMessage += 'Expected a string, array of strings, or object.';
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
errorMessage += 'Expected a string or array of strings.';
|
|
28
|
+
}
|
|
29
|
+
throw new Error(errorMessage);
|
|
30
|
+
}
|
|
31
|
+
function ensureObject(value, name) {
|
|
32
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
33
|
+
throw new Error(`Project ${name} field is malformed. Expected an object.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function ensureString(value, name) {
|
|
37
|
+
if (typeof value !== 'string') {
|
|
38
|
+
throw new Error(`Project ${name} field is malformed. Expected a string.`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function createI18nOptions(projectMetadata, inline) {
|
|
42
|
+
const { i18n: metadata = {} } = projectMetadata;
|
|
43
|
+
ensureObject(metadata, 'i18n');
|
|
44
|
+
const i18n = {
|
|
45
|
+
inlineLocales: new Set(),
|
|
46
|
+
// en-US is the default locale added to Angular applications (https://angular.io/guide/i18n#i18n-pipes)
|
|
47
|
+
sourceLocale: 'en-US',
|
|
48
|
+
locales: {},
|
|
49
|
+
get shouldInline() {
|
|
50
|
+
return this.inlineLocales.size > 0;
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
let rawSourceLocale;
|
|
54
|
+
let rawSourceLocaleBaseHref;
|
|
55
|
+
if (typeof metadata.sourceLocale === 'string') {
|
|
56
|
+
rawSourceLocale = metadata.sourceLocale;
|
|
57
|
+
}
|
|
58
|
+
else if (metadata.sourceLocale !== undefined) {
|
|
59
|
+
ensureObject(metadata.sourceLocale, 'i18n sourceLocale');
|
|
60
|
+
if (metadata.sourceLocale.code !== undefined) {
|
|
61
|
+
ensureString(metadata.sourceLocale.code, 'i18n sourceLocale code');
|
|
62
|
+
rawSourceLocale = metadata.sourceLocale.code;
|
|
63
|
+
}
|
|
64
|
+
if (metadata.sourceLocale.baseHref !== undefined) {
|
|
65
|
+
ensureString(metadata.sourceLocale.baseHref, 'i18n sourceLocale baseHref');
|
|
66
|
+
rawSourceLocaleBaseHref = metadata.sourceLocale.baseHref;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (rawSourceLocale !== undefined) {
|
|
70
|
+
i18n.sourceLocale = rawSourceLocale;
|
|
71
|
+
i18n.hasDefinedSourceLocale = true;
|
|
72
|
+
}
|
|
73
|
+
i18n.locales[i18n.sourceLocale] = {
|
|
74
|
+
files: [],
|
|
75
|
+
baseHref: rawSourceLocaleBaseHref,
|
|
76
|
+
};
|
|
77
|
+
if (metadata.locales !== undefined) {
|
|
78
|
+
ensureObject(metadata.locales, 'i18n locales');
|
|
79
|
+
for (const [locale, options] of Object.entries(metadata.locales)) {
|
|
80
|
+
let translationFiles;
|
|
81
|
+
let baseHref;
|
|
82
|
+
if (options && typeof options === 'object' && 'translation' in options) {
|
|
83
|
+
translationFiles = normalizeTranslationFileOption(options.translation, locale, false);
|
|
84
|
+
if ('baseHref' in options) {
|
|
85
|
+
ensureString(options.baseHref, `i18n locales ${locale} baseHref`);
|
|
86
|
+
baseHref = options.baseHref;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
translationFiles = normalizeTranslationFileOption(options, locale, true);
|
|
91
|
+
}
|
|
92
|
+
if (locale === i18n.sourceLocale) {
|
|
93
|
+
throw new Error(`An i18n locale ('${locale}') cannot both be a source locale and provide a translation.`);
|
|
94
|
+
}
|
|
95
|
+
i18n.locales[locale] = {
|
|
96
|
+
files: translationFiles.map((file) => ({ path: file })),
|
|
97
|
+
baseHref,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (inline === true) {
|
|
102
|
+
i18n.inlineLocales.add(i18n.sourceLocale);
|
|
103
|
+
Object.keys(i18n.locales).forEach((locale) => i18n.inlineLocales.add(locale));
|
|
104
|
+
}
|
|
105
|
+
else if (inline) {
|
|
106
|
+
for (const locale of inline) {
|
|
107
|
+
if (!i18n.locales[locale] && i18n.sourceLocale !== locale) {
|
|
108
|
+
throw new Error(`Requested locale '${locale}' is not defined for the project.`);
|
|
109
|
+
}
|
|
110
|
+
i18n.inlineLocales.add(locale);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return i18n;
|
|
114
|
+
}
|
|
115
|
+
exports.createI18nOptions = createI18nOptions;
|
|
116
|
+
function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedFormats, duplicateTranslation) {
|
|
117
|
+
let translations = undefined;
|
|
118
|
+
for (const file of desc.files) {
|
|
119
|
+
const loadResult = loader(node_path_1.default.join(workspaceRoot, file.path));
|
|
120
|
+
for (const diagnostics of loadResult.diagnostics.messages) {
|
|
121
|
+
if (diagnostics.type === 'error') {
|
|
122
|
+
logger.error(`Error parsing translation file '${file.path}': ${diagnostics.message}`);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
logger.warn(`WARNING [${file.path}]: ${diagnostics.message}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (loadResult.locale !== undefined && loadResult.locale !== locale) {
|
|
129
|
+
logger.warn(`WARNING [${file.path}]: File target locale ('${loadResult.locale}') does not match configured locale ('${locale}')`);
|
|
130
|
+
}
|
|
131
|
+
usedFormats?.add(loadResult.format);
|
|
132
|
+
file.format = loadResult.format;
|
|
133
|
+
file.integrity = loadResult.integrity;
|
|
134
|
+
if (translations) {
|
|
135
|
+
// Merge translations
|
|
136
|
+
for (const [id, message] of Object.entries(loadResult.translations)) {
|
|
137
|
+
if (translations[id] !== undefined) {
|
|
138
|
+
const duplicateTranslationMessage = `[${file.path}]: Duplicate translations for message '${id}' when merging.`;
|
|
139
|
+
switch (duplicateTranslation) {
|
|
140
|
+
case 'ignore':
|
|
141
|
+
break;
|
|
142
|
+
case 'error':
|
|
143
|
+
logger.error(`ERROR ${duplicateTranslationMessage}`);
|
|
144
|
+
break;
|
|
145
|
+
case 'warning':
|
|
146
|
+
default:
|
|
147
|
+
logger.warn(`WARNING ${duplicateTranslationMessage}`);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
translations[id] = message;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// First or only translation file
|
|
156
|
+
translations = loadResult.translations;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
desc.translation = translations;
|
|
160
|
+
}
|
|
161
|
+
exports.loadTranslations = loadTranslations;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 addEventDispatchContract(html: string): Promise<string>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.addEventDispatchContract = void 0;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const html_rewriting_stream_1 = require("./html-rewriting-stream");
|
|
13
|
+
let jsActionContractScript;
|
|
14
|
+
async function addEventDispatchContract(html) {
|
|
15
|
+
const { rewriter, transformedContent } = await (0, html_rewriting_stream_1.htmlRewritingStream)(html);
|
|
16
|
+
jsActionContractScript ??=
|
|
17
|
+
'<script type="text/javascript" id="ng-event-dispatch-contract">' +
|
|
18
|
+
(await (0, promises_1.readFile)(require.resolve('@angular/core/event-dispatch-contract.min.js'), 'utf-8')) +
|
|
19
|
+
'</script>';
|
|
20
|
+
rewriter.on('startTag', (tag) => {
|
|
21
|
+
rewriter.emitStartTag(tag);
|
|
22
|
+
if (tag.tagName === 'body') {
|
|
23
|
+
rewriter.emitRaw(jsActionContractScript);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return transformedContent();
|
|
27
|
+
}
|
|
28
|
+
exports.addEventDispatchContract = addEventDispatchContract;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 type LoadOutputFileFunctionType = (file: string) => Promise<string>;
|
|
9
|
+
export type CrossOriginValue = 'none' | 'anonymous' | 'use-credentials';
|
|
10
|
+
export type Entrypoint = [name: string, isModule: boolean];
|
|
11
|
+
export interface AugmentIndexHtmlOptions {
|
|
12
|
+
html: string;
|
|
13
|
+
baseHref?: string;
|
|
14
|
+
deployUrl?: string;
|
|
15
|
+
sri: boolean;
|
|
16
|
+
/** crossorigin attribute setting of elements that provide CORS support */
|
|
17
|
+
crossOrigin?: CrossOriginValue;
|
|
18
|
+
files: FileInfo[];
|
|
19
|
+
loadOutputFile: LoadOutputFileFunctionType;
|
|
20
|
+
/** Used to sort the inseration of files in the HTML file */
|
|
21
|
+
entrypoints: Entrypoint[];
|
|
22
|
+
/** Used to set the document default locale */
|
|
23
|
+
lang?: string;
|
|
24
|
+
hints?: {
|
|
25
|
+
url: string;
|
|
26
|
+
mode: string;
|
|
27
|
+
as?: string;
|
|
28
|
+
}[];
|
|
29
|
+
imageDomains?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface FileInfo {
|
|
32
|
+
file: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
extension: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function augmentIndexHtml(params: AugmentIndexHtmlOptions): Promise<{
|
|
37
|
+
content: string;
|
|
38
|
+
warnings: string[];
|
|
39
|
+
errors: string[];
|
|
40
|
+
}>;
|