@depup/angular__build 22.1.8-depup.5 → 22.2.0-depup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -15
- package/builders.json +1 -1
- package/changes.json +17 -33
- package/package.json +36 -51
- package/src/builders/application/build-action.js +63 -92
- package/src/builders/application/build-action.js.map +1 -1
- package/src/builders/application/chunk-optimizer.d.ts +2 -2
- package/src/builders/application/chunk-optimizer.js +5 -5
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/execute-build.js +26 -19
- package/src/builders/application/execute-build.js.map +1 -1
- package/src/builders/application/execute-post-bundle.d.ts +2 -2
- package/src/builders/application/execute-post-bundle.js +5 -5
- package/src/builders/application/execute-post-bundle.js.map +1 -1
- package/src/builders/application/i18n.d.ts +3 -1
- package/src/builders/application/i18n.js +48 -13
- package/src/builders/application/i18n.js.map +1 -1
- package/src/{tools/esbuild → builders/application}/index-html-generator.d.ts +2 -2
- package/src/{tools/esbuild → builders/application}/index-html-generator.js +2 -2
- package/src/builders/application/index-html-generator.js.map +1 -0
- package/src/builders/application/index.js +2 -2
- package/src/builders/application/index.js.map +1 -1
- package/src/builders/application/options.d.ts +5 -0
- package/src/builders/application/options.js +8 -26
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/application/results.d.ts +3 -2
- package/src/builders/application/schema.d.ts +2 -1
- package/src/builders/application/schema.js.map +1 -1
- package/src/builders/application/schema.json +1 -2
- package/src/builders/application/setup-bundling.js +3 -1
- package/src/builders/application/setup-bundling.js.map +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/internal.js.map +1 -1
- package/src/builders/dev-server/vite/index.js +5 -8
- package/src/builders/dev-server/vite/index.js.map +1 -1
- package/src/builders/dev-server/vite/server.js +2 -0
- package/src/builders/dev-server/vite/server.js.map +1 -1
- package/src/builders/dev-server/vite/utils.d.ts +1 -1
- package/src/builders/dev-server/vite/utils.js +9 -4
- package/src/builders/dev-server/vite/utils.js.map +1 -1
- package/src/builders/extract-i18n/application-extraction.js +6 -5
- package/src/builders/extract-i18n/application-extraction.js.map +1 -1
- package/src/builders/karma/application_builder.js +1 -1
- package/src/builders/karma/application_builder.js.map +1 -1
- package/src/builders/karma/assets-middleware.d.ts +2 -2
- package/src/builders/karma/assets-middleware.js +5 -2
- package/src/builders/karma/assets-middleware.js.map +1 -1
- package/src/builders/karma/progress-reporter.js +7 -5
- package/src/builders/karma/progress-reporter.js.map +1 -1
- package/src/builders/karma/utils.d.ts +2 -1
- package/src/builders/karma/utils.js +2 -2
- package/src/builders/karma/utils.js.map +1 -1
- package/src/builders/unit-test/builder.js +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.js +9 -3
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/executor.js +5 -4
- package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/plugins.d.ts +4 -4
- package/src/builders/unit-test/runners/vitest/plugins.js +9 -2
- package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
- package/src/builders/unit-test/schema.d.ts +3 -2
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +3 -2
- package/src/builders/unit-test/test-discovery.js +3 -2
- package/src/builders/unit-test/test-discovery.js.map +1 -1
- package/src/private.d.ts +3 -5
- package/src/private.js +6 -9
- package/src/private.js.map +1 -1
- package/src/tools/angular/angular-host.d.ts +1 -2
- package/src/tools/angular/angular-host.js +6 -6
- package/src/tools/angular/angular-host.js.map +1 -1
- package/src/tools/angular/compilation/angular-compilation.d.ts +24 -16
- package/src/tools/angular/compilation/angular-compilation.js +4 -80
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +6 -12
- package/src/tools/angular/compilation/aot-compilation.js +23 -20
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/compiler-options.d.ts +25 -0
- package/src/tools/angular/compilation/compiler-options.js +135 -0
- package/src/tools/angular/compilation/compiler-options.js.map +1 -0
- package/src/tools/angular/compilation/factory.d.ts +5 -3
- package/src/tools/angular/compilation/factory.js +10 -5
- package/src/tools/angular/compilation/factory.js.map +1 -1
- package/src/tools/angular/compilation/index.d.ts +3 -3
- package/src/tools/angular/compilation/index.js +1 -3
- package/src/tools/angular/compilation/index.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +6 -9
- package/src/tools/angular/compilation/jit-compilation.js +10 -16
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-compilation.d.ts +3 -14
- package/src/tools/angular/compilation/parallel-compilation.js +40 -42
- package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.d.ts +5 -17
- package/src/tools/angular/compilation/parallel-worker.js +89 -68
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +31 -0
- package/src/tools/angular/compilation/typescript-compilation.js +125 -0
- package/src/tools/angular/compilation/typescript-compilation.js.map +1 -0
- package/src/tools/angular/linker/oxc-ast-host.d.ts +33 -0
- package/src/tools/angular/linker/oxc-ast-host.js +234 -0
- package/src/tools/angular/linker/oxc-ast-host.js.map +1 -0
- package/src/tools/angular/linker/oxc-linker.d.ts +22 -0
- package/src/tools/angular/linker/oxc-linker.js +75 -0
- package/src/tools/angular/linker/oxc-linker.js.map +1 -0
- package/src/tools/angular/linker/string-ast-factory.d.ts +86 -0
- package/src/tools/angular/linker/string-ast-factory.js +234 -0
- package/src/tools/angular/linker/string-ast-factory.js.map +1 -0
- package/src/tools/esbuild/angular/compilation-state.d.ts +23 -3
- package/src/tools/esbuild/angular/compilation-state.js +51 -13
- package/src/tools/esbuild/angular/compilation-state.js.map +1 -1
- package/src/tools/esbuild/angular/compiler-plugin.d.ts +1 -0
- package/src/tools/esbuild/angular/compiler-plugin.js +126 -139
- package/src/tools/esbuild/angular/compiler-plugin.js.map +1 -1
- package/src/tools/esbuild/angular/component-stylesheets.d.ts +3 -3
- package/src/tools/esbuild/angular/component-stylesheets.js +52 -22
- package/src/tools/esbuild/angular/component-stylesheets.js.map +1 -1
- package/src/tools/esbuild/angular/source-file-cache.d.ts +1 -2
- package/src/tools/esbuild/angular/source-file-cache.js +1 -11
- package/src/tools/esbuild/angular/source-file-cache.js.map +1 -1
- package/src/tools/esbuild/application-code-bundle.js +7 -14
- package/src/tools/esbuild/application-code-bundle.js.map +1 -1
- package/src/tools/esbuild/budget-stats.js +3 -3
- package/src/tools/esbuild/budget-stats.js.map +1 -1
- package/src/tools/esbuild/bundler-context.d.ts +23 -7
- package/src/tools/esbuild/bundler-context.js +112 -43
- package/src/tools/esbuild/bundler-context.js.map +1 -1
- package/src/tools/esbuild/bundler-execution-result.d.ts +2 -1
- package/src/tools/esbuild/bundler-execution-result.js +2 -2
- package/src/tools/esbuild/bundler-execution-result.js.map +1 -1
- package/src/tools/esbuild/bundler-files.js +3 -5
- package/src/tools/esbuild/bundler-files.js.map +1 -1
- package/src/tools/esbuild/compiler-plugin-options.js +2 -1
- package/src/tools/esbuild/compiler-plugin-options.js.map +1 -1
- package/src/tools/esbuild/i18n-locale-plugin.d.ts +1 -8
- package/src/tools/esbuild/i18n-locale-plugin.js +33 -114
- package/src/tools/esbuild/i18n-locale-plugin.js.map +1 -1
- package/src/tools/esbuild/license-extractor.d.ts +1 -1
- package/src/tools/esbuild/license-extractor.js +89 -86
- package/src/tools/esbuild/license-extractor.js.map +1 -1
- package/src/tools/esbuild/load-result-cache.d.ts +2 -1
- package/src/tools/esbuild/load-result-cache.js +28 -13
- package/src/tools/esbuild/load-result-cache.js.map +1 -1
- package/src/tools/esbuild/persistent-load-result-cache.d.ts +87 -0
- package/src/tools/esbuild/persistent-load-result-cache.js +229 -0
- package/src/tools/esbuild/persistent-load-result-cache.js.map +1 -0
- package/src/tools/esbuild/stylesheets/bundle-options.d.ts +1 -0
- package/src/tools/esbuild/stylesheets/bundle-options.js +1 -1
- package/src/tools/esbuild/stylesheets/bundle-options.js.map +1 -1
- package/src/tools/esbuild/stylesheets/css-resource-plugin.d.ts +3 -1
- package/src/tools/esbuild/stylesheets/css-resource-plugin.js +4 -2
- package/src/tools/esbuild/stylesheets/css-resource-plugin.js.map +1 -1
- package/src/tools/esbuild/stylesheets/sass-language.d.ts +9 -0
- package/src/tools/esbuild/stylesheets/sass-language.js +109 -50
- package/src/tools/esbuild/stylesheets/sass-language.js.map +1 -1
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.d.ts +35 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js +64 -0
- package/src/tools/esbuild/stylesheets/stylesheet-cache-key.js.map +1 -0
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +1 -1
- package/src/tools/esbuild/utils.d.ts +3 -3
- package/src/tools/esbuild/utils.js +9 -6
- package/src/tools/esbuild/utils.js.map +1 -1
- package/src/tools/i18n/i18n-inliner-worker.d.ts +126 -0
- package/src/tools/i18n/i18n-inliner-worker.js +363 -0
- package/src/tools/i18n/i18n-inliner-worker.js.map +1 -0
- package/src/tools/i18n/i18n-inliner.d.ts +97 -0
- package/src/tools/i18n/i18n-inliner.js +500 -0
- package/src/tools/i18n/i18n-inliner.js.map +1 -0
- package/src/tools/i18n/i18n-translation-encoder.d.ts +21 -0
- package/src/tools/i18n/i18n-translation-encoder.js +92 -0
- package/src/tools/i18n/i18n-translation-encoder.js.map +1 -0
- package/src/tools/i18n/i18n-translation-reader.d.ts +41 -0
- package/src/tools/i18n/i18n-translation-reader.js +164 -0
- package/src/tools/i18n/i18n-translation-reader.js.map +1 -0
- package/src/tools/i18n/index.d.ts +11 -0
- package/src/tools/i18n/index.js +28 -0
- package/src/tools/i18n/index.js.map +1 -0
- package/src/tools/i18n/locale-data.d.ts +47 -0
- package/src/tools/i18n/locale-data.js +108 -0
- package/src/tools/i18n/locale-data.js.map +1 -0
- package/src/tools/javascript-transformer/index.d.ts +8 -0
- package/src/tools/javascript-transformer/index.js +25 -0
- package/src/tools/javascript-transformer/index.js.map +1 -0
- package/src/tools/{esbuild → javascript-transformer}/javascript-transformer-worker.d.ts +0 -4
- package/src/tools/javascript-transformer/javascript-transformer-worker.js +231 -0
- package/src/tools/javascript-transformer/javascript-transformer-worker.js.map +1 -0
- package/src/tools/{esbuild → javascript-transformer}/javascript-transformer.d.ts +26 -9
- package/src/tools/javascript-transformer/javascript-transformer.js +294 -0
- package/src/tools/javascript-transformer/javascript-transformer.js.map +1 -0
- package/src/tools/{babel/plugins → oxc}/oxc-transform.d.ts +5 -2
- package/src/tools/{babel/plugins → oxc}/oxc-transform.js +105 -138
- package/src/tools/oxc/oxc-transform.js.map +1 -0
- package/src/tools/oxc/traversal.d.ts +32 -0
- package/src/tools/oxc/traversal.js +299 -0
- package/src/tools/oxc/traversal.js.map +1 -0
- package/src/tools/oxc/types.d.ts +20 -0
- package/src/tools/sass/rebasing-importer.d.ts +12 -18
- package/src/tools/sass/rebasing-importer.js +23 -26
- package/src/tools/sass/rebasing-importer.js.map +1 -1
- package/src/tools/sass/sass-service.d.ts +15 -38
- package/src/tools/sass/sass-service.js +132 -187
- package/src/tools/sass/sass-service.js.map +1 -1
- package/src/tools/vite/middlewares/assets-middleware.js +3 -3
- package/src/tools/vite/middlewares/assets-middleware.js.map +1 -1
- package/src/tools/vite/utils.d.ts +1 -1
- package/src/{tools/esbuild → utils/cache}/cache.d.ts +25 -8
- package/src/{tools/esbuild → utils/cache}/cache.js +72 -41
- package/src/utils/cache/cache.js.map +1 -0
- package/src/utils/cache/index.d.ts +8 -0
- package/src/utils/cache/index.js +25 -0
- package/src/utils/cache/index.js.map +1 -0
- package/src/{tools/esbuild → utils/cache}/lmdb-cache-store.js +1 -1
- package/src/{tools/esbuild → utils/cache}/lmdb-cache-store.js.map +1 -1
- package/src/{tools/esbuild → utils/cache}/sqlite-cache-store.d.ts +1 -1
- package/src/utils/cache/sqlite-cache-store.js +339 -0
- package/src/utils/cache/sqlite-cache-store.js.map +1 -0
- package/src/utils/concurrency.d.ts +30 -0
- package/src/utils/concurrency.js +81 -0
- package/src/utils/concurrency.js.map +1 -0
- package/src/utils/environment-options.d.ts +34 -0
- package/src/utils/environment-options.js +42 -12
- package/src/utils/environment-options.js.map +1 -1
- package/src/utils/hash.d.ts +24 -0
- package/src/utils/hash.js +94 -0
- package/src/utils/hash.js.map +1 -0
- package/src/utils/i18n-options.d.ts +3 -1
- package/src/utils/i18n-options.js.map +1 -1
- package/src/utils/index-file/auto-csp.d.ts +8 -0
- package/src/utils/index-file/auto-csp.js +30 -3
- package/src/utils/index-file/auto-csp.js.map +1 -1
- package/src/utils/index-file/index-html-generator.d.ts +1 -1
- package/src/utils/index-file/index-html-generator.js +9 -13
- package/src/utils/index-file/index-html-generator.js.map +1 -1
- package/src/utils/index-file/inline-critical-css.d.ts +16 -18
- package/src/utils/index-file/inline-critical-css.js +78 -179
- package/src/utils/index-file/inline-critical-css.js.map +1 -1
- package/src/utils/index-file/nonce.d.ts +2 -0
- package/src/utils/index-file/nonce.js +1 -0
- package/src/utils/index-file/nonce.js.map +1 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/postcss-configuration.d.ts +6 -0
- package/src/utils/postcss-configuration.js +23 -0
- package/src/utils/postcss-configuration.js.map +1 -1
- package/src/{tools/esbuild → utils}/profiling.js +1 -1
- package/src/{tools/esbuild → utils}/profiling.js.map +1 -1
- package/src/utils/server-rendering/manifest.d.ts +2 -2
- package/src/utils/server-rendering/manifest.js +53 -4
- package/src/utils/server-rendering/manifest.js.map +1 -1
- package/src/utils/source-map.d.ts +26 -2
- package/src/utils/source-map.js +151 -53
- package/src/utils/source-map.js.map +1 -1
- package/src/utils/test-files.d.ts +2 -2
- package/src/utils/test-files.js +3 -3
- package/src/utils/test-files.js.map +1 -1
- package/src/utils/watcher.d.ts +61 -0
- package/src/utils/watcher.js +642 -0
- package/src/utils/watcher.js.map +1 -0
- package/src/tools/angular/compilation/noop-compilation.d.ts +0 -20
- package/src/tools/angular/compilation/noop-compilation.js +0 -27
- package/src/tools/angular/compilation/noop-compilation.js.map +0 -1
- package/src/tools/babel/plugins/add-code-coverage.d.ts +0 -14
- package/src/tools/babel/plugins/add-code-coverage.js +0 -44
- package/src/tools/babel/plugins/add-code-coverage.js.map +0 -1
- package/src/tools/babel/plugins/adjust-static-class-members.d.ts +0 -25
- package/src/tools/babel/plugins/adjust-static-class-members.js +0 -349
- package/src/tools/babel/plugins/adjust-static-class-members.js.map +0 -1
- package/src/tools/babel/plugins/adjust-typescript-enums.d.ts +0 -21
- package/src/tools/babel/plugins/adjust-typescript-enums.js +0 -113
- package/src/tools/babel/plugins/adjust-typescript-enums.js.map +0 -1
- 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/elide-angular-metadata.js.map +0 -1
- package/src/tools/babel/plugins/index.d.ts +0 -11
- package/src/tools/babel/plugins/index.js +0 -22
- package/src/tools/babel/plugins/index.js.map +0 -1
- package/src/tools/babel/plugins/oxc-transform.js.map +0 -1
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +0 -13
- package/src/tools/babel/plugins/pure-toplevel-functions.js +0 -128
- package/src/tools/babel/plugins/pure-toplevel-functions.js.map +0 -1
- package/src/tools/babel/plugins/types.d.ts +0 -20
- package/src/tools/babel/typings.d.ts +0 -21
- package/src/tools/esbuild/cache.js.map +0 -1
- package/src/tools/esbuild/i18n-inliner-worker.d.ts +0 -81
- package/src/tools/esbuild/i18n-inliner-worker.js +0 -255
- package/src/tools/esbuild/i18n-inliner-worker.js.map +0 -1
- package/src/tools/esbuild/i18n-inliner.d.ts +0 -58
- package/src/tools/esbuild/i18n-inliner.js +0 -265
- package/src/tools/esbuild/i18n-inliner.js.map +0 -1
- package/src/tools/esbuild/index-html-generator.js.map +0 -1
- package/src/tools/esbuild/javascript-transformer-worker.js +0 -192
- package/src/tools/esbuild/javascript-transformer-worker.js.map +0 -1
- package/src/tools/esbuild/javascript-transformer.js +0 -197
- package/src/tools/esbuild/javascript-transformer.js.map +0 -1
- package/src/tools/esbuild/sqlite-cache-store.js +0 -165
- package/src/tools/esbuild/sqlite-cache-store.js.map +0 -1
- package/src/tools/esbuild/watcher.d.ts +0 -25
- package/src/tools/esbuild/watcher.js +0 -119
- package/src/tools/esbuild/watcher.js.map +0 -1
- package/src/tools/sass/worker.d.ts +0 -63
- package/src/tools/sass/worker.js +0 -202
- package/src/tools/sass/worker.js.map +0 -1
- /package/src/tools/{esbuild/angular → angular/compilation}/diagnostics.d.ts +0 -0
- /package/src/tools/{esbuild/angular → angular/compilation}/diagnostics.js +0 -0
- /package/src/tools/{esbuild/angular → angular/compilation}/diagnostics.js.map +0 -0
- /package/src/{tools/esbuild → utils/cache}/lmdb-cache-store.d.ts +0 -0
- /package/src/{tools/esbuild → utils}/profiling.d.ts +0 -0
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.LOCALE_DATA_BASE_MODULE = exports.LOCALE_DATA_NAMESPACE = void 0;
|
|
10
|
+
exports.resolveLocaleDataPath = exports.loadLocaleData = exports.LOCALE_DATA_BASE_MODULE = exports.LOCALE_DATA_NAMESPACE = void 0;
|
|
11
11
|
exports.createAngularLocaleDataPlugin = createAngularLocaleDataPlugin;
|
|
12
12
|
const resolve_project_1 = require("../../utils/resolve-project");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
exports.LOCALE_DATA_BASE_MODULE = '@angular/common/locales/global';
|
|
13
|
+
const locale_data_1 = require("../i18n/locale-data");
|
|
14
|
+
var locale_data_2 = require("../i18n/locale-data");
|
|
15
|
+
Object.defineProperty(exports, "LOCALE_DATA_NAMESPACE", { enumerable: true, get: function () { return locale_data_2.LOCALE_DATA_NAMESPACE; } });
|
|
16
|
+
Object.defineProperty(exports, "LOCALE_DATA_BASE_MODULE", { enumerable: true, get: function () { return locale_data_2.LOCALE_DATA_BASE_MODULE; } });
|
|
17
|
+
Object.defineProperty(exports, "loadLocaleData", { enumerable: true, get: function () { return locale_data_2.loadLocaleData; } });
|
|
18
|
+
Object.defineProperty(exports, "resolveLocaleDataPath", { enumerable: true, get: function () { return locale_data_2.resolveLocaleDataPath; } });
|
|
21
19
|
/**
|
|
22
20
|
* Creates an esbuild plugin that resolves Angular locale data files from `@angular/common`.
|
|
23
21
|
*
|
|
@@ -28,120 +26,41 @@ function createAngularLocaleDataPlugin() {
|
|
|
28
26
|
name: 'angular-locale-data',
|
|
29
27
|
setup(build) {
|
|
30
28
|
build.onResolve({ filter: /^angular:locale\/data:/ }, async ({ path }) => {
|
|
31
|
-
// Extract the locale from the path
|
|
32
29
|
const rawLocaleTag = path.split(':', 3)[2];
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const { absWorkingDir } = build.initialOptions;
|
|
31
|
+
let projectResolve;
|
|
32
|
+
const resolution = (0, locale_data_1.resolveLocaleDataPath)(rawLocaleTag, (potentialPath) => {
|
|
33
|
+
projectResolve ??= (0, resolve_project_1.createProjectResolver)(absWorkingDir ?? process.cwd());
|
|
34
|
+
try {
|
|
35
|
+
return projectResolve(potentialPath);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (resolution.error) {
|
|
40
42
|
return {
|
|
41
43
|
path: rawLocaleTag,
|
|
42
|
-
namespace:
|
|
43
|
-
errors: [
|
|
44
|
-
{
|
|
45
|
-
text: `Invalid or unsupported locale provided in configuration: "${rawLocaleTag}"`,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
44
|
+
namespace: locale_data_1.LOCALE_DATA_NAMESPACE,
|
|
45
|
+
errors: [{ text: resolution.error }],
|
|
48
46
|
};
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
path: rawLocaleTag,
|
|
59
|
-
namespace: exports.LOCALE_DATA_NAMESPACE,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
// Attempt to resolve the locale tag data within the Angular base module location
|
|
63
|
-
const potentialPath = `${exports.LOCALE_DATA_BASE_MODULE}/${partialLocaleTag}`;
|
|
64
|
-
// If packages are configured to be external then leave the original angular locale import path.
|
|
65
|
-
// This happens when using the development server with caching enabled to allow Vite prebundling to work.
|
|
66
|
-
// There currently is no option on the esbuild resolve function to resolve while disabling the option.
|
|
67
|
-
// NOTE: If esbuild eventually allows controlling the external package options in a build.resolve call, this
|
|
68
|
-
// workaround can be removed.
|
|
69
|
-
let result;
|
|
70
|
-
const { packages, absWorkingDir } = build.initialOptions;
|
|
71
|
-
if (packages === 'external' && absWorkingDir) {
|
|
72
|
-
projectResolve ??= (0, resolve_project_1.createProjectResolver)(absWorkingDir);
|
|
73
|
-
try {
|
|
74
|
-
projectResolve(potentialPath);
|
|
75
|
-
result = {
|
|
76
|
-
errors: [],
|
|
77
|
-
warnings: [],
|
|
78
|
-
external: true,
|
|
79
|
-
sideEffects: true,
|
|
80
|
-
namespace: '',
|
|
81
|
-
suffix: '',
|
|
82
|
-
pluginData: undefined,
|
|
83
|
-
path: potentialPath,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
catch { }
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
result = await build.resolve(potentialPath, {
|
|
90
|
-
kind: 'import-statement',
|
|
91
|
-
resolveDir: absWorkingDir,
|
|
92
|
-
});
|
|
93
|
-
if (result && result.external && absWorkingDir) {
|
|
94
|
-
projectResolve ??= (0, resolve_project_1.createProjectResolver)(absWorkingDir);
|
|
95
|
-
try {
|
|
96
|
-
const resolvedPath = projectResolve(potentialPath);
|
|
97
|
-
result = {
|
|
98
|
-
...result,
|
|
99
|
-
external: false,
|
|
100
|
-
path: resolvedPath,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
catch { }
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (result?.path) {
|
|
107
|
-
if (exact) {
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
return {
|
|
112
|
-
...result,
|
|
113
|
-
warnings: [
|
|
114
|
-
...result.warnings,
|
|
115
|
-
{
|
|
116
|
-
location: null,
|
|
117
|
-
text: `Locale data for '${rawLocaleTag}' cannot be found. Using locale data for '${partialLocaleTag}'.`,
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Remove the last subtag and try again with a less specific locale.
|
|
124
|
-
// Usually the match is exact so the string splitting here is not done until actually needed after the exact
|
|
125
|
-
// match fails to resolve.
|
|
126
|
-
const parts = partialLocaleTag.split('-');
|
|
127
|
-
partialLocaleTag = parts.slice(0, -1).join('-');
|
|
128
|
-
exact = false;
|
|
48
|
+
if (!resolution.path) {
|
|
49
|
+
return {
|
|
50
|
+
path: rawLocaleTag,
|
|
51
|
+
namespace: locale_data_1.LOCALE_DATA_NAMESPACE,
|
|
52
|
+
warnings: resolution.warning
|
|
53
|
+
? [{ location: null, text: resolution.warning }]
|
|
54
|
+
: undefined,
|
|
55
|
+
};
|
|
129
56
|
}
|
|
130
|
-
// Not found so issue a warning and use an empty loader. Framework built-in `en-US` data will be used.
|
|
131
|
-
// This retains existing behavior as in the Webpack-based builder.
|
|
132
57
|
return {
|
|
133
|
-
path:
|
|
134
|
-
|
|
135
|
-
warnings: [
|
|
136
|
-
{
|
|
137
|
-
location: null,
|
|
138
|
-
text: `Locale data for '${rawLocaleTag}' cannot be found. No locale data will be included for this locale.`,
|
|
139
|
-
},
|
|
140
|
-
],
|
|
58
|
+
path: resolution.path,
|
|
59
|
+
warnings: resolution.warning ? [{ location: null, text: resolution.warning }] : undefined,
|
|
141
60
|
};
|
|
142
61
|
});
|
|
143
|
-
// Locales that cannot be found will be loaded as empty content
|
|
144
|
-
build.onLoad({ filter: /./, namespace:
|
|
62
|
+
// Locales that cannot be found or are en/en-US will be loaded as empty content
|
|
63
|
+
build.onLoad({ filter: /./, namespace: locale_data_1.LOCALE_DATA_NAMESPACE }, () => ({
|
|
145
64
|
contents: '',
|
|
146
65
|
loader: 'empty',
|
|
147
66
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-locale-plugin.js","sourceRoot":"","sources":["i18n-locale-plugin.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"i18n-locale-plugin.js","sourceRoot":"","sources":["i18n-locale-plugin.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA0BH,sEAiDC;AAxED,iEAAoE;AACpE,qDAM6B;AAE7B,mDAO6B;AAN3B,oHAAA,qBAAqB,OAAA;AACrB,sHAAA,uBAAuB,OAAA;AAGvB,6GAAA,cAAc,OAAA;AACd,oHAAA,qBAAqB,OAAA;AAGvB;;;;GAIG;AACH,SAAgB,6BAA6B;IAC3C,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,KAAK,CAAC,KAAK;YACT,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;gBACvE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3C,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,cAAc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AAE,CAAC,CAAC;gBACrE,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,OAAO;aAChB,CAAC,CAAC,CAAC;QACN,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -22,4 +22,4 @@ import type { Metafile } from 'esbuild';
|
|
|
22
22
|
* @param rootDirectory The root directory of the workspace.
|
|
23
23
|
* @returns A string containing the content of the output licenses file.
|
|
24
24
|
*/
|
|
25
|
-
export declare function extractLicenses(
|
|
25
|
+
export declare function extractLicenses(metafiles: Metafile[], rootDirectory: string): Promise<string>;
|
|
@@ -58,106 +58,109 @@ const EXTRACTION_FILE_SEPARATOR = '-'.repeat(80) + '\n';
|
|
|
58
58
|
* @param rootDirectory The root directory of the workspace.
|
|
59
59
|
* @returns A string containing the content of the output licenses file.
|
|
60
60
|
*/
|
|
61
|
-
async function extractLicenses(
|
|
61
|
+
async function extractLicenses(metafiles, rootDirectory) {
|
|
62
62
|
let extractedLicenseContent = `${EXTRACTION_FILE_HEADER}\n${EXTRACTION_FILE_SEPARATOR}`;
|
|
63
63
|
const seenPaths = new Set();
|
|
64
64
|
const seenPackageDirectories = new Set();
|
|
65
65
|
const seenPackages = new Set();
|
|
66
|
-
for (const
|
|
67
|
-
for (const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Skip already processed paths
|
|
73
|
-
if (seenPaths.has(inputPath)) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
seenPaths.add(inputPath);
|
|
77
|
-
// Skip non-package paths
|
|
78
|
-
if (!inputPath.includes(NODE_MODULE_SEGMENT)) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
// Extract the package name from the path
|
|
82
|
-
let baseDirectory = node_path_1.default.join(rootDirectory, inputPath);
|
|
83
|
-
let nameOrScope, nameOrFile;
|
|
84
|
-
let found = false;
|
|
85
|
-
while (baseDirectory !== node_path_1.default.dirname(baseDirectory)) {
|
|
86
|
-
const segment = node_path_1.default.basename(baseDirectory);
|
|
87
|
-
if (segment === NODE_MODULE_SEGMENT) {
|
|
88
|
-
found = true;
|
|
89
|
-
break;
|
|
66
|
+
for (const metafile of metafiles) {
|
|
67
|
+
for (const entry of Object.values(metafile.outputs)) {
|
|
68
|
+
for (const [inputPath, { bytesInOutput }] of Object.entries(entry.inputs)) {
|
|
69
|
+
// Skip if not included in output
|
|
70
|
+
if (bytesInOutput <= 0) {
|
|
71
|
+
continue;
|
|
90
72
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
// Skip non-package path edge cases that are not caught in the includes check above
|
|
96
|
-
if (!found || !nameOrScope) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
const packageName = nameOrScope.startsWith('@')
|
|
100
|
-
? `${nameOrScope}/${nameOrFile}`
|
|
101
|
-
: nameOrScope;
|
|
102
|
-
const packageDirectory = node_path_1.default.join(baseDirectory, packageName);
|
|
103
|
-
if (seenPackageDirectories.has(packageDirectory)) {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
seenPackageDirectories.add(packageDirectory);
|
|
107
|
-
// Load the package's metadata to find the package's name, version, and license type
|
|
108
|
-
const packageJsonPath = node_path_1.default.join(packageDirectory, 'package.json');
|
|
109
|
-
let packageJson;
|
|
110
|
-
try {
|
|
111
|
-
packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonPath, 'utf-8'));
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
// Invalid package
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
// Skip already processed packages
|
|
118
|
-
const packageId = `${packageName}@${packageJson.version}`;
|
|
119
|
-
if (seenPackages.has(packageId)) {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
seenPackages.add(packageId);
|
|
123
|
-
// Attempt to find license text inside package
|
|
124
|
-
let licenseText = '';
|
|
125
|
-
if (typeof packageJson.license === 'string' &&
|
|
126
|
-
packageJson.license.toUpperCase().startsWith(CUSTOM_LICENSE_TEXT)) {
|
|
127
|
-
// Attempt to load the package's custom license
|
|
128
|
-
let customLicensePath;
|
|
129
|
-
const customLicenseFile = node_path_1.default.normalize(packageJson.license.slice(CUSTOM_LICENSE_TEXT.length).trim());
|
|
130
|
-
if (customLicenseFile.startsWith('..') || node_path_1.default.isAbsolute(customLicenseFile)) {
|
|
131
|
-
// Path is attempting to access files outside of the package
|
|
132
|
-
// TODO: Issue warning?
|
|
73
|
+
// Skip already processed paths
|
|
74
|
+
if (seenPaths.has(inputPath)) {
|
|
75
|
+
continue;
|
|
133
76
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
77
|
+
seenPaths.add(inputPath);
|
|
78
|
+
// Skip non-package paths
|
|
79
|
+
if (!inputPath.includes(NODE_MODULE_SEGMENT)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
// Extract the package name from the path
|
|
83
|
+
let baseDirectory = node_path_1.default.join(rootDirectory, inputPath);
|
|
84
|
+
let nameOrScope, nameOrFile;
|
|
85
|
+
let found = false;
|
|
86
|
+
while (baseDirectory !== node_path_1.default.dirname(baseDirectory)) {
|
|
87
|
+
const segment = node_path_1.default.basename(baseDirectory);
|
|
88
|
+
if (segment === NODE_MODULE_SEGMENT) {
|
|
89
|
+
found = true;
|
|
90
|
+
break;
|
|
138
91
|
}
|
|
139
|
-
|
|
92
|
+
nameOrFile = nameOrScope;
|
|
93
|
+
nameOrScope = segment;
|
|
94
|
+
baseDirectory = node_path_1.default.dirname(baseDirectory);
|
|
140
95
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
96
|
+
// Skip non-package path edge cases that are not caught in the includes check above
|
|
97
|
+
if (!found || !nameOrScope) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const packageName = nameOrScope.startsWith('@')
|
|
101
|
+
? `${nameOrScope}/${nameOrFile}`
|
|
102
|
+
: nameOrScope;
|
|
103
|
+
const packageDirectory = node_path_1.default.join(baseDirectory, packageName);
|
|
104
|
+
if (seenPackageDirectories.has(packageDirectory)) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
seenPackageDirectories.add(packageDirectory);
|
|
108
|
+
// Load the package's metadata to find the package's name, version, and license type
|
|
109
|
+
const packageJsonPath = node_path_1.default.join(packageDirectory, 'package.json');
|
|
110
|
+
let packageJson;
|
|
111
|
+
try {
|
|
112
|
+
packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonPath, 'utf-8'));
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Invalid package
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// Skip already processed packages
|
|
119
|
+
const packageId = `${packageName}@${packageJson.version}`;
|
|
120
|
+
if (seenPackages.has(packageId)) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
seenPackages.add(packageId);
|
|
124
|
+
// Attempt to find license text inside package
|
|
125
|
+
let licenseText = '';
|
|
126
|
+
if (typeof packageJson.license === 'string' &&
|
|
127
|
+
packageJson.license.toUpperCase().startsWith(CUSTOM_LICENSE_TEXT)) {
|
|
128
|
+
// Attempt to load the package's custom license
|
|
129
|
+
let customLicensePath;
|
|
130
|
+
const customLicenseFile = node_path_1.default.normalize(packageJson.license.slice(CUSTOM_LICENSE_TEXT.length).trim());
|
|
131
|
+
if (customLicenseFile.startsWith('..') || node_path_1.default.isAbsolute(customLicenseFile)) {
|
|
132
|
+
// Path is attempting to access files outside of the package
|
|
133
|
+
// TODO: Issue warning?
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
customLicensePath = node_path_1.default.join(packageDirectory, customLicenseFile);
|
|
148
137
|
try {
|
|
149
|
-
licenseText = await (0, promises_1.readFile)(
|
|
150
|
-
break;
|
|
138
|
+
licenseText = await (0, promises_1.readFile)(customLicensePath, 'utf-8');
|
|
151
139
|
}
|
|
152
140
|
catch { }
|
|
153
141
|
}
|
|
154
142
|
}
|
|
143
|
+
else {
|
|
144
|
+
// Search for a license file within the root of the package
|
|
145
|
+
const entries = await (0, promises_1.readdir)(packageDirectory, { withFileTypes: true }).catch(() => []);
|
|
146
|
+
for (const entry of entries) {
|
|
147
|
+
if ((entry.isFile() || entry.isSymbolicLink()) &&
|
|
148
|
+
LICENSE_FILE_REGEXP.test(entry.name)) {
|
|
149
|
+
const packageLicensePath = node_path_1.default.join(packageDirectory, entry.name);
|
|
150
|
+
try {
|
|
151
|
+
licenseText = await (0, promises_1.readFile)(packageLicensePath, 'utf-8');
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
catch { }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Generate the package's license entry in the output content
|
|
159
|
+
extractedLicenseContent += `Package: ${packageJson.name}\n`;
|
|
160
|
+
extractedLicenseContent += `License: ${JSON.stringify(packageJson.license, null, 2)}\n`;
|
|
161
|
+
extractedLicenseContent += `\n${licenseText}\n`;
|
|
162
|
+
extractedLicenseContent += EXTRACTION_FILE_SEPARATOR;
|
|
155
163
|
}
|
|
156
|
-
// Generate the package's license entry in the output content
|
|
157
|
-
extractedLicenseContent += `Package: ${packageJson.name}\n`;
|
|
158
|
-
extractedLicenseContent += `License: ${JSON.stringify(packageJson.license, null, 2)}\n`;
|
|
159
|
-
extractedLicenseContent += `\n${licenseText}\n`;
|
|
160
|
-
extractedLicenseContent += EXTRACTION_FILE_SEPARATOR;
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
return extractedLicenseContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-extractor.js","sourceRoot":"","sources":["license-extractor.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAwDH,
|
|
1
|
+
{"version":3,"file":"license-extractor.js","sourceRoot":"","sources":["license-extractor.ts"],"names":[],"mappings":";AAAA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AAM,OAAO,GAAG,MAAM,IAAA,kBAAO,EAAC,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;oBAEzF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;wBAC5B,IACE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;4BAC1C,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EACpC,CAAC;4BACD,MAAM,kBAAkB,GAAG,mBAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;4BACnE,IAAI,CAAC;gCACH,WAAW,GAAG,MAAM,IAAA,mBAAQ,EAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;gCAC1D,MAAM;4BACR,CAAC;4BAAC,MAAM,CAAC,CAAA,CAAC;wBACZ,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,6DAA6D;gBAC7D,uBAAuB,IAAI,YAAY,WAAW,CAAC,IAAI,IAAI,CAAC;gBAC5D,uBAAuB,IAAI,YAAY,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;gBACxF,uBAAuB,IAAI,KAAK,WAAW,IAAI,CAAC;gBAChD,uBAAuB,IAAI,yBAAyB,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { OnLoadResult, PluginBuild } from 'esbuild';
|
|
9
9
|
export interface LoadResultCache {
|
|
10
|
-
get(path: string): OnLoadResult | undefined;
|
|
10
|
+
get(path: string): OnLoadResult | Promise<OnLoadResult | undefined> | undefined;
|
|
11
11
|
put(path: string, result: OnLoadResult): Promise<void>;
|
|
12
|
+
invalidate(path: string): boolean;
|
|
12
13
|
readonly watchFiles: ReadonlyArray<string>;
|
|
13
14
|
}
|
|
14
15
|
export declare function createCachedLoad(cache: LoadResultCache | undefined, callback: Parameters<PluginBuild['onLoad']>[1]): Parameters<PluginBuild['onLoad']>[1];
|
|
@@ -16,7 +16,7 @@ function createCachedLoad(cache, callback) {
|
|
|
16
16
|
}
|
|
17
17
|
return async (args) => {
|
|
18
18
|
const loadCacheKey = `${args.namespace}:${args.path}`;
|
|
19
|
-
let result = cache.get(loadCacheKey);
|
|
19
|
+
let result = await cache.get(loadCacheKey);
|
|
20
20
|
if (result === undefined) {
|
|
21
21
|
result = await callback(args);
|
|
22
22
|
// Do not cache null or undefined
|
|
@@ -24,7 +24,9 @@ function createCachedLoad(cache, callback) {
|
|
|
24
24
|
// Ensure requested path is included if it was a resolved file
|
|
25
25
|
if (args.namespace === 'file') {
|
|
26
26
|
result.watchFiles ??= [];
|
|
27
|
-
result.watchFiles.
|
|
27
|
+
if (!result.watchFiles.includes(args.path)) {
|
|
28
|
+
result.watchFiles.push(args.path);
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
await cache.put(loadCacheKey, result);
|
|
30
32
|
}
|
|
@@ -40,13 +42,29 @@ class MemoryLoadResultCache {
|
|
|
40
42
|
return this.#loadResults.get(path);
|
|
41
43
|
}
|
|
42
44
|
async put(path, result) {
|
|
45
|
+
const previousWatchFiles = this.#watchFilesPerKey.get(path);
|
|
43
46
|
if (result.errors && result.errors.length > 0) {
|
|
44
|
-
const previousWatchFiles = this.#watchFilesPerKey.get(path);
|
|
45
47
|
if (previousWatchFiles) {
|
|
46
48
|
result.watchFiles = Array.from(new Set([...(result.watchFiles ?? []), ...previousWatchFiles]));
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
const currentNormalizedWatchFiles = new Set(result.watchFiles?.map(node_path_1.normalize) ?? []);
|
|
52
|
+
// Clean up any previous file dependencies that are no longer referenced
|
|
53
|
+
if (previousWatchFiles) {
|
|
54
|
+
for (const watchFile of previousWatchFiles) {
|
|
55
|
+
const normalizedWatchFile = (0, node_path_1.normalize)(watchFile);
|
|
56
|
+
if (!currentNormalizedWatchFiles.has(normalizedWatchFile)) {
|
|
57
|
+
const affected = this.#fileDependencies.get(normalizedWatchFile);
|
|
58
|
+
if (affected) {
|
|
59
|
+
affected.delete(path);
|
|
60
|
+
if (affected.size === 0) {
|
|
61
|
+
this.#fileDependencies.delete(normalizedWatchFile);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (result.watchFiles && result.watchFiles.length > 0) {
|
|
50
68
|
this.#watchFilesPerKey.set(path, [...result.watchFiles]);
|
|
51
69
|
}
|
|
52
70
|
else {
|
|
@@ -68,16 +86,13 @@ class MemoryLoadResultCache {
|
|
|
68
86
|
}
|
|
69
87
|
invalidate(path) {
|
|
70
88
|
const affectedPaths = this.#fileDependencies.get(path);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
this.#fileDependencies.delete(path);
|
|
89
|
+
if (!affectedPaths) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
for (const affected of affectedPaths) {
|
|
93
|
+
this.#loadResults.delete(affected);
|
|
79
94
|
}
|
|
80
|
-
return
|
|
95
|
+
return true;
|
|
81
96
|
}
|
|
82
97
|
get watchFiles() {
|
|
83
98
|
// this.#loadResults.keys() is not included here because the keys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-result-cache.js","sourceRoot":"","sources":["load-result-cache.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"load-result-cache.js","sourceRoot":"","sources":["load-result-cache.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAYH,4CA8BC;AAvCD,yCAAsC;AAStC,SAAg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ED,KAAK;QACH,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACF;AAnFD,sDAmFC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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.dev/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @fileoverview
|
|
10
|
+
* Implements a generic, two-tier (L1 memory + L2 persistent disk store) caching system for
|
|
11
|
+
* esbuild plugin `OnLoadResult` outcomes across the `@angular/build` compiler pipeline.
|
|
12
|
+
*
|
|
13
|
+
* Supported Module Types:
|
|
14
|
+
* 1. **Disk File Modules** (`file:` namespace): Standard disk-based source files (TS, JS, CSS, Sass, Less).
|
|
15
|
+
* Cache keys are computed using the root `globalConfigHash`, file path, and file content. Validity is
|
|
16
|
+
* verified via fast-path metadata (`mtimeMs` + `size`) with fallback to content hashing (`sha256`).
|
|
17
|
+
* 2. **Custom Plugin Namespace Modules** (e.g. `angular:script/global`, `sass:`): Modules loaded through
|
|
18
|
+
* custom esbuild namespaces that resolve to disk source files.
|
|
19
|
+
* 3. **Virtual Modules & Remote Resources** (e.g. `angular:styles/component`, `css-inline-fonts`): Synthetic
|
|
20
|
+
* in-memory modules or remote asset declarations whose compiled outcomes depend on parent source file
|
|
21
|
+
* dependencies (`watchFiles`) or global configuration options (`globalConfigHash`).
|
|
22
|
+
*
|
|
23
|
+
* Key Exported Types:
|
|
24
|
+
* - {@link PersistentLoadResultCache}: Primary two-tier cache manager implementing `LoadResultCache`.
|
|
25
|
+
* - {@link CachedLoadResultEntry}: Serialized structure persisted to disk for cached esbuild `OnLoadResult` items.
|
|
26
|
+
* - {@link CachedDependencyMetadata}: Per-dependency file metadata (`hash`, `mtimeMs`, `size`) used for cache validation and healing.
|
|
27
|
+
*/
|
|
28
|
+
import type { Loader, OnLoadResult, PartialMessage } from 'esbuild';
|
|
29
|
+
import type { Cache as PersistentCacheStore } from '../../utils/cache';
|
|
30
|
+
import { LoadResultCache } from './load-result-cache';
|
|
31
|
+
/**
|
|
32
|
+
* Metadata for a single watch file dependency.
|
|
33
|
+
*/
|
|
34
|
+
export interface CachedDependencyMetadata {
|
|
35
|
+
hash: string;
|
|
36
|
+
mtimeMs: number;
|
|
37
|
+
size: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Serialized representation of any esbuild load result stored in persistent cache.
|
|
41
|
+
*/
|
|
42
|
+
export interface CachedLoadResultEntry {
|
|
43
|
+
/** Compiled output string or binary data */
|
|
44
|
+
contents: string | Uint8Array;
|
|
45
|
+
/** esbuild loader type */
|
|
46
|
+
loader?: Loader;
|
|
47
|
+
/** Absolute paths of all imported/watched dependency files */
|
|
48
|
+
watchFiles: string[];
|
|
49
|
+
/** Absolute paths of all watched directories */
|
|
50
|
+
watchDirs?: string[];
|
|
51
|
+
/** Map of watchFile absolute paths to dependency metadata */
|
|
52
|
+
watchFilesMetadata: Record<string, CachedDependencyMetadata>;
|
|
53
|
+
/** Warnings emitted during load processing */
|
|
54
|
+
warnings?: PartialMessage[];
|
|
55
|
+
/** Errors emitted during load processing */
|
|
56
|
+
errors?: PartialMessage[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Normalizes a namespaced cache key into a valid disk file path if one exists.
|
|
60
|
+
* Handles 'file:' URIs, OS platform differences, and custom plugin namespaces.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractDiskFilePath(path: string): string | undefined;
|
|
63
|
+
export declare class PersistentLoadResultCache implements LoadResultCache {
|
|
64
|
+
private readonly persistentStore?;
|
|
65
|
+
private readonly globalConfigHash;
|
|
66
|
+
private readonly memoryCache;
|
|
67
|
+
constructor(persistentStore?: PersistentCacheStore<CachedLoadResultEntry> | undefined, globalConfigHash?: string);
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves a load result from cache.
|
|
70
|
+
* Checks L1 memory cache first for immediate watch-mode speed, falling back to L2 persistent disk
|
|
71
|
+
* store on L1 cache miss. L2 persistent cache entries are validated against dependency metadata.
|
|
72
|
+
*/
|
|
73
|
+
get(path: string): Promise<OnLoadResult | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Stores a load result in both L1 memory cache and L2 persistent disk store.
|
|
76
|
+
*/
|
|
77
|
+
put(path: string, result: OnLoadResult): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Invalidates cached entries affected by a modified dependency file during watch mode.
|
|
80
|
+
*
|
|
81
|
+
* Note: Invalidation of L1 memory cache is sufficient for active watch mode.
|
|
82
|
+
* Cross-process/cold start stale entries in L2 persistent store are automatically handled
|
|
83
|
+
* during `get()` via dependency metadata verification (`validateAndHealCacheEntry`).
|
|
84
|
+
*/
|
|
85
|
+
invalidate(path: string): boolean;
|
|
86
|
+
get watchFiles(): ReadonlyArray<string>;
|
|
87
|
+
}
|