easyeda 0.0.22 → 0.0.24
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/cli/main.cjs +40 -10
- package/dist/cli/main.cjs.map +1 -1
- package/dist/lib/index.cjs +24 -6
- package/dist/lib/index.cjs.map +1 -1
- package/dist/lib/index.d.cts +1 -1
- package/package.json +1 -1
package/dist/lib/index.cjs
CHANGED
|
@@ -29541,9 +29541,9 @@ export const ${componentName} = (props: Props) => {
|
|
|
29541
29541
|
<bug
|
|
29542
29542
|
{...props}
|
|
29543
29543
|
footprint={${footprintTsx}}
|
|
29544
|
-
cadModel={{
|
|
29544
|
+
${objUrl ? `cadModel={{
|
|
29545
29545
|
objUrl: "${objUrl}"
|
|
29546
|
-
}}
|
|
29546
|
+
}}` : ""}
|
|
29547
29547
|
pinLabels={pinLabels}
|
|
29548
29548
|
schPinSpacing={0.75}
|
|
29549
29549
|
schPortArrangement={${JSON.stringify(schPinArrangement, null, " ")}}
|
|
@@ -29567,18 +29567,18 @@ function normalizeManufacturerPartNumber(partNumber) {
|
|
|
29567
29567
|
}
|
|
29568
29568
|
|
|
29569
29569
|
// lib/convert-to-typescript-component/index.tsx
|
|
29570
|
-
var convertRawEasyEdaToTs = (rawEasy) => {
|
|
29570
|
+
var convertRawEasyEdaToTs = async (rawEasy) => {
|
|
29571
29571
|
const easyeda = EasyEdaJsonSchema.parse(rawEasy);
|
|
29572
29572
|
const soup = convertEasyEdaJsonToTscircuitSoupJson(easyeda, {
|
|
29573
29573
|
useModelCdn: true
|
|
29574
29574
|
});
|
|
29575
|
-
const result = convertToTypescriptComponent({
|
|
29575
|
+
const result = await convertToTypescriptComponent({
|
|
29576
29576
|
easyeda,
|
|
29577
29577
|
soup
|
|
29578
29578
|
});
|
|
29579
29579
|
return result;
|
|
29580
29580
|
};
|
|
29581
|
-
var convertToTypescriptComponent = ({
|
|
29581
|
+
var convertToTypescriptComponent = async ({
|
|
29582
29582
|
soup,
|
|
29583
29583
|
easyeda: easyEdaJson
|
|
29584
29584
|
}) => {
|
|
@@ -29607,14 +29607,32 @@ var convertToTypescriptComponent = ({
|
|
|
29607
29607
|
pins: rightPins.map((pin) => pin.pinNumber).reverse()
|
|
29608
29608
|
}
|
|
29609
29609
|
};
|
|
29610
|
+
let modelObjUrl;
|
|
29611
|
+
if (cad_component2.model_obj_url) {
|
|
29612
|
+
const isValidUrl = await checkModelObjUrlValidity(
|
|
29613
|
+
cad_component2.model_obj_url
|
|
29614
|
+
);
|
|
29615
|
+
if (isValidUrl) {
|
|
29616
|
+
modelObjUrl = cad_component2.model_obj_url;
|
|
29617
|
+
}
|
|
29618
|
+
}
|
|
29610
29619
|
return soupTypescriptComponentTemplate({
|
|
29611
29620
|
componentName: pn,
|
|
29612
29621
|
pinLabels,
|
|
29613
29622
|
schPinArrangement,
|
|
29614
|
-
objUrl:
|
|
29623
|
+
objUrl: modelObjUrl,
|
|
29615
29624
|
easyEdaJson
|
|
29616
29625
|
});
|
|
29617
29626
|
};
|
|
29627
|
+
var checkModelObjUrlValidity = async (url) => {
|
|
29628
|
+
try {
|
|
29629
|
+
const response = await fetch(url, { method: "HEAD" });
|
|
29630
|
+
return response.status === 200;
|
|
29631
|
+
} catch (error) {
|
|
29632
|
+
console.error(`Error checking model object URL ${url}:`, error);
|
|
29633
|
+
return false;
|
|
29634
|
+
}
|
|
29635
|
+
};
|
|
29618
29636
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29619
29637
|
0 && (module.exports = {
|
|
29620
29638
|
convertEasyEdaJsonToTscircuitSoupJson,
|