diff --git a/examples/somethingEarly.gen.ts b/examples/somethingEarly.gen.ts index 015818b..4ca200f 100644 --- a/examples/somethingEarly.gen.ts +++ b/examples/somethingEarly.gen.ts @@ -1,3 +1,7 @@ export default () => { - return `export const five = 5;`; + return new Promise((resolve) => { + setTimeout(() => { + resolve(`export const five = 5;`); + }, 500); + }); }; diff --git a/examples/somethingLate.gen.ts b/examples/somethingLate.gen.ts index 514248b..80cd419 100644 --- a/examples/somethingLate.gen.ts +++ b/examples/somethingLate.gen.ts @@ -1,4 +1,4 @@ export default async (context: any) => { - const { five } = await context.import("./somethingEarly.ts"); + const { five } = await context.import("./somethingEarly.out"); return five.toString(); }; diff --git a/package-lock.json b/package-lock.json index 83adba8..6126125 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,10 +8,15 @@ "name": "@dylanpizzo/codegen", "version": "0.1.0", "license": "UNLICENSED", + "dependencies": { + "tsx": "^4.19.3" + }, + "bin": { + "codegen": "cat dist/bin/codegen.js" + }, "devDependencies": { "@types/node": "^22.13.5", "esbuild": "^0.19.2", - "tsx": "^4.19.3", "typescript": "^5.2.2" } }, @@ -294,7 +299,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "netbsd" @@ -326,7 +330,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "openbsd" @@ -466,7 +469,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -480,7 +482,6 @@ "version": "4.10.0", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", - "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -492,7 +493,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -501,7 +501,6 @@ "version": "4.19.3", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.3.tgz", "integrity": "sha512-4H8vUNGNjQ4V2EOoGw005+c+dGuPSnhpPBPHBtsZdGZBk/iJb4kguGlPWaZTZ3q5nMtFOEsY0nRDlh9PJyd6SQ==", - "dev": true, "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" @@ -523,7 +522,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "aix" @@ -539,7 +537,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "android" @@ -555,7 +552,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "android" @@ -571,7 +567,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "android" @@ -587,7 +582,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -603,7 +597,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -619,7 +612,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "freebsd" @@ -635,7 +627,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "freebsd" @@ -651,7 +642,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -667,7 +657,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -683,7 +672,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "linux" @@ -699,7 +687,6 @@ "cpu": [ "loong64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -715,7 +702,6 @@ "cpu": [ "mips64el" ], - "dev": true, "optional": true, "os": [ "linux" @@ -731,7 +717,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -747,7 +732,6 @@ "cpu": [ "riscv64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -763,7 +747,6 @@ "cpu": [ "s390x" ], - "dev": true, "optional": true, "os": [ "linux" @@ -779,7 +762,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -795,7 +777,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "netbsd" @@ -811,7 +792,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "openbsd" @@ -827,7 +807,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "sunos" @@ -843,7 +822,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -859,7 +837,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "win32" @@ -875,7 +852,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -888,7 +864,6 @@ "version": "0.25.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", - "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" diff --git a/package.json b/package.json index 33abe5f..af2b602 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,13 @@ "./dist" ], "bin": { - "codegen": "./dist/bin/codegen.js" + "codegen": "cat dist/bin/codegen.js" }, "publishConfig": { "registry": "https://npm.dylanpizzo.dev" }, "scripts": { - "dev-watch": "tsx scripts/watch.ts", - "prod-build": "tsc && tsx scripts/build.ts", + "prod-build": "tsc", "prepublishOnly": "npm run prod-build", "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/scripts/build.ts b/scripts/build.ts deleted file mode 100644 index 29b5659..0000000 --- a/scripts/build.ts +++ /dev/null @@ -1,9 +0,0 @@ -import esbuild from "esbuild"; - -esbuild.build({ - entryPoints: ["src/index.ts", "src/bin/codegen.ts"], - format: "esm", - outdir: "dist", - bundle: true, - platform: "node", -}); diff --git a/scripts/watch.ts b/scripts/watch.ts deleted file mode 100644 index 98370c5..0000000 --- a/scripts/watch.ts +++ /dev/null @@ -1,12 +0,0 @@ -import esbuild from "esbuild"; - -const buildContext = await esbuild.context({ - entryPoints: ["src/index.ts", "src/bin/codegen.ts"], - format: "esm", - outdir: "dist", - bundle: true, - platform: "node", - logLevel: "info", -}); - -await buildContext.watch(); diff --git a/src/bin/codegen.ts b/src/bin/codegen.ts old mode 100644 new mode 100755 diff --git a/tsconfig.json b/tsconfig.json index 27a1601..ba51c2d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,12 +5,10 @@ "lib": ["esnext"], "moduleResolution": "bundler", "jsx": "react-jsx", - "allowImportingTsExtensions": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "declaration": true, - "emitDeclarationOnly": true, "outDir": "./dist" }, "include": ["src"],