veryfront 0.1.112 → 0.1.113
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/esm/cli/commands/completions/command-help.d.ts +3 -0
- package/esm/cli/commands/completions/command-help.d.ts.map +1 -0
- package/esm/cli/commands/completions/command-help.js +13 -0
- package/esm/cli/commands/completions/command.d.ts +28 -0
- package/esm/cli/commands/completions/command.d.ts.map +1 -0
- package/esm/cli/commands/completions/command.js +133 -0
- package/esm/cli/commands/completions/handler.d.ts +3 -0
- package/esm/cli/commands/completions/handler.d.ts.map +1 -0
- package/esm/cli/commands/completions/handler.js +20 -0
- package/esm/cli/help/command-definitions.d.ts.map +1 -1
- package/esm/cli/help/command-definitions.js +2 -0
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +17 -1
- package/esm/cli/shared/suggest.d.ts +8 -0
- package/esm/cli/shared/suggest.d.ts.map +1 -0
- package/esm/cli/shared/suggest.js +25 -0
- package/esm/deno.js +1 -1
- package/esm/src/html/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/dev-scripts.js +3 -2
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +2 -1
- package/esm/src/html/html-shell-generator.js +1 -1
- package/esm/src/html/hydration-script-builder/dev-client-renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-component-manifest.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +2 -1
- package/esm/src/html/styles-builder/dev-styles.d.ts.map +1 -1
- package/esm/src/html/styles-builder/dev-styles.js +2 -1
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.d.ts +10 -0
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.js +51 -24
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.js +3 -3
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +93 -5
- package/esm/src/rendering/snippet-renderer.js +1 -1
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +3 -2
- package/esm/src/server/dev-server/error-overlay/html-template.d.ts +1 -1
- package/esm/src/server/dev-server/error-overlay/html-template.d.ts.map +1 -1
- package/esm/src/server/dev-server/error-overlay/html-template.js +4 -3
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.d.ts +1 -1
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.d.ts.map +1 -1
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.js +2 -2
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +3 -3
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.d.ts +2 -3
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.js +61 -51
- package/esm/src/utils/version.d.ts +1 -1
- package/esm/src/utils/version.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/completions/command-help.ts +15 -0
- package/src/cli/commands/completions/command.ts +163 -0
- package/src/cli/commands/completions/handler.ts +29 -0
- package/src/cli/help/command-definitions.ts +2 -0
- package/src/cli/router.ts +16 -1
- package/src/cli/shared/suggest.ts +33 -0
- package/src/deno.js +1 -1
- package/src/src/html/dev-scripts.ts +4 -2
- package/src/src/html/html-injection.ts +2 -1
- package/src/src/html/html-shell-generator.ts +1 -1
- package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -1
- package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -1
- package/src/src/html/hydration-script-builder/dev-error-logger.ts +3 -1
- package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -1
- package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -1
- package/src/src/html/hydration-script-builder/prod-scripts.ts +2 -1
- package/src/src/html/styles-builder/dev-styles.ts +2 -1
- package/src/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.ts +63 -29
- package/src/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.ts +4 -4
- package/src/src/rendering/orchestrator/html.ts +112 -4
- package/src/src/rendering/snippet-renderer.ts +1 -1
- package/src/src/security/http/response/security-handler.ts +3 -2
- package/src/src/server/dev-server/error-overlay/html-template.ts +4 -2
- package/src/src/server/dev-server/error-overlay/overlay-renderer.ts +2 -1
- package/src/src/server/services/rendering/ssr.service.ts +12 -7
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.ts +83 -52
- package/src/src/utils/version.ts +1 -1
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { Logger } from "../../../../utils/logger/logger.js";
|
|
11
|
+
import {
|
|
12
|
+
extractAllFilePaths,
|
|
13
|
+
extractAllFilePathsRecursive,
|
|
14
|
+
extractAllHttpBundlePathsRecursive,
|
|
15
|
+
visitImportedVfModules,
|
|
16
|
+
} from "../../../../modules/react-loader/ssr-module-loader/http-bundle-helpers.js";
|
|
11
17
|
import {
|
|
12
18
|
getCacheBaseDir,
|
|
13
19
|
getHttpBundleCacheDir,
|
|
@@ -15,7 +21,6 @@ import {
|
|
|
15
21
|
} from "../../../../utils/cache-dir.js";
|
|
16
22
|
import { FRAMEWORK_ROOT, LOG_PREFIX_MDX_LOADER } from "../constants.js";
|
|
17
23
|
import { getLocalFs } from "../cache/index.js";
|
|
18
|
-
import { extractHttpBundlePaths } from "../../../../modules/react-loader/ssr-module-loader/http-bundle-helpers.js";
|
|
19
24
|
import { ensureHttpBundlesExist } from "../../../esm/http-cache.js";
|
|
20
25
|
import { ensureMdxModuleDependencies } from "./dependency-recovery.js";
|
|
21
26
|
|
|
@@ -24,48 +29,38 @@ interface MdxRecoveryOptions {
|
|
|
24
29
|
contentSourceId: string;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
* Check if cached code has file:// paths that are incompatible with this environment.
|
|
29
|
-
* Returns true if the cached code should be invalidated (has paths from a different environment).
|
|
30
|
-
*
|
|
31
|
-
* Checks for:
|
|
32
|
-
* 1. Framework source paths (file:///app/src/...) that don't match FRAMEWORK_ROOT
|
|
33
|
-
* 2. HTTP bundle cache paths (file:///app/.cache/veryfront-http-bundle/...) that don't match local cache dir
|
|
34
|
-
* 3. MDX ESM cache paths (file:///app/.cache/veryfront-mdx-esm/...) that don't match local cache dir
|
|
35
|
-
*
|
|
36
|
-
* IMPORTANT: This function creates a new RegExp on each call to avoid race conditions
|
|
37
|
-
* when multiple modules are processed concurrently. Using a shared global regex with
|
|
38
|
-
* the 'g' flag would cause interleaved exec() calls to skip paths.
|
|
39
|
-
*/
|
|
40
|
-
export async function hasIncompatibleFrameworkPaths(code: string, log: Logger): Promise<boolean> {
|
|
41
|
-
// Check for esm.sh URLs that reference /_vf_modules/ paths - these are invalid
|
|
42
|
-
// and indicate a cached transform from before the fix was deployed
|
|
43
|
-
if (/esm\.sh\/_?vf_modules\//.test(code)) {
|
|
44
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} Cached code has invalid esm.sh/_vf_modules URL`);
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
32
|
+
const INVALID_VFMOD_ESM_URL_PATTERN = /esm\.sh\/_?vf_modules\//;
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
async function hasIncompatibleFrameworkPathsInCode(
|
|
35
|
+
code: string,
|
|
36
|
+
log: Logger,
|
|
37
|
+
options: {
|
|
38
|
+
localHttpCacheDir: string;
|
|
39
|
+
localMdxCacheDir: string;
|
|
40
|
+
localCacheBaseDir: string;
|
|
41
|
+
sourcePath?: string;
|
|
42
|
+
},
|
|
43
|
+
): Promise<boolean> {
|
|
51
44
|
const localFs = getLocalFs();
|
|
45
|
+
const sourceContext = options.sourcePath ? { vfModulePath: options.sourcePath } : {};
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
while ((match = allFilePathsPattern.exec(code)) !== null) {
|
|
60
|
-
if (match[1]) allPaths.push(match[1]);
|
|
47
|
+
if (INVALID_VFMOD_ESM_URL_PATTERN.test(code)) {
|
|
48
|
+
log.debug(
|
|
49
|
+
`${LOG_PREFIX_MDX_LOADER} Cached code has invalid esm.sh/_vf_modules URL`,
|
|
50
|
+
sourceContext,
|
|
51
|
+
);
|
|
52
|
+
return true;
|
|
61
53
|
}
|
|
62
54
|
|
|
55
|
+
const allPaths = extractAllFilePaths(code);
|
|
56
|
+
|
|
63
57
|
for (const path of allPaths) {
|
|
64
58
|
if (path.includes("veryfront-http-bundle")) {
|
|
65
|
-
if (!path.startsWith(localHttpCacheDir)) {
|
|
59
|
+
if (!path.startsWith(options.localHttpCacheDir)) {
|
|
66
60
|
log.debug(`${LOG_PREFIX_MDX_LOADER} HTTP bundle path from different environment`, {
|
|
67
61
|
path,
|
|
68
|
-
expectedDir: localHttpCacheDir,
|
|
62
|
+
expectedDir: options.localHttpCacheDir,
|
|
63
|
+
...sourceContext,
|
|
69
64
|
});
|
|
70
65
|
return true;
|
|
71
66
|
}
|
|
@@ -73,10 +68,11 @@ export async function hasIncompatibleFrameworkPaths(code: string, log: Logger):
|
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
if (path.includes("veryfront-mdx-esm")) {
|
|
76
|
-
if (!path.startsWith(localMdxCacheDir)) {
|
|
71
|
+
if (!path.startsWith(options.localMdxCacheDir)) {
|
|
77
72
|
log.debug(`${LOG_PREFIX_MDX_LOADER} MDX cache path from different environment`, {
|
|
78
73
|
path,
|
|
79
|
-
expectedDir: localMdxCacheDir,
|
|
74
|
+
expectedDir: options.localMdxCacheDir,
|
|
75
|
+
...sourceContext,
|
|
80
76
|
});
|
|
81
77
|
return true;
|
|
82
78
|
}
|
|
@@ -87,10 +83,11 @@ export async function hasIncompatibleFrameworkPaths(code: string, log: Logger):
|
|
|
87
83
|
// like file:///app/.cache/markdown.tsx. These paths are not portable across pods.
|
|
88
84
|
// Allow local cache-base paths so valid local file:// dependencies under .cache
|
|
89
85
|
// are not evicted on every read.
|
|
90
|
-
if (path.includes(".cache/") && !path.startsWith(localCacheBaseDir)) {
|
|
86
|
+
if (path.includes(".cache/") && !path.startsWith(options.localCacheBaseDir)) {
|
|
91
87
|
log.debug(`${LOG_PREFIX_MDX_LOADER} Legacy cache path is not portable`, {
|
|
92
88
|
path,
|
|
93
|
-
expectedBaseDir: localCacheBaseDir,
|
|
89
|
+
expectedBaseDir: options.localCacheBaseDir,
|
|
90
|
+
...sourceContext,
|
|
94
91
|
});
|
|
95
92
|
return true;
|
|
96
93
|
}
|
|
@@ -101,6 +98,7 @@ export async function hasIncompatibleFrameworkPaths(code: string, log: Logger):
|
|
|
101
98
|
log.debug(`${LOG_PREFIX_MDX_LOADER} Framework path from different environment`, {
|
|
102
99
|
path,
|
|
103
100
|
expectedRoot: FRAMEWORK_ROOT,
|
|
101
|
+
...sourceContext,
|
|
104
102
|
});
|
|
105
103
|
return true;
|
|
106
104
|
}
|
|
@@ -108,12 +106,18 @@ export async function hasIncompatibleFrameworkPaths(code: string, log: Logger):
|
|
|
108
106
|
try {
|
|
109
107
|
const stat = await localFs.stat(path);
|
|
110
108
|
if (!stat?.isFile) {
|
|
111
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} Framework path does not exist`, {
|
|
109
|
+
log.debug(`${LOG_PREFIX_MDX_LOADER} Framework path does not exist`, {
|
|
110
|
+
path,
|
|
111
|
+
...sourceContext,
|
|
112
|
+
});
|
|
112
113
|
return true;
|
|
113
114
|
}
|
|
114
115
|
} catch (_) {
|
|
115
116
|
/* expected: framework file may not exist in this environment */
|
|
116
|
-
log.debug(`${LOG_PREFIX_MDX_LOADER} Framework path not accessible`, {
|
|
117
|
+
log.debug(`${LOG_PREFIX_MDX_LOADER} Framework path not accessible`, {
|
|
118
|
+
path,
|
|
119
|
+
...sourceContext,
|
|
120
|
+
});
|
|
117
121
|
return true;
|
|
118
122
|
}
|
|
119
123
|
}
|
|
@@ -121,6 +125,42 @@ export async function hasIncompatibleFrameworkPaths(code: string, log: Logger):
|
|
|
121
125
|
return false;
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Check if cached code has file:// paths that are incompatible with this environment.
|
|
130
|
+
* Returns true if the cached code should be invalidated (has paths from a different environment).
|
|
131
|
+
*
|
|
132
|
+
* Checks for:
|
|
133
|
+
* 1. Framework source paths (file:///app/src/...) that don't match FRAMEWORK_ROOT
|
|
134
|
+
* 2. HTTP bundle cache paths (file:///app/.cache/veryfront-http-bundle/...) that don't match local cache dir
|
|
135
|
+
* 3. MDX ESM cache paths (file:///app/.cache/veryfront-mdx-esm/...) that don't match local cache dir
|
|
136
|
+
*
|
|
137
|
+
* This check also walks transitively imported VF modules so nested stale paths
|
|
138
|
+
* are rejected before import-time failures.
|
|
139
|
+
*/
|
|
140
|
+
export async function hasIncompatibleFrameworkPaths(code: string, log: Logger): Promise<boolean> {
|
|
141
|
+
const options = {
|
|
142
|
+
localHttpCacheDir: getHttpBundleCacheDir(),
|
|
143
|
+
localMdxCacheDir: getMdxEsmCacheDir(),
|
|
144
|
+
localCacheBaseDir: getCacheBaseDir(),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
if (await hasIncompatibleFrameworkPathsInCode(code, log, options)) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let incompatible = false;
|
|
152
|
+
await visitImportedVfModules(code, async (vfModuleCode, vfModulePath) => {
|
|
153
|
+
if (incompatible) return;
|
|
154
|
+
|
|
155
|
+
incompatible = await hasIncompatibleFrameworkPathsInCode(vfModuleCode, log, {
|
|
156
|
+
...options,
|
|
157
|
+
sourcePath: vfModulePath,
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return incompatible;
|
|
162
|
+
}
|
|
163
|
+
|
|
124
164
|
/**
|
|
125
165
|
* Check if cached code has file:// paths that don't exist locally.
|
|
126
166
|
* Returns list of missing paths, or empty array if all exist.
|
|
@@ -133,19 +173,10 @@ export async function findMissingFileDependenciesInCode(
|
|
|
133
173
|
log: Logger,
|
|
134
174
|
): Promise<string[]> {
|
|
135
175
|
const localFs = getLocalFs();
|
|
136
|
-
const pattern = /file:\/\/([^"'\s]+\.(?:mjs|js|tsx|ts|jsx)(?:\?[^"'\s]*)?)/gi;
|
|
137
176
|
const missing: string[] = [];
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
let match;
|
|
141
|
-
while ((match = pattern.exec(code)) !== null) {
|
|
142
|
-
const path = match[1] as string;
|
|
143
|
-
// Skip query parameters in paths
|
|
144
|
-
const cleanPath = path.replace(/\?.*$/, "");
|
|
145
|
-
|
|
146
|
-
if (checked.has(cleanPath)) continue;
|
|
147
|
-
checked.add(cleanPath);
|
|
177
|
+
const allPaths = await extractAllFilePathsRecursive(code);
|
|
148
178
|
|
|
179
|
+
for (const cleanPath of allPaths) {
|
|
149
180
|
try {
|
|
150
181
|
const stat = await localFs.stat(cleanPath);
|
|
151
182
|
if (!stat?.isFile) {
|
|
@@ -200,7 +231,7 @@ export async function validateCachedModule(
|
|
|
200
231
|
return false;
|
|
201
232
|
}
|
|
202
233
|
|
|
203
|
-
const bundlePaths =
|
|
234
|
+
const bundlePaths = await extractAllHttpBundlePathsRecursive(cachedCode);
|
|
204
235
|
if (bundlePaths.length > 0) {
|
|
205
236
|
const cacheDir = getHttpBundleCacheDir();
|
|
206
237
|
const failed = await ensureHttpBundlesExist(bundlePaths, cacheDir);
|
package/src/src/utils/version.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { getEnv } from "../platform/compat/process.js";
|
|
|
3
3
|
|
|
4
4
|
// Keep in sync with deno.json version.
|
|
5
5
|
// scripts/release.ts updates this constant during releases.
|
|
6
|
-
export const VERSION = "0.1.
|
|
6
|
+
export const VERSION = "0.1.113";
|
|
7
7
|
|
|
8
8
|
export function normalizeVeryfrontVersion(version: string | undefined): string | undefined {
|
|
9
9
|
if (!version) return undefined;
|