houdini 1.2.12 → 1.2.14

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.
Files changed (51) hide show
  1. package/build/adapter/index.d.ts +3 -0
  2. package/build/adapter-cjs/index.js +33 -0
  3. package/build/adapter-esm/index.js +9 -0
  4. package/build/cmd/init.d.ts +1 -0
  5. package/build/cmd-cjs/index.js +53 -48
  6. package/build/cmd-esm/index.js +51 -46
  7. package/build/codegen-cjs/index.js +23 -25
  8. package/build/codegen-esm/index.js +23 -24
  9. package/build/lib/index.d.ts +3 -1
  10. package/build/{router → lib/router}/conventions.d.ts +3 -5
  11. package/build/{router → lib/router}/index.d.ts +1 -1
  12. package/build/{router → lib/router}/manifest.d.ts +2 -2
  13. package/build/{router → lib/router}/server.d.ts +2 -2
  14. package/build/{router → lib/router}/types.d.ts +2 -1
  15. package/build/lib/types.d.ts +1 -1
  16. package/build/lib-cjs/index.js +148 -32
  17. package/build/lib-esm/index.js +142 -29
  18. package/build/runtime/lib/types.d.ts +1 -1
  19. package/build/runtime/router/match.d.ts +38 -0
  20. package/build/runtime/router/server.d.ts +22 -25
  21. package/build/runtime/router/session.d.ts +22 -0
  22. package/build/runtime/router/types.d.ts +23 -0
  23. package/build/runtime-cjs/lib/types.d.ts +1 -1
  24. package/build/runtime-cjs/lib/types.js +2 -0
  25. package/build/runtime-cjs/router/match.d.ts +38 -0
  26. package/build/runtime-cjs/router/match.js +149 -0
  27. package/build/runtime-cjs/router/server.d.ts +22 -25
  28. package/build/runtime-cjs/router/server.js +71 -49
  29. package/build/runtime-cjs/router/session.d.ts +22 -0
  30. package/build/runtime-cjs/router/session.js +77 -0
  31. package/build/runtime-cjs/router/types.d.ts +23 -0
  32. package/build/runtime-cjs/router/types.js +16 -0
  33. package/build/runtime-esm/lib/types.d.ts +1 -1
  34. package/build/runtime-esm/lib/types.js +1 -0
  35. package/build/runtime-esm/router/match.d.ts +38 -0
  36. package/build/runtime-esm/router/match.js +122 -0
  37. package/build/runtime-esm/router/server.d.ts +22 -25
  38. package/build/runtime-esm/router/server.js +64 -47
  39. package/build/runtime-esm/router/session.d.ts +22 -0
  40. package/build/runtime-esm/router/session.js +52 -0
  41. package/build/runtime-esm/router/types.d.ts +23 -0
  42. package/build/runtime-esm/router/types.js +0 -0
  43. package/build/test-cjs/index.js +27 -25
  44. package/build/test-esm/index.js +27 -24
  45. package/build/vite-cjs/index.js +40 -46
  46. package/build/vite-esm/index.js +39 -44
  47. package/package.json +10 -9
  48. package/build/router-cjs/index.js +0 -57736
  49. package/build/router-esm/index.js +0 -57726
  50. /package/build/{router-cjs → adapter-cjs}/package.json +0 -0
  51. /package/build/{router-esm → adapter-esm}/package.json +0 -0
@@ -1,4 +1,3 @@
1
- import { createRequire as conflict_free } from 'module'; const require = conflict_free(import.meta.url);
2
1
  "use strict";
3
2
  var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
@@ -57108,7 +57107,7 @@ var LogLevel = {
57108
57107
 
57109
57108
  // src/lib/config.ts
57110
57109
  var import_meta = {};
57111
- var currentDir = global.__dirname || dirname((0, import_node_url.fileURLToPath)(import_meta.url));
57110
+ var currentDir = dirname((0, import_node_url.fileURLToPath)(import_meta.url));
57112
57111
  var DEFAULT_CONFIG_PATH = join(process.cwd(), "houdini.config.js");
57113
57112
  var emptySchema = graphql2.buildSchema("type Query { hello: String }");
57114
57113
  var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
@@ -57541,13 +57540,10 @@ async function find_graphql(config2, parsedScript, walker) {
57541
57540
  });
