@stencil/core 5.0.0-rc.14 → 5.0.0-rc.16
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/dist/app-data/index.d.ts +1 -1
- package/dist/app-data/index.js +0 -1
- package/dist/{client-Cpehp9QL.mjs → client-nVB5tHhh.mjs} +60 -14
- package/dist/compiler/browser.d.ts +0 -2
- package/dist/compiler/browser.js +136 -37
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-C451Mp7c.mjs → compiler-D6kG51sR.mjs} +324 -93
- package/dist/declarations/stencil-public-compiler.d.ts +0 -2
- package/dist/{index-BDAZsQzV.d.mts → index-BOBfOxcK.d.mts} +0 -2
- package/dist/{index-BS1JKKvz.d.mts → index-CamUaPx1.d.mts} +1 -1
- package/dist/{index-CWPcrnEJ.d.ts → index-DaYfl65k.d.ts} +0 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-C6N23fLr.mjs → node-IRt_dGbC.mjs} +1 -1
- package/dist/runtime/client/lazy.js +104 -40
- package/dist/runtime/client/runtime.js +104 -40
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +104 -40
- package/dist/runtime/server/index.mjs +104 -40
- package/dist/runtime/server/runner.mjs +84 -66
- package/dist/signals/index.js +0 -1
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +0 -2
- package/dist/testing/index.mjs +105 -44
- package/package.json +4 -8
package/dist/app-data/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Env, r as NAMESPACE, t as BUILD } from "../index-
|
|
1
|
+
import { n as Env, r as NAMESPACE, t as BUILD } from "../index-DaYfl65k.js";
|
|
2
2
|
export { BUILD, Env, NAMESPACE };
|
package/dist/app-data/index.js
CHANGED
|
@@ -25,7 +25,6 @@ import * as SignalsCore from "@preact/signals-core";
|
|
|
25
25
|
*/
|
|
26
26
|
const BUILD = {
|
|
27
27
|
allRenderFn: false,
|
|
28
|
-
element: true,
|
|
29
28
|
event: true,
|
|
30
29
|
hasRenderFn: true,
|
|
31
30
|
hostListener: true,
|
|
@@ -366,19 +365,28 @@ const getSlottedChildNodes = (childNodes) => {
|
|
|
366
365
|
* @returns a reference to the slot node that matches the provided name, `null` otherwise
|
|
367
366
|
*/
|
|
368
367
|
function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
368
|
+
const slotNodes = [];
|
|
369
|
+
collectHostSlotNodes(childNodes, hostName, slotName, slotNodes);
|
|
370
|
+
return slotNodes;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Pre-order walk for {@link getHostSlotNodes}, appending to `out`.
|
|
374
|
+
* @param childNodes the nodes to search
|
|
375
|
+
* @param hostName the host name of the slot to match on
|
|
376
|
+
* @param slotName the name of the slot to match on; stops at the first match when given
|
|
377
|
+
* @param out the matching slot nodes, in document order
|
|
378
|
+
* @returns true once a named slot has been found
|
|
379
|
+
*/
|
|
380
|
+
function collectHostSlotNodes(childNodes, hostName, slotName, out) {
|
|
381
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
382
|
+
const childNode = childNodes[i];
|
|
374
383
|
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
375
|
-
|
|
376
|
-
if (
|
|
384
|
+
out.push(childNode);
|
|
385
|
+
if (slotName !== void 0) return true;
|
|
377
386
|
}
|
|
378
|
-
|
|
379
|
-
if (typeof slotName !== "undefined" && slottedNodes.length) return slottedNodes;
|
|
387
|
+
if (collectHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName, out) && slotName !== void 0) return true;
|
|
380
388
|
}
|
|
381
|
-
return
|
|
389
|
+
return false;
|
|
382
390
|
}
|
|
383
391
|
/**
|
|
384
392
|
* Get all 'child' sibling nodes of a slot node
|
|
@@ -462,11 +470,40 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
|
462
470
|
slotName: ""
|
|
463
471
|
};
|
|
464
472
|
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
473
|
+
let hostSlots = slotNodeCache.get(parentHost);
|
|
474
|
+
const cached = hostSlots?.get(slotName);
|
|
475
|
+
if (cached && isHostSlot(cached, parentHost, slotName)) return {
|
|
476
|
+
slotNode: cached,
|
|
477
|
+
slotName
|
|
478
|
+
};
|
|
479
|
+
const slotNode = getHostSlotNodes(internalCall(parentHost, "childNodes"), parentHost.tagName, slotName)[0];
|
|
480
|
+
if (slotNode) {
|
|
481
|
+
if (!hostSlots) slotNodeCache.set(parentHost, hostSlots = /* @__PURE__ */ new Map());
|
|
482
|
+
hostSlots.set(slotName, slotNode);
|
|
483
|
+
}
|
|
465
484
|
return {
|
|
466
|
-
slotNode
|
|
485
|
+
slotNode,
|
|
467
486
|
slotName
|
|
468
487
|
};
|
|
469
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* The slot node last found per host and slot name. Each slotted child of a host looks up its
|
|
491
|
+
* slot, and a full search walks the host's whole internal tree, so a host with many slotted
|
|
492
|
+
* children would otherwise cost O(children × tree).
|
|
493
|
+
*/
|
|
494
|
+
const slotNodeCache = /* @__PURE__ */ new WeakMap();
|
|
495
|
+
/**
|
|
496
|
+
* Whether a cached slot node is still the host's slot of that name.
|
|
497
|
+
* @param slotNode the cached slot node
|
|
498
|
+
* @param host the host element
|
|
499
|
+
* @param slotName the slot name
|
|
500
|
+
* @returns true if `slotNode` is still a slot of `host` named `slotName`, inside its internal tree
|
|
501
|
+
*/
|
|
502
|
+
const isHostSlot = (slotNode, host, slotName) => {
|
|
503
|
+
if (!slotNode["s-sr"] || slotNode["s-hn"] !== host.tagName || getSlotName(slotNode) !== slotName) return false;
|
|
504
|
+
for (let n = internalCall(slotNode, "parentNode"); n; n = internalCall(n, "parentNode")) if (n === host) return true;
|
|
505
|
+
return false;
|
|
506
|
+
};
|
|
470
507
|
//#endregion
|
|
471
508
|
//#region src/runtime/dom-extras.ts
|
|
472
509
|
/**
|
|
@@ -1630,8 +1667,7 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
1630
1667
|
if (parent?.["s-cr"]) checkSlotRelocate = true;
|
|
1631
1668
|
if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
1632
1669
|
else if (typeof newNode["s-sn"] === "string") {
|
|
1633
|
-
|
|
1634
|
-
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
1670
|
+
if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && hostPatchesAll(newNode, parent)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
1635
1671
|
parent.insertBefore(newNode, reference);
|
|
1636
1672
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
1637
1673
|
if (slotNode) {
|
|
@@ -1645,6 +1681,16 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
1645
1681
|
else return parent?.insertBefore(newNode, reference);
|
|
1646
1682
|
};
|
|
1647
1683
|
/**
|
|
1684
|
+
* Whether the host a slotted node belongs to opted into `patchAll`.
|
|
1685
|
+
* @param newNode the slotted node
|
|
1686
|
+
* @param parent the node it is being inserted into
|
|
1687
|
+
* @returns true if the host component has the `patchAll` flag
|
|
1688
|
+
*/
|
|
1689
|
+
const hostPatchesAll = (newNode, parent) => {
|
|
1690
|
+
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
1691
|
+
return !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll);
|
|
1692
|
+
};
|
|
1693
|
+
/**
|
|
1648
1694
|
* Adds or removes a scoped class to the parent element of a slotted node.
|
|
1649
1695
|
* This is used for styling slotted content (e.g. with `::scoped(...) {...}` selectors )
|
|
1650
1696
|
* in `scoped: true` components.
|
|
@@ -1017,7 +1017,6 @@ interface BuildFeatures {
|
|
|
1017
1017
|
patchInsert: boolean;
|
|
1018
1018
|
slot: boolean;
|
|
1019
1019
|
svg: boolean;
|
|
1020
|
-
element: boolean;
|
|
1021
1020
|
event: boolean;
|
|
1022
1021
|
hostListener: boolean;
|
|
1023
1022
|
hostListenerTargetWindow: boolean;
|
|
@@ -1097,7 +1096,6 @@ interface ComponentCompilerFeatures {
|
|
|
1097
1096
|
hasConnectedCallbackFn: boolean;
|
|
1098
1097
|
hasDeserializer: boolean;
|
|
1099
1098
|
hasDisconnectedCallbackFn: boolean;
|
|
1100
|
-
hasElement: boolean;
|
|
1101
1099
|
hasEvent: boolean;
|
|
1102
1100
|
hasLifecycle: boolean;
|
|
1103
1101
|
hasListener: boolean;
|
package/dist/compiler/browser.js
CHANGED
|
@@ -1105,7 +1105,6 @@ const escapeRegExpSpecialCharacters = (text) => {
|
|
|
1105
1105
|
*/
|
|
1106
1106
|
const BUILD = {
|
|
1107
1107
|
allRenderFn: false,
|
|
1108
|
-
element: true,
|
|
1109
1108
|
event: true,
|
|
1110
1109
|
hasRenderFn: true,
|
|
1111
1110
|
hostListener: true,
|
|
@@ -1377,7 +1376,7 @@ const insertPolyfillHostInCssText = (cssText) => {
|
|
|
1377
1376
|
const _colonHostContextRe = createSupportsRuleRe(":host-context");
|
|
1378
1377
|
cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
|
|
1379
1378
|
supportsBlocks.forEach((originalSelector, index) => {
|
|
1380
|
-
cssText = cssText.replace(`__supports_${index}__`, originalSelector);
|
|
1379
|
+
cssText = cssText.replace(`__supports_${index}__`, () => originalSelector);
|
|
1381
1380
|
});
|
|
1382
1381
|
return cssText;
|
|
1383
1382
|
};
|
|
@@ -1610,11 +1609,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
1610
1609
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
1611
1610
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
1612
1611
|
if (commentOriginalSelector) orgSelectors.forEach(({ placeholder, comment }) => {
|
|
1613
|
-
cssText = cssText.replace(placeholder, comment);
|
|
1612
|
+
cssText = cssText.replace(placeholder, () => comment);
|
|
1614
1613
|
});
|
|
1615
1614
|
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
1616
1615
|
const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector) + "(?=\\s*[,{]|$)", "g");
|
|
1617
|
-
cssText = cssText.replace(regex, slottedSelector.updatedSelector);
|
|
1616
|
+
cssText = cssText.replace(regex, () => slottedSelector.updatedSelector);
|
|
1618
1617
|
});
|
|
1619
1618
|
cssText = expandPartSelectors(cssText);
|
|
1620
1619
|
return cssText;
|
|
@@ -1845,7 +1844,7 @@ const validateComponentTag = (tag) => {
|
|
|
1845
1844
|
};
|
|
1846
1845
|
//#endregion
|
|
1847
1846
|
//#region src/version.ts
|
|
1848
|
-
const version = "5.0.0-rc.
|
|
1847
|
+
const version = "5.0.0-rc.16";
|
|
1849
1848
|
//#endregion
|
|
1850
1849
|
//#region src/compiler/events.ts
|
|
1851
1850
|
const buildEvents = () => {
|
|
@@ -3702,6 +3701,7 @@ const validatePaths = (config) => {
|
|
|
3702
3701
|
};
|
|
3703
3702
|
if (typeof config.globalScript === "string" && !isAbsolute(config.globalScript)) validatedPaths.globalScript = join$1(rootDir, config.globalScript);
|
|
3704
3703
|
if (typeof config.globalStyle === "string" && !isAbsolute(config.globalStyle)) validatedPaths.globalStyle = join$1(rootDir, config.globalStyle);
|
|
3704
|
+
if (Array.isArray(config.watchExternalDirs)) validatedPaths.watchExternalDirs = config.watchExternalDirs.map((dir) => isAbsolute(dir) ? normalizePath(dir) : join$1(rootDir, dir));
|
|
3705
3705
|
if (config.writeLog) {
|
|
3706
3706
|
validatedPaths.buildLogFilePath = typeof config.buildLogFilePath === "string" ? config.buildLogFilePath : DEFAULT_BUILD_LOG_FILE_NAME;
|
|
3707
3707
|
if (!isAbsolute(validatedPaths.buildLogFilePath)) validatedPaths.buildLogFilePath = join$1(rootDir, config.buildLogFilePath);
|
|
@@ -8844,7 +8844,8 @@ const arrayToArrayLiteral = (list, refs) => {
|
|
|
8844
8844
|
/**
|
|
8845
8845
|
* Convert a JavaScript object (i.e. an object existing at runtime) to the
|
|
8846
8846
|
* corresponding TypeScript Intermediate Representation (IR) for an object literal.
|
|
8847
|
-
*
|
|
8847
|
+
* The compiler-internal `_astNode` field is excluded from serialization. Other `_`-prefixed keys
|
|
8848
|
+
* are kept: they can be user member names (e.g. `@State() _filters`).
|
|
8848
8849
|
*
|
|
8849
8850
|
* @param obj the JavaScript object to convert to TypeScript IR
|
|
8850
8851
|
* @param refs a set of references to objects, used to avoid circular references
|
|
@@ -8853,7 +8854,7 @@ const arrayToArrayLiteral = (list, refs) => {
|
|
|
8853
8854
|
const objectToObjectLiteral = (obj, refs) => {
|
|
8854
8855
|
if (refs.has(obj)) return ts$1.factory.createIdentifier("undefined");
|
|
8855
8856
|
refs.add(obj);
|
|
8856
|
-
const newProperties = Object.keys(obj).filter((key) =>
|
|
8857
|
+
const newProperties = Object.keys(obj).filter((key) => key !== "_astNode").map((key) => {
|
|
8857
8858
|
return ts$1.factory.createPropertyAssignment(ts$1.factory.createStringLiteral(key), convertValueToLiteral(obj[key], refs));
|
|
8858
8859
|
});
|
|
8859
8860
|
return ts$1.factory.createObjectLiteralExpression(newProperties, true);
|
|
@@ -11164,8 +11165,8 @@ const defineCustomElement = (tsSourceFile, moduleFile, transformOpts) => {
|
|
|
11164
11165
|
return ts$1.factory.updateSourceFile(tsSourceFile, statements);
|
|
11165
11166
|
};
|
|
11166
11167
|
const addDefineCustomElement = (moduleFile, compilerMeta) => {
|
|
11167
|
-
if (compilerMeta.isPlain) return ts$1.factory.createExpressionStatement(ts$1.factory.createCallExpression(ts$1.factory.createPropertyAccessExpression(ts$1.factory.createIdentifier("customElements"), ts$1.factory.createIdentifier("define")), [], [ts$1.factory.createCallExpression(ts$1.factory.createIdentifier(TRANSFORM_TAG), [], [ts$1.factory.createStringLiteral(compilerMeta.tagName)]), ts$1.factory.createIdentifier(compilerMeta.componentClassName)]));
|
|
11168
11168
|
addCoreRuntimeApi(moduleFile, RUNTIME_APIS.transformTag);
|
|
11169
|
+
if (compilerMeta.isPlain) return ts$1.factory.createExpressionStatement(ts$1.factory.createCallExpression(ts$1.factory.createPropertyAccessExpression(ts$1.factory.createIdentifier("customElements"), ts$1.factory.createIdentifier("define")), [], [ts$1.factory.createCallExpression(ts$1.factory.createIdentifier(TRANSFORM_TAG), [], [ts$1.factory.createStringLiteral(compilerMeta.tagName)]), ts$1.factory.createIdentifier(compilerMeta.componentClassName)]));
|
|
11169
11170
|
addCoreRuntimeApi(moduleFile, RUNTIME_APIS.defineCustomElement);
|
|
11170
11171
|
const compactMeta = formatComponentRuntimeMeta(compilerMeta, true);
|
|
11171
11172
|
const liternalCmpClassName = ts$1.factory.createIdentifier(compilerMeta.componentClassName);
|
|
@@ -12149,6 +12150,14 @@ const MEMBER_DECORATORS_TO_REMOVE = [
|
|
|
12149
12150
|
];
|
|
12150
12151
|
//#endregion
|
|
12151
12152
|
//#region src/compiler/transformers/decorators-to-static/element-decorator.ts
|
|
12153
|
+
/**
|
|
12154
|
+
* Adds a static `elementRef` getter for an `@Element()` field.
|
|
12155
|
+
* @param diagnostics for surfacing errors
|
|
12156
|
+
* @param decoratedMembers the class's decorated members
|
|
12157
|
+
* @param newMembers out param: the class's members, receiving the static getter
|
|
12158
|
+
* @param decoratorName the local name `Element` is imported as
|
|
12159
|
+
* @returns the names of the `@Element()` fields
|
|
12160
|
+
*/
|
|
12152
12161
|
const elementDecoratorsToStatic = (diagnostics, decoratedMembers, newMembers, decoratorName) => {
|
|
12153
12162
|
const elementRefs = decoratedMembers.filter(ts$1.isPropertyDeclaration).map((prop) => parseElementDecorator(prop, decoratorName)).filter((element) => !!element);
|
|
12154
12163
|
if (elementRefs.length > 0) {
|
|
@@ -12158,6 +12167,7 @@ const elementDecoratorsToStatic = (diagnostics, decoratedMembers, newMembers, de
|
|
|
12158
12167
|
error.messageText = `It's not valid to add more than one Element() decorator`;
|
|
12159
12168
|
}
|
|
12160
12169
|
}
|
|
12170
|
+
return elementRefs;
|
|
12161
12171
|
};
|
|
12162
12172
|
const parseElementDecorator = (prop, decoratorName) => {
|
|
12163
12173
|
if (retrieveTsDecorators(prop)?.find(isDecoratorNamed(decoratorName)) == null) return null;
|
|
@@ -12661,9 +12671,15 @@ const listenDecoratorsToStatic = (diagnostics, typeChecker, decoratedMembers, ne
|
|
|
12661
12671
|
const parseListenDecorators = (diagnostics, typeChecker, method, decoratorName) => {
|
|
12662
12672
|
const listenDecorators = (retrieveTsDecorators(method) ?? []).filter(isDecoratorNamed(decoratorName));
|
|
12663
12673
|
if (listenDecorators.length === 0) return [];
|
|
12664
|
-
return listenDecorators.
|
|
12674
|
+
return listenDecorators.flatMap((listenDecorator) => {
|
|
12665
12675
|
const methodName = method.name.getText();
|
|
12666
12676
|
const [listenText, listenOptions] = getDecoratorParameters(listenDecorator, typeChecker, diagnostics);
|
|
12677
|
+
if (typeof listenText !== "string") {
|
|
12678
|
+
const err = buildError(diagnostics);
|
|
12679
|
+
err.messageText = `@Listen() expects an event name as a string, received ${JSON.stringify(listenText)}.`;
|
|
12680
|
+
augmentDiagnosticWithNode(err, listenDecorator);
|
|
12681
|
+
return [];
|
|
12682
|
+
}
|
|
12667
12683
|
const eventNames = listenText.split(",");
|
|
12668
12684
|
if (eventNames.length > 1) {
|
|
12669
12685
|
const err = buildError(diagnostics);
|
|
@@ -13496,16 +13512,66 @@ const stateDecoratorToStatic = (prop, typeChecker, decoratorName) => {
|
|
|
13496
13512
|
return ts$1.factory.createPropertyAssignment(ts$1.factory.createStringLiteral(stateName), convertValueToLiteral(meta));
|
|
13497
13513
|
};
|
|
13498
13514
|
//#endregion
|
|
13515
|
+
//#region src/compiler/transformers/decorators-to-static/validate-computed-names.ts
|
|
13516
|
+
/** Decorators whose member may have a computed name that resolves to a literal at compile time. */
|
|
13517
|
+
const RESOLVED_COMPUTED_NAME = [
|
|
13518
|
+
"Prop",
|
|
13519
|
+
"State",
|
|
13520
|
+
"AttachInternals"
|
|
13521
|
+
];
|
|
13522
|
+
/** Decorators whose member must have a plain name. */
|
|
13523
|
+
const NO_COMPUTED_NAME = [
|
|
13524
|
+
"Element",
|
|
13525
|
+
"Event",
|
|
13526
|
+
"Listen",
|
|
13527
|
+
"Method",
|
|
13528
|
+
"Watch"
|
|
13529
|
+
];
|
|
13530
|
+
/**
|
|
13531
|
+
* Reports Stencil-decorated members whose computed name Stencil can't use.
|
|
13532
|
+
* @param diagnostics for surfacing errors
|
|
13533
|
+
* @param typeChecker used to resolve a computed name to a literal
|
|
13534
|
+
* @param decoratedMembers the class's decorated members
|
|
13535
|
+
* @param importAliasMap local names of the Stencil decorators
|
|
13536
|
+
*/
|
|
13537
|
+
const validateComputedMemberNames = (diagnostics, typeChecker, decoratedMembers, importAliasMap) => {
|
|
13538
|
+
for (const member of decoratedMembers) {
|
|
13539
|
+
const name = member.name;
|
|
13540
|
+
if (!name || !ts$1.isComputedPropertyName(name)) continue;
|
|
13541
|
+
const decorators = retrieveTsDecorators(member) ?? [];
|
|
13542
|
+
const uses = (list) => list.find((dec) => decorators.some(isDecoratorNamed(importAliasMap.get(dec))));
|
|
13543
|
+
const unsupported = uses(NO_COMPUTED_NAME);
|
|
13544
|
+
if (unsupported) {
|
|
13545
|
+
const err = buildError(diagnostics);
|
|
13546
|
+
err.messageText = `@${unsupported}() does not support a computed member name (\`${name.getText()}\`). Use a plain name.`;
|
|
13547
|
+
augmentDiagnosticWithNode(err, name);
|
|
13548
|
+
continue;
|
|
13549
|
+
}
|
|
13550
|
+
const resolved = uses(RESOLVED_COMPUTED_NAME);
|
|
13551
|
+
if (resolved && !typeChecker.getTypeAtLocation(name.expression)?.isLiteral()) {
|
|
13552
|
+
const err = buildError(diagnostics);
|
|
13553
|
+
err.messageText = `The computed name \`${name.getText()}\` of this @${resolved}() can't be resolved at compile time. Use a \`const\` string or enum member.`;
|
|
13554
|
+
augmentDiagnosticWithNode(err, name);
|
|
13555
|
+
}
|
|
13556
|
+
}
|
|
13557
|
+
};
|
|
13558
|
+
//#endregion
|
|
13499
13559
|
//#region src/compiler/transformers/decorators-to-static/watch-decorator.ts
|
|
13500
|
-
const watchDecoratorsToStatic = (typeChecker, decoratedProps, newMembers, decoratorName) => {
|
|
13501
|
-
const watchers = decoratedProps.filter(ts$1.isMethodDeclaration).map((method) => parseWatchDecorator(typeChecker, method, decoratorName));
|
|
13560
|
+
const watchDecoratorsToStatic = (diagnostics, typeChecker, decoratedProps, newMembers, decoratorName) => {
|
|
13561
|
+
const watchers = decoratedProps.filter(ts$1.isMethodDeclaration).map((method) => parseWatchDecorator(diagnostics, typeChecker, method, decoratorName));
|
|
13502
13562
|
const flatWatchers = flatOne(watchers);
|
|
13503
13563
|
if (flatWatchers.length > 0) newMembers.push(createStaticGetter("watchers", convertValueToLiteral(flatWatchers)));
|
|
13504
13564
|
};
|
|
13505
|
-
const parseWatchDecorator = (typeChecker, method, decoratorName) => {
|
|
13565
|
+
const parseWatchDecorator = (diagnostics, typeChecker, method, decoratorName) => {
|
|
13506
13566
|
const methodName = method.name.getText();
|
|
13507
|
-
return (retrieveTsDecorators(method) ?? []).filter(isDecoratorNamed(decoratorName)).
|
|
13567
|
+
return (retrieveTsDecorators(method) ?? []).filter(isDecoratorNamed(decoratorName)).flatMap((decorator) => {
|
|
13508
13568
|
const [propName, handlerOptions] = getDecoratorParameters(decorator, typeChecker);
|
|
13569
|
+
if (typeof propName !== "string") {
|
|
13570
|
+
const err = buildError(diagnostics);
|
|
13571
|
+
err.messageText = `@Watch() expects the name of a member as a string, received ${JSON.stringify(propName)}.`;
|
|
13572
|
+
augmentDiagnosticWithNode(err, decorator);
|
|
13573
|
+
return [];
|
|
13574
|
+
}
|
|
13509
13575
|
if (handlerOptions) return {
|
|
13510
13576
|
propName,
|
|
13511
13577
|
methodName,
|
|
@@ -13544,7 +13610,17 @@ const convertDecoratorsToStatic = (config, diagnostics, typeChecker, program, in
|
|
|
13544
13610
|
return (transformCtx) => {
|
|
13545
13611
|
let sourceFile;
|
|
13546
13612
|
const visit = (node) => {
|
|
13547
|
-
if (ts$1.isClassDeclaration(node) || includeClassExpressions && ts$1.isClassExpression(node))
|
|
13613
|
+
if (ts$1.isClassDeclaration(node) || includeClassExpressions && ts$1.isClassExpression(node)) try {
|
|
13614
|
+
return visitClassDeclaration(config, diagnostics, typeChecker, program, node, sourceFile);
|
|
13615
|
+
} catch (e) {
|
|
13616
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
13617
|
+
if (!diagnostics.some((d) => d.messageText === message)) {
|
|
13618
|
+
const err = buildError(diagnostics);
|
|
13619
|
+
err.messageText = message;
|
|
13620
|
+
augmentDiagnosticWithNode(err, node.name ?? node);
|
|
13621
|
+
}
|
|
13622
|
+
return node;
|
|
13623
|
+
}
|
|
13548
13624
|
return ts$1.visitEachChild(node, visit, transformCtx);
|
|
13549
13625
|
};
|
|
13550
13626
|
return (tsSourceFile) => {
|
|
@@ -13588,6 +13664,7 @@ const visitClassDeclaration = (config, diagnostics, typeChecker, program, classN
|
|
|
13588
13664
|
const filteredMethodsAndFields = removeStencilMethodDecorators(Array.from(classMembers), diagnostics, importAliasMap);
|
|
13589
13665
|
if (componentDecorator && ts$1.isClassDeclaration(classNode)) componentDecoratorToStatic(config, typeChecker, diagnostics, classNode, filteredMethodsAndFields, componentDecorator);
|
|
13590
13666
|
if (decoratedMembers.length > 0) {
|
|
13667
|
+
validateComputedMemberNames(diagnostics, typeChecker, decoratedMembers, importAliasMap);
|
|
13591
13668
|
const handWritten = serializeDecoratorsToStatic(typeChecker, decoratedMembers, [], importAliasMap.get("PropSerialize"), "PropSerialize", importAliasMap.get("Prop")).concat(serializeDecoratorsToStatic(typeChecker, decoratedMembers, [], importAliasMap.get("AttrDeserialize"), "AttrDeserialize", importAliasMap.get("Prop")));
|
|
13592
13669
|
const jsonProps = getJsonSerializedProps(diagnostics, typeChecker, decoratedMembers, importAliasMap.get("Prop"), handWritten);
|
|
13593
13670
|
if (jsonProps.length > 0) {
|
|
@@ -13606,8 +13683,9 @@ const visitClassDeclaration = (config, diagnostics, typeChecker, program, classN
|
|
|
13606
13683
|
stateDecoratorsToStatic(decoratedMembers, filteredMethodsAndFields, typeChecker, importAliasMap.get("State"));
|
|
13607
13684
|
eventDecoratorsToStatic(config, diagnostics, decoratedMembers, typeChecker, program, filteredMethodsAndFields, importAliasMap.get("Event"));
|
|
13608
13685
|
methodDecoratorsToStatic(config, diagnostics, classNode, decoratedMembers, typeChecker, program, filteredMethodsAndFields, importAliasMap.get("Method"));
|
|
13609
|
-
elementDecoratorsToStatic(diagnostics, decoratedMembers, filteredMethodsAndFields, importAliasMap.get("Element"));
|
|
13610
|
-
|
|
13686
|
+
const elementRefs = elementDecoratorsToStatic(diagnostics, decoratedMembers, filteredMethodsAndFields, importAliasMap.get("Element"));
|
|
13687
|
+
if (!componentDecorator && elementRefs.length > 0) removeFields(filteredMethodsAndFields, elementRefs);
|
|
13688
|
+
watchDecoratorsToStatic(diagnostics, typeChecker, decoratedMembers, filteredMethodsAndFields, importAliasMap.get("Watch"));
|
|
13611
13689
|
listenDecoratorsToStatic(diagnostics, typeChecker, decoratedMembers, filteredMethodsAndFields, importAliasMap.get("Listen"));
|
|
13612
13690
|
attachInternalsDecoratorsToStatic(diagnostics, decoratedMembers, filteredMethodsAndFields, typeChecker, importAliasMap.get("AttachInternals"));
|
|
13613
13691
|
}
|
|
@@ -13618,6 +13696,17 @@ const visitClassDeclaration = (config, diagnostics, typeChecker, program, classN
|
|
|
13618
13696
|
return ts$1.isClassDeclaration(classNode) ? ts$1.factory.updateClassDeclaration(classNode, updatedModifiers, classNode.name, classNode.typeParameters, classNode.heritageClauses, updatedClassFields) : ts$1.factory.updateClassExpression(classNode, updatedModifiers, classNode.name, classNode.typeParameters, classNode.heritageClauses, updatedClassFields);
|
|
13619
13697
|
};
|
|
13620
13698
|
/**
|
|
13699
|
+
* Removes the property declarations with the given names, in place.
|
|
13700
|
+
* @param members the class members to filter
|
|
13701
|
+
* @param names the property names to remove
|
|
13702
|
+
*/
|
|
13703
|
+
const removeFields = (members, names) => {
|
|
13704
|
+
for (let i = members.length - 1; i >= 0; i--) {
|
|
13705
|
+
const m = members[i];
|
|
13706
|
+
if (ts$1.isPropertyDeclaration(m) && names.includes(m.name.getText())) members.splice(i, 1);
|
|
13707
|
+
}
|
|
13708
|
+
};
|
|
13709
|
+
/**
|
|
13621
13710
|
* Take a list of `ClassElement` AST nodes and remove any decorators from
|
|
13622
13711
|
* method elements which are Stencil-specific decorators. We implement the
|
|
13623
13712
|
* intended behavior for these Stencil-specific decorators (things like
|
|
@@ -13993,7 +14082,7 @@ const setComponentBuildConditionals = (cmpMeta) => {
|
|
|
13993
14082
|
cmpMeta.hasListenerTargetBody = cmpMeta.listeners.some((l) => l.target === "body");
|
|
13994
14083
|
cmpMeta.hasListenerTarget = cmpMeta.listeners.some((l) => !!l.target);
|
|
13995
14084
|
}
|
|
13996
|
-
cmpMeta.hasMember = cmpMeta.hasProp || cmpMeta.hasState || cmpMeta.
|
|
14085
|
+
cmpMeta.hasMember = cmpMeta.hasProp || cmpMeta.hasState || cmpMeta.hasMethod || cmpMeta.formAssociated;
|
|
13997
14086
|
cmpMeta.isUpdateable = cmpMeta.hasProp || cmpMeta.hasState;
|
|
13998
14087
|
if (cmpMeta.styles.length > 0) {
|
|
13999
14088
|
cmpMeta.hasStyle = true;
|
|
@@ -14119,6 +14208,13 @@ const tsResolveModuleNamePackageJsonPath = (config, compilerCtx, moduleName, con
|
|
|
14119
14208
|
return null;
|
|
14120
14209
|
};
|
|
14121
14210
|
//#endregion
|
|
14211
|
+
//#region src/compiler/transformers/static-to-meta/element-ref.ts
|
|
14212
|
+
const parseStaticElementRef = (staticMembers) => {
|
|
14213
|
+
const parsedElementRef = getStaticValue(staticMembers, "elementRef");
|
|
14214
|
+
if (typeof parsedElementRef === "string") return parsedElementRef;
|
|
14215
|
+
return null;
|
|
14216
|
+
};
|
|
14217
|
+
//#endregion
|
|
14122
14218
|
//#region src/compiler/transformers/static-to-meta/events.ts
|
|
14123
14219
|
const parseStaticEvents = (staticMembers) => {
|
|
14124
14220
|
const parsedEvents = getStaticValue(staticMembers, "events");
|
|
@@ -14834,6 +14930,7 @@ function mergeExtendedClassMeta(compilerCtx, typeChecker, buildCtx, cmpNode, sta
|
|
|
14834
14930
|
let classMethods = cmpNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
|
|
14835
14931
|
let serializers = parseStaticSerializers(staticMembers, "serializers");
|
|
14836
14932
|
let deserializers = parseStaticSerializers(staticMembers, "deserializers");
|
|
14933
|
+
let elementRef = parseStaticElementRef(staticMembers);
|
|
14837
14934
|
tree.forEach((extendedClass) => {
|
|
14838
14935
|
const extendedStaticMembers = extendedClass.classNode.members.filter(isStaticGetter);
|
|
14839
14936
|
const mixinProps = reanchorInheritedTypeReferences(parseStaticProps(extendedStaticMembers) ?? [], extendedClass.fileName, moduleFile.sourceFilePath);
|
|
@@ -14865,6 +14962,7 @@ function mergeExtendedClassMeta(compilerCtx, typeChecker, buildCtx, cmpNode, sta
|
|
|
14865
14962
|
serializers = [...deDupeMembers(parseStaticSerializers(extendedStaticMembers, "serializers") ?? [], serializers), ...serializers];
|
|
14866
14963
|
deserializers = [...deDupeMembers(parseStaticSerializers(extendedStaticMembers, "deserializers") ?? [], deserializers), ...deserializers];
|
|
14867
14964
|
classMethods = [...classMethods, ...extendedClass.classNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)];
|
|
14965
|
+
elementRef ??= parseStaticElementRef(extendedStaticMembers);
|
|
14868
14966
|
if (isMixin) hasMixin = true;
|
|
14869
14967
|
});
|
|
14870
14968
|
return {
|
|
@@ -14878,7 +14976,8 @@ function mergeExtendedClassMeta(compilerCtx, typeChecker, buildCtx, cmpNode, sta
|
|
|
14878
14976
|
watchers,
|
|
14879
14977
|
classMethods,
|
|
14880
14978
|
serializers,
|
|
14881
|
-
deserializers
|
|
14979
|
+
deserializers,
|
|
14980
|
+
elementRef
|
|
14882
14981
|
};
|
|
14883
14982
|
}
|
|
14884
14983
|
//#endregion
|
|
@@ -14934,7 +15033,8 @@ function extractInheritedMetaFromClass(classDecl) {
|
|
|
14934
15033
|
"events",
|
|
14935
15034
|
"listeners",
|
|
14936
15035
|
"watchers",
|
|
14937
|
-
"methods"
|
|
15036
|
+
"methods",
|
|
15037
|
+
"elementRef"
|
|
14938
15038
|
].includes(m.name.text))) return {
|
|
14939
15039
|
properties: parseStaticProps(staticMembers),
|
|
14940
15040
|
states: parseStaticStates(staticMembers),
|
|
@@ -14942,6 +15042,7 @@ function extractInheritedMetaFromClass(classDecl) {
|
|
|
14942
15042
|
events: parseStaticEvents(staticMembers),
|
|
14943
15043
|
listeners: parseStaticListeners(staticMembers),
|
|
14944
15044
|
watchers: parseStaticWatchers(staticMembers),
|
|
15045
|
+
elementRef: parseStaticElementRef(staticMembers),
|
|
14945
15046
|
methodNames
|
|
14946
15047
|
};
|
|
14947
15048
|
const properties = [];
|
|
@@ -14950,6 +15051,7 @@ function extractInheritedMetaFromClass(classDecl) {
|
|
|
14950
15051
|
const events = [];
|
|
14951
15052
|
const listeners = [];
|
|
14952
15053
|
const watchers = [];
|
|
15054
|
+
let elementRef = null;
|
|
14953
15055
|
for (const member of classDecl.members) {
|
|
14954
15056
|
if (!ts$1.isPropertyDeclaration(member) && !ts$1.isMethodDeclaration(member)) continue;
|
|
14955
15057
|
if (!ts$1.isIdentifier(member.name)) continue;
|
|
@@ -14975,7 +15077,8 @@ function extractInheritedMetaFromClass(classDecl) {
|
|
|
14975
15077
|
getter: false,
|
|
14976
15078
|
setter: false
|
|
14977
15079
|
});
|
|
14978
|
-
} else if (decName === "
|
|
15080
|
+
} else if (decName === "Element" && ts$1.isPropertyDeclaration(member)) elementRef ??= memberName;
|
|
15081
|
+
else if (decName === "State" && ts$1.isPropertyDeclaration(member)) states.push({ name: memberName });
|
|
14979
15082
|
else if (decName === "Event" && ts$1.isPropertyDeclaration(member)) {
|
|
14980
15083
|
const opts = extractDecoratorOptions(args[0]);
|
|
14981
15084
|
events.push({
|
|
@@ -15022,6 +15125,7 @@ function extractInheritedMetaFromClass(classDecl) {
|
|
|
15022
15125
|
events,
|
|
15023
15126
|
listeners,
|
|
15024
15127
|
watchers,
|
|
15128
|
+
elementRef,
|
|
15025
15129
|
methodNames
|
|
15026
15130
|
};
|
|
15027
15131
|
}
|
|
@@ -15261,7 +15365,8 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
15261
15365
|
"watchers",
|
|
15262
15366
|
"serializers",
|
|
15263
15367
|
"deserializers",
|
|
15264
|
-
"methods"
|
|
15368
|
+
"methods",
|
|
15369
|
+
"elementRef"
|
|
15265
15370
|
].includes(m.name.text));
|
|
15266
15371
|
if (!hasUsableStaticMembers && className) {
|
|
15267
15372
|
const converted = convertInMemorySourceDecorators(parentSf, config);
|
|
@@ -15282,6 +15387,7 @@ function extractAncestorMeta(ancestor, cmpSourceFile, resolveImport, config) {
|
|
|
15282
15387
|
watchers: parseStaticWatchers(resolvedStaticMembers) ?? [],
|
|
15283
15388
|
serializers: parseStaticSerializers(resolvedStaticMembers, "serializers") ?? [],
|
|
15284
15389
|
deserializers: parseStaticSerializers(resolvedStaticMembers, "deserializers") ?? [],
|
|
15390
|
+
elementRef: parseStaticElementRef(resolvedStaticMembers),
|
|
15285
15391
|
methodNames: resolvedClassNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean)
|
|
15286
15392
|
};
|
|
15287
15393
|
}
|
|
@@ -15313,6 +15419,7 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
15313
15419
|
let classMethods = cmpNode.members.filter(ts$1.isMethodDeclaration).map((m) => ts$1.isIdentifier(m.name) ? m.name.text : "").filter(Boolean);
|
|
15314
15420
|
let serializers = parseStaticSerializers(staticMembers, "serializers");
|
|
15315
15421
|
let deserializers = parseStaticSerializers(staticMembers, "deserializers");
|
|
15422
|
+
let elementRef = parseStaticElementRef(staticMembers);
|
|
15316
15423
|
const ancestors = [];
|
|
15317
15424
|
resolveAncestors(cmpNode, sourceFile, sourceFile.fileName, resolveImport, /* @__PURE__ */ new Set(), ancestors, cmpNode, buildCtx);
|
|
15318
15425
|
ancestors.forEach((ancestor) => {
|
|
@@ -15329,6 +15436,7 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
15329
15436
|
serializers = [...deDupeMembers(parentMeta.serializers ?? [], serializers), ...serializers];
|
|
15330
15437
|
deserializers = [...deDupeMembers(parentMeta.deserializers ?? [], deserializers), ...deserializers];
|
|
15331
15438
|
classMethods = [...classMethods, ...parentMeta.methodNames];
|
|
15439
|
+
elementRef ??= parentMeta.elementRef;
|
|
15332
15440
|
});
|
|
15333
15441
|
return {
|
|
15334
15442
|
doesExtend,
|
|
@@ -15340,7 +15448,8 @@ function mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, sourceF
|
|
|
15340
15448
|
watchers,
|
|
15341
15449
|
classMethods,
|
|
15342
15450
|
serializers,
|
|
15343
|
-
deserializers
|
|
15451
|
+
deserializers,
|
|
15452
|
+
elementRef
|
|
15344
15453
|
};
|
|
15345
15454
|
}
|
|
15346
15455
|
//#endregion
|
|
@@ -15361,13 +15470,6 @@ const parseClassMethods = (classMethods, cmpMeta) => {
|
|
|
15361
15470
|
cmpMeta.hasRenderFn = classMethods.includes("render");
|
|
15362
15471
|
};
|
|
15363
15472
|
//#endregion
|
|
15364
|
-
//#region src/compiler/transformers/static-to-meta/element-ref.ts
|
|
15365
|
-
const parseStaticElementRef = (staticMembers) => {
|
|
15366
|
-
const parsedElementRef = getStaticValue(staticMembers, "elementRef");
|
|
15367
|
-
if (typeof parsedElementRef === "string") return parsedElementRef;
|
|
15368
|
-
return null;
|
|
15369
|
-
};
|
|
15370
|
-
//#endregion
|
|
15371
15473
|
//#region src/compiler/transformers/static-to-meta/encapsulation.ts
|
|
15372
15474
|
/**
|
|
15373
15475
|
* Find and return the type of encapsulation that a component has based on the return value of its static getter of the
|
|
@@ -15647,7 +15749,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
|
|
|
15647
15749
|
const staticMembers = cmpNode.members.filter(isStaticGetter);
|
|
15648
15750
|
const tagName = getComponentTagName(staticMembers);
|
|
15649
15751
|
if (tagName == null) return cmpNode;
|
|
15650
|
-
const { doesExtend, properties, states, methods, listeners, events, watchers, classMethods, serializers, deserializers } = transformOpts?.resolveImport ? mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, moduleFile.staticSourceFile, transformOpts.resolveImport, buildCtx.config, buildCtx) : mergeExtendedClassMeta(compilerCtx, typeChecker, buildCtx, cmpNode, staticMembers, moduleFile);
|
|
15752
|
+
const { doesExtend, properties, states, methods, listeners, events, watchers, classMethods, serializers, deserializers, elementRef } = transformOpts?.resolveImport ? mergeExtendedClassMetaWithResolveImport(cmpNode, staticMembers, moduleFile.staticSourceFile, transformOpts.resolveImport, buildCtx.config, buildCtx) : mergeExtendedClassMeta(compilerCtx, typeChecker, buildCtx, cmpNode, staticMembers, moduleFile);
|
|
15651
15753
|
const symbol = typeChecker ? typeChecker.getSymbolAtLocation(cmpNode.name) : void 0;
|
|
15652
15754
|
const docs = serializeSymbol(typeChecker, symbol);
|
|
15653
15755
|
const isCollectionDependency = moduleFile.isCollectionDependency;
|
|
@@ -15660,7 +15762,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
|
|
|
15660
15762
|
excludeFromCollection: moduleFile.excludeFromCollection,
|
|
15661
15763
|
isCollectionDependency,
|
|
15662
15764
|
componentClassName: cmpNode.name ? cmpNode.name.text : "",
|
|
15663
|
-
elementRef
|
|
15765
|
+
elementRef,
|
|
15664
15766
|
encapsulation,
|
|
15665
15767
|
shadowDelegatesFocus: !!parseStaticShadowDelegatesFocus(encapsulation, staticMembers),
|
|
15666
15768
|
shadowClonable: !!parseStaticShadowClonable(encapsulation, staticMembers),
|
|
@@ -15699,7 +15801,6 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
|
|
|
15699
15801
|
hasConnectedCallbackFn: false,
|
|
15700
15802
|
hasDeserializer: false,
|
|
15701
15803
|
hasDisconnectedCallbackFn: false,
|
|
15702
|
-
hasElement: false,
|
|
15703
15804
|
hasEvent: false,
|
|
15704
15805
|
hasLifecycle: false,
|
|
15705
15806
|
hasListener: false,
|
|
@@ -16298,7 +16399,6 @@ const transpileModule = (config, input, transformOpts) => {
|
|
|
16298
16399
|
const isAutomaticRuntime = tsCompilerOptions.jsx === ts$1.JsxEmit.ReactJSX || tsCompilerOptions.jsx === ts$1.JsxEmit.ReactJSXDev;
|
|
16299
16400
|
if (tsCompilerOptions.jsx != null && !isAutomaticRuntime && !isString$1(tsCompilerOptions.jsxFactory)) tsCompilerOptions.jsxFactory = "h";
|
|
16300
16401
|
if (tsCompilerOptions.jsx != null && !isAutomaticRuntime && !isString$1(tsCompilerOptions.jsxFragmentFactory)) tsCompilerOptions.jsxFragmentFactory = "Fragment";
|
|
16301
|
-
if (tsCompilerOptions.paths && !isString$1(tsCompilerOptions.baseUrl)) tsCompilerOptions.baseUrl = ".";
|
|
16302
16402
|
const sourceFile = ts$1.createSourceFile(sourceFilePath, input, tsCompilerOptions.target);
|
|
16303
16403
|
const importedSources = /* @__PURE__ */ new Map();
|
|
16304
16404
|
const resolveImport = input.includes("resolveVar(") ? transformOpts.resolveImport : void 0;
|
|
@@ -16319,7 +16419,7 @@ const transpileModule = (config, input, transformOpts) => {
|
|
|
16319
16419
|
};
|
|
16320
16420
|
};
|
|
16321
16421
|
if (resolveImport) tsCompilerOptions.noResolve = false;
|
|
16322
|
-
const
|
|
16422
|
+
const program = ts$1.createProgram([sourceFilePath], tsCompilerOptions, {
|
|
16323
16423
|
getSourceFile: (fileName) => normalizePath(fileName) === normalizePath(sourceFilePath) ? sourceFile : importedSources.get(normalizePath(fileName)),
|
|
16324
16424
|
writeFile: (name, text) => {
|
|
16325
16425
|
if (name.endsWith(".js.map") || name.endsWith(".mjs.map")) results.map = text;
|
|
@@ -16334,9 +16434,8 @@ const transpileModule = (config, input, transformOpts) => {
|
|
|
16334
16434
|
readFile: () => "",
|
|
16335
16435
|
directoryExists: () => true,
|
|
16336
16436
|
getDirectories: () => [],
|
|
16337
|
-
|
|
16338
|
-
};
|
|
16339
|
-
const program = ts$1.createProgram([sourceFilePath], tsCompilerOptions, compilerHost);
|
|
16437
|
+
resolveModuleNameLiterals: (moduleLiterals, containingFile) => moduleLiterals.map((literal) => ({ resolvedModule: resolveImport ? resolveViaCallback(literal.text, containingFile) : void 0 }))
|
|
16438
|
+
});
|
|
16340
16439
|
const typeChecker = program.getTypeChecker();
|
|
16341
16440
|
const transformers = {
|
|
16342
16441
|
before: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CompilerFsStats, $n as WatcherCloseResults, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdOptions, Ar as FsWriteResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrDocumentOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsSlot, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsUsage, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsTypeLibrary, Et as FsWatchResults, F as Compiler, Fn as RolldownConfig, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as SystemDetails, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as SerializeDocumentOptions, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileOptions, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TransformOptions, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as ServiceWorkerConfig, Lt as LoadConfigInit, M as CliInitOptions, Mn as ResolveModuleOptions, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtOpts, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as JsonDocsValue, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RobotsTxtResults, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as ValidatedOutputTargetWww, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpOpts, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsProp, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTag, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDevServerConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as SsrFactoryOptions, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as StencilDocsConfig, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as UnvalidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as TranspileResults, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedConfig, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsEvent, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsMethodReturn, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerMainController, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocMethodParameter, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsDependencyGraph, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsCustomState, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleIdResults, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveImportContext, kr as StyleDoc, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsComponent, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocs, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOnlyResults, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tr as WorkerOptions, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ur as UserBuildConditionals, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsListener, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsStyle, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsPart, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethod, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SitemapXmpResults, zt as LogLevel } from "../index-
|
|
1
|
+
import { $ as CompilerFsStats, $n as WatcherCloseResults, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdOptions, Ar as FsWriteResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrDocumentOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsSlot, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsUsage, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsTypeLibrary, Et as FsWatchResults, F as Compiler, Fn as RolldownConfig, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as SystemDetails, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as SerializeDocumentOptions, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileOptions, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TransformOptions, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as ServiceWorkerConfig, Lt as LoadConfigInit, M as CliInitOptions, Mn as ResolveModuleOptions, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtOpts, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as JsonDocsValue, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RobotsTxtResults, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as ValidatedOutputTargetWww, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpOpts, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsProp, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTag, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDevServerConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as SsrFactoryOptions, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as StencilDocsConfig, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as UnvalidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as TranspileResults, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedConfig, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsEvent, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsMethodReturn, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerMainController, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocMethodParameter, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsDependencyGraph, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsCustomState, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleIdResults, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveImportContext, kr as StyleDoc, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsComponent, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocs, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOnlyResults, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tr as WorkerOptions, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ur as UserBuildConditionals, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsListener, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsStyle, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsPart, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethod, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SitemapXmpResults, zt as LogLevel } from "../index-BOBfOxcK.mjs";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
import { Plugin as Plugin$1 } from "rolldown";
|
|
4
4
|
//#region src/version.d.ts
|
package/dist/compiler/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-
|
|
2
|
-
import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-
|
|
1
|
+
import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-D6kG51sR.mjs";
|
|
2
|
+
import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-IRt_dGbC.mjs";
|
|
3
3
|
export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $i as COLLECTION, $r as rolldownToStencilSourceMap, Aa as WWW, Ai as shouldExcludeComponent, Bi as normalizeDiagnostics, Br as isDtsFile, Ca as STANDALONE, Ci as isOutputTargetSsrWasm, Da as TYPES, Di as isOutputTargetWww, Ea as SVG_NS, Ei as isOutputTargetTypes, Fi as catchError, Fr as addDocBlock, Gi as createOnWarnFn, Gr as parsePackageJson, Hi as augmentDiagnosticWithNode, Hr as isJsxFile, Ii as hasError, Ir as createJsVarName, Ji as formatComponentRuntimeMeta, Jr as getInlineSourceMappingUrlLinker, Ki as isRolldownError, Kr as readOnlyArrayHasStringMember, Li as hasWarning, Lr as generatePreamble, Mi as buildError, Mr as validateComponentModes, Ni as buildJsonFileError, Nr as validateComponentTag, Oa as VALID_CONFIG_OUTPUT_TARGETS, Oi as isValidConfigOutputTarget, Pi as buildWarn, Pr as ParsePackageJsonResult, Qi as CMP_FLAGS, Qr as relativizeSourceMap, Ri as shouldIgnoreError, Rr as getTextDocs, Sa as SSR_WASM, Si as isOutputTargetSsr, Ta as STYLE_EXT, Ti as isOutputTargetStats, Ui as loadTypeScriptDiagnostic, Ur as isTsFile, Vi as splitLineBreaks, Vr as isJsFile, Wi as loadTypeScriptDiagnostics, Wr as isTsxFile, Xi as stringifyRuntimeData, Xr as getSourceMappingUrlForEndOfFile, Yi as formatLazyBundleRuntimeMeta, Yr as getRolldownSourceMapOptions, Zi as ASSETS, Zr as getSourceMappingUrlLinker, _a as LISTENER_FLAGS, _i as isOutputTargetDocsReadme, aa as DIST_LAZY, ai as getComponentsDtsTypesFilePath, ba as NODE_TYPES, bi as isOutputTargetLoaderBundle, ca as DOCS_CUSTOM_ELEMENTS_MANIFEST, ci as isOutputTargetCollection, da as DOCS_VSCODE, di as isOutputTargetDistLazy, ea as COLLECTION_APP_DATA_FILE_NAME, ei as result_d_exports, fa as EVENT_FLAGS, fi as isOutputTargetDocs, ga as HTML_NS, gi as isOutputTargetDocsJson, ha as HOST_FLAGS, hi as isOutputTargetDocsCustomElementsManifest, ia as DEFAULT_STYLE_MODE, ii as getComponentsDtsSrcFilePath, ja as XLINK_NS, ji as TASK_CANCELED_MSG, jr as ModeValidationError, ka as WATCH_FLAGS, ki as relativeImport, la as DOCS_JSON, li as isOutputTargetCopy, ma as GLOBAL_STYLE, mi as isOutputTargetDocsCustom, na as COPY, ni as filterActiveTargets, oa as DOCS_AGENT_SKILL, oi as getComponentsFromModules, pa as GENERATED_DTS, pi as isOutputTargetDocsAgentSkill, qi as loadRolldownDiagnostics, qr as readPackageJson, ra as CUSTOM, ri as filterExcludedComponents, sa as DOCS_CUSTOM, si as isOutputTargetAssets, ta as COLLECTION_MANIFEST_FILE_NAME, ti as FilterComponentsResult, ua as DOCS_README, ui as isOutputTargetCustom, va as LOADER_BUNDLE, vi as isOutputTargetDocsVscode, wa as STATS, wi as isOutputTargetStandalone, xa as SSR, xi as isOutputTargetServerRenderer, ya as MEMBER_FLAGS, yi as isOutputTargetGlobalStyle, zi as escapeHtml, zr as hasDependency } from "../../index-
|
|
1
|
+
import { $i as COLLECTION, $r as rolldownToStencilSourceMap, Aa as WWW, Ai as shouldExcludeComponent, Bi as normalizeDiagnostics, Br as isDtsFile, Ca as STANDALONE, Ci as isOutputTargetSsrWasm, Da as TYPES, Di as isOutputTargetWww, Ea as SVG_NS, Ei as isOutputTargetTypes, Fi as catchError, Fr as addDocBlock, Gi as createOnWarnFn, Gr as parsePackageJson, Hi as augmentDiagnosticWithNode, Hr as isJsxFile, Ii as hasError, Ir as createJsVarName, Ji as formatComponentRuntimeMeta, Jr as getInlineSourceMappingUrlLinker, Ki as isRolldownError, Kr as readOnlyArrayHasStringMember, Li as hasWarning, Lr as generatePreamble, Mi as buildError, Mr as validateComponentModes, Ni as buildJsonFileError, Nr as validateComponentTag, Oa as VALID_CONFIG_OUTPUT_TARGETS, Oi as isValidConfigOutputTarget, Pi as buildWarn, Pr as ParsePackageJsonResult, Qi as CMP_FLAGS, Qr as relativizeSourceMap, Ri as shouldIgnoreError, Rr as getTextDocs, Sa as SSR_WASM, Si as isOutputTargetSsr, Ta as STYLE_EXT, Ti as isOutputTargetStats, Ui as loadTypeScriptDiagnostic, Ur as isTsFile, Vi as splitLineBreaks, Vr as isJsFile, Wi as loadTypeScriptDiagnostics, Wr as isTsxFile, Xi as stringifyRuntimeData, Xr as getSourceMappingUrlForEndOfFile, Yi as formatLazyBundleRuntimeMeta, Yr as getRolldownSourceMapOptions, Zi as ASSETS, Zr as getSourceMappingUrlLinker, _a as LISTENER_FLAGS, _i as isOutputTargetDocsReadme, aa as DIST_LAZY, ai as getComponentsDtsTypesFilePath, ba as NODE_TYPES, bi as isOutputTargetLoaderBundle, ca as DOCS_CUSTOM_ELEMENTS_MANIFEST, ci as isOutputTargetCollection, da as DOCS_VSCODE, di as isOutputTargetDistLazy, ea as COLLECTION_APP_DATA_FILE_NAME, ei as result_d_exports, fa as EVENT_FLAGS, fi as isOutputTargetDocs, ga as HTML_NS, gi as isOutputTargetDocsJson, ha as HOST_FLAGS, hi as isOutputTargetDocsCustomElementsManifest, ia as DEFAULT_STYLE_MODE, ii as getComponentsDtsSrcFilePath, ja as XLINK_NS, ji as TASK_CANCELED_MSG, jr as ModeValidationError, ka as WATCH_FLAGS, ki as relativeImport, la as DOCS_JSON, li as isOutputTargetCopy, ma as GLOBAL_STYLE, mi as isOutputTargetDocsCustom, na as COPY, ni as filterActiveTargets, oa as DOCS_AGENT_SKILL, oi as getComponentsFromModules, pa as GENERATED_DTS, pi as isOutputTargetDocsAgentSkill, qi as loadRolldownDiagnostics, qr as readPackageJson, ra as CUSTOM, ri as filterExcludedComponents, sa as DOCS_CUSTOM, si as isOutputTargetAssets, ta as COLLECTION_MANIFEST_FILE_NAME, ti as FilterComponentsResult, ua as DOCS_README, ui as isOutputTargetCustom, va as LOADER_BUNDLE, vi as isOutputTargetDocsVscode, wa as STATS, wi as isOutputTargetStandalone, xa as SSR, xi as isOutputTargetServerRenderer, ya as MEMBER_FLAGS, yi as isOutputTargetGlobalStyle, zi as escapeHtml, zr as hasDependency } from "../../index-BOBfOxcK.mjs";
|
|
2
2
|
//#region src/utils/byte-size.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Used to learn the size of a string in bytes.
|