@tscircuit/cli 0.1.112 → 0.1.114
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 +55 -8
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -437163,7 +437163,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
437163
437163
|
import { execSync as execSync2 } from "node:child_process";
|
|
437164
437164
|
var import_semver = __toESM2(require_semver2(), 1);
|
|
437165
437165
|
// package.json
|
|
437166
|
-
var version = "0.1.
|
|
437166
|
+
var version = "0.1.113";
|
|
437167
437167
|
var package_default = {
|
|
437168
437168
|
name: "@tscircuit/cli",
|
|
437169
437169
|
version,
|
|
@@ -437178,6 +437178,7 @@ var package_default = {
|
|
|
437178
437178
|
"@types/configstore": "^6.0.2",
|
|
437179
437179
|
"@types/debug": "^4.1.12",
|
|
437180
437180
|
"@types/jsonwebtoken": "^9.0.9",
|
|
437181
|
+
"@types/micromatch": "^4.0.9",
|
|
437181
437182
|
"@types/prompts": "^2.4.9",
|
|
437182
437183
|
"@types/react": "^19.0.8",
|
|
437183
437184
|
"@types/semver": "^7.5.8",
|
|
@@ -442030,9 +442031,19 @@ var prettyResponseErrorHook = async (_request, _options, response) => {
|
|
|
442030
442031
|
if (!response.ok) {
|
|
442031
442032
|
try {
|
|
442032
442033
|
const errorData = await response.json();
|
|
442033
|
-
|
|
442034
|
+
let requestBody = "";
|
|
442035
|
+
try {
|
|
442036
|
+
requestBody = await _request.clone().text();
|
|
442037
|
+
} catch {}
|
|
442038
|
+
const apiError = errorData?.error;
|
|
442039
|
+
const errorString = apiError ? `
|
|
442040
|
+
${apiError.error_code}: ${apiError.message}` : "";
|
|
442041
|
+
throw new Error(`FAIL [${response.status}]: ${_request.method} ${new URL(_request.url).pathname}` + errorString + (requestBody ? `
|
|
442042
|
+
|
|
442043
|
+
Request Body:
|
|
442044
|
+
${requestBody}` : "") + `
|
|
442034
442045
|
|
|
442035
|
-
|
|
442046
|
+
${JSON.stringify(errorData, null, 2)}`);
|
|
442036
442047
|
} catch (e) {}
|
|
442037
442048
|
}
|
|
442038
442049
|
};
|
|
@@ -442067,7 +442078,8 @@ import * as path12 from "node:path";
|
|
|
442067
442078
|
// lib/project-config/project-config-schema.ts
|
|
442068
442079
|
init_lib();
|
|
442069
442080
|
var projectConfigSchema = z.object({
|
|
442070
|
-
mainEntrypoint: z.string().optional()
|
|
442081
|
+
mainEntrypoint: z.string().optional(),
|
|
442082
|
+
ignoredFiles: z.array(z.string()).optional()
|
|
442071
442083
|
});
|
|
442072
442084
|
|
|
442073
442085
|
// lib/project-config/index.ts
|
|
@@ -442662,11 +442674,37 @@ var isDynamicPattern = normalizeArgumentsSync((patterns, options) => patterns.so
|
|
|
442662
442674
|
var generateGlobTasks = normalizeArguments(generateTasks);
|
|
442663
442675
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
442664
442676
|
|
|
442677
|
+
// lib/shared/should-ignore-path.ts
|
|
442678
|
+
var import_micromatch = __toESM2(require_micromatch(), 1);
|
|
442679
|
+
var DEFAULT_IGNORED_PATTERNS = [
|
|
442680
|
+
"**/node_modules/**",
|
|
442681
|
+
"**/.git/**",
|
|
442682
|
+
"**/.vscode/**",
|
|
442683
|
+
"**/.*/*",
|
|
442684
|
+
"**/.*"
|
|
442685
|
+
];
|
|
442686
|
+
var normalizeIgnorePattern = (pattern) => {
|
|
442687
|
+
if (/[\*\?\[\]\{\}]/.test(pattern))
|
|
442688
|
+
return pattern;
|
|
442689
|
+
return `**/${pattern}/**`;
|
|
442690
|
+
};
|
|
442691
|
+
var shouldIgnorePath = (relativePath, configIgnored = []) => {
|
|
442692
|
+
const extraPatterns = configIgnored.map(normalizeIgnorePattern);
|
|
442693
|
+
return import_micromatch.default.isMatch(relativePath, [
|
|
442694
|
+
...DEFAULT_IGNORED_PATTERNS,
|
|
442695
|
+
...extraPatterns
|
|
442696
|
+
]);
|
|
442697
|
+
};
|
|
442698
|
+
|
|
442665
442699
|
// cli/dev/get-package-file-paths.ts
|
|
442666
|
-
var getPackageFilePaths = (projectDir) => {
|
|
442700
|
+
var getPackageFilePaths = (projectDir, ignored = []) => {
|
|
442701
|
+
const ignorePatterns = [
|
|
442702
|
+
...DEFAULT_IGNORED_PATTERNS,
|
|
442703
|
+
...ignored.map(normalizeIgnorePattern)
|
|
442704
|
+
];
|
|
442667
442705
|
const fileNames = globbySync("**", {
|
|
442668
442706
|
cwd: projectDir,
|
|
442669
|
-
ignore:
|
|
442707
|
+
ignore: ignorePatterns
|
|
442670
442708
|
});
|
|
442671
442709
|
return fileNames.map((fileName) => path15.join(projectDir, fileName));
|
|
442672
442710
|
};
|
|
@@ -442934,6 +442972,7 @@ class DevServer {
|
|
|
442934
442972
|
port;
|
|
442935
442973
|
componentFilePath;
|
|
442936
442974
|
projectDir;
|
|
442975
|
+
ignoredFiles;
|
|
442937
442976
|
httpServer;
|
|
442938
442977
|
eventsWatcher;
|
|
442939
442978
|
fsKy;
|
|
@@ -442946,6 +442985,8 @@ class DevServer {
|
|
|
442946
442985
|
this.port = port;
|
|
442947
442986
|
this.componentFilePath = componentFilePath;
|
|
442948
442987
|
this.projectDir = path18.dirname(componentFilePath);
|
|
442988
|
+
const projectConfig = loadProjectConfig(this.projectDir);
|
|
442989
|
+
this.ignoredFiles = projectConfig?.ignoredFiles ?? [];
|
|
442949
442990
|
this.fsKy = distribution_default.create({
|
|
442950
442991
|
prefixUrl: `http://localhost:${port}`
|
|
442951
442992
|
});
|
|
@@ -442962,7 +443003,7 @@ class DevServer {
|
|
|
442962
443003
|
this.filesystemWatcher = watch(this.projectDir, {
|
|
442963
443004
|
persistent: true,
|
|
442964
443005
|
ignoreInitial: true,
|
|
442965
|
-
ignored:
|
|
443006
|
+
ignored: (p) => shouldIgnorePath(path18.relative(this.projectDir, p), this.ignoredFiles)
|
|
442966
443007
|
});
|
|
442967
443008
|
this.filesystemWatcher.on("change", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
442968
443009
|
this.filesystemWatcher.on("add", (filePath) => this.handleFileChangedOnFilesystem(filePath));
|
|
@@ -442989,6 +443030,8 @@ class DevServer {
|
|
|
442989
443030
|
const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
|
|
442990
443031
|
if (relativeFilePath.includes("manual-edits.json"))
|
|
442991
443032
|
return;
|
|
443033
|
+
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
443034
|
+
return;
|
|
442992
443035
|
await this.typesHandler?.handleFileTypeDependencies(absoluteFilePath);
|
|
442993
443036
|
console.log(kleur_default.green(`Saving: ${relativeFilePath}`));
|
|
442994
443037
|
await this.fsKy.post("api/files/upsert", {
|
|
@@ -443001,6 +443044,8 @@ class DevServer {
|
|
|
443001
443044
|
}
|
|
443002
443045
|
async handleFileRemovedFromFilesystem(absoluteFilePath) {
|
|
443003
443046
|
const relativeFilePath = path18.relative(this.projectDir, absoluteFilePath);
|
|
443047
|
+
if (shouldIgnorePath(relativeFilePath, this.ignoredFiles))
|
|
443048
|
+
return;
|
|
443004
443049
|
if (!relativeFilePath || relativeFilePath.trim() === "") {
|
|
443005
443050
|
debug2("Skipping delete for empty file path");
|
|
443006
443051
|
return;
|
|
@@ -443038,6 +443083,8 @@ class DevServer {
|
|
|
443038
443083
|
async handleFileRename(oldPath, newPath) {
|
|
443039
443084
|
const oldRelativePath = path18.relative(this.projectDir, oldPath);
|
|
443040
443085
|
const newRelativePath = path18.relative(this.projectDir, newPath);
|
|
443086
|
+
if (shouldIgnorePath(oldRelativePath, this.ignoredFiles) || shouldIgnorePath(newRelativePath, this.ignoredFiles))
|
|
443087
|
+
return;
|
|
443041
443088
|
await this.handleFileRemovedFromFilesystem(oldPath);
|
|
443042
443089
|
const fileContent = fs18.readFileSync(newPath, "utf-8");
|
|
443043
443090
|
await this.fsKy.post("api/files/upsert", {
|
|
@@ -443050,7 +443097,7 @@ class DevServer {
|
|
|
443050
443097
|
debug2(`File renamed from ${oldRelativePath} to ${newRelativePath}`);
|
|
443051
443098
|
}
|
|
443052
443099
|
async upsertInitialFiles() {
|
|
443053
|
-
const filePaths = getPackageFilePaths(this.projectDir);
|
|
443100
|
+
const filePaths = getPackageFilePaths(this.projectDir, this.ignoredFiles);
|
|
443054
443101
|
for (const filePath of filePaths) {
|
|
443055
443102
|
const fileContent = fs18.readFileSync(filePath, "utf-8");
|
|
443056
443103
|
await this.fsKy.post("api/files/upsert", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.114",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@babel/standalone": "^7.26.9",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"@types/configstore": "^6.0.2",
|
|
13
13
|
"@types/debug": "^4.1.12",
|
|
14
14
|
"@types/jsonwebtoken": "^9.0.9",
|
|
15
|
+
"@types/micromatch": "^4.0.9",
|
|
15
16
|
"@types/prompts": "^2.4.9",
|
|
16
17
|
"@types/react": "^19.0.8",
|
|
17
18
|
"@types/semver": "^7.5.8",
|