@danielx/civet 0.5.92 → 0.5.93

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/browser.js CHANGED
@@ -475,6 +475,8 @@ var Civet = (() => {
475
475
  };
476
476
  }
477
477
  function processUnaryExpression(pre, exp, post) {
478
+ if (!(pre.length || post))
479
+ return exp;
478
480
  if (post?.token === "?") {
479
481
  post = {
480
482
  $loc: post.$loc,
@@ -524,22 +526,10 @@ var Civet = (() => {
524
526
  };
525
527
  }
526
528
  }
527
- if (exp.children) {
528
- const children = [...pre, ...exp.children];
529
- if (post)
530
- children.push(post);
531
- return Object.assign({}, exp, { children });
532
- } else if (Array.isArray(exp)) {
533
- const children = [...pre, ...exp];
534
- if (post)
535
- children.push(post);
536
- return { children };
537
- } else {
538
- const children = [...pre, exp];
539
- if (post)
540
- children.push(post);
541
- return { children };
542
- }
529
+ return {
530
+ type: "UnaryExpression",
531
+ children: [...pre, exp, post]
532
+ };
543
533
  }
544
534
  module.exports = {
545
535
  blockWithPrefix,
@@ -3119,9 +3109,9 @@ ${input.slice(result.pos)}
3119
3109
  return result;
3120
3110
  }
3121
3111
  }
3122
- var FatArrow$0 = $TS($S(__, $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3112
+ var FatArrow$0 = $TS($S($E(_), $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3123
3113
  var ws = $1;
3124
- if (!ws.length)
3114
+ if (!ws)
3125
3115
  return " =>";
3126
3116
  return $0;
3127
3117
  });
@@ -4132,11 +4122,8 @@ ${input.slice(result.pos)}
4132
4122
  return result;
4133
4123
  }
4134
4124
  }
4135
- var LeftHandSideExpression$0 = $TS($S($Q($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression), function($skip, $loc, $0, $1, $2) {
4136
- if ($1.length)
4137
- return $0;
4138
- return $2;
4139
- });
4125
+ var LeftHandSideExpression$0 = $S($P($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression, $E(TypeArguments));
4126
+ var LeftHandSideExpression$1 = CallExpression;
4140
4127
  function LeftHandSideExpression(state) {
4141
4128
  let eventData;
4142
4129
  if (state.events) {
@@ -4148,12 +4135,12 @@ ${input.slice(result.pos)}
4148
4135
  }
4149
4136
  }
4150
4137
  if (state.tokenize) {
4151
- const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state));
4138
+ const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state));
4152
4139
  if (state.events)
4153
4140
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4154
4141
  return result;
4155
4142
  } else {
4156
- const result = LeftHandSideExpression$0(state);
4143
+ const result = LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state);
4157
4144
  if (state.events)
4158
4145
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4159
4146
  return result;
@@ -4722,10 +4709,13 @@ ${input.slice(result.pos)}
4722
4709
  }
4723
4710
  }
4724
4711
  var Parameters$0 = NonEmptyParameters;
4725
- var Parameters$1 = $TV($EXPECT($L0, fail, 'Parameters ""'), function($skip, $loc, $0, $1) {
4712
+ var Parameters$1 = $TS($S($E(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
4713
+ var tp = $1;
4714
+ var p = $2;
4726
4715
  return {
4727
4716
  type: "Parameters",
4728
- children: [{ $loc, token: "()" }],
4717
+ children: [tp, { $loc: p.$loc, token: "()" }],
4718
+ tp,
4729
4719
  names: [],
4730
4720
  implicit: true
4731
4721
  };
@@ -4771,9 +4761,8 @@ ${input.slice(result.pos)}
4771
4761
  }
4772
4762
  let blockPrefix;
4773
4763
  if (after.length) {
4774
- const spliceRef = module.getRef("splice");
4775
4764
  blockPrefix = {
4776
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
4765
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
4777
4766
  names: after.flatMap((p) => p.names)
4778
4767
  };
4779
4768
  }
@@ -6157,7 +6146,7 @@ ${input.slice(result.pos)}
6157
6146
  async,
6158
6147
  generator,
6159
6148
  block: null,
6160
- children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
6149
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
6161
6150
  };
6162
6151
  });
6163
6152
  function FunctionSignature(state) {
@@ -6470,7 +6459,7 @@ ${input.slice(result.pos)}
6470
6459
  return result;
6471
6460
  }
6472
6461
  }
