okai 0.0.25 → 0.0.27

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/cs-gen.js CHANGED
@@ -1,4 +1,4 @@
1
- import { unwrap } from "./cs-ast";
1
+ import { unwrap } from "./cs-ast.js";
2
2
  import { leftPart } from "./utils.js";
3
3
  export class CSharpGenerator {
4
4
  namespaces = [];
package/dist/index.js CHANGED
@@ -653,7 +653,7 @@ function chooseFile(ctx, info, gist, comamnd) {
653
653
  }
654
654
  const origTsd = file.content;
655
655
  const tsdAst = astForProject(toAst(origTsd), info);
656
- const res = generateCsAstFromTsd(toTsd(tsdAst));
656
+ const res = generateCsAstFromTsd(toTsd(tsdAst), { references: [`./api.d.ts`] });
657
657
  const genApis = new CSharpApiGenerator();
658
658
  const csApiFiles = genApis.generate(res.csAst);
659
659
  const getMigrations = new CSharpMigrationGenerator();
package/dist/ts-ast.js CHANGED
@@ -34,8 +34,14 @@ export function astForProject(tsAst, info) {
34
34
  return tsAst;
35
35
  }
36
36
  // Convert User TypeScript into CS AST and Updated TSD
37
- export function generateCsAstFromTsd(userTs) {
37
+ export function generateCsAstFromTsd(userTs, opt) {
38
38
  const userTsAst = toAst(userTs); // user modified tsd
39
+ if (opt?.references) {
40
+ userTsAst.references = userTsAst.references || [];
41
+ opt.references
42
+ .filter(x => !userTsAst.references.some(y => y.path === x))
43
+ .forEach(path => userTsAst.references.push({ path }));
44
+ }
39
45
  const tsd = toTsd(userTsAst);
40
46
  const tsdAst = toAst(tsd);
41
47
  const csAst = toMetadataTypes(tsdAst);
package/dist/utils.js CHANGED
@@ -199,6 +199,7 @@ export function toTsdHeader(header) {
199
199
  sb.push(`migration: ${header.migration}`);
200
200
  }
201
201
  sb.push('*/');
202
+ sb.push('');
202
203
  return sb.join('\n');
203
204
  }
204
205
  export function toPascalCase(s) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "okai",
3
3
  "type": "module",
4
- "version": "0.0.25",
4
+ "version": "0.0.27",
5
5
  "bin": "./dist/okai.js",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",