@angular/build 22.2.0-next.5 → 22.2.0-next.6
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 +7 -6
- package/src/builders/application/build-action.js +47 -39
- package/src/builders/application/build-action.js.map +1 -1
- package/src/builders/application/execute-build.js +1 -1
- package/src/builders/application/execute-build.js.map +1 -1
- package/src/builders/application/execute-post-bundle.js +2 -5
- package/src/builders/application/execute-post-bundle.js.map +1 -1
- package/src/builders/application/i18n.js +6 -8
- package/src/builders/application/i18n.js.map +1 -1
- package/src/builders/application/index.js +2 -2
- package/src/builders/application/index.js.map +1 -1
- package/src/builders/application/results.d.ts +3 -2
- package/src/builders/dev-server/vite/index.js +4 -7
- package/src/builders/dev-server/vite/index.js.map +1 -1
- package/src/builders/dev-server/vite/server.js +1 -1
- 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/options.d.ts +1 -0
- package/src/builders/unit-test/options.js +2 -1
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/build-options.js +5 -6
- package/src/builders/unit-test/runners/vitest/build-options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/executor.js +4 -4
- package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
- package/src/builders/unit-test/schema.d.ts +7 -0
- package/src/builders/unit-test/schema.js.map +1 -1
- package/src/builders/unit-test/schema.json +5 -0
- package/src/private.d.ts +1 -1
- package/src/private.js +4 -3
- package/src/private.js.map +1 -1
- package/src/tools/angular/compilation/angular-compilation.d.ts +3 -8
- package/src/tools/angular/compilation/angular-compilation.js +2 -88
- package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +5 -5
- package/src/tools/angular/compilation/aot-compilation.js +9 -13
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/compiler-options.d.ts +24 -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/index.d.ts +1 -1
- 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 +5 -5
- package/src/tools/angular/compilation/jit-compilation.js +8 -15
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-compilation.d.ts +2 -7
- package/src/tools/angular/compilation/parallel-compilation.js +3 -29
- package/src/tools/angular/compilation/parallel-compilation.js.map +1 -1
- package/src/tools/angular/compilation/parallel-worker.d.ts +2 -2
- package/src/tools/angular/compilation/parallel-worker.js +3 -12
- package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +24 -0
- package/src/tools/angular/compilation/typescript-compilation.js +107 -0
- package/src/tools/angular/compilation/typescript-compilation.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.js +36 -101
- package/src/tools/esbuild/angular/compiler-plugin.js.map +1 -1
- package/src/tools/esbuild/bundler-execution-result.d.ts +1 -0
- 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/i18n-inliner-worker.d.ts +47 -55
- package/src/tools/esbuild/i18n-inliner-worker.js +67 -98
- package/src/tools/esbuild/i18n-inliner-worker.js.map +1 -1
- package/src/tools/esbuild/i18n-inliner.d.ts +9 -10
- package/src/tools/esbuild/i18n-inliner.js +215 -120
- package/src/tools/esbuild/i18n-inliner.js.map +1 -1
- package/src/tools/esbuild/i18n-translation-encoder.d.ts +2 -1
- package/src/tools/esbuild/i18n-translation-encoder.js.map +1 -1
- package/src/tools/esbuild/i18n-translation-reader.d.ts +4 -3
- package/src/tools/esbuild/i18n-translation-reader.js.map +1 -1
- package/src/tools/esbuild/javascript-transformer-worker.js +8 -4
- package/src/tools/esbuild/javascript-transformer-worker.js.map +1 -1
- package/src/tools/esbuild/javascript-transformer.js +53 -1
- package/src/tools/esbuild/javascript-transformer.js.map +1 -1
- package/src/tools/esbuild/sqlite-cache-store.d.ts +8 -0
- package/src/tools/esbuild/sqlite-cache-store.js +19 -7
- package/src/tools/esbuild/sqlite-cache-store.js.map +1 -1
- package/src/tools/esbuild/stylesheets/sass-language.js +19 -14
- package/src/tools/esbuild/stylesheets/sass-language.js.map +1 -1
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +1 -1
- package/src/tools/esbuild/utils.d.ts +1 -1
- package/src/tools/esbuild/utils.js.map +1 -1
- package/src/tools/oxc/oxc-transform.js +75 -117
- package/src/tools/oxc/oxc-transform.js.map +1 -1
- 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/sass/rebasing-importer.d.ts +8 -14
- package/src/tools/sass/rebasing-importer.js +18 -24
- package/src/tools/sass/rebasing-importer.js.map +1 -1
- package/src/tools/sass/sass-service.d.ts +11 -38
- package/src/tools/sass/sass-service.js +124 -187
- package/src/tools/sass/sass-service.js.map +1 -1
- package/src/utils/environment-options.d.ts +12 -0
- package/src/utils/environment-options.js +20 -12
- package/src/utils/environment-options.js.map +1 -1
- package/src/utils/i18n-options.d.ts +2 -1
- package/src/utils/i18n-options.js.map +1 -1
- package/src/utils/normalize-cache.d.ts +11 -1
- package/src/utils/normalize-cache.js +6 -3
- package/src/utils/normalize-cache.js.map +1 -1
- package/src/utils/purge-cache.js +24 -13
- package/src/utils/purge-cache.js.map +1 -1
- package/src/utils/server-rendering/prerender.d.ts +2 -1
- package/src/utils/server-rendering/prerender.js +31 -18
- package/src/utils/server-rendering/prerender.js.map +1 -1
- package/src/utils/server-rendering/render-worker.d.ts +6 -4
- package/src/utils/server-rendering/render-worker.js +3 -1
- package/src/utils/server-rendering/render-worker.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/tools/angular/compilation/noop-compilation.d.ts +0 -15
- package/src/tools/angular/compilation/noop-compilation.js +0 -27
- package/src/tools/angular/compilation/noop-compilation.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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { DecodedSourceMap } from '@ampproject/remapping';
|
|
9
|
-
import type { CanonicalizeContext, Importer, ImporterResult } from 'sass';
|
|
9
|
+
import type { CanonicalizeContext, Importer, ImporterResult } from 'sass-embedded';
|
|
10
10
|
/**
|
|
11
11
|
* A preprocessed cache entry for the files and directories within a previously searched
|
|
12
12
|
* directory when performing Sass import resolution.
|
|
@@ -70,14 +70,15 @@ export declare class RelativeUrlRebasingImporter extends UrlRebasingImporter {
|
|
|
70
70
|
private checkFound;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Provides the Sass importer logic to resolve module (npm package) stylesheet imports
|
|
74
|
-
*
|
|
75
|
-
* the URLs in the output of the Sass compiler reflect the final filesystem location of the output CSS file.
|
|
73
|
+
* Provides the Sass importer logic to resolve module (npm package) stylesheet imports asynchronously
|
|
74
|
+
* and also rebase any `url()` function usage within those stylesheets.
|
|
76
75
|
*/
|
|
77
|
-
export declare class
|
|
76
|
+
export declare class AsyncModuleUrlRebasingImporter implements Importer<'async'> {
|
|
78
77
|
private finder;
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
private relativeImporter;
|
|
79
|
+
constructor(entryDirectory: string, directoryCache: Map<string, DirectoryEntry>, rebaseSourceMaps: Map<string, DecodedSourceMap> | undefined, finder: (specifier: string, options: CanonicalizeContext) => Promise<URL | null> | URL | null);
|
|
80
|
+
canonicalize(url: string, options: CanonicalizeContext): Promise<URL | null>;
|
|
81
|
+
load(canonicalUrl: URL): ImporterResult | null;
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
84
|
* Provides the Sass importer logic to resolve load paths located stylesheet imports via both import and
|
|
@@ -91,11 +92,4 @@ export declare class LoadPathsUrlRebasingImporter extends RelativeUrlRebasingImp
|
|
|
91
92
|
fromImport: boolean;
|
|
92
93
|
}): URL | null;
|
|
93
94
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Workaround for Sass not calling instance methods with `this`.
|
|
96
|
-
* The `canonicalize` and `load` methods will be bound to the class instance.
|
|
97
|
-
* @param importer A Sass importer to bind.
|
|
98
|
-
* @returns The bound Sass importer.
|
|
99
|
-
*/
|
|
100
|
-
export declare function sassBindWorkaround<T extends Importer>(importer: T): T;
|
|
101
95
|
export {};
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.LoadPathsUrlRebasingImporter = exports.
|
|
11
|
-
exports.sassBindWorkaround = sassBindWorkaround;
|
|
10
|
+
exports.LoadPathsUrlRebasingImporter = exports.AsyncModuleUrlRebasingImporter = exports.RelativeUrlRebasingImporter = void 0;
|
|
12
11
|
const magic_string_1 = require("magic-string");
|
|
13
12
|
const node_fs_1 = require("node:fs");
|
|
14
13
|
const node_path_1 = require("node:path");
|
|
@@ -38,6 +37,7 @@ class UrlRebasingImporter {
|
|
|
38
37
|
constructor(entryDirectory, rebaseSourceMaps) {
|
|
39
38
|
this.entryDirectory = entryDirectory;
|
|
40
39
|
this.rebaseSourceMaps = rebaseSourceMaps;
|
|
40
|
+
this.load = this.load.bind(this);
|
|
41
41
|
}
|
|
42
42
|
load(canonicalUrl) {
|
|
43
43
|
const stylesheetPath = (0, node_url_1.fileURLToPath)(canonicalUrl);
|
|
@@ -116,6 +116,7 @@ class RelativeUrlRebasingImporter extends UrlRebasingImporter {
|
|
|
116
116
|
constructor(entryDirectory, directoryCache = new Map(), rebaseSourceMaps) {
|
|
117
117
|
super(entryDirectory, rebaseSourceMaps);
|
|
118
118
|
this.directoryCache = directoryCache;
|
|
119
|
+
this.canonicalize = this.canonicalize.bind(this);
|
|
119
120
|
}
|
|
120
121
|
canonicalize(url, options) {
|
|
121
122
|
return this.resolveImport(url, options.fromImport, true);
|
|
@@ -273,26 +274,30 @@ class RelativeUrlRebasingImporter extends UrlRebasingImporter {
|
|
|
273
274
|
}
|
|
274
275
|
exports.RelativeUrlRebasingImporter = RelativeUrlRebasingImporter;
|
|
275
276
|
/**
|
|
276
|
-
* Provides the Sass importer logic to resolve module (npm package) stylesheet imports
|
|
277
|
-
*
|
|
278
|
-
* the URLs in the output of the Sass compiler reflect the final filesystem location of the output CSS file.
|
|
277
|
+
* Provides the Sass importer logic to resolve module (npm package) stylesheet imports asynchronously
|
|
278
|
+
* and also rebase any `url()` function usage within those stylesheets.
|
|
279
279
|
*/
|
|
280
|
-
class
|
|
280
|
+
class AsyncModuleUrlRebasingImporter {
|
|
281
281
|
finder;
|
|
282
|
+
relativeImporter;
|
|
282
283
|
constructor(entryDirectory, directoryCache, rebaseSourceMaps, finder) {
|
|
283
|
-
super(entryDirectory, directoryCache, rebaseSourceMaps);
|
|
284
284
|
this.finder = finder;
|
|
285
|
+
this.relativeImporter = new RelativeUrlRebasingImporter(entryDirectory, directoryCache, rebaseSourceMaps);
|
|
286
|
+
this.canonicalize = this.canonicalize.bind(this);
|
|
287
|
+
this.load = this.load.bind(this);
|
|
285
288
|
}
|
|
286
|
-
canonicalize(url, options) {
|
|
289
|
+
async canonicalize(url, options) {
|
|
287
290
|
if (url.startsWith('file://')) {
|
|
288
|
-
return
|
|
291
|
+
return this.relativeImporter.canonicalize(url, options);
|
|
289
292
|
}
|
|
290
|
-
|
|
291
|
-
result
|
|
292
|
-
|
|
293
|
+
const result = await this.finder(url, options);
|
|
294
|
+
return result ? this.relativeImporter.canonicalize(result.href, options) : null;
|
|
295
|
+
}
|
|
296
|
+
load(canonicalUrl) {
|
|
297
|
+
return this.relativeImporter.load(canonicalUrl);
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
|
-
exports.
|
|
300
|
+
exports.AsyncModuleUrlRebasingImporter = AsyncModuleUrlRebasingImporter;
|
|
296
301
|
/**
|
|
297
302
|
* Provides the Sass importer logic to resolve load paths located stylesheet imports via both import and
|
|
298
303
|
* use rules and also rebase any `url()` function usage within those stylesheets. The rebasing will ensure that
|
|
@@ -319,15 +324,4 @@ class LoadPathsUrlRebasingImporter extends RelativeUrlRebasingImporter {
|
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
326
|
exports.LoadPathsUrlRebasingImporter = LoadPathsUrlRebasingImporter;
|
|
322
|
-
/**
|
|
323
|
-
* Workaround for Sass not calling instance methods with `this`.
|
|
324
|
-
* The `canonicalize` and `load` methods will be bound to the class instance.
|
|
325
|
-
* @param importer A Sass importer to bind.
|
|
326
|
-
* @returns The bound Sass importer.
|
|
327
|
-
*/
|
|
328
|
-
function sassBindWorkaround(importer) {
|
|
329
|
-
importer.canonicalize = importer.canonicalize.bind(importer);
|
|
330
|
-
importer.load = importer.load.bind(importer);
|
|
331
|
-
return importer;
|
|
332
|
-
}
|
|
333
327
|
//# sourceMappingURL=rebasing-importer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebasing-importer.js","sourceRoot":"","sources":["rebasing-importer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"rebasing-importer.js","sourceRoot":"","sources":["rebasing-importer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,+CAA2C;AAC3C,qCAA8D;AAC9D,yCAAuE;AACvE,uCAAwD;AAExD,6CAAkD;AAClD,2CAA+C;AAC/C,mCAAmC;AAWnC;;;;;;;;;;GAUG;AACH,MAAe,mBAAmB;IAOtB;IACA;IAPV;;;;OAIG;IACH,YACU,cAAsB,EACtB,gBAAgD;QADhD,mBAAc,GAAd,cAAc,CAAQ;QACtB,qBAAgB,GAAhB,gBAAgB,CAAgC;QAExD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAID,IAAI,CAAC,YAAiB;QACpB,MAAM,cAAc,GAAG,IAAA,wBAAa,EAAC,YAAY,CAAC,CAAC;QACnD,MAAM,mBAAmB,GAAG,IAAA,mBAAO,EAAC,cAAc,CAAC,CAAC;QACpD,IAAI,QAAQ,GAAG,IAAA,sBAAY,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAErD,iCAAiC;QACjC,IAAI,eAAe,CAAC;QACpB,KAAK,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,IAAA,gBAAQ,EAAC,QAAQ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YACR,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzBD,oEAyBC"}
|
|
@@ -5,44 +5,19 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
|
-
import type { CompileResult,
|
|
9
|
-
export interface SerializableVersion {
|
|
10
|
-
major: number;
|
|
11
|
-
minor: number;
|
|
12
|
-
patch: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SerializableDeprecation extends Omit<Deprecation, 'obsoleteIn' | 'deprecatedIn'> {
|
|
15
|
-
/** The version this deprecation first became active in. */
|
|
16
|
-
deprecatedIn: SerializableVersion | null;
|
|
17
|
-
/** The version this deprecation became obsolete in. */
|
|
18
|
-
obsoleteIn: SerializableVersion | null;
|
|
19
|
-
}
|
|
20
|
-
export type SerializableWarningMessage = ({
|
|
21
|
-
deprecation: true;
|
|
22
|
-
deprecationType: SerializableDeprecation;
|
|
23
|
-
} | {
|
|
24
|
-
deprecation: false;
|
|
25
|
-
}) & {
|
|
26
|
-
message: string;
|
|
27
|
-
span?: Omit<SourceSpan, 'url'> & {
|
|
28
|
-
url?: string;
|
|
29
|
-
};
|
|
30
|
-
stack?: string;
|
|
31
|
-
};
|
|
8
|
+
import type { CompileResult, StringOptions } from 'sass-embedded';
|
|
32
9
|
/**
|
|
33
|
-
* A Sass renderer implementation that
|
|
34
|
-
* `sass-
|
|
35
|
-
*
|
|
36
|
-
* the worker which can be up to two times faster than the asynchronous variant.
|
|
10
|
+
* A Sass renderer implementation that uses the persistent Dart Sass embedded compiler
|
|
11
|
+
* daemon (`sass-embedded`) communicating over standard input/output with protocol buffers,
|
|
12
|
+
* or falls back to the pure-JS Dart Sass async compiler (`sass.initAsyncCompiler()`).
|
|
37
13
|
*/
|
|
38
|
-
export declare class
|
|
14
|
+
export declare class SassCompiler {
|
|
39
15
|
#private;
|
|
40
16
|
private readonly rebase;
|
|
41
|
-
|
|
42
|
-
constructor(rebase?: boolean, maxThreads?: number);
|
|
17
|
+
constructor(rebase?: boolean);
|
|
43
18
|
/**
|
|
44
19
|
* Provides information about the Sass implementation.
|
|
45
|
-
* This mimics enough of the `
|
|
20
|
+
* This mimics enough of the `sass-embedded` or `sass` value to be used with the `sass-loader`.
|
|
46
21
|
*/
|
|
47
22
|
get info(): string;
|
|
48
23
|
/**
|
|
@@ -50,18 +25,16 @@ export declare class SassWorkerImplementation {
|
|
|
50
25
|
*/
|
|
51
26
|
compileString(): never;
|
|
52
27
|
/**
|
|
53
|
-
* Asynchronously request a Sass stylesheet to be
|
|
28
|
+
* Asynchronously request a Sass stylesheet to be rendered using the native embedded compiler
|
|
29
|
+
* or the pure-JS async compiler fallback.
|
|
54
30
|
*
|
|
55
31
|
* @param source The contents to compile.
|
|
56
|
-
* @param options The `
|
|
32
|
+
* @param options The `sass` / `sass-embedded` options to use when rendering the stylesheet.
|
|
57
33
|
*/
|
|
58
34
|
compileStringAsync(source: string, options: StringOptions<'async'>): Promise<CompileResult>;
|
|
59
35
|
/**
|
|
60
|
-
* Shutdown the Sass
|
|
61
|
-
* Executing this method will stop any pending render requests.
|
|
36
|
+
* Shutdown the Sass compiler.
|
|
62
37
|
* @returns A void promise that resolves when closing is complete.
|
|
63
38
|
*/
|
|
64
39
|
close(): Promise<void>;
|
|
65
|
-
private processImporters;
|
|
66
|
-
private isFileImporter;
|
|
67
40
|
}
|
|
@@ -6,102 +6,91 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
|
-
var
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
15
|
-
dispose = value[Symbol.asyncDispose];
|
|
16
|
-
}
|
|
17
|
-
if (dispose === void 0) {
|
|
18
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
19
|
-
dispose = value[Symbol.dispose];
|
|
20
|
-
if (async) inner = dispose;
|
|
21
|
-
}
|
|
22
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
23
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
24
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
25
|
-
}
|
|
26
|
-
else if (async) {
|
|
27
|
-
env.stack.push({ async: true });
|
|
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]; } };
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function next() {
|
|
39
|
-
while (r = env.stack.pop()) {
|
|
40
|
-
try {
|
|
41
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
42
|
-
if (r.dispose) {
|
|
43
|
-
var result = r.dispose.call(r.value);
|
|
44
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
45
|
-
}
|
|
46
|
-
else s |= 1;
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
fail(e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
53
|
-
if (env.hasError) throw env.error;
|
|
54
|
-
}
|
|
55
|
-
return next();
|
|
56
|
-
};
|
|
57
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
58
|
-
var e = new Error(message);
|
|
59
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
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;
|
|
60
24
|
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
61
42
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
43
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
44
|
};
|
|
64
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.
|
|
66
|
-
const
|
|
46
|
+
exports.SassCompiler = void 0;
|
|
47
|
+
const remapping_1 = __importDefault(require("@ampproject/remapping"));
|
|
48
|
+
const node_path_1 = require("node:path");
|
|
67
49
|
const node_url_1 = require("node:url");
|
|
68
|
-
const node_worker_threads_1 = require("node:worker_threads");
|
|
69
50
|
const environment_options_1 = require("../../utils/environment-options");
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The maximum number of Workers that will be created to execute render requests.
|
|
76
|
-
*/
|
|
77
|
-
const MAX_RENDER_WORKERS = environment_options_1.maxWorkers;
|
|
51
|
+
const rebasing_importer_1 = require("./rebasing-importer");
|
|
52
|
+
function isFileImporter(value) {
|
|
53
|
+
return 'findFileUrl' in value;
|
|
54
|
+
}
|
|
78
55
|
/**
|
|
79
|
-
* A Sass renderer implementation that
|
|
80
|
-
* `sass-
|
|
81
|
-
*
|
|
82
|
-
* the worker which can be up to two times faster than the asynchronous variant.
|
|
56
|
+
* A Sass renderer implementation that uses the persistent Dart Sass embedded compiler
|
|
57
|
+
* daemon (`sass-embedded`) communicating over standard input/output with protocol buffers,
|
|
58
|
+
* or falls back to the pure-JS Dart Sass async compiler (`sass.initAsyncCompiler()`).
|
|
83
59
|
*/
|
|
84
|
-
class
|
|
60
|
+
class SassCompiler {
|
|
85
61
|
rebase;
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
constructor(rebase = false
|
|
62
|
+
#asyncCompiler;
|
|
63
|
+
#asyncCompilerPromise;
|
|
64
|
+
constructor(rebase = false) {
|
|
89
65
|
this.rebase = rebase;
|
|
90
|
-
this.maxThreads = maxThreads;
|
|
91
66
|
}
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
67
|
+
async #createAsyncCompiler() {
|
|
68
|
+
if (environment_options_1.useSassEmbedded) {
|
|
69
|
+
const { initAsyncCompiler } = await Promise.resolve().then(() => __importStar(require('sass-embedded')));
|
|
70
|
+
return initAsyncCompiler();
|
|
71
|
+
}
|
|
72
|
+
const { initAsyncCompiler } = await Promise.resolve().then(() => __importStar(require('sass')));
|
|
73
|
+
return initAsyncCompiler();
|
|
74
|
+
}
|
|
75
|
+
async #ensureAsyncCompiler() {
|
|
76
|
+
if (this.#asyncCompiler) {
|
|
77
|
+
return this.#asyncCompiler;
|
|
78
|
+
}
|
|
79
|
+
this.#asyncCompilerPromise ??= this.#createAsyncCompiler();
|
|
80
|
+
try {
|
|
81
|
+
this.#asyncCompiler = await this.#asyncCompilerPromise;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
this.#asyncCompilerPromise = undefined;
|
|
85
|
+
}
|
|
86
|
+
return this.#asyncCompiler;
|
|
98
87
|
}
|
|
99
88
|
/**
|
|
100
89
|
* Provides information about the Sass implementation.
|
|
101
|
-
* This mimics enough of the `
|
|
90
|
+
* This mimics enough of the `sass-embedded` or `sass` value to be used with the `sass-loader`.
|
|
102
91
|
*/
|
|
103
92
|
get info() {
|
|
104
|
-
return 'dart-sass\
|
|
93
|
+
return environment_options_1.useSassEmbedded ? 'sass-embedded\tasync-compiler' : 'dart-sass\tasync-compiler';
|
|
105
94
|
}
|
|
106
95
|
/**
|
|
107
96
|
* The synchronous render function is not used by the `sass-loader`.
|
|
@@ -110,133 +99,81 @@ class SassWorkerImplementation {
|
|
|
110
99
|
throw new Error('Sass compileString is not supported.');
|
|
111
100
|
}
|
|
112
101
|
/**
|
|
113
|
-
* Asynchronously request a Sass stylesheet to be
|
|
102
|
+
* Asynchronously request a Sass stylesheet to be rendered using the native embedded compiler
|
|
103
|
+
* or the pure-JS async compiler fallback.
|
|
114
104
|
*
|
|
115
105
|
* @param source The contents to compile.
|
|
116
|
-
* @param options The `
|
|
106
|
+
* @param options The `sass` / `sass-embedded` options to use when rendering the stylesheet.
|
|
117
107
|
*/
|
|
118
108
|
async compileStringAsync(source, options) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// URL is not serializable so to convert to string here and back to URL in the worker.
|
|
137
|
-
url: url ? (0, node_url_1.fileURLToPath)(url) : undefined,
|
|
138
|
-
},
|
|
139
|
-
}, {
|
|
140
|
-
transferList: importerChannel ? [importerChannel.port] : undefined,
|
|
141
|
-
}));
|
|
142
|
-
const { result, error, warnings } = response;
|
|
143
|
-
if (warnings && logger?.warn) {
|
|
144
|
-
for (const { message, span, ...options } of warnings) {
|
|
145
|
-
logger.warn(message, {
|
|
146
|
-
...options,
|
|
147
|
-
span: span && {
|
|
148
|
-
...span,
|
|
149
|
-
url: span.url ? (0, node_url_1.pathToFileURL)(span.url) : undefined,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (error) {
|
|
155
|
-
// Convert stringified url value required for cloning back to a URL object
|
|
156
|
-
const url = error.span?.url;
|
|
157
|
-
if (url) {
|
|
158
|
-
error.span.url = (0, node_url_1.pathToFileURL)(url);
|
|
159
|
-
}
|
|
160
|
-
throw error;
|
|
109
|
+
// The CLI's configuration does not use or expose the ability to define custom Sass functions
|
|
110
|
+
if (options.functions && Object.keys(options.functions).length > 0) {
|
|
111
|
+
throw new Error('Sass custom functions are not supported.');
|
|
112
|
+
}
|
|
113
|
+
const compiler = await this.#ensureAsyncCompiler();
|
|
114
|
+
if (!this.rebase) {
|
|
115
|
+
return compiler.compileStringAsync(source, options);
|
|
116
|
+
}
|
|
117
|
+
const { functions, importers, importer, url, logger, ...serializableOptions } = options;
|
|
118
|
+
let finalImporters;
|
|
119
|
+
let loadPaths = options.loadPaths;
|
|
120
|
+
const entryDirectory = url ? (0, node_path_1.dirname)((0, node_url_1.fileURLToPath)(url)) : process.cwd();
|
|
121
|
+
const directoryCache = new Map();
|
|
122
|
+
const rebaseSourceMaps = options.sourceMap ? new Map() : undefined;
|
|
123
|
+
if (importers?.length) {
|
|
124
|
+
if (importers.some((i) => !isFileImporter(i))) {
|
|
125
|
+
throw new Error('Only File Importers are supported.');
|
|
161
126
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
127
|
+
finalImporters = [
|
|
128
|
+
new rebasing_importer_1.AsyncModuleUrlRebasingImporter(entryDirectory, directoryCache, rebaseSourceMaps, async (specifier, options) => {
|
|
129
|
+
for (const importer of importers) {
|
|
130
|
+
const result = await importer.findFileUrl(specifier, options);
|
|
131
|
+
if (result) {
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}),
|
|
137
|
+
];
|
|
168
138
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
139
|
+
if (loadPaths?.length) {
|
|
140
|
+
finalImporters ??= [];
|
|
141
|
+
finalImporters.push(new rebasing_importer_1.LoadPathsUrlRebasingImporter(entryDirectory, directoryCache, rebaseSourceMaps, loadPaths));
|
|
142
|
+
loadPaths = undefined;
|
|
172
143
|
}
|
|
173
|
-
|
|
174
|
-
|
|
144
|
+
const relativeImporter = new rebasing_importer_1.RelativeUrlRebasingImporter(entryDirectory, directoryCache, rebaseSourceMaps);
|
|
145
|
+
const result = await compiler.compileStringAsync(source, {
|
|
146
|
+
...serializableOptions,
|
|
147
|
+
url,
|
|
148
|
+
loadPaths,
|
|
149
|
+
importers: finalImporters,
|
|
150
|
+
importer: relativeImporter,
|
|
151
|
+
logger,
|
|
152
|
+
});
|
|
153
|
+
if (result.sourceMap && rebaseSourceMaps?.size) {
|
|
154
|
+
result.sourceMap = (0, remapping_1.default)(result.sourceMap, (file, context) => (file !== context.importer ? rebaseSourceMaps.get(file) : null));
|
|
175
155
|
}
|
|
156
|
+
return result;
|
|
176
157
|
}
|
|
177
158
|
/**
|
|
178
|
-
* Shutdown the Sass
|
|
179
|
-
* Executing this method will stop any pending render requests.
|
|
159
|
+
* Shutdown the Sass compiler.
|
|
180
160
|
* @returns A void promise that resolves when closing is complete.
|
|
181
161
|
*/
|
|
182
162
|
async close() {
|
|
183
|
-
if (this.#
|
|
163
|
+
if (this.#asyncCompilerPromise) {
|
|
184
164
|
try {
|
|
185
|
-
await this.#
|
|
165
|
+
await this.#ensureAsyncCompiler();
|
|
186
166
|
}
|
|
187
|
-
|
|
188
|
-
|
|
167
|
+
catch {
|
|
168
|
+
// Ignore compiler initialization failures on shutdown
|
|
189
169
|
}
|
|
190
170
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
mainImporterPort.on('message', ({ url, options }) => {
|
|
196
|
-
this.processImporters(importers, url, {
|
|
197
|
-
...options,
|
|
198
|
-
// URL is not serializable so in the worker we convert to string and here back to URL.
|
|
199
|
-
containingUrl: options.containingUrl
|
|
200
|
-
? (0, node_url_1.pathToFileURL)(options.containingUrl)
|
|
201
|
-
: null,
|
|
202
|
-
})
|
|
203
|
-
.then((result) => {
|
|
204
|
-
mainImporterPort.postMessage(result);
|
|
205
|
-
})
|
|
206
|
-
.catch((error) => {
|
|
207
|
-
mainImporterPort.postMessage(error);
|
|
208
|
-
})
|
|
209
|
-
.finally(() => {
|
|
210
|
-
Atomics.store(importerSignal, 0, 1);
|
|
211
|
-
Atomics.notify(importerSignal, 0);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
mainImporterPort.unref();
|
|
215
|
-
return {
|
|
216
|
-
port: workerImporterPort,
|
|
217
|
-
signal: importerSignal,
|
|
218
|
-
[Symbol.dispose]() {
|
|
219
|
-
mainImporterPort.close();
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
async processImporters(importers, url, options) {
|
|
224
|
-
for (const importer of importers) {
|
|
225
|
-
if (!this.isFileImporter(importer)) {
|
|
226
|
-
// Importer
|
|
227
|
-
throw new Error('Only File Importers are supported.');
|
|
228
|
-
}
|
|
229
|
-
// File importer (Can be sync or aync).
|
|
230
|
-
const result = await importer.findFileUrl(url, options);
|
|
231
|
-
if (result) {
|
|
232
|
-
return (0, node_url_1.fileURLToPath)(result);
|
|
233
|
-
}
|
|
171
|
+
if (this.#asyncCompiler) {
|
|
172
|
+
const compiler = this.#asyncCompiler;
|
|
173
|
+
this.#asyncCompiler = undefined;
|
|
174
|
+
await compiler.dispose();
|
|
234
175
|
}
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
isFileImporter(value) {
|
|
238
|
-
return 'findFileUrl' in value;
|
|
239
176
|
}
|
|
240
177
|
}
|
|
241
|
-
exports.
|
|
178
|
+
exports.SassCompiler = SassCompiler;
|
|
242
179
|
//# sourceMappingURL=sass-service.js.map
|