6473
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6462
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6474
6463
  var async = $1;
6475
6464
  var parameters = $2;
6476
6465
  var suffix = $3;
@@ -8542,7 +8531,7 @@ ${input.slice(result.pos)}
8542
8531
  return result;
8543
8532
  }
8544
8533
  }
8545
- var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
8534
+ var MethodModifier$0 = $TS($S(GetOrSet, $E(_), $Y(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
8546
8535
  var kind = $1;
8547
8536
  return {
8548
8537
  type: "MethodModifier",
@@ -17400,7 +17389,8 @@ ${input.slice(result.pos)}
17400
17389
  var JSXAttributeValue$1 = JSXElement;
17401
17390
  var JSXAttributeValue$2 = JSXFragment;
17402
17391
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
17403
- if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
17392
+ var value = $2;
17393
+ if (value.type === "StringLiteral") {
17404
17394
  return $skip;
17405
17395
  }
17406
17396
  return $0;
@@ -19783,7 +19773,7 @@ ${input.slice(result.pos)}
19783
19773
  return result;
19784
19774
  }
19785
19775
  }
19786
- var TypeParameters$0 = $TS($S(__, $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19776
+ var TypeParameters$0 = $TS($S($E(_), $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19787
19777
  var parameters = $3;
19788
19778
  return {
19789
19779
  type: "TypeParameters",
@@ -21934,10 +21924,9 @@ ${input.slice(result.pos)}
21934
21924
  names.push(...rest.names);
21935
21925
  }
21936
21926
  if (after.length) {
21937
- const spliceRef = module.getRef("splice");
21938
21927
  blockPrefix = {
21939
21928
  type: "PostRestBindingElements",
21940
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
21929
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
21941
21930
  names: after.flatMap((p) => p.names)
21942
21931
  };
21943
21932
  }
@@ -22298,16 +22287,6 @@ ${input.slice(result.pos)}
22298
22287
  exp.children.push(...post);
22299
22288
  });
22300
22289
  }
22301
- function checkSpliceRef(statements) {
22302
- const spliceRef = module.getRef("splice");
22303
- if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
22304
- const typeSuffix = {
22305
- ts: true,
22306
- children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
22307
- };
22308
- module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
22309
- }
22310
- }
22311
22290
  module.attachPostfixStatementAsExpression = function(exp, post) {
22312
22291
  let clause;
22313
22292
  switch (post[1].type) {
@@ -22795,7 +22774,6 @@ ${input.slice(result.pos)}
22795
22774
  processTryExpressions(statements);
22796
22775
  hoistRefDecs(statements);
22797
22776
  gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
22798
- checkSpliceRef(statements);
22799
22777
  statements.unshift(...module.prelude);
22800
22778
  if (module.config.autoLet) {
22801
22779
  createLetDecs(statements, []);
@@ -23606,17 +23584,17 @@ ${input.slice(result.pos)}
23606
23584
  smRegexp = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([+a-zA-Z0-9\/]*=?=?)$/;
23607
23585
  SourceMap.remap = function(codeWithSourceMap, upstreamMap, sourcePath, targetPath) {
23608
23586
  var codeWithoutSourceMap, composedLines, newSourceMap, parsed, remappedCodeWithSourceMap, remappedSourceMapJSON, sourceMapText;
23609
- sourceMapText = codeWithSourceMap.match(smRegexp);
23587
+ sourceMapText = null;
23588
+ codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, (match, sm) => {
23589
+ sourceMapText = sm;
23590
+ return "";
23591
+ });
23610
23592
  if (sourceMapText) {
23611
- parsed = SourceMap.parseWithLines(sourceMapText[1]);
23612
- } else {
23613
- console.warn("No source map found in code");
23614
- return codeWithSourceMap;
23593
+ parsed = SourceMap.parseWithLines(sourceMapText);
23594
+ composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23595
+ upstreamMap.data.lines = composedLines;
23615
23596
  }
23616
- composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23617
- upstreamMap.data.lines = composedLines;
23618
23597
  remappedSourceMapJSON = upstreamMap.json(sourcePath, targetPath);
23619
- codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, "");
23620
23598
  newSourceMap = `${"sourceMapping"}URL=data:application/json;charset=utf-8;base64,${base64Encode(JSON.stringify(remappedSourceMapJSON))}`;
23621
23599
  remappedCodeWithSourceMap = `${codeWithoutSourceMap}
23622
23600
  //# ${newSourceMap}`;
@@ -23786,15 +23764,14 @@ ${input.slice(result.pos)}
23786
23764
  // source/main.coffee
23787
23765
  "civet coffeeCompat";
23788
23766
  var SourceMap2;
23789
- var base64Encode2;
23790
23767
  var makeCache;
23791
23768
  var parse;
23792
23769
  var uncacheable;
23793
23770
  ({ parse } = import_parser.default);
23794
- ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
23771
+ ({ SourceMap: SourceMap2 } = util_exports);
23795
23772
  uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23796
23773
  var compile = function(src, options) {
23797
- var ast, code, events, filename, ref, result, sm, srcMapJSON;
23774
+ var ast, code, events, filename, ref, result, sm;
23798
23775
  if (!options) {
23799
23776
  options = {};
23800
23777
  } else {
@@ -23816,10 +23793,7 @@ ${input.slice(result.pos)}
23816
23793
  options.updateSourceMap = sm.updateSourceMap;
23817
23794
  code = generate_default(ast, options);
23818
23795
  if (options.inlineMap) {
23819
- srcMapJSON = sm.json(filename, "");
23820
- return `${code}
23821
- ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode2(JSON.stringify(srcMapJSON))}
23822
- `;
23796
+ return SourceMap2.remap(code, sm, filename, filename + ".tsx");
23823
23797
  } else {
23824
23798
  return {
23825
23799
  code,
package/dist/civet CHANGED
@@ -265,7 +265,6 @@ cli = async function() {
265
265
  if (options.run) {
266
266
  options.js = true;
267
267
  options.inlineMap = true;
268
- require("../register.js");
269
268
  }
270
269
  if (options.repl) {
271
270
  return repl(options);
@@ -353,6 +352,7 @@ cli = async function() {
353
352
  }
354
353
  results.push(process.exit(child.status));
355
354
  } else {
355
+ require("../register.js");
356
356
  try {
357
357
  module.filename = await fs.realpath(filename);
358
358
  } catch (error1) {
package/dist/esm.mjs CHANGED
@@ -44,7 +44,7 @@ function ensureRegister () {
44
44
  let path = pathOrUrl
45
45
  // If it's a file URL, convert to local path
46
46
  // I could not find a way to handle non-URLs except to swallow an error
47
- if (path.startsWith('file://')) {
47
+ if (path.startsWith('file:')) {
48
48
  try {
49
49
  path = fileURLToPath(path)
50
50
  } catch(e) {}
@@ -85,10 +85,11 @@ export async function load(url, context, next) {
85
85
  js: true,
86
86
  })
87
87
 
88
- const transpiledPath = url + ".tsx"
88
+ // NOTE: Append .tsx to URL so ts-node treats as TypeScript
89
+ const transpiledUrl = url + ".tsx"
89
90
 
90
91
  // NOTE: Assuming ts-node hook follows load hook
91
- const result = await next(transpiledPath, {
92
+ const result = await next(transpiledUrl, {
92
93
  // ts-node won't transpile unless this is module
93
94
  // can't use commonjs since we don't rewrite imports
94
95
  format: "module",
@@ -99,9 +100,13 @@ export async function load(url, context, next) {
99
100
  // NOTE: we must install our source map support after ts-node does to take priority
100
101
  ensureRegister()
101
102
 
103
+ // Remove .tsx extension for final URL
104
+ result.responseURL = (result.responseURL ?? transpiledUrl)
105
+ .replace(/.tsx$/, '')
106
+
102
107
  // parse source map from downstream (ts-node) result
103
108
  // compose with civet source map
104
- result.source = SourceMap.remap(result.source, sourceMap, url, "")
109
+ result.source = SourceMap.remap(result.source, sourceMap, url, result.responseURL)
105
110
  // NOTE: This path needs to match what ts-node uses so we can override the source map
106
111
  outputCache.set(normalizeSlashes(path), result.source)
107
112
 
package/dist/main.js CHANGED
@@ -474,6 +474,8 @@ var require_lib = __commonJS({
474
474
  };
475
475
  }
476
476
  function processUnaryExpression(pre, exp, post) {
477
+ if (!(pre.length || post))
478
+ return exp;
477
479
  if (post?.token === "?") {
478
480
  post = {
479
481
  $loc: post.$loc,
@@ -523,22 +525,10 @@ var require_lib = __commonJS({
523
525
  };
524
526
  }
525
527
  }
526
- if (exp.children) {
527
- const children = [...pre, ...exp.children];
528
- if (post)
529
- children.push(post);
530
- return Object.assign({}, exp, { children });
531
- } else if (Array.isArray(exp)) {
532
- const children = [...pre, ...exp];
533
- if (post)
534
- children.push(post);
535
- return { children };
536
- } else {
537
- const children = [...pre, exp];
538
- if (post)
539
- children.push(post);
540
- return { children };
541
- }
528
+ return {
529
+ type: "UnaryExpression",
530
+ children: [...pre, exp, post]
531
+ };
542
532
  }
543
533
  module2.exports = {
544
534
  blockWithPrefix,
@@ -3118,9 +3108,9 @@ ${input.slice(result.pos)}
3118
3108
  return result;
3119
3109
  }
3120
3110
  }
3121
- var FatArrow$0 = $TS($S(__, $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3111
+ var FatArrow$0 = $TS($S($E(_), $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3122
3112
  var ws = $1;
3123
- if (!ws.length)
3113
+ if (!ws)
3124
3114
  return " =>";
3125
3115
  return $0;
3126
3116
  });
@@ -4131,11 +4121,8 @@ ${input.slice(result.pos)}
4131
4121
  return result;
4132
4122
  }
4133
4123
  }
4134
- var LeftHandSideExpression$0 = $TS($S($Q($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression), function($skip, $loc, $0, $1, $2) {
4135
- if ($1.length)
4136
- return $0;
4137
- return $2;
4138
- });
4124
+ var LeftHandSideExpression$0 = $S($P($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression, $E(TypeArguments));
4125
+ var LeftHandSideExpression$1 = CallExpression;
4139
4126
  function LeftHandSideExpression(state) {
4140
4127
  let eventData;
4141
4128
  if (state.events) {
@@ -4147,12 +4134,12 @@ ${input.slice(result.pos)}
4147
4134
  }
4148
4135
  }
4149
4136
  if (state.tokenize) {
4150
- const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state));
4137
+ const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state));
4151
4138
  if (state.events)
4152
4139
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4153
4140
  return result;
4154
4141
  } else {
4155
- const result = LeftHandSideExpression$0(state);
4142
+ const result = LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state);
4156
4143
  if (state.events)
4157
4144
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4158
4145
  return result;
@@ -4721,10 +4708,13 @@ ${input.slice(result.pos)}
4721
4708
  }
4722
4709
  }
4723
4710
  var Parameters$0 = NonEmptyParameters;
4724
- var Parameters$1 = $TV($EXPECT($L0, fail, 'Parameters ""'), function($skip, $loc, $0, $1) {
4711
+ var Parameters$1 = $TS($S($E(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
4712
+ var tp = $1;
4713
+ var p = $2;
4725
4714
  return {
4726
4715
  type: "Parameters",
4727
- children: [{ $loc, token: "()" }],
4716
+ children: [tp, { $loc: p.$loc, token: "()" }],
4717
+ tp,
4728
4718
  names: [],
4729
4719
  implicit: true
4730
4720
  };
@@ -4770,9 +4760,8 @@ ${input.slice(result.pos)}
4770
4760
  }
4771
4761
  let blockPrefix;
4772
4762
  if (after.length) {
4773
- const spliceRef = module2.getRef("splice");
4774
4763
  blockPrefix = {
4775
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
4764
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
4776
4765
  names: after.flatMap((p) => p.names)
4777
4766
  };
4778
4767
  }
@@ -6156,7 +6145,7 @@ ${input.slice(result.pos)}
6156
6145
  async,
6157
6146
  generator,
6158
6147
  block: null,
6159
- children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
6148
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
6160
6149
  };
6161
6150
  });
6162
6151
  function FunctionSignature(state) {
@@ -6469,7 +6458,7 @@ ${input.slice(result.pos)}
6469
6458
  return result;
6470
6459
  }
6471
6460
  }
6472
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6461
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6473
6462
  var async = $1;
6474
6463
  var parameters = $2;
6475
6464
  var suffix = $3;
@@ -8541,7 +8530,7 @@ ${input.slice(result.pos)}
8541
8530
  return result;
8542
8531
  }
8543
8532
  }
8544
- var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
8533
+ var MethodModifier$0 = $TS($S(GetOrSet, $E(_), $Y(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
8545
8534
  var kind = $1;
8546
8535
  return {
8547
8536
  type: "MethodModifier",
@@ -17399,7 +17388,8 @@ ${input.slice(result.pos)}
17399
17388
  var JSXAttributeValue$1 = JSXElement;
17400
17389
  var JSXAttributeValue$2 = JSXFragment;
17401
17390
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
17402
- if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
17391
+ var value = $2;
17392
+ if (value.type === "StringLiteral") {
17403
17393
  return $skip;
17404
17394
  }
17405
17395
  return $0;
@@ -19782,7 +19772,7 @@ ${input.slice(result.pos)}
19782
19772
  return result;
19783
19773
  }
19784
19774
  }
19785
- var TypeParameters$0 = $TS($S(__, $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19775
+ var TypeParameters$0 = $TS($S($E(_), $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19786
19776
  var parameters = $3;
19787
19777
  return {
19788
19778
  type: "TypeParameters",
@@ -21933,10 +21923,9 @@ ${input.slice(result.pos)}
21933
21923
  names.push(...rest.names);
21934
21924
  }
21935
21925
  if (after.length) {
21936
- const spliceRef = module2.getRef("splice");
21937
21926
  blockPrefix = {
21938
21927
  type: "PostRestBindingElements",
21939
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
21928
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
21940
21929
  names: after.flatMap((p) => p.names)
21941
21930
  };
21942
21931
  }
@@ -22297,16 +22286,6 @@ ${input.slice(result.pos)}
22297
22286
  exp.children.push(...post);
22298
22287
  });
22299
22288
  }
22300
- function checkSpliceRef(statements) {
22301
- const spliceRef = module2.getRef("splice");
22302
- if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
22303
- const typeSuffix = {
22304
- ts: true,
22305
- children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
22306
- };
22307
- module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module2.asAny, "\n"]]);
22308
- }
22309
- }
22310
22289
  module2.attachPostfixStatementAsExpression = function(exp, post) {
22311
22290
  let clause;
22312
22291
  switch (post[1].type) {
@@ -22794,7 +22773,6 @@ ${input.slice(result.pos)}
22794
22773
  processTryExpressions(statements);
22795
22774
  hoistRefDecs(statements);
22796
22775
  gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
22797
- checkSpliceRef(statements);
22798
22776
  statements.unshift(...module2.prelude);
22799
22777
  if (module2.config.autoLet) {
22800
22778
  createLetDecs(statements, []);
@@ -23606,17 +23584,17 @@ SourceMap.parseWithLines = function(base64encodedJSONstr) {
23606
23584
  smRegexp = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([+a-zA-Z0-9\/]*=?=?)$/;
23607
23585
  SourceMap.remap = function(codeWithSourceMap, upstreamMap, sourcePath, targetPath) {
23608
23586
  var codeWithoutSourceMap, composedLines, newSourceMap, parsed, remappedCodeWithSourceMap, remappedSourceMapJSON, sourceMapText;
23609
- sourceMapText = codeWithSourceMap.match(smRegexp);
23587
+ sourceMapText = null;
23588
+ codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, (match, sm) => {
23589
+ sourceMapText = sm;
23590
+ return "";
23591
+ });
23610
23592
  if (sourceMapText) {
23611
- parsed = SourceMap.parseWithLines(sourceMapText[1]);
23612
- } else {
23613
- console.warn("No source map found in code");
23614
- return codeWithSourceMap;
23593
+ parsed = SourceMap.parseWithLines(sourceMapText);
23594
+ composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23595
+ upstreamMap.data.lines = composedLines;
23615
23596
  }
23616
- composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23617
- upstreamMap.data.lines = composedLines;
23618
23597
  remappedSourceMapJSON = upstreamMap.json(sourcePath, targetPath);
23619
- codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, "");
23620
23598
  newSourceMap = `${"sourceMapping"}URL=data:application/json;charset=utf-8;base64,${base64Encode(JSON.stringify(remappedSourceMapJSON))}`;
23621
23599
  remappedCodeWithSourceMap = `${codeWithoutSourceMap}
23622
23600
  //# ${newSourceMap}`;
@@ -23786,15 +23764,14 @@ remapPosition = function(position, sourcemapLines) {
23786
23764
  // source/main.coffee
23787
23765
  "civet coffeeCompat";
23788
23766
  var SourceMap2;
23789
- var base64Encode2;
23790
23767
  var makeCache;
23791
23768
  var parse;
23792
23769
  var uncacheable;
23793
23770
  ({ parse } = import_parser.default);
23794
- ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
23771
+ ({ SourceMap: SourceMap2 } = util_exports);
23795
23772
  uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23796
23773
  var compile = function(src, options) {
23797
- var ast, code, events, filename, ref, result, sm, srcMapJSON;
23774
+ var ast, code, events, filename, ref, result, sm;
23798
23775
  if (!options) {
23799
23776
  options = {};
23800
23777
  } else {
@@ -23816,10 +23793,7 @@ var compile = function(src, options) {
23816
23793
  options.updateSourceMap = sm.updateSourceMap;
23817
23794
  code = generate_default(ast, options);
23818
23795
  if (options.inlineMap) {
23819
- srcMapJSON = sm.json(filename, "");
23820
- return `${code}
23821
- ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode2(JSON.stringify(srcMapJSON))}
23822
- `;
23796
+ return SourceMap2.remap(code, sm, filename, filename + ".tsx");
23823
23797
  } else {
23824
23798
  return {
23825
23799
  code,
package/dist/main.mjs CHANGED
@@ -472,6 +472,8 @@ var require_lib = __commonJS({
472
472
  };
473
473
  }
474
474
  function processUnaryExpression(pre, exp, post) {
475
+ if (!(pre.length || post))
476
+ return exp;
475
477
  if (post?.token === "?") {
476
478
  post = {
477
479
  $loc: post.$loc,
@@ -521,22 +523,10 @@ var require_lib = __commonJS({
521
523
  };
522
524
  }
523
525
  }
524
- if (exp.children) {
525
- const children = [...pre, ...exp.children];
526
- if (post)
527
- children.push(post);
528
- return Object.assign({}, exp, { children });
529
- } else if (Array.isArray(exp)) {
530
- const children = [...pre, ...exp];
531
- if (post)
532
- children.push(post);
533
- return { children };
534
- } else {
535
- const children = [...pre, exp];
536
- if (post)
537
- children.push(post);
538
- return { children };
539
- }
526
+ return {
527
+ type: "UnaryExpression",
528
+ children: [...pre, exp, post]
529
+ };
540
530
  }
541
531
  module.exports = {
542
532
  blockWithPrefix,
@@ -3116,9 +3106,9 @@ ${input.slice(result.pos)}
3116
3106
  return result;
3117
3107
  }
3118
3108
  }
3119
- var FatArrow$0 = $TS($S(__, $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3109
+ var FatArrow$0 = $TS($S($E(_), $EXPECT($L8, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
3120
3110
  var ws = $1;
3121
- if (!ws.length)
3111
+ if (!ws)
3122
3112
  return " =>";
3123
3113
  return $0;
3124
3114
  });
@@ -4129,11 +4119,8 @@ ${input.slice(result.pos)}
4129
4119
  return result;
4130
4120
  }
4131
4121
  }
4132
- var LeftHandSideExpression$0 = $TS($S($Q($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression), function($skip, $loc, $0, $1, $2) {
4133
- if ($1.length)
4134
- return $0;
4135
- return $2;
4136
- });
4122
+ var LeftHandSideExpression$0 = $S($P($S(New, $N($C($EXPECT($L5, fail, 'LeftHandSideExpression "."'), $EXPECT($L10, fail, 'LeftHandSideExpression ":"'))), __)), CallExpression, $E(TypeArguments));
4123
+ var LeftHandSideExpression$1 = CallExpression;
4137
4124
  function LeftHandSideExpression(state) {
4138
4125
  let eventData;
4139
4126
  if (state.events) {
@@ -4145,12 +4132,12 @@ ${input.slice(result.pos)}
4145
4132
  }
4146
4133
  }
4147
4134
  if (state.tokenize) {
4148
- const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state));
4135
+ const result = $TOKEN("LeftHandSideExpression", state, LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state));
4149
4136
  if (state.events)
4150
4137
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4151
4138
  return result;
4152
4139
  } else {
4153
- const result = LeftHandSideExpression$0(state);
4140
+ const result = LeftHandSideExpression$0(state) || LeftHandSideExpression$1(state);
4154
4141
  if (state.events)
4155
4142
  state.events.exit?.("LeftHandSideExpression", state, result, eventData);
4156
4143
  return result;
@@ -4719,10 +4706,13 @@ ${input.slice(result.pos)}
4719
4706
  }
4720
4707
  }
4721
4708
  var Parameters$0 = NonEmptyParameters;
4722
- var Parameters$1 = $TV($EXPECT($L0, fail, 'Parameters ""'), function($skip, $loc, $0, $1) {
4709
+ var Parameters$1 = $TS($S($E(TypeParameters), Loc), function($skip, $loc, $0, $1, $2) {
4710
+ var tp = $1;
4711
+ var p = $2;
4723
4712
  return {
4724
4713
  type: "Parameters",
4725
- children: [{ $loc, token: "()" }],
4714
+ children: [tp, { $loc: p.$loc, token: "()" }],
4715
+ tp,
4726
4716
  names: [],
4727
4717
  implicit: true
4728
4718
  };
@@ -4768,9 +4758,8 @@ ${input.slice(result.pos)}
4768
4758
  }
4769
4759
  let blockPrefix;
4770
4760
  if (after.length) {
4771
- const spliceRef = module.getRef("splice");
4772
4761
  blockPrefix = {
4773
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
4762
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
4774
4763
  names: after.flatMap((p) => p.names)
4775
4764
  };
4776
4765
  }
@@ -6154,7 +6143,7 @@ ${input.slice(result.pos)}
6154
6143
  async,
6155
6144
  generator,
6156
6145
  block: null,
6157
- children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
6146
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
6158
6147
  };
6159
6148
  });
6160
6149
  function FunctionSignature(state) {
@@ -6467,7 +6456,7 @@ ${input.slice(result.pos)}
6467
6456
  return result;
6468
6457
  }
6469
6458
  }
6470
- var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6459
+ var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $E(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
6471
6460
  var async = $1;
6472
6461
  var parameters = $2;
6473
6462
  var suffix = $3;
@@ -8539,7 +8528,7 @@ ${input.slice(result.pos)}
8539
8528
  return result;
8540
8529
  }
8541
8530
  }
8542
- var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
8531
+ var MethodModifier$0 = $TS($S(GetOrSet, $E(_), $Y(ClassElementName)), function($skip, $loc, $0, $1, $2, $3) {
8543
8532
  var kind = $1;
8544
8533
  return {
8545
8534
  type: "MethodModifier",
@@ -17397,7 +17386,8 @@ ${input.slice(result.pos)}
17397
17386
  var JSXAttributeValue$1 = JSXElement;
17398
17387
  var JSXAttributeValue$2 = JSXFragment;
17399
17388
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
17400
- if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
17389
+ var value = $2;
17390
+ if (value.type === "StringLiteral") {
17401
17391
  return $skip;
17402
17392
  }
17403
17393
  return $0;
@@ -19780,7 +19770,7 @@ ${input.slice(result.pos)}
19780
19770
  return result;
19781
19771
  }
19782
19772
  }
19783
- var TypeParameters$0 = $TS($S(__, $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19773
+ var TypeParameters$0 = $TS($S($E(_), $EXPECT($L132, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L31, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
19784
19774
  var parameters = $3;
19785
19775
  return {
19786
19776
  type: "TypeParameters",
@@ -21931,10 +21921,9 @@ ${input.slice(result.pos)}
21931
21921
  names.push(...rest.names);
21932
21922
  }
21933
21923
  if (after.length) {
21934
- const spliceRef = module.getRef("splice");
21935
21924
  blockPrefix = {
21936
21925
  type: "PostRestBindingElements",
21937
- children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
21926
+ children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", after.length.toString(), ")"],
21938
21927
  names: after.flatMap((p) => p.names)
21939
21928
  };
21940
21929
  }
@@ -22295,16 +22284,6 @@ ${input.slice(result.pos)}
22295
22284
  exp.children.push(...post);
22296
22285
  });
22297
22286
  }
22298
- function checkSpliceRef(statements) {
22299
- const spliceRef = module.getRef("splice");
22300
- if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
22301
- const typeSuffix = {
22302
- ts: true,
22303
- children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
22304
- };
22305
- module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
22306
- }
22307
- }
22308
22287
  module.attachPostfixStatementAsExpression = function(exp, post) {
22309
22288
  let clause;
22310
22289
  switch (post[1].type) {
@@ -22792,7 +22771,6 @@ ${input.slice(result.pos)}
22792
22771
  processTryExpressions(statements);
22793
22772
  hoistRefDecs(statements);
22794
22773
  gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
22795
- checkSpliceRef(statements);
22796
22774
  statements.unshift(...module.prelude);
22797
22775
  if (module.config.autoLet) {
22798
22776
  createLetDecs(statements, []);
@@ -23594,17 +23572,17 @@ SourceMap.parseWithLines = function(base64encodedJSONstr) {
23594
23572
  smRegexp = /\n\/\/# sourceMappingURL=data:application\/json;charset=utf-8;base64,([+a-zA-Z0-9\/]*=?=?)$/;
23595
23573
  SourceMap.remap = function(codeWithSourceMap, upstreamMap, sourcePath, targetPath) {
23596
23574
  var codeWithoutSourceMap, composedLines, newSourceMap, parsed, remappedCodeWithSourceMap, remappedSourceMapJSON, sourceMapText;
23597
- sourceMapText = codeWithSourceMap.match(smRegexp);
23575
+ sourceMapText = null;
23576
+ codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, (match, sm) => {
23577
+ sourceMapText = sm;
23578
+ return "";
23579
+ });
23598
23580
  if (sourceMapText) {
23599
- parsed = SourceMap.parseWithLines(sourceMapText[1]);
23600
- } else {
23601
- console.warn("No source map found in code");
23602
- return codeWithSourceMap;
23581
+ parsed = SourceMap.parseWithLines(sourceMapText);
23582
+ composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23583
+ upstreamMap.data.lines = composedLines;
23603
23584
  }
23604
- composedLines = SourceMap.composeLines(upstreamMap.data.lines, parsed.lines);
23605
- upstreamMap.data.lines = composedLines;
23606
23585
  remappedSourceMapJSON = upstreamMap.json(sourcePath, targetPath);
23607
- codeWithoutSourceMap = codeWithSourceMap.replace(smRegexp, "");
23608
23586
  newSourceMap = `${"sourceMapping"}URL=data:application/json;charset=utf-8;base64,${base64Encode(JSON.stringify(remappedSourceMapJSON))}`;
23609
23587
  remappedCodeWithSourceMap = `${codeWithoutSourceMap}
23610
23588
  //# ${newSourceMap}`;
@@ -23774,15 +23752,14 @@ remapPosition = function(position, sourcemapLines) {
23774
23752
  // source/main.coffee
23775
23753
  "civet coffeeCompat";
23776
23754
  var SourceMap2;
23777
- var base64Encode2;
23778
23755
  var makeCache;
23779
23756
  var parse;
23780
23757
  var uncacheable;
23781
23758
  ({ parse } = import_parser.default);
23782
- ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
23759
+ ({ SourceMap: SourceMap2 } = util_exports);
23783
23760
  uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "Dedented", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedNonAssignmentExtendedExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23784
23761
  var compile = function(src, options) {
23785
- var ast, code, events, filename, ref, result, sm, srcMapJSON;
23762
+ var ast, code, events, filename, ref, result, sm;
23786
23763
  if (!options) {
23787
23764
  options = {};
23788
23765
  } else {
@@ -23804,10 +23781,7 @@ var compile = function(src, options) {
23804
23781
  options.updateSourceMap = sm.updateSourceMap;
23805
23782
  code = generate_default(ast, options);
23806
23783
  if (options.inlineMap) {
23807
- srcMapJSON = sm.json(filename, "");
23808
- return `${code}
23809
- ${"//#"} sourceMappingURL=data:application/json;base64,${base64Encode2(JSON.stringify(srcMapJSON))}
23810
- `;
23784
+ return SourceMap2.remap(code, sm, filename, filename + ".tsx");
23811
23785
  } else {
23812
23786
  return {
23813
23787
  code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.92",
3
+ "version": "0.5.93",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.mjs",
@@ -37,6 +37,9 @@
37
37
  },
38
38
  "author": "Daniel X. Moore",
39
39
  "license": "MIT",
40
+ "dependencies": {
41
+ "@cspotcode/source-map-support": "^0.8.1"
42
+ },
40
43
  "devDependencies": {
41
44
  "@danielx/hera": "^0.8.0",
42
45
  "@types/assert": "^1.5.6",
package/register.js CHANGED
@@ -22,4 +22,13 @@ if (require.extensions) {
22
22
  module._compile(js, filename);
23
23
  return;
24
24
  };
25
+
26
+ try {
27
+ require('@cspotcode/source-map-support').install({
28
+ environment: 'node',
29
+ hookRequire: true // support inline source maps
30
+ })
31
+ } catch (e) {
32
+ // ignore missing dependency
33
+ }
25
34
  }
Binary file