diff --git a/build-portable-artifacts.mjs b/build-portable-artifacts.mjs index 80a5c2c..18f2fa0 100644 --- a/build-portable-artifacts.mjs +++ b/build-portable-artifacts.mjs @@ -43,6 +43,8 @@ const coreURL = coreFile ? compiler.contentArtifactUrl(coreFile) : null; const coreServer = path.join(config.sharedRuntime, "core.mjs"); await fs.mkdir(path.join(output, "share/quixos/generated"), { recursive: true }); const portable = config.portable; +for (const target of Object.keys(portable?.entries ?? {})) + if (!["browser", "server"].includes(target)) throw Error(`Unsupported portable entry target ${target}`); for (const settings of [portable, config.remote].filter(Boolean)) if (!/^[$A-Z_a-z][$\w]*$/.test(settings.registryExport)) throw Error("Registry export must be a JavaScript identifier"); @@ -82,7 +84,7 @@ for (const { target, mode, settings } of builds) { await fs.writeFile(path.join(work, bindingPath), source); generated.set(mode, { file: path.join(work, bindingPath), source }); await fs.writeFile(path.join(output, "share/quixos/generated", `${mode}.ts`), source); - const entry = relative(settings.entry); + const entry = relative(settings.entries?.[target] ?? settings.entry); execFileSync( config.node, [ diff --git a/portable-artifacts.nix b/portable-artifacts.nix index 2fbe763..32102d8 100644 --- a/portable-artifacts.nix +++ b/portable-artifacts.nix @@ -33,6 +33,7 @@ let else { inherit (portable) entry; + entries = portable.entries or { }; registryExport = portable.registryExport or "registry"; bindingOutput = portable.bindingOutput or "src/gen/qx.ts"; targets =