@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.
- package/dist/TSCompiler.d.mts +1 -0
- package/dist/TSCompiler.mjs +9 -6
- package/package.json +2 -2
package/dist/TSCompiler.d.mts
CHANGED
package/dist/TSCompiler.mjs
CHANGED
|
@@ -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
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
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.
|
|
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.
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|