marko 5.37.8 → 5.37.9

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.
@@ -1,23 +1,28 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");exports.__esModule = true;exports.default = void 0;var _compiler = require("@marko/compiler");
2
2
 
3
- var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-previous-location"));var _default = exports.default =
3
+ var _withPreviousLocation = _interopRequireDefault(require("../../../util/with-previous-location"));
4
+
5
+ const seen = new WeakSet();var _default = exports.default =
4
6
 
5
7
  {
6
8
  exit(tag, _, value) {
7
9
  const {
8
10
  hub: { file }
9
11
  } = tag;
10
- value.replaceWith(
11
- (0, _withPreviousLocation.default)(
12
- _compiler.types.callExpression(
13
- _compiler.types.memberExpression(
14
- file._componentDefIdentifier,
15
- _compiler.types.identifier("elId")
16
- ),
17
- [value.node]
18
- ),
19
- value.node
20
- )
12
+
13
+ if (seen.has(value.node)) {
14
+ return;
15
+ }
16
+
17
+ const replacement = (0, _withPreviousLocation.default)(
18
+ _compiler.types.callExpression(
19
+ _compiler.types.memberExpression(file._componentDefIdentifier, _compiler.types.identifier("elId")),
20
+ [value.node]
21
+ ),
22
+ value.node
21
23
  );
24
+
25
+ seen.add(replacement);
26
+ value.replaceWith(replacement);
22
27
  }
23
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.37.8",
3
+ "version": "5.37.9",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@babel/runtime": "^7.26.0",
73
- "@marko/compiler": "^5.39.7",
73
+ "@marko/compiler": "^5.39.8",
74
74
  "app-module-path": "^2.2.0",
75
75
  "argly": "^1.2.0",
76
76
  "browser-refresh-client": "1.1.4",
@@ -85,6 +85,9 @@
85
85
  "self-closing-tags": "^1.0.1",
86
86
  "warp10": "^2.1.0"
87
87
  },
88
+ "engines": {
89
+ "node": "18 || 20 || >=22"
90
+ },
88
91
  "logo": {
89
92
  "url": "https://raw.githubusercontent.com/marko-js/branding/master/marko-logo-small.png"
90
93
  }
@@ -2,22 +2,27 @@ import { types as t } from "@marko/compiler";
2
2
 
3
3
  import withPreviousLocation from "../../../util/with-previous-location";
4
4
 
5
+ const seen = new WeakSet();
6
+
5
7
  export default {
6
8
  exit(tag, _, value) {
7
9
  const {
8
10
  hub: { file },
9
11
  } = tag;
10
- value.replaceWith(
11
- withPreviousLocation(
12
- t.callExpression(
13
- t.memberExpression(
14
- file._componentDefIdentifier,
15
- t.identifier("elId"),
16
- ),
17
- [value.node],
18
- ),
19
- value.node,
12
+
13
+ if (seen.has(value.node)) {
14
+ return;
15
+ }
16
+
17
+ const replacement = withPreviousLocation(
18
+ t.callExpression(
19
+ t.memberExpression(file._componentDefIdentifier, t.identifier("elId")),
20
+ [value.node],
20
21
  ),
22
+ value.node,
21
23
  );
24
+
25
+ seen.add(replacement);
26
+ value.replaceWith(replacement);
22
27
  },
23
28
  };