@qwik.dev/core 2.0.0-alpha.2 → 2.0.0-alpha.3
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.wasm.cjs +259 -272
- package/bindings/qwik.wasm.mjs +259 -272
- 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 +2 -2
- package/dist/core-internal.d.ts +4 -7
- package/dist/core.cjs +59 -52
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +59 -52
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +35 -25
- package/dist/core.prod.mjs +36 -25
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +50 -38
- package/dist/optimizer.mjs +52 -39
- package/dist/prefetch/package.json +1 -1
- package/dist/server.cjs +63 -56
- package/dist/server.mjs +63 -56
- package/dist/testing/index.cjs +61 -54
- package/dist/testing/index.mjs +61 -54
- package/dist/testing/package.json +1 -1
- package/package.json +4 -4
package/dist/core.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core 2.0.0-alpha.3-dev+418fd6d
|
|
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
|
|
@@ -3292,48 +3292,48 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
3292
3292
|
/////////////////////////////////////////////////////////////////////////////
|
|
3293
3293
|
/////////////////////////////////////////////////////////////////////////////
|
|
3294
3294
|
function descendContentToProject(children, host) {
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
const slotName = prop;
|
|
3309
|
-
projections.push(slotName);
|
|
3310
|
-
projections.push(createProjectionJSXNode(slotName));
|
|
3311
|
-
}
|
|
3295
|
+
const projectionChildren = Array.isArray(children) ? children : [children];
|
|
3296
|
+
const createProjectionJSXNode = (slotName) => {
|
|
3297
|
+
return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
|
|
3298
|
+
};
|
|
3299
|
+
const projections = [];
|
|
3300
|
+
if (host) {
|
|
3301
|
+
// we need to create empty projections for all the slots to remove unused slots content
|
|
3302
|
+
for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
|
|
3303
|
+
const prop = host[i];
|
|
3304
|
+
if (isSlotProp(prop)) {
|
|
3305
|
+
const slotName = prop;
|
|
3306
|
+
projections.push(slotName);
|
|
3307
|
+
projections.push(createProjectionJSXNode(slotName));
|
|
3312
3308
|
}
|
|
3313
3309
|
}
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3310
|
+
}
|
|
3311
|
+
if (projections.length === 0 && children == null) {
|
|
3312
|
+
// We did not find any existing slots and we don't have any children to project.
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
3315
|
+
/// STEP 1: Bucketize the children based on the projection name.
|
|
3316
|
+
for (let i = 0; i < projectionChildren.length; i++) {
|
|
3317
|
+
const child = projectionChildren[i];
|
|
3318
|
+
const slotName = String((isJSXNode(child) && directGetPropsProxyProp(child, QSlot)) || QDefaultSlot);
|
|
3319
|
+
const idx = mapApp_findIndx(projections, slotName, 0);
|
|
3320
|
+
let jsxBucket;
|
|
3321
|
+
if (idx >= 0) {
|
|
3322
|
+
jsxBucket = projections[idx + 1];
|
|
3323
|
+
}
|
|
3324
|
+
else {
|
|
3325
|
+
projections.splice(~idx, 0, slotName, (jsxBucket = createProjectionJSXNode(slotName)));
|
|
3330
3326
|
}
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3327
|
+
const removeProjection = child === false;
|
|
3328
|
+
if (!removeProjection) {
|
|
3329
|
+
jsxBucket.children.push(child);
|
|
3334
3330
|
}
|
|
3335
|
-
descend(projections, true);
|
|
3336
3331
|
}
|
|
3332
|
+
/// STEP 2: remove the names
|
|
3333
|
+
for (let i = projections.length - 2; i >= 0; i = i - 2) {
|
|
3334
|
+
projections.splice(i, 1);
|
|
3335
|
+
}
|
|
3336
|
+
descend(projections, true);
|
|
3337
3337
|
}
|
|
3338
3338
|
function expectProjection() {
|
|
3339
3339
|
const jsxNode = jsxValue;
|
|
@@ -3855,7 +3855,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
|
|
|
3855
3855
|
container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps);
|
|
3856
3856
|
}
|
|
3857
3857
|
}
|
|
3858
|
-
|
|
3858
|
+
descendContentToProject(jsxNode.children, host);
|
|
3859
3859
|
}
|
|
3860
3860
|
else {
|
|
3861
3861
|
const lookupKey = jsxNode.key;
|
|
@@ -4356,9 +4356,13 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
|
|
|
4356
4356
|
case ChoreType.COMPONENT:
|
|
4357
4357
|
case ChoreType.COMPONENT_SSR:
|
|
4358
4358
|
returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), (jsx) => {
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4359
|
+
if (chore.$type$ === ChoreType.COMPONENT) {
|
|
4360
|
+
const styleScopedId = container.getHostProp(host, QScopedStyle);
|
|
4361
|
+
return vnode_diff(container, jsx, host, addComponentStylePrefix(styleScopedId));
|
|
4362
|
+
}
|
|
4363
|
+
else {
|
|
4364
|
+
return jsx;
|
|
4365
|
+
}
|
|
4362
4366
|
}, (err) => container.handleError(err, host));
|
|
4363
4367
|
break;
|
|
4364
4368
|
case ChoreType.RESOURCE:
|
|
@@ -4533,7 +4537,7 @@ function sortedInsert(sortedArray, value) {
|
|
|
4533
4537
|
*
|
|
4534
4538
|
* @public
|
|
4535
4539
|
*/
|
|
4536
|
-
const version = "2.0.0-alpha.
|
|
4540
|
+
const version = "2.0.0-alpha.3-dev+418fd6d";
|
|
4537
4541
|
|
|
4538
4542
|
/** @internal */
|
|
4539
4543
|
class _SharedContainer {
|
|
@@ -5083,11 +5087,6 @@ class DomContainer extends _SharedContainer {
|
|
|
5083
5087
|
parseQRL(qrl) {
|
|
5084
5088
|
return inflateQRL(this, parseQRL(qrl));
|
|
5085
5089
|
}
|
|
5086
|
-
processJsx(host, jsx) {
|
|
5087
|
-
// console.log('>>>> processJsx', String(host));
|
|
5088
|
-
const styleScopedId = this.getHostProp(host, QScopedStyle);
|
|
5089
|
-
return vnode_diff(this, jsx, host, addComponentStylePrefix(styleScopedId));
|
|
5090
|
-
}
|
|
5091
5090
|
handleError(err, host) {
|
|
5092
5091
|
if (qDev) {
|
|
5093
5092
|
// Clean vdom
|
|
@@ -8049,7 +8048,10 @@ const inflate = (container, target, typeId, data) => {
|
|
|
8049
8048
|
if (valType === TypeIds.RootRef || valType >= TypeIds.Error) {
|
|
8050
8049
|
Object.defineProperty(target, key, {
|
|
8051
8050
|
get() {
|
|
8052
|
-
|
|
8051
|
+
const value = deserializeData(container, valType, valData);
|
|
8052
|
+
// after first deserialize, we can replace the Object.defineProperty with the value
|
|
8053
|
+
target[key] = value;
|
|
8054
|
+
return value;
|
|
8053
8055
|
},
|
|
8054
8056
|
set(value) {
|
|
8055
8057
|
Object.defineProperty(target, key, {
|
|
@@ -8391,6 +8393,7 @@ function inflateQRL(container, qrl) {
|
|
|
8391
8393
|
}
|
|
8392
8394
|
return qrl;
|
|
8393
8395
|
}
|
|
8396
|
+
let isDomRef = (obj) => false;
|
|
8394
8397
|
const createSerializationContext = (
|
|
8395
8398
|
/**
|
|
8396
8399
|
* Node constructor, for instanceof checks.
|
|
@@ -8426,7 +8429,7 @@ prepVNodeData) => {
|
|
|
8426
8429
|
return id;
|
|
8427
8430
|
};
|
|
8428
8431
|
const isSsrNode = (NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false);
|
|
8429
|
-
|
|
8432
|
+
isDomRef = (DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false);
|
|
8430
8433
|
return {
|
|
8431
8434
|
$serialize$() {
|
|
8432
8435
|
serialize(this);
|
|
@@ -8579,7 +8582,7 @@ prepVNodeData) => {
|
|
|
8579
8582
|
discoveredValues.push(obj.vnodeData);
|
|
8580
8583
|
}
|
|
8581
8584
|
else if (isDomRef(obj)) {
|
|
8582
|
-
discoveredValues.push(obj
|
|
8585
|
+
discoveredValues.push(obj.$ssrNode$.id);
|
|
8583
8586
|
}
|
|
8584
8587
|
else if (isJSXNode(obj)) {
|
|
8585
8588
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
@@ -8877,7 +8880,8 @@ function serialize(serializationContext) {
|
|
|
8877
8880
|
}
|
|
8878
8881
|
}
|
|
8879
8882
|
else if ($isDomRef$(value)) {
|
|
8880
|
-
|
|
8883
|
+
value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE;
|
|
8884
|
+
output(TypeIds.RefVNode, value.$ssrNode$.id);
|
|
8881
8885
|
}
|
|
8882
8886
|
else if (value instanceof Signal) {
|
|
8883
8887
|
/**
|
|
@@ -9295,6 +9299,9 @@ const canSerialize = (value) => {
|
|
|
9295
9299
|
else if (value instanceof Uint8Array) {
|
|
9296
9300
|
return true;
|
|
9297
9301
|
}
|
|
9302
|
+
else if (isDomRef?.(value)) {
|
|
9303
|
+
return true;
|
|
9304
|
+
}
|
|
9298
9305
|
}
|
|
9299
9306
|
else if (typeof value === 'function') {
|
|
9300
9307
|
if (isQrl(value) || isQwikComponent(value)) {
|