marko 5.39.26 → 5.39.28

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.
Files changed (35) hide show
  1. package/dist/node_modules/@internal/components-beginComponent/index-browser.js +1 -2
  2. package/dist/node_modules/@internal/components-entry/index.js +8 -2
  3. package/dist/node_modules/@internal/components-registry/index-browser.js +9 -7
  4. package/dist/translator/index.js +7 -6
  5. package/dist/translator/tag/index.js +3 -2
  6. package/dist/translator/tag/native-tag[html]/index.js +3 -2
  7. package/dist/translator/taglib/core/parse-module-code.js +4 -2
  8. package/dist/translator/taglib/core/transform-style.js +3 -2
  9. package/dist/translator/taglib/core/translate-include-content.js +4 -3
  10. package/dist/translator/text/index[vdom].js +5 -3
  11. package/dist/translator/util/add-dependencies.js +4 -3
  12. package/dist/translator/util/optimize-vdom-create.js +5 -3
  13. package/package.json +24 -23
  14. package/src/node_modules/@internal/components-beginComponent/index-browser.js +4 -5
  15. package/src/node_modules/@internal/components-beginComponent/index.js +3 -3
  16. package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +4 -4
  17. package/src/node_modules/@internal/components-entry/index.js +12 -6
  18. package/src/node_modules/@internal/components-registry/index-browser.js +23 -21
  19. package/src/node_modules/@internal/components-registry/index.js +1 -1
  20. package/src/node_modules/@internal/components-util/index-browser.js +3 -3
  21. package/src/node_modules/@internal/components-util/index.js +1 -1
  22. package/src/node_modules/@internal/create-readable/index-browser.js +1 -1
  23. package/src/node_modules/@internal/create-readable/index.js +1 -1
  24. package/src/node_modules/@internal/loader/fallback-node.js +2 -2
  25. package/src/node_modules/@internal/loader/index.js +2 -2
  26. package/src/translator/index.js +5 -4
  27. package/src/translator/tag/index.js +2 -1
  28. package/src/translator/tag/native-tag[html]/index.js +2 -1
  29. package/src/translator/taglib/core/parse-module-code.js +3 -1
  30. package/src/translator/taglib/core/transform-style.js +2 -1
  31. package/src/translator/taglib/core/translate-include-content.js +2 -1
  32. package/src/translator/text/index[vdom].js +3 -1
  33. package/src/translator/util/add-dependencies.js +2 -1
  34. package/src/translator/util/optimize-vdom-create.js +3 -1
  35. package/tags-html.d.ts +44 -8
@@ -12,8 +12,7 @@ ownerComponentDef)
12
12
  componentId,
13
13
  componentsContext
14
14
  );
15
- componentsContext.p_.q_[
16
- componentId] =
15
+ componentsContext.p_.q_[componentId] =
17
16
  true;
18
17
  componentsContext.b_.push(componentDef);
19
18
 
