@tscircuit/cli 0.1.534 → 0.1.535
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 +41 -4
- 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.534";
|
|
72391
72391
|
var package_default = {
|
|
72392
72392
|
name: "@tscircuit/cli",
|
|
72393
72393
|
version,
|
|
@@ -196729,9 +196729,13 @@ var STATIC_ASSET_EXTENSIONS = new Set([
|
|
|
196729
196729
|
]);
|
|
196730
196730
|
var createStaticAssetPlugin = ({
|
|
196731
196731
|
outputDir,
|
|
196732
|
-
projectDir
|
|
196732
|
+
projectDir,
|
|
196733
|
+
baseUrl,
|
|
196734
|
+
pathMappings
|
|
196733
196735
|
}) => {
|
|
196734
196736
|
const copiedAssets = new Map;
|
|
196737
|
+
const resolvedBaseUrl = baseUrl ?? projectDir;
|
|
196738
|
+
const resolvedPathMappings = pathMappings ?? {};
|
|
196735
196739
|
return {
|
|
196736
196740
|
name: "tsci-static-assets",
|
|
196737
196741
|
resolveId(source, importer) {
|
|
@@ -196747,10 +196751,24 @@ var createStaticAssetPlugin = ({
|
|
|
196747
196751
|
return resolvedFromImporter;
|
|
196748
196752
|
}
|
|
196749
196753
|
}
|
|
196750
|
-
const resolvedFromProject = path35.resolve(
|
|
196754
|
+
const resolvedFromProject = path35.resolve(resolvedBaseUrl, source);
|
|
196751
196755
|
if (fs36.existsSync(resolvedFromProject)) {
|
|
196752
196756
|
return resolvedFromProject;
|
|
196753
196757
|
}
|
|
196758
|
+
for (const [pattern, targets] of Object.entries(resolvedPathMappings)) {
|
|
196759
|
+
const isWildcard = pattern.endsWith("/*");
|
|
196760
|
+
const patternPrefix = isWildcard ? pattern.slice(0, -1) : pattern;
|
|
196761
|
+
if (isWildcard ? source.startsWith(patternPrefix) : source === pattern) {
|
|
196762
|
+
const wildcard = isWildcard ? source.slice(patternPrefix.length) : "";
|
|
196763
|
+
for (const target of targets) {
|
|
196764
|
+
const targetPath = isWildcard ? target.replace("*", wildcard) : target;
|
|
196765
|
+
const resolvedTarget = path35.resolve(resolvedBaseUrl, targetPath);
|
|
196766
|
+
if (fs36.existsSync(resolvedTarget)) {
|
|
196767
|
+
return resolvedTarget;
|
|
196768
|
+
}
|
|
196769
|
+
}
|
|
196770
|
+
}
|
|
196771
|
+
}
|
|
196754
196772
|
return null;
|
|
196755
196773
|
},
|
|
196756
196774
|
load(id2) {
|
|
@@ -196823,10 +196841,29 @@ var transpileFile = async ({
|
|
|
196823
196841
|
fs37.mkdirSync(outputDir, { recursive: true });
|
|
196824
196842
|
const tsconfigPath = path36.join(projectDir, "tsconfig.json");
|
|
196825
196843
|
const hasTsConfig = fs37.existsSync(tsconfigPath);
|
|
196844
|
+
let tsconfigBaseUrl = projectDir;
|
|
196845
|
+
let tsconfigPathMappings;
|
|
196846
|
+
if (hasTsConfig) {
|
|
196847
|
+
try {
|
|
196848
|
+
const tsconfigContent = fs37.readFileSync(tsconfigPath, "utf-8");
|
|
196849
|
+
const tsconfig = JSON.parse(tsconfigContent);
|
|
196850
|
+
if (tsconfig.compilerOptions?.baseUrl) {
|
|
196851
|
+
tsconfigBaseUrl = path36.resolve(path36.dirname(tsconfigPath), tsconfig.compilerOptions.baseUrl);
|
|
196852
|
+
}
|
|
196853
|
+
if (tsconfig.compilerOptions?.paths) {
|
|
196854
|
+
tsconfigPathMappings = tsconfig.compilerOptions.paths;
|
|
196855
|
+
}
|
|
196856
|
+
} catch {}
|
|
196857
|
+
}
|
|
196826
196858
|
console.log("Building ESM bundle...");
|
|
196827
196859
|
const staticAssetExtensions = Array.from(STATIC_ASSET_EXTENSIONS);
|
|
196828
196860
|
const getPlugins = () => [
|
|
196829
|
-
createStaticAssetPlugin({
|
|
196861
|
+
createStaticAssetPlugin({
|
|
196862
|
+
outputDir,
|
|
196863
|
+
projectDir,
|
|
196864
|
+
baseUrl: tsconfigBaseUrl,
|
|
196865
|
+
pathMappings: tsconfigPathMappings
|
|
196866
|
+
}),
|
|
196830
196867
|
resolve12({
|
|
196831
196868
|
extensions: [
|
|
196832
196869
|
".ts",
|