@ohos-ports/houdini 0.0.0-stage → 2.0.12-beta.1

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 (157) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -2
  3. package/build/adapter/index.d.ts +3 -0
  4. package/build/adapter/index.js +6 -0
  5. package/build/adapter/package.json +1 -0
  6. package/build/cmd/generate.d.ts +12 -0
  7. package/build/cmd/generate.js +81 -0
  8. package/build/cmd/index.d.ts +1 -0
  9. package/build/cmd/index.js +36 -0
  10. package/build/cmd/package.json +1 -0
  11. package/build/cmd/pullSchema.d.ts +4 -0
  12. package/build/cmd/pullSchema.js +26 -0
  13. package/build/lib/ast.d.ts +16 -0
  14. package/build/lib/ast.js +71 -0
  15. package/build/lib/codegen.d.ts +57 -0
  16. package/build/lib/codegen.js +729 -0
  17. package/build/lib/config.d.ts +269 -0
  18. package/build/lib/config.js +140 -0
  19. package/build/lib/constants.d.ts +8 -0
  20. package/build/lib/constants.js +14 -0
  21. package/build/lib/database.d.ts +7 -0
  22. package/build/lib/database.js +635 -0
  23. package/build/lib/db.d.ts +14 -0
  24. package/build/lib/db.js +178 -0
  25. package/build/lib/deepMerge.d.ts +1 -0
  26. package/build/lib/deepMerge.js +23 -0
  27. package/build/lib/error.d.ts +30 -0
  28. package/build/lib/error.js +127 -0
  29. package/build/lib/fs.d.ts +33 -0
  30. package/build/lib/fs.js +245 -0
  31. package/build/lib/graphql.d.ts +11 -0
  32. package/build/lib/graphql.js +36 -0
  33. package/build/lib/imports.d.ts +35 -0
  34. package/build/lib/imports.js +66 -0
  35. package/build/lib/index.d.ts +17 -0
  36. package/build/lib/index.js +21 -0
  37. package/build/lib/logger.d.ts +12 -0
  38. package/build/lib/logger.js +45 -0
  39. package/build/lib/package.json +1 -0
  40. package/build/lib/parse.d.ts +17 -0
  41. package/build/lib/parse.js +33 -0
  42. package/build/lib/path.d.ts +12 -0
  43. package/build/lib/path.js +44 -0
  44. package/build/lib/pipeline.d.ts +3 -0
  45. package/build/lib/pipeline.js +8 -0
  46. package/build/lib/plugins.d.ts +5 -0
  47. package/build/lib/plugins.js +129 -0
  48. package/build/lib/project.d.ts +20 -0
  49. package/build/lib/project.js +317 -0
  50. package/build/lib/schema.d.ts +1 -0
  51. package/build/lib/schema.js +61 -0
  52. package/build/lib/sleep.d.ts +1 -0
  53. package/build/lib/sleep.js +8 -0
  54. package/build/lib/types.d.ts +103 -0
  55. package/build/lib/types.js +37 -0
  56. package/build/lib/walk.d.ts +34 -0
  57. package/build/lib/walk.js +138 -0
  58. package/build/node/index.d.ts +44 -0
  59. package/build/node/index.js +402 -0
  60. package/build/node/package.json +1 -0
  61. package/build/oauth/index.d.ts +41 -0
  62. package/build/oauth/index.js +108 -0
  63. package/build/oauth/package.json +1 -0
  64. package/build/package.json +212 -0
  65. package/build/router/auth-token.d.ts +29 -0
  66. package/build/router/auth-token.js +168 -0
  67. package/build/router/conventions.d.ts +38 -0
  68. package/build/router/conventions.js +165 -0
  69. package/build/router/cookies.d.ts +41 -0
  70. package/build/router/cookies.js +143 -0
  71. package/build/router/jwt.d.ts +117 -0
  72. package/build/router/jwt.js +144 -0
  73. package/build/router/manifest.d.ts +12 -0
  74. package/build/router/manifest.js +280 -0
  75. package/build/router/match.d.ts +39 -0
  76. package/build/router/match.js +219 -0
  77. package/build/router/package.json +1 -0
  78. package/build/router/server.d.ts +57 -0
  79. package/build/router/server.js +501 -0
  80. package/build/router/session.d.ts +32 -0
  81. package/build/router/session.js +361 -0
  82. package/build/router/types.d.ts +44 -0
  83. package/build/router/types.js +0 -0
  84. package/build/runtime/cache/benchmarks/cache.bench.d.ts +1 -0
  85. package/build/runtime/cache/benchmarks/cache.bench.js +943 -0
  86. package/build/runtime/cache/constants.d.ts +1 -0
  87. package/build/runtime/cache/constants.js +4 -0
  88. package/build/runtime/cache/gc.d.ts +11 -0
  89. package/build/runtime/cache/gc.js +53 -0
  90. package/build/runtime/cache/index.d.ts +174 -0
  91. package/build/runtime/cache/index.js +1197 -0
  92. package/build/runtime/cache/lists.d.ts +94 -0
  93. package/build/runtime/cache/lists.js +530 -0
  94. package/build/runtime/cache/staleManager.d.ts +39 -0
  95. package/build/runtime/cache/staleManager.js +140 -0
  96. package/build/runtime/cache/storage.d.ts +113 -0
  97. package/build/runtime/cache/storage.js +496 -0
  98. package/build/runtime/cache/stuff.d.ts +2 -0
  99. package/build/runtime/cache/stuff.js +32 -0
  100. package/build/runtime/cache/subscription.d.ts +69 -0
  101. package/build/runtime/cache/subscription.js +386 -0
  102. package/build/runtime/client.d.ts +43 -0
  103. package/build/runtime/client.js +86 -0
  104. package/build/runtime/coerce.d.ts +4 -0
  105. package/build/runtime/coerce.js +31 -0
  106. package/build/runtime/config.d.ts +20 -0
  107. package/build/runtime/config.js +88 -0
  108. package/build/runtime/constants.d.ts +6 -0
  109. package/build/runtime/constants.js +12 -0
  110. package/build/runtime/deepEquals.d.ts +1 -0
  111. package/build/runtime/deepEquals.js +28 -0
  112. package/build/runtime/documentStore.d.ts +114 -0
  113. package/build/runtime/documentStore.js +460 -0
  114. package/build/runtime/endpoint.d.ts +14 -0
  115. package/build/runtime/endpoint.js +29 -0
  116. package/build/runtime/flatten.d.ts +2 -0
  117. package/build/runtime/flatten.js +17 -0
  118. package/build/runtime/formData.d.ts +24 -0
  119. package/build/runtime/formData.js +93 -0
  120. package/build/runtime/index.d.ts +16 -0
  121. package/build/runtime/index.js +54 -0
  122. package/build/runtime/key.d.ts +6 -0
  123. package/build/runtime/key.js +17 -0
  124. package/build/runtime/log.d.ts +6 -0
  125. package/build/runtime/log.js +43 -0
  126. package/build/runtime/lru.d.ts +53 -0
  127. package/build/runtime/lru.js +68 -0
  128. package/build/runtime/multipart.d.ts +8 -0
  129. package/build/runtime/multipart.js +49 -0
  130. package/build/runtime/package.json +1 -0
  131. package/build/runtime/pageInfo.d.ts +7 -0
  132. package/build/runtime/pageInfo.js +52 -0
  133. package/build/runtime/pagination.d.ts +31 -0
  134. package/build/runtime/pagination.js +351 -0
  135. package/build/runtime/scalars.d.ts +14 -0
  136. package/build/runtime/scalars.js +89 -0
  137. package/build/runtime/selection.d.ts +2 -0
  138. package/build/runtime/selection.js +57 -0
  139. package/build/runtime/store.d.ts +19 -0
  140. package/build/runtime/store.js +56 -0
  141. package/build/runtime/types.d.ts +425 -0
  142. package/build/runtime/types.js +88 -0
  143. package/build/test/index.d.ts +7 -0
  144. package/build/test/index.js +329 -0
  145. package/build/test/package.json +1 -0
  146. package/build/vite/hmr.d.ts +24 -0
  147. package/build/vite/hmr.js +454 -0
  148. package/build/vite/houdini.d.ts +5 -0
  149. package/build/vite/houdini.js +146 -0
  150. package/build/vite/index.d.ts +26 -0
  151. package/build/vite/index.js +130 -0
  152. package/build/vite/package.json +1 -0
  153. package/build/vite/schema.d.ts +5 -0
  154. package/build/vite/schema.js +201 -0
  155. package/build/vite/session.d.ts +30 -0
  156. package/build/vite/session.js +29 -0
  157. package/package.json +207 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Alec Aivazis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,36 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/HoudiniGraphql/houdini/main/.github/assets/logo_l.svg">
