@vistagenic/vista 0.3.2 → 0.3.4

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 (118) hide show
  1. package/bin/vista.js +79 -109
  2. package/dist/ai/embeddings.d.ts +11 -11
  3. package/dist/ai/embeddings.js +71 -71
  4. package/dist/ai/index.d.ts +10 -10
  5. package/dist/ai/index.js +26 -26
  6. package/dist/ai/providers/base.js +85 -85
  7. package/dist/ai/react/react-server.d.ts +1 -1
  8. package/dist/ai/react/react-server.js +17 -17
  9. package/dist/ai/react/use-agent.js +138 -138
  10. package/dist/auth/core.d.ts +140 -140
  11. package/dist/auth/core.js +165 -165
  12. package/dist/auth/index.d.ts +20 -20
  13. package/dist/auth/index.js +369 -369
  14. package/dist/auth/react-server.d.ts +1 -1
  15. package/dist/auth/react-server.js +10 -10
  16. package/dist/auth/react.d.ts +18 -18
  17. package/dist/auth/react.js +71 -71
  18. package/dist/bin/build-rsc-flashpack.js +6 -0
  19. package/dist/bin/build-rsc.js +555 -492
  20. package/dist/bin/build.js +365 -353
  21. package/dist/bin/generate.js +513 -510
  22. package/dist/bin/webpack.config.d.ts +3 -1
  23. package/dist/bin/webpack.config.js +7 -4
  24. package/dist/build/manifest.d.ts +169 -169
  25. package/dist/build/manifest.js +423 -423
  26. package/dist/build/rsc/client-manifest.d.ts +62 -62
  27. package/dist/build/rsc/client-manifest.js +295 -295
  28. package/dist/build/rsc/compiler.d.ts +3 -1
  29. package/dist/build/rsc/compiler.js +12 -7
  30. package/dist/build/rsc/native-scanner.d.ts +135 -135
  31. package/dist/build/rsc/native-scanner.js +203 -203
  32. package/dist/build/rsc/react-client-reference-manifest.d.ts +35 -28
  33. package/dist/build/rsc/react-client-reference-manifest.js +366 -240
  34. package/dist/build/standalone.js +260 -254
  35. package/dist/client/dynamic.react-server.d.ts +2 -2
  36. package/dist/client/dynamic.react-server.js +23 -23
  37. package/dist/client/link.js +1 -1
  38. package/dist/client/link.react-server.d.ts +2 -2
  39. package/dist/client/link.react-server.js +11 -11
  40. package/dist/client/navigation.js +2 -2
  41. package/dist/client/navigation.react-server.d.ts +1 -1
  42. package/dist/client/navigation.react-server.js +17 -17
  43. package/dist/client/router.react-server.d.ts +1 -1
  44. package/dist/client/router.react-server.js +17 -17
  45. package/dist/client/rsc-router.d.ts +1 -3
  46. package/dist/client/rsc-router.js +98 -45
  47. package/dist/client/rsc-router.react-server.d.ts +1 -1
  48. package/dist/client/rsc-router.react-server.js +17 -17
  49. package/dist/client/script.react-server.d.ts +2 -2
  50. package/dist/client/script.react-server.js +23 -23
  51. package/dist/config.d.ts +1 -1
  52. package/dist/config.js +1 -7
  53. package/dist/deploy/adapters/cloudflare.js +42 -41
  54. package/dist/deploy/adapters/docker.d.ts +1 -0
  55. package/dist/deploy/adapters/docker.js +5 -4
  56. package/dist/deploy/adapters/netlify.js +60 -27
  57. package/dist/deploy/adapters/vercel.js +80 -50
  58. package/dist/deploy/preflight.js +4 -3
  59. package/dist/deploy/runtime-pack.d.ts +11 -0
  60. package/dist/deploy/runtime-pack.js +300 -0
  61. package/dist/deploy/utils.d.ts +7 -1
  62. package/dist/deploy/utils.js +95 -3
  63. package/dist/flashpack/command.js +1 -0
  64. package/dist/flashpack/runtime.js +2 -1
  65. package/dist/image/get-img-props.js +21 -11
  66. package/dist/image/image-config.d.ts +2 -0
  67. package/dist/image/image-config.js +17 -0
  68. package/dist/image/index.d.ts +18 -3
  69. package/dist/image/index.js +1 -1
  70. package/dist/image/react-server.d.ts +1 -2
  71. package/dist/image/react-server.js +1 -1
  72. package/dist/index.d.ts +23 -23
  73. package/dist/index.js +61 -61
  74. package/dist/server/app-dir.d.ts +22 -0
  75. package/dist/server/app-dir.js +77 -0
  76. package/dist/server/app-router-runtime.d.ts +1 -0
  77. package/dist/server/app-router-runtime.js +34 -9
  78. package/dist/server/cookie-parse.d.ts +4 -4
  79. package/dist/server/cookie-parse.js +14 -14
  80. package/dist/server/engine.js +5 -5
  81. package/dist/server/hydration-chunks.d.ts +7 -0
  82. package/dist/server/hydration-chunks.js +49 -0
  83. package/dist/server/image-optimizer.js +2 -1
  84. package/dist/server/index.d.ts +109 -109
  85. package/dist/server/index.js +315 -315
  86. package/dist/server/middleware-runner.d.ts +125 -125
  87. package/dist/server/middleware-runner.js +607 -615
  88. package/dist/server/middleware-security.d.ts +36 -36
  89. package/dist/server/middleware-security.js +183 -183
  90. package/dist/server/module-compile-hook.js +706 -695
  91. package/dist/server/root-resolver.js +6 -5
  92. package/dist/server/rsc-engine-flashpack.d.ts +3 -1
  93. package/dist/server/rsc-engine-flashpack.js +12 -1
  94. package/dist/server/rsc-engine.d.ts +6 -1
  95. package/dist/server/rsc-engine.js +217 -280
  96. package/dist/server/rsc-upstream.js +900 -892
  97. package/dist/server/ssr-webpack-shim.d.ts +6 -0
  98. package/dist/server/ssr-webpack-shim.js +29 -0
  99. package/dist/server/static-generator.d.ts +2 -0
  100. package/dist/server/static-generator.js +33 -32
  101. package/dist/server/structure-validator.js +2 -1
  102. package/dist/server/structure-watch.js +2 -0
  103. package/dist/server/typed-api-runtime.js +639 -635
  104. package/dist/server/vista-import-map.js +134 -134
  105. package/dist/stack/index.d.ts +34 -34
  106. package/dist/stack/index.js +49 -49
  107. package/dist/stack/server/caller.d.ts +13 -13
  108. package/dist/stack/server/caller.js +42 -42
  109. package/dist/stack/server/executor.d.ts +40 -40
  110. package/dist/stack/server/executor.js +222 -222
  111. package/dist/stack/server/index.d.ts +11 -11
  112. package/dist/stack/server/index.js +24 -24
  113. package/dist/stack/server/procedure.d.ts +20 -20
  114. package/dist/stack/server/procedure.js +66 -66
  115. package/dist/stack/server/types.d.ts +113 -113
  116. package/dist/theme/react-server.d.ts +10 -10
  117. package/dist/theme/react-server.js +16 -16
  118. package/package.json +1 -1
