@stencil/core 4.40.1 → 4.41.0-dev.1767590127.4bb24de
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/cli/config-flags.d.ts +2 -2
- package/cli/index.cjs +9 -4
- package/cli/index.js +9 -4
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +304 -142
- package/dev-server/client/index.js +12 -12
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- package/dev-server/index.js +2 -2
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +18 -11
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +105 -25
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +65 -26
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +4262 -4210
- package/internal/package.json +1 -1
- package/internal/stencil-core/jsx-dev-runtime.cjs +7 -0
- package/internal/stencil-core/jsx-dev-runtime.d.ts +23 -0
- package/internal/stencil-core/jsx-dev-runtime.js +2 -0
- package/internal/stencil-core/jsx-runtime.cjs +8 -0
- package/internal/stencil-core/jsx-runtime.d.ts +22 -0
- package/internal/stencil-core/jsx-runtime.js +2 -0
- package/internal/stencil-private.d.ts +20 -0
- package/internal/stencil-public-compiler.d.ts +6 -0
- package/internal/stencil-public-docs.d.ts +11 -0
- package/internal/stencil-public-runtime.d.ts +29 -0
- package/internal/testing/index.js +753 -638
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +192 -135
- package/mock-doc/index.js +193 -135
- package/mock-doc/package.json +1 -1
- package/package.json +11 -1
- package/screenshot/index.js +29 -8
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +29 -29
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +98 -70
- package/testing/package.json +1 -1
package/compiler/stencil.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Compiler v4.
|
|
2
|
+
Stencil Compiler v4.41.0-dev.1767590127.4bb24de | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -25074,8 +25074,8 @@ ${lanes.join("\n")}
|
|
|
25074
25074
|
return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
|
|
25075
25075
|
}
|
|
25076
25076
|
function getJSXTransformEnabled(options) {
|
|
25077
|
-
const
|
|
25078
|
-
return
|
|
25077
|
+
const jsx2 = options.jsx;
|
|
25078
|
+
return jsx2 === 2 || jsx2 === 4 || jsx2 === 5;
|
|
25079
25079
|
}
|
|
25080
25080
|
function getJSXImplicitImportBase(compilerOptions, file) {
|
|
25081
25081
|
const jsxImportSourcePragmas = file == null ? void 0 : file.pragmas.get("jsximportsource");
|
|
@@ -153086,8 +153086,8 @@ ${lanes.join("\n")}
|
|
|
153086
153086
|
/* Ignore */
|
|
153087
153087
|
};
|
|
153088
153088
|
}
|
|
153089
|
-
function jsxModeNeedsExplicitImport(
|
|
153090
|
-
return
|
|
153089
|
+
function jsxModeNeedsExplicitImport(jsx2) {
|
|
153090
|
+
return jsx2 === 2 || jsx2 === 3;
|
|
153091
153091
|
}
|
|
153092
153092
|
function isSourceFileFromLibrary(program3, node) {
|
|
153093
153093
|
return program3.isSourceFileFromExternalLibrary(node) || program3.isSourceFileDefaultLibrary(node);
|
|
@@ -178305,8 +178305,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
178305
178305
|
return binaryExpr;
|
|
178306
178306
|
}
|
|
178307
178307
|
function doChange38(changeTracker, sf, node) {
|
|
178308
|
-
const
|
|
178309
|
-
if (
|
|
178308
|
+
const jsx2 = flattenInvalidBinaryExpr(node);
|
|
178309
|
+
if (jsx2) changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx2, factory.createJsxJsxClosingFragment()));
|
|
178310
178310
|
}
|
|
178311
178311
|
function flattenInvalidBinaryExpr(node) {
|
|
178312
178312
|
const children = [];
|
|
@@ -226972,7 +226972,7 @@ var init_parseAst = __esm({
|
|
|
226972
226972
|
};
|
|
226973
226973
|
}
|
|
226974
226974
|
];
|
|
226975
|
-
parseAst = (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => convertProgram(getAstBuffer((0, import_native.parse)(input, allowReturnOutsideFunction,
|
|
226975
|
+
parseAst = (input, { allowReturnOutsideFunction = false, jsx: jsx2 = false } = {}) => convertProgram(getAstBuffer((0, import_native.parse)(input, allowReturnOutsideFunction, jsx2)));
|
|
226976
226976
|
}
|
|
226977
226977
|
});
|
|
226978
226978
|
|
|
@@ -239392,12 +239392,12 @@ var init_node_entry = __esm({
|
|
|
239392
239392
|
}
|
|
239393
239393
|
}
|
|
239394
239394
|
getRenderingMode() {
|
|
239395
|
-
const
|
|
239396
|
-
const { mode, factory, importSource } =
|
|
239395
|
+
const jsx2 = this.scope.context.options.jsx;
|
|
239396
|
+
const { mode, factory, importSource } = jsx2;
|
|
239397
239397
|
if (mode === "automatic") {
|
|
239398
239398
|
return {
|
|
239399
239399
|
factory: getRenderedJsxChildren(this.children) > 1 ? "jsxs" : "jsx",
|
|
239400
|
-
importSource:
|
|
239400
|
+
importSource: jsx2.jsxImportSource,
|
|
239401
239401
|
mode
|
|
239402
239402
|
};
|
|
239403
239403
|
}
|
|
@@ -239449,8 +239449,8 @@ var init_node_entry = __esm({
|
|
|
239449
239449
|
}
|
|
239450
239450
|
}
|
|
239451
239451
|
getRenderingMode() {
|
|
239452
|
-
const
|
|
239453
|
-
const { mode, factory, importSource } =
|
|
239452
|
+
const jsx2 = this.scope.context.options.jsx;
|
|
239453
|
+
const { mode, factory, importSource } = jsx2;
|
|
239454
239454
|
if (mode === "automatic") {
|
|
239455
239455
|
let hasSpread = false;
|
|
239456
239456
|
for (const attribute of this.openingElement.attributes) {
|
|
@@ -239659,12 +239659,12 @@ var init_node_entry = __esm({
|
|
|
239659
239659
|
this.included = true;
|
|
239660
239660
|
if (!this.deoptimized)
|
|
239661
239661
|
this.applyDeoptimizations();
|
|
239662
|
-
const
|
|
239663
|
-
if (
|
|
239662
|
+
const jsx2 = this.scope.context.options.jsx;
|
|
239663
|
+
if (jsx2.mode === "automatic") {
|
|
239664
239664
|
this.fragment = "Fragment";
|
|
239665
|
-
this.fragmentVariable = getAndIncludeFactoryVariable("Fragment", false,
|
|
239665
|
+
this.fragmentVariable = getAndIncludeFactoryVariable("Fragment", false, jsx2.jsxImportSource, this, context);
|
|
239666
239666
|
} else {
|
|
239667
|
-
const { fragment, importSource, mode } =
|
|
239667
|
+
const { fragment, importSource, mode } = jsx2;
|
|
239668
239668
|
if (fragment != null) {
|
|
239669
239669
|
this.fragment = fragment;
|
|
239670
239670
|
this.fragmentVariable = getAndIncludeFactoryVariable(fragment, mode === "preserve", importSource, this, context);
|
|
@@ -245765,7 +245765,7 @@ var import_typescript72 = __toESM(require_typescript_5_8_3_bundle_cache_min());
|
|
|
245765
245765
|
|
|
245766
245766
|
// src/version.ts
|
|
245767
245767
|
init_import_meta_url();
|
|
245768
|
-
var buildId = "
|
|
245768
|
+
var buildId = "1767590127";
|
|
245769
245769
|
var minfyJsId = "terser5.37.0_7";
|
|
245770
245770
|
var optimizeCssId = "autoprefixer10.4.19_postcss8.5.6_7";
|
|
245771
245771
|
var parse5Version = "7.2.1";
|
|
@@ -245773,8 +245773,8 @@ var rollupVersion = "4.34.9";
|
|
|
245773
245773
|
var jqueryVersion = "4.0.0-pre";
|
|
245774
245774
|
var terserVersion = "5.37.0";
|
|
245775
245775
|
var typescriptVersion = "5.8.3";
|
|
245776
|
-
var vermoji = "\u{
|
|
245777
|
-
var version = "4.
|
|
245776
|
+
var vermoji = "\u{1F4E3}";
|
|
245777
|
+
var version = "4.41.0-dev.1767590127.4bb24de";
|
|
245778
245778
|
var versions = {
|
|
245779
245779
|
stencil: version,
|
|
245780
245780
|
parse5: parse5Version,
|
|
@@ -248940,6 +248940,12 @@ init_import_meta_url();
|
|
|
248940
248940
|
// src/runtime/tag-transform.ts
|
|
248941
248941
|
init_import_meta_url();
|
|
248942
248942
|
|
|
248943
|
+
// src/runtime/vdom/jsx-dev-runtime.ts
|
|
248944
|
+
init_import_meta_url();
|
|
248945
|
+
|
|
248946
|
+
// src/runtime/vdom/jsx-runtime.ts
|
|
248947
|
+
init_import_meta_url();
|
|
248948
|
+
|
|
248943
248949
|
// src/runtime/vdom/vdom-annotations.ts
|
|
248944
248950
|
init_import_meta_url();
|
|
248945
248951
|
|
|
@@ -249229,35 +249235,36 @@ var buildEvents = () => {
|
|
|
249229
249235
|
|
|
249230
249236
|
// src/compiler/build/compiler-ctx.ts
|
|
249231
249237
|
var CompilerContext = class {
|
|
249232
|
-
|
|
249233
|
-
|
|
249234
|
-
|
|
249235
|
-
|
|
249236
|
-
|
|
249237
|
-
|
|
249238
|
-
|
|
249239
|
-
|
|
249240
|
-
|
|
249241
|
-
|
|
249242
|
-
|
|
249243
|
-
|
|
249244
|
-
|
|
249245
|
-
|
|
249246
|
-
|
|
249247
|
-
|
|
249248
|
-
|
|
249249
|
-
|
|
249250
|
-
|
|
249251
|
-
|
|
249252
|
-
|
|
249253
|
-
|
|
249254
|
-
|
|
249255
|
-
|
|
249256
|
-
|
|
249257
|
-
|
|
249258
|
-
|
|
249259
|
-
|
|
249260
|
-
|
|
249238
|
+
version = 2;
|
|
249239
|
+
activeBuildId = -1;
|
|
249240
|
+
activeFilesAdded = [];
|
|
249241
|
+
activeFilesDeleted = [];
|
|
249242
|
+
activeFilesUpdated = [];
|
|
249243
|
+
activeDirsAdded = [];
|
|
249244
|
+
activeDirsDeleted = [];
|
|
249245
|
+
addWatchDir = noop;
|
|
249246
|
+
addWatchFile = noop;
|
|
249247
|
+
cache;
|
|
249248
|
+
cssModuleImports = /* @__PURE__ */ new Map();
|
|
249249
|
+
changedFiles = /* @__PURE__ */ new Set();
|
|
249250
|
+
changedModules = /* @__PURE__ */ new Set();
|
|
249251
|
+
collections = [];
|
|
249252
|
+
compilerOptions = null;
|
|
249253
|
+
events = buildEvents();
|
|
249254
|
+
fs;
|
|
249255
|
+
hasSuccessfulBuild = false;
|
|
249256
|
+
isActivelyBuilding = false;
|
|
249257
|
+
lastBuildResults = null;
|
|
249258
|
+
moduleMap = /* @__PURE__ */ new Map();
|
|
249259
|
+
nodeMap = /* @__PURE__ */ new WeakMap();
|
|
249260
|
+
resolvedCollections = /* @__PURE__ */ new Set();
|
|
249261
|
+
rollupCache = /* @__PURE__ */ new Map();
|
|
249262
|
+
rollupCacheHydrate = null;
|
|
249263
|
+
rollupCacheLazy = null;
|
|
249264
|
+
rollupCacheNative = null;
|
|
249265
|
+
cachedGlobalStyle;
|
|
249266
|
+
styleModeNames = /* @__PURE__ */ new Set();
|
|
249267
|
+
worker = null;
|
|
249261
249268
|
reset() {
|
|
249262
249269
|
this.cache.clear();
|
|
249263
249270
|
this.cssModuleImports.clear();
|
|
@@ -250521,15 +250528,18 @@ var getTypeReferenceLocation = (typeName, type, sourceFile, checker, program3) =
|
|
|
250521
250528
|
const compilerHost = import_typescript9.default.createCompilerHost(options);
|
|
250522
250529
|
const importHomeModule = getHomeModule(sourceFile, localImportPath, options, compilerHost, program3);
|
|
250523
250530
|
if (importHomeModule) {
|
|
250524
|
-
const
|
|
250531
|
+
const importElement = namedImportBindings.elements.find((nbe) => nbe.name.getText() === typeName);
|
|
250532
|
+
const importName = importElement.name;
|
|
250525
250533
|
const originalTypeName = getOriginalTypeName(importName, checker);
|
|
250534
|
+
const importedAs = importElement.propertyName ? importElement.propertyName.getText() : typeName;
|
|
250526
250535
|
const typeDecl = findTypeWithName(importHomeModule, originalTypeName);
|
|
250527
250536
|
type = checker.getTypeAtLocation(typeDecl);
|
|
250528
250537
|
const id = addToLibrary(type, originalTypeName, checker, normalizePath(importHomeModule.fileName, false));
|
|
250529
250538
|
return {
|
|
250530
250539
|
location: "import",
|
|
250531
250540
|
path: localImportPath,
|
|
250532
|
-
id
|
|
250541
|
+
id,
|
|
250542
|
+
referenceLocation: importedAs
|
|
250533
250543
|
};
|
|
250534
250544
|
}
|
|
250535
250545
|
}
|
|
@@ -250558,6 +250568,35 @@ var getTypeReferenceLocation = (typeName, type, sourceFile, checker, program3) =
|
|
|
250558
250568
|
id
|
|
250559
250569
|
};
|
|
250560
250570
|
}
|
|
250571
|
+
const defaultImportDeclaration = sourceFile.statements.find((st) => {
|
|
250572
|
+
if (!import_typescript9.default.isImportDeclaration(st) || !st.importClause) {
|
|
250573
|
+
return false;
|
|
250574
|
+
}
|
|
250575
|
+
const defaultImportName = st.importClause.name;
|
|
250576
|
+
return defaultImportName && defaultImportName.getText() === typeName;
|
|
250577
|
+
});
|
|
250578
|
+
if (defaultImportDeclaration) {
|
|
250579
|
+
const localImportPath = defaultImportDeclaration.moduleSpecifier.text;
|
|
250580
|
+
const options = program3.getCompilerOptions();
|
|
250581
|
+
const compilerHost = import_typescript9.default.createCompilerHost(options);
|
|
250582
|
+
const importHomeModule = getHomeModule(sourceFile, localImportPath, options, compilerHost, program3);
|
|
250583
|
+
if (importHomeModule) {
|
|
250584
|
+
const defaultExport = importHomeModule.statements.find(
|
|
250585
|
+
(st) => import_typescript9.default.isExportAssignment(st) && !st.isExportEquals && import_typescript9.default.isIdentifier(st.expression) && st.expression.getText() === typeName
|
|
250586
|
+
);
|
|
250587
|
+
if (defaultExport) {
|
|
250588
|
+
const typeDecl = findTypeWithName(importHomeModule, typeName);
|
|
250589
|
+
type = checker.getTypeAtLocation(typeDecl);
|
|
250590
|
+
const id = addToLibrary(type, typeName, checker, normalizePath(importHomeModule.fileName, false));
|
|
250591
|
+
return {
|
|
250592
|
+
location: "import",
|
|
250593
|
+
path: localImportPath,
|
|
250594
|
+
id,
|
|
250595
|
+
isDefault: true
|
|
250596
|
+
};
|
|
250597
|
+
}
|
|
250598
|
+
}
|
|
250599
|
+
}
|
|
250561
250600
|
return {
|
|
250562
250601
|
location: "global",
|
|
250563
250602
|
id: "global::" + typeName
|
|
@@ -256234,6 +256273,18 @@ var appDataPlugin = (config, compilerCtx, buildCtx, buildConditionals, platform)
|
|
|
256234
256273
|
if (globalScripts.some((s) => s.path === id)) {
|
|
256235
256274
|
const program3 = this.parse(code, {});
|
|
256236
256275
|
const needsDefault = !program3.body.some((s) => s.type === "ExportDefaultDeclaration");
|
|
256276
|
+
if (needsDefault) {
|
|
256277
|
+
const diagnostic = {
|
|
256278
|
+
level: "warn",
|
|
256279
|
+
type: "build",
|
|
256280
|
+
header: "Missing default export in globalScript",
|
|
256281
|
+
messageText: `globalScript should export a default function.
|
|
256282
|
+
See: https://stenciljs.com/docs/config#globalscript`,
|
|
256283
|
+
relFilePath: id,
|
|
256284
|
+
lines: []
|
|
256285
|
+
};
|
|
256286
|
+
buildCtx.diagnostics.push(diagnostic);
|
|
256287
|
+
}
|
|
256237
256288
|
const defaultExport = needsDefault ? "\nexport const globalFn = () => {};\nexport default globalFn;" : "";
|
|
256238
256289
|
code = code + defaultExport;
|
|
256239
256290
|
const compilerOptions = { ...config.tsCompilerOptions };
|
|
@@ -256301,13 +256352,17 @@ var getGlobalScriptData = (config, compilerCtx) => {
|
|
|
256301
256352
|
};
|
|
256302
256353
|
var appendGlobalScripts = (globalScripts, s) => {
|
|
256303
256354
|
if (globalScripts.length === 1) {
|
|
256304
|
-
s.prepend(`import
|
|
256355
|
+
s.prepend(`import * as appGlobalScriptNs from '${globalScripts[0].path}';
|
|
256356
|
+
`);
|
|
256357
|
+
s.prepend(`const appGlobalScript = appGlobalScriptNs.default || (() => {});
|
|
256305
256358
|
`);
|
|
256306
256359
|
s.append(`export const globalScripts = appGlobalScript;
|
|
256307
256360
|
`);
|
|
256308
256361
|
} else if (globalScripts.length > 1) {
|
|
256309
256362
|
globalScripts.forEach((globalScript) => {
|
|
256310
|
-
s.prepend(`import ${globalScript.defaultName} from '${globalScript.path}';
|
|
256363
|
+
s.prepend(`import * as ${globalScript.defaultName}Ns from '${globalScript.path}';
|
|
256364
|
+
`);
|
|
256365
|
+
s.prepend(`const ${globalScript.defaultName} = ${globalScript.defaultName}Ns.default || (() => {});
|
|
256311
256366
|
`);
|
|
256312
256367
|
});
|
|
256313
256368
|
s.append(`export const globalScripts = () => {
|
|
@@ -269749,10 +269804,6 @@ var HYDRATE_FACTORY_INTRO = `
|
|
|
269749
269804
|
// const ${MODE_RESOLUTION_CHAIN_DECLARATION}
|
|
269750
269805
|
|
|
269751
269806
|
export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
|
|
269752
|
-
var everywhere;
|
|
269753
|
-
try { everywhere = global || globalThis; }
|
|
269754
|
-
catch (e) { everywhere = window || globalThis; }
|
|
269755
|
-
|
|
269756
269807
|
var globalThis = $stencilWindow;
|
|
269757
269808
|
var self = $stencilWindow;
|
|
269758
269809
|
var top = $stencilWindow;
|
|
@@ -269779,6 +269830,11 @@ export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydr
|
|
|
269779
269830
|
var setInterval = $stencilWindow.setInterval.bind($stencilWindow);
|
|
269780
269831
|
var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow);
|
|
269781
269832
|
|
|
269833
|
+
// Tag transform functions are provided from the outer scope
|
|
269834
|
+
// This ensures the factory uses the same instance as the runner
|
|
269835
|
+
var setTagTransformer = $stencilTagTransform.setTagTransformer;
|
|
269836
|
+
var transformTag = $stencilTagTransform.transformTag;
|
|
269837
|
+
|
|
269782
269838
|
var CharacterData = $stencilWindow.CharacterData;
|
|
269783
269839
|
var CSS = $stencilWindow.CSS;
|
|
269784
269840
|
var CustomEvent = $stencilWindow.CustomEvent;
|
|
@@ -269966,6 +270022,35 @@ var writeHydrateOutput = async (config, compilerCtx, buildCtx, outputTarget, rol
|
|
|
269966
270022
|
`// const ${MODE_RESOLUTION_CHAIN_DECLARATION}`,
|
|
269967
270023
|
`const ${MODE_RESOLUTION_CHAIN_DECLARATION}`
|
|
269968
270024
|
);
|
|
270025
|
+
const tagTransformFunctionPattern = /function (setTagTransformer|transformTag)\(/;
|
|
270026
|
+
const match2 = code.match(tagTransformFunctionPattern);
|
|
270027
|
+
if (match2) {
|
|
270028
|
+
const injectCode = `
|
|
270029
|
+
// Tag transform state object for factory closure
|
|
270030
|
+
var $stencilTagTransform = { setTagTransformer: setTagTransformer, transformTag: transformTag };
|
|
270031
|
+
`;
|
|
270032
|
+
const lastTransformTagIndex = code.lastIndexOf("function transformTag(");
|
|
270033
|
+
const lastSetTagTransformerIndex = code.lastIndexOf("function setTagTransformer(");
|
|
270034
|
+
const injectionPoint = Math.max(lastTransformTagIndex, lastSetTagTransformerIndex);
|
|
270035
|
+
if (injectionPoint !== -1) {
|
|
270036
|
+
let braceCount = 0;
|
|
270037
|
+
let foundStart = false;
|
|
270038
|
+
let injectionIndex = injectionPoint;
|
|
270039
|
+
for (let i = injectionPoint; i < code.length; i++) {
|
|
270040
|
+
if (code[i] === "{") {
|
|
270041
|
+
foundStart = true;
|
|
270042
|
+
braceCount++;
|
|
270043
|
+
} else if (code[i] === "}") {
|
|
270044
|
+
braceCount--;
|
|
270045
|
+
if (foundStart && braceCount === 0) {
|
|
270046
|
+
injectionIndex = i + 1;
|
|
270047
|
+
break;
|
|
270048
|
+
}
|
|
270049
|
+
}
|
|
270050
|
+
}
|
|
270051
|
+
code = code.slice(0, injectionIndex) + injectCode + code.slice(injectionIndex);
|
|
270052
|
+
}
|
|
270053
|
+
}
|
|
269969
270054
|
if (minify2) {
|
|
269970
270055
|
const optimizeResults = await optimizeModule(config, compilerCtx, {
|
|
269971
270056
|
input: code,
|
|
@@ -270041,8 +270126,8 @@ var generateHydrateApp = async (config, compilerCtx, buildCtx, outputTargets) =>
|
|
|
270041
270126
|
{
|
|
270042
270127
|
name: "hydrateAppPlugin",
|
|
270043
270128
|
resolveId(id) {
|
|
270044
|
-
if (id === STENCIL_HYDRATE_FACTORY_ID) {
|
|
270045
|
-
return
|
|
270129
|
+
if (id === STENCIL_HYDRATE_FACTORY_ID || id === "@hydrate-factory") {
|
|
270130
|
+
return STENCIL_HYDRATE_FACTORY_ID;
|
|
270046
270131
|
}
|
|
270047
270132
|
if (id === STENCIL_MOCK_DOC_ID) {
|
|
270048
270133
|
return mockDoc;
|
|
@@ -270353,7 +270438,7 @@ var lazyComponentTransform = (compilerCtx, transformOpts, buildCtx) => {
|
|
|
270353
270438
|
return updateLazyComponentClass(transformOpts, styleStatements, node, moduleFile, cmp, buildCtx);
|
|
270354
270439
|
} else if (module2 == null ? void 0 : module2.isMixin) {
|
|
270355
270440
|
return updateMixin(node, moduleFile, cmp, transformOpts);
|
|
270356
|
-
} else if (buildCtx.config._isTesting && buildCtx.config.flags.spec) {
|
|
270441
|
+
} else if (buildCtx.config._isTesting && buildCtx.config.flags.spec && !buildCtx.config.flags.e2e) {
|
|
270357
270442
|
return updateConstructor(node, Array.from(node.members), [], []);
|
|
270358
270443
|
}
|
|
270359
270444
|
}
|
|
@@ -271672,9 +271757,13 @@ var validateStats = (userConfig, userOutputs) => {
|
|
|
271672
271757
|
if (userConfig.flags.stats) {
|
|
271673
271758
|
const hasOutputTarget = userOutputs.some(isOutputTargetStats);
|
|
271674
271759
|
if (!hasOutputTarget) {
|
|
271675
|
-
|
|
271760
|
+
const statsOutput = {
|
|
271676
271761
|
type: STATS
|
|
271677
|
-
}
|
|
271762
|
+
};
|
|
271763
|
+
if (typeof userConfig.flags.stats === "string") {
|
|
271764
|
+
statsOutput.file = userConfig.flags.stats;
|
|
271765
|
+
}
|
|
271766
|
+
outputTargets.push(statsOutput);
|
|
271678
271767
|
}
|
|
271679
271768
|
}
|
|
271680
271769
|
outputTargets.push(...userOutputs.filter(isOutputTargetStats));
|
|
@@ -271953,6 +272042,9 @@ var validateDevServer = (config, diagnostics) => {
|
|
|
271953
272042
|
if (!isBoolean(devServer.websocket)) {
|
|
271954
272043
|
devServer.websocket = true;
|
|
271955
272044
|
}
|
|
272045
|
+
if (!isBoolean(devServer.strictPort)) {
|
|
272046
|
+
devServer.strictPort = false;
|
|
272047
|
+
}
|
|
271956
272048
|
if (flags.ssr) {
|
|
271957
272049
|
devServer.ssr = true;
|
|
271958
272050
|
} else {
|
|
@@ -272044,9 +272136,7 @@ init_import_meta_url();
|
|
|
272044
272136
|
// src/compiler/docs/readme/docs-util.ts
|
|
272045
272137
|
init_import_meta_url();
|
|
272046
272138
|
var MarkdownTable = class {
|
|
272047
|
-
|
|
272048
|
-
this.rows = [];
|
|
272049
|
-
}
|
|
272139
|
+
rows = [];
|
|
272050
272140
|
addHeader(data) {
|
|
272051
272141
|
this.addRow(data, true);
|
|
272052
272142
|
}
|
|
@@ -272718,52 +272808,61 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
272718
272808
|
|
|
272719
272809
|
// src/compiler/build/build-ctx.ts
|
|
272720
272810
|
var BuildContext = class {
|
|
272811
|
+
buildId = -1;
|
|
272812
|
+
buildMessages = [];
|
|
272813
|
+
buildResults = null;
|
|
272814
|
+
bundleBuildCount = 0;
|
|
272815
|
+
collections = [];
|
|
272816
|
+
completedTasks = [];
|
|
272817
|
+
compilerCtx;
|
|
272818
|
+
components = [];
|
|
272819
|
+
componentGraph = /* @__PURE__ */ new Map();
|
|
272820
|
+
config;
|
|
272821
|
+
data = {};
|
|
272822
|
+
buildStats = void 0;
|
|
272823
|
+
esmBrowserComponentBundle;
|
|
272824
|
+
esmComponentBundle;
|
|
272825
|
+
es5ComponentBundle;
|
|
272826
|
+
systemComponentBundle;
|
|
272827
|
+
commonJsComponentBundle;
|
|
272828
|
+
diagnostics = [];
|
|
272829
|
+
dirsAdded = [];
|
|
272830
|
+
dirsDeleted = [];
|
|
272831
|
+
entryModules = [];
|
|
272832
|
+
filesAdded = [];
|
|
272833
|
+
filesChanged = [];
|
|
272834
|
+
filesDeleted = [];
|
|
272835
|
+
filesUpdated = [];
|
|
272836
|
+
filesWritten = [];
|
|
272837
|
+
globalStyle = void 0;
|
|
272838
|
+
hasConfigChanges = false;
|
|
272839
|
+
hasFinished = false;
|
|
272840
|
+
hasHtmlChanges = false;
|
|
272841
|
+
hasPrintedResults = false;
|
|
272842
|
+
hasServiceWorkerChanges = false;
|
|
272843
|
+
hasScriptChanges = true;
|
|
272844
|
+
hasStyleChanges = true;
|
|
272845
|
+
hydrateAppFilePath = null;
|
|
272846
|
+
indexBuildCount = 0;
|
|
272847
|
+
indexDoc = void 0;
|
|
272848
|
+
isRebuild = false;
|
|
272849
|
+
moduleFiles = [];
|
|
272850
|
+
outputs = [];
|
|
272851
|
+
packageJson = {};
|
|
272852
|
+
packageJsonFilePath = null;
|
|
272853
|
+
pendingCopyTasks = [];
|
|
272854
|
+
requiresFullBuild = true;
|
|
272855
|
+
scriptsAdded = [];
|
|
272856
|
+
scriptsDeleted = [];
|
|
272857
|
+
startTime = Date.now();
|
|
272858
|
+
styleBuildCount = 0;
|
|
272859
|
+
stylesPromise = null;
|
|
272860
|
+
stylesUpdated = [];
|
|
272861
|
+
timeSpan = null;
|
|
272862
|
+
timestamp;
|
|
272863
|
+
transpileBuildCount = 0;
|
|
272864
|
+
validateTypesPromise;
|
|
272721
272865
|
constructor(config, compilerCtx) {
|
|
272722
|
-
this.buildId = -1;
|
|
272723
|
-
this.buildMessages = [];
|
|
272724
|
-
this.buildResults = null;
|
|
272725
|
-
this.bundleBuildCount = 0;
|
|
272726
|
-
this.collections = [];
|
|
272727
|
-
this.completedTasks = [];
|
|
272728
|
-
this.components = [];
|
|
272729
|
-
this.componentGraph = /* @__PURE__ */ new Map();
|
|
272730
|
-
this.data = {};
|
|
272731
|
-
this.buildStats = void 0;
|
|
272732
|
-
this.diagnostics = [];
|
|
272733
|
-
this.dirsAdded = [];
|
|
272734
|
-
this.dirsDeleted = [];
|
|
272735
|
-
this.entryModules = [];
|
|
272736
|
-
this.filesAdded = [];
|
|
272737
|
-
this.filesChanged = [];
|
|
272738
|
-
this.filesDeleted = [];
|
|
272739
|
-
this.filesUpdated = [];
|
|
272740
|
-
this.filesWritten = [];
|
|
272741
|
-
this.globalStyle = void 0;
|
|
272742
|
-
this.hasConfigChanges = false;
|
|
272743
|
-
this.hasFinished = false;
|
|
272744
|
-
this.hasHtmlChanges = false;
|
|
272745
|
-
this.hasPrintedResults = false;
|
|
272746
|
-
this.hasServiceWorkerChanges = false;
|
|
272747
|
-
this.hasScriptChanges = true;
|
|
272748
|
-
this.hasStyleChanges = true;
|
|
272749
|
-
this.hydrateAppFilePath = null;
|
|
272750
|
-
this.indexBuildCount = 0;
|
|
272751
|
-
this.indexDoc = void 0;
|
|
272752
|
-
this.isRebuild = false;
|
|
272753
|
-
this.moduleFiles = [];
|
|
272754
|
-
this.outputs = [];
|
|
272755
|
-
this.packageJson = {};
|
|
272756
|
-
this.packageJsonFilePath = null;
|
|
272757
|
-
this.pendingCopyTasks = [];
|
|
272758
|
-
this.requiresFullBuild = true;
|
|
272759
|
-
this.scriptsAdded = [];
|
|
272760
|
-
this.scriptsDeleted = [];
|
|
272761
|
-
this.startTime = Date.now();
|
|
272762
|
-
this.styleBuildCount = 0;
|
|
272763
|
-
this.stylesPromise = null;
|
|
272764
|
-
this.stylesUpdated = [];
|
|
272765
|
-
this.timeSpan = null;
|
|
272766
|
-
this.transpileBuildCount = 0;
|
|
272767
272866
|
this.config = validateConfig(config, {}).config;
|
|
272768
272867
|
this.compilerCtx = compilerCtx;
|
|
272769
272868
|
this.buildId = ++this.compilerCtx.activeBuildId;
|
|
@@ -274491,12 +274590,21 @@ var updateImportReferenceFactory = (typeCounts, filePath, config) => {
|
|
|
274491
274590
|
return;
|
|
274492
274591
|
}
|
|
274493
274592
|
const newTypeName = getIncrementTypeName(typeName);
|
|
274593
|
+
let originalExportName;
|
|
274594
|
+
if (typeReference.referenceLocation) {
|
|
274595
|
+
originalExportName = typeReference.referenceLocation;
|
|
274596
|
+
} else {
|
|
274597
|
+
const typeIdParts = typeReference.id.split("::");
|
|
274598
|
+
originalExportName = typeIdParts.length > 1 ? typeIdParts[typeIdParts.length - 1] : typeName;
|
|
274599
|
+
}
|
|
274494
274600
|
existingTypeImportData[importResolvedFile].push({
|
|
274495
|
-
//
|
|
274496
|
-
//
|
|
274497
|
-
|
|
274601
|
+
// originalName: the name exported from the source module (for import { originalName as ... })
|
|
274602
|
+
// localName: the name used in the component file (the alias if there is one)
|
|
274603
|
+
// importName: Stencil-generated alias to avoid collisions in components.d.ts
|
|
274604
|
+
originalName: originalExportName,
|
|
274498
274605
|
localName: typeName,
|
|
274499
|
-
importName: newTypeName
|
|
274606
|
+
importName: newTypeName,
|
|
274607
|
+
isDefault: typeReference.isDefault
|
|
274500
274608
|
});
|
|
274501
274609
|
});
|
|
274502
274610
|
return existingTypeImportData;
|
|
@@ -274543,23 +274651,48 @@ var generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
|
|
|
274543
274651
|
});
|
|
274544
274652
|
c.push(COMPONENTS_DTS_HEADER);
|
|
274545
274653
|
c.push(`import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";`);
|
|
274546
|
-
const
|
|
274654
|
+
const imports = [];
|
|
274655
|
+
const exports2 = [];
|
|
274656
|
+
Object.keys(typeImportData).forEach((filePath) => {
|
|
274547
274657
|
const typeData = typeImportData[filePath];
|
|
274548
274658
|
let importFilePath = filePath;
|
|
274549
274659
|
if ((0, import_path43.isAbsolute)(filePath)) {
|
|
274550
274660
|
importFilePath = normalizePath("./" + relative(config.srcDir, filePath)).replace(/\.(tsx|ts)$/, "");
|
|
274551
274661
|
}
|
|
274552
|
-
|
|
274553
|
-
|
|
274554
|
-
|
|
274555
|
-
|
|
274556
|
-
|
|
274557
|
-
|
|
274558
|
-
|
|
274559
|
-
|
|
274560
|
-
|
|
274662
|
+
const hasDefaultImport = typeData.some((td3) => td3.isDefault);
|
|
274663
|
+
if (hasDefaultImport && typeData.length === 1) {
|
|
274664
|
+
const td3 = typeData[0];
|
|
274665
|
+
imports.push(`import ${td3.importName} from "${importFilePath}";`);
|
|
274666
|
+
exports2.push(`export { default as ${td3.importName} } from "${importFilePath}";`);
|
|
274667
|
+
} else if (hasDefaultImport) {
|
|
274668
|
+
const defaultImport = typeData.find((td3) => td3.isDefault);
|
|
274669
|
+
const namedImports = typeData.filter((td3) => !td3.isDefault);
|
|
274670
|
+
const namedPart = namedImports.sort(sortImportNames).map((td3) => {
|
|
274671
|
+
if (td3.originalName === "") {
|
|
274672
|
+
return `${td3.localName}`;
|
|
274673
|
+
} else if (td3.originalName === td3.importName) {
|
|
274674
|
+
return `${td3.originalName}`;
|
|
274675
|
+
} else {
|
|
274676
|
+
return `${td3.originalName} as ${td3.importName}`;
|
|
274677
|
+
}
|
|
274678
|
+
}).join(`, `);
|
|
274679
|
+
imports.push(`import ${defaultImport.importName}, { ${namedPart} } from "${importFilePath}";`);
|
|
274680
|
+
exports2.push(`export { default as ${defaultImport.importName}, ${namedPart} } from "${importFilePath}";`);
|
|
274681
|
+
} else {
|
|
274682
|
+
const namedPart = typeData.sort(sortImportNames).map((td3) => {
|
|
274683
|
+
if (td3.originalName === "") {
|
|
274684
|
+
return `${td3.localName}`;
|
|
274685
|
+
} else if (td3.originalName === td3.importName) {
|
|
274686
|
+
return `${td3.originalName}`;
|
|
274687
|
+
} else {
|
|
274688
|
+
return `${td3.originalName} as ${td3.importName}`;
|
|
274689
|
+
}
|
|
274690
|
+
}).join(`, `);
|
|
274691
|
+
imports.push(`import { ${namedPart} } from "${importFilePath}";`);
|
|
274692
|
+
exports2.push(`export { ${namedPart} } from "${importFilePath}";`);
|
|
274693
|
+
}
|
|
274561
274694
|
});
|
|
274562
|
-
c.push(...
|
|
274695
|
+
c.push(...imports, ...exports2);
|
|
274563
274696
|
c.push(`export namespace Components {`);
|
|
274564
274697
|
c.push(...modules.map((m) => `${m.component}`));
|
|
274565
274698
|
c.push(`}`);
|
|
@@ -278697,7 +278830,7 @@ var runTsProgram = async (config, compilerCtx, buildCtx, tsBuilder) => {
|
|
|
278697
278830
|
buildCtx.diagnostics.push(...tsGlobal);
|
|
278698
278831
|
buildCtx.diagnostics.push(...tsOptions);
|
|
278699
278832
|
if (buildCtx.hasError) {
|
|
278700
|
-
return
|
|
278833
|
+
return [];
|
|
278701
278834
|
}
|
|
278702
278835
|
const tsProgram = tsBuilder.getProgram();
|
|
278703
278836
|
const tsTypeChecker = tsProgram.getTypeChecker();
|
|
@@ -278754,7 +278887,32 @@ var runTsProgram = async (config, compilerCtx, buildCtx, tsBuilder) => {
|
|
|
278754
278887
|
resolveComponentDependencies(buildCtx.components);
|
|
278755
278888
|
validateTranspiledComponents(config, buildCtx);
|
|
278756
278889
|
if (buildCtx.hasError) {
|
|
278757
|
-
return
|
|
278890
|
+
return [];
|
|
278891
|
+
}
|
|
278892
|
+
return emittedDts;
|
|
278893
|
+
};
|
|
278894
|
+
var validateTypesAfterGeneration = async (config, compilerCtx, buildCtx, tsBuilder, emittedDts) => {
|
|
278895
|
+
const tsProgram = tsBuilder.getProgram();
|
|
278896
|
+
const typesOutputTarget = config.outputTargets.filter(isOutputTargetDistTypes);
|
|
278897
|
+
const componentsDtsPath = join(config.srcDir, "components.d.ts");
|
|
278898
|
+
const componentsDtsExists = await compilerCtx.fs.access(componentsDtsPath);
|
|
278899
|
+
if (config.validateTypes && componentsDtsExists) {
|
|
278900
|
+
const sourceFiles = tsProgram.getSourceFiles().filter((sf) => {
|
|
278901
|
+
const fileName = normalizePath(sf.fileName);
|
|
278902
|
+
return !fileName.includes("node_modules") && !fileName.endsWith(".d.ts") && fileName.startsWith(normalizePath(config.srcDir));
|
|
278903
|
+
});
|
|
278904
|
+
for (const sourceFile of sourceFiles) {
|
|
278905
|
+
const sourceSemanticDiagnostics = tsProgram.getSemanticDiagnostics(sourceFile);
|
|
278906
|
+
const tsSemantic = loadTypeScriptDiagnostics(sourceSemanticDiagnostics);
|
|
278907
|
+
if (config.devMode) {
|
|
278908
|
+
tsSemantic.forEach((semanticDiagnostic) => {
|
|
278909
|
+
if (semanticDiagnostic.code === "6133" || semanticDiagnostic.code === "6192") {
|
|
278910
|
+
semanticDiagnostic.level = "warn";
|
|
278911
|
+
}
|
|
278912
|
+
});
|
|
278913
|
+
}
|
|
278914
|
+
buildCtx.diagnostics.push(...tsSemantic);
|
|
278915
|
+
}
|
|
278758
278916
|
}
|
|
278759
278917
|
const hasTypesChanged = await generateAppTypes(config, compilerCtx, buildCtx, "src");
|
|
278760
278918
|
if (typesOutputTarget.length > 0) {
|
|
@@ -278771,17 +278929,6 @@ var runTsProgram = async (config, compilerCtx, buildCtx, tsBuilder) => {
|
|
|
278771
278929
|
});
|
|
278772
278930
|
await Promise.all(srcRootDtsFiles);
|
|
278773
278931
|
}
|
|
278774
|
-
if (config.validateTypes && !hasTypesChanged) {
|
|
278775
|
-
const tsSemantic = loadTypeScriptDiagnostics(tsBuilder.getSemanticDiagnostics());
|
|
278776
|
-
if (config.devMode) {
|
|
278777
|
-
tsSemantic.forEach((semanticDiagnostic) => {
|
|
278778
|
-
if (semanticDiagnostic.code === "6133" || semanticDiagnostic.code === "6192") {
|
|
278779
|
-
semanticDiagnostic.level = "warn";
|
|
278780
|
-
}
|
|
278781
|
-
});
|
|
278782
|
-
}
|
|
278783
|
-
buildCtx.diagnostics.push(...tsSemantic);
|
|
278784
|
-
}
|
|
278785
278932
|
return hasTypesChanged;
|
|
278786
278933
|
};
|
|
278787
278934
|
var getRelativeDts = (config, srcPath, emitDtsPath) => {
|
|
@@ -279681,9 +279828,17 @@ var build2 = async (config, compilerCtx, buildCtx, tsBuilder) => {
|
|
|
279681
279828
|
await readPackageJson(config, compilerCtx, buildCtx);
|
|
279682
279829
|
if (buildCtx.hasError) return buildAbort(buildCtx);
|
|
279683
279830
|
const tsTimeSpan = buildCtx.createTimeSpan("transpile started");
|
|
279684
|
-
const
|
|
279831
|
+
const emittedDts = await runTsProgram(config, compilerCtx, buildCtx, tsBuilder);
|
|
279685
279832
|
tsTimeSpan.finish("transpile finished");
|
|
279686
279833
|
if (buildCtx.hasError) return buildAbort(buildCtx);
|
|
279834
|
+
const componentDtsChanged = await validateTypesAfterGeneration(
|
|
279835
|
+
config,
|
|
279836
|
+
compilerCtx,
|
|
279837
|
+
buildCtx,
|
|
279838
|
+
tsBuilder,
|
|
279839
|
+
emittedDts
|
|
279840
|
+
);
|
|
279841
|
+
if (buildCtx.hasError) return buildAbort(buildCtx);
|
|
279687
279842
|
if (config.watch && componentDtsChanged) {
|
|
279688
279843
|
return null;
|
|
279689
279844
|
}
|
|
@@ -280251,11 +280406,14 @@ var Cache = class {
|
|
|
280251
280406
|
constructor(config, cacheFs) {
|
|
280252
280407
|
this.config = config;
|
|
280253
280408
|
this.cacheFs = cacheFs;
|
|
280254
|
-
this.failed = 0;
|
|
280255
|
-
this.skip = false;
|
|
280256
280409
|
this.sys = config.sys;
|
|
280257
280410
|
this.logger = config.logger;
|
|
280258
280411
|
}
|
|
280412
|
+
failed = 0;
|
|
280413
|
+
skip = false;
|
|
280414
|
+
sys;
|
|
280415
|
+
logger;
|
|
280416
|
+
buildCacheDir;
|
|
280259
280417
|
async initCacheDir() {
|
|
280260
280418
|
if (this.config._isTesting || !this.config.cacheDir) {
|
|
280261
280419
|
return;
|
|
@@ -281606,6 +281764,10 @@ var parseCss = (css, filePath) => {
|
|
|
281606
281764
|
});
|
|
281607
281765
|
};
|
|
281608
281766
|
class ParsePosition {
|
|
281767
|
+
start;
|
|
281768
|
+
end;
|
|
281769
|
+
source;
|
|
281770
|
+
content;
|
|
281609
281771
|
constructor(start) {
|
|
281610
281772
|
this.start = start;
|
|
281611
281773
|
this.end = { line: lineno, column };
|
|
@@ -282901,7 +283063,7 @@ var transformCssToEsmModule = (input) => {
|
|
|
282901
283063
|
};
|
|
282902
283064
|
var generateTransformCssToEsm = (input, results) => {
|
|
282903
283065
|
const s = new MagicString("");
|
|
282904
|
-
results.styleText = results.styleText.replace(
|
|
283066
|
+
results.styleText = results.styleText.replace(/\n/g, " ").replace(/\r/g, " ").replace(/\t/g, " ").replace(/`/g, "\\`").replace(/\u000c/g, "\\f").replace(/\u0008/g, "\\b").replace(/\u000b/g, "\\v").replace(/\0/g, "\\0").replace(/\\/g, "\\\\");
|
|
282905
283067
|
if (input.addTagTransformers) {
|
|
282906
283068
|
results.styleText = addTagTransformToCssString(results.styleText, input.tags);
|
|
282907
283069
|
}
|