4
+ <img height="140" alt="Houdini's logo (dark or light)" src="https://raw.githubusercontent.com/HoudiniGraphql/houdini/main/.github/assets/logo_d.svg">
5
+ </picture>
6
+ <br />
7
+ <br />
8
+ <strong>
9
+ The disappearing GraphQL clients.
10
+ </strong>
11
+ <br />
12
+ <br />
13
+ <a href="https://npmjs.org/package/houdini">
14
+ <img src="https://img.shields.io/npm/v/houdini.svg" alt="version" />
15
+ </a>
16
+ <a href="https://github.com/HoudiniGraphql/houdini/actions">
17
+ <img src="https://github.com/HoudiniGraphql/houdini/actions/workflows/tests.yml/badge.svg" alt="CI Tests" />
18
+ </a>
19
+ <a href="https://github.com/HoudiniGraphql/houdini">
20
+ <img src="https://img.shields.io/github/stars/HoudiniGraphql/houdini.svg?label=stars" alt="github stars" />
21
+ </a>
22
+ <a href="https://npmjs.org/package/houdini">
23
+ <img src="https://img.shields.io/npm/dm/houdini.svg" alt="downloads" />
24
+ </a>
25
+ <a href="https://github.com/HoudiniGraphql/houdini/blob/main/LICENSE">
26
+ <img src="https://img.shields.io/github/license/HoudiniGraphql/houdini.svg?maxAge=2592000" alt="license" />
27
+ </a>
28
+ </div>
2
29
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
30
+ ----
31
+
32
+ At its core, houdini seeks to enable a high quality developer experience
33
+ without compromising bundle size. Like Svelte, houdini shifts what is
34
+ traditionally handled by a bloated runtime into a compile step that allows
35
+ for the generation of an incredibly lean GraphQL abstraction for your application.
36
+ See more at <a href="https://www.houdinigraphql.com">HoudiniGraphQL.com</a> 🚀
@@ -0,0 +1,3 @@
1
+ import type { serverAdapterFactory as createAdapter } from '../router/server.js';
2
+ export declare const endpoint: string;
3
+ export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'yoga' | 'schema' | 'graphqlEndpoint' | 'componentCache' | 'client' | 'config_file'>) => ReturnType<typeof createAdapter>;
@@ -0,0 +1,6 @@
1
+ const endpoint = "";
2
+ let createServerAdapter;
3
+ export {
4
+ createServerAdapter,
5
+ endpoint
6
+ };
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,12 @@
1
+ import { type PipelineHook } from '../lib/index.js';
2
+ export declare function generate(args?: {
3
+ pullSchema: boolean;
4
+ output?: string;
5
+ headers: string[];
6
+ log?: string;
7
+ verbose: boolean;
8
+ mode?: string;
9
+ preserveDatabase: boolean;
10
+ afterPhase?: PipelineHook;
11
+ beforePhase?: PipelineHook;
12
+ }): Promise<void>;
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { format_error } from "../lib/error.js";
4
+ import {
5
+ codegen_setup,
6
+ init_db,
7
+ run_pipeline,
8
+ PIPELINE_HOOKS
9
+ } from "../lib/index.js";
10
+ import * as path from "../lib/path.js";
11
+ import { get_config } from "../lib/project.js";
12
+ import pull_schema from "./pullSchema.js";
13
+ async function generate(args = {
14
+ pullSchema: false,
15
+ headers: [],
16
+ verbose: false,
17
+ preserveDatabase: false
18
+ }) {
19
+ const mode = args.mode ?? "development";
20
+ let on_close = async () => {
21
+ };
22
+ if (args.pullSchema) {
23
+ await pull_schema({ headers: args.headers });
24
+ }
25
+ try {
26
+ const config = await get_config();
27
+ if (args.output && config) {
28
+ config.config_file.persistedQueriesPath = path.resolve(args.output);
29
+ }
30
+ const [db, dbFilepath] = await init_db(config, args.preserveDatabase);
31
+ const { trigger_hook, close } = await codegen_setup(config, mode, db, dbFilepath);
32
+ on_close = async () => {
33
+ try {
34
+ await close();
35
+ process.exit(0);
36
+ } catch (_error) {
37
+ process.exit(1);
38
+ }
39
+ };
40
+ process.on("SIGINT", on_close);
41
+ process.on("SIGTERM", on_close);
42
+ if (args.afterPhase && !PIPELINE_HOOKS.includes(args.afterPhase)) {
43
+ throw new Error(
44
+ `Invalid --after-phase: ${args.afterPhase}. Valid phases are: ${PIPELINE_HOOKS.join(
45
+ ", "
46
+ )}`
47
+ );
48
+ }
49
+ if (args.beforePhase && !PIPELINE_HOOKS.includes(args.beforePhase)) {
50
+ throw new Error(
51
+ `Invalid --before-phase: ${args.beforePhase}. Valid phases are: ${PIPELINE_HOOKS.join(", ")}`
52
+ );
53
+ }
54
+ const pipelineOptions = {
55
+ after: "Schema"
56
+ };
57
+ if (args.afterPhase) {
58
+ pipelineOptions.after = args.afterPhase;
59
+ }
60
+ if (args.beforePhase) {
61
+ pipelineOptions.through = args.beforePhase;
62
+ }
63
+ const results = await run_pipeline(trigger_hook, pipelineOptions);
64
+ const docCount = Object.values(results.GenerateDocuments ?? {}).flat().length;
65
+ console.log(`\u{1F3A9} Generated ${docCount} ${docCount === 1 ? "document" : "documents"}`);
66
+ await on_close();
67
+ } catch (e) {
68
+ format_error(e, (error) => {
69
+ console.error(error.stack?.split("\n").slice(1).join("\n"));
70
+ });
71
+ try {
72
+ on_close();
73
+ } catch (closeError) {
74
+ console.error("Error closing plugins:", closeError);
75
+ }
76
+ process.exit(1);
77
+ }
78
+ }
79
+ export {
80
+ generate
81
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from "commander";
4
+ import { yellow } from "kleur/colors";
5
+ import { generate } from "./generate.js";
6
+ import pullSchema from "./pullSchema.js";
7
+ const program = new Command();
8
+ program.command("generate").description("generate the application runtime").option("-p, --pull-schema", "pull the latest schema before generating").option("-r, --preserve-database", "preserve any existing generated logic").option("-o, --output [outputPath]", "persist queries to a queryMap file").option(
9
+ "-h, --headers <headers...>",
10
+ "headers to use when pulling your schema. Should be passed as KEY=VALUE"
11
+ ).option("-v, --verbose", "verbose error messages").option(
12
+ "--after-phase <phase>",
13
+ "start the pipeline after the specified phase (Config, AfterLoad, Schema, ExtractDocuments, AfterExtract, BeforeValidate, Validate, AfterValidate, BeforeGenerate, GenerateDocuments, GenerateRuntime, AfterGenerate)"
14
+ ).option(
15
+ "--before-phase <phase>",
16
+ "run the pipeline up to and including the specified phase (Config, AfterLoad, Schema, ExtractDocuments, AfterExtract, BeforeValidate, Validate, AfterValidate, BeforeGenerate, GenerateDocuments, GenerateRuntime, AfterGenerate)"
17
+ ).action(generate);
18
+ program.command("init").description("REMOVED: use the svelte cli community addon instead").action(() => {
19
+ console.log(
20
+ `${yellow("The init command has been replaced by a community addon for the Svelte CLI.")}`
21
+ );
22
+ console.log(
23
+ `${yellow("To get started, run `npx sv add @houdinigraphql` in a SvelteKit project.")}`
24
+ );
25
+ });
26
+ program.command("pull-schema").usage("[options]").description("pull the latest schema from your api").option("-o, --output [outputPath]", "the destination for the schema contents").option(
27
+ "-h, --headers <headers...>",
28
+ "headers to use when pulling your schema. Should be passed as KEY=VALUE"
29
+ ).action(pullSchema);
30
+ program.parse();
31
+ process.on("unhandledRejection", (error) => {
32
+ if ("description" in error) {
33
+ } else {
34
+ console.log(error);
35
+ }
36
+ });
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,4 @@
1
+ export default function (args: {
2
+ headers: string[];
3
+ output?: string;
4
+ }): Promise<void>;
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ import * as path from "../lib/path.js";
4
+ import { get_config } from "../lib/project.js";
5
+ import { pull_schema } from "../lib/schema.js";
6
+ async function pullSchema_default(args) {
7
+ const config = await get_config({ skip_schema: true });
8
+ const apiURL = await config.api_url();
9
+ if (!apiURL) {
10
+ console.log(
11
+ "\u274C Your project does not have a remote endpoint configured. Please provide one with the `apiUrl` value in your houdini.config.js file."
12
+ );
13
+ process.exit(1);
14
+ }
15
+ const headers = await config.schema_pull_headers();
16
+ const targetPath = args.output ? path.resolve(args.output) : config.config_file.schemaPath ?? path.resolve(process.cwd(), "schema.json");
17
+ await pull_schema(
18
+ apiURL,
19
+ (config.config_file.watchSchema || void 0)?.timeout ?? 3e4,
20
+ targetPath,
21
+ headers
22
+ );
23
+ }
24
+ export {
25
+ pullSchema_default as default
26
+ };
@@ -0,0 +1,16 @@
1
+ import * as recast from 'recast';
2
+ type Statement = recast.types.namedTypes.Statement;
3
+ type Program = recast.types.namedTypes.Program;
4
+ type ExportNamedDeclaration = recast.types.namedTypes.ExportNamedDeclaration;
5
+ type FunctionDeclaration = recast.types.namedTypes.FunctionDeclaration;
6
+ type Identifier = recast.types.namedTypes.Identifier;
7
+ type ArrowFunctionExpression = recast.types.namedTypes.ArrowFunctionExpression;
8
+ type FunctionExpression = recast.types.namedTypes.FunctionExpression;
9
+ type CallExpression = recast.types.namedTypes.CallExpression;
10
+ export declare function find_insert_index(script: Program): number;
11
+ export declare function find_exported_fn(body: Statement[], name: string): {
12
+ declaration: FunctionDeclaration | FunctionExpression | ArrowFunctionExpression | null | Identifier | CallExpression;
13
+ export: ExportNamedDeclaration;
14
+ } | null;
15
+ export declare function find_exported_id(program: Program, name: string): recast.types.namedTypes.ExportNamedDeclaration | undefined;
16
+ export {};
@@ -0,0 +1,71 @@
1
+ import * as recast from "recast";
2
+ const _AST = recast.types.builders;
3
+ function find_insert_index(script) {
4
+ let insert_index = script.body.findIndex((statement) => {
5
+ return statement.type !== "ImportDeclaration";
6
+ });
7
+ if (insert_index === -1) {
8
+ insert_index = script.body.length;
9
+ }
10
+ return insert_index;
11
+ }
12
+ function find_exported_fn(body, name) {
13
+ for (const statement of body) {
14
+ if (statement.type !== "ExportNamedDeclaration") {
15
+ continue;
16
+ }
17
+ const exportDeclaration = statement;
18
+ if (exportDeclaration.declaration?.type === "FunctionDeclaration") {
19
+ const value = exportDeclaration.declaration;
20
+ if (value.id?.name === name) {
21
+ return {
22
+ declaration: exportDeclaration.declaration,
23
+ export: exportDeclaration
24
+ };
25
+ }
26
+ } else if (exportDeclaration.declaration?.type === "VariableDeclaration") {
27
+ const value = exportDeclaration.declaration;
28
+ if (value.declarations.length !== 1 || value.declarations[0].type !== "VariableDeclarator" || value.declarations[0].id.type !== "Identifier" || value.declarations[0].id.name !== name) {
29
+ continue;
30
+ }
31
+ const declaration = value.declarations[0];
32
+ let { init } = declaration;
33
+ if (!init) {
34
+ continue;
35
+ }
36
+ if (init.type === "TSSatisfiesExpression") {
37
+ init = init.expression;
38
+ }
39
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
40
+ init = init.arguments[0];
41
+ }
42
+ if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
43
+ return { declaration: init, export: exportDeclaration };
44
+ }
45
+ if (init.type === "Identifier" || init.type === "CallExpression") {
46
+ return { declaration: init, export: exportDeclaration };
47
+ }
48
+ } else {
49
+ }
50
+ }
51
+ const exported = body.find(
52
+ (expression) => expression.type === "ExportNamedDeclaration" && (expression.declaration?.type === "FunctionDeclaration" && expression.declaration.id?.name === name || expression.declaration?.type === "VariableDeclaration" && expression.declaration.declarations.length === 1 && expression.declaration.declarations[0].type === "Identifier" && expression.declaration.declarations[0].name === name)
53
+ );
54
+ if (!exported) {
55
+ return null;
56
+ }
57
+ return {
58
+ declaration: exported.declaration,
59
+ export: exported
60
+ };
61
+ }
62
+ function find_exported_id(program, name) {
63
+ return program.body.find(
64
+ (statement) => statement.type === "ExportNamedDeclaration" && statement.declaration?.type === "VariableDeclaration" && statement.declaration.declarations.length === 1 && statement.declaration.declarations[0].type === "VariableDeclarator" && statement.declaration.declarations[0].id.type === "Identifier" && statement.declaration.declarations[0].id.name === name
65
+ );
66
+ }
67
+ export {
68
+ find_exported_fn,
69
+ find_exported_id,
70
+ find_insert_index
71
+ };
@@ -0,0 +1,57 @@
1
+ import * as conventions from '../router/conventions.js';
2
+ import type { Config } from './config.js';
3
+ import { type Db } from './db.js';
4
+ import type { ProjectManifest } from './types.js';
5
+ export type PluginSpec = {
6
+ name: string;
7
+ port: number;
8
+ directory: string;
9
+ hooks: Set<string>;
10
+ order: 'before' | 'after' | 'core';
11
+ };
12
+ export type Adapter = ((args: {
13
+ config: Config;
14
+ conventions: typeof conventions;
15
+ sourceDir: string;
16
+ publicBase: string;
17
+ outDir: string;
18
+ manifest: ProjectManifest;
19
+ adapterPath: string;
20
+ }) => void | Promise<void>) & {
21
+ includePaths?: Record<string, string> | ((args: {
22
+ config: Config;
23
+ }) => Record<string, string>);
24
+ disableServer?: boolean;
25
+ pre?: (args: {
26
+ config: Config;
27
+ conventions: typeof conventions;
28
+ sourceDir: string;
29
+ publicBase: string;
30
+ outDir: string;
31
+ }) => Promise<void> | void;
32
+ };
33
+ export declare function connect_db(config: Config, db_file?: string): Promise<[Db, string]>;
34
+ export declare function init_db(config: Config, preserve: boolean, db_file?: string): Promise<[Db, string]>;
35
+ export type CompilerProxy = {
36
+ close: () => Promise<void>;
37
+ trigger_hook: (name: PipelineHook, opts?: {
38
+ parallel_safe?: boolean;
39
+ payload?: {};
40
+ task_id?: string;
41
+ }) => Promise<Record<string, any> | null>;
42
+ database_path: string;
43
+ run_pipeline: (options: RunPipelineOptions) => Promise<Record<PipelineHook, Record<string, any>>>;
44
+ /** Serializes concurrent pipeline runs (HMR vs schema watcher) via a promise chain. */
45
+ pipeline_lock: <T>(fn: () => Promise<T>) => Promise<T>;
46
+ };
47
+ export declare function plugin_db_key(name: string): string;
48
+ export declare function codegen_setup(config: Config, mode: string, db: Db, db_file: string): Promise<CompilerProxy>;
49
+ export declare const PIPELINE_HOOKS: readonly ["Config", "AfterLoad", "Schema", "ExtractDocuments", "AfterExtract", "BeforeValidate", "Validate", "AfterValidate", "BeforeGenerate", "GenerateDocuments", "GenerateRuntime", "AfterGenerate"];
50
+ export type PipelineHook = (typeof PIPELINE_HOOKS)[number];
51
+ export type RunPipelineOptions = {
52
+ task_id?: string;
53
+ after?: PipelineHook;
54
+ start?: PipelineHook;
55
+ through?: PipelineHook;
56
+ };
57
+ export declare function run_pipeline(trigger_hook: CompilerProxy['trigger_hook'], options?: RunPipelineOptions): Promise<Record<PipelineHook, Record<string, any>>>;