fix to not import multiple times
This commit is contained in:
parent
af15775e5e
commit
ad00791462
|
@ -52,11 +52,11 @@ const { values } = parseArgs({
|
|||
},
|
||||
jsout: {
|
||||
type: "string",
|
||||
short: "j"
|
||||
short: "j",
|
||||
},
|
||||
cout: {
|
||||
type: "string",
|
||||
short: "c"
|
||||
short: "c",
|
||||
},
|
||||
},
|
||||
strict: true,
|
||||
|
@ -146,7 +146,10 @@ for (const type of Object.keys(schema)) {
|
|||
set ${prop}(v) {
|
||||
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};`;
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue