nitro-graphql 2.0.0-beta.70 → 2.0.0-beta.72

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 (112) hide show
  1. package/dist/cli/adapter.mjs +1 -3
  2. package/dist/cli/commands/build.d.mts +2 -2
  3. package/dist/cli/commands/build.mjs +1 -3
  4. package/dist/cli/commands/dev.d.mts +2 -2
  5. package/dist/cli/commands/dev.mjs +1 -3
  6. package/dist/cli/commands/generate.mjs +8 -8
  7. package/dist/cli/commands/index.mjs +1 -2
  8. package/dist/cli/commands/init.mjs +4 -4
  9. package/dist/cli/commands/validate.mjs +1 -3
  10. package/dist/cli/completions.mjs +1 -3
  11. package/dist/cli/config.mjs +1 -2
  12. package/dist/cli/index.mjs +1 -3
  13. package/dist/cli/server/debug-handler.mjs +2 -5
  14. package/dist/cli/server/dev-server.mjs +1 -3
  15. package/dist/cli/server/graphql-handler.mjs +1 -3
  16. package/dist/cli/server/health-handler.mjs +1 -2
  17. package/dist/cli/server/loader.mjs +1 -3
  18. package/dist/cli/server/sandbox-handler.mjs +1 -3
  19. package/dist/cli/server/watcher.mjs +1 -3
  20. package/dist/cli/server/ws-handler.mjs +1 -3
  21. package/dist/config.mjs +1 -2
  22. package/dist/core/codegen/client.mjs +1 -3
  23. package/dist/core/codegen/document-loader.mjs +1 -3
  24. package/dist/core/codegen/index.mjs +1 -2
  25. package/dist/core/codegen/plugin.mjs +1 -2
  26. package/dist/core/codegen/runtime.d.mts +0 -2
  27. package/dist/core/codegen/runtime.mjs +6 -5
  28. package/dist/core/codegen/schema-loader.mjs +1 -3
  29. package/dist/core/codegen/server.mjs +1 -3
  30. package/dist/core/codegen/validation.mjs +1 -3
  31. package/dist/core/config.mjs +6 -8
  32. package/dist/core/constants.mjs +1 -3
  33. package/dist/core/debug/index.mjs +1 -2
  34. package/dist/core/debug/template.mjs +5 -4
  35. package/dist/core/extend/index.mjs +1 -2
  36. package/dist/core/extend/loader.mjs +1 -3
  37. package/dist/core/index.d.mts +0 -4
  38. package/dist/core/index.mjs +1 -2
  39. package/dist/core/manifest.mjs +1 -3
  40. package/dist/core/pubsub/index.mjs +1 -3
  41. package/dist/core/scanning/ast-scanner.mjs +1 -3
  42. package/dist/core/scanning/common.mjs +1 -3
  43. package/dist/core/scanning/directives.mjs +3 -4
  44. package/dist/core/scanning/documents.mjs +3 -4
  45. package/dist/core/scanning/index.mjs +1 -2
  46. package/dist/core/scanning/resolvers.mjs +3 -4
  47. package/dist/core/scanning/schemas.mjs +1 -3
  48. package/dist/core/schema/builder.mjs +1 -3
  49. package/dist/core/schema/federation.mjs +1 -3
  50. package/dist/core/schema/index.mjs +1 -2
  51. package/dist/core/server/index.mjs +1 -2
  52. package/dist/core/server/sandbox.mjs +1 -2
  53. package/dist/core/server/types.mjs +1 -1
  54. package/dist/core/server/yoga.mjs +1 -3
  55. package/dist/core/types/adapter.d.mts +0 -2
  56. package/dist/core/types/adapter.mjs +1 -1
  57. package/dist/core/types/codegen.mjs +1 -1
  58. package/dist/core/types/config.mjs +1 -1
  59. package/dist/core/types/define.mjs +1 -1
  60. package/dist/core/types/index.mjs +1 -1
  61. package/dist/core/types/scanning.mjs +1 -1
  62. package/dist/core/utils/directive-parser.mjs +1 -2
  63. package/dist/core/utils/errors.mjs +1 -3
  64. package/dist/core/utils/file-io.mjs +1 -3
  65. package/dist/core/utils/imports.mjs +3 -4
  66. package/dist/core/utils/index.mjs +1 -2
  67. package/dist/core/utils/logger.mjs +1 -3
  68. package/dist/core/utils/ofetch-templates.mjs +1 -2
  69. package/dist/core/utils/runtime.mjs +1 -3
  70. package/dist/core/utils/subscribe-templates.mjs +1 -2
  71. package/dist/core/validation/external-services.mjs +3 -3
  72. package/dist/core/validation/index.mjs +1 -2
  73. package/dist/core/watcher/index.mjs +4 -5
  74. package/dist/define.mjs +1 -3
  75. package/dist/index.mjs +2 -3
  76. package/dist/nitro/adapter.d.mts +0 -1
  77. package/dist/nitro/adapter.mjs +1 -4
  78. package/dist/nitro/apollo.mjs +1 -3
  79. package/dist/nitro/codegen.mjs +1 -3
  80. package/dist/nitro/config.mjs +1 -3
  81. package/dist/nitro/index.mjs +3 -5
  82. package/dist/nitro/paths.mjs +9 -4
  83. package/dist/nitro/rollup.mjs +4 -5
  84. package/dist/nitro/routes/apollo-sandbox-script.d.mts +2 -2
  85. package/dist/nitro/routes/apollo-sandbox-script.mjs +1 -3
  86. package/dist/nitro/routes/apollo-server-ws.mjs +3 -6
  87. package/dist/nitro/routes/apollo-server.d.mts +2 -2
  88. package/dist/nitro/routes/apollo-server.mjs +1 -3
  89. package/dist/nitro/routes/debug.d.mts +2 -2
  90. package/dist/nitro/routes/debug.mjs +3 -7
  91. package/dist/nitro/routes/graphql-yoga-ws.d.mts +2 -2
  92. package/dist/nitro/routes/graphql-yoga-ws.mjs +3 -6
  93. package/dist/nitro/routes/graphql-yoga.d.mts +2 -2
  94. package/dist/nitro/routes/graphql-yoga.mjs +1 -3
  95. package/dist/nitro/routes/health.d.mts +2 -2
  96. package/dist/nitro/routes/health.mjs +1 -3
  97. package/dist/nitro/setup/extend-loader.mjs +1 -3
  98. package/dist/nitro/setup/file-watcher.mjs +3 -4
  99. package/dist/nitro/setup/logging.mjs +1 -3
  100. package/dist/nitro/setup/rollup-integration.mjs +4 -3
  101. package/dist/nitro/setup/routes.mjs +1 -3
  102. package/dist/nitro/setup/scanner.mjs +1 -3
  103. package/dist/nitro/setup/ts-config.mjs +1 -3
  104. package/dist/nitro/setup.mjs +4 -6
  105. package/dist/nitro/types.mjs +1 -1
  106. package/dist/nitro/virtual/generators.mjs +1 -3
  107. package/dist/nitro/virtual/stubs.mjs +1 -2
  108. package/dist/nuxt.mjs +4 -5
  109. package/dist/stubs/index.mjs +1 -1
  110. package/dist/subscribe/index.mjs +3 -4
  111. package/native/index.js +52 -52
  112. package/package.json +35 -35
