marko 5.39.14 → 5.39.16

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.
@@ -309,7 +309,12 @@ const translate = exports.translate = {
309
309
  _compiler.types.identifier("withPageAssets")
310
310
  )],
311
311
 
312
- _compiler.types.stringLiteral("marko/src/runtime/helpers/load-tag.js")
312
+ _compiler.types.stringLiteral(
313
+ (0, _babelUtils.resolveRelativePath)(
314
+ file,
315
+ "marko/src/runtime/helpers/load-tag.js"
316
+ )
317
+ )
313
318
  ),
314
319
  _compiler.types.exportAllDeclaration(_compiler.types.stringLiteral(relPath)),
315
320
  _compiler.types.exportDefaultDeclaration(
@@ -11,17 +11,27 @@ const loadTagsByFile = new WeakMap();
11
11
  function analyzeLoadImport(importDecl, tagEntry) {
12
12
  if (!importDecl.node.attributes?.length) return;
13
13
 
14
- const loadAttrValuePath = importDecl.
14
+ const loadAttrPath = importDecl.
15
15
  get("attributes").
16
16
  find(
17
17
  (p) =>
18
18
  (p.node.key.type === "Identifier" ?
19
19
  p.node.key.name :
20
20
  p.node.key.value) === "load"
21
- )?.
22
- get("value");
21
+ );
22
+
23
+ if (!loadAttrPath) return;
24
+
25
+ // Under hot reload every module is already eagerly loaded, so the lazy facade
26
+ // buys nothing and its HMR-cached template collides with the real template's
27
+ // `_` slot, recursing on render (see load-tag-browser.js). Drop the attribute
28
+ // so the import compiles as a normal eager tag import in dev.
29
+ if (importDecl.hub.file.markoOpts.hot) {
30
+ loadAttrPath.remove();
31
+ return;
32
+ }
23
33
 
24
- if (!loadAttrValuePath) return;
34
+ const loadAttrValuePath = loadAttrPath.get("value");
25
35
 
26
36
  if (!tagEntry) {
27
37
  throw importDecl.buildCodeFrameError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.39.14",
3
+ "version": "5.39.16",
4
4
  "private": false,
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "keywords": [
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@marko/compiler": "^5.40.1",
74
- "@marko/runtime-tags": "^6.1.19",
74
+ "@marko/runtime-tags": "^6.2.5",
75
75
  "app-module-path": "^2.2.0",
76
76
  "argly": "^1.2.0",
77
77
  "browser-refresh-client": "1.1.4",
@@ -309,7 +309,12 @@ export const translate = {
309
309
  t.identifier("withPageAssets"),
310
310
  ),
311
311
  ],
312
- t.stringLiteral("marko/src/runtime/helpers/load-tag.js"),
312
+ t.stringLiteral(
313
+ resolveRelativePath(
314
+ file,
315
+ "marko/src/runtime/helpers/load-tag.js",
316
+ ),
317
+ ),
313
318
  ),
314
319
  t.exportAllDeclaration(t.stringLiteral(relPath)),
315
320
  t.exportDefaultDeclaration(
@@ -11,17 +11,27 @@ const loadTagsByFile = new WeakMap();
11
11
  export function analyzeLoadImport(importDecl, tagEntry) {
12
12
  if (!importDecl.node.attributes?.length) return;
13
13
 
14
- const loadAttrValuePath = importDecl
14
+ const loadAttrPath = importDecl
15
15
  .get("attributes")
16
16
  .find(
17
17
  (p) =>
18
18
  (p.node.key.type === "Identifier"
19
19
  ? p.node.key.name
20
20
  : p.node.key.value) === "load",
21
- )
22
- ?.get("value");
21
+ );
22
+
23
+ if (!loadAttrPath) return;
24
+
25
+ // Under hot reload every module is already eagerly loaded, so the lazy facade
26
+ // buys nothing and its HMR-cached template collides with the real template's
27
+ // `_` slot, recursing on render (see load-tag-browser.js). Drop the attribute
28
+ // so the import compiles as a normal eager tag import in dev.
29
+ if (importDecl.hub.file.markoOpts.hot) {
30
+ loadAttrPath.remove();
31
+ return;
32
+ }
23
33
 
24
- if (!loadAttrValuePath) return;
34
+ const loadAttrValuePath = loadAttrPath.get("value");
25
35
 
26
36
  if (!tagEntry) {
27
37
  throw importDecl.buildCodeFrameError(