@angular/build 18.1.0-next.0 → 18.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +23 -14
- package/src/builders/application/build-action.d.ts +1 -1
- package/src/builders/application/build-action.js +2 -3
- package/src/builders/application/execute-build.d.ts +1 -1
- package/src/builders/application/execute-build.js +2 -3
- package/src/builders/application/execute-post-bundle.d.ts +1 -1
- package/src/builders/application/execute-post-bundle.js +2 -3
- package/src/builders/application/i18n.d.ts +1 -1
- package/src/builders/application/i18n.js +3 -4
- package/src/builders/application/index.d.ts +1 -1
- package/src/builders/application/index.js +3 -4
- package/src/builders/application/options.d.ts +3 -3
- package/src/builders/application/options.js +2 -3
- package/src/builders/application/setup-bundling.d.ts +1 -1
- package/src/builders/application/setup-bundling.js +3 -9
- package/src/builders/dev-server/builder.d.ts +1 -2
- package/src/builders/dev-server/builder.js +2 -3
- package/src/builders/dev-server/index.d.ts +1 -1
- package/src/builders/dev-server/index.js +1 -1
- package/src/builders/dev-server/internal.d.ts +1 -1
- package/src/builders/dev-server/internal.js +1 -1
- package/src/builders/dev-server/options.d.ts +5 -1
- package/src/builders/dev-server/options.js +27 -3
- package/src/builders/dev-server/output.d.ts +1 -1
- package/src/builders/dev-server/output.js +1 -1
- package/src/builders/dev-server/schema.d.ts +10 -0
- package/src/builders/dev-server/schema.json +11 -0
- package/src/builders/dev-server/vite-server.d.ts +1 -1
- package/src/builders/dev-server/vite-server.js +43 -35
- package/src/builders/extract-i18n/application-extraction.d.ts +1 -1
- package/src/builders/extract-i18n/application-extraction.js +2 -3
- package/src/builders/extract-i18n/builder.d.ts +1 -1
- package/src/builders/extract-i18n/builder.js +2 -3
- package/src/builders/extract-i18n/index.d.ts +1 -1
- package/src/builders/extract-i18n/index.js +1 -1
- package/src/builders/extract-i18n/options.d.ts +1 -1
- package/src/builders/extract-i18n/options.js +2 -3
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/private.d.ts +1 -1
- package/src/private.js +1 -1
- package/src/tools/babel/plugins/adjust-static-class-members.d.ts +1 -2
- package/src/tools/babel/plugins/adjust-static-class-members.js +3 -4
- package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +1 -2
- package/src/tools/babel/plugins/adjust-typescript-enums.js +3 -4
- package/src/tools/babel/plugins/elide-angular-metadata.d.ts +1 -2
- package/src/tools/babel/plugins/elide-angular-metadata.js +3 -4
- package/src/tools/babel/plugins/index.d.ts +1 -1
- package/src/tools/babel/plugins/index.js +1 -1
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +1 -2
- package/src/tools/babel/plugins/pure-toplevel-functions.js +2 -2
- package/src/tools/babel/typings.d.ts +1 -1
- package/src/tools/esbuild/angular/angular-host.d.ts +1 -1
- package/src/tools/esbuild/angular/angular-host.js +3 -4
- package/src/tools/esbuild/angular/compilation/angular-compilation.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/angular-compilation.js +1 -1
- package/src/tools/esbuild/angular/compilation/aot-compilation.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/aot-compilation.js +43 -8
- package/src/tools/esbuild/angular/compilation/factory.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/factory.js +2 -3
- package/src/tools/esbuild/angular/compilation/index.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/index.js +1 -1
- package/src/tools/esbuild/angular/compilation/jit-bootstrap-transformer.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/jit-bootstrap-transformer.js +3 -4
- package/src/tools/esbuild/angular/compilation/jit-compilation.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/jit-compilation.js +1 -1
- package/src/tools/esbuild/angular/compilation/noop-compilation.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/noop-compilation.js +1 -1
- package/src/tools/esbuild/angular/compilation/parallel-compilation.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation/parallel-compilation.js +1 -1
- package/src/tools/esbuild/angular/compilation/parallel-worker.d.ts +3 -2
- package/src/tools/esbuild/angular/compilation/parallel-worker.js +11 -8
- package/src/tools/esbuild/angular/compilation-state.d.ts +1 -1
- package/src/tools/esbuild/angular/compilation-state.js +3 -3
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +2 -2
- package/src/tools/esbuild/angular/compiler-plugin.js +27 -13
- package/src/tools/esbuild/angular/component-stylesheets.d.ts +1 -1
- package/src/tools/esbuild/angular/component-stylesheets.js +1 -1
- package/src/tools/esbuild/angular/diagnostics.d.ts +1 -1
- package/src/tools/esbuild/angular/diagnostics.js +2 -3
- package/src/tools/esbuild/angular/file-reference-tracker.d.ts +1 -1
- package/src/tools/esbuild/angular/file-reference-tracker.js +1 -1
- package/src/tools/esbuild/angular/jit-plugin-callbacks.d.ts +1 -1
- package/src/tools/esbuild/angular/jit-plugin-callbacks.js +2 -3
- package/src/tools/esbuild/angular/jit-resource-transformer.d.ts +1 -1
- package/src/tools/esbuild/angular/jit-resource-transformer.js +2 -3
- package/src/tools/esbuild/angular/source-file-cache.d.ts +1 -1
- package/src/tools/esbuild/angular/source-file-cache.js +1 -1
- package/src/tools/esbuild/angular/uri.d.ts +1 -1
- package/src/tools/esbuild/angular/uri.js +5 -5
- package/src/tools/esbuild/angular/web-worker-transformer.d.ts +1 -1
- package/src/tools/esbuild/angular/web-worker-transformer.js +2 -3
- package/src/tools/esbuild/application-code-bundle.d.ts +1 -1
- package/src/tools/esbuild/application-code-bundle.js +21 -7
- package/src/tools/esbuild/budget-stats.d.ts +1 -1
- package/src/tools/esbuild/budget-stats.js +2 -3
- package/src/tools/esbuild/bundler-context.d.ts +1 -1
- package/src/tools/esbuild/bundler-context.js +1 -1
- package/src/tools/esbuild/bundler-execution-result.d.ts +1 -1
- package/src/tools/esbuild/bundler-execution-result.js +1 -1
- package/src/tools/esbuild/cache.d.ts +1 -1
- package/src/tools/esbuild/cache.js +1 -1
- package/src/tools/esbuild/commonjs-checker.d.ts +1 -1
- package/src/tools/esbuild/commonjs-checker.js +2 -3
- package/src/tools/esbuild/compiler-plugin-options.d.ts +1 -1
- package/src/tools/esbuild/compiler-plugin-options.js +3 -4
- package/src/tools/esbuild/external-packages-plugin.d.ts +1 -1
- package/src/tools/esbuild/external-packages-plugin.js +2 -3
- package/src/tools/esbuild/global-scripts.d.ts +1 -1
- package/src/tools/esbuild/global-scripts.js +2 -3
- package/src/tools/esbuild/global-styles.d.ts +1 -1
- package/src/tools/esbuild/global-styles.js +3 -4
- package/src/tools/esbuild/i18n-inliner-worker.d.ts +2 -2
- package/src/tools/esbuild/i18n-inliner-worker.js +2 -2
- package/src/tools/esbuild/i18n-inliner.d.ts +1 -1
- package/src/tools/esbuild/i18n-inliner.js +1 -1
- package/src/tools/esbuild/i18n-locale-plugin.d.ts +1 -1
- package/src/tools/esbuild/i18n-locale-plugin.js +3 -3
- package/src/tools/esbuild/index-html-generator.d.ts +1 -1
- package/src/tools/esbuild/index-html-generator.js +9 -12
- package/src/tools/esbuild/javascript-transformer-worker.d.ts +1 -1
- package/src/tools/esbuild/javascript-transformer-worker.js +2 -2
- package/src/tools/esbuild/javascript-transformer.d.ts +2 -2
- package/src/tools/esbuild/javascript-transformer.js +1 -1
- package/src/tools/esbuild/license-extractor.d.ts +1 -1
- package/src/tools/esbuild/license-extractor.js +2 -3
- package/src/tools/esbuild/lmdb-cache-store.d.ts +1 -1
- package/src/tools/esbuild/lmdb-cache-store.js +1 -1
- package/src/tools/esbuild/load-result-cache.d.ts +1 -1
- package/src/tools/esbuild/load-result-cache.js +3 -3
- package/src/tools/esbuild/profiling.d.ts +1 -1
- package/src/tools/esbuild/profiling.js +5 -6
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.d.ts +1 -1
- package/src/tools/esbuild/rxjs-esm-resolution-plugin.js +2 -3
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.d.ts +1 -1
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.js +2 -3
- package/src/tools/esbuild/stylesheets/bundle-options.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/bundle-options.js +2 -3
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/css-inline-fonts-plugin.js +2 -3
- package/src/tools/esbuild/stylesheets/css-language.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/css-language.js +1 -1
- package/src/tools/esbuild/stylesheets/css-resource-plugin.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/css-resource-plugin.js +2 -3
- package/src/tools/esbuild/stylesheets/less-language.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/less-language.js +1 -1
- package/src/tools/esbuild/stylesheets/sass-language.d.ts +1 -1
- package/src/tools/esbuild/stylesheets/sass-language.js +30 -4
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +9 -2
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +46 -41
- package/src/tools/esbuild/utils.d.ts +1 -1
- package/src/tools/esbuild/utils.js +16 -17
- package/src/tools/esbuild/virtual-module-plugin.d.ts +1 -1
- package/src/tools/esbuild/virtual-module-plugin.js +2 -3
- package/src/tools/esbuild/watcher.d.ts +1 -1
- package/src/tools/esbuild/watcher.js +3 -3
- package/src/tools/sass/lexer.d.ts +1 -1
- package/src/tools/sass/lexer.js +2 -3
- package/src/tools/sass/rebasing-importer.d.ts +1 -1
- package/src/tools/sass/rebasing-importer.js +3 -3
- package/src/tools/sass/sass-service.d.ts +1 -1
- package/src/tools/sass/sass-service.js +4 -2
- package/src/tools/sass/worker.d.ts +3 -5
- package/src/tools/sass/worker.js +2 -2
- package/src/tools/vite/angular-memory-plugin.d.ts +1 -1
- package/src/tools/vite/angular-memory-plugin.js +2 -3
- package/src/tools/vite/i18n-locale-plugin.d.ts +1 -1
- package/src/tools/vite/i18n-locale-plugin.js +3 -3
- package/src/utils/bundle-calculator.d.ts +1 -1
- package/src/utils/bundle-calculator.js +5 -5
- package/src/utils/check-port.d.ts +1 -1
- package/src/utils/check-port.js +28 -9
- package/src/utils/color.d.ts +1 -1
- package/src/utils/color.js +1 -1
- package/src/utils/delete-output-dir.d.ts +1 -1
- package/src/utils/delete-output-dir.js +2 -3
- package/src/utils/environment-options.d.ts +1 -1
- package/src/utils/environment-options.js +1 -1
- package/src/utils/error.d.ts +1 -1
- package/src/utils/error.js +2 -3
- package/src/utils/format-bytes.d.ts +1 -1
- package/src/utils/format-bytes.js +2 -3
- package/src/utils/i18n-options.d.ts +1 -1
- package/src/utils/i18n-options.js +3 -4
- package/src/utils/index-file/add-event-dispatch-contract.d.ts +1 -1
- package/src/utils/index-file/add-event-dispatch-contract.js +2 -3
- package/src/utils/index-file/augment-index-html.d.ts +1 -1
- package/src/utils/index-file/augment-index-html.js +22 -10
- package/src/utils/index-file/html-rewriting-stream.d.ts +1 -1
- package/src/utils/index-file/html-rewriting-stream.js +2 -3
- package/src/utils/index-file/index-html-generator.d.ts +1 -1
- package/src/utils/index-file/index-html-generator.js +1 -1
- package/src/utils/index-file/inline-critical-css.d.ts +1 -1
- package/src/utils/index-file/inline-critical-css.js +1 -1
- package/src/utils/index-file/inline-fonts.d.ts +1 -1
- package/src/utils/index-file/inline-fonts.js +1 -1
- package/src/utils/index-file/nonce.d.ts +1 -1
- package/src/utils/index-file/nonce.js +2 -3
- package/src/utils/index-file/valid-self-closing-tags.d.ts +1 -1
- package/src/utils/index-file/valid-self-closing-tags.js +1 -1
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.js +1 -1
- package/src/utils/load-esm.d.ts +1 -1
- package/src/utils/load-esm.js +2 -3
- package/src/utils/load-proxy-config.d.ts +1 -1
- package/src/utils/load-proxy-config.js +2 -3
- package/src/utils/load-translations.d.ts +1 -1
- package/src/utils/load-translations.js +2 -3
- package/src/utils/normalize-asset-patterns.d.ts +1 -1
- package/src/utils/normalize-asset-patterns.js +3 -3
- package/src/utils/normalize-cache.d.ts +1 -1
- package/src/utils/normalize-cache.js +3 -4
- package/src/utils/normalize-optimization.d.ts +1 -1
- package/src/utils/normalize-optimization.js +2 -3
- package/src/utils/normalize-source-maps.d.ts +1 -1
- package/src/utils/normalize-source-maps.js +2 -3
- package/src/utils/postcss-configuration.d.ts +1 -1
- package/src/utils/postcss-configuration.js +4 -5
- package/src/utils/purge-cache.d.ts +1 -1
- package/src/utils/purge-cache.js +2 -3
- package/src/utils/resolve-assets.d.ts +1 -1
- package/src/utils/resolve-assets.js +2 -3
- package/src/utils/routes-extractor/extractor.d.ts +1 -1
- package/src/utils/routes-extractor/extractor.js +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +4 -5
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.d.ts +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +1 -1
- package/src/utils/server-rendering/fetch-patch.d.ts +1 -1
- package/src/utils/server-rendering/fetch-patch.js +2 -3
- package/src/utils/server-rendering/load-esm-from-memory.d.ts +1 -1
- package/src/utils/server-rendering/load-esm-from-memory.js +2 -3
- package/src/utils/server-rendering/main-bundle-exports.d.ts +1 -1
- package/src/utils/server-rendering/main-bundle-exports.js +1 -1
- package/src/utils/server-rendering/prerender.d.ts +1 -1
- package/src/utils/server-rendering/prerender.js +2 -3
- package/src/utils/server-rendering/render-page.d.ts +1 -1
- package/src/utils/server-rendering/render-page.js +2 -3
- package/src/utils/server-rendering/render-worker.d.ts +1 -1
- package/src/utils/server-rendering/render-worker.js +1 -1
- package/src/utils/server-rendering/routes-extractor-worker.d.ts +1 -1
- package/src/utils/server-rendering/routes-extractor-worker.js +1 -1
- package/src/utils/service-worker.d.ts +1 -3
- package/src/utils/service-worker.js +4 -5
- package/src/utils/spinner.d.ts +1 -1
- package/src/utils/spinner.js +1 -1
- package/src/utils/stats-table.d.ts +1 -1
- package/src/utils/stats-table.js +3 -4
- package/src/utils/supported-browsers.d.ts +1 -1
- package/src/utils/supported-browsers.js +2 -3
- package/src/utils/tty.d.ts +1 -1
- package/src/utils/tty.js +2 -3
- package/src/utils/url.d.ts +1 -1
- package/src/utils/url.js +2 -3
- package/src/utils/version.d.ts +1 -1
- package/src/utils/version.js +2 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -33,6 +33,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
33
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
34
|
};
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.default = transformJavaScript;
|
|
36
37
|
const core_1 = require("@babel/core");
|
|
37
38
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
38
39
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -47,7 +48,6 @@ async function transformJavaScript(request) {
|
|
|
47
48
|
// Transfer the data via `move` instead of cloning
|
|
48
49
|
return piscina_1.default.move(textEncoder.encode(transformedData));
|
|
49
50
|
}
|
|
50
|
-
exports.default = transformJavaScript;
|
|
51
51
|
/**
|
|
52
52
|
* Cached instance of the compiler-cli linker's createEs2015LinkerPlugin function.
|
|
53
53
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Cache } from './cache';
|
|
9
9
|
/**
|
|
@@ -26,7 +26,7 @@ export declare class JavaScriptTransformer {
|
|
|
26
26
|
#private;
|
|
27
27
|
readonly maxThreads: number;
|
|
28
28
|
private readonly cache?;
|
|
29
|
-
constructor(options: JavaScriptTransformerOptions, maxThreads: number, cache?: Cache<Uint8Array
|
|
29
|
+
constructor(options: JavaScriptTransformerOptions, maxThreads: number, cache?: Cache<Uint8Array> | undefined);
|
|
30
30
|
/**
|
|
31
31
|
* Performs JavaScript transformations on a file from the filesystem.
|
|
32
32
|
* If no transformations are required, the data for the original file will be returned.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Metafile } from 'esbuild';
|
|
9
9
|
/**
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.extractLicenses =
|
|
13
|
+
exports.extractLicenses = extractLicenses;
|
|
14
14
|
const promises_1 = require("node:fs/promises");
|
|
15
15
|
const node_path_1 = __importDefault(require("node:path"));
|
|
16
16
|
/**
|
|
@@ -155,4 +155,3 @@ async function extractLicenses(metafile, rootDirectory) {
|
|
|
155
155
|
}
|
|
156
156
|
return extractedLicenseContent;
|
|
157
157
|
}
|
|
158
|
-
exports.extractLicenses = extractLicenses;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Cache, CacheStore } from './cache';
|
|
9
9
|
export declare class LmbdCacheStore implements CacheStore<unknown> {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.LmbdCacheStore = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { OnLoadResult, PluginBuild } from 'esbuild';
|
|
9
9
|
export interface LoadResultCache {
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.MemoryLoadResultCache =
|
|
10
|
+
exports.MemoryLoadResultCache = void 0;
|
|
11
|
+
exports.createCachedLoad = createCachedLoad;
|
|
11
12
|
const node_path_1 = require("node:path");
|
|
12
13
|
function createCachedLoad(cache, callback) {
|
|
13
14
|
if (cache === undefined) {
|
|
@@ -31,7 +32,6 @@ function createCachedLoad(cache, callback) {
|
|
|
31
32
|
return result;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
exports.createCachedLoad = createCachedLoad;
|
|
35
35
|
class MemoryLoadResultCache {
|
|
36
36
|
#loadResults = new Map();
|
|
37
37
|
#fileDependencies = new Map();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
export declare function resetCumulativeDurations(): void;
|
|
9
9
|
export declare function logCumulativeDurations(): void;
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.resetCumulativeDurations = resetCumulativeDurations;
|
|
11
|
+
exports.logCumulativeDurations = logCumulativeDurations;
|
|
12
|
+
exports.profileAsync = profileAsync;
|
|
13
|
+
exports.profileSync = profileSync;
|
|
11
14
|
const environment_options_1 = require("../../utils/environment-options");
|
|
12
15
|
let cumulativeDurations;
|
|
13
16
|
function resetCumulativeDurations() {
|
|
14
17
|
cumulativeDurations?.clear();
|
|
15
18
|
}
|
|
16
|
-
exports.resetCumulativeDurations = resetCumulativeDurations;
|
|
17
19
|
function logCumulativeDurations() {
|
|
18
20
|
if (!environment_options_1.debugPerformance || !cumulativeDurations) {
|
|
19
21
|
return;
|
|
@@ -36,7 +38,6 @@ function logCumulativeDurations() {
|
|
|
36
38
|
console.log(`DURATION[${name}]: ${total.toFixed(9)}s [count: ${durations.length}; avg: ${average.toFixed(9)}s; min: ${min?.toFixed(9)}s; max: ${max?.toFixed(9)}s]`);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
exports.logCumulativeDurations = logCumulativeDurations;
|
|
40
41
|
function recordDuration(name, startTime, cumulative) {
|
|
41
42
|
const duration = Number(process.hrtime.bigint() - startTime) / 10 ** 9;
|
|
42
43
|
if (cumulative) {
|
|
@@ -62,7 +63,6 @@ async function profileAsync(name, action, cumulative) {
|
|
|
62
63
|
recordDuration(name, startTime, cumulative);
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
exports.profileAsync = profileAsync;
|
|
66
66
|
function profileSync(name, action, cumulative) {
|
|
67
67
|
if (!environment_options_1.debugPerformance) {
|
|
68
68
|
return action();
|
|
@@ -75,4 +75,3 @@ function profileSync(name, action, cumulative) {
|
|
|
75
75
|
recordDuration(name, startTime, cumulative);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
exports.profileSync = profileSync;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
9
|
/**
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createRxjsEsmResolutionPlugin =
|
|
10
|
+
exports.createRxjsEsmResolutionPlugin = createRxjsEsmResolutionPlugin;
|
|
11
11
|
const RXJS_ESM_RESOLUTION = Symbol('RXJS_ESM_RESOLUTION');
|
|
12
12
|
/**
|
|
13
13
|
* Creates a plugin that forces ESM resolution of rxjs.
|
|
@@ -41,4 +41,3 @@ function createRxjsEsmResolutionPlugin() {
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
exports.createRxjsEsmResolutionPlugin = createRxjsEsmResolutionPlugin;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
9
|
/**
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createSourcemapIgnorelistPlugin =
|
|
10
|
+
exports.createSourcemapIgnorelistPlugin = createSourcemapIgnorelistPlugin;
|
|
11
11
|
/**
|
|
12
12
|
* The field identifier for the sourcemap Chrome Devtools ignore list extension.
|
|
13
13
|
*
|
|
@@ -70,4 +70,3 @@ function createSourcemapIgnorelistPlugin() {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
exports.createSourcemapIgnorelistPlugin = createSourcemapIgnorelistPlugin;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { BuildOptions } from 'esbuild';
|
|
9
9
|
import { NormalizedCachedOptions } from '../../../utils/normalize-cache';
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.createStylesheetBundleOptions =
|
|
13
|
+
exports.createStylesheetBundleOptions = createStylesheetBundleOptions;
|
|
14
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
15
|
const css_inline_fonts_plugin_1 = require("./css-inline-fonts-plugin");
|
|
16
16
|
const css_language_1 = require("./css-language");
|
|
@@ -61,4 +61,3 @@ function createStylesheetBundleOptions(options, cache, inlineComponentData) {
|
|
|
61
61
|
plugins,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
exports.createStylesheetBundleOptions = createStylesheetBundleOptions;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
9
|
import { NormalizedCachedOptions } from '../../../utils/normalize-cache';
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createCssInlineFontsPlugin =
|
|
10
|
+
exports.createCssInlineFontsPlugin = createCssInlineFontsPlugin;
|
|
11
11
|
const inline_fonts_1 = require("../../../utils/index-file/inline-fonts");
|
|
12
12
|
const load_result_cache_1 = require("../load-result-cache");
|
|
13
13
|
/**
|
|
@@ -54,4 +54,3 @@ function createCssInlineFontsPlugin({ cache, cacheOptions, }) {
|
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
exports.createCssInlineFontsPlugin = createCssInlineFontsPlugin;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { StylesheetLanguage } from './stylesheet-plugin-factory';
|
|
9
9
|
export declare const CssStylesheetLanguage: Readonly<StylesheetLanguage>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.CssStylesheetLanguage = void 0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
9
|
import { LoadResultCache } from '../load-result-cache';
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createCssResourcePlugin =
|
|
10
|
+
exports.createCssResourcePlugin = createCssResourcePlugin;
|
|
11
11
|
const promises_1 = require("node:fs/promises");
|
|
12
12
|
const node_path_1 = require("node:path");
|
|
13
13
|
const load_result_cache_1 = require("../load-result-cache");
|
|
@@ -111,4 +111,3 @@ function createCssResourcePlugin(cache) {
|
|
|
111
111
|
},
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
exports.createCssResourcePlugin = createCssResourcePlugin;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { StylesheetLanguage } from './stylesheet-plugin-factory';
|
|
9
9
|
export declare const LessStylesheetLanguage: Readonly<StylesheetLanguage>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { StylesheetLanguage } from './stylesheet-plugin-factory';
|
|
9
9
|
export declare function shutdownSassWorkerPool(): void;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -30,7 +30,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.SassStylesheetLanguage =
|
|
33
|
+
exports.SassStylesheetLanguage = void 0;
|
|
34
|
+
exports.shutdownSassWorkerPool = shutdownSassWorkerPool;
|
|
34
35
|
const node_path_1 = require("node:path");
|
|
35
36
|
const node_url_1 = require("node:url");
|
|
36
37
|
const cache_1 = require("../cache");
|
|
@@ -49,7 +50,6 @@ function shutdownSassWorkerPool() {
|
|
|
49
50
|
}
|
|
50
51
|
sassWorkerPoolPromise = undefined;
|
|
51
52
|
}
|
|
52
|
-
exports.shutdownSassWorkerPool = shutdownSassWorkerPool;
|
|
53
53
|
exports.SassStylesheetLanguage = Object.freeze({
|
|
54
54
|
name: 'sass',
|
|
55
55
|
componentFilter: /^s[ac]ss;/,
|
|
@@ -169,6 +169,10 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
169
169
|
catch (error) {
|
|
170
170
|
if (isSassException(error)) {
|
|
171
171
|
const fileWithError = error.span.url ? (0, node_url_1.fileURLToPath)(error.span.url) : undefined;
|
|
172
|
+
const watchFiles = [filePath, ...extractFilesFromStack(error.sassStack)];
|
|
173
|
+
if (fileWithError) {
|
|
174
|
+
watchFiles.push(fileWithError);
|
|
175
|
+
}
|
|
172
176
|
return {
|
|
173
177
|
loader: 'css',
|
|
174
178
|
errors: [
|
|
@@ -177,7 +181,7 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
177
181
|
},
|
|
178
182
|
],
|
|
179
183
|
warnings,
|
|
180
|
-
watchFiles
|
|
184
|
+
watchFiles,
|
|
181
185
|
};
|
|
182
186
|
}
|
|
183
187
|
throw error;
|
|
@@ -190,3 +194,25 @@ function sourceMapToUrlComment(sourceMap, root) {
|
|
|
190
194
|
const urlSourceMap = Buffer.from(JSON.stringify(sourceMap), 'utf-8').toString('base64');
|
|
191
195
|
return `/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${urlSourceMap} */`;
|
|
192
196
|
}
|
|
197
|
+
function* extractFilesFromStack(stack) {
|
|
198
|
+
const lines = stack.split('\n');
|
|
199
|
+
const cwd = process.cwd();
|
|
200
|
+
// Stack line has format of "<file> <location> <identifier>"
|
|
201
|
+
for (const line of lines) {
|
|
202
|
+
const segments = line.split(' ');
|
|
203
|
+
if (segments.length < 3) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
// Extract path from stack line.
|
|
207
|
+
// Paths may contain spaces. All segments before location are part of the file path.
|
|
208
|
+
let path = '';
|
|
209
|
+
let index = 0;
|
|
210
|
+
while (!segments[index].match(/\d+:\d+/)) {
|
|
211
|
+
path += segments[index++];
|
|
212
|
+
}
|
|
213
|
+
if (path) {
|
|
214
|
+
// Stack paths from dart-sass are relative to the current working directory (not input file or workspace root)
|
|
215
|
+
yield (0, node_path_1.join)(cwd, path);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { OnLoadResult, Plugin, PluginBuild } from 'esbuild';
|
|
9
9
|
import type { PostcssConfiguration } from '../../../utils/postcss-configuration';
|
|
@@ -52,7 +52,14 @@ export interface StylesheetLanguage {
|
|
|
52
52
|
export declare class StylesheetPluginFactory {
|
|
53
53
|
private readonly options;
|
|
54
54
|
private readonly cache?;
|
|
55
|
-
private postcssProcessor?;
|
|
56
55
|
constructor(options: StylesheetPluginOptions, cache?: LoadResultCache | undefined);
|
|
57
56
|
create(language: Readonly<StylesheetLanguage>): Plugin;
|
|
57
|
+
private setupPostcssPromise;
|
|
58
|
+
private get setupPostcss();
|
|
59
|
+
private initPostcssCallCount;
|
|
60
|
+
/**
|
|
61
|
+
* This method should not be called directly.
|
|
62
|
+
* Use {@link setupPostcss} instead.
|
|
63
|
+
*/
|
|
64
|
+
private initPostcss;
|
|
58
65
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
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.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -65,56 +65,19 @@ const postcssProcessors = new Map();
|
|
|
65
65
|
class StylesheetPluginFactory {
|
|
66
66
|
options;
|
|
67
67
|
cache;
|
|
68
|
-
postcssProcessor;
|
|
69
68
|
constructor(options, cache) {
|
|
70
69
|
this.options = options;
|
|
71
70
|
this.cache = cache;
|
|
72
71
|
}
|
|
73
72
|
create(language) {
|
|
73
|
+
const { cache, options, setupPostcss } = this;
|
|
74
74
|
// Return a noop plugin if no load actions are required
|
|
75
|
-
if (!language.process &&
|
|
76
|
-
!this.options.postcssConfiguration &&
|
|
77
|
-
!this.options.tailwindConfiguration) {
|
|
75
|
+
if (!language.process && !options.postcssConfiguration && !options.tailwindConfiguration) {
|
|
78
76
|
return {
|
|
79
77
|
name: 'angular-' + language.name,
|
|
80
78
|
setup() { },
|
|
81
79
|
};
|
|
82
80
|
}
|
|
83
|
-
const { cache, options } = this;
|
|
84
|
-
const setupPostcss = async () => {
|
|
85
|
-
// Return already created processor if present
|
|
86
|
-
if (this.postcssProcessor) {
|
|
87
|
-
return this.postcssProcessor;
|
|
88
|
-
}
|
|
89
|
-
if (options.postcssConfiguration) {
|
|
90
|
-
const postCssInstanceKey = JSON.stringify(options.postcssConfiguration);
|
|
91
|
-
this.postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
92
|
-
if (!this.postcssProcessor) {
|
|
93
|
-
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
94
|
-
this.postcssProcessor = postcss();
|
|
95
|
-
for (const [pluginName, pluginOptions] of options.postcssConfiguration.plugins) {
|
|
96
|
-
const { default: plugin } = await Promise.resolve(`${pluginName}`).then(s => __importStar(require(s)));
|
|
97
|
-
if (typeof plugin !== 'function' || plugin.postcss !== true) {
|
|
98
|
-
throw new Error(`Attempted to load invalid Postcss plugin: "${pluginName}"`);
|
|
99
|
-
}
|
|
100
|
-
this.postcssProcessor.use(plugin(pluginOptions));
|
|
101
|
-
}
|
|
102
|
-
postcssProcessors.set(postCssInstanceKey, new WeakRef(this.postcssProcessor));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else if (options.tailwindConfiguration) {
|
|
106
|
-
const { package: tailwindPackage, file: config } = options.tailwindConfiguration;
|
|
107
|
-
const postCssInstanceKey = tailwindPackage + ':' + config;
|
|
108
|
-
this.postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
109
|
-
if (!this.postcssProcessor) {
|
|
110
|
-
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
111
|
-
const tailwind = await Promise.resolve(`${tailwindPackage}`).then(s => __importStar(require(s)));
|
|
112
|
-
this.postcssProcessor = postcss().use(tailwind.default({ config }));
|
|
113
|
-
postcssProcessors.set(postCssInstanceKey, new WeakRef(this.postcssProcessor));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return this.postcssProcessor;
|
|
117
|
-
};
|
|
118
81
|
return {
|
|
119
82
|
name: 'angular-' + language.name,
|
|
120
83
|
async setup(build) {
|
|
@@ -122,7 +85,7 @@ class StylesheetPluginFactory {
|
|
|
122
85
|
let postcssProcessor;
|
|
123
86
|
build.onStart(async () => {
|
|
124
87
|
try {
|
|
125
|
-
postcssProcessor = await setupPostcss
|
|
88
|
+
postcssProcessor = await setupPostcss;
|
|
126
89
|
}
|
|
127
90
|
catch {
|
|
128
91
|
return {
|
|
@@ -156,6 +119,48 @@ class StylesheetPluginFactory {
|
|
|
156
119
|
},
|
|
157
120
|
};
|
|
158
121
|
}
|
|
122
|
+
setupPostcssPromise;
|
|
123
|
+
get setupPostcss() {
|
|
124
|
+
return (this.setupPostcssPromise ??= this.initPostcss());
|
|
125
|
+
}
|
|
126
|
+
initPostcssCallCount = 0;
|
|
127
|
+
/**
|
|
128
|
+
* This method should not be called directly.
|
|
129
|
+
* Use {@link setupPostcss} instead.
|
|
130
|
+
*/
|
|
131
|
+
async initPostcss() {
|
|
132
|
+
node_assert_1.default.equal(++this.initPostcssCallCount, 1, '`initPostcss` was called more than once.');
|
|
133
|
+
const { options } = this;
|
|
134
|
+
if (options.postcssConfiguration) {
|
|
135
|
+
const postCssInstanceKey = JSON.stringify(options.postcssConfiguration);
|
|
136
|
+
let postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
137
|
+
if (!postcssProcessor) {
|
|
138
|
+
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
139
|
+
postcssProcessor = postcss();
|
|
140
|
+
for (const [pluginName, pluginOptions] of options.postcssConfiguration.plugins) {
|
|
141
|
+
const { default: plugin } = await Promise.resolve(`${pluginName}`).then(s => __importStar(require(s)));
|
|
142
|
+
if (typeof plugin !== 'function' || plugin.postcss !== true) {
|
|
143
|
+
throw new Error(`Attempted to load invalid Postcss plugin: "${pluginName}"`);
|
|
144
|
+
}
|
|
145
|
+
postcssProcessor.use(plugin(pluginOptions));
|
|
146
|
+
}
|
|
147
|
+
postcssProcessors.set(postCssInstanceKey, new WeakRef(postcssProcessor));
|
|
148
|
+
}
|
|
149
|
+
return postcssProcessor;
|
|
150
|
+
}
|
|
151
|
+
else if (options.tailwindConfiguration) {
|
|
152
|
+
const { package: tailwindPackage, file: config } = options.tailwindConfiguration;
|
|
153
|
+
const postCssInstanceKey = tailwindPackage + ':' + config;
|
|
154
|
+
let postcssProcessor = postcssProcessors.get(postCssInstanceKey)?.deref();
|
|
155
|
+
if (!postcssProcessor) {
|
|
156
|
+
postcss ??= (await Promise.resolve().then(() => __importStar(require('postcss')))).default;
|
|
157
|
+
const tailwind = await Promise.resolve(`${tailwindPackage}`).then(s => __importStar(require(s)));
|
|
158
|
+
postcssProcessor = postcss().use(tailwind.default({ config }));
|
|
159
|
+
postcssProcessors.set(postCssInstanceKey, new WeakRef(postcssProcessor));
|
|
160
|
+
}
|
|
161
|
+
return postcssProcessor;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
159
164
|
}
|
|
160
165
|
exports.StylesheetPluginFactory = StylesheetPluginFactory;
|
|
161
166
|
async function processStylesheet(language, data, filename, format, options, build, postcssProcessor) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { BuildOptions, Metafile, OutputFile } from 'esbuild';
|