@tscircuit/cli 0.1.501 → 0.1.503
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 +55 -1
- 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.502";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -77218,6 +77218,25 @@ function resolveNodeModuleImport(importPath, projectDir) {
|
|
|
77218
77218
|
resolvedFiles.push(entryPath);
|
|
77219
77219
|
}
|
|
77220
77220
|
}
|
|
77221
|
+
if (resolvedFiles.length === 0) {
|
|
77222
|
+
const fallbackPaths = [
|
|
77223
|
+
path18.join(packageDir, "index.js"),
|
|
77224
|
+
path18.join(packageDir, "index.mjs"),
|
|
77225
|
+
path18.join(packageDir, "index.ts"),
|
|
77226
|
+
path18.join(packageDir, "index.tsx"),
|
|
77227
|
+
path18.join(packageDir, "dist", "index.js"),
|
|
77228
|
+
path18.join(packageDir, "dist", "index.mjs"),
|
|
77229
|
+
path18.join(packageDir, "lib", "index.js"),
|
|
77230
|
+
path18.join(packageDir, "src", "index.ts"),
|
|
77231
|
+
path18.join(packageDir, "src", "index.tsx")
|
|
77232
|
+
];
|
|
77233
|
+
for (const p of fallbackPaths) {
|
|
77234
|
+
if (fs18.existsSync(p) && fs18.statSync(p).isFile()) {
|
|
77235
|
+
resolvedFiles.push(p);
|
|
77236
|
+
break;
|
|
77237
|
+
}
|
|
77238
|
+
}
|
|
77239
|
+
}
|
|
77221
77240
|
return resolvedFiles;
|
|
77222
77241
|
}
|
|
77223
77242
|
function collectAllNodeModuleDependencies(entryFilePath, projectDir, maxDepth = 10) {
|
|
@@ -197532,6 +197551,40 @@ var registerInstall = (program3) => {
|
|
|
197532
197551
|
});
|
|
197533
197552
|
};
|
|
197534
197553
|
|
|
197554
|
+
// cli/transpile/register.ts
|
|
197555
|
+
import path42 from "node:path";
|
|
197556
|
+
var registerTranspile = (program3) => {
|
|
197557
|
+
program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
|
|
197558
|
+
try {
|
|
197559
|
+
const { projectDir, circuitFiles, mainEntrypoint } = await getBuildEntrypoints({
|
|
197560
|
+
fileOrDir: file
|
|
197561
|
+
});
|
|
197562
|
+
const distDir = path42.join(projectDir, "dist");
|
|
197563
|
+
console.log("Transpiling entry file...");
|
|
197564
|
+
const entryFile = mainEntrypoint || circuitFiles[0];
|
|
197565
|
+
if (!entryFile) {
|
|
197566
|
+
console.error("No entry file found for transpilation");
|
|
197567
|
+
process.exit(1);
|
|
197568
|
+
}
|
|
197569
|
+
const transpileSuccess = await transpileFile({
|
|
197570
|
+
input: entryFile,
|
|
197571
|
+
outputDir: distDir,
|
|
197572
|
+
projectDir
|
|
197573
|
+
});
|
|
197574
|
+
if (!transpileSuccess) {
|
|
197575
|
+
console.error("Transpilation failed");
|
|
197576
|
+
process.exit(1);
|
|
197577
|
+
}
|
|
197578
|
+
console.log("Transpile complete!");
|
|
197579
|
+
process.exit(0);
|
|
197580
|
+
} catch (error) {
|
|
197581
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
197582
|
+
console.error(message);
|
|
197583
|
+
process.exit(1);
|
|
197584
|
+
}
|
|
197585
|
+
});
|
|
197586
|
+
};
|
|
197587
|
+
|
|
197535
197588
|
// cli/main.ts
|
|
197536
197589
|
var program2 = new Command;
|
|
197537
197590
|
program2.name("tsci").description("CLI for developing tscircuit packages");
|
|
@@ -197550,6 +197603,7 @@ registerConfigPrint(program2);
|
|
|
197550
197603
|
registerConfigSet(program2);
|
|
197551
197604
|
registerExport(program2);
|
|
197552
197605
|
registerBuild(program2);
|
|
197606
|
+
registerTranspile(program2);
|
|
197553
197607
|
registerAdd(program2);
|
|
197554
197608
|
registerRemove(program2);
|
|
197555
197609
|
registerSnapshot(program2);
|