fix to not import multiple times
This commit is contained in:
parent
af15775e5e
commit
ad00791462
|
@ -51,12 +51,12 @@ const { values } = parseArgs({
|
||||||
short: "S",
|
short: "S",
|
||||||
},
|
},
|
||||||
jsout: {
|
jsout: {
|
||||||
type: "string",
|
type: "string",
|
||||||
short: "j"
|
short: "j",
|
||||||
},
|
},
|
||||||
cout: {
|
cout: {
|
||||||
type: "string",
|
type: "string",
|
||||||
short: "c"
|
short: "c",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
strict: true,
|
strict: true,
|
||||||
|
@ -146,7 +146,10 @@ for (const type of Object.keys(schema)) {
|
||||||
set ${prop}(v) {
|
set ${prop}(v) {
|
||||||
this._data.set(v.bytes(), ${offset});
|
this._data.set(v.bytes(), ${offset});
|
||||||
}`;
|
}`;
|
||||||
importStatements += `import ${propType} from "./${propType}"\n\n`;
|
const importS = `import ${propType} from "./${propType}"\n\n`;
|
||||||
|
if (!importStatements.includes(importS)) {
|
||||||
|
importStatements += importS;
|
||||||
|
}
|
||||||
|
|
||||||
cData += `\n\t\t${types[propType].c} ${prop};`;
|
cData += `\n\t\t${types[propType].c} ${prop};`;
|
||||||
break;
|
break;
|
||||||
|
@ -179,6 +182,9 @@ export default ${type}`;
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
await Bun.write(Bun.file(values.jsout + type + ".js"), (importStatements + jsData));
|
await Bun.write(
|
||||||
|
Bun.file(values.jsout + type + ".js"),
|
||||||
|
importStatements + jsData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
await Bun.write(Bun.file(values.cout + "types.h"), cData);
|
await Bun.write(Bun.file(values.cout + "types.h"), cData);
|
||||||
|
|
Loading…
Reference in New Issue