@angular/compiler 19.0.0-rc.2 → 19.0.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/fesm2022/compiler.mjs +74 -42
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0
|
|
2
|
+
* @license Angular v19.0.0
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -8197,13 +8197,15 @@ class ShadowCss {
|
|
|
8197
8197
|
_polyfillHostRe.lastIndex = 0;
|
|
8198
8198
|
if (_polyfillHostRe.test(selector)) {
|
|
8199
8199
|
const replaceBy = `[${hostSelector}]`;
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
return
|
|
8200
|
+
let result = selector;
|
|
8201
|
+
while (result.match(_polyfillHostNoCombinatorRe)) {
|
|
8202
|
+
result = result.replace(_polyfillHostNoCombinatorRe, (_hnc, selector) => {
|
|
8203
|
+
return selector.replace(/([^:\)]*)(:*)(.*)/, (_, before, colon, after) => {
|
|
8204
|
+
return before + replaceBy + colon + after;
|
|
8205
|
+
});
|
|
8204
8206
|
});
|
|
8205
|
-
}
|
|
8206
|
-
|
|
8207
|
+
}
|
|
8208
|
+
return result.replace(_polyfillHostRe, replaceBy);
|
|
8207
8209
|
}
|
|
8208
8210
|
return scopeSelector + ' ' + selector;
|
|
8209
8211
|
}
|
|
@@ -8212,7 +8214,7 @@ class ShadowCss {
|
|
|
8212
8214
|
_applySelectorScope({ selector, scopeSelector, hostSelector, isParentSelector, }) {
|
|
8213
8215
|
const isRe = /\[is=([^\]]*)\]/g;
|
|
8214
8216
|
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
8215
|
-
const attrName =
|
|
8217
|
+
const attrName = `[${scopeSelector}]`;
|
|
8216
8218
|
const _scopeSelectorPart = (p) => {
|
|
8217
8219
|
let scopedP = p.trim();
|
|
8218
8220
|
if (!scopedP) {
|
|
@@ -8220,8 +8222,8 @@ class ShadowCss {
|
|
|
8220
8222
|
}
|
|
8221
8223
|
if (p.includes(_polyfillHostNoCombinator)) {
|
|
8222
8224
|
scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
8223
|
-
if (
|
|
8224
|
-
const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)(
|
|
8225
|
+
if (!p.match(_polyfillHostNoCombinatorOutsidePseudoFunction)) {
|
|
8226
|
+
const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)([\s\S]*)/);
|
|
8225
8227
|
scopedP = before + attrName + colon + after;
|
|
8226
8228
|
}
|
|
8227
8229
|
}
|
|
@@ -8229,7 +8231,7 @@ class ShadowCss {
|
|
|
8229
8231
|
// remove :host since it should be unnecessary
|
|
8230
8232
|
const t = p.replace(_polyfillHostRe, '');
|
|
8231
8233
|
if (t.length > 0) {
|
|
8232
|
-
const matches = t.match(/([^:]*)(:*)(
|
|
8234
|
+
const matches = t.match(/([^:]*)(:*)([\s\S]*)/);
|
|
8233
8235
|
if (matches) {
|
|
8234
8236
|
scopedP = matches[1] + attrName + matches[2] + matches[3];
|
|
8235
8237
|
}
|
|
@@ -8242,24 +8244,55 @@ class ShadowCss {
|
|
|
8242
8244
|
// functions are recursively sent to `_scopeSelector()`.
|
|
8243
8245
|
const _pseudoFunctionAwareScopeSelectorPart = (selectorPart) => {
|
|
8244
8246
|
let scopedPart = '';
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8247
|
+
// Collect all outer `:where()` and `:is()` selectors,
|
|
8248
|
+
// counting parenthesis to keep nested selectors intact.
|
|
8249
|
+
const pseudoSelectorParts = [];
|
|
8250
|
+
let pseudoSelectorMatch;
|
|
8251
|
+
while ((pseudoSelectorMatch = _cssPrefixWithPseudoSelectorFunction.exec(selectorPart)) !== null) {
|
|
8252
|
+
let openedBrackets = 1;
|
|
8253
|
+
let index = _cssPrefixWithPseudoSelectorFunction.lastIndex;
|
|
8254
|
+
while (index < selectorPart.length) {
|
|
8255
|
+
const currentSymbol = selectorPart[index];
|
|
8256
|
+
index++;
|
|
8257
|
+
if (currentSymbol === '(') {
|
|
8258
|
+
openedBrackets++;
|
|
8259
|
+
continue;
|
|
8260
|
+
}
|
|
8261
|
+
if (currentSymbol === ')') {
|
|
8262
|
+
openedBrackets--;
|
|
8263
|
+
if (openedBrackets === 0) {
|
|
8264
|
+
break;
|
|
8265
|
+
}
|
|
8266
|
+
continue;
|
|
8267
|
+
}
|
|
8268
|
+
}
|
|
8269
|
+
pseudoSelectorParts.push(`${pseudoSelectorMatch[0]}${selectorPart.slice(_cssPrefixWithPseudoSelectorFunction.lastIndex, index)}`);
|
|
8270
|
+
_cssPrefixWithPseudoSelectorFunction.lastIndex = index;
|
|
8271
|
+
}
|
|
8272
|
+
// If selector consists of only `:where()` and `:is()` on the outer level
|
|
8273
|
+
// scope those pseudo-selectors individually, otherwise scope the whole
|
|
8274
|
+
// selector.
|
|
8275
|
+
if (pseudoSelectorParts.join('') === selectorPart) {
|
|
8276
|
+
scopedPart = pseudoSelectorParts
|
|
8277
|
+
.map((selectorPart) => {
|
|
8278
|
+
const [cssPseudoSelectorFunction] = selectorPart.match(_cssPrefixWithPseudoSelectorFunction) ?? [];
|
|
8279
|
+
// Unwrap the pseudo selector to scope its contents.
|
|
8280
|
+
// For example,
|
|
8281
|
+
// - `:where(selectorToScope)` -> `selectorToScope`;
|
|
8282
|
+
// - `:is(.foo, .bar)` -> `.foo, .bar`.
|
|
8283
|
+
const selectorToScope = selectorPart.slice(cssPseudoSelectorFunction?.length, -1);
|
|
8284
|
+
if (selectorToScope.includes(_polyfillHostNoCombinator)) {
|
|
8285
|
+
this._shouldScopeIndicator = true;
|
|
8286
|
+
}
|
|
8287
|
+
const scopedInnerPart = this._scopeSelector({
|
|
8288
|
+
selector: selectorToScope,
|
|
8289
|
+
scopeSelector,
|
|
8290
|
+
hostSelector,
|
|
8291
|
+
});
|
|
8292
|
+
// Put the result back into the pseudo selector function.
|
|
8293
|
+
return `${cssPseudoSelectorFunction}${scopedInnerPart})`;
|
|
8294
|
+
})
|
|
8295
|
+
.join('');
|
|
8263
8296
|
}
|
|
8264
8297
|
else {
|
|
8265
8298
|
this._shouldScopeIndicator =
|
|
@@ -8380,7 +8413,7 @@ class SafeSelector {
|
|
|
8380
8413
|
}
|
|
8381
8414
|
}
|
|
8382
8415
|
const _cssScopedPseudoFunctionPrefix = '(:(where|is)\\()?';
|
|
8383
|
-
const _cssPrefixWithPseudoSelectorFunction =
|
|
8416
|
+
const _cssPrefixWithPseudoSelectorFunction = /:(where|is)\(/gi;
|
|
8384
8417
|
const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
8385
8418
|
const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
8386
8419
|
const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
@@ -8392,9 +8425,8 @@ const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
|
|
|
8392
8425
|
const _cssColonHostContextReGlobal = new RegExp(_cssScopedPseudoFunctionPrefix + '(' + _polyfillHostContext + _parenSuffix + ')', 'gim');
|
|
8393
8426
|
const _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
|
|
8394
8427
|
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
8395
|
-
const
|
|
8396
|
-
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
8397
|
-
const _polyfillHostNoCombinatorReGlobal = new RegExp(_polyfillHostNoCombinatorRe, 'g');
|
|
8428
|
+
const _polyfillHostNoCombinatorOutsidePseudoFunction = new RegExp(`${_polyfillHostNoCombinator}(?![^(]*\\))`, 'g');
|
|
8429
|
+
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s,]*)/;
|
|
8398
8430
|
const _shadowDOMSelectorsRe = [
|
|
8399
8431
|
/::shadow/g,
|
|
8400
8432
|
/::content/g,
|
|
@@ -30840,7 +30872,7 @@ function publishFacade(global) {
|
|
|
30840
30872
|
* @description
|
|
30841
30873
|
* Entry point for all public APIs of the compiler package.
|
|
30842
30874
|
*/
|
|
30843
|
-
const VERSION = new Version('19.0.0
|
|
30875
|
+
const VERSION = new Version('19.0.0');
|
|
30844
30876
|
|
|
30845
30877
|
class CompilerConfig {
|
|
30846
30878
|
defaultEncapsulation;
|
|
@@ -32684,7 +32716,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32684
32716
|
function compileDeclareClassMetadata(metadata) {
|
|
32685
32717
|
const definitionMap = new DefinitionMap();
|
|
32686
32718
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32687
|
-
definitionMap.set('version', literal('19.0.0
|
|
32719
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
32688
32720
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32689
32721
|
definitionMap.set('type', metadata.type);
|
|
32690
32722
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32702,7 +32734,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32702
32734
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32703
32735
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32704
32736
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32705
|
-
definitionMap.set('version', literal('19.0.0
|
|
32737
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
32706
32738
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32707
32739
|
definitionMap.set('type', metadata.type);
|
|
32708
32740
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -32797,7 +32829,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32797
32829
|
const definitionMap = new DefinitionMap();
|
|
32798
32830
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
32799
32831
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32800
|
-
definitionMap.set('version', literal('19.0.0
|
|
32832
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
32801
32833
|
// e.g. `type: MyDirective`
|
|
32802
32834
|
definitionMap.set('type', meta.type.value);
|
|
32803
32835
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33216,7 +33248,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33216
33248
|
function compileDeclareFactoryFunction(meta) {
|
|
33217
33249
|
const definitionMap = new DefinitionMap();
|
|
33218
33250
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33219
|
-
definitionMap.set('version', literal('19.0.0
|
|
33251
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
33220
33252
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33221
33253
|
definitionMap.set('type', meta.type.value);
|
|
33222
33254
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33251,7 +33283,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33251
33283
|
function createInjectableDefinitionMap(meta) {
|
|
33252
33284
|
const definitionMap = new DefinitionMap();
|
|
33253
33285
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33254
|
-
definitionMap.set('version', literal('19.0.0
|
|
33286
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
33255
33287
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33256
33288
|
definitionMap.set('type', meta.type.value);
|
|
33257
33289
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33302,7 +33334,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33302
33334
|
function createInjectorDefinitionMap(meta) {
|
|
33303
33335
|
const definitionMap = new DefinitionMap();
|
|
33304
33336
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33305
|
-
definitionMap.set('version', literal('19.0.0
|
|
33337
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
33306
33338
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33307
33339
|
definitionMap.set('type', meta.type.value);
|
|
33308
33340
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33335,7 +33367,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33335
33367
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33336
33368
|
}
|
|
33337
33369
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33338
|
-
definitionMap.set('version', literal('19.0.0
|
|
33370
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
33339
33371
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33340
33372
|
definitionMap.set('type', meta.type.value);
|
|
33341
33373
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33386,7 +33418,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33386
33418
|
function createPipeDefinitionMap(meta) {
|
|
33387
33419
|
const definitionMap = new DefinitionMap();
|
|
33388
33420
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33389
|
-
definitionMap.set('version', literal('19.0.0
|
|
33421
|
+
definitionMap.set('version', literal('19.0.0'));
|
|
33390
33422
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33391
33423
|
// e.g. `type: MyPipe`
|
|
33392
33424
|
definitionMap.set('type', meta.type.value);
|