pastoria 1.0.15 → 1.1.0

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/src/index.ts DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import {program} from 'commander';
4
- import {readFile} from 'node:fs/promises';
5
- import * as path from 'node:path';
6
- import {createBuild} from './build.js';
7
- import {startDevserver} from './devserver.js';
8
-
9
- async function main() {
10
- const packageData = JSON.parse(
11
- await readFile(path.join(import.meta.dirname, '../package.json'), 'utf-8'),
12
- );
13
-
14
- program
15
- .name('pastoria')
16
- .description(packageData.description)
17
- .version(packageData.version);
18
-
19
- program
20
- .command('dev')
21
- .description('Start the pastoria devserver')
22
- .option('--port <port>', 'Port the devserver will listen on', '3000')
23
- .action(startDevserver);
24
-
25
- program
26
- .command('make')
27
- .description('Creates a production build of the project')
28
- .argument(
29
- '[steps...]',
30
- 'Specific build steps to run (schema, relay, router). If not provided, will infer from changed files.',
31
- )
32
- .option('-B, --always-make', 'Always make, never cache')
33
- .option('-R, --release', 'Build for production')
34
- .option('-w, --watch', 'Watch for changes and rebuild')
35
- .action(createBuild);
36
-
37
- program.parseAsync();
38
- }
39
-
40
- main().catch(console.error);
package/src/logger.ts DELETED
@@ -1,12 +0,0 @@
1
- import {createLogger} from 'vite';
2
- import pc from 'picocolors';
3
-
4
- export const logger = createLogger('info', {prefix: pc.greenBright('[MAKE]')});
5
-
6
- export function logInfo(...messages: string[]) {
7
- logger.info(messages.join(' '), {timestamp: true});
8
- }
9
-
10
- export function logWarn(...messages: string[]) {
11
- logger.warn(messages.join(' '), {timestamp: true});
12
- }
@@ -1,109 +0,0 @@
1
- import tailwindcss from '@tailwindcss/vite';
2
- import react from '@vitejs/plugin-react';
3
- import {access} from 'node:fs/promises';
4
- import {
5
- InlineConfig,
6
- PluginOption,
7
- type BuildEnvironmentOptions,
8
- type Plugin,
9
- } from 'vite';
10
- import {cjsInterop} from 'vite-plugin-cjs-interop';
11
- import {
12
- generateClientEntry,
13
- generateServerEntry,
14
- PastoriaCapabilities,
15
- } from './generate.js';
16
- import {logger} from './logger.js';
17
-
18
- async function determineCapabilities(): Promise<PastoriaCapabilities> {
19
- const capabilities: PastoriaCapabilities = {
20
- hasAppRoot: false,
21
- hasServerHandler: false,
22
- };
23
-
24
- async function hasAppRoot() {
25
- try {
26
- await access('__generated__/router/app_root.ts');
27
- capabilities.hasAppRoot = true;
28
- } catch {}
29
- }
30
-
31
- async function hasServerHandler() {
32
- try {
33
- await access('__generated__/router/server_handler.ts');
34
- capabilities.hasServerHandler = true;
35
- } catch {}
36
- }
37
-
38
- await Promise.all([hasAppRoot(), hasServerHandler()]);
39
- return capabilities;
40
- }
41
-
42
- function pastoriaEntryPlugin(): Plugin {
43
- const clientEntryModuleId = 'virtual:pastoria-entry-client.tsx';
44
- const serverEntryModuleId = 'virtual:pastoria-entry-server.tsx';
45
-
46
- return {
47
- name: 'pastoria-entry',
48
- resolveId(id) {
49
- if (id === clientEntryModuleId) {
50
- return clientEntryModuleId; // Return without \0 prefix so React plugin can see .tsx extension
51
- } else if (id === serverEntryModuleId) {
52
- return serverEntryModuleId;
53
- }
54
- },
55
- async load(id) {
56
- const capabilities = await determineCapabilities();
57
- if (id === clientEntryModuleId) {
58
- return generateClientEntry(capabilities);
59
- } else if (id === serverEntryModuleId) {
60
- return generateServerEntry(capabilities);
61
- }
62
- },
63
- };
64
- }
65
-
66
- export const CLIENT_BUILD: BuildEnvironmentOptions = {
67
- outDir: 'dist/client',
68
- rollupOptions: {
69
- input: 'virtual:pastoria-entry-client.tsx',
70
- },
71
- };
72
-
73
- export const SERVER_BUILD: BuildEnvironmentOptions = {
74
- outDir: 'dist/server',
75
- ssr: true,
76
- rollupOptions: {
77
- input: 'virtual:pastoria-entry-server.tsx',
78
- },
79
- };
80
-
81
- export function createBuildConfig(
82
- buildEnv: BuildEnvironmentOptions,
83
- ): InlineConfig {
84
- return {
85
- appType: 'custom' as const,
86
- customLogger: logger,
87
- build: {
88
- ...buildEnv,
89
- assetsInlineLimit: 0,
90
- manifest: true,
91
- ssrManifest: true,
92
- },
93
- plugins: [
94
- pastoriaEntryPlugin(),
95
- tailwindcss() as PluginOption,
96
- react({
97
- babel: {
98
- plugins: [['babel-plugin-react-compiler', {}], 'relay'],
99
- },
100
- }),
101
- cjsInterop({
102
- dependencies: ['react-relay', 'react-relay/hooks', 'relay-runtime'],
103
- }),
104
- ],
105
- ssr: {
106
- noExternal: ['pastoria-runtime'],
107
- },
108
- };
109
- }
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "nodenext",
5
- "lib": ["ES2022", "DOM", "ESNext.Collection"],
6
- "moduleResolution": "nodenext",
7
- "outDir": "./dist",
8
- "rootDir": "./src",
9
- "declaration": true,
10
- "declarationMap": true,
11
- "sourceMap": true,
12
- "strict": true,
13
- "esModuleInterop": true,
14
- "skipLibCheck": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "jsx": "react-jsx",
17
- "noUncheckedIndexedAccess": true
18
- },
19
- "include": ["src/**/*"],
20
- "exclude": ["node_modules", "dist"]
21
- }