marko 5.38.22 → 5.38.23
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.
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
9
|
module.exports = function (input) {
|
|
10
|
-
if (
|
|
11
|
-
|
|
10
|
+
if (input.toJSON) {
|
|
11
|
+
return input;
|
|
12
|
+
} else {
|
|
13
|
+
const newInput = { ...input };
|
|
14
|
+
Object.defineProperty(newInput, "toJSON", toJSONDescriptor);
|
|
15
|
+
return newInput;
|
|
12
16
|
}
|
|
13
17
|
};
|
package/dist/translator/index.js
CHANGED
|
@@ -426,6 +426,28 @@ const translate = exports.translate = {
|
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
+
let inputName = "input";
|
|
430
|
+
|
|
431
|
+
if (meta.implicitSplitComponent && isHTML) {
|
|
432
|
+
inputName = path.scope.generateUid(inputName);
|
|
433
|
+
renderBlock.unshiftContainer(
|
|
434
|
+
"body",
|
|
435
|
+
_compiler.types.variableDeclaration("const", [
|
|
436
|
+
_compiler.types.variableDeclarator(
|
|
437
|
+
_compiler.types.identifier("input"),
|
|
438
|
+
_compiler.types.callExpression(
|
|
439
|
+
(0, _babelUtils.importDefault)(
|
|
440
|
+
file,
|
|
441
|
+
"marko/src/runtime/helpers/skip-serialize.js",
|
|
442
|
+
"marko_skip_serialize"
|
|
443
|
+
),
|
|
444
|
+
[_compiler.types.identifier(inputName)]
|
|
445
|
+
)
|
|
446
|
+
)]
|
|
447
|
+
)
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
|
|
429
451
|
let rendererAssignment = _compiler.types.assignmentExpression(
|
|
430
452
|
"=",
|
|
431
453
|
templateRendererMember,
|
|
@@ -433,7 +455,7 @@ const translate = exports.translate = {
|
|
|
433
455
|
_compiler.types.functionExpression(
|
|
434
456
|
null,
|
|
435
457
|
[
|
|
436
|
-
_compiler.types.identifier(
|
|
458
|
+
_compiler.types.identifier(inputName),
|
|
437
459
|
_compiler.types.identifier("out"),
|
|
438
460
|
file._componentDefIdentifier,
|
|
439
461
|
file._componentInstanceIdentifier,
|
|
@@ -464,22 +486,6 @@ const translate = exports.translate = {
|
|
|
464
486
|
|
|
465
487
|
path.pushContainer("body", _compiler.types.expressionStatement(rendererAssignment));
|
|
466
488
|
|
|
467
|
-
if (meta.implicitSplitComponent && isHTML) {
|
|
468
|
-
renderBlock.unshiftContainer(
|
|
469
|
-
"body",
|
|
470
|
-
_compiler.types.expressionStatement(
|
|
471
|
-
_compiler.types.callExpression(
|
|
472
|
-
(0, _babelUtils.importDefault)(
|
|
473
|
-
file,
|
|
474
|
-
"marko/src/runtime/helpers/skip-serialize.js",
|
|
475
|
-
"marko_skip_serialize"
|
|
476
|
-
),
|
|
477
|
-
[_compiler.types.identifier("input")]
|
|
478
|
-
)
|
|
479
|
-
)
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
489
|
renderBlock.remove();
|
|
484
490
|
|
|
485
491
|
if (!isHTML) {
|
package/package.json
CHANGED
|
@@ -7,7 +7,11 @@ var toJSONDescriptor = {
|
|
|
7
7
|
},
|
|
8
8
|
};
|
|
9
9
|
module.exports = function (input) {
|
|
10
|
-
if (
|
|
11
|
-
|
|
10
|
+
if (input.toJSON) {
|
|
11
|
+
return input;
|
|
12
|
+
} else {
|
|
13
|
+
const newInput = { ...input };
|
|
14
|
+
Object.defineProperty(newInput, "toJSON", toJSONDescriptor);
|
|
15
|
+
return newInput;
|
|
12
16
|
}
|
|
13
17
|
};
|
package/src/translator/index.js
CHANGED
|
@@ -426,6 +426,28 @@ export const translate = {
|
|
|
426
426
|
);
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
+
let inputName = "input";
|
|
430
|
+
|
|
431
|
+
if (meta.implicitSplitComponent && isHTML) {
|
|
432
|
+
inputName = path.scope.generateUid(inputName);
|
|
433
|
+
renderBlock.unshiftContainer(
|
|
434
|
+
"body",
|
|
435
|
+
t.variableDeclaration("const", [
|
|
436
|
+
t.variableDeclarator(
|
|
437
|
+
t.identifier("input"),
|
|
438
|
+
t.callExpression(
|
|
439
|
+
importDefault(
|
|
440
|
+
file,
|
|
441
|
+
"marko/src/runtime/helpers/skip-serialize.js",
|
|
442
|
+
"marko_skip_serialize",
|
|
443
|
+
),
|
|
444
|
+
[t.identifier(inputName)],
|
|
445
|
+
),
|
|
446
|
+
),
|
|
447
|
+
]),
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
|
|
429
451
|
let rendererAssignment = t.assignmentExpression(
|
|
430
452
|
"=",
|
|
431
453
|
templateRendererMember,
|
|
@@ -433,7 +455,7 @@ export const translate = {
|
|
|
433
455
|
t.functionExpression(
|
|
434
456
|
null,
|
|
435
457
|
[
|
|
436
|
-
t.identifier(
|
|
458
|
+
t.identifier(inputName),
|
|
437
459
|
t.identifier("out"),
|
|
438
460
|
file._componentDefIdentifier,
|
|
439
461
|
file._componentInstanceIdentifier,
|
|
@@ -464,22 +486,6 @@ export const translate = {
|
|
|
464
486
|
|
|
465
487
|
path.pushContainer("body", t.expressionStatement(rendererAssignment));
|
|
466
488
|
|
|
467
|
-
if (meta.implicitSplitComponent && isHTML) {
|
|
468
|
-
renderBlock.unshiftContainer(
|
|
469
|
-
"body",
|
|
470
|
-
t.expressionStatement(
|
|
471
|
-
t.callExpression(
|
|
472
|
-
importDefault(
|
|
473
|
-
file,
|
|
474
|
-
"marko/src/runtime/helpers/skip-serialize.js",
|
|
475
|
-
"marko_skip_serialize",
|
|
476
|
-
),
|
|
477
|
-
[t.identifier("input")],
|
|
478
|
-
),
|
|
479
|
-
),
|
|
480
|
-
);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
489
|
renderBlock.remove();
|
|
484
490
|
|
|
485
491
|
if (!isHTML) {
|