@@ -291,8 +291,14 @@ function getInitComponentsCodeFromData($global, initComponentsData) {
291
291
  )})`;
292
292
  }
293
293
 
294
- exports._h_ = function getInitComponentsCodeForDefs($global, defs) {
295
- return getInitComponentsCodeFromData($global, getInitComponentsData($global, defs));
294
+ exports._h_ = function getInitComponentsCodeForDefs(
295
+ $global,
296
+ defs)
297
+ {
298
+ return getInitComponentsCodeFromData(
299
+ $global,
300
+ getInitComponentsData($global, defs)
301
+ );
296
302
  };
297
303
  exports.__ = addComponentsFromContext;
298
304
  exports.writeInitComponentsCode = writeInitComponentsCode;
@@ -475,11 +475,14 @@ function initServerRendered(renderedComponents, host) {
475
475
  eventDelegation._C_(host);
476
476
 
477
477
  if (!meta._D_) {
478
- meta._D_ = Object.assign({
479
- renderId: prefix,
480
- runtimeId: runtimeId,
481
- componentIdPrefix: prefix
482
- }, renderedComponents.g);
478
+ meta._D_ = Object.assign(
479
+ {
480
+ renderId: prefix,
481
+ runtimeId: runtimeId,
482
+ componentIdPrefix: prefix
483
+ },
484
+ renderedComponents.g
485
+ );
483
486
  }
484
487
 
485
488
  if (renderedComponents.t) {
@@ -494,8 +497,7 @@ function initServerRendered(renderedComponents, host) {
494
497
  map(function (componentDef) {
495
498
  var typeName = meta._E_[componentDef[1]];
496
499
 
497
- return registered[typeName] ||
498
- req.e(typeName) ?
500
+ return registered[typeName] || req.e(typeName) ?
499
501
  tryHydrateComponent(componentDef, meta, host, runtimeId) :
500
502
  addPendingDef(componentDef, typeName, meta, host, runtimeId);
501
503
  }).
@@ -1,4 +1,6 @@
1
- "use strict";exports.__esModule = true;exports.analyze = void 0;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.translate = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.optionalTaglibs = exports.internalEntryBuilder = void 0;var _compiler = require("@marko/compiler");
1
+ "use strict";exports.__esModule = true;exports.analyze = void 0;exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.version = exports.translate = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.optionalTaglibs = exports.internalEntryBuilder = void 0;var _path = require("path");
2
+
3
+ var _compiler = require("@marko/compiler");
2
4
  var _babelUtils = require("@marko/compiler/babel-utils");
3
5
 
4
6
 
@@ -15,8 +17,7 @@ var _babelUtils = require("@marko/compiler/babel-utils");
15
17
 
16
18
 
17
19
 
18
- var _package = require("marko/package.json");exports.version = _package.version;
19
- var _path = require("path");
20
+ var _package = _interopRequireDefault(require("marko/package.json"));
20
21
 
21
22
  var _cdata = _interopRequireDefault(require("./cdata"));
22
23
  var _class = _interopRequireDefault(require("./class"));
@@ -36,9 +37,9 @@ var _optimizeVdomCreate = require("./util/optimize-vdom-create");
36
37
 
37
38
 
38
39
 
39
- var _package2 = require("../../package.json");exports.version = _package2.version;
40
40
 
41
- var _taglib = _interopRequireWildcard(require("./taglib"));exports.optionalTaglibs = _taglib.optionalTaglibs;exports.taglibs = _taglib.default;function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const CLASS_HYDRATION_SELF = "self";const CLASS_HYDRATION_DESCENDANT = "descendant";const tagDiscoveryDirs = exports.tagDiscoveryDirs = ["components"];
41
+
42
+ var _taglib = _interopRequireWildcard(require("./taglib"));exports.optionalTaglibs = _taglib.optionalTaglibs;exports.taglibs = _taglib.default;function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const CLASS_HYDRATION_SELF = "self";const CLASS_HYDRATION_DESCENDANT = "descendant";const version = exports.version = _package.default.version;const tagDiscoveryDirs = exports.tagDiscoveryDirs = ["components"];
42
43
 
43
44
 
44
45
  const preferAPI = exports.preferAPI = "class";
@@ -416,7 +417,7 @@ const translate = exports.translate = {
416
417
  if (markoOpts.writeVersionComment) {
417
418
  path.addComment(
418
419
  "leading",
419
- ` Compiled using marko@${_package.version} - DO NOT EDIT`,
420
+ ` Compiled using marko@${_package.default.version} - DO NOT EDIT`,
420
421
  true
421
422
  );
422
423
  }
@@ -1,4 +1,6 @@
1
- "use strict";exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
1
+ "use strict";exports.__esModule = true;exports.default = void 0;var _path = _interopRequireDefault(require("path"));
2
+
3
+ var _compiler = require("@marko/compiler");
2
4
  var _babelUtils = require("@marko/compiler/babel-utils");
3
5
 
4
6
 
@@ -10,7 +12,6 @@ var _babelUtils = require("@marko/compiler/babel-utils");
10
12
 
11
13
 
12
14
 
13
- var _path = _interopRequireDefault(require("path"));
14
15
 
15
16
  var _keyManager = require("../util/key-manager");
16
17
  var _optimizeVdomCreate = require("../util/optimize-vdom-create");
@@ -1,11 +1,12 @@
1
- "use strict";exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler");
1
+ "use strict";exports.__esModule = true;exports.default = _default;var _path = require("path");
2
+
3
+ var _compiler = require("@marko/compiler");
2
4
  var _babelUtils = require("@marko/compiler/babel-utils");
3
5
 
4
6
 
5
7
 
6
8
 
7
9
 
8
- var _path = require("path");
9
10
  var _selfClosingTags = _interopRequireDefault(require("self-closing-tags"));
10
11
 
11
12
  var _htmlOutWrite = _interopRequireDefault(require("../../util/html-out-write"));
@@ -1,5 +1,6 @@
1
- "use strict";exports.__esModule = true;exports.default = _default;var _modules = _interopRequireDefault(require("@marko/compiler/modules"));
2
- var _path = _interopRequireDefault(require("path"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
1
+ "use strict";exports.__esModule = true;exports.default = _default;var _path = _interopRequireDefault(require("path"));
2
+
3
+ var _modules = _interopRequireDefault(require("@marko/compiler/modules"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
3
4
 
4
5
  const startOffset = "module-code".length;
5
6
 
@@ -11,6 +12,7 @@ function _default(tag) {
11
12
  const dirname = _path.default.dirname(file.opts.filename);
12
13
  const relativeRequire = (entry) =>
13
14
  _modules.default.require(_modules.default.resolve(entry, dirname));
15
+ // oxlint-disable-next-line no-eval -- <parse-module-code> evaluates template-declared module code
14
16
  const fn = eval(rawValue.slice(startOffset));
15
17
  const source = fn(relativeRequire, file.markoOpts);
16
18
  file.metadata.marko.moduleCode = source;
@@ -1,5 +1,6 @@
1
- "use strict";exports.__esModule = true;exports.default = _default;var _babelUtils = require("@marko/compiler/babel-utils");
2
- var _path = _interopRequireDefault(require("path"));
1
+ "use strict";exports.__esModule = true;exports.default = _default;var _path = _interopRequireDefault(require("path"));
2
+
3
+ var _babelUtils = require("@marko/compiler/babel-utils");
3
4
 
4
5
  var _getComponentFiles = _interopRequireDefault(require("../../util/get-component-files"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
5
6
 
@@ -1,9 +1,10 @@
1
- "use strict";exports.__esModule = true;exports.enter = enter;var _compiler = require("@marko/compiler");
2
- var _babelUtils = require("@marko/compiler/babel-utils");
1
+ "use strict";exports.__esModule = true;exports.enter = enter;var _path = _interopRequireDefault(require("path"));
2
+
3
+ var _compiler = require("@marko/compiler");
4
+ var _babelUtils = require("@marko/compiler/babel-utils");function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
3
5
 
4
6
 
5
7
 
6
- var _path = _interopRequireDefault(require("path"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
7
8
 
8
9
  function enter(tag) {
9
10
  const {
@@ -1,8 +1,10 @@
1
1
  "use strict";exports.__esModule = true;exports.default = _default;var _compiler = require("@marko/compiler");
2
- var _he = require("he");
2
+ var _he = _interopRequireDefault(require("he"));
3
+
4
+
3
5
 
4
6
  var _vdomOutWrite = _interopRequireDefault(require("../util/vdom-out-write"));
5
- var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
7
+ var _withPreviousLocation = _interopRequireDefault(require("../util/with-previous-location"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const { decode } = _he.default;
6
8
 
7
9
  function _default(path) {
8
10
  const { node } = path;
@@ -11,7 +13,7 @@ function _default(path) {
11
13
  (0, _withPreviousLocation.default)(
12
14
  (0, _vdomOutWrite.default)(
13
15
  "t",
14
- _compiler.types.stringLiteral((0, _he.decode)(node.value)),
16
+ _compiler.types.stringLiteral(decode(node.value)),
15
17
  path.hub.file._componentInstanceIdentifier
16
18
  ),
17
19
  node
@@ -1,12 +1,13 @@
1
- "use strict";exports.__esModule = true;exports.entryBuilder = exports.default = void 0;var _compiler = require("@marko/compiler");
1
+ "use strict";exports.__esModule = true;exports.entryBuilder = exports.default = void 0;var _path = _interopRequireDefault(require("path"));
2
+
3
+ var _compiler = require("@marko/compiler");
2
4
  var _babelUtils = require("@marko/compiler/babel-utils");
3
5
 
4
6
 
5
7
 
6
8
 
7
9
  var _modules = _interopRequireDefault(require("@marko/compiler/modules"));
8
- var _magicString = _interopRequireDefault(require("magic-string"));
9
- var _path = _interopRequireDefault(require("path"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
10
+ var _magicString = _interopRequireDefault(require("magic-string"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
10
11
  const kEntryState = Symbol();
11
12
  const lassoDepPrefix = "package: ";var _default =
12
13
 
@@ -6,11 +6,13 @@ var _babelUtils = require("@marko/compiler/babel-utils");
6
6
 
7
7
 
8
8
 
9
- var _he = require("he");
9
+ var _he = _interopRequireDefault(require("he"));
10
+
11
+
10
12
 
11
13
  var _attributes = _interopRequireDefault(require("../tag/native-tag[vdom]/attributes"));
12
14
  var _keyManager = require("./key-manager");
13
- var _vdomOutWrite = _interopRequireDefault(require("./vdom-out-write"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}
15
+ var _vdomOutWrite = _interopRequireDefault(require("./vdom-out-write"));function _interopRequireDefault(e) {return e && e.__esModule ? e : { default: e };}const { decode } = _he.default;
14
16
 
15
17
  const skipDirectives = new Set([
16
18
  "key",
@@ -27,7 +29,7 @@ const mergeStaticCreateVisitor = {
27
29
  const { node } = path;
28
30
  state.currentRoot = _compiler.types.callExpression(
29
31
  _compiler.types.memberExpression(state.currentRoot, _compiler.types.identifier("t")),
30
- [_compiler.types.stringLiteral((0, _he.decode)(node.value))]
32
+ [_compiler.types.stringLiteral(decode(node.value))]
31
33
  );
32
34
  },
33
35
  MarkoPlaceholder(path, state) {
package/package.json CHANGED
@@ -1,28 +1,23 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.26",
3
+ "version": "5.39.28",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
7
- "front-end",
8
- "templating",
9
- "template",
10
7
  "async",
11
- "streaming",
12
8
  "components",
13
- "ui",
14
- "vdom",
15
9
  "dom",
10
+ "front-end",
16
11
  "morphdom",
12
+ "streaming",
13
+ "template",
14
+ "templating",
15
+ "ui",
16
+ "vdom",
17
17
  "virtual",
18
18
  "virtual-dom"
19
19
  ],
20
20
  "homepage": "https://markojs.com/",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/marko-js/marko.git",
24
- "directory": "packages/runtime-class"
25
- },
26
21
  "license": "MIT",
27
22
  "author": "Patrick Steele-Idem <pnidem@gmail.com>",
28
23
  "maintainers": [
@@ -33,14 +28,11 @@
33
28
  "Dylan Piercey <pierceydylan@gmail.com>",
34
29
  "Martin Aberer"
35
30
  ],
36
- "main": "index.js",
37
- "browser": {
38
- "./compiler.js": "./compiler-browser.marko",
39
- "./components.js": "./components-browser.marko",
40
- "./legacy-components.js": "./legacy-components-browser.marko",
41
- "./index.js": "./index-browser.marko"
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/marko-js/marko.git",
34
+ "directory": "packages/runtime-class"
42
35
  },
43
- "types": "index.d.ts",
44
36
  "bin": {
45
37
  "markoc": "bin/markoc"
46
38
  },
@@ -66,15 +58,24 @@
66
58
  "translator/package.json",
67
59
  "translator/index.d.ts"
68
60
  ],
61
+ "main": "index.js",
62
+ "browser": {
63
+ "./compiler.js": "./compiler-browser.marko",
64
+ "./components.js": "./components-browser.marko",
65
+ "./legacy-components.js": "./legacy-components-browser.marko",
66
+ "./index.js": "./index-browser.marko"
67
+ },
68
+ "types": "index.d.ts",
69
69
  "dependencies": {
70
- "@marko/compiler": "^5.41.4",
71
- "@marko/runtime-tags": "^6.3.17",
70
+ "@marko/compiler": "^5.41.9",
71
+ "@marko/runtime-tags": "^6.3.23",
72
72
  "app-module-path": "^2.2.0",
73
73
  "argly": "^1.2.0",
74
74
  "browser-refresh-client": "1.1.4",
75
75
  "complain": "^1.6.1",
76
76
  "csstype": "^3.2.3",
77
77
  "events-light": "^1.0.5",
78
+ "he": "^1.2.0",
78
79
  "listener-tracker": "^2.0.0",
79
80
  "magic-string": "^0.30.21",
80
81
  "minimatch": "^10.2.5",
@@ -84,10 +85,10 @@
84
85
  "warp10": "^2.1.0"
85
86
  },
86
87
  "devDependencies": {
87
- "marko": "5.39.26"
88
+ "marko": "5.39.28"
88
89
  },
89
90
  "engines": {
90
- "node": "18 || 20 || >=22"
91
+ "node": ">=22"
91
92
  },
92
93
  "logo": {
93
94
  "url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
@@ -4,17 +4,16 @@ module.exports = function beginComponent(
4
4
  componentsContext,
5
5
  component,
6
6
  key,
7
- ownerComponentDef
7
+ ownerComponentDef,
8
8
  ) {
9
9
  var componentId = component.id;
10
10
  var componentDef = (componentsContext.___componentDef = new ComponentDef(
11
11
  component,
12
12
  componentId,
13
- componentsContext
13
+ componentsContext,
14
14
  ));
15
- componentsContext.___globalContext.___renderedComponentsById[
16
- componentId
17
- ] = true;
15
+ componentsContext.___globalContext.___renderedComponentsById[componentId] =
16
+ true;
18
17
  componentsContext.___components.push(componentDef);
19
18
 
20
19
  var out = componentsContext.___out;
@@ -13,7 +13,7 @@ module.exports = function beginComponent(
13
13
  ownerComponentDef,
14
14
  isSplitComponent,
15
15
  isImplicitComponent,
16
- existingComponentDef
16
+ existingComponentDef,
17
17
  ) {
18
18
  var componentId = component.id;
19
19
 
@@ -24,7 +24,7 @@ module.exports = function beginComponent(
24
24
  (componentsContext.___componentDef = new ComponentDef(
25
25
  component,
26
26
  componentId,
27
- componentsContext
27
+ componentsContext,
28
28
  ));
29
29
 
30
30
  var ownerIsRenderBoundary =
@@ -84,7 +84,7 @@ module.exports = function beginComponent(
84
84
  ownerComponentDef.id +
85
85
  " " +
86
86
  key +
87
- "-->"
87
+ "-->",
88
88
  );
89
89
  } else {
90
90
  out.w("<!--" + runtimeId + "#" + componentId + "-->");
@@ -90,7 +90,7 @@ module.exports = function defineWidget(def, renderer) {
90
90
  .join("")
91
91
  )
92
92
  complain(
93
- "'widget.state = newState' has changed from merging the newState to replacing the old state."
93
+ "'widget.state = newState' has changed from merging the newState to replacing the old state.",
94
94
  );
95
95
  }
96
96
 
@@ -117,7 +117,7 @@ module.exports = function defineWidget(def, renderer) {
117
117
  (this.___rootNode && this.___rootNode.firstChild)
118
118
  ) {
119
119
  complain(
120
- "this.el no longer returns the `w-bind` element and instead returns the first node in the template. Assign a key to the w-bind element and use getEl(key) instead."
120
+ "this.el no longer returns the `w-bind` element and instead returns the first node in the template. Assign a key to the w-bind element and use getEl(key) instead.",
121
121
  );
122
122
  }
123
123
  }
@@ -174,7 +174,7 @@ module.exports = function defineWidget(def, renderer) {
174
174
  "widget was updated after it was destroyed, if this widget is migrated to a modern component this will become a noop.",
175
175
  {
176
176
  location: this.___type,
177
- }
177
+ },
178
178
  );
179
179
  }
180
180
 
@@ -269,7 +269,7 @@ module.exports = function defineWidget(def, renderer) {
269
269
  jQuery.patchComponent(
270
270
  window.$,
271
271
  proto,
272
- true /* don't throw error until used if `$` is missing*/
272
+ true /* don't throw error until used if `$` is missing*/,
273
273
  );
274
274
 
275
275
  ready.patchComponent(proto);
@@ -23,7 +23,7 @@ function safeJSONReplacer(match) {
23
23
 
24
24
  function isNotEmpty(obj) {
25
25
  var keys = Object.keys(obj);
26
- for (var i = keys.length; i--; ) {
26
+ for (var i = keys.length; i--;) {
27
27
  if (obj[keys[i]] !== undefined) {
28
28
  return true;
29
29
  }
@@ -43,7 +43,7 @@ function getSerializedGlobals($global) {
43
43
  if (serializedGlobalsLookup) {
44
44
  let serializedGlobals;
45
45
  let keys = Object.keys(serializedGlobalsLookup);
46
- for (let i = keys.length; i--; ) {
46
+ for (let i = keys.length; i--;) {
47
47
  let key = keys[i];
48
48
  if (serializedGlobalsLookup[key]) {
49
49
  let value = $global[key];
@@ -125,7 +125,7 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
125
125
  // value so that the property name will be serialized down to the browser.
126
126
  // This ensures that we add the proper getter/setter for the state property.
127
127
  const stateKeys = Object.keys(state);
128
- for (let i = stateKeys.length; i--; ) {
128
+ for (let i = stateKeys.length; i--;) {
129
129
  const stateKey = stateKeys[i];
130
130
 
131
131
  if (state[stateKey] === undefined) {
@@ -291,9 +291,15 @@ function getInitComponentsCodeFromData($global, initComponentsData) {
291
291
  )})`;
