@tscircuit/cli 0.1.2343 → 0.1.2344

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.
@@ -33471,6 +33471,29 @@ var mergePlatformConfigs = (...configs) => {
33471
33471
  }, {});
33472
33472
  };
33473
33473
 
33474
+ // lib/shared/get-platform-fetch.ts
33475
+ class BakedAssetNotFoundError extends Error {
33476
+ constructor() {
33477
+ super("This part isn't currently available in tscircuit standalone (enterprise), please contact your representative to get it added");
33478
+ }
33479
+ }
33480
+ var getPlatformFetch = (upstreamFetch = globalThis.fetch) => {
33481
+ const baseUrl = process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL?.replace(/\/+$/, "");
33482
+ if (!baseUrl)
33483
+ return upstreamFetch;
33484
+ const origin = new URL(baseUrl).origin;
33485
+ return Object.assign(async (input, init) => {
33486
+ const url = new URL(input instanceof Request ? input.url : input);
33487
+ if (url.protocol !== "http:" && url.protocol !== "https:")
33488
+ return upstreamFetch(input, init);
33489
+ const target = url.origin === origin ? url : new URL(`${url.hostname}${url.pathname}${url.search}`, `${baseUrl}/`);
33490
+ const response = await upstreamFetch(new Request(target, new Request(input, init)));
33491
+ if (response.status === 404 || response.status === 405)
33492
+ throw new BakedAssetNotFoundError;
33493
+ return response;
33494
+ }, { preconnect: upstreamFetch.preconnect });
33495
+ };
33496
+
33474
33497
  // lib/shared/get-platform-config-with-cli-defaults.ts
33475
33498
  function createLocalCacheEngine(cacheDir = path9.join(process.cwd(), ".tscircuit", "cache")) {
33476
33499
  return {
@@ -33529,10 +33552,10 @@ function getPlatformConfigWithCliDefaults(userConfig, options) {
33529
33552
  }
33530
33553
  }
33531
33554
  };
33532
- if (!userConfig) {
33533
- return defaultConfig;
33534
- }
33535
- return mergePlatformConfigs(defaultConfig, userConfig);
33555
+ const config = userConfig ? mergePlatformConfigs(defaultConfig, userConfig) : defaultConfig;
33556
+ if (process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL)
33557
+ config.platformFetch = getPlatformFetch(config.platformFetch);
33558
+ return config;
33536
33559
  }
33537
33560
 
33538
33561
  // cli/build/drc-diagnostic-filter.ts
package/dist/cli/main.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/cli/main.js
3
- size: 46848961 bytes
4
- sha256: 4fc70142398eccf4013cefd3c811ac94a34227f10b3d534354017578183754d3
3
+ size: 46850785 bytes
4
+ sha256: 6c3abb3942ef667f849632fcb882cb6d36c8aa22e9fe2cdbd737a5177a67ec0f
@@ -24354,6 +24354,29 @@ var mergePlatformConfigs = (...configs) => {
24354
24354
  }, {});
24355
24355
  };
24356
24356
 
24357
+ // lib/shared/get-platform-fetch.ts
24358
+ class BakedAssetNotFoundError extends Error {
24359
+ constructor() {
24360
+ super("This part isn't currently available in tscircuit standalone (enterprise), please contact your representative to get it added");
24361
+ }
24362
+ }
24363
+ var getPlatformFetch = (upstreamFetch = globalThis.fetch) => {
24364
+ const baseUrl = process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL?.replace(/\/+$/, "");
24365
+ if (!baseUrl)
24366
+ return upstreamFetch;
24367
+ const origin = new URL(baseUrl).origin;
24368
+ return Object.assign(async (input, init) => {
24369
+ const url = new URL(input instanceof Request ? input.url : input);
24370
+ if (url.protocol !== "http:" && url.protocol !== "https:")
24371
+ return upstreamFetch(input, init);
24372
+ const target = url.origin === origin ? url : new URL(`${url.hostname}${url.pathname}${url.search}`, `${baseUrl}/`);
24373
+ const response = await upstreamFetch(new Request(target, new Request(input, init)));
24374
+ if (response.status === 404 || response.status === 405)
24375
+ throw new BakedAssetNotFoundError;
24376
+ return response;
24377
+ }, { preconnect: upstreamFetch.preconnect });
24378
+ };
24379
+
24357
24380
  // lib/shared/get-platform-config-with-cli-defaults.ts
