@angular/compiler 19.0.0-next.8 → 19.0.0-next.9
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 +118 -65
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +6 -1
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0-next.
|
|
2
|
+
* @license Angular v19.0.0-next.9
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2943,6 +2943,10 @@ class Identifiers {
|
|
|
2943
2943
|
name: 'ɵɵInputTransformsFeature',
|
|
2944
2944
|
moduleName: CORE,
|
|
2945
2945
|
}; }
|
|
2946
|
+
static { this.ExternalStylesFeature = {
|
|
2947
|
+
name: 'ɵɵExternalStylesFeature',
|
|
2948
|
+
moduleName: CORE,
|
|
2949
|
+
}; }
|
|
2946
2950
|
static { this.listener = { name: 'ɵɵlistener', moduleName: CORE }; }
|
|
2947
2951
|
static { this.getInheritedFactory = {
|
|
2948
2952
|
name: 'ɵɵgetInheritedFactory',
|
|
@@ -7305,7 +7309,7 @@ class ShadowCss {
|
|
|
7305
7309
|
* captures how many (if any) leading whitespaces are present or a comma
|
|
7306
7310
|
* - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
|
|
7307
7311
|
* captures two different possible keyframes, ones which are quoted or ones which are valid css
|
|
7308
|
-
*
|
|
7312
|
+
* indents (custom properties excluded)
|
|
7309
7313
|
* - (?=[,\s;]|$)
|
|
7310
7314
|
* simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
|
|
7311
7315
|
* semicolon or the end of the string
|
|
@@ -7534,7 +7538,7 @@ class ShadowCss {
|
|
|
7534
7538
|
*/
|
|
7535
7539
|
_scopeCssText(cssText, scopeSelector, hostSelector) {
|
|
7536
7540
|
const unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
|
|
7537
|
-
// replace :host and :host-context -shadowcsshost and -
|
|
7541
|
+
// replace :host and :host-context with -shadowcsshost and -shadowcsshostcontext respectively
|
|
7538
7542
|
cssText = this._insertPolyfillHostInCssText(cssText);
|
|
7539
7543
|
cssText = this._convertColonHost(cssText);
|
|
7540
7544
|
cssText = this._convertColonHostContext(cssText);
|
|
@@ -7612,7 +7616,7 @@ class ShadowCss {
|
|
|
7612
7616
|
* .foo<scopeName> .bar { ... }
|
|
7613
7617
|
*/
|
|
7614
7618
|
_convertColonHostContext(cssText) {
|
|
7615
|
-
return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
|
|
7619
|
+
return cssText.replace(_cssColonHostContextReGlobal, (selectorText, pseudoPrefix) => {
|
|
7616
7620
|
// We have captured a selector that contains a `:host-context` rule.
|
|
7617
7621
|
// For backward compatibility `:host-context` may contain a comma separated list of selectors.
|
|
7618
7622
|
// Each context selector group will contain a list of host-context selectors that must match
|
|
@@ -7661,10 +7665,10 @@ class ShadowCss {
|
|
|
7661
7665
|
selectorText = match[2];
|
|
7662
7666
|
}
|
|
7663
7667
|
// The context selectors now must be combined with each other to capture all the possible
|
|
7664
|
-
// selectors that `:host-context` can match. See `
|
|
7668
|
+
// selectors that `:host-context` can match. See `_combineHostContextSelectors()` for more
|
|
7665
7669
|
// info about how this is done.
|
|
7666
7670
|
return contextSelectorGroups
|
|
7667
|
-
.map((contextSelectors) =>
|
|
7671
|
+
.map((contextSelectors) => _combineHostContextSelectors(contextSelectors, selectorText, pseudoPrefix))
|
|
7668
7672
|
.join(', ');
|
|
7669
7673
|
});
|
|
7670
7674
|
}
|
|
@@ -7681,7 +7685,12 @@ class ShadowCss {
|
|
|
7681
7685
|
let selector = rule.selector;
|
|
7682
7686
|
let content = rule.content;
|
|
7683
7687
|
if (rule.selector[0] !== '@') {
|
|
7684
|
-
selector = this._scopeSelector(
|
|
7688
|
+
selector = this._scopeSelector({
|
|
7689
|
+
selector,
|
|
7690
|
+
scopeSelector,
|
|
7691
|
+
hostSelector,
|
|
7692
|
+
isParentSelector: true,
|
|
7693
|
+
});
|
|
7685
7694
|
}
|
|
7686
7695
|
else if (scopedAtRuleIdentifiers.some((atRule) => rule.selector.startsWith(atRule))) {
|
|
7687
7696
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
@@ -7721,15 +7730,29 @@ class ShadowCss {
|
|
|
7721
7730
|
return new CssRule(selector, rule.content);
|
|
7722
7731
|
});
|
|
7723
7732
|
}
|
|
7724
|
-
|
|
7733
|
+
// `isParentSelector` is used to distinguish the selectors which are coming from
|
|
7734
|
+
// the initial selector string and any nested selectors, parsed recursively,
|
|
7735
|
+
// for example `selector = 'a:where(.one)'` could be the parent, while recursive call
|
|
7736
|
+
// would have `selector = '.one'`.
|
|
7737
|
+
_scopeSelector({ selector, scopeSelector, hostSelector, isParentSelector = false, }) {
|
|
7738
|
+
// Split the selector into independent parts by `,` (comma) unless
|
|
7739
|
+
// comma is within parenthesis, for example `:is(.one, two)`.
|
|
7740
|
+
// Negative lookup after comma allows not splitting inside nested parenthesis,
|
|
7741
|
+
// up to three levels (((,))).
|
|
7742
|
+
const selectorSplitRe = / ?,(?!(?:[^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\))) ?/;
|
|
7725
7743
|
return selector
|
|
7726
|
-
.split(
|
|
7744
|
+
.split(selectorSplitRe)
|
|
7727
7745
|
.map((part) => part.split(_shadowDeepSelectors))
|
|
7728
7746
|
.map((deepParts) => {
|
|
7729
7747
|
const [shallowPart, ...otherParts] = deepParts;
|
|
7730
7748
|
const applyScope = (shallowPart) => {
|
|
7731
7749
|
if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
|
|
7732
|
-
return this._applySelectorScope(
|
|
7750
|
+
return this._applySelectorScope({
|
|
7751
|
+
selector: shallowPart,
|
|
7752
|
+
scopeSelector,
|
|
7753
|
+
hostSelector,
|
|
7754
|
+
isParentSelector,
|
|
7755
|
+
});
|
|
7733
7756
|
}
|
|
7734
7757
|
else {
|
|
7735
7758
|
return shallowPart;
|
|
@@ -7756,8 +7779,8 @@ class ShadowCss {
|
|
|
7756
7779
|
if (_polyfillHostRe.test(selector)) {
|
|
7757
7780
|
const replaceBy = `[${hostSelector}]`;
|
|
7758
7781
|
return selector
|
|
7759
|
-
.replace(
|
|
7760
|
-
return selector.replace(/([
|
|
7782
|
+
.replace(_polyfillHostNoCombinatorReGlobal, (_hnc, selector) => {
|
|
7783
|
+
return selector.replace(/([^:\)]*)(:*)(.*)/, (_, before, colon, after) => {
|
|
7761
7784
|
return before + replaceBy + colon + after;
|
|
7762
7785
|
});
|
|
7763
7786
|
})
|
|
@@ -7767,7 +7790,7 @@ class ShadowCss {
|
|
|
7767
7790
|
}
|
|
7768
7791
|
// return a selector with [name] suffix on each simple selector
|
|
7769
7792
|
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
|
|
7770
|
-
_applySelectorScope(selector, scopeSelector, hostSelector) {
|
|
7793
|
+
_applySelectorScope({ selector, scopeSelector, hostSelector, isParentSelector, }) {
|
|
7771
7794
|
const isRe = /\[is=([^\]]*)\]/g;
|
|
7772
7795
|
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
7773
7796
|
const attrName = '[' + scopeSelector + ']';
|
|
@@ -7778,6 +7801,10 @@ class ShadowCss {
|
|
|
7778
7801
|
}
|
|
7779
7802
|
if (p.includes(_polyfillHostNoCombinator)) {
|
|
7780
7803
|
scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
7804
|
+
if (_polyfillHostNoCombinatorWithinPseudoFunction.test(p)) {
|
|
7805
|
+
const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)(.*)/);
|
|
7806
|
+
scopedP = before + attrName + colon + after;
|
|
7807
|
+
}
|
|
7781
7808
|
}
|
|
7782
7809
|
else {
|
|
7783
7810
|
// remove :host since it should be unnecessary
|
|
@@ -7791,12 +7818,50 @@ class ShadowCss {
|
|
|
7791
7818
|
}
|
|
7792
7819
|
return scopedP;
|
|
7793
7820
|
};
|
|
7794
|
-
|
|
7795
|
-
selector
|
|
7821
|
+
// Wraps `_scopeSelectorPart()` to not use it directly on selectors with
|
|
7822
|
+
// pseudo selector functions like `:where()`. Selectors within pseudo selector
|
|
7823
|
+
// functions are recursively sent to `_scopeSelector()`.
|
|
7824
|
+
const _pseudoFunctionAwareScopeSelectorPart = (selectorPart) => {
|
|
7825
|
+
let scopedPart = '';
|
|
7826
|
+
const cssPrefixWithPseudoSelectorFunctionMatch = selectorPart.match(_cssPrefixWithPseudoSelectorFunction);
|
|
7827
|
+
if (cssPrefixWithPseudoSelectorFunctionMatch) {
|
|
7828
|
+
const [cssPseudoSelectorFunction] = cssPrefixWithPseudoSelectorFunctionMatch;
|
|
7829
|
+
// Unwrap the pseudo selector to scope its contents.
|
|
7830
|
+
// For example,
|
|
7831
|
+
// - `:where(selectorToScope)` -> `selectorToScope`;
|
|
7832
|
+
// - `:is(.foo, .bar)` -> `.foo, .bar`.
|
|
7833
|
+
const selectorToScope = selectorPart.slice(cssPseudoSelectorFunction.length, -1);
|
|
7834
|
+
if (selectorToScope.includes(_polyfillHostNoCombinator)) {
|
|
7835
|
+
this._shouldScopeIndicator = true;
|
|
7836
|
+
}
|
|
7837
|
+
const scopedInnerPart = this._scopeSelector({
|
|
7838
|
+
selector: selectorToScope,
|
|
7839
|
+
scopeSelector,
|
|
7840
|
+
hostSelector,
|
|
7841
|
+
});
|
|
7842
|
+
// Put the result back into the pseudo selector function.
|
|
7843
|
+
scopedPart = `${cssPseudoSelectorFunction}${scopedInnerPart})`;
|
|
7844
|
+
}
|
|
7845
|
+
else {
|
|
7846
|
+
this._shouldScopeIndicator =
|
|
7847
|
+
this._shouldScopeIndicator || selectorPart.includes(_polyfillHostNoCombinator);
|
|
7848
|
+
scopedPart = this._shouldScopeIndicator ? _scopeSelectorPart(selectorPart) : selectorPart;
|
|
7849
|
+
}
|
|
7850
|
+
return scopedPart;
|
|
7851
|
+
};
|
|
7852
|
+
if (isParentSelector) {
|
|
7853
|
+
this._safeSelector = new SafeSelector(selector);
|
|
7854
|
+
selector = this._safeSelector.content();
|
|
7855
|
+
}
|
|
7796
7856
|
let scopedSelector = '';
|
|
7797
7857
|
let startIndex = 0;
|
|
7798
7858
|
let res;
|
|
7799
|
-
|
|
7859
|
+
// Combinators aren't used as a delimiter if they are within parenthesis,
|
|
7860
|
+
// for example `:where(.one .two)` stays intact.
|
|
7861
|
+
// Similarly to selector separation by comma initially, negative lookahead
|
|
7862
|
+
// is used here to not break selectors within nested parenthesis up to three
|
|
7863
|
+
// nested layers.
|
|
7864
|
+
const sep = /( |>|\+|~(?!=))(?!([^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\)))\s*/g;
|
|
7800
7865
|
// If a selector appears before :host it should not be shimmed as it
|
|
7801
7866
|
// matches on ancestor elements and not on elements in the host's shadow
|
|
7802
7867
|
// `:host-context(div)` is transformed to
|
|
@@ -7809,8 +7874,13 @@ class ShadowCss {
|
|
|
7809
7874
|
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
|
|
7810
7875
|
// `:host-context(tag)`)
|
|
7811
7876
|
const hasHost = selector.includes(_polyfillHostNoCombinator);
|
|
7812
|
-
// Only scope parts after the first `-shadowcsshost-no-combinator`
|
|
7813
|
-
|
|
7877
|
+
// Only scope parts after or on the same level as the first `-shadowcsshost-no-combinator`
|
|
7878
|
+
// when it is present. The selector has the same level when it is a part of a pseudo
|
|
7879
|
+
// selector, like `:where()`, for example `:where(:host, .foo)` would result in `.foo`
|
|
7880
|
+
// being scoped.
|
|
7881
|
+
if (isParentSelector || this._shouldScopeIndicator) {
|
|
7882
|
+
this._shouldScopeIndicator = !hasHost;
|
|
7883
|
+
}
|
|
7814
7884
|
while ((res = sep.exec(selector)) !== null) {
|
|
7815
7885
|
const separator = res[1];
|
|
7816
7886
|
// Do not trim the selector, as otherwise this will break sourcemaps
|
|
@@ -7826,16 +7896,15 @@ class ShadowCss {
|
|
|
7826
7896
|
if (part.match(/__esc-ph-(\d+)__/) && selector[res.index + 1]?.match(/[a-fA-F\d]/)) {
|
|
7827
7897
|
continue;
|
|
7828
7898
|
}
|
|
7829
|
-
|
|
7830
|
-
const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
|
|
7899
|
+
const scopedPart = _pseudoFunctionAwareScopeSelectorPart(part);
|
|
7831
7900
|
scopedSelector += `${scopedPart} ${separator} `;
|
|
7832
7901
|
startIndex = sep.lastIndex;
|
|
7833
7902
|
}
|
|
7834
7903
|
const part = selector.substring(startIndex);
|
|
7835
|
-
|
|
7836
|
-
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
7904
|
+
scopedSelector += _pseudoFunctionAwareScopeSelectorPart(part);
|
|
7837
7905
|
// replace the placeholders with their original values
|
|
7838
|
-
|
|
7906
|
+
// using values stored inside the `safeSelector` instance.
|
|
7907
|
+
return this._safeSelector.restore(scopedSelector);
|
|
7839
7908
|
}
|
|
7840
7909
|
_insertPolyfillHostInCssText(selector) {
|
|
7841
7910
|
return selector
|
|
@@ -7890,6 +7959,8 @@ class SafeSelector {
|
|
|
7890
7959
|
});
|
|
7891
7960
|
}
|
|
7892
7961
|
}
|
|
7962
|
+
const _cssScopedPseudoFunctionPrefix = '(:(where|is)\\()?';
|
|
7963
|
+
const _cssPrefixWithPseudoSelectorFunction = /^:(where|is)\(/i;
|
|
7893
7964
|
const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
7894
7965
|
const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
7895
7966
|
const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
@@ -7898,10 +7969,12 @@ const _polyfillHost = '-shadowcsshost';
|
|
|
7898
7969
|
const _polyfillHostContext = '-shadowcsscontext';
|
|
7899
7970
|
const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
|
|
7900
7971
|
const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
|
|
7901
|
-
const _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');
|
|
7972
|
+
const _cssColonHostContextReGlobal = new RegExp(_cssScopedPseudoFunctionPrefix + '(' + _polyfillHostContext + _parenSuffix + ')', 'gim');
|
|
7902
7973
|
const _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
|
|
7903
7974
|
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
7975
|
+
const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp(`:.*\\(.*${_polyfillHostNoCombinator}.*\\)`);
|
|
7904
7976
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
7977
|
+
const _polyfillHostNoCombinatorReGlobal = new RegExp(_polyfillHostNoCombinatorRe, 'g');
|
|
7905
7978
|
const _shadowDOMSelectorsRe = [
|
|
7906
7979
|
/::shadow/g,
|
|
7907
7980
|
/::content/g,
|
|
@@ -8135,7 +8208,7 @@ function unescapeQuotes(str, isQuoted) {
|
|
|
8135
8208
|
* @param contextSelectors an array of context selectors that will be combined.
|
|
8136
8209
|
* @param otherSelectors the rest of the selectors that are not context selectors.
|
|
8137
8210
|
*/
|
|
8138
|
-
function
|
|
8211
|
+
function _combineHostContextSelectors(contextSelectors, otherSelectors, pseudoPrefix = '') {
|
|
8139
8212
|
const hostMarker = _polyfillHostNoCombinator;
|
|
8140
8213
|
_polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test
|
|
8141
8214
|
const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
|
|
@@ -8161,8 +8234,8 @@ function combineHostContextSelectors(contextSelectors, otherSelectors) {
|
|
|
8161
8234
|
// (A<hostMarker>) or as an ancestor (A <hostMarker>).
|
|
8162
8235
|
return combined
|
|
8163
8236
|
.map((s) => otherSelectorsHasHost
|
|
8164
|
-
? `${s}${otherSelectors}`
|
|
8165
|
-
: `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`)
|
|
8237
|
+
? `${pseudoPrefix}${s}${otherSelectors}`
|
|
8238
|
+
: `${pseudoPrefix}${s}${hostMarker}${otherSelectors}, ${pseudoPrefix}${s} ${hostMarker}${otherSelectors}`)
|
|
8166
8239
|
.join(',');
|
|
8167
8240
|
}
|
|
8168
8241
|
/**
|
|
@@ -25105,29 +25178,9 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
25105
25178
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
25106
25179
|
}
|
|
25107
25180
|
else if (ast instanceof PropertyRead) {
|
|
25108
|
-
const isThisReceiver = ast.receiver instanceof ThisReceiver;
|
|
25109
25181
|
// Whether this is an implicit receiver, *excluding* explicit reads of `this`.
|
|
25110
25182
|
const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
|
|
25111
|
-
|
|
25112
|
-
// receiver.
|
|
25113
|
-
const isSpecialNode = ast.name === '$any' || ast.name === '$event';
|
|
25114
|
-
// TODO: The most sensible condition here would be simply `isImplicitReceiver`, to convert only
|
|
25115
|
-
// actual implicit `this` reads, and not explicit ones. However, TemplateDefinitionBuilder (and
|
|
25116
|
-
// the Typecheck block!) both have the same bug, in which they also consider explicit `this`
|
|
25117
|
-
// reads to be implicit. This causes problems when the explicit `this` read is inside a
|
|
25118
|
-
// template with a context that also provides the variable name being read:
|
|
25119
|
-
// ```
|
|
25120
|
-
// <ng-template let-a>{{this.a}}</ng-template>
|
|
25121
|
-
// ```
|
|
25122
|
-
// The whole point of the explicit `this` was to access the class property, but TDB and the
|
|
25123
|
-
// current TCB treat the read as implicit, and give you the context property instead!
|
|
25124
|
-
//
|
|
25125
|
-
// For now, we emulate this old behavior by aggressively converting explicit reads to to
|
|
25126
|
-
// implicit reads, except for the special cases that TDB and the current TCB protect. However,
|
|
25127
|
-
// it would be an improvement to fix this.
|
|
25128
|
-
//
|
|
25129
|
-
// See also the corresponding comment for the TCB, in `type_check_block.ts`.
|
|
25130
|
-
if (isImplicitReceiver || (isThisReceiver && !isSpecialNode)) {
|
|
25183
|
+
if (isImplicitReceiver) {
|
|
25131
25184
|
return new LexicalReadExpr(ast.name);
|
|
25132
25185
|
}
|
|
25133
25186
|
else {
|
|
@@ -27988,6 +28041,10 @@ function addFeatures(definitionMap, meta) {
|
|
|
27988
28041
|
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
27989
28042
|
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
27990
28043
|
}
|
|
28044
|
+
if ('externalStyles' in meta && meta.externalStyles?.length) {
|
|
28045
|
+
const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
|
|
28046
|
+
features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
|
|
28047
|
+
}
|
|
27991
28048
|
if (features.length) {
|
|
27992
28049
|
definitionMap.set('features', literalArr(features));
|
|
27993
28050
|
}
|
|
@@ -28063,6 +28120,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
28063
28120
|
if (meta.encapsulation === null) {
|
|
28064
28121
|
meta.encapsulation = ViewEncapsulation.Emulated;
|
|
28065
28122
|
}
|
|
28123
|
+
let hasStyles = !!meta.externalStyles?.length;
|
|
28066
28124
|
// e.g. `styles: [str1, str2]`
|
|
28067
28125
|
if (meta.styles && meta.styles.length) {
|
|
28068
28126
|
const styleValues = meta.encapsulation == ViewEncapsulation.Emulated
|
|
@@ -28075,10 +28133,11 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
28075
28133
|
return result;
|
|
28076
28134
|
}, []);
|
|
28077
28135
|
if (styleNodes.length > 0) {
|
|
28136
|
+
hasStyles = true;
|
|
28078
28137
|
definitionMap.set('styles', literalArr(styleNodes));
|
|
28079
28138
|
}
|
|
28080
28139
|
}
|
|
28081
|
-
|
|
28140
|
+
if (!hasStyles && meta.encapsulation === ViewEncapsulation.Emulated) {
|
|
28082
28141
|
// If there is no style, don't generate css selectors on elements
|
|
28083
28142
|
meta.encapsulation = ViewEncapsulation.None;
|
|
28084
28143
|
}
|
|
@@ -29120,18 +29179,12 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
29120
29179
|
maybeMap(ast, name) {
|
|
29121
29180
|
// If the receiver of the expression isn't the `ImplicitReceiver`, this isn't the root of an
|
|
29122
29181
|
// `AST` expression that maps to a `Variable` or `Reference`.
|
|
29123
|
-
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
29182
|
+
if (!(ast.receiver instanceof ImplicitReceiver) || ast.receiver instanceof ThisReceiver) {
|
|
29124
29183
|
return;
|
|
29125
29184
|
}
|
|
29126
29185
|
// Check whether the name exists in the current scope. If so, map it. Otherwise, the name is
|
|
29127
29186
|
// probably a property on the top-level component context.
|
|
29128
29187
|
const target = this.scope.lookup(name);
|
|
29129
|
-
// It's not allowed to read template entities via `this`, however it previously worked by
|
|
29130
|
-
// accident (see #55115). Since `@let` declarations are new, we can fix it from the beginning,
|
|
29131
|
-
// whereas pre-existing template entities will be fixed in #55115.
|
|
29132
|
-
if (target instanceof LetDeclaration$1 && ast.receiver instanceof ThisReceiver) {
|
|
29133
|
-
return;
|
|
29134
|
-
}
|
|
29135
29188
|
if (target !== null) {
|
|
29136
29189
|
this.bindings.set(ast, target);
|
|
29137
29190
|
}
|
|
@@ -29988,7 +30041,7 @@ function publishFacade(global) {
|
|
|
29988
30041
|
* @description
|
|
29989
30042
|
* Entry point for all public APIs of the compiler package.
|
|
29990
30043
|
*/
|
|
29991
|
-
const VERSION = new Version('19.0.0-next.
|
|
30044
|
+
const VERSION = new Version('19.0.0-next.9');
|
|
29992
30045
|
|
|
29993
30046
|
class CompilerConfig {
|
|
29994
30047
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters, } = {}) {
|
|
@@ -31639,7 +31692,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
31639
31692
|
function compileDeclareClassMetadata(metadata) {
|
|
31640
31693
|
const definitionMap = new DefinitionMap();
|
|
31641
31694
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
31642
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
31695
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
31643
31696
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31644
31697
|
definitionMap.set('type', metadata.type);
|
|
31645
31698
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -31657,7 +31710,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
31657
31710
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
31658
31711
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
31659
31712
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
31660
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
31713
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
31661
31714
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31662
31715
|
definitionMap.set('type', metadata.type);
|
|
31663
31716
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -31752,7 +31805,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
31752
31805
|
const definitionMap = new DefinitionMap();
|
|
31753
31806
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
31754
31807
|
definitionMap.set('minVersion', literal(minVersion));
|
|
31755
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
31808
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
31756
31809
|
// e.g. `type: MyDirective`
|
|
31757
31810
|
definitionMap.set('type', meta.type.value);
|
|
31758
31811
|
if (meta.isStandalone) {
|
|
@@ -32174,7 +32227,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
32174
32227
|
function compileDeclareFactoryFunction(meta) {
|
|
32175
32228
|
const definitionMap = new DefinitionMap();
|
|
32176
32229
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
32177
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
32230
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
32178
32231
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32179
32232
|
definitionMap.set('type', meta.type.value);
|
|
32180
32233
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -32209,7 +32262,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
32209
32262
|
function createInjectableDefinitionMap(meta) {
|
|
32210
32263
|
const definitionMap = new DefinitionMap();
|
|
32211
32264
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
32212
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
32265
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
32213
32266
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32214
32267
|
definitionMap.set('type', meta.type.value);
|
|
32215
32268
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -32260,7 +32313,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
32260
32313
|
function createInjectorDefinitionMap(meta) {
|
|
32261
32314
|
const definitionMap = new DefinitionMap();
|
|
32262
32315
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
32263
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
32316
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
32264
32317
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32265
32318
|
definitionMap.set('type', meta.type.value);
|
|
32266
32319
|
definitionMap.set('providers', meta.providers);
|
|
@@ -32293,7 +32346,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
32293
32346
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
32294
32347
|
}
|
|
32295
32348
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
32296
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
32349
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
32297
32350
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32298
32351
|
definitionMap.set('type', meta.type.value);
|
|
32299
32352
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -32344,7 +32397,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
32344
32397
|
function createPipeDefinitionMap(meta) {
|
|
32345
32398
|
const definitionMap = new DefinitionMap();
|
|
32346
32399
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
32347
|
-
definitionMap.set('version', literal('19.0.0-next.
|
|
32400
|
+
definitionMap.set('version', literal('19.0.0-next.9'));
|
|
32348
32401
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32349
32402
|
// e.g. `type: MyPipe`
|
|
32350
32403
|
definitionMap.set('type', meta.type.value);
|