57542
57541
  }
57543
57542
 
57544
- // src/router/manifest.ts
57543
+ // src/lib/router/manifest.ts
57545
57544
  var t = __toESM(require_lib6(), 1);
57546
57545
  var graphql5 = __toESM(require("graphql"), 1);
57547
57546
 
57548
- // src/router/server.ts
57549
- var import_vite = require("vite");
57550
-
57551
57547
  // src/codegen/generators/artifacts/index.ts
57552
57548
  var graphql15 = __toESM(require("graphql"), 1);
57553
57549
  var recast5 = __toESM(require_main2(), 1);
@@ -58554,9 +58550,11 @@ function serializeValue(value) {
58554
58550
  }
58555
58551
  if (typeof value === "object" && value !== null) {
58556
58552
  return AST4.objectExpression(
58557
- Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
58558
- ([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
58559
- )
58553
+ Object.entries(value).filter(
58554
+ ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58555
+ ).map(([key, val]) => {
58556
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58557
+ })
58560
58558
  );
58561
58559
  }
58562
58560
  if (typeof value === "string") {
@@ -59103,7 +59101,7 @@ async function paginate(config2, documents) {
59103
59101
  value: "__typename"
59104
59102
  }
59105
59103
  },
59106
- ...(typeConfig?.keys || ["id"]).map((key) => ({
59104
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
59107
59105
  kind: graphql11.Kind.FIELD,
59108
59106
  name: {
59109
59107
  kind: graphql11.Kind.NAME,
@@ -62787,7 +62785,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
62787
62785
  if (missing.length > 0) {
62788
62786
  ctx.reportError(
62789
62787
  new graphql26.GraphQLError(
62790
- "The following arguments are missing from this fragment: " + JSON.stringify(missing)
62788
+ `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
62791
62789
  )
62792
62790
  );
62793
62791
  return;
@@ -63023,7 +63021,7 @@ function nodeDirectives(config2, directives) {
63023
63021
  }
63024
63022
  if (!possibleNodes.includes(definitionType)) {
63025
63023
  ctx.reportError(
63026
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
63024
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
63027
63025
  );
63028
63026
  }
63029
63027
  }
@@ -63158,45 +63156,45 @@ function getAndVerifyNodeInterface(config2) {
63158
63156
  return null;
63159
63157
  }
63160
63158
  if (!graphql26.isInterfaceType(nodeInterface)) {
63161
- displayInvalidNodeFieldMessage(config2.logLevel);
63159
+ displayInvalidNodeFieldMessage(config2);
63162
63160
  return null;
63163
63161
  }
63164
63162
  const queryType = schema.getQueryType();
63165
63163
  if (!queryType) {
63166
- displayInvalidNodeFieldMessage(config2.logLevel);
63164
+ displayInvalidNodeFieldMessage(config2);
63167
63165
  return null;
63168
63166
  }
63169
63167
  const nodeField = queryType.getFields()["node"];
63170
63168
  if (!nodeField) {
63171
- displayInvalidNodeFieldMessage(config2.logLevel);
63169
+ displayInvalidNodeFieldMessage(config2);
63172
63170
  return null;
63173
63171
  }
63174
63172
  const args = nodeField.args;
63175
63173
  if (args.length === 0) {
63176
- displayInvalidNodeFieldMessage(config2.logLevel);
63174
+ displayInvalidNodeFieldMessage(config2);
63177
63175
  return null;
63178
63176
  }
63179
- const idArg = args.find((arg) => arg.name === "id");
63177
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
63180
63178
  if (!idArg) {
63181
- displayInvalidNodeFieldMessage(config2.logLevel);
63179
+ displayInvalidNodeFieldMessage(config2);
63182
63180
  return null;
63183
63181
  }
63184
63182
  const idType = unwrapType(config2, idArg.type);
63185
63183
  if (idType.type.name !== "ID") {
63186
- displayInvalidNodeFieldMessage(config2.logLevel);
63184
+ displayInvalidNodeFieldMessage(config2);
63187
63185
  return null;
63188
63186
  }
63189
63187
  const fieldReturnType = unwrapType(config2, nodeField.type);
63190
63188
  if (fieldReturnType.type.name !== "Node") {
63191
- displayInvalidNodeFieldMessage(config2.logLevel);
63189
+ displayInvalidNodeFieldMessage(config2);
63192
63190
  return null;
63193
63191
  }
63194
63192
  return nodeInterface;
63195
63193
  }
63196
63194
  var nbInvalidNodeFieldMessageDisplayed = 0;
63197
- function displayInvalidNodeFieldMessage(logLevel) {
63195
+ function displayInvalidNodeFieldMessage(config2) {
63198
63196
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
63199
- if (logLevel === LogLevel.Full) {
63197
+ if (config2.logLevel === LogLevel.Full) {
63200
63198
  console.warn(invalidNodeFieldMessage);
63201
63199
  } else {
63202
63200
  console.warn(invalidNodeFieldMessageLight);
@@ -63210,18 +63208,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
63210
63208
  If you are trying to provide the Node interface and its field, they must look like the following:
63211
63209
 
63212
63210
  interface Node {
63213
- id: ID!
63211
+ id: ID!
63214
63212
  }
63215
63213
 
63216
63214
  extend type Query {
63217
- node(id: ID!): Node
63215
+ node(id: ID!): Node
63218
63216
  }
63219
63217
 
63220
63218
  For more information, please visit these links:
63221
63219
  - https://graphql.org/learn/global-object-identification/
63222
63220
  - ${siteURL}/guides/caching-data#custom-ids
63223
63221
  `;
63224
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63222
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63225
63223
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
63226
63224
  have defined a resolver entry for the fragment type.
63227
63225
 
@@ -57106,7 +57106,7 @@ var LogLevel = {
57106
57106
  };
57107
57107
 
57108
57108
  // src/lib/config.ts
57109
- var currentDir = global.__dirname || dirname(fileURLToPath(import.meta.url));
57109
+ var currentDir = dirname(fileURLToPath(import.meta.url));
57110
57110
  var DEFAULT_CONFIG_PATH = join(process.cwd(), "houdini.config.js");
57111
57111
  var emptySchema = graphql2.buildSchema("type Query { hello: String }");
57112
57112
  var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
@@ -57539,13 +57539,10 @@ async function find_graphql(config2, parsedScript, walker) {
57539
57539
  });
57540
57540
  }
57541
57541
 
57542
- // src/router/manifest.ts
57542
+ // src/lib/router/manifest.ts
57543
57543
  var t = __toESM(require_lib6(), 1);
57544
57544
  import * as graphql5 from "graphql";
57545
57545
 
57546
- // src/router/server.ts
57547
- import { build } from "vite";
57548
-
57549
57546
  // src/codegen/generators/artifacts/index.ts
57550
57547
  var recast5 = __toESM(require_main2(), 1);
57551
57548
  import * as graphql15 from "graphql";
@@ -58552,9 +58549,11 @@ function serializeValue(value) {
58552
58549
  }
58553
58550
  if (typeof value === "object" && value !== null) {
58554
58551
  return AST4.objectExpression(
58555
- Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
58556
- ([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
58557
- )
58552
+ Object.entries(value).filter(
58553
+ ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58554
+ ).map(([key, val]) => {
58555
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58556
+ })
58558
58557
  );
58559
58558
  }
58560
58559
  if (typeof value === "string") {
@@ -59101,7 +59100,7 @@ async function paginate(config2, documents) {
59101
59100
  value: "__typename"
59102
59101
  }
59103
59102
  },
59104
- ...(typeConfig?.keys || ["id"]).map((key) => ({
59103
+ ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
59105
59104
  kind: graphql11.Kind.FIELD,
59106
59105
  name: {
59107
59106
  kind: graphql11.Kind.NAME,
@@ -62785,7 +62784,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
62785
62784
  if (missing.length > 0) {
62786
62785
  ctx.reportError(
62787
62786
  new graphql26.GraphQLError(
62788
- "The following arguments are missing from this fragment: " + JSON.stringify(missing)
62787
+ `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
62789
62788
  )
62790
62789
  );
62791
62790
  return;
@@ -63021,7 +63020,7 @@ function nodeDirectives(config2, directives) {
63021
63020
  }
63022
63021
  if (!possibleNodes.includes(definitionType)) {
63023
63022
  ctx.reportError(
63024
- new graphql26.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
63023
+ new graphql26.GraphQLError(paginateOnNonNodeMessage(node.name.value))
63025
63024
  );
63026
63025
  }
63027
63026
  }
@@ -63156,45 +63155,45 @@ function getAndVerifyNodeInterface(config2) {
63156
63155
  return null;
63157
63156
  }
63158
63157
  if (!graphql26.isInterfaceType(nodeInterface)) {
63159
- displayInvalidNodeFieldMessage(config2.logLevel);
63158
+ displayInvalidNodeFieldMessage(config2);
63160
63159
  return null;
63161
63160
  }
63162
63161
  const queryType = schema.getQueryType();
63163
63162
  if (!queryType) {
63164
- displayInvalidNodeFieldMessage(config2.logLevel);
63163
+ displayInvalidNodeFieldMessage(config2);
63165
63164
  return null;
63166
63165
  }
63167
63166
  const nodeField = queryType.getFields()["node"];
63168
63167
  if (!nodeField) {
63169
- displayInvalidNodeFieldMessage(config2.logLevel);
63168
+ displayInvalidNodeFieldMessage(config2);
63170
63169
  return null;
63171
63170
  }
63172
63171
  const args = nodeField.args;
63173
63172
  if (args.length === 0) {
63174
- displayInvalidNodeFieldMessage(config2.logLevel);
63173
+ displayInvalidNodeFieldMessage(config2);
63175
63174
  return null;
63176
63175
  }
63177
- const idArg = args.find((arg) => arg.name === "id");
63176
+ const idArg = args.find((arg) => arg.name === config2.defaultKeys[0]);
63178
63177
  if (!idArg) {
63179
- displayInvalidNodeFieldMessage(config2.logLevel);
63178
+ displayInvalidNodeFieldMessage(config2);
63180
63179
  return null;
63181
63180
  }
63182
63181
  const idType = unwrapType(config2, idArg.type);
63183
63182
  if (idType.type.name !== "ID") {
63184
- displayInvalidNodeFieldMessage(config2.logLevel);
63183
+ displayInvalidNodeFieldMessage(config2);
63185
63184
  return null;
63186
63185
  }
63187
63186
  const fieldReturnType = unwrapType(config2, nodeField.type);
63188
63187
  if (fieldReturnType.type.name !== "Node") {
63189
- displayInvalidNodeFieldMessage(config2.logLevel);
63188
+ displayInvalidNodeFieldMessage(config2);
63190
63189
  return null;
63191
63190
  }
63192
63191
  return nodeInterface;
63193
63192
  }
63194
63193
  var nbInvalidNodeFieldMessageDisplayed = 0;
63195
- function displayInvalidNodeFieldMessage(logLevel) {
63194
+ function displayInvalidNodeFieldMessage(config2) {
63196
63195
  if (nbInvalidNodeFieldMessageDisplayed === 0) {
63197
- if (logLevel === LogLevel.Full) {
63196
+ if (config2.logLevel === LogLevel.Full) {
63198
63197
  console.warn(invalidNodeFieldMessage);
63199
63198
  } else {
63200
63199
  console.warn(invalidNodeFieldMessageLight);
@@ -63208,18 +63207,18 @@ var invalidNodeFieldMessage = `\u26A0\uFE0F Your project defines a Node interfa
63208
63207
  If you are trying to provide the Node interface and its field, they must look like the following:
63209
63208
 
63210
63209
  interface Node {
63211
- id: ID!
63210
+ id: ID!
63212
63211
  }
63213
63212
 
63214
63213
  extend type Query {
63215
- node(id: ID!): Node
63214
+ node(id: ID!): Node
63216
63215
  }
63217
63216
 
63218
63217
  For more information, please visit these links:
63219
63218
  - https://graphql.org/learn/global-object-identification/
63220
63219
  - ${siteURL}/guides/caching-data#custom-ids
63221
63220
  `;
63222
- var paginateOnNonNodeMessage = (config2, directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63221
+ var paginateOnNonNodeMessage = (directiveName) => `It looks like you are trying to use @${directiveName} on a document that does not have a valid type resolver.
63223
63222
  If this is happening inside of a fragment, make sure that the fragment either implements the Node interface or you
63224
63223
  have defined a resolver entry for the fragment type.
63225
63224
 
@@ -12,9 +12,11 @@ export * from './cleanupFiles';
12
12
  export * from './deepMerge';
13
13
  export * from './plugin';
14
14
  export * from './detectTools';
15
+ export * from '../runtime/router/match';
15
16
  export * from './walk';
16
17
  export type { EmbeddedGraphqlDocument } from './walk';
17
18
  export * as fs from './fs';
18
19
  export * as path from './path';
19
- export * from '../router';
20
+ export * from './router';
20
21
  export { Cache } from '../runtime/cache/cache';
22
+ export * from '../runtime/router/match';
@@ -1,12 +1,10 @@
1
- import { type Config } from '../lib';
1
+ import { type Config } from '..';
2
2
  /** The location of the project's router */
3
3
  export declare function router_path(config: Config): string;
4
4
  /** The location of the page component */
5
5
  export declare function page_entry_path(config: Config, id: string, base?: string): string;
6
- export declare function render_client_path(config: Config, base?: string): string;
7
- export declare function render_server_path(config: Config, base?: string): string;
8
- export declare function render_yoga_path(config: Config, base?: string): string;
9
- export declare function render_app_path(config: Config, base?: string): string;
6
+ export declare function server_adapter_path(config: Config, base?: string): string;
7
+ export declare function adapter_config_path(config: Config, base?: string): string;
10
8
  export declare function page_unit_path(config: Config, id: string, base?: string): string;
11
9
  export declare function layout_unit_path(config: Config, id: string, base?: string): string;
12
10
  export declare function fallback_unit_path(config: Config, which: 'page' | 'layout', id: string, base?: string): string;
@@ -6,4 +6,4 @@ export * as routerConventions from './conventions';
6
6
  export * from './manifest';
7
7
  export * from './types';
8
8
  export * from './server';
9
- export { handle_request, get_session } from '../runtime/router/server';
9
+ export { handle_request, get_session } from '../../runtime/router/session';
@@ -1,5 +1,5 @@
1
- import { type Config } from '../lib';
2
- import type { ProjectManifest, PageManifest, QueryManifest } from '../runtime/lib/types';
1
+ import { type Config } from '..';
2
+ import type { ProjectManifest, PageManifest, QueryManifest } from '../../runtime/lib/types';
3
3
  export type { ProjectManifest, PageManifest, QueryManifest };
4
4
  /**
5
5
  * Walk down the routes directory and build a normalized description of the project's
@@ -1,4 +1,4 @@
1
1
  import type * as graphql from 'graphql';
2
- import type { Config } from '../lib/config';
3
- export declare function isViteSchemaBuild(): boolean;
2
+ import type { Config } from '../config';
3
+ export declare function isSecondaryBuild(): boolean;
4
4
  export declare function loadLocalSchema(config: Config): Promise<graphql.GraphQLSchema>;
@@ -1,5 +1,5 @@
1
1
  import type { ProjectManifest, routerConventions } from '.';
2
- import type { Config } from '../lib/config';
2
+ import type { Config } from '../config';
3
3
  export type Adapter = (args: {
4
4
  config: Config;
5
5
  conventions: typeof routerConventions;
@@ -7,4 +7,5 @@ export type Adapter = (args: {
7
7
  publicBase: string;
8
8
  outDir: string;
9
9
  manifest: ProjectManifest;
10
+ adapterPath: string;
10
11
  }) => void | Promise<void>;
@@ -2,11 +2,11 @@ import type * as graphql from 'graphql';
2
2
  import type * as recast from 'recast';
3
3
  import type { CustomPluginOptions, InputOptions, LoadResult, MinimalPluginContext, NormalizedInputOptions, NullValue, ObjectHook, PluginContext, ResolveIdResult, SourceMapInput } from 'rollup';
4
4
  import type { ConfigEnv, ResolvedConfig, UserConfig, ViteDevServer } from 'vite';
5
- import type { Adapter } from '../router';
6
5
  import type { ConfigFile } from '../runtime/lib/config';
7
6
  import type { ArtifactKinds, BaseCompiledDocument, DocumentArtifact, ValueOf } from '../runtime/lib/types';
8
7
  import type { TransformPage } from '../vite/houdini';
9
8
  import type { Config } from './config';
9
+ import type { Adapter } from './router';
10
10
  type Program = recast.types.namedTypes.Program;
11
11
  export type Maybe<T> = T | null | undefined;
12
12
  export type Script = Program;