@stencil/core 5.0.0-alpha.5 → 5.0.0-alpha.6
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/{client-Dnio47yQ.mjs → client-fWOou5EW.mjs} +2324 -2125
- package/dist/compiler/index.d.mts +5 -5
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +2 -2
- package/dist/compiler/utils/index.mjs +3 -3
- package/dist/{compiler-Dxri2g8Z.mjs → compiler-CdUbDTbV.mjs} +13329 -12670
- package/dist/declarations/stencil-public-compiler.d.ts +254 -121
- package/dist/declarations/stencil-public-docs.d.ts +10 -0
- package/dist/declarations/stencil-public-runtime.d.ts +49 -12
- package/dist/{index-D5zaocDq.d.mts → index-D8vvsppY.d.mts} +228 -180
- package/dist/{index-D61XZw0f.d.ts → index-Dap2E02-.d.ts} +82 -31
- package/dist/{index-Dat4djoo.d.mts → index-UUlemGuu.d.mts} +13 -2
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.d.mts +18 -0
- package/dist/jsx-runtime.mjs +2 -0
- package/dist/{node-pj6rF4Wt.mjs → node-klLZLdDe.mjs} +59 -55
- package/dist/{regular-expression-D0_N0PGa.mjs → regular-expression-DUdhF3Ei.mjs} +72 -6
- package/dist/runtime/app-data/index.d.ts +1 -1
- package/dist/runtime/app-data/index.js +15 -9
- package/dist/{runtime-CKyUrF4i.js → runtime/client/lazy.js} +2539 -2199
- package/dist/runtime/client/{index.d.ts → runtime.d.ts} +49 -40
- package/dist/runtime/client/{index.js → runtime.js} +2401 -2185
- package/dist/runtime/index.d.ts +20 -3
- package/dist/runtime/index.js +4956 -2
- package/dist/runtime/server/index.d.mts +30 -39
- package/dist/runtime/server/index.mjs +2369 -2185
- package/dist/runtime/server/runner.d.mts +4 -6
- package/dist/runtime/server/runner.mjs +307 -361
- package/dist/signals/index.d.ts +47 -0
- package/dist/signals/index.js +199 -0
- 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 +97 -3
- package/dist/testing/index.mjs +199 -47
- package/dist/{validation-BA8nzXu_.mjs → validation-2QipI30K.mjs} +21 -32
- package/package.json +41 -27
- package/dist/index-D-XN9HW_.d.ts +0 -30
- package/dist/jsx-runtime-B3vQbWIW.d.ts +0 -28
- package/dist/jsx-runtime.d.ts +0 -2
- package/dist/jsx-runtime.js +0 -2
- /package/dist/{chunk-CjcI7cDX.mjs → chunk-z9aeyW2b.mjs} +0 -0
package/dist/testing/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _ as getBuildFeatures, c as createWorkerContext, g as BuildContext, h as Cache, i as createSystem, p as createInMemoryFs } from "../compiler-
|
|
4
|
-
import {
|
|
5
|
-
import { o as buildEvents } from "../node-
|
|
6
|
-
import
|
|
7
|
-
import path from "path";
|
|
1
|
+
import { C as setAssetPath, S as getAssetPath, U as BUILD, W as Env, _ as getRenderingRef, b as getElement, c as Mixin, d as getMode, g as forceUpdate, h, k as reWireGetterSetter, l as Fragment, m as Host, t as insertVdomAnnotations, u as bootstrapLazy, v as renderVdom, y as createEvent } from "../client-fWOou5EW.mjs";
|
|
2
|
+
import { I as EVENT_FLAGS, h as noop, w as CMP_FLAGS } from "../regular-expression-DUdhF3Ei.mjs";
|
|
3
|
+
import { _ as getBuildFeatures, c as createWorkerContext, g as BuildContext, h as Cache, i as createSystem, o as loadConfig, p as createInMemoryFs, s as createCompiler } from "../compiler-CdUbDTbV.mjs";
|
|
4
|
+
import { wt as formatLazyBundleRuntimeMeta } from "../validation-2QipI30K.mjs";
|
|
5
|
+
import { o as buildEvents } from "../node-klLZLdDe.mjs";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import path$1 from "path";
|
|
8
10
|
import { MockWindow, setupGlobal } from "@stencil/mock-doc";
|
|
9
11
|
import { createHash } from "crypto";
|
|
10
12
|
import { afterAll, vi } from "vitest";
|
|
@@ -86,7 +88,7 @@ const createTestingSystem = () => {
|
|
|
86
88
|
let diskReads = 0;
|
|
87
89
|
let diskWrites = 0;
|
|
88
90
|
const sys = createSystem();
|
|
89
|
-
sys.platformPath = path;
|
|
91
|
+
sys.platformPath = path$1;
|
|
90
92
|
sys.generateContentHash = (content, length) => {
|
|
91
93
|
let hash = createHash("sha1").update(content).digest("hex").toLowerCase();
|
|
92
94
|
if (typeof length === "number") hash = hash.slice(0, length);
|
|
@@ -223,6 +225,7 @@ const mockComponentMeta = (overrides = {}) => ({
|
|
|
223
225
|
hasVdomStyle: false,
|
|
224
226
|
hasVdomText: false,
|
|
225
227
|
hasVdomXlink: false,
|
|
228
|
+
hasSignalsImport: false,
|
|
226
229
|
hasWatchCallback: false,
|
|
227
230
|
htmlAttrNames: [],
|
|
228
231
|
htmlParts: [],
|
|
@@ -246,6 +249,7 @@ const mockComponentMeta = (overrides = {}) => ({
|
|
|
246
249
|
states: [],
|
|
247
250
|
styleDocs: [],
|
|
248
251
|
styles: [],
|
|
252
|
+
globalStyles: [],
|
|
249
253
|
tagName: "stub-cmp",
|
|
250
254
|
virtualProperties: [],
|
|
251
255
|
watchers: [],
|
|
@@ -260,7 +264,7 @@ const mockComponentMeta = (overrides = {}) => ({
|
|
|
260
264
|
*/
|
|
261
265
|
function mockValidatedConfig(overrides = {}) {
|
|
262
266
|
const baseConfig = mockConfig(overrides);
|
|
263
|
-
const rootDir =
|
|
267
|
+
const rootDir = path.resolve("/");
|
|
264
268
|
return {
|
|
265
269
|
...baseConfig,
|
|
266
270
|
cacheDir: ".stencil",
|
|
@@ -268,8 +272,6 @@ function mockValidatedConfig(overrides = {}) {
|
|
|
268
272
|
devServer: {},
|
|
269
273
|
extras: {},
|
|
270
274
|
fsNamespace: "testing",
|
|
271
|
-
hashFileNames: false,
|
|
272
|
-
hashedFileNameLength: 8,
|
|
273
275
|
hydratedFlag: null,
|
|
274
276
|
logLevel: "info",
|
|
275
277
|
logger: mockLogger(),
|
|
@@ -277,7 +279,7 @@ function mockValidatedConfig(overrides = {}) {
|
|
|
277
279
|
minifyJs: false,
|
|
278
280
|
namespace: "Testing",
|
|
279
281
|
outputTargets: baseConfig.outputTargets ?? [],
|
|
280
|
-
packageJsonFilePath:
|
|
282
|
+
packageJsonFilePath: path.join(rootDir, "package.json"),
|
|
281
283
|
rootDir,
|
|
282
284
|
sourceMap: true,
|
|
283
285
|
srcDir: "/src",
|
|
@@ -285,10 +287,7 @@ function mockValidatedConfig(overrides = {}) {
|
|
|
285
287
|
suppressReservedPublicNameWarnings: false,
|
|
286
288
|
sys: createTestingSystem(),
|
|
287
289
|
transformAliasedImportPaths: true,
|
|
288
|
-
rolldownConfig: {
|
|
289
|
-
inputOptions: {},
|
|
290
|
-
outputOptions: {}
|
|
291
|
-
},
|
|
290
|
+
rolldownConfig: {},
|
|
292
291
|
...overrides
|
|
293
292
|
};
|
|
294
293
|
}
|
|
@@ -300,7 +299,7 @@ function mockValidatedConfig(overrides = {}) {
|
|
|
300
299
|
* @returns the mock Stencil configuration
|
|
301
300
|
*/
|
|
302
301
|
function mockConfig(overrides = {}) {
|
|
303
|
-
const rootDir =
|
|
302
|
+
const rootDir = path.resolve("/");
|
|
304
303
|
let { sys } = overrides;
|
|
305
304
|
if (!sys) sys = createTestingSystem();
|
|
306
305
|
sys.getCurrentDirectory = () => rootDir;
|
|
@@ -312,7 +311,6 @@ function mockConfig(overrides = {}) {
|
|
|
312
311
|
enableCache: false,
|
|
313
312
|
extras: {},
|
|
314
313
|
globalScript: null,
|
|
315
|
-
hashFileNames: false,
|
|
316
314
|
logger: new TestingLogger(),
|
|
317
315
|
maxConcurrentWorkers: 0,
|
|
318
316
|
minifyCss: false,
|
|
@@ -478,9 +476,173 @@ const mockModule = (mod = {}) => ({
|
|
|
478
476
|
hasVdomStyle: false,
|
|
479
477
|
hasVdomText: false,
|
|
480
478
|
hasVdomXlink: false,
|
|
479
|
+
hasSignalsImport: false,
|
|
481
480
|
...mod
|
|
482
481
|
});
|
|
483
482
|
//#endregion
|
|
483
|
+
//#region src/testing/create-test-compiler.ts
|
|
484
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
485
|
+
const TESTING_TSCONFIG = path.resolve(__dirname, "fixtures/tsconfig.testing.json");
|
|
486
|
+
/**
|
|
487
|
+
* Builds a patched sys that falls through to real disk for TypeScript lib files.
|
|
488
|
+
*
|
|
489
|
+
* @returns A compiler system instance with patched readFileSync, readFile, accessSync, and statSync methods
|
|
490
|
+
*/
|
|
491
|
+
const createPatchedSys = () => {
|
|
492
|
+
const sys = mockCompilerSystem();
|
|
493
|
+
const originalReadFileSync = sys.readFileSync.bind(sys);
|
|
494
|
+
sys.readFileSync = (p) => {
|
|
495
|
+
const mem = originalReadFileSync(p);
|
|
496
|
+
if (mem !== void 0) return mem;
|
|
497
|
+
try {
|
|
498
|
+
return fs.readFileSync(p, "utf-8");
|
|
499
|
+
} catch {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
const originalReadFile = sys.readFile.bind(sys);
|
|
504
|
+
sys.readFile = async (p) => {
|
|
505
|
+
const mem = await originalReadFile(p);
|
|
506
|
+
if (mem !== void 0) return mem;
|
|
507
|
+
try {
|
|
508
|
+
return fs.readFileSync(p, "utf-8");
|
|
509
|
+
} catch {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
const originalAccessSync = sys.accessSync.bind(sys);
|
|
514
|
+
sys.accessSync = (p) => {
|
|
515
|
+
if (originalAccessSync(p)) return true;
|
|
516
|
+
try {
|
|
517
|
+
fs.accessSync(p);
|
|
518
|
+
return true;
|
|
519
|
+
} catch {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
const originalStatSync = sys.statSync.bind(sys);
|
|
524
|
+
sys.statSync = (p) => {
|
|
525
|
+
const mem = originalStatSync(p);
|
|
526
|
+
if (!mem.error) return mem;
|
|
527
|
+
try {
|
|
528
|
+
const s = fs.statSync(p);
|
|
529
|
+
return {
|
|
530
|
+
isDirectory: s.isDirectory(),
|
|
531
|
+
isFile: s.isFile(),
|
|
532
|
+
isSymbolicLink: s.isSymbolicLink(),
|
|
533
|
+
size: s.size,
|
|
534
|
+
error: null
|
|
535
|
+
};
|
|
536
|
+
} catch {
|
|
537
|
+
return mem;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
sys.getCompilerExecutingPath = () => path.resolve(__dirname, "../../dist/compiler/index.mjs");
|
|
541
|
+
return sys;
|
|
542
|
+
};
|
|
543
|
+
/**
|
|
544
|
+
* Runs the expensive one-time setup for a test compiler suite: patching the
|
|
545
|
+
* sys, reading and validating the tsconfig. Use this in a `beforeAll` block
|
|
546
|
+
* when a describe block contains multiple tests that each need a fresh
|
|
547
|
+
* compiler, to avoid repeating `loadConfig` on every test.
|
|
548
|
+
*
|
|
549
|
+
* @param options - Configuration options for preparing the test compiler
|
|
550
|
+
* @returns A {@link PreparedTestCompiler} that can be passed to {@link createTestCompiler}
|
|
551
|
+
*
|
|
552
|
+
* @example
|
|
553
|
+
* ```ts
|
|
554
|
+
* let setup: PreparedTestCompiler;
|
|
555
|
+
* beforeAll(async () => { setup = await prepareTestCompiler(); });
|
|
556
|
+
* beforeEach(async () => {
|
|
557
|
+
* const { compiler } = await createTestCompiler({ setup });
|
|
558
|
+
* });
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
const prepareTestCompiler = async (options = {}) => {
|
|
562
|
+
const sys = createPatchedSys();
|
|
563
|
+
const tsconfigPath = options.tsconfig ?? TESTING_TSCONFIG;
|
|
564
|
+
const { config: validatedConfig } = await loadConfig({
|
|
565
|
+
sys,
|
|
566
|
+
config: {
|
|
567
|
+
devMode: true,
|
|
568
|
+
sourceMap: false,
|
|
569
|
+
enableCache: false,
|
|
570
|
+
minifyJs: false,
|
|
571
|
+
minifyCss: false,
|
|
572
|
+
namespace: "Testing",
|
|
573
|
+
tsconfig: tsconfigPath,
|
|
574
|
+
...options.config
|
|
575
|
+
},
|
|
576
|
+
initTsConfig: false
|
|
577
|
+
});
|
|
578
|
+
return {
|
|
579
|
+
_validatedConfig: validatedConfig,
|
|
580
|
+
_tsconfigPath: tsconfigPath
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Creates a test compiler instance with a hybrid filesystem (reads from disk, writes to memory).
|
|
585
|
+
* This utility handles the common setup pattern for compiler tests.
|
|
586
|
+
*
|
|
587
|
+
* When multiple tests in the same suite need independent compiler instances,
|
|
588
|
+
* pass a {@link PreparedTestCompiler} from {@link prepareTestCompiler} as
|
|
589
|
+
* `options.setup` to skip the expensive `loadConfig` step on each test.
|
|
590
|
+
*
|
|
591
|
+
* @param options - Configuration options for the test compiler
|
|
592
|
+
* @returns An object with the compiler, validated config, and system instance
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
* ```ts
|
|
596
|
+
* const { compiler, config } = await createTestCompiler({
|
|
597
|
+
* config: { minifyCss: true }
|
|
598
|
+
* });
|
|
599
|
+
* await compiler.fs.writeFile('/src/index.html', '<cmp-a></cmp-a>');
|
|
600
|
+
* const result = await compiler.build();
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
const createTestCompiler = async (options = {}) => {
|
|
604
|
+
let validatedConfig;
|
|
605
|
+
let tsconfigPath;
|
|
606
|
+
if (options.setup) {
|
|
607
|
+
const freshSys = createPatchedSys();
|
|
608
|
+
validatedConfig = {
|
|
609
|
+
...options.setup._validatedConfig,
|
|
610
|
+
sys: freshSys
|
|
611
|
+
};
|
|
612
|
+
tsconfigPath = options.setup._tsconfigPath;
|
|
613
|
+
} else {
|
|
614
|
+
const sys = createPatchedSys();
|
|
615
|
+
tsconfigPath = options.tsconfig ?? TESTING_TSCONFIG;
|
|
616
|
+
const { config } = await loadConfig({
|
|
617
|
+
sys,
|
|
618
|
+
config: {
|
|
619
|
+
devMode: true,
|
|
620
|
+
sourceMap: false,
|
|
621
|
+
enableCache: false,
|
|
622
|
+
minifyJs: false,
|
|
623
|
+
minifyCss: false,
|
|
624
|
+
namespace: "Testing",
|
|
625
|
+
tsconfig: tsconfigPath,
|
|
626
|
+
...options.config
|
|
627
|
+
},
|
|
628
|
+
initTsConfig: false
|
|
629
|
+
});
|
|
630
|
+
validatedConfig = config;
|
|
631
|
+
}
|
|
632
|
+
const compiler = await createCompiler(validatedConfig);
|
|
633
|
+
const tsconfigObj = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
|
|
634
|
+
await compiler.fs.writeFile(tsconfigPath, JSON.stringify({
|
|
635
|
+
...tsconfigObj,
|
|
636
|
+
include: [validatedConfig.srcDir]
|
|
637
|
+
}));
|
|
638
|
+
await compiler.fs.writeFile(path.join(validatedConfig.srcDir, "components.d.ts"), "");
|
|
639
|
+
return {
|
|
640
|
+
compiler,
|
|
641
|
+
config: validatedConfig,
|
|
642
|
+
sys: validatedConfig.sys
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
//#endregion
|
|
484
646
|
//#region src/testing/platform/testing-constants.ts
|
|
485
647
|
const styles = /* @__PURE__ */ new Map();
|
|
486
648
|
const modeResolutionChain = [];
|
|
@@ -516,7 +678,7 @@ const Build = {
|
|
|
516
678
|
* @returns the corresponding Stencil reference data structure, or undefined if one cannot be found
|
|
517
679
|
*/
|
|
518
680
|
const getHostRef = (elm) => {
|
|
519
|
-
if (elm.
|
|
681
|
+
if (elm.__s_ghr) return elm.__s_ghr();
|
|
520
682
|
};
|
|
521
683
|
/**
|
|
522
684
|
* Add the provided `hostRef` instance to the global {@link hostRefs} map, using the provided `lazyInstance` as a key.
|
|
@@ -537,7 +699,7 @@ const registerInstance = (lazyInstance, hostRef) => {
|
|
|
537
699
|
});
|
|
538
700
|
hostRef = getHostRef(elm);
|
|
539
701
|
}
|
|
540
|
-
lazyInstance.
|
|
702
|
+
lazyInstance.__s_ghr = () => hostRef;
|
|
541
703
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
542
704
|
if (hostRef.$cmpMeta$?.$flags$ & CMP_FLAGS.hasModernPropertyDecls && (BUILD.state || BUILD.prop)) reWireGetterSetter(lazyInstance, hostRef);
|
|
543
705
|
const Cstr = lazyInstance.constructor;
|
|
@@ -588,7 +750,7 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
588
750
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
589
751
|
elm["s-p"] = [];
|
|
590
752
|
elm["s-rc"] = [];
|
|
591
|
-
elm.
|
|
753
|
+
elm.__s_ghr = () => hostRef;
|
|
592
754
|
};
|
|
593
755
|
const setErrorHandler = (handler) => handler;
|
|
594
756
|
//#endregion
|
|
@@ -728,6 +890,8 @@ function flushLoadModule(bundleId) {
|
|
|
728
890
|
const isVitestEnvironment = typeof process !== "undefined" && process.env?.VITEST;
|
|
729
891
|
const existingWindow = typeof globalThis !== "undefined" && globalThis.window;
|
|
730
892
|
const win = isVitestEnvironment && existingWindow ? existingWindow : setupGlobal(global);
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/testing/platform/testing-platform.ts
|
|
731
895
|
const plt = {
|
|
732
896
|
$flags$: 0,
|
|
733
897
|
$resourcesUrl$: "",
|
|
@@ -738,14 +902,6 @@ const plt = {
|
|
|
738
902
|
ce: (eventName, opts) => new win.CustomEvent(eventName, opts)
|
|
739
903
|
};
|
|
740
904
|
/**
|
|
741
|
-
* Helper function to programmatically set shadow DOM support in testing scenarios.
|
|
742
|
-
*
|
|
743
|
-
* This function modifies the global {@link supportsShadow} variable.
|
|
744
|
-
*
|
|
745
|
-
* @param supports `true` if shadow DOM is supported, `false` otherwise
|
|
746
|
-
*/
|
|
747
|
-
const setSupportsShadowDom = (supports) => {};
|
|
748
|
-
/**
|
|
749
905
|
* Resets global testing variables and collections, so that a new set of tests can be started with a "clean slate".
|
|
750
906
|
*
|
|
751
907
|
* It is expected that this function be called between spec tests, and should be automatically configured by Stencil to
|
|
@@ -861,13 +1017,13 @@ function resetBuildConditionals(b) {
|
|
|
861
1017
|
b.hydratedAttribute = false;
|
|
862
1018
|
b.hydratedClass = true;
|
|
863
1019
|
b.invisiblePrehydration = true;
|
|
864
|
-
b.
|
|
865
|
-
b.
|
|
1020
|
+
b.staticHydrationStyles = false;
|
|
1021
|
+
b.lightDomPatches = false;
|
|
1022
|
+
b.slotChildNodes = false;
|
|
1023
|
+
b.slotCloneNode = false;
|
|
1024
|
+
b.slotDomMutations = false;
|
|
1025
|
+
b.slotTextContent = false;
|
|
866
1026
|
b.hotModuleReplacement = false;
|
|
867
|
-
b.scopedSlotTextContentFix = false;
|
|
868
|
-
b.slotChildNodesFix = false;
|
|
869
|
-
b.experimentalSlotFixes = false;
|
|
870
|
-
b.experimentalScopedSlotChanges = false;
|
|
871
1027
|
}
|
|
872
1028
|
//#endregion
|
|
873
1029
|
//#region src/testing/spec-page.ts
|
|
@@ -887,14 +1043,8 @@ async function newSpecPage(opts) {
|
|
|
887
1043
|
resetBuildConditionals(BUILD);
|
|
888
1044
|
if (Array.isArray(opts.components)) registerComponents(opts.components);
|
|
889
1045
|
if (opts.hydrateClientSide) opts.includeAnnotations = true;
|
|
890
|
-
if (opts.hydrateServerSide)
|
|
891
|
-
|
|
892
|
-
setSupportsShadowDom(false);
|
|
893
|
-
} else {
|
|
894
|
-
opts.includeAnnotations = !!opts.includeAnnotations;
|
|
895
|
-
if (opts.supportsShadowDom === false) setSupportsShadowDom(false);
|
|
896
|
-
else setSupportsShadowDom(true);
|
|
897
|
-
}
|
|
1046
|
+
if (opts.hydrateServerSide) opts.includeAnnotations = true;
|
|
1047
|
+
else opts.includeAnnotations = !!opts.includeAnnotations;
|
|
898
1048
|
BUILD.cssAnnotations = opts.includeAnnotations;
|
|
899
1049
|
const cmpTags = /* @__PURE__ */ new Set();
|
|
900
1050
|
win["__stencil_spec_options"] = opts;
|
|
@@ -948,9 +1098,8 @@ async function newSpecPage(opts) {
|
|
|
948
1098
|
BUILD.hydrateServerSide = true;
|
|
949
1099
|
BUILD.hydrateClientSide = false;
|
|
950
1100
|
}
|
|
951
|
-
BUILD.
|
|
952
|
-
|
|
953
|
-
BUILD.attachStyles = !!opts.attachStyles;
|
|
1101
|
+
BUILD.slotCloneNode = false;
|
|
1102
|
+
if (opts.buildFlags) Object.assign(BUILD, opts.buildFlags);
|
|
954
1103
|
if (typeof opts.url === "string") page.win.location.href = opts.url;
|
|
955
1104
|
if (typeof opts.direction === "string") page.doc.documentElement.setAttribute("dir", opts.direction);
|
|
956
1105
|
if (typeof opts.language === "string") page.doc.documentElement.setAttribute("lang", opts.language);
|
|
@@ -963,6 +1112,9 @@ async function newSpecPage(opts) {
|
|
|
963
1112
|
if (typeof opts.userAgent === "string") try {
|
|
964
1113
|
page.win.navigator.userAgent = opts.userAgent;
|
|
965
1114
|
} catch {}
|
|
1115
|
+
if (opts.hydrateServerSide && opts.serializeShadowRoot === "scoped") {
|
|
1116
|
+
for (const [, cmps] of lazyBundles) for (const cmp of cmps) if (cmp[0] & CMP_FLAGS.shadowDomEncapsulation) cmp[0] |= CMP_FLAGS.shadowNeedsScopedCss;
|
|
1117
|
+
}
|
|
966
1118
|
bootstrapLazy(lazyBundles);
|
|
967
1119
|
if (typeof opts.template === "function") renderVdom({
|
|
968
1120
|
$ancestorComponent$: void 0,
|
|
@@ -1168,4 +1320,4 @@ function setupConsoleMocker() {
|
|
|
1168
1320
|
};
|
|
1169
1321
|
}
|
|
1170
1322
|
//#endregion
|
|
1171
|
-
export { Build, Env, Fragment, Host, Mixin, createEvent, createTestingSystem, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, h, mockBuildCtx, mockCompilerCtx, mockCompilerSystem, mockComponentMeta, mockConfig, mockDocument, mockLoadConfigInit, mockLogger, mockModule, mockValidatedConfig, mockWindow, newSpecPage, readTask, registerHost, registerInstance, setAssetPath, setErrorHandler, setMode, setupConsoleMocker, shuffleArray, writeTask };
|
|
1323
|
+
export { Build, Env, Fragment, Host, Mixin, createEvent, createTestCompiler, createTestingSystem, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, h, mockBuildCtx, mockCompilerCtx, mockCompilerSystem, mockComponentMeta, mockConfig, mockDocument, mockLoadConfigInit, mockLogger, mockModule, mockValidatedConfig, mockWindow, newSpecPage, prepareTestCompiler, readTask, registerHost, registerInstance, setAssetPath, setErrorHandler, setMode, setupConsoleMocker, shuffleArray, writeTask };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { t as __exportAll } from "./chunk-z9aeyW2b.mjs";
|
|
2
|
+
import { $ as WATCH_FLAGS, A as DIST_LAZY, C as ASSETS, D as COPY, F as DOCS_VSCODE, H as LOADER_BUNDLE, J as STATS, K as SSR_WASM, L as GENERATED_DTS, M as DOCS_CUSTOM_ELEMENTS_MANIFEST, N as DOCS_JSON, O as CUSTOM, P as DOCS_README, Q as VALID_CONFIG_OUTPUT_TARGETS, R as GLOBAL_STYLE, U as MEMBER_FLAGS, V as LISTENER_FLAGS, Y as STENCIL_REBUNDLE, Z as TYPES, _ as sortBy, b as toTitleCase, i as flatOne, j as DOCS_CUSTOM, n as dashToPascalCase, p as isString, q as STANDALONE, r as escapeWithPattern, u as isIterable, w as CMP_FLAGS, y as toDashCase } from "./regular-expression-DUdhF3Ei.mjs";
|
|
3
|
+
import path, { basename, dirname, relative } from "node:path";
|
|
4
4
|
import picomatch from "picomatch";
|
|
5
5
|
//#region src/utils/byte-size.ts
|
|
6
6
|
/**
|
|
@@ -486,6 +486,7 @@ const escapeHtml = (unsafe) => {
|
|
|
486
486
|
};
|
|
487
487
|
//#endregion
|
|
488
488
|
//#region src/utils/logger/logger-rolldown.ts
|
|
489
|
+
const isRolldownError = (e) => typeof e === "object" && e !== null && "message" in e;
|
|
489
490
|
const loadRolldownDiagnostics = (config, compilerCtx, buildCtx, rolldownError) => {
|
|
490
491
|
const formattedCode = formatErrorCode(rolldownError.code);
|
|
491
492
|
const diagnostic = {
|
|
@@ -661,15 +662,15 @@ const getRootLength = (path) => {
|
|
|
661
662
|
const getEncodedRootLength = (path) => {
|
|
662
663
|
if (!path) return 0;
|
|
663
664
|
const ch0 = path.charCodeAt(0);
|
|
664
|
-
if (ch0 ===
|
|
665
|
+
if (ch0 === 47 || ch0 === 92) {
|
|
665
666
|
if (path.charCodeAt(1) !== ch0) return 1;
|
|
666
|
-
const p1 = path.indexOf(ch0 ===
|
|
667
|
+
const p1 = path.indexOf(ch0 === 47 ? "/" : altDirectorySeparator, 2);
|
|
667
668
|
if (p1 < 0) return path.length;
|
|
668
669
|
return p1 + 1;
|
|
669
670
|
}
|
|
670
|
-
if (isVolumeCharacter(ch0) && path.charCodeAt(1) ===
|
|
671
|
+
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === 58) {
|
|
671
672
|
const ch2 = path.charCodeAt(2);
|
|
672
|
-
if (ch2 ===
|
|
673
|
+
if (ch2 === 47 || ch2 === 92) return 3;
|
|
673
674
|
if (path.length === 2) return 2;
|
|
674
675
|
}
|
|
675
676
|
const schemeEnd = path.indexOf(urlSchemeSeparator);
|
|
@@ -682,7 +683,7 @@ const getEncodedRootLength = (path) => {
|
|
|
682
683
|
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
|
|
683
684
|
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
|
|
684
685
|
if (volumeSeparatorEnd !== -1) {
|
|
685
|
-
if (path.charCodeAt(volumeSeparatorEnd) ===
|
|
686
|
+
if (path.charCodeAt(volumeSeparatorEnd) === 47) return ~(volumeSeparatorEnd + 1);
|
|
686
687
|
if (volumeSeparatorEnd === path.length) return ~volumeSeparatorEnd;
|
|
687
688
|
}
|
|
688
689
|
}
|
|
@@ -692,13 +693,13 @@ const getEncodedRootLength = (path) => {
|
|
|
692
693
|
}
|
|
693
694
|
return 0;
|
|
694
695
|
};
|
|
695
|
-
const isVolumeCharacter = (charCode) => charCode >=
|
|
696
|
+
const isVolumeCharacter = (charCode) => charCode >= 97 && charCode <= 122 || charCode >= 65 && charCode <= 90;
|
|
696
697
|
const getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
697
698
|
const ch0 = url.charCodeAt(start);
|
|
698
|
-
if (ch0 ===
|
|
699
|
-
if (ch0 ===
|
|
699
|
+
if (ch0 === 58) return start + 1;
|
|
700
|
+
if (ch0 === 37 && url.charCodeAt(start + 1) === 51) {
|
|
700
701
|
const ch2 = url.charCodeAt(start + 2);
|
|
701
|
-
if (ch2 ===
|
|
702
|
+
if (ch2 === 97 || ch2 === 65) return start + 3;
|
|
702
703
|
}
|
|
703
704
|
return -1;
|
|
704
705
|
};
|
|
@@ -728,19 +729,6 @@ const normalizeFsPathQuery = (importPath) => {
|
|
|
728
729
|
format: params ? params.get("format") : null
|
|
729
730
|
};
|
|
730
731
|
};
|
|
731
|
-
var CharacterCodes = /* @__PURE__ */ function(CharacterCodes) {
|
|
732
|
-
CharacterCodes[CharacterCodes["a"] = 97] = "a";
|
|
733
|
-
CharacterCodes[CharacterCodes["A"] = 65] = "A";
|
|
734
|
-
CharacterCodes[CharacterCodes["z"] = 122] = "z";
|
|
735
|
-
CharacterCodes[CharacterCodes["Z"] = 90] = "Z";
|
|
736
|
-
CharacterCodes[CharacterCodes["_3"] = 51] = "_3";
|
|
737
|
-
CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash";
|
|
738
|
-
CharacterCodes[CharacterCodes["colon"] = 58] = "colon";
|
|
739
|
-
CharacterCodes[CharacterCodes["dot"] = 46] = "dot";
|
|
740
|
-
CharacterCodes[CharacterCodes["percent"] = 37] = "percent";
|
|
741
|
-
CharacterCodes[CharacterCodes["slash"] = 47] = "slash";
|
|
742
|
-
return CharacterCodes;
|
|
743
|
-
}(CharacterCodes || {});
|
|
744
732
|
/**
|
|
745
733
|
* A wrapped version of node.js' {@link path.relative} which adds our custom
|
|
746
734
|
* normalization logic. This solves the relative path between `from` and `to`!
|
|
@@ -761,7 +749,7 @@ function relative$1(from, to) {
|
|
|
761
749
|
* path. However, our algorithm does differ from that of Node's, as described in this function's JSDoc when a zero
|
|
762
750
|
* length string is encountered.
|
|
763
751
|
*/
|
|
764
|
-
return normalizePath(
|
|
752
|
+
return normalizePath(path.relative(from, to), false);
|
|
765
753
|
}
|
|
766
754
|
/**
|
|
767
755
|
* A wrapped version of node.js' {@link path.join} which adds our custom
|
|
@@ -784,7 +772,7 @@ function join$1(...paths) {
|
|
|
784
772
|
* Note that our algorithm does differ from Node's, as described in this function's JSDoc regarding trailing
|
|
785
773
|
* slashes.
|
|
786
774
|
*/
|
|
787
|
-
return normalizePath(
|
|
775
|
+
return normalizePath(path.join(...paths), false);
|
|
788
776
|
}
|
|
789
777
|
/**
|
|
790
778
|
* A wrapped version of node.js' {@link path.resolve} which adds our custom
|
|
@@ -796,12 +784,12 @@ function join$1(...paths) {
|
|
|
796
784
|
* @param paths a path or path fragments to resolve
|
|
797
785
|
* @returns a resolved path!
|
|
798
786
|
*/
|
|
799
|
-
function resolve(...paths) {
|
|
787
|
+
function resolve$1(...paths) {
|
|
800
788
|
/**
|
|
801
789
|
* When normalizing, we should _not_ attempt to relativize the path returned by the native Node `resolve` method. When
|
|
802
790
|
* calculating the path from each of the string-based parts, Node does not prepend './' to the calculated path.
|
|
803
791
|
*/
|
|
804
|
-
return normalizePath(
|
|
792
|
+
return normalizePath(path.resolve(...paths), false);
|
|
805
793
|
}
|
|
806
794
|
/**
|
|
807
795
|
* A wrapped version of node.js' {@link path.normalize} which adds our custom
|
|
@@ -818,7 +806,7 @@ function normalize(toNormalize) {
|
|
|
818
806
|
* When normalizing, we should _not_ attempt to relativize the path returned by the native Node `normalize` method.
|
|
819
807
|
* When calculating the path from each of the string-based parts, Node does not prepend './' to the calculated path.
|
|
820
808
|
*/
|
|
821
|
-
return normalizePath(
|
|
809
|
+
return normalizePath(path.normalize(toNormalize), false);
|
|
822
810
|
}
|
|
823
811
|
//#endregion
|
|
824
812
|
//#region src/utils/logger/logger-typescript.ts
|
|
@@ -1054,7 +1042,8 @@ const getComponentsDtsTypesFilePath = (typesDir) => join$1(typesDir, GENERATED_D
|
|
|
1054
1042
|
const isOutputTargetLoaderBundle = (o) => o.type === LOADER_BUNDLE;
|
|
1055
1043
|
const isOutputTargetStandalone = (o) => o.type === STANDALONE;
|
|
1056
1044
|
const isOutputTargetSsr = (o) => o.type === "ssr";
|
|
1057
|
-
const
|
|
1045
|
+
const isOutputTargetSsrWasm = (o) => o.type === SSR_WASM;
|
|
1046
|
+
const isOutputTargetCollection = (o) => o.type === STENCIL_REBUNDLE;
|
|
1058
1047
|
const isOutputTargetTypes = (o) => o.type === TYPES;
|
|
1059
1048
|
const isOutputTargetGlobalStyle = (o) => o.type === GLOBAL_STYLE;
|
|
1060
1049
|
const isOutputTargetAssets = (o) => o.type === ASSETS;
|
|
@@ -1466,4 +1455,4 @@ const validateComponentTag = (tag) => {
|
|
|
1466
1455
|
if (tag.lastIndexOf("-") === tag.length - 1) return `"${tag}" tag cannot end with a dash (-)`;
|
|
1467
1456
|
};
|
|
1468
1457
|
//#endregion
|
|
1469
|
-
export {
|
|
1458
|
+
export { loadTypeScriptDiagnostics as $, isOutputTargetCollection as A, isOutputTargetGlobalStyle as B, result_exports as C, formatComponentRuntimeMeta as Ct, getComponentsDtsTypesFilePath as D, getComponentsDtsSrcFilePath as E, byteSize as Et, isOutputTargetDocsCustom as F, isOutputTargetStats as G, isOutputTargetSsr as H, isOutputTargetDocsCustomElementsManifest as I, isValidConfigOutputTarget as J, isOutputTargetTypes as K, isOutputTargetDocsJson as L, isOutputTargetCustom as M, isOutputTargetDistLazy as N, getComponentsFromModules as O, isOutputTargetDocs as P, loadTypeScriptDiagnostic as Q, isOutputTargetDocsReadme as R, ok as S, isGlob as St, filterExcludedComponents as T, stringifyRuntimeData as Tt, isOutputTargetSsrWasm as U, isOutputTargetLoaderBundle as V, isOutputTargetStandalone as W, shouldExcludeComponent as X, relativeImport as Y, augmentDiagnosticWithNode as Z, getSourceMappingUrlForEndOfFile as _, catchError as _t, getTextDocs as a, relative$1 as at, err as b, shouldIgnoreError as bt, isJsFile as c, isRolldownError as ct, isTsxFile as d, normalizeDiagnostics as dt, join$1 as et, parsePackageJson as f, splitLineBreaks as ft, getInlineSourceMappingUrlLinker as g, buildWarn as gt, isRemoteUrl as h, buildJsonFileError as ht, generatePreamble as i, normalizePath as it, isOutputTargetCopy as j, isOutputTargetAssets as k, isJsxFile as l, loadRolldownDiagnostics as lt, readPackageJson as m, buildError as mt, addDocBlock as n, normalizeFsPath as nt, hasDependency as o, resolve$1 as ot, readOnlyArrayHasStringMember as p, TASK_CANCELED_MSG as pt, isOutputTargetWww as q, createJsVarName as r, normalizeFsPathQuery as rt, isDtsFile as s, createOnWarnFn as st, validateComponentTag as t, normalize as tt, isTsFile as u, escapeHtml as ut, getSourceMappingUrlLinker as v, hasError as vt, filterActiveTargets as w, formatLazyBundleRuntimeMeta as wt, map as x, isRootPath as xt, rolldownToStencilSourceMap as y, hasWarning as yt, isOutputTargetDocsVscode as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.6",
|
|
4
4
|
"description": "A Compiler for Web Components and Progressive Web Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -44,18 +44,22 @@
|
|
|
44
44
|
"import": "./dist/compiler/utils/index.mjs"
|
|
45
45
|
},
|
|
46
46
|
"./jsx-runtime": {
|
|
47
|
-
"types": "./dist/jsx-runtime.d.
|
|
48
|
-
"import": "./dist/jsx-runtime.
|
|
47
|
+
"types": "./dist/jsx-runtime.d.mts",
|
|
48
|
+
"import": "./dist/jsx-runtime.mjs"
|
|
49
49
|
},
|
|
50
50
|
"./jsx-dev-runtime": {
|
|
51
|
-
"types": "./dist/jsx-runtime.d.
|
|
52
|
-
"import": "./dist/jsx-runtime.
|
|
51
|
+
"types": "./dist/jsx-runtime.d.mts",
|
|
52
|
+
"import": "./dist/jsx-runtime.mjs"
|
|
53
53
|
},
|
|
54
54
|
"./mock-doc": {
|
|
55
55
|
"types": "./dist/mock-doc.d.mts",
|
|
56
56
|
"import": "./dist/mock-doc.mjs",
|
|
57
57
|
"default": "./dist/mock-doc.mjs"
|
|
58
58
|
},
|
|
59
|
+
"./signals": {
|
|
60
|
+
"types": "./dist/signals/index.d.ts",
|
|
61
|
+
"import": "./dist/signals/index.js"
|
|
62
|
+
},
|
|
59
63
|
"./runtime": {
|
|
60
64
|
"types": "./dist/runtime/index.d.ts",
|
|
61
65
|
"import": "./dist/runtime/index.js"
|
|
@@ -69,8 +73,16 @@
|
|
|
69
73
|
"import": "./dist/runtime/app-globals/index.js"
|
|
70
74
|
},
|
|
71
75
|
"./runtime/client": {
|
|
72
|
-
"types": "./dist/runtime/client/
|
|
73
|
-
"import": "./dist/runtime/client/
|
|
76
|
+
"types": "./dist/runtime/client/runtime.d.ts",
|
|
77
|
+
"import": "./dist/runtime/client/runtime.js"
|
|
78
|
+
},
|
|
79
|
+
"./runtime/client/standalone": {
|
|
80
|
+
"types": "./dist/runtime/client/runtime.d.ts",
|
|
81
|
+
"import": "./dist/runtime/client/runtime.js"
|
|
82
|
+
},
|
|
83
|
+
"./runtime/client/lazy": {
|
|
84
|
+
"types": "./dist/runtime/client/runtime.d.ts",
|
|
85
|
+
"import": "./dist/runtime/client/lazy.js"
|
|
74
86
|
},
|
|
75
87
|
"./runtime/server": {
|
|
76
88
|
"types": "./dist/runtime/server/index.d.mts",
|
|
@@ -90,34 +102,36 @@
|
|
|
90
102
|
}
|
|
91
103
|
},
|
|
92
104
|
"dependencies": {
|
|
93
|
-
"@parcel/watcher": "^2.
|
|
105
|
+
"@parcel/watcher": "^2.0.0",
|
|
106
|
+
"@preact/signals-core": "^1.0.0",
|
|
94
107
|
"@rollup/pluginutils": "^5.3.0",
|
|
95
|
-
"browserslist": "^4.
|
|
96
|
-
"chalk": "^5.
|
|
108
|
+
"browserslist": "^4.0.0",
|
|
109
|
+
"chalk": "^5.0.0",
|
|
97
110
|
"css-what": "^7.0.0",
|
|
98
|
-
"
|
|
111
|
+
"jiti": "^2.0.0",
|
|
112
|
+
"lightningcss": "^1.0.0",
|
|
99
113
|
"magic-string": "^0.30.0",
|
|
100
|
-
"picomatch": "^4.0.
|
|
101
|
-
"postcss": "^8.
|
|
102
|
-
"postcss-safe-parser": "^7.0.
|
|
103
|
-
"postcss-selector-parser": "^7.
|
|
114
|
+
"picomatch": "^4.0.0",
|
|
115
|
+
"postcss": "^8.0.0",
|
|
116
|
+
"postcss-safe-parser": "^7.0.0",
|
|
117
|
+
"postcss-selector-parser": "^7.0.0",
|
|
104
118
|
"resolve": "^1.22.0",
|
|
105
|
-
"rolldown": "^1.0.0
|
|
106
|
-
"semver": "^7.
|
|
107
|
-
"terser": "5.
|
|
108
|
-
"tinyglobby": "^0.2.
|
|
109
|
-
"typescript": ">4.0.0",
|
|
110
|
-
"@stencil/cli": "5.0.0-alpha.
|
|
111
|
-
"@stencil/
|
|
112
|
-
"@stencil/
|
|
119
|
+
"rolldown": "^1.0.0",
|
|
120
|
+
"semver": "^7.0.0",
|
|
121
|
+
"terser": "^5.0.0",
|
|
122
|
+
"tinyglobby": "^0.2.0",
|
|
123
|
+
"typescript": ">4.0.0 <7.0.0",
|
|
124
|
+
"@stencil/cli": "5.0.0-alpha.6",
|
|
125
|
+
"@stencil/mock-doc": "5.0.0-alpha.6",
|
|
126
|
+
"@stencil/dev-server": "5.0.0-alpha.6"
|
|
113
127
|
},
|
|
114
128
|
"devDependencies": {
|
|
115
129
|
"@ionic/prettier-config": "^4.0.0",
|
|
116
|
-
"@stencil/vitest": "^1.
|
|
130
|
+
"@stencil/vitest": "^1.12.1",
|
|
117
131
|
"prettier": "^3.5.0",
|
|
118
|
-
"tsdown": "
|
|
119
|
-
"vitest": "^4.1.
|
|
120
|
-
"vitest-environment-stencil": "^1.
|
|
132
|
+
"tsdown": ">=0.21.0 <1.0.0",
|
|
133
|
+
"vitest": "^4.1.7",
|
|
134
|
+
"vitest-environment-stencil": "^1.12.1"
|
|
121
135
|
},
|
|
122
136
|
"volta": {
|
|
123
137
|
"extends": "../../package.json"
|