@cordy/electro-cli 1.2.11 → 1.2.13
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 +10 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -491,7 +491,7 @@ const cac = (name = "") => new CAC(name);
|
|
|
491
491
|
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region package.json
|
|
494
|
-
var version$1 = "1.2.
|
|
494
|
+
var version$1 = "1.2.13";
|
|
495
495
|
|
|
496
496
|
//#endregion
|
|
497
497
|
//#region src/dev/logger.ts
|
|
@@ -2204,6 +2204,7 @@ function deduplicatePlugins(plugins) {
|
|
|
2204
2204
|
//#endregion
|
|
2205
2205
|
//#region src/dev/bridge-types.ts
|
|
2206
2206
|
const GENERATED_BRIDGE_DIRS = ["views", "windows"];
|
|
2207
|
+
const VIEW_BRIDGE_MODULE_FILE = "bridge.gen.ts";
|
|
2207
2208
|
/**
|
|
2208
2209
|
* Resolve generated bridge declaration file for a view.
|
|
2209
2210
|
* Supports both historical `generated/windows/*` and current `generated/views/*`.
|
|
@@ -2216,7 +2217,11 @@ function findBridgeTypesForView(files, viewName) {
|
|
|
2216
2217
|
/** Target location for per-view bridge types next to the config file. */
|
|
2217
2218
|
function resolveViewBridgePath(view) {
|
|
2218
2219
|
if (!view.__source) return null;
|
|
2219
|
-
return resolve(dirname(view.__source),
|
|
2220
|
+
return resolve(dirname(view.__source), VIEW_BRIDGE_MODULE_FILE);
|
|
2221
|
+
}
|
|
2222
|
+
/** Convert generated bridge declaration content into runtime-accessible bridge module. */
|
|
2223
|
+
function createViewBridgeModuleContent(bridgeTypesContent) {
|
|
2224
|
+
return `${bridgeTypesContent.trimEnd()}\n\nexport const electro = window.electro as ElectroBridge;\n`;
|
|
2220
2225
|
}
|
|
2221
2226
|
function isGeneratedBridgeTypesPath(path) {
|
|
2222
2227
|
return GENERATED_BRIDGE_DIRS.some((dir) => path.startsWith(`generated/${dir}/`) && path.endsWith(".bridge.d.ts"));
|
|
@@ -2945,7 +2950,7 @@ async function build$1(options) {
|
|
|
2945
2950
|
const bridgePath = resolveViewBridgePath(view);
|
|
2946
2951
|
if (bridge && bridgePath) {
|
|
2947
2952
|
await mkdir(dirname(bridgePath), { recursive: true });
|
|
2948
|
-
await writeFileIfChanged$2(bridgePath, bridge.content);
|
|
2953
|
+
await writeFileIfChanged$2(bridgePath, createViewBridgeModuleContent(bridge.content));
|
|
2949
2954
|
}
|
|
2950
2955
|
for (const relPath of generatedBridgeTypesPaths(view.name)) {
|
|
2951
2956
|
const legacyPath = resolve(codegenDir, relPath);
|
|
@@ -3326,7 +3331,7 @@ var DevServer = class {
|
|
|
3326
3331
|
const bridgePath = resolveViewBridgePath(view);
|
|
3327
3332
|
if (bridge && bridgePath) {
|
|
3328
3333
|
await mkdir(dirname(bridgePath), { recursive: true });
|
|
3329
|
-
await writeFileIfChanged$1(bridgePath, bridge.content);
|
|
3334
|
+
await writeFileIfChanged$1(bridgePath, createViewBridgeModuleContent(bridge.content));
|
|
3330
3335
|
}
|
|
3331
3336
|
for (const relPath of generatedBridgeTypesPaths(view.name)) {
|
|
3332
3337
|
const legacyPath = resolve(outputDir, relPath);
|
|
@@ -3694,7 +3699,7 @@ async function generate$1(options) {
|
|
|
3694
3699
|
const bridgePath = resolveViewBridgePath(view);
|
|
3695
3700
|
if (bridge && bridgePath) {
|
|
3696
3701
|
await mkdir(dirname(bridgePath), { recursive: true });
|
|
3697
|
-
await writeFileIfChanged(bridgePath, bridge.content);
|
|
3702
|
+
await writeFileIfChanged(bridgePath, createViewBridgeModuleContent(bridge.content));
|
|
3698
3703
|
console.log(` ${relative(process.cwd(), bridgePath)}`);
|
|
3699
3704
|
}
|
|
3700
3705
|
for (const relPath of generatedBridgeTypesPaths(view.name)) {
|