@tscircuit/cli 0.1.769 → 0.1.770

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 +344 -120
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -73252,6 +73252,7 @@ var projectConfigSchema = z.object({
73252
73252
  build: z.object({
73253
73253
  circuitJson: z.boolean().optional(),
73254
73254
  kicadLibrary: z.boolean().optional(),
73255
+ kicadPcm: z.boolean().optional(),
73255
73256
  previewImages: z.boolean().optional(),
73256
73257
  typescriptLibrary: z.boolean().optional()
73257
73258
  }).optional()
@@ -74127,7 +74128,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74127
74128
  import { execSync as execSync2 } from "node:child_process";
74128
74129
  var import_semver2 = __toESM2(require_semver2(), 1);
74129
74130
  // package.json
74130
- var version = "0.1.768";
74131
+ var version = "0.1.769";
74131
74132
  var package_default = {
74132
74133
  name: "@tscircuit/cli",
74133
74134
  version,
@@ -172424,8 +172425,8 @@ var registerRemove = (program3) => {
172424
172425
  };
172425
172426
 
172426
172427
  // cli/build/register.ts
172427
- import path45 from "node:path";
172428
- import fs45 from "node:fs";
172428
+ import path47 from "node:path";
172429
+ import fs47 from "node:fs";
172429
172430
 
172430
172431
  // cli/build/build-file.ts
172431
172432
  import path35 from "node:path";
@@ -172711,7 +172712,8 @@ var applyCiBuildOptions = async ({
172711
172712
  site: options?.site ?? true,
172712
172713
  useCdnJavascript: options?.useCdnJavascript ?? true,
172713
172714
  ignoreErrors: options?.ignoreErrors ?? true,
172714
- kicadFootprintLibrary: options?.kicadFootprintLibrary ?? projectConfig2?.build?.kicadLibrary ?? false
172715
+ kicadFootprintLibrary: options?.kicadFootprintLibrary ?? projectConfig2?.build?.kicadLibrary ?? false,
172716
+ kicadPcm: options?.kicadPcm ?? projectConfig2?.build?.kicadPcm ?? false
172715
172717
  },
172716
172718
  handled: false
172717
172719
  };
@@ -173145,9 +173147,204 @@ var generateKicadProject = async ({
173145
173147
  };
173146
173148
  };
173147
173149
 
173148
- // cli/build/transpile/index.ts
173150
+ // cli/build/build-kicad-pcm.ts
173149
173151
  import path43 from "node:path";
173150
173152
  import fs43 from "node:fs";
173153
+
173154
+ // lib/shared/generate-pcm-assets.ts
173155
+ var import_jszip3 = __toESM2(require_lib4(), 1);
173156
+ import fs42 from "node:fs";
173157
+ import path42 from "node:path";
173158
+ import crypto3 from "node:crypto";
173159
+ async function generatePcmAssets(options) {
173160
+ const {
173161
+ packageName,
173162
+ version: version2,
173163
+ author,
173164
+ description = `${packageName} - tscircuit component`,
173165
+ descriptionFull = `A tscircuit component exported for use in KiCad. Visit https://tscircuit.com/${author}/${packageName} for more information.`,
173166
+ license = "MIT",
173167
+ kicadLibraryPath,
173168
+ outputDir,
173169
+ baseUrl
173170
+ } = options;
173171
+ const identifier = `com.tscircuit.${author}.${packageName}`.toLowerCase().replace(/[^a-z0-9.-]/g, "-").slice(0, 50);
173172
+ fs42.mkdirSync(outputDir, { recursive: true });
173173
+ const metadata = {
173174
+ $schema: "https://go.kicad.org/pcm/schemas/v1",
173175
+ name: `tscircuit ${packageName}`,
173176
+ description: description.slice(0, 500),
173177
+ description_full: descriptionFull.slice(0, 5000),
173178
+ identifier,
173179
+ type: "library",
173180
+ author: {
173181
+ name: author,
173182
+ contact: {
173183
+ web: `https://tscircuit.com/${author}`
173184
+ }
173185
+ },
173186
+ license,
173187
+ resources: {},
173188
+ versions: [
173189
+ {
173190
+ version: version2,
173191
+ status: "stable",
173192
+ kicad_version: "7.0"
173193
+ }
173194
+ ]
173195
+ };
173196
+ const zipFileName = `${identifier}-${version2}.zip`;
173197
+ const zipFilePath = path42.join(outputDir, zipFileName);
173198
+ await createPcmZip({
173199
+ kicadLibraryPath,
173200
+ metadata,
173201
+ outputPath: zipFilePath
173202
+ });
173203
+ const zipBuffer = fs42.readFileSync(zipFilePath);
173204
+ const sha256 = crypto3.createHash("sha256").update(zipBuffer).digest("hex");
173205
+ const zipSize = zipBuffer.length;
173206
+ const downloadUrl = baseUrl ? `${baseUrl}/pcm/${zipFileName}` : `./${zipFileName}`;
173207
+ const packagesJson = {
173208
+ packages: [
173209
+ {
173210
+ identifier,
173211
+ name: `tscircuit ${packageName}`,
173212
+ description: description.slice(0, 500),
173213
+ description_full: descriptionFull.slice(0, 5000),
173214
+ type: "library",
173215
+ author: {
173216
+ name: author,
173217
+ contact: {
173218
+ web: `https://tscircuit.com/${author}`
173219
+ }
173220
+ },
173221
+ license,
173222
+ resources: {},
173223
+ versions: [
173224
+ {
173225
+ version: version2,
173226
+ status: "stable",
173227
+ kicad_version: "7.0",
173228
+ download_url: downloadUrl,
173229
+ download_sha256: sha256,
173230
+ download_size: zipSize,
173231
+ install_size: zipSize * 2
173232
+ }
173233
+ ]
173234
+ }
173235
+ ]
173236
+ };
173237
+ const packagesJsonPath = path42.join(outputDir, "packages.json");
173238
+ fs42.writeFileSync(packagesJsonPath, JSON.stringify(packagesJson, null, 2));
173239
+ const packagesJsonBuffer = fs42.readFileSync(packagesJsonPath);
173240
+ const packagesJsonSha256 = crypto3.createHash("sha256").update(packagesJsonBuffer).digest("hex");
173241
+ const packagesJsonUrl = baseUrl ? `${baseUrl}/pcm/packages.json` : "./packages.json";
173242
+ const repositoryJson = {
173243
+ $schema: "https://go.kicad.org/pcm/schemas/v1",
173244
+ name: `tscircuit ${author}/${packageName}`,
173245
+ maintainer: {
173246
+ name: author,
173247
+ contact: {
173248
+ web: `https://tscircuit.com/${author}`
173249
+ }
173250
+ },
173251
+ packages: {
173252
+ url: packagesJsonUrl,
173253
+ sha256: packagesJsonSha256,
173254
+ update_timestamp: Math.floor(Date.now() / 1000)
173255
+ }
173256
+ };
173257
+ const repositoryJsonPath = path42.join(outputDir, "repository.json");
173258
+ fs42.writeFileSync(repositoryJsonPath, JSON.stringify(repositoryJson, null, 2));
173259
+ return {
173260
+ outputDir,
173261
+ repositoryJsonPath,
173262
+ packagesJsonPath,
173263
+ packageZipPath: zipFilePath,
173264
+ packageZipSha256: sha256,
173265
+ packageZipSize: zipSize
173266
+ };
173267
+ }
173268
+ function addDirectoryToZip(opts) {
173269
+ const { zip, dirPath, zipPath } = opts;
173270
+ const entries = fs42.readdirSync(dirPath, { withFileTypes: true });
173271
+ for (const entry of entries) {
173272
+ const fullPath = path42.join(dirPath, entry.name);
173273
+ const entryZipPath = zipPath ? `${zipPath}/${entry.name}` : entry.name;
173274
+ if (entry.isDirectory()) {
173275
+ addDirectoryToZip({ zip, dirPath: fullPath, zipPath: entryZipPath });
173276
+ } else {
173277
+ const content = fs42.readFileSync(fullPath);
173278
+ zip.file(entryZipPath, content);
173279
+ }
173280
+ }
173281
+ }
173282
+ async function createPcmZip(options) {
173283
+ const { kicadLibraryPath, metadata, outputPath } = options;
173284
+ const zip = new import_jszip3.default;
173285
+ zip.file("metadata.json", JSON.stringify(metadata, null, 2));
173286
+ const footprintsDir = path42.join(kicadLibraryPath, "footprints");
173287
+ if (fs42.existsSync(footprintsDir)) {
173288
+ addDirectoryToZip({ zip, dirPath: footprintsDir, zipPath: "footprints" });
173289
+ }
173290
+ const symbolsDir = path42.join(kicadLibraryPath, "symbols");
173291
+ if (fs42.existsSync(symbolsDir)) {
173292
+ addDirectoryToZip({ zip, dirPath: symbolsDir, zipPath: "symbols" });
173293
+ }
173294
+ const modelsDir = path42.join(kicadLibraryPath, "3dmodels");
173295
+ if (fs42.existsSync(modelsDir)) {
173296
+ addDirectoryToZip({ zip, dirPath: modelsDir, zipPath: "3dmodels" });
173297
+ }
173298
+ const zipBuffer = await zip.generateAsync({
173299
+ type: "nodebuffer",
173300
+ compression: "DEFLATE",
173301
+ compressionOptions: { level: 9 }
173302
+ });
173303
+ fs42.writeFileSync(outputPath, zipBuffer);
173304
+ }
173305
+
173306
+ // cli/build/build-kicad-pcm.ts
173307
+ async function buildKicadPcm({
173308
+ entryFile,
173309
+ projectDir,
173310
+ distDir
173311
+ }) {
173312
+ const packageJsonPath = path43.join(projectDir, "package.json");
173313
+ if (!fs43.existsSync(packageJsonPath)) {
173314
+ throw new Error("No package.json found for KiCad PCM generation");
173315
+ }
173316
+ const packageJson = JSON.parse(fs43.readFileSync(packageJsonPath, "utf-8"));
173317
+ const packageName = packageJson.name?.split("/").pop()?.split(".").pop() || path43.basename(projectDir);
173318
+ const version2 = packageJson.version || "1.0.0";
173319
+ const author = getPackageAuthor(packageJson.name || "") || "tscircuit";
173320
+ const description = packageJson.description || "";
173321
+ const libraryName = path43.basename(projectDir);
173322
+ const kicadLibOutputDir = path43.join(distDir, "kicad-library");
173323
+ if (!fs43.existsSync(kicadLibOutputDir)) {
173324
+ await convertToKicadLibrary({
173325
+ filePath: entryFile,
173326
+ libraryName,
173327
+ outputDir: kicadLibOutputDir
173328
+ });
173329
+ }
173330
+ const pcmOutputDir = path43.join(distDir, "pcm");
173331
+ const baseUrl = `https://${author}--${packageName}.tscircuit.app`;
173332
+ await generatePcmAssets({
173333
+ packageName,
173334
+ version: version2,
173335
+ author,
173336
+ description,
173337
+ kicadLibraryPath: kicadLibOutputDir,
173338
+ outputDir: pcmOutputDir,
173339
+ baseUrl
173340
+ });
173341
+ console.log(` KiCad PCM assets generated at ${kleur_default.dim(path43.relative(process.cwd(), pcmOutputDir))}`);
173342
+ console.log(` Repository URL: ${kleur_default.cyan(`${baseUrl}/pcm/repository.json`)}`);
173343
+ }
173344
+
173345
+ // cli/build/transpile/index.ts
173346
+ import path45 from "node:path";
173347
+ import fs45 from "node:fs";
173151
173348
  import { rollup } from "rollup";
173152
173349
  import typescript from "@rollup/plugin-typescript";
173153
173350
  import resolve11 from "@rollup/plugin-node-resolve";
@@ -173156,11 +173353,11 @@ import json from "@rollup/plugin-json";
173156
173353
  import dts from "rollup-plugin-dts";
173157
173354
 
173158
173355
  // cli/build/transpile/static-asset-plugin.ts
173159
- import fs42 from "node:fs";
173160
- import path42 from "node:path";
173356
+ import fs44 from "node:fs";
173357
+ import path44 from "node:path";
173161
173358
  import { createHash } from "node:crypto";
173162
173359
  function normalizePathSeparators(filePath) {
173163
- return filePath.split(path42.sep).join("/");
173360
+ return filePath.split(path44.sep).join("/");
173164
173361
  }
173165
173362
  var STATIC_ASSET_EXTENSIONS = new Set([
173166
173363
  ".glb",
@@ -173191,24 +173388,24 @@ var createStaticAssetPlugin = ({
173191
173388
  return {
173192
173389
  name: "tsci-static-assets",
173193
173390
  resolveId(source, importer) {
173194
- const ext = path42.extname(source).toLowerCase();
173391
+ const ext = path44.extname(source).toLowerCase();
173195
173392
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
173196
173393
  return null;
173197
- if (path42.isAbsolute(source)) {
173198
- return fs42.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
173394
+ if (path44.isAbsolute(source)) {
173395
+ return fs44.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
173199
173396
  }
173200
173397
  if (importer) {
173201
- const importerNative = importer.split("/").join(path42.sep);
173202
- const resolvedFromImporter = path42.resolve(path42.dirname(importerNative), source);
173203
- if (fs42.existsSync(resolvedFromImporter)) {
173398
+ const importerNative = importer.split("/").join(path44.sep);
173399
+ const resolvedFromImporter = path44.resolve(path44.dirname(importerNative), source);
173400
+ if (fs44.existsSync(resolvedFromImporter)) {
173204
173401
  return {
173205
173402
  id: normalizePathSeparators(resolvedFromImporter),
173206
173403
  external: true
173207
173404
  };
173208
173405
  }
173209
173406
  }
173210
- const resolvedFromProject = path42.resolve(resolvedBaseUrl, source);
173211
- if (fs42.existsSync(resolvedFromProject)) {
173407
+ const resolvedFromProject = path44.resolve(resolvedBaseUrl, source);
173408
+ if (fs44.existsSync(resolvedFromProject)) {
173212
173409
  return {
173213
173410
  id: normalizePathSeparators(resolvedFromProject),
173214
173411
  external: true
@@ -173221,8 +173418,8 @@ var createStaticAssetPlugin = ({
173221
173418
  const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
173222
173419
  for (const target of targets) {
173223
173420
  const targetPath = isWildcard ? target.replace("*", wildcard) : target;
173224
- const resolvedTarget = path42.resolve(resolvedBaseUrl, targetPath);
173225
- if (fs42.existsSync(resolvedTarget)) {
173421
+ const resolvedTarget = path44.resolve(resolvedBaseUrl, targetPath);
173422
+ if (fs44.existsSync(resolvedTarget)) {
173226
173423
  return {
173227
173424
  id: normalizePathSeparators(resolvedTarget),
173228
173425
  external: true
@@ -173248,18 +173445,18 @@ var createStaticAssetPlugin = ({
173248
173445
  if (chunk.type !== "chunk")
173249
173446
  continue;
173250
173447
  for (const importedId of chunk.imports) {
173251
- const ext = path42.extname(importedId).toLowerCase();
173448
+ const ext = path44.extname(importedId).toLowerCase();
173252
173449
  if (!STATIC_ASSET_EXTENSIONS.has(ext))
173253
173450
  continue;
173254
173451
  if (!copiedAssets.has(importedId)) {
173255
- const assetDir = path42.join(outputDir, "assets");
173256
- fs42.mkdirSync(assetDir, { recursive: true });
173257
- const nativePath = importedId.split("/").join(path42.sep);
173258
- const fileBuffer = fs42.readFileSync(nativePath);
173452
+ const assetDir = path44.join(outputDir, "assets");
173453
+ fs44.mkdirSync(assetDir, { recursive: true });
173454
+ const nativePath = importedId.split("/").join(path44.sep);
173455
+ const fileBuffer = fs44.readFileSync(nativePath);
173259
173456
  const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
173260
- const fileName = `${path42.basename(importedId, ext)}-${hash}${ext}`;
173261
- const outputFilePath = path42.join(assetDir, fileName);
173262
- fs42.writeFileSync(outputFilePath, fileBuffer);
173457
+ const fileName = `${path44.basename(importedId, ext)}-${hash}${ext}`;
173458
+ const outputFilePath = path44.join(assetDir, fileName);
173459
+ fs44.writeFileSync(outputFilePath, fileBuffer);
173263
173460
  copiedAssets.set(importedId, `./assets/${fileName}`);
173264
173461
  assetIdToOutputPath.set(importedId, `./assets/${fileName}`);
173265
173462
  }
@@ -173281,17 +173478,17 @@ function escapeRegExp(string) {
173281
173478
 
173282
173479
  // cli/build/transpile/index.ts
173283
173480
  var createExternalFunction = (projectDir, tsconfigPath) => (id) => {
173284
- if (id.startsWith(".") || id.startsWith("/") || path43.isAbsolute(id)) {
173481
+ if (id.startsWith(".") || id.startsWith("/") || path45.isAbsolute(id)) {
173285
173482
  return false;
173286
173483
  }
173287
173484
  let baseUrl = projectDir;
173288
173485
  let pathMappings = {};
173289
- if (tsconfigPath && fs43.existsSync(tsconfigPath)) {
173486
+ if (tsconfigPath && fs45.existsSync(tsconfigPath)) {
173290
173487
  try {
173291
- const tsconfigContent = fs43.readFileSync(tsconfigPath, "utf-8");
173488
+ const tsconfigContent = fs45.readFileSync(tsconfigPath, "utf-8");
173292
173489
  const tsconfig = JSON.parse(tsconfigContent);
173293
173490
  if (tsconfig.compilerOptions?.baseUrl) {
173294
- baseUrl = path43.resolve(path43.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
173491
+ baseUrl = path45.resolve(path45.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
173295
173492
  }
173296
173493
  if (tsconfig.compilerOptions?.paths) {
173297
173494
  pathMappings = tsconfig.compilerOptions.paths;
@@ -173305,17 +173502,17 @@ var createExternalFunction = (projectDir, tsconfigPath) => (id) => {
173305
173502
  }
173306
173503
  }
173307
173504
  const potentialPaths = [
173308
- path43.join(baseUrl, id),
173309
- path43.join(baseUrl, `${id}.ts`),
173310
- path43.join(baseUrl, `${id}.tsx`),
173311
- path43.join(baseUrl, `${id}.js`),
173312
- path43.join(baseUrl, `${id}.jsx`),
173313
- path43.join(baseUrl, id, "index.ts"),
173314
- path43.join(baseUrl, id, "index.tsx"),
173315
- path43.join(baseUrl, id, "index.js"),
173316
- path43.join(baseUrl, id, "index.jsx")
173505
+ path45.join(baseUrl, id),
173506
+ path45.join(baseUrl, `${id}.ts`),
173507
+ path45.join(baseUrl, `${id}.tsx`),
173508
+ path45.join(baseUrl, `${id}.js`),
173509
+ path45.join(baseUrl, `${id}.jsx`),
173510
+ path45.join(baseUrl, id, "index.ts"),
173511
+ path45.join(baseUrl, id, "index.tsx"),
173512
+ path45.join(baseUrl, id, "index.js"),
173513
+ path45.join(baseUrl, id, "index.jsx")
173317
173514
  ];
173318
- if (potentialPaths.some((p4) => fs43.existsSync(p4))) {
173515
+ if (potentialPaths.some((p4) => fs45.existsSync(p4))) {
173319
173516
  return false;
173320
173517
  }
173321
173518
  return true;
@@ -173326,17 +173523,17 @@ var transpileFile = async ({
173326
173523
  projectDir
173327
173524
  }) => {
173328
173525
  try {
173329
- fs43.mkdirSync(outputDir, { recursive: true });
173330
- const tsconfigPath = path43.join(projectDir, "tsconfig.json");
173331
- const hasTsConfig = fs43.existsSync(tsconfigPath);
173526
+ fs45.mkdirSync(outputDir, { recursive: true });
173527
+ const tsconfigPath = path45.join(projectDir, "tsconfig.json");
173528
+ const hasTsConfig = fs45.existsSync(tsconfigPath);
173332
173529
  let tsconfigBaseUrl = projectDir;
173333
173530
  let tsconfigPathMappings;
173334
173531
  if (hasTsConfig) {
173335
173532
  try {
173336
- const tsconfigContent = fs43.readFileSync(tsconfigPath, "utf-8");
173533
+ const tsconfigContent = fs45.readFileSync(tsconfigPath, "utf-8");
173337
173534
  const tsconfig = JSON.parse(tsconfigContent);
173338
173535
  if (tsconfig.compilerOptions?.baseUrl) {
173339
- tsconfigBaseUrl = path43.resolve(path43.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
173536
+ tsconfigBaseUrl = path45.resolve(path45.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
173340
173537
  }
173341
173538
  if (tsconfig.compilerOptions?.paths) {
173342
173539
  tsconfigPathMappings = tsconfig.compilerOptions.paths;
@@ -173391,27 +173588,27 @@ var transpileFile = async ({
173391
173588
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
173392
173589
  plugins: getPlugins()
173393
173590
  });
173394
- const esmOutputPath = path43.join(outputDir, "index.js");
173591
+ const esmOutputPath = path45.join(outputDir, "index.js");
173395
173592
  await esmBundle.write({
173396
173593
  file: esmOutputPath,
173397
173594
  format: "es",
173398
173595
  sourcemap: false
173399
173596
  });
173400
- console.log(`ESM bundle written to ${path43.relative(projectDir, esmOutputPath)}`);
173597
+ console.log(`ESM bundle written to ${path45.relative(projectDir, esmOutputPath)}`);
173401
173598
  console.log("Building CommonJS bundle...");
173402
173599
  const cjsBundle = await rollup({
173403
173600
  input,
173404
173601
  external: createExternalFunction(projectDir, hasTsConfig ? tsconfigPath : undefined),
173405
173602
  plugins: getPlugins()
173406
173603
  });
173407
- const cjsOutputPath = path43.join(outputDir, "index.cjs");
173604
+ const cjsOutputPath = path45.join(outputDir, "index.cjs");
173408
173605
  console.log("Writing CJS bundle to:", cjsOutputPath);
173409
173606
  await cjsBundle.write({
173410
173607
  file: cjsOutputPath,
173411
173608
  format: "cjs",
173412
173609
  sourcemap: false
173413
173610
  });
173414
- console.log(`CommonJS bundle written to ${path43.relative(projectDir, cjsOutputPath)}`);
173611
+ console.log(`CommonJS bundle written to ${path45.relative(projectDir, cjsOutputPath)}`);
173415
173612
  console.log("Generating type declarations...");
173416
173613
  const dtsBundle = await rollup({
173417
173614
  input,
@@ -173436,9 +173633,9 @@ var transpileFile = async ({
173436
173633
  dtsContent = dtsContent.replace(/import \* as [\w_]+ from ['"]react\/jsx-runtime['"];?\s*\n?/g, "");
173437
173634
  dtsContent = dtsContent.replace(/[\w_]+\.JSX\.Element/g, "any");
173438
173635
  dtsContent = dtsContent.replace(/export\s*{\s*};\s*$/gm, "").trim();
173439
- const dtsOutputPath = path43.join(outputDir, "index.d.ts");
173440
- fs43.writeFileSync(dtsOutputPath, dtsContent);
173441
- console.log(`Type declarations written to ${path43.relative(projectDir, dtsOutputPath)}`);
173636
+ const dtsOutputPath = path45.join(outputDir, "index.d.ts");
173637
+ fs45.writeFileSync(dtsOutputPath, dtsContent);
173638
+ console.log(`Type declarations written to ${path45.relative(projectDir, dtsOutputPath)}`);
173442
173639
  console.log(kleur_default.green("Transpilation complete!"));
173443
173640
  return true;
173444
173641
  } catch (err) {
@@ -173451,17 +173648,17 @@ var transpileFile = async ({
173451
173648
  };
173452
173649
 
173453
173650
  // cli/utils/validate-main-in-dist.ts
173454
- import fs44 from "node:fs";
173455
- import path44 from "node:path";
173651
+ import fs46 from "node:fs";
173652
+ import path46 from "node:path";
173456
173653
  var validateMainInDist = (projectDir, distDir) => {
173457
- const packageJsonPath = path44.join(projectDir, "package.json");
173458
- if (!fs44.existsSync(packageJsonPath))
173654
+ const packageJsonPath = path46.join(projectDir, "package.json");
173655
+ if (!fs46.existsSync(packageJsonPath))
173459
173656
  return;
173460
- const packageJson = JSON.parse(fs44.readFileSync(packageJsonPath, "utf-8"));
173657
+ const packageJson = JSON.parse(fs46.readFileSync(packageJsonPath, "utf-8"));
173461
173658
  if (typeof packageJson.main !== "string")
173462
173659
  return;
173463
- const resolvedMainPath = path44.resolve(projectDir, packageJson.main);
173464
- const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path44.sep}`);
173660
+ const resolvedMainPath = path46.resolve(projectDir, packageJson.main);
173661
+ const isMainInDist = resolvedMainPath === distDir || resolvedMainPath.startsWith(`${distDir}${path46.sep}`);
173465
173662
  if (!isMainInDist) {
173466
173663
  console.warn('When using transpilation, your package\'s "main" field should point inside the `dist/*` directory, usually to "dist/index.js"');
173467
173664
  }
@@ -173483,9 +173680,9 @@ async function getLatestTscircuitCdnUrl() {
173483
173680
  }
173484
173681
 
173485
173682
  // cli/build/register.ts
173486
- var normalizeRelativePath = (projectDir, targetPath) => path45.relative(projectDir, targetPath).split(path45.sep).join("/");
173683
+ var normalizeRelativePath = (projectDir, targetPath) => path47.relative(projectDir, targetPath).split(path47.sep).join("/");
173487
173684
  var registerBuild = (program3) => {
173488
- program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad", "Generate KiCad project directories for each successful build output").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").action(async (file, options) => {
173685
+ program3.command("build").description("Run tscircuit eval and output circuit json").argument("[file]", "Path to the entry file").option("--ci", "Run install and optional prebuild/build commands (or default CI build)").option("--ignore-errors", "Do not exit with code 1 on errors").option("--ignore-warnings", "Do not log warnings").option("--disable-pcb", "Disable PCB outputs").option("--disable-parts-engine", "Disable the parts engine").option("--site", "Generate a static site in the dist directory").option("--transpile", "Transpile the entry file to JavaScript").option("--preview-images", "Generate preview images in the dist directory").option("--all-images", "Generate preview images for every successful build output").option("--kicad", "Generate KiCad project directories for each successful build output").option("--preview-gltf", "Generate a GLTF file from the preview entrypoint").option("--kicad-pcm", "Generate KiCad PCM (Plugin and Content Manager) assets in dist/pcm").option("--use-cdn-javascript", "Use CDN-hosted JavaScript instead of bundled standalone file for --site").action(async (file, options) => {
173489
173686
  try {
173490
173687
  const {
173491
173688
  projectDir,
@@ -173516,8 +173713,8 @@ var registerBuild = (program3) => {
173516
173713
  }
173517
173714
  return config;
173518
173715
  })();
173519
- const distDir = path45.join(projectDir, "dist");
173520
- fs45.mkdirSync(distDir, { recursive: true });
173716
+ const distDir = path47.join(projectDir, "dist");
173717
+ fs47.mkdirSync(distDir, { recursive: true });
173521
173718
  console.log(`Building ${circuitFiles.length} file(s)...`);
173522
173719
  let hasErrors = false;
173523
173720
  const staticFileReferences = [];
@@ -173525,10 +173722,10 @@ var registerBuild = (program3) => {
173525
173722
  const kicadProjects = [];
173526
173723
  const shouldGenerateKicad = resolvedOptions?.kicad || resolvedOptions?.kicadFootprintLibrary;
173527
173724
  for (const filePath of circuitFiles) {
173528
- const relative10 = path45.relative(projectDir, filePath);
173725
+ const relative10 = path47.relative(projectDir, filePath);
173529
173726
  console.log(`Building ${relative10}...`);
173530
173727
  const outputDirName = relative10.replace(/(\.board|\.circuit)?\.tsx$/, "");
173531
- const outputPath = path45.join(distDir, outputDirName, "circuit.json");
173728
+ const outputPath = path47.join(distDir, outputDirName, "circuit.json");
173532
173729
  const buildOutcome = await buildFile(filePath, outputPath, projectDir, {
173533
173730
  ignoreErrors: resolvedOptions?.ignoreErrors,
173534
173731
  ignoreWarnings: resolvedOptions?.ignoreWarnings,
@@ -173542,17 +173739,17 @@ var registerBuild = (program3) => {
173542
173739
  if (!buildOutcome.ok) {
173543
173740
  hasErrors = true;
173544
173741
  } else if (resolvedOptions?.site) {
173545
- const normalizedSourcePath = relative10.split(path45.sep).join("/");
173546
- const relativeOutputPath = path45.join(outputDirName, "circuit.json");
173547
- const normalizedOutputPath = relativeOutputPath.split(path45.sep).join("/");
173742
+ const normalizedSourcePath = relative10.split(path47.sep).join("/");
173743
+ const relativeOutputPath = path47.join(outputDirName, "circuit.json");
173744
+ const normalizedOutputPath = relativeOutputPath.split(path47.sep).join("/");
173548
173745
  staticFileReferences.push({
173549
173746
  filePath: normalizedSourcePath,
173550
173747
  fileStaticAssetUrl: `./${normalizedOutputPath}`
173551
173748
  });
173552
173749
  }
173553
173750
  if (buildOutcome.ok && shouldGenerateKicad && buildOutcome.circuitJson) {
173554
- const projectOutputDir = path45.join(distDir, outputDirName, "kicad");
173555
- const projectName = path45.basename(outputDirName);
173751
+ const projectOutputDir = path47.join(distDir, outputDirName, "kicad");
173752
+ const projectName = path47.basename(outputDirName);
173556
173753
  const project = await generateKicadProject({
173557
173754
  circuitJson: buildOutcome.circuitJson,
173558
173755
  outputDir: projectOutputDir,
@@ -173615,14 +173812,14 @@ var registerBuild = (program3) => {
173615
173812
  if (resolvedOptions?.useCdnJavascript) {
173616
173813
  standaloneScriptSrc = await getLatestTscircuitCdnUrl();
173617
173814
  } else {
173618
- fs45.writeFileSync(path45.join(distDir, "standalone.min.js"), standalone_min_default);
173815
+ fs47.writeFileSync(path47.join(distDir, "standalone.min.js"), standalone_min_default);
173619
173816
  }
173620
173817
  const indexHtml = getStaticIndexHtmlFile({
173621
173818
  files: staticFileReferences,
173622
173819
  standaloneScriptSrc,
173623
173820
  defaultMainComponentPath: siteDefaultComponentPath ? normalizeRelativePath(projectDir, siteDefaultComponentPath) : undefined
173624
173821
  });
173625
- fs45.writeFileSync(path45.join(distDir, "index.html"), indexHtml);
173822
+ fs47.writeFileSync(path47.join(distDir, "index.html"), indexHtml);
173626
173823
  }
173627
173824
  if (resolvedOptions?.kicadFootprintLibrary) {
173628
173825
  console.log("Generating KiCad footprint library...");
@@ -173637,15 +173834,15 @@ var registerBuild = (program3) => {
173637
173834
  process.exit(1);
173638
173835
  }
173639
173836
  } else {
173640
- const libraryName = path45.basename(projectDir);
173641
- const kicadLibOutputDir = path45.join(distDir, "kicad-library");
173837
+ const libraryName = path47.basename(projectDir);
173838
+ const kicadLibOutputDir = path47.join(distDir, "kicad-library");
173642
173839
  try {
173643
173840
  await convertToKicadLibrary({
173644
173841
  filePath: entryFile,
173645
173842
  libraryName,
173646
173843
  outputDir: kicadLibOutputDir
173647
173844
  });
173648
- console.log(` KiCad library generated at ${kleur_default.dim(path45.relative(process.cwd(), kicadLibOutputDir))}`);
173845
+ console.log(` KiCad library generated at ${kleur_default.dim(path47.relative(process.cwd(), kicadLibOutputDir))}`);
173649
173846
  } catch (err) {
173650
173847
  console.error(`Error generating KiCad library: ${err instanceof Error ? err.message : err}`);
173651
173848
  if (!resolvedOptions?.ignoreErrors) {
@@ -173654,6 +173851,32 @@ var registerBuild = (program3) => {
173654
173851
  }
173655
173852
  }
173656
173853
  }
173854
+ if (resolvedOptions?.kicadPcm) {
173855
+ console.log("Generating KiCad PCM assets...");
173856
+ const { mainEntrypoint: kicadEntrypoint } = await getBuildEntrypoints({
173857
+ fileOrDir: file,
173858
+ includeBoardFiles: false
173859
+ });
173860
+ if (!kicadEntrypoint) {
173861
+ console.error("No entry file found for KiCad PCM generation. Make sure you have a lib/index.ts or set mainEntrypoint in tscircuit.config.json");
173862
+ if (!resolvedOptions?.ignoreErrors) {
173863
+ process.exit(1);
173864
+ }
173865
+ } else {
173866
+ try {
173867
+ await buildKicadPcm({
173868
+ entryFile: kicadEntrypoint,
173869
+ projectDir,
173870
+ distDir
173871
+ });
173872
+ } catch (err) {
173873
+ console.error(`Error generating KiCad PCM assets: ${err instanceof Error ? err.message : err}`);
173874
+ if (!resolvedOptions?.ignoreErrors) {
173875
+ process.exit(1);
173876
+ }
173877
+ }
173878
+ }
173879
+ }
173657
173880
  const successCount = builtFiles.filter((f2) => f2.ok).length;
173658
173881
  const failCount = builtFiles.length - successCount;
173659
173882
  const enabledOpts = [
@@ -173663,6 +173886,7 @@ var registerBuild = (program3) => {
173663
173886
  resolvedOptions?.allImages && "all-images",
173664
173887
  resolvedOptions?.kicad && "kicad",
173665
173888
  resolvedOptions?.kicadFootprintLibrary && "kicad-footprint-library",
173889
+ resolvedOptions?.kicadPcm && "kicad-pcm",
173666
173890
  resolvedOptions?.previewGltf && "preview-gltf"
173667
173891
  ].filter(Boolean);
173668
173892
  console.log("");
@@ -173671,7 +173895,7 @@ var registerBuild = (program3) => {
173671
173895
  if (enabledOpts.length > 0) {
173672
173896
  console.log(` Options ${kleur_default.cyan(enabledOpts.join(", "))}`);
173673
173897
  }
173674
- console.log(` Output ${kleur_default.dim(path45.relative(process.cwd(), distDir) || "dist")}`);
173898
+ console.log(` Output ${kleur_default.dim(path47.relative(process.cwd(), distDir) || "dist")}`);
173675
173899
  console.log(hasErrors ? kleur_default.yellow(`
173676
173900
  ⚠ Build completed with errors`) : kleur_default.green(`
173677
173901
  ✓ Done`));
@@ -173685,8 +173909,8 @@ var registerBuild = (program3) => {
173685
173909
  };
173686
173910
 
173687
173911
  // lib/shared/snapshot-project.ts
173688
- import fs47 from "node:fs";
173689
- import path46 from "node:path";
173912
+ import fs49 from "node:fs";
173913
+ import path48 from "node:path";
173690
173914
  import looksSame2 from "looks-same";
173691
173915
  import {
173692
173916
  convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
@@ -173697,7 +173921,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
173697
173921
 
173698
173922
  // lib/shared/compare-images.ts
173699
173923
  import looksSame from "looks-same";
173700
- import fs46 from "node:fs/promises";
173924
+ import fs48 from "node:fs/promises";
173701
173925
  var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
173702
173926
  const { equal: equal2 } = await looksSame(buffer1, buffer2, {
173703
173927
  strict: false,
@@ -173713,7 +173937,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
173713
173937
  tolerance: 2
173714
173938
  });
173715
173939
  } else {
173716
- await fs46.writeFile(diffPath, buffer2);
173940
+ await fs48.writeFile(diffPath, buffer2);
173717
173941
  }
173718
173942
  }
173719
173943
  return { equal: equal2 };
@@ -173738,7 +173962,7 @@ var snapshotProject = async ({
173738
173962
  ...DEFAULT_IGNORED_PATTERNS,
173739
173963
  ...ignored.map(normalizeIgnorePattern)
173740
173964
  ];
173741
- const resolvedPaths = filePaths.map((f2) => path46.resolve(projectDir, f2));
173965
+ const resolvedPaths = filePaths.map((f2) => path48.resolve(projectDir, f2));
173742
173966
  const boardFiles = findBoardFiles({
173743
173967
  projectDir,
173744
173968
  ignore,
@@ -173752,7 +173976,7 @@ var snapshotProject = async ({
173752
173976
  const mismatches = [];
173753
173977
  let didUpdate = false;
173754
173978
  for (const file of boardFiles) {
173755
- const relativeFilePath = path46.relative(projectDir, file);
173979
+ const relativeFilePath = path48.relative(projectDir, file);
173756
173980
  let circuitJson;
173757
173981
  let pcbSvg;
173758
173982
  let schSvg;
@@ -173807,17 +174031,17 @@ var snapshotProject = async ({
173807
174031
  } catch (error) {
173808
174032
  const errorMessage = error instanceof Error ? error.message : String(error);
173809
174033
  if (errorMessage.includes("No pcb_board found in circuit JSON")) {
173810
- const fileDir = path46.dirname(file);
173811
- const relativeDir = path46.relative(projectDir, fileDir);
173812
- const snapDir2 = snapshotsDirName ? path46.join(projectDir, snapshotsDirName, relativeDir) : path46.join(fileDir, "__snapshots__");
173813
- const base2 = path46.basename(file).replace(/\.tsx$/, "");
173814
- const snap3dPath = path46.join(snapDir2, `${base2}-3d.snap.png`);
173815
- const existing3dSnapshot = fs47.existsSync(snap3dPath);
174034
+ const fileDir = path48.dirname(file);
174035
+ const relativeDir = path48.relative(projectDir, fileDir);
174036
+ const snapDir2 = snapshotsDirName ? path48.join(projectDir, snapshotsDirName, relativeDir) : path48.join(fileDir, "__snapshots__");
174037
+ const base2 = path48.basename(file).replace(/\.tsx$/, "");
174038
+ const snap3dPath = path48.join(snapDir2, `${base2}-3d.snap.png`);
174039
+ const existing3dSnapshot = fs49.existsSync(snap3dPath);
173816
174040
  if (existing3dSnapshot) {
173817
174041
  onError(kleur_default.red(`
173818
174042
  ❌ Failed to generate 3D snapshot for ${relativeFilePath}:
173819
174043
  `) + kleur_default.red(` No pcb_board found in circuit JSON
173820
- `) + kleur_default.red(` Existing snapshot: ${path46.relative(projectDir, snap3dPath)}
174044
+ `) + kleur_default.red(` Existing snapshot: ${path48.relative(projectDir, snap3dPath)}
173821
174045
  `));
173822
174046
  return onExit2(1);
173823
174047
  } else {
@@ -173833,9 +174057,9 @@ var snapshotProject = async ({
173833
174057
  }
173834
174058
  }
173835
174059
  }
173836
- const snapDir = snapshotsDirName ? path46.join(projectDir, snapshotsDirName, path46.relative(projectDir, path46.dirname(file))) : path46.join(path46.dirname(file), "__snapshots__");
173837
- fs47.mkdirSync(snapDir, { recursive: true });
173838
- const base = path46.basename(file).replace(/\.tsx$/, "");
174060
+ const snapDir = snapshotsDirName ? path48.join(projectDir, snapshotsDirName, path48.relative(projectDir, path48.dirname(file))) : path48.join(path48.dirname(file), "__snapshots__");
174061
+ fs49.mkdirSync(snapDir, { recursive: true });
174062
+ const base = path48.basename(file).replace(/\.tsx$/, "");
173839
174063
  const snapshots = [];
173840
174064
  if (pcbOnly || !schematicOnly) {
173841
174065
  snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
@@ -173853,31 +174077,31 @@ var snapshotProject = async ({
173853
174077
  for (const snapshot of snapshots) {
173854
174078
  const { type } = snapshot;
173855
174079
  const is3d = type === "3d";
173856
- const snapPath = path46.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
173857
- const existing = fs47.existsSync(snapPath);
174080
+ const snapPath = path48.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
174081
+ const existing = fs49.existsSync(snapPath);
173858
174082
  const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
173859
174083
  const newContentForFile = snapshot.content;
173860
174084
  if (!existing) {
173861
- fs47.writeFileSync(snapPath, newContentForFile);
173862
- console.log("✅", kleur_default.gray(path46.relative(projectDir, snapPath)));
174085
+ fs49.writeFileSync(snapPath, newContentForFile);
174086
+ console.log("✅", kleur_default.gray(path48.relative(projectDir, snapPath)));
173863
174087
  didUpdate = true;
173864
174088
  continue;
173865
174089
  }
173866
- const oldContentBuffer = fs47.readFileSync(snapPath);
174090
+ const oldContentBuffer = fs49.readFileSync(snapPath);
173867
174091
  const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
173868
174092
  const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
173869
174093
  if (update) {
173870
174094
  if (!forceUpdate && equal2) {
173871
- console.log("✅", kleur_default.gray(path46.relative(projectDir, snapPath)));
174095
+ console.log("✅", kleur_default.gray(path48.relative(projectDir, snapPath)));
173872
174096
  } else {
173873
- fs47.writeFileSync(snapPath, newContentForFile);
173874
- console.log("✅", kleur_default.gray(path46.relative(projectDir, snapPath)));
174097
+ fs49.writeFileSync(snapPath, newContentForFile);
174098
+ console.log("✅", kleur_default.gray(path48.relative(projectDir, snapPath)));
173875
174099
  didUpdate = true;
173876
174100
  }
173877
174101
  } else if (!equal2) {
173878
174102
  mismatches.push(`${snapPath} (diff: ${diffPath})`);
173879
174103
  } else {
173880
- console.log("✅", kleur_default.gray(path46.relative(projectDir, snapPath)));
174104
+ console.log("✅", kleur_default.gray(path48.relative(projectDir, snapPath)));
173881
174105
  }
173882
174106
  }
173883
174107
  }
@@ -173916,22 +174140,22 @@ var registerSnapshot = (program3) => {
173916
174140
  };
173917
174141
 
173918
174142
  // lib/shared/setup-github-actions.ts
173919
- import fs48 from "node:fs";
173920
- import path47 from "node:path";
174143
+ import fs50 from "node:fs";
174144
+ import path49 from "node:path";
173921
174145
  var setupGithubActions = (projectDir = process.cwd()) => {
173922
174146
  const findGitRoot = (startDir) => {
173923
- let dir = path47.resolve(startDir);
173924
- while (dir !== path47.parse(dir).root) {
173925
- if (fs48.existsSync(path47.join(dir, ".git"))) {
174147
+ let dir = path49.resolve(startDir);
174148
+ while (dir !== path49.parse(dir).root) {
174149
+ if (fs50.existsSync(path49.join(dir, ".git"))) {
173926
174150
  return dir;
173927
174151
  }
173928
- dir = path47.dirname(dir);
174152
+ dir = path49.dirname(dir);
173929
174153
  }
173930
174154
  return null;
173931
174155
  };
173932
174156
  const gitRoot = findGitRoot(projectDir) ?? projectDir;
173933
- const workflowsDir = path47.join(gitRoot, ".github", "workflows");
173934
- fs48.mkdirSync(workflowsDir, { recursive: true });
174157
+ const workflowsDir = path49.join(gitRoot, ".github", "workflows");
174158
+ fs50.mkdirSync(workflowsDir, { recursive: true });
173935
174159
  const buildWorkflow = `name: tscircuit Build
173936
174160
 
173937
174161
  on:
@@ -173970,8 +174194,8 @@ jobs:
173970
174194
  - run: bun install
173971
174195
  - run: bunx tsci snapshot
173972
174196
  `;
173973
- writeFileIfNotExists(path47.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
173974
- writeFileIfNotExists(path47.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
174197
+ writeFileIfNotExists(path49.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
174198
+ writeFileIfNotExists(path49.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
173975
174199
  };
173976
174200
 
173977
174201
  // cli/setup/register.ts
@@ -174009,8 +174233,8 @@ function registerAuthSetupNpmrc(program3) {
174009
174233
  }
174010
174234
 
174011
174235
  // cli/convert/register.ts
174012
- import fs49 from "node:fs/promises";
174013
- import path48 from "node:path";
174236
+ import fs51 from "node:fs/promises";
174237
+ import path50 from "node:path";
174014
174238
  import { parseKicadModToCircuitJson } from "kicad-component-converter";
174015
174239
 
174016
174240
  // node_modules/@tscircuit/mm/dist/index.js
@@ -174131,15 +174355,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
174131
174355
  var registerConvert = (program3) => {
174132
174356
  program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
174133
174357
  try {
174134
- const inputPath = path48.resolve(file);
174135
- const modContent = await fs49.readFile(inputPath, "utf-8");
174358
+ const inputPath = path50.resolve(file);
174359
+ const modContent = await fs51.readFile(inputPath, "utf-8");
174136
174360
  const circuitJson = await parseKicadModToCircuitJson(modContent);
174137
- const componentName = options.name ?? path48.basename(inputPath, ".kicad_mod");
174361
+ const componentName = options.name ?? path50.basename(inputPath, ".kicad_mod");
174138
174362
  const tsx = convertCircuitJsonToTscircuit(circuitJson, {
174139
174363
  componentName
174140
174364
  });
174141
- const outputPath = options.output ? path48.resolve(options.output) : path48.join(path48.dirname(inputPath), `${componentName}.tsx`);
174142
- await fs49.writeFile(outputPath, tsx);
174365
+ const outputPath = options.output ? path50.resolve(options.output) : path50.join(path50.dirname(inputPath), `${componentName}.tsx`);
174366
+ await fs51.writeFile(outputPath, tsx);
174143
174367
  console.log(kleur_default.green(`Converted ${outputPath}`));
174144
174368
  } catch (error) {
174145
174369
  console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
@@ -174255,7 +174479,7 @@ var registerInstall = (program3) => {
174255
174479
  };
174256
174480
 
174257
174481
  // cli/transpile/register.ts
174258
- import path49 from "node:path";
174482
+ import path51 from "node:path";
174259
174483
  var registerTranspile = (program3) => {
174260
174484
  program3.command("transpile").description("Transpile TypeScript/TSX to JavaScript (ESM, CommonJS, and type declarations)").argument("[file]", "Path to the entry file").action(async (file) => {
174261
174485
  try {
@@ -174263,7 +174487,7 @@ var registerTranspile = (program3) => {
174263
174487
  fileOrDir: file,
174264
174488
  includeBoardFiles: false
174265
174489
  });
174266
- const distDir = path49.join(projectDir, "dist");
174490
+ const distDir = path51.join(projectDir, "dist");
174267
174491
  validateMainInDist(projectDir, distDir);
174268
174492
  console.log("Transpiling entry file...");
174269
174493
  const entryFile = mainEntrypoint || circuitFiles[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.769",
3
+ "version": "0.1.770",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",