@repokit/core 1.6.0 → 1.6.1

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.
@@ -2,6 +2,7 @@
2
2
  declare class TSCompiler {
3
3
  readonly root: string;
4
4
  readonly command: string;
5
+ private static readonly TMP_FILE_NAME;
5
6
  constructor(root: string, command: string);
6
7
  compile(path: string): Promise<any>;
7
8
  }
@@ -1,17 +1,20 @@
1
- import { readFile } from "node:fs/promises";
1
+ import { readFile, rm, writeFile } from "node:fs/promises";
2
+ import { basename, resolve } from "node:path";
2
3
  import { transform } from "@swc/core";
3
4
 
4
5
  //#region externals/TSCompiler.ts
5
- var TSCompiler = class {
6
+ var TSCompiler = class TSCompiler {
7
+ static TMP_FILE_NAME = ".repokit_tmp.js";
6
8
  constructor(root, command) {
7
9
  this.root = root;
8
10
  this.command = command;
9
11
  }
10
12
  async compile(path) {
11
- const source = (await readFile(path)).toString();
12
- const result = await transform(source, { module: { type: "es6" } });
13
- const config = eval(result.code);
14
- console.log(config);
13
+ const result = await transform((await readFile(path)).toString(), { module: { type: "es6" } });
14
+ const target = `${resolve(path, "../")}/${basename(path)}${TSCompiler.TMP_FILE_NAME}`;
15
+ await writeFile(target, result.code);
16
+ const config = await import(target);
17
+ await rm(target, { force: true });
15
18
  return config;
16
19
  }
17
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repokit/core",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "A knowledgebase for your repository - wrapped in a CLI",
5
5
  "keywords": [
6
6
  "cli",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "main": "./dist/index.mjs",
28
28
  "module": "./dist/index.mjs",
29
- "types": "./dist/index.d.mjs",
29
+ "types": "./dist/index.d.mts",
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },