@homebound/truss 2.0.0-next.1 → 2.0.0-next.11
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/build/index.js +39 -1
- package/build/index.js.map +1 -1
- package/build/plugin/index.d.ts +4 -3
- package/build/plugin/index.js +615 -101
- package/build/plugin/index.js.map +1 -1
- package/cli.js +6 -19
- package/package.json +3 -3
package/cli.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import { join } from "node:path";
|
|
5
4
|
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { register } from "
|
|
5
|
+
import { register } from "tsx/esm/api";
|
|
7
6
|
import { generate } from "./build/index.js";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// Pass `module: commonjs` to handle vite projects that use `module: esnext`.
|
|
13
|
-
register({ transpileOnly: true, compilerOptions: { module: "commonjs" } });
|
|
8
|
+
// Register tsx loader so we can import TypeScript config files
|
|
9
|
+
// (handles both CJS and ESM projects, with extensionless .ts imports).
|
|
10
|
+
const unregister = register();
|
|
14
11
|
|
|
15
12
|
const filename = process.argv[2] ?? "./truss-config.ts";
|
|
16
13
|
const configPath = join(process.cwd(), filename);
|
|
@@ -21,18 +18,8 @@ main().catch((err) => {
|
|
|
21
18
|
});
|
|
22
19
|
|
|
23
20
|
async function main() {
|
|
24
|
-
const config = await
|
|
21
|
+
const config = (await import(pathToFileURL(configPath).href)).default;
|
|
22
|
+
unregister();
|
|
25
23
|
await generate(config);
|
|
26
24
|
console.log(`Generated ${config.outputPath}`);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
async function loadConfig(configPath) {
|
|
30
|
-
try {
|
|
31
|
-
return require(configPath).default;
|
|
32
|
-
} catch (err) {
|
|
33
|
-
if (err && typeof err === "object" && "code" in err && err.code === "ERR_REQUIRE_ESM") {
|
|
34
|
-
return (await import(pathToFileURL(configPath).href)).default;
|
|
35
|
-
}
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebound/truss",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": "cli.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"change-case": "^5.4.4",
|
|
26
26
|
"csstype": "^3.2.3",
|
|
27
|
-
"ts-
|
|
28
|
-
"
|
|
27
|
+
"ts-poet": "^6.12.0",
|
|
28
|
+
"tsx": "^4.19.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@homebound/tsconfig": "^1.1.1",
|