houdini 2.0.0 → 2.0.2
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 +13 -3
- package/build/lib/parse.d.ts +1 -1
- package/build/lib/parse.js +3 -2
- package/build/package.json +1 -1
- package/build/runtime/types.d.ts +5 -1
- package/build/runtime/types.js +28 -1
- package/build/vite/hmr.js +3 -1
- package/build/vite/houdini.js +12 -2
- package/build/vite/index.js +5 -3
- 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.2"
|
|
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.1"
|
|
481
481
|
};
|
|
482
482
|
} else {
|
|
483
483
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/lib/codegen.js
CHANGED
|
@@ -244,7 +244,11 @@ async function codegen_setup(config, mode, db, db_file) {
|
|
|
244
244
|
errors.forEach((error) => {
|
|
245
245
|
format_hook_error(config.root_dir, error, name, pending.hook);
|
|
246
246
|
});
|
|
247
|
-
pending.reject(
|
|
247
|
+
pending.reject(
|
|
248
|
+
Object.assign(new Error(`Failed to call ${name}`), {
|
|
249
|
+
alreadyLogged: true
|
|
250
|
+
})
|
|
251
|
+
);
|
|
248
252
|
} else {
|
|
249
253
|
pending.resolve(msg.result);
|
|
250
254
|
}
|
|
@@ -319,7 +323,9 @@ async function codegen_setup(config, mode, db, db_file) {
|
|
|
319
323
|
}
|
|
320
324
|
logger.time(`Spawn ${plugin.name}`);
|
|
321
325
|
const child = spawn(executable, args, {
|
|
322
|
-
stdio
|
|
326
|
+
// stdio/WASM plugins carry the protocol over stdin+stdout, so those must be pipes.
|
|
327
|
+
// websocket plugins talk over TCP, so let stdout/stderr through to the console.
|
|
328
|
+
stdio: pluginUsesStdio ? ["pipe", "pipe", "inherit"] : ["inherit", "inherit", "inherit"],
|
|
323
329
|
detached: process.platform !== "win32"
|
|
324
330
|
});
|
|
325
331
|
if (pluginUsesStdio) {
|
|
@@ -373,7 +379,11 @@ async function codegen_setup(config, mode, db, db_file) {
|
|
|
373
379
|
errors.forEach((error) => {
|
|
374
380
|
format_hook_error(config.root_dir, error, name, pending.hook);
|
|
375
381
|
});
|
|
376
|
-
pending.reject(
|
|
382
|
+
pending.reject(
|
|
383
|
+
Object.assign(new Error(`Failed to call ${name}`), {
|
|
384
|
+
alreadyLogged: true
|
|
385
|
+
})
|
|
386
|
+
);
|
|
377
387
|
} else {
|
|
378
388
|
pending.resolve(response.result);
|
|
379
389
|
}
|
package/build/lib/parse.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type ParsedFile = Maybe<{
|
|
|
6
6
|
start: number;
|
|
7
7
|
end: number;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function parseJS(str: string, config?: Partial<ParserOptions
|
|
9
|
+
export declare function parseJS(str: string, config?: Partial<ParserOptions>, sourceFileName?: string): Script;
|
|
10
10
|
type PrintOptions = Options & {
|
|
11
11
|
pretty?: boolean;
|
|
12
12
|
};
|
package/build/lib/parse.js
CHANGED
|
@@ -5,9 +5,10 @@ const defaultBabelConfig = {
|
|
|
5
5
|
plugins: ["typescript", "importAssertions", "decorators-legacy", "explicitResourceManagement"],
|
|
6
6
|
sourceType: "module"
|
|
7
7
|
};
|
|
8
|
-
function parseJS(str, config) {
|
|
8
|
+
function parseJS(str, config, sourceFileName) {
|
|
9
9
|
const mergedConfig = config ? deepMerge("", defaultBabelConfig, config) : defaultBabelConfig;
|
|
10
10
|
return recastParse(str || "", {
|
|
11
|
+
sourceFileName,
|
|
11
12
|
parser: {
|
|
12
13
|
// tokens: true is required so recast doesn't fall back to esprima's tokenizer,
|
|
13
14
|
// which can't handle TypeScript syntax.
|
|
@@ -16,7 +17,7 @@ function parseJS(str, config) {
|
|
|
16
17
|
}).program;
|
|
17
18
|
}
|
|
18
19
|
async function printJS(script, options) {
|
|
19
|
-
const defaultOptions = { tabWidth: 4 };
|
|
20
|
+
const defaultOptions = { tabWidth: 4, sourceMapName: "houdini-transform" };
|
|
20
21
|
if (options?.pretty) {
|
|
21
22
|
return prettyPrint(
|
|
22
23
|
script,
|
package/build/package.json
CHANGED
package/build/runtime/types.d.ts
CHANGED
|
@@ -401,7 +401,11 @@ interface VariableNode {
|
|
|
401
401
|
}
|
|
402
402
|
export declare const PendingValue: unique symbol;
|
|
403
403
|
export type LoadingType = typeof PendingValue;
|
|
404
|
-
|
|
404
|
+
type ContainsPending<T> = [T] extends [LoadingType] ? true : T extends readonly (infer E)[] ? ContainsPending<E> : T extends object ? true extends {
|
|
405
|
+
[K in keyof T]-?: ContainsPending<T[K]>;
|
|
406
|
+
}[keyof T] ? true : false : false;
|
|
407
|
+
type PendingMembers<T> = T extends unknown ? (ContainsPending<T> extends true ? T : never) : never;
|
|
408
|
+
export declare function isPending<T>(value: T): value is PendingMembers<T>;
|
|
405
409
|
export declare const CachePolicy: {
|
|
406
410
|
readonly CacheOrNetwork: "CacheOrNetwork";
|
|
407
411
|
readonly CacheOnly: "CacheOnly";
|
package/build/runtime/types.js
CHANGED
|
@@ -36,7 +36,34 @@ const DataSource = {
|
|
|
36
36
|
const fragmentKey = " $fragments";
|
|
37
37
|
const PendingValue = /* @__PURE__ */ Symbol("houdini_loading");
|
|
38
38
|
function isPending(value) {
|
|
39
|
-
return
|
|
39
|
+
return containsPendingValue(value);
|
|
40
|
+
}
|
|
41
|
+
function containsPendingValue(value, seen) {
|
|
42
|
+
if (typeof value === "symbol") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (value === null || typeof value !== "object") {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
seen = seen ?? /* @__PURE__ */ new Set();
|
|
49
|
+
if (seen.has(value)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
seen.add(value);
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
for (const element of value) {
|
|
55
|
+
if (containsPendingValue(element, seen)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
for (const key of Object.keys(value)) {
|
|
62
|
+
if (containsPendingValue(value[key], seen)) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
40
67
|
}
|
|
41
68
|
const CachePolicy = {
|
|
42
69
|
CacheOrNetwork: "CacheOrNetwork",
|
package/build/vite/hmr.js
CHANGED
|
@@ -378,7 +378,9 @@ function createDebounceHmr(debounceMs = 50) {
|
|
|
378
378
|
try {
|
|
379
379
|
await callback(filesWithContent, [...filesToDelete], currentBatchId.toString());
|
|
380
380
|
} catch (err) {
|
|
381
|
-
|
|
381
|
+
if (!err?.alreadyLogged) {
|
|
382
|
+
console.error("[houdini] HMR pipeline error:", err);
|
|
383
|
+
}
|
|
382
384
|
}
|
|
383
385
|
while (pendingBatch) {
|
|
384
386
|
const {
|
package/build/vite/houdini.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { codegen_setup } from "../lib/codegen.js";
|
|
2
|
+
import { codegen_setup, init_db } from "../lib/codegen.js";
|
|
3
3
|
import * as fs from "../lib/fs.js";
|
|
4
4
|
let compiler;
|
|
5
5
|
let alreadyBuilt = false;
|
|
@@ -15,6 +15,13 @@ function houdini(ctx) {
|
|
|
15
15
|
},
|
|
16
16
|
async configResolved(conf) {
|
|
17
17
|
viteConfig = conf;
|
|
18
|
+
if (conf.isWorker) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!ctx.db) {
|
|
22
|
+
const [db] = await init_db(ctx.config, false);
|
|
23
|
+
ctx.db = db;
|
|
24
|
+
}
|
|
18
25
|
},
|
|
19
26
|
async config(userConfig, env) {
|
|
20
27
|
viteEnv = env;
|
|
@@ -55,6 +62,9 @@ function houdini(ctx) {
|
|
|
55
62
|
};
|
|
56
63
|
},
|
|
57
64
|
async buildStart() {
|
|
65
|
+
if (viteConfig.isWorker) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
58
68
|
if (!compiler && !devServer) {
|
|
59
69
|
compiler = await codegen_setup(ctx.config, "dev", ctx.db, ctx.db_file);
|
|
60
70
|
}
|
|
@@ -84,7 +94,7 @@ function houdini(ctx) {
|
|
|
84
94
|
closeBundle: {
|
|
85
95
|
order: "post",
|
|
86
96
|
async handler() {
|
|
87
|
-
if (viteEnv.mode !== "production" || devServer || viteConfig.build.ssr) {
|
|
97
|
+
if (viteEnv.mode !== "production" || devServer || viteConfig.build.ssr || viteConfig.isWorker) {
|
|
88
98
|
return;
|
|
89
99
|
}
|
|
90
100
|
if (!ctx.adapter) {
|
package/build/vite/index.js
CHANGED
|
@@ -2,18 +2,20 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import {
|
|
5
|
+
import { get_config } from "../lib/index.js";
|
|
6
|
+
import { db_path } from "../router/conventions.js";
|
|
6
7
|
import { document_hmr } from "./hmr.js";
|
|
7
8
|
import { houdini } from "./houdini.js";
|
|
8
9
|
import { poll_remote_schema, watch_local_schema, refresh_on_schema } from "./schema.js";
|
|
9
10
|
async function index_default(opts) {
|
|
10
11
|
const config = await get_config();
|
|
11
|
-
const
|
|
12
|
+
const db_file = db_path(config);
|
|
12
13
|
const ctx = {
|
|
13
14
|
...opts,
|
|
14
15
|
config,
|
|
15
16
|
db_file,
|
|
16
|
-
|
|
17
|
+
// assigned in houdini()'s configResolved; never opened for worker builds
|
|
18
|
+
db: void 0,
|
|
17
19
|
// pick up adapter from config file if not provided in opts
|
|
18
20
|
adapter: opts?.adapter ?? config.config_file.adapter
|
|
19
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
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.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"graphql": ">=16",
|