marko 5.38.21 → 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 (!input.toJSON) {
11
- Object.defineProperty(input, "toJSON", toJSONDescriptor);
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
  };
@@ -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("input"),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.38.21",
3
+ "version": "5.38.23",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -69,8 +69,8 @@
69
69
  "build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
70
70
  },
71
71
  "dependencies": {
72
- "@marko/compiler": "^5.39.51",
73
- "@marko/runtime-tags": "^6.0.143",
72
+ "@marko/compiler": "^5.39.53",
73
+ "@marko/runtime-tags": "^6.0.144",
74
74
  "app-module-path": "^2.2.0",
75
75
  "argly": "^1.2.0",
76
76
  "browser-refresh-client": "1.1.4",
@@ -7,7 +7,11 @@ var toJSONDescriptor = {
7
7
  },
8
8
  };
9
9
  module.exports = function (input) {
10
- if (!input.toJSON) {
11
- Object.defineProperty(input, "toJSON", toJSONDescriptor);
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
  };
@@ -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("input"),
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) {