gemi 0.42.0 → 0.42.2

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/bin/gemi.js CHANGED
@@ -68673,6 +68673,7 @@ async function loadApp() {
68673
68673
  var import_recast = __toESM(require_main2(), 1);
68674
68674
  var import_ast_types = __toESM(require_main3(), 1);
68675
68675
  async function customRequestParser(original) {
68676
+ const promotedToValue = new Set;
68676
68677
  function isExportedControllerClassDeclaration(body) {
68677
68678
  return (body.type === "ExportNamedDeclaration" || body.type === "ExportDefaultDeclaration") && body.declaration?.type === "ClassDeclaration" && (body.declaration.superClass?.name === "Controller" || body.declaration.superClass?.name === "ResourceController");
68678
68679
  }
@@ -68706,6 +68707,7 @@ async function customRequestParser(original) {
68706
68707
  const right = import_ast_types.builders.newExpression(import_ast_types.builders.identifier(reqName), []);
68707
68708
  const _node = import_ast_types.builders.assignmentPattern(left, right);
68708
68709
  node.params[0] = _node;
68710
+ promotedToValue.add(reqName);
68709
68711
  }
68710
68712
  }
68711
68713
  }
@@ -68737,11 +68739,38 @@ async function customRequestParser(original) {
68737
68739
  const right = import_ast_types.builders.newExpression(import_ast_types.builders.identifier(reqName), []);
68738
68740
  const _node = import_ast_types.builders.assignmentPattern(left, right);
68739
68741
  arg.params[0] = _node;
68742
+ promotedToValue.add(reqName);
68740
68743
  }
68741
68744
  }
68742
68745
  }
68743
68746
  }
68744
68747
  }
68748
+ function promoteTypeOnlyImports(body) {
68749
+ for (const node of body) {
68750
+ if (node?.type !== "ImportDeclaration") {
68751
+ continue;
68752
+ }
68753
+ const specifiers = node.specifiers ?? [];
68754
+ const isNeeded = (specifier) => promotedToValue.has(specifier.local?.name ?? specifier.imported?.name);
68755
+ if (node.importKind === "type") {
68756
+ if (!specifiers.some(isNeeded)) {
68757
+ continue;
68758
+ }
68759
+ node.importKind = "value";
68760
+ for (const specifier of specifiers) {
68761
+ if (!isNeeded(specifier)) {
68762
+ specifier.importKind = "type";
68763
+ }
68764
+ }
68765
+ continue;
68766
+ }
68767
+ for (const specifier of specifiers) {
68768
+ if (specifier.importKind === "type" && isNeeded(specifier)) {
68769
+ specifier.importKind = "value";
68770
+ }
68771
+ }
68772
+ }
68773
+ }
68745
68774
  const orgFile = await import_recast.parse(original, {
68746
68775
  parser: await Promise.resolve().then(() => __toESM(require_typescript3(), 1))
68747
68776
  });
@@ -68766,7 +68795,8 @@ async function customRequestParser(original) {
68766
68795
  continue;
68767
68796
  }
68768
68797
  }
68769
- return import_recast.print(orgFile).code.replace("type HttpRequest", "HttpRequest");
68798
+ promoteTypeOnlyImports(orgFile.program.body);
68799
+ return import_recast.print(orgFile).code;
68770
68800
  }
68771
68801
 
68772
68802
  // bun/plugin.ts
@@ -69261,5 +69291,5 @@ program.command("app:route-manifest").action(async () => {
69261
69291
  });
69262
69292
  program.parse();
69263
69293
 
69264
- //# debugId=ED465C15ADFED86164756E2164756E21
69294
+ //# debugId=71D97BBCCC12C4B064756E2164756E21
69265
69295
  //# sourceMappingURL=gemi.js.map