houdini 2.0.0-next.29 → 2.0.0-next.30
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/plugins.js +2 -1
- package/build/node/index.d.ts +3 -0
- package/build/node/index.js +9 -2
- 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.0-next.
|
|
475
|
+
houdini: "^2.0.0-next.30"
|
|
476
476
|
};
|
|
477
477
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
478
478
|
packageJSON2.devDependencies = {
|
|
479
479
|
...packageJSON2.devDependencies,
|
|
480
|
-
"houdini-svelte": "^3.0.0-next.
|
|
480
|
+
"houdini-svelte": "^3.0.0-next.32"
|
|
481
481
|
};
|
|
482
482
|
} else {
|
|
483
483
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/lib/plugins.js
CHANGED
|
@@ -27,7 +27,8 @@ async function plugin_path(plugin_name, config_path, preferWasm = false) {
|
|
|
27
27
|
if (!package_json.bin) {
|
|
28
28
|
throw new Error("There is no bin defined.");
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const bin_value = typeof package_json.bin === "string" ? package_json.bin : Object.values(package_json.bin)[0];
|
|
31
|
+
const native_bin = path.join(plugin_dir, bin_value);
|
|
31
32
|
if (preferWasm) {
|
|
32
33
|
try {
|
|
33
34
|
const wasm_dir = find_module(`${plugin_name}-wasm`, config_path);
|
package/build/node/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type Db } from '../lib/db.js';
|
|
2
|
+
export type { Db } from '../lib/db.js';
|
|
1
3
|
export type PipelineHook = 'config' | 'afterLoad' | 'schema' | 'extractDocuments' | 'afterExtract' | 'beforeValidate' | 'validate' | 'afterValidate' | 'beforeGenerate' | 'generateDocuments' | 'generateRuntime' | 'afterGenerate';
|
|
2
4
|
export type PluginContext = {
|
|
3
5
|
taskId: string;
|
|
4
6
|
pluginDirectory: string;
|
|
7
|
+
db: Db;
|
|
5
8
|
invokeHook(hook: string, payload?: Record<string, any>, options?: {
|
|
6
9
|
parallel?: boolean;
|
|
7
10
|
}): Promise<Record<string, any>>;
|
package/build/node/index.js
CHANGED
|
@@ -16,12 +16,12 @@ class PluginError extends Error {
|
|
|
16
16
|
function plugin(config) {
|
|
17
17
|
const { transport, database, pluginKey } = parseArgs();
|
|
18
18
|
if (transport === "stdio") {
|
|
19
|
-
runStdio(config, pluginKey);
|
|
19
|
+
void runStdio(config, database, pluginKey);
|
|
20
20
|
} else {
|
|
21
21
|
void runWebSocket(config, database, pluginKey);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function runStdio(config, pluginKey) {
|
|
24
|
+
async function runStdio(config, databasePath, pluginKey) {
|
|
25
25
|
const { pending, invokeCounter, rl } = makeStdioChannel();
|
|
26
26
|
const reg = {
|
|
27
27
|
type: "register",
|
|
@@ -33,7 +33,9 @@ function runStdio(config, pluginKey) {
|
|
|
33
33
|
if (config.configModule !== void 0) reg.configModule = config.configModule;
|
|
34
34
|
if (config.clientPlugins !== void 0) reg.clientPlugins = JSON.stringify(config.clientPlugins);
|
|
35
35
|
stdioWrite(reg);
|
|
36
|
+
const dbPromise = openDb(databasePath || ":memory:");
|
|
36
37
|
rl.on("line", async (line) => {
|
|
38
|
+
const db2 = await dbPromise;
|
|
37
39
|
let msg;
|
|
38
40
|
try {
|
|
39
41
|
msg = JSON.parse(line);
|
|
@@ -44,6 +46,7 @@ function runStdio(config, pluginKey) {
|
|
|
44
46
|
const ctx = {
|
|
45
47
|
taskId: msg.taskId ?? "",
|
|
46
48
|
pluginDirectory: msg.pluginDirectory ?? "",
|
|
49
|
+
db: db2,
|
|
47
50
|
invokeHook: makeInvokeHook(pending, invokeCounter, msg.taskId ?? "")
|
|
48
51
|
};
|
|
49
52
|
await dispatch(config, msg, ctx, (response) => stdioWrite(response));
|
|
@@ -51,11 +54,13 @@ function runStdio(config, pluginKey) {
|
|
|
51
54
|
resolveInvoke(pending, msg);
|
|
52
55
|
}
|
|
53
56
|
});
|
|
57
|
+
const db = await dbPromise;
|
|
54
58
|
rl.on("close", () => {
|
|
55
59
|
for (const { reject } of pending.values()) {
|
|
56
60
|
reject(new Error("stdin closed"));
|
|
57
61
|
}
|
|
58
62
|
pending.clear();
|
|
63
|
+
db.close();
|
|
59
64
|
process.exit(0);
|
|
60
65
|
});
|
|
61
66
|
}
|
|
@@ -90,6 +95,7 @@ async function runWebSocket(config, databasePath, pluginKey) {
|
|
|
90
95
|
const ctx = {
|
|
91
96
|
taskId,
|
|
92
97
|
pluginDirectory,
|
|
98
|
+
db,
|
|
93
99
|
invokeHook: wsInvokeHook
|
|
94
100
|
};
|
|
95
101
|
await dispatch(config, msg, ctx, (response) => {
|
|
@@ -125,6 +131,7 @@ async function runWebSocket(config, databasePath, pluginKey) {
|
|
|
125
131
|
const ctx = {
|
|
126
132
|
taskId: msg.taskId ?? "",
|
|
127
133
|
pluginDirectory: msg.pluginDirectory ?? "",
|
|
134
|
+
db,
|
|
128
135
|
invokeHook: wsInvokeHook
|
|
129
136
|
};
|
|
130
137
|
await dispatch(config, msg, ctx, (response) => ws.send(JSON.stringify(response)));
|
package/build/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.30",
|
|
4
4
|
"description": "The disappearing GraphQL clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"recast": "^0.23.11",
|
|
51
51
|
"sql.js": "^1.14.1",
|
|
52
52
|
"ws": "^8.21.0",
|
|
53
|
-
"houdini-core": "^2.0.0-next.
|
|
53
|
+
"houdini-core": "^2.0.0-next.18"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"graphql": ">=16",
|