lilact 0.28.1 → 0.28.4

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.
@@ -3723,7 +3723,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
3723
3723
  path,
3724
3724
  mappings: module.mappings,
3725
3725
  factory: "createComponent",
3726
- appendSourcemap: false,
3726
+ appendSourcemap: true,
3727
3727
  injectTraceLabels: true,
3728
3728
  produceCJS: true,
3729
3729
  blocks_info: lilact_default.blocks_info
@@ -3731,6 +3731,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
3731
3731
  } catch (value) {
3732
3732
  const error2 = asError(value);
3733
3733
  error2.fileName ?? (error2.fileName = path);
3734
+ error2.lilact_source ?? (error2.lilact_source = { path });
3734
3735
  error2.sourcePhase = "transpile";
3735
3736
  module.error = error2;
3736
3737
  lilact_default.error = error2;
@@ -3739,9 +3740,8 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
3739
3740
  if (typeof lilact_default.scanBlockLabels === "function") {
3740
3741
  lilact_default.scanBlockLabels(processed, path);
3741
3742
  }
3742
- processed += `
3743
- //# sourceURL=eval:/${path}`;
3744
3743
  try {
3744
+ new Function(processed);
3745
3745
  globalThis.Lilact = lilact_default;
3746
3746
  globalThis.createComponent = lilact_default.createComponent;
3747
3747
  globalThis.Fragment = lilact_default.Fragment;
@@ -4662,6 +4662,10 @@ __export(errors_exports, {
4662
4662
  scanBlockLabels: () => scanBlockLabels,
4663
4663
  traceError: () => traceError
4664
4664
  });
4665
+ function isSafari() {
4666
+ const userAgent = navigator.userAgent;
4667
+ return /Safari/.test(userAgent) && !/Chrome|Chromium|CriOS|FxiOS|EdgiOS|OPiOS/.test(userAgent);
4668
+ }
4665
4669
  function number(value) {
4666
4670
  const result2 = Number(value);
4667
4671
  return Number.isFinite(result2) ? result2 : null;
@@ -4704,8 +4708,9 @@ function browserLocation(error2) {
4704
4708
  const column2 = number(
4705
4709
  error2?.columnNumber ?? error2?.colno ?? error2?.column
4706
4710
  );
4711
+ const lineOffset = isSafari() ? 0 : 1;
4707
4712
  return {
4708
- line: line2 == null ? null : Math.max(0, line2 - 1),
4713
+ line: line2 == null ? null : Math.max(0, line2 - lineOffset),
4709
4714
  column: column2 == null ? null : Math.max(0, column2 - 1)
4710
4715
  };
4711
4716
  }
@@ -4756,8 +4761,9 @@ function traceError(value, runPath) {
4756
4761
  column: number(error2.columnNumber)
4757
4762
  } : browserLocation(error2);
4758
4763
  const fileName = source?.path || stack?.path || error2.fileName || runPath || null;
4759
- let line2 = stack?.line ?? browser.line ?? null;
4760
- let column2 = stack?.column ?? browser.column ?? null;
4764
+ const sameSource = !source?.path || !stack?.path || source.path === stack.path;
4765
+ let line2 = sameSource ? stack?.line ?? browser.line ?? null : browser.line ?? null;
4766
+ let column2 = sameSource ? stack?.column ?? browser.column ?? null : browser.column ?? null;
4761
4767
  const result2 = {
4762
4768
  fileName,
4763
4769
  lineNumber: line2,
@@ -4783,7 +4789,7 @@ function traceError(value, runPath) {
4783
4789
  if (block && (result2.lineNumber == null || result2.columnNumber == null || !result2.fileName)) {
4784
4790
  result2.fileName || (result2.fileName = block.path || runPath || null);
4785
4791
  result2.lineNumber ?? (result2.lineNumber = block.line);
4786
- result2.columnNumber ?? (result2.columnNumber = block.col);
4792
+ result2.columnNumber ?? (result2.columnNumber = block.column);
4787
4793
  result2.label = block.desc;
4788
4794
  }
4789
4795
  lilact_default.error = result2;
@@ -4876,7 +4882,7 @@ function scanBlockLabels(code2, path2) {
4876
4882
  lilact_default.blocks_info.labels[match2[1]] = {
4877
4883
  path: path2,
4878
4884
  line: Number(match2[2]),
4879
- col: Number(match2[3]),
4885
+ column: Number(match2[3]),
4880
4886
  desc: match2[4]
4881
4887
  };
4882
4888
  }
@@ -6725,7 +6731,10 @@ function generateSourceMap(json, path2, jsx_eols, out_eols, mappings = []) {
6725
6731
  lc = m[3];
6726
6732
  }
6727
6733
  sourcemap.mappings = mstr.substring(1).replace(/;,/g, ";");
6728
- return "\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(JSON.stringify(sourcemap));
6734
+ let out = "\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(JSON.stringify(sourcemap));
6735
+ out += `
6736
+ //# sourceURL=eval:/${path2}`;
6737
+ return out;
6729
6738
  }
6730
6739
  function transpileJSX(jsx2, {
6731
6740
  factory = "createComponent",