@angular/compiler 20.3.11 → 20.3.12
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 +54 -84
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.3.
|
|
2
|
+
* @license Angular v20.3.12
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -7806,13 +7806,11 @@ class ShadowCss {
|
|
|
7806
7806
|
return cssText.replace(_cssColonHostRe, (_, hostSelectors, otherSelectors) => {
|
|
7807
7807
|
if (hostSelectors) {
|
|
7808
7808
|
const convertedSelectors = [];
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
if (!
|
|
7809
|
+
const hostSelectorArray = hostSelectors.split(',').map((p) => p.trim());
|
|
7810
|
+
for (const hostSelector of hostSelectorArray) {
|
|
7811
|
+
if (!hostSelector)
|
|
7812
7812
|
break;
|
|
7813
|
-
const convertedSelector = _polyfillHostNoCombinator +
|
|
7814
|
-
trimmedHostSelector.replace(_polyfillHost, '') +
|
|
7815
|
-
otherSelectors;
|
|
7813
|
+
const convertedSelector = _polyfillHostNoCombinator + hostSelector.replace(_polyfillHost, '') + otherSelectors;
|
|
7816
7814
|
convertedSelectors.push(convertedSelector);
|
|
7817
7815
|
}
|
|
7818
7816
|
return convertedSelectors.join(',');
|
|
@@ -7822,38 +7820,6 @@ class ShadowCss {
|
|
|
7822
7820
|
}
|
|
7823
7821
|
});
|
|
7824
7822
|
}
|
|
7825
|
-
/**
|
|
7826
|
-
* Generator function that splits a string on top-level commas (commas that are not inside parentheses).
|
|
7827
|
-
* Yields each part of the string between top-level commas. Terminates if an extra closing paren is found.
|
|
7828
|
-
*
|
|
7829
|
-
* @param text The string to split
|
|
7830
|
-
*/
|
|
7831
|
-
*_splitOnTopLevelCommas(text) {
|
|
7832
|
-
const length = text.length;
|
|
7833
|
-
let parens = 0;
|
|
7834
|
-
let prev = 0;
|
|
7835
|
-
for (let i = 0; i < length; i++) {
|
|
7836
|
-
const charCode = text.charCodeAt(i);
|
|
7837
|
-
if (charCode === $LPAREN) {
|
|
7838
|
-
parens++;
|
|
7839
|
-
}
|
|
7840
|
-
else if (charCode === $RPAREN) {
|
|
7841
|
-
parens--;
|
|
7842
|
-
if (parens < 0) {
|
|
7843
|
-
// Found an extra closing paren. Assume we want the list terminated here
|
|
7844
|
-
yield text.slice(prev, i);
|
|
7845
|
-
return;
|
|
7846
|
-
}
|
|
7847
|
-
}
|
|
7848
|
-
else if (charCode === $COMMA && parens === 0) {
|
|
7849
|
-
// Found a top-level comma, yield the current chunk
|
|
7850
|
-
yield text.slice(prev, i);
|
|
7851
|
-
prev = i + 1;
|
|
7852
|
-
}
|
|
7853
|
-
}
|
|
7854
|
-
// Yield the final chunk
|
|
7855
|
-
yield text.slice(prev);
|
|
7856
|
-
}
|
|
7857
7823
|
/*
|
|
7858
7824
|
* convert a rule like :host-context(.foo) > .bar { }
|
|
7859
7825
|
*
|
|
@@ -7870,14 +7836,34 @@ class ShadowCss {
|
|
|
7870
7836
|
* .foo<scopeName> .bar { ... }
|
|
7871
7837
|
*/
|
|
7872
7838
|
_convertColonHostContext(cssText) {
|
|
7839
|
+
const length = cssText.length;
|
|
7840
|
+
let parens = 0;
|
|
7841
|
+
let prev = 0;
|
|
7842
|
+
let result = '';
|
|
7873
7843
|
// Splits up the selectors on their top-level commas, processes the :host-context in them
|
|
7874
7844
|
// individually and stitches them back together. This ensures that individual selectors don't
|
|
7875
7845
|
// affect each other.
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7846
|
+
for (let i = 0; i < length; i++) {
|
|
7847
|
+
const char = cssText[i];
|
|
7848
|
+
// If we hit a comma and there are no open parentheses, take the current chunk and process it.
|
|
7849
|
+
if (char === ',' && parens === 0) {
|
|
7850
|
+
result += this._convertColonHostContextInSelectorPart(cssText.slice(prev, i)) + ',';
|
|
7851
|
+
prev = i + 1;
|
|
7852
|
+
continue;
|
|
7853
|
+
}
|
|
7854
|
+
// We've hit the end. Take everything since the last comma.
|
|
7855
|
+
if (i === length - 1) {
|
|
7856
|
+
result += this._convertColonHostContextInSelectorPart(cssText.slice(prev));
|
|
7857
|
+
break;
|
|
7858
|
+
}
|
|
7859
|
+
if (char === '(') {
|
|
7860
|
+
parens++;
|
|
7861
|
+
}
|
|
7862
|
+
else if (char === ')') {
|
|
7863
|
+
parens--;
|
|
7864
|
+
}
|
|
7879
7865
|
}
|
|
7880
|
-
return
|
|
7866
|
+
return result;
|
|
7881
7867
|
}
|
|
7882
7868
|
_convertColonHostContextInSelectorPart(cssText) {
|
|
7883
7869
|
return cssText.replace(_cssColonHostContextReGlobal, (selectorText, pseudoPrefix) => {
|
|
@@ -7889,26 +7875,17 @@ class ShadowCss {
|
|
|
7889
7875
|
const contextSelectorGroups = [[]];
|
|
7890
7876
|
// There may be more than `:host-context` in this selector so `selectorText` could look like:
|
|
7891
7877
|
// `:host-context(.one):host-context(.two)`.
|
|
7892
|
-
//
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
const newContextSelectors = [];
|
|
7904
|
-
let endIndex = 0; // Index of the closing paren of the :host-context()
|
|
7905
|
-
for (const selector of this._splitOnTopLevelCommas(afterPrefix.substring(1))) {
|
|
7906
|
-
endIndex = endIndex + selector.length + 1;
|
|
7907
|
-
const trimmed = selector.trim();
|
|
7908
|
-
if (trimmed) {
|
|
7909
|
-
newContextSelectors.push(trimmed);
|
|
7910
|
-
}
|
|
7911
|
-
}
|
|
7878
|
+
// Execute `_cssColonHostContextRe` over and over until we have extracted all the
|
|
7879
|
+
// `:host-context` selectors from this selector.
|
|
7880
|
+
let match;
|
|
7881
|
+
while ((match = _cssColonHostContextRe.exec(selectorText))) {
|
|
7882
|
+
// `match` = [':host-context(<selectors>)<rest>', <selectors>, <rest>]
|
|
7883
|
+
// The `<selectors>` could actually be a comma separated list: `:host-context(.one, .two)`.
|
|
7884
|
+
const newContextSelectors = (match[1] ?? '')
|
|
7885
|
+
.trim()
|
|
7886
|
+
.split(',')
|
|
7887
|
+
.map((m) => m.trim())
|
|
7888
|
+
.filter((m) => m !== '');
|
|
7912
7889
|
// We must duplicate the current selector group for each of these new selectors.
|
|
7913
7890
|
// For example if the current groups are:
|
|
7914
7891
|
// ```
|
|
@@ -7935,8 +7912,7 @@ class ShadowCss {
|
|
|
7935
7912
|
}
|
|
7936
7913
|
}
|
|
7937
7914
|
// Update the `selectorText` and see repeat to see if there are more `:host-context`s.
|
|
7938
|
-
selectorText =
|
|
7939
|
-
startIndex = selectorText.indexOf(_polyfillHostContext);
|
|
7915
|
+
selectorText = match[2];
|
|
7940
7916
|
}
|
|
7941
7917
|
// The context selectors now must be combined with each other to capture all the possible
|
|
7942
7918
|
// selectors that `:host-context` can match. See `_combineHostContextSelectors()` for more
|
|
@@ -8243,9 +8219,9 @@ class SafeSelector {
|
|
|
8243
8219
|
});
|
|
8244
8220
|
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
8245
8221
|
// WS and "+" would otherwise be interpreted as selector separators.
|
|
8246
|
-
this._content = selector.replace(
|
|
8222
|
+
this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
8247
8223
|
const replaceBy = `__ph-${this.index}__`;
|
|
8248
|
-
this.placeholders.push(
|
|
8224
|
+
this.placeholders.push(exp);
|
|
8249
8225
|
this.index++;
|
|
8250
8226
|
return pseudo + replaceBy;
|
|
8251
8227
|
});
|
|
@@ -8277,19 +8253,13 @@ const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*([
|
|
|
8277
8253
|
const _polyfillHost = '-shadowcsshost';
|
|
8278
8254
|
// note: :host-context pre-processed to -shadowcsshostcontext.
|
|
8279
8255
|
const _polyfillHostContext = '-shadowcsscontext';
|
|
8280
|
-
|
|
8281
|
-
const _noParens = '[^)(]*';
|
|
8282
|
-
// Matches content with at most ONE level of nesting, e.g., "a(b)c"
|
|
8283
|
-
const _level1Parens = String.raw `(?:\(${_noParens}\)|${_noParens})+?`;
|
|
8284
|
-
// Matches content with at most TWO levels of nesting, e.g., "a(b(c)d)e"
|
|
8285
|
-
const _level2Parens = String.raw `(?:\(${_level1Parens}\)|${_noParens})+?`;
|
|
8286
|
-
const _parenSuffix = String.raw `(?:\((${_level2Parens})\))`;
|
|
8287
|
-
const nthRegex = new RegExp(String.raw `(:nth-[-\w]+)` + _parenSuffix, 'g');
|
|
8256
|
+
const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))';
|
|
8288
8257
|
const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix + '?([^,{]*)', 'gim');
|
|
8289
8258
|
// note: :host-context patterns are terminated with `{`, as opposed to :host which
|
|
8290
8259
|
// is both `{` and `,` because :host-context handles top-level commas differently.
|
|
8291
8260
|
const _hostContextPattern = _polyfillHostContext + _parenSuffix + '?([^{]*)';
|
|
8292
8261
|
const _cssColonHostContextReGlobal = new RegExp(`${_cssScopedPseudoFunctionPrefix}(${_hostContextPattern})`, 'gim');
|
|
8262
|
+
const _cssColonHostContextRe = new RegExp(_hostContextPattern, 'im');
|
|
8293
8263
|
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
8294
8264
|
const _polyfillHostNoCombinatorOutsidePseudoFunction = new RegExp(`${_polyfillHostNoCombinator}(?![^(]*\\))`, 'g');
|
|
8295
8265
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s,]*)/;
|
|
@@ -34307,7 +34277,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
34307
34277
|
function compileDeclareClassMetadata(metadata) {
|
|
34308
34278
|
const definitionMap = new DefinitionMap();
|
|
34309
34279
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
34310
|
-
definitionMap.set('version', literal('20.3.
|
|
34280
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34311
34281
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34312
34282
|
definitionMap.set('type', metadata.type);
|
|
34313
34283
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -34325,7 +34295,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
34325
34295
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
34326
34296
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
34327
34297
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
34328
|
-
definitionMap.set('version', literal('20.3.
|
|
34298
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34329
34299
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34330
34300
|
definitionMap.set('type', metadata.type);
|
|
34331
34301
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -34420,7 +34390,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
34420
34390
|
const definitionMap = new DefinitionMap();
|
|
34421
34391
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
34422
34392
|
definitionMap.set('minVersion', literal(minVersion));
|
|
34423
|
-
definitionMap.set('version', literal('20.3.
|
|
34393
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34424
34394
|
// e.g. `type: MyDirective`
|
|
34425
34395
|
definitionMap.set('type', meta.type.value);
|
|
34426
34396
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34836,7 +34806,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34836
34806
|
function compileDeclareFactoryFunction(meta) {
|
|
34837
34807
|
const definitionMap = new DefinitionMap();
|
|
34838
34808
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34839
|
-
definitionMap.set('version', literal('20.3.
|
|
34809
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34840
34810
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34841
34811
|
definitionMap.set('type', meta.type.value);
|
|
34842
34812
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34871,7 +34841,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34871
34841
|
function createInjectableDefinitionMap(meta) {
|
|
34872
34842
|
const definitionMap = new DefinitionMap();
|
|
34873
34843
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34874
|
-
definitionMap.set('version', literal('20.3.
|
|
34844
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34875
34845
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34876
34846
|
definitionMap.set('type', meta.type.value);
|
|
34877
34847
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34922,7 +34892,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34922
34892
|
function createInjectorDefinitionMap(meta) {
|
|
34923
34893
|
const definitionMap = new DefinitionMap();
|
|
34924
34894
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34925
|
-
definitionMap.set('version', literal('20.3.
|
|
34895
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34926
34896
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34927
34897
|
definitionMap.set('type', meta.type.value);
|
|
34928
34898
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34955,7 +34925,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34955
34925
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34956
34926
|
}
|
|
34957
34927
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34958
|
-
definitionMap.set('version', literal('20.3.
|
|
34928
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
34959
34929
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34960
34930
|
definitionMap.set('type', meta.type.value);
|
|
34961
34931
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -35006,7 +34976,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
35006
34976
|
function createPipeDefinitionMap(meta) {
|
|
35007
34977
|
const definitionMap = new DefinitionMap();
|
|
35008
34978
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
35009
|
-
definitionMap.set('version', literal('20.3.
|
|
34979
|
+
definitionMap.set('version', literal('20.3.12'));
|
|
35010
34980
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
35011
34981
|
// e.g. `type: MyPipe`
|
|
35012
34982
|
definitionMap.set('type', meta.type.value);
|
|
@@ -35162,7 +35132,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
35162
35132
|
* @description
|
|
35163
35133
|
* Entry point for all public APIs of the compiler package.
|
|
35164
35134
|
*/
|
|
35165
|
-
const VERSION = new Version('20.3.
|
|
35135
|
+
const VERSION = new Version('20.3.12');
|
|
35166
35136
|
|
|
35167
35137
|
//////////////////////////////////////
|
|
35168
35138
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|