@angular/build 22.2.0-next.6 → 22.2.0-next.7
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 +13 -13
- package/src/builders/application/build-action.js +1 -0
- package/src/builders/application/build-action.js.map +1 -1
- package/src/builders/application/chunk-optimizer.js +4 -1
- package/src/builders/application/chunk-optimizer.js.map +1 -1
- package/src/builders/application/execute-post-bundle.js +2 -2
- package/src/builders/application/execute-post-bundle.js.map +1 -1
- package/src/builders/application/i18n.js +2 -1
- package/src/builders/application/i18n.js.map +1 -1
- package/src/builders/application/options.js +5 -2
- package/src/builders/application/options.js.map +1 -1
- 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/dev-server/options.d.ts +4 -1
- package/src/builders/dev-server/options.js +1 -0
- package/src/builders/dev-server/options.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/unit-test/runners/vitest/plugins.d.ts +3 -4
- package/src/builders/unit-test/runners/vitest/plugins.js +2 -0
- 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/private.d.ts +0 -1
- package/src/private.js +1 -3
- package/src/private.js.map +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/aot-compilation.js +1 -3
- package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/jit-compilation.js +1 -3
- package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
- package/src/tools/angular/compilation/typescript-compilation.d.ts +8 -1
- package/src/tools/angular/compilation/typescript-compilation.js +10 -2
- package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
- package/src/tools/esbuild/angular/compiler-plugin.js +40 -13
- package/src/tools/esbuild/angular/compiler-plugin.js.map +1 -1
- package/src/tools/esbuild/cache.d.ts +17 -10
- package/src/tools/esbuild/cache.js +60 -47
- package/src/tools/esbuild/cache.js.map +1 -1
- package/src/tools/esbuild/i18n-inliner.d.ts +6 -1
- package/src/tools/esbuild/i18n-inliner.js +14 -4
- package/src/tools/esbuild/i18n-inliner.js.map +1 -1
- package/src/tools/esbuild/index-html-generator.js +1 -1
- package/src/tools/esbuild/index-html-generator.js.map +1 -1
- package/src/tools/esbuild/javascript-transformer.d.ts +18 -6
- package/src/tools/esbuild/javascript-transformer.js +68 -57
- package/src/tools/esbuild/javascript-transformer.js.map +1 -1
- package/src/tools/esbuild/lmdb-cache-store.js +1 -1
- package/src/tools/esbuild/lmdb-cache-store.js.map +1 -1
- package/src/tools/esbuild/persistent-load-result-cache.js +9 -31
- package/src/tools/esbuild/persistent-load-result-cache.js.map +1 -1
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.js +109 -0
- package/src/tools/esbuild/sourcemap-ignorelist-plugin.js.map +1 -1
- package/src/tools/esbuild/sqlite-cache-store.d.ts +1 -1
- package/src/tools/esbuild/sqlite-cache-store.js +239 -65
- package/src/tools/esbuild/sqlite-cache-store.js.map +1 -1
- package/src/tools/esbuild/stylesheets/sass-language.d.ts +1 -0
- package/src/tools/esbuild/stylesheets/sass-language.js +49 -28
- package/src/tools/esbuild/stylesheets/sass-language.js.map +1 -1
- package/src/tools/esbuild/watcher.js +26 -3
- package/src/tools/esbuild/watcher.js.map +1 -1
- package/src/tools/oxc/oxc-transform.js +1 -1
- package/src/tools/oxc/oxc-transform.js.map +1 -1
- package/src/tools/sass/sass-service.d.ts +4 -0
- package/src/tools/sass/sass-service.js +9 -1
- package/src/tools/sass/sass-service.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 +44 -189
- 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/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
|
@@ -8,9 +8,45 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.SqliteCacheStore = void 0;
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
11
13
|
const node_sqlite_1 = require("node:sqlite");
|
|
14
|
+
const node_util_1 = require("node:util");
|
|
12
15
|
const node_v8_1 = require("node:v8");
|
|
16
|
+
const node_zlib_1 = require("node:zlib");
|
|
13
17
|
const cache_1 = require("./cache");
|
|
18
|
+
const deflateRawAsync = (0, node_util_1.promisify)(node_zlib_1.deflateRaw);
|
|
19
|
+
/**
|
|
20
|
+
* Minimum payload size (in bytes) required to attempt compression.
|
|
21
|
+
* Smaller payloads generally do not achieve meaningful compression ratios, while larger payloads
|
|
22
|
+
* (such as transformed JavaScript modules from node_modules) achieve 70-80% size reduction
|
|
23
|
+
* and drastically reduce SQLite overflow pages.
|
|
24
|
+
*/
|
|
25
|
+
const COMPRESSION_THRESHOLD = 32 * 1024; // 32 KB
|
|
26
|
+
/**
|
|
27
|
+
* Storage format discriminator values for cache table entries.
|
|
28
|
+
*/
|
|
29
|
+
var CacheFormat;
|
|
30
|
+
(function (CacheFormat) {
|
|
31
|
+
CacheFormat[CacheFormat["V8"] = 0] = "V8";
|
|
32
|
+
CacheFormat[CacheFormat["V8Compressed"] = 1] = "V8Compressed";
|
|
33
|
+
CacheFormat[CacheFormat["RawBinary"] = 2] = "RawBinary";
|
|
34
|
+
CacheFormat[CacheFormat["RawBinaryCompressed"] = 3] = "RawBinaryCompressed";
|
|
35
|
+
})(CacheFormat || (CacheFormat = {}));
|
|
36
|
+
/**
|
|
37
|
+
* Common SQLite primary result codes.
|
|
38
|
+
* @see https://www.sqlite.org/rescode.html
|
|
39
|
+
*/
|
|
40
|
+
var SqliteResultCode;
|
|
41
|
+
(function (SqliteResultCode) {
|
|
42
|
+
SqliteResultCode[SqliteResultCode["Busy"] = 5] = "Busy";
|
|
43
|
+
SqliteResultCode[SqliteResultCode["Locked"] = 6] = "Locked";
|
|
44
|
+
})(SqliteResultCode || (SqliteResultCode = {}));
|
|
45
|
+
function isSqliteError(error) {
|
|
46
|
+
return (error instanceof Error &&
|
|
47
|
+
('errcode' in error ||
|
|
48
|
+
('code' in error && error.code === 'ERR_SQLITE_ERROR')));
|
|
49
|
+
}
|
|
14
50
|
/**
|
|
15
51
|
* A persistent cache store backed by SQLite.
|
|
16
52
|
*
|
|
@@ -24,42 +60,115 @@ class SqliteCacheStore {
|
|
|
24
60
|
maxPayloadSize;
|
|
25
61
|
ttlDays;
|
|
26
62
|
#db;
|
|
63
|
+
#disabled = false;
|
|
27
64
|
#getStmt;
|
|
28
65
|
#hasStmt;
|
|
29
66
|
#setStmt;
|
|
30
67
|
#updateAccessedStmt;
|
|
31
68
|
#pendingAccessedKeys = new Set();
|
|
32
69
|
#flushTimeout;
|
|
33
|
-
|
|
70
|
+
#busyTimeoutMs;
|
|
71
|
+
constructor(cachePath, maxPayloadSize = 1024 * 1024 * 1024, ttlDays = 14, busyTimeoutMs = 5000) {
|
|
34
72
|
this.cachePath = cachePath;
|
|
35
73
|
this.maxPayloadSize = maxPayloadSize;
|
|
36
74
|
this.ttlDays = ttlDays;
|
|
75
|
+
this.#busyTimeoutMs =
|
|
76
|
+
Number.isSafeInteger(busyTimeoutMs) && busyTimeoutMs >= 0 ? busyTimeoutMs : 5000;
|
|
77
|
+
}
|
|
78
|
+
#openDatabase() {
|
|
79
|
+
let db;
|
|
80
|
+
try {
|
|
81
|
+
if (this.cachePath === ':memory:') {
|
|
82
|
+
db = new node_sqlite_1.DatabaseSync(this.cachePath);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Optimistically attempt to open the database file first to avoid directory creation
|
|
86
|
+
// syscalls on warm builds where the parent directory already exists.
|
|
87
|
+
try {
|
|
88
|
+
db = new node_sqlite_1.DatabaseSync(this.cachePath);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(this.cachePath), { recursive: true });
|
|
92
|
+
db = new node_sqlite_1.DatabaseSync(this.cachePath);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Optimize SQLite for cache usage
|
|
96
|
+
db.exec(`PRAGMA busy_timeout = ${this.#busyTimeoutMs};`);
|
|
97
|
+
db.exec('PRAGMA auto_vacuum = FULL;');
|
|
98
|
+
db.exec('PRAGMA journal_mode = WAL;');
|
|
99
|
+
db.exec('PRAGMA synchronous = NORMAL;');
|
|
100
|
+
db.exec('PRAGMA temp_store = MEMORY;');
|
|
101
|
+
db.exec('PRAGMA mmap_size = 268435456;');
|
|
102
|
+
db.exec('CREATE TABLE IF NOT EXISTS cache (' +
|
|
103
|
+
'key TEXT PRIMARY KEY, ' +
|
|
104
|
+
'value BLOB, ' +
|
|
105
|
+
'format INTEGER NOT NULL DEFAULT 0, ' +
|
|
106
|
+
'last_accessed INTEGER NOT NULL' +
|
|
107
|
+
') WITHOUT ROWID;');
|
|
108
|
+
try {
|
|
109
|
+
db.exec('ALTER TABLE cache ADD COLUMN format INTEGER NOT NULL DEFAULT 0;');
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Ignore error if format column already exists
|
|
113
|
+
}
|
|
114
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_cache_accessed ON cache (last_accessed DESC, key DESC);');
|
|
115
|
+
this.#getStmt = db.prepare('SELECT value, format FROM cache WHERE key = ?');
|
|
116
|
+
this.#hasStmt = db.prepare('SELECT 1 FROM cache WHERE key = ?');
|
|
117
|
+
this.#setStmt = db.prepare('INSERT OR REPLACE INTO cache (key, value, format, last_accessed) VALUES (?, ?, ?, unixepoch())');
|
|
118
|
+
this.#updateAccessedStmt = db.prepare('UPDATE cache SET last_accessed = unixepoch() WHERE key = ?');
|
|
119
|
+
this.#db = db;
|
|
120
|
+
return db;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
try {
|
|
124
|
+
db?.close();
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Ignore close error on corrupted handle
|
|
128
|
+
}
|
|
129
|
+
this.#getStmt = undefined;
|
|
130
|
+
this.#hasStmt = undefined;
|
|
131
|
+
this.#setStmt = undefined;
|
|
132
|
+
this.#updateAccessedStmt = undefined;
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
37
135
|
}
|
|
38
136
|
#ensureDb() {
|
|
137
|
+
if (this.#disabled) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
39
140
|
if (!this.#db) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
141
|
+
try {
|
|
142
|
+
return this.#openDatabase();
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
// If the database is locked by another active process,
|
|
146
|
+
// do not attempt to delete the database files as that could corrupt the active process's database.
|
|
147
|
+
const isBusy = isSqliteError(error) &&
|
|
148
|
+
(error.errcode === SqliteResultCode.Busy || error.errcode === SqliteResultCode.Locked);
|
|
149
|
+
// Attempt to recover from database corruption by deleting the corrupted files and recreating
|
|
150
|
+
if (!isBusy && this.cachePath !== ':memory:') {
|
|
151
|
+
try {
|
|
152
|
+
(0, node_fs_1.rmSync)(this.cachePath, { force: true });
|
|
153
|
+
(0, node_fs_1.rmSync)(this.cachePath + '-wal', { force: true });
|
|
154
|
+
(0, node_fs_1.rmSync)(this.cachePath + '-shm', { force: true });
|
|
155
|
+
(0, node_fs_1.rmSync)(this.cachePath + '-journal', { force: true });
|
|
156
|
+
return this.#openDatabase();
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
// If recovery fails (e.g. read-only filesystem or permission denied), disable caching
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.#disabled = true;
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
53
165
|
}
|
|
54
166
|
return this.#db;
|
|
55
167
|
}
|
|
56
168
|
#queueAccessUpdate(key) {
|
|
57
169
|
this.#pendingAccessedKeys.add(key);
|
|
58
|
-
if (this.#
|
|
59
|
-
this.#flushAccessUpdates();
|
|
60
|
-
}
|
|
61
|
-
else if (!this.#flushTimeout) {
|
|
62
|
-
this.#flushTimeout = setTimeout(() => this.#flushAccessUpdates(), 500);
|
|
170
|
+
if (!this.#flushTimeout) {
|
|
171
|
+
this.#flushTimeout = setTimeout(() => this.#flushAccessUpdates(), 1000);
|
|
63
172
|
this.#flushTimeout.unref?.();
|
|
64
173
|
}
|
|
65
174
|
}
|
|
@@ -68,19 +177,21 @@ class SqliteCacheStore {
|
|
|
68
177
|
clearTimeout(this.#flushTimeout);
|
|
69
178
|
this.#flushTimeout = undefined;
|
|
70
179
|
}
|
|
71
|
-
if (
|
|
180
|
+
if (this.#pendingAccessedKeys.size === 0) {
|
|
72
181
|
return;
|
|
73
182
|
}
|
|
74
183
|
try {
|
|
75
|
-
this.#db
|
|
76
|
-
|
|
77
|
-
this.#
|
|
184
|
+
if (this.#db && this.#updateAccessedStmt) {
|
|
185
|
+
this.#db.exec('BEGIN IMMEDIATE TRANSACTION;');
|
|
186
|
+
for (const key of this.#pendingAccessedKeys) {
|
|
187
|
+
this.#updateAccessedStmt.run(key);
|
|
188
|
+
}
|
|
189
|
+
this.#db.exec('COMMIT;');
|
|
78
190
|
}
|
|
79
|
-
this.#db.exec('COMMIT;');
|
|
80
191
|
}
|
|
81
192
|
catch {
|
|
82
193
|
try {
|
|
83
|
-
this.#db
|
|
194
|
+
this.#db?.exec('ROLLBACK;');
|
|
84
195
|
}
|
|
85
196
|
catch {
|
|
86
197
|
// Ignore rollback errors if transaction was not active
|
|
@@ -92,73 +203,136 @@ class SqliteCacheStore {
|
|
|
92
203
|
}
|
|
93
204
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
205
|
async get(key) {
|
|
95
|
-
this.#ensureDb()
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
206
|
+
if (!this.#ensureDb()) {
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
// SQLite column types are dynamic, so the stored value is only known at runtime.
|
|
211
|
+
const row = this.#getStmt?.get(key);
|
|
212
|
+
if (row) {
|
|
213
|
+
this.#queueAccessUpdate(key);
|
|
214
|
+
if (row.value instanceof Uint8Array) {
|
|
215
|
+
try {
|
|
216
|
+
switch (row.format) {
|
|
217
|
+
case CacheFormat.RawBinary:
|
|
218
|
+
return row.value;
|
|
219
|
+
case CacheFormat.RawBinaryCompressed: {
|
|
220
|
+
const decompressed = (0, node_zlib_1.inflateRawSync)(row.value);
|
|
221
|
+
return new Uint8Array(decompressed.buffer, decompressed.byteOffset, decompressed.byteLength);
|
|
222
|
+
}
|
|
223
|
+
case CacheFormat.V8Compressed:
|
|
224
|
+
return (0, node_v8_1.deserialize)((0, node_zlib_1.inflateRawSync)(row.value));
|
|
225
|
+
case CacheFormat.V8:
|
|
226
|
+
default:
|
|
227
|
+
return (0, node_v8_1.deserialize)(row.value);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// Treat corrupt or unparseable cached payloads as a cache miss.
|
|
232
|
+
}
|
|
106
233
|
}
|
|
107
234
|
}
|
|
108
235
|
}
|
|
236
|
+
catch {
|
|
237
|
+
// Treat query errors (e.g. disk read failures) as a cache miss.
|
|
238
|
+
}
|
|
109
239
|
return undefined;
|
|
110
240
|
}
|
|
111
241
|
has(key) {
|
|
112
|
-
this.#ensureDb()
|
|
113
|
-
|
|
242
|
+
if (!this.#ensureDb()) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
return !!this.#hasStmt?.get(key);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
114
251
|
}
|
|
115
252
|
async set(key, value) {
|
|
116
|
-
this.#ensureDb()
|
|
117
|
-
|
|
118
|
-
|
|
253
|
+
if (!this.#ensureDb()) {
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
this.#pendingAccessedKeys.delete(key);
|
|
258
|
+
const isBinary = value instanceof Uint8Array;
|
|
259
|
+
const data = isBinary ? value : (0, node_v8_1.serialize)(value);
|
|
260
|
+
let format = isBinary ? CacheFormat.RawBinary : CacheFormat.V8;
|
|
261
|
+
let payload = data;
|
|
262
|
+
if (data.byteLength >= COMPRESSION_THRESHOLD) {
|
|
263
|
+
const compressed = await deflateRawAsync(data, { level: 1 });
|
|
264
|
+
if (compressed.byteLength < data.byteLength) {
|
|
265
|
+
payload = compressed;
|
|
266
|
+
format = isBinary ? CacheFormat.RawBinaryCompressed : CacheFormat.V8Compressed;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
this.#setStmt?.run(key, payload, format);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
// Writing to cache is non-fatal and should not fail the build.
|
|
273
|
+
}
|
|
119
274
|
return this;
|
|
120
275
|
}
|
|
121
276
|
createCache(namespace) {
|
|
122
|
-
return new cache_1.Cache(this, namespace);
|
|
277
|
+
return new cache_1.Cache(new cache_1.NamespacedCacheStore(this, namespace));
|
|
123
278
|
}
|
|
124
279
|
close() {
|
|
280
|
+
this.#flushAccessUpdates();
|
|
125
281
|
if (this.#db) {
|
|
126
282
|
try {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
283
|
+
this.#db.exec('BEGIN IMMEDIATE TRANSACTION;');
|
|
284
|
+
try {
|
|
285
|
+
// 1. Delete items older than N days
|
|
286
|
+
this.#db
|
|
287
|
+
.prepare("DELETE FROM cache WHERE last_accessed < unixepoch('now', ?);")
|
|
288
|
+
.run(`-${this.ttlDays} days`);
|
|
289
|
+
// 2. Prune oldest items if payload exceeds maxPayloadSize
|
|
290
|
+
// Skip the expensive window aggregate query if total database size is below maxPayloadSize
|
|
291
|
+
const sizeResult = this.#db
|
|
292
|
+
.prepare('SELECT (page_count - freelist_count) * page_size AS total_size ' +
|
|
293
|
+
'FROM pragma_page_count(), pragma_freelist_count(), pragma_page_size();')
|
|
294
|
+
.get();
|
|
295
|
+
if ((sizeResult?.total_size ?? 0) > this.maxPayloadSize) {
|
|
296
|
+
this.#db
|
|
297
|
+
.prepare(`DELETE FROM cache WHERE key IN (
|
|
298
|
+
SELECT key FROM (
|
|
299
|
+
SELECT key,
|
|
300
|
+
sum(length(key) + length(value)) OVER (ORDER BY last_accessed DESC, key DESC) as running_size
|
|
301
|
+
FROM cache
|
|
302
|
+
) WHERE running_size > ?
|
|
303
|
+
);`)
|
|
304
|
+
.run(this.maxPayloadSize);
|
|
305
|
+
}
|
|
306
|
+
this.#db.exec('COMMIT;');
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
try {
|
|
310
|
+
this.#db.exec('ROLLBACK;');
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
// Ignore rollback errors if transaction was not active
|
|
314
|
+
}
|
|
315
|
+
throw error;
|
|
316
|
+
}
|
|
144
317
|
}
|
|
145
318
|
catch {
|
|
146
319
|
// Pruning errors should not block build success
|
|
147
320
|
}
|
|
148
321
|
finally {
|
|
149
|
-
if (this.#flushTimeout) {
|
|
150
|
-
clearTimeout(this.#flushTimeout);
|
|
151
|
-
this.#flushTimeout = undefined;
|
|
152
|
-
}
|
|
153
|
-
this.#pendingAccessedKeys.clear();
|
|
154
322
|
this.#getStmt = undefined;
|
|
155
323
|
this.#hasStmt = undefined;
|
|
156
324
|
this.#setStmt = undefined;
|
|
157
325
|
this.#updateAccessedStmt = undefined;
|
|
158
|
-
|
|
326
|
+
try {
|
|
327
|
+
this.#db.close();
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
// Failure to close should not block build success
|
|
331
|
+
}
|
|
159
332
|
this.#db = undefined;
|
|
160
333
|
}
|
|
161
334
|
}
|
|
335
|
+
this.#disabled = false;
|
|
162
336
|
}
|
|
163
337
|
}
|
|
164
338
|
exports.SqliteCacheStore = SqliteCacheStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-cache-store.js","sourceRoot":"","sources":["sqlite-cache-store.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAA0D;AAC1D,qCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"sqlite-cache-store.js","sourceRoot":"","sources":["sqlite-cache-store.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qCAA4C;AAC5C,yCAAoC;AACpC,6CAA0D;AAC1D,yCAAsC;AACtC,qCAAiD;AACjD,yCAAuD;AACvD,mCAA4E;AAE5E,MAAM,eAAe,GAAG,IAAA,qBAAS,EAAC,sBAAU,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ;AAEjD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AC;oBAEhD,IAAI,CAAC,UAAU,EAAE,UAAU,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;wBACxD,IAAI,CAAC,GAAG;6BACL,OAAO,CACN;;;;;;mBAMG,CACJ;6BACA,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC9B,CAAC;oBAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC3B,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC;wBACH,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC7B,CAAC;oBAAC,MAAM,CAAC;wBACP,uDAAuD;oBACzD,CAAC;oBACD,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,gDAAgD;YAClD,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC1B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;gBAC1B,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;gBAErC,IAAI,CAAC;oBACH,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;gBACnB,CAAC;gBAAC,MAAM,CAAC;oBACP,kDAAkD;gBACpD,CAAC;gBACD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;YACvB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;CACF;AA5TD,4CA4TC"}
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { StylesheetLanguage } from './stylesheet-plugin-factory';
|
|
9
|
+
export declare function resetSassWorkerPoolCaches(): void;
|
|
9
10
|
export declare function shutdownSassWorkerPool(): void;
|
|
10
11
|
export declare const SassStylesheetLanguage: Readonly<StylesheetLanguage>;
|
|
@@ -41,16 +41,30 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
})();
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.SassStylesheetLanguage = void 0;
|
|
44
|
+
exports.resetSassWorkerPoolCaches = resetSassWorkerPoolCaches;
|
|
44
45
|
exports.shutdownSassWorkerPool = shutdownSassWorkerPool;
|
|
45
46
|
const node_path_1 = require("node:path");
|
|
46
47
|
const node_url_1 = require("node:url");
|
|
47
48
|
const cache_1 = require("../cache");
|
|
48
49
|
let sassService;
|
|
49
50
|
let sassServicePromise;
|
|
51
|
+
let resolutionCache;
|
|
52
|
+
let packageRootCache;
|
|
50
53
|
function isSassException(error) {
|
|
51
54
|
return !!error && typeof error === 'object' && 'sassMessage' in error;
|
|
52
55
|
}
|
|
56
|
+
function resetSassWorkerPoolCaches() {
|
|
57
|
+
resolutionCache?.clear();
|
|
58
|
+
packageRootCache?.clear();
|
|
59
|
+
if (sassService) {
|
|
60
|
+
sassService.clearCache();
|
|
61
|
+
}
|
|
62
|
+
else if (sassServicePromise) {
|
|
63
|
+
void sassServicePromise.then((service) => service.clearCache());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
53
66
|
function shutdownSassWorkerPool() {
|
|
67
|
+
resetSassWorkerPoolCaches();
|
|
54
68
|
if (sassService) {
|
|
55
69
|
void sassService.close();
|
|
56
70
|
sassService = undefined;
|
|
@@ -106,14 +120,15 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
106
120
|
sassServicePromise = undefined;
|
|
107
121
|
}
|
|
108
122
|
}
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
// regardless of its importer's path.
|
|
123
|
+
// Caching follows Sass behavior where a given package url will always resolve to the same value
|
|
124
|
+
// regardless of its importer's path. Relative paths are qualified with the containing URL.
|
|
112
125
|
// A null value indicates that the cached resolution attempt failed to find a location and
|
|
113
126
|
// later stage resolution should be attempted. This avoids potentially expensive repeat
|
|
114
127
|
// failing resolution attempts.
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
resolutionCache ??= new cache_1.MemoryCache();
|
|
129
|
+
packageRootCache ??= new cache_1.MemoryCache();
|
|
130
|
+
const currentResolutionCache = resolutionCache;
|
|
131
|
+
const currentPackageRootCache = packageRootCache;
|
|
117
132
|
const warnings = [];
|
|
118
133
|
const { silenceDeprecations, futureDeprecations, fatalDeprecations } = options.sass ?? {};
|
|
119
134
|
try {
|
|
@@ -130,30 +145,36 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
130
145
|
quietDeps: true,
|
|
131
146
|
importers: [
|
|
132
147
|
{
|
|
133
|
-
findFileUrl: (url, options) =>
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
findFileUrl: (url, options) => {
|
|
149
|
+
const cacheKey = url.startsWith('pkg:')
|
|
150
|
+
? url
|
|
151
|
+
: `${options.containingUrl?.href ?? ''}:${url}`;
|
|
152
|
+
return currentResolutionCache.getOrCreate(cacheKey, async () => {
|
|
153
|
+
const result = await resolveUrl(url, options);
|
|
154
|
+
if (result.path) {
|
|
155
|
+
return (0, node_url_1.pathToFileURL)(result.path);
|
|
156
|
+
}
|
|
157
|
+
// Check for package deep imports
|
|
158
|
+
const { packageName, pathSegments } = parsePackageName(url);
|
|
159
|
+
// Caching package root locations is particularly beneficial for `@material/*` packages
|
|
160
|
+
// which extensively use deep imports.
|
|
161
|
+
const packageRootKey = `${options.containingUrl?.href ?? ''}:${packageName}`;
|
|
162
|
+
const packageRoot = await currentPackageRootCache.getOrCreate(packageRootKey, async () => {
|
|
163
|
+
// Use the required presence of a package root `package.json` file to resolve the location
|
|
164
|
+
const packageResult = await resolveUrl(packageName + '/package.json', options);
|
|
165
|
+
return packageResult.path ? (0, node_path_1.dirname)(packageResult.path) : null;
|
|
166
|
+
});
|
|
167
|
+
// Package not found could be because of an error or the specifier is intended to be found
|
|
168
|
+
// via a later stage of the resolution process (`loadPaths`, etc.).
|
|
169
|
+
// Errors are reported after the full completion of the resolution process. Exceptions for
|
|
170
|
+
// not found packages should not be raised here.
|
|
171
|
+
if (packageRoot) {
|
|
172
|
+
return (0, node_url_1.pathToFileURL)((0, node_path_1.join)(packageRoot, ...pathSegments));
|
|
173
|
+
}
|
|
174
|
+
// Not found
|
|
175
|
+
return null;
|
|
146
176
|
});
|
|
147
|
-
|
|
148
|
-
// via a later stage of the resolution process (`loadPaths`, etc.).
|
|
149
|
-
// Errors are reported after the full completion of the resolution process. Exceptions for
|
|
150
|
-
// not found packages should not be raised here.
|
|
151
|
-
if (packageRoot) {
|
|
152
|
-
return (0, node_url_1.pathToFileURL)((0, node_path_1.join)(packageRoot, ...pathSegments));
|
|
153
|
-
}
|
|
154
|
-
// Not found
|
|
155
|
-
return null;
|
|
156
|
-
}),
|
|
177
|
+
},
|
|
157
178
|
},
|
|
158
179
|
],
|
|
159
180
|
logger: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sass-language.js","sourceRoot":"","sources":["sass-language.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"sass-language.js","sourceRoot":"","sources":["sass-language.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBH,8DAQC;AAED,wDASC;AAnCD,yCAA0C;AAC1C,uCAAwD;AAGxD,oCAAuC;AAGvC,IAAI,WAAqC,CAAC;AAC1C,IAAI,kBAAqD,CAAC;AAC1D,IAAI,eAAoD,CAAC;AACzD,IAAI,gBAAwD,CAAC;AAE7D,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,CAAC,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