@danielx/civet 0.6.87 → 0.6.89

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/README.md CHANGED
@@ -22,10 +22,9 @@ The modern way to write TypeScript.
22
22
  [esbuild](source/esbuild-plugin.civet),
23
23
  [Vite](https://github.com/edemaine/vite-plugin-civet),
24
24
  -->
25
+ [ESM/CJS loader](source/esm.civet),
25
26
  [Babel](source/babel-plugin.mjs),
26
27
  [Gulp](integration/gulp),
27
- [ESM module resolution](source/esm.civet),
28
- [CJS](register.js),
29
28
  [Bun](source/bun-civet.civet)
30
29
  - Starter templates for [Solid](https://github.com/orenelbaum/solid-civet-template) and [Solid Start](https://github.com/orenelbaum/solid-start-civet-template)
31
30
 
@@ -43,8 +42,8 @@ civet -c
43
42
  civet < source.civet > output.ts
44
43
  # Execute a .civet script
45
44
  civet source.civet ...args...
46
- # Execute a .civet source file in node using ts-node
47
- node --loader ts-node/esm --loader @danielx/civet/esm source.civet
45
+ # Execute a .civet source file in node
46
+ node --import @danielx/civet/register source.civet
48
47
  ```
49
48
 
50
49
  ![image](https://user-images.githubusercontent.com/18894/184558519-b675a903-7490-43ba-883e-0d8addacd4b9.png)
package/dist/browser.js CHANGED
@@ -235,6 +235,9 @@ var Civet = (() => {
235
235
  function hasYield(exp) {
236
236
  return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Yield").length > 0;
237
237
  }
238
+ function hasImportDeclaration(exp) {
239
+ return gatherRecursiveWithinFunction(exp, ({ type }) => type === "ImportDeclaration").length > 0;
240
+ }
238
241
  function deepCopy(node) {
239
242
  if (node == null)
240
243
  return node;
@@ -396,9 +399,10 @@ var Civet = (() => {
396
399
  }
397
400
  return ["(", type, ")"];
398
401
  }
399
- function wrapIIFE(expressions, async) {
402
+ function wrapIIFE(expressions, asyncFlag) {
400
403
  let prefix;
401
- if (async) {
404
+ let async;
405
+ if (asyncFlag) {
402
406
  async = "async ";
403
407
  } else if (hasAwait(expressions)) {
404
408
  async = "async ";
@@ -586,16 +590,16 @@ var Civet = (() => {
586
590
  expressions,
587
591
  children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
588
592
  };
589
- if (block.bare) {
590
- block.children = [[" {"], ...block.children, "}"];
591
- block.bare = false;
592
- }
593
+ braceBlock(block);
593
594
  updateParentPointers(block);
594
595
  }
595
596
  return block;
596
597
  }
597
598
  function braceBlock(block) {
598
599
  if (block.bare) {
600
+ if (block.children === block.expressions) {
601
+ block.children = [block.expressions];
602
+ }
599
603
  block.children.unshift(" {");
600
604
  block.children.push("}");
601
605
  return block.bare = false;
@@ -605,8 +609,13 @@ var Civet = (() => {
605
609
  }
606
610
  function duplicateBlock(block) {
607
611
  const expressions = [...block.expressions];
608
- const children = [...block.children];
609
- children.splice(children.indexOf(block.expressions), 1, expressions);
612
+ let children;
613
+ if (block.children === block.expressions) {
614
+ children = expressions;
615
+ } else {
616
+ children = [...block.children];
617
+ children.splice(children.indexOf(block.expressions), 1, expressions);
618
+ }
610
619
  return {
611
620
  ...block,
612
621
  expressions,
@@ -1712,7 +1721,11 @@ var Civet = (() => {
1712
1721
  }
1713
1722
  case "Identifier":
1714
1723
  case "BindingProperty": {
1715
- const children = [pattern.name, pattern.delim];
1724
+ const children = [
1725
+ // { name: value } = ... declares value, not name
1726
+ pattern.value ?? pattern.name,
1727
+ pattern.delim
1728
+ ];
1716
1729
  if (isWhitespaceOrEmpty(pattern.children[0])) {
1717
1730
  children.unshift(pattern.children[0]);
1718
1731
  }
@@ -2019,8 +2032,7 @@ var Civet = (() => {
2019
2032
  throw new Error("Could not find iteration statement in iteration expression");
2020
2033
  }
2021
2034
  if (subtype === "DoStatement") {
2022
- insertReturn(block);
2023
- children.splice(i, 1, ...wrapIIFE(["", statement, void 0], async));
2035
+ children.splice(i, 1, ...wrapIIFE([["", statement, void 0]], async));
2024
2036
  updateParentPointers(exp);
2025
2037
  return;
2026
2038
  }
@@ -2320,6 +2332,111 @@ var Civet = (() => {
2320
2332
  }
2321
2333
  }
2322
2334
  }
2335
+ function dynamizeFromClause(from) {
2336
+ from = from.slice(1);
2337
+ from = insertTrimmingSpace(from, "");
2338
+ if (from.at(-1)?.type === "ImportAssertion") {
2339
+ const assert2 = from.pop();
2340
+ from.push(", {", assert2.keyword, ":", assert2.object, "}");
2341
+ }
2342
+ return ["(", ...from, ")"];
2343
+ }
2344
+ function dynamizeImportDeclaration(decl) {
2345
+ const { imports } = decl;
2346
+ let { star, binding, specifiers } = imports;
2347
+ const justDefault = binding && !specifiers && !star;
2348
+ const pattern = (() => {
2349
+ {
2350
+ if (binding) {
2351
+ if (specifiers) {
2352
+ return makeRef();
2353
+ } else {
2354
+ return binding;
2355
+ }
2356
+ } else {
2357
+ return convertNamedImportsToObject(imports, true);
2358
+ }
2359
+ }
2360
+ })();
2361
+ const c = "const";
2362
+ const initializer = [
2363
+ " = ",
2364
+ justDefault ? "(" : void 0,
2365
+ { type: "Await", children: ["await"] },
2366
+ " ",
2367
+ decl.children[0],
2368
+ // import
2369
+ dynamizeFromClause(decl.from),
2370
+ justDefault ? ").default" : void 0
2371
+ ];
2372
+ const bindings = [{
2373
+ type: "Binding",
2374
+ names: pattern.names,
2375
+ pattern,
2376
+ initializer,
2377
+ children: [pattern, initializer]
2378
+ }];
2379
+ if (binding && specifiers) {
2380
+ const pattern2 = binding;
2381
+ const initializer2 = [
2382
+ " = ",
2383
+ pattern,
2384
+ ".default"
2385
+ ];
2386
+ bindings.push({
2387
+ type: "Binding",
2388
+ names: binding.names,
2389
+ pattern: pattern2,
2390
+ initializer: initializer2,
2391
+ children: [pattern2, initializer2]
2392
+ });
2393
+ const pattern3 = convertNamedImportsToObject(imports.children.at(-1), true);
2394
+ const initializer3 = [
2395
+ " = ",
2396
+ pattern
2397
+ ];
2398
+ bindings.push({
2399
+ type: "Binding",
2400
+ names: specifiers.names,
2401
+ pattern: pattern3,
2402
+ initializer: initializer3,
2403
+ children: [pattern3, initializer3]
2404
+ });
2405
+ }
2406
+ return {
2407
+ type: "Declaration",
2408
+ names: imports.names,
2409
+ bindings,
2410
+ decl: c,
2411
+ children: [
2412
+ c,
2413
+ " ",
2414
+ bindings.flatMap((binding2, i) => i > 0 ? [", ", binding2] : [binding2])
2415
+ ]
2416
+ };
2417
+ }
2418
+ function dynamizeImportDeclarationExpression($0) {
2419
+ const [imp, ws1, named, ws2, from] = $0;
2420
+ const object = convertNamedImportsToObject(named);
2421
+ const dot = ".";
2422
+ return processCallMemberExpression({
2423
+ type: "CallExpression",
2424
+ children: [
2425
+ { type: "Await", children: "await" },
2426
+ " ",
2427
+ imp,
2428
+ insertTrimmingSpace(ws2, ""),
2429
+ dynamizeFromClause(from),
2430
+ {
2431
+ type: "PropertyGlob",
2432
+ dot,
2433
+ object,
2434
+ children: [ws1, dot, object],
2435
+ reversed: true
2436
+ }
2437
+ ]
2438
+ });
2439
+ }
2323
2440
  var init_declaration = __esm({
2324
2441
  "source/parser/declaration.civet"() {
2325
2442
  "use strict";
@@ -2329,6 +2446,7 @@ var Civet = (() => {
2329
2446
  init_util();
2330
2447
  init_function();
2331
2448
  init_binding();
2449
+ init_lib();
2332
2450
  }
2333
2451
  });
2334
2452
 
@@ -3145,21 +3263,28 @@ var Civet = (() => {
3145
3263
  adjustIndexAccess: () => adjustIndexAccess,
3146
3264
  attachPostfixStatementAsExpression: () => attachPostfixStatementAsExpression,
3147
3265
  blockWithPrefix: () => blockWithPrefix,
3266
+ convertNamedImportsToObject: () => convertNamedImportsToObject,
3148
3267
  convertObjectToJSXAttributes: () => convertObjectToJSXAttributes,
3149
3268
  dedentBlockString: () => dedentBlockString,
3150
3269
  dedentBlockSubstitutions: () => dedentBlockSubstitutions,
3151
3270
  deepCopy: () => deepCopy,
3271
+ dynamizeImportDeclaration: () => dynamizeImportDeclaration,
3272
+ dynamizeImportDeclarationExpression: () => dynamizeImportDeclarationExpression,
3152
3273
  expressionizeTypeIf: () => expressionizeTypeIf,
3153
3274
  forRange: () => forRange,
3154
3275
  gatherBindingCode: () => gatherBindingCode,
3155
3276
  gatherRecursive: () => gatherRecursive,
3277
+ gatherRecursiveAll: () => gatherRecursiveAll,
3278
+ gatherRecursiveWithinFunction: () => gatherRecursiveWithinFunction,
3156
3279
  getIndentLevel: () => getIndentLevel,
3157
3280
  getPrecedence: () => getPrecedence,
3158
3281
  getTrimmingSpace: () => getTrimmingSpace,
3159
3282
  hasAwait: () => hasAwait,
3283
+ hasImportDeclaration: () => hasImportDeclaration,
3160
3284
  hasYield: () => hasYield,
3161
3285
  insertTrimmingSpace: () => insertTrimmingSpace,
3162
3286
  isEmptyBareBlock: () => isEmptyBareBlock,
3287
+ isFunction: () => isFunction,
3163
3288
  isWhitespaceOrEmpty: () => isWhitespaceOrEmpty,
3164
3289
  lastAccessInCallExpression: () => lastAccessInCallExpression,
3165
3290
  literalValue: () => literalValue,
@@ -3420,9 +3545,13 @@ var Civet = (() => {
3420
3545
  throw new Error(`Glob pattern must have call or member expression value, found ${JSON.stringify(part.value)}`);
3421
3546
  }
3422
3547
  let suppressPrefix = false;
3423
- let value = part.value ?? part.name;
3548
+ let name = part.name;
3549
+ let value = part.value ?? name;
3424
3550
  const wValue = getTrimmingSpace(part.value);
3425
3551
  [value, suppressPrefix] = handleThisPrivateShorthands(value);
3552
+ if (glob.reversed) {
3553
+ [name, value] = [value, name];
3554
+ }
3426
3555
  if (!suppressPrefix) {
3427
3556
  value = prefix.concat(insertTrimmingSpace(value, ""));
3428
3557
  }
@@ -3440,13 +3569,13 @@ var Civet = (() => {
3440
3569
  } else {
3441
3570
  parts.push({
3442
3571
  type: part.type === "Identifier" ? "Property" : part.type,
3443
- name: part.name,
3572
+ name,
3444
3573
  value,
3445
3574
  delim: part.delim,
3446
3575
  names: part.names,
3447
3576
  children: [
3448
3577
  isWhitespaceOrEmpty(part.children[0]) && part.children[0],
3449
- part.name,
3578
+ name,
3450
3579
  isWhitespaceOrEmpty(part.children[2]) && part.children[2],
3451
3580
  part.children[3]?.token === ":" ? part.children[3] : ":",
3452
3581
  value,
@@ -3591,6 +3720,35 @@ var Civet = (() => {
3591
3720
  block
3592
3721
  };
3593
3722
  }
3723
+ function convertNamedImportsToObject(node, pattern) {
3724
+ const properties = node.specifiers.map((specifier) => {
3725
+ if (specifier.ts) {
3726
+ return { type: "Error", message: "cannot use `type` in dynamic import" };
3727
+ } else {
3728
+ const { source, binding } = specifier;
3729
+ const delim = specifier.children.at(-1);
3730
+ return {
3731
+ type: pattern ? "BindingProperty" : "Property",
3732
+ name: source,
3733
+ value: !(source === binding) ? binding : void 0,
3734
+ delim,
3735
+ children: source === binding ? [source, delim] : [source, ":", binding, delim]
3736
+ };
3737
+ }
3738
+ });
3739
+ return {
3740
+ type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
3741
+ names: node.names,
3742
+ properties,
3743
+ children: [
3744
+ node.children[0],
3745
+ // {
3746
+ properties,
3747
+ node.children.at(-1)
3748
+ // }
3749
+ ]
3750
+ };
3751
+ }
3594
3752
  function convertObjectToJSXAttributes(obj) {
3595
3753
  const { properties } = obj;
3596
3754
  const parts = [];
@@ -7066,14 +7224,17 @@ ${input.slice(result.pos)}
7066
7224
  children: [$1, ...$2, ...rest.flat()]
7067
7225
  });
7068
7226
  });
7069
- var CallExpression$1 = $TS($S($EXPECT($L20, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
7227
+ var CallExpression$1 = $TS($S(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
7228
+ return dynamizeImportDeclarationExpression($0);
7229
+ });
7230
+ var CallExpression$2 = $TS($S($EXPECT($L20, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
7070
7231
  var rest = $3;
7071
7232
  return processCallMemberExpression({
7072
7233
  type: "CallExpression",
7073
7234
  children: [$1, ...$2, ...rest.flat()]
7074
7235
  });
7075
7236
  });
7076
- var CallExpression$2 = $TS($S(MemberExpression, AllowedTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
7237
+ var CallExpression$3 = $TS($S(MemberExpression, AllowedTrailingMemberExpressions, $Q(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
7077
7238
  var member = $1;
7078
7239
  var trailing = $2;
7079
7240
  var rest = $3;
@@ -7086,7 +7247,7 @@ ${input.slice(result.pos)}
7086
7247
  }
7087
7248
  return member;
7088
7249
  });
7089
- var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2];
7250
+ var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
7090
7251
  function CallExpression(ctx, state) {
7091
7252
  return $EVENT_C(ctx, state, "CallExpression", CallExpression$$);
7092
7253
  }
@@ -8668,11 +8829,14 @@ ${input.slice(result.pos)}
8668
8829
  });
8669
8830
  var NonSingleBracedBlock$1 = ImplicitNestedBlock;
8670
8831
  var NonSingleBracedBlock$2 = $TS($S(InsertOpenBrace, NestedImplicitObjectLiteral, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
8832
+ var o = $1;
8671
8833
  var s = $2;
8834
+ var c = $3;
8835
+ const expressions = [s];
8672
8836
  return {
8673
8837
  type: "BlockStatement",
8674
- expressions: [s],
8675
- children: $0
8838
+ expressions,
8839
+ children: [o, expressions, c]
8676
8840
  };
8677
8841
  });
8678
8842
  var NonSingleBracedBlock$$ = [NonSingleBracedBlock$0, NonSingleBracedBlock$1, NonSingleBracedBlock$2];
@@ -11350,28 +11514,31 @@ ${input.slice(result.pos)}
11350
11514
  };
11351
11515
  });
11352
11516
  var ImportDeclaration$1 = $T($S(Import, __, TypeKeyword, __, ImportClause, __, FromClause), function(value) {
11353
- return { "type": "ImportDeclaration", "ts": true, "children": value };
11517
+ var imports = value[4];
11518
+ var from = value[6];
11519
+ return { "type": "ImportDeclaration", "ts": true, "children": value, "imports": imports, "from": from };
11354
11520
  });
11355
11521
  var ImportDeclaration$2 = $T($S(Import, __, ImportClause, __, FromClause), function(value) {
11356
- return { "type": "ImportDeclaration", "children": value };
11522
+ var imports = value[2];
11523
+ var from = value[4];
11524
+ return { "type": "ImportDeclaration", "children": value, "imports": imports, "from": from };
11357
11525
  });
11358
11526
  var ImportDeclaration$3 = $T($S(Import, __, ModuleSpecifier), function(value) {
11359
- return { "type": "ImportDeclaration", "children": value };
11527
+ var module3 = value[2];
11528
+ return { "type": "ImportDeclaration", "children": value, "module": module3 };
11360
11529
  });
11361
11530
  var ImportDeclaration$4 = $TS($S(ImpliedImport, $E($S(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11362
11531
  var i = $1;
11363
11532
  var t = $2;
11364
- var c = $3;
11533
+ var imports = $3;
11365
11534
  var w = $4;
11366
- var f = $5;
11535
+ var from = $5;
11367
11536
  i.$loc = {
11368
- pos: f[0].$loc.pos - 1,
11369
- length: f[0].$loc.length + 1
11537
+ pos: from[0].$loc.pos - 1,
11538
+ length: from[0].$loc.length + 1
11370
11539
  };
11371
- const children = [i, t, c, w, f];
11372
- if (!t)
11373
- return children;
11374
- return { type: "ImportDeclaration", ts: true, children };
11540
+ const children = [i, t, imports, w, from];
11541
+ return { type: "ImportDeclaration", ts: !!t, children, imports, from };
11375
11542
  });
11376
11543
  var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4];
11377
11544
  function ImportDeclaration(ctx, state) {
@@ -11389,14 +11556,17 @@ ${input.slice(result.pos)}
11389
11556
  if (rest) {
11390
11557
  return {
11391
11558
  type: "Declaration",
11392
- children: $0,
11393
- names: [...binding.names, ...rest[3].names]
11559
+ children: [binding, ...rest],
11560
+ names: [...binding.names, ...rest[3].names],
11561
+ binding,
11562
+ specifiers: rest[3].specifiers
11394
11563
  };
11395
11564
  }
11396
11565
  return {
11397
11566
  type: "Declaration",
11398
- children: $0,
11399
- names: binding.names
11567
+ children: [binding],
11568
+ names: binding.names,
11569
+ binding
11400
11570
  };
11401
11571
  });
11402
11572
  var ImportClause$1 = NameSpaceImport;
@@ -11406,11 +11576,14 @@ ${input.slice(result.pos)}
11406
11576
  return $EVENT_C(ctx, state, "ImportClause", ImportClause$$);
11407
11577
  }
11408
11578
  var NameSpaceImport$0 = $TS($S(Star, ImportAsToken, __, ImportedBinding), function($skip, $loc, $0, $1, $2, $3, $4) {
11579
+ var star = $1;
11409
11580
  var binding = $4;
11410
11581
  return {
11411
11582
  type: "Declaration",
11412
11583
  children: $0,
11413
- names: binding.names
11584
+ names: binding.names,
11585
+ binding,
11586
+ star
11414
11587
  };
11415
11588
  });
11416
11589
  function NameSpaceImport(ctx, state) {
@@ -11422,17 +11595,32 @@ ${input.slice(result.pos)}
11422
11595
  return {
11423
11596
  type: "Declaration",
11424
11597
  children: $0,
11425
- names
11598
+ names,
11599
+ specifiers
11426
11600
  };
11427
11601
  });
11428
11602
  function NamedImports(ctx, state) {
11429
11603
  return $EVENT(ctx, state, "NamedImports", NamedImports$0);
11430
11604
  }
11431
- var FromClause$0 = $S(From, __, ModuleSpecifier);
11605
+ var FromClause$0 = $TS($S(From, __, ModuleSpecifier), function($skip, $loc, $0, $1, $2, $3) {
11606
+ var module3 = $3;
11607
+ if (!Array.isArray(module3))
11608
+ return $0;
11609
+ return [$1, $2, ...module3];
11610
+ });
11432
11611
  function FromClause(ctx, state) {
11433
11612
  return $EVENT(ctx, state, "FromClause", FromClause$0);
11434
11613
  }
11435
- var ImportAssertion$0 = $S($E(_), $C($EXPECT($L117, 'ImportAssertion "with"'), $EXPECT($L118, 'ImportAssertion "assert"')), NonIdContinue, $E(_), ObjectLiteral);
11614
+ var ImportAssertion$0 = $TS($S($E(_), $C($EXPECT($L117, 'ImportAssertion "with"'), $EXPECT($L118, 'ImportAssertion "assert"')), NonIdContinue, $E(_), ObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11615
+ var keyword = $2;
11616
+ var object = $5;
11617
+ return {
11618
+ type: "ImportAssertion",
11619
+ keyword,
11620
+ object,
11621
+ children: $0
11622
+ };
11623
+ });
11436
11624
  function ImportAssertion(ctx, state) {
11437
11625
  return $EVENT(ctx, state, "ImportAssertion", ImportAssertion$0);
11438
11626
  }
@@ -11462,8 +11650,10 @@ ${input.slice(result.pos)}
11462
11650
  return $EVENT_C(ctx, state, "TypeAndImportSpecifier", TypeAndImportSpecifier$$);
11463
11651
  }
11464
11652
  var ImportSpecifier$0 = $TS($S(__, ModuleExportName, ImportAsToken, __, ImportedBinding, ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
11653
+ var source = $2;
11465
11654
  var binding = $5;
11466
11655
  return {
11656
+ source,
11467
11657
  binding,
11468
11658
  children: $0
11469
11659
  };
@@ -11471,6 +11661,7 @@ ${input.slice(result.pos)}
11471
11661
  var ImportSpecifier$1 = $TS($S(__, ImportedBinding, ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
11472
11662
  var binding = $2;
11473
11663
  return {
11664
+ source: binding,
11474
11665
  binding,
11475
11666
  children: $0
11476
11667
  };
@@ -11662,9 +11853,18 @@ ${input.slice(result.pos)}
11662
11853
  function ImplicitExportSpecifier(ctx, state) {
11663
11854
  return $EVENT(ctx, state, "ImplicitExportSpecifier", ImplicitExportSpecifier$0);
11664
11855
  }
11665
- var Declaration$0 = HoistableDeclaration;
11666
- var Declaration$1 = ClassDeclaration;
11667
- var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
11856
+ var Declaration$0 = $TV(ImportDeclaration, function($skip, $loc, $0, $1) {
11857
+ var decl = $0;
11858
+ if (decl.ts || decl.module || !decl.imports || !decl.from)
11859
+ return $skip;
11860
+ const { imports } = decl;
11861
+ if (!imports.binding && !imports.specifiers)
11862
+ return $skip;
11863
+ return dynamizeImportDeclaration(decl);
11864
+ });
11865
+ var Declaration$1 = HoistableDeclaration;
11866
+ var Declaration$2 = ClassDeclaration;
11867
+ var Declaration$3 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
11668
11868
  var d = $0;
11669
11869
  if (d.thisAssignments?.length)
11670
11870
  return {
@@ -11678,11 +11878,11 @@ ${input.slice(result.pos)}
11678
11878
  };
11679
11879
  return d;
11680
11880
  });
11681
- var Declaration$3 = TypeDeclaration;
11682
- var Declaration$4 = EnumDeclaration;
11683
- var Declaration$5 = OperatorDeclaration;
11684
- var Declaration$6 = UsingDeclaration;
11685
- var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5, Declaration$6];
11881
+ var Declaration$4 = TypeDeclaration;
11882
+ var Declaration$5 = EnumDeclaration;
11883
+ var Declaration$6 = OperatorDeclaration;
11884
+ var Declaration$7 = UsingDeclaration;
11885
+ var Declaration$$ = [Declaration$0, Declaration$1, Declaration$2, Declaration$3, Declaration$4, Declaration$5, Declaration$6, Declaration$7];
11686
11886
  function Declaration(ctx, state) {
11687
11887
  return $EVENT_C(ctx, state, "Declaration", Declaration$$);
11688
11888
  }
@@ -16435,10 +16635,13 @@ ${input.slice(result.pos)}
16435
16635
  let ast;
16436
16636
  try {
16437
16637
  import_parser.parse.config = options.parseOptions || {};
16438
- ast = prune((0, import_parser.parse)(src, {
16638
+ ast = (0, import_parser.parse)(src, {
16439
16639
  filename,
16440
16640
  events
16441
- }));
16641
+ });
16642
+ if (!(options.ast === "raw")) {
16643
+ ast = prune(ast);
16644
+ }
16442
16645
  } finally {
16443
16646
  if (hits || trace) {
16444
16647
  import("fs").then(function({ writeFileSync }) {