@tscircuit/cli 0.1.912 → 0.1.913

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.
@@ -2620,12 +2620,37 @@ function analyzeCircuitJson(circuitJson) {
2620
2620
 
2621
2621
  // lib/shared/get-complete-platform-config.ts
2622
2622
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
2623
+ import { createHash } from "node:crypto";
2623
2624
  import path3 from "node:path";
2624
2625
  import fs3 from "node:fs";
2626
+ function createLocalCacheEngine(cacheDir = path3.join(process.cwd(), ".tscircuit", "cache")) {
2627
+ return {
2628
+ getItem: (key) => {
2629
+ try {
2630
+ const hash = createHash("md5").update(key).digest("hex");
2631
+ const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
2632
+ const filePath = path3.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
2633
+ return fs3.readFileSync(filePath, "utf-8");
2634
+ } catch {
2635
+ return null;
2636
+ }
2637
+ },
2638
+ setItem: (key, value) => {
2639
+ try {
2640
+ fs3.mkdirSync(cacheDir, { recursive: true });
2641
+ const hash = createHash("md5").update(key).digest("hex");
2642
+ const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
2643
+ const filePath = path3.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
2644
+ fs3.writeFileSync(filePath, value);
2645
+ } catch {}
2646
+ }
2647
+ };
2648
+ }
2625
2649
  function getCompletePlatformConfig(userConfig) {
2626
2650
  const basePlatformConfig = getPlatformConfig();
2627
2651
  const defaultConfig = {
2628
2652
  ...basePlatformConfig,
2653
+ localCacheEngine: createLocalCacheEngine(),
2629
2654
  footprintFileParserMap: {
2630
2655
  ...basePlatformConfig.footprintFileParserMap,
2631
2656
  kicad_mod: {
package/dist/cli/main.js CHANGED
@@ -71936,6 +71936,9 @@ Thumbs.db
71936
71936
  npm-debug.log*
71937
71937
  yarn-debug.log*
71938
71938
  yarn-error.log*
71939
+
71940
+ # tscircuit cache
71941
+ .tscircuit/
71939
71942
  `;
71940
71943
  writeFileIfNotExists(gitignorePath, gitignoreContent);
71941
71944
  };
@@ -74384,7 +74387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74384
74387
  import { execSync as execSync2 } from "node:child_process";
74385
74388
  var import_semver2 = __toESM2(require_semver2(), 1);
74386
74389
  // package.json
74387
- var version = "0.1.911";
74390
+ var version = "0.1.912";
74388
74391
  var package_default = {
74389
74392
  name: "@tscircuit/cli",
74390
74393
  main: "dist/cli/main.js",
@@ -74447,7 +74450,7 @@ var package_default = {
74447
74450
  semver: "^7.6.3",
74448
74451
  sharp: "0.32.6",
74449
74452
  tempy: "^3.1.0",
74450
- tscircuit: "^0.0.1293-libonly",
74453
+ tscircuit: "^0.0.1296-libonly",
74451
74454
  tsx: "^4.7.1",
74452
74455
  "typed-ky": "^0.0.4",
74453
74456
  zod: "^3.23.8"
@@ -174332,12 +174335,37 @@ function analyzeCircuitJson(circuitJson) {
174332
174335
 
174333
174336
  // lib/shared/get-complete-platform-config.ts
174334
174337
  import { getPlatformConfig } from "@tscircuit/eval/platform-config";
174338
+ import { createHash } from "node:crypto";
174335
174339
  import path41 from "node:path";
174336
174340
  import fs41 from "node:fs";
174341
+ function createLocalCacheEngine(cacheDir = path41.join(process.cwd(), ".tscircuit", "cache")) {
174342
+ return {
174343
+ getItem: (key) => {
174344
+ try {
174345
+ const hash = createHash("md5").update(key).digest("hex");
174346
+ const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
174347
+ const filePath = path41.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
174348
+ return fs41.readFileSync(filePath, "utf-8");
174349
+ } catch {
174350
+ return null;
174351
+ }
174352
+ },
174353
+ setItem: (key, value) => {
174354
+ try {
174355
+ fs41.mkdirSync(cacheDir, { recursive: true });
174356
+ const hash = createHash("md5").update(key).digest("hex");
174357
+ const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
174358
+ const filePath = path41.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
174359
+ fs41.writeFileSync(filePath, value);
174360
+ } catch {}
174361
+ }
174362
+ };
174363
+ }
174337
174364
  function getCompletePlatformConfig(userConfig) {
174338
174365
  const basePlatformConfig = getPlatformConfig();
174339
174366
  const defaultConfig = {
174340
174367
  ...basePlatformConfig,
174368
+ localCacheEngine: createLocalCacheEngine(),
174341
174369
  footprintFileParserMap: {
174342
174370
  ...basePlatformConfig.footprintFileParserMap,
174343
174371
  kicad_mod: {
@@ -175176,7 +175204,7 @@ import dts from "rollup-plugin-dts";
175176
175204
  // cli/build/transpile/static-asset-plugin.ts
175177
175205
  import fs50 from "node:fs";
175178
175206
  import path51 from "node:path";
175179
- import { createHash } from "node:crypto";
175207
+ import { createHash as createHash2 } from "node:crypto";
175180
175208
  function normalizePathSeparators(filePath) {
175181
175209
  return filePath.split(path51.sep).join("/");
175182
175210
  }
@@ -175274,7 +175302,7 @@ var createStaticAssetPlugin = ({
175274
175302
  fs50.mkdirSync(assetDir, { recursive: true });
175275
175303
  const nativePath = importedId.split("/").join(path51.sep);
175276
175304
  const fileBuffer = fs50.readFileSync(nativePath);
175277
- const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
175305
+ const hash = createHash2("sha1").update(fileBuffer).digest("hex").slice(0, 8);
175278
175306
  const fileName = `${path51.basename(importedId, ext)}-${hash}${ext}`;
175279
175307
  const outputFilePath = path51.join(assetDir, fileName);
175280
175308
  fs50.writeFileSync(outputFilePath, fileBuffer);
package/dist/lib/index.js CHANGED
@@ -60414,7 +60414,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60414
60414
  }));
60415
60415
  };
60416
60416
  // package.json
60417
- var version = "0.1.911";
60417
+ var version = "0.1.912";
60418
60418
  var package_default = {
60419
60419
  name: "@tscircuit/cli",
60420
60420
  main: "dist/cli/main.js",
@@ -60477,7 +60477,7 @@ var package_default = {
60477
60477
  semver: "^7.6.3",
60478
60478
  sharp: "0.32.6",
60479
60479
  tempy: "^3.1.0",
60480
- tscircuit: "^0.0.1293-libonly",
60480
+ tscircuit: "^0.0.1296-libonly",
60481
60481
  tsx: "^4.7.1",
60482
60482
  "typed-ky": "^0.0.4",
60483
60483
  zod: "^3.23.8"
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ".": "./dist/cli/main.js",
6
6
  "./lib": "./dist/lib/index.js"
7
7
  },
8
- "version": "0.1.912",
8
+ "version": "0.1.913",
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",
@@ -60,7 +60,7 @@
60
60
  "semver": "^7.6.3",
61
61
  "sharp": "0.32.6",
62
62
  "tempy": "^3.1.0",
63
- "tscircuit": "^0.0.1293-libonly",
63
+ "tscircuit": "^0.0.1296-libonly",
64
64
  "tsx": "^4.7.1",
65
65
  "typed-ky": "^0.0.4",
66
66
  "zod": "^3.23.8"