pastoria 1.0.11 → 1.0.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # pastoria
2
2
 
3
+ ## 1.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 0ef0bdc: Automatically infer variable names and types from queries on
8
+ resource-routes if none provided
9
+
10
+ ## 1.0.12
11
+
12
+ ### Patch Changes
13
+
14
+ - 641b356: Add pastoria make command
15
+
3
16
  ## 1.0.11
4
17
 
5
18
  ### Patch Changes
package/dist/build.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { InlineConfig, type BuildEnvironmentOptions } from 'vite';
2
- export declare const CLIENT_BUILD: BuildEnvironmentOptions;
3
- export declare const SERVER_BUILD: BuildEnvironmentOptions;
4
- export declare function createBuildConfig(buildEnv: BuildEnvironmentOptions): InlineConfig;
5
- export declare function createBuild(): Promise<void>;
1
+ export declare function createBuild(steps: string[], opts: {
2
+ alwaysMake: boolean;
3
+ release: boolean;
4
+ watch?: boolean;
5
+ }): Promise<void>;
6
6
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EACZ,KAAK,uBAAuB,EAE7B,MAAM,MAAM,CAAC;AA8Id,eAAO,MAAM,YAAY,EAAE,uBAK1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,uBAM1B,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,uBAAuB,GAChC,YAAY,CAyBd;AAED,wBAAsB,WAAW,kBAUhC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AA4MA,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE;IACJ,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,iBA+FF"}
package/dist/build.js CHANGED
@@ -1,179 +1,228 @@
1
- import tailwindcss from '@tailwindcss/vite';
2
- import react from '@vitejs/plugin-react';
3
- import { access } from 'node:fs/promises';
4
- import { build, } from 'vite';
5
- import { cjsInterop } from 'vite-plugin-cjs-interop';
6
- function generateClientEntry({ hasAppRoot }) {
7
- const appImport = hasAppRoot
8
- ? `import {App} from '#genfiles/router/app_root';`
9
- : '';
10
- const appValue = hasAppRoot ? 'App' : 'null';
11
- return `// Generated by Pastoria.
12
- import {createRouterApp} from '#genfiles/router/router';
13
- ${appImport}
14
- import {hydrateRoot} from 'react-dom/client';
15
-
16
- async function main() {
17
- const RouterApp = await createRouterApp();
18
- hydrateRoot(document, <RouterApp App={${appValue}} />);
1
+ import ParcelWatcher, { getEventsSince, writeSnapshot } from '@parcel/watcher';
2
+ import { spawn } from 'node:child_process';
3
+ import { access, readFile } from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import { IndentationText, Project } from 'ts-morph';
6
+ import { build } from 'vite';
7
+ import { generatePastoriaArtifacts, generatePastoriaExports, PASTORIA_TAG_REGEX, } from './generate.js';
8
+ import { logger, logInfo } from './logger.js';
9
+ import { CLIENT_BUILD, createBuildConfig, SERVER_BUILD } from './vite_plugin.js';
10
+ var PastoriaMakePhase;
11
+ (function (PastoriaMakePhase) {
12
+ PastoriaMakePhase[PastoriaMakePhase["PASTORIA_EXPORTS"] = 0] = "PASTORIA_EXPORTS";
13
+ PastoriaMakePhase[PastoriaMakePhase["PASTORIA_ARTIFACTS"] = 1] = "PASTORIA_ARTIFACTS";
14
+ PastoriaMakePhase[PastoriaMakePhase["RELAY"] = 2] = "RELAY";
15
+ PastoriaMakePhase[PastoriaMakePhase["GRATS"] = 3] = "GRATS";
16
+ })(PastoriaMakePhase || (PastoriaMakePhase = {}));
17
+ const ALL_MAKE_PHASES = new Set([
18
+ PastoriaMakePhase.PASTORIA_EXPORTS,
19
+ PastoriaMakePhase.PASTORIA_ARTIFACTS,
20
+ PastoriaMakePhase.RELAY,
21
+ PastoriaMakePhase.GRATS,
22
+ ]);
23
+ const SNAPSHOT_PATH = '.pastoriainfo';
24
+ async function runCommand(command, args) {
25
+ return new Promise((resolve, reject) => {
26
+ const child = spawn(command, args, {
27
+ cwd: process.cwd(),
28
+ stdio: 'inherit', // Stream output to terminal
29
+ shell: true,
30
+ });
31
+ child.on('exit', (code) => {
32
+ if (code === 0) {
33
+ resolve();
34
+ }
35
+ else {
36
+ reject(new Error(`Command failed with exit code ${code}`));
37
+ }
38
+ });
39
+ child.on('error', reject);
40
+ });
19
41
  }
20
-
21
- main();
22
- `;
42
+ async function runGratsCompiler() {
43
+ const gratsPath = path.join(process.cwd(), 'node_modules', '.bin', 'grats');
44
+ await runCommand(gratsPath, []);
23
45
  }
24
- function generateServerEntry({ hasAppRoot, hasServerHandler, }) {
25
- const appImport = hasAppRoot
26
- ? `import {App} from '#genfiles/router/app_root';`
27
- : '';
28
- const appValue = hasAppRoot ? 'App' : 'null';
29
- const serverHandlerImport = hasServerHandler
30
- ? `import {router as serverHandler} from '#genfiles/router/server_handler';`
31
- : '';
32
- const serverHandlerUse = hasServerHandler
33
- ? ' router.use(serverHandler)'
34
- : '';
35
- return `// Generated by Pastoria.
36
- import {JSResource} from '#genfiles/router/js_resource';
37
- import {
38
- listRoutes,
39
- router__createAppFromEntryPoint,
40
- router__loadEntryPoint,
41
- } from '#genfiles/router/router';
42
- import {getSchema} from '#genfiles/schema/schema';
43
- import {Context} from '#genfiles/router/context';
44
- ${appImport}
45
- ${serverHandlerImport}
46
- import express from 'express';
47
- import {GraphQLSchema, specifiedDirectives} from 'graphql';
48
- import {PastoriaConfig} from 'pastoria-config';
49
- import {createRouterHandler} from 'pastoria-runtime/server';
50
- import type {Manifest} from 'vite';
51
-
52
- const schemaConfig = getSchema().toConfig();
53
- const schema = new GraphQLSchema({
54
- ...schemaConfig,
55
- directives: [...specifiedDirectives, ...schemaConfig.directives],
56
- });
57
-
58
- export function createHandler(
59
- persistedQueries: Record<string, string>,
60
- config: Required<PastoriaConfig>,
61
- manifest?: Manifest,
62
- ) {
63
- const routeHandler = createRouterHandler(
64
- listRoutes(),
65
- JSResource.srcOfModuleId,
66
- router__loadEntryPoint,
67
- router__createAppFromEntryPoint,
68
- ${appValue},
69
- schema,
70
- (req) => Context.createFromRequest(req),
71
- persistedQueries,
72
- config,
73
- manifest,
74
- );
75
-
76
- const router = express.Router();
77
- router.use(routeHandler);
78
- ${serverHandlerUse}
79
-
80
- return router;
46
+ async function runRelayCompiler() {
47
+ const relayPath = path.join(process.cwd(), 'node_modules', '.bin', 'relay-compiler');
48
+ await runCommand(relayPath, []);
81
49
  }
82
- `;
50
+ function fileMatchesPastoriaTags(filePath, content) {
51
+ // Skip generated files
52
+ if (filePath.includes('__generated__')) {
53
+ return false;
54
+ }
55
+ return PASTORIA_TAG_REGEX.test(content);
83
56
  }
84
- async function determineCapabilities() {
85
- const capabilities = {
86
- hasAppRoot: false,
87
- hasServerHandler: false,
88
- };
89
- async function hasAppRoot() {
90
- try {
91
- await access('__generated__/router/app_root.ts');
92
- capabilities.hasAppRoot = true;
93
- }
94
- catch { }
57
+ function fileMatchesGratsTags(filePath, content) {
58
+ // Skip generated files
59
+ if (filePath.includes('__generated__')) {
60
+ return false;
95
61
  }
96
- async function hasServerHandler() {
97
- try {
98
- await access('__generated__/router/server_handler.ts');
99
- capabilities.hasServerHandler = true;
100
- }
101
- catch { }
62
+ // Match any Grats JSDoc tag
63
+ return /@gql\w+/.test(content);
64
+ }
65
+ function fileMatchesRelayImports(filePath, content) {
66
+ // Skip generated files
67
+ if (filePath.includes('__generated__')) {
68
+ return false;
102
69
  }
103
- await Promise.all([hasAppRoot(), hasServerHandler()]);
104
- return capabilities;
70
+ return (/import\s+.*\s+from\s+['"]react-relay['"]/.test(content) ||
71
+ /import\s+.*\s+from\s+['"]relay-runtime['"]/.test(content));
105
72
  }
106
- function pastoriaEntryPlugin() {
107
- const clientEntryModuleId = 'virtual:pastoria-entry-client.tsx';
108
- const serverEntryModuleId = 'virtual:pastoria-entry-server.tsx';
109
- return {
110
- name: 'pastoria-entry',
111
- resolveId(id) {
112
- if (id === clientEntryModuleId) {
113
- return clientEntryModuleId; // Return without \0 prefix so React plugin can see .tsx extension
114
- }
115
- else if (id === serverEntryModuleId) {
116
- return serverEntryModuleId;
73
+ async function requiredMakePhasesForChanges(events) {
74
+ let makePhases = new Set();
75
+ await Promise.all(events.map(async (event) => {
76
+ const filePath = event.path;
77
+ // Skip non-TypeScript/TSX files
78
+ if (!filePath.match(/\.(ts|tsx)$/)) {
79
+ return;
80
+ }
81
+ // For delete events, we can't read content, so assume it might affect all pipelines
82
+ if (event.type === 'delete') {
83
+ makePhases = ALL_MAKE_PHASES;
84
+ return;
85
+ }
86
+ // Read file content for create/update events
87
+ try {
88
+ const content = await readFile(filePath, 'utf-8');
89
+ if (fileMatchesPastoriaTags(filePath, content)) {
90
+ makePhases.add(PastoriaMakePhase.PASTORIA_EXPORTS);
91
+ makePhases.add(PastoriaMakePhase.PASTORIA_ARTIFACTS);
117
92
  }
118
- },
119
- async load(id) {
120
- const capabilities = await determineCapabilities();
121
- if (id === clientEntryModuleId) {
122
- return generateClientEntry(capabilities);
93
+ if (fileMatchesGratsTags(filePath, content)) {
94
+ makePhases.add(PastoriaMakePhase.GRATS);
95
+ makePhases.add(PastoriaMakePhase.RELAY); // Relay depends on Grats schema
123
96
  }
124
- else if (id === serverEntryModuleId) {
125
- return generateServerEntry(capabilities);
97
+ if (fileMatchesRelayImports(filePath, content)) {
98
+ makePhases.add(PastoriaMakePhase.RELAY);
126
99
  }
127
- },
128
- };
100
+ }
101
+ catch {
102
+ // If we can't read the file, assume it might affect all pipelines
103
+ makePhases = ALL_MAKE_PHASES;
104
+ }
105
+ }));
106
+ return makePhases;
129
107
  }
130
- export const CLIENT_BUILD = {
131
- outDir: 'dist/client',
132
- rollupOptions: {
133
- input: 'virtual:pastoria-entry-client.tsx',
134
- },
135
- };
136
- export const SERVER_BUILD = {
137
- outDir: 'dist/server',
138
- ssr: true,
139
- rollupOptions: {
140
- input: 'virtual:pastoria-entry-server.tsx',
141
- },
142
- };
143
- export function createBuildConfig(buildEnv) {
144
- return {
145
- appType: 'custom',
146
- build: {
147
- ...buildEnv,
148
- assetsInlineLimit: 0,
149
- manifest: true,
150
- ssrManifest: true,
151
- },
152
- plugins: [
153
- pastoriaEntryPlugin(),
154
- tailwindcss(),
155
- react({
156
- babel: {
157
- plugins: [['babel-plugin-react-compiler', {}], 'relay'],
158
- },
159
- }),
160
- cjsInterop({
161
- dependencies: ['react-relay', 'react-relay/hooks', 'relay-runtime'],
162
- }),
163
- ],
164
- ssr: {
165
- noExternal: ['pastoria-runtime'],
166
- },
167
- };
108
+ function requiredMakePhasesForArgs(steps) {
109
+ const validSteps = new Set(['schema', 'relay', 'router']);
110
+ const needs = new Set();
111
+ for (const step of steps) {
112
+ if (!validSteps.has(step)) {
113
+ throw new Error(`Invalid build step: ${step}. Valid steps are: schema, relay, router`);
114
+ }
115
+ switch (step) {
116
+ case 'schema':
117
+ needs.add(PastoriaMakePhase.GRATS);
118
+ break;
119
+ case 'relay':
120
+ needs.add(PastoriaMakePhase.RELAY);
121
+ break;
122
+ case 'router':
123
+ needs.add(PastoriaMakePhase.PASTORIA_EXPORTS);
124
+ needs.add(PastoriaMakePhase.PASTORIA_ARTIFACTS);
125
+ break;
126
+ }
127
+ }
128
+ return needs;
168
129
  }
169
- export async function createBuild() {
170
- const clientBuild = await build({
171
- ...createBuildConfig(CLIENT_BUILD),
172
- configFile: false,
173
- });
174
- const serverBuild = await build({
175
- ...createBuildConfig(SERVER_BUILD),
176
- configFile: false,
130
+ async function executeBuildSteps(project, needs) {
131
+ let rebuiltAnything = false;
132
+ let cachedMetadata = undefined;
133
+ if (needs.has(PastoriaMakePhase.PASTORIA_EXPORTS)) {
134
+ logInfo('Running Pastoria exports generation...');
135
+ cachedMetadata = await generatePastoriaExports(project);
136
+ rebuiltAnything = true;
137
+ }
138
+ if (needs.has(PastoriaMakePhase.GRATS)) {
139
+ logInfo('Running Grats compiler...');
140
+ await runGratsCompiler();
141
+ rebuiltAnything = true;
142
+ }
143
+ if (needs.has(PastoriaMakePhase.RELAY)) {
144
+ logInfo('Running Relay compiler...');
145
+ await runRelayCompiler();
146
+ rebuiltAnything = true;
147
+ }
148
+ if (needs.has(PastoriaMakePhase.PASTORIA_ARTIFACTS)) {
149
+ logInfo('Running Pastoria artifacts generation...');
150
+ await generatePastoriaArtifacts(project, cachedMetadata);
151
+ rebuiltAnything = true;
152
+ }
153
+ return rebuiltAnything;
154
+ }
155
+ export async function createBuild(steps, opts) {
156
+ if (opts.watch && opts.release) {
157
+ throw new Error('Cannot use --watch and --release together. Watch mode is for development only.');
158
+ }
159
+ const project = new Project({
160
+ tsConfigFilePath: path.join(process.cwd(), 'tsconfig.json'),
161
+ manipulationSettings: {
162
+ indentationText: IndentationText.TwoSpaces,
163
+ },
177
164
  });
165
+ const cwd = process.cwd();
166
+ let makePhases = new Set();
167
+ // If specific steps are provided, override automatic inference
168
+ if (steps.length > 0) {
169
+ makePhases = makePhases.union(requiredMakePhasesForArgs(steps));
170
+ }
171
+ else if (opts.alwaysMake) {
172
+ makePhases = ALL_MAKE_PHASES;
173
+ }
174
+ // Use @parcel/watcher to get changes since last snapshot
175
+ else {
176
+ try {
177
+ // Check if snapshot exists - if not, do a full build
178
+ await access(SNAPSHOT_PATH);
179
+ // Get events since last snapshot
180
+ const events = await getEventsSince(cwd, SNAPSHOT_PATH);
181
+ if (events.length > 0) {
182
+ // Analyze which files changed and determine what needs to be rebuilt
183
+ makePhases = makePhases.union(await requiredMakePhasesForChanges(events));
184
+ }
185
+ }
186
+ catch (err) {
187
+ // No snapshot exists yet, or error reading it - do a full build
188
+ makePhases = ALL_MAKE_PHASES;
189
+ }
190
+ }
191
+ // Execute build pipeline conditionally
192
+ await executeBuildSteps(project, makePhases);
193
+ // Write snapshot for next incremental build
194
+ await writeSnapshot(cwd, SNAPSHOT_PATH);
195
+ if (opts.release) {
196
+ await build({
197
+ ...createBuildConfig(CLIENT_BUILD),
198
+ configFile: false,
199
+ });
200
+ await build({
201
+ ...createBuildConfig(SERVER_BUILD),
202
+ configFile: false,
203
+ });
204
+ }
205
+ // Start watch mode if requested
206
+ if (opts.watch) {
207
+ logInfo('Watching for changes...');
208
+ const subscription = await ParcelWatcher.subscribe(cwd, async (err, events) => {
209
+ if (err) {
210
+ logger.error('Watch error!', { error: err });
211
+ return;
212
+ }
213
+ // Analyze which files changed and determine what needs to be rebuilt
214
+ const rebuiltAnything = await executeBuildSteps(project, await requiredMakePhasesForChanges(events));
215
+ if (rebuiltAnything) {
216
+ // Write snapshot after successful rebuild
217
+ await writeSnapshot(cwd, SNAPSHOT_PATH);
218
+ logInfo('Rebuild complete. Watching for changes...');
219
+ }
220
+ });
221
+ // Keep the process running
222
+ process.on('SIGINT', async () => {
223
+ await subscription.unsubscribe();
224
+ process.exit(0);
225
+ });
226
+ }
178
227
  }
179
228
  //# sourceMappingURL=build.js.map
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAExC,OAAO,EACL,KAAK,GAIN,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAOnD,SAAS,mBAAmB,CAAC,EAAC,UAAU,EAAuB;IAC7D,MAAM,SAAS,GAAG,UAAU;QAC1B,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAA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AAG,EAAE,aAAa,CAAC,CAAC;gBACxC,OAAO,CAAC,2CAA2C,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CACF,CAAC;QAEF,2BAA2B;QAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YAC9B,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"devserver.d.ts","sourceRoot":"","sources":["../src/devserver.ts"],"names":[],"mappings":"AAqBA,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,iBAmCxD"}
1
+ {"version":3,"file":"devserver.d.ts","sourceRoot":"","sources":["../src/devserver.ts"],"names":[],"mappings":"AAsBA,wBAAsB,cAAc,CAAC,IAAI,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,iBAmCxD"}
package/dist/devserver.js CHANGED
@@ -2,10 +2,11 @@ import cookieParser from 'cookie-parser';
2
2
  import dotenv from 'dotenv';
3
3
  import express from 'express';
4
4
  import { readFile } from 'node:fs/promises';
5
- import pc from 'picocolors';
6
5
  import { loadConfig } from 'pastoria-config';
6
+ import pc from 'picocolors';
7
7
  import { createServer as createViteServer } from 'vite';
8
- import { CLIENT_BUILD, createBuildConfig } from './build.js';
8
+ import { logInfo } from './logger.js';
9
+ import { CLIENT_BUILD, createBuildConfig } from './vite_plugin.js';
9
10
  export async function startDevserver(opts) {
10
11
  dotenv.config();
11
12
  const buildConfig = createBuildConfig(CLIENT_BUILD);
@@ -29,7 +30,7 @@ export async function startDevserver(opts) {
29
30
  console.error(err);
30
31
  }
31
32
  else {
32
- console.log(pc.cyan(`Listening on port ${opts.port}!`));
33
+ logInfo(pc.cyan(`Listening on port ${opts.port}!`));
33
34
  }
34
35
  });
35
36
  }
@@ -1 +1 @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U,EAAE,KAAK;QACjB,MAAM,EAAE,EAAC,cAAc,EAAE,IAAI,EAAC;KAC/B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAElC,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CACjC,MAAM,QAAQ,CAAC,6CAA6C,EAAE,OAAO,CAAC,CACvE,CAAC;QAEF,MAAM,EAAC,aAAa,EAAC,GAAG,CAAC,MAAM,IAAI,CAAC,aAAa,CAC/C,mCAAmC,CACpC,CAAgB,CAAC;QAElB,MAAM,OAAO,GAAG,aAAa,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;QACpC,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,qBAAqB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -25,5 +25,37 @@
25
25
  * The generator automatically creates Zod schemas for route parameters based on
26
26
  * TypeScript types, enabling runtime validation and type safety.
27
27
  */
28
- export declare function generatePastoriaArtifacts(): Promise<void>;
28
+ import { Project, SourceFile, Symbol, ts } from 'ts-morph';
29
+ type RouterResource = {
30
+ sourceFile: SourceFile;
31
+ symbol: Symbol;
32
+ queries: Map<string, string>;
33
+ entryPoints: Map<string, string>;
34
+ };
35
+ type RouterRoute = {
36
+ sourceFile: SourceFile;
37
+ symbol: Symbol;
38
+ params: Map<string, ts.Type>;
39
+ };
40
+ type ExportedSymbol = {
41
+ sourceFile: SourceFile;
42
+ symbol: Symbol;
43
+ };
44
+ export interface PastoriaMetadata {
45
+ resources: Map<string, RouterResource>;
46
+ routes: Map<string, RouterRoute>;
47
+ serverHandlers: Map<string, ExportedSymbol>;
48
+ appRoot: ExportedSymbol | null;
49
+ gqlContext: ExportedSymbol | null;
50
+ }
51
+ export declare const PASTORIA_TAG_REGEX: RegExp;
52
+ export declare function generatePastoriaExports(project: Project): Promise<PastoriaMetadata>;
53
+ export declare function generatePastoriaArtifacts(project: Project, metadata?: PastoriaMetadata): Promise<void>;
54
+ export interface PastoriaCapabilities {
55
+ hasAppRoot: boolean;
56
+ hasServerHandler: boolean;
57
+ }
58
+ export declare function generateClientEntry({ hasAppRoot, }: PastoriaCapabilities): string;
59
+ export declare function generateServerEntry({ hasAppRoot, hasServerHandler, }: PastoriaCapabilities): string;
60
+ export {};
29
61
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAotBH,wBAAsB,yBAAyB,kBAgB9C"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,EAEL,OAAO,EACP,UAAU,EACV,MAAM,EAEN,EAAE,EAEH,MAAM,UAAU,CAAC;AAsBlB,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAA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