marko 5.39.24 → 5.39.26

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2024 eBay Inc. and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -42,6 +42,8 @@ existingComponentDef)
42
42
  if (componentsContext.w_) {
43
43
  var forceBoundary = componentsContext.w_;
44
44
  componentsContext.w_ = false;
45
+ // `"preserve"` is set by the tags-compat registration for a preserved
46
+ // boundary (interop dynamic-tag); any other truthy mode is a plain split.
45
47
  if (forceBoundary === "preserve") {
46
48
  isSplitComponent = true;
47
49
  } else {
@@ -70,7 +70,9 @@ exports.p = function (domCompat) {
70
70
  const defDeserialize = ComponentDef._F_;
71
71
  ComponentDef._F_ = function (o, types, global, registry) {
72
72
  if (typeof o[2] === "number") {
73
- o[2] = domCompat.getScope(global, o[2]).m5i;
73
+ // `getScope` can return undefined for a not-yet-resumed scope (streaming /
74
+ // out-of-order resume of a class-in-tags child); match every other consumer.
75
+ o[2] = domCompat.getScope(global, o[2])?.m5i;
74
76
  }
75
77
  return defDeserialize(o, types, global, registry);
76
78
  };
@@ -191,12 +193,10 @@ exports.p = function (domCompat) {
191
193
 
192
194
  for (const key in rawInput) {
193
195
  const value = rawInput[key];
194
- if (/^on[-A-Z]/.test(key)) {
195
- if (typeof value === "function") {
196
- (customEvents || (customEvents = {}))[
197
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase()] =
198
- [value];
199
- }
196
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
197
+ (customEvents || (customEvents = {}))[toCustomEventName(key)] = [
198
+ value];
199
+
200
200
  } else {
201
201
  normalizedInput[key === "content" ? "renderBody" : key] = value;
202
202
  }
@@ -260,4 +260,12 @@ exports.p = function (domCompat) {
260
260
  _: RenderBodyComponent,
261
261
  Component: defineComponent({}, RenderBodyComponent)
262
262
  }));
263
- };
263
+ };
264
+
265
+ function toCustomEventName(key) {
266
+ return key[2] === "-" ?
267
+ key.slice(3) :
268
+ key.
269
+ slice(2).
270
+ replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
271
+ }
@@ -8,7 +8,6 @@ const {
8
8
  const createRenderer = require("../../components/renderer");
9
9
  const defaultCreateOut = require("../../createOut");
10
10
  const dynamicTag5 = require("../dynamic-tag");
11
- const PRESERVE_BOUNDARY = "preserve";
12
11
 
13
12
  exports.p = function (htmlCompat) {
14
13
  const writersByGlobal = new WeakMap();
@@ -187,15 +186,13 @@ exports.p = function (htmlCompat) {
187
186
 
188
187
  for (const key in originalInput) {
189
188
  const value = originalInput[key];
190
- if (/^on[-A-Z]/.test(key)) {
191
- if (typeof value === "function") {
192
- (customEvents || (customEvents = [])).push([
193
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase(),
194
- value]
195
- );
196
- forceBoundary = true;
197
- value.toJSON = htmlCompat.toJSON(state);
198
- }
189
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
190
+ (customEvents || (customEvents = [])).push([
191
+ toCustomEventName(key),
192
+ value]
193
+ );
194
+ forceBoundary = true;
195
+ value.toJSON = htmlCompat.toJSON(state);
199
196
  } else {
200
197
  input[key === "content" ? "renderBody" : key] = value;
201
198
  }
@@ -243,6 +240,14 @@ exports.p = function (htmlCompat) {
243
240
  };
244
241
  };
245
242
 
243
+ function toCustomEventName(key) {
244
+ return key[2] === "-" ?
245
+ key.slice(3) :
246
+ key.
247
+ slice(2).
248
+ replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
249
+ }
250
+
246
251
  function hasBridgedClassEvent(input) {
247
252
  if (input && typeof input === "object" && !Array.isArray(input)) {
248
253
  for (const key in input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.24",
3
+ "version": "5.39.26",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
@@ -66,12 +66,9 @@
66
66
  "translator/package.json",
67
67
  "translator/index.d.ts"
68
68
  ],
69
- "scripts": {
70
- "build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
71
- },
72
69
  "dependencies": {
73
- "@marko/compiler": "^5.41.0",
74
- "@marko/runtime-tags": "^6.3.16",
70
+ "@marko/compiler": "^5.41.4",
71
+ "@marko/runtime-tags": "^6.3.17",
75
72
  "app-module-path": "^2.2.0",
76
73
  "argly": "^1.2.0",
77
74
  "browser-refresh-client": "1.1.4",
@@ -86,10 +83,16 @@
86
83
  "self-closing-tags": "^1.0.1",
87
84
  "warp10": "^2.1.0"
88
85
  },
86
+ "devDependencies": {
87
+ "marko": "5.39.26"
88
+ },
89
89
  "engines": {
90
90
  "node": "18 || 20 || >=22"
91
91
  },
92
92
  "logo": {
93
93
  "url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
94
+ },
95
+ "scripts": {
96
+ "build": "babel ./src --out-dir ./dist --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
94
97
  }
95
- }
98
+ }
@@ -42,6 +42,8 @@ module.exports = function beginComponent(
42
42
  if (componentsContext.___forceBoundary) {
43
43
  var forceBoundary = componentsContext.___forceBoundary;
44
44
  componentsContext.___forceBoundary = false;
45
+ // `"preserve"` is set by the tags-compat registration for a preserved
46
+ // boundary (interop dynamic-tag); any other truthy mode is a plain split.
45
47
  if (forceBoundary === "preserve") {
46
48
  isSplitComponent = true;
47
49
  } else {
@@ -70,7 +70,9 @@ exports.p = function (domCompat) {
70
70
  const defDeserialize = ComponentDef.___deserialize;
71
71
  ComponentDef.___deserialize = function (o, types, global, registry) {
72
72
  if (typeof o[2] === "number") {
73
- o[2] = domCompat.getScope(global, o[2]).m5i;
73
+ // `getScope` can return undefined for a not-yet-resumed scope (streaming /
74
+ // out-of-order resume of a class-in-tags child); match every other consumer.
75
+ o[2] = domCompat.getScope(global, o[2])?.m5i;
74
76
  }
75
77
  return defDeserialize(o, types, global, registry);
76
78
  };
@@ -191,12 +193,10 @@ exports.p = function (domCompat) {
191
193
 
192
194
  for (const key in rawInput) {
193
195
  const value = rawInput[key];
194
- if (/^on[-A-Z]/.test(key)) {
195
- if (typeof value === "function") {
196
- (customEvents || (customEvents = {}))[
197
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase()
198
- ] = [value];
199
- }
196
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
197
+ (customEvents || (customEvents = {}))[toCustomEventName(key)] = [
198
+ value,
199
+ ];
200
200
  } else {
201
201
  normalizedInput[key === "content" ? "renderBody" : key] = value;
202
202
  }
@@ -261,3 +261,11 @@ exports.p = function (domCompat) {
261
261
  Component: defineComponent({}, RenderBodyComponent),
262
262
  }));
263
263
  };
264
+
265
+ function toCustomEventName(key) {
266
+ return key[2] === "-"
267
+ ? key.slice(3)
268
+ : key
269
+ .slice(2)
270
+ .replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
271
+ }
@@ -8,7 +8,6 @@ const {
8
8
  const createRenderer = require("../../components/renderer");
9
9
  const defaultCreateOut = require("../../createOut");
10
10
  const dynamicTag5 = require("../dynamic-tag");
11
- const PRESERVE_BOUNDARY = "preserve";
12
11
 
13
12
  exports.p = function (htmlCompat) {
14
13
  const writersByGlobal = new WeakMap();
@@ -187,15 +186,13 @@ exports.p = function (htmlCompat) {
187
186
 
188
187
  for (const key in originalInput) {
189
188
  const value = originalInput[key];
190
- if (/^on[-A-Z]/.test(key)) {
191
- if (typeof value === "function") {
192
- (customEvents || (customEvents = [])).push([
193
- key[2] === "-" ? key.slice(3) : key.slice(2).toLowerCase(),
194
- value,
195
- ]);
196
- forceBoundary = true;
197
- value.toJSON = htmlCompat.toJSON(state);
198
- }
189
+ if (/^on[-A-Z]/.test(key) && typeof value === "function") {
190
+ (customEvents || (customEvents = [])).push([
191
+ toCustomEventName(key),
192
+ value,
193
+ ]);
194
+ forceBoundary = true;
195
+ value.toJSON = htmlCompat.toJSON(state);
199
196
  } else {
200
197
  input[key === "content" ? "renderBody" : key] = value;
201
198
  }
@@ -243,6 +240,14 @@ exports.p = function (htmlCompat) {
243
240
  };
244
241
  };
245
242
 
243
+ function toCustomEventName(key) {
244
+ return key[2] === "-"
245
+ ? key.slice(3)
246
+ : key
247
+ .slice(2)
248
+ .replace(/[A-Z]/g, (m, i) => (i ? "-" : "") + m.toLowerCase());
249
+ }
250
+
246
251
  function hasBridgedClassEvent(input) {
247
252
  if (input && typeof input === "object" && !Array.isArray(input)) {
248
253
  for (const key in input) {