@danielx/civet 0.8.12 → 0.8.13

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/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
4
4
  For each version of Civet, it lists and links to all incorporated PRs,
5
5
  as well as a full diff and commit list.
6
6
 
7
+ ## 0.8.13 (2024-11-05, [diff](https://github.com/DanielXMoore/Civet/compare/v0.8.12...v0.8.13), [commits](https://github.com/DanielXMoore/Civet/commits/v0.8.13))
8
+ * Playground copy button for large text fragments [[#1569](https://github.com/DanielXMoore/Civet/pull/1569)]
9
+ * Fix unplugin `typecheck`: source mapping and `rewriteCivetImports` combination [[#1571](https://github.com/DanielXMoore/Civet/pull/1571)]
10
+ * Playground buttons to copy input or output [[#1572](https://github.com/DanielXMoore/Civet/pull/1572)]
11
+ * Fix modulo access with placeholders: `x[& %]` [[#1573](https://github.com/DanielXMoore/Civet/pull/1573)]
12
+ * Fix parenthesized `&` followed by type postfix [[#1574](https://github.com/DanielXMoore/Civet/pull/1574)]
13
+ * Playground TypeScript toggle [[#1577](https://github.com/DanielXMoore/Civet/pull/1577)]
14
+ * Fix parenthesized `&` followed by binary op [[#1576](https://github.com/DanielXMoore/Civet/pull/1576)]
15
+ * Object and array literals via `{}` and `[]` followed by items [[#1575](https://github.com/DanielXMoore/Civet/pull/1575)]
16
+
7
17
  ## 0.8.12 (2024-11-03, [diff](https://github.com/DanielXMoore/Civet/compare/v0.8.11...v0.8.12), [commits](https://github.com/DanielXMoore/Civet/commits/v0.8.12))
8
18
  * Fix REPL support for `ref`s created by Civet [[#1553](https://github.com/DanielXMoore/Civet/pull/1553)]
9
19
  * `array[i%]` modulo index shorthand [[#1554](https://github.com/DanielXMoore/Civet/pull/1554)]
package/dist/browser.js CHANGED
@@ -1873,8 +1873,8 @@ ${body}`;
1873
1873
  ts(": <T>(object: T, prop: PropertyKey) => boolean"),
1874
1874
  " = ({}.constructor",
1875
1875
  asAny,
1876
- ").hasOwn;\n"
1877
- ]]);
1876
+ ").hasOwn"
1877
+ ], ";\n"]);
1878
1878
  },
1879
1879
  is(isRef) {
1880
1880
  state.prelude.push(["", [
@@ -1883,9 +1883,8 @@ ${body}`;
1883
1883
  isRef,
1884
1884
  ts(": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"),
1885
1885
  " = Object.is",
1886
- asAny,
1887
- ";\n"
1888
- ]]);
1886
+ asAny
1887
+ ], ";\n"]);
1889
1888
  },
1890
1889
  /**
1891
1890
  * Array length check with type guard.
@@ -1903,8 +1902,11 @@ ${body}`;
1903
1902
  },
1904
1903
  rslice(rsliceRef) {
1905
1904
  const RSliceable = makeRef("RSliceable");
1905
+ state.prelude.push([
1906
+ "",
1907
+ ts(["type ", RSliceable, "<R> = string | {length: number; slice(start: number, end: number): {reverse(): R}}\n"])
1908
+ ]);
1906
1909
  state.prelude.push(["", [
1907
- ts(["type ", RSliceable, "<R> = string | {length: number; slice(start: number, end: number): {reverse(): R}}\n"]),
1908
1910
  preludeVar,
1909
1911
  rsliceRef,
1910
1912
  ts([": <R, T extends string | ", RSliceable, "<R>>(a: T, start?: number, end?: number) => T extends string ? string : T extends ", RSliceable, "<infer R> ? R : never"]),
@@ -1923,8 +1925,8 @@ ${body}`;
1923
1925
  " } else {\n",
1924
1926
  " return a.slice(end, start + 1).reverse()\n",
1925
1927
  " }\n",
1926
- "});\n"
1927
- ]]);
1928
+ "})"
1929
+ ], ";\n"]);
1928
1930
  },
1929
1931
  div(divRef) {
1930
1932
  state.prelude.push(["", [
@@ -1932,8 +1934,8 @@ ${body}`;
1932
1934
  preludeVar,
1933
1935
  divRef,
1934
1936
  ts(": (a: number, b: number) => number"),
1935
- " = (a, b) => Math.floor(a / b);\n"
1936
- ]]);
1937
+ " = (a, b) => Math.floor(a / b)"
1938
+ ], ";\n"]);
1937
1939
  },
1938
1940
  modulo(moduloRef) {
1939
1941
  state.prelude.push(["", [
@@ -1941,14 +1943,15 @@ ${body}`;
1941
1943
  preludeVar,
1942
1944
  moduloRef,
1943
1945
  ts(": (a: number, b: number) => number"),
1944
- " = (a, b) => (a % b + b) % b;\n"
1945
- ]]);
1946
+ " = (a, b) => (a % b + b) % b"
1947
+ ], ";\n"]);
1946
1948
  },
1947
1949
  Falsy(FalsyRef) {
1948
1950
  state.prelude.push([
1949
1951
  "",
1950
1952
  // [indent, statement]
1951
- ts(["type ", FalsyRef, " = false | 0 | '' | 0n | null | undefined;\n"])
1953
+ ts(["type ", FalsyRef, " = false | 0 | '' | 0n | null | undefined"]),
1954
+ ";\n"
1952
1955
  ]);
1953
1956
  },
1954
1957
  xor(xorRef) {
@@ -1969,9 +1972,8 @@ ${body}`;
1969
1972
  " extends never ? never : A))"
1970
1973
  ]),
1971
1974
  " = (a, b) => (a ? !b && a : b)",
1972
- asAny,
1973
- ";\n"
1974
- ]]);
1975
+ asAny
1976
+ ], ";\n"]);
1975
1977
  },
1976
1978
  xnor(xnorRef) {
1977
1979
  const Falsy = getHelperRef("Falsy");
@@ -1989,9 +1991,8 @@ ${body}`;
1989
1991
  " ? never : B))"
1990
1992
  ]),
1991
1993
  " = (a, b) => (a ? b : !b || a)",
1992
- asAny,
1993
- ";\n"
1994
- ]]);
1994
+ asAny
1995
+ ], ";\n"]);
1995
1996
  },
1996
1997
  concatAssign(ref) {
1997
1998
  state.prelude.push(["", [
@@ -2009,8 +2010,8 @@ ${body}`;
2009
2010
  asAny,
2010
2011
  ") : (lhs",
2011
2012
  asAny,
2012
- ").push(rhs), lhs);\n"
2013
- ]]);
2013
+ ").push(rhs), lhs)"
2014
+ ], ";\n"]);
2014
2015
  },
2015
2016
  AutoPromise(ref) {
2016
2017
  state.prelude.push([
@@ -4718,7 +4719,7 @@ ${js}`
4718
4719
  const simple = ref === expression;
4719
4720
  let children;
4720
4721
  if (simple) {
4721
- ref = insertTrimmingSpace(ref, "");
4722
+ ref = trimFirstSpace(ref);
4722
4723
  children = [ref];
4723
4724
  } else {
4724
4725
  children = [ref, initializer];
@@ -4908,9 +4909,12 @@ ${js}`
4908
4909
  }
4909
4910
  function dynamizeFromClause(from) {
4910
4911
  from = from.slice(1);
4911
- from = insertTrimmingSpace(from, "");
4912
- if (from[from.length - 1]?.type === "ImportAssertion") {
4913
- const assert2 = from.pop();
4912
+ from = trimFirstSpace(from);
4913
+ let ref2;
4914
+ if (ref2 = from[from.length - 1]?.assertion) {
4915
+ const assert2 = ref2;
4916
+ let ref3;
4917
+ ref3 = from[from.length - 1], ref3.children = ref3.children.filter((a2) => a2 !== assert2);
4914
4918
  from.push(", {", assert2.keyword, ":", assert2.object, "}");
4915
4919
  }
4916
4920
  return ["(", ...from, ")"];
@@ -4919,20 +4923,20 @@ ${js}`
4919
4923
  const { imports } = decl;
4920
4924
  let { star, binding, specifiers } = imports;
4921
4925
  const justDefault = binding && !specifiers && !star;
4922
- let ref2;
4926
+ let ref4;
4923
4927
  {
4924
4928
  if (binding) {
4925
4929
  if (specifiers) {
4926
- ref2 = makeRef();
4930
+ ref4 = makeRef();
4927
4931
  } else {
4928
- ref2 = binding;
4932
+ ref4 = binding;
4929
4933
  }
4930
4934
  } else {
4931
- ref2 = convertNamedImportsToObject(imports, true);
4935
+ ref4 = convertNamedImportsToObject(imports, true);
4932
4936
  }
4933
4937
  }
4934
4938
  ;
4935
- const pattern = ref2;
4939
+ const pattern = ref4;
4936
4940
  const c = "const";
4937
4941
  const expression = [
4938
4942
  justDefault ? "(" : void 0,
@@ -5009,7 +5013,7 @@ ${js}`
5009
5013
  { type: "Await", children: "await" },
5010
5014
  " ",
5011
5015
  imp,
5012
- insertTrimmingSpace(ws2, ""),
5016
+ trimFirstSpace(ws2),
5013
5017
  dynamizeFromClause(from),
5014
5018
  {
5015
5019
  type: "PropertyGlob",
@@ -6660,19 +6664,23 @@ ${js}`
6660
6664
  assert.notEqual(i, 0, "Index access must be preceded by an expression");
6661
6665
  const prefix = i === 1 ? children[0] : children.slice(0, i);
6662
6666
  const { ref, refAssignment } = maybeRefAssignment(prefix);
6667
+ const args = [
6668
+ glob.children.slice(0 + 1, -1),
6669
+ // between "[" and "]" tokens
6670
+ ",",
6671
+ [" ", ref, ".length"]
6672
+ ];
6663
6673
  const call = makeNode({
6664
6674
  type: "CallExpression",
6675
+ implicit: true,
6665
6676
  children: [
6666
6677
  getHelperRef("modulo"),
6667
6678
  makeNode({
6668
6679
  type: "Call",
6680
+ args,
6669
6681
  children: [
6670
6682
  "(",
6671
- ...glob.children.slice(0 + 1, -1),
6672
- // between "[" and "]" tokens
6673
- ", ",
6674
- ref,
6675
- ".length",
6683
+ args,
6676
6684
  ")"
6677
6685
  ]
6678
6686
  })
@@ -6684,7 +6692,7 @@ ${js}`
6684
6692
  ...node,
6685
6693
  children: [
6686
6694
  makeLeftHandSideExpression(refAssignment ?? prefix),
6687
- {
6695
+ makeNode({
6688
6696
  ...glob,
6689
6697
  mod: false,
6690
6698
  expression: call,
@@ -6695,7 +6703,7 @@ ${js}`
6695
6703
  (ref3 = glob.children)[ref3.length - 1]
6696
6704
  // "]" token
6697
6705
  ]
6698
- },
6706
+ }),
6699
6707
  ...children.slice(i + 1)
6700
6708
  ]
6701
6709
  });
@@ -8045,6 +8053,7 @@ ${js}`
8045
8053
  ArrayElementDelimiter,
8046
8054
  ElementListWithIndentedApplicationForbidden,
8047
8055
  ElementList,
8056
+ SingleLineElementList,
8048
8057
  ElementListRest,
8049
8058
  ArrayElementExpression,
8050
8059
  NestedBulletedArray,
@@ -8057,6 +8066,7 @@ ${js}`
8057
8066
  BulletedArrayWithTrailing,
8058
8067
  ObjectLiteral,
8059
8068
  BracedObjectLiteral,
8069
+ SingleLineObjectProperties,
8060
8070
  BracedObjectLiteralContent,
8061
8071
  NestedImplicitObjectLiteral,
8062
8072
  NestedImplicitPropertyDefinitions,
@@ -11695,13 +11705,13 @@ ${js}`
11695
11705
  expression: fn
11696
11706
  };
11697
11707
  });
11698
- var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, __, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R15, "FunctionExpression /\\+\\+|--|[\\+\\-&]\\S/")), BinaryOp, __, NonPipelineAssignmentExpression, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
11708
+ var FunctionExpression$5 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenParen, __, (0, import_lib2.$N)((0, import_lib2.$EXPECT)($R15, "FunctionExpression /\\+\\+|--|[\\+\\-&]\\S/")), (0, import_lib2.$N)((0, import_lib2.$S)(Placeholder, (0, import_lib2.$C)(TypePostfix, BinaryOpRHS))), BinaryOp, __, NonPipelineAssignmentExpression, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11699
11709
  var open = $1;
11700
11710
  var ws1 = $2;
11701
- var op = $4;
11702
- var ws2 = $5;
11703
- var rhs = $6;
11704
- var close = $7;
11711
+ var op = $5;
11712
+ var ws2 = $6;
11713
+ var rhs = $7;
11714
+ var close = $8;
11705
11715
  const refA = makeRef("a");
11706
11716
  const fn = makeAmpersandFunction({
11707
11717
  ref: refA,
@@ -12403,7 +12413,30 @@ ${js}`
12403
12413
  var _ArrayLiteral$0 = (0, import_lib2.$T)((0, import_lib2.$S)(ArrayBindingPattern, UpcomingAssignment), function(value) {
12404
12414
  return value[0];
12405
12415
  });
12406
- var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12416
+ var _ArrayLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, CloseBracket, ApplicationStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$C)(NestedElementList, SingleLineElementList)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
12417
+ var open = $1;
12418
+ var close = $2;
12419
+ var content = $5;
12420
+ if (!content)
12421
+ return $skip;
12422
+ let last = content[content.length - 1];
12423
+ let lastArray = Array.isArray(last) ? last : last.children;
12424
+ if (isComma(lastArray[lastArray.length - 1])) {
12425
+ lastArray = lastArray.slice(0, -1);
12426
+ if (Array.isArray(last)) {
12427
+ last = lastArray;
12428
+ } else {
12429
+ last = { ...last, children: lastArray };
12430
+ }
12431
+ content = [...content.slice(0, -1), last];
12432
+ }
12433
+ return {
12434
+ type: "ArrayExpression",
12435
+ children: [open, ...content, close],
12436
+ names: content.flatMap((c) => c?.names || [])
12437
+ };
12438
+ });
12439
+ var _ArrayLiteral$2 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBracket, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(ArrayLiteralContent, __, CloseBracket)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12407
12440
  var open = $1;
12408
12441
  if (!$3)
12409
12442
  return $skip;
@@ -12424,8 +12457,8 @@ ${js}`
12424
12457
  names
12425
12458
  };
12426
12459
  });
12427
- var _ArrayLiteral$2 = NestedBulletedArray;
12428
- var _ArrayLiteral$$ = [_ArrayLiteral$0, _ArrayLiteral$1, _ArrayLiteral$2];
12460
+ var _ArrayLiteral$3 = NestedBulletedArray;
12461
+ var _ArrayLiteral$$ = [_ArrayLiteral$0, _ArrayLiteral$1, _ArrayLiteral$2, _ArrayLiteral$3];
12429
12462
  function _ArrayLiteral(ctx, state2) {
12430
12463
  return (0, import_lib2.$EVENT_C)(ctx, state2, "_ArrayLiteral", _ArrayLiteral$$);
12431
12464
  }
@@ -12598,7 +12631,12 @@ ${js}`
12598
12631
  var ElementList$0 = (0, import_lib2.$T)((0, import_lib2.$S)(BulletedArray), function(value) {
12599
12632
  return [value[0]];
12600
12633
  });
12601
- var ElementList$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), ArrayElementExpression, (0, import_lib2.$Q)(ElementListRest)), function($skip, $loc, $0, $1, $2, $3) {
12634
+ var ElementList$1 = SingleLineElementList;
12635
+ var ElementList$$ = [ElementList$0, ElementList$1];
12636
+ function ElementList(ctx, state2) {
12637
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "ElementList", ElementList$$);
12638
+ }
12639
+ var SingleLineElementList$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(EOS), ArrayElementExpression, (0, import_lib2.$Q)(ElementListRest)), function($skip, $loc, $0, $1, $2, $3) {
12602
12640
  var first = $2;
12603
12641
  var rest = $3;
12604
12642
  if (!rest.length)
@@ -12609,9 +12647,8 @@ ${js}`
12609
12647
  rest.map(([_2, e], i) => append(e, rest[i + 1]?.[0]))
12610
12648
  );
12611
12649
  });
12612
- var ElementList$$ = [ElementList$0, ElementList$1];
12613
- function ElementList(ctx, state2) {
12614
- return (0, import_lib2.$EVENT_C)(ctx, state2, "ElementList", ElementList$$);
12650
+ function SingleLineElementList(ctx, state2) {
12651
+ return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineElementList", SingleLineElementList$0);
12615
12652
  }
12616
12653
  var ElementListRest$0 = (0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), Comma, (0, import_lib2.$N)(EOS)), ArrayElementExpression);
12617
12654
  function ElementListRest(ctx, state2) {
@@ -12790,7 +12827,29 @@ ${js}`
12790
12827
  function ObjectLiteral(ctx, state2) {
12791
12828
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ObjectLiteral", ObjectLiteral$$);
12792
12829
  }
12793
- var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(BracedObjectLiteralContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12830
+ var BracedObjectLiteral$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, CloseBrace, ApplicationStart, AllowAll, (0, import_lib2.$E)((0, import_lib2.$C)(NestedPropertyDefinitions, SingleLineObjectProperties)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
12831
+ var open = $1;
12832
+ var close = $2;
12833
+ var properties = $5;
12834
+ if (!properties?.length)
12835
+ return $skip;
12836
+ let last = properties[properties.length - 1];
12837
+ if (last.delim?.implicit) {
12838
+ last = {
12839
+ ...last,
12840
+ delim: void 0,
12841
+ children: last.children.filter((c) => c !== last.delim)
12842
+ };
12843
+ properties = [...properties.slice(0, properties.length - 1), last];
12844
+ }
12845
+ return {
12846
+ type: "ObjectExpression",
12847
+ children: [open, properties, close],
12848
+ names: properties.flatMap((c) => c.names || []),
12849
+ properties
12850
+ };
12851
+ });
12852
+ var BracedObjectLiteral$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(OpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$S)(BracedObjectLiteralContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
12794
12853
  var open = $1;
12795
12854
  if (!$3)
12796
12855
  return $skip;
@@ -12802,13 +12861,13 @@ ${js}`
12802
12861
  properties
12803
12862
  };
12804
12863
  });
12864
+ var BracedObjectLiteral$$ = [BracedObjectLiteral$0, BracedObjectLiteral$1];
12805
12865
  function BracedObjectLiteral(ctx, state2) {
12806
- return (0, import_lib2.$EVENT)(ctx, state2, "BracedObjectLiteral", BracedObjectLiteral$0);
12866
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "BracedObjectLiteral", BracedObjectLiteral$$);
12807
12867
  }
12808
- var BracedObjectLiteralContent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Q)((0, import_lib2.$S)(PropertyDefinition, ObjectPropertyDelimiter)), (0, import_lib2.$E)(NestedPropertyDefinitions)), function($skip, $loc, $0, $1, $2) {
12809
- var line = $1;
12810
- var nested = $2;
12811
- line = line.flatMap(([prop, delim]) => {
12868
+ var SingleLineObjectProperties$0 = (0, import_lib2.$TV)((0, import_lib2.$Q)((0, import_lib2.$S)(PropertyDefinition, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
12869
+ var line = $0;
12870
+ return line.flatMap(([prop, delim]) => {
12812
12871
  prop = Array.isArray(prop) ? prop : [prop];
12813
12872
  let last = prop[prop.length - 1];
12814
12873
  if (!last)
@@ -12820,6 +12879,13 @@ ${js}`
12820
12879
  };
12821
12880
  return [...prop.slice(0, prop.length - 1), last];
12822
12881
  });
12882
+ });
12883
+ function SingleLineObjectProperties(ctx, state2) {
12884
+ return (0, import_lib2.$EVENT)(ctx, state2, "SingleLineObjectProperties", SingleLineObjectProperties$0);
12885
+ }
12886
+ var BracedObjectLiteralContent$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(SingleLineObjectProperties, (0, import_lib2.$E)(NestedPropertyDefinitions)), function($skip, $loc, $0, $1, $2) {
12887
+ var line = $1;
12888
+ var nested = $2;
12823
12889
  return line.concat(nested || []);
12824
12890
  });
12825
12891
  var BracedObjectLiteralContent$1 = (0, import_lib2.$TV)((0, import_lib2.$P)((0, import_lib2.$S)(__, PropertyDefinition, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
@@ -12951,8 +13017,8 @@ ${js}`
12951
13017
  }
12952
13018
  var ObjectPropertyDelimiter$0 = (0, import_lib2.$S)((0, import_lib2.$E)(_), Comma);
12953
13019
  var ObjectPropertyDelimiter$1 = (0, import_lib2.$Y)((0, import_lib2.$S)(__, (0, import_lib2.$EXPECT)($L37, 'ObjectPropertyDelimiter "}"')));
12954
- var ObjectPropertyDelimiter$2 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertComma), function(value) {
12955
- return value[1];
13020
+ var ObjectPropertyDelimiter$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$Y)(EOS), InsertComma), function($skip, $loc, $0, $1, $2) {
13021
+ return { ...$2, implicit: true };
12956
13022
  });
12957
13023
  var ObjectPropertyDelimiter$$ = [ObjectPropertyDelimiter$0, ObjectPropertyDelimiter$1, ObjectPropertyDelimiter$2];
12958
13024
  function ObjectPropertyDelimiter(ctx, state2) {
@@ -15731,8 +15797,9 @@ ${js}`
15731
15797
  return (0, import_lib2.$EVENT_C)(ctx, state2, "ModuleExportName", ModuleExportName$$);
15732
15798
  }
15733
15799
  var ModuleSpecifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(UnprocessedModuleSpecifier, (0, import_lib2.$E)(ImportAssertion)), function($skip, $loc, $0, $1, $2) {
15734
- var a = $2;
15735
- let { token } = $1;
15800
+ var module = $1;
15801
+ var assertion = $2;
15802
+ let { token } = module;
15736
15803
  if (config.rewriteTsImports) {
15737
15804
  token = token.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
15738
15805
  }
@@ -15742,9 +15809,15 @@ ${js}`
15742
15809
  `${config.rewriteCivetImports.replace(/\$/g, "$$")}$1`
15743
15810
  );
15744
15811
  }
15745
- if (a)
15746
- return [{ ...$1, token }, a];
15747
- return { ...$1, token };
15812
+ if (token !== module.token) {
15813
+ module = { ...module, token, input: module.token };
15814
+ }
15815
+ return {
15816
+ type: "ModuleSpecifier",
15817
+ module,
15818
+ assertion,
15819
+ children: [module, assertion]
15820
+ };
15748
15821
  });
15749
15822
  function ModuleSpecifier(ctx, state2) {
15750
15823
  return (0, import_lib2.$EVENT)(ctx, state2, "ModuleSpecifier", ModuleSpecifier$0);