@angular/build 19.2.0-next.1 → 19.2.0-rc.0
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/builders.json +5 -0
- package/package.json +18 -13
- package/src/builders/application/build-action.js +6 -1
- package/src/builders/application/execute-build.js +1 -5
- package/src/builders/application/execute-post-bundle.js +2 -2
- package/src/builders/application/i18n.js +6 -3
- package/src/builders/application/options.d.ts +5 -1
- package/src/builders/application/options.js +9 -1
- package/src/builders/dev-server/schema.d.ts +4 -4
- package/src/builders/dev-server/schema.json +2 -2
- package/src/builders/dev-server/vite-server.js +45 -4
- package/src/builders/karma/application_builder.d.ts +15 -0
- package/src/builders/karma/application_builder.js +490 -0
- package/src/builders/karma/find-tests.d.ts +15 -0
- package/src/builders/karma/find-tests.js +144 -0
- package/src/builders/karma/index.d.ts +23 -0
- package/src/builders/karma/index.js +135 -0
- package/src/builders/karma/polyfills/init_sourcemaps.js +10 -0
- package/src/builders/karma/polyfills/init_test_bed.js +19 -0
- package/src/builders/karma/polyfills/jasmine_global.js +18 -0
- package/src/builders/karma/polyfills/jasmine_global_cleanup.js +14 -0
- package/src/builders/karma/schema.d.ts +248 -0
- package/src/builders/karma/schema.js +15 -0
- package/src/builders/karma/schema.json +347 -0
- package/src/private.d.ts +2 -0
- package/src/private.js +6 -1
- package/src/tools/angular/compilation/hmr-candidates.js +43 -12
- package/src/tools/babel/plugins/add-code-coverage.js +8 -1
- package/src/tools/esbuild/angular/compiler-plugin.js +8 -3
- package/src/tools/esbuild/i18n-inliner.d.ts +9 -0
- package/src/tools/esbuild/i18n-inliner.js +110 -21
- package/src/tools/esbuild/index-html-generator.js +1 -8
- package/src/tools/esbuild/stylesheets/less-language.js +16 -4
- package/src/tools/esbuild/stylesheets/sass-language.js +2 -5
- package/src/tools/esbuild/utils.js +4 -1
- package/src/tools/vite/middlewares/html-fallback-middleware.js +2 -1
- package/src/tools/vite/plugins/angular-memory-plugin.d.ts +1 -1
- package/src/tools/vite/plugins/angular-memory-plugin.js +11 -16
- package/src/utils/error.js +2 -2
- package/src/utils/index-file/auto-csp.js +1 -1
- package/src/utils/index-file/index-html-generator.js +3 -2
- package/src/utils/index-file/inline-critical-css.d.ts +1 -0
- package/src/utils/index-file/inline-critical-css.js +11 -7
- package/src/utils/load-translations.js +3 -3
- package/src/utils/normalize-asset-patterns.js +3 -3
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +1 -2
- package/src/utils/server-rendering/manifest.js +7 -2
- package/src/utils/server-rendering/prerender.js +3 -3
- package/src/utils/server-rendering/render-worker.js +2 -2
- package/src/utils/server-rendering/routes-extractor-worker.js +2 -2
- package/src/utils/service-worker.js +2 -2
- package/src/utils/version.js +2 -2
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"title": "Karma Target",
|
|
4
|
+
"description": "Karma target options for Build Facade.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"main": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the main entry-point file."
|
|
10
|
+
},
|
|
11
|
+
"tsConfig": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "The name of the TypeScript configuration file."
|
|
14
|
+
},
|
|
15
|
+
"karmaConfig": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The name of the Karma configuration file."
|
|
18
|
+
},
|
|
19
|
+
"polyfills": {
|
|
20
|
+
"description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
|
|
21
|
+
"type": "array",
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"uniqueItems": true
|
|
25
|
+
},
|
|
26
|
+
"default": []
|
|
27
|
+
},
|
|
28
|
+
"assets": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"description": "List of static application assets.",
|
|
31
|
+
"default": [],
|
|
32
|
+
"items": {
|
|
33
|
+
"$ref": "#/definitions/assetPattern"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"description": "Global scripts to be included in the build.",
|
|
38
|
+
"type": "array",
|
|
39
|
+
"default": [],
|
|
40
|
+
"items": {
|
|
41
|
+
"oneOf": [
|
|
42
|
+
{
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"input": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "The file to include.",
|
|
48
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
49
|
+
},
|
|
50
|
+
"bundleName": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"pattern": "^[\\w\\-.]*$",
|
|
53
|
+
"description": "The bundle name for this extra entry point."
|
|
54
|
+
},
|
|
55
|
+
"inject": {
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
58
|
+
"default": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["input"]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The file to include.",
|
|
67
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"styles": {
|
|
73
|
+
"description": "Global styles to be included in the build.",
|
|
74
|
+
"type": "array",
|
|
75
|
+
"default": [],
|
|
76
|
+
"items": {
|
|
77
|
+
"oneOf": [
|
|
78
|
+
{
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"input": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "The file to include.",
|
|
84
|
+
"pattern": "\\.(?:css|scss|sass|less)$"
|
|
85
|
+
},
|
|
86
|
+
"bundleName": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"pattern": "^[\\w\\-.]*$",
|
|
89
|
+
"description": "The bundle name for this extra entry point."
|
|
90
|
+
},
|
|
91
|
+
"inject": {
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
94
|
+
"default": true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"required": ["input"]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "The file to include.",
|
|
103
|
+
"pattern": "\\.(?:css|scss|sass|less)$"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"inlineStyleLanguage": {
|
|
109
|
+
"description": "The stylesheet language to use for the application's inline component styles.",
|
|
110
|
+
"type": "string",
|
|
111
|
+
"default": "css",
|
|
112
|
+
"enum": ["css", "less", "sass", "scss"]
|
|
113
|
+
},
|
|
114
|
+
"stylePreprocessorOptions": {
|
|
115
|
+
"description": "Options to pass to style preprocessors.",
|
|
116
|
+
"type": "object",
|
|
117
|
+
"properties": {
|
|
118
|
+
"includePaths": {
|
|
119
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
120
|
+
"type": "array",
|
|
121
|
+
"items": {
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
"default": []
|
|
125
|
+
},
|
|
126
|
+
"sass": {
|
|
127
|
+
"description": "Options to pass to the sass preprocessor.",
|
|
128
|
+
"type": "object",
|
|
129
|
+
"properties": {
|
|
130
|
+
"fatalDeprecations": {
|
|
131
|
+
"description": "A set of deprecations to treat as fatal. If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. If a Version is provided, then all deprecations that were active in that compiler version will be treated as fatal.",
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"silenceDeprecations": {
|
|
138
|
+
"description": " A set of active deprecations to ignore. If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead.",
|
|
139
|
+
"type": "array",
|
|
140
|
+
"items": {
|
|
141
|
+
"type": "string"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"futureDeprecations": {
|
|
145
|
+
"description": "A set of future deprecations to opt into early. Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary.",
|
|
146
|
+
"type": "array",
|
|
147
|
+
"items": {
|
|
148
|
+
"type": "string"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"additionalProperties": false
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"additionalProperties": false
|
|
156
|
+
},
|
|
157
|
+
"externalDependencies": {
|
|
158
|
+
"description": "Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.",
|
|
159
|
+
"type": "array",
|
|
160
|
+
"items": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
},
|
|
163
|
+
"default": []
|
|
164
|
+
},
|
|
165
|
+
"loader": {
|
|
166
|
+
"description": "Defines the type of loader to use with a specified file extension when used with a JavaScript `import`. `text` inlines the content as a string; `binary` inlines the content as a Uint8Array; `file` emits the file and provides the runtime location of the file; `empty` considers the content to be empty and not include it in bundles.",
|
|
167
|
+
"type": "object",
|
|
168
|
+
"patternProperties": {
|
|
169
|
+
"^\\.\\S+$": { "enum": ["text", "binary", "file", "empty"] }
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"define": {
|
|
173
|
+
"description": "Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.",
|
|
174
|
+
"type": "object",
|
|
175
|
+
"additionalProperties": {
|
|
176
|
+
"type": "string"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"include": {
|
|
180
|
+
"type": "array",
|
|
181
|
+
"items": {
|
|
182
|
+
"type": "string"
|
|
183
|
+
},
|
|
184
|
+
"default": ["**/*.spec.ts"],
|
|
185
|
+
"description": "Globs of files to include, relative to project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
|
|
186
|
+
},
|
|
187
|
+
"exclude": {
|
|
188
|
+
"type": "array",
|
|
189
|
+
"items": {
|
|
190
|
+
"type": "string"
|
|
191
|
+
},
|
|
192
|
+
"default": [],
|
|
193
|
+
"description": "Globs of files to exclude, relative to the project root."
|
|
194
|
+
},
|
|
195
|
+
"sourceMap": {
|
|
196
|
+
"description": "Output source maps for scripts and styles. For more information, see https://angular.dev/reference/configs/workspace-config#source-map-configuration.",
|
|
197
|
+
"default": true,
|
|
198
|
+
"oneOf": [
|
|
199
|
+
{
|
|
200
|
+
"type": "object",
|
|
201
|
+
"properties": {
|
|
202
|
+
"scripts": {
|
|
203
|
+
"type": "boolean",
|
|
204
|
+
"description": "Output source maps for all scripts.",
|
|
205
|
+
"default": true
|
|
206
|
+
},
|
|
207
|
+
"styles": {
|
|
208
|
+
"type": "boolean",
|
|
209
|
+
"description": "Output source maps for all styles.",
|
|
210
|
+
"default": true
|
|
211
|
+
},
|
|
212
|
+
"vendor": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"description": "Resolve vendor packages source maps.",
|
|
215
|
+
"default": false
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"additionalProperties": false
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"type": "boolean"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"progress": {
|
|
226
|
+
"type": "boolean",
|
|
227
|
+
"description": "Log progress to the console while building.",
|
|
228
|
+
"default": true
|
|
229
|
+
},
|
|
230
|
+
"watch": {
|
|
231
|
+
"type": "boolean",
|
|
232
|
+
"description": "Run build when files change."
|
|
233
|
+
},
|
|
234
|
+
"poll": {
|
|
235
|
+
"type": "number",
|
|
236
|
+
"description": "Enable and define the file watching poll time period in milliseconds."
|
|
237
|
+
},
|
|
238
|
+
"preserveSymlinks": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set."
|
|
241
|
+
},
|
|
242
|
+
"browsers": {
|
|
243
|
+
"description": "Override which browsers tests are run against. Set to `false` to not use any browser.",
|
|
244
|
+
"oneOf": [
|
|
245
|
+
{
|
|
246
|
+
"type": "string",
|
|
247
|
+
"description": "A comma seperate list of browsers to run tests against."
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"const": false,
|
|
251
|
+
"type": "boolean",
|
|
252
|
+
"description": "Does use run tests against a browser."
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"codeCoverage": {
|
|
257
|
+
"type": "boolean",
|
|
258
|
+
"description": "Output a code coverage report.",
|
|
259
|
+
"default": false
|
|
260
|
+
},
|
|
261
|
+
"codeCoverageExclude": {
|
|
262
|
+
"type": "array",
|
|
263
|
+
"description": "Globs to exclude from code coverage.",
|
|
264
|
+
"items": {
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
267
|
+
"default": []
|
|
268
|
+
},
|
|
269
|
+
"fileReplacements": {
|
|
270
|
+
"description": "Replace compilation source files with other compilation source files in the build.",
|
|
271
|
+
"type": "array",
|
|
272
|
+
"items": {
|
|
273
|
+
"$ref": "#/definitions/fileReplacement"
|
|
274
|
+
},
|
|
275
|
+
"default": []
|
|
276
|
+
},
|
|
277
|
+
"reporters": {
|
|
278
|
+
"type": "array",
|
|
279
|
+
"description": "Karma reporters to use. Directly passed to the karma runner.",
|
|
280
|
+
"items": {
|
|
281
|
+
"type": "string"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"webWorkerTsConfig": {
|
|
285
|
+
"type": "string",
|
|
286
|
+
"description": "TypeScript configuration for Web Worker modules."
|
|
287
|
+
},
|
|
288
|
+
"aot": {
|
|
289
|
+
"type": "boolean",
|
|
290
|
+
"description": "Run tests using Ahead of Time compilation.",
|
|
291
|
+
"default": false
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"additionalProperties": false,
|
|
295
|
+
"required": ["tsConfig"],
|
|
296
|
+
"definitions": {
|
|
297
|
+
"assetPattern": {
|
|
298
|
+
"oneOf": [
|
|
299
|
+
{
|
|
300
|
+
"type": "object",
|
|
301
|
+
"properties": {
|
|
302
|
+
"glob": {
|
|
303
|
+
"type": "string",
|
|
304
|
+
"description": "The pattern to match."
|
|
305
|
+
},
|
|
306
|
+
"input": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
309
|
+
},
|
|
310
|
+
"output": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"default": "",
|
|
313
|
+
"description": "Absolute path within the output."
|
|
314
|
+
},
|
|
315
|
+
"ignore": {
|
|
316
|
+
"description": "An array of globs to ignore.",
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": {
|
|
319
|
+
"type": "string"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"additionalProperties": false,
|
|
324
|
+
"required": ["glob", "input"]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"type": "string"
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"fileReplacement": {
|
|
332
|
+
"type": "object",
|
|
333
|
+
"properties": {
|
|
334
|
+
"replace": {
|
|
335
|
+
"type": "string",
|
|
336
|
+
"pattern": "\\.(([cm]?[jt])sx?|json)$"
|
|
337
|
+
},
|
|
338
|
+
"with": {
|
|
339
|
+
"type": "string",
|
|
340
|
+
"pattern": "\\.(([cm]?[jt])sx?|json)$"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"additionalProperties": false,
|
|
344
|
+
"required": ["replace", "with"]
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
package/src/private.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { buildApplicationInternal } from './builders/application';
|
|
|
11
11
|
export type { ApplicationBuilderInternalOptions } from './builders/application/options';
|
|
12
12
|
export { type Result, type ResultFile, ResultKind } from './builders/application/results';
|
|
13
13
|
export { serveWithVite } from './builders/dev-server/vite-server';
|
|
14
|
+
export { execute as executeKarmaInternal } from './builders/karma/application_builder';
|
|
14
15
|
export * from './tools/babel/plugins';
|
|
15
16
|
export type { ExternalResultMetadata } from './tools/esbuild/bundler-execution-result';
|
|
16
17
|
export { emitFilesToDisk } from './tools/esbuild/utils';
|
|
@@ -39,3 +40,4 @@ export { augmentAppWithServiceWorker } from './utils/service-worker';
|
|
|
39
40
|
export { type BundleStats, generateBuildStatsTable } from './utils/stats-table';
|
|
40
41
|
export { getSupportedBrowsers } from './utils/supported-browsers';
|
|
41
42
|
export { assertCompatibleAngularVersion } from './utils/version';
|
|
43
|
+
export { findTests, getTestEntrypoints } from './builders/karma/find-tests';
|
package/src/private.js
CHANGED
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.JavaScriptTransformer = exports.createJitResourceTransformer = exports.SourceFileCache = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.serveWithVite = exports.ResultKind = exports.buildApplicationInternal = void 0;
|
|
24
|
+
exports.getTestEntrypoints = exports.findTests = exports.assertCompatibleAngularVersion = exports.getSupportedBrowsers = exports.generateBuildStatsTable = exports.augmentAppWithServiceWorker = exports.purgeStaleBuildCache = exports.createTranslationLoader = exports.loadProxyConfiguration = exports.InlineCriticalCssProcessor = exports.IndexHtmlGenerator = exports.loadTranslations = exports.createI18nOptions = exports.deleteOutputDir = exports.checkPort = exports.JavaScriptTransformer = exports.createJitResourceTransformer = exports.SourceFileCache = exports.SassWorkerImplementation = exports.transformSupportedBrowsersToTargets = exports.emitFilesToDisk = exports.executeKarmaInternal = exports.serveWithVite = exports.ResultKind = exports.buildApplicationInternal = void 0;
|
|
25
25
|
exports.createCompilerPlugin = createCompilerPlugin;
|
|
26
26
|
/**
|
|
27
27
|
* @fileoverview
|
|
@@ -39,6 +39,8 @@ var results_1 = require("./builders/application/results");
|
|
|
39
39
|
Object.defineProperty(exports, "ResultKind", { enumerable: true, get: function () { return results_1.ResultKind; } });
|
|
40
40
|
var vite_server_1 = require("./builders/dev-server/vite-server");
|
|
41
41
|
Object.defineProperty(exports, "serveWithVite", { enumerable: true, get: function () { return vite_server_1.serveWithVite; } });
|
|
42
|
+
var application_builder_1 = require("./builders/karma/application_builder");
|
|
43
|
+
Object.defineProperty(exports, "executeKarmaInternal", { enumerable: true, get: function () { return application_builder_1.execute; } });
|
|
42
44
|
// Tools
|
|
43
45
|
__exportStar(require("./tools/babel/plugins"), exports);
|
|
44
46
|
var utils_1 = require("./tools/esbuild/utils");
|
|
@@ -85,3 +87,6 @@ var supported_browsers_1 = require("./utils/supported-browsers");
|
|
|
85
87
|
Object.defineProperty(exports, "getSupportedBrowsers", { enumerable: true, get: function () { return supported_browsers_1.getSupportedBrowsers; } });
|
|
86
88
|
var version_1 = require("./utils/version");
|
|
87
89
|
Object.defineProperty(exports, "assertCompatibleAngularVersion", { enumerable: true, get: function () { return version_1.assertCompatibleAngularVersion; } });
|
|
90
|
+
var find_tests_1 = require("./builders/karma/find-tests");
|
|
91
|
+
Object.defineProperty(exports, "findTests", { enumerable: true, get: function () { return find_tests_1.findTests; } });
|
|
92
|
+
Object.defineProperty(exports, "getTestEntrypoints", { enumerable: true, get: function () { return find_tests_1.getTestEntrypoints; } });
|
|
@@ -136,7 +136,8 @@ function analyzeFileUpdates(stale, updated, compiler) {
|
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
138
|
// Compare component meta decorator object literals
|
|
139
|
-
|
|
139
|
+
const analysis = analyzeMetaUpdates(staleDecoratorExpression, stale, updatedDecoratorExpression, updated);
|
|
140
|
+
if (analysis === MetaUpdateAnalysis.Unsupported) {
|
|
140
141
|
return null;
|
|
141
142
|
}
|
|
142
143
|
// Compare text of the member nodes to determine if any changes have occurred
|
|
@@ -145,7 +146,9 @@ function analyzeFileUpdates(stale, updated, compiler) {
|
|
|
145
146
|
return null;
|
|
146
147
|
}
|
|
147
148
|
// If all previous class checks passed, this class is supported for HMR updates
|
|
148
|
-
|
|
149
|
+
if (analysis === MetaUpdateAnalysis.Supported) {
|
|
150
|
+
candidates.push(updatedNode);
|
|
151
|
+
}
|
|
149
152
|
continue;
|
|
150
153
|
}
|
|
151
154
|
}
|
|
@@ -161,7 +164,19 @@ function analyzeFileUpdates(stale, updated, compiler) {
|
|
|
161
164
|
/**
|
|
162
165
|
* The set of Angular component metadata fields that are supported by HMR updates.
|
|
163
166
|
*/
|
|
164
|
-
const
|
|
167
|
+
const SUPPORTED_FIELD_NAMES = new Set([
|
|
168
|
+
'template',
|
|
169
|
+
'templateUrl',
|
|
170
|
+
'styles',
|
|
171
|
+
'styleUrl',
|
|
172
|
+
'stylesUrl',
|
|
173
|
+
]);
|
|
174
|
+
var MetaUpdateAnalysis;
|
|
175
|
+
(function (MetaUpdateAnalysis) {
|
|
176
|
+
MetaUpdateAnalysis[MetaUpdateAnalysis["Supported"] = 0] = "Supported";
|
|
177
|
+
MetaUpdateAnalysis[MetaUpdateAnalysis["Unsupported"] = 1] = "Unsupported";
|
|
178
|
+
MetaUpdateAnalysis[MetaUpdateAnalysis["None"] = 2] = "None";
|
|
179
|
+
})(MetaUpdateAnalysis || (MetaUpdateAnalysis = {}));
|
|
165
180
|
/**
|
|
166
181
|
* Analyzes the metadata fields of a decorator call expression for unsupported HMR updates.
|
|
167
182
|
* Only updates to supported fields can be present for HMR to be viable.
|
|
@@ -169,22 +184,25 @@ const SUPPORTED_FIELDS = new Set(['template', 'templateUrl', 'styles', 'styleUrl
|
|
|
169
184
|
* @param staleSource The source file instance containing the stale call instance.
|
|
170
185
|
* @param updatedCall A call expression instance.
|
|
171
186
|
* @param updatedSource The source file instance containing the updated call instance.
|
|
172
|
-
* @returns
|
|
187
|
+
* @returns A MetaUpdateAnalysis enum value.
|
|
173
188
|
*/
|
|
174
|
-
function
|
|
189
|
+
function analyzeMetaUpdates(staleCall, staleSource, updatedCall, updatedSource) {
|
|
175
190
|
const staleObject = staleCall.arguments[0];
|
|
176
191
|
const updatedObject = updatedCall.arguments[0];
|
|
192
|
+
let hasSupportedUpdate = false;
|
|
177
193
|
if (!typescript_1.default.isObjectLiteralExpression(staleObject) || !typescript_1.default.isObjectLiteralExpression(updatedObject)) {
|
|
178
|
-
return
|
|
194
|
+
return MetaUpdateAnalysis.Unsupported;
|
|
179
195
|
}
|
|
196
|
+
const supportedFields = new Map();
|
|
180
197
|
const unsupportedFields = [];
|
|
181
198
|
for (const property of staleObject.properties) {
|
|
182
199
|
if (!typescript_1.default.isPropertyAssignment(property) || typescript_1.default.isComputedPropertyName(property.name)) {
|
|
183
200
|
// Unsupported object literal property
|
|
184
|
-
return
|
|
201
|
+
return MetaUpdateAnalysis.Unsupported;
|
|
185
202
|
}
|
|
186
203
|
const name = property.name.text;
|
|
187
|
-
if (
|
|
204
|
+
if (SUPPORTED_FIELD_NAMES.has(name)) {
|
|
205
|
+
supportedFields.set(name, property.initializer);
|
|
188
206
|
continue;
|
|
189
207
|
}
|
|
190
208
|
unsupportedFields.push(property.initializer);
|
|
@@ -193,18 +211,31 @@ function hasUnsupportedMetaUpdates(staleCall, staleSource, updatedCall, updatedS
|
|
|
193
211
|
for (const property of updatedObject.properties) {
|
|
194
212
|
if (!typescript_1.default.isPropertyAssignment(property) || typescript_1.default.isComputedPropertyName(property.name)) {
|
|
195
213
|
// Unsupported object literal property
|
|
196
|
-
return
|
|
214
|
+
return MetaUpdateAnalysis.Unsupported;
|
|
197
215
|
}
|
|
198
216
|
const name = property.name.text;
|
|
199
|
-
if (
|
|
217
|
+
if (SUPPORTED_FIELD_NAMES.has(name)) {
|
|
218
|
+
const staleInitializer = supportedFields.get(name);
|
|
219
|
+
// If the supported field was added or has its content changed, there has been a supported update
|
|
220
|
+
if (!staleInitializer ||
|
|
221
|
+
!equalRangeText(property.initializer, updatedSource, staleInitializer, staleSource)) {
|
|
222
|
+
hasSupportedUpdate = true;
|
|
223
|
+
}
|
|
224
|
+
// Remove the field entry to allow tracking removed fields
|
|
225
|
+
supportedFields.delete(name);
|
|
200
226
|
continue;
|
|
201
227
|
}
|
|
202
228
|
// Compare in order
|
|
203
229
|
if (!equalRangeText(property.initializer, updatedSource, unsupportedFields[i++], staleSource)) {
|
|
204
|
-
return
|
|
230
|
+
return MetaUpdateAnalysis.Unsupported;
|
|
205
231
|
}
|
|
206
232
|
}
|
|
207
|
-
|
|
233
|
+
if (i !== unsupportedFields.length) {
|
|
234
|
+
return MetaUpdateAnalysis.Unsupported;
|
|
235
|
+
}
|
|
236
|
+
// Any remaining supported field indicates a field removal. This is also considered a supported update.
|
|
237
|
+
hasSupportedUpdate ||= supportedFields.size > 0;
|
|
238
|
+
return hasSupportedUpdate ? MetaUpdateAnalysis.Supported : MetaUpdateAnalysis.None;
|
|
208
239
|
}
|
|
209
240
|
/**
|
|
210
241
|
* Compares the text from a provided range in a source file to the text of a range in a second source file.
|
|
@@ -14,6 +14,7 @@ exports.default = default_1;
|
|
|
14
14
|
const core_1 = require("@babel/core");
|
|
15
15
|
const istanbul_lib_instrument_1 = require("istanbul-lib-instrument");
|
|
16
16
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
17
|
+
const node_url_1 = require("node:url");
|
|
17
18
|
/**
|
|
18
19
|
* A babel plugin factory function for adding istanbul instrumentation.
|
|
19
20
|
*
|
|
@@ -25,9 +26,15 @@ function default_1() {
|
|
|
25
26
|
visitor: {
|
|
26
27
|
Program: {
|
|
27
28
|
enter(path, state) {
|
|
29
|
+
const inputSourceMap = // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
state.file.inputMap?.toObject();
|
|
31
|
+
// istanbul does not support URL as sources.
|
|
32
|
+
if (inputSourceMap?.sources) {
|
|
33
|
+
inputSourceMap.sources = inputSourceMap.sources.map((s) => s.startsWith('file://') ? (0, node_url_1.fileURLToPath)(s) : s);
|
|
34
|
+
}
|
|
28
35
|
const visitor = (0, istanbul_lib_instrument_1.programVisitor)(core_1.types, state.filename, {
|
|
29
36
|
// Babel returns a Converter object from the `convert-source-map` package
|
|
30
|
-
inputSourceMap
|
|
37
|
+
inputSourceMap,
|
|
31
38
|
});
|
|
32
39
|
visitors.set(path, visitor);
|
|
33
40
|
visitor.enter(path);
|
|
@@ -47,6 +47,7 @@ exports.createCompilerPlugin = createCompilerPlugin;
|
|
|
47
47
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
48
48
|
const node_crypto_1 = require("node:crypto");
|
|
49
49
|
const path = __importStar(require("node:path"));
|
|
50
|
+
const node_url_1 = require("node:url");
|
|
50
51
|
const environment_options_1 = require("../../../utils/environment-options");
|
|
51
52
|
const compilation_1 = require("../../angular/compilation");
|
|
52
53
|
const javascript_transformer_1 = require("../javascript-transformer");
|
|
@@ -233,7 +234,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
|
|
|
233
234
|
let referencedFiles;
|
|
234
235
|
let externalStylesheets;
|
|
235
236
|
try {
|
|
236
|
-
const initializationResult = await compilation.initialize(pluginOptions.tsconfig, hostOptions, createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, build.initialOptions.conditions));
|
|
237
|
+
const initializationResult = await compilation.initialize(pluginOptions.tsconfig, hostOptions, createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, build.initialOptions.conditions, build.initialOptions.absWorkingDir));
|
|
237
238
|
shouldTsIgnoreJs = !initializationResult.compilerOptions.allowJs;
|
|
238
239
|
// Isolated modules option ensures safe non-TypeScript transpilation.
|
|
239
240
|
// Typescript printing support for sourcemaps is not yet integrated.
|
|
@@ -402,7 +403,7 @@ function createCompilerPlugin(pluginOptions, compilationOrFactory, stylesheetBun
|
|
|
402
403
|
const replacement = pluginOptions.fileReplacements?.[path.normalize(args.path)];
|
|
403
404
|
if (replacement) {
|
|
404
405
|
return {
|
|
405
|
-
contents: await Promise.resolve().then(() => __importStar(require('fs/promises'))).then(({ readFile }) => readFile(path.normalize(replacement))),
|
|
406
|
+
contents: await Promise.resolve().then(() => __importStar(require('node:fs/promises'))).then(({ readFile }) => readFile(path.normalize(replacement))),
|
|
406
407
|
loader: 'json',
|
|
407
408
|
watchFiles: [replacement],
|
|
408
409
|
};
|
|
@@ -474,7 +475,7 @@ async function bundleExternalStylesheet(stylesheetBundler, stylesheetFile, exter
|
|
|
474
475
|
});
|
|
475
476
|
}
|
|
476
477
|
}
|
|
477
|
-
function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, customConditions) {
|
|
478
|
+
function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserveSymlinks, customConditions, absWorkingDir) {
|
|
478
479
|
return (compilerOptions) => {
|
|
479
480
|
// target of 9 is ES2022 (using the number avoids an expensive import of typescript just for an enum)
|
|
480
481
|
if (compilerOptions.target === undefined || compilerOptions.target < 9 /** ES2022 */) {
|
|
@@ -542,6 +543,10 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
|
|
|
542
543
|
return {
|
|
543
544
|
...compilerOptions,
|
|
544
545
|
noEmitOnError: false,
|
|
546
|
+
// Using the path as a URL is necessary here; otherwise, esbuild will not generate source maps correctly.
|
|
547
|
+
// https://github.com/evanw/esbuild/issues/4070
|
|
548
|
+
// https://github.com/evanw/esbuild/issues/4075
|
|
549
|
+
outDir: absWorkingDir ? (0, node_url_1.pathToFileURL)(absWorkingDir + '/').href : undefined,
|
|
545
550
|
inlineSources: !!pluginOptions.sourcemap,
|
|
546
551
|
inlineSourceMap: !!pluginOptions.sourcemap,
|
|
547
552
|
sourceMap: undefined,
|
|
@@ -13,6 +13,7 @@ export interface I18nInlinerOptions {
|
|
|
13
13
|
missingTranslation: 'error' | 'warning' | 'ignore';
|
|
14
14
|
outputFiles: BuildOutputFile[];
|
|
15
15
|
shouldOptimize?: boolean;
|
|
16
|
+
persistentCachePath?: string;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* A class that performs i18n translation inlining of JavaScript code.
|
|
@@ -22,6 +23,7 @@ export interface I18nInlinerOptions {
|
|
|
22
23
|
*/
|
|
23
24
|
export declare class I18nInliner {
|
|
24
25
|
#private;
|
|
26
|
+
private readonly options;
|
|
25
27
|
constructor(options: I18nInlinerOptions, maxThreads?: number);
|
|
26
28
|
/**
|
|
27
29
|
* Performs inlining of translations for the provided locale and translations. The files that
|
|
@@ -41,4 +43,11 @@ export declare class I18nInliner {
|
|
|
41
43
|
* @returns A void promise that resolves when closing is complete.
|
|
42
44
|
*/
|
|
43
45
|
close(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Initializes the cache for storing translated bundles.
|
|
48
|
+
* If the cache is already initialized, it does nothing.
|
|
49
|
+
*
|
|
50
|
+
* @returns A promise that resolves once the cache initialization process is complete.
|
|
51
|
+
*/
|
|
52
|
+
private initCache;
|
|
44
53
|
}
|