@vue-jsx-vapor/compiler 0.2.5 → 0.2.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/index.cjs +16 -3
- package/dist/index.js +16 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -948,11 +948,13 @@ function processTextLike(context) {
|
|
948
948
|
const nexts = _optionalChain([context, 'access', _11 => _11.parent, 'access', _12 => _12.node, 'access', _13 => _13.children, 'optionalAccess', _14 => _14.slice, 'call', _15 => _15(context.index)]);
|
949
949
|
const idx = nexts.findIndex((n) => !isTextLike(n));
|
950
950
|
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
951
|
+
const id = context.reference();
|
952
|
+
const values = createTextLikeExpressions(nodes, context);
|
951
953
|
context.dynamic.flags |= 4 /* INSERT */ | 2 /* NON_TEMPLATE */;
|
952
954
|
context.registerOperation({
|
953
955
|
type: 11 /* CREATE_TEXT_NODE */,
|
954
|
-
id
|
955
|
-
values
|
956
|
+
id,
|
957
|
+
values,
|
956
958
|
jsx: true
|
957
959
|
});
|
958
960
|
}
|
@@ -975,7 +977,7 @@ function createTextLikeExpressions(nodes, context) {
|
|
975
977
|
for (const node of nodes) {
|
976
978
|
seen.get(context.root).add(node);
|
977
979
|
if (isEmptyText(node)) continue;
|
978
|
-
values.push(resolveExpression(node, context,
|
980
|
+
values.push(resolveExpression(node, context, !context.inVOnce));
|
979
981
|
}
|
980
982
|
return values;
|
981
983
|
}
|
@@ -1401,6 +1403,16 @@ var transformVHtml = (dir, node, context) => {
|
|
1401
1403
|
);
|
1402
1404
|
};
|
1403
1405
|
|
1406
|
+
// src/transforms/vOnce.ts
|
1407
|
+
var transformVOnce = (node, context) => {
|
1408
|
+
if (
|
1409
|
+
// !context.inSSR &&
|
1410
|
+
node.type === "JSXElement" && findProp(node, "v-once")
|
1411
|
+
) {
|
1412
|
+
context.inVOnce = true;
|
1413
|
+
}
|
1414
|
+
};
|
1415
|
+
|
1404
1416
|
// src/compile.ts
|
1405
1417
|
function compile(source, options = {}) {
|
1406
1418
|
const resolvedOptions = _shared.extend.call(void 0, {}, options, {
|
@@ -1452,6 +1464,7 @@ function compile(source, options = {}) {
|
|
1452
1464
|
function getBaseTransformPreset() {
|
1453
1465
|
return [
|
1454
1466
|
[
|
1467
|
+
transformVOnce,
|
1455
1468
|
transformVFor,
|
1456
1469
|
transformTemplateRef,
|
1457
1470
|
transformText,
|
package/dist/index.js
CHANGED
@@ -948,11 +948,13 @@ function processTextLike(context) {
|
|
948
948
|
const nexts = context.parent.node.children?.slice(context.index);
|
949
949
|
const idx = nexts.findIndex((n) => !isTextLike(n));
|
950
950
|
const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
|
951
|
+
const id = context.reference();
|
952
|
+
const values = createTextLikeExpressions(nodes, context);
|
951
953
|
context.dynamic.flags |= 4 /* INSERT */ | 2 /* NON_TEMPLATE */;
|
952
954
|
context.registerOperation({
|
953
955
|
type: 11 /* CREATE_TEXT_NODE */,
|
954
|
-
id
|
955
|
-
values
|
956
|
+
id,
|
957
|
+
values,
|
956
958
|
jsx: true
|
957
959
|
});
|
958
960
|
}
|
@@ -975,7 +977,7 @@ function createTextLikeExpressions(nodes, context) {
|
|
975
977
|
for (const node of nodes) {
|
976
978
|
seen.get(context.root).add(node);
|
977
979
|
if (isEmptyText(node)) continue;
|
978
|
-
values.push(resolveExpression(node, context,
|
980
|
+
values.push(resolveExpression(node, context, !context.inVOnce));
|
979
981
|
}
|
980
982
|
return values;
|
981
983
|
}
|
@@ -1401,6 +1403,16 @@ var transformVHtml = (dir, node, context) => {
|
|
1401
1403
|
);
|
1402
1404
|
};
|
1403
1405
|
|
1406
|
+
// src/transforms/vOnce.ts
|
1407
|
+
var transformVOnce = (node, context) => {
|
1408
|
+
if (
|
1409
|
+
// !context.inSSR &&
|
1410
|
+
node.type === "JSXElement" && findProp(node, "v-once")
|
1411
|
+
) {
|
1412
|
+
context.inVOnce = true;
|
1413
|
+
}
|
1414
|
+
};
|
1415
|
+
|
1404
1416
|
// src/compile.ts
|
1405
1417
|
function compile(source, options = {}) {
|
1406
1418
|
const resolvedOptions = extend5({}, options, {
|
@@ -1452,6 +1464,7 @@ function compile(source, options = {}) {
|
|
1452
1464
|
function getBaseTransformPreset() {
|
1453
1465
|
return [
|
1454
1466
|
[
|
1467
|
+
transformVOnce,
|
1455
1468
|
transformVFor,
|
1456
1469
|
transformTemplateRef,
|
1457
1470
|
transformText,
|