@@ -21,6 +21,7 @@ const client_manifest_1 = require("./client-manifest");
21
21
  const server_manifest_1 = require("./server-manifest");
22
22
  const react_client_reference_manifest_1 = require("./react-client-reference-manifest");
23
23
  const constants_1 = require("../../constants");
24
+ const app_dir_1 = require("../../server/app-dir");
24
25
  // Find module path (handles monorepo hoisting)
25
26
  const findModulePath = (moduleName, cwd) => {
26
27
  const localPath = path_1.default.resolve(cwd, 'node_modules', moduleName);
@@ -60,12 +61,12 @@ function resolveFromWorkspace(specifier, cwd) {
60
61
  * Output goes to .vista/server/ and is NEVER sent to the client.
61
62
  */
62
63
  function createServerWebpackConfig(options) {
63
- const { cwd, isDev, vistaDirs, buildId, engineVariant = 'default' } = options;
64
+ const { cwd, isDev, vistaDirs, buildId, engineVariant = 'default', imagesUnoptimized = false, deployOutput, } = options;
64
65
  const swcLoaderPath = resolveFromWorkspace('swc-loader', cwd);
65
66
  const nullLoaderPath = resolveFromWorkspace('null-loader', cwd);
66
67
  const cssLoaderPath = resolveFromWorkspace('css-loader', cwd);
67
68
  // Generate server manifest first
68
- const serverManifest = (0, server_manifest_1.generateServerManifest)(cwd, path_1.default.join(cwd, 'app'));
69
+ const serverManifest = (0, server_manifest_1.generateServerManifest)(cwd, (0, app_dir_1.resolveAppDir)(cwd));
69
70
  fs_1.default.writeFileSync(path_1.default.join(vistaDirs.server, 'server-manifest.json'), JSON.stringify(serverManifest, null, 2));
70
71
  return {
71
72
  mode: isDev ? 'development' : 'production',
@@ -74,7 +75,7 @@ function createServerWebpackConfig(options) {
74
75
  // Entry: All pages and layouts for SSR
75
76
  entry: () => {
76
77
  const entries = {};
77
- const appDir = path_1.default.join(cwd, 'app');
78
+ const appDir = (0, app_dir_1.resolveAppDir)(cwd);
78
79
  // Scan for all page.tsx, layout.tsx files
79
80
  function scanDir(dir, prefix = '') {
80
81
  if (!fs_1.default.existsSync(dir))
@@ -180,6 +181,8 @@ function createServerWebpackConfig(options) {
180
181
  'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
181
182
  'process.env.VISTA_ENGINE': JSON.stringify(engineVariant),
182
183
  'process.env.VISTA_ENGINE_VARIANT': JSON.stringify(engineVariant),
184
+ 'process.env.VISTA_IMAGES_UNOPTIMIZED': JSON.stringify(imagesUnoptimized ? '1' : ''),
185
+ 'process.env.VISTA_DEPLOY_OUTPUT': JSON.stringify(deployOutput || ''),
183
186
  [constants_1.BUILD_ID_DEFINE]: JSON.stringify(buildId),
184
187
  [constants_1.SERVER_DEFINE]: 'true',
185
188
  }),
@@ -195,13 +198,13 @@ function createServerWebpackConfig(options) {
195
198
  * Server components are replaced with client references.
196
199
  */
197
200
  function createClientWebpackConfig(options) {
198
- const { cwd, isDev, vistaDirs, buildId, engineVariant = 'default', clientReferenceFiles = [] } = options;
201
+ const { cwd, isDev, vistaDirs, buildId, engineVariant = 'default', clientReferenceFiles = [], imagesUnoptimized = false, deployOutput, } = options;
199
202
  const swcLoaderPath = resolveFromWorkspace('swc-loader', cwd);
200
203
  const nullLoaderPath = resolveFromWorkspace('null-loader', cwd);
201
204
  const cssLoaderPath = resolveFromWorkspace('css-loader', cwd);
202
205
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
203
206
  // Generate client manifest
204
- const clientManifest = (0, client_manifest_1.generateClientManifest)(cwd, path_1.default.join(cwd, 'app'));
207
+ const clientManifest = (0, client_manifest_1.generateClientManifest)(cwd, (0, app_dir_1.resolveAppDir)(cwd));
205
208
  fs_1.default.writeFileSync(path_1.default.join(vistaDirs.root, 'client-manifest.json'), JSON.stringify(clientManifest, null, 2));
206
209
  const reactPath = findModulePath('react', cwd);
207
210
  const reactDomPath = findModulePath('react-dom', cwd);
@@ -221,7 +224,7 @@ function createClientWebpackConfig(options) {
221
224
  entry: clientEntry,
222
225
  output: {
223
226
  path: vistaDirs.chunks,
224
- filename: isDev ? '[name].js' : 'main-[contenthash:8].js',
227
+ filename: isDev ? '[name].js' : '[name]-[contenthash:8].js',
225
228
  chunkFilename: isDev ? '[name].js' : '[name]-[contenthash:8].js',
226
229
  publicPath: constants_1.STATIC_CHUNKS_PATH,
227
230
  clean: !isDev,
@@ -335,7 +338,7 @@ function createClientWebpackConfig(options) {
335
338
  ? flightClientReferences
336
339
  : [
337
340
  {
338
- directory: path_1.default.join(cwd, 'app'),
341
+ directory: (0, app_dir_1.resolveAppDir)(cwd),
339
342
  recursive: true,
340
343
  include: /\.[jt]sx?$/,
341
344
  },
@@ -404,6 +407,8 @@ function createClientWebpackConfig(options) {
404
407
  'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
405
408
  'process.env.VISTA_ENGINE': JSON.stringify(engineVariant),
406
409
  'process.env.VISTA_ENGINE_VARIANT': JSON.stringify(engineVariant),
410
+ 'process.env.VISTA_IMAGES_UNOPTIMIZED': JSON.stringify(imagesUnoptimized ? '1' : ''),
411
+ 'process.env.VISTA_DEPLOY_OUTPUT': JSON.stringify(deployOutput || ''),
407
412
  [constants_1.BUILD_ID_DEFINE]: JSON.stringify(buildId),
408
413
  [constants_1.SERVER_DEFINE]: 'false',
409
414
  }),
@@ -1,135 +1,135 @@
1
- /**
2
- * Vista RSC Native Scanner
3
- *
4
- * Uses Rust-powered native bindings for blazing fast component scanning.
5
- * Falls back to TypeScript implementation if native module unavailable.
6
- */
7
- export interface NapiScannedComponent {
8
- absolutePath: string;
9
- relativePath: string;
10
- isClient: boolean;
11
- directiveLine: number;
12
- componentType: string;
13
- exports: string[];
14
- clientHooksUsed: string[];
15
- hasMetadata: boolean;
16
- hasGenerateMetadata: boolean;
17
- }
18
- export interface NapiServerComponentError {
19
- file: string;
20
- message: string;
21
- hooks: string[];
22
- }
23
- export interface NapiScanResult {
24
- clientComponents: NapiScannedComponent[];
25
- serverComponents: NapiScannedComponent[];
26
- pages: NapiScannedComponent[];
27
- layouts: NapiScannedComponent[];
28
- apiRoutes: NapiScannedComponent[];
29
- errors: NapiServerComponentError[];
30
- totalFiles: number;
31
- scanTimeMs: number;
32
- }
33
- export interface NapiClientModuleEntry {
34
- id: string;
35
- path: string;
36
- absolutePath: string;
37
- chunkName: string;
38
- exports: string[];
39
- asyncLoad: boolean;
40
- }
41
- export interface NapiClientManifest {
42
- buildId: string;
43
- clientModules: NapiClientModuleEntry[];
44
- }
45
- export interface NapiRouteEntry {
46
- pattern: string;
47
- pagePath: string;
48
- layoutPaths: string[];
49
- loadingPath: string | null;
50
- errorPath: string | null;
51
- routeType: string;
52
- }
53
- export interface NapiServerModuleEntry {
54
- id: string;
55
- path: string;
56
- absolutePath: string;
57
- componentType: string;
58
- hasMetadata: boolean;
59
- hasGenerateMetadata: boolean;
60
- }
61
- export interface NapiServerManifest {
62
- buildId: string;
63
- serverModules: NapiServerModuleEntry[];
64
- routes: NapiRouteEntry[];
65
- }
66
- export interface NapiClientScanRoot {
67
- dir: string;
68
- prefix: string;
69
- }
70
- /**
71
- * Check if native module is available
72
- */
73
- export declare function isNativeAvailable(): boolean;
74
- /**
75
- * Scan app directory using Rust native code
76
- * Returns null if native module is not available
77
- */
78
- export declare function scanAppNative(appDir: string): NapiScanResult | null;
79
- /**
80
- * Generate client manifest using Rust native code
81
- */
82
- export declare function generateClientManifestNative(appDir: string, buildId: string): NapiClientManifest | null;
83
- /**
84
- * Generate client manifest from an explicit project root plus `app/`
85
- */
86
- export declare function generateClientManifestForProjectNative(cwd: string, appDir: string, buildId: string): NapiClientManifest | null;
87
- /**
88
- * Discover project-level client scan roots using Rust native code
89
- */
90
- export declare function discoverProjectClientRootsNative(cwd: string): NapiClientScanRoot[] | null;
91
- /**
92
- * Generate server manifest using Rust native code
93
- */
94
- export declare function generateServerManifestNative(appDir: string, buildId: string): NapiServerManifest | null;
95
- /**
96
- * Generate unique mount ID for client component
97
- */
98
- export declare function generateMountIdNative(): string | null;
99
- /**
100
- * Reset mount ID counter (call at start of each request)
101
- */
102
- export declare function resetMountCounterNative(): boolean;
103
- /**
104
- * Convert NAPI scan result to internal format
105
- */
106
- export declare function convertScanResult(result: NapiScanResult): {
107
- clientComponents: {
108
- absolutePath: string;
109
- relativePath: string;
110
- isClient: boolean;
111
- directiveLine: number;
112
- componentType: string;
113
- exports: string[];
114
- clientHooksUsed: string[];
115
- hasMetadata: boolean;
116
- hasGenerateMetadata: boolean;
117
- }[];
118
- serverComponents: {
119
- absolutePath: string;
120
- relativePath: string;
121
- isClient: boolean;
122
- directiveLine: number;
123
- componentType: string;
124
- exports: string[];
125
- clientHooksUsed: any[];
126
- hasMetadata: boolean;
127
- hasGenerateMetadata: boolean;
128
- }[];
129
- pages: NapiScannedComponent[];
130
- layouts: NapiScannedComponent[];
131
- apiRoutes: NapiScannedComponent[];
132
- errors: NapiServerComponentError[];
133
- totalFiles: number;
134
- scanTimeMs: number;
135
- };
1
+ /**
2
+ * Vista RSC Native Scanner
3
+ *
4
+ * Uses Rust-powered native bindings for blazing fast component scanning.
5
+ * Falls back to TypeScript implementation if native module unavailable.
6
+ */
7
+ export interface NapiScannedComponent {
8
+ absolutePath: string;
9
+ relativePath: string;
10
+ isClient: boolean;
11
+ directiveLine: number;
12
+ componentType: string;
13
+ exports: string[];
14
+ clientHooksUsed: string[];
15
+ hasMetadata: boolean;
16
+ hasGenerateMetadata: boolean;
17
+ }
18
+ export interface NapiServerComponentError {
19
+ file: string;
20
+ message: string;
21
+ hooks: string[];
22
+ }
23
+ export interface NapiScanResult {
24
+ clientComponents: NapiScannedComponent[];
25
+ serverComponents: NapiScannedComponent[];
26
+ pages: NapiScannedComponent[];
27
+ layouts: NapiScannedComponent[];
28
+ apiRoutes: NapiScannedComponent[];
29
+ errors: NapiServerComponentError[];
30
+ totalFiles: number;
31
+ scanTimeMs: number;
32
+ }
33
+ export interface NapiClientModuleEntry {
34
+ id: string;
35
+ path: string;
36
+ absolutePath: string;
37
+ chunkName: string;
38
+ exports: string[];
39
+ asyncLoad: boolean;
40
+ }
41
+ export interface NapiClientManifest {
42
+ buildId: string;
43
+ clientModules: NapiClientModuleEntry[];
44
+ }
45
+ export interface NapiRouteEntry {
46
+ pattern: string;
47
+ pagePath: string;
48
+ layoutPaths: string[];
49
+ loadingPath: string | null;
50
+ errorPath: string | null;
51
+ routeType: string;
52
+ }
53
+ export interface NapiServerModuleEntry {
54
+ id: string;
55
+ path: string;
56
+ absolutePath: string;
57
+ componentType: string;
58
+ hasMetadata: boolean;
59
+ hasGenerateMetadata: boolean;
60
+ }
61
+ export interface NapiServerManifest {
62
+ buildId: string;
63
+ serverModules: NapiServerModuleEntry[];
64
+ routes: NapiRouteEntry[];
65
+ }
66
+ export interface NapiClientScanRoot {
67
+ dir: string;
68
+ prefix: string;
69
+ }
70
+ /**
71
+ * Check if native module is available
72
+ */
73
+ export declare function isNativeAvailable(): boolean;
74
+ /**
75
+ * Scan app directory using Rust native code
76
+ * Returns null if native module is not available
77
+ */
78
+ export declare function scanAppNative(appDir: string): NapiScanResult | null;
79
+ /**
80
+ * Generate client manifest using Rust native code
81
+ */
82
+ export declare function generateClientManifestNative(appDir: string, buildId: string): NapiClientManifest | null;
83
+ /**
84
+ * Generate client manifest from an explicit project root plus `app/`
85
+ */
86
+ export declare function generateClientManifestForProjectNative(cwd: string, appDir: string, buildId: string): NapiClientManifest | null;
87
+ /**
88
+ * Discover project-level client scan roots using Rust native code
89
+ */
90
+ export declare function discoverProjectClientRootsNative(cwd: string): NapiClientScanRoot[] | null;
91
+ /**
92
+ * Generate server manifest using Rust native code
93
+ */
94
+ export declare function generateServerManifestNative(appDir: string, buildId: string): NapiServerManifest | null;
95
+ /**
96
+ * Generate unique mount ID for client component
97
+ */
98
+ export declare function generateMountIdNative(): string | null;
99
+ /**
100
+ * Reset mount ID counter (call at start of each request)
101
+ */
102
+ export declare function resetMountCounterNative(): boolean;
103
+ /**
104
+ * Convert NAPI scan result to internal format
105
+ */
106
+ export declare function convertScanResult(result: NapiScanResult): {
107
+ clientComponents: {
108
+ absolutePath: string;
109
+ relativePath: string;
110
+ isClient: boolean;
111
+ directiveLine: number;
112
+ componentType: string;
113
+ exports: string[];
114
+ clientHooksUsed: string[];
115
+ hasMetadata: boolean;
116
+ hasGenerateMetadata: boolean;
117
+ }[];
118
+ serverComponents: {
119
+ absolutePath: string;
120
+ relativePath: string;
121
+ isClient: boolean;
122
+ directiveLine: number;
123
+ componentType: string;
124
+ exports: string[];
125
+ clientHooksUsed: any[];
126
+ hasMetadata: boolean;
127
+ hasGenerateMetadata: boolean;
128
+ }[];
129
+ pages: NapiScannedComponent[];
130
+ layouts: NapiScannedComponent[];
131
+ apiRoutes: NapiScannedComponent[];
132
+ errors: NapiServerComponentError[];
133
+ totalFiles: number;
134
+ scanTimeMs: number;
135
+ };