marko 6.0.132 → 6.0.134

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
@@ -1121,7 +1121,7 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
1121
1121
  const normalizedValue = normalizeStrProp(value);
1122
1122
  scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
1123
1123
  if (valueChange) {
1124
- scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */;
1124
+ scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 2 /* InputValue */;
1125
1125
  scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
1126
1126
  if (el.isConnected) {
1127
1127
  setValueAndUpdateSelection(el, normalizedValue);
@@ -1015,7 +1015,7 @@ function _attr_input_value(scope, nodeAccessor, value, valueChange) {
1015
1015
  const normalizedValue = normalizeStrProp(value);
1016
1016
  scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
1017
1017
  if (valueChange) {
1018
- scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */;
1018
+ scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 2 /* InputValue */;
1019
1019
  scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
1020
1020
  if (el.isConnected) {
1021
1021
  setValueAndUpdateSelection(el, normalizedValue);
package/dist/dom.js CHANGED
@@ -682,7 +682,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
682
682
  }
683
683
  function _attr_input_value(scope, nodeAccessor, value, valueChange) {
684
684
  let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
685
- scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["F" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["G" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["F" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
685
+ scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["F" /* ControlledType */ + nodeAccessor] = 2 /* InputValue */, scope["G" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["F" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
686
686
  }
687
687
  function _attr_input_value_script(scope, nodeAccessor) {
688
688
  let el = scope[nodeAccessor];
package/dist/dom.mjs CHANGED
@@ -579,7 +579,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
579
579
  }
580
580
  function _attr_input_value(scope, nodeAccessor, value, valueChange) {
581
581
  let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
582
- scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["F" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["G" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["F" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
582
+ scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["F" /* ControlledType */ + nodeAccessor] = 2 /* InputValue */, scope["G" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["F" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
583
583
  }
584
584
  function _attr_input_value_script(scope, nodeAccessor) {
585
585
  let el = scope[nodeAccessor];
@@ -1028,8 +1028,8 @@ var Sorted = class {
1028
1028
  return false;
1029
1029
  }
1030
1030
  for (let i = subLen; i--; ) {
1031
- const supIndex = this.findIndex(superset, subset[i]);
1032
- if (supIndex === -1 || supLen - supIndex <= i) return false;
1031
+ const found = findIndexSorted(this.compare, superset, subset[i]);
1032
+ if (found === -1 || supLen - found <= i) return false;
1033
1033
  }
1034
1034
  return true;
1035
1035
  }
@@ -1773,7 +1773,7 @@ function getOrCreateSection(path7) {
1773
1773
  let cur = path7;
1774
1774
  while (true) {
1775
1775
  if (cur.type === "Program" || cur.type === "MarkoTagBody" && !cur.node.attributeTags && !isNativeNode(cur.parentPath)) {
1776
- return (path7.node.extra ??= {}).section = startSection(cur);
1776
+ return startSection(cur);
1777
1777
  }
1778
1778
  cur = cur.parentPath;
1779
1779
  }
@@ -2370,9 +2370,7 @@ var entry_builder_default = {
2370
2370
  };
2371
2371
  const programExtra = file.path.node.extra;
2372
2372
  const { analyzedTags } = file.metadata.marko;
2373
- state.imports.push(
2374
- (0, import_babel_utils12.resolveRelativePath)(entryFile, file.opts.filename)
2375
- );
2373
+ state.imports.push((0, import_babel_utils12.resolveRelativePath)(entryFile, file.opts.filename));
2376
2374
  if (programExtra.isInteractive || programExtra.needsCompat) {
2377
2375
  state.init = true;
2378
2376
  }
@@ -3462,8 +3460,16 @@ function getBindingGetterIdentifier(binding) {
3462
3460
  return identifier;
3463
3461
  }
3464
3462
  function getSignal(section, referencedBindings, name2 = generateSignalName(referencedBindings)) {
3465
- if (!Array.isArray(referencedBindings) && referencedBindings?.type === 7 /* constant */) {
3466
- return getSignal(section, void 0);
3463
+ if (referencedBindings && !Array.isArray(referencedBindings)) {
3464
+ if (referencedBindings.type === 7 /* constant */) {
3465
+ return getSignal(section, void 0);
3466
+ }
3467
+ if (referencedBindings.type !== 4 /* local */ && referencedBindings.section !== section) {
3468
+ const canonicalReference = getCanonicalBinding(referencedBindings);
3469
+ if (canonicalReference !== referencedBindings) {
3470
+ return getSignal(section, canonicalReference);
3471
+ }
3472
+ }
3467
3473
  }
3468
3474
  const signals = getSignals(section);
3469
3475
  let signal = signals.get(referencedBindings);
@@ -3508,9 +3514,9 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
3508
3514
  scopeOffset && getScopeAccessorLiteral(scopeOffset, true)
3509
3515
  );
3510
3516
  };
3511
- } else if (referencedBindings.section !== section && bindingUtil.find(section.referencedClosures, referencedBindings)) {
3517
+ } else if (referencedBindings.section !== section && sectionUtil.has(referencedBindings.closureSections, section)) {
3512
3518
  signal.build = () => {
3513
- const closure = getCanonicalBinding(referencedBindings);
3519
+ const closure = referencedBindings;
3514
3520
  const render = getSignalFn(signal);
3515
3521
  const closureSignalBuilder = getClosureSignalBuilder(section);
3516
3522
  if (closureSignalBuilder && !isDynamicClosure(section, closure)) {
@@ -3692,7 +3698,7 @@ function getSignalFn(signal) {
3692
3698
  )
3693
3699
  );
3694
3700
  });
3695
- if (isValue && binding.sources && binding.type !== 4 /* local */) {
3701
+ if (isValue && binding.sources) {
3696
3702
  let dynamicClosureArgs;
3697
3703
  let dynamicClosureSignalIdentifier;
3698
3704
  forEach(binding.closureSections, (closureSection) => {
@@ -8604,18 +8610,11 @@ function trackVarReferences(tag, type, upstreamAlias) {
8604
8610
  return tagVar.extra?.binding;
8605
8611
  }
8606
8612
  }
8607
- function trackParamsReferences(body, type, upstreamAlias) {
8613
+ function trackParamsReferences(body, type) {
8608
8614
  const params = body.node.params;
8609
8615
  if (body.node.body.length && params.length) {
8610
- const canonicalUpstreamAlias = upstreamAlias && getCanonicalBinding(upstreamAlias);
8611
- let section;
8612
- if (canonicalUpstreamAlias) {
8613
- section = canonicalUpstreamAlias.section;
8614
- type = canonicalUpstreamAlias.type;
8615
- } else {
8616
- section = getOrCreateSection(body);
8617
- }
8618
- const paramsBinding = canonicalUpstreamAlias || ((body.node.extra ??= {}).binding = createBinding(
8616
+ const section = getOrCreateSection(body);
8617
+ const paramsBinding = (body.node.extra ??= {}).binding = createBinding(
8619
8618
  generateUid("params"),
8620
8619
  type,
8621
8620
  section,
@@ -8623,8 +8622,11 @@ function trackParamsReferences(body, type, upstreamAlias) {
8623
8622
  void 0,
8624
8623
  void 0,
8625
8624
  params[0].loc
8626
- ));
8627
- section.params = paramsBinding;
8625
+ );
8626
+ const bodySection = getSectionForBody(body);
8627
+ if (bodySection) {
8628
+ bodySection.params = paramsBinding;
8629
+ }
8628
8630
  for (let i = 0; i < params.length; i++) {
8629
8631
  const param = params[i];
8630
8632
  if (param.type === "RestElement") {
@@ -9044,20 +9046,20 @@ function finalizeReferences() {
9044
9046
  );
9045
9047
  for (const { isEffect, section: section2 } of binding.reads) {
9046
9048
  if (section2 !== binding.section) {
9047
- const canonicalUpstreamAlias = getCanonicalBinding(binding);
9048
- canonicalUpstreamAlias.closureSections = sectionUtil.add(
9049
- canonicalUpstreamAlias.closureSections,
9050
- section2
9051
- );
9052
9049
  if (binding.type === 4 /* local */) {
9053
9050
  section2.referencedLocalClosures = bindingUtil.add(
9054
9051
  section2.referencedLocalClosures,
9055
9052
  binding
9056
9053
  );
9057
9054
  } else {
9055
+ const canonicalUpstreamAlias = getCanonicalBinding(binding);
9056
+ canonicalUpstreamAlias.closureSections = sectionUtil.add(
9057
+ canonicalUpstreamAlias.closureSections,
9058
+ section2
9059
+ );
9058
9060
  section2.referencedClosures = bindingUtil.add(
9059
9061
  section2.referencedClosures,
9060
- binding
9062
+ canonicalUpstreamAlias
9061
9063
  );
9062
9064
  addOwnerSerializeReason(
9063
9065
  section2,
@@ -10292,12 +10294,13 @@ var define_default = {
10292
10294
  dropNodes(getAllTagReferenceNodes(tag.node));
10293
10295
  return;
10294
10296
  }
10295
- trackParamsReferences(tagBody, 3 /* param */);
10297
+ const paramsBinding = trackParamsReferences(tagBody, 3 /* param */);
10296
10298
  setTagDownstream(tag, varBinding);
10297
10299
  if (bodySection) {
10298
10300
  if (import_compiler43.types.isIdentifier(tag.node.var)) {
10299
10301
  const babelBinding = tag.scope.getBinding(tag.node.var.name);
10300
10302
  let allDirectReferences = true;
10303
+ let allHaveInput = true;
10301
10304
  for (const ref of babelBinding.referencePaths) {
10302
10305
  if (isReferenceHoisted(babelBinding.path, ref)) {
10303
10306
  throw ref.buildCodeFrameError(
@@ -10306,12 +10309,18 @@ var define_default = {
10306
10309
  }
10307
10310
  if (ref.parent.type === "MarkoTag" && ref.parent.name === ref.node) {
10308
10311
  (ref.parent.extra ??= {}).defineBodySection = bodySection;
10312
+ allHaveInput &&= !ref.parent.arguments?.length;
10309
10313
  dropNodes(ref.parent.name);
10310
10314
  } else {
10315
+ allHaveInput = false;
10311
10316
  allDirectReferences = false;
10312
10317
  }
10313
10318
  }
10314
10319
  if (allDirectReferences) {
10320
+ const inputAlias = allHaveInput && paramsBinding?.propertyAliases.get("0");
10321
+ if (inputAlias) {
10322
+ inputAlias.nullable = false;
10323
+ }
10315
10324
  dropNodes(getAllTagReferenceNodes(tag.node));
10316
10325
  return;
10317
10326
  }
@@ -94,7 +94,7 @@ export declare function createBinding(name: string, type: Binding["type"], secti
94
94
  export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
95
95
  export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
96
96
  export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, upstreamAlias?: Binding["upstreamAlias"]): Binding | undefined;
97
- export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType, upstreamAlias?: Binding["upstreamAlias"]): Binding | undefined;
97
+ export declare function trackParamsReferences(body: t.NodePath<t.MarkoTagBody | t.Program>, type: BindingType): Binding | undefined;
98
98
  export declare function trackHoistedReference(referencePath: t.NodePath<t.Identifier>, binding: Binding): void;
99
99
  export declare function isReferenceHoisted(bindingPath: t.NodePath, reference: t.NodePath): boolean;
100
100
  export declare function setReferencesScope(path: t.NodePath<any>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.132",
3
+ "version": "6.0.134",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -48,7 +48,7 @@
48
48
  "build": "node -r ~ts ./scripts/bundle.ts"
49
49
  },
50
50
  "dependencies": {
51
- "@marko/compiler": "^5.39.46",
51
+ "@marko/compiler": "^5.39.48",
52
52
  "csstype": "^3.1.3",
53
53
  "magic-string": "^0.30.17"
54
54
  },