@@ -3,7 +3,6 @@ import { BUILTIN_SCALARS, CHUNK_NAME_RESOLVERS, CHUNK_NAME_SCHEMAS, CHUNK_PATH_G
3
3
  import { CoreClientUtilsConfig, CoreCodegenConfig, CoreConfig, CoreContext, CoreExternalService, CoreFederationConfig, CoreGraphQLOptions, CoreLogger, CorePathsConfig, CoreSdkConfig, CoreSecurityConfig, CoreTypesConfig } from "./types/config.mjs";
4
4
  import { DefineDirectiveConfig, DirectiveArgument, DirectiveDefinition, Flatten, GraphQLArgumentType, GraphQLBaseType, GraphQLScalarType } from "./types/define.mjs";
5
5
  import { ResolverImport, ScanContext, ScanResult, ScannedFile, ScannedResolver } from "./types/scanning.mjs";
6
- import "./types/index.mjs";
7
6
  import { BASE_SCHEMA, CreateMergedSchemaOptions, DirectiveWrapper, ModuleConfig, ResolverDefinition, SchemaDefinition, buildGraphQLSchema, createMergedSchema, parse, subscribe, validate } from "./schema/builder.mjs";
8
7
  import { CoreServerInstance, CoreServerOptions, ServerFactory } from "./server/types.mjs";
9
8
  import { loadGraphQLDocuments } from "./codegen/document-loader.mjs";
@@ -13,7 +12,6 @@ import { GENERATED_FILE_HEADER, pluginContent } from "./codegen/plugin.mjs";
13
12
  import { generateResolverModule, generateRuntimeIndex, generateSchemaModule } from "./codegen/runtime.mjs";
14
13
  import { DEFAULT_SERVER_CODEGEN_CONFIG, generateServerTypesCore, generateTypes } from "./codegen/server.mjs";
15
14
  import { validateNoDuplicateTypes, validateSchemaFiles } from "./codegen/validation.mjs";
16
- import "./codegen/index.mjs";
17
15
  import { CreateCoreConfigOptions, createCoreConfig, createCoreContext, createScanContext, mergeGraphQLOptions } from "./config.mjs";
18
16
  import { PackageConfig, ResolvedExtend, ResolvedPackage, isLocalPath, loadPackageConfig, resolvePackageFiles } from "./manifest.mjs";
19
17
  import { ASTScanConfig, parseSingleFile, scanWithAST } from "./scanning/ast-scanner.mjs";
@@ -23,10 +21,8 @@ import { ScanDocumentsOptions, scanDocumentsCore } from "./scanning/documents.mj
23
21
  import { parseResolverCall, scanResolversCore } from "./scanning/resolvers.mjs";
24
22
  import { scanGraphqlCore, scanSchemasCore } from "./scanning/schemas.mjs";
25
23
  import { loadFederationSupport, resetFederationCache, warnFederationUnavailable } from "./schema/federation.mjs";
26
- import "./schema/index.mjs";
27
24
  import { APOLLO_SANDBOX_CDN, createSandboxResponse, fetchSandboxScript } from "./server/sandbox.mjs";
28
25
  import { BASE_SCHEMA as BASE_SCHEMA$1, apolloSandboxHtml, createYogaServer } from "./server/yoga.mjs";
29
- import "./server/index.mjs";
30
26
  import { DirectiveFileRef, DirectiveParser, ParsedDirective, directiveParser, generateDirectiveSchema, generateDirectiveSchemas } from "./utils/directive-parser.mjs";
31
27
  import { MaskErrorOptions, createDefaultMaskError } from "./utils/errors.mjs";
32
28
  import { ensureDir, readFileSafe, writeFile, writeFileIfChanged } from "./utils/file-io.mjs";
@@ -25,5 +25,4 @@ import { createDefaultMaskError } from "./utils/errors.mjs";
25
25
  import { getImportId, relativeWithDot } from "./utils/imports.mjs";
26
26
  import { generateOfetchTemplate } from "./utils/ofetch-templates.mjs";
27
27
  import { validateExternalServices } from "./validation/external-services.mjs";
28
-
29
- export { APOLLO_SANDBOX_CDN, BASE_SCHEMA, BUILTIN_SCALARS, CHUNK_NAME_RESOLVERS, CHUNK_NAME_SCHEMAS, CHUNK_PATH_GRAPHQL, CHUNK_PATH_UNKNOWN, CODEGEN_EXTERNALS, DEFAULT_CLIENT_CODEGEN_CONFIG, DEFAULT_CLIENT_TYPES_PATH, DEFAULT_GRAPHQL_SCALARS, DEFAULT_SERVER_CODEGEN_CONFIG, DEFAULT_SERVER_TYPES_PATH, DEFINE_DIRECTIVE, DEFINE_FIELD, DEFINE_FUNCTIONS, DEFINE_GRAPHQL_CONFIG, DEFINE_MUTATION, DEFINE_QUERY, DEFINE_RESOLVER, DEFINE_SCHEMA, DEFINE_SUBSCRIPTION, DIRECTIVE_EXTENSIONS, DIRECTIVE_GLOB_PATTERN, DIR_APP_GRAPHQL, DIR_BUILD_NITRO, DIR_BUILD_NUXT, DIR_CLIENT_GRAPHQL, DIR_EXTERNAL, DIR_ROUTES_GRAPHQL, DIR_SERVER_GRAPHQL, DIR_SERVER_GRAPHQL_WIN, DirectiveParser, ENDPOINT_DEBUG, ENDPOINT_GRAPHQL, ENDPOINT_HEALTH, FEDERATION_EXTERNALS, FILE_CLIENT_TYPES, FILE_CONFIG_TS, FILE_CONTEXT_DTS, FILE_CONTEXT_TS, FILE_DIRECTIVES_GRAPHQL, FILE_GRAPHQL_CONFIG, FILE_GRAPHQL_DTS, FILE_INDEX_TS, FILE_OFETCH_TS, FILE_SCHEMA_GRAPHQL, FILE_SCHEMA_TS, FILE_SDK_TS, FILE_SERVER_TYPES, FRAMEWORK_NITRO, FRAMEWORK_NUXT, FRAMEWORK_STANDALONE, GENERATED_FILE_HEADER, GLOB_SCAN_PATTERN, GRAPHQL_EXTENSIONS, GRAPHQL_FRAMEWORK_APOLLO, GRAPHQL_FRAMEWORK_YOGA, GRAPHQL_GLOB_PATTERN, GRAPHQL_HTTP_METHODS, HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_INTERNAL_ERROR, LOG_TAG, PATTERN_CLIENT_EXTERNAL_TYPES, PLACEHOLDER_BUILD_DIR, PLACEHOLDER_CLIENT_DIR, PLACEHOLDER_FRAMEWORK, PLACEHOLDER_ROOT_DIR, PLACEHOLDER_SERVER_DIR, PLACEHOLDER_SERVICE_NAME, PLACEHOLDER_TYPES_DIR, RESOLVER_EXTENSIONS, RESOLVER_GLOB_PATTERN, RESOLVER_TYPE_DIRECTIVE, RESOLVER_TYPE_MUTATION, RESOLVER_TYPE_QUERY, RESOLVER_TYPE_RESOLVER, RESOLVER_TYPE_SUBSCRIPTION, RESOLVER_TYPE_TYPE, SERVICE_DEFAULT, BASE_SCHEMA$1 as YOGA_BASE_SCHEMA, apolloSandboxHtml, buildGraphQLSchema, createCoreConfig, createCoreContext, createDefaultMaskError, createLogger, createMergedSchema, createSandboxResponse, createScanContext, createSilentLogger, createYogaServer, deduplicateFiles, defaultLogger, directiveParser, downloadAndSaveSchema, ensureDir, extractPaths, extractSubscriptions, fetchSandboxScript, filterByExtension, generateClientTypesCore, generateDirectiveSchema, generateDirectiveSchemas, generateExternalClientTypesCore, generateOfetchTemplate, generateResolverModule, generateRuntimeIndex, generateSchemaModule, generateServerTypesCore, generateSubscriptionBuilder, generateTypes, getImportId, graphQLLoadSchemaSync, isLocalPath, loadExternalSchema, loadFederationSupport, loadGraphQLDocuments, loadPackageConfig, mergeGraphQLOptions, parse, parseDirectiveCall, parseResolverCall, parseSingleFile, pluginContent, readFileSafe, relativeWithDot, resetFederationCache, resolvePackageFiles, scanDirectivesCore, scanDirectory, scanDocumentsCore, scanGraphqlCore, scanResolversCore, scanSchemasCore, scanWithAST, subscribe, validate, validateExternalServices, validateNoDuplicateTypes, validateSchemaFiles, warnFederationUnavailable, writeFile, writeFileIfChanged };
28
+ export { APOLLO_SANDBOX_CDN, BASE_SCHEMA, BUILTIN_SCALARS, CHUNK_NAME_RESOLVERS, CHUNK_NAME_SCHEMAS, CHUNK_PATH_GRAPHQL, CHUNK_PATH_UNKNOWN, CODEGEN_EXTERNALS, DEFAULT_CLIENT_CODEGEN_CONFIG, DEFAULT_CLIENT_TYPES_PATH, DEFAULT_GRAPHQL_SCALARS, DEFAULT_SERVER_CODEGEN_CONFIG, DEFAULT_SERVER_TYPES_PATH, DEFINE_DIRECTIVE, DEFINE_FIELD, DEFINE_FUNCTIONS, DEFINE_GRAPHQL_CONFIG, DEFINE_MUTATION, DEFINE_QUERY, DEFINE_RESOLVER, DEFINE_SCHEMA, DEFINE_SUBSCRIPTION, DIRECTIVE_EXTENSIONS, DIRECTIVE_GLOB_PATTERN, DIR_APP_GRAPHQL, DIR_BUILD_NITRO, DIR_BUILD_NUXT, DIR_CLIENT_GRAPHQL, DIR_EXTERNAL, DIR_ROUTES_GRAPHQL, DIR_SERVER_GRAPHQL, DIR_SERVER_GRAPHQL_WIN, DirectiveParser, ENDPOINT_DEBUG, ENDPOINT_GRAPHQL, ENDPOINT_HEALTH, FEDERATION_EXTERNALS, FILE_CLIENT_TYPES, FILE_CONFIG_TS, FILE_CONTEXT_DTS, FILE_CONTEXT_TS, FILE_DIRECTIVES_GRAPHQL, FILE_GRAPHQL_CONFIG, FILE_GRAPHQL_DTS, FILE_INDEX_TS, FILE_OFETCH_TS, FILE_SCHEMA_GRAPHQL, FILE_SCHEMA_TS, FILE_SDK_TS, FILE_SERVER_TYPES, FRAMEWORK_NITRO, FRAMEWORK_NUXT, FRAMEWORK_STANDALONE, GENERATED_FILE_HEADER, GLOB_SCAN_PATTERN, GRAPHQL_EXTENSIONS, GRAPHQL_FRAMEWORK_APOLLO, GRAPHQL_FRAMEWORK_YOGA, GRAPHQL_GLOB_PATTERN, GRAPHQL_HTTP_METHODS, HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_INTERNAL_ERROR, LOG_TAG, PATTERN_CLIENT_EXTERNAL_TYPES, PLACEHOLDER_BUILD_DIR, PLACEHOLDER_CLIENT_DIR, PLACEHOLDER_FRAMEWORK, PLACEHOLDER_ROOT_DIR, PLACEHOLDER_SERVER_DIR, PLACEHOLDER_SERVICE_NAME, PLACEHOLDER_TYPES_DIR, RESOLVER_EXTENSIONS, RESOLVER_GLOB_PATTERN, RESOLVER_TYPE_DIRECTIVE, RESOLVER_TYPE_MUTATION, RESOLVER_TYPE_QUERY, RESOLVER_TYPE_RESOLVER, RESOLVER_TYPE_SUBSCRIPTION, RESOLVER_TYPE_TYPE, SERVICE_DEFAULT, BASE_SCHEMA$1 as YOGA_BASE_SCHEMA, apolloSandboxHtml, buildGraphQLSchema, createCoreConfig, createCoreContext, createDefaultMaskError, createLogger, createMergedSchema, createSandboxResponse, createScanContext, createSilentLogger, createYogaServer, deduplicateFiles, defaultLogger, directiveParser, downloadAndSaveSchema, ensureDir, extractPaths, extractSubscriptions, fetchSandboxScript, filterByExtension, generateClientTypesCore, generateDirectiveSchema, generateDirectiveSchemas, generateExternalClientTypesCore, generateOfetchTemplate, generateResolverModule, generateRuntimeIndex, generateSchemaModule, generateServerTypesCore, generateSubscriptionBuilder, generateTypes, getImportId, graphQLLoadSchemaSync, isLocalPath, loadExternalSchema, loadFederationSupport, loadGraphQLDocuments, loadPackageConfig, mergeGraphQLOptions, parse, parseDirectiveCall, parseResolverCall, parseSingleFile, pluginContent, readFileSafe, relativeWithDot, resetFederationCache, resolvePackageFiles, scanDirectivesCore, scanDirectory, scanDocumentsCore, scanGraphqlCore, scanResolversCore, scanSchemasCore, scanWithAST, subscribe, validate, validateExternalServices, validateNoDuplicateTypes, validateSchemaFiles, warnFederationUnavailable, writeFile, writeFileIfChanged };
@@ -4,7 +4,6 @@ import { existsSync } from "node:fs";
4
4
  import { loadConfig } from "c12";
5
5
  import { resolvePath } from "mlly";
6
6
  import { glob } from "tinyglobby";
7
-
8
7
  //#region src/core/manifest.ts
9
8
  /**
10
9
  * Package Config Loader
@@ -97,6 +96,5 @@ async function resolvePackageFiles(pkg) {
97
96
  schemaPath: existsSync(schemaPath) ? schemaPath : void 0
98
97
  };
99
98
  }
100
-
101
99
  //#endregion
102
- export { isLocalPath, loadPackageConfig, resolvePackageFiles };
100
+ export { isLocalPath, loadPackageConfig, resolvePackageFiles };
@@ -1,5 +1,4 @@
1
1
  import { EventEmitter } from "node:events";
2
-
3
2
  //#region src/core/pubsub/index.ts
4
3
  /**
5
4
  * Built-in PubSub implementation for GraphQL Subscriptions
@@ -143,6 +142,5 @@ async function* withFilter(asyncIterable, filter) {
143
142
  async function* mapAsyncIterator(asyncIterable, mapper) {
144
143
  for await (const value of asyncIterable) yield await mapper(value);
145
144
  }
146
-
147
145
  //#endregion
148
- export { createPubSub, mapAsyncIterator, withFilter };
146
+ export { createPubSub, mapAsyncIterator, withFilter };
@@ -2,7 +2,6 @@ import { scanDirectory } from "./common.mjs";
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { basename, relative } from "pathe";
4
4
  import { parseSync } from "oxc-parser";
5
-
6
5
  //#region src/core/scanning/ast-scanner.ts
7
6
  /**
8
7
  * Scan files matching a pattern and parse their exports using AST
@@ -111,6 +110,5 @@ function parseExports(filePath, program, config) {
111
110
  warnings
112
111
  };
113
112
  }
114
-
115
113
  //#endregion
116
- export { parseSingleFile, scanWithAST };
114
+ export { parseSingleFile, scanWithAST };
@@ -1,7 +1,6 @@
1
1
  import { GLOB_SCAN_PATTERN } from "../constants.mjs";
2
2
  import { join, relative } from "pathe";
3
3
  import { glob } from "tinyglobby";
4
-
5
4
  //#region src/core/scanning/common.ts
6
5
  const DEFAULT_IGNORE_PATTERNS = [
7
6
  "**/node_modules/**",
@@ -54,6 +53,5 @@ function filterByExtension(files, extensions) {
54
53
  function extractPaths(files) {
55
54
  return files.map((f) => f.fullPath);
56
55
  }
57
-
58
56
  //#endregion
59
- export { deduplicateFiles, extractPaths, filterByExtension, scanDirectory };
57
+ export { deduplicateFiles, extractPaths, filterByExtension, scanDirectory };
@@ -1,8 +1,8 @@
1
1
  import { DIRECTIVE_GLOB_PATTERN } from "../constants.mjs";
2
2
  import { scanWithAST } from "./ast-scanner.mjs";
3
3
  import { hash } from "ohash";
4
-
5
4
  //#region src/core/scanning/directives.ts
5
+ const HYPHEN_RE = /-/g;
6
6
  /**
7
7
  * Parse a defineDirective call and return the import info
8
8
  */
@@ -11,7 +11,7 @@ function parseDirectiveCall(calleeName, exportName, filePath) {
11
11
  return {
12
12
  name: exportName,
13
13
  type: "directive",
14
- as: `_${hash(exportName + filePath).replace(/-/g, "").slice(0, 6)}`
14
+ as: `_${hash(exportName + filePath).replace(HYPHEN_RE, "").slice(0, 6)}`
15
15
  };
16
16
  }
17
17
  /**
@@ -24,6 +24,5 @@ function scanDirectivesCore(ctx) {
24
24
  emitWarnings: false
25
25
  });
26
26
  }
27
-
28
27
  //#endregion
29
- export { parseDirectiveCall, scanDirectivesCore };
28
+ export { parseDirectiveCall, scanDirectivesCore };
@@ -1,8 +1,8 @@
1
1
  import { GRAPHQL_GLOB_PATTERN } from "../constants.mjs";
2
2
  import { scanDirectory } from "./common.mjs";
3
3
  import { relative } from "pathe";
4
-
5
4
  //#region src/core/scanning/documents.ts
5
+ const REGEX_SPECIAL_CHARS_RE = /[.*+?^${}()|[\]\\]/g;
6
6
  /**
7
7
  * Scan for GraphQL client documents (.graphql, .gql) in client directory
8
8
  * Excludes files from external service directories
@@ -17,7 +17,7 @@ async function scanDocumentsCore(ctx, options = {}) {
17
17
  return {
18
18
  items: allFiles.filter((f) => !f.path.startsWith("external/")).filter((f) => {
19
19
  const relativePath = f.path;
20
- for (const pattern of externalPatterns) if (pattern.replace(new RegExp(`^${clientDirRelative.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/`), "").split("/")[0] === relativePath.split("/")[0]) return false;
20
+ for (const pattern of externalPatterns) if (pattern.replace(new RegExp(`^${clientDirRelative.replace(REGEX_SPECIAL_CHARS_RE, "\\$&")}/`), "").split("/")[0] === relativePath.split("/")[0]) return false;
21
21
  return true;
22
22
  }).map((f) => f.fullPath),
23
23
  warnings,
@@ -32,6 +32,5 @@ async function scanDocumentsCore(ctx, options = {}) {
32
32
  };
33
33
  }
34
34
  }
35
-
36
35
  //#endregion
37
- export { scanDocumentsCore };
36
+ export { scanDocumentsCore };
@@ -4,5 +4,4 @@ import { parseDirectiveCall, scanDirectivesCore } from "./directives.mjs";
4
4
  import { scanDocumentsCore } from "./documents.mjs";
5
5
  import { parseResolverCall, scanResolversCore } from "./resolvers.mjs";
6
6
  import { scanGraphqlCore, scanSchemasCore } from "./schemas.mjs";
7
-
8
- export { deduplicateFiles, extractPaths, filterByExtension, parseDirectiveCall, parseResolverCall, parseSingleFile, scanDirectivesCore, scanDirectory, scanDocumentsCore, scanGraphqlCore, scanResolversCore, scanSchemasCore, scanWithAST };
7
+ export { deduplicateFiles, extractPaths, filterByExtension, parseDirectiveCall, parseResolverCall, parseSingleFile, scanDirectivesCore, scanDirectory, scanDocumentsCore, scanGraphqlCore, scanResolversCore, scanSchemasCore, scanWithAST };
@@ -1,14 +1,14 @@
1
1
  import { DEFINE_FUNCTIONS, RESOLVER_GLOB_PATTERN } from "../constants.mjs";
2
2
  import { scanWithAST } from "./ast-scanner.mjs";
3
3
  import { hash } from "ohash";
4
-
5
4
  //#region src/core/scanning/resolvers.ts
5
+ const HYPHEN_RE = /-/g;
6
6
  /**
7
7
  * Parse a define* function call and return the import info
8
8
  * Exported for use by manifest loader
9
9
  */
10
10
  function parseResolverCall(calleeName, exportName, filePath) {
11
- const aliasHash = `_${hash(exportName + filePath).replace(/-/g, "").slice(0, 6)}`;
11
+ const aliasHash = `_${hash(exportName + filePath).replace(HYPHEN_RE, "").slice(0, 6)}`;
12
12
  switch (calleeName) {
13
13
  case "defineResolver": return {
14
14
  name: exportName,
@@ -54,6 +54,5 @@ function scanResolversCore(ctx) {
54
54
  validFunctions: DEFINE_FUNCTIONS
55
55
  });
56
56
  }
57
-
58
57
  //#endregion
59
- export { parseResolverCall, scanResolversCore };
58
+ export { parseResolverCall, scanResolversCore };
@@ -1,7 +1,6 @@
1
1
  import { GRAPHQL_GLOB_PATTERN } from "../constants.mjs";
2
2
  import { extractPaths, scanDirectory } from "./common.mjs";
3
3
  import { relative } from "pathe";
4
-
5
4
  //#region src/core/scanning/schemas.ts
6
5
  /**
7
6
  * Scan for GraphQL schema files (.graphql, .gql) in server directory
@@ -47,6 +46,5 @@ async function scanGraphqlCore(ctx) {
47
46
  };
48
47
  }
49
48
  }
50
-
51
49
  //#endregion
52
- export { scanGraphqlCore, scanSchemasCore };
50
+ export { scanGraphqlCore, scanSchemasCore };
@@ -4,7 +4,6 @@ import { buildSchema, parse, parse as parse$1, print, subscribe, validate } from
4
4
  import { readFileSync } from "node:fs";
5
5
  import { mergeResolvers, mergeTypeDefs } from "@graphql-tools/merge";
6
6
  import { makeExecutableSchema } from "@graphql-tools/schema";
7
-
8
7
  //#region src/core/schema/builder.ts
9
8
  /**
10
9
  * Create a merged GraphQL schema from schemas, resolvers, and directives
@@ -73,6 +72,5 @@ async function buildGraphQLSchema(schemaPaths) {
73
72
  return null;
74
73
  }
75
74
  }
76
-
77
75
  //#endregion
78
- export { BASE_SCHEMA, buildGraphQLSchema, createMergedSchema, parse, subscribe, validate };
76
+ export { BASE_SCHEMA, buildGraphQLSchema, createMergedSchema, parse, subscribe, validate };
@@ -1,6 +1,5 @@
1
1
  import { LOG_TAG } from "../constants.mjs";
2
2
  import { consola as consola$1 } from "consola";
3
-
4
3
  //#region src/core/schema/federation.ts
5
4
  const logger = consola$1.withTag(LOG_TAG);
6
5
  /**
@@ -35,6 +34,5 @@ function warnFederationUnavailable() {
35
34
  function resetFederationCache() {
36
35
  buildSubgraphSchemaCache = null;
37
36
  }
38
-
39
37
  //#endregion
40
- export { loadFederationSupport, resetFederationCache, warnFederationUnavailable };
38
+ export { loadFederationSupport, resetFederationCache, warnFederationUnavailable };
@@ -1,4 +1,3 @@
1
1
  import { loadFederationSupport, resetFederationCache, warnFederationUnavailable } from "./federation.mjs";
2
2
  import { BASE_SCHEMA, buildGraphQLSchema, createMergedSchema, parse, subscribe, validate } from "./builder.mjs";
3
-
4
- export { BASE_SCHEMA, buildGraphQLSchema, createMergedSchema, loadFederationSupport, parse, resetFederationCache, subscribe, validate, warnFederationUnavailable };
3
+ export { BASE_SCHEMA, buildGraphQLSchema, createMergedSchema, loadFederationSupport, parse, resetFederationCache, subscribe, validate, warnFederationUnavailable };
@@ -1,4 +1,3 @@
1
1
  import { APOLLO_SANDBOX_CDN, createSandboxResponse, fetchSandboxScript } from "./sandbox.mjs";
2
2
  import { BASE_SCHEMA, apolloSandboxHtml, createYogaServer } from "./yoga.mjs";
3
-
4
- export { APOLLO_SANDBOX_CDN, BASE_SCHEMA as YOGA_BASE_SCHEMA, apolloSandboxHtml, createSandboxResponse, createYogaServer, fetchSandboxScript };
3
+ export { APOLLO_SANDBOX_CDN, BASE_SCHEMA as YOGA_BASE_SCHEMA, apolloSandboxHtml, createSandboxResponse, createYogaServer, fetchSandboxScript };
@@ -34,6 +34,5 @@ async function createSandboxResponse() {
34
34
  });
35
35
  }
36
36
  }
37
-
38
37
  //#endregion
39
- export { APOLLO_SANDBOX_CDN, createSandboxResponse, fetchSandboxScript };
38
+ export { APOLLO_SANDBOX_CDN, createSandboxResponse, fetchSandboxScript };
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { BASE_SCHEMA as BASE_SCHEMA$1, createMergedSchema } from "../schema/builder.mjs";
2
2
  import defu from "defu";
3
3
  import { createYoga } from "graphql-yoga";
4
-
5
4
  //#region src/core/server/yoga.ts
6
5
  /**
7
6
  * Base schema definition for Yoga server
@@ -84,6 +83,5 @@ async function createYogaServer(options) {
84
83
  schema
85
84
  };
86
85
  }
87
-
88
86
  //#endregion
89
- export { BASE_SCHEMA, apolloSandboxHtml, createYogaServer };
87
+ export { BASE_SCHEMA, apolloSandboxHtml, createYogaServer };
@@ -1,7 +1,5 @@
1
1
  import { CoreConfig, CoreContext, CoreLogger } from "./config.mjs";
2
2
  import { ScanContext, ScanResult, ScannedResolver } from "./scanning.mjs";
3
- import "./index.mjs";
4
-
5
3
  //#region src/core/types/adapter.d.ts
6
4
  /**
7
5
  * Framework adapter interface
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -213,6 +213,5 @@ async function generateDirectiveSchemas(directives, buildDir) {
213
213
  }
214
214
  return schemaContent;
215
215
  }
216
-
217
216
  //#endregion
218
- export { DirectiveParser, directiveParser, generateDirectiveSchema, generateDirectiveSchemas };
217
+ export { DirectiveParser, directiveParser, generateDirectiveSchema, generateDirectiveSchemas };
@@ -1,5 +1,4 @@
1
1
  import { GraphQLError } from "graphql";
2
-
3
2
  //#region src/core/utils/errors.ts
4
3
  /**
5
4
  * Error handling utilities for GraphQL
@@ -88,6 +87,5 @@ function createDefaultMaskError(options) {
88
87
  return error instanceof Error ? error : new Error(String(error));
89
88
  };
90
89
  }
91
-
92
90
  //#endregion
93
- export { createDefaultMaskError };
91
+ export { createDefaultMaskError };
@@ -1,6 +1,5 @@
1
1
  import { dirname } from "pathe";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
-
4
3
  //#region src/core/utils/file-io.ts
5
4
  /**
6
5
  * Unified file I/O utilities
@@ -42,6 +41,5 @@ function readFileSafe(path) {
42
41
  return;
43
42
  }
44
43
  }
45
-
46
44
  //#endregion
47
- export { ensureDir, readFileSafe, writeFile, writeFileIfChanged };
45
+ export { ensureDir, readFileSafe, writeFile, writeFileIfChanged };
@@ -1,16 +1,16 @@
1
1
  import { relative } from "pathe";
2
2
  import { hash } from "ohash";
3
-
4
3
  //#region src/core/utils/imports.ts
5
4
  /**
6
5
  * Import utilities
7
6
  * Helpers for generating import IDs and relative paths
8
7
  */
8
+ const HYPHEN_RE = /-/g;
9
9
  /**
10
10
  * Generate a unique import ID for a file path
11
11
  */
12
12
  function getImportId(p, lazy) {
13
- return (lazy ? "_lazy_" : "_") + hash(p).replace(/-/g, "").slice(0, 6);
13
+ return (lazy ? "_lazy_" : "_") + hash(p).replace(HYPHEN_RE, "").slice(0, 6);
14
14
  }
15
15
  const RELATIVE_RE = /^\.{1,2}\//;
16
16
  /**
@@ -20,6 +20,5 @@ function relativeWithDot(from, to) {
20
20
  const rel = relative(from, to);
21
21
  return RELATIVE_RE.test(rel) ? rel : `./${rel}`;
22
22
  }
23
-
24
23
  //#endregion
25
- export { getImportId, relativeWithDot };
24
+ export { getImportId, relativeWithDot };
@@ -4,5 +4,4 @@ import { DirectiveParser, directiveParser, generateDirectiveSchema, generateDire
4
4
  import { createDefaultMaskError } from "./errors.mjs";
5
5
  import { getImportId, relativeWithDot } from "./imports.mjs";
6
6
  import { generateOfetchTemplate } from "./ofetch-templates.mjs";
7
-
8
- export { DirectiveParser, createDefaultMaskError, createLogger, createSilentLogger, defaultLogger, directiveParser, ensureDir, generateDirectiveSchema, generateDirectiveSchemas, generateOfetchTemplate, getImportId, readFileSafe, relativeWithDot, writeFile, writeFileIfChanged };
7
+ export { DirectiveParser, createDefaultMaskError, createLogger, createSilentLogger, defaultLogger, directiveParser, ensureDir, generateDirectiveSchema, generateDirectiveSchemas, generateOfetchTemplate, getImportId, readFileSafe, relativeWithDot, writeFile, writeFileIfChanged };
@@ -1,6 +1,5 @@
1
1
  import { LOG_TAG } from "../constants.mjs";
2
2
  import { consola as consola$1 } from "consola";
3
-
4
3
  //#region src/core/utils/logger.ts
5
4
  /**
6
5
  * Create a logger instance with the nitro-graphql tag
@@ -33,6 +32,5 @@ function createSilentLogger() {
33
32
  debug: noop
34
33
  };
35
34
  }
36
-
37
35
  //#endregion
38
- export { createLogger, createSilentLogger, defaultLogger };
36
+ export { createLogger, createSilentLogger, defaultLogger };
@@ -130,6 +130,5 @@ export function create${capitalizedName}GraphQLClient(endpoint: string = '${endp
130
130
 
131
131
  export const $${serviceName}Sdk: Sdk = getSdk(create${capitalizedName}GraphQLClient())`;
132
132
  }
133
-
134
133
  //#endregion
135
- export { generateOfetchTemplate };
134
+ export { generateOfetchTemplate };
@@ -1,7 +1,6 @@
1
1
  import { basename, dirname, join, resolve } from "pathe";
2
2
  import { existsSync, mkdirSync, promises, readFileSync, writeFileSync } from "node:fs";
3
3
  import { pathToFileURL as pathToFileURL$1 } from "node:url";
4
-
5
4
  //#region src/core/utils/runtime.ts
6
5
  /**
7
6
  * Cross-runtime compatibility layer
@@ -106,6 +105,5 @@ async function readdir(path) {
106
105
  async function stat(path) {
107
106
  return promises.stat(path);
108
107
  }
109
-
110
108
  //#endregion
111
- export { basename, dirname, exists, existsSync_, exit, getCwd, join, mkdir, mkdirSync_, onSignal, pathToFileURL, readFile, readFileSync_, readdir, resolve, stat, writeFile, writeFileSync_ };
109
+ export { basename, dirname, exists, existsSync_, exit, getCwd, join, mkdir, mkdirSync_, onSignal, pathToFileURL, readFile, readFileSync_, readdir, resolve, stat, writeFile, writeFileSync_ };
@@ -54,6 +54,5 @@ const config: SubscriptionClientConfig = {
54
54
  // Export configured client instance
55
55
  export const subscriptionClient = createSubscriptionClient(config)
56
56
  `;
57
-
58
57
  //#endregion
59
- export { subscribeClientTemplate };
58
+ export { subscribeClientTemplate };
@@ -3,6 +3,7 @@
3
3
  * External services validation utilities
4
4
  * Framework-agnostic validation helpers
5
5
  */
6
+ const VALID_IDENTIFIER_RE = /^[a-z]\w*$/i;
6
7
  /**
7
8
  * Validate external GraphQL service configuration
8
9
  */
@@ -24,10 +25,9 @@ function validateExternalServices(services) {
24
25
  } catch {
25
26
  errors.push(`${prefix}.endpoint "${service.endpoint}" must be a valid URL`);
26
27
  }
27
- if ("name" in service && typeof service.name === "string" && !/^[a-z]\w*$/i.test(service.name)) errors.push(`${prefix}.name "${service.name}" must be a valid identifier (letters, numbers, underscore, starting with letter)`);
28
+ if ("name" in service && typeof service.name === "string" && !VALID_IDENTIFIER_RE.test(service.name)) errors.push(`${prefix}.name "${service.name}" must be a valid identifier (letters, numbers, underscore, starting with letter)`);
28
29
  }
29
30
  return errors;
30
31
  }
