@tscircuit/cli 0.1.577 → 0.1.579
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 +46 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -72387,7 +72387,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72387
72387
|
import { execSync as execSync2 } from "node:child_process";
|
|
72388
72388
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72389
72389
|
// package.json
|
|
72390
|
-
var version = "0.1.
|
|
72390
|
+
var version = "0.1.578";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -77224,6 +77224,23 @@ function getLocalPackages(projectDir) {
|
|
|
77224
77224
|
}
|
|
77225
77225
|
return localPackages;
|
|
77226
77226
|
}
|
|
77227
|
+
function getAllDependencyPackages(projectDir) {
|
|
77228
|
+
const packageJsonPath = path19.join(projectDir, "package.json");
|
|
77229
|
+
const allPackages = new Set;
|
|
77230
|
+
if (!fs19.existsSync(packageJsonPath)) {
|
|
77231
|
+
return allPackages;
|
|
77232
|
+
}
|
|
77233
|
+
try {
|
|
77234
|
+
const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
|
|
77235
|
+
const deps = packageJson.dependencies || {};
|
|
77236
|
+
for (const packageName of Object.keys(deps)) {
|
|
77237
|
+
allPackages.add(packageName);
|
|
77238
|
+
}
|
|
77239
|
+
} catch (error) {
|
|
77240
|
+
console.warn("Failed to parse package.json for dependencies:", error);
|
|
77241
|
+
}
|
|
77242
|
+
return allPackages;
|
|
77243
|
+
}
|
|
77227
77244
|
function getNodeModuleImports(filePath) {
|
|
77228
77245
|
const absolutePath = path19.resolve(filePath);
|
|
77229
77246
|
if (!fs19.existsSync(absolutePath)) {
|
|
@@ -77513,18 +77530,25 @@ function isRuntimeProvidedPackage(packageName) {
|
|
|
77513
77530
|
}
|
|
77514
77531
|
function getAllNodeModuleFilePaths(entryFilePath, projectDir) {
|
|
77515
77532
|
const localPackages = getLocalPackages(projectDir);
|
|
77516
|
-
|
|
77533
|
+
const allDependencyPackages = getAllDependencyPackages(projectDir);
|
|
77534
|
+
if (allDependencyPackages.size === 0) {
|
|
77517
77535
|
return [];
|
|
77518
77536
|
}
|
|
77519
77537
|
const dependencies2 = collectAllNodeModuleDependencies(entryFilePath, projectDir);
|
|
77520
77538
|
const processedPackages = new Set;
|
|
77521
77539
|
const allFiles = new Set;
|
|
77540
|
+
const hasLocalPackages = localPackages.size > 0;
|
|
77522
77541
|
for (const [importPath, resolvedFiles] of dependencies2.entries()) {
|
|
77523
77542
|
const packageName = getPackageNameFromImport(importPath);
|
|
77524
77543
|
const isLocalPackage = localPackages.has(packageName);
|
|
77544
|
+
const isProjectDependency = allDependencyPackages.has(packageName);
|
|
77525
77545
|
if (isRuntimeProvidedPackage(packageName) && !isLocalPackage) {
|
|
77526
77546
|
continue;
|
|
77527
77547
|
}
|
|
77548
|
+
const shouldUpload = isProjectDependency || isLocalPackage || hasLocalPackages;
|
|
77549
|
+
if (!shouldUpload) {
|
|
77550
|
+
continue;
|
|
77551
|
+
}
|
|
77528
77552
|
if (!processedPackages.has(packageName)) {
|
|
77529
77553
|
processedPackages.add(packageName);
|
|
77530
77554
|
if (resolvedFiles.length > 0) {
|
|
@@ -183281,6 +183305,9 @@ import dts from "rollup-plugin-dts";
|
|
|
183281
183305
|
import fs37 from "node:fs";
|
|
183282
183306
|
import path36 from "node:path";
|
|
183283
183307
|
import { createHash } from "node:crypto";
|
|
183308
|
+
function normalizePathSeparators(filePath) {
|
|
183309
|
+
return filePath.split(path36.sep).join("/");
|
|
183310
|
+
}
|
|
183284
183311
|
var STATIC_ASSET_EXTENSIONS = new Set([
|
|
183285
183312
|
".glb",
|
|
183286
183313
|
".gltf",
|
|
@@ -183314,17 +183341,24 @@ var createStaticAssetPlugin = ({
|
|
|
183314
183341
|
if (!STATIC_ASSET_EXTENSIONS.has(ext))
|
|
183315
183342
|
return null;
|
|
183316
183343
|
if (path36.isAbsolute(source)) {
|
|
183317
|
-
return fs37.existsSync(source) ? { id: source, external: true } : null;
|
|
183344
|
+
return fs37.existsSync(source) ? { id: normalizePathSeparators(source), external: true } : null;
|
|
183318
183345
|
}
|
|
183319
183346
|
if (importer) {
|
|
183320
|
-
const
|
|
183347
|
+
const importerNative = importer.split("/").join(path36.sep);
|
|
183348
|
+
const resolvedFromImporter = path36.resolve(path36.dirname(importerNative), source);
|
|
183321
183349
|
if (fs37.existsSync(resolvedFromImporter)) {
|
|
183322
|
-
return {
|
|
183350
|
+
return {
|
|
183351
|
+
id: normalizePathSeparators(resolvedFromImporter),
|
|
183352
|
+
external: true
|
|
183353
|
+
};
|
|
183323
183354
|
}
|
|
183324
183355
|
}
|
|
183325
183356
|
const resolvedFromProject = path36.resolve(resolvedBaseUrl, source);
|
|
183326
183357
|
if (fs37.existsSync(resolvedFromProject)) {
|
|
183327
|
-
return {
|
|
183358
|
+
return {
|
|
183359
|
+
id: normalizePathSeparators(resolvedFromProject),
|
|
183360
|
+
external: true
|
|
183361
|
+
};
|
|
183328
183362
|
}
|
|
183329
183363
|
for (const [pattern, targets] of Object.entries(resolvedPathMappings)) {
|
|
183330
183364
|
const isWildcard = pattern.endsWith("/*");
|
|
@@ -183335,7 +183369,10 @@ var createStaticAssetPlugin = ({
|
|
|
183335
183369
|
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
183336
183370
|
const resolvedTarget = path36.resolve(resolvedBaseUrl, targetPath);
|
|
183337
183371
|
if (fs37.existsSync(resolvedTarget)) {
|
|
183338
|
-
return {
|
|
183372
|
+
return {
|
|
183373
|
+
id: normalizePathSeparators(resolvedTarget),
|
|
183374
|
+
external: true
|
|
183375
|
+
};
|
|
183339
183376
|
}
|
|
183340
183377
|
}
|
|
183341
183378
|
}
|
|
@@ -183363,7 +183400,8 @@ var createStaticAssetPlugin = ({
|
|
|
183363
183400
|
if (!copiedAssets.has(importedId)) {
|
|
183364
183401
|
const assetDir = path36.join(outputDir, "assets");
|
|
183365
183402
|
fs37.mkdirSync(assetDir, { recursive: true });
|
|
183366
|
-
const
|
|
183403
|
+
const nativePath = importedId.split("/").join(path36.sep);
|
|
183404
|
+
const fileBuffer = fs37.readFileSync(nativePath);
|
|
183367
183405
|
const hash = createHash("sha1").update(fileBuffer).digest("hex").slice(0, 8);
|
|
183368
183406
|
const fileName = `${path36.basename(importedId, ext)}-${hash}${ext}`;
|
|
183369
183407
|
const outputFilePath = path36.join(assetDir, fileName);
|