marko 6.0.166 → 6.0.167

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/dist/debug/dom.js CHANGED
@@ -32,7 +32,7 @@ function _assert_hoist(value) {
32
32
  if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
33
33
  }
34
34
  function _assert_init(scope, accessor) {
35
- if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access "${accessor}" before initialization.`);
35
+ if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
36
36
  return scope[accessor];
37
37
  }
38
38
  function assertExclusiveAttrs(attrs, onError = throwErr) {
@@ -30,7 +30,7 @@ function _assert_hoist(value) {
30
30
  if (typeof value !== "function") throw new Error(`Hoisted values must be functions, received type "${typeof value}".`);
31
31
  }
32
32
  function _assert_init(scope, accessor) {
33
- if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access "${accessor}" before initialization.`);
33
+ if (scope["#Creating"] || !(accessor in scope)) throw new ReferenceError(`Cannot access '${accessor}' before initialization`);
34
34
  return scope[accessor];
35
35
  }
36
36
  function assertExclusiveAttrs(attrs, onError = throwErr) {
@@ -1484,9 +1484,11 @@ function withContext(key, value, cb, cbValue) {
1484
1484
  ctx[key] = prev;
1485
1485
  }
1486
1486
  }
1487
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1487
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1488
1488
  _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
1489
- _scope_with_id(childScopeId)["#TagVariable"] = _resume({}, registryId, parentScopeId);
1489
+ const childScope = _scope_with_id(childScopeId);
1490
+ childScope["#TagVariable"] = _resume({}, registryId, parentScopeId);
1491
+ if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1490
1492
  }
1491
1493
  function _resume(val, id, scopeId) {
1492
1494
  return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
@@ -1482,9 +1482,11 @@ function withContext(key, value, cb, cbValue) {
1482
1482
  ctx[key] = prev;
1483
1483
  }
1484
1484
  }
1485
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1485
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1486
1486
  _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
1487
- _scope_with_id(childScopeId)["#TagVariable"] = _resume({}, registryId, parentScopeId);
1487
+ const childScope = _scope_with_id(childScopeId);
1488
+ childScope["#TagVariable"] = _resume({}, registryId, parentScopeId);
1489
+ if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1488
1490
  }
1489
1491
  function _resume(val, id, scopeId) {
1490
1492
  return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
@@ -23,7 +23,7 @@ export declare function _script(scopeId: number, registryId: string): void;
23
23
  export declare function _attr_content(nodeAccessor: Accessor, scopeId: number, content: unknown, serializeReason?: 1 | 0): void;
24
24
  export declare function withContext<T>(key: PropertyKey, value: unknown, cb: () => T): T;
25
25
  export declare function withContext<T, U>(key: PropertyKey, value: unknown, cb: (value: U) => T, cbValue: U): T;
26
- export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string): void;
26
+ export declare function _var(parentScopeId: number, scopeOffsetAccessor: Accessor, childScopeId: number, registryId: string, nodeAccessor?: Accessor): void;
27
27
  export declare function _resume<T extends WeakKey>(val: T, id: string, scopeId?: number): T;
28
28
  export declare function _id(): string;
29
29
  export declare function _scope_id(): number;
package/dist/html.js CHANGED
@@ -1305,8 +1305,10 @@ function withContext(key, value, cb, cbValue) {
1305
1305
  ctx[kPendingContexts]--, ctx[key] = prev;
1306
1306
  }
1307
1307
  }
1308
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1309
- _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id(), _scope_with_id(childScopeId).T = _resume({}, registryId, parentScopeId);
1308
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1309
+ _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
1310
+ let childScope = _scope_with_id(childScopeId);
1311
+ childScope.T = _resume({}, registryId, parentScopeId), nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
1310
1312
  }
1311
1313
  function _resume(val, id, scopeId) {
1312
1314
  return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
package/dist/html.mjs CHANGED
@@ -1304,8 +1304,10 @@ function withContext(key, value, cb, cbValue) {
1304
1304
  ctx[kPendingContexts]--, ctx[key] = prev;
1305
1305
  }
1306
1306
  }
1307
- function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1308
- _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id(), _scope_with_id(childScopeId).T = _resume({}, registryId, parentScopeId);
1307
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1308
+ _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
1309
+ let childScope = _scope_with_id(childScopeId);
1310
+ childScope.T = _resume({}, registryId, parentScopeId), nodeAccessor !== void 0 && writeScope(parentScopeId, { ["A" + nodeAccessor]: childScope });
1309
1311
  }
1310
1312
  function _resume(val, id, scopeId) {
1311
1313
  return scopeId === void 0 ? register(id, val) : $chunk.boundary.state.serializer.register(id, val, _scope_with_id(scopeId));
@@ -8265,8 +8265,9 @@ var dynamic_tag_default = {
8265
8265
  const dynamicTagExpr = hasTagArgs ? callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, _marko_compiler.types.arrayExpression(args), _marko_compiler.types.numericLiteral(0), _marko_compiler.types.numericLiteral(1), serializeArg) : callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, args[0], args[1] || (serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0), serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0, serializeArg);
8266
8266
  if (node.var) {
8267
8267
  const dynamicScopeIdentifier = generateUidIdentifier(tag.get("name").toString() + "_scope");
8268
+ const mutatesTagVar = !!(tag.node.var.type === "Identifier" && tag.scope.getBinding(tag.node.var.name)?.constantViolations.length);
8268
8269
  statements.push(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(dynamicScopeIdentifier, callRuntime("_peek_scope_id"))]));
8269
- statements.push(_marko_compiler.types.variableDeclaration("let", [_marko_compiler.types.variableDeclarator(node.var, dynamicTagExpr)]), _marko_compiler.types.expressionStatement(callRuntime("_var", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(tag.node.extra[kChildOffsetScopeBinding]), dynamicScopeIdentifier, _marko_compiler.types.stringLiteral(getResumeRegisterId(tagSection, node.var.extra?.binding, "var")))));
8270
+ statements.push(_marko_compiler.types.variableDeclaration("let", [_marko_compiler.types.variableDeclarator(node.var, dynamicTagExpr)]), _marko_compiler.types.expressionStatement(callRuntime("_var", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(tag.node.extra[kChildOffsetScopeBinding]), dynamicScopeIdentifier, _marko_compiler.types.stringLiteral(getResumeRegisterId(tagSection, node.var.extra?.binding, "var")), mutatesTagVar ? getScopeAccessorLiteral(nodeBinding) : void 0)));
8270
8271
  } else statements.push(_marko_compiler.types.expressionStatement(dynamicTagExpr));
8271
8272
  for (const replacement of tag.replaceWithMultiple(statements)) replacement.skip();
8272
8273
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.166",
3
+ "version": "6.0.167",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",