vinext 0.0.40 → 0.0.42
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/README.md +1 -2
- package/dist/build/client-build-config.d.ts +119 -0
- package/dist/build/client-build-config.js +149 -0
- package/dist/build/client-build-config.js.map +1 -0
- package/dist/build/layout-classification-types.d.ts +62 -0
- package/dist/build/layout-classification-types.js +1 -0
- package/dist/build/layout-classification.d.ts +60 -0
- package/dist/build/layout-classification.js +98 -0
- package/dist/build/layout-classification.js.map +1 -0
- package/dist/build/report.d.ts +15 -1
- package/dist/build/report.js +50 -1
- package/dist/build/report.js.map +1 -1
- package/dist/build/route-classification-manifest.d.ts +53 -0
- package/dist/build/route-classification-manifest.js +145 -0
- package/dist/build/route-classification-manifest.js.map +1 -0
- package/dist/build/run-prerender.js +1 -1
- package/dist/build/ssr-manifest.d.ts +19 -0
- package/dist/build/ssr-manifest.js +71 -0
- package/dist/build/ssr-manifest.js.map +1 -0
- package/dist/check.js +4 -4
- package/dist/check.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/entry.js +1 -1
- package/dist/config/config-matchers.js +1 -0
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/entries/app-rsc-entry.js +341 -114
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +205 -199
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/index.d.ts +1 -169
- package/dist/index.js +113 -432
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +2 -2
- package/dist/init.js.map +1 -1
- package/dist/plugins/fonts.d.ts +49 -1
- package/dist/plugins/fonts.js +97 -3
- package/dist/plugins/fonts.js.map +1 -1
- package/dist/plugins/postcss.d.ts +27 -0
- package/dist/plugins/postcss.js +94 -0
- package/dist/plugins/postcss.js.map +1 -0
- package/dist/plugins/strip-server-exports.d.ts +14 -0
- package/dist/plugins/strip-server-exports.js +73 -0
- package/dist/plugins/strip-server-exports.js.map +1 -0
- package/dist/routing/app-router.d.ts +6 -4
- package/dist/routing/app-router.js +21 -22
- package/dist/routing/app-router.js.map +1 -1
- package/dist/server/app-browser-entry.js +235 -97
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-error.d.ts +8 -0
- package/dist/server/app-browser-error.js +9 -0
- package/dist/server/app-browser-error.js.map +1 -0
- package/dist/server/app-browser-state.d.ts +93 -0
- package/dist/server/app-browser-state.js +132 -0
- package/dist/server/app-browser-state.js.map +1 -0
- package/dist/server/app-elements.d.ts +92 -0
- package/dist/server/app-elements.js +122 -0
- package/dist/server/app-elements.js.map +1 -0
- package/dist/server/app-page-boundary-render.d.ts +3 -1
- package/dist/server/app-page-boundary-render.js +41 -1
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +6 -3
- package/dist/server/app-page-cache.js +14 -8
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-execution.d.ts +36 -3
- package/dist/server/app-page-execution.js +50 -10
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +10 -4
- package/dist/server/app-page-probe.js +24 -15
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render.d.ts +8 -4
- package/dist/server/app-page-render.js +15 -4
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +52 -4
- package/dist/server/app-page-request.js +86 -16
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +4 -11
- package/dist/server/app-page-response.js +7 -19
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-route-wiring.d.ts +22 -8
- package/dist/server/app-page-route-wiring.js +219 -81
- package/dist/server/app-page-route-wiring.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +4 -1
- package/dist/server/app-page-stream.js +2 -1
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-render-dependency.d.ts +13 -0
- package/dist/server/app-render-dependency.js +35 -0
- package/dist/server/app-render-dependency.js.map +1 -0
- package/dist/server/app-route-handler-execution.d.ts +1 -0
- package/dist/server/app-route-handler-execution.js +1 -0
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-response.js +2 -1
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +1 -0
- package/dist/server/app-route-handler-runtime.js +26 -1
- package/dist/server/app-route-handler-runtime.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +3 -1
- package/dist/server/app-ssr-entry.js +23 -19
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-stream.d.ts +1 -1
- package/dist/server/app-ssr-stream.js +4 -4
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/csp.d.ts +12 -0
- package/dist/server/csp.js +46 -0
- package/dist/server/csp.js.map +1 -0
- package/dist/server/dev-server.js +22 -18
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/html.d.ts +4 -1
- package/dist/server/html.js +11 -1
- package/dist/server/html.js.map +1 -1
- package/dist/server/middleware-response-headers.d.ts +12 -0
- package/dist/server/middleware-response-headers.js +23 -0
- package/dist/server/middleware-response-headers.js.map +1 -0
- package/dist/server/middleware.js +1 -5
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/pages-page-data.d.ts +1 -0
- package/dist/server/pages-page-data.js +2 -2
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +2 -1
- package/dist/server/pages-page-response.js +16 -14
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +3 -3
- package/dist/server/prod-server.js +5 -4
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +15 -1
- package/dist/server/request-pipeline.js +88 -5
- package/dist/server/request-pipeline.js.map +1 -1
- package/dist/shims/cache-runtime.d.ts +1 -0
- package/dist/shims/cache-runtime.js +0 -5
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +1 -0
- package/dist/shims/cache.js +1 -8
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/client-hook-error.d.ts +14 -0
- package/dist/shims/client-hook-error.js +19 -0
- package/dist/shims/client-hook-error.js.map +1 -0
- package/dist/shims/constants.d.ts +3 -3
- package/dist/shims/constants.js +3 -3
- package/dist/shims/constants.js.map +1 -1
- package/dist/shims/document.d.ts +6 -6
- package/dist/shims/error-boundary.d.ts +4 -4
- package/dist/shims/error-boundary.js +1 -1
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/form.d.ts +3 -3
- package/dist/shims/head-state.d.ts +1 -0
- package/dist/shims/head-state.js +0 -5
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/headers.d.ts +11 -0
- package/dist/shims/headers.js +13 -10
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-state.d.ts +1 -0
- package/dist/shims/i18n-state.js +0 -4
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/internal/app-router-context.d.ts +6 -6
- package/dist/shims/internal/router-context.d.ts +2 -2
- package/dist/shims/layout-segment-context.d.ts +2 -2
- package/dist/shims/link.js +19 -11
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +3 -3
- package/dist/shims/navigation-state.d.ts +2 -0
- package/dist/shims/navigation-state.js +0 -13
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +55 -8
- package/dist/shims/navigation.js +97 -23
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/navigation.react-server.d.ts +14 -0
- package/dist/shims/navigation.react-server.js +29 -0
- package/dist/shims/navigation.react-server.js.map +1 -0
- package/dist/shims/request-context.d.ts +1 -0
- package/dist/shims/request-context.js +0 -9
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/request-state-types.d.ts +1 -1
- package/dist/shims/router-state.d.ts +1 -0
- package/dist/shims/router-state.js +0 -5
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/script-nonce-context.d.ts +12 -0
- package/dist/shims/script-nonce-context.js +17 -0
- package/dist/shims/script-nonce-context.js.map +1 -0
- package/dist/shims/script.js +41 -10
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.js +6 -1
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/slot.d.ts +11 -7
- package/dist/shims/slot.js +28 -19
- package/dist/shims/slot.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +2 -0
- package/dist/shims/unified-request-context.js +0 -14
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/url-safety.js +25 -4
- package/dist/shims/url-safety.js.map +1 -1
- package/dist/utils/mdx-scan.d.ts +10 -0
- package/dist/utils/mdx-scan.js +36 -0
- package/dist/utils/mdx-scan.js.map +1 -0
- package/dist/utils/public-routes.d.ts +5 -0
- package/dist/utils/public-routes.js +50 -0
- package/dist/utils/public-routes.js.map +1 -0
- package/package.json +9 -9
- package/dist/plugins/fix-use-server-closure-collision.d.ts +0 -29
- package/dist/plugins/fix-use-server-closure-collision.js +0 -204
- package/dist/plugins/fix-use-server-closure-collision.js.map +0 -1
package/dist/shims/url-safety.js
CHANGED
|
@@ -7,12 +7,33 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Detect dangerous URI schemes that should never be navigated to.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* Adapted from Next.js's javascript URL detector:
|
|
12
|
+
* packages/next/src/client/lib/javascript-url.ts
|
|
13
|
+
* https://github.com/vercel/next.js/blob/canary/packages/next/src/client/lib/javascript-url.ts
|
|
14
|
+
*
|
|
15
|
+
* URL parsing ignores leading C0 control characters / spaces, and treats
|
|
16
|
+
* embedded tab/newline characters in the scheme as insignificant. We mirror
|
|
17
|
+
* that behavior here so obfuscated values like `java\nscript:` and
|
|
18
|
+
* `\x00javascript:` are still blocked.
|
|
19
|
+
*
|
|
20
|
+
* Vinext intentionally extends this handling to `data:` and `vbscript:` too,
|
|
21
|
+
* since both are also dangerous navigation targets.
|
|
12
22
|
*/
|
|
13
|
-
const
|
|
23
|
+
const LEADING_IGNORED = "[\\u0000-\\u001F \\u200B\\uFEFF]*";
|
|
24
|
+
const SCHEME_IGNORED = "[\\r\\n\\t]*";
|
|
25
|
+
function buildDangerousSchemeRegex(scheme) {
|
|
26
|
+
const chars = scheme.split("").join(SCHEME_IGNORED);
|
|
27
|
+
return new RegExp(`^${LEADING_IGNORED}${chars}${SCHEME_IGNORED}:`, "i");
|
|
28
|
+
}
|
|
29
|
+
const DANGEROUS_SCHEME_RES = [
|
|
30
|
+
buildDangerousSchemeRegex("javascript"),
|
|
31
|
+
buildDangerousSchemeRegex("data"),
|
|
32
|
+
buildDangerousSchemeRegex("vbscript")
|
|
33
|
+
];
|
|
14
34
|
function isDangerousScheme(url) {
|
|
15
|
-
|
|
35
|
+
const str = "" + url;
|
|
36
|
+
return DANGEROUS_SCHEME_RES.some((re) => re.test(str));
|
|
16
37
|
}
|
|
17
38
|
//#endregion
|
|
18
39
|
export { isDangerousScheme };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-safety.js","names":[],"sources":["../../src/shims/url-safety.ts"],"sourcesContent":["/**\n * Shared URL safety utilities for Link, Form, and navigation shims.\n *\n * Centralizes dangerous URI scheme detection so all components and\n * navigation functions use the same validation logic.\n */\n\n/**\n * Detect dangerous URI schemes that should never be navigated to.\n *
|
|
1
|
+
{"version":3,"file":"url-safety.js","names":[],"sources":["../../src/shims/url-safety.ts"],"sourcesContent":["/**\n * Shared URL safety utilities for Link, Form, and navigation shims.\n *\n * Centralizes dangerous URI scheme detection so all components and\n * navigation functions use the same validation logic.\n */\n\n/**\n * Detect dangerous URI schemes that should never be navigated to.\n *\n * Adapted from Next.js's javascript URL detector:\n * packages/next/src/client/lib/javascript-url.ts\n * https://github.com/vercel/next.js/blob/canary/packages/next/src/client/lib/javascript-url.ts\n *\n * URL parsing ignores leading C0 control characters / spaces, and treats\n * embedded tab/newline characters in the scheme as insignificant. We mirror\n * that behavior here so obfuscated values like `java\\nscript:` and\n * `\\x00javascript:` are still blocked.\n *\n * Vinext intentionally extends this handling to `data:` and `vbscript:` too,\n * since both are also dangerous navigation targets.\n */\nconst LEADING_IGNORED = \"[\\\\u0000-\\\\u001F \\\\u200B\\\\uFEFF]*\";\nconst SCHEME_IGNORED = \"[\\\\r\\\\n\\\\t]*\";\n\nfunction buildDangerousSchemeRegex(scheme: string): RegExp {\n const chars = scheme.split(\"\").join(SCHEME_IGNORED);\n return new RegExp(`^${LEADING_IGNORED}${chars}${SCHEME_IGNORED}:`, \"i\");\n}\n\nconst DANGEROUS_SCHEME_RES = [\n buildDangerousSchemeRegex(\"javascript\"),\n buildDangerousSchemeRegex(\"data\"),\n buildDangerousSchemeRegex(\"vbscript\"),\n];\n\nexport function isDangerousScheme(url: string): boolean {\n const str = \"\" + (url as unknown as string);\n return DANGEROUS_SCHEME_RES.some((re) => re.test(str));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AAEvB,SAAS,0BAA0B,QAAwB;CACzD,MAAM,QAAQ,OAAO,MAAM,GAAG,CAAC,KAAK,eAAe;AACnD,QAAO,IAAI,OAAO,IAAI,kBAAkB,QAAQ,eAAe,IAAI,IAAI;;AAGzE,MAAM,uBAAuB;CAC3B,0BAA0B,aAAa;CACvC,0BAA0B,OAAO;CACjC,0BAA0B,WAAW;CACtC;AAED,SAAgB,kBAAkB,KAAsB;CACtD,MAAM,MAAM,KAAM;AAClB,QAAO,qBAAqB,MAAM,OAAO,GAAG,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/utils/mdx-scan.d.ts
|
|
2
|
+
/** Module-level cache for hasMdxFiles — avoids re-scanning per Vite environment. */
|
|
3
|
+
declare const mdxScanCache: Map<string, boolean>;
|
|
4
|
+
/**
|
|
5
|
+
* Check if the project has .mdx files in app/ or pages/ directories.
|
|
6
|
+
*/
|
|
7
|
+
declare function hasMdxFiles(root: string, appDir: string | null, pagesDir: string | null): boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { hasMdxFiles, mdxScanCache };
|
|
10
|
+
//# sourceMappingURL=mdx-scan.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/utils/mdx-scan.ts
|
|
4
|
+
/** Module-level cache for hasMdxFiles — avoids re-scanning per Vite environment. */
|
|
5
|
+
const mdxScanCache = /* @__PURE__ */ new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Check if the project has .mdx files in app/ or pages/ directories.
|
|
8
|
+
*/
|
|
9
|
+
function hasMdxFiles(root, appDir, pagesDir) {
|
|
10
|
+
const cacheKey = `${root}\0${appDir ?? ""}\0${pagesDir ?? ""}`;
|
|
11
|
+
if (mdxScanCache.has(cacheKey)) return mdxScanCache.get(cacheKey);
|
|
12
|
+
const dirs = [appDir, pagesDir].filter(Boolean);
|
|
13
|
+
for (const dir of dirs) if (fs.existsSync(dir) && scanDirForMdx(dir)) {
|
|
14
|
+
mdxScanCache.set(cacheKey, true);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
mdxScanCache.set(cacheKey, false);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
function scanDirForMdx(dir) {
|
|
21
|
+
try {
|
|
22
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
23
|
+
for (const entry of entries) {
|
|
24
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
25
|
+
const full = path.join(dir, entry.name);
|
|
26
|
+
if (entry.isDirectory()) {
|
|
27
|
+
if (scanDirForMdx(full)) return true;
|
|
28
|
+
} else if (entry.isFile() && entry.name.toLowerCase().endsWith(".mdx")) return true;
|
|
29
|
+
}
|
|
30
|
+
} catch {}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { hasMdxFiles, mdxScanCache };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=mdx-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-scan.js","names":[],"sources":["../../src/utils/mdx-scan.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/** Module-level cache for hasMdxFiles — avoids re-scanning per Vite environment. */\nexport const mdxScanCache = new Map<string, boolean>();\n\n/**\n * Check if the project has .mdx files in app/ or pages/ directories.\n */\nexport function hasMdxFiles(root: string, appDir: string | null, pagesDir: string | null): boolean {\n const cacheKey = `${root}\\0${appDir ?? \"\"}\\0${pagesDir ?? \"\"}`;\n if (mdxScanCache.has(cacheKey)) return mdxScanCache.get(cacheKey)!;\n const dirs = [appDir, pagesDir].filter(Boolean) as string[];\n for (const dir of dirs) {\n if (fs.existsSync(dir) && scanDirForMdx(dir)) {\n mdxScanCache.set(cacheKey, true);\n return true;\n }\n }\n mdxScanCache.set(cacheKey, false);\n return false;\n}\n\nfunction scanDirForMdx(dir: string): boolean {\n try {\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (scanDirForMdx(full)) return true;\n } else if (entry.isFile() && entry.name.toLowerCase().endsWith(\".mdx\")) {\n return true;\n }\n }\n } catch {\n // ignore unreadable dirs\n }\n return false;\n}\n"],"mappings":";;;;AAIA,MAAa,+BAAe,IAAI,KAAsB;;;;AAKtD,SAAgB,YAAY,MAAc,QAAuB,UAAkC;CACjG,MAAM,WAAW,GAAG,KAAK,IAAI,UAAU,GAAG,IAAI,YAAY;AAC1D,KAAI,aAAa,IAAI,SAAS,CAAE,QAAO,aAAa,IAAI,SAAS;CACjE,MAAM,OAAO,CAAC,QAAQ,SAAS,CAAC,OAAO,QAAQ;AAC/C,MAAK,MAAM,OAAO,KAChB,KAAI,GAAG,WAAW,IAAI,IAAI,cAAc,IAAI,EAAE;AAC5C,eAAa,IAAI,UAAU,KAAK;AAChC,SAAO;;AAGX,cAAa,IAAI,UAAU,MAAM;AACjC,QAAO;;AAGT,SAAS,cAAc,KAAsB;AAC3C,KAAI;EACF,MAAM,UAAU,GAAG,YAAY,KAAK,EAAE,eAAe,MAAM,CAAC;AAC5D,OAAK,MAAM,SAAS,SAAS;AAC3B,OAAI,MAAM,KAAK,WAAW,IAAI,IAAI,MAAM,SAAS,eAAgB;GACjE,MAAM,OAAO,KAAK,KAAK,KAAK,MAAM,KAAK;AACvC,OAAI,MAAM,aAAa;QACjB,cAAc,KAAK,CAAE,QAAO;cACvB,MAAM,QAAQ,IAAI,MAAM,KAAK,aAAa,CAAC,SAAS,OAAO,CACpE,QAAO;;SAGL;AAGR,QAAO"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/utils/public-routes.ts
|
|
4
|
+
function scanPublicFileRoutes(root) {
|
|
5
|
+
const publicDir = path.join(root, "public");
|
|
6
|
+
const routes = [];
|
|
7
|
+
const visitedDirs = /* @__PURE__ */ new Set();
|
|
8
|
+
function walk(dir) {
|
|
9
|
+
let realDir;
|
|
10
|
+
try {
|
|
11
|
+
realDir = fs.realpathSync(dir);
|
|
12
|
+
} catch {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (visitedDirs.has(realDir)) return;
|
|
16
|
+
visitedDirs.add(realDir);
|
|
17
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
18
|
+
for (const entry of entries) {
|
|
19
|
+
const fullPath = path.join(dir, entry.name);
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
walk(fullPath);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (entry.isSymbolicLink()) {
|
|
25
|
+
let stat;
|
|
26
|
+
try {
|
|
27
|
+
stat = fs.statSync(fullPath);
|
|
28
|
+
} catch {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (stat.isDirectory()) {
|
|
32
|
+
walk(fullPath);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (!stat.isFile()) continue;
|
|
36
|
+
} else if (!entry.isFile()) continue;
|
|
37
|
+
const relativePath = path.relative(publicDir, fullPath).split(path.sep).join("/");
|
|
38
|
+
routes.push("/" + relativePath);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (fs.existsSync(publicDir)) try {
|
|
42
|
+
walk(publicDir);
|
|
43
|
+
} catch {}
|
|
44
|
+
routes.sort();
|
|
45
|
+
return routes;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { scanPublicFileRoutes };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=public-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-routes.js","names":[],"sources":["../../src/utils/public-routes.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport function scanPublicFileRoutes(root: string): string[] {\n const publicDir = path.join(root, \"public\");\n const routes: string[] = [];\n const visitedDirs = new Set<string>();\n\n function walk(dir: string): void {\n let realDir: string;\n try {\n realDir = fs.realpathSync(dir);\n } catch {\n return;\n }\n if (visitedDirs.has(realDir)) return;\n visitedDirs.add(realDir);\n\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n walk(fullPath);\n continue;\n }\n if (entry.isSymbolicLink()) {\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch {\n continue;\n }\n if (stat.isDirectory()) {\n walk(fullPath);\n continue;\n }\n if (!stat.isFile()) continue;\n } else if (!entry.isFile()) {\n continue;\n }\n const relativePath = path.relative(publicDir, fullPath).split(path.sep).join(\"/\");\n routes.push(\"/\" + relativePath);\n }\n }\n\n if (fs.existsSync(publicDir)) {\n try {\n walk(publicDir);\n } catch {\n // ignore unreadable dirs\n }\n }\n\n routes.sort();\n return routes;\n}\n"],"mappings":";;;AAGA,SAAgB,qBAAqB,MAAwB;CAC3D,MAAM,YAAY,KAAK,KAAK,MAAM,SAAS;CAC3C,MAAM,SAAmB,EAAE;CAC3B,MAAM,8BAAc,IAAI,KAAa;CAErC,SAAS,KAAK,KAAmB;EAC/B,IAAI;AACJ,MAAI;AACF,aAAU,GAAG,aAAa,IAAI;UACxB;AACN;;AAEF,MAAI,YAAY,IAAI,QAAQ,CAAE;AAC9B,cAAY,IAAI,QAAQ;EAExB,MAAM,UAAU,GAAG,YAAY,KAAK,EAAE,eAAe,MAAM,CAAC;AAC5D,OAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK;AAC3C,OAAI,MAAM,aAAa,EAAE;AACvB,SAAK,SAAS;AACd;;AAEF,OAAI,MAAM,gBAAgB,EAAE;IAC1B,IAAI;AACJ,QAAI;AACF,YAAO,GAAG,SAAS,SAAS;YACtB;AACN;;AAEF,QAAI,KAAK,aAAa,EAAE;AACtB,UAAK,SAAS;AACd;;AAEF,QAAI,CAAC,KAAK,QAAQ,CAAE;cACX,CAAC,MAAM,QAAQ,CACxB;GAEF,MAAM,eAAe,KAAK,SAAS,WAAW,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,IAAI;AACjF,UAAO,KAAK,MAAM,aAAa;;;AAInC,KAAI,GAAG,WAAW,UAAU,CAC1B,KAAI;AACF,OAAK,UAAU;SACT;AAKV,QAAO,MAAM;AACb,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vinext",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"description": "Run Next.js apps on Vite. Drop-in replacement for the next CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -66,18 +66,18 @@
|
|
|
66
66
|
"@types/react": "^19.2.14",
|
|
67
67
|
"@types/react-dom": "^19.2.3",
|
|
68
68
|
"@vitejs/plugin-react": "^6.0.1",
|
|
69
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
70
|
-
"react-server-dom-webpack": "^19.2.
|
|
71
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.
|
|
72
|
-
"vite-plus": "0.1.
|
|
69
|
+
"@vitejs/plugin-rsc": "^0.5.23",
|
|
70
|
+
"react-server-dom-webpack": "^19.2.5",
|
|
71
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.17",
|
|
72
|
+
"vite-plus": "0.1.17"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@mdx-js/rollup": "^3.0.0",
|
|
76
76
|
"@vitejs/plugin-react": "^5.1.4 || ^6.0.0",
|
|
77
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
78
|
-
"react": "
|
|
79
|
-
"react-dom": "
|
|
80
|
-
"react-server-dom-webpack": "^19.2.
|
|
77
|
+
"@vitejs/plugin-rsc": "^0.5.23",
|
|
78
|
+
"react": "^19.2.5",
|
|
79
|
+
"react-dom": "^19.2.5",
|
|
80
|
+
"react-server-dom-webpack": "^19.2.5",
|
|
81
81
|
"vite": "^7.0.0 || ^8.0.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependenciesMeta": {
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "vite";
|
|
2
|
-
|
|
3
|
-
//#region src/plugins/fix-use-server-closure-collision.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Fix 'use server' closure variable collision with local declarations.
|
|
6
|
-
*
|
|
7
|
-
* @vitejs/plugin-rsc uses `periscopic` to find closure variables for
|
|
8
|
-
* 'use server' inline functions. Due to how periscopic handles block scopes,
|
|
9
|
-
* `const X = ...` declared inside a 'use server' function body is tracked in
|
|
10
|
-
* the BlockStatement scope (not the FunctionDeclaration scope). When periscopic
|
|
11
|
-
* searches for the owner of a reference `X`, it finds the block scope — which
|
|
12
|
-
* is neither the function scope nor the module scope — so it incorrectly
|
|
13
|
-
* classifies `X` as a closure variable from the outer scope.
|
|
14
|
-
*
|
|
15
|
-
* The result: plugin-rsc injects `const [X] = await decryptActionBoundArgs(...)`
|
|
16
|
-
* at the top of the hoisted function, colliding with the existing `const X = ...`
|
|
17
|
-
* declaration in the body. This causes a SyntaxError.
|
|
18
|
-
*
|
|
19
|
-
* Fix: before plugin-rsc sees the file, detect any 'use server' function whose
|
|
20
|
-
* local `const/let/var` declarations shadow an outer-scope variable, and rename
|
|
21
|
-
* the inner declarations (+ usages within that function) to `__local_X`. This
|
|
22
|
-
* eliminates the collision without changing semantics.
|
|
23
|
-
*
|
|
24
|
-
* This is a general fix that works for any library — not just @payloadcms/next.
|
|
25
|
-
*/
|
|
26
|
-
declare const fixUseServerClosureCollisionPlugin: Plugin;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { fixUseServerClosureCollisionPlugin };
|
|
29
|
-
//# sourceMappingURL=fix-use-server-closure-collision.d.ts.map
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { parseAst } from "vite";
|
|
2
|
-
import MagicString from "magic-string";
|
|
3
|
-
//#region src/plugins/fix-use-server-closure-collision.ts
|
|
4
|
-
/**
|
|
5
|
-
* Fix 'use server' closure variable collision with local declarations.
|
|
6
|
-
*
|
|
7
|
-
* @vitejs/plugin-rsc uses `periscopic` to find closure variables for
|
|
8
|
-
* 'use server' inline functions. Due to how periscopic handles block scopes,
|
|
9
|
-
* `const X = ...` declared inside a 'use server' function body is tracked in
|
|
10
|
-
* the BlockStatement scope (not the FunctionDeclaration scope). When periscopic
|
|
11
|
-
* searches for the owner of a reference `X`, it finds the block scope — which
|
|
12
|
-
* is neither the function scope nor the module scope — so it incorrectly
|
|
13
|
-
* classifies `X` as a closure variable from the outer scope.
|
|
14
|
-
*
|
|
15
|
-
* The result: plugin-rsc injects `const [X] = await decryptActionBoundArgs(...)`
|
|
16
|
-
* at the top of the hoisted function, colliding with the existing `const X = ...`
|
|
17
|
-
* declaration in the body. This causes a SyntaxError.
|
|
18
|
-
*
|
|
19
|
-
* Fix: before plugin-rsc sees the file, detect any 'use server' function whose
|
|
20
|
-
* local `const/let/var` declarations shadow an outer-scope variable, and rename
|
|
21
|
-
* the inner declarations (+ usages within that function) to `__local_X`. This
|
|
22
|
-
* eliminates the collision without changing semantics.
|
|
23
|
-
*
|
|
24
|
-
* This is a general fix that works for any library — not just @payloadcms/next.
|
|
25
|
-
*/
|
|
26
|
-
const fixUseServerClosureCollisionPlugin = {
|
|
27
|
-
name: "vinext:fix-use-server-closure-collision",
|
|
28
|
-
enforce: "pre",
|
|
29
|
-
transform(code, id) {
|
|
30
|
-
if (!code.includes("use server")) return null;
|
|
31
|
-
if (!/\.(js|jsx|ts|tsx|mjs|cjs)$/.test(id.split("?")[0])) return null;
|
|
32
|
-
let ast;
|
|
33
|
-
try {
|
|
34
|
-
ast = parseAst(code);
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
function collectPatternNames(pattern, names) {
|
|
39
|
-
if (!pattern) return;
|
|
40
|
-
if (pattern.type === "Identifier") names.add(pattern.name);
|
|
41
|
-
else if (pattern.type === "ObjectPattern") for (const prop of pattern.properties) collectPatternNames(prop.value ?? prop.argument, names);
|
|
42
|
-
else if (pattern.type === "ArrayPattern") for (const elem of pattern.elements) collectPatternNames(elem, names);
|
|
43
|
-
else if (pattern.type === "RestElement" || pattern.type === "AssignmentPattern") collectPatternNames(pattern.left ?? pattern.argument, names);
|
|
44
|
-
}
|
|
45
|
-
function hasUseServerDirective(body) {
|
|
46
|
-
for (const stmt of body) {
|
|
47
|
-
if (stmt.type === "ExpressionStatement" && stmt.expression?.type === "Literal" && typeof stmt.expression.value === "string") {
|
|
48
|
-
if (stmt.expression.value === "use server") return true;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const s = new MagicString(code);
|
|
56
|
-
const renamedRanges = /* @__PURE__ */ new Set();
|
|
57
|
-
let changed = false;
|
|
58
|
-
function visitNode(node, ancestorNames) {
|
|
59
|
-
if (!node || typeof node !== "object") return;
|
|
60
|
-
if (!(node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression")) {
|
|
61
|
-
const namesForChildren = new Set(ancestorNames);
|
|
62
|
-
if (node.type === "CatchClause" && node.param) collectPatternNames(node.param, namesForChildren);
|
|
63
|
-
collectFunctionScopedNames(node, namesForChildren);
|
|
64
|
-
const immediateStmts = node.type === "Program" ? node.body : node.type === "BlockStatement" ? node.body : [];
|
|
65
|
-
for (const stmt of immediateStmts) if (stmt?.type === "VariableDeclaration") for (const decl of stmt.declarations) collectPatternNames(decl.id, namesForChildren);
|
|
66
|
-
else if (stmt?.type === "ClassDeclaration" && stmt.id?.name) namesForChildren.add(stmt.id.name);
|
|
67
|
-
else if (stmt?.type === "ImportDeclaration") {
|
|
68
|
-
for (const spec of stmt.specifiers ?? []) if (spec.local?.name) namesForChildren.add(spec.local.name);
|
|
69
|
-
}
|
|
70
|
-
for (const key of Object.keys(node)) {
|
|
71
|
-
if (key === "type") continue;
|
|
72
|
-
const child = node[key];
|
|
73
|
-
if (Array.isArray(child)) for (const c of child) visitNode(c, namesForChildren);
|
|
74
|
-
else if (child && typeof child === "object" && child.type) visitNode(child, namesForChildren);
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const namesForBody = new Set(ancestorNames);
|
|
79
|
-
for (const p of node.params ?? []) collectPatternNames(p, namesForBody);
|
|
80
|
-
const bodyStmts = node.body?.type === "BlockStatement" ? node.body.body : [];
|
|
81
|
-
if (hasUseServerDirective(bodyStmts)) {
|
|
82
|
-
const localDecls = /* @__PURE__ */ new Set();
|
|
83
|
-
collectAllDeclaredNames(node.body, localDecls);
|
|
84
|
-
const collisionRenames = /* @__PURE__ */ new Map();
|
|
85
|
-
for (const name of localDecls) if (namesForBody.has(name)) {
|
|
86
|
-
let to = `__local_${name}`;
|
|
87
|
-
let suffix = 0;
|
|
88
|
-
while (localDecls.has(to) || namesForBody.has(to)) {
|
|
89
|
-
to = `__local_${suffix}_${name}`;
|
|
90
|
-
suffix++;
|
|
91
|
-
}
|
|
92
|
-
collisionRenames.set(name, to);
|
|
93
|
-
}
|
|
94
|
-
if (collisionRenames.size > 0) {
|
|
95
|
-
for (const [name, to] of collisionRenames) renamingWalk(node.body, name, to);
|
|
96
|
-
changed = true;
|
|
97
|
-
}
|
|
98
|
-
const namesForChildren = new Set(namesForBody);
|
|
99
|
-
for (const name of localDecls) if (collisionRenames.has(name)) {
|
|
100
|
-
namesForChildren.delete(name);
|
|
101
|
-
namesForChildren.add(collisionRenames.get(name));
|
|
102
|
-
} else namesForChildren.add(name);
|
|
103
|
-
for (const stmt of bodyStmts) visitNode(stmt, namesForChildren);
|
|
104
|
-
for (const p of node.params ?? []) visitNode(p, ancestorNames);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const namesForChildren = new Set(namesForBody);
|
|
108
|
-
collectFunctionScopedNames(node.body, namesForChildren);
|
|
109
|
-
for (const stmt of bodyStmts) if (stmt?.type === "VariableDeclaration" && stmt.kind !== "var") for (const decl of stmt.declarations) collectPatternNames(decl.id, namesForChildren);
|
|
110
|
-
for (const key of Object.keys(node)) {
|
|
111
|
-
if (key === "type") continue;
|
|
112
|
-
const child = node[key];
|
|
113
|
-
if (Array.isArray(child)) for (const c of child) visitNode(c, namesForChildren);
|
|
114
|
-
else if (child && typeof child === "object" && child.type) visitNode(child, namesForChildren);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function renamingWalk(node, from, to, parent) {
|
|
118
|
-
if (!node || typeof node !== "object") return;
|
|
119
|
-
if (node.type === "Identifier" && node.name === from) {
|
|
120
|
-
if (parent?.type === "MemberExpression" && parent.property === node && !parent.computed) return;
|
|
121
|
-
if (parent?.type === "Property" && parent.key === node && !parent.computed) {
|
|
122
|
-
if (parent.shorthand) {
|
|
123
|
-
const rangeKey = `${node.start}:${node.end}`;
|
|
124
|
-
if (!renamedRanges.has(rangeKey)) {
|
|
125
|
-
renamedRanges.add(rangeKey);
|
|
126
|
-
s.update(node.start, node.end, `${from}: ${to}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (parent?.type === "Property" && parent.shorthand && parent.value === node) return;
|
|
132
|
-
if (parent?.type === "LabeledStatement" && parent.label === node) return;
|
|
133
|
-
if ((parent?.type === "BreakStatement" || parent?.type === "ContinueStatement") && parent.label === node) return;
|
|
134
|
-
const rangeKey = `${node.start}:${node.end}`;
|
|
135
|
-
if (!renamedRanges.has(rangeKey)) {
|
|
136
|
-
renamedRanges.add(rangeKey);
|
|
137
|
-
s.update(node.start, node.end, to);
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") {
|
|
142
|
-
const nestedDecls = /* @__PURE__ */ new Set();
|
|
143
|
-
for (const p of node.params ?? []) collectPatternNames(p, nestedDecls);
|
|
144
|
-
collectAllDeclaredNames(node.body, nestedDecls);
|
|
145
|
-
if (nestedDecls.has(from)) return;
|
|
146
|
-
if (node.body?.type === "BlockStatement" && hasUseServerDirective(node.body.body)) return;
|
|
147
|
-
}
|
|
148
|
-
for (const key of Object.keys(node)) {
|
|
149
|
-
if (key === "type" || key === "start" || key === "end") continue;
|
|
150
|
-
const child = node[key];
|
|
151
|
-
if (Array.isArray(child)) for (const c of child) renamingWalk(c, from, to, node);
|
|
152
|
-
else if (child && typeof child === "object" && child.type) renamingWalk(child, from, to, node);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function collectFunctionScopedNames(node, names) {
|
|
156
|
-
if (!node || typeof node !== "object") return;
|
|
157
|
-
if (node.type === "FunctionDeclaration") {
|
|
158
|
-
if (node.id?.name) names.add(node.id.name);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (node.type === "ClassDeclaration") {
|
|
162
|
-
if (node.id?.name) names.add(node.id.name);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return;
|
|
166
|
-
if (node.type === "VariableDeclaration" && node.kind === "var") for (const decl of node.declarations) collectPatternNames(decl.id, names);
|
|
167
|
-
for (const key of Object.keys(node)) {
|
|
168
|
-
if (key === "type") continue;
|
|
169
|
-
const child = node[key];
|
|
170
|
-
if (Array.isArray(child)) for (const c of child) collectFunctionScopedNames(c, names);
|
|
171
|
-
else if (child && typeof child === "object" && child.type) collectFunctionScopedNames(child, names);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function collectAllDeclaredNames(node, names) {
|
|
175
|
-
if (!node || typeof node !== "object") return;
|
|
176
|
-
if (node.type === "VariableDeclaration") for (const decl of node.declarations) collectPatternNames(decl.id, names);
|
|
177
|
-
if (node.type === "FunctionDeclaration") {
|
|
178
|
-
if (node.id?.name) names.add(node.id.name);
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (node.type === "ClassDeclaration") {
|
|
182
|
-
if (node.id?.name) names.add(node.id.name);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return;
|
|
186
|
-
for (const key of Object.keys(node)) {
|
|
187
|
-
if (key === "type") continue;
|
|
188
|
-
const child = node[key];
|
|
189
|
-
if (Array.isArray(child)) for (const c of child) collectAllDeclaredNames(c, names);
|
|
190
|
-
else if (child && typeof child === "object" && child.type) collectAllDeclaredNames(child, names);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
visitNode(ast, /* @__PURE__ */ new Set());
|
|
194
|
-
if (!changed) return null;
|
|
195
|
-
return {
|
|
196
|
-
code: s.toString(),
|
|
197
|
-
map: s.generateMap({ hires: "boundary" })
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
//#endregion
|
|
202
|
-
export { fixUseServerClosureCollisionPlugin };
|
|
203
|
-
|
|
204
|
-
//# sourceMappingURL=fix-use-server-closure-collision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fix-use-server-closure-collision.js","names":[],"sources":["../../src/plugins/fix-use-server-closure-collision.ts"],"sourcesContent":["import type { Plugin } from \"vite\";\nimport { parseAst } from \"vite\";\nimport MagicString from \"magic-string\";\n\n/**\n * Fix 'use server' closure variable collision with local declarations.\n *\n * @vitejs/plugin-rsc uses `periscopic` to find closure variables for\n * 'use server' inline functions. Due to how periscopic handles block scopes,\n * `const X = ...` declared inside a 'use server' function body is tracked in\n * the BlockStatement scope (not the FunctionDeclaration scope). When periscopic\n * searches for the owner of a reference `X`, it finds the block scope — which\n * is neither the function scope nor the module scope — so it incorrectly\n * classifies `X` as a closure variable from the outer scope.\n *\n * The result: plugin-rsc injects `const [X] = await decryptActionBoundArgs(...)`\n * at the top of the hoisted function, colliding with the existing `const X = ...`\n * declaration in the body. This causes a SyntaxError.\n *\n * Fix: before plugin-rsc sees the file, detect any 'use server' function whose\n * local `const/let/var` declarations shadow an outer-scope variable, and rename\n * the inner declarations (+ usages within that function) to `__local_X`. This\n * eliminates the collision without changing semantics.\n *\n * This is a general fix that works for any library — not just @payloadcms/next.\n */\nexport const fixUseServerClosureCollisionPlugin: Plugin = {\n name: \"vinext:fix-use-server-closure-collision\",\n enforce: \"pre\" as const,\n transform(code: string, id: string) {\n // Quick bail-out: only files that contain 'use server' inline\n if (!code.includes(\"use server\")) return null;\n // Only JS/TS files\n if (!/\\.(js|jsx|ts|tsx|mjs|cjs)$/.test(id.split(\"?\")[0])) return null;\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n let ast: any;\n try {\n ast = parseAst(code);\n } catch {\n return null;\n }\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function collectPatternNames(pattern: any, names: Set<string>) {\n if (!pattern) return;\n if (pattern.type === \"Identifier\") {\n names.add(pattern.name);\n } else if (pattern.type === \"ObjectPattern\") {\n for (const prop of pattern.properties) {\n collectPatternNames(prop.value ?? prop.argument, names);\n }\n } else if (pattern.type === \"ArrayPattern\") {\n for (const elem of pattern.elements) {\n collectPatternNames(elem, names);\n }\n } else if (pattern.type === \"RestElement\" || pattern.type === \"AssignmentPattern\") {\n collectPatternNames(pattern.left ?? pattern.argument, names);\n }\n }\n\n // Check if a block body has 'use server' as its leading directive prologue.\n // Only the first contiguous run of string-literal expression statements\n // counts — a \"use server\" string mid-function is not a directive.\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function hasUseServerDirective(body: any[]): boolean {\n for (const stmt of body) {\n if (\n stmt.type === \"ExpressionStatement\" &&\n stmt.expression?.type === \"Literal\" &&\n typeof stmt.expression.value === \"string\"\n ) {\n if (stmt.expression.value === \"use server\") return true;\n // Any other string literal in the prologue — keep scanning\n continue;\n }\n // First non-string-literal statement ends the prologue\n break;\n }\n return false;\n }\n\n // Find all 'use server' inline functions and check for collisions.\n //\n // `ancestorNames` accumulates the names that are in scope in all ancestor\n // function/program bodies as we descend — this is the correct set to\n // compare against, not a whole-AST walk (which would pick up siblings).\n const s = new MagicString(code);\n // Track source ranges already rewritten so renamingWalk never calls\n // s.update() twice on the same span (MagicString throws if it does).\n const renamedRanges = new Set<string>();\n let changed = false;\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function visitNode(node: any, ancestorNames: Set<string>) {\n if (!node || typeof node !== \"object\") return;\n\n const isFn =\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\";\n\n if (!isFn) {\n // Non-function nodes (Program, BlockStatement, IfStatement, CatchClause,\n // etc.) don't introduce a new function scope, but they may contain\n // variable declarations and catch bindings that are visible to nested\n // functions as ancestor names. Accumulate those into a new set before\n // recursing so we don't mutate the caller's set.\n const namesForChildren = new Set(ancestorNames);\n\n // CatchClause: `catch (e)` — `e` is in scope for the catch body\n if (node.type === \"CatchClause\" && node.param) {\n collectPatternNames(node.param, namesForChildren);\n }\n\n // Collect names visible at function scope from this node:\n // - FunctionDeclaration names (hoisted to enclosing scope)\n // - ClassDeclaration names (block-scoped like let, but treated as\n // function-scoped for our purposes since periscopic sees them)\n // - var declarations (hoisted to function scope, found anywhere)\n // We do NOT collect let/const from nested blocks here — those are\n // block-scoped and not visible to sibling/outer function declarations.\n collectFunctionScopedNames(node, namesForChildren);\n // Also collect let/const/var/class/import declared as immediate children\n // of this node (e.g. top-level Program statements, or the direct body of\n // a BlockStatement) — those ARE in scope for everything in the same block.\n const immediateStmts =\n node.type === \"Program\" ? node.body : node.type === \"BlockStatement\" ? node.body : [];\n for (const stmt of immediateStmts) {\n if (stmt?.type === \"VariableDeclaration\") {\n for (const decl of stmt.declarations) collectPatternNames(decl.id, namesForChildren);\n } else if (stmt?.type === \"ClassDeclaration\" && stmt.id?.name) {\n namesForChildren.add(stmt.id.name);\n } else if (stmt?.type === \"ImportDeclaration\") {\n for (const spec of stmt.specifiers ?? []) {\n // ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier\n // all have `local.name` as the binding name in this module.\n if (spec.local?.name) namesForChildren.add(spec.local.name);\n }\n }\n }\n\n for (const key of Object.keys(node)) {\n if (key === \"type\") continue;\n const child = node[key];\n if (Array.isArray(child)) {\n for (const c of child) visitNode(c, namesForChildren);\n } else if (child && typeof child === \"object\" && child.type) {\n visitNode(child, namesForChildren);\n }\n }\n return;\n }\n\n // Build the ancestor name set visible inside this function:\n // everything the parent saw, plus this function's own params.\n const namesForBody = new Set(ancestorNames);\n for (const p of node.params ?? []) collectPatternNames(p, namesForBody);\n\n // Check whether the body has the 'use server' directive.\n const bodyStmts = node.body?.type === \"BlockStatement\" ? node.body.body : [];\n const isServerFn = hasUseServerDirective(bodyStmts);\n\n if (isServerFn) {\n // Collect ALL variables declared anywhere in this function body.\n // This includes direct bodyStmts, but also for...of/for...in loop\n // variables, declarations inside if/try/while blocks, etc.\n // periscopic puts these in the BlockStatement scope (not the function\n // scope), so they get mis-classified as closure vars from the outer scope.\n // We use collectAllDeclaredNames (recursive, crosses blocks, stops at\n // nested function bodies) to catch every possible declaration site.\n const localDecls = new Set<string>();\n collectAllDeclaredNames(node.body, localDecls);\n\n // Find collisions: local decls that shadow a name from ancestor scopes.\n // collisionRenames maps original name → chosen rename target, taking\n // into account that `__local_${name}` may itself already be declared\n // (e.g. the user wrote `const __local_cookies = ...`). In that case\n // we try `__local_0_${name}`, `__local_1_${name}`, … until we find a\n // free name. This prevents a secondary collision.\n const collisionRenames = new Map<string, string>();\n for (const name of localDecls) {\n if (namesForBody.has(name)) {\n let to = `__local_${name}`;\n let suffix = 0;\n while (localDecls.has(to) || namesForBody.has(to)) {\n to = `__local_${suffix}_${name}`;\n suffix++;\n }\n collisionRenames.set(name, to);\n }\n }\n\n if (collisionRenames.size > 0) {\n for (const [name, to] of collisionRenames) {\n renamingWalk(node.body, name, to);\n }\n changed = true;\n }\n\n // Build the ancestor set for children of this server function.\n // Colliding names have been renamed in this body, e.g. `cookies` →\n // `__local_cookies`. The original name no longer exists as a binding\n // in this scope, so we must remove it from the set and add the renamed\n // version instead. Leaving the original name in would cause nested\n // server functions to see it as an ancestor binding and spuriously flag\n // their own independent `const cookies` as a collision.\n const namesForChildren = new Set(namesForBody);\n for (const name of localDecls) {\n if (collisionRenames.has(name)) {\n namesForChildren.delete(name);\n namesForChildren.add(collisionRenames.get(name)!);\n } else {\n namesForChildren.add(name);\n }\n }\n\n // Recurse into children — nested 'use server' functions must be visited.\n // Skip node.body itself (already handled by renamingWalk above for\n // collisions); we recurse into each statement individually so that\n // nested functions inside the body get their own visitNode pass with\n // the correct ancestorNames.\n for (const stmt of bodyStmts) {\n visitNode(stmt, namesForChildren);\n }\n // Also visit params (they can contain default expressions with closures)\n for (const p of node.params ?? []) visitNode(p, ancestorNames);\n return;\n }\n\n // Not a server function — build the ancestor set for nested functions:\n // - var declarations anywhere in this function body (function-scoped)\n // - FunctionDeclaration names anywhere in this function body\n // - let/const only from the top-level statements of this function body\n // (block-scoped — not visible to nested fns in sibling blocks)\n const namesForChildren = new Set(namesForBody);\n collectFunctionScopedNames(node.body, namesForChildren);\n for (const stmt of bodyStmts) {\n if (stmt?.type === \"VariableDeclaration\" && stmt.kind !== \"var\") {\n for (const decl of stmt.declarations) collectPatternNames(decl.id, namesForChildren);\n }\n }\n\n for (const key of Object.keys(node)) {\n if (key === \"type\") continue;\n const child = node[key];\n if (Array.isArray(child)) {\n for (const c of child) visitNode(c, namesForChildren);\n } else if (child && typeof child === \"object\" && child.type) {\n visitNode(child, namesForChildren);\n }\n }\n }\n\n // Walk an AST subtree renaming all variable-reference Identifier nodes\n // matching `from` to `to`.\n //\n // Correctness rules:\n // - Non-computed MemberExpression.property is NOT a variable reference\n // - Non-computed Property.key is NOT a variable reference\n // - Shorthand Property { x } must be expanded to { x: __local_x }\n // - A nested function that re-declares `from` in its params OR anywhere\n // in its body via var/const/let (including inside control flow) is a\n // new binding — stop descending into it\n // - Never call s.update() on the same source range twice\n //\n // `parent` is the direct parent AST node, used to detect property contexts.\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function renamingWalk(node: any, from: string, to: string, parent?: any) {\n if (!node || typeof node !== \"object\") return;\n\n if (node.type === \"Identifier\" && node.name === from) {\n // Non-computed member expression property: obj.cookies — not a ref\n if (parent?.type === \"MemberExpression\" && parent.property === node && !parent.computed) {\n return;\n }\n\n // Non-computed property key in an object literal\n if (parent?.type === \"Property\" && parent.key === node && !parent.computed) {\n if (parent.shorthand) {\n // { cookies } — key and value are the same AST node.\n // Expand to { cookies: __local_cookies } by rewriting at the key\n // visit; skip the value visit via the guard below.\n const rangeKey = `${node.start}:${node.end}`;\n if (!renamedRanges.has(rangeKey)) {\n renamedRanges.add(rangeKey);\n s.update(node.start, node.end, `${from}: ${to}`);\n }\n }\n // Either way, key is not a variable reference — do not rename it.\n return;\n }\n\n // Value side of a shorthand property — same node as key, already handled\n if (parent?.type === \"Property\" && parent.shorthand && parent.value === node) {\n return;\n }\n\n // LabeledStatement label: `cookies: for (...)` — not a variable reference\n if (parent?.type === \"LabeledStatement\" && parent.label === node) {\n return;\n }\n\n // break/continue label: `break cookies` / `continue cookies` — not a variable reference\n if (\n (parent?.type === \"BreakStatement\" || parent?.type === \"ContinueStatement\") &&\n parent.label === node\n ) {\n return;\n }\n\n const rangeKey = `${node.start}:${node.end}`;\n if (!renamedRanges.has(rangeKey)) {\n renamedRanges.add(rangeKey);\n s.update(node.start, node.end, to);\n }\n return;\n }\n\n // For nested function nodes, check whether they re-declare `from`.\n // If they do, stop — the name in that nested scope is a different binding.\n // We must check ALL var declarations anywhere in the body (var hoists),\n // not just top-level statements.\n if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\"\n ) {\n const nestedDecls = new Set<string>();\n // Params\n for (const p of node.params ?? []) collectPatternNames(p, nestedDecls);\n // Recursively find all var/const/let declarations in the body,\n // including those nested inside if/for/while/etc.\n collectAllDeclaredNames(node.body, nestedDecls);\n if (nestedDecls.has(from)) return;\n\n // Also stop at nested 'use server' functions — visitNode will handle them\n // independently with the correct collision set, preventing double-rewrites.\n if (node.body?.type === \"BlockStatement\" && hasUseServerDirective(node.body.body)) {\n return;\n }\n }\n\n for (const key of Object.keys(node)) {\n if (key === \"type\" || key === \"start\" || key === \"end\") continue;\n const child = node[key];\n if (Array.isArray(child)) {\n for (const c of child) renamingWalk(c, from, to, node);\n } else if (child && typeof child === \"object\" && child.type) {\n renamingWalk(child, from, to, node);\n }\n }\n }\n\n // Collect names that are visible at function scope from a given subtree.\n //\n // Two separate helpers with different traversal rules:\n //\n // collectFunctionScopedNames(node, names)\n // Collects `var` declarations and `FunctionDeclaration` names anywhere\n // in the subtree, crossing block boundaries (if/for/while/try/catch)\n // but NOT crossing nested function bodies. `let`/`const` in nested\n // blocks are intentionally skipped — they are block-scoped and not\n // visible outside that block.\n // Use this when building ancestorNames for nested functions.\n //\n // collectAllDeclaredNames(node, names)\n // Collects ALL var/let/const declarations anywhere in the subtree,\n // crossing block boundaries but not nested function bodies.\n // Used only by renamingWalk's re-declaration check, where we want to\n // know if ANY declaration of `from` exists in a nested function's scope\n // (params already handled separately).\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function collectFunctionScopedNames(node: any, names: Set<string>) {\n if (!node || typeof node !== \"object\") return;\n // FunctionDeclaration: its name is a binding in the enclosing scope.\n // Record it, then stop — don't recurse into the body (different scope).\n if (node.type === \"FunctionDeclaration\") {\n if (node.id?.name) names.add(node.id.name);\n return;\n }\n // ClassDeclaration: like FunctionDeclaration, its name is a binding in\n // the enclosing scope. Don't recurse into the body.\n if (node.type === \"ClassDeclaration\") {\n if (node.id?.name) names.add(node.id.name);\n return;\n }\n // FunctionExpression / ArrowFunctionExpression names are only in scope\n // inside their own body, not the enclosing scope — skip entirely.\n if (node.type === \"FunctionExpression\" || node.type === \"ArrowFunctionExpression\") {\n return;\n }\n // var declarations are function-scoped — collect them wherever they appear.\n // let/const at a nested block level are block-scoped and NOT visible to\n // sibling or outer function declarations, so skip them here.\n if (node.type === \"VariableDeclaration\" && node.kind === \"var\") {\n for (const decl of node.declarations) collectPatternNames(decl.id, names);\n }\n for (const key of Object.keys(node)) {\n if (key === \"type\") continue;\n const child = node[key];\n if (Array.isArray(child)) {\n for (const c of child) collectFunctionScopedNames(c, names);\n } else if (child && typeof child === \"object\" && child.type) {\n collectFunctionScopedNames(child, names);\n }\n }\n }\n\n // Collect ALL declared names (var/let/const/class/function) in a subtree,\n // crossing blocks but not nested function bodies or class bodies.\n // Used by renamingWalk's re-declaration check where any shadowing\n // declaration — regardless of kind — must stop the rename from descending\n // further, and by the server-function local-decl scan to detect all\n // possible collision sites (including class declarations in the body).\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n function collectAllDeclaredNames(node: any, names: Set<string>) {\n if (!node || typeof node !== \"object\") return;\n if (node.type === \"VariableDeclaration\") {\n for (const decl of node.declarations) collectPatternNames(decl.id, names);\n }\n // FunctionDeclaration name is a binding in the enclosing scope — record it.\n if (node.type === \"FunctionDeclaration\") {\n if (node.id?.name) names.add(node.id.name);\n return; // don't recurse into its body\n }\n // ClassDeclaration name is a binding in the enclosing scope — record it.\n if (node.type === \"ClassDeclaration\") {\n if (node.id?.name) names.add(node.id.name);\n return; // don't recurse into the class body (separate scope)\n }\n if (node.type === \"FunctionExpression\" || node.type === \"ArrowFunctionExpression\") {\n return; // different scope — stop\n }\n for (const key of Object.keys(node)) {\n if (key === \"type\") continue;\n const child = node[key];\n if (Array.isArray(child)) {\n for (const c of child) collectAllDeclaredNames(c, names);\n } else if (child && typeof child === \"object\" && child.type) {\n collectAllDeclaredNames(child, names);\n }\n }\n }\n\n visitNode(ast, new Set());\n\n if (!changed) return null;\n return { code: s.toString(), map: s.generateMap({ hires: \"boundary\" }) };\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,qCAA6C;CACxD,MAAM;CACN,SAAS;CACT,UAAU,MAAc,IAAY;AAElC,MAAI,CAAC,KAAK,SAAS,aAAa,CAAE,QAAO;AAEzC,MAAI,CAAC,6BAA6B,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAE,QAAO;EAGjE,IAAI;AACJ,MAAI;AACF,SAAM,SAAS,KAAK;UACd;AACN,UAAO;;EAIT,SAAS,oBAAoB,SAAc,OAAoB;AAC7D,OAAI,CAAC,QAAS;AACd,OAAI,QAAQ,SAAS,aACnB,OAAM,IAAI,QAAQ,KAAK;YACd,QAAQ,SAAS,gBAC1B,MAAK,MAAM,QA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