mirror of
https://github.com/pyscript/pyscript.git
synced 2026-05-01 01:00:17 -04:00
[next] Include most basic error plugin (#1677)
This commit is contained in:
committed by
GitHub
parent
264675d0c3
commit
1d015c7534
24
pyscript.core/rollup/plugins.cjs
Normal file
24
pyscript.core/rollup/plugins.cjs
Normal file
@@ -0,0 +1,24 @@
|
||||
const { readdirSync, writeFileSync } = require("node:fs");
|
||||
const { join } = require("node:path");
|
||||
|
||||
const plugins = [""];
|
||||
|
||||
for (const file of readdirSync(join(__dirname, "..", "src", "plugins"))) {
|
||||
if (/\.js$/.test(file)) {
|
||||
const name = file.slice(0, -3);
|
||||
const key = /^[a-zA-Z0-9$_]+$/.test(name)
|
||||
? name
|
||||
: `[${JSON.stringify(name)}]`;
|
||||
const value = JSON.stringify(`./plugins/${file}`);
|
||||
plugins.push(` ${key}: () => import(${value}),`);
|
||||
}
|
||||
}
|
||||
|
||||
plugins.push("");
|
||||
|
||||
writeFileSync(
|
||||
join(__dirname, "..", "src", "plugins.js"),
|
||||
`// ⚠️ This file is an artifact: DO NOT MODIFY\nexport default {${plugins.join(
|
||||
"\n",
|
||||
)}};\n`,
|
||||
);
|
||||
Reference in New Issue
Block a user