@tscircuit/cli 0.1.1810 → 0.1.1811
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/cli/build/build.worker.js +4 -3
- package/dist/cli/main.js +62 -12
- package/dist/cli/snapshot/snapshot.worker.js +4 -3
- package/dist/lib/index.js +266 -225
- package/package.json +1 -1
|
@@ -13055,11 +13055,12 @@ function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit
|
|
|
13055
13055
|
}
|
|
13056
13056
|
};
|
|
13057
13057
|
}
|
|
13058
|
-
function getPlatformConfigWithCliDefaults(userConfig) {
|
|
13058
|
+
function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
13059
13059
|
const basePlatformConfig = getPlatformConfig();
|
|
13060
|
+
const cacheDir = options?.projectDir ? path8.join(options.projectDir, ".tscircuit", "cache") : undefined;
|
|
13060
13061
|
const defaultConfig = {
|
|
13061
13062
|
...basePlatformConfig,
|
|
13062
|
-
localCacheEngine: createLocalCacheEngine(),
|
|
13063
|
+
localCacheEngine: createLocalCacheEngine(cacheDir),
|
|
13063
13064
|
footprintFileParserMap: {
|
|
13064
13065
|
...basePlatformConfig.footprintFileParserMap,
|
|
13065
13066
|
kicad_mod: {
|
|
@@ -17395,7 +17396,7 @@ var handleBuildFile = async (filePath, outputPath, glbOutputPath, stepOutputPath
|
|
|
17395
17396
|
await registerStaticAssetLoaders();
|
|
17396
17397
|
const projectConfig = await loadRuntimeProjectConfig(projectDir);
|
|
17397
17398
|
const platformConfig = mergePlatformConfigs(projectConfig?.platformConfig, options?.platformConfig);
|
|
17398
|
-
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig);
|
|
17399
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig, { projectDir });
|
|
17399
17400
|
const normalizedInputPath = filePath.toLowerCase().replaceAll("\\", "/");
|
|
17400
17401
|
const isPrebuiltCircuitJson = normalizedInputPath.endsWith(".circuit.json") || normalizedInputPath.endsWith("/circuit.json");
|
|
17401
17402
|
const circuitJson = isPrebuiltCircuitJson ? loadCircuitJsonFromInputFile(filePath) : (await generateCircuitJson({
|
package/dist/cli/main.js
CHANGED
|
@@ -118506,7 +118506,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
118506
118506
|
// lib/getVersion.ts
|
|
118507
118507
|
import { createRequire as createRequire2 } from "node:module";
|
|
118508
118508
|
// package.json
|
|
118509
|
-
var version = "0.1.
|
|
118509
|
+
var version = "0.1.1809";
|
|
118510
118510
|
var package_default = {
|
|
118511
118511
|
name: "@tscircuit/cli",
|
|
118512
118512
|
version,
|
|
@@ -129875,11 +129875,12 @@ function createLocalCacheEngine(cacheDir = path19.join(process.cwd(), ".tscircui
|
|
|
129875
129875
|
}
|
|
129876
129876
|
};
|
|
129877
129877
|
}
|
|
129878
|
-
function getPlatformConfigWithCliDefaults(userConfig) {
|
|
129878
|
+
function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
129879
129879
|
const basePlatformConfig = getPlatformConfig();
|
|
129880
|
+
const cacheDir = options?.projectDir ? path19.join(options.projectDir, ".tscircuit", "cache") : undefined;
|
|
129880
129881
|
const defaultConfig = {
|
|
129881
129882
|
...basePlatformConfig,
|
|
129882
|
-
localCacheEngine: createLocalCacheEngine(),
|
|
129883
|
+
localCacheEngine: createLocalCacheEngine(cacheDir),
|
|
129883
129884
|
footprintFileParserMap: {
|
|
129884
129885
|
...basePlatformConfig.footprintFileParserMap,
|
|
129885
129886
|
kicad_mod: {
|
|
@@ -130887,7 +130888,7 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
130887
130888
|
const parsed = JSON.parse(fs28.readFileSync(input, "utf-8"));
|
|
130888
130889
|
circuitJson = Array.isArray(parsed) ? parsed : [];
|
|
130889
130890
|
}
|
|
130890
|
-
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(options?.platformConfig);
|
|
130891
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(options?.platformConfig, { projectDir });
|
|
130891
130892
|
if (!isPrebuiltCircuitJson) {
|
|
130892
130893
|
const result = await generateCircuitJson({
|
|
130893
130894
|
filePath: input,
|
|
@@ -136388,7 +136389,7 @@ var checkNetlist = async (file) => {
|
|
|
136388
136389
|
pcbDisabled: true,
|
|
136389
136390
|
routingDisabled: true,
|
|
136390
136391
|
placementDrcChecksDisabled: true
|
|
136391
|
-
});
|
|
136392
|
+
}, { projectDir: findCircuitProjectDir(resolvedInputFilePath) });
|
|
136392
136393
|
const { circuitJson } = await getOrGenerateCircuitJson({
|
|
136393
136394
|
filePath: resolvedInputFilePath,
|
|
136394
136395
|
platformConfig: platformConfigWithCliDefaults
|
|
@@ -136465,7 +136466,9 @@ var getCircuitJsonForCheck = async ({
|
|
|
136465
136466
|
const parsedJson = JSON.parse(fs43.readFileSync(filePath, "utf-8"));
|
|
136466
136467
|
return Array.isArray(parsedJson) ? parsedJson : [];
|
|
136467
136468
|
}
|
|
136468
|
-
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig
|
|
136469
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig, {
|
|
136470
|
+
projectDir: findCircuitProjectDir(filePath)
|
|
136471
|
+
});
|
|
136469
136472
|
const { circuitJson } = await getOrGenerateCircuitJson({
|
|
136470
136473
|
filePath,
|
|
136471
136474
|
platformConfig: platformConfigWithCliDefaults,
|
|
@@ -287613,7 +287616,9 @@ var loadCircuitJsonForFootprinter = async (inputPath) => {
|
|
|
287613
287616
|
const { circuitJson } = await generateCircuitJson({
|
|
287614
287617
|
filePath: inputPath,
|
|
287615
287618
|
injectedProps: { name: "CONVERT" },
|
|
287616
|
-
platformConfig: getPlatformConfigWithCliDefaults(
|
|
287619
|
+
platformConfig: getPlatformConfigWithCliDefaults(undefined, {
|
|
287620
|
+
projectDir: findCircuitProjectDir(inputPath)
|
|
287621
|
+
})
|
|
287617
287622
|
});
|
|
287618
287623
|
const pcbComponentCount = circuitJson.filter((element) => element.type === "pcb_component").length;
|
|
287619
287624
|
if (pcbComponentCount > 1) {
|
|
@@ -291433,17 +291438,25 @@ Rebuilding KiCad PCM assets...`));
|
|
|
291433
291438
|
};
|
|
291434
291439
|
|
|
291435
291440
|
// lib/server/createHttpServer.ts
|
|
291441
|
+
var RUNFRAME_CACHE_PATH = "/api/cache";
|
|
291436
291442
|
var resolveLocalTscircuitStandalonePath = (projectDir) => {
|
|
291437
291443
|
if (!projectDir)
|
|
291438
291444
|
return;
|
|
291439
291445
|
try {
|
|
291440
291446
|
const projectRequire = createRequire5(path62.join(projectDir, "package.json"));
|
|
291441
|
-
const browserBundlePath =
|
|
291447
|
+
const browserBundlePath = projectRequire.resolve("tscircuit/browser");
|
|
291442
291448
|
if (fs56.existsSync(browserBundlePath))
|
|
291443
291449
|
return browserBundlePath;
|
|
291444
291450
|
} catch {}
|
|
291445
291451
|
return;
|
|
291446
291452
|
};
|
|
291453
|
+
var readRequestBody = async (req) => {
|
|
291454
|
+
const chunks = [];
|
|
291455
|
+
for await (const chunk of req) {
|
|
291456
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
291457
|
+
}
|
|
291458
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
291459
|
+
};
|
|
291447
291460
|
var createHttpServer = async ({
|
|
291448
291461
|
port = 3020,
|
|
291449
291462
|
defaultMainComponentPath,
|
|
@@ -291452,10 +291465,42 @@ var createHttpServer = async ({
|
|
|
291452
291465
|
entryFile
|
|
291453
291466
|
}) => {
|
|
291454
291467
|
const fileServerHandler = getNodeHandler(stdin_default, {});
|
|
291468
|
+
const localCacheEngine = projectDir ? createLocalCacheEngine(path62.join(projectDir, ".tscircuit", "cache")) : undefined;
|
|
291455
291469
|
const pcmProxy = kicadPcm && projectDir && entryFile ? createKicadPcmProxy({ projectDir, entryFile, port }) : null;
|
|
291456
291470
|
const server = http.createServer(async (req, res2) => {
|
|
291457
291471
|
const requestHost = req.headers.host ?? `localhost:${port}`;
|
|
291458
291472
|
const url2 = new URL(req.url, `http://${requestHost}`);
|
|
291473
|
+
if (url2.pathname === RUNFRAME_CACHE_PATH) {
|
|
291474
|
+
const key = url2.searchParams.get("key");
|
|
291475
|
+
if (!localCacheEngine || !key) {
|
|
291476
|
+
res2.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
291477
|
+
res2.end("A project directory and cache key are required");
|
|
291478
|
+
return;
|
|
291479
|
+
}
|
|
291480
|
+
if (req.method === "GET") {
|
|
291481
|
+
const value = await localCacheEngine.getItem(key);
|
|
291482
|
+
if (value === null) {
|
|
291483
|
+
res2.writeHead(404);
|
|
291484
|
+
res2.end();
|
|
291485
|
+
return;
|
|
291486
|
+
}
|
|
291487
|
+
res2.writeHead(200, {
|
|
291488
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
291489
|
+
"Cache-Control": "no-store"
|
|
291490
|
+
});
|
|
291491
|
+
res2.end(value);
|
|
291492
|
+
return;
|
|
291493
|
+
}
|
|
291494
|
+
if (req.method === "POST") {
|
|
291495
|
+
await localCacheEngine.setItem(key, await readRequestBody(req));
|
|
291496
|
+
res2.writeHead(204);
|
|
291497
|
+
res2.end();
|
|
291498
|
+
return;
|
|
291499
|
+
}
|
|
291500
|
+
res2.writeHead(405, { Allow: "GET, POST" });
|
|
291501
|
+
res2.end();
|
|
291502
|
+
return;
|
|
291503
|
+
}
|
|
291459
291504
|
if (url2.pathname === "/api/files/upsert-multipart" && req.method === "POST") {
|
|
291460
291505
|
try {
|
|
291461
291506
|
const request = new Request(url2.toString(), {
|
|
@@ -294449,10 +294494,13 @@ var registerExport = (program2) => {
|
|
|
294449
294494
|
const projectConfig2 = await loadRuntimeProjectConfig(process.cwd());
|
|
294450
294495
|
const commandPlatformConfig = options.disablePartsEngine === true ? { partsEngineDisabled: true } : undefined;
|
|
294451
294496
|
const platformConfig2 = mergePlatformConfigs(projectConfig2?.platformConfig, commandPlatformConfig);
|
|
294497
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig2, {
|
|
294498
|
+
projectDir: findCircuitProjectDir(file)
|
|
294499
|
+
});
|
|
294452
294500
|
if (formatOption === "spice") {
|
|
294453
294501
|
const { circuitJson } = await getOrGenerateCircuitJson({
|
|
294454
294502
|
filePath: file,
|
|
294455
|
-
platformConfig:
|
|
294503
|
+
platformConfig: platformConfigWithCliDefaults
|
|
294456
294504
|
});
|
|
294457
294505
|
if (circuitJson) {
|
|
294458
294506
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
@@ -294471,7 +294519,7 @@ var registerExport = (program2) => {
|
|
|
294471
294519
|
filePath: file,
|
|
294472
294520
|
format,
|
|
294473
294521
|
outputPath: options.output,
|
|
294474
|
-
platformConfig:
|
|
294522
|
+
platformConfig: platformConfigWithCliDefaults,
|
|
294475
294523
|
pcbSnapshotSettings: options.showCourtyards ? { showCourtyards: true } : undefined,
|
|
294476
294524
|
onExit: (code) => process.exit(code),
|
|
294477
294525
|
onError: (message) => console.error(message),
|
|
@@ -316915,7 +316963,9 @@ var registerSimulate = (program3) => {
|
|
|
316915
316963
|
const { circuitJson } = await getOrGenerateCircuitJson({
|
|
316916
316964
|
filePath: file,
|
|
316917
316965
|
saveToFile: false,
|
|
316918
|
-
platformConfig: getPlatformConfigWithCliDefaults(platformConfig2
|
|
316966
|
+
platformConfig: getPlatformConfigWithCliDefaults(platformConfig2, {
|
|
316967
|
+
projectDir: findCircuitProjectDir(file)
|
|
316968
|
+
})
|
|
316919
316969
|
});
|
|
316920
316970
|
if (!circuitJson) {
|
|
316921
316971
|
console.log("error: Failed to generate circuit JSON");
|
|
@@ -317086,7 +317136,7 @@ var processSnapshotFile = async ({
|
|
|
317086
317136
|
const parsed = JSON.parse(fs72.readFileSync(file, "utf-8"));
|
|
317087
317137
|
circuitJson = Array.isArray(parsed) ? parsed : [];
|
|
317088
317138
|
} else {
|
|
317089
|
-
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig2);
|
|
317139
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig2, { projectDir });
|
|
317090
317140
|
const result = await getOrGenerateCircuitJson({
|
|
317091
317141
|
filePath: file,
|
|
317092
317142
|
platformConfig: platformConfigWithCliDefaults
|
|
@@ -3895,11 +3895,12 @@ function createLocalCacheEngine(cacheDir = path7.join(process.cwd(), ".tscircuit
|
|
|
3895
3895
|
}
|
|
3896
3896
|
};
|
|
3897
3897
|
}
|
|
3898
|
-
function getPlatformConfigWithCliDefaults(userConfig) {
|
|
3898
|
+
function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
3899
3899
|
const basePlatformConfig = getPlatformConfig();
|
|
3900
|
+
const cacheDir = options?.projectDir ? path7.join(options.projectDir, ".tscircuit", "cache") : undefined;
|
|
3900
3901
|
const defaultConfig = {
|
|
3901
3902
|
...basePlatformConfig,
|
|
3902
|
-
localCacheEngine: createLocalCacheEngine(),
|
|
3903
|
+
localCacheEngine: createLocalCacheEngine(cacheDir),
|
|
3903
3904
|
footprintFileParserMap: {
|
|
3904
3905
|
...basePlatformConfig.footprintFileParserMap,
|
|
3905
3906
|
kicad_mod: {
|
|
@@ -4074,7 +4075,7 @@ var processSnapshotFile = async ({
|
|
|
4074
4075
|
const parsed = JSON.parse(fs9.readFileSync(file, "utf-8"));
|
|
4075
4076
|
circuitJson = Array.isArray(parsed) ? parsed : [];
|
|
4076
4077
|
} else {
|
|
4077
|
-
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig);
|
|
4078
|
+
const platformConfigWithCliDefaults = getPlatformConfigWithCliDefaults(platformConfig, { projectDir });
|
|
4078
4079
|
const result = await getOrGenerateCircuitJson({
|
|
4079
4080
|
filePath: file,
|
|
4080
4081
|
platformConfig: platformConfigWithCliDefaults
|
package/dist/lib/index.js
CHANGED
|
@@ -39247,8 +39247,8 @@ var require_utils = __commonJS((exports2, module2) => {
|
|
|
39247
39247
|
}
|
|
39248
39248
|
return ind;
|
|
39249
39249
|
}
|
|
39250
|
-
function removeDotSegments(
|
|
39251
|
-
let input =
|
|
39250
|
+
function removeDotSegments(path5) {
|
|
39251
|
+
let input = path5;
|
|
39252
39252
|
const output = [];
|
|
39253
39253
|
let nextSlash = -1;
|
|
39254
39254
|
let len = 0;
|
|
@@ -39491,8 +39491,8 @@ var require_schemes = __commonJS((exports2, module2) => {
|
|
|
39491
39491
|
wsComponent.secure = undefined;
|
|
39492
39492
|
}
|
|
39493
39493
|
if (wsComponent.resourceName) {
|
|
39494
|
-
const [
|
|
39495
|
-
wsComponent.path =
|
|
39494
|
+
const [path5, query] = wsComponent.resourceName.split("?");
|
|
39495
|
+
wsComponent.path = path5 && path5 !== "/" ? path5 : undefined;
|
|
39496
39496
|
wsComponent.query = query;
|
|
39497
39497
|
wsComponent.resourceName = undefined;
|
|
39498
39498
|
}
|
|
@@ -43430,12 +43430,12 @@ var require_dist5 = __commonJS((exports2, module2) => {
|
|
|
43430
43430
|
throw new Error(`Unknown format "${name}"`);
|
|
43431
43431
|
return f;
|
|
43432
43432
|
};
|
|
43433
|
-
function addFormats(ajv, list,
|
|
43433
|
+
function addFormats(ajv, list, fs3, exportName) {
|
|
43434
43434
|
var _a;
|
|
43435
43435
|
var _b;
|
|
43436
43436
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
43437
43437
|
for (const f of list)
|
|
43438
|
-
ajv.addFormat(f,
|
|
43438
|
+
ajv.addFormat(f, fs3[f]);
|
|
43439
43439
|
}
|
|
43440
43440
|
module2.exports = exports2 = formatsPlugin;
|
|
43441
43441
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65757
65757
|
}));
|
|
65758
65758
|
};
|
|
65759
65759
|
// package.json
|
|
65760
|
-
var version = "0.1.
|
|
65760
|
+
var version = "0.1.1809";
|
|
65761
65761
|
var package_default = {
|
|
65762
65762
|
name: "@tscircuit/cli",
|
|
65763
65763
|
version,
|
|
@@ -66838,11 +66838,91 @@ var winterSpec = {
|
|
|
66838
66838
|
};
|
|
66839
66839
|
var stdin_default = winterSpec;
|
|
66840
66840
|
|
|
66841
|
+
// lib/shared/get-platform-config-with-cli-defaults.ts
|
|
66842
|
+
import { createHash } from "node:crypto";
|
|
66843
|
+
import fs from "node:fs";
|
|
66844
|
+
import path from "node:path";
|
|
66845
|
+
import { getPlatformConfig } from "@tscircuit/eval/platform-config";
|
|
66846
|
+
function createLocalCacheEngine(cacheDir = path.join(process.cwd(), ".tscircuit", "cache")) {
|
|
66847
|
+
return {
|
|
66848
|
+
getItem: (key) => {
|
|
66849
|
+
try {
|
|
66850
|
+
const hash = createHash("md5").update(key).digest("hex");
|
|
66851
|
+
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
66852
|
+
const filePath = path.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
66853
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
66854
|
+
} catch {
|
|
66855
|
+
return null;
|
|
66856
|
+
}
|
|
66857
|
+
},
|
|
66858
|
+
setItem: (key, value) => {
|
|
66859
|
+
try {
|
|
66860
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
66861
|
+
const hash = createHash("md5").update(key).digest("hex");
|
|
66862
|
+
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
66863
|
+
const filePath = path.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
66864
|
+
fs.writeFileSync(filePath, value);
|
|
66865
|
+
} catch {}
|
|
66866
|
+
}
|
|
66867
|
+
};
|
|
66868
|
+
}
|
|
66869
|
+
function getPlatformConfigWithCliDefaults(userConfig, options) {
|
|
66870
|
+
const basePlatformConfig = getPlatformConfig();
|
|
66871
|
+
const cacheDir = options?.projectDir ? path.join(options.projectDir, ".tscircuit", "cache") : undefined;
|
|
66872
|
+
const defaultConfig = {
|
|
66873
|
+
...basePlatformConfig,
|
|
66874
|
+
localCacheEngine: createLocalCacheEngine(cacheDir),
|
|
66875
|
+
footprintFileParserMap: {
|
|
66876
|
+
...basePlatformConfig.footprintFileParserMap,
|
|
66877
|
+
kicad_mod: {
|
|
66878
|
+
loadFromUrl: async (url) => {
|
|
66879
|
+
let fetchUrl = url;
|
|
66880
|
+
if (url.startsWith("./") || url.startsWith("../")) {
|
|
66881
|
+
const absolutePath = path.resolve(process.cwd(), url);
|
|
66882
|
+
fetchUrl = `file://${absolutePath}`;
|
|
66883
|
+
} else if (url.startsWith("/")) {
|
|
66884
|
+
if (fs.existsSync(url)) {
|
|
66885
|
+
fetchUrl = `file://${url}`;
|
|
66886
|
+
} else {
|
|
66887
|
+
const relativePath = `.${url}`;
|
|
66888
|
+
const absolutePath = path.resolve(process.cwd(), relativePath);
|
|
66889
|
+
if (fs.existsSync(absolutePath)) {
|
|
66890
|
+
fetchUrl = `file://${absolutePath}`;
|
|
66891
|
+
} else {
|
|
66892
|
+
fetchUrl = `file://${url}`;
|
|
66893
|
+
}
|
|
66894
|
+
}
|
|
66895
|
+
}
|
|
66896
|
+
return basePlatformConfig.footprintFileParserMap.kicad_mod.loadFromUrl(fetchUrl);
|
|
66897
|
+
}
|
|
66898
|
+
}
|
|
66899
|
+
}
|
|
66900
|
+
};
|
|
66901
|
+
if (!userConfig) {
|
|
66902
|
+
return defaultConfig;
|
|
66903
|
+
}
|
|
66904
|
+
const mergedConfig = {
|
|
66905
|
+
...defaultConfig,
|
|
66906
|
+
...userConfig,
|
|
66907
|
+
footprintFileParserMap: {
|
|
66908
|
+
...defaultConfig.footprintFileParserMap,
|
|
66909
|
+
...userConfig.footprintFileParserMap
|
|
66910
|
+
}
|
|
66911
|
+
};
|
|
66912
|
+
if (defaultConfig.staticFileLoaderMap || userConfig.staticFileLoaderMap) {
|
|
66913
|
+
mergedConfig.staticFileLoaderMap = {
|
|
66914
|
+
...defaultConfig.staticFileLoaderMap,
|
|
66915
|
+
...userConfig.staticFileLoaderMap
|
|
66916
|
+
};
|
|
66917
|
+
}
|
|
66918
|
+
return mergedConfig;
|
|
66919
|
+
}
|
|
66920
|
+
|
|
66841
66921
|
// node_modules/conf/dist/source/index.js
|
|
66842
66922
|
import { isDeepStrictEqual } from "node:util";
|
|
66843
66923
|
import process7 from "node:process";
|
|
66844
|
-
import
|
|
66845
|
-
import
|
|
66924
|
+
import fs3 from "node:fs";
|
|
66925
|
+
import path5 from "node:path";
|
|
66846
66926
|
import crypto2 from "node:crypto";
|
|
66847
66927
|
import assert from "node:assert";
|
|
66848
66928
|
|
|
@@ -66857,12 +66937,12 @@ var disallowedKeys = new Set([
|
|
|
66857
66937
|
"constructor"
|
|
66858
66938
|
]);
|
|
66859
66939
|
var digits = new Set("0123456789");
|
|
66860
|
-
function getPathSegments(
|
|
66940
|
+
function getPathSegments(path2) {
|
|
66861
66941
|
const parts = [];
|
|
66862
66942
|
let currentSegment = "";
|
|
66863
66943
|
let currentPart = "start";
|
|
66864
66944
|
let isIgnoring = false;
|
|
66865
|
-
for (const character of
|
|
66945
|
+
for (const character of path2) {
|
|
66866
66946
|
switch (character) {
|
|
66867
66947
|
case "\\": {
|
|
66868
66948
|
if (currentPart === "index") {
|
|
@@ -66984,11 +67064,11 @@ function assertNotStringIndex(object, key) {
|
|
|
66984
67064
|
throw new Error("Cannot use string index");
|
|
66985
67065
|
}
|
|
66986
67066
|
}
|
|
66987
|
-
function getProperty(object,
|
|
66988
|
-
if (!isObject(object) || typeof
|
|
67067
|
+
function getProperty(object, path2, value) {
|
|
67068
|
+
if (!isObject(object) || typeof path2 !== "string") {
|
|
66989
67069
|
return value === undefined ? object : value;
|
|
66990
67070
|
}
|
|
66991
|
-
const pathArray = getPathSegments(
|
|
67071
|
+
const pathArray = getPathSegments(path2);
|
|
66992
67072
|
if (pathArray.length === 0) {
|
|
66993
67073
|
return value;
|
|
66994
67074
|
}
|
|
@@ -67008,12 +67088,12 @@ function getProperty(object, path, value) {
|
|
|
67008
67088
|
}
|
|
67009
67089
|
return object === undefined ? value : object;
|
|
67010
67090
|
}
|
|
67011
|
-
function setProperty(object,
|
|
67012
|
-
if (!isObject(object) || typeof
|
|
67091
|
+
function setProperty(object, path2, value) {
|
|
67092
|
+
if (!isObject(object) || typeof path2 !== "string") {
|
|
67013
67093
|
return object;
|
|
67014
67094
|
}
|
|
67015
67095
|
const root = object;
|
|
67016
|
-
const pathArray = getPathSegments(
|
|
67096
|
+
const pathArray = getPathSegments(path2);
|
|
67017
67097
|
for (let index = 0;index < pathArray.length; index++) {
|
|
67018
67098
|
const key = pathArray[index];
|
|
67019
67099
|
assertNotStringIndex(object, key);
|
|
@@ -67026,11 +67106,11 @@ function setProperty(object, path, value) {
|
|
|
67026
67106
|
}
|
|
67027
67107
|
return root;
|
|
67028
67108
|
}
|
|
67029
|
-
function deleteProperty(object,
|
|
67030
|
-
if (!isObject(object) || typeof
|
|
67109
|
+
function deleteProperty(object, path2) {
|
|
67110
|
+
if (!isObject(object) || typeof path2 !== "string") {
|
|
67031
67111
|
return false;
|
|
67032
67112
|
}
|
|
67033
|
-
const pathArray = getPathSegments(
|
|
67113
|
+
const pathArray = getPathSegments(path2);
|
|
67034
67114
|
for (let index = 0;index < pathArray.length; index++) {
|
|
67035
67115
|
const key = pathArray[index];
|
|
67036
67116
|
assertNotStringIndex(object, key);
|
|
@@ -67044,11 +67124,11 @@ function deleteProperty(object, path) {
|
|
|
67044
67124
|
}
|
|
67045
67125
|
}
|
|
67046
67126
|
}
|
|
67047
|
-
function hasProperty(object,
|
|
67048
|
-
if (!isObject(object) || typeof
|
|
67127
|
+
function hasProperty(object, path2) {
|
|
67128
|
+
if (!isObject(object) || typeof path2 !== "string") {
|
|
67049
67129
|
return false;
|
|
67050
67130
|
}
|
|
67051
|
-
const pathArray = getPathSegments(
|
|
67131
|
+
const pathArray = getPathSegments(path2);
|
|
67052
67132
|
if (pathArray.length === 0) {
|
|
67053
67133
|
return false;
|
|
67054
67134
|
}
|
|
@@ -67062,41 +67142,41 @@ function hasProperty(object, path) {
|
|
|
67062
67142
|
}
|
|
67063
67143
|
|
|
67064
67144
|
// node_modules/env-paths/index.js
|
|
67065
|
-
import
|
|
67145
|
+
import path2 from "node:path";
|
|
67066
67146
|
import os from "node:os";
|
|
67067
67147
|
import process2 from "node:process";
|
|
67068
67148
|
var homedir = os.homedir();
|
|
67069
67149
|
var tmpdir = os.tmpdir();
|
|
67070
67150
|
var { env } = process2;
|
|
67071
67151
|
var macos = (name) => {
|
|
67072
|
-
const library =
|
|
67152
|
+
const library = path2.join(homedir, "Library");
|
|
67073
67153
|
return {
|
|
67074
|
-
data:
|
|
67075
|
-
config:
|
|
67076
|
-
cache:
|
|
67077
|
-
log:
|
|
67078
|
-
temp:
|
|
67154
|
+
data: path2.join(library, "Application Support", name),
|
|
67155
|
+
config: path2.join(library, "Preferences", name),
|
|
67156
|
+
cache: path2.join(library, "Caches", name),
|
|
67157
|
+
log: path2.join(library, "Logs", name),
|
|
67158
|
+
temp: path2.join(tmpdir, name)
|
|
67079
67159
|
};
|
|
67080
67160
|
};
|
|
67081
67161
|
var windows = (name) => {
|
|
67082
|
-
const appData = env.APPDATA ||
|
|
67083
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
67162
|
+
const appData = env.APPDATA || path2.join(homedir, "AppData", "Roaming");
|
|
67163
|
+
const localAppData = env.LOCALAPPDATA || path2.join(homedir, "AppData", "Local");
|
|
67084
67164
|
return {
|
|
67085
|
-
data:
|
|
67086
|
-
config:
|
|
67087
|
-
cache:
|
|
67088
|
-
log:
|
|
67089
|
-
temp:
|
|
67165
|
+
data: path2.join(localAppData, name, "Data"),
|
|
67166
|
+
config: path2.join(appData, name, "Config"),
|
|
67167
|
+
cache: path2.join(localAppData, name, "Cache"),
|
|
67168
|
+
log: path2.join(localAppData, name, "Log"),
|
|
67169
|
+
temp: path2.join(tmpdir, name)
|
|
67090
67170
|
};
|
|
67091
67171
|
};
|
|
67092
67172
|
var linux = (name) => {
|
|
67093
|
-
const username =
|
|
67173
|
+
const username = path2.basename(homedir);
|
|
67094
67174
|
return {
|
|
67095
|
-
data:
|
|
67096
|
-
config:
|
|
67097
|
-
cache:
|
|
67098
|
-
log:
|
|
67099
|
-
temp:
|
|
67175
|
+
data: path2.join(env.XDG_DATA_HOME || path2.join(homedir, ".local", "share"), name),
|
|
67176
|
+
config: path2.join(env.XDG_CONFIG_HOME || path2.join(homedir, ".config"), name),
|
|
67177
|
+
cache: path2.join(env.XDG_CACHE_HOME || path2.join(homedir, ".cache"), name),
|
|
67178
|
+
log: path2.join(env.XDG_STATE_HOME || path2.join(homedir, ".local", "state"), name),
|
|
67179
|
+
temp: path2.join(tmpdir, username, name)
|
|
67100
67180
|
};
|
|
67101
67181
|
};
|
|
67102
67182
|
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
@@ -67116,10 +67196,10 @@ function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
|
67116
67196
|
}
|
|
67117
67197
|
|
|
67118
67198
|
// node_modules/atomically/dist/index.js
|
|
67119
|
-
import
|
|
67199
|
+
import path4 from "node:path";
|
|
67120
67200
|
|
|
67121
67201
|
// node_modules/stubborn-fs/dist/index.js
|
|
67122
|
-
import
|
|
67202
|
+
import fs2 from "node:fs";
|
|
67123
67203
|
import { promisify } from "node:util";
|
|
67124
67204
|
|
|
67125
67205
|
// node_modules/stubborn-utils/dist/attemptify_async.js
|
|
@@ -67249,41 +67329,41 @@ var RETRYIFY_OPTIONS = {
|
|
|
67249
67329
|
// node_modules/stubborn-fs/dist/index.js
|
|
67250
67330
|
var FS = {
|
|
67251
67331
|
attempt: {
|
|
67252
|
-
chmod: attemptify_async_default(promisify(
|
|
67253
|
-
chown: attemptify_async_default(promisify(
|
|
67254
|
-
close: attemptify_async_default(promisify(
|
|
67255
|
-
fsync: attemptify_async_default(promisify(
|
|
67256
|
-
mkdir: attemptify_async_default(promisify(
|
|
67257
|
-
realpath: attemptify_async_default(promisify(
|
|
67258
|
-
stat: attemptify_async_default(promisify(
|
|
67259
|
-
unlink: attemptify_async_default(promisify(
|
|
67260
|
-
chmodSync: attemptify_sync_default(
|
|
67261
|
-
chownSync: attemptify_sync_default(
|
|
67262
|
-
closeSync: attemptify_sync_default(
|
|
67263
|
-
existsSync: attemptify_sync_default(
|
|
67264
|
-
fsyncSync: attemptify_sync_default(
|
|
67265
|
-
mkdirSync: attemptify_sync_default(
|
|
67266
|
-
realpathSync: attemptify_sync_default(
|
|
67267
|
-
statSync: attemptify_sync_default(
|
|
67268
|
-
unlinkSync: attemptify_sync_default(
|
|
67332
|
+
chmod: attemptify_async_default(promisify(fs2.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
67333
|
+
chown: attemptify_async_default(promisify(fs2.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
67334
|
+
close: attemptify_async_default(promisify(fs2.close), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67335
|
+
fsync: attemptify_async_default(promisify(fs2.fsync), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67336
|
+
mkdir: attemptify_async_default(promisify(fs2.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67337
|
+
realpath: attemptify_async_default(promisify(fs2.realpath), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67338
|
+
stat: attemptify_async_default(promisify(fs2.stat), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67339
|
+
unlink: attemptify_async_default(promisify(fs2.unlink), ATTEMPTIFY_NOOP_OPTIONS),
|
|
67340
|
+
chmodSync: attemptify_sync_default(fs2.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
67341
|
+
chownSync: attemptify_sync_default(fs2.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
|
|
67342
|
+
closeSync: attemptify_sync_default(fs2.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67343
|
+
existsSync: attemptify_sync_default(fs2.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67344
|
+
fsyncSync: attemptify_sync_default(fs2.fsync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67345
|
+
mkdirSync: attemptify_sync_default(fs2.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67346
|
+
realpathSync: attemptify_sync_default(fs2.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67347
|
+
statSync: attemptify_sync_default(fs2.statSync, ATTEMPTIFY_NOOP_OPTIONS),
|
|
67348
|
+
unlinkSync: attemptify_sync_default(fs2.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
|
|
67269
67349
|
},
|
|
67270
67350
|
retry: {
|
|
67271
|
-
close: retryify_async_default(promisify(
|
|
67272
|
-
fsync: retryify_async_default(promisify(
|
|
67273
|
-
open: retryify_async_default(promisify(
|
|
67274
|
-
readFile: retryify_async_default(promisify(
|
|
67275
|
-
rename: retryify_async_default(promisify(
|
|
67276
|
-
stat: retryify_async_default(promisify(
|
|
67277
|
-
write: retryify_async_default(promisify(
|
|
67278
|
-
writeFile: retryify_async_default(promisify(
|
|
67279
|
-
closeSync: retryify_sync_default(
|
|
67280
|
-
fsyncSync: retryify_sync_default(
|
|
67281
|
-
openSync: retryify_sync_default(
|
|
67282
|
-
readFileSync: retryify_sync_default(
|
|
67283
|
-
renameSync: retryify_sync_default(
|
|
67284
|
-
statSync: retryify_sync_default(
|
|
67285
|
-
writeSync: retryify_sync_default(
|
|
67286
|
-
writeFileSync: retryify_sync_default(
|
|
67351
|
+
close: retryify_async_default(promisify(fs2.close), RETRYIFY_OPTIONS),
|
|
67352
|
+
fsync: retryify_async_default(promisify(fs2.fsync), RETRYIFY_OPTIONS),
|
|
67353
|
+
open: retryify_async_default(promisify(fs2.open), RETRYIFY_OPTIONS),
|
|
67354
|
+
readFile: retryify_async_default(promisify(fs2.readFile), RETRYIFY_OPTIONS),
|
|
67355
|
+
rename: retryify_async_default(promisify(fs2.rename), RETRYIFY_OPTIONS),
|
|
67356
|
+
stat: retryify_async_default(promisify(fs2.stat), RETRYIFY_OPTIONS),
|
|
67357
|
+
write: retryify_async_default(promisify(fs2.write), RETRYIFY_OPTIONS),
|
|
67358
|
+
writeFile: retryify_async_default(promisify(fs2.writeFile), RETRYIFY_OPTIONS),
|
|
67359
|
+
closeSync: retryify_sync_default(fs2.closeSync, RETRYIFY_OPTIONS),
|
|
67360
|
+
fsyncSync: retryify_sync_default(fs2.fsyncSync, RETRYIFY_OPTIONS),
|
|
67361
|
+
openSync: retryify_sync_default(fs2.openSync, RETRYIFY_OPTIONS),
|
|
67362
|
+
readFileSync: retryify_sync_default(fs2.readFileSync, RETRYIFY_OPTIONS),
|
|
67363
|
+
renameSync: retryify_sync_default(fs2.renameSync, RETRYIFY_OPTIONS),
|
|
67364
|
+
statSync: retryify_sync_default(fs2.statSync, RETRYIFY_OPTIONS),
|
|
67365
|
+
writeSync: retryify_sync_default(fs2.writeSync, RETRYIFY_OPTIONS),
|
|
67366
|
+
writeFileSync: retryify_sync_default(fs2.writeFileSync, RETRYIFY_OPTIONS)
|
|
67287
67367
|
}
|
|
67288
67368
|
};
|
|
67289
67369
|
var dist_default = FS;
|
|
@@ -67313,7 +67393,7 @@ var isUndefined = (value) => {
|
|
|
67313
67393
|
};
|
|
67314
67394
|
|
|
67315
67395
|
// node_modules/atomically/dist/utils/temp.js
|
|
67316
|
-
import
|
|
67396
|
+
import path3 from "node:path";
|
|
67317
67397
|
|
|
67318
67398
|
// node_modules/when-exit/dist/node/interceptor.js
|
|
67319
67399
|
import process6 from "node:process";
|
|
@@ -67413,7 +67493,7 @@ var Temp = {
|
|
|
67413
67493
|
}
|
|
67414
67494
|
},
|
|
67415
67495
|
truncate: (filePath) => {
|
|
67416
|
-
const basename =
|
|
67496
|
+
const basename = path3.basename(filePath);
|
|
67417
67497
|
if (basename.length <= LIMIT_BASENAME_LENGTH)
|
|
67418
67498
|
return filePath;
|
|
67419
67499
|
const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
|
|
@@ -67455,7 +67535,7 @@ function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
|
67455
67535
|
}
|
|
67456
67536
|
}
|
|
67457
67537
|
if (!filePathExists) {
|
|
67458
|
-
const parentPath =
|
|
67538
|
+
const parentPath = path4.dirname(filePath);
|
|
67459
67539
|
dist_default.attempt.mkdirSync(parentPath, {
|
|
67460
67540
|
mode: DEFAULT_FOLDER_MODE,
|
|
67461
67541
|
recursive: true
|
|
@@ -67771,7 +67851,7 @@ class Conf {
|
|
|
67771
67851
|
this.events = new EventTarget;
|
|
67772
67852
|
this.#encryptionKey = options.encryptionKey;
|
|
67773
67853
|
const fileExtension = options.fileExtension ? `.${options.fileExtension}` : "";
|
|
67774
|
-
this.path =
|
|
67854
|
+
this.path = path5.resolve(options.cwd, `${options.configName ?? "config"}${fileExtension}`);
|
|
67775
67855
|
const fileStore = this.store;
|
|
67776
67856
|
const store = Object.assign(createPlainObject(), options.defaults, fileStore);
|
|
67777
67857
|
if (options.migrations) {
|
|
@@ -67874,7 +67954,7 @@ class Conf {
|
|
|
67874
67954
|
}
|
|
67875
67955
|
get store() {
|
|
67876
67956
|
try {
|
|
67877
|
-
const data =
|
|
67957
|
+
const data = fs3.readFileSync(this.path, this.#encryptionKey ? null : "utf8");
|
|
67878
67958
|
const dataString = this._encryptData(data);
|
|
67879
67959
|
const deserializedData = this._deserialize(dataString);
|
|
67880
67960
|
this._validate(deserializedData);
|
|
@@ -67945,7 +68025,7 @@ class Conf {
|
|
|
67945
68025
|
throw new Error("Config schema violation: " + errors.join("; "));
|
|
67946
68026
|
}
|
|
67947
68027
|
_ensureDirectory() {
|
|
67948
|
-
|
|
68028
|
+
fs3.mkdirSync(path5.dirname(this.path), { recursive: true });
|
|
67949
68029
|
}
|
|
67950
68030
|
_write(value) {
|
|
67951
68031
|
let data = this._serialize(value);
|
|
@@ -67956,13 +68036,13 @@ class Conf {
|
|
|
67956
68036
|
data = concatUint8Arrays([initializationVector, stringToUint8Array(":"), cipher.update(stringToUint8Array(data)), cipher.final()]);
|
|
67957
68037
|
}
|
|
67958
68038
|
if (process7.env.SNAP) {
|
|
67959
|
-
|
|
68039
|
+
fs3.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
67960
68040
|
} else {
|
|
67961
68041
|
try {
|
|
67962
68042
|
writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
67963
68043
|
} catch (error) {
|
|
67964
68044
|
if (error?.code === "EXDEV") {
|
|
67965
|
-
|
|
68045
|
+
fs3.writeFileSync(this.path, data, { mode: this.#options.configFileMode });
|
|
67966
68046
|
return;
|
|
67967
68047
|
}
|
|
67968
68048
|
throw error;
|
|
@@ -67971,15 +68051,15 @@ class Conf {
|
|
|
67971
68051
|
}
|
|
67972
68052
|
_watch() {
|
|
67973
68053
|
this._ensureDirectory();
|
|
67974
|
-
if (!
|
|
68054
|
+
if (!fs3.existsSync(this.path)) {
|
|
67975
68055
|
this._write(createPlainObject());
|
|
67976
68056
|
}
|
|
67977
68057
|
if (process7.platform === "win32") {
|
|
67978
|
-
|
|
68058
|
+
fs3.watch(this.path, { persistent: false }, debounce_fn_default(() => {
|
|
67979
68059
|
this.events.dispatchEvent(new Event("change"));
|
|
67980
68060
|
}, { wait: 100 }));
|
|
67981
68061
|
} else {
|
|
67982
|
-
|
|
68062
|
+
fs3.watchFile(this.path, { persistent: false }, debounce_fn_default(() => {
|
|
67983
68063
|
this.events.dispatchEvent(new Event("change"));
|
|
67984
68064
|
}, { wait: 5000 }));
|
|
67985
68065
|
}
|
|
@@ -68115,14 +68195,14 @@ function jwtDecode(token, options) {
|
|
|
68115
68195
|
}
|
|
68116
68196
|
|
|
68117
68197
|
// lib/cli-config/index.ts
|
|
68118
|
-
import
|
|
68198
|
+
import fs5 from "node:fs";
|
|
68119
68199
|
import os3 from "node:os";
|
|
68120
|
-
import
|
|
68200
|
+
import path7 from "node:path";
|
|
68121
68201
|
|
|
68122
68202
|
// lib/shared/handle-registry-auth-error.ts
|
|
68123
|
-
import
|
|
68203
|
+
import fs4 from "node:fs";
|
|
68124
68204
|
import os2 from "node:os";
|
|
68125
|
-
import
|
|
68205
|
+
import path6 from "node:path";
|
|
68126
68206
|
|
|
68127
68207
|
// node_modules/kleur/index.mjs
|
|
68128
68208
|
var FORCE_COLOR;
|
|
@@ -68242,9 +68322,9 @@ function isUnauthorizedError(error) {
|
|
|
68242
68322
|
return /\b(401|E401)\b/i.test(output) || /unauthorized/i.test(output);
|
|
68243
68323
|
}
|
|
68244
68324
|
function hasTsciAuthToken(npmrcPath) {
|
|
68245
|
-
if (!
|
|
68325
|
+
if (!fs4.existsSync(npmrcPath))
|
|
68246
68326
|
return false;
|
|
68247
|
-
const content =
|
|
68327
|
+
const content = fs4.readFileSync(npmrcPath, "utf-8");
|
|
68248
68328
|
return AUTH_TOKEN_REGEX.test(content);
|
|
68249
68329
|
}
|
|
68250
68330
|
function handleRegistryAuthError({
|
|
@@ -68254,8 +68334,8 @@ function handleRegistryAuthError({
|
|
|
68254
68334
|
if (!isUnauthorizedError(error))
|
|
68255
68335
|
return;
|
|
68256
68336
|
const npmrcPaths = [
|
|
68257
|
-
|
|
68258
|
-
|
|
68337
|
+
path6.join(projectDir, ".npmrc"),
|
|
68338
|
+
path6.join(os2.homedir(), ".npmrc")
|
|
68259
68339
|
];
|
|
68260
68340
|
const hasToken = npmrcPaths.some(hasTsciAuthToken);
|
|
68261
68341
|
if (hasToken) {
|
|
@@ -68278,13 +68358,13 @@ var getSessionToken = () => {
|
|
|
68278
68358
|
};
|
|
68279
68359
|
var getSessionTokenFromNpmrc = () => {
|
|
68280
68360
|
const npmrcPaths = [
|
|
68281
|
-
|
|
68282
|
-
|
|
68361
|
+
path7.join(process.cwd(), ".npmrc"),
|
|
68362
|
+
path7.join(os3.homedir(), ".npmrc")
|
|
68283
68363
|
];
|
|
68284
68364
|
for (const npmrcPath of npmrcPaths) {
|
|
68285
|
-
if (!
|
|
68365
|
+
if (!fs5.existsSync(npmrcPath))
|
|
68286
68366
|
continue;
|
|
68287
|
-
const content =
|
|
68367
|
+
const content = fs5.readFileSync(npmrcPath, "utf-8");
|
|
68288
68368
|
const match = content.match(AUTH_TOKEN_REGEX);
|
|
68289
68369
|
if (match?.[1]) {
|
|
68290
68370
|
return match[1].trim();
|
|
@@ -69579,13 +69659,13 @@ function buildSymbolDataFromSchematicPrimitives(params2) {
|
|
|
69579
69659
|
]
|
|
69580
69660
|
});
|
|
69581
69661
|
}
|
|
69582
|
-
for (const
|
|
69583
|
-
if (
|
|
69662
|
+
for (const path8 of paths) {
|
|
69663
|
+
if (path8.points && path8.points.length > 0) {
|
|
69584
69664
|
primitives2.push({
|
|
69585
69665
|
type: "path",
|
|
69586
|
-
points:
|
|
69587
|
-
fill:
|
|
69588
|
-
fillColor:
|
|
69666
|
+
points: path8.points,
|
|
69667
|
+
fill: path8.is_filled ?? false,
|
|
69668
|
+
fillColor: path8.fill_color
|
|
69589
69669
|
});
|
|
69590
69670
|
}
|
|
69591
69671
|
}
|
|
@@ -70454,10 +70534,10 @@ var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
|
70454
70534
|
const instances = new SymbolInstances;
|
|
70455
70535
|
const project = new SymbolInstancesProject("");
|
|
70456
70536
|
const instancePathPrefix = this.ctx.symbolInstancePathPrefix ?? `/${kicadSch?.uuid?.value || ""}`;
|
|
70457
|
-
const
|
|
70458
|
-
|
|
70459
|
-
|
|
70460
|
-
project.paths.push(
|
|
70537
|
+
const path8 = new SymbolInstancePath(instancePathPrefix);
|
|
70538
|
+
path8.reference = labelText;
|
|
70539
|
+
path8.unit = 1;
|
|
70540
|
+
project.paths.push(path8);
|
|
70461
70541
|
instances.projects.push(project);
|
|
70462
70542
|
symbol._sxInstances = instances;
|
|
70463
70543
|
return symbol;
|
|
@@ -70702,10 +70782,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
70702
70782
|
const instances = new SymbolInstances2;
|
|
70703
70783
|
const project = new SymbolInstancesProject2("");
|
|
70704
70784
|
const instancePathPrefix = this.ctx.symbolInstancePathPrefix ?? `/${kicadSch?.uuid?.value || ""}`;
|
|
70705
|
-
const
|
|
70706
|
-
|
|
70707
|
-
|
|
70708
|
-
project.paths.push(
|
|
70785
|
+
const path8 = new SymbolInstancePath2(instancePathPrefix);
|
|
70786
|
+
path8.reference = reference;
|
|
70787
|
+
path8.unit = 1;
|
|
70788
|
+
project.paths.push(path8);
|
|
70709
70789
|
instances.projects.push(project);
|
|
70710
70790
|
symbol._sxInstances = instances;
|
|
70711
70791
|
symbols4.push(symbol);
|
|
@@ -70974,11 +71054,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
70974
71054
|
throw new Error("KicadSch instance not initialized in context");
|
|
70975
71055
|
}
|
|
70976
71056
|
const sheetInstances = new SheetInstances;
|
|
70977
|
-
const
|
|
70978
|
-
|
|
71057
|
+
const path8 = new SheetInstancesRootPath;
|
|
71058
|
+
path8.value = "/";
|
|
70979
71059
|
const page = new SheetInstancesRootPage("1");
|
|
70980
|
-
|
|
70981
|
-
sheetInstances.paths = [
|
|
71060
|
+
path8.pages = [page];
|
|
71061
|
+
sheetInstances.paths = [path8];
|
|
70982
71062
|
kicadSch.sheetInstances = sheetInstances;
|
|
70983
71063
|
kicadSch.embeddedFonts = new EmbeddedFonts3(false);
|
|
70984
71064
|
this.finished = true;
|
|
@@ -72200,17 +72280,17 @@ function convertSilkscreenTexts(params2) {
|
|
|
72200
72280
|
function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRotation = 0 }) {
|
|
72201
72281
|
const fpLines = [];
|
|
72202
72282
|
const rotationMatrix = componentRotation !== 0 ? rotate4(componentRotation * Math.PI / 180) : identity2();
|
|
72203
|
-
for (const
|
|
72204
|
-
if (!
|
|
72283
|
+
for (const path8 of silkscreenPaths) {
|
|
72284
|
+
if (!path8.route || path8.route.length < 2)
|
|
72205
72285
|
continue;
|
|
72206
72286
|
const layerMap = {
|
|
72207
72287
|
top: "F.SilkS",
|
|
72208
72288
|
bottom: "B.SilkS"
|
|
72209
72289
|
};
|
|
72210
|
-
const kicadLayer = layerMap[
|
|
72211
|
-
for (let i = 0;i <
|
|
72212
|
-
const startPoint =
|
|
72213
|
-
const endPoint =
|
|
72290
|
+
const kicadLayer = layerMap[path8.layer] || path8.layer || "F.SilkS";
|
|
72291
|
+
for (let i = 0;i < path8.route.length - 1; i++) {
|
|
72292
|
+
const startPoint = path8.route[i];
|
|
72293
|
+
const endPoint = path8.route[i + 1];
|
|
72214
72294
|
if (!startPoint || !endPoint)
|
|
72215
72295
|
continue;
|
|
72216
72296
|
const startRelative = applyToPoint12(rotationMatrix, {
|
|
@@ -72228,7 +72308,7 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
|
|
|
72228
72308
|
stroke: new Stroke12
|
|
72229
72309
|
});
|
|
72230
72310
|
if (fpLine.stroke) {
|
|
72231
|
-
fpLine.stroke.width =
|
|
72311
|
+
fpLine.stroke.width = path8.stroke_width || 0.15;
|
|
72232
72312
|
fpLine.stroke.type = "default";
|
|
72233
72313
|
}
|
|
72234
72314
|
fpLines.push(fpLine);
|
|
@@ -72721,7 +72801,7 @@ var AddFootprintsStage = class extends ConverterStage {
|
|
|
72721
72801
|
componentRotation: component.rotation || 0
|
|
72722
72802
|
}));
|
|
72723
72803
|
footprint.fpTexts = fpTexts;
|
|
72724
|
-
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((
|
|
72804
|
+
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((path8) => path8.pcb_component_id === component.pcb_component_id) || [];
|
|
72725
72805
|
const fpLines = footprint.fpLines ?? [];
|
|
72726
72806
|
fpLines.push(...convertSilkscreenPaths(pcbSilkscreenPaths, {
|
|
72727
72807
|
componentCenter: component.center,
|
|
@@ -73438,13 +73518,13 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
73438
73518
|
if (!c2kMatPcb) {
|
|
73439
73519
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
73440
73520
|
}
|
|
73441
|
-
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((
|
|
73442
|
-
for (const
|
|
73443
|
-
if (!
|
|
73521
|
+
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list().filter((path8) => !path8.pcb_component_id) || [];
|
|
73522
|
+
for (const path8 of pcbSilkscreenPaths) {
|
|
73523
|
+
if (!path8.route || path8.route.length < 2)
|
|
73444
73524
|
continue;
|
|
73445
|
-
for (let i = 0;i <
|
|
73446
|
-
const startPoint =
|
|
73447
|
-
const endPoint =
|
|
73525
|
+
for (let i = 0;i < path8.route.length - 1; i++) {
|
|
73526
|
+
const startPoint = path8.route[i];
|
|
73527
|
+
const endPoint = path8.route[i + 1];
|
|
73448
73528
|
if (!startPoint || !endPoint)
|
|
73449
73529
|
continue;
|
|
73450
73530
|
const transformedStart = applyToPoint23(c2kMatPcb, {
|
|
@@ -73459,12 +73539,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
73459
73539
|
top: "F.SilkS",
|
|
73460
73540
|
bottom: "B.SilkS"
|
|
73461
73541
|
};
|
|
73462
|
-
const kicadLayer = layerMap[
|
|
73542
|
+
const kicadLayer = layerMap[path8.layer] || path8.layer || "F.SilkS";
|
|
73463
73543
|
const grLine = new GrLine({
|
|
73464
73544
|
start: { x: transformedStart.x, y: transformedStart.y },
|
|
73465
73545
|
end: { x: transformedEnd.x, y: transformedEnd.y },
|
|
73466
73546
|
layer: kicadLayer,
|
|
73467
|
-
width:
|
|
73547
|
+
width: path8.stroke_width || 0.15
|
|
73468
73548
|
});
|
|
73469
73549
|
appendGraphicLine(kicadPcb, grLine);
|
|
73470
73550
|
}
|
|
@@ -74784,9 +74864,9 @@ var KicadLibraryConverter = class {
|
|
|
74784
74864
|
});
|
|
74785
74865
|
libConverter.runUntilFinished();
|
|
74786
74866
|
const libOutput = libConverter.getOutput();
|
|
74787
|
-
for (const
|
|
74788
|
-
if (!this.ctx.model3dSourcePaths.includes(
|
|
74789
|
-
this.ctx.model3dSourcePaths.push(
|
|
74867
|
+
for (const path8 of libOutput.model3dSourcePaths) {
|
|
74868
|
+
if (!this.ctx.model3dSourcePaths.includes(path8)) {
|
|
74869
|
+
this.ctx.model3dSourcePaths.push(path8);
|
|
74790
74870
|
}
|
|
74791
74871
|
}
|
|
74792
74872
|
extractedKicadComponents.push({
|
|
@@ -74828,12 +74908,12 @@ function deriveComponentNameFromPath(filePath) {
|
|
|
74828
74908
|
|
|
74829
74909
|
// lib/shared/importFromUserLand.ts
|
|
74830
74910
|
import { createRequire as createRequire2 } from "node:module";
|
|
74831
|
-
import
|
|
74832
|
-
import
|
|
74911
|
+
import fs6 from "node:fs";
|
|
74912
|
+
import path8 from "node:path";
|
|
74833
74913
|
async function importFromUserLand(moduleName) {
|
|
74834
|
-
const userModulePath =
|
|
74835
|
-
if (
|
|
74836
|
-
const userRequire = createRequire2(
|
|
74914
|
+
const userModulePath = path8.join(process.cwd(), "node_modules", moduleName);
|
|
74915
|
+
if (fs6.existsSync(userModulePath)) {
|
|
74916
|
+
const userRequire = createRequire2(path8.join(process.cwd(), "noop.js"));
|
|
74837
74917
|
try {
|
|
74838
74918
|
const resolvedUserPath = userRequire.resolve(moduleName);
|
|
74839
74919
|
return await import(resolvedUserPath);
|
|
@@ -74855,85 +74935,6 @@ async function importFromUserLand(moduleName) {
|
|
|
74855
74935
|
return import(moduleName);
|
|
74856
74936
|
}
|
|
74857
74937
|
|
|
74858
|
-
// lib/shared/get-platform-config-with-cli-defaults.ts
|
|
74859
|
-
import { createHash } from "node:crypto";
|
|
74860
|
-
import fs6 from "node:fs";
|
|
74861
|
-
import path8 from "node:path";
|
|
74862
|
-
import { getPlatformConfig } from "@tscircuit/eval/platform-config";
|
|
74863
|
-
function createLocalCacheEngine(cacheDir = path8.join(process.cwd(), ".tscircuit", "cache")) {
|
|
74864
|
-
return {
|
|
74865
|
-
getItem: (key) => {
|
|
74866
|
-
try {
|
|
74867
|
-
const hash = createHash("md5").update(key).digest("hex");
|
|
74868
|
-
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
74869
|
-
const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
74870
|
-
return fs6.readFileSync(filePath, "utf-8");
|
|
74871
|
-
} catch {
|
|
74872
|
-
return null;
|
|
74873
|
-
}
|
|
74874
|
-
},
|
|
74875
|
-
setItem: (key, value) => {
|
|
74876
|
-
try {
|
|
74877
|
-
fs6.mkdirSync(cacheDir, { recursive: true });
|
|
74878
|
-
const hash = createHash("md5").update(key).digest("hex");
|
|
74879
|
-
const keyWithSafeCharacters = key.replace(/[^a-zA-Z0-9]/g, "_");
|
|
74880
|
-
const filePath = path8.join(cacheDir, `${keyWithSafeCharacters.slice(keyWithSafeCharacters.length - 10, keyWithSafeCharacters.length)}-${hash}.json`);
|
|
74881
|
-
fs6.writeFileSync(filePath, value);
|
|
74882
|
-
} catch {}
|
|
74883
|
-
}
|
|
74884
|
-
};
|
|
74885
|
-
}
|
|
74886
|
-
function getPlatformConfigWithCliDefaults(userConfig) {
|
|
74887
|
-
const basePlatformConfig = getPlatformConfig();
|
|
74888
|
-
const defaultConfig = {
|
|
74889
|
-
...basePlatformConfig,
|
|
74890
|
-
localCacheEngine: createLocalCacheEngine(),
|
|
74891
|
-
footprintFileParserMap: {
|
|
74892
|
-
...basePlatformConfig.footprintFileParserMap,
|
|
74893
|
-
kicad_mod: {
|
|
74894
|
-
loadFromUrl: async (url) => {
|
|
74895
|
-
let fetchUrl = url;
|
|
74896
|
-
if (url.startsWith("./") || url.startsWith("../")) {
|
|
74897
|
-
const absolutePath = path8.resolve(process.cwd(), url);
|
|
74898
|
-
fetchUrl = `file://${absolutePath}`;
|
|
74899
|
-
} else if (url.startsWith("/")) {
|
|
74900
|
-
if (fs6.existsSync(url)) {
|
|
74901
|
-
fetchUrl = `file://${url}`;
|
|
74902
|
-
} else {
|
|
74903
|
-
const relativePath = `.${url}`;
|
|
74904
|
-
const absolutePath = path8.resolve(process.cwd(), relativePath);
|
|
74905
|
-
if (fs6.existsSync(absolutePath)) {
|
|
74906
|
-
fetchUrl = `file://${absolutePath}`;
|
|
74907
|
-
} else {
|
|
74908
|
-
fetchUrl = `file://${url}`;
|
|
74909
|
-
}
|
|
74910
|
-
}
|
|
74911
|
-
}
|
|
74912
|
-
return basePlatformConfig.footprintFileParserMap.kicad_mod.loadFromUrl(fetchUrl);
|
|
74913
|
-
}
|
|
74914
|
-
}
|
|
74915
|
-
}
|
|
74916
|
-
};
|
|
74917
|
-
if (!userConfig) {
|
|
74918
|
-
return defaultConfig;
|
|
74919
|
-
}
|
|
74920
|
-
const mergedConfig = {
|
|
74921
|
-
...defaultConfig,
|
|
74922
|
-
...userConfig,
|
|
74923
|
-
footprintFileParserMap: {
|
|
74924
|
-
...defaultConfig.footprintFileParserMap,
|
|
74925
|
-
...userConfig.footprintFileParserMap
|
|
74926
|
-
}
|
|
74927
|
-
};
|
|
74928
|
-
if (defaultConfig.staticFileLoaderMap || userConfig.staticFileLoaderMap) {
|
|
74929
|
-
mergedConfig.staticFileLoaderMap = {
|
|
74930
|
-
...defaultConfig.staticFileLoaderMap,
|
|
74931
|
-
...userConfig.staticFileLoaderMap
|
|
74932
|
-
};
|
|
74933
|
-
}
|
|
74934
|
-
return mergedConfig;
|
|
74935
|
-
}
|
|
74936
|
-
|
|
74937
74938
|
// lib/shared/convert-to-kicad-library.tsx
|
|
74938
74939
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
74939
74940
|
async function convertToKicadLibrary({
|
|
@@ -76189,17 +76190,25 @@ Rebuilding KiCad PCM assets...`));
|
|
|
76189
76190
|
};
|
|
76190
76191
|
|
|
76191
76192
|
// lib/server/createHttpServer.ts
|
|
76193
|
+
var RUNFRAME_CACHE_PATH = "/api/cache";
|
|
76192
76194
|
var resolveLocalTscircuitStandalonePath = (projectDir) => {
|
|
76193
76195
|
if (!projectDir)
|
|
76194
76196
|
return;
|
|
76195
76197
|
try {
|
|
76196
76198
|
const projectRequire = createRequire3(path16.join(projectDir, "package.json"));
|
|
76197
|
-
const browserBundlePath =
|
|
76199
|
+
const browserBundlePath = projectRequire.resolve("tscircuit/browser");
|
|
76198
76200
|
if (fs16.existsSync(browserBundlePath))
|
|
76199
76201
|
return browserBundlePath;
|
|
76200
76202
|
} catch {}
|
|
76201
76203
|
return;
|
|
76202
76204
|
};
|
|
76205
|
+
var readRequestBody = async (req) => {
|
|
76206
|
+
const chunks = [];
|
|
76207
|
+
for await (const chunk of req) {
|
|
76208
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
76209
|
+
}
|
|
76210
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
76211
|
+
};
|
|
76203
76212
|
var createHttpServer = async ({
|
|
76204
76213
|
port = 3020,
|
|
76205
76214
|
defaultMainComponentPath,
|
|
@@ -76208,10 +76217,42 @@ var createHttpServer = async ({
|
|
|
76208
76217
|
entryFile
|
|
76209
76218
|
}) => {
|
|
76210
76219
|
const fileServerHandler = getNodeHandler(stdin_default, {});
|
|
76220
|
+
const localCacheEngine = projectDir ? createLocalCacheEngine(path16.join(projectDir, ".tscircuit", "cache")) : undefined;
|
|
76211
76221
|
const pcmProxy = kicadPcm && projectDir && entryFile ? createKicadPcmProxy({ projectDir, entryFile, port }) : null;
|
|
76212
76222
|
const server = http.createServer(async (req, res) => {
|
|
76213
76223
|
const requestHost = req.headers.host ?? `localhost:${port}`;
|
|
76214
76224
|
const url = new URL(req.url, `http://${requestHost}`);
|
|
76225
|
+
if (url.pathname === RUNFRAME_CACHE_PATH) {
|
|
76226
|
+
const key = url.searchParams.get("key");
|
|
76227
|
+
if (!localCacheEngine || !key) {
|
|
76228
|
+
res.writeHead(400, { "Content-Type": "text/plain; charset=utf-8" });
|
|
76229
|
+
res.end("A project directory and cache key are required");
|
|
76230
|
+
return;
|
|
76231
|
+
}
|
|
76232
|
+
if (req.method === "GET") {
|
|
76233
|
+
const value = await localCacheEngine.getItem(key);
|
|
76234
|
+
if (value === null) {
|
|
76235
|
+
res.writeHead(404);
|
|
76236
|
+
res.end();
|
|
76237
|
+
return;
|
|
76238
|
+
}
|
|
76239
|
+
res.writeHead(200, {
|
|
76240
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
76241
|
+
"Cache-Control": "no-store"
|
|
76242
|
+
});
|
|
76243
|
+
res.end(value);
|
|
76244
|
+
return;
|
|
76245
|
+
}
|
|
76246
|
+
if (req.method === "POST") {
|
|
76247
|
+
await localCacheEngine.setItem(key, await readRequestBody(req));
|
|
76248
|
+
res.writeHead(204);
|
|
76249
|
+
res.end();
|
|
76250
|
+
return;
|
|
76251
|
+
}
|
|
76252
|
+
res.writeHead(405, { Allow: "GET, POST" });
|
|
76253
|
+
res.end();
|
|
76254
|
+
return;
|
|
76255
|
+
}
|
|
76215
76256
|
if (url.pathname === "/api/files/upsert-multipart" && req.method === "POST") {
|
|
76216
76257
|
try {
|
|
76217
76258
|
const request = new Request(url.toString(), {
|
|
@@ -77045,9 +77086,9 @@ class NodeFsHandler {
|
|
|
77045
77086
|
if (this.fsw.closed) {
|
|
77046
77087
|
return;
|
|
77047
77088
|
}
|
|
77048
|
-
const
|
|
77089
|
+
const dirname2 = sysPath.dirname(file);
|
|
77049
77090
|
const basename2 = sysPath.basename(file);
|
|
77050
|
-
const parent = this.fsw._getWatchedDir(
|
|
77091
|
+
const parent = this.fsw._getWatchedDir(dirname2);
|
|
77051
77092
|
let prevStats = stats;
|
|
77052
77093
|
if (parent.has(basename2))
|
|
77053
77094
|
return;
|
|
@@ -77074,7 +77115,7 @@ class NodeFsHandler {
|
|
|
77074
77115
|
prevStats = newStats2;
|
|
77075
77116
|
}
|
|
77076
77117
|
} catch (error) {
|
|
77077
|
-
this.fsw._remove(
|
|
77118
|
+
this.fsw._remove(dirname2, basename2);
|
|
77078
77119
|
}
|
|
77079
77120
|
} else if (parent.has(basename2)) {
|
|
77080
77121
|
const at = newStats.atimeMs;
|