@vistagenic/vista 0.2.10 → 0.2.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/bin/vista.js +183 -36
- package/dist/bin/build-rsc-flashpack.d.ts +4 -0
- package/dist/bin/build-rsc-flashpack.js +29 -0
- package/dist/bin/build-rsc.js +61 -16
- package/dist/bin/build.js +36 -13
- package/dist/bin/devtools-indicator-snippet.js +30 -0
- package/dist/bin/file-scanner.d.ts +1 -1
- package/dist/bin/file-scanner.js +8 -0
- package/dist/bin/flashpack-runner.d.ts +1 -0
- package/dist/bin/flashpack-runner.js +61 -0
- package/dist/bin/server-component-plugin.d.ts +6 -4
- package/dist/bin/server-component-plugin.js +22 -69
- package/dist/bin/webpack.config.d.ts +3 -0
- package/dist/bin/webpack.config.js +12 -3
- package/dist/build/manifest.d.ts +17 -3
- package/dist/build/manifest.js +99 -23
- package/dist/build/rsc/compiler.d.ts +2 -0
- package/dist/build/rsc/compiler.js +25 -5
- package/dist/build/rsc/react-client-reference-manifest.d.ts +22 -0
- package/dist/build/rsc/react-client-reference-manifest.js +219 -0
- package/dist/build/rsc/server-manifest.d.ts +23 -2
- package/dist/build/rsc/server-manifest.js +162 -24
- package/dist/build/standalone.d.ts +31 -0
- package/dist/build/standalone.js +334 -0
- package/dist/client/rsc-router.d.ts +31 -0
- package/dist/client/rsc-router.js +89 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.js +106 -5
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +3 -1
- package/dist/flashpack/command.d.ts +8 -0
- package/dist/flashpack/command.js +134 -0
- package/dist/flashpack/runtime.d.ts +39 -0
- package/dist/flashpack/runtime.js +249 -0
- package/dist/server/app-router-runtime.d.ts +26 -0
- package/dist/server/app-router-runtime.js +321 -0
- package/dist/server/artifact-validator.js +21 -1
- package/dist/server/cache.d.ts +10 -0
- package/dist/server/cache.js +270 -0
- package/dist/server/client-boundary.js +20 -2
- package/dist/server/engine.js +236 -159
- package/dist/server/fetch-policy.d.ts +2 -0
- package/dist/server/fetch-policy.js +123 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +131 -22
- package/dist/server/module-boundary-validator.d.ts +15 -0
- package/dist/server/module-boundary-validator.js +262 -0
- package/dist/server/module-compile-hook.d.ts +7 -0
- package/dist/server/module-compile-hook.js +662 -0
- package/dist/server/ppr.d.ts +18 -0
- package/dist/server/ppr.js +59 -0
- package/dist/server/request-context.d.ts +31 -0
- package/dist/server/request-context.js +95 -0
- package/dist/server/rsc-engine-flashpack.d.ts +4 -0
- package/dist/server/rsc-engine-flashpack.js +27 -0
- package/dist/server/rsc-engine.d.ts +2 -0
- package/dist/server/rsc-engine.js +589 -317
- package/dist/server/rsc-upstream.js +539 -233
- package/dist/server/runtime-actions.d.ts +5 -0
- package/dist/server/runtime-actions.js +80 -0
- package/dist/server/runtime-artifacts.d.ts +11 -0
- package/dist/server/runtime-artifacts.js +35 -0
- package/dist/server/segment-config.d.ts +37 -0
- package/dist/server/segment-config.js +205 -0
- package/dist/server/spawn-permissions.d.ts +2 -0
- package/dist/server/spawn-permissions.js +21 -0
- package/dist/server/static-cache.d.ts +15 -1
- package/dist/server/static-cache.js +83 -3
- package/dist/server/static-generator.js +254 -100
- package/dist/server/structure-validator.d.ts +1 -1
- package/dist/server/structure-validator.js +26 -5
- package/dist/server/structure-watch.js +1 -1
- package/dist/server/typed-api-runtime.d.ts +1 -0
- package/dist/server/typed-api-runtime.js +145 -25
- package/dist/server/vista-import-map.d.ts +1 -0
- package/dist/server/vista-import-map.js +123 -0
- package/package.json +13 -1
package/bin/vista.js
CHANGED
|
@@ -1,33 +1,128 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
3
6
|
const command = process.argv[2];
|
|
4
7
|
const flags = process.argv.slice(3);
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function getFlagValue(flag) {
|
|
10
|
+
const index = flags.indexOf(flag);
|
|
11
|
+
if (index !== -1) {
|
|
12
|
+
const next = flags[index + 1];
|
|
13
|
+
if (next && !next.startsWith('-')) return next;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const inline = flags.find((value) => value.startsWith(`${flag}=`));
|
|
17
|
+
if (inline) return inline.slice(flag.length + 1);
|
|
18
|
+
return undefined;
|
|
12
19
|
}
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
function normalizeEngineVariant(raw) {
|
|
22
|
+
const value = String(raw || '')
|
|
23
|
+
.trim()
|
|
24
|
+
.toLowerCase();
|
|
25
|
+
|
|
26
|
+
if (!value) return null;
|
|
27
|
+
if (value === 'default' || value === 'webpack') return 'default';
|
|
28
|
+
if (value === 'flashpack') return 'flashpack';
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function forceRuntimeEnv(mode) {
|
|
33
|
+
if (mode === 'development') {
|
|
34
|
+
process.env.NODE_ENV = 'development';
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
process.env.NODE_ENV = 'production';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (command === 'g' || command === 'generate') {
|
|
41
|
+
const { runGenerateCommand } = require('../dist/bin/generate');
|
|
42
|
+
runGenerateCommand(flags).then((code) => {
|
|
43
|
+
if (code !== 0) process.exit(code);
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
16
48
|
const useLegacy = flags.includes('--legacy') || process.env.VISTA_LEGACY === 'true';
|
|
17
49
|
const useRSC = !useLegacy;
|
|
50
|
+
const explicitFlashpack = flags.includes('--flashpack');
|
|
51
|
+
const explicitDefaultEngine = flags.includes('--default-engine') || flags.includes('--webpack');
|
|
52
|
+
const explicitEngineFlag = getFlagValue('--engine');
|
|
53
|
+
const explicitEngineVariant = normalizeEngineVariant(explicitEngineFlag);
|
|
54
|
+
|
|
55
|
+
if (explicitEngineFlag && !explicitEngineVariant) {
|
|
56
|
+
console.error(
|
|
57
|
+
`Unsupported engine "${explicitEngineFlag}". Use "default" or "flashpack" (legacy alias: webpack).`
|
|
58
|
+
);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
(explicitFlashpack && explicitDefaultEngine) ||
|
|
64
|
+
(explicitEngineVariant && (explicitFlashpack || explicitDefaultEngine))
|
|
65
|
+
) {
|
|
66
|
+
console.error('Use only one engine selector: --engine, --flashpack, or --default-engine/--webpack.');
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const envEngineVariant = normalizeEngineVariant(
|
|
71
|
+
process.env.VISTA_ENGINE_VARIANT ||
|
|
72
|
+
process.env.VISTA_ENGINE ||
|
|
73
|
+
(process.env.VISTA_FLASHPACK === 'true' ? 'flashpack' : '')
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
let configEngineVariant = null;
|
|
77
|
+
try {
|
|
78
|
+
const { loadConfig } = require('../dist/config');
|
|
79
|
+
const projectConfig = loadConfig(process.cwd());
|
|
80
|
+
const fromConfig =
|
|
81
|
+
typeof projectConfig?.engine === 'string'
|
|
82
|
+
? projectConfig.engine
|
|
83
|
+
: projectConfig?.engine && typeof projectConfig.engine === 'object'
|
|
84
|
+
? projectConfig.engine.variant
|
|
85
|
+
: '';
|
|
86
|
+
configEngineVariant = normalizeEngineVariant(fromConfig);
|
|
87
|
+
} catch {
|
|
88
|
+
// Best effort only; keep CLI resilient if config loading fails.
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const forcedByFlag = explicitEngineVariant || (explicitFlashpack ? 'flashpack' : null) || (explicitDefaultEngine ? 'default' : null);
|
|
92
|
+
const engineVariant = forcedByFlag || envEngineVariant || configEngineVariant || 'default';
|
|
93
|
+
process.env.VISTA_ENGINE = engineVariant;
|
|
94
|
+
process.env.VISTA_ENGINE_VARIANT = engineVariant;
|
|
95
|
+
process.env.VISTA_FLASHPACK = engineVariant === 'flashpack' ? 'true' : 'false';
|
|
18
96
|
|
|
19
97
|
// Mark startup time for "Ready in Xms" display
|
|
20
98
|
const { markStartTime } = require('../dist/server/logger');
|
|
21
99
|
markStartTime();
|
|
22
100
|
|
|
23
|
-
if (command === 'dev') {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
101
|
+
if (command === 'dev') {
|
|
102
|
+
forceRuntimeEnv('development');
|
|
103
|
+
if (useRSC) {
|
|
104
|
+
console.log(`[vista] Engine: ${process.env.VISTA_ENGINE}`);
|
|
105
|
+
const useFlashpack = process.env.VISTA_ENGINE === 'flashpack';
|
|
106
|
+
if (useFlashpack) {
|
|
107
|
+
const { runFlashpackEngineCommand } = require('../dist/flashpack/command');
|
|
108
|
+
runFlashpackEngineCommand('dev', {
|
|
109
|
+
cwd: process.cwd(),
|
|
110
|
+
port: process.env.PORT || 3003,
|
|
111
|
+
}).catch((err) => {
|
|
112
|
+
console.error('Flashpack dev failed:', err);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const { buildRSC } = useFlashpack
|
|
118
|
+
? require('../dist/bin/build-rsc-flashpack')
|
|
119
|
+
: require('../dist/bin/build-rsc');
|
|
120
|
+
const { startRSCServer } = useFlashpack
|
|
121
|
+
? require('../dist/server/rsc-engine-flashpack')
|
|
122
|
+
: require('../dist/server/rsc-engine');
|
|
123
|
+
|
|
124
|
+
buildRSC(true)
|
|
125
|
+
.then(({ clientCompiler }) => {
|
|
31
126
|
startRSCServer({
|
|
32
127
|
port: process.env.PORT || 3003,
|
|
33
128
|
compiler: clientCompiler,
|
|
@@ -51,12 +146,31 @@ if (command === 'dev') {
|
|
|
51
146
|
process.exit(1);
|
|
52
147
|
});
|
|
53
148
|
}
|
|
54
|
-
} else if (command === 'build') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
149
|
+
} else if (command === 'build') {
|
|
150
|
+
forceRuntimeEnv('production');
|
|
151
|
+
if (useRSC) {
|
|
152
|
+
console.log(`[vista] Engine: ${process.env.VISTA_ENGINE}`);
|
|
153
|
+
const useFlashpack = process.env.VISTA_ENGINE === 'flashpack';
|
|
154
|
+
if (useFlashpack) {
|
|
155
|
+
const { runFlashpackEngineCommand } = require('../dist/flashpack/command');
|
|
156
|
+
runFlashpackEngineCommand('build', {
|
|
157
|
+
cwd: process.cwd(),
|
|
158
|
+
})
|
|
159
|
+
.then(() => {
|
|
160
|
+
console.log('');
|
|
161
|
+
console.log('Production build complete!');
|
|
162
|
+
})
|
|
163
|
+
.catch((err) => {
|
|
164
|
+
console.error('Flashpack build failed:', err);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
});
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const { buildRSC } = useFlashpack
|
|
170
|
+
? require('../dist/bin/build-rsc-flashpack')
|
|
171
|
+
: require('../dist/bin/build-rsc');
|
|
172
|
+
|
|
173
|
+
buildRSC(false)
|
|
60
174
|
.then(() => {
|
|
61
175
|
console.log('');
|
|
62
176
|
console.log('Production build complete!');
|
|
@@ -78,11 +192,39 @@ if (command === 'dev') {
|
|
|
78
192
|
process.exit(1);
|
|
79
193
|
});
|
|
80
194
|
}
|
|
81
|
-
} else if (command === 'start') {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
195
|
+
} else if (command === 'start') {
|
|
196
|
+
forceRuntimeEnv('production');
|
|
197
|
+
if (useRSC) {
|
|
198
|
+
console.log(`[vista] Engine: ${process.env.VISTA_ENGINE}`);
|
|
199
|
+
if (process.env.VISTA_ENGINE === 'flashpack') {
|
|
200
|
+
const { runFlashpackEngineCommand } = require('../dist/flashpack/command');
|
|
201
|
+
runFlashpackEngineCommand('start', {
|
|
202
|
+
cwd: process.cwd(),
|
|
203
|
+
port: process.env.PORT || 3003,
|
|
204
|
+
}).catch((err) => {
|
|
205
|
+
console.error('Flashpack start failed:', err);
|
|
206
|
+
process.exit(1);
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const standaloneServerPath = path.join(process.cwd(), '.vista', 'standalone', 'server.js');
|
|
211
|
+
if (fs.existsSync(standaloneServerPath)) {
|
|
212
|
+
const standalone = require(standaloneServerPath);
|
|
213
|
+
const startStandaloneServer =
|
|
214
|
+
standalone.startStandaloneServer || standalone.default || standalone;
|
|
215
|
+
startStandaloneServer({
|
|
216
|
+
port: process.env.PORT || 3003,
|
|
217
|
+
engine: process.env.VISTA_ENGINE,
|
|
218
|
+
});
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const useFlashpack = process.env.VISTA_ENGINE === 'flashpack';
|
|
223
|
+
const { startRSCServer } = useFlashpack
|
|
224
|
+
? require('../dist/server/rsc-engine-flashpack')
|
|
225
|
+
: require('../dist/server/rsc-engine');
|
|
226
|
+
startRSCServer({ port: process.env.PORT || 3003 });
|
|
227
|
+
} else {
|
|
86
228
|
const { startServer } = require('../dist/server/engine');
|
|
87
229
|
startServer(process.env.PORT || 3003);
|
|
88
230
|
}
|
|
@@ -93,18 +235,23 @@ if (command === 'dev') {
|
|
|
93
235
|
console.log('Usage: vista <command> [options]');
|
|
94
236
|
console.log('');
|
|
95
237
|
console.log('Commands:');
|
|
96
|
-
console.log(' dev Start development server with HMR');
|
|
97
|
-
console.log(' build Create production build');
|
|
98
|
-
console.log(' start Start production server');
|
|
99
|
-
console.log(' g Generate typed API scaffolds (api-init, router, procedure)');
|
|
100
|
-
console.log('');
|
|
238
|
+
console.log(' dev Start development server with HMR');
|
|
239
|
+
console.log(' build Create production build');
|
|
240
|
+
console.log(' start Start production server');
|
|
241
|
+
console.log(' g Generate typed API scaffolds (api-init, router, procedure)');
|
|
242
|
+
console.log('');
|
|
101
243
|
console.log('Options:');
|
|
102
244
|
console.log(' --legacy Use traditional SSR mode (instead of RSC)');
|
|
245
|
+
console.log(' --engine <default|flashpack> Select engine variant');
|
|
246
|
+
console.log(' --flashpack Use Rust-first Flashpack engine path');
|
|
247
|
+
console.log(' --default-engine Force default engine path');
|
|
248
|
+
console.log(' --webpack Alias of --default-engine');
|
|
103
249
|
console.log('');
|
|
104
250
|
console.log('Examples:');
|
|
105
251
|
console.log(' vista dev # Start dev server (RSC mode)');
|
|
106
252
|
console.log(' vista dev --legacy # Start dev server with legacy SSR');
|
|
253
|
+
console.log(' vista dev --flashpack # Start dev server with Flashpack mode');
|
|
107
254
|
console.log(' vista build # Production build with RSC');
|
|
108
|
-
console.log(' vista g api-init # Generate typed API starter files');
|
|
109
|
-
console.log('');
|
|
110
|
-
}
|
|
255
|
+
console.log(' vista g api-init # Generate typed API starter files');
|
|
256
|
+
console.log('');
|
|
257
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRSC = void 0;
|
|
4
|
+
exports.buildRSCFlashpack = buildRSCFlashpack;
|
|
5
|
+
const build_rsc_1 = require("./build-rsc");
|
|
6
|
+
const runtime_1 = require("../flashpack/runtime");
|
|
7
|
+
function resolveMode(watch) {
|
|
8
|
+
if (watch)
|
|
9
|
+
return 'development';
|
|
10
|
+
return process.env.NODE_ENV === 'development' ? 'development' : 'production';
|
|
11
|
+
}
|
|
12
|
+
async function buildRSCFlashpack(watch = false) {
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const mode = resolveMode(watch);
|
|
15
|
+
const strict = process.env.VISTA_FLASHPACK_STRICT !== 'false';
|
|
16
|
+
const phase = watch ? 'dev' : 'build';
|
|
17
|
+
const prepared = (0, runtime_1.prepareFlashpackRuntime)({
|
|
18
|
+
cwd,
|
|
19
|
+
phase,
|
|
20
|
+
mode,
|
|
21
|
+
allowFallback: !strict,
|
|
22
|
+
});
|
|
23
|
+
if (process.env.VISTA_DEBUG) {
|
|
24
|
+
console.log(`[flashpack] runtime prepared (rust=${prepared.rustPipelineUsed ? 'on' : 'fallback'}) at ${prepared.flashDir}`);
|
|
25
|
+
}
|
|
26
|
+
return (0, build_rsc_1.buildRSC)(watch);
|
|
27
|
+
}
|
|
28
|
+
exports.buildRSC = buildRSCFlashpack;
|
|
29
|
+
exports.default = buildRSCFlashpack;
|
package/dist/bin/build-rsc.js
CHANGED
|
@@ -29,6 +29,8 @@ const structure_log_1 = require("../server/structure-log");
|
|
|
29
29
|
const devtools_indicator_snippet_1 = require("./devtools-indicator-snippet");
|
|
30
30
|
const dev_error_overlay_snippet_1 = require("./dev-error-overlay-snippet");
|
|
31
31
|
const deploy_output_1 = require("./deploy-output");
|
|
32
|
+
const module_boundary_validator_1 = require("../server/module-boundary-validator");
|
|
33
|
+
const standalone_1 = require("../build/standalone");
|
|
32
34
|
const _debug = !!process.env.VISTA_DEBUG;
|
|
33
35
|
/**
|
|
34
36
|
* Run PostCSS for CSS compilation
|
|
@@ -150,11 +152,25 @@ function reportDevRuntimeError(title: string, error: unknown): void {
|
|
|
150
152
|
var indicator = (window as any).__VISTA_DEVTOOLS_INDICATOR__;
|
|
151
153
|
var overlay = (window as any).__VISTA_DEV_ERROR_OVERLAY__;
|
|
152
154
|
var message = buildRuntimeMessage(title, error);
|
|
155
|
+
var canRestoreFromIndicator = false;
|
|
156
|
+
if (indicator && indicator.hidden !== true && typeof indicator.setError === 'function') {
|
|
157
|
+
canRestoreFromIndicator = true;
|
|
158
|
+
if (typeof indicator.ensureAttached === 'function') {
|
|
159
|
+
try {
|
|
160
|
+
canRestoreFromIndicator = indicator.ensureAttached() !== false;
|
|
161
|
+
} catch {
|
|
162
|
+
canRestoreFromIndicator = false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
153
166
|
if (indicator && typeof indicator.setError === 'function') {
|
|
154
167
|
indicator.setError(title, 1);
|
|
155
168
|
}
|
|
156
169
|
if (overlay && typeof overlay.capture === 'function') {
|
|
157
170
|
overlay.capture([message]);
|
|
171
|
+
if (!canRestoreFromIndicator && typeof overlay.show === 'function') {
|
|
172
|
+
overlay.show([message]);
|
|
173
|
+
}
|
|
158
174
|
return;
|
|
159
175
|
}
|
|
160
176
|
if (overlay && typeof overlay.show === 'function') {
|
|
@@ -229,7 +245,7 @@ ${isDev
|
|
|
229
245
|
if (indicator && typeof indicator.pulse === 'function') {
|
|
230
246
|
indicator.pulse('hmr', 460);
|
|
231
247
|
}
|
|
232
|
-
setTimeout(() => window.location.reload(),
|
|
248
|
+
setTimeout(() => window.location.reload(), 80);
|
|
233
249
|
} else {
|
|
234
250
|
try {
|
|
235
251
|
const msg = JSON.parse(e.data);
|
|
@@ -296,7 +312,11 @@ async function buildRSC(watch = false) {
|
|
|
296
312
|
// Pre-build Structure Validation
|
|
297
313
|
// ========================================================================
|
|
298
314
|
const vistaConfig = (0, config_1.loadConfig)(cwd);
|
|
315
|
+
const engineVariant = (0, config_1.resolveAndApplyEngineVariant)(vistaConfig);
|
|
299
316
|
const structureConfig = (0, config_1.resolveStructureValidationConfig)(vistaConfig);
|
|
317
|
+
const cacheComponentsConfig = (0, config_1.resolveCacheComponentsConfig)(vistaConfig);
|
|
318
|
+
if (_debug)
|
|
319
|
+
console.log(`[vista:build] Engine variant: ${engineVariant}`);
|
|
300
320
|
if (structureConfig.enabled) {
|
|
301
321
|
const result = (0, structure_validator_1.validateAppStructure)({ cwd });
|
|
302
322
|
(0, structure_log_1.logValidationResult)(result, structureConfig.logLevel);
|
|
@@ -356,25 +376,25 @@ async function buildRSC(watch = false) {
|
|
|
356
376
|
console.log('');
|
|
357
377
|
}
|
|
358
378
|
// Check for errors (using client hooks without 'use client')
|
|
359
|
-
const scanErrors =
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
})),
|
|
365
|
-
];
|
|
379
|
+
const scanErrors = (0, module_boundary_validator_1.validateModuleBoundaries)({
|
|
380
|
+
appDir,
|
|
381
|
+
extraRoots: fs_1.default.existsSync(componentsDir) ? [componentsDir] : [],
|
|
382
|
+
cacheComponentsEnabled: cacheComponentsConfig.enabled,
|
|
383
|
+
}).issues;
|
|
366
384
|
if (scanErrors.length > 0) {
|
|
367
|
-
console.log('\x1b[41m\x1b[37m ERROR \x1b[0m \x1b[31mServer
|
|
385
|
+
console.log('\x1b[41m\x1b[37m ERROR \x1b[0m \x1b[31mServer/Segment Violations\x1b[0m');
|
|
368
386
|
console.log('');
|
|
369
387
|
for (const error of scanErrors) {
|
|
370
|
-
console.log(`\x1b[31m✗\x1b[0m ${error.
|
|
371
|
-
console.log(`
|
|
372
|
-
console.log('');
|
|
373
|
-
console.log(` \x1b[36mTo fix:\x1b[0m Add \x1b[33m'use client'\x1b[0m at the top of the file`);
|
|
388
|
+
console.log(`\x1b[31m✗\x1b[0m ${path_1.default.relative(cwd, error.filePath)}`);
|
|
389
|
+
console.log(` ${error.message}`);
|
|
374
390
|
console.log('');
|
|
391
|
+
if (error.fix) {
|
|
392
|
+
console.log(` \x1b[36mTo fix:\x1b[0m ${error.fix}`);
|
|
393
|
+
console.log('');
|
|
394
|
+
}
|
|
375
395
|
}
|
|
376
396
|
if (!watch) {
|
|
377
|
-
console.log('\x1b[31mBuild failed due to
|
|
397
|
+
console.log('\x1b[31mBuild failed due to server/segment violations.\x1b[0m');
|
|
378
398
|
process.exit(1);
|
|
379
399
|
}
|
|
380
400
|
}
|
|
@@ -410,6 +430,11 @@ async function buildRSC(watch = false) {
|
|
|
410
430
|
pagePath: route.pagePath,
|
|
411
431
|
type: route.type,
|
|
412
432
|
})));
|
|
433
|
+
(0, manifest_1.writeReservedVistaArtifacts)(vistaDirs.root, {
|
|
434
|
+
buildId,
|
|
435
|
+
engineVariant,
|
|
436
|
+
imagesConfig: vistaConfig.images,
|
|
437
|
+
});
|
|
413
438
|
// Generate client entry
|
|
414
439
|
generateRSCClientEntry(cwd, vistaDirs.root, watch);
|
|
415
440
|
// Create webpack configs
|
|
@@ -418,6 +443,7 @@ async function buildRSC(watch = false) {
|
|
|
418
443
|
isDev: watch,
|
|
419
444
|
vistaDirs,
|
|
420
445
|
buildId,
|
|
446
|
+
engineVariant,
|
|
421
447
|
clientReferenceFiles,
|
|
422
448
|
};
|
|
423
449
|
// Build CSS
|
|
@@ -432,7 +458,9 @@ async function buildRSC(watch = false) {
|
|
|
432
458
|
// plugin ran will skip the parser hook entirely, causing empty Flight
|
|
433
459
|
// manifests. Clearing on every dev-start is the safest approach –
|
|
434
460
|
// first-compile is ~1s longer but guarantees correct manifests.
|
|
435
|
-
const cacheDir =
|
|
461
|
+
const cacheDir = engineVariant === 'flashpack'
|
|
462
|
+
? path_1.default.join(cwd, constants_1.FLASH_DIR, 'cache', 'webpack')
|
|
463
|
+
: path_1.default.join(vistaDirs.root, 'cache');
|
|
436
464
|
if (fs_1.default.existsSync(cacheDir)) {
|
|
437
465
|
fs_1.default.rmSync(cacheDir, { recursive: true, force: true });
|
|
438
466
|
if (_debug)
|
|
@@ -556,11 +584,19 @@ async function buildRSC(watch = false) {
|
|
|
556
584
|
const prerenderManifestPath = path_1.default.join(vistaDirs.root, 'prerender-manifest.json');
|
|
557
585
|
fs_1.default.writeFileSync(prerenderManifestPath, JSON.stringify(ssgResult.manifest, null, 2));
|
|
558
586
|
console.log('[Vista JS RSC] Wrote prerender-manifest.json');
|
|
587
|
+
(0, standalone_1.generateStandaloneOutput)({
|
|
588
|
+
cwd,
|
|
589
|
+
vistaDir: vistaDirs.root,
|
|
590
|
+
buildId,
|
|
591
|
+
serverManifest,
|
|
592
|
+
debug: _debug,
|
|
593
|
+
});
|
|
559
594
|
(0, deploy_output_1.generateDeploymentOutputs)({
|
|
560
595
|
cwd,
|
|
561
596
|
vistaDir: vistaDirs.root,
|
|
562
597
|
debug: _debug,
|
|
563
598
|
});
|
|
599
|
+
(0, manifest_1.pruneEmptyVistaDirectories)(vistaDirs.root);
|
|
564
600
|
console.log('');
|
|
565
601
|
console.log('╔══════════════════════════════════════════════════════════════╗');
|
|
566
602
|
console.log('║ Build Complete! 🎉 ║');
|
|
@@ -569,7 +605,16 @@ async function buildRSC(watch = false) {
|
|
|
569
605
|
console.log(' Output directory: .vista/');
|
|
570
606
|
console.log(' ├── server/ (Server-side bundle - NEVER sent to client)');
|
|
571
607
|
console.log(' ├── static/ (Client assets - only client components)');
|
|
572
|
-
|
|
608
|
+
if (engineVariant === 'flashpack') {
|
|
609
|
+
console.log(' └── cache/ (metadata bridge to the active Flashpack cache)');
|
|
610
|
+
console.log(' Flashpack directory: .flash/');
|
|
611
|
+
console.log(' ├── cache/ (Flashpack runtime cache)');
|
|
612
|
+
console.log(' ├── graph/ (Rust pipeline graph snapshots)');
|
|
613
|
+
console.log(' └── logs/ (Flashpack phase logs)');
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
console.log(' └── cache/ (Build cache for faster rebuilds)');
|
|
617
|
+
}
|
|
573
618
|
console.log('');
|
|
574
619
|
return { serverCompiler: null, clientCompiler: null };
|
|
575
620
|
}
|
package/dist/bin/build.js
CHANGED
|
@@ -18,6 +18,7 @@ const structure_log_1 = require("../server/structure-log");
|
|
|
18
18
|
const devtools_indicator_snippet_1 = require("./devtools-indicator-snippet");
|
|
19
19
|
const dev_error_overlay_snippet_1 = require("./dev-error-overlay-snippet");
|
|
20
20
|
const deploy_output_1 = require("./deploy-output");
|
|
21
|
+
const module_boundary_validator_1 = require("../server/module-boundary-validator");
|
|
21
22
|
const _debug = !!process.env.VISTA_DEBUG;
|
|
22
23
|
// Helper to run PostCSS
|
|
23
24
|
function runPostCSS(cwd, vistaDir) {
|
|
@@ -222,7 +223,7 @@ sse.onmessage = (event) => {
|
|
|
222
223
|
if (indicator && typeof indicator.pulse === 'function') {
|
|
223
224
|
indicator.pulse('hmr', 460);
|
|
224
225
|
}
|
|
225
|
-
setTimeout(() => window.location.reload(),
|
|
226
|
+
setTimeout(() => window.location.reload(), 80);
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
228
229
|
|
|
@@ -272,7 +273,11 @@ async function buildClient(watch = false, onRebuild) {
|
|
|
272
273
|
// Pre-build Structure Validation
|
|
273
274
|
// ========================================================================
|
|
274
275
|
const vistaConfig = (0, config_1.loadConfig)(cwd);
|
|
276
|
+
const engineVariant = (0, config_1.resolveAndApplyEngineVariant)(vistaConfig);
|
|
275
277
|
const structureConfig = (0, config_1.resolveStructureValidationConfig)(vistaConfig);
|
|
278
|
+
const cacheComponentsConfig = (0, config_1.resolveCacheComponentsConfig)(vistaConfig);
|
|
279
|
+
if (_debug)
|
|
280
|
+
console.log(`[vista:build] Engine variant: ${engineVariant}`);
|
|
276
281
|
if (structureConfig.enabled) {
|
|
277
282
|
const result = (0, structure_validator_1.validateAppStructure)({ cwd });
|
|
278
283
|
(0, structure_log_1.logValidationResult)(result, structureConfig.logLevel);
|
|
@@ -306,20 +311,27 @@ async function buildClient(watch = false, onRebuild) {
|
|
|
306
311
|
console.log(` - ${c.relativePath}`);
|
|
307
312
|
});
|
|
308
313
|
}
|
|
309
|
-
|
|
310
|
-
|
|
314
|
+
const moduleBoundaryIssues = (0, module_boundary_validator_1.validateModuleBoundaries)({
|
|
315
|
+
appDir,
|
|
316
|
+
extraRoots: fs_1.default.existsSync(componentsDir) ? [componentsDir] : [],
|
|
317
|
+
cacheComponentsEnabled: cacheComponentsConfig.enabled,
|
|
318
|
+
}).issues;
|
|
319
|
+
if (moduleBoundaryIssues.length > 0) {
|
|
311
320
|
console.log('');
|
|
312
|
-
console.log('\x1b[41m\x1b[37m ERROR \x1b[0m \x1b[31mServer
|
|
321
|
+
console.log('\x1b[41m\x1b[37m ERROR \x1b[0m \x1b[31mServer/Segment Validation Error\x1b[0m');
|
|
313
322
|
console.log('');
|
|
314
|
-
for (const
|
|
315
|
-
console.log(`\x1b[31m✗\x1b[0m ${
|
|
316
|
-
console.log(`
|
|
317
|
-
console.log(` These only work in a Client Component.`);
|
|
318
|
-
console.log('');
|
|
319
|
-
console.log(` \x1b[36mTo fix:\x1b[0m Add \x1b[33m'use client'\x1b[0m at the top of your file:`);
|
|
320
|
-
console.log('');
|
|
321
|
-
console.log(` \x1b[32m'use client';\x1b[0m`);
|
|
323
|
+
for (const issue of moduleBoundaryIssues) {
|
|
324
|
+
console.log(`\x1b[31m✗\x1b[0m ${path_1.default.relative(cwd, issue.filePath)}`);
|
|
325
|
+
console.log(` ${issue.message}`);
|
|
322
326
|
console.log('');
|
|
327
|
+
if (issue.fix) {
|
|
328
|
+
console.log(` \x1b[36mTo fix:\x1b[0m ${issue.fix}`);
|
|
329
|
+
console.log('');
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (!watch) {
|
|
333
|
+
console.log('\x1b[31mBuild failed due to server/segment violations.\x1b[0m');
|
|
334
|
+
process.exit(1);
|
|
323
335
|
}
|
|
324
336
|
}
|
|
325
337
|
}
|
|
@@ -355,10 +367,20 @@ async function buildClient(watch = false, onRebuild) {
|
|
|
355
367
|
(0, manifest_1.writeCanonicalVistaArtifacts)(cwd, vistaDir, buildId, []);
|
|
356
368
|
console.warn(`[vista:build] Failed to derive route artifacts: ${error.message}`);
|
|
357
369
|
}
|
|
370
|
+
(0, manifest_1.writeReservedVistaArtifacts)(vistaDir, {
|
|
371
|
+
buildId,
|
|
372
|
+
engineVariant,
|
|
373
|
+
imagesConfig: vistaConfig.images,
|
|
374
|
+
});
|
|
358
375
|
// Generate client entry - TRUE RSC: only client components
|
|
359
376
|
generateClientEntry(cwd, vistaDir, clientComponents, watch);
|
|
360
377
|
// Create Webpack config
|
|
361
|
-
const config = (0, webpack_config_1.createWebpackConfig)({
|
|
378
|
+
const config = (0, webpack_config_1.createWebpackConfig)({
|
|
379
|
+
cwd,
|
|
380
|
+
isDev: watch,
|
|
381
|
+
engineVariant,
|
|
382
|
+
cacheComponentsEnabled: cacheComponentsConfig.enabled,
|
|
383
|
+
});
|
|
362
384
|
// Create Webpack compiler
|
|
363
385
|
exports.compiler = compiler = (0, webpack_1.default)(config);
|
|
364
386
|
if (watch) {
|
|
@@ -424,6 +446,7 @@ async function buildClient(watch = false, onRebuild) {
|
|
|
424
446
|
vistaDir,
|
|
425
447
|
debug: _debug,
|
|
426
448
|
});
|
|
449
|
+
(0, manifest_1.pruneEmptyVistaDirectories)(vistaDir);
|
|
427
450
|
compiler.close((closeErr) => {
|
|
428
451
|
if (closeErr)
|
|
429
452
|
console.error('Error closing compiler:', closeErr);
|
|
@@ -343,6 +343,36 @@ function getDevToolsIndicatorBootstrapSource(bootSessionId) {
|
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
document.addEventListener('vista:ppr-shell', function () {
|
|
347
|
+
pulse('ppr-shell', 420);
|
|
348
|
+
});
|
|
349
|
+
document.addEventListener('vista:ppr-resume', function (event) {
|
|
350
|
+
var detail = event && event.detail && typeof event.detail === 'object' ? event.detail : {};
|
|
351
|
+
begin('ppr-' + (detail.mode || 'resume'));
|
|
352
|
+
});
|
|
353
|
+
document.addEventListener('vista:ppr-complete', function (event) {
|
|
354
|
+
var detail = event && event.detail && typeof event.detail === 'object' ? event.detail : {};
|
|
355
|
+
pulse('ppr-' + (detail.mode || 'complete'), 520);
|
|
356
|
+
clearError();
|
|
357
|
+
setRoute();
|
|
358
|
+
});
|
|
359
|
+
document.addEventListener('vista:ppr-error', function (event) {
|
|
360
|
+
var detail = event && event.detail && typeof event.detail === 'object' ? event.detail : {};
|
|
361
|
+
setError(detail.message || 'ppr-resume', 1);
|
|
362
|
+
});
|
|
363
|
+
document.addEventListener('vista:rsc-resume-start', function () {
|
|
364
|
+
begin('flight-resume');
|
|
365
|
+
});
|
|
366
|
+
document.addEventListener('vista:rsc-resume-complete', function () {
|
|
367
|
+
pulse('flight-ready', 480);
|
|
368
|
+
clearError();
|
|
369
|
+
setRoute();
|
|
370
|
+
});
|
|
371
|
+
document.addEventListener('vista:rsc-resume-error', function (event) {
|
|
372
|
+
var detail = event && event.detail && typeof event.detail === 'object' ? event.detail : {};
|
|
373
|
+
setError(detail.message || 'flight-resume', 1);
|
|
374
|
+
});
|
|
375
|
+
|
|
346
376
|
setRoute();
|
|
347
377
|
setState(false, 'idle');
|
|
348
378
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export interface RouteNode {
|
|
15
15
|
segment: string;
|
|
16
|
-
kind: 'static' | 'dynamic' | 'catch-all' | 'optional-catch-all' | 'group';
|
|
16
|
+
kind: 'static' | 'dynamic' | 'catch-all' | 'optional-catch-all' | 'group' | 'parallel' | 'interception';
|
|
17
17
|
indexPath?: string;
|
|
18
18
|
layoutPath?: string;
|
|
19
19
|
loadingPath?: string;
|
package/dist/bin/file-scanner.js
CHANGED
|
@@ -116,8 +116,16 @@ function classifySegment(segment) {
|
|
|
116
116
|
return 'optional-catch-all';
|
|
117
117
|
if (segment.startsWith('[...'))
|
|
118
118
|
return 'catch-all';
|
|
119
|
+
if (segment.startsWith('(.)') ||
|
|
120
|
+
segment.startsWith('(..)') ||
|
|
121
|
+
segment.startsWith('(..)(..)') ||
|
|
122
|
+
segment.startsWith('(...)')) {
|
|
123
|
+
return 'interception';
|
|
124
|
+
}
|
|
119
125
|
if (segment.startsWith('(') && segment.endsWith(')'))
|
|
120
126
|
return 'group';
|
|
127
|
+
if (segment.startsWith('@'))
|
|
128
|
+
return 'parallel';
|
|
121
129
|
if (segment.startsWith('['))
|
|
122
130
|
return 'dynamic';
|
|
123
131
|
return 'static';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|