pastoria 1.1.0 → 1.2.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.
- package/dist/devserver.d.ts.map +1 -1
- package/dist/devserver.js +1 -3
- package/dist/devserver.js.map +1 -1
- package/dist/filesystem.d.ts +188 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +358 -0
- package/dist/filesystem.js.map +1 -0
- package/dist/generate.d.ts +47 -50
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +747 -450
- package/dist/generate.js.map +1 -1
- package/dist/index.js +41 -13
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +6 -1
- package/dist/logger.js.map +1 -1
- package/dist/vite_plugin.js +1 -1
- package/dist/vite_plugin.js.map +1 -1
- package/package.json +5 -7
- package/templates/js_resource.ts +7 -1
- package/templates/router.tsx +188 -45
- package/justfile +0 -41
package/dist/generate.d.ts
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Router Code Generator
|
|
3
3
|
*
|
|
4
|
-
* This script generates type-safe router configuration files
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* -
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
4
|
+
* This script generates type-safe router configuration files using filesystem-based
|
|
5
|
+
* routing, similar to Next.js App Router.
|
|
6
|
+
*
|
|
7
|
+
* ## Filesystem Routing Convention
|
|
8
|
+
*
|
|
9
|
+
* Routes are defined by the directory structure under `pastoria/`:
|
|
10
|
+
* - `pastoria/page.tsx` → Route `/`
|
|
11
|
+
* - `pastoria/about/page.tsx` → Route `/about`
|
|
12
|
+
* - `pastoria/post/[slug]/page.tsx` → Route `/post/:slug`
|
|
13
|
+
* - `pastoria/app.tsx` → Root layout component
|
|
14
|
+
* - `pastoria/api/.../route.ts` → API route handlers
|
|
15
|
+
* - `pastoria/*.page.tsx` → Nested entry points
|
|
16
|
+
* - `pastoria/entrypoint.ts` → Manual entry point definitions
|
|
17
|
+
*
|
|
18
|
+
* ## Page Files
|
|
19
|
+
*
|
|
20
|
+
* Each `page.tsx` should:
|
|
21
|
+
* - Default export a React component
|
|
22
|
+
* - Optionally export `queries` object mapping query refs to Relay query types
|
|
23
|
+
*
|
|
24
|
+
* ## Generated Files
|
|
25
|
+
*
|
|
26
|
+
* Output is placed in `__generated__/router/`:
|
|
27
|
+
* - `js_resource.ts` - Resource configuration for lazy loading
|
|
28
|
+
* - `router.tsx` - Client-side router with type-safe routes
|
|
29
|
+
* - `app_root.ts` - Re-export of the app root component
|
|
30
|
+
* - `environment.ts` - Re-export of the user's PastoriaEnvironment
|
|
31
|
+
* - `server_handler.ts` - API route handlers
|
|
32
|
+
* - `types.ts` - PageProps and other type definitions
|
|
27
33
|
*/
|
|
28
|
-
import { Project
|
|
29
|
-
type
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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>;
|
|
34
|
+
import { Project } from 'ts-morph';
|
|
35
|
+
import { type FilesystemMetadata } from './filesystem.js';
|
|
36
|
+
/**
|
|
37
|
+
* Generates all Pastoria artifacts from the filesystem.
|
|
38
|
+
*
|
|
39
|
+
* This is the main entry point for code generation.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generatePastoriaArtifacts(project: Project): Promise<FilesystemMetadata>;
|
|
54
42
|
export interface PastoriaCapabilities {
|
|
55
43
|
hasAppRoot: boolean;
|
|
56
44
|
hasServerHandler: boolean;
|
|
57
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Detects what capabilities are available based on source files.
|
|
48
|
+
*/
|
|
49
|
+
export declare function detectCapabilities(): Promise<PastoriaCapabilities>;
|
|
50
|
+
/**
|
|
51
|
+
* Generates the client entry point code.
|
|
52
|
+
*/
|
|
58
53
|
export declare function generateClientEntry({ hasAppRoot, }: PastoriaCapabilities): string;
|
|
54
|
+
/**
|
|
55
|
+
* Generates the server entry point code.
|
|
56
|
+
*/
|
|
59
57
|
export declare function generateServerEntry({ hasAppRoot, hasServerHandler, }: PastoriaCapabilities): string;
|
|
60
|
-
export {};
|
|
61
58
|
//# sourceMappingURL=generate.d.ts.map
|
package/dist/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EAEL,OAAO,EAKR,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,iBAAiB,CAAC;AAoiCzB;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,OAAO,+BAa/D;AAMD,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAcxE;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,GACX,EAAE,oBAAoB,GAAG,MAAM,CAgB/B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,gBAAgB,GACjB,EAAE,oBAAoB,GAAG,MAAM,CA+C/B"}
|