@vistagenic/vista 0.2.9 → 0.2.12

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  const command = process.argv[2];
4
4
  const flags = process.argv.slice(3);
5
5
 
6
+ function forceRuntimeEnv(mode) {
7
+ if (mode === 'development') {
8
+ process.env.NODE_ENV = 'development';
9
+ return;
10
+ }
11
+ process.env.NODE_ENV = 'production';
12
+ }
13
+
6
14
  if (command === 'g' || command === 'generate') {
7
15
  const { runGenerateCommand } = require('../dist/bin/generate');
8
16
  runGenerateCommand(flags).then((code) => {
@@ -20,8 +28,9 @@ const useRSC = !useLegacy;
20
28
  const { markStartTime } = require('../dist/server/logger');
21
29
  markStartTime();
22
30
 
23
- if (command === 'dev') {
24
- if (useRSC) {
31
+ if (command === 'dev') {
32
+ forceRuntimeEnv('development');
33
+ if (useRSC) {
25
34
  // RSC Mode (default) - True React Server Components Architecture
26
35
  const { buildRSC } = require('../dist/bin/build-rsc');
27
36
  const { startRSCServer } = require('../dist/server/rsc-engine');
@@ -51,8 +60,9 @@ if (command === 'dev') {
51
60
  process.exit(1);
52
61
  });
53
62
  }
54
- } else if (command === 'build') {
55
- if (useRSC) {
63
+ } else if (command === 'build') {
64
+ forceRuntimeEnv('production');
65
+ if (useRSC) {
56
66
  // RSC Production Build (default)
57
67
  const { buildRSC } = require('../dist/bin/build-rsc');
58
68
 
@@ -78,8 +88,9 @@ if (command === 'dev') {
78
88
  process.exit(1);
79
89
  });
80
90
  }
81
- } else if (command === 'start') {
82
- if (useRSC) {
91
+ } else if (command === 'start') {
92
+ forceRuntimeEnv('production');
93
+ if (useRSC) {
83
94
  const { startRSCServer } = require('../dist/server/rsc-engine');
84
95
  startRSCServer({ port: process.env.PORT || 3003 });
85
96
  } else {
@@ -150,11 +150,25 @@ function reportDevRuntimeError(title: string, error: unknown): void {
150
150
  var indicator = (window as any).__VISTA_DEVTOOLS_INDICATOR__;
151
151
  var overlay = (window as any).__VISTA_DEV_ERROR_OVERLAY__;
152
152
  var message = buildRuntimeMessage(title, error);
153
+ var canRestoreFromIndicator = false;
154
+ if (indicator && indicator.hidden !== true && typeof indicator.setError === 'function') {
155
+ canRestoreFromIndicator = true;
156
+ if (typeof indicator.ensureAttached === 'function') {
157
+ try {
158
+ canRestoreFromIndicator = indicator.ensureAttached() !== false;
159
+ } catch {
160
+ canRestoreFromIndicator = false;
161
+ }
162
+ }
163
+ }
153
164
  if (indicator && typeof indicator.setError === 'function') {
154
165
  indicator.setError(title, 1);
155
166
  }
156
167
  if (overlay && typeof overlay.capture === 'function') {
157
168
  overlay.capture([message]);
169
+ if (!canRestoreFromIndicator && typeof overlay.show === 'function') {
170
+ overlay.show([message]);
171
+ }
158
172
  return;
159
173
  }
160
174
  if (overlay && typeof overlay.show === 'function') {
@@ -31,8 +31,13 @@ function getImgProps(props, config = image_config_1.imageConfigDefault, defaultL
31
31
  // Handle Dimensions
32
32
  let widthInt = width ? Number(width) : undefined;
33
33
  let heightInt = height ? Number(height) : undefined;
34
+ const vercelStaticBuild = typeof window === 'undefined' &&
35
+ (process.env.VERCEL === '1' || typeof process.env.VERCEL_URL === 'string');
36
+ // Disable optimizer when explicitly requested, configured globally,
37
+ // or when building for Vercel static output (no /_vista/image endpoint).
38
+ const disableOptimization = !!unoptimized || !!config.unoptimized || vercelStaticBuild;
34
39
  // Generate SrcSet
35
- const srcSet = generateSrcSet(src, widthInt, loader, config, !!unoptimized);
40
+ const srcSet = generateSrcSet(src, widthInt, loader, config, disableOptimization);
36
41
  return {
37
42
  ...rest,
38
43
  src,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vistagenic/vista",
3
- "version": "0.2.9",
3
+ "version": "0.2.12",
4
4
  "description": "The React Framework for Visionaries - Rust-powered SSR with Server Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",