@tscircuit/cli 0.1.506 → 0.1.507
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/main.js +37 -17
- package/package.json +1 -1
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.506";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -196324,6 +196324,17 @@ var isSubPath2 = (maybeChild, maybeParent) => {
|
|
|
196324
196324
|
const relative9 = path31.relative(maybeParent, maybeChild);
|
|
196325
196325
|
return relative9 === "" || !relative9.startsWith("..") && !path31.isAbsolute(relative9);
|
|
196326
196326
|
};
|
|
196327
|
+
var findProjectRoot = (startDir) => {
|
|
196328
|
+
let currentDir = startDir;
|
|
196329
|
+
while (currentDir !== path31.dirname(currentDir)) {
|
|
196330
|
+
const packageJsonPath = path31.join(currentDir, "package.json");
|
|
196331
|
+
if (fs32.existsSync(packageJsonPath)) {
|
|
196332
|
+
return currentDir;
|
|
196333
|
+
}
|
|
196334
|
+
currentDir = path31.dirname(currentDir);
|
|
196335
|
+
}
|
|
196336
|
+
return startDir;
|
|
196337
|
+
};
|
|
196327
196338
|
async function getBuildEntrypoints({
|
|
196328
196339
|
fileOrDir,
|
|
196329
196340
|
rootDir = process.cwd()
|
|
@@ -196374,7 +196385,9 @@ async function getBuildEntrypoints({
|
|
|
196374
196385
|
circuitFiles
|
|
196375
196386
|
};
|
|
196376
196387
|
}
|
|
196377
|
-
|
|
196388
|
+
const fileDir = path31.dirname(resolved);
|
|
196389
|
+
const projectDir = findProjectRoot(fileDir);
|
|
196390
|
+
return { projectDir, circuitFiles: [resolved] };
|
|
196378
196391
|
}
|
|
196379
196392
|
return buildFromProjectDir();
|
|
196380
196393
|
}
|
|
@@ -196743,6 +196756,15 @@ var createStaticAssetPlugin = ({
|
|
|
196743
196756
|
// cli/build/transpile/index.ts
|
|
196744
196757
|
var __dirname = "/home/runner/work/cli/cli/cli/build/transpile";
|
|
196745
196758
|
var CLI_TYPES_ROOT = path36.resolve(__dirname, "../../../types");
|
|
196759
|
+
var externalFunction = (id2) => {
|
|
196760
|
+
if (id2.startsWith(".") || id2.startsWith("/")) {
|
|
196761
|
+
return false;
|
|
196762
|
+
}
|
|
196763
|
+
if (path36.isAbsolute(id2)) {
|
|
196764
|
+
return false;
|
|
196765
|
+
}
|
|
196766
|
+
return true;
|
|
196767
|
+
};
|
|
196746
196768
|
var transpileFile = async ({
|
|
196747
196769
|
input,
|
|
196748
196770
|
outputDir,
|
|
@@ -196791,37 +196813,34 @@ var transpileFile = async ({
|
|
|
196791
196813
|
];
|
|
196792
196814
|
const esmBundle = await rollup({
|
|
196793
196815
|
input,
|
|
196794
|
-
external:
|
|
196795
|
-
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196796
|
-
},
|
|
196816
|
+
external: externalFunction,
|
|
196797
196817
|
plugins: getPlugins("ESNext")
|
|
196798
196818
|
});
|
|
196819
|
+
const esmOutputPath = path36.join(outputDir, "index.js");
|
|
196799
196820
|
await esmBundle.write({
|
|
196800
|
-
file:
|
|
196821
|
+
file: esmOutputPath,
|
|
196801
196822
|
format: "es",
|
|
196802
196823
|
sourcemap: false
|
|
196803
196824
|
});
|
|
196804
|
-
console.log(`ESM bundle written to ${path36.relative(projectDir,
|
|
196825
|
+
console.log(`ESM bundle written to ${path36.relative(projectDir, esmOutputPath)}`);
|
|
196805
196826
|
console.log("Building CommonJS bundle...");
|
|
196806
196827
|
const cjsBundle = await rollup({
|
|
196807
196828
|
input,
|
|
196808
|
-
external:
|
|
196809
|
-
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196810
|
-
},
|
|
196829
|
+
external: externalFunction,
|
|
196811
196830
|
plugins: getPlugins("CommonJS")
|
|
196812
196831
|
});
|
|
196832
|
+
const cjsOutputPath = path36.join(outputDir, "index.cjs");
|
|
196833
|
+
console.log("[DEBUG] Writing CJS bundle to:", cjsOutputPath);
|
|
196813
196834
|
await cjsBundle.write({
|
|
196814
|
-
file:
|
|
196835
|
+
file: cjsOutputPath,
|
|
196815
196836
|
format: "cjs",
|
|
196816
196837
|
sourcemap: false
|
|
196817
196838
|
});
|
|
196818
|
-
console.log(`CommonJS bundle written to ${path36.relative(projectDir,
|
|
196839
|
+
console.log(`CommonJS bundle written to ${path36.relative(projectDir, cjsOutputPath)}`);
|
|
196819
196840
|
console.log("Generating type declarations...");
|
|
196820
196841
|
const dtsBundle = await rollup({
|
|
196821
196842
|
input,
|
|
196822
|
-
external:
|
|
196823
|
-
return !id2.startsWith(".") && !id2.startsWith("/");
|
|
196824
|
-
},
|
|
196843
|
+
external: externalFunction,
|
|
196825
196844
|
plugins: [
|
|
196826
196845
|
dts({
|
|
196827
196846
|
respectExternal: true
|
|
@@ -196835,8 +196854,9 @@ var transpileFile = async ({
|
|
|
196835
196854
|
dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
|
|
196836
196855
|
dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
|
|
196837
196856
|
dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
|
|
196838
|
-
|
|
196839
|
-
|
|
196857
|
+
const dtsOutputPath = path36.join(outputDir, "index.d.ts");
|
|
196858
|
+
fs37.writeFileSync(dtsOutputPath, dtsContent);
|
|
196859
|
+
console.log(`Type declarations written to ${path36.relative(projectDir, dtsOutputPath)}`);
|
|
196840
196860
|
console.log(kleur_default.green("Transpilation complete!"));
|
|
196841
196861
|
return true;
|
|
196842
196862
|
} catch (err) {
|