marko 5.38.2 → 5.38.4

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.
@@ -0,0 +1,5 @@
1
+ /** File for types only, not actual implementation **/
2
+
3
+ export interface Input extends Marko.HTML.Script {
4
+ value?(): unknown;
5
+ }
@@ -2,6 +2,7 @@
2
2
  const {
3
3
  T_
4
4
  } = require("../../components/ComponentsContext");
5
+ const ComponentDef = require("../../components/ComponentDef");
5
6
  const defineComponent = require("../../components/defineComponent");
6
7
  const { r: registerComponent } = require("../../components/registry");
7
8
  const createRenderer = require("../../components/renderer");
@@ -46,6 +47,14 @@ exports.p = function (domCompat) {
46
47
  this.bq_(customEvents, scopeId);
47
48
  };
48
49
 
50
+ const defDeserialize = ComponentDef._F_;
51
+ ComponentDef._F_ = function (o, types, global, registry) {
52
+ if (typeof o[2] === "number") {
53
+ o[2] = self[global.runtimeId][global.renderId].s[o[2]].m5i;
54
+ }
55
+ return defDeserialize(o, types, global, registry);
56
+ };
57
+
49
58
  const TagsCompatId = "tags-compat";
50
59
  const TagsCompat = createRenderer(
51
60
  function (_, out, componentDef, component) {
@@ -43,7 +43,7 @@ exports.p = function (htmlCompat) {
43
43
  writers.classAPI = [];
44
44
  }
45
45
 
46
- if (componentDefs) {
46
+ if (componentDefs?.length) {
47
47
  scripts = _h_($global, componentDefs);
48
48
  if (scripts) {
49
49
  htmlCompat.ensureState($global).walkOnNextFlush = true;
@@ -198,11 +198,15 @@ exports.p = function (htmlCompat) {
198
198
 
199
199
  const componentDef = componentsContext.b_[0];
200
200
  if (componentDef) {
201
- htmlCompat.writeSetScopeForComponent(branchId, componentDef.id);
201
+ const rawInput = componentDef.s_.P_;
202
+ const { toJSON: _, ...serializeInput } = rawInput;
202
203
  componentDef.s_.X_ = customEvents;
203
- if (componentDef.s_.P_.toJSON) {
204
- componentDef.s_.P_.toJSON = undefined;
205
- }
204
+ rawInput.toJSON = () => branchId;
205
+ htmlCompat.writeSetScopeForComponent(
206
+ branchId,
207
+ componentDef.id,
208
+ serializeInput
209
+ );
206
210
  }
207
211
  } else {
208
212
  renderBody5(out, input, ...args);
@@ -404,6 +404,9 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
404
404
  rawOpenTag: true
405
405
  }
406
406
  },
407
+ "<script>": {
408
+ types: "marko/src/core-tags/core/script.d.marko"
409
+ },
407
410
  "<*>": {
408
411
  "@key": {
409
412
  type: "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.38.2",
3
+ "version": "5.38.4",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -71,7 +71,7 @@
71
71
  "dependencies": {
72
72
  "@babel/runtime": "^7.28.2",
73
73
  "@marko/compiler": "^5.39.45",
74
- "@marko/runtime-tags": "^6.0.122",
74
+ "@marko/runtime-tags": "^6.0.123",
75
75
  "app-module-path": "^2.2.0",
76
76
  "argly": "^1.2.0",
77
77
  "browser-refresh-client": "1.1.4",
@@ -0,0 +1,5 @@
1
+ /** File for types only, not actual implementation **/
2
+
3
+ export interface Input extends Marko.HTML.Script {
4
+ value?(): unknown;
5
+ }
@@ -2,6 +2,7 @@ const { ___componentLookup } = require("@internal/components-util");
2
2
  const {
3
3
  ___getComponentsContext,
4
4
  } = require("../../components/ComponentsContext");
5
+ const ComponentDef = require("../../components/ComponentDef");
5
6
  const defineComponent = require("../../components/defineComponent");
6
7
  const { r: registerComponent } = require("../../components/registry");
7
8
  const createRenderer = require("../../components/renderer");
@@ -46,6 +47,14 @@ exports.p = function (domCompat) {
46
47
  this.___setCustomEventsOriginal(customEvents, scopeId);
47
48
  };
48
49
 
50
+ const defDeserialize = ComponentDef.___deserialize;
51
+ ComponentDef.___deserialize = function (o, types, global, registry) {
52
+ if (typeof o[2] === "number") {
53
+ o[2] = self[global.runtimeId][global.renderId].s[o[2]].m5i;
54
+ }
55
+ return defDeserialize(o, types, global, registry);
56
+ };
57
+
49
58
  const TagsCompatId = "tags-compat";
50
59
  const TagsCompat = createRenderer(
51
60
  function (_, out, componentDef, component) {
@@ -43,7 +43,7 @@ exports.p = function (htmlCompat) {
43
43
  writers.classAPI = [];
44
44
  }
45
45
 
46
- if (componentDefs) {
46
+ if (componentDefs?.length) {
47
47
  scripts = ___getInitComponentsCodeForDefs($global, componentDefs);
48
48
  if (scripts) {
49
49
  htmlCompat.ensureState($global).walkOnNextFlush = true;
@@ -198,11 +198,15 @@ exports.p = function (htmlCompat) {
198
198
 
199
199
  const componentDef = componentsContext.___components[0];
200
200
  if (componentDef) {
201
- htmlCompat.writeSetScopeForComponent(branchId, componentDef.id);
201
+ const rawInput = componentDef.___component.___input;
202
+ const { toJSON: _, ...serializeInput } = rawInput;
202
203
  componentDef.___component.___customEvents = customEvents;
203
- if (componentDef.___component.___input.toJSON) {
204
- componentDef.___component.___input.toJSON = undefined;
205
- }
204
+ rawInput.toJSON = () => branchId;
205
+ htmlCompat.writeSetScopeForComponent(
206
+ branchId,
207
+ componentDef.id,
208
+ serializeInput,
209
+ );
206
210
  }
207
211
  } else {
208
212
  renderBody5(out, input, ...args);
@@ -404,6 +404,9 @@ export default {
404
404
  rawOpenTag: true,
405
405
  },
406
406
  },
407
+ "<script>": {
408
+ types: "marko/src/core-tags/core/script.d.marko",
409
+ },
407
410
  "<*>": {
408
411
  "@key": {
409
412
  type: "string",