@tscircuit/core 0.0.756 → 0.0.757
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/index.js +23 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6946,6 +6946,23 @@ var getFileExtension = (filename) => {
|
|
|
6946
6946
|
return cleanFilename.split(".").pop();
|
|
6947
6947
|
};
|
|
6948
6948
|
|
|
6949
|
+
// lib/utils/constructAssetUrl.ts
|
|
6950
|
+
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
6951
|
+
if (!baseUrl) {
|
|
6952
|
+
return targetUrl;
|
|
6953
|
+
}
|
|
6954
|
+
if (!targetUrl.startsWith("/")) {
|
|
6955
|
+
return targetUrl;
|
|
6956
|
+
}
|
|
6957
|
+
try {
|
|
6958
|
+
const base = new URL(baseUrl);
|
|
6959
|
+
const resolved = new URL(targetUrl, base.origin);
|
|
6960
|
+
return resolved.toString();
|
|
6961
|
+
} catch (error) {
|
|
6962
|
+
return targetUrl;
|
|
6963
|
+
}
|
|
6964
|
+
};
|
|
6965
|
+
|
|
6949
6966
|
// lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
|
|
6950
6967
|
function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
|
|
6951
6968
|
let { footprint } = component.props;
|
|
@@ -6957,10 +6974,13 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
6957
6974
|
if (typeof footprint === "string" && isFootprintUrl(footprint) && footprintParser) {
|
|
6958
6975
|
if (component._hasStartedFootprintUrlLoad) return;
|
|
6959
6976
|
component._hasStartedFootprintUrlLoad = true;
|
|
6960
|
-
const
|
|
6977
|
+
const baseUrl = component.root?.platform?.projectBaseUrl;
|
|
6978
|
+
const url = constructAssetUrl(footprint, baseUrl);
|
|
6961
6979
|
queueAsyncEffect("load-footprint-from-platform-file-parser", async () => {
|
|
6962
6980
|
try {
|
|
6963
|
-
const result = await footprintParser.loadFromUrl(
|
|
6981
|
+
const result = await footprintParser.loadFromUrl(footprint).catch(() => {
|
|
6982
|
+
return footprintParser.loadFromUrl(url);
|
|
6983
|
+
});
|
|
6964
6984
|
const fpComponents = createComponentsFromCircuitJson(
|
|
6965
6985
|
{
|
|
6966
6986
|
componentName: component.name,
|
|
@@ -15791,7 +15811,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15791
15811
|
var package_default = {
|
|
15792
15812
|
name: "@tscircuit/core",
|
|
15793
15813
|
type: "module",
|
|
15794
|
-
version: "0.0.
|
|
15814
|
+
version: "0.0.756",
|
|
15795
15815
|
types: "dist/index.d.ts",
|
|
15796
15816
|
main: "dist/index.js",
|
|
15797
15817
|
module: "dist/index.js",
|