@tscircuit/cli 0.1.542 → 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.
Files changed (2) hide show
  1. package/dist/main.js +13 -1
  2. 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.541";
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.542",
3
+ "version": "0.1.543",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",