292
292
  }
293
293
 
294
- exports.___getInitComponentsCodeForDefs = function getInitComponentsCodeForDefs($global, defs) {
295
- return getInitComponentsCodeFromData($global, getInitComponentsData($global, defs));
296
- }
294
+ exports.___getInitComponentsCodeForDefs = function getInitComponentsCodeForDefs(
295
+ $global,
296
+ defs,
297
+ ) {
298
+ return getInitComponentsCodeFromData(
299
+ $global,
300
+ getInitComponentsData($global, defs),
301
+ );
302
+ };
297
303
  exports.___addComponentsFromContext = addComponentsFromContext;
298
304
  exports.writeInitComponentsCode = writeInitComponentsCode;
299
305
 
@@ -80,7 +80,7 @@ function load(typeName, isLegacy) {
80
80
  // eslint-disable-next-line no-constant-condition
81
81
  if ("MARKO_DEBUG") {
82
82
  complain(
83
- "Looks like you used `require:` in your browser.json to load a component. This requires that Marko has knowledge of how lasso generates paths and will be removed in a future version. `marko-dependencies:/path/to/template.marko` should be used instead."
83
+ "Looks like you used `require:` in your browser.json to load a component. This requires that Marko has knowledge of how lasso generates paths and will be removed in a future version. `marko-dependencies:/path/to/template.marko` should be used instead.",
84
84
  );
85
85
  }
86
86
  }
