@tscircuit/cli 0.1.464 → 0.1.465
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/main.js +25 -24
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -72198,7 +72198,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72198
72198
|
import { execSync as execSync2 } from "node:child_process";
|
|
72199
72199
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72200
72200
|
// package.json
|
|
72201
|
-
var version = "0.1.
|
|
72201
|
+
var version = "0.1.464";
|
|
72202
72202
|
var package_default = {
|
|
72203
72203
|
name: "@tscircuit/cli",
|
|
72204
72204
|
version,
|
|
@@ -93893,9 +93893,9 @@ var import_jszip2 = __toESM2(require_lib4(), 1);
|
|
|
93893
93893
|
|
|
93894
93894
|
// lib/shared/generate-circuit-json.tsx
|
|
93895
93895
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
93896
|
-
import path24 from "node:path
|
|
93897
|
-
import { relative as relative9 } from "node:path";
|
|
93896
|
+
import path24 from "node:path";
|
|
93898
93897
|
import fs24 from "node:fs";
|
|
93898
|
+
import { pathToFileURL } from "node:url";
|
|
93899
93899
|
import Debug11 from "debug";
|
|
93900
93900
|
|
|
93901
93901
|
// lib/utils/abbreviate-stringify-object.ts
|
|
@@ -93954,10 +93954,11 @@ async function generateCircuitJson({
|
|
|
93954
93954
|
const runner = new userLandTscircuit.RootCircuit({
|
|
93955
93955
|
platform: platformConfig
|
|
93956
93956
|
});
|
|
93957
|
-
const
|
|
93958
|
-
const
|
|
93959
|
-
const
|
|
93960
|
-
const
|
|
93957
|
+
const absoluteFilePath = path24.isAbsolute(filePath) ? filePath : path24.resolve(process.cwd(), filePath);
|
|
93958
|
+
const projectDir = path24.dirname(absoluteFilePath);
|
|
93959
|
+
const resolvedOutputDir = outputDir ?? projectDir;
|
|
93960
|
+
const relativeComponentPath = path24.relative(projectDir, absoluteFilePath);
|
|
93961
|
+
const baseFileName = outputFileName || path24.basename(absoluteFilePath).replace(/\.[^.]+$/, "");
|
|
93961
93962
|
const outputPath = path24.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
93962
93963
|
debug11(`Project directory: ${projectDir}`);
|
|
93963
93964
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
@@ -93966,15 +93967,16 @@ async function generateCircuitJson({
|
|
|
93966
93967
|
...await import_make_vfs2.getVirtualFileSystemFromDirPath({
|
|
93967
93968
|
dirPath: projectDir,
|
|
93968
93969
|
fileMatchFn: (filePath2) => {
|
|
93969
|
-
|
|
93970
|
+
const normalizedFilePath = filePath2.replace(/\\/g, "/");
|
|
93971
|
+
if (normalizedFilePath.includes("node_modules/"))
|
|
93970
93972
|
return false;
|
|
93971
|
-
if (
|
|
93973
|
+
if (normalizedFilePath.includes("dist/"))
|
|
93972
93974
|
return false;
|
|
93973
|
-
if (
|
|
93975
|
+
if (normalizedFilePath.includes("build/"))
|
|
93974
93976
|
return false;
|
|
93975
|
-
if (
|
|
93977
|
+
if (normalizedFilePath.match(/^\.[^/]/))
|
|
93976
93978
|
return false;
|
|
93977
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(path24.extname(
|
|
93979
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path24.extname(normalizedFilePath)))
|
|
93978
93980
|
return false;
|
|
93979
93981
|
return true;
|
|
93980
93982
|
},
|
|
@@ -93982,11 +93984,10 @@ async function generateCircuitJson({
|
|
|
93982
93984
|
})
|
|
93983
93985
|
};
|
|
93984
93986
|
debug11(`fsMap: ${abbreviateStringifyObject(fsMap)}`);
|
|
93985
|
-
const
|
|
93986
|
-
const MainComponent = await import(resolvedFilePath);
|
|
93987
|
+
const MainComponent = await import(pathToFileURL(absoluteFilePath).href);
|
|
93987
93988
|
const Component = MainComponent.default || (Object.keys(MainComponent).find((k) => k[0] === k[0].toUpperCase()) !== undefined ? MainComponent[Object.keys(MainComponent).find((k) => k[0] === k[0].toUpperCase())] : undefined);
|
|
93988
93989
|
if (!Component) {
|
|
93989
|
-
throw new Error(`No component found in "${
|
|
93990
|
+
throw new Error(`No component found in "${absoluteFilePath}". Make sure you export a component.`);
|
|
93990
93991
|
}
|
|
93991
93992
|
runner.add(/* @__PURE__ */ jsxDEV(Component, {}, undefined, false, undefined, this));
|
|
93992
93993
|
await runner.renderUntilSettled();
|
|
@@ -142044,10 +142045,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
142044
142045
|
function uniqueSort(nodes) {
|
|
142045
142046
|
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
|
142046
142047
|
nodes.sort((a, b3) => {
|
|
142047
|
-
const
|
|
142048
|
-
if (
|
|
142048
|
+
const relative9 = compareDocumentPosition(a, b3);
|
|
142049
|
+
if (relative9 & DocumentPosition.PRECEDING) {
|
|
142049
142050
|
return -1;
|
|
142050
|
-
} else if (
|
|
142051
|
+
} else if (relative9 & DocumentPosition.FOLLOWING) {
|
|
142051
142052
|
return 1;
|
|
142052
142053
|
}
|
|
142053
142054
|
return 0;
|
|
@@ -195760,8 +195761,8 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
195760
195761
|
import fs31 from "node:fs";
|
|
195761
195762
|
import path30 from "node:path";
|
|
195762
195763
|
var isSubPath2 = (maybeChild, maybeParent) => {
|
|
195763
|
-
const
|
|
195764
|
-
return
|
|
195764
|
+
const relative9 = path30.relative(maybeParent, maybeChild);
|
|
195765
|
+
return relative9 === "" || !relative9.startsWith("..") && !path30.isAbsolute(relative9);
|
|
195765
195766
|
};
|
|
195766
195767
|
async function getBuildEntrypoints({
|
|
195767
195768
|
fileOrDir,
|
|
@@ -195991,9 +195992,9 @@ var registerBuild = (program3) => {
|
|
|
195991
195992
|
const staticFileReferences = [];
|
|
195992
195993
|
const builtFiles = [];
|
|
195993
195994
|
for (const filePath of circuitFiles) {
|
|
195994
|
-
const
|
|
195995
|
-
console.log(`Building ${
|
|
195996
|
-
const outputDirName =
|
|
195995
|
+
const relative9 = path32.relative(projectDir, filePath);
|
|
195996
|
+
console.log(`Building ${relative9}...`);
|
|
195997
|
+
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
195997
195998
|
const outputPath = path32.join(distDir, outputDirName, "circuit.json");
|
|
195998
195999
|
const ok = await buildFile(filePath, outputPath, projectDir, {
|
|
195999
196000
|
ignoreErrors: options?.ignoreErrors,
|
|
@@ -196008,7 +196009,7 @@ var registerBuild = (program3) => {
|
|
|
196008
196009
|
if (!ok) {
|
|
196009
196010
|
hasErrors = true;
|
|
196010
196011
|
} else if (options?.site) {
|
|
196011
|
-
const normalizedSourcePath =
|
|
196012
|
+
const normalizedSourcePath = relative9.split(path32.sep).join("/");
|
|
196012
196013
|
const relativeOutputPath = path32.join(outputDirName, "circuit.json");
|
|
196013
196014
|
const normalizedOutputPath = relativeOutputPath.split(path32.sep).join("/");
|
|
196014
196015
|
staticFileReferences.push({
|