@cordy/electro-cli 1.2.2 → 1.2.4
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/index.mjs +2 -39
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -490,7 +490,7 @@ const cac = (name = "") => new CAC(name);
|
|
|
490
490
|
|
|
491
491
|
//#endregion
|
|
492
492
|
//#region package.json
|
|
493
|
-
var version$1 = "1.2.
|
|
493
|
+
var version$1 = "1.2.4";
|
|
494
494
|
|
|
495
495
|
//#endregion
|
|
496
496
|
//#region src/dev/logger.ts
|
|
@@ -838,43 +838,6 @@ function resolveSourcemap$1(mode) {
|
|
|
838
838
|
if (mode === "none") return false;
|
|
839
839
|
return true;
|
|
840
840
|
}
|
|
841
|
-
/**
|
|
842
|
-
* Vite plugin: rewrite static ESM `import { X } from "electron"` into CJS require().
|
|
843
|
-
*
|
|
844
|
-
* Electron's npm package is CJS. Node's ESM-CJS interop cannot detect all
|
|
845
|
-
* named exports, so `import { Menu } from "electron"` fails at runtime.
|
|
846
|
-
* This plugin post-processes the rendered chunk and replaces such imports
|
|
847
|
-
* with `createRequire`-based require() calls.
|
|
848
|
-
*/
|
|
849
|
-
function electronCjsCompat() {
|
|
850
|
-
return {
|
|
851
|
-
name: "electro:electron-cjs-compat",
|
|
852
|
-
renderChunk(code) {
|
|
853
|
-
const re = /^import\s+(.+?)\s+from\s+"(electron(?:\/\w+)?)"\s*;\s*$/gm;
|
|
854
|
-
if (!re.test(code)) return null;
|
|
855
|
-
re.lastIndex = 0;
|
|
856
|
-
let result = code;
|
|
857
|
-
let match;
|
|
858
|
-
while ((match = re.exec(code)) !== null) {
|
|
859
|
-
const [full, clause, specifier] = match;
|
|
860
|
-
const named = clause.match(/\{([^}]+)\}/)?.[1];
|
|
861
|
-
const def = clause.match(/^(\w+)/);
|
|
862
|
-
const hasDefault = def && !clause.startsWith("{");
|
|
863
|
-
const tag = specifier.replace(/\//g, "_");
|
|
864
|
-
const lines = [`import { createRequire as __cr_${tag} } from "node:module";`, `var __${tag} = __cr_${tag}(import.meta.url)("${specifier}");`];
|
|
865
|
-
if (hasDefault && !named) lines.push(`var ${def[1]} = __${tag};`);
|
|
866
|
-
if (hasDefault && named) lines.push(`var ${def[1].replace(/,\s*$/, "").trim()} = __${tag};`);
|
|
867
|
-
if (named) for (const n of named.split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
868
|
-
const alias = n.match(/^(\w+)\s+as\s+(\w+)$/);
|
|
869
|
-
if (alias) lines.push(`var ${alias[2]} = __${tag}.${alias[1]};`);
|
|
870
|
-
else lines.push(`var ${n} = __${tag}.${n};`);
|
|
871
|
-
}
|
|
872
|
-
result = result.replace(full, lines.join("\n"));
|
|
873
|
-
}
|
|
874
|
-
return result;
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
841
|
function createNodeConfig(opts) {
|
|
879
842
|
const resolveConditions = opts.scope === "preload" ? [
|
|
880
843
|
"node",
|
|
@@ -885,7 +848,7 @@ function createNodeConfig(opts) {
|
|
|
885
848
|
const config = {
|
|
886
849
|
configFile: false,
|
|
887
850
|
root: opts.root,
|
|
888
|
-
plugins:
|
|
851
|
+
plugins: opts.plugins ?? [],
|
|
889
852
|
customLogger: opts.customLogger,
|
|
890
853
|
envPrefix,
|
|
891
854
|
define: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cordy/electro-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "CLI for @cordy/electro — dev server, build, and code generation commands",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"prepublishOnly": "bun run build"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@cordy/electro": "1.2.
|
|
50
|
+
"@cordy/electro": "1.2.4",
|
|
51
51
|
"electron": ">=40.4.1",
|
|
52
52
|
"vite": ">=8.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@cordy/electro-generator": "1.2.
|
|
55
|
+
"@cordy/electro-generator": "1.2.3"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@cordy/electro": "1.2.
|
|
58
|
+
"@cordy/electro": "1.2.4",
|
|
59
59
|
"@types/node": "^25.2.3",
|
|
60
60
|
"cac": "^6.7.14",
|
|
61
61
|
"electron": "^40.4.1",
|