@@ -117,7 +117,7 @@ function getComponentClass(typeName, isLegacy) {
117
117
  if ("MARKO_DEBUG") {
118
118
  var classNameMatch =
119
119
  /\/([^/]+?)(?:\/index|\/template|)(?:\.marko|\.component(?:-browser)?|)$/.exec(
120
- typeName
120
+ typeName,
121
121
  );
122
122
  var className = classNameMatch ? classNameMatch[1] : "AnonymousComponent";
123
123
  className = className.replace(/-(.)/g, function (g) {
@@ -128,7 +128,7 @@ function getComponentClass(typeName, isLegacy) {
128
128
  .replace(/^[^a-z$_]/i, "_$&")
129
129
  .replace(/[^0-9a-z$_]+/gi, "_");
130
130
  className = className[0].toUpperCase() + className.slice(1);
131
-
131
+
132
132
  var OldComponentClass = ComponentClass;
133
133
  ComponentClass = {
134
134
  [className]: function (id, doc) {
@@ -178,7 +178,7 @@ function indexServerComponentBoundaries(node, runtimeId, stack) {
178
178
  } else {
179
179
  rootNode = createFragmentNode(
180
180
  endNode.parentNode.firstChild,
181
- endNode
181
+ endNode,
182
182
  );
183
183
  }
184
184
 
@@ -201,7 +201,7 @@ function indexServerComponentBoundaries(node, runtimeId, stack) {
201
201
  keyedElements,
202
202
  key,
203
203
  rootNode,
204
- componentId
204
+ componentId,
205
205
  );
206
206
  }
207
207
 
@@ -276,7 +276,7 @@ function addDOMEventListeners(
276
276
  targetMethodName,
277
277
  isOnce,
278
278
  extraArgs,
279
- handles
279
+ handles,
280
280
  ) {
281
281
  var removeListener = addEventListenerHelper(
282
282
  el,
@@ -289,7 +289,7 @@ function addDOMEventListeners(
289
289
  }
290
290
 
291
291
  invokeComponentEventHandler(component, targetMethodName, args);
292
- }
292
+ },
293
293
  );
294
294
  handles.push(removeListener);
295
295
  }
@@ -330,7 +330,7 @@ function initComponent(componentDef, host) {
330
330
  targetMethodName,
331
331
  isOnce,
332
332
  extraArgs,
333
- eventListenerHandles
333
+ eventListenerHandles,
334
334
  );
335
335
  });
336
336
 
@@ -364,12 +364,12 @@ function initClientRendered(componentDefs, host) {
364
364
  var componentDef;
365
365
  var i;
366
366
 
367
- for (i = len; i--; ) {
367
+ for (i = len; i--;) {
368
368
  componentDef = componentDefs[i];
369
369
  trackComponent(componentDef);
370
370
  }
371
371
 
372
- for (i = len; i--; ) {
372
+ for (i = len; i--;) {
373
373
  componentDef = componentDefs[i];
374
374
  initComponent(componentDef, host);
375
375
  }
@@ -402,7 +402,7 @@ function initServerRendered(renderedComponents, host) {
402
402
  renderedComponents.i !== componentsUtil.___runtimeId
403
403
  ) {
404
404
  console.warn(
405
- "Multiple instances of Marko have attached to the same runtime id. This could mean that more than one copy of Marko is loaded on the page, or that the script containing Marko has executed more than once."
405
+ "Multiple instances of Marko have attached to the same runtime id. This could mean that more than one copy of Marko is loaded on the page, or that the script containing Marko has executed more than once.",
406
406
  );
407
407
  }
408
408
  }
@@ -439,7 +439,7 @@ function initServerRendered(renderedComponents, host) {
439
439
  // eslint-disable-next-line no-constant-condition
440
440
  if ("MARKO_DEBUG") {
441
441
  complain(
442
- "Passing serialized data to `require('marko/components).init` is deprecated. Instead set '$global.runtimeId' and provide the 'runtimeId' option to your Marko bundler plugin."
442
+ "Passing serialized data to `require('marko/components).init` is deprecated. Instead set '$global.runtimeId' and provide the 'runtimeId' option to your Marko bundler plugin.",
443
443
  );
444
444
  }
445
445
  }
@@ -448,7 +448,7 @@ function initServerRendered(renderedComponents, host) {
448
448
  if ("MARKO_DEBUG") {
449
449
  if (host !== document) {
450
450
  complain(
451
- "Passing a document other than the current document to `require('marko/components).init` is deprecated."
451
+ "Passing a document other than the current document to `require('marko/components).init` is deprecated.",
452
452
  );
453
453
  }
454
454
  }
@@ -475,11 +475,14 @@ function initServerRendered(renderedComponents, host) {
475
475
  eventDelegation.___init(host);
476
476
 
477
477
  if (!meta.___globals) {
478
- meta.___globals = Object.assign({
479
- renderId: prefix,
480
- runtimeId: runtimeId,
481
- componentIdPrefix: prefix,
482
- }, renderedComponents.g);
478
+ meta.___globals = Object.assign(
479
+ {
480
+ renderId: prefix,
481
+ runtimeId: runtimeId,
482
+ componentIdPrefix: prefix,
483
+ },
484
+ renderedComponents.g,
485
+ );
483
486
  }
484
487
 
485
488
  if (renderedComponents.t) {
@@ -494,8 +497,7 @@ function initServerRendered(renderedComponents, host) {
494
497
  .map(function (componentDef) {
495
498
  var typeName = meta.___types[componentDef[1]];
496
499
 
497
- return registered[typeName] ||
498
- req.e(typeName)
500
+ return registered[typeName] || req.e(typeName)
499
501
  ? tryHydrateComponent(componentDef, meta, host, runtimeId)
500
502
  : addPendingDef(componentDef, typeName, meta, host, runtimeId);
501
503
  })
@@ -510,7 +512,7 @@ function tryHydrateComponent(rawDef, meta, host, runtimeId) {
510
512
  rawDef,
511
513
  meta.___types,
512
514
  meta.___globals,
513
- exports
515
+ exports,
514
516
  );
515
517
  var mount = hydrateComponentAndGetMount(componentDef, host);
516
518
 
@@ -22,7 +22,7 @@ function createComponent(
22
22
  out,
23
23
  typeName,
24
24
  customEvents,
25
- scope
25
+ scope,
26
26
  ) {
27
27
  let ServerComponent;
28
28
 
@@ -86,7 +86,7 @@ function attachBubblingEvent(
86
86
  componentDef,
87
87
  handlerMethodName,
88
88
  isOnce,
89
- extraArgs
89
+ extraArgs,
90
90
  ) {
91
91
  if (handlerMethodName) {
92
92
  var componentId = componentDef.id;
@@ -110,7 +110,7 @@ function getMarkoPropsFromEl(el) {
110
110
  virtualProps = el.getAttribute("data-marko");
111
111
  vPropsByDOMNode.set(
112
112
  el,
113
- (virtualProps = virtualProps ? JSON.parse(virtualProps) : EMPTY_OBJECT)
113
+ (virtualProps = virtualProps ? JSON.parse(virtualProps) : EMPTY_OBJECT),
114
114
  );
115
115
  }
116
116
  }
@@ -129,7 +129,7 @@ function addComponentRootToKeyedElements(
129
129
  keyedElements,
130
130
  key,
131
131
  rootNode,
132
- componentId
132
+ componentId,
133
133
  ) {
134
134
  if (/\[\]$/.test(key)) {
135
135
  var repeatedElementsForKey = (keyedElements[key] =
@@ -16,7 +16,7 @@ function attachBubblingEvent(
16
16
  componentDef,
17
17
  handlerMethodName,
18
18
  isOnce,
19
- extraArgs
19
+ extraArgs,
20
20
  ) {
21
21
  if (handlerMethodName) {
22
22
  if (extraArgs) {
@@ -16,7 +16,7 @@ module.exports = function (data) {
16
16
  data && data.$global,
17
17
  facade,
18
18
  undefined,
19
- this.___shouldBuffer
19
+ this.___shouldBuffer,
20
20
  );
21
21
  out.once("error", (err) => {
22
22
  facade.write = facade.end = noop;
@@ -45,7 +45,7 @@ class Readable extends stream.Readable {
45
45
  globalData,
46
46
  this,
47
47
  undefined,
48
- template.___shouldBuffer
48
+ template.___shouldBuffer,
49
49
  );
50
50
  template.render(data, out);
51
51
  out.end();
@@ -38,7 +38,7 @@ function loadSource(templatePath, compiledSrc) {
38
38
 
39
39
  var templateModule = new Module(templatePath, module);
40
40
  templateModule.paths = Module._nodeModulePaths(
41
- nodePath.dirname(templatePath)
41
+ nodePath.dirname(templatePath),
42
42
  );
43
43
  templateModule.filename = templatePath;
44
44
 
@@ -66,7 +66,7 @@ function doLoad(templatePath, templateSrc, options) {
66
66
  {},
67
67
  markoCompiler.defaultOptions,
68
68
  options,
69
- requiredCompilerOptions
69
+ requiredCompilerOptions,
70
70
  );
71
71
  templatePath = nodePath.resolve(cwd, templatePath);
72
72
  var template = getCachedTemplate(templatePath);
@@ -11,13 +11,13 @@ module.exports = !require.extensions[".marko"]
11
11
  case 2:
12
12
  return (fallback = fallback || require("./fallback-node"))(
13
13
  templatePath,
14
- templateSrc
14
+ templateSrc,
15
15
  );
16
16
  case 3:
17
17
  return (fallback = fallback || require("./fallback-node"))(
18
18
  templatePath,
19
19
  templateSrc,
20
- options
20
+ options,
21
21
  );
22
22
  }
23
23
  };
@@ -1,3 +1,5 @@
1
+ import { resolve } from "path";
2
+
1
3
  import { types as t } from "@marko/compiler";
2
4
  import {
3
5
  findParentTag,
@@ -15,8 +17,7 @@ import {
15
17
  resolveRelativePath,
16
18
  resolveTagImport,
17
19
  } from "@marko/compiler/babel-utils";
18
- import { version } from "marko/package.json";
19
- import { resolve } from "path";
20
+ import markoPkg from "marko/package.json" with { type: "json" };
20
21
 
21
22
  import MarkoCDATA from "./cdata";
22
23
  import MarkoClass from "./class";
@@ -36,7 +37,7 @@ import { analyzeStaticVDOM } from "./util/optimize-vdom-create";
36
37
  const CLASS_HYDRATION_SELF = "self";
37
38
  const CLASS_HYDRATION_DESCENDANT = "descendant";
38
39
 
39
- export { version } from "../../package.json";
40
+ export const version = markoPkg.version;
40
41
  export const tagDiscoveryDirs = ["components"];
41
42
  export { optionalTaglibs, default as taglibs } from "./taglib";
42
43
  export { entryBuilder as internalEntryBuilder } from "./util/add-dependencies";
@@ -416,7 +417,7 @@ export const translate = {
416
417
  if (markoOpts.writeVersionComment) {
417
418
  path.addComment(
418
419
  "leading",
419
- ` Compiled using marko@${version} - DO NOT EDIT`,
420
+ ` Compiled using marko@${markoPkg.version} - DO NOT EDIT`,
420
421
  true,
421
422
  );
422
423
  }
@@ -1,3 +1,5 @@
1
+ import nodePath from "path";
2
+
1
3
  import { types as t } from "@marko/compiler";
2
4
  import {
3
5
  assertNoVar,
@@ -10,7 +12,6 @@ import {
10
12
  isTransparentTag,
11
13
  resolveTagImport,
12
14
  } from "@marko/compiler/babel-utils";
13
- import nodePath from "path";
14
15
 
15
16
  import { getKeyManager } from "../util/key-manager";
16
17
  import { optimizeStaticVDOM } from "../util/optimize-vdom-create";
@@ -1,3 +1,5 @@
1
+ import { resolve } from "path";
2
+
1
3
  import { types as t } from "@marko/compiler";
2
4
  import {
3
5
  getTagDef,
@@ -5,7 +7,6 @@ import {
5
7
  importNamed,
6
8
  normalizeTemplateString,
7
9
  } from "@marko/compiler/babel-utils";
8
- import { resolve } from "path";
9
10
  import SELF_CLOSING from "self-closing-tags";
10
11
 
11
12
  import write from "../../util/html-out-write";
@@ -1,6 +1,7 @@
1
- import markoModules from "@marko/compiler/modules";
2
1
  import path from "path";
3
2
 
3
+ import markoModules from "@marko/compiler/modules";
4
+
4
5
  const startOffset = "module-code".length;
5
6
 
6
7
  export default function (tag) {
@@ -11,6 +12,7 @@ export default function (tag) {
11
12
  const dirname = path.dirname(file.opts.filename);
12
13
  const relativeRequire = (entry) =>
13
14
  markoModules.require(markoModules.resolve(entry, dirname));
15
+ // oxlint-disable-next-line no-eval -- <parse-module-code> evaluates template-declared module code
14
16
  const fn = eval(rawValue.slice(startOffset));
15
17
  const source = fn(relativeRequire, file.markoOpts);
16
18
  file.metadata.marko.moduleCode = source;
@@ -1,6 +1,7 @@
1
- import { getStart } from "@marko/compiler/babel-utils";
2
1
  import path from "path";
3
2
 
3
+ import { getStart } from "@marko/compiler/babel-utils";
4
+
4
5
  import getComponentFiles from "../../util/get-component-files";
5
6
 
6
7
  const STYLE_REG = /^style((?:\.[^.\s\\/:*?"<>|({]+)+)?\s*\{/;
@@ -1,9 +1,10 @@
1
+ import path from "path";
2
+
1
3
  import { types as t } from "@marko/compiler";
2
4
  import {
3
5
  assertNoAttributes,
4
6
  assertNoParams,
5
7
  } from "@marko/compiler/babel-utils";
6
- import path from "path";
7
8
 
8
9
  export function enter(tag) {
9
10
  const {
@@ -1,5 +1,7 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { decode } from "he";
2
+ import he from "he";
3
+
4
+ const { decode } = he;
3
5
 
4
6
  import write from "../util/vdom-out-write";
5
7
  import withPreviousLocation from "../util/with-previous-location";
@@ -1,3 +1,5 @@
1
+ import path from "path";
2
+
1
3
  import { types as t } from "@marko/compiler";
2
4
  import {
3
5
  loadFileForImport,
@@ -6,7 +8,6 @@ import {
6
8
  } from "@marko/compiler/babel-utils";
7
9
  import markoModules from "@marko/compiler/modules";
8
10
  import MagicString from "magic-string";
9
- import path from "path";
10
11
  const kEntryState = Symbol();
11
12
  const lassoDepPrefix = "package: ";
12
13
 
@@ -6,7 +6,9 @@ import {
6
6
  isLoopTag,
7
7
  isNativeTag,
8
8
  } from "@marko/compiler/babel-utils";
9
- import { decode } from "he";
9
+ import he from "he";
10
+
11
+ const { decode } = he;
10
12
 
11
13
  import translateAttributes from "../tag/native-tag[vdom]/attributes";
12
14
  import { getKeyManager, hasUserKey } from "./key-manager";
package/tags-html.d.ts CHANGED
@@ -823,7 +823,13 @@ declare global {
823
823
  * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-method
824
824
  */
825
825
  method?:
826
- AttrMissing | "POST" | "post" | "GET" | "get" | "dialog" | "DIALOG";
826
+ | AttrMissing
827
+ | "POST"
828
+ | "post"
829
+ | "GET"
830
+ | "get"
831
+ | "dialog"
832
+ | "DIALOG";
827
833
  /**
828
834
  * The name attribute represents the form's name within the forms collection.
829
835
  * @see https://html.spec.whatwg.org/multipage/forms.html#attr-form-name
@@ -2473,7 +2479,11 @@ declare global {
2473
2479
  * @see https://html.spec.whatwg.org/multipage/interaction.html#attr-autocapitalize
2474
2480
  */
2475
2481
  autocapitalize?:
2476
- AttrOnOff | "characters" | "none" | "sentences" | "words";
2482
+ | AttrOnOff
2483
+ | "characters"
2484
+ | "none"
2485
+ | "sentences"
2486
+ | "words";
2477
2487
 
2478
2488
  /**
2479
2489
  * Indicates whether the element should automatically get focus when the page loads.
@@ -3583,7 +3593,13 @@ declare global {
3583
3593
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-dropeffect
3584
3594
  * */
3585
3595
  "aria-dropeffect"?:
3586
- AttrMissing | "copy" | "execute" | "link" | "move" | "none" | "popup";
3596
+ | AttrMissing
3597
+ | "copy"
3598
+ | "execute"
3599
+ | "link"
3600
+ | "move"
3601
+ | "none"
3602
+ | "popup";
3587
3603
  /**
3588
3604
  * Identifies the element that provides an error message for the object.
3589
3605
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-errormessage
@@ -3613,7 +3629,12 @@ declare global {
3613
3629
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
3614
3630
  */
3615
3631
  "aria-haspopup"?:
3616
- AttrBooleanString | "dialog" | "grid" | "listbox" | "menu" | "tree";
3632
+ | AttrBooleanString
3633
+ | "dialog"
3634
+ | "grid"
3635
+ | "listbox"
3636
+ | "menu"
3637
+ | "tree";
3617
3638
  /**
3618
3639
  * Indicates whether the element is exposed to an accessibility API.
3619
3640
  * @see https://www.w3.org/TR/wai-aria-1.1/#aria-hidden
@@ -3872,13 +3893,22 @@ declare global {
3872
3893
 
3873
3894
  type AttrMissing = undefined | null | false;
3874
3895
  type AttrClass =
3875
- AttrMissing | string | AttrClass[] | Record<string, AttrMissing | boolean>;
3896
+ | AttrMissing
3897
+ | string
3898
+ | AttrClass[]
3899
+ | Record<string, AttrMissing | boolean>;
3876
3900
  type AttrStyle = AttrMissing | string | Marko.CSS.Properties | AttrStyle[];
3877
3901
  type AttrCrossOrigin = AttrBoolean | "anonymous" | "use-credentials";
3878
3902
  type AttrEventHandler<Event, Target> =
3879
- AttrMissing | ((event: Event, target: Target) => unknown);
3903
+ | AttrMissing
3904
+ | ((event: Event, target: Target) => unknown);
3880
3905
  type AttrTarget =
3881
- AttrMissing | "_blank" | "_parent" | "_self" | "_top" | (string & {});
3906
+ | AttrMissing
3907
+ | "_blank"
3908
+ | "_parent"
3909
+ | "_self"
3910
+ | "_top"
3911
+ | (string & {});
3882
3912
  type AttrReferrerPolicy =
3883
3913
  | AttrMissing
3884
3914
  | "no-referrer-when-downgrade"
@@ -3908,7 +3938,13 @@ type AttrHref =
3908
3938
  * so any URL is accepted while suggesting common prefixes in autocomplete.
3909
3939
  */
3910
3940
  type AttrSrc =
3911
- AttrMissing | "/" | "./" | "https://" | "data:" | "blob:" | (string & {});
3941
+ | AttrMissing
3942
+ | "/"
3943
+ | "./"
3944
+ | "https://"
3945
+ | "data:"
3946
+ | "blob:"
3947
+ | (string & {});
3912
3948
  /**
3913
3949
  * MIME type for type, codetype, and enctype attributes. Use (string & {}) so
3914
3950
  * any MIME type is accepted while suggesting common values in autocomplete.