houdini 2.0.0-next.7 → 2.0.0-next.9
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/adapter/index.d.ts +1 -1
- package/build/cmd-cjs/index.js +9 -14
- package/build/cmd-esm/index.js +9 -14
- package/build/codegen-cjs/index.js +7 -12
- package/build/codegen-esm/index.js +7 -12
- package/build/lib-cjs/index.js +6 -3
- package/build/lib-esm/index.js +6 -3
- package/build/runtime/lib/types.d.ts +2 -2
- package/build/runtime/public/cache.d.ts +0 -1
- package/build/runtime/router/server.d.ts +5 -5
- package/build/runtime/server/index.d.ts +17 -0
- package/build/runtime-cjs/lib/types.d.ts +2 -2
- package/build/runtime-cjs/public/cache.d.ts +0 -1
- package/build/runtime-cjs/public/cache.js +0 -14
- package/build/runtime-cjs/router/server.d.ts +5 -5
- package/build/runtime-cjs/router/server.js +16 -11
- package/build/runtime-cjs/router/session.js +3 -0
- package/build/runtime-cjs/server/index.d.ts +17 -0
- package/build/runtime-cjs/server/index.js +62 -0
- package/build/runtime-esm/lib/types.d.ts +2 -2
- package/build/runtime-esm/public/cache.d.ts +0 -1
- package/build/runtime-esm/public/cache.js +0 -14
- package/build/runtime-esm/router/server.d.ts +5 -5
- package/build/runtime-esm/router/server.js +19 -14
- package/build/runtime-esm/router/session.js +3 -0
- package/build/runtime-esm/server/index.d.ts +17 -0
- package/build/runtime-esm/server/index.js +38 -0
- package/build/test-cjs/index.js +7 -12
- package/build/test-esm/index.js +7 -12
- package/build/vite/hmr.d.ts +0 -2
- package/build/vite-cjs/index.js +22 -33
- package/build/vite-esm/index.js +22 -33
- package/package.json +2 -2
package/build/adapter/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { serverAdapterFactory as createAdapter } from '../runtime/router/server';
|
|
2
2
|
export declare const endpoint: string;
|
|
3
|
-
export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | '
|
|
3
|
+
export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'server' | 'schema' | 'graphqlEndpoint' | 'componentCache' | 'client'>) => ReturnType<typeof createAdapter>;
|
package/build/cmd-cjs/index.js
CHANGED
|
@@ -82357,6 +82357,10 @@ ${exportStatement("config")}
|
|
|
82357
82357
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
82358
82358
|
[join2(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
82359
82359
|
}),
|
|
82360
|
+
recursiveCopy(
|
|
82361
|
+
join2(config.runtimeSource, "server"),
|
|
82362
|
+
join2(config.rootDir, "server")
|
|
82363
|
+
),
|
|
82360
82364
|
generatePluginRuntimes({
|
|
82361
82365
|
config,
|
|
82362
82366
|
docs
|
|
@@ -83634,10 +83638,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
83634
83638
|
const [shapeType, inputType] = ensureImports({
|
|
83635
83639
|
config,
|
|
83636
83640
|
body,
|
|
83637
|
-
sourceModule:
|
|
83638
|
-
config.runtimeDirectory,
|
|
83639
|
-
config.artifactImportPath(doc.name)
|
|
83640
|
-
),
|
|
83641
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83641
83642
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
83642
83643
|
});
|
|
83643
83644
|
return prev.concat(
|
|
@@ -83667,10 +83668,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
83667
83668
|
const [shapeType] = ensureImports({
|
|
83668
83669
|
config,
|
|
83669
83670
|
body,
|
|
83670
|
-
sourceModule:
|
|
83671
|
-
config.runtimeDirectory,
|
|
83672
|
-
config.artifactImportPath(doc.name)
|
|
83673
|
-
),
|
|
83671
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83674
83672
|
import: [`${definition.name.value}$data`]
|
|
83675
83673
|
});
|
|
83676
83674
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -83683,10 +83681,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
83683
83681
|
ensureImports({
|
|
83684
83682
|
config,
|
|
83685
83683
|
body,
|
|
83686
|
-
sourceModule:
|
|
83687
|
-
config.runtimeDirectory,
|
|
83688
|
-
config.artifactImportPath(doc.name)
|
|
83689
|
-
),
|
|
83684
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83690
83685
|
import: [`${definition.name.value}$input`]
|
|
83691
83686
|
})[0]
|
|
83692
83687
|
)
|
|
@@ -89211,12 +89206,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
89211
89206
|
}
|
|
89212
89207
|
packageJSON2.devDependencies = {
|
|
89213
89208
|
...packageJSON2.devDependencies,
|
|
89214
|
-
houdini: "^2.0.0-next.
|
|
89209
|
+
houdini: "^2.0.0-next.9"
|
|
89215
89210
|
};
|
|
89216
89211
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
89217
89212
|
packageJSON2.devDependencies = {
|
|
89218
89213
|
...packageJSON2.devDependencies,
|
|
89219
|
-
"houdini-svelte": "^3.0.0-next.
|
|
89214
|
+
"houdini-svelte": "^3.0.0-next.12"
|
|
89220
89215
|
};
|
|
89221
89216
|
} else {
|
|
89222
89217
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -82361,6 +82361,10 @@ ${exportStatement("config")}
|
|
|
82361
82361
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
82362
82362
|
[join2(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
82363
82363
|
}),
|
|
82364
|
+
recursiveCopy(
|
|
82365
|
+
join2(config.runtimeSource, "server"),
|
|
82366
|
+
join2(config.rootDir, "server")
|
|
82367
|
+
),
|
|
82364
82368
|
generatePluginRuntimes({
|
|
82365
82369
|
config,
|
|
82366
82370
|
docs
|
|
@@ -83638,10 +83642,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
83638
83642
|
const [shapeType, inputType] = ensureImports({
|
|
83639
83643
|
config,
|
|
83640
83644
|
body,
|
|
83641
|
-
sourceModule:
|
|
83642
|
-
config.runtimeDirectory,
|
|
83643
|
-
config.artifactImportPath(doc.name)
|
|
83644
|
-
),
|
|
83645
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83645
83646
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
83646
83647
|
});
|
|
83647
83648
|
return prev.concat(
|
|
@@ -83671,10 +83672,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
83671
83672
|
const [shapeType] = ensureImports({
|
|
83672
83673
|
config,
|
|
83673
83674
|
body,
|
|
83674
|
-
sourceModule:
|
|
83675
|
-
config.runtimeDirectory,
|
|
83676
|
-
config.artifactImportPath(doc.name)
|
|
83677
|
-
),
|
|
83675
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83678
83676
|
import: [`${definition.name.value}$data`]
|
|
83679
83677
|
});
|
|
83680
83678
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -83687,10 +83685,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
83687
83685
|
ensureImports({
|
|
83688
83686
|
config,
|
|
83689
83687
|
body,
|
|
83690
|
-
sourceModule:
|
|
83691
|
-
config.runtimeDirectory,
|
|
83692
|
-
config.artifactImportPath(doc.name)
|
|
83693
|
-
),
|
|
83688
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
83694
83689
|
import: [`${definition.name.value}$input`]
|
|
83695
83690
|
})[0]
|
|
83696
83691
|
)
|
|
@@ -89215,12 +89210,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
89215
89210
|
}
|
|
89216
89211
|
packageJSON2.devDependencies = {
|
|
89217
89212
|
...packageJSON2.devDependencies,
|
|
89218
|
-
houdini: "^2.0.0-next.
|
|
89213
|
+
houdini: "^2.0.0-next.9"
|
|
89219
89214
|
};
|
|
89220
89215
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
89221
89216
|
packageJSON2.devDependencies = {
|
|
89222
89217
|
...packageJSON2.devDependencies,
|
|
89223
|
-
"houdini-svelte": "^3.0.0-next.
|
|
89218
|
+
"houdini-svelte": "^3.0.0-next.12"
|
|
89224
89219
|
};
|
|
89225
89220
|
} else {
|
|
89226
89221
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -68889,6 +68889,10 @@ ${exportStatement("config")}
|
|
|
68889
68889
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
68890
68890
|
[join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
68891
68891
|
}),
|
|
68892
|
+
recursiveCopy(
|
|
68893
|
+
join(config.runtimeSource, "server"),
|
|
68894
|
+
join(config.rootDir, "server")
|
|
68895
|
+
),
|
|
68892
68896
|
generatePluginRuntimes({
|
|
68893
68897
|
config,
|
|
68894
68898
|
docs
|
|
@@ -70166,10 +70170,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
70166
70170
|
const [shapeType, inputType] = ensureImports({
|
|
70167
70171
|
config,
|
|
70168
70172
|
body,
|
|
70169
|
-
sourceModule:
|
|
70170
|
-
config.runtimeDirectory,
|
|
70171
|
-
config.artifactImportPath(doc.name)
|
|
70172
|
-
),
|
|
70173
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70173
70174
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
70174
70175
|
});
|
|
70175
70176
|
return prev.concat(
|
|
@@ -70199,10 +70200,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70199
70200
|
const [shapeType] = ensureImports({
|
|
70200
70201
|
config,
|
|
70201
70202
|
body,
|
|
70202
|
-
sourceModule:
|
|
70203
|
-
config.runtimeDirectory,
|
|
70204
|
-
config.artifactImportPath(doc.name)
|
|
70205
|
-
),
|
|
70203
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70206
70204
|
import: [`${definition.name.value}$data`]
|
|
70207
70205
|
});
|
|
70208
70206
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -70215,10 +70213,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70215
70213
|
ensureImports({
|
|
70216
70214
|
config,
|
|
70217
70215
|
body,
|
|
70218
|
-
sourceModule:
|
|
70219
|
-
config.runtimeDirectory,
|
|
70220
|
-
config.artifactImportPath(doc.name)
|
|
70221
|
-
),
|
|
70216
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70222
70217
|
import: [`${definition.name.value}$input`]
|
|
70223
70218
|
})[0]
|
|
70224
70219
|
)
|
|
@@ -68888,6 +68888,10 @@ ${exportStatement("config")}
|
|
|
68888
68888
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
68889
68889
|
[join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
68890
68890
|
}),
|
|
68891
|
+
recursiveCopy(
|
|
68892
|
+
join(config.runtimeSource, "server"),
|
|
68893
|
+
join(config.rootDir, "server")
|
|
68894
|
+
),
|
|
68891
68895
|
generatePluginRuntimes({
|
|
68892
68896
|
config,
|
|
68893
68897
|
docs
|
|
@@ -70165,10 +70169,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
70165
70169
|
const [shapeType, inputType] = ensureImports({
|
|
70166
70170
|
config,
|
|
70167
70171
|
body,
|
|
70168
|
-
sourceModule:
|
|
70169
|
-
config.runtimeDirectory,
|
|
70170
|
-
config.artifactImportPath(doc.name)
|
|
70171
|
-
),
|
|
70172
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70172
70173
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
70173
70174
|
});
|
|
70174
70175
|
return prev.concat(
|
|
@@ -70198,10 +70199,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70198
70199
|
const [shapeType] = ensureImports({
|
|
70199
70200
|
config,
|
|
70200
70201
|
body,
|
|
70201
|
-
sourceModule:
|
|
70202
|
-
config.runtimeDirectory,
|
|
70203
|
-
config.artifactImportPath(doc.name)
|
|
70204
|
-
),
|
|
70202
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70205
70203
|
import: [`${definition.name.value}$data`]
|
|
70206
70204
|
});
|
|
70207
70205
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -70214,10 +70212,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70214
70212
|
ensureImports({
|
|
70215
70213
|
config,
|
|
70216
70214
|
body,
|
|
70217
|
-
sourceModule:
|
|
70218
|
-
config.runtimeDirectory,
|
|
70219
|
-
config.artifactImportPath(doc.name)
|
|
70220
|
-
),
|
|
70215
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70221
70216
|
import: [`${definition.name.value}$input`]
|
|
70222
70217
|
})[0]
|
|
70223
70218
|
)
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -73384,7 +73384,7 @@ async function load_manifest(args) {
|
|
|
73384
73384
|
layout_queries: {},
|
|
73385
73385
|
artifacts: [],
|
|
73386
73386
|
local_schema: false,
|
|
73387
|
-
|
|
73387
|
+
local_server: false
|
|
73388
73388
|
},
|
|
73389
73389
|
queries: [],
|
|
73390
73390
|
layouts: [],
|
|
@@ -73408,8 +73408,8 @@ async function load_manifest(args) {
|
|
|
73408
73408
|
if (name === "+schema") {
|
|
73409
73409
|
manifest.local_schema = true;
|
|
73410
73410
|
}
|
|
73411
|
-
if (name === "+
|
|
73412
|
-
manifest.
|
|
73411
|
+
if (name === "+server") {
|
|
73412
|
+
manifest.local_server = true;
|
|
73413
73413
|
}
|
|
73414
73414
|
}
|
|
73415
73415
|
} catch {
|
|
@@ -77808,6 +77808,9 @@ async function get_session(req, secrets) {
|
|
|
77808
77808
|
if (!cookie) {
|
|
77809
77809
|
return {};
|
|
77810
77810
|
}
|
|
77811
|
+
if (cookie === "{}") {
|
|
77812
|
+
return {};
|
|
77813
|
+
}
|
|
77811
77814
|
for (const secret of secrets) {
|
|
77812
77815
|
if (!await verify(cookie, secret)) {
|
|
77813
77816
|
continue;
|
package/build/lib-esm/index.js
CHANGED
|
@@ -73295,7 +73295,7 @@ async function load_manifest(args) {
|
|
|
73295
73295
|
layout_queries: {},
|
|
73296
73296
|
artifacts: [],
|
|
73297
73297
|
local_schema: false,
|
|
73298
|
-
|
|
73298
|
+
local_server: false
|
|
73299
73299
|
},
|
|
73300
73300
|
queries: [],
|
|
73301
73301
|
layouts: [],
|
|
@@ -73319,8 +73319,8 @@ async function load_manifest(args) {
|
|
|
73319
73319
|
if (name === "+schema") {
|
|
73320
73320
|
manifest.local_schema = true;
|
|
73321
73321
|
}
|
|
73322
|
-
if (name === "+
|
|
73323
|
-
manifest.
|
|
73322
|
+
if (name === "+server") {
|
|
73323
|
+
manifest.local_server = true;
|
|
73324
73324
|
}
|
|
73325
73325
|
}
|
|
73326
73326
|
} catch {
|
|
@@ -77719,6 +77719,9 @@ async function get_session(req, secrets) {
|
|
|
77719
77719
|
if (!cookie) {
|
|
77720
77720
|
return {};
|
|
77721
77721
|
}
|
|
77722
|
+
if (cookie === "{}") {
|
|
77723
|
+
return {};
|
|
77724
|
+
}
|
|
77722
77725
|
for (const secret of secrets) {
|
|
77723
77726
|
if (!await verify(cookie, secret)) {
|
|
77724
77727
|
continue;
|
|
@@ -372,8 +372,8 @@ export type ProjectManifest = {
|
|
|
372
372
|
artifacts: string[];
|
|
373
373
|
/** Whether or not there is a local schema defined */
|
|
374
374
|
local_schema: boolean;
|
|
375
|
-
/** Whether or not there is a custom
|
|
376
|
-
|
|
375
|
+
/** Whether or not there is a custom server defined */
|
|
376
|
+
local_server: boolean;
|
|
377
377
|
/** Information about componentFields defined in the project */
|
|
378
378
|
component_fields: Record<string, {
|
|
379
379
|
filepath: string;
|
|
@@ -6,7 +6,6 @@ import type { ArgType, CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue
|
|
|
6
6
|
export declare class Cache<Def extends CacheTypeDef> {
|
|
7
7
|
_internal_unstable: _Cache;
|
|
8
8
|
constructor(cache: _Cache);
|
|
9
|
-
validateInstabilityWarning(): void;
|
|
10
9
|
get<T extends TypeNames<Def>>(type: T, data: IDFields<Def, T>): Record<Def, T>;
|
|
11
10
|
get config(): import("../lib").ConfigFile;
|
|
12
11
|
list<Name extends ValidLists<Def>>(name: Name, { parentID, allLists }?: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createServerAdapter
|
|
1
|
+
import { createServerAdapter } from '@whatwg-node/server';
|
|
2
2
|
import type { GraphQLSchema } from 'graphql';
|
|
3
|
-
import { createYoga } from 'graphql-yoga';
|
|
4
3
|
import type { HoudiniClient } from '../client';
|
|
4
|
+
import { Server } from '../server';
|
|
5
5
|
import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
|
|
6
|
-
export declare function _serverHandler<ComponentType = unknown>({ schema,
|
|
6
|
+
export declare function _serverHandler<ComponentType = unknown>({ schema, server, client, production, manifest, graphqlEndpoint, on_render, componentCache, }: {
|
|
7
7
|
schema?: GraphQLSchema | null;
|
|
8
|
-
|
|
8
|
+
server?: Server<any, any>;
|
|
9
9
|
client: HoudiniClient;
|
|
10
10
|
production: boolean;
|
|
11
11
|
manifest: RouterManifest<ComponentType> | null;
|
|
@@ -20,5 +20,5 @@ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga,
|
|
|
20
20
|
componentCache: Record<string, any>;
|
|
21
21
|
}) => Response | Promise<Response | undefined> | undefined;
|
|
22
22
|
} & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
|
|
23
|
-
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof
|
|
23
|
+
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createServerAdapter>;
|
|
24
24
|
export type ServerAdapterFactory = typeof serverAdapterFactory;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServerAdapterRequestHandler } from '@whatwg-node/server';
|
|
2
|
+
import { YogaServer } from 'graphql-yoga';
|
|
3
|
+
import type { YogaSchemaDefinition } from 'graphql-yoga/typings/plugins/use-schema';
|
|
4
|
+
type YogaParams = Required<ConstructorParameters<typeof YogaServer>>[0];
|
|
5
|
+
type ConstructorParams = Omit<YogaParams, 'schema' | 'graphqlEndpoint'>;
|
|
6
|
+
export declare class Server<ServerContext extends Record<string, any>, UserContext extends Record<string, any>> {
|
|
7
|
+
opts: ConstructorParams | null;
|
|
8
|
+
_yoga: YogaServer<any, any> | null;
|
|
9
|
+
constructor(opts?: ConstructorParams);
|
|
10
|
+
init({ endpoint, schema, getSession, }: {
|
|
11
|
+
schema: YogaSchemaDefinition<any>;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
getSession: (request: Request) => Promise<UserContext>;
|
|
14
|
+
}): import("@whatwg-node/server").ServerAdapter<ServerContext, Server<ServerContext, UserContext>>;
|
|
15
|
+
handle: ServerAdapterRequestHandler<ServerContext>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -372,8 +372,8 @@ export type ProjectManifest = {
|
|
|
372
372
|
artifacts: string[];
|
|
373
373
|
/** Whether or not there is a local schema defined */
|
|
374
374
|
local_schema: boolean;
|
|
375
|
-
/** Whether or not there is a custom
|
|
376
|
-
|
|
375
|
+
/** Whether or not there is a custom server defined */
|
|
376
|
+
local_server: boolean;
|
|
377
377
|
/** Information about componentFields defined in the project */
|
|
378
378
|
component_fields: Record<string, {
|
|
379
379
|
filepath: string;
|
|
@@ -6,7 +6,6 @@ import type { ArgType, CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue
|
|
|
6
6
|
export declare class Cache<Def extends CacheTypeDef> {
|
|
7
7
|
_internal_unstable: _Cache;
|
|
8
8
|
constructor(cache: _Cache);
|
|
9
|
-
validateInstabilityWarning(): void;
|
|
10
9
|
get<T extends TypeNames<Def>>(type: T, data: IDFields<Def, T>): Record<Def, T>;
|
|
11
10
|
get config(): import("../lib").ConfigFile;
|
|
12
11
|
list<Name extends ValidLists<Def>>(name: Name, { parentID, allLists }?: {
|
|
@@ -29,19 +29,8 @@ class Cache {
|
|
|
29
29
|
constructor(cache) {
|
|
30
30
|
this._internal_unstable = cache;
|
|
31
31
|
}
|
|
32
|
-
// if the user is using the imperative API, we want the ability to break the API
|
|
33
|
-
// with any minor version. In order to do this, we require them to accept this contract
|
|
34
|
-
// through their config file
|
|
35
|
-
validateInstabilityWarning() {
|
|
36
|
-
if (!this.config.acceptImperativeInstability && !this.config.features?.imperativeCache) {
|
|
37
|
-
console.warn(`\u26A0\uFE0F The imperative cache API is considered unstable and will change in any minor version release
|
|
38
|
-
Please acknowledge this by enabling the imperative cache feature flage in your config file.
|
|
39
|
-
For more information: https://houdinigraphql.com/api/cache`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
32
|
// return the record proxy for the given type/id combo
|
|
43
33
|
get(type, data) {
|
|
44
|
-
this.validateInstabilityWarning();
|
|
45
34
|
let recordID = this._internal_unstable._internal_unstable.id(type, data);
|
|
46
35
|
if (!recordID) {
|
|
47
36
|
throw new Error("todo");
|
|
@@ -57,7 +46,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
57
46
|
return (0, import_lib.getCurrentConfig)();
|
|
58
47
|
}
|
|
59
48
|
list(name, { parentID, allLists } = {}) {
|
|
60
|
-
this.validateInstabilityWarning();
|
|
61
49
|
return new import_list.ListCollection({
|
|
62
50
|
cache: this,
|
|
63
51
|
name,
|
|
@@ -69,7 +57,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
69
57
|
query,
|
|
70
58
|
variables
|
|
71
59
|
}) {
|
|
72
|
-
this.validateInstabilityWarning();
|
|
73
60
|
return this._internal_unstable.read({
|
|
74
61
|
selection: query.artifact.selection,
|
|
75
62
|
variables
|
|
@@ -80,7 +67,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
80
67
|
variables,
|
|
81
68
|
data
|
|
82
69
|
}) {
|
|
83
|
-
this.validateInstabilityWarning();
|
|
84
70
|
this._internal_unstable.write({
|
|
85
71
|
selection: query.artifact.selection,
|
|
86
72
|
// @ts-expect-error
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createServerAdapter
|
|
1
|
+
import { createServerAdapter } from '@whatwg-node/server';
|
|
2
2
|
import type { GraphQLSchema } from 'graphql';
|
|
3
|
-
import { createYoga } from 'graphql-yoga';
|
|
4
3
|
import type { HoudiniClient } from '../client';
|
|
4
|
+
import { Server } from '../server';
|
|
5
5
|
import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
|
|
6
|
-
export declare function _serverHandler<ComponentType = unknown>({ schema,
|
|
6
|
+
export declare function _serverHandler<ComponentType = unknown>({ schema, server, client, production, manifest, graphqlEndpoint, on_render, componentCache, }: {
|
|
7
7
|
schema?: GraphQLSchema | null;
|
|
8
|
-
|
|
8
|
+
server?: Server<any, any>;
|
|
9
9
|
client: HoudiniClient;
|
|
10
10
|
production: boolean;
|
|
11
11
|
manifest: RouterManifest<ComponentType> | null;
|
|
@@ -20,5 +20,5 @@ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga,
|
|
|
20
20
|
componentCache: Record<string, any>;
|
|
21
21
|
}) => Response | Promise<Response | undefined> | undefined;
|
|
22
22
|
} & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
|
|
23
|
-
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof
|
|
23
|
+
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createServerAdapter>;
|
|
24
24
|
export type ServerAdapterFactory = typeof serverAdapterFactory;
|
|
@@ -23,8 +23,8 @@ __export(server_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(server_exports);
|
|
25
25
|
var import_server = require("@whatwg-node/server");
|
|
26
|
-
var import_graphql_yoga = require("graphql-yoga");
|
|
27
26
|
var import_config = require("../lib/config");
|
|
27
|
+
var import_server2 = require("../server");
|
|
28
28
|
var import_cookies = require("./cookies");
|
|
29
29
|
var import_match = require("./match");
|
|
30
30
|
var import_session = require("./session");
|
|
@@ -32,7 +32,7 @@ const config_file = (0, import_config.getCurrentConfig)();
|
|
|
32
32
|
const session_keys = (0, import_config.localApiSessionKeys)(config_file);
|
|
33
33
|
function _serverHandler({
|
|
34
34
|
schema,
|
|
35
|
-
|
|
35
|
+
server,
|
|
36
36
|
client,
|
|
37
37
|
production,
|
|
38
38
|
manifest,
|
|
@@ -40,18 +40,23 @@ function _serverHandler({
|
|
|
40
40
|
on_render,
|
|
41
41
|
componentCache
|
|
42
42
|
}) {
|
|
43
|
-
if (schema && !
|
|
44
|
-
|
|
43
|
+
if (schema && !server) {
|
|
44
|
+
server = new import_server2.Server({
|
|
45
|
+
landingPage: !production
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
let requestHandler = null;
|
|
49
|
+
if (server && schema) {
|
|
50
|
+
requestHandler = server.init({
|
|
45
51
|
schema,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
context: async (request) => await (0, import_session.get_session)(request.headers, session_keys)
|
|
52
|
+
endpoint: graphqlEndpoint,
|
|
53
|
+
getSession: (request) => (0, import_session.get_session)(request.headers, session_keys)
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
client.componentCache = componentCache;
|
|
52
|
-
if (
|
|
57
|
+
if (requestHandler) {
|
|
53
58
|
client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
|
|
54
|
-
const response = await
|
|
59
|
+
const response = await requestHandler(
|
|
55
60
|
new Request(`http://localhost/${graphqlEndpoint}`, {
|
|
56
61
|
method: "POST",
|
|
57
62
|
headers: {
|
|
@@ -77,8 +82,8 @@ function _serverHandler({
|
|
|
77
82
|
);
|
|
78
83
|
}
|
|
79
84
|
const url = new URL(request.url).pathname;
|
|
80
|
-
if (
|
|
81
|
-
return
|
|
85
|
+
if (requestHandler && url === graphqlEndpoint) {
|
|
86
|
+
return requestHandler(request);
|
|
82
87
|
}
|
|
83
88
|
const authResponse = await (0, import_session.handle_request)({
|
|
84
89
|
request,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServerAdapterRequestHandler } from '@whatwg-node/server';
|
|
2
|
+
import { YogaServer } from 'graphql-yoga';
|
|
3
|
+
import type { YogaSchemaDefinition } from 'graphql-yoga/typings/plugins/use-schema';
|
|
4
|
+
type YogaParams = Required<ConstructorParameters<typeof YogaServer>>[0];
|
|
5
|
+
type ConstructorParams = Omit<YogaParams, 'schema' | 'graphqlEndpoint'>;
|
|
6
|
+
export declare class Server<ServerContext extends Record<string, any>, UserContext extends Record<string, any>> {
|
|
7
|
+
opts: ConstructorParams | null;
|
|
8
|
+
_yoga: YogaServer<any, any> | null;
|
|
9
|
+
constructor(opts?: ConstructorParams);
|
|
10
|
+
init({ endpoint, schema, getSession, }: {
|
|
11
|
+
schema: YogaSchemaDefinition<any>;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
getSession: (request: Request) => Promise<UserContext>;
|
|
14
|
+
}): import("@whatwg-node/server").ServerAdapter<ServerContext, Server<ServerContext, UserContext>>;
|
|
15
|
+
handle: ServerAdapterRequestHandler<ServerContext>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var server_exports = {};
|
|
20
|
+
__export(server_exports, {
|
|
21
|
+
Server: () => Server
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(server_exports);
|
|
24
|
+
var import_server = require("@whatwg-node/server");
|
|
25
|
+
var import_graphql_yoga = require("graphql-yoga");
|
|
26
|
+
class Server {
|
|
27
|
+
opts;
|
|
28
|
+
_yoga = null;
|
|
29
|
+
constructor(opts) {
|
|
30
|
+
this.opts = opts ?? null;
|
|
31
|
+
}
|
|
32
|
+
init({
|
|
33
|
+
endpoint,
|
|
34
|
+
schema,
|
|
35
|
+
getSession
|
|
36
|
+
}) {
|
|
37
|
+
this._yoga = new import_graphql_yoga.YogaServer({
|
|
38
|
+
...this.opts,
|
|
39
|
+
schema,
|
|
40
|
+
graphqlEndpoint: endpoint,
|
|
41
|
+
context: async (ctx) => {
|
|
42
|
+
const userContext = !this.opts ? {} : typeof this.opts.context === "function" ? await this.opts.context(ctx) : this.opts.context || {};
|
|
43
|
+
const sessionContext = await getSession(ctx.request) || {};
|
|
44
|
+
return {
|
|
45
|
+
...userContext,
|
|
46
|
+
session: sessionContext
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return (0, import_server.createServerAdapter)(this, {
|
|
51
|
+
fetchAPI: this._yoga.fetchAPI,
|
|
52
|
+
plugins: this._yoga["plugins"]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
handle = (request, serverContext) => {
|
|
56
|
+
return this._yoga.handle(request, serverContext);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
Server
|
|
62
|
+
});
|
|
@@ -372,8 +372,8 @@ export type ProjectManifest = {
|
|
|
372
372
|
artifacts: string[];
|
|
373
373
|
/** Whether or not there is a local schema defined */
|
|
374
374
|
local_schema: boolean;
|
|
375
|
-
/** Whether or not there is a custom
|
|
376
|
-
|
|
375
|
+
/** Whether or not there is a custom server defined */
|
|
376
|
+
local_server: boolean;
|
|
377
377
|
/** Information about componentFields defined in the project */
|
|
378
378
|
component_fields: Record<string, {
|
|
379
379
|
filepath: string;
|
|
@@ -6,7 +6,6 @@ import type { ArgType, CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue
|
|
|
6
6
|
export declare class Cache<Def extends CacheTypeDef> {
|
|
7
7
|
_internal_unstable: _Cache;
|
|
8
8
|
constructor(cache: _Cache);
|
|
9
|
-
validateInstabilityWarning(): void;
|
|
10
9
|
get<T extends TypeNames<Def>>(type: T, data: IDFields<Def, T>): Record<Def, T>;
|
|
11
10
|
get config(): import("../lib").ConfigFile;
|
|
12
11
|
list<Name extends ValidLists<Def>>(name: Name, { parentID, allLists }?: {
|
|
@@ -6,19 +6,8 @@ class Cache {
|
|
|
6
6
|
constructor(cache) {
|
|
7
7
|
this._internal_unstable = cache;
|
|
8
8
|
}
|
|
9
|
-
// if the user is using the imperative API, we want the ability to break the API
|
|
10
|
-
// with any minor version. In order to do this, we require them to accept this contract
|
|
11
|
-
// through their config file
|
|
12
|
-
validateInstabilityWarning() {
|
|
13
|
-
if (!this.config.acceptImperativeInstability && !this.config.features?.imperativeCache) {
|
|
14
|
-
console.warn(`\u26A0\uFE0F The imperative cache API is considered unstable and will change in any minor version release
|
|
15
|
-
Please acknowledge this by enabling the imperative cache feature flage in your config file.
|
|
16
|
-
For more information: https://houdinigraphql.com/api/cache`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
9
|
// return the record proxy for the given type/id combo
|
|
20
10
|
get(type, data) {
|
|
21
|
-
this.validateInstabilityWarning();
|
|
22
11
|
let recordID = this._internal_unstable._internal_unstable.id(type, data);
|
|
23
12
|
if (!recordID) {
|
|
24
13
|
throw new Error("todo");
|
|
@@ -34,7 +23,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
34
23
|
return getCurrentConfig();
|
|
35
24
|
}
|
|
36
25
|
list(name, { parentID, allLists } = {}) {
|
|
37
|
-
this.validateInstabilityWarning();
|
|
38
26
|
return new ListCollection({
|
|
39
27
|
cache: this,
|
|
40
28
|
name,
|
|
@@ -46,7 +34,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
46
34
|
query,
|
|
47
35
|
variables
|
|
48
36
|
}) {
|
|
49
|
-
this.validateInstabilityWarning();
|
|
50
37
|
return this._internal_unstable.read({
|
|
51
38
|
selection: query.artifact.selection,
|
|
52
39
|
variables
|
|
@@ -57,7 +44,6 @@ For more information: https://houdinigraphql.com/api/cache`);
|
|
|
57
44
|
variables,
|
|
58
45
|
data
|
|
59
46
|
}) {
|
|
60
|
-
this.validateInstabilityWarning();
|
|
61
47
|
this._internal_unstable.write({
|
|
62
48
|
selection: query.artifact.selection,
|
|
63
49
|
// @ts-expect-error
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createServerAdapter
|
|
1
|
+
import { createServerAdapter } from '@whatwg-node/server';
|
|
2
2
|
import type { GraphQLSchema } from 'graphql';
|
|
3
|
-
import { createYoga } from 'graphql-yoga';
|
|
4
3
|
import type { HoudiniClient } from '../client';
|
|
4
|
+
import { Server } from '../server';
|
|
5
5
|
import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
|
|
6
|
-
export declare function _serverHandler<ComponentType = unknown>({ schema,
|
|
6
|
+
export declare function _serverHandler<ComponentType = unknown>({ schema, server, client, production, manifest, graphqlEndpoint, on_render, componentCache, }: {
|
|
7
7
|
schema?: GraphQLSchema | null;
|
|
8
|
-
|
|
8
|
+
server?: Server<any, any>;
|
|
9
9
|
client: HoudiniClient;
|
|
10
10
|
production: boolean;
|
|
11
11
|
manifest: RouterManifest<ComponentType> | null;
|
|
@@ -20,5 +20,5 @@ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga,
|
|
|
20
20
|
componentCache: Record<string, any>;
|
|
21
21
|
}) => Response | Promise<Response | undefined> | undefined;
|
|
22
22
|
} & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
|
|
23
|
-
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof
|
|
23
|
+
export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createServerAdapter>;
|
|
24
24
|
export type ServerAdapterFactory = typeof serverAdapterFactory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createServerAdapter
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { createServerAdapter } from "@whatwg-node/server";
|
|
2
|
+
import { localApiSessionKeys, getCurrentConfig } from "../lib/config";
|
|
3
|
+
import { Server } from "../server";
|
|
4
4
|
import { serialize as encodeCookie } from "./cookies";
|
|
5
5
|
import { find_match } from "./match";
|
|
6
6
|
import { get_session, handle_request, session_cookie_name } from "./session";
|
|
@@ -8,7 +8,7 @@ const config_file = getCurrentConfig();
|
|
|
8
8
|
const session_keys = localApiSessionKeys(config_file);
|
|
9
9
|
function _serverHandler({
|
|
10
10
|
schema,
|
|
11
|
-
|
|
11
|
+
server,
|
|
12
12
|
client,
|
|
13
13
|
production,
|
|
14
14
|
manifest,
|
|
@@ -16,18 +16,23 @@ function _serverHandler({
|
|
|
16
16
|
on_render,
|
|
17
17
|
componentCache
|
|
18
18
|
}) {
|
|
19
|
-
if (schema && !
|
|
20
|
-
|
|
19
|
+
if (schema && !server) {
|
|
20
|
+
server = new Server({
|
|
21
|
+
landingPage: !production
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
let requestHandler = null;
|
|
25
|
+
if (server && schema) {
|
|
26
|
+
requestHandler = server.init({
|
|
21
27
|
schema,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
context: async (request) => await get_session(request.headers, session_keys)
|
|
28
|
+
endpoint: graphqlEndpoint,
|
|
29
|
+
getSession: (request) => get_session(request.headers, session_keys)
|
|
25
30
|
});
|
|
26
31
|
}
|
|
27
32
|
client.componentCache = componentCache;
|
|
28
|
-
if (
|
|
33
|
+
if (requestHandler) {
|
|
29
34
|
client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
|
|
30
|
-
const response = await
|
|
35
|
+
const response = await requestHandler(
|
|
31
36
|
new Request(`http://localhost/${graphqlEndpoint}`, {
|
|
32
37
|
method: "POST",
|
|
33
38
|
headers: {
|
|
@@ -53,8 +58,8 @@ function _serverHandler({
|
|
|
53
58
|
);
|
|
54
59
|
}
|
|
55
60
|
const url = new URL(request.url).pathname;
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
61
|
+
if (requestHandler && url === graphqlEndpoint) {
|
|
62
|
+
return requestHandler(request);
|
|
58
63
|
}
|
|
59
64
|
const authResponse = await handle_request({
|
|
60
65
|
request,
|
|
@@ -79,7 +84,7 @@ function _serverHandler({
|
|
|
79
84
|
};
|
|
80
85
|
}
|
|
81
86
|
const serverAdapterFactory = (args) => {
|
|
82
|
-
return
|
|
87
|
+
return createServerAdapter(_serverHandler(args));
|
|
83
88
|
};
|
|
84
89
|
export {
|
|
85
90
|
_serverHandler,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ServerAdapterRequestHandler } from '@whatwg-node/server';
|
|
2
|
+
import { YogaServer } from 'graphql-yoga';
|
|
3
|
+
import type { YogaSchemaDefinition } from 'graphql-yoga/typings/plugins/use-schema';
|
|
4
|
+
type YogaParams = Required<ConstructorParameters<typeof YogaServer>>[0];
|
|
5
|
+
type ConstructorParams = Omit<YogaParams, 'schema' | 'graphqlEndpoint'>;
|
|
6
|
+
export declare class Server<ServerContext extends Record<string, any>, UserContext extends Record<string, any>> {
|
|
7
|
+
opts: ConstructorParams | null;
|
|
8
|
+
_yoga: YogaServer<any, any> | null;
|
|
9
|
+
constructor(opts?: ConstructorParams);
|
|
10
|
+
init({ endpoint, schema, getSession, }: {
|
|
11
|
+
schema: YogaSchemaDefinition<any>;
|
|
12
|
+
endpoint: string;
|
|
13
|
+
getSession: (request: Request) => Promise<UserContext>;
|
|
14
|
+
}): import("@whatwg-node/server").ServerAdapter<ServerContext, Server<ServerContext, UserContext>>;
|
|
15
|
+
handle: ServerAdapterRequestHandler<ServerContext>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createServerAdapter } from "@whatwg-node/server";
|
|
2
|
+
import { YogaServer } from "graphql-yoga";
|
|
3
|
+
class Server {
|
|
4
|
+
opts;
|
|
5
|
+
_yoga = null;
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
this.opts = opts ?? null;
|
|
8
|
+
}
|
|
9
|
+
init({
|
|
10
|
+
endpoint,
|
|
11
|
+
schema,
|
|
12
|
+
getSession
|
|
13
|
+
}) {
|
|
14
|
+
this._yoga = new YogaServer({
|
|
15
|
+
...this.opts,
|
|
16
|
+
schema,
|
|
17
|
+
graphqlEndpoint: endpoint,
|
|
18
|
+
context: async (ctx) => {
|
|
19
|
+
const userContext = !this.opts ? {} : typeof this.opts.context === "function" ? await this.opts.context(ctx) : this.opts.context || {};
|
|
20
|
+
const sessionContext = await getSession(ctx.request) || {};
|
|
21
|
+
return {
|
|
22
|
+
...userContext,
|
|
23
|
+
session: sessionContext
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return createServerAdapter(this, {
|
|
28
|
+
fetchAPI: this._yoga.fetchAPI,
|
|
29
|
+
plugins: this._yoga["plugins"]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
handle = (request, serverContext) => {
|
|
33
|
+
return this._yoga.handle(request, serverContext);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
Server
|
|
38
|
+
};
|
package/build/test-cjs/index.js
CHANGED
|
@@ -69233,6 +69233,10 @@ ${exportStatement("config")}
|
|
|
69233
69233
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
69234
69234
|
[join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
69235
69235
|
}),
|
|
69236
|
+
recursiveCopy(
|
|
69237
|
+
join(config.runtimeSource, "server"),
|
|
69238
|
+
join(config.rootDir, "server")
|
|
69239
|
+
),
|
|
69236
69240
|
generatePluginRuntimes({
|
|
69237
69241
|
config,
|
|
69238
69242
|
docs
|
|
@@ -70510,10 +70514,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
70510
70514
|
const [shapeType, inputType] = ensureImports({
|
|
70511
70515
|
config,
|
|
70512
70516
|
body,
|
|
70513
|
-
sourceModule:
|
|
70514
|
-
config.runtimeDirectory,
|
|
70515
|
-
config.artifactImportPath(doc.name)
|
|
70516
|
-
),
|
|
70517
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70517
70518
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
70518
70519
|
});
|
|
70519
70520
|
return prev.concat(
|
|
@@ -70543,10 +70544,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70543
70544
|
const [shapeType] = ensureImports({
|
|
70544
70545
|
config,
|
|
70545
70546
|
body,
|
|
70546
|
-
sourceModule:
|
|
70547
|
-
config.runtimeDirectory,
|
|
70548
|
-
config.artifactImportPath(doc.name)
|
|
70549
|
-
),
|
|
70547
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70550
70548
|
import: [`${definition.name.value}$data`]
|
|
70551
70549
|
});
|
|
70552
70550
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -70559,10 +70557,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70559
70557
|
ensureImports({
|
|
70560
70558
|
config,
|
|
70561
70559
|
body,
|
|
70562
|
-
sourceModule:
|
|
70563
|
-
config.runtimeDirectory,
|
|
70564
|
-
config.artifactImportPath(doc.name)
|
|
70565
|
-
),
|
|
70560
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70566
70561
|
import: [`${definition.name.value}$input`]
|
|
70567
70562
|
})[0]
|
|
70568
70563
|
)
|
package/build/test-esm/index.js
CHANGED
|
@@ -69229,6 +69229,10 @@ ${exportStatement("config")}
|
|
|
69229
69229
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
69230
69230
|
[join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
69231
69231
|
}),
|
|
69232
|
+
recursiveCopy(
|
|
69233
|
+
join(config.runtimeSource, "server"),
|
|
69234
|
+
join(config.rootDir, "server")
|
|
69235
|
+
),
|
|
69232
69236
|
generatePluginRuntimes({
|
|
69233
69237
|
config,
|
|
69234
69238
|
docs
|
|
@@ -70506,10 +70510,7 @@ function queryDefinitions(config, body, docs, returnType) {
|
|
|
70506
70510
|
const [shapeType, inputType] = ensureImports({
|
|
70507
70511
|
config,
|
|
70508
70512
|
body,
|
|
70509
|
-
sourceModule:
|
|
70510
|
-
config.runtimeDirectory,
|
|
70511
|
-
config.artifactImportPath(doc.name)
|
|
70512
|
-
),
|
|
70513
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70513
70514
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
70514
70515
|
});
|
|
70515
70516
|
return prev.concat(
|
|
@@ -70539,10 +70540,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70539
70540
|
const [shapeType] = ensureImports({
|
|
70540
70541
|
config,
|
|
70541
70542
|
body,
|
|
70542
|
-
sourceModule:
|
|
70543
|
-
config.runtimeDirectory,
|
|
70544
|
-
config.artifactImportPath(doc.name)
|
|
70545
|
-
),
|
|
70543
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70546
70544
|
import: [`${definition.name.value}$data`]
|
|
70547
70545
|
});
|
|
70548
70546
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -70555,10 +70553,7 @@ function fragmentListMap(config, concreteTypes, body, docs, return_type) {
|
|
|
70555
70553
|
ensureImports({
|
|
70556
70554
|
config,
|
|
70557
70555
|
body,
|
|
70558
|
-
sourceModule:
|
|
70559
|
-
config.runtimeDirectory,
|
|
70560
|
-
config.artifactImportPath(doc.name)
|
|
70561
|
-
),
|
|
70556
|
+
sourceModule: config.artifactImportPath(doc.name),
|
|
70562
70557
|
import: [`${definition.name.value}$input`]
|
|
70563
70558
|
})[0]
|
|
70564
70559
|
)
|
package/build/vite/hmr.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { EnvironmentModuleNode } from 'vite';
|
|
2
1
|
import { type Config } from '../lib';
|
|
3
2
|
export declare function isGraphQLFile(filepath: string): boolean;
|
|
4
3
|
export declare function shouldReactToFileChange(filepath: string, config: Config): Promise<boolean>;
|
|
5
|
-
export declare function fileDependsOnHoudini(modules: EnvironmentModuleNode[], houdiniPath: string): Boolean;
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -73003,7 +73003,7 @@ async function load_manifest(args) {
|
|
|
73003
73003
|
layout_queries: {},
|
|
73004
73004
|
artifacts: [],
|
|
73005
73005
|
local_schema: false,
|
|
73006
|
-
|
|
73006
|
+
local_server: false
|
|
73007
73007
|
},
|
|
73008
73008
|
queries: [],
|
|
73009
73009
|
layouts: [],
|
|
@@ -73027,8 +73027,8 @@ async function load_manifest(args) {
|
|
|
73027
73027
|
if (name === "+schema") {
|
|
73028
73028
|
manifest.local_schema = true;
|
|
73029
73029
|
}
|
|
73030
|
-
if (name === "+
|
|
73031
|
-
manifest.
|
|
73030
|
+
if (name === "+server") {
|
|
73031
|
+
manifest.local_server = true;
|
|
73032
73032
|
}
|
|
73033
73033
|
}
|
|
73034
73034
|
} catch {
|
|
@@ -80003,6 +80003,10 @@ ${exportStatement("config")}
|
|
|
80003
80003
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
80004
80004
|
[join2(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
80005
80005
|
}),
|
|
80006
|
+
recursiveCopy(
|
|
80007
|
+
join2(config2.runtimeSource, "server"),
|
|
80008
|
+
join2(config2.rootDir, "server")
|
|
80009
|
+
),
|
|
80006
80010
|
generatePluginRuntimes({
|
|
80007
80011
|
config: config2,
|
|
80008
80012
|
docs
|
|
@@ -81280,10 +81284,7 @@ function queryDefinitions(config2, body, docs, returnType) {
|
|
|
81280
81284
|
const [shapeType, inputType] = ensureImports({
|
|
81281
81285
|
config: config2,
|
|
81282
81286
|
body,
|
|
81283
|
-
sourceModule:
|
|
81284
|
-
config2.runtimeDirectory,
|
|
81285
|
-
config2.artifactImportPath(doc.name)
|
|
81286
|
-
),
|
|
81287
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81287
81288
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
81288
81289
|
});
|
|
81289
81290
|
return prev.concat(
|
|
@@ -81313,10 +81314,7 @@ function fragmentListMap(config2, concreteTypes, body, docs, return_type) {
|
|
|
81313
81314
|
const [shapeType] = ensureImports({
|
|
81314
81315
|
config: config2,
|
|
81315
81316
|
body,
|
|
81316
|
-
sourceModule:
|
|
81317
|
-
config2.runtimeDirectory,
|
|
81318
|
-
config2.artifactImportPath(doc.name)
|
|
81319
|
-
),
|
|
81317
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81320
81318
|
import: [`${definition.name.value}$data`]
|
|
81321
81319
|
});
|
|
81322
81320
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -81329,10 +81327,7 @@ function fragmentListMap(config2, concreteTypes, body, docs, return_type) {
|
|
|
81329
81327
|
ensureImports({
|
|
81330
81328
|
config: config2,
|
|
81331
81329
|
body,
|
|
81332
|
-
sourceModule:
|
|
81333
|
-
config2.runtimeDirectory,
|
|
81334
|
-
config2.artifactImportPath(doc.name)
|
|
81335
|
-
),
|
|
81330
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81336
81331
|
import: [`${definition.name.value}$input`]
|
|
81337
81332
|
})[0]
|
|
81338
81333
|
)
|
|
@@ -85754,17 +85749,6 @@ async function shouldReactToFileChange(filepath, config2) {
|
|
|
85754
85749
|
}
|
|
85755
85750
|
return config2.includeFile(filepath, { root: process.cwd() });
|
|
85756
85751
|
}
|
|
85757
|
-
function fileDependsOnHoudini(modules, houdiniPath) {
|
|
85758
|
-
const fileDependencies = modules.reduce((acc, module2) => {
|
|
85759
|
-
module2.importedModules.forEach((importedModule) => {
|
|
85760
|
-
if (importedModule?.id) acc.push(importedModule.id);
|
|
85761
|
-
});
|
|
85762
|
-
return acc;
|
|
85763
|
-
}, []);
|
|
85764
|
-
return fileDependencies.some((file) => {
|
|
85765
|
-
return file.startsWith(houdiniPath);
|
|
85766
|
-
});
|
|
85767
|
-
}
|
|
85768
85752
|
|
|
85769
85753
|
// src/vite/houdini.ts
|
|
85770
85754
|
var config;
|
|
@@ -85778,12 +85762,19 @@ function Plugin(opts = {}) {
|
|
|
85778
85762
|
// houdini will always act as a "meta framework" and process the user's code before it
|
|
85779
85763
|
// is processed by the user's library-specific plugins.
|
|
85780
85764
|
enforce: "pre",
|
|
85781
|
-
async hotUpdate({
|
|
85765
|
+
async hotUpdate({
|
|
85766
|
+
file,
|
|
85767
|
+
server,
|
|
85768
|
+
modules,
|
|
85769
|
+
timestamp,
|
|
85770
|
+
read
|
|
85771
|
+
}) {
|
|
85782
85772
|
const config2 = await getConfig(opts);
|
|
85783
85773
|
const shouldReact = await shouldReactToFileChange(file, config2);
|
|
85784
85774
|
const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? ".houdini");
|
|
85775
|
+
const dependsOn = (await read()).includes("$houdini");
|
|
85785
85776
|
const isGqlFile = isGraphQLFile(file);
|
|
85786
|
-
if (!(shouldReact && (
|
|
85777
|
+
if (!(shouldReact && (dependsOn || isGqlFile))) {
|
|
85787
85778
|
return modules;
|
|
85788
85779
|
}
|
|
85789
85780
|
if (config2.localSchema) {
|
|
@@ -85793,20 +85784,18 @@ function Plugin(opts = {}) {
|
|
|
85793
85784
|
config2.pluginMode = true;
|
|
85794
85785
|
let artifactStats = void 0;
|
|
85795
85786
|
if (!lastHotUpdateEvent || timestamp !== lastHotUpdateEvent.timestamp) {
|
|
85796
|
-
console.log("\u{1F3A9} \u{1F504} bundle HMR rebuild...");
|
|
85797
85787
|
try {
|
|
85798
85788
|
artifactStats = await compile(config2);
|
|
85799
85789
|
} catch (e2) {
|
|
85800
85790
|
formatErrors(e2);
|
|
85801
85791
|
}
|
|
85792
|
+
lastHotUpdateEvent = {
|
|
85793
|
+
timestamp
|
|
85794
|
+
};
|
|
85802
85795
|
}
|
|
85803
|
-
lastHotUpdateEvent = {
|
|
85804
|
-
timestamp
|
|
85805
|
-
};
|
|
85806
85796
|
if (!artifactStats) {
|
|
85807
85797
|
return modules;
|
|
85808
85798
|
}
|
|
85809
|
-
console.log("\u{1F3A9} \u2B06\uFE0F bundle changed, triggering HMR update");
|
|
85810
85799
|
const taintedModules = [];
|
|
85811
85800
|
for await (const file2 of fs_exports.walk(runtimeDir)) {
|
|
85812
85801
|
const module2 = environment.moduleGraph.getModuleById(file2);
|
package/build/vite-esm/index.js
CHANGED
|
@@ -72996,7 +72996,7 @@ async function load_manifest(args) {
|
|
|
72996
72996
|
layout_queries: {},
|
|
72997
72997
|
artifacts: [],
|
|
72998
72998
|
local_schema: false,
|
|
72999
|
-
|
|
72999
|
+
local_server: false
|
|
73000
73000
|
},
|
|
73001
73001
|
queries: [],
|
|
73002
73002
|
layouts: [],
|
|
@@ -73020,8 +73020,8 @@ async function load_manifest(args) {
|
|
|
73020
73020
|
if (name === "+schema") {
|
|
73021
73021
|
manifest.local_schema = true;
|
|
73022
73022
|
}
|
|
73023
|
-
if (name === "+
|
|
73024
|
-
manifest.
|
|
73023
|
+
if (name === "+server") {
|
|
73024
|
+
manifest.local_server = true;
|
|
73025
73025
|
}
|
|
73026
73026
|
}
|
|
73027
73027
|
} catch {
|
|
@@ -79995,6 +79995,10 @@ ${exportStatement("config")}
|
|
|
79995
79995
|
// we need to update the list of client plugins that get injected by codegen plugins
|
|
79996
79996
|
[join2(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
79997
79997
|
}),
|
|
79998
|
+
recursiveCopy(
|
|
79999
|
+
join2(config2.runtimeSource, "server"),
|
|
80000
|
+
join2(config2.rootDir, "server")
|
|
80001
|
+
),
|
|
79998
80002
|
generatePluginRuntimes({
|
|
79999
80003
|
config: config2,
|
|
80000
80004
|
docs
|
|
@@ -81272,10 +81276,7 @@ function queryDefinitions(config2, body, docs, returnType) {
|
|
|
81272
81276
|
const [shapeType, inputType] = ensureImports({
|
|
81273
81277
|
config: config2,
|
|
81274
81278
|
body,
|
|
81275
|
-
sourceModule:
|
|
81276
|
-
config2.runtimeDirectory,
|
|
81277
|
-
config2.artifactImportPath(doc.name)
|
|
81278
|
-
),
|
|
81279
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81279
81280
|
import: [`${doc.name}$result`, `${doc.name}$input`]
|
|
81280
81281
|
});
|
|
81281
81282
|
return prev.concat(
|
|
@@ -81305,10 +81306,7 @@ function fragmentListMap(config2, concreteTypes, body, docs, return_type) {
|
|
|
81305
81306
|
const [shapeType] = ensureImports({
|
|
81306
81307
|
config: config2,
|
|
81307
81308
|
body,
|
|
81308
|
-
sourceModule:
|
|
81309
|
-
config2.runtimeDirectory,
|
|
81310
|
-
config2.artifactImportPath(doc.name)
|
|
81311
|
-
),
|
|
81309
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81312
81310
|
import: [`${definition.name.value}$data`]
|
|
81313
81311
|
});
|
|
81314
81312
|
let inputType = AST13.tsNeverKeyword();
|
|
@@ -81321,10 +81319,7 @@ function fragmentListMap(config2, concreteTypes, body, docs, return_type) {
|
|
|
81321
81319
|
ensureImports({
|
|
81322
81320
|
config: config2,
|
|
81323
81321
|
body,
|
|
81324
|
-
sourceModule:
|
|
81325
|
-
config2.runtimeDirectory,
|
|
81326
|
-
config2.artifactImportPath(doc.name)
|
|
81327
|
-
),
|
|
81322
|
+
sourceModule: config2.artifactImportPath(doc.name),
|
|
81328
81323
|
import: [`${definition.name.value}$input`]
|
|
81329
81324
|
})[0]
|
|
81330
81325
|
)
|
|
@@ -85746,17 +85741,6 @@ async function shouldReactToFileChange(filepath, config2) {
|
|
|
85746
85741
|
}
|
|
85747
85742
|
return config2.includeFile(filepath, { root: process.cwd() });
|
|
85748
85743
|
}
|
|
85749
|
-
function fileDependsOnHoudini(modules, houdiniPath) {
|
|
85750
|
-
const fileDependencies = modules.reduce((acc, module) => {
|
|
85751
|
-
module.importedModules.forEach((importedModule) => {
|
|
85752
|
-
if (importedModule?.id) acc.push(importedModule.id);
|
|
85753
|
-
});
|
|
85754
|
-
return acc;
|
|
85755
|
-
}, []);
|
|
85756
|
-
return fileDependencies.some((file) => {
|
|
85757
|
-
return file.startsWith(houdiniPath);
|
|
85758
|
-
});
|
|
85759
|
-
}
|
|
85760
85744
|
|
|
85761
85745
|
// src/vite/houdini.ts
|
|
85762
85746
|
var config;
|
|
@@ -85770,12 +85754,19 @@ function Plugin(opts = {}) {
|
|
|
85770
85754
|
// houdini will always act as a "meta framework" and process the user's code before it
|
|
85771
85755
|
// is processed by the user's library-specific plugins.
|
|
85772
85756
|
enforce: "pre",
|
|
85773
|
-
async hotUpdate({
|
|
85757
|
+
async hotUpdate({
|
|
85758
|
+
file,
|
|
85759
|
+
server,
|
|
85760
|
+
modules,
|
|
85761
|
+
timestamp,
|
|
85762
|
+
read
|
|
85763
|
+
}) {
|
|
85774
85764
|
const config2 = await getConfig(opts);
|
|
85775
85765
|
const shouldReact = await shouldReactToFileChange(file, config2);
|
|
85776
85766
|
const runtimeDir = path_exports.join(config2.projectRoot, config2.runtimeDir ?? ".houdini");
|
|
85767
|
+
const dependsOn = (await read()).includes("$houdini");
|
|
85777
85768
|
const isGqlFile = isGraphQLFile(file);
|
|
85778
|
-
if (!(shouldReact && (
|
|
85769
|
+
if (!(shouldReact && (dependsOn || isGqlFile))) {
|
|
85779
85770
|
return modules;
|
|
85780
85771
|
}
|
|
85781
85772
|
if (config2.localSchema) {
|
|
@@ -85785,20 +85776,18 @@ function Plugin(opts = {}) {
|
|
|
85785
85776
|
config2.pluginMode = true;
|
|
85786
85777
|
let artifactStats = void 0;
|
|
85787
85778
|
if (!lastHotUpdateEvent || timestamp !== lastHotUpdateEvent.timestamp) {
|
|
85788
|
-
console.log("\u{1F3A9} \u{1F504} bundle HMR rebuild...");
|
|
85789
85779
|
try {
|
|
85790
85780
|
artifactStats = await compile(config2);
|
|
85791
85781
|
} catch (e2) {
|
|
85792
85782
|
formatErrors(e2);
|
|
85793
85783
|
}
|
|
85784
|
+
lastHotUpdateEvent = {
|
|
85785
|
+
timestamp
|
|
85786
|
+
};
|
|
85794
85787
|
}
|
|
85795
|
-
lastHotUpdateEvent = {
|
|
85796
|
-
timestamp
|
|
85797
|
-
};
|
|
85798
85788
|
if (!artifactStats) {
|
|
85799
85789
|
return modules;
|
|
85800
85790
|
}
|
|
85801
|
-
console.log("\u{1F3A9} \u2B06\uFE0F bundle changed, triggering HMR update");
|
|
85802
85791
|
const taintedModules = [];
|
|
85803
85792
|
for await (const file2 of fs_exports.walk(runtimeDir)) {
|
|
85804
85793
|
const module = environment.moduleGraph.getModuleById(file2);
|
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.9",
|
|
4
4
|
"description": "The disappearing GraphQL clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/fs-extra": "^9.0.13",
|
|
39
39
|
"@types/micromatch": "^4.0.2",
|
|
40
40
|
"@ungap/structured-clone": "^1.0.2",
|
|
41
|
-
"@whatwg-node/server": "^0.
|
|
41
|
+
"@whatwg-node/server": "^0.10.5",
|
|
42
42
|
"ast-types": "^0.16.1",
|
|
43
43
|
"commander": "^9.4.0",
|
|
44
44
|
"deepmerge": "^4.2.2",
|