31
-
32
32
  //#endregion
33
- export { validateExternalServices };
33
+ export { validateExternalServices };
@@ -1,3 +1,2 @@
1
1
  import { validateExternalServices } from "./external-services.mjs";
2
-
3
- export { validateExternalServices };
2
+ export { validateExternalServices };
@@ -1,8 +1,8 @@
1
1
  import { DIRECTIVE_EXTENSIONS, GRAPHQL_EXTENSIONS, RESOLVER_EXTENSIONS } from "../constants.mjs";
2
2
  import { watch } from "chokidar";
3
3
  import { debounce } from "perfect-debounce";
4
-
5
4
  //#region src/core/watcher/index.ts
5
+ const BACKSLASH_RE = /\\/g;
6
6
  /**
7
7
  * Check if a file is a GraphQL-related file
8
8
  */
@@ -26,8 +26,8 @@ function classifyChange(path, serverDir) {
26
26
  if (!fileType) return null;
27
27
  if (fileType === "resolver" || fileType === "directive") return "server";
28
28
  if (fileType === "graphql") {
29
- const normalizedPath = path.replace(/\\/g, "/");
30
- const normalizedServerDir = serverDir.replace(/\\/g, "/");
29
+ const normalizedPath = path.replace(BACKSLASH_RE, "/");
30
+ const normalizedServerDir = serverDir.replace(BACKSLASH_RE, "/");
31
31
  if (normalizedPath.includes(normalizedServerDir)) return "server";
32
32
  if (normalizedPath.includes("/server/graphql/") || normalizedPath.includes("\\server\\graphql\\")) return "server";
33
33
  return "client";
@@ -136,6 +136,5 @@ function createCoreWatcher(config, callbacks) {
136
136
  async function closeWatcher(watcher) {
137
137
  await watcher.close();
138
138
  }
139
-
140
139
  //#endregion
141
- export { classifyChange, closeWatcher, createCoreWatcher, createIgnoredFunction, getFileType, isWatchableFile, shouldSkipPath };
140
+ export { classifyChange, closeWatcher, createCoreWatcher, createIgnoredFunction, getFileType, isWatchableFile, shouldSkipPath };
package/dist/define.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createPubSub, mapAsyncIterator, withFilter } from "./core/pubsub/index.mjs";
2
-
3
2
  //#region src/define.ts
4
3
  /**
5
4
  * Define schema extensions programmatically for GraphQL types.
@@ -320,6 +319,5 @@ function defineDirective(config) {
320
319
  locations: [...config.locations]
321
320
  };
322
321
  }
323
-
324
322
  //#endregion
325
- export { createPubSub, defineDirective, defineField, defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defineSchema, defineSubscription, mapAsyncIterator, withFilter };
323
+ export { createPubSub, defineDirective, defineField, defineGraphQLConfig, defineMutation, defineQuery, defineResolver, defineSchema, defineSubscription, mapAsyncIterator, withFilter };
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { NitroAdapter } from "./nitro/adapter.mjs";
2
2
  import { resolveSecurityConfig } from "./nitro/setup/logging.mjs";
3
3
  import { setupNitroGraphQL } from "./nitro/setup.mjs";
4
- import nitro_default from "./nitro/index.mjs";
5
-
6
- export { NitroAdapter, nitro_default as default, resolveSecurityConfig, setupNitroGraphQL };
4
+ import graphqlModule from "./nitro/index.mjs";
5
+ export { NitroAdapter, graphqlModule as default, resolveSecurityConfig, setupNitroGraphQL };
@@ -1,6 +1,5 @@
1
1
  import { CoreConfig, CoreContext, CoreLogger } from "../core/types/config.mjs";
2
2
  import { ScanContext } from "../core/types/scanning.mjs";
3
- import "../core/types/index.mjs";
4
3
  import { FrameworkAdapter, ScanAdapter } from "../core/types/adapter.mjs";
5
4
  import { Nitro } from "nitro/types";
6
5
 
@@ -3,7 +3,6 @@ import { scanDocumentsCore } from "../core/scanning/documents.mjs";
3
3
  import { scanResolversCore } from "../core/scanning/resolvers.mjs";
4
4
  import { scanGraphqlCore, scanSchemasCore } from "../core/scanning/schemas.mjs";
5
5
  import { join, relative } from "pathe";
6
-
7
6
  //#region src/nitro/adapter.ts
8
7
  /**
9
8
  * Create a CoreLogger from Nitro's logger
@@ -87,7 +86,5 @@ const NitroAdapter = {
87
86
  });
88
87
  }
89
88
  };
90
- var adapter_default = NitroAdapter;
91
-
92
89
  //#endregion
93
- export { NitroAdapter, createCoreConfigFromNitro, createCoreContextFromNitro, createLoggerFromNitro, createScanContextFromNitro, adapter_default as default };
90
+ export { NitroAdapter, NitroAdapter as default, createCoreConfigFromNitro, createCoreContextFromNitro, createLoggerFromNitro, createScanContextFromNitro };
@@ -1,6 +1,5 @@
1
1
  import { HeaderMap } from "@apollo/server";
2
2
  import { eventHandler, getRequestURL, readBody } from "nitro/h3";
3
-
4
3
  //#region src/nitro/apollo.ts
5
4
  function startServerAndCreateH3Handler(server, options) {
6
5
  const defaultContext = () => Promise.resolve({});
@@ -54,6 +53,5 @@ async function normalizeBody(event) {
54
53
  const method = event.req.method;
55
54
  if (method && PayloadMethods.includes(method)) return await readBody(event);
56
55
  }
57
-
58
56
  //#endregion
59
- export { startServerAndCreateH3Handler };
57
+ export { startServerAndCreateH3Handler };
@@ -16,7 +16,6 @@ import { existsSync, readFileSync } from "node:fs";
16
16
  import { mergeTypeDefs } from "@graphql-tools/merge";
17
17
  import { makeExecutableSchema } from "@graphql-tools/schema";
18
18
  import { loadFilesSync } from "@graphql-tools/load-files";
19
-
20
19
  //#region src/nitro/codegen.ts
21
20
  const logger = consola.withTag(LOG_TAG);
22
21
  async function buildSchemaFromString(source, federation) {
@@ -168,6 +167,5 @@ async function generateExternalTypes(nitro, options = {}) {
168
167
  consola.error(`[${service.name}] External service failed:`, error);
169
168
  }
170
169
  }
171
-
172
170
  //#endregion
173
- export { generateClientTypes, generateServerTypes };
171
+ export { generateClientTypes, generateServerTypes };
@@ -1,5 +1,4 @@
1
1
  import { DEFAULT_CLIENT_TYPES_PATH, DEFAULT_SERVER_TYPES_PATH, ENDPOINT_GRAPHQL, ENDPOINT_HEALTH } from "../core/constants.mjs";
2
-
3
2
  //#region src/nitro/config.ts
4
3
  /**
5
4
  * Default type generation configuration
@@ -52,6 +51,5 @@ const DEFAULT_WATCHER_PERSISTENT = true;
52
51
  * Default watcher ignore initial setting
53
52
  */
54
53
  const DEFAULT_WATCHER_IGNORE_INITIAL = true;
55
-
56
54
  //#endregion
57
- export { DEFAULT_IGNORE_PATTERNS, DEFAULT_PATHS_CONFIG, DEFAULT_RUNTIME_CONFIG, DEFAULT_SDK_CONFIG, DEFAULT_TYPESCRIPT_STRICT, DEFAULT_TYPES_CONFIG, DEFAULT_WATCHER_IGNORE_INITIAL, DEFAULT_WATCHER_PERSISTENT };
55
+ export { DEFAULT_IGNORE_PATTERNS, DEFAULT_PATHS_CONFIG, DEFAULT_RUNTIME_CONFIG, DEFAULT_SDK_CONFIG, DEFAULT_TYPESCRIPT_STRICT, DEFAULT_TYPES_CONFIG, DEFAULT_WATCHER_IGNORE_INITIAL, DEFAULT_WATCHER_PERSISTENT };