houdini 2.0.4 → 2.0.5
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/build/cmd/init.js +2 -2
- package/build/lib/codegen.js +71 -46
- package/build/package.json +1 -1
- package/package.json +2 -2
package/build/cmd/init.js
CHANGED
|
@@ -472,12 +472,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
472
472
|
}
|
|
473
473
|
packageJSON2.devDependencies = {
|
|
474
474
|
...packageJSON2.devDependencies,
|
|
475
|
-
houdini: "^2.0.
|
|
475
|
+
houdini: "^2.0.5"
|
|
476
476
|
};
|
|
477
477
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
478
478
|
packageJSON2.devDependencies = {
|
|
479
479
|
...packageJSON2.devDependencies,
|
|
480
|
-
"houdini-svelte": "^3.0.
|
|
480
|
+
"houdini-svelte": "^3.0.2"
|
|
481
481
|
};
|
|
482
482
|
} else {
|
|
483
483
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/lib/codegen.js
CHANGED
|
@@ -302,49 +302,72 @@ async function codegen_setup(config, mode, db, db_file) {
|
|
|
302
302
|
});
|
|
303
303
|
_db.run("DELETE FROM plugins");
|
|
304
304
|
_db.flush();
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
args.unshift(wasiRunnerPath, plugin.executable);
|
|
317
|
-
}
|
|
318
|
-
const dbKey = plugin_db_key(plugin.name);
|
|
319
|
-
args.push("--plugin-key", dbKey);
|
|
320
|
-
const pluginUsesStdio = useStdio || path.extname(plugin.executable) === ".wasm";
|
|
321
|
-
if (pluginUsesStdio) {
|
|
322
|
-
args.push("--transport", "stdio");
|
|
305
|
+
const spawnedChildren = [];
|
|
306
|
+
const kill_spawned = () => {
|
|
307
|
+
for (const { child, detached } of spawnedChildren) {
|
|
308
|
+
if (child.pid === void 0 || child.exitCode !== null) continue;
|
|
309
|
+
try {
|
|
310
|
+
if (process.platform === "win32") {
|
|
311
|
+
child.kill();
|
|
312
|
+
} else {
|
|
313
|
+
process.kill(detached ? -child.pid : child.pid, "SIGINT");
|
|
314
|
+
}
|
|
315
|
+
} catch {
|
|
323
316
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const guarded = async (fn) => {
|
|
320
|
+
try {
|
|
321
|
+
return await fn();
|
|
322
|
+
} catch (err) {
|
|
323
|
+
kill_spawned();
|
|
324
|
+
throw err;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
logger.time("Start Plugins");
|
|
328
|
+
await guarded(
|
|
329
|
+
() => Promise.all(
|
|
330
|
+
config.plugins.map(async (plugin) => {
|
|
331
|
+
let executable = plugin.executable;
|
|
332
|
+
const args = ["--database", db_file];
|
|
333
|
+
const jsExtensions = [".js", ".mjs", ".cjs"];
|
|
334
|
+
if (jsExtensions.includes(path.extname(plugin.executable))) {
|
|
335
|
+
executable = "node";
|
|
336
|
+
args.unshift(plugin.executable);
|
|
337
|
+
} else if (path.extname(plugin.executable) === ".wasm") {
|
|
338
|
+
executable = "node";
|
|
339
|
+
args.unshift(wasiRunnerPath, plugin.executable);
|
|
340
|
+
}
|
|
341
|
+
const dbKey = plugin_db_key(plugin.name);
|
|
342
|
+
args.push("--plugin-key", dbKey);
|
|
343
|
+
const pluginUsesStdio = useStdio || path.extname(plugin.executable) === ".wasm";
|
|
344
|
+
if (pluginUsesStdio) {
|
|
345
|
+
args.push("--transport", "stdio");
|
|
346
|
+
}
|
|
347
|
+
logger.time(`Spawn ${plugin.name}`);
|
|
348
|
+
const detached = process.platform !== "win32" && !pluginUsesStdio;
|
|
349
|
+
const child = spawn(executable, args, {
|
|
350
|
+
// stdio/WASM plugins carry the protocol over stdin+stdout, so those must be pipes.
|
|
351
|
+
// websocket plugins talk over TCP, so let stdout/stderr through to the console.
|
|
352
|
+
stdio: pluginUsesStdio ? ["pipe", "pipe", "inherit"] : ["inherit", "inherit", "inherit"],
|
|
353
|
+
detached
|
|
340
354
|
});
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
355
|
+
spawnedChildren.push({ child, detached });
|
|
356
|
+
if (pluginUsesStdio) {
|
|
357
|
+
stdioStdin.set(dbKey, child.stdin);
|
|
358
|
+
child.stdin.on("error", (err) => {
|
|
359
|
+
if (err.code !== "EPIPE") {
|
|
360
|
+
console.error(`[${plugin.name}] stdin error:`, err.message);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
plugins[plugin.name] = {
|
|
365
|
+
process: child,
|
|
366
|
+
...await (pluginUsesStdio ? wait_for_plugin_stdio(plugin.name, child) : wait_for_plugin_db(plugin.name, dbKey))
|
|
367
|
+
};
|
|
368
|
+
logger.timeEnd(`Spawn ${plugin.name}`, LogLevel.Verbose);
|
|
369
|
+
})
|
|
370
|
+
)
|
|
348
371
|
);
|
|
349
372
|
for (const plugin of config.plugins) {
|
|
350
373
|
plugin_specs.push(spec_results[plugin.name]);
|
|
@@ -484,11 +507,13 @@ async function codegen_setup(config, mode, db, db_file) {
|
|
|
484
507
|
return result;
|
|
485
508
|
};
|
|
486
509
|
triggerHookRef.fn = trigger_hook;
|
|
487
|
-
await
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
510
|
+
await guarded(async () => {
|
|
511
|
+
await write_config(_db, config, invoke_hook, plugin_specs, mode, logger);
|
|
512
|
+
_db.flush();
|
|
513
|
+
await trigger_hook("Config");
|
|
514
|
+
await trigger_hook("AfterLoad");
|
|
515
|
+
await trigger_hook("Schema");
|
|
516
|
+
});
|
|
492
517
|
let pipelineQueue = Promise.resolve();
|
|
493
518
|
return {
|
|
494
519
|
database_path: db_file,
|
package/build/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "The disappearing GraphQL clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"recast": "^0.23.11",
|
|
53
53
|
"sql.js": "^1.14.1",
|
|
54
54
|
"ws": "^8.21.0",
|
|
55
|
-
"houdini-core": "^2.0.
|
|
55
|
+
"houdini-core": "^2.0.4"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"graphql": ">=16",
|