24358
24381
  function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit", "cache")) {
24359
24382
  return {
@@ -24412,10 +24435,10 @@ function getPlatformConfigWithCliDefaults(userConfig, options) {
24412
24435
  }
24413
24436
  }
24414
24437
  };
24415
- if (!userConfig) {
24416
- return defaultConfig;
24417
- }
24418
- return mergePlatformConfigs(defaultConfig, userConfig);
24438
+ const config = userConfig ? mergePlatformConfigs(defaultConfig, userConfig) : defaultConfig;
24439
+ if (process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL)
24440
+ config.platformFetch = getPlatformFetch(config.platformFetch);
24441
+ return config;
24419
24442
  }
24420
24443
 
24421
24444
  // lib/shared/simulation-svg-assets.ts
package/dist/lib/index.js CHANGED
@@ -70266,6 +70266,29 @@ var mergePlatformConfigs = (...configs) => {
70266
70266
  }, {});
70267
70267
  };
70268
70268
 
70269
+ // lib/shared/get-platform-fetch.ts
70270
+ class BakedAssetNotFoundError extends Error {
70271
+ constructor() {
70272
+ super("This part isn't currently available in tscircuit standalone (enterprise), please contact your representative to get it added");
70273
+ }
70274
+ }
70275
+ var getPlatformFetch = (upstreamFetch = globalThis.fetch) => {
70276
+ const baseUrl = process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL?.replace(/\/+$/, "");
70277
+ if (!baseUrl)
70278
+ return upstreamFetch;
70279
+ const origin = new URL(baseUrl).origin;
70280
+ return Object.assign(async (input, init) => {
70281
+ const url = new URL(input instanceof Request ? input.url : input);
70282
+ if (url.protocol !== "http:" && url.protocol !== "https:")
70283
+ return upstreamFetch(input, init);
70284
+ const target = url.origin === origin ? url : new URL(`${url.hostname}${url.pathname}${url.search}`, `${baseUrl}/`);
70285
+ const response = await upstreamFetch(new Request(target, new Request(input, init)));
70286
+ if (response.status === 404 || response.status === 405)
70287
+ throw new BakedAssetNotFoundError;
70288
+ return response;
70289
+ }, { preconnect: upstreamFetch.preconnect });
70290
+ };
70291
+
70269
70292
  // lib/shared/get-platform-config-with-cli-defaults.ts
70270
70293
  function createLocalCacheEngine(cacheDir = path.join(process.cwd(), ".tscircuit", "cache")) {
70271
70294
  return {
@@ -70324,10 +70347,10 @@ function getPlatformConfigWithCliDefaults(userConfig, options) {
70324
70347
  }
70325
70348
  }
70326
70349
  };
70327
- if (!userConfig) {
70328
- return defaultConfig;
70329
- }
70330
- return mergePlatformConfigs(defaultConfig, userConfig);
70350
+ const config = userConfig ? mergePlatformConfigs(defaultConfig, userConfig) : defaultConfig;
70351
+ if (process.env.TSCIRCUIT_BAKED_ASSET_SERVER_BASE_URL)
70352
+ config.platformFetch = getPlatformFetch(config.platformFetch);
70353
+ return config;
70331
70354
  }
70332
70355
 
70333
70356
  // node_modules/conf/dist/source/index.js
@@ -84348,6 +84371,7 @@ var getRegistryApiKy = ({
84348
84371
  } = {}) => {
84349
84372
  const resolvedToken = sessionToken ?? getSessionToken() ?? getSessionTokenFromNpmrc();
84350
84373
  return distribution_default.create({
84374
+ fetch: getPlatformFetch(),
84351
84375
  prefixUrl: getRegistryApiUrl(),
84352
84376
  headers: {
84353
84377
  ...resolvedToken ? { Authorization: `Bearer ${resolvedToken}` } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2343",
3
+ "version": "0.1.2344",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"