vinext 0.0.41 → 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 +0 -1
- 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 +2 -2
- package/dist/check.js.map +1 -1
- package/dist/cli.js +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 +287 -95
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/index.d.ts +1 -169
- package/dist/index.js +112 -432
- package/dist/index.js.map +1 -1
- package/dist/plugins/fonts.d.ts +49 -1
- package/dist/plugins/fonts.js +96 -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 +2 -1
- package/dist/server/app-page-boundary-render.js +40 -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 +7 -4
- package/dist/server/app-page-render.js +13 -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 +1 -0
- package/dist/server/app-page-response.js +1 -0
- 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 -83
- package/dist/server/app-page-route-wiring.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-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.js +6 -2
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/dev-server.js +2 -4
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/middleware.js +1 -5
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/prod-server.d.ts +3 -3
- package/dist/server/prod-server.js +1 -1
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-pipeline.d.ts +2 -1
- package/dist/server/request-pipeline.js +34 -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/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/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 +3 -3
- 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/index.d.ts
CHANGED
|
@@ -1,160 +1,9 @@
|
|
|
1
1
|
import { NextConfig, NextConfigInput } from "./config/next-config.js";
|
|
2
2
|
import { AppStaticExportOptions, StaticExportOptions, StaticExportResult, staticExportApp, staticExportPages } from "./build/static-export.js";
|
|
3
|
-
import { matchConfigPattern } from "./config/config-matchers.js";
|
|
4
|
-
import { asyncHooksStubPlugin } from "./plugins/async-hooks-stub.js";
|
|
5
|
-
import { _findBalancedObject, _findCallEnd, parseStaticObjectLiteral } from "./plugins/fonts.js";
|
|
6
|
-
import { computeLazyChunks } from "./utils/lazy-chunks.js";
|
|
7
3
|
import { PluginOption } from "vite";
|
|
8
4
|
import { Options } from "@vitejs/plugin-react";
|
|
9
5
|
|
|
10
6
|
//#region src/index.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Module-level cache for resolvePostcssStringPlugins — avoids re-scanning per Vite environment.
|
|
13
|
-
* Stores the Promise itself so concurrent calls (RSC/SSR/Client config() hooks firing in
|
|
14
|
-
* parallel) all await the same in-flight scan rather than each starting their own.
|
|
15
|
-
*/
|
|
16
|
-
declare const _postcssCache: Map<string, Promise<{
|
|
17
|
-
plugins: unknown[];
|
|
18
|
-
} | undefined>>;
|
|
19
|
-
/**
|
|
20
|
-
* Resolve PostCSS string plugin names in a project's PostCSS config.
|
|
21
|
-
*
|
|
22
|
-
* Next.js (via postcss-load-config) resolves string plugin names in the
|
|
23
|
-
* object form `{ plugins: { "pkg-name": opts } }` but NOT in the array form
|
|
24
|
-
* `{ plugins: ["pkg-name"] }`. Since many Next.js projects use the array
|
|
25
|
-
* form (particularly with Tailwind CSS v4), we detect this case and resolve
|
|
26
|
-
* the string names to actual plugin functions so Vite can use them.
|
|
27
|
-
*
|
|
28
|
-
* Returns the resolved PostCSS config object to inject into Vite's
|
|
29
|
-
* `css.postcss`, or `undefined` if no resolution is needed.
|
|
30
|
-
*/
|
|
31
|
-
declare function resolvePostcssStringPlugins(projectRoot: string): Promise<{
|
|
32
|
-
plugins: unknown[];
|
|
33
|
-
} | undefined>;
|
|
34
|
-
/**
|
|
35
|
-
* manualChunks function for client builds.
|
|
36
|
-
*
|
|
37
|
-
* Splits the client bundle into:
|
|
38
|
-
* - "framework" — React, ReactDOM, and scheduler (loaded on every page)
|
|
39
|
-
* - "vinext" — vinext shims (router, head, link, etc.)
|
|
40
|
-
*
|
|
41
|
-
* All other vendor code is left to Rollup's default chunk-splitting
|
|
42
|
-
* algorithm. Rollup automatically deduplicates shared modules into
|
|
43
|
-
* common chunks based on the import graph — no manual intervention
|
|
44
|
-
* needed.
|
|
45
|
-
*
|
|
46
|
-
* Why not split every npm package into its own chunk?
|
|
47
|
-
* - Per-package splitting (`vendor-X`) creates 50-200+ chunks for a
|
|
48
|
-
* typical app, far exceeding the ~25-request sweet spot for HTTP/2.
|
|
49
|
-
* - gzip/brotli compress small files poorly — each file restarts with
|
|
50
|
-
* an empty dictionary, losing ~5-15% total compressed size vs fewer
|
|
51
|
-
* larger chunks (Khan Academy measured +2.5% wire size with 10x
|
|
52
|
-
* more files containing less raw code).
|
|
53
|
-
* - ES module evaluation has per-module overhead that compounds on
|
|
54
|
-
* mobile devices.
|
|
55
|
-
* - No major Vite-based framework (Remix, SvelteKit, Astro, TanStack)
|
|
56
|
-
* uses per-package splitting. Next.js only isolates packages >160KB.
|
|
57
|
-
* - Rollup's graph-based splitting already handles the common case
|
|
58
|
-
* well: shared dependencies between routes get their own chunks,
|
|
59
|
-
* and route-specific code stays in route chunks.
|
|
60
|
-
*/
|
|
61
|
-
declare function clientManualChunks(id: string): string | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Rollup output config with manualChunks for client code-splitting.
|
|
64
|
-
* Used by both CLI builds and multi-environment builds.
|
|
65
|
-
*
|
|
66
|
-
* experimentalMinChunkSize merges tiny shared chunks (< 10KB) back into
|
|
67
|
-
* their importers. This reduces HTTP request count and improves gzip
|
|
68
|
-
* compression efficiency — small files restart the compression dictionary,
|
|
69
|
-
* adding ~5-15% wire overhead vs fewer larger chunks.
|
|
70
|
-
*/
|
|
71
|
-
declare const clientOutputConfig: {
|
|
72
|
-
manualChunks: typeof clientManualChunks;
|
|
73
|
-
experimentalMinChunkSize: number;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Rollup treeshake configuration for production client builds.
|
|
77
|
-
*
|
|
78
|
-
* Uses the 'recommended' preset as a safe base, then overrides
|
|
79
|
-
* moduleSideEffects to strip unused re-exports from npm packages.
|
|
80
|
-
*
|
|
81
|
-
* The 'no-external' value for moduleSideEffects means:
|
|
82
|
-
* - Local project modules: preserve side effects (CSS imports, polyfills)
|
|
83
|
-
* - node_modules packages: treat as side-effect-free unless exports are used
|
|
84
|
-
*
|
|
85
|
-
* This is the single highest-impact optimization for large barrel-exporting
|
|
86
|
-
* libraries like mermaid, @mui/material, lucide-react, etc. These libraries
|
|
87
|
-
* re-export hundreds of sub-modules through barrel files. Without this,
|
|
88
|
-
* Rollup preserves every sub-module even when only a few exports are consumed.
|
|
89
|
-
*
|
|
90
|
-
* Why 'no-external' instead of false (global side-effect-free)?
|
|
91
|
-
* - User code may rely on import-time side effects (e.g., `import './global.css'`)
|
|
92
|
-
* - 'no-external' is safe for app code while still enabling aggressive DCE for deps
|
|
93
|
-
*
|
|
94
|
-
* Why not the 'smallest' preset?
|
|
95
|
-
* - 'smallest' also sets propertyReadSideEffects: false and
|
|
96
|
-
* tryCatchDeoptimization: false, which can break specific libraries
|
|
97
|
-
* that rely on property access side effects or try/catch for feature detection
|
|
98
|
-
* - 'recommended' + 'no-external' gives most of the benefit with less risk
|
|
99
|
-
*
|
|
100
|
-
* @deprecated Use getClientTreeshakeConfigForVite(viteMajorVersion) instead
|
|
101
|
-
* for Vite version compatibility. Kept for backward compatibility.
|
|
102
|
-
*/
|
|
103
|
-
declare const clientTreeshakeConfig: {
|
|
104
|
-
preset: "recommended";
|
|
105
|
-
moduleSideEffects: "no-external";
|
|
106
|
-
};
|
|
107
|
-
declare function getClientOutputConfigForVite(viteMajorVersion: number): {
|
|
108
|
-
manualChunks: typeof clientManualChunks;
|
|
109
|
-
experimentalMinChunkSize: number;
|
|
110
|
-
} | {
|
|
111
|
-
codeSplitting: {
|
|
112
|
-
minSize: number;
|
|
113
|
-
groups: {
|
|
114
|
-
name(moduleId: string): string | null;
|
|
115
|
-
}[];
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Returns treeshake configuration appropriate for the Vite version.
|
|
120
|
-
*
|
|
121
|
-
* Rollup (Vite 7) supports presets like "recommended" which set multiple
|
|
122
|
-
* treeshake options at once. Rolldown (Vite 8+) doesn't support presets,
|
|
123
|
-
* so we only return moduleSideEffects for Vite 8+.
|
|
124
|
-
*
|
|
125
|
-
* The Rollup "recommended" preset sets:
|
|
126
|
-
* - annotations: true (Rolldown default is also true)
|
|
127
|
-
* - manualPureFunctions: [] (Rolldown default is also [])
|
|
128
|
-
* - propertyReadSideEffects: true (Rolldown equivalent is 'always', the default)
|
|
129
|
-
* - unknownGlobalSideEffects: false (Rolldown default is true — this is a known acceptable
|
|
130
|
-
* divergence. Slightly less aggressive DCE on unknown globals, acceptable for client bundles)
|
|
131
|
-
* - correctVarValueBeforeDeclaration and tryCatchDeoptimization (Rolldown handles these differently)
|
|
132
|
-
*
|
|
133
|
-
* The key optimization is moduleSideEffects: "no-external", which is supported
|
|
134
|
-
* by both bundlers and provides the DCE benefits for barrel-exporting libraries.
|
|
135
|
-
* It treats node_modules as side-effect-free (enabling aggressive DCE) while
|
|
136
|
-
* preserving side effects in local code.
|
|
137
|
-
*/
|
|
138
|
-
declare function getClientTreeshakeConfigForVite(viteMajorVersion: number): {
|
|
139
|
-
moduleSideEffects: "no-external";
|
|
140
|
-
preset?: undefined;
|
|
141
|
-
} | {
|
|
142
|
-
preset: "recommended";
|
|
143
|
-
moduleSideEffects: "no-external";
|
|
144
|
-
};
|
|
145
|
-
type BundleBackfillChunk = {
|
|
146
|
-
type: "chunk";
|
|
147
|
-
fileName: string;
|
|
148
|
-
imports?: string[];
|
|
149
|
-
modules?: Record<string, unknown>;
|
|
150
|
-
viteMetadata?: {
|
|
151
|
-
importedCss?: Set<string>;
|
|
152
|
-
importedAssets?: Set<string>;
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
declare function augmentSsrManifestFromBundle(ssrManifest: Record<string, string[]>, bundle: Record<string, BundleBackfillChunk | {
|
|
156
|
-
type: string;
|
|
157
|
-
}>, root: string, base?: string): Record<string, string[]>;
|
|
158
7
|
type VinextOptions = {
|
|
159
8
|
/**
|
|
160
9
|
* Base directory containing the app/ and pages/ directories.
|
|
@@ -243,23 +92,6 @@ type VinextOptions = {
|
|
|
243
92
|
};
|
|
244
93
|
};
|
|
245
94
|
declare function vinext(options?: VinextOptions): PluginOption[];
|
|
246
|
-
/**
|
|
247
|
-
* Strip server-only data-fetching exports (getServerSideProps,
|
|
248
|
-
* getStaticProps, getStaticPaths) from page modules for the client
|
|
249
|
-
* bundle. Uses Vite's parseAst (Rollup/acorn) for correct handling
|
|
250
|
-
* of all export patterns including function expressions, arrow
|
|
251
|
-
* functions with TS return types, and re-exports.
|
|
252
|
-
*
|
|
253
|
-
* Modeled after Next.js's SWC `next-ssg-transform`.
|
|
254
|
-
*/
|
|
255
|
-
declare function stripServerExports(code: string): string | null;
|
|
256
|
-
/** Module-level cache for hasMdxFiles — avoids re-scanning per Vite environment. */
|
|
257
|
-
declare const _mdxScanCache: Map<string, boolean>;
|
|
258
|
-
/**
|
|
259
|
-
* Check if the project has .mdx files in app/ or pages/ directories.
|
|
260
|
-
*/
|
|
261
|
-
declare function hasMdxFiles(root: string, appDir: string | null, pagesDir: string | null): boolean;
|
|
262
|
-
declare function scanPublicFileRoutes(root: string): string[];
|
|
263
95
|
//#endregion
|
|
264
|
-
export { type AppStaticExportOptions, type NextConfig, type StaticExportOptions, type StaticExportResult, VinextOptions,
|
|
96
|
+
export { type AppStaticExportOptions, type NextConfig, type StaticExportOptions, type StaticExportResult, VinextOptions, vinext as default, staticExportApp, staticExportPages };
|
|
265
97
|
//# sourceMappingURL=index.d.ts.map
|