@stencil/core 5.0.0-alpha.5 → 5.0.0-alpha.7
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-Dd-NB5Ei.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-BmT_yLHU.mjs} +13458 -12695
- package/dist/declarations/stencil-public-compiler.d.ts +273 -144
- package/dist/declarations/stencil-public-docs.d.ts +10 -0
- package/dist/declarations/stencil-public-runtime.d.ts +49 -12
- package/dist/{index-D61XZw0f.d.ts → index-BuveMLxy.d.ts} +82 -31
- package/dist/{index-D5zaocDq.d.mts → index-CVhWFUM0.d.mts} +249 -204
- package/dist/{index-Dat4djoo.d.mts → index-ch-cf-bZ.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-10UamZmn.mjs} +59 -55
- package/dist/{regular-expression-D0_N0PGa.mjs → regular-expression-CFVJOTUh.mjs} +83 -8
- 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 -50
- package/dist/{validation-BA8nzXu_.mjs → validation-ByxKj8bC.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-Dd-NB5Ei.mjs";
|
|
2
|
+
import { L as EVENT_FLAGS, h as noop, w as CMP_FLAGS } from "../regular-expression-CFVJOTUh.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-BmT_yLHU.mjs";
|
|
4
|
+
import { wt as formatLazyBundleRuntimeMeta } from "../validation-ByxKj8bC.mjs";
|
|
5
|
+
import { o as buildEvents } from "../node-10UamZmn.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,16 +264,14 @@ 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",
|
|
267
271
|
devMode: true,
|
|
268
272
|
devServer: {},
|
|
269
|
-
|
|
273
|
+
compat: {},
|
|
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;
|
|
@@ -310,9 +309,8 @@ function mockConfig(overrides = {}) {
|
|
|
310
309
|
bundles: null,
|
|
311
310
|
devMode: true,
|
|
312
311
|
enableCache: false,
|
|
313
|
-
|
|
312
|
+
compat: {},
|
|
314
313
|
globalScript: null,
|
|
315
|
-
hashFileNames: false,
|
|
316
314
|
logger: new TestingLogger(),
|
|
317
315
|
maxConcurrentWorkers: 0,
|
|
318
316
|
minifyCss: false,
|
|
@@ -346,7 +344,6 @@ const mockLoadConfigInit = (overrides) => {
|
|
|
346
344
|
return {
|
|
347
345
|
config: {},
|
|
348
346
|
configPath: void 0,
|
|
349
|
-
initTsConfig: true,
|
|
350
347
|
logger: void 0,
|
|
351
348
|
sys: void 0,
|
|
352
349
|
...overrides
|
|
@@ -478,9 +475,171 @@ const mockModule = (mod = {}) => ({
|
|
|
478
475
|
hasVdomStyle: false,
|
|
479
476
|
hasVdomText: false,
|
|
480
477
|
hasVdomXlink: false,
|
|
478
|
+
hasSignalsImport: false,
|
|
481
479
|
...mod
|
|
482
480
|
});
|
|
483
481
|
//#endregion
|
|
482
|
+
//#region src/testing/create-test-compiler.ts
|
|
483
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
484
|
+
const TESTING_TSCONFIG = path.resolve(__dirname, "fixtures/tsconfig.testing.json");
|
|
485
|
+
/**
|
|
486
|
+
* Builds a patched sys that falls through to real disk for TypeScript lib files.
|
|
487
|
+
*
|
|
488
|
+
* @returns A compiler system instance with patched readFileSync, readFile, accessSync, and statSync methods
|
|
489
|
+
*/
|
|
490
|
+
const createPatchedSys = () => {
|
|
491
|
+
const sys = mockCompilerSystem();
|
|
492
|
+
const originalReadFileSync = sys.readFileSync.bind(sys);
|
|
493
|
+
sys.readFileSync = (p) => {
|
|
494
|
+
const mem = originalReadFileSync(p);
|
|
495
|
+
if (mem !== void 0) return mem;
|
|
496
|
+
try {
|
|
497
|
+
return fs.readFileSync(p, "utf-8");
|
|
498
|
+
} catch {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const originalReadFile = sys.readFile.bind(sys);
|
|
503
|
+
sys.readFile = async (p) => {
|
|
504
|
+
const mem = await originalReadFile(p);
|
|
505
|
+
if (mem !== void 0) return mem;
|
|
506
|
+
try {
|
|
507
|
+
return fs.readFileSync(p, "utf-8");
|
|
508
|
+
} catch {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
const originalAccessSync = sys.accessSync.bind(sys);
|
|
513
|
+
sys.accessSync = (p) => {
|
|
514
|
+
if (originalAccessSync(p)) return true;
|
|
515
|
+
try {
|
|
516
|
+
fs.accessSync(p);
|
|
517
|
+
return true;
|
|
518
|
+
} catch {
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
const originalStatSync = sys.statSync.bind(sys);
|
|
523
|
+
sys.statSync = (p) => {
|
|
524
|
+
const mem = originalStatSync(p);
|
|
525
|
+
if (!mem.error) return mem;
|
|
526
|
+
try {
|
|
527
|
+
const s = fs.statSync(p);
|
|
528
|
+
return {
|
|
529
|
+
isDirectory: s.isDirectory(),
|
|
530
|
+
isFile: s.isFile(),
|
|
531
|
+
isSymbolicLink: s.isSymbolicLink(),
|
|
532
|
+
size: s.size,
|
|
533
|
+
error: null
|
|
534
|
+
};
|
|
535
|
+
} catch {
|
|
536
|
+
return mem;
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
sys.getCompilerExecutingPath = () => path.resolve(__dirname, "../../dist/compiler/index.mjs");
|
|
540
|
+
return sys;
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Runs the expensive one-time setup for a test compiler suite: patching the
|
|
544
|
+
* sys, reading and validating the tsconfig. Use this in a `beforeAll` block
|
|
545
|
+
* when a describe block contains multiple tests that each need a fresh
|
|
546
|
+
* compiler, to avoid repeating `loadConfig` on every test.
|
|
547
|
+
*
|
|
548
|
+
* @param options - Configuration options for preparing the test compiler
|
|
549
|
+
* @returns A {@link PreparedTestCompiler} that can be passed to {@link createTestCompiler}
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```ts
|
|
553
|
+
* let setup: PreparedTestCompiler;
|
|
554
|
+
* beforeAll(async () => { setup = await prepareTestCompiler(); });
|
|
555
|
+
* beforeEach(async () => {
|
|
556
|
+
* const { compiler } = await createTestCompiler({ setup });
|
|
557
|
+
* });
|
|
558
|
+
* ```
|
|
559
|
+
*/
|
|
560
|
+
const prepareTestCompiler = async (options = {}) => {
|
|
561
|
+
const sys = createPatchedSys();
|
|
562
|
+
const tsconfigPath = options.tsconfig ?? TESTING_TSCONFIG;
|
|
563
|
+
const { config: validatedConfig } = await loadConfig({
|
|
564
|
+
sys,
|
|
565
|
+
config: {
|
|
566
|
+
devMode: true,
|
|
567
|
+
sourceMap: false,
|
|
568
|
+
enableCache: false,
|
|
569
|
+
minifyJs: false,
|
|
570
|
+
minifyCss: false,
|
|
571
|
+
namespace: "Testing",
|
|
572
|
+
tsconfig: tsconfigPath,
|
|
573
|
+
...options.config
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
return {
|
|
577
|
+
_validatedConfig: validatedConfig,
|
|
578
|
+
_tsconfigPath: tsconfigPath
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Creates a test compiler instance with a hybrid filesystem (reads from disk, writes to memory).
|
|
583
|
+
* This utility handles the common setup pattern for compiler tests.
|
|
584
|
+
*
|
|
585
|
+
* When multiple tests in the same suite need independent compiler instances,
|
|
586
|
+
* pass a {@link PreparedTestCompiler} from {@link prepareTestCompiler} as
|
|
587
|
+
* `options.setup` to skip the expensive `loadConfig` step on each test.
|
|
588
|
+
*
|
|
589
|
+
* @param options - Configuration options for the test compiler
|
|
590
|
+
* @returns An object with the compiler, validated config, and system instance
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```ts
|
|
594
|
+
* const { compiler, config } = await createTestCompiler({
|
|
595
|
+
* config: { minifyCss: true }
|
|
596
|
+
* });
|
|
597
|
+
* await compiler.fs.writeFile('/src/index.html', '<cmp-a></cmp-a>');
|
|
598
|
+
* const result = await compiler.build();
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
601
|
+
const createTestCompiler = async (options = {}) => {
|
|
602
|
+
let validatedConfig;
|
|
603
|
+
let tsconfigPath;
|
|
604
|
+
if (options.setup) {
|
|
605
|
+
const freshSys = createPatchedSys();
|
|
606
|
+
validatedConfig = {
|
|
607
|
+
...options.setup._validatedConfig,
|
|
608
|
+
sys: freshSys
|
|
609
|
+
};
|
|
610
|
+
tsconfigPath = options.setup._tsconfigPath;
|
|
611
|
+
} else {
|
|
612
|
+
const sys = createPatchedSys();
|
|
613
|
+
tsconfigPath = options.tsconfig ?? TESTING_TSCONFIG;
|
|
614
|
+
const { config } = await loadConfig({
|
|
615
|
+
sys,
|
|
616
|
+
config: {
|
|
617
|
+
devMode: true,
|
|
618
|
+
sourceMap: false,
|
|
619
|
+
enableCache: false,
|
|
620
|
+
minifyJs: false,
|
|
621
|
+
minifyCss: false,
|
|
622
|
+
namespace: "Testing",
|
|
623
|
+
tsconfig: tsconfigPath,
|
|
624
|
+
...options.config
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
validatedConfig = config;
|
|
628
|
+
}
|
|
629
|
+
const compiler = await createCompiler(validatedConfig);
|
|
630
|
+
const tsconfigObj = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
|
|
631
|
+
await compiler.fs.writeFile(tsconfigPath, JSON.stringify({
|
|
632
|
+
...tsconfigObj,
|
|
633
|
+
include: [validatedConfig.srcDir]
|
|
634
|
+
}));
|
|
635
|
+
await compiler.fs.writeFile(path.join(validatedConfig.srcDir, "components.d.ts"), "");
|
|
636
|
+
return {
|
|
637
|
+
compiler,
|
|
638
|
+
config: validatedConfig,
|
|
639
|
+
sys: validatedConfig.sys
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
//#endregion
|
|
484
643
|
//#region src/testing/platform/testing-constants.ts
|
|
485
644
|
const styles = /* @__PURE__ */ new Map();
|
|
486
645
|
const modeResolutionChain = [];
|
|
@@ -516,7 +675,7 @@ const Build = {
|
|
|
516
675
|
* @returns the corresponding Stencil reference data structure, or undefined if one cannot be found
|
|
517
676
|
*/
|
|
518
677
|
const getHostRef = (elm) => {
|
|
519
|
-
if (elm.
|
|
678
|
+
if (elm.__s_ghr) return elm.__s_ghr();
|
|
520
679
|
};
|
|
521
680
|
/**
|
|
522
681
|
* Add the provided `hostRef` instance to the global {@link hostRefs} map, using the provided `lazyInstance` as a key.
|
|
@@ -537,7 +696,7 @@ const registerInstance = (lazyInstance, hostRef) => {
|
|
|
537
696
|
});
|
|
538
697
|
hostRef = getHostRef(elm);
|
|
539
698
|
}
|
|
540
|
-
lazyInstance.
|
|
699
|
+
lazyInstance.__s_ghr = () => hostRef;
|
|
541
700
|
hostRef.$lazyInstance$ = lazyInstance;
|
|
542
701
|
if (hostRef.$cmpMeta$?.$flags$ & CMP_FLAGS.hasModernPropertyDecls && (BUILD.state || BUILD.prop)) reWireGetterSetter(lazyInstance, hostRef);
|
|
543
702
|
const Cstr = lazyInstance.constructor;
|
|
@@ -588,7 +747,7 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
588
747
|
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
|
|
589
748
|
elm["s-p"] = [];
|
|
590
749
|
elm["s-rc"] = [];
|
|
591
|
-
elm.
|
|
750
|
+
elm.__s_ghr = () => hostRef;
|
|
592
751
|
};
|
|
593
752
|
const setErrorHandler = (handler) => handler;
|
|
594
753
|
//#endregion
|
|
@@ -728,6 +887,8 @@ function flushLoadModule(bundleId) {
|
|
|
728
887
|
const isVitestEnvironment = typeof process !== "undefined" && process.env?.VITEST;
|
|
729
888
|
const existingWindow = typeof globalThis !== "undefined" && globalThis.window;
|
|
730
889
|
const win = isVitestEnvironment && existingWindow ? existingWindow : setupGlobal(global);
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/testing/platform/testing-platform.ts
|
|
731
892
|
const plt = {
|
|
732
893
|
$flags$: 0,
|
|
733
894
|
$resourcesUrl$: "",
|
|
@@ -738,14 +899,6 @@ const plt = {
|
|
|
738
899
|
ce: (eventName, opts) => new win.CustomEvent(eventName, opts)
|
|
739
900
|
};
|
|
740
901
|
/**
|
|
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
902
|
* Resets global testing variables and collections, so that a new set of tests can be started with a "clean slate".
|
|
750
903
|
*
|
|
751
904
|
* It is expected that this function be called between spec tests, and should be automatically configured by Stencil to
|
|
@@ -861,13 +1014,13 @@ function resetBuildConditionals(b) {
|
|
|
861
1014
|
b.hydratedAttribute = false;
|
|
862
1015
|
b.hydratedClass = true;
|
|
863
1016
|
b.invisiblePrehydration = true;
|
|
864
|
-
b.
|
|
865
|
-
b.
|
|
1017
|
+
b.staticHydrationStyles = false;
|
|
1018
|
+
b.lightDomPatches = false;
|
|
1019
|
+
b.slotChildNodes = false;
|
|
1020
|
+
b.slotCloneNode = false;
|
|
1021
|
+
b.slotDomMutations = false;
|
|
1022
|
+
b.slotTextContent = false;
|
|
866
1023
|
b.hotModuleReplacement = false;
|
|
867
|
-
b.scopedSlotTextContentFix = false;
|
|
868
|
-
b.slotChildNodesFix = false;
|
|
869
|
-
b.experimentalSlotFixes = false;
|
|
870
|
-
b.experimentalScopedSlotChanges = false;
|
|
871
1024
|
}
|
|
872
1025
|
//#endregion
|
|
873
1026
|
//#region src/testing/spec-page.ts
|
|
@@ -887,14 +1040,8 @@ async function newSpecPage(opts) {
|
|
|
887
1040
|
resetBuildConditionals(BUILD);
|
|
888
1041
|
if (Array.isArray(opts.components)) registerComponents(opts.components);
|
|
889
1042
|
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
|
-
}
|
|
1043
|
+
if (opts.hydrateServerSide) opts.includeAnnotations = true;
|
|
1044
|
+
else opts.includeAnnotations = !!opts.includeAnnotations;
|
|
898
1045
|
BUILD.cssAnnotations = opts.includeAnnotations;
|
|
899
1046
|
const cmpTags = /* @__PURE__ */ new Set();
|
|
900
1047
|
win["__stencil_spec_options"] = opts;
|
|
@@ -948,9 +1095,8 @@ async function newSpecPage(opts) {
|
|
|
948
1095
|
BUILD.hydrateServerSide = true;
|
|
949
1096
|
BUILD.hydrateClientSide = false;
|
|
950
1097
|
}
|
|
951
|
-
BUILD.
|
|
952
|
-
|
|
953
|
-
BUILD.attachStyles = !!opts.attachStyles;
|
|
1098
|
+
BUILD.slotCloneNode = false;
|
|
1099
|
+
if (opts.buildFlags) Object.assign(BUILD, opts.buildFlags);
|
|
954
1100
|
if (typeof opts.url === "string") page.win.location.href = opts.url;
|
|
955
1101
|
if (typeof opts.direction === "string") page.doc.documentElement.setAttribute("dir", opts.direction);
|
|
956
1102
|
if (typeof opts.language === "string") page.doc.documentElement.setAttribute("lang", opts.language);
|
|
@@ -963,6 +1109,9 @@ async function newSpecPage(opts) {
|
|
|
963
1109
|
if (typeof opts.userAgent === "string") try {
|
|
964
1110
|
page.win.navigator.userAgent = opts.userAgent;
|
|
965
1111
|
} catch {}
|
|
1112
|
+
if (opts.hydrateServerSide && opts.serializeShadowRoot === "scoped") {
|
|
1113
|
+
for (const [, cmps] of lazyBundles) for (const cmp of cmps) if (cmp[0] & CMP_FLAGS.shadowDomEncapsulation) cmp[0] |= CMP_FLAGS.shadowNeedsScopedCss;
|
|
1114
|
+
}
|
|
966
1115
|
bootstrapLazy(lazyBundles);
|
|
967
1116
|
if (typeof opts.template === "function") renderVdom({
|
|
968
1117
|
$ancestorComponent$: void 0,
|
|
@@ -1168,4 +1317,4 @@ function setupConsoleMocker() {
|
|
|
1168
1317
|
};
|
|
1169
1318
|
}
|
|
1170
1319
|
//#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 };
|
|
1320
|
+
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 VALID_CONFIG_OUTPUT_TARGETS, C as ASSETS, F as DOCS_README, H as LISTENER_FLAGS, I as DOCS_VSCODE, J as STANDALONE, M as DOCS_CUSTOM, N as DOCS_CUSTOM_ELEMENTS_MANIFEST, O as COPY, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, T as COLLECTION, U as LOADER_BUNDLE, W as MEMBER_FLAGS, Y as STATS, _ as sortBy, b as toTitleCase, et as WATCH_FLAGS, i as flatOne, j as DIST_LAZY, k as CUSTOM, n as dashToPascalCase, p as isString, q as SSR_WASM, r as escapeWithPattern, u as isIterable, w as CMP_FLAGS, y as toDashCase, z as GLOBAL_STYLE } from "./regular-expression-CFVJOTUh.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 === COLLECTION;
|
|
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.7",
|
|
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/dev-server": "5.0.0-alpha.
|
|
112
|
-
"@stencil/mock-doc": "5.0.0-alpha.
|
|
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.7",
|
|
125
|
+
"@stencil/dev-server": "5.0.0-alpha.7",
|
|
126
|
+
"@stencil/mock-doc": "5.0.0-alpha.7"
|
|
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"
|