@tscircuit/cli 0.1.541 → 0.1.543
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/cli/entrypoint.js +5 -4
- package/dist/main.js +13 -1
- package/package.json +1 -1
package/cli/entrypoint.js
CHANGED
|
@@ -25,10 +25,11 @@ const globalPackageJson = require("../package.json")
|
|
|
25
25
|
let mainPath = join(packageRoot, "dist/main.js")
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const localRequire = createRequire(join(process.cwd(), "package.json"))
|
|
29
|
+
const localPackageJsonPath = localRequire.resolve(
|
|
30
|
+
"@tscircuit/cli/package.json",
|
|
31
|
+
)
|
|
32
|
+
const localPackageJson = localRequire(localPackageJsonPath)
|
|
32
33
|
const localPackageRoot = dirname(localPackageJsonPath)
|
|
33
34
|
const localMainPath = join(localPackageRoot, "dist/main.js")
|
|
34
35
|
|
package/dist/main.js
CHANGED
|
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72387
72387
|
import { execSync as execSync2 } from "node:child_process";
|
|
72388
72388
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72389
72389
|
// package.json
|
|
72390
|
-
var version = "0.1.
|
|
72390
|
+
var version = "0.1.542";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -197749,6 +197749,7 @@ var registerInstall = (program3) => {
|
|
|
197749
197749
|
};
|
|
197750
197750
|
|
|
197751
197751
|
// cli/transpile/register.ts
|
|
197752
|
+
import fs45 from "node:fs";
|
|
197752
197753
|
import path43 from "node:path";
|
|
197753
197754
|
var registerTranspile = (program3) => {
|
|
197754
197755
|
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
@@ -197757,6 +197758,17 @@ var registerTranspile = (program3) => {
|
|
|
197757
197758
|
fileOrDir: file
|
|
197758
197759
|
});
|
|
197759
197760
|
const distDir = path43.join(projectDir, "dist");
|
|
197761
|
+
const packageJsonPath = path43.join(projectDir, "package.json");
|
|
197762
|
+
if (fs45.existsSync(packageJsonPath)) {
|
|
197763
|
+
const packageJson = JSON.parse(fs45.readFileSync(packageJsonPath, "utf-8"));
|
|
197764
|
+
if (typeof packageJson.main === "string") {
|
|
197765
|
+
const resolvedMainPath = path43.resolve(projectDir, packageJson.main);
|
|
197766
|
+
const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path43.sep}`);
|
|
197767
|
+
if (!isMainInDist) {
|
|
197768
|
+
throw new Error('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
|
|
197769
|
+
}
|
|
197770
|
+
}
|
|
197771
|
+
}
|
|
197760
197772
|
console.log("Transpiling entry file...");
|
|
197761
197773
|
const entryFile = mainEntrypoint || circuitFiles[0];
|
|
197762
197774
|
if (!entryFile) {
|