@qwik.dev/core 2.0.0-alpha.0 → 2.0.0-alpha.2
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +1384 -761
- package/dist/core-internal.d.ts +15 -2
- package/dist/core.cjs +75 -61
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +75 -61
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +56 -46
- package/dist/core.prod.mjs +58 -49
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +57 -60
- package/dist/optimizer.mjs +59 -63
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +1 -0
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +81 -53
- package/dist/server.mjs +81 -53
- package/dist/starters/features/auth/package.json +3 -1
- package/dist/starters/features/drizzle/package.json +2 -1
- package/dist/starters/features/postcss/package.json +3 -0
- package/dist/starters/features/prisma/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +3 -0
- package/dist/starters/features/turso/package.json +4 -1
- package/dist/testing/index.cjs +77 -49
- package/dist/testing/index.mjs +77 -49
- package/dist/testing/package.json +1 -1
- package/package.json +13 -11
- package/public.d.ts +2 -0
package/dist/testing/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/testing 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/testing 2.0.0-alpha.2-dev+58b6f8d
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -23077,9 +23077,11 @@ function clearEffects(subscriber, value) {
|
|
|
23077
23077
|
return subscriptionRemoved;
|
|
23078
23078
|
}
|
|
23079
23079
|
|
|
23080
|
+
// packages/qwik/src/core/signal/flags.ts
|
|
23081
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
23082
|
+
|
|
23080
23083
|
// packages/qwik/src/core/signal/signal.ts
|
|
23081
23084
|
var DEBUG = false;
|
|
23082
|
-
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
23083
23085
|
var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
23084
23086
|
var throwIfQRLNotResolved = (qrl2) => {
|
|
23085
23087
|
const resolved = qrl2.resolved;
|
|
@@ -23615,6 +23617,20 @@ var StoreHandler = class {
|
|
|
23615
23617
|
if (prop === STORE_TARGET) {
|
|
23616
23618
|
return true;
|
|
23617
23619
|
}
|
|
23620
|
+
if (typeof prop === "string") {
|
|
23621
|
+
const ctx = tryGetInvokeContext();
|
|
23622
|
+
if (ctx) {
|
|
23623
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
23624
|
+
if (effectSubscriber) {
|
|
23625
|
+
addEffect(
|
|
23626
|
+
target,
|
|
23627
|
+
Array.isArray(target) ? STORE_ARRAY_PROP : prop,
|
|
23628
|
+
this,
|
|
23629
|
+
effectSubscriber
|
|
23630
|
+
);
|
|
23631
|
+
}
|
|
23632
|
+
}
|
|
23633
|
+
}
|
|
23618
23634
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
23619
23635
|
}
|
|
23620
23636
|
ownKeys(target) {
|
|
@@ -23987,6 +24003,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
23987
24003
|
iCtx.$container$ = container;
|
|
23988
24004
|
let componentFn;
|
|
23989
24005
|
container.ensureProjectionResolved(renderHost);
|
|
24006
|
+
let isInlineComponent = false;
|
|
23990
24007
|
if (componentQRL === null) {
|
|
23991
24008
|
componentQRL = componentQRL || container.getHostProp(renderHost, OnRenderProp);
|
|
23992
24009
|
assertDefined(componentQRL, "No Component found at this location");
|
|
@@ -24001,14 +24018,19 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
24001
24018
|
const qComponentFn = componentQRL;
|
|
24002
24019
|
componentFn = () => invokeApply(iCtx, qComponentFn, [props || EMPTY_OBJ, null, 0]);
|
|
24003
24020
|
} else {
|
|
24021
|
+
isInlineComponent = true;
|
|
24004
24022
|
const inlineComponent = componentQRL;
|
|
24005
24023
|
componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
|
|
24006
24024
|
}
|
|
24007
24025
|
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
|
|
24008
24026
|
() => {
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
|
|
24027
|
+
if (!isInlineComponent) {
|
|
24028
|
+
container.setHostProp(renderHost, ELEMENT_SEQ_IDX, null);
|
|
24029
|
+
container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
|
|
24030
|
+
if (container.getHostProp(renderHost, ELEMENT_PROPS) !== props) {
|
|
24031
|
+
container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
24032
|
+
}
|
|
24033
|
+
}
|
|
24012
24034
|
if (vnode_isVNode(renderHost)) {
|
|
24013
24035
|
clearVNodeEffectDependencies(renderHost);
|
|
24014
24036
|
}
|
|
@@ -25239,7 +25261,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
25239
25261
|
return hostDiff;
|
|
25240
25262
|
}
|
|
25241
25263
|
} else {
|
|
25242
|
-
const errorMessage =
|
|
25264
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
|
|
25265
|
+
You are attempting to change a state that has already been streamed to the client.
|
|
25266
|
+
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
25267
|
+
Problematic Node: ${aHost.toString()}`;
|
|
25243
25268
|
if (shouldThrowOnHostMismatch) {
|
|
25244
25269
|
throwErrorAndStop(errorMessage);
|
|
25245
25270
|
}
|
|
@@ -25354,9 +25379,10 @@ var _SharedContainer = class {
|
|
|
25354
25379
|
trackSignalValue(signal, subscriber, property, data) {
|
|
25355
25380
|
return trackSignal(() => signal.value, subscriber, property, this, data);
|
|
25356
25381
|
}
|
|
25357
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
25382
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
25358
25383
|
return createSerializationContext(
|
|
25359
25384
|
NodeConstructor,
|
|
25385
|
+
DomRefConstructor,
|
|
25360
25386
|
symbolToChunkResolver,
|
|
25361
25387
|
this.getHostProp.bind(this),
|
|
25362
25388
|
this.setHostProp.bind(this),
|
|
@@ -27885,6 +27911,12 @@ var SsrNode = class {
|
|
|
27885
27911
|
return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
|
|
27886
27912
|
}
|
|
27887
27913
|
};
|
|
27914
|
+
var DomRef = class {
|
|
27915
|
+
/** @id is the same id as for SsrNode */
|
|
27916
|
+
constructor(id) {
|
|
27917
|
+
this.id = id;
|
|
27918
|
+
}
|
|
27919
|
+
};
|
|
27888
27920
|
var SsrComponentFrame = class {
|
|
27889
27921
|
constructor(componentNode) {
|
|
27890
27922
|
this.componentNode = componentNode;
|
|
@@ -28499,12 +28531,7 @@ function inflateQRL(container, qrl2) {
|
|
|
28499
28531
|
}
|
|
28500
28532
|
return qrl2;
|
|
28501
28533
|
}
|
|
28502
|
-
var
|
|
28503
|
-
constructor(id) {
|
|
28504
|
-
this.id = id;
|
|
28505
|
-
}
|
|
28506
|
-
};
|
|
28507
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
28534
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
28508
28535
|
if (!writer) {
|
|
28509
28536
|
const buffer = [];
|
|
28510
28537
|
writer = {
|
|
@@ -28528,11 +28555,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28528
28555
|
return id;
|
|
28529
28556
|
};
|
|
28530
28557
|
const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
28558
|
+
const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
28531
28559
|
return {
|
|
28532
28560
|
$serialize$() {
|
|
28533
28561
|
serialize(this);
|
|
28534
28562
|
},
|
|
28535
28563
|
$isSsrNode$: isSsrNode,
|
|
28564
|
+
$isDomRef$: isDomRef,
|
|
28536
28565
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
28537
28566
|
$wasSeen$,
|
|
28538
28567
|
$roots$: roots,
|
|
@@ -28641,6 +28670,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28641
28670
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
28642
28671
|
} else if (isSsrNode(obj)) {
|
|
28643
28672
|
discoveredValues.push(obj.vnodeData);
|
|
28673
|
+
} else if (isDomRef(obj)) {
|
|
28674
|
+
discoveredValues.push(obj.id);
|
|
28644
28675
|
} else if (isJSXNode(obj)) {
|
|
28645
28676
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
28646
28677
|
} else if (Array.isArray(obj)) {
|
|
@@ -28695,7 +28726,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28695
28726
|
};
|
|
28696
28727
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
28697
28728
|
function serialize(serializationContext) {
|
|
28698
|
-
const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
28729
|
+
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
28699
28730
|
let depth = -1;
|
|
28700
28731
|
let writeType = false;
|
|
28701
28732
|
const output = (type, value) => {
|
|
@@ -28864,14 +28895,10 @@ function serialize(serializationContext) {
|
|
|
28864
28895
|
}
|
|
28865
28896
|
output(13 /* Object */, out);
|
|
28866
28897
|
}
|
|
28867
|
-
} else if (value
|
|
28898
|
+
} else if ($isDomRef$(value)) {
|
|
28868
28899
|
output(9 /* RefVNode */, value.id);
|
|
28869
28900
|
} else if (value instanceof Signal) {
|
|
28870
|
-
|
|
28871
|
-
if ($isSsrNode$(v)) {
|
|
28872
|
-
serializationContext.$addRoot$(v);
|
|
28873
|
-
v = new DomVRef(v.id);
|
|
28874
|
-
}
|
|
28901
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
28875
28902
|
if (value instanceof WrappedSignal) {
|
|
28876
28903
|
output(23 /* WrappedSignal */, [
|
|
28877
28904
|
...serializeWrappingFn(serializationContext, value),
|
|
@@ -29366,8 +29393,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29366
29393
|
}
|
|
29367
29394
|
let _containerEl;
|
|
29368
29395
|
const qrl2 = async function(...args) {
|
|
29369
|
-
const
|
|
29370
|
-
const result = await
|
|
29396
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
29397
|
+
const result = await boundedFn(...args);
|
|
29371
29398
|
return result;
|
|
29372
29399
|
};
|
|
29373
29400
|
const setContainer = (el) => {
|
|
@@ -29376,6 +29403,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29376
29403
|
}
|
|
29377
29404
|
return _containerEl;
|
|
29378
29405
|
};
|
|
29406
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
29407
|
+
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
29408
|
+
if (!isFunction(fn)) {
|
|
29409
|
+
throw qError(QError_qrlIsNotFunction);
|
|
29410
|
+
}
|
|
29411
|
+
if (beforeFn && beforeFn() === false) {
|
|
29412
|
+
return;
|
|
29413
|
+
}
|
|
29414
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
29415
|
+
const prevQrl = context.$qrl$;
|
|
29416
|
+
const prevEvent = context.$event$;
|
|
29417
|
+
context.$qrl$ = qrl2;
|
|
29418
|
+
context.$event$ ||= this;
|
|
29419
|
+
try {
|
|
29420
|
+
return invoke.call(this, context, fn, ...args);
|
|
29421
|
+
} finally {
|
|
29422
|
+
context.$qrl$ = prevQrl;
|
|
29423
|
+
context.$event$ = prevEvent;
|
|
29424
|
+
}
|
|
29425
|
+
});
|
|
29426
|
+
}
|
|
29427
|
+
const resolveLazy = (containerEl) => {
|
|
29428
|
+
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
29429
|
+
};
|
|
29379
29430
|
const wrapFn = (fn) => {
|
|
29380
29431
|
if (typeof fn !== "function" || !(capture == null ? void 0 : capture.length) && !(captureRef == null ? void 0 : captureRef.length)) {
|
|
29381
29432
|
return fn;
|
|
@@ -29425,30 +29476,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29425
29476
|
}
|
|
29426
29477
|
return symbolRef;
|
|
29427
29478
|
};
|
|
29428
|
-
const resolveLazy = (containerEl) => {
|
|
29429
|
-
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
29430
|
-
};
|
|
29431
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
29432
|
-
return (...args) => maybeThen(resolveLazy(), (f) => {
|
|
29433
|
-
if (!isFunction(f)) {
|
|
29434
|
-
throw qError(QError_qrlIsNotFunction);
|
|
29435
|
-
}
|
|
29436
|
-
if (beforeFn && beforeFn() === false) {
|
|
29437
|
-
return;
|
|
29438
|
-
}
|
|
29439
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
29440
|
-
const prevQrl = context.$qrl$;
|
|
29441
|
-
const prevEvent = context.$event$;
|
|
29442
|
-
context.$qrl$ = qrl2;
|
|
29443
|
-
context.$event$ ||= this;
|
|
29444
|
-
try {
|
|
29445
|
-
return invoke.call(this, context, f, ...args);
|
|
29446
|
-
} finally {
|
|
29447
|
-
context.$qrl$ = prevQrl;
|
|
29448
|
-
context.$event$ = prevEvent;
|
|
29449
|
-
}
|
|
29450
|
-
});
|
|
29451
|
-
}
|
|
29452
29479
|
const createOrReuseInvocationContext = (invoke2) => {
|
|
29453
29480
|
if (invoke2 == null) {
|
|
29454
29481
|
return newInvokeContext();
|
|
@@ -29471,7 +29498,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29471
29498
|
$symbol$: symbol,
|
|
29472
29499
|
$refSymbol$: refSymbol,
|
|
29473
29500
|
$hash$: hash3,
|
|
29474
|
-
getFn:
|
|
29501
|
+
getFn: bindFnToContext,
|
|
29475
29502
|
$capture$: capture,
|
|
29476
29503
|
$captureRef$: captureRef,
|
|
29477
29504
|
dev: null,
|
|
@@ -31154,6 +31181,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
31154
31181
|
};
|
|
31155
31182
|
this.serializationCtx = this.serializationCtxFactory(
|
|
31156
31183
|
SsrNode,
|
|
31184
|
+
DomRef,
|
|
31157
31185
|
this.symbolToChunkResolver,
|
|
31158
31186
|
opts.writer,
|
|
31159
31187
|
(vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
|
|
@@ -31927,10 +31955,10 @@ var SSRContainer = class extends import_core5._SharedContainer {
|
|
|
31927
31955
|
if (key === "ref") {
|
|
31928
31956
|
const lastNode = this.getLastNode();
|
|
31929
31957
|
if ((0, import_core5.isSignal)(value)) {
|
|
31930
|
-
value.value = lastNode;
|
|
31958
|
+
value.value = new DomRef(lastNode.id);
|
|
31931
31959
|
continue;
|
|
31932
31960
|
} else if (typeof value === "function") {
|
|
31933
|
-
value(lastNode);
|
|
31961
|
+
value(new DomRef(lastNode.id));
|
|
31934
31962
|
continue;
|
|
31935
31963
|
}
|
|
31936
31964
|
}
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/testing 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/testing 2.0.0-alpha.2-dev+58b6f8d
|
|
4
4
|
* Copyright QwikDev. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
|
|
@@ -23062,9 +23062,11 @@ function clearEffects(subscriber, value) {
|
|
|
23062
23062
|
return subscriptionRemoved;
|
|
23063
23063
|
}
|
|
23064
23064
|
|
|
23065
|
+
// packages/qwik/src/core/signal/flags.ts
|
|
23066
|
+
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
23067
|
+
|
|
23065
23068
|
// packages/qwik/src/core/signal/signal.ts
|
|
23066
23069
|
var DEBUG = false;
|
|
23067
|
-
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
23068
23070
|
var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
23069
23071
|
var throwIfQRLNotResolved = (qrl2) => {
|
|
23070
23072
|
const resolved = qrl2.resolved;
|
|
@@ -23597,6 +23599,20 @@ var StoreHandler = class {
|
|
|
23597
23599
|
if (prop === STORE_TARGET) {
|
|
23598
23600
|
return true;
|
|
23599
23601
|
}
|
|
23602
|
+
if (typeof prop === "string") {
|
|
23603
|
+
const ctx = tryGetInvokeContext();
|
|
23604
|
+
if (ctx) {
|
|
23605
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
23606
|
+
if (effectSubscriber) {
|
|
23607
|
+
addEffect(
|
|
23608
|
+
target,
|
|
23609
|
+
Array.isArray(target) ? STORE_ARRAY_PROP : prop,
|
|
23610
|
+
this,
|
|
23611
|
+
effectSubscriber
|
|
23612
|
+
);
|
|
23613
|
+
}
|
|
23614
|
+
}
|
|
23615
|
+
}
|
|
23600
23616
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
23601
23617
|
}
|
|
23602
23618
|
ownKeys(target) {
|
|
@@ -23969,6 +23985,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
23969
23985
|
iCtx.$container$ = container;
|
|
23970
23986
|
let componentFn;
|
|
23971
23987
|
container.ensureProjectionResolved(renderHost);
|
|
23988
|
+
let isInlineComponent = false;
|
|
23972
23989
|
if (componentQRL === null) {
|
|
23973
23990
|
componentQRL = componentQRL || container.getHostProp(renderHost, OnRenderProp);
|
|
23974
23991
|
assertDefined(componentQRL, "No Component found at this location");
|
|
@@ -23983,14 +24000,19 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
|
|
|
23983
24000
|
const qComponentFn = componentQRL;
|
|
23984
24001
|
componentFn = () => invokeApply(iCtx, qComponentFn, [props || EMPTY_OBJ, null, 0]);
|
|
23985
24002
|
} else {
|
|
24003
|
+
isInlineComponent = true;
|
|
23986
24004
|
const inlineComponent = componentQRL;
|
|
23987
24005
|
componentFn = () => invokeApply(iCtx, inlineComponent, [props || EMPTY_OBJ]);
|
|
23988
24006
|
}
|
|
23989
24007
|
const executeComponentWithPromiseExceptionRetry = (retryCount = 0) => safeCall(
|
|
23990
24008
|
() => {
|
|
23991
|
-
|
|
23992
|
-
|
|
23993
|
-
|
|
24009
|
+
if (!isInlineComponent) {
|
|
24010
|
+
container.setHostProp(renderHost, ELEMENT_SEQ_IDX, null);
|
|
24011
|
+
container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
|
|
24012
|
+
if (container.getHostProp(renderHost, ELEMENT_PROPS) !== props) {
|
|
24013
|
+
container.setHostProp(renderHost, ELEMENT_PROPS, props);
|
|
24014
|
+
}
|
|
24015
|
+
}
|
|
23994
24016
|
if (vnode_isVNode(renderHost)) {
|
|
23995
24017
|
clearVNodeEffectDependencies(renderHost);
|
|
23996
24018
|
}
|
|
@@ -25220,7 +25242,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
25220
25242
|
return hostDiff;
|
|
25221
25243
|
}
|
|
25222
25244
|
} else {
|
|
25223
|
-
const errorMessage =
|
|
25245
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
|
|
25246
|
+
You are attempting to change a state that has already been streamed to the client.
|
|
25247
|
+
This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
|
|
25248
|
+
Problematic Node: ${aHost.toString()}`;
|
|
25224
25249
|
if (shouldThrowOnHostMismatch) {
|
|
25225
25250
|
throwErrorAndStop(errorMessage);
|
|
25226
25251
|
}
|
|
@@ -25334,9 +25359,10 @@ var _SharedContainer = class {
|
|
|
25334
25359
|
trackSignalValue(signal, subscriber, property, data) {
|
|
25335
25360
|
return trackSignal(() => signal.value, subscriber, property, this, data);
|
|
25336
25361
|
}
|
|
25337
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
25362
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
25338
25363
|
return createSerializationContext(
|
|
25339
25364
|
NodeConstructor,
|
|
25365
|
+
DomRefConstructor,
|
|
25340
25366
|
symbolToChunkResolver,
|
|
25341
25367
|
this.getHostProp.bind(this),
|
|
25342
25368
|
this.setHostProp.bind(this),
|
|
@@ -27857,6 +27883,12 @@ __publicField(SsrNode, "ELEMENT_NODE", 1);
|
|
|
27857
27883
|
__publicField(SsrNode, "TEXT_NODE", 3);
|
|
27858
27884
|
__publicField(SsrNode, "DOCUMENT_NODE", 9);
|
|
27859
27885
|
__publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
|
|
27886
|
+
var DomRef = class {
|
|
27887
|
+
/** @id is the same id as for SsrNode */
|
|
27888
|
+
constructor(id) {
|
|
27889
|
+
this.id = id;
|
|
27890
|
+
}
|
|
27891
|
+
};
|
|
27860
27892
|
var SsrComponentFrame = class {
|
|
27861
27893
|
constructor(componentNode) {
|
|
27862
27894
|
this.componentNode = componentNode;
|
|
@@ -28468,12 +28500,7 @@ function inflateQRL(container, qrl2) {
|
|
|
28468
28500
|
}
|
|
28469
28501
|
return qrl2;
|
|
28470
28502
|
}
|
|
28471
|
-
var
|
|
28472
|
-
constructor(id) {
|
|
28473
|
-
this.id = id;
|
|
28474
|
-
}
|
|
28475
|
-
};
|
|
28476
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
28503
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
28477
28504
|
if (!writer) {
|
|
28478
28505
|
const buffer = [];
|
|
28479
28506
|
writer = {
|
|
@@ -28497,11 +28524,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28497
28524
|
return id;
|
|
28498
28525
|
};
|
|
28499
28526
|
const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
|
|
28527
|
+
const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
|
|
28500
28528
|
return {
|
|
28501
28529
|
$serialize$() {
|
|
28502
28530
|
serialize(this);
|
|
28503
28531
|
},
|
|
28504
28532
|
$isSsrNode$: isSsrNode,
|
|
28533
|
+
$isDomRef$: isDomRef,
|
|
28505
28534
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
28506
28535
|
$wasSeen$,
|
|
28507
28536
|
$roots$: roots,
|
|
@@ -28610,6 +28639,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28610
28639
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
28611
28640
|
} else if (isSsrNode(obj)) {
|
|
28612
28641
|
discoveredValues.push(obj.vnodeData);
|
|
28642
|
+
} else if (isDomRef(obj)) {
|
|
28643
|
+
discoveredValues.push(obj.id);
|
|
28613
28644
|
} else if (isJSXNode(obj)) {
|
|
28614
28645
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
28615
28646
|
} else if (Array.isArray(obj)) {
|
|
@@ -28664,7 +28695,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
28664
28695
|
};
|
|
28665
28696
|
var promiseResults = /* @__PURE__ */ new WeakMap();
|
|
28666
28697
|
function serialize(serializationContext) {
|
|
28667
|
-
const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
28698
|
+
const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
|
|
28668
28699
|
let depth = -1;
|
|
28669
28700
|
let writeType = false;
|
|
28670
28701
|
const output = (type, value) => {
|
|
@@ -28832,14 +28863,10 @@ function serialize(serializationContext) {
|
|
|
28832
28863
|
}
|
|
28833
28864
|
output(13 /* Object */, out);
|
|
28834
28865
|
}
|
|
28835
|
-
} else if (value
|
|
28866
|
+
} else if ($isDomRef$(value)) {
|
|
28836
28867
|
output(9 /* RefVNode */, value.id);
|
|
28837
28868
|
} else if (value instanceof Signal) {
|
|
28838
|
-
|
|
28839
|
-
if ($isSsrNode$(v)) {
|
|
28840
|
-
serializationContext.$addRoot$(v);
|
|
28841
|
-
v = new DomVRef(v.id);
|
|
28842
|
-
}
|
|
28869
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
28843
28870
|
if (value instanceof WrappedSignal) {
|
|
28844
28871
|
output(23 /* WrappedSignal */, [
|
|
28845
28872
|
...serializeWrappingFn(serializationContext, value),
|
|
@@ -29333,8 +29360,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29333
29360
|
}
|
|
29334
29361
|
let _containerEl;
|
|
29335
29362
|
const qrl2 = async function(...args) {
|
|
29336
|
-
const
|
|
29337
|
-
const result = await
|
|
29363
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
29364
|
+
const result = await boundedFn(...args);
|
|
29338
29365
|
return result;
|
|
29339
29366
|
};
|
|
29340
29367
|
const setContainer = (el) => {
|
|
@@ -29343,6 +29370,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29343
29370
|
}
|
|
29344
29371
|
return _containerEl;
|
|
29345
29372
|
};
|
|
29373
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
29374
|
+
return (...args) => maybeThen(resolveLazy(), (fn) => {
|
|
29375
|
+
if (!isFunction(fn)) {
|
|
29376
|
+
throw qError(QError_qrlIsNotFunction);
|
|
29377
|
+
}
|
|
29378
|
+
if (beforeFn && beforeFn() === false) {
|
|
29379
|
+
return;
|
|
29380
|
+
}
|
|
29381
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
29382
|
+
const prevQrl = context.$qrl$;
|
|
29383
|
+
const prevEvent = context.$event$;
|
|
29384
|
+
context.$qrl$ = qrl2;
|
|
29385
|
+
context.$event$ || (context.$event$ = this);
|
|
29386
|
+
try {
|
|
29387
|
+
return invoke.call(this, context, fn, ...args);
|
|
29388
|
+
} finally {
|
|
29389
|
+
context.$qrl$ = prevQrl;
|
|
29390
|
+
context.$event$ = prevEvent;
|
|
29391
|
+
}
|
|
29392
|
+
});
|
|
29393
|
+
}
|
|
29394
|
+
const resolveLazy = (containerEl) => {
|
|
29395
|
+
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
29396
|
+
};
|
|
29346
29397
|
const wrapFn = (fn) => {
|
|
29347
29398
|
if (typeof fn !== "function" || !capture?.length && !captureRef?.length) {
|
|
29348
29399
|
return fn;
|
|
@@ -29392,30 +29443,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29392
29443
|
}
|
|
29393
29444
|
return symbolRef;
|
|
29394
29445
|
};
|
|
29395
|
-
const resolveLazy = (containerEl) => {
|
|
29396
|
-
return symbolRef !== null ? symbolRef : resolve(containerEl);
|
|
29397
|
-
};
|
|
29398
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
29399
|
-
return (...args) => maybeThen(resolveLazy(), (f) => {
|
|
29400
|
-
if (!isFunction(f)) {
|
|
29401
|
-
throw qError(QError_qrlIsNotFunction);
|
|
29402
|
-
}
|
|
29403
|
-
if (beforeFn && beforeFn() === false) {
|
|
29404
|
-
return;
|
|
29405
|
-
}
|
|
29406
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
29407
|
-
const prevQrl = context.$qrl$;
|
|
29408
|
-
const prevEvent = context.$event$;
|
|
29409
|
-
context.$qrl$ = qrl2;
|
|
29410
|
-
context.$event$ || (context.$event$ = this);
|
|
29411
|
-
try {
|
|
29412
|
-
return invoke.call(this, context, f, ...args);
|
|
29413
|
-
} finally {
|
|
29414
|
-
context.$qrl$ = prevQrl;
|
|
29415
|
-
context.$event$ = prevEvent;
|
|
29416
|
-
}
|
|
29417
|
-
});
|
|
29418
|
-
}
|
|
29419
29446
|
const createOrReuseInvocationContext = (invoke2) => {
|
|
29420
29447
|
if (invoke2 == null) {
|
|
29421
29448
|
return newInvokeContext();
|
|
@@ -29438,7 +29465,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
29438
29465
|
$symbol$: symbol,
|
|
29439
29466
|
$refSymbol$: refSymbol,
|
|
29440
29467
|
$hash$: hash3,
|
|
29441
|
-
getFn:
|
|
29468
|
+
getFn: bindFnToContext,
|
|
29442
29469
|
$capture$: capture,
|
|
29443
29470
|
$captureRef$: captureRef,
|
|
29444
29471
|
dev: null,
|
|
@@ -31132,6 +31159,7 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
31132
31159
|
};
|
|
31133
31160
|
this.serializationCtx = this.serializationCtxFactory(
|
|
31134
31161
|
SsrNode,
|
|
31162
|
+
DomRef,
|
|
31135
31163
|
this.symbolToChunkResolver,
|
|
31136
31164
|
opts.writer,
|
|
31137
31165
|
(vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
|
|
@@ -31895,10 +31923,10 @@ var SSRContainer = class extends _SharedContainer2 {
|
|
|
31895
31923
|
if (key === "ref") {
|
|
31896
31924
|
const lastNode = this.getLastNode();
|
|
31897
31925
|
if (isSignal3(value)) {
|
|
31898
|
-
value.value = lastNode;
|
|
31926
|
+
value.value = new DomRef(lastNode.id);
|
|
31899
31927
|
continue;
|
|
31900
31928
|
} else if (typeof value === "function") {
|
|
31901
|
-
value(lastNode);
|
|
31929
|
+
value(new DomRef(lastNode.id));
|
|
31902
31930
|
continue;
|
|
31903
31931
|
}
|
|
31904
31932
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwik.dev/core",
|
|
3
3
|
"description": "An open source framework for building instant loading web apps at any scale, without the extra effort.",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.2",
|
|
5
5
|
"author": "Qwik Team",
|
|
6
6
|
"bin": {
|
|
7
7
|
"qwik": "./qwik-cli.cjs"
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"image-size": "1.1.1",
|
|
15
15
|
"kleur": "4.1.5",
|
|
16
|
+
"ignore": "5.3.1",
|
|
16
17
|
"prettier": "3.3.3",
|
|
18
|
+
"ts-morph": "23.0.0",
|
|
17
19
|
"vitest": "2.1.4",
|
|
18
|
-
"@qwik.dev/core": "2.0.0-alpha.
|
|
20
|
+
"@qwik.dev/core": "2.0.0-alpha.2",
|
|
19
21
|
"@qwik.dev/dom": "2.1.19"
|
|
20
22
|
},
|
|
21
23
|
"engines": {
|
|
@@ -27,8 +29,8 @@
|
|
|
27
29
|
"import": {
|
|
28
30
|
"development": "./dist/core.mjs",
|
|
29
31
|
"production": "./dist/core.prod.mjs",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
+
"min": "./dist/core.min.mjs",
|
|
33
|
+
"default": "./dist/core.prod.mjs"
|
|
32
34
|
},
|
|
33
35
|
"require": {
|
|
34
36
|
"development": "./dist/core.cjs",
|
|
@@ -40,12 +42,12 @@
|
|
|
40
42
|
"require": "./dist/cli.cjs"
|
|
41
43
|
},
|
|
42
44
|
"./internal": {
|
|
43
|
-
"types": "./
|
|
45
|
+
"types": "./core-internal.d.ts",
|
|
44
46
|
"import": {
|
|
45
47
|
"development": "./dist/core.mjs",
|
|
46
48
|
"production": "./dist/core.prod.mjs",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
+
"min": "./dist/core.min.mjs",
|
|
50
|
+
"default": "./dist/core.prod.mjs"
|
|
49
51
|
},
|
|
50
52
|
"require": {
|
|
51
53
|
"development": "./dist/core.cjs",
|
|
@@ -58,8 +60,8 @@
|
|
|
58
60
|
"import": {
|
|
59
61
|
"development": "./dist/core.mjs",
|
|
60
62
|
"production": "./dist/core.prod.mjs",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
+
"min": "./dist/core.min.mjs",
|
|
64
|
+
"default": "./dist/core.prod.mjs"
|
|
63
65
|
},
|
|
64
66
|
"require": {
|
|
65
67
|
"development": "./dist/core.cjs",
|
|
@@ -72,8 +74,8 @@
|
|
|
72
74
|
"import": {
|
|
73
75
|
"development": "./dist/core.mjs",
|
|
74
76
|
"production": "./dist/core.prod.mjs",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
+
"min": "./dist/core.min.mjs",
|
|
78
|
+
"default": "./dist/core.mjs"
|
|
77
79
|
},
|
|
78
80
|
"require": {
|
|
79
81
|
"development": "./dist/core.cjs",
|
package/public.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export {
|
|
|
8
8
|
createComputed$,
|
|
9
9
|
createContextId,
|
|
10
10
|
createSignal,
|
|
11
|
+
CSSProperties,
|
|
11
12
|
// TODO remove this
|
|
12
13
|
event$,
|
|
13
14
|
EventHandler,
|
|
@@ -43,6 +44,7 @@ export {
|
|
|
43
44
|
SkipRender,
|
|
44
45
|
Slot,
|
|
45
46
|
sync$,
|
|
47
|
+
TaskCtx,
|
|
46
48
|
// TODO do we really want to export this?
|
|
47
49
|
untrack,
|
|
48
50
|
useComputed$,
|