vinext 0.0.37 → 0.0.39
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 +33 -20
- package/dist/build/nitro-route-rules.d.ts +50 -0
- package/dist/build/nitro-route-rules.js +81 -0
- package/dist/build/nitro-route-rules.js.map +1 -0
- package/dist/build/precompress.d.ts +17 -0
- package/dist/build/precompress.js +102 -0
- package/dist/build/precompress.js.map +1 -0
- package/dist/build/prerender.d.ts +27 -22
- package/dist/build/prerender.js +17 -17
- package/dist/build/prerender.js.map +1 -1
- package/dist/build/report.d.ts +3 -4
- package/dist/build/report.js.map +1 -1
- package/dist/build/run-prerender.d.ts +3 -4
- package/dist/build/run-prerender.js.map +1 -1
- package/dist/build/standalone.d.ts +32 -0
- package/dist/build/standalone.js +199 -0
- package/dist/build/standalone.js.map +1 -0
- package/dist/build/static-export.d.ts +17 -29
- package/dist/build/static-export.js.map +1 -1
- package/dist/cache.d.ts +2 -0
- package/dist/cache.js +2 -0
- package/dist/check.d.ts +4 -4
- package/dist/check.js +1 -1
- package/dist/check.js.map +1 -1
- package/dist/cli.js +37 -26
- package/dist/cli.js.map +1 -1
- package/dist/client/empty-module.d.ts +1 -0
- package/dist/client/empty-module.js +1 -0
- package/dist/client/entry.js +2 -0
- package/dist/client/entry.js.map +1 -1
- package/dist/client/instrumentation-client-state.d.ts +10 -0
- package/dist/client/instrumentation-client-state.js +19 -0
- package/dist/client/instrumentation-client-state.js.map +1 -0
- package/dist/client/instrumentation-client.d.ts +8 -0
- package/dist/client/instrumentation-client.js +8 -0
- package/dist/client/instrumentation-client.js.map +1 -0
- package/dist/client/vinext-next-data.d.ts +5 -8
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/kv-cache-handler.d.ts +5 -3
- package/dist/cloudflare/kv-cache-handler.js +1 -1
- package/dist/cloudflare/kv-cache-handler.js.map +1 -1
- package/dist/cloudflare/tpr.d.ts +35 -27
- package/dist/cloudflare/tpr.js +37 -15
- package/dist/cloudflare/tpr.js.map +1 -1
- package/dist/config/config-matchers.d.ts +2 -2
- package/dist/config/config-matchers.js +1 -1
- package/dist/config/config-matchers.js.map +1 -1
- package/dist/config/dotenv.d.ts +4 -4
- package/dist/config/dotenv.js.map +1 -1
- package/dist/config/next-config.d.ts +40 -61
- package/dist/config/next-config.js +5 -4
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.d.ts +25 -41
- package/dist/deploy.js +10 -4
- package/dist/deploy.js.map +1 -1
- package/dist/entries/app-rsc-entry.d.ts +6 -10
- package/dist/entries/app-rsc-entry.js +31 -28
- package/dist/entries/app-rsc-entry.js.map +1 -1
- package/dist/entries/pages-client-entry.js +2 -0
- package/dist/entries/pages-client-entry.js.map +1 -1
- package/dist/entries/pages-server-entry.js +42 -263
- package/dist/entries/pages-server-entry.js.map +1 -1
- package/dist/entries/runtime-entry-module.d.ts +13 -1
- package/dist/entries/runtime-entry-module.js +18 -4
- package/dist/entries/runtime-entry-module.js.map +1 -1
- package/dist/index.d.ts +33 -41
- package/dist/index.js +263 -777
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +14 -26
- package/dist/init.js +8 -2
- package/dist/init.js.map +1 -1
- package/dist/plugins/client-reference-dedup.js.map +1 -1
- package/dist/plugins/fix-use-server-closure-collision.d.ts +29 -0
- package/dist/plugins/fix-use-server-closure-collision.js +204 -0
- package/dist/plugins/fix-use-server-closure-collision.js.map +1 -0
- package/dist/plugins/fonts.d.ts +56 -0
- package/dist/plugins/fonts.js +531 -0
- package/dist/plugins/fonts.js.map +1 -0
- package/dist/plugins/instrumentation-client.d.ts +7 -0
- package/dist/plugins/instrumentation-client.js +29 -0
- package/dist/plugins/instrumentation-client.js.map +1 -0
- package/dist/plugins/og-assets.d.ts +26 -0
- package/dist/plugins/og-assets.js +118 -0
- package/dist/plugins/og-assets.js.map +1 -0
- package/dist/plugins/optimize-imports.d.ts +2 -2
- package/dist/plugins/optimize-imports.js +4 -4
- package/dist/plugins/optimize-imports.js.map +1 -1
- package/dist/plugins/server-externals-manifest.d.ts +27 -0
- package/dist/plugins/server-externals-manifest.js +76 -0
- package/dist/plugins/server-externals-manifest.js.map +1 -0
- package/dist/routing/app-router.d.ts +29 -55
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +2 -2
- package/dist/routing/file-matcher.js.map +1 -1
- package/dist/routing/pages-router.d.ts +6 -11
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/route-trie.d.ts +2 -2
- package/dist/routing/route-trie.js.map +1 -1
- package/dist/server/api-handler.js +6 -23
- package/dist/server/api-handler.js.map +1 -1
- package/dist/server/app-browser-entry.js +274 -39
- package/dist/server/app-browser-entry.js.map +1 -1
- package/dist/server/app-browser-stream.d.ts +6 -6
- package/dist/server/app-browser-stream.js.map +1 -1
- package/dist/server/app-page-boundary-render.d.ts +8 -8
- package/dist/server/app-page-boundary-render.js +2 -2
- package/dist/server/app-page-boundary-render.js.map +1 -1
- package/dist/server/app-page-boundary.d.ts +13 -11
- package/dist/server/app-page-boundary.js +1 -1
- package/dist/server/app-page-boundary.js.map +1 -1
- package/dist/server/app-page-cache.d.ts +10 -10
- package/dist/server/app-page-cache.js.map +1 -1
- package/dist/server/app-page-execution.d.ts +10 -10
- package/dist/server/app-page-execution.js.map +1 -1
- package/dist/server/app-page-probe.d.ts +2 -2
- package/dist/server/app-page-probe.js.map +1 -1
- package/dist/server/app-page-render.d.ts +4 -4
- package/dist/server/app-page-render.js.map +1 -1
- package/dist/server/app-page-request.d.ts +12 -12
- package/dist/server/app-page-request.js.map +1 -1
- package/dist/server/app-page-response.d.ts +18 -18
- package/dist/server/app-page-response.js.map +1 -1
- package/dist/server/app-page-stream.d.ts +18 -18
- package/dist/server/app-page-stream.js.map +1 -1
- package/dist/server/app-route-handler-cache.d.ts +2 -2
- package/dist/server/app-route-handler-cache.js.map +1 -1
- package/dist/server/app-route-handler-execution.d.ts +6 -6
- package/dist/server/app-route-handler-execution.js.map +1 -1
- package/dist/server/app-route-handler-policy.d.ts +8 -8
- package/dist/server/app-route-handler-policy.js.map +1 -1
- package/dist/server/app-route-handler-response.d.ts +6 -6
- package/dist/server/app-route-handler-response.js.map +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +4 -4
- package/dist/server/app-route-handler-runtime.js.map +1 -1
- package/dist/server/app-ssr-entry.d.ts +4 -4
- package/dist/server/app-ssr-entry.js.map +1 -1
- package/dist/server/app-ssr-stream.d.ts +2 -2
- package/dist/server/app-ssr-stream.js +1 -3
- package/dist/server/app-ssr-stream.js.map +1 -1
- package/dist/server/dev-module-runner.d.ts +2 -2
- package/dist/server/dev-module-runner.js.map +1 -1
- package/dist/server/dev-server.js +8 -8
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/image-optimization.d.ts +7 -12
- package/dist/server/image-optimization.js.map +1 -1
- package/dist/server/instrumentation.d.ts +13 -13
- package/dist/server/instrumentation.js +16 -7
- package/dist/server/instrumentation.js.map +1 -1
- package/dist/server/isr-cache.d.ts +2 -2
- package/dist/server/isr-cache.js.map +1 -1
- package/dist/server/metadata-routes.d.ts +14 -19
- package/dist/server/metadata-routes.js.map +1 -1
- package/dist/server/middleware.d.ts +10 -16
- package/dist/server/middleware.js +15 -8
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/pages-api-route.d.ts +23 -0
- package/dist/server/pages-api-route.js +40 -0
- package/dist/server/pages-api-route.js.map +1 -0
- package/dist/server/pages-i18n.d.ts +4 -4
- package/dist/server/pages-i18n.js.map +1 -1
- package/dist/server/pages-media-type.d.ts +16 -0
- package/dist/server/pages-media-type.js +25 -0
- package/dist/server/pages-media-type.js.map +1 -0
- package/dist/server/pages-node-compat.d.ts +45 -0
- package/dist/server/pages-node-compat.js +148 -0
- package/dist/server/pages-node-compat.js.map +1 -0
- package/dist/server/pages-page-data.d.ts +22 -22
- package/dist/server/pages-page-data.js.map +1 -1
- package/dist/server/pages-page-response.d.ts +8 -8
- package/dist/server/pages-page-response.js.map +1 -1
- package/dist/server/prod-server.d.ts +20 -15
- package/dist/server/prod-server.js +171 -53
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/seed-cache.js.map +1 -1
- package/dist/server/static-file-cache.d.ts +57 -0
- package/dist/server/static-file-cache.js +219 -0
- package/dist/server/static-file-cache.js.map +1 -0
- package/dist/shims/app.d.ts +2 -2
- package/dist/shims/cache-for-request.d.ts +58 -0
- package/dist/shims/cache-for-request.js +74 -0
- package/dist/shims/cache-for-request.js.map +1 -0
- package/dist/shims/cache-runtime.d.ts +6 -9
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +28 -31
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/config.d.ts +2 -2
- package/dist/shims/config.js.map +1 -1
- package/dist/shims/dynamic.d.ts +2 -2
- package/dist/shims/dynamic.js +30 -17
- package/dist/shims/dynamic.js.map +1 -1
- package/dist/shims/error-boundary.d.ts +7 -7
- package/dist/shims/error-boundary.js.map +1 -1
- package/dist/shims/error.d.ts +2 -2
- package/dist/shims/error.js.map +1 -1
- package/dist/shims/fetch-cache.d.ts +4 -4
- package/dist/shims/fetch-cache.js.map +1 -1
- package/dist/shims/font-google-base.d.ts +4 -4
- package/dist/shims/font-google-base.js.map +1 -1
- package/dist/shims/font-local.d.ts +6 -6
- package/dist/shims/font-local.js.map +1 -1
- package/dist/shims/form.d.ts +4 -8
- package/dist/shims/form.js +4 -6
- package/dist/shims/form.js.map +1 -1
- package/dist/shims/head-state.d.ts +2 -2
- package/dist/shims/head-state.js.map +1 -1
- package/dist/shims/head.d.ts +2 -2
- package/dist/shims/head.js +18 -20
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +4 -4
- package/dist/shims/headers.js +1 -1
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/i18n-context.d.ts +2 -2
- package/dist/shims/i18n-context.js.map +1 -1
- package/dist/shims/i18n-state.d.ts +2 -2
- package/dist/shims/i18n-state.js.map +1 -1
- package/dist/shims/image-config.d.ts +2 -2
- package/dist/shims/image-config.js.map +1 -1
- package/dist/shims/image.d.ts +5 -6
- package/dist/shims/image.js +24 -8
- package/dist/shims/image.js.map +1 -1
- package/dist/shims/internal/app-router-context.d.ts +6 -6
- package/dist/shims/internal/app-router-context.js.map +1 -1
- package/dist/shims/internal/utils.d.ts +2 -2
- package/dist/shims/internal/utils.js.map +1 -1
- package/dist/shims/layout-segment-context.d.ts +12 -5
- package/dist/shims/layout-segment-context.js +18 -7
- package/dist/shims/layout-segment-context.js.map +1 -1
- package/dist/shims/legacy-image.d.ts +5 -8
- package/dist/shims/legacy-image.js.map +1 -1
- package/dist/shims/link.d.ts +21 -31
- package/dist/shims/link.js +4 -56
- package/dist/shims/link.js.map +1 -1
- package/dist/shims/metadata.d.ts +23 -31
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/navigation-state.d.ts +2 -2
- package/dist/shims/navigation-state.js.map +1 -1
- package/dist/shims/navigation.d.ts +102 -17
- package/dist/shims/navigation.js +361 -113
- package/dist/shims/navigation.js.map +1 -1
- package/dist/shims/request-context.d.ts +2 -2
- package/dist/shims/request-context.js.map +1 -1
- package/dist/shims/router-state.d.ts +4 -4
- package/dist/shims/router-state.js.map +1 -1
- package/dist/shims/router.d.ts +28 -47
- package/dist/shims/router.js.map +1 -1
- package/dist/shims/script.d.ts +16 -31
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.d.ts +11 -10
- package/dist/shims/server.js +3 -0
- package/dist/shims/server.js.map +1 -1
- package/dist/shims/unified-request-context.d.ts +4 -4
- package/dist/shims/unified-request-context.js +1 -0
- package/dist/shims/unified-request-context.js.map +1 -1
- package/dist/shims/web-vitals.d.ts +2 -2
- package/dist/shims/web-vitals.js.map +1 -1
- package/dist/utils/lazy-chunks.d.ts +34 -0
- package/dist/utils/lazy-chunks.js +50 -0
- package/dist/utils/lazy-chunks.js.map +1 -0
- package/dist/utils/vinext-root.d.ts +24 -0
- package/dist/utils/vinext-root.js +31 -0
- package/dist/utils/vinext-root.js.map +1 -0
- package/package.json +8 -4
|
@@ -15,10 +15,10 @@ import { NavigationState } from "./navigation-state.js";
|
|
|
15
15
|
*
|
|
16
16
|
* Each field group is documented with its source shim module.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
/** Cloudflare Workers ExecutionContext, or null on Node.js dev. */
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
type UnifiedRequestContext = {
|
|
19
|
+
/** Cloudflare Workers ExecutionContext, or null on Node.js dev. */executionContext: ExecutionContextLike | null; /** Per-request cache for cacheForRequest(). Keyed by factory function reference. */
|
|
20
|
+
requestCache: WeakMap<(...args: any[]) => any, unknown>;
|
|
21
|
+
} & VinextHeadersShimState & I18nState & NavigationState & CacheState & PrivateCacheState & FetchCacheState & RouterState & HeadState;
|
|
22
22
|
/**
|
|
23
23
|
* Create a fresh `UnifiedRequestContext` with defaults for all fields.
|
|
24
24
|
* Pass partial overrides for the fields you need to pre-populate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-request-context.js","names":[],"sources":["../../src/shims/unified-request-context.ts"],"sourcesContent":["/**\n * Unified per-request context backed by a single AsyncLocalStorage.\n *\n * Consolidates the 5–6 nested ALS scopes that previously wrapped every\n * App Router request (headers, navigation, cache-state, private-cache,\n * fetch-cache, execution-context) into one flat store.\n *\n * Each shim module checks `isInsideUnifiedScope()` and reads its sub-fields\n * from the unified store, falling back to its own standalone ALS when\n * outside (SSR environment, Pages Router, tests).\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport type {\n CacheState,\n ExecutionContextLike,\n FetchCacheState,\n HeadState,\n I18nState,\n NavigationState,\n PrivateCacheState,\n RouterState,\n VinextHeadersShimState,\n} from \"./request-state-types.js\";\n\n// ---------------------------------------------------------------------------\n// Unified context shape\n// ---------------------------------------------------------------------------\n\n/**\n * Flat union of all per-request state previously spread across\n * VinextHeadersShimState, NavigationState, CacheState, PrivateCacheState,\n * FetchCacheState, and ExecutionContextLike.\n *\n * Each field group is documented with its source shim module.\n */\nexport
|
|
1
|
+
{"version":3,"file":"unified-request-context.js","names":[],"sources":["../../src/shims/unified-request-context.ts"],"sourcesContent":["/**\n * Unified per-request context backed by a single AsyncLocalStorage.\n *\n * Consolidates the 5–6 nested ALS scopes that previously wrapped every\n * App Router request (headers, navigation, cache-state, private-cache,\n * fetch-cache, execution-context) into one flat store.\n *\n * Each shim module checks `isInsideUnifiedScope()` and reads its sub-fields\n * from the unified store, falling back to its own standalone ALS when\n * outside (SSR environment, Pages Router, tests).\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport type {\n CacheState,\n ExecutionContextLike,\n FetchCacheState,\n HeadState,\n I18nState,\n NavigationState,\n PrivateCacheState,\n RouterState,\n VinextHeadersShimState,\n} from \"./request-state-types.js\";\n\n// ---------------------------------------------------------------------------\n// Unified context shape\n// ---------------------------------------------------------------------------\n\n/**\n * Flat union of all per-request state previously spread across\n * VinextHeadersShimState, NavigationState, CacheState, PrivateCacheState,\n * FetchCacheState, and ExecutionContextLike.\n *\n * Each field group is documented with its source shim module.\n */\nexport type UnifiedRequestContext = {\n // ── request-context.ts ─────────────────────────────────────────────\n /** Cloudflare Workers ExecutionContext, or null on Node.js dev. */\n executionContext: ExecutionContextLike | null;\n\n // ── cache-for-request.ts ──────────────────────────────────────────\n /** Per-request cache for cacheForRequest(). Keyed by factory function reference. */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n requestCache: WeakMap<(...args: any[]) => any, unknown>;\n} & VinextHeadersShimState &\n I18nState &\n NavigationState &\n CacheState &\n PrivateCacheState &\n FetchCacheState &\n RouterState &\n HeadState;\n\n// ---------------------------------------------------------------------------\n// ALS setup — stored on globalThis via Symbol.for so all Vite environments\n// (RSC/SSR/client) share the same instance.\n// ---------------------------------------------------------------------------\n\nconst _ALS_KEY = Symbol.for(\"vinext.unifiedRequestContext.als\");\nconst _REQUEST_CONTEXT_ALS_KEY = Symbol.for(\"vinext.requestContext.als\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\nconst _als = (_g[_ALS_KEY] ??=\n new AsyncLocalStorage<UnifiedRequestContext>()) as AsyncLocalStorage<UnifiedRequestContext>;\n\nfunction _getInheritedExecutionContext(): ExecutionContextLike | null {\n const unifiedStore = _als.getStore();\n if (unifiedStore) return unifiedStore.executionContext;\n\n const executionContextAls = _g[_REQUEST_CONTEXT_ALS_KEY] as\n | AsyncLocalStorage<ExecutionContextLike | null>\n | undefined;\n return executionContextAls?.getStore() ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Create a fresh `UnifiedRequestContext` with defaults for all fields.\n * Pass partial overrides for the fields you need to pre-populate.\n */\nexport function createRequestContext(opts?: Partial<UnifiedRequestContext>): UnifiedRequestContext {\n return {\n headersContext: null,\n dynamicUsageDetected: false,\n pendingSetCookies: [],\n draftModeCookieHeader: null,\n phase: \"render\",\n i18nContext: null,\n serverContext: null,\n serverInsertedHTMLCallbacks: [],\n requestScopedCacheLife: null,\n _privateCache: null,\n currentRequestTags: [],\n executionContext: _getInheritedExecutionContext(), // inherits from standalone ALS if present\n requestCache: new WeakMap(),\n ssrContext: null,\n ssrHeadChildren: [],\n ...opts,\n };\n}\n\n/**\n * Run `fn` within a unified request context scope.\n * All shim modules will read/write their state from `ctx` for the\n * duration of the call, including async continuations.\n */\nexport function runWithRequestContext<T>(\n ctx: UnifiedRequestContext,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n return _als.run(ctx, fn);\n}\n\n/**\n * Run `fn` in a nested unified scope derived from the current request context.\n * Used by legacy runWith* wrappers to reset or override one sub-state while\n * preserving proper async isolation for continuations created inside `fn`.\n * The child scope is a shallow clone of the parent store, so untouched fields\n * keep sharing their existing references while overridden slices can be reset.\n *\n * @internal\n */\nexport function runWithUnifiedStateMutation<T>(\n mutate: (ctx: UnifiedRequestContext) => void,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n const parentCtx = _als.getStore();\n if (!parentCtx) return fn();\n\n const childCtx = { ...parentCtx };\n // NOTE: This is a shallow clone. Array fields (pendingSetCookies,\n // serverInsertedHTMLCallbacks, currentRequestTags, ssrHeadChildren), the\n // _privateCache Map, requestCache WeakMap, and object fields (headersContext,\n // i18nContext, serverContext, ssrContext, executionContext,\n // requestScopedCacheLife) still share references with the parent until\n // replaced. requestCache is intentionally shared — nested scopes within\n // the same request should see the same cached values. The mutate\n // callback must replace those reference-typed slices (for example\n // `ctx.currentRequestTags = []`) rather than mutating them in-place (for\n // example `ctx.currentRequestTags.push(...)`) or the parent scope will\n // observe those changes too. Keep this enumeration in sync with\n // UnifiedRequestContext: when adding a new reference-typed field, add it\n // here too and verify callers still follow the replace-not-mutate rule.\n mutate(childCtx);\n return _als.run(childCtx, fn);\n}\n\n/**\n * Get the current unified request context.\n * Returns the ALS store when inside a `runWithRequestContext()` scope,\n * or a fresh detached context otherwise. Unlike the legacy per-shim fallback\n * singletons, this detached value is ephemeral — mutations do not persist\n * across calls. This is intentional to prevent state leakage outside request\n * scopes.\n *\n * Only direct callers observe this detached fallback. Shim `_getState()`\n * helpers should continue to gate on `isInsideUnifiedScope()` and fall back\n * to their standalone ALS/fallback singletons outside the unified scope.\n * If called inside a standalone `runWithExecutionContext()` scope, the\n * detached context still reflects that inherited `executionContext`.\n */\nexport function getRequestContext(): UnifiedRequestContext {\n return _als.getStore() ?? createRequestContext();\n}\n\n/**\n * Check whether the current execution is inside a `runWithRequestContext()` scope.\n * Shim modules use this to decide whether to read from the unified store\n * or fall back to their own standalone ALS.\n */\nexport function isInsideUnifiedScope(): boolean {\n return _als.getStore() != null;\n}\n"],"mappings":";;;;;;;;;;;;;AA2DA,MAAM,WAAW,OAAO,IAAI,mCAAmC;AAC/D,MAAM,2BAA2B,OAAO,IAAI,4BAA4B;AACxE,MAAM,KAAK;AACX,MAAM,OAAQ,GAAG,cACf,IAAI,mBAA0C;AAEhD,SAAS,gCAA6D;CACpE,MAAM,eAAe,KAAK,UAAU;AACpC,KAAI,aAAc,QAAO,aAAa;AAKtC,QAH4B,GAAG,2BAGH,UAAU,IAAI;;;;;;AAW5C,SAAgB,qBAAqB,MAA8D;AACjG,QAAO;EACL,gBAAgB;EAChB,sBAAsB;EACtB,mBAAmB,EAAE;EACrB,uBAAuB;EACvB,OAAO;EACP,aAAa;EACb,eAAe;EACf,6BAA6B,EAAE;EAC/B,wBAAwB;EACxB,eAAe;EACf,oBAAoB,EAAE;EACtB,kBAAkB,+BAA+B;EACjD,8BAAc,IAAI,SAAS;EAC3B,YAAY;EACZ,iBAAiB,EAAE;EACnB,GAAG;EACJ;;;;;;;AAQH,SAAgB,sBACd,KACA,IACgB;AAChB,QAAO,KAAK,IAAI,KAAK,GAAG;;;;;;;;;;;AAY1B,SAAgB,4BACd,QACA,IACgB;CAChB,MAAM,YAAY,KAAK,UAAU;AACjC,KAAI,CAAC,UAAW,QAAO,IAAI;CAE3B,MAAM,WAAW,EAAE,GAAG,WAAW;AAcjC,QAAO,SAAS;AAChB,QAAO,KAAK,IAAI,UAAU,GAAG;;;;;;;;;;;;;;;;AAiB/B,SAAgB,oBAA2C;AACzD,QAAO,KAAK,UAAU,IAAI,sBAAsB;;;;;;;AAQlD,SAAgB,uBAAgC;AAC9C,QAAO,KAAK,UAAU,IAAI"}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* In real Next.js, this sends Core Web Vitals to an analytics endpoint.
|
|
7
7
|
* Apps can use the web-vitals library directly instead.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
type WebVitalsMetric = {
|
|
10
10
|
id: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: number;
|
|
13
13
|
rating?: "good" | "needs-improvement" | "poor";
|
|
14
14
|
delta: number;
|
|
15
15
|
navigationType?: "navigate" | "reload" | "back-forward" | "prerender";
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
type ReportWebVitalsCallback = (metric: WebVitalsMetric) => void;
|
|
18
18
|
/**
|
|
19
19
|
* Register a callback to receive Core Web Vitals metrics.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-vitals.js","names":[],"sources":["../../src/shims/web-vitals.ts"],"sourcesContent":["/**\n * next/web-vitals shim\n *\n * Provides useReportWebVitals() — a no-op hook for compatibility.\n * In real Next.js, this sends Core Web Vitals to an analytics endpoint.\n * Apps can use the web-vitals library directly instead.\n */\n\
|
|
1
|
+
{"version":3,"file":"web-vitals.js","names":[],"sources":["../../src/shims/web-vitals.ts"],"sourcesContent":["/**\n * next/web-vitals shim\n *\n * Provides useReportWebVitals() — a no-op hook for compatibility.\n * In real Next.js, this sends Core Web Vitals to an analytics endpoint.\n * Apps can use the web-vitals library directly instead.\n */\n\ntype WebVitalsMetric = {\n id: string;\n name: string;\n value: number;\n rating?: \"good\" | \"needs-improvement\" | \"poor\";\n delta: number;\n navigationType?: \"navigate\" | \"reload\" | \"back-forward\" | \"prerender\";\n};\n\ntype ReportWebVitalsCallback = (metric: WebVitalsMetric) => void;\n\n/**\n * Register a callback to receive Core Web Vitals metrics.\n * No-op in our implementation — use the `web-vitals` library directly\n * for production metrics collection.\n */\nexport function useReportWebVitals(_callback: ReportWebVitalsCallback): void {\n // No-op — apps should use the web-vitals library directly\n // or their own analytics integration.\n}\n\nexport type { WebVitalsMetric, ReportWebVitalsCallback };\n"],"mappings":";;;;;;AAwBA,SAAgB,mBAAmB,WAA0C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/utils/lazy-chunks.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build-manifest chunk metadata used to compute lazy chunks.
|
|
4
|
+
*/
|
|
5
|
+
type BuildManifestChunk = {
|
|
6
|
+
file: string;
|
|
7
|
+
isEntry?: boolean;
|
|
8
|
+
isDynamicEntry?: boolean;
|
|
9
|
+
imports?: string[];
|
|
10
|
+
dynamicImports?: string[];
|
|
11
|
+
css?: string[];
|
|
12
|
+
assets?: string[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Compute the set of chunk filenames that are ONLY reachable through dynamic
|
|
16
|
+
* imports (i.e. behind React.lazy(), next/dynamic, or manual import()).
|
|
17
|
+
*
|
|
18
|
+
* These chunks should NOT be modulepreloaded in the HTML — they will be
|
|
19
|
+
* fetched on demand when the dynamic import executes.
|
|
20
|
+
*
|
|
21
|
+
* Algorithm: Starting from all entry chunks in the build manifest, walk the
|
|
22
|
+
* static `imports` tree (breadth-first). Any chunk file NOT reached by this
|
|
23
|
+
* walk is only reachable through `dynamicImports` and is therefore "lazy".
|
|
24
|
+
*
|
|
25
|
+
* @param buildManifest - Vite's build manifest (manifest.json), which is a
|
|
26
|
+
* Record<string, ManifestChunk> where each chunk has `file`, `imports`,
|
|
27
|
+
* `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.
|
|
28
|
+
* @returns Array of chunk filenames (e.g. "assets/mermaid-NOHMQCX5.js") that
|
|
29
|
+
* should be excluded from modulepreload hints.
|
|
30
|
+
*/
|
|
31
|
+
declare function computeLazyChunks(buildManifest: Record<string, BuildManifestChunk>): string[];
|
|
32
|
+
//#endregion
|
|
33
|
+
export { BuildManifestChunk, computeLazyChunks };
|
|
34
|
+
//# sourceMappingURL=lazy-chunks.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/utils/lazy-chunks.ts
|
|
2
|
+
/**
|
|
3
|
+
* Compute the set of chunk filenames that are ONLY reachable through dynamic
|
|
4
|
+
* imports (i.e. behind React.lazy(), next/dynamic, or manual import()).
|
|
5
|
+
*
|
|
6
|
+
* These chunks should NOT be modulepreloaded in the HTML — they will be
|
|
7
|
+
* fetched on demand when the dynamic import executes.
|
|
8
|
+
*
|
|
9
|
+
* Algorithm: Starting from all entry chunks in the build manifest, walk the
|
|
10
|
+
* static `imports` tree (breadth-first). Any chunk file NOT reached by this
|
|
11
|
+
* walk is only reachable through `dynamicImports` and is therefore "lazy".
|
|
12
|
+
*
|
|
13
|
+
* @param buildManifest - Vite's build manifest (manifest.json), which is a
|
|
14
|
+
* Record<string, ManifestChunk> where each chunk has `file`, `imports`,
|
|
15
|
+
* `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.
|
|
16
|
+
* @returns Array of chunk filenames (e.g. "assets/mermaid-NOHMQCX5.js") that
|
|
17
|
+
* should be excluded from modulepreload hints.
|
|
18
|
+
*/
|
|
19
|
+
function computeLazyChunks(buildManifest) {
|
|
20
|
+
const eagerFiles = /* @__PURE__ */ new Set();
|
|
21
|
+
const visited = /* @__PURE__ */ new Set();
|
|
22
|
+
const queue = [];
|
|
23
|
+
for (const key of Object.keys(buildManifest)) if (buildManifest[key].isEntry) queue.push(key);
|
|
24
|
+
while (queue.length > 0) {
|
|
25
|
+
const key = queue.shift();
|
|
26
|
+
if (!key || visited.has(key)) continue;
|
|
27
|
+
visited.add(key);
|
|
28
|
+
const chunk = buildManifest[key];
|
|
29
|
+
if (!chunk) continue;
|
|
30
|
+
eagerFiles.add(chunk.file);
|
|
31
|
+
if (chunk.css) for (const cssFile of chunk.css) eagerFiles.add(cssFile);
|
|
32
|
+
if (chunk.imports) {
|
|
33
|
+
for (const imp of chunk.imports) if (!visited.has(imp)) queue.push(imp);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const lazyChunks = [];
|
|
37
|
+
const allFiles = /* @__PURE__ */ new Set();
|
|
38
|
+
for (const key of Object.keys(buildManifest)) {
|
|
39
|
+
const chunk = buildManifest[key];
|
|
40
|
+
if (chunk.file && !allFiles.has(chunk.file)) {
|
|
41
|
+
allFiles.add(chunk.file);
|
|
42
|
+
if (!eagerFiles.has(chunk.file) && chunk.file.endsWith(".js")) lazyChunks.push(chunk.file);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return lazyChunks;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { computeLazyChunks };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=lazy-chunks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-chunks.js","names":[],"sources":["../../src/utils/lazy-chunks.ts"],"sourcesContent":["/**\n * Build-manifest chunk metadata used to compute lazy chunks.\n */\nexport type BuildManifestChunk = {\n file: string;\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n imports?: string[];\n dynamicImports?: string[];\n css?: string[];\n assets?: string[];\n};\n\n/**\n * Compute the set of chunk filenames that are ONLY reachable through dynamic\n * imports (i.e. behind React.lazy(), next/dynamic, or manual import()).\n *\n * These chunks should NOT be modulepreloaded in the HTML — they will be\n * fetched on demand when the dynamic import executes.\n *\n * Algorithm: Starting from all entry chunks in the build manifest, walk the\n * static `imports` tree (breadth-first). Any chunk file NOT reached by this\n * walk is only reachable through `dynamicImports` and is therefore \"lazy\".\n *\n * @param buildManifest - Vite's build manifest (manifest.json), which is a\n * Record<string, ManifestChunk> where each chunk has `file`, `imports`,\n * `dynamicImports`, `isEntry`, and `isDynamicEntry` fields.\n * @returns Array of chunk filenames (e.g. \"assets/mermaid-NOHMQCX5.js\") that\n * should be excluded from modulepreload hints.\n */\nexport function computeLazyChunks(buildManifest: Record<string, BuildManifestChunk>): string[] {\n // Collect all chunk files that are statically reachable from entries\n const eagerFiles = new Set<string>();\n const visited = new Set<string>();\n const queue: string[] = [];\n\n // Start BFS from all entry chunks\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.isEntry) {\n queue.push(key);\n }\n }\n\n while (queue.length > 0) {\n const key = queue.shift();\n if (!key || visited.has(key)) continue;\n visited.add(key);\n\n const chunk = buildManifest[key];\n if (!chunk) continue;\n\n // Mark this chunk's file as eager\n eagerFiles.add(chunk.file);\n\n // Also mark its CSS as eager (CSS should always be preloaded to avoid FOUC)\n if (chunk.css) {\n for (const cssFile of chunk.css) {\n eagerFiles.add(cssFile);\n }\n }\n\n // Follow only static imports — NOT dynamicImports\n if (chunk.imports) {\n for (const imp of chunk.imports) {\n if (!visited.has(imp)) {\n queue.push(imp);\n }\n }\n }\n }\n\n // Any JS file in the manifest that's NOT in eagerFiles is a lazy chunk\n const lazyChunks: string[] = [];\n const allFiles = new Set<string>();\n for (const key of Object.keys(buildManifest)) {\n const chunk = buildManifest[key];\n if (chunk.file && !allFiles.has(chunk.file)) {\n allFiles.add(chunk.file);\n if (!eagerFiles.has(chunk.file) && chunk.file.endsWith(\".js\")) {\n lazyChunks.push(chunk.file);\n }\n }\n }\n\n return lazyChunks;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,SAAgB,kBAAkB,eAA6D;CAE7F,MAAM,6BAAa,IAAI,KAAa;CACpC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,QAAkB,EAAE;AAG1B,MAAK,MAAM,OAAO,OAAO,KAAK,cAAc,CAE1C,KADc,cAAc,KAClB,QACR,OAAM,KAAK,IAAI;AAInB,QAAO,MAAM,SAAS,GAAG;EACvB,MAAM,MAAM,MAAM,OAAO;AACzB,MAAI,CAAC,OAAO,QAAQ,IAAI,IAAI,CAAE;AAC9B,UAAQ,IAAI,IAAI;EAEhB,MAAM,QAAQ,cAAc;AAC5B,MAAI,CAAC,MAAO;AAGZ,aAAW,IAAI,MAAM,KAAK;AAG1B,MAAI,MAAM,IACR,MAAK,MAAM,WAAW,MAAM,IAC1B,YAAW,IAAI,QAAQ;AAK3B,MAAI,MAAM;QACH,MAAM,OAAO,MAAM,QACtB,KAAI,CAAC,QAAQ,IAAI,IAAI,CACnB,OAAM,KAAK,IAAI;;;CAOvB,MAAM,aAAuB,EAAE;CAC/B,MAAM,2BAAW,IAAI,KAAa;AAClC,MAAK,MAAM,OAAO,OAAO,KAAK,cAAc,EAAE;EAC5C,MAAM,QAAQ,cAAc;AAC5B,MAAI,MAAM,QAAQ,CAAC,SAAS,IAAI,MAAM,KAAK,EAAE;AAC3C,YAAS,IAAI,MAAM,KAAK;AACxB,OAAI,CAAC,WAAW,IAAI,MAAM,KAAK,IAAI,MAAM,KAAK,SAAS,MAAM,CAC3D,YAAW,KAAK,MAAM,KAAK;;;AAKjC,QAAO"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/utils/vinext-root.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the root directory of the vinext package at runtime.
|
|
4
|
+
*
|
|
5
|
+
* Both the CLI pre-flight check (`cli.ts`) and the standalone output emitter
|
|
6
|
+
* (`build/standalone.ts`) need to locate vinext's package root so they can
|
|
7
|
+
* verify that `dist/` exists and copy vinext's runtime files into standalone
|
|
8
|
+
* output. Centralising the logic here ensures the two callers stay in sync.
|
|
9
|
+
*
|
|
10
|
+
* The resolution works for both the compiled output layout and for running
|
|
11
|
+
* directly from source:
|
|
12
|
+
*
|
|
13
|
+
* - Compiled layout: this file lives at `dist/utils/vinext-root.js`
|
|
14
|
+
* → two levels up (`../..`) is the package root.
|
|
15
|
+
* - Source layout: this file lives at `src/utils/vinext-root.ts`
|
|
16
|
+
* → two levels up (`../..`) is the package root.
|
|
17
|
+
*
|
|
18
|
+
* If an explicit root is provided (e.g. from a test fixture), it is returned
|
|
19
|
+
* as-is after resolving to an absolute path.
|
|
20
|
+
*/
|
|
21
|
+
declare function resolveVinextPackageRoot(explicitRoot?: string): string;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { resolveVinextPackageRoot };
|
|
24
|
+
//# sourceMappingURL=vinext-root.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
//#region src/utils/vinext-root.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the root directory of the vinext package at runtime.
|
|
6
|
+
*
|
|
7
|
+
* Both the CLI pre-flight check (`cli.ts`) and the standalone output emitter
|
|
8
|
+
* (`build/standalone.ts`) need to locate vinext's package root so they can
|
|
9
|
+
* verify that `dist/` exists and copy vinext's runtime files into standalone
|
|
10
|
+
* output. Centralising the logic here ensures the two callers stay in sync.
|
|
11
|
+
*
|
|
12
|
+
* The resolution works for both the compiled output layout and for running
|
|
13
|
+
* directly from source:
|
|
14
|
+
*
|
|
15
|
+
* - Compiled layout: this file lives at `dist/utils/vinext-root.js`
|
|
16
|
+
* → two levels up (`../..`) is the package root.
|
|
17
|
+
* - Source layout: this file lives at `src/utils/vinext-root.ts`
|
|
18
|
+
* → two levels up (`../..`) is the package root.
|
|
19
|
+
*
|
|
20
|
+
* If an explicit root is provided (e.g. from a test fixture), it is returned
|
|
21
|
+
* as-is after resolving to an absolute path.
|
|
22
|
+
*/
|
|
23
|
+
function resolveVinextPackageRoot(explicitRoot) {
|
|
24
|
+
if (explicitRoot) return path.resolve(explicitRoot);
|
|
25
|
+
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
return path.resolve(currentDir, "..", "..");
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { resolveVinextPackageRoot };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=vinext-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vinext-root.js","names":[],"sources":["../../src/utils/vinext-root.ts"],"sourcesContent":["import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve the root directory of the vinext package at runtime.\n *\n * Both the CLI pre-flight check (`cli.ts`) and the standalone output emitter\n * (`build/standalone.ts`) need to locate vinext's package root so they can\n * verify that `dist/` exists and copy vinext's runtime files into standalone\n * output. Centralising the logic here ensures the two callers stay in sync.\n *\n * The resolution works for both the compiled output layout and for running\n * directly from source:\n *\n * - Compiled layout: this file lives at `dist/utils/vinext-root.js`\n * → two levels up (`../..`) is the package root.\n * - Source layout: this file lives at `src/utils/vinext-root.ts`\n * → two levels up (`../..`) is the package root.\n *\n * If an explicit root is provided (e.g. from a test fixture), it is returned\n * as-is after resolving to an absolute path.\n */\nexport function resolveVinextPackageRoot(explicitRoot?: string): string {\n if (explicitRoot) {\n return path.resolve(explicitRoot);\n }\n const currentDir = path.dirname(fileURLToPath(import.meta.url));\n // src/utils/vinext-root.ts → ../.. → package root\n // dist/utils/vinext-root.js → ../.. → package root\n return path.resolve(currentDir, \"..\", \"..\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,yBAAyB,cAA+B;AACtE,KAAI,aACF,QAAO,KAAK,QAAQ,aAAa;CAEnC,MAAM,aAAa,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAG/D,QAAO,KAAK,QAAQ,YAAY,MAAM,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vinext",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Run Next.js apps on Vite. Drop-in replacement for the next CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"import": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./cache": {
|
|
25
|
+
"types": "./dist/cache.d.ts",
|
|
26
|
+
"import": "./dist/cache.js"
|
|
27
|
+
},
|
|
24
28
|
"./shims/*": {
|
|
25
29
|
"types": "./dist/shims/*.d.ts",
|
|
26
30
|
"import": "./dist/shims/*.js"
|
|
@@ -62,8 +66,8 @@
|
|
|
62
66
|
"@types/node": "^25.2.3",
|
|
63
67
|
"@types/react": "^19.2.14",
|
|
64
68
|
"@types/react-dom": "^19.2.3",
|
|
65
|
-
"@vitejs/plugin-react": "^
|
|
66
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
69
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
70
|
+
"@vitejs/plugin-rsc": "^0.5.21",
|
|
67
71
|
"react-server-dom-webpack": "^19.2.4",
|
|
68
72
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.12",
|
|
69
73
|
"vite-plus": "0.1.12"
|
|
@@ -71,7 +75,7 @@
|
|
|
71
75
|
"peerDependencies": {
|
|
72
76
|
"@mdx-js/rollup": "^3.0.0",
|
|
73
77
|
"@vitejs/plugin-react": "^5.1.4 || ^6.0.0",
|
|
74
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
78
|
+
"@vitejs/plugin-rsc": "^0.5.21",
|
|
75
79
|
"react": ">=19.2.0",
|
|
76
80
|
"react-dom": ">=19.2.0",
|
|
77
81
|
"react-server-dom-webpack": "^19.2.4",
|