@reckona/mreact-router 0.0.196 → 0.0.197
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 +3 -1
- package/dist/boundaries.d.ts +66 -0
- package/dist/boundaries.d.ts.map +1 -0
- package/dist/boundaries.js +168 -0
- package/dist/boundaries.js.map +1 -0
- package/dist/build.d.ts +3 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +18 -1
- package/dist/build.js.map +1 -1
- package/dist/cli-options.d.ts +1 -0
- package/dist/cli-options.d.ts.map +1 -1
- package/dist/cli-options.js +30 -0
- package/dist/cli-options.js.map +1 -1
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -1
- package/dist/client-route-inference.d.ts +1 -1
- package/dist/client-route-inference.d.ts.map +1 -1
- package/dist/client-route-inference.js.map +1 -1
- package/dist/client.d.ts +11 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +411 -22
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/boundaries.ts +285 -0
- package/src/build.ts +25 -1
- package/src/cli-options.ts +36 -1
- package/src/cli.ts +23 -0
- package/src/client-route-inference.ts +3 -0
- package/src/client.ts +647 -40
- package/src/index.ts +24 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from "./build.js";
|
|
2
2
|
export { assetHref, assetPreloadLinks } from "./assets.js";
|
|
3
|
+
export { analyzeAppBoundaries, createBoundaryReport, formatBoundaryReport, formatBoundaryReportJson, } from "./boundaries.js";
|
|
4
|
+
export type { AnalyzeAppBoundariesOptions, BoundaryReport, BoundaryReportComponent, BoundaryReportRoute, BoundaryReportSummary, CreateBoundaryReportInput, CreateBoundaryReportRouteInput, } from "./boundaries.js";
|
|
3
5
|
export { cacheControl, createMemoryRouteCache, revalidatePath } from "./cache.js";
|
|
4
6
|
export { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from "./cookies.js";
|
|
5
7
|
export { defineMessages, detectLocale } from "./i18n.js";
|
|
@@ -92,14 +94,14 @@ export { startDevServer } from "./dev-server.js";
|
|
|
92
94
|
export type { StartDevServerOptions } from "./dev-server.js";
|
|
93
95
|
export { renderAppRequest } from "./render.js";
|
|
94
96
|
export type { AppRouterRenderPreload, AppRouterResponseHook, AppRouterResponseHookContext, RenderAppRequestOptions, } from "./render.js";
|
|
95
|
-
export { parseTraceContext, traceContextFromRequest
|
|
97
|
+
export { parseTraceContext, traceContextFromRequest } from "./trace.js";
|
|
96
98
|
export type { RouterInstrumentation, RouterMiddlewareEndInstrumentationEvent, RouterMiddlewareInstrumentationEvent, RouterRequestEndInstrumentationEvent, RouterRequestInstrumentationEvent, RouterRouteEndInstrumentationEvent, RouterRouteInstrumentationEvent, RouterTraceContext, } from "./trace.js";
|
|
97
99
|
export type { FileSystemPrerenderStoreOptions, KeyValuePrerenderStoreAdapter, KeyValuePrerenderStoreOptions, MemoryPrerenderStoreEntry, MemoryPrerenderStoreOptions, } from "./prerender-store.js";
|
|
98
100
|
export { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from "./prerender-store.js";
|
|
99
101
|
export { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from "./serve.js";
|
|
100
102
|
export type { BuiltAppRuntimePreloadMode, AppRouterPrerenderStore, BuiltAppRuntimePreloadStrategy, RenderBuiltAppRequestOptions, RequestHostPolicy, ResponseSinkStrategy, StartServerOptions, } from "./serve.js";
|
|
101
103
|
export { matchRoute, scanAppRoutes } from "./routes.js";
|
|
102
|
-
export type { CachedClientRouteSource, ClientRouteInferenceCache } from "./client.js";
|
|
104
|
+
export type { CachedClientRouteSource, ClientRouteComponent, ClientRouteComponentClassification, ClientRouteComponentOrigin, ClientRouteInferenceCache, ClientRouteInferenceDiagnostic, } from "./client.js";
|
|
103
105
|
export type { RouteMatcher, ScanAppRoutesOptions } from "./routes.js";
|
|
104
106
|
export type { AppFileConvention } from "./file-conventions.js";
|
|
105
107
|
export type { AppAssetRoute, AppMetadataRoute, AppRoute, MatchedRoute, PageRoute, RouteSegment, ServerRoute, } from "./routes.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,yBAAyB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB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AAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxE,YAAY,EACV,qBAAqB,EACrB,uCAAuC,EACvC,oCAAoC,EACpC,oCAAoC,EACpC,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,+BAA+B,EAC/B,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxF,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxD,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,kCAAkC,EAClC,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,WAAW,GACZ,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from "./build.js";
|
|
2
2
|
export { assetHref, assetPreloadLinks } from "./assets.js";
|
|
3
|
+
export { analyzeAppBoundaries, createBoundaryReport, formatBoundaryReport, formatBoundaryReportJson, } from "./boundaries.js";
|
|
3
4
|
export { cacheControl, createMemoryRouteCache, revalidatePath } from "./cache.js";
|
|
4
5
|
export { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from "./cookies.js";
|
|
5
6
|
export { defineMessages, detectLocale } from "./i18n.js";
|
|
@@ -57,7 +58,7 @@ export async function rotateSession(request, response, store, options = {}) {
|
|
|
57
58
|
export { createFormCsrfToken, formCsrfCookie, formCsrfFieldName, validateFormCsrf, } from "./csrf.js";
|
|
58
59
|
export { startDevServer } from "./dev-server.js";
|
|
59
60
|
export { renderAppRequest } from "./render.js";
|
|
60
|
-
export { parseTraceContext, traceContextFromRequest
|
|
61
|
+
export { parseTraceContext, traceContextFromRequest } from "./trace.js";
|
|
61
62
|
export { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from "./prerender-store.js";
|
|
62
63
|
export { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from "./serve.js";
|
|
63
64
|
export { matchRoute, scanAppRoutes } from "./routes.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,E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O,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAgB,EAChB,KAAkC,EAClC,OAAO,GAAiC,EAAE;IAE1C,OAAO,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAgB,EAChB,QAAkB,EAClB,KAAkC,EAClC,OAAO,GAAiC,EAAE;IAE1C,OAAO,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AA4HD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAwBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAO/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from \"./build.js\";\nexport { assetHref, assetPreloadLinks } from \"./assets.js\";\nexport { cacheControl, createMemoryRouteCache, revalidatePath } from \"./cache.js\";\nexport { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from \"./cookies.js\";\nexport { defineMessages, detectLocale } from \"./i18n.js\";\nexport { defer, isDeferredLoaderData } from \"./deferred.js\";\nexport type { DeferredLoaderData } from \"./deferred.js\";\nexport { definePage } from \"./types.js\";\nexport { Link, linkProps } from \"./link.js\";\nexport type { LinkSerializableAttribute, LinkSinkChild, LinkSinkProps } from \"./link.js\";\nexport { href } from \"./typed-routes.js\";\nexport { parseMultipartStream } from \"./multipart.js\";\nexport type {\n MultipartFixedLengthStream,\n MultipartStreamFieldOptions,\n MultipartStreamParseOptions,\n MultipartStreamPart,\n} from \"./multipart.js\";\nexport { getNavigationState, subscribeNavigationState } from \"./navigation-state.js\";\nexport { getRouterRuntimeCacheStats } from \"./runtime-cache.js\";\nexport type { HttpUpgradeHandler } from \"./upgrade.js\";\nexport {\n cookies,\n headers,\n html,\n isNotFoundError,\n isRedirectError,\n json,\n next,\n notFound,\n parseForm,\n redirect,\n redirect303,\n redirectExternal,\n rewrite,\n textError,\n throwNotFound,\n} from \"./navigation.js\";\nexport type { MiddlewareNext, ParseSchema, RedirectOptions, RequestCookies } from \"./navigation.js\";\nexport { createMemoryPrerenderStore } from \"./prerender-store.js\";\nexport { getServerRuntimeState } from \"./runtime-state.js\";\nimport {\n createMemorySessionStore as createMemorySessionStoreInternal,\n createSession as createSessionInternal,\n destroySession as destroySessionInternal,\n getSession as getSessionInternal,\n rotateSession as rotateSessionInternal,\n} from \"./session.js\";\nimport type {\n MemorySessionStoreOptions as MemorySessionStoreOptionsInternal,\n SessionCookieOptions as SessionCookieOptionsInternal,\n SessionRecord as SessionRecordInternal,\n SessionStore as SessionStoreInternal,\n} from \"./session.js\";\n\n/**\n * Creates a deprecated process-local session store alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport function createMemorySessionStore<TData = unknown>(\n options: MemorySessionStoreOptionsInternal = {},\n): SessionStoreInternal<TData> {\n return createMemorySessionStoreInternal<TData>(options);\n}\n/**\n * Creates a deprecated session record and cookie alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function createSession<TData>(\n response: Response,\n store: SessionStoreInternal<TData>,\n data: TData,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData>> {\n return createSessionInternal(response, store, data, options);\n}\n/**\n * Destroys a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function destroySession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<void> {\n return destroySessionInternal(request, response, store, options);\n}\n/**\n * Reads a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function getSession<TData>(\n request: Request,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return getSessionInternal(request, store, options);\n}\n/**\n * Rotates a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function rotateSession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return rotateSessionInternal(request, response, store, options);\n}\nexport type {\n AwsLambdaArtifactManifest,\n AwsLambdaGeneratedHandlerPreloadMode,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n BuiltPrerenderedRoute,\n BuiltRouteSourceAnalysisSummary,\n BuiltServerModuleArtifact,\n BuiltServerModuleOutput,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type { AppRouterProjectOptions } from \"./config.js\";\nexport type { ServerActionContext } from \"./actions.js\";\nexport type {\n AppRouteHref,\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n DynamicHrefOptions,\n RouteParamsFor,\n RouteSearchParams,\n RouteSearchValue,\n SegmentRouteParam,\n StaticHrefOptions,\n ExtractRouteParams,\n HasRouteParams,\n Simplify,\n} from \"./typed-routes.js\";\nexport type {\n InferLoaderData,\n InferLoaderParams,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n PageComponent,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteLoader,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n} from \"./config.js\";\nexport type {\n AssetHelperOptions,\n AssetLinkDescriptor,\n AssetManifest,\n AssetManifestEntry,\n} from \"./assets.js\";\nexport type {\n AppRouterCache,\n AppRouterCacheEntry,\n CacheControlOptions,\n MemoryRouteCacheOptions,\n RouteCachePolicy,\n} from \"./cache.js\";\nexport type { CookieOptions } from \"./cookies.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\n/** Re-exports link types used by the router root entrypoint. */\nexport type {\n AppRouteDeclarations,\n ConcreteLinkHrefGuard,\n LinkChild,\n LinkHref,\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n RegisteredAppRoutePath,\n LinkScroll,\n LinkTransition,\n TrustedLinkHtml,\n} from \"./link.js\";\n/** Re-exports client navigation state types used by the router root entrypoint. */\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\n/** Configures the deprecated router memory session store alias. */\nexport type { MemorySessionStoreOptions } from \"./session.js\";\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterLogLevel,\n AppRouterRuntime,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { DetectedLocale, LocaleRoutingOptions, MessageTree } from \"./i18n.js\";\nexport {\n createFormCsrfToken,\n formCsrfCookie,\n formCsrfFieldName,\n validateFormCsrf,\n} from \"./csrf.js\";\nexport type {\n AppRouterAllowedServerAction,\n AppRouterServerActionOptions,\n PreparedFormActionReference,\n} from \"./actions.js\";\n/**\n * Configures the deprecated router session cookie alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionCookieOptions } from \"./session.js\";\n/**\n * Stores session data through the deprecated router session record alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionRecord } from \"./session.js\";\n/**\n * Defines session persistence through the deprecated router session store alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionStore } from \"./session.js\";\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\n AppRouterRenderPreload,\n AppRouterResponseHook,\n AppRouterResponseHookContext,\n RenderAppRequestOptions,\n} from \"./render.js\";\nexport {\n parseTraceContext,\n traceContextFromRequest,\n} from \"./trace.js\";\nexport type {\n RouterInstrumentation,\n RouterMiddlewareEndInstrumentationEvent,\n RouterMiddlewareInstrumentationEvent,\n RouterRequestEndInstrumentationEvent,\n RouterRequestInstrumentationEvent,\n RouterRouteEndInstrumentationEvent,\n RouterRouteInstrumentationEvent,\n RouterTraceContext,\n} from \"./trace.js\";\nexport type {\n FileSystemPrerenderStoreOptions,\n KeyValuePrerenderStoreAdapter,\n KeyValuePrerenderStoreOptions,\n MemoryPrerenderStoreEntry,\n MemoryPrerenderStoreOptions,\n} from \"./prerender-store.js\";\nexport { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from \"./prerender-store.js\";\nexport { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from \"./serve.js\";\nexport type {\n BuiltAppRuntimePreloadMode,\n AppRouterPrerenderStore,\n BuiltAppRuntimePreloadStrategy,\n RenderBuiltAppRequestOptions,\n RequestHostPolicy,\n ResponseSinkStrategy,\n StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } from \"./routes.js\";\nexport type { CachedClientRouteSource, ClientRouteInferenceCache } from \"./client.js\";\nexport type { RouteMatcher, ScanAppRoutesOptions } from \"./routes.js\";\nexport type { AppFileConvention } from \"./file-conventions.js\";\nexport type {\n AppAssetRoute,\n AppMetadataRoute,\n AppRoute,\n MatchedRoute,\n PageRoute,\n RouteSegment,\n ServerRoute,\n} from \"./routes.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WA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K,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAgB,EAChB,KAAkC,EAClC,OAAO,GAAiC,EAAE;IAE1C,OAAO,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AACD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAgB,EAChB,QAAkB,EAClB,KAAkC,EAClC,OAAO,GAAiC,EAAE;IAE1C,OAAO,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AA4HD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAwBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAO/C,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAkBxE,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAUxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from \"./build.js\";\nexport { assetHref, assetPreloadLinks } from \"./assets.js\";\nexport {\n analyzeAppBoundaries,\n createBoundaryReport,\n formatBoundaryReport,\n formatBoundaryReportJson,\n} from \"./boundaries.js\";\nexport type {\n AnalyzeAppBoundariesOptions,\n BoundaryReport,\n BoundaryReportComponent,\n BoundaryReportRoute,\n BoundaryReportSummary,\n CreateBoundaryReportInput,\n CreateBoundaryReportRouteInput,\n} from \"./boundaries.js\";\nexport { cacheControl, createMemoryRouteCache, revalidatePath } from \"./cache.js\";\nexport { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from \"./cookies.js\";\nexport { defineMessages, detectLocale } from \"./i18n.js\";\nexport { defer, isDeferredLoaderData } from \"./deferred.js\";\nexport type { DeferredLoaderData } from \"./deferred.js\";\nexport { definePage } from \"./types.js\";\nexport { Link, linkProps } from \"./link.js\";\nexport type { LinkSerializableAttribute, LinkSinkChild, LinkSinkProps } from \"./link.js\";\nexport { href } from \"./typed-routes.js\";\nexport { parseMultipartStream } from \"./multipart.js\";\nexport type {\n MultipartFixedLengthStream,\n MultipartStreamFieldOptions,\n MultipartStreamParseOptions,\n MultipartStreamPart,\n} from \"./multipart.js\";\nexport { getNavigationState, subscribeNavigationState } from \"./navigation-state.js\";\nexport { getRouterRuntimeCacheStats } from \"./runtime-cache.js\";\nexport type { HttpUpgradeHandler } from \"./upgrade.js\";\nexport {\n cookies,\n headers,\n html,\n isNotFoundError,\n isRedirectError,\n json,\n next,\n notFound,\n parseForm,\n redirect,\n redirect303,\n redirectExternal,\n rewrite,\n textError,\n throwNotFound,\n} from \"./navigation.js\";\nexport type { MiddlewareNext, ParseSchema, RedirectOptions, RequestCookies } from \"./navigation.js\";\nexport { createMemoryPrerenderStore } from \"./prerender-store.js\";\nexport { getServerRuntimeState } from \"./runtime-state.js\";\nimport {\n createMemorySessionStore as createMemorySessionStoreInternal,\n createSession as createSessionInternal,\n destroySession as destroySessionInternal,\n getSession as getSessionInternal,\n rotateSession as rotateSessionInternal,\n} from \"./session.js\";\nimport type {\n MemorySessionStoreOptions as MemorySessionStoreOptionsInternal,\n SessionCookieOptions as SessionCookieOptionsInternal,\n SessionRecord as SessionRecordInternal,\n SessionStore as SessionStoreInternal,\n} from \"./session.js\";\n\n/**\n * Creates a deprecated process-local session store alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport function createMemorySessionStore<TData = unknown>(\n options: MemorySessionStoreOptionsInternal = {},\n): SessionStoreInternal<TData> {\n return createMemorySessionStoreInternal<TData>(options);\n}\n/**\n * Creates a deprecated session record and cookie alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function createSession<TData>(\n response: Response,\n store: SessionStoreInternal<TData>,\n data: TData,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData>> {\n return createSessionInternal(response, store, data, options);\n}\n/**\n * Destroys a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function destroySession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<void> {\n return destroySessionInternal(request, response, store, options);\n}\n/**\n * Reads a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function getSession<TData>(\n request: Request,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return getSessionInternal(request, store, options);\n}\n/**\n * Rotates a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport async function rotateSession<TData>(\n request: Request,\n response: Response,\n store: SessionStoreInternal<TData>,\n options: SessionCookieOptionsInternal = {},\n): Promise<SessionRecordInternal<TData> | undefined> {\n return rotateSessionInternal(request, response, store, options);\n}\nexport type {\n AwsLambdaArtifactManifest,\n AwsLambdaGeneratedHandlerPreloadMode,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n BuiltPrerenderedRoute,\n BuiltRouteSourceAnalysisSummary,\n BuiltServerModuleArtifact,\n BuiltServerModuleOutput,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type { AppRouterProjectOptions } from \"./config.js\";\nexport type { ServerActionContext } from \"./actions.js\";\nexport type {\n AppRouteHref,\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n DynamicHrefOptions,\n RouteParamsFor,\n RouteSearchParams,\n RouteSearchValue,\n SegmentRouteParam,\n StaticHrefOptions,\n ExtractRouteParams,\n HasRouteParams,\n Simplify,\n} from \"./typed-routes.js\";\nexport type {\n InferLoaderData,\n InferLoaderParams,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n PageComponent,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteLoader,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientConsoleMethod,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\n AppRouterProductionOptions,\n} from \"./config.js\";\nexport type {\n AssetHelperOptions,\n AssetLinkDescriptor,\n AssetManifest,\n AssetManifestEntry,\n} from \"./assets.js\";\nexport type {\n AppRouterCache,\n AppRouterCacheEntry,\n CacheControlOptions,\n MemoryRouteCacheOptions,\n RouteCachePolicy,\n} from \"./cache.js\";\nexport type { CookieOptions } from \"./cookies.js\";\nexport type { AppRouterImportPolicy } from \"./import-policy.js\";\n/** Re-exports link types used by the router root entrypoint. */\nexport type {\n AppRouteDeclarations,\n ConcreteLinkHrefGuard,\n LinkChild,\n LinkHref,\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n RegisteredAppRoutePath,\n LinkScroll,\n LinkTransition,\n TrustedLinkHtml,\n} from \"./link.js\";\n/** Re-exports client navigation state types used by the router root entrypoint. */\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\n/** Configures the deprecated router memory session store alias. */\nexport type { MemorySessionStoreOptions } from \"./session.js\";\nexport type {\n AppRouterCspInlineNonceWarningLogEvent,\n AppRouterLogError,\n AppRouterLogEvent,\n AppRouterLogger,\n AppRouterLogLevel,\n AppRouterRuntime,\n AppRouterRequestEndLogEvent,\n AppRouterRequestErrorLogEvent,\n AppRouterRenderTimingLogEvent,\n AppRouterRequestStartLogEvent,\n AppRouterRequestTimingLogEvent,\n} from \"./logger.js\";\nexport type { DetectedLocale, LocaleRoutingOptions, MessageTree } from \"./i18n.js\";\nexport {\n createFormCsrfToken,\n formCsrfCookie,\n formCsrfFieldName,\n validateFormCsrf,\n} from \"./csrf.js\";\nexport type {\n AppRouterAllowedServerAction,\n AppRouterServerActionOptions,\n PreparedFormActionReference,\n} from \"./actions.js\";\n/**\n * Configures the deprecated router session cookie alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionCookieOptions } from \"./session.js\";\n/**\n * Stores session data through the deprecated router session record alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionRecord } from \"./session.js\";\n/**\n * Defines session persistence through the deprecated router session store alias.\n *\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type { SessionStore } from \"./session.js\";\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\n AppRouterRenderPreload,\n AppRouterResponseHook,\n AppRouterResponseHookContext,\n RenderAppRequestOptions,\n} from \"./render.js\";\nexport { parseTraceContext, traceContextFromRequest } from \"./trace.js\";\nexport type {\n RouterInstrumentation,\n RouterMiddlewareEndInstrumentationEvent,\n RouterMiddlewareInstrumentationEvent,\n RouterRequestEndInstrumentationEvent,\n RouterRequestInstrumentationEvent,\n RouterRouteEndInstrumentationEvent,\n RouterRouteInstrumentationEvent,\n RouterTraceContext,\n} from \"./trace.js\";\nexport type {\n FileSystemPrerenderStoreOptions,\n KeyValuePrerenderStoreAdapter,\n KeyValuePrerenderStoreOptions,\n MemoryPrerenderStoreEntry,\n MemoryPrerenderStoreOptions,\n} from \"./prerender-store.js\";\nexport { createFileSystemPrerenderStore, createKeyValuePrerenderStore } from \"./prerender-store.js\";\nexport { preloadBuiltAppRuntime, renderBuiltAppRequest, startServer } from \"./serve.js\";\nexport type {\n BuiltAppRuntimePreloadMode,\n AppRouterPrerenderStore,\n BuiltAppRuntimePreloadStrategy,\n RenderBuiltAppRequestOptions,\n RequestHostPolicy,\n ResponseSinkStrategy,\n StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } from \"./routes.js\";\nexport type {\n CachedClientRouteSource,\n ClientRouteComponent,\n ClientRouteComponentClassification,\n ClientRouteComponentOrigin,\n ClientRouteInferenceCache,\n ClientRouteInferenceDiagnostic,\n} from \"./client.js\";\nexport type { RouteMatcher, ScanAppRoutesOptions } from \"./routes.js\";\nexport type { AppFileConvention } from \"./file-conventions.js\";\nexport type {\n AppAssetRoute,\n AppMetadataRoute,\n AppRoute,\n MatchedRoute,\n PageRoute,\n RouteSegment,\n ServerRoute,\n} from \"./routes.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.197",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -111,20 +111,20 @@
|
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@typescript/typescript6": "^6.0.2",
|
|
113
113
|
"esbuild": ">=0.28.1 <0.29",
|
|
114
|
-
"@reckona/mreact": "0.0.
|
|
115
|
-
"@reckona/mreact-compat": "0.0.
|
|
116
|
-
"@reckona/mreact-compiler": "0.0.
|
|
117
|
-
"@reckona/mreact-devtools": "0.0.
|
|
118
|
-
"@reckona/mreact-query": "0.0.
|
|
119
|
-
"@reckona/mreact-reactive-core": "0.0.
|
|
120
|
-
"@reckona/mreact-reactive-dom": "0.0.
|
|
121
|
-
"@reckona/mreact-
|
|
122
|
-
"@reckona/mreact-
|
|
114
|
+
"@reckona/mreact": "0.0.197",
|
|
115
|
+
"@reckona/mreact-compat": "0.0.197",
|
|
116
|
+
"@reckona/mreact-compiler": "0.0.197",
|
|
117
|
+
"@reckona/mreact-devtools": "0.0.197",
|
|
118
|
+
"@reckona/mreact-query": "0.0.197",
|
|
119
|
+
"@reckona/mreact-reactive-core": "0.0.197",
|
|
120
|
+
"@reckona/mreact-reactive-dom": "0.0.197",
|
|
121
|
+
"@reckona/mreact-shared": "0.0.197",
|
|
122
|
+
"@reckona/mreact-server": "0.0.197"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"vite": ">=8.1.4 <9"
|
|
126
126
|
},
|
|
127
127
|
"optionalDependencies": {
|
|
128
|
-
"@reckona/mreact-router-native": "0.0.
|
|
128
|
+
"@reckona/mreact-router-native": "0.0.197"
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { relative, sep } from "node:path";
|
|
3
|
+
import type { UserConfig } from "vite";
|
|
4
|
+
import type {
|
|
5
|
+
ClientRouteComponent,
|
|
6
|
+
ClientRouteComponentClassification,
|
|
7
|
+
ClientRouteComponentOrigin,
|
|
8
|
+
ClientRouteInferenceDiagnostic,
|
|
9
|
+
} from "./client-route-inference.js";
|
|
10
|
+
import {
|
|
11
|
+
createClientRouteInferenceCache,
|
|
12
|
+
inferClientRouteModule,
|
|
13
|
+
} from "./client-route-inference.js";
|
|
14
|
+
import { resolveAppRouterProjectOptions, type AppRouterProjectOptions } from "./config.js";
|
|
15
|
+
import { stripRouteClientSource } from "./route-source.js";
|
|
16
|
+
import { scanAppRoutes } from "./routes.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Describes one statically traced component in a route boundary report.
|
|
20
|
+
*/
|
|
21
|
+
export interface BoundaryReportComponent {
|
|
22
|
+
classification: ClientRouteComponentClassification;
|
|
23
|
+
exportName: string;
|
|
24
|
+
file: string;
|
|
25
|
+
origin: ClientRouteComponentOrigin;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Describes the rendered component boundary graph for one page route.
|
|
30
|
+
*/
|
|
31
|
+
export interface BoundaryReportRoute {
|
|
32
|
+
classification: "client-route" | "server-render";
|
|
33
|
+
components: readonly BoundaryReportComponent[];
|
|
34
|
+
entry: string;
|
|
35
|
+
path: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Counts route and component classifications across a boundary report.
|
|
40
|
+
*/
|
|
41
|
+
export interface BoundaryReportSummary {
|
|
42
|
+
clientBoundaries: number;
|
|
43
|
+
clientRoutes: number;
|
|
44
|
+
serverOnlyComponents: number;
|
|
45
|
+
serverRenderComponents: number;
|
|
46
|
+
serverRenderRoutes: number;
|
|
47
|
+
sharedComponents: number;
|
|
48
|
+
unknownComponents: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Contains a deterministic, versioned snapshot of app-router component boundaries.
|
|
53
|
+
*/
|
|
54
|
+
export interface BoundaryReport {
|
|
55
|
+
diagnostics: readonly ClientRouteInferenceDiagnostic[];
|
|
56
|
+
routes: readonly BoundaryReportRoute[];
|
|
57
|
+
summary: BoundaryReportSummary;
|
|
58
|
+
version: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface CreateBoundaryReportRouteInput {
|
|
62
|
+
components: readonly ClientRouteComponent[];
|
|
63
|
+
diagnostics: readonly ClientRouteInferenceDiagnostic[];
|
|
64
|
+
entry: string;
|
|
65
|
+
path: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CreateBoundaryReportInput {
|
|
69
|
+
projectRoot: string;
|
|
70
|
+
routes: readonly CreateBoundaryReportRouteInput[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Supplies project and Vite settings for standalone boundary analysis.
|
|
75
|
+
*/
|
|
76
|
+
export interface AnalyzeAppBoundariesOptions extends AppRouterProjectOptions {
|
|
77
|
+
viteConfig?: Pick<UserConfig, "define" | "plugins"> | undefined;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Inspects every page route without writing build artifacts or executing application code.
|
|
82
|
+
*/
|
|
83
|
+
export async function analyzeAppBoundaries(
|
|
84
|
+
options: AnalyzeAppBoundariesOptions,
|
|
85
|
+
): Promise<BoundaryReport> {
|
|
86
|
+
const project = resolveAppRouterProjectOptions(options);
|
|
87
|
+
const routes = (await scanAppRoutes({ appDir: project.routesDir })).filter(
|
|
88
|
+
(route) => route.kind === "page",
|
|
89
|
+
);
|
|
90
|
+
const cache = createClientRouteInferenceCache();
|
|
91
|
+
const analyzedRoutes = await Promise.all(
|
|
92
|
+
routes.map(async (route): Promise<CreateBoundaryReportRouteInput> => {
|
|
93
|
+
const source = await readFile(route.file, "utf8");
|
|
94
|
+
const inference = await inferClientRouteModule({
|
|
95
|
+
appDir: project.routesDir,
|
|
96
|
+
cache,
|
|
97
|
+
code: stripRouteClientSource({ code: source, filename: route.file }),
|
|
98
|
+
collectComponents: true,
|
|
99
|
+
filename: route.file,
|
|
100
|
+
routePath: route.path,
|
|
101
|
+
vitePlugins: options.viteConfig?.plugins,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
components: inference.components ?? [],
|
|
106
|
+
diagnostics: inference.diagnostics,
|
|
107
|
+
entry: route.file,
|
|
108
|
+
path: route.path,
|
|
109
|
+
};
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return createBoundaryReport({
|
|
114
|
+
projectRoot: project.projectRoot,
|
|
115
|
+
routes: analyzedRoutes,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function createBoundaryReport(input: CreateBoundaryReportInput): BoundaryReport {
|
|
120
|
+
const routes = input.routes
|
|
121
|
+
.map((route): BoundaryReportRoute => {
|
|
122
|
+
const entry = projectRelativePath(input.projectRoot, route.entry);
|
|
123
|
+
const components = normalizeComponents(input.projectRoot, entry, route.components);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
classification: components.some(
|
|
127
|
+
(component) =>
|
|
128
|
+
component.file === entry &&
|
|
129
|
+
component.exportName === "default" &&
|
|
130
|
+
component.classification === "client-route",
|
|
131
|
+
)
|
|
132
|
+
? "client-route"
|
|
133
|
+
: "server-render",
|
|
134
|
+
components,
|
|
135
|
+
entry,
|
|
136
|
+
path: route.path,
|
|
137
|
+
};
|
|
138
|
+
})
|
|
139
|
+
.sort((left, right) =>
|
|
140
|
+
left.path === right.path
|
|
141
|
+
? left.entry.localeCompare(right.entry)
|
|
142
|
+
: left.path.localeCompare(right.path),
|
|
143
|
+
);
|
|
144
|
+
const diagnostics = input.routes
|
|
145
|
+
.flatMap((route) => route.diagnostics)
|
|
146
|
+
.map((diagnostic) => {
|
|
147
|
+
const filename = projectRelativePath(input.projectRoot, diagnostic.filename);
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
...diagnostic,
|
|
151
|
+
filename,
|
|
152
|
+
message: diagnostic.message.split(diagnostic.filename).join(filename),
|
|
153
|
+
};
|
|
154
|
+
})
|
|
155
|
+
.sort((left, right) =>
|
|
156
|
+
left.filename === right.filename
|
|
157
|
+
? left.code.localeCompare(right.code)
|
|
158
|
+
: left.filename.localeCompare(right.filename),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
diagnostics,
|
|
163
|
+
routes,
|
|
164
|
+
summary: summarizeBoundaryRoutes(routes),
|
|
165
|
+
version: 1,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function formatBoundaryReport(report: BoundaryReport): string {
|
|
170
|
+
const lines = ["Boundaries:"];
|
|
171
|
+
|
|
172
|
+
for (const route of report.routes) {
|
|
173
|
+
lines.push(` ${route.path} [${route.classification}]`);
|
|
174
|
+
|
|
175
|
+
for (const component of route.components) {
|
|
176
|
+
lines.push(
|
|
177
|
+
` ${component.file}#${component.exportName} ${component.classification}${formatComponentOrigin(component.origin)}`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
lines.push("");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (report.diagnostics.length > 0) {
|
|
185
|
+
lines.push("Warnings:");
|
|
186
|
+
for (const diagnostic of report.diagnostics) {
|
|
187
|
+
lines.push(` ${diagnostic.code}: ${diagnostic.message}`);
|
|
188
|
+
}
|
|
189
|
+
lines.push("");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const summary = report.summary;
|
|
193
|
+
lines.push(
|
|
194
|
+
[
|
|
195
|
+
`Summary: ${summary.serverRenderRoutes} ${plural(summary.serverRenderRoutes, "server-render route")}`,
|
|
196
|
+
`${summary.clientRoutes} ${plural(summary.clientRoutes, "client route")}`,
|
|
197
|
+
`${summary.clientBoundaries} ${plural(summary.clientBoundaries, "client boundary")}`,
|
|
198
|
+
`${summary.serverRenderComponents} ${plural(summary.serverRenderComponents, "server-render component")}`,
|
|
199
|
+
`${summary.serverOnlyComponents} ${plural(summary.serverOnlyComponents, "server-only component")}`,
|
|
200
|
+
`${summary.sharedComponents} ${plural(summary.sharedComponents, "shared component")}`,
|
|
201
|
+
`${summary.unknownComponents} ${plural(summary.unknownComponents, "unknown component")}`,
|
|
202
|
+
].join(", "),
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
return `${lines.join("\n")}\n`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function formatBoundaryReportJson(report: BoundaryReport): string {
|
|
209
|
+
return `${JSON.stringify(report, null, 2)}\n`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function normalizeComponents(
|
|
213
|
+
projectRoot: string,
|
|
214
|
+
entry: string,
|
|
215
|
+
components: readonly ClientRouteComponent[],
|
|
216
|
+
): BoundaryReportComponent[] {
|
|
217
|
+
const unique = new Map<string, BoundaryReportComponent>();
|
|
218
|
+
|
|
219
|
+
for (const component of components) {
|
|
220
|
+
const normalized = {
|
|
221
|
+
...component,
|
|
222
|
+
file: projectRelativePath(projectRoot, component.file),
|
|
223
|
+
};
|
|
224
|
+
unique.set(
|
|
225
|
+
`${normalized.file}\0${normalized.exportName}\0${normalized.classification}`,
|
|
226
|
+
normalized,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return Array.from(unique.values()).sort((left, right) => {
|
|
231
|
+
const leftEntry = left.file === entry;
|
|
232
|
+
const rightEntry = right.file === entry;
|
|
233
|
+
|
|
234
|
+
if (leftEntry !== rightEntry) {
|
|
235
|
+
return leftEntry ? -1 : 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return left.file === right.file
|
|
239
|
+
? left.exportName === right.exportName
|
|
240
|
+
? left.classification.localeCompare(right.classification)
|
|
241
|
+
: left.exportName.localeCompare(right.exportName)
|
|
242
|
+
: left.file.localeCompare(right.file);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function summarizeBoundaryRoutes(routes: readonly BoundaryReportRoute[]): BoundaryReportSummary {
|
|
247
|
+
const components = routes.flatMap((route) => route.components);
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
clientBoundaries: countClassification(components, "client-boundary"),
|
|
251
|
+
clientRoutes: routes.filter((route) => route.classification === "client-route").length,
|
|
252
|
+
serverOnlyComponents: countClassification(components, "server-only"),
|
|
253
|
+
serverRenderComponents: countClassification(components, "server-render"),
|
|
254
|
+
serverRenderRoutes: routes.filter((route) => route.classification === "server-render").length,
|
|
255
|
+
sharedComponents: countClassification(components, "shared"),
|
|
256
|
+
unknownComponents: countClassification(components, "unknown"),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function countClassification(
|
|
261
|
+
components: readonly BoundaryReportComponent[],
|
|
262
|
+
classification: ClientRouteComponentClassification,
|
|
263
|
+
): number {
|
|
264
|
+
return components.filter((component) => component.classification === classification).length;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function projectRelativePath(projectRoot: string, file: string): string {
|
|
268
|
+
const value = relative(projectRoot, file).split(sep).join("/");
|
|
269
|
+
return value === "" ? "." : value;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function formatComponentOrigin(origin: ClientRouteComponentOrigin): string {
|
|
273
|
+
if (origin === "use-client-directive") return ' ("use client")';
|
|
274
|
+
if (origin === "use-server-directive") return ' ("use server")';
|
|
275
|
+
if (origin === "client-filename") return " (.client.*)";
|
|
276
|
+
if (origin === "compat-filename") return " (.compat.*)";
|
|
277
|
+
if (origin === "inferred-client-runtime") return " (inferred)";
|
|
278
|
+
if (origin === "server-only-import") return " (server-only import)";
|
|
279
|
+
if (origin === "unresolved-reference") return " (unresolved)";
|
|
280
|
+
return "";
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function plural(count: number, singular: string): string {
|
|
284
|
+
return count === 1 ? singular : `${singular}s`;
|
|
285
|
+
}
|
package/src/build.ts
CHANGED
|
@@ -36,8 +36,11 @@ import {
|
|
|
36
36
|
navigationRuntimeLinkDisabledDiagnostic,
|
|
37
37
|
resolveNavigationRuntime,
|
|
38
38
|
type ClientRouteManifestEntry,
|
|
39
|
+
type ClientRouteComponent,
|
|
40
|
+
type ClientRouteInferenceDiagnostic,
|
|
39
41
|
type ClientRouteInferenceCache,
|
|
40
42
|
} from "./client-route-inference.js";
|
|
43
|
+
import { createBoundaryReport, type BoundaryReport } from "./boundaries.js";
|
|
41
44
|
import {
|
|
42
45
|
buildClientRouteBatchOutput,
|
|
43
46
|
buildNavigationRuntimeBundle,
|
|
@@ -129,6 +132,8 @@ export type AwsLambdaGeneratedHandlerPreloadMode =
|
|
|
129
132
|
export interface BuildAppOptions extends AppRouterProjectOptions {
|
|
130
133
|
awsLambdaPreload?: AwsLambdaGeneratedHandlerPreloadMode | undefined;
|
|
131
134
|
awsLambdaPreloadRoutes?: readonly string[] | undefined;
|
|
135
|
+
/** Receives the full route and component boundary report after source analysis. */
|
|
136
|
+
onBoundaryReport?: ((report: BoundaryReport) => void) | undefined;
|
|
132
137
|
onBuildProgress?: ((event: BuildAppProgressEvent) => void) | undefined;
|
|
133
138
|
onBuildPhaseTiming?: ((timing: BuildAppPhaseTiming) => void) | undefined;
|
|
134
139
|
outDir: string;
|
|
@@ -382,6 +387,8 @@ interface BuildRouteSourceAnalysis extends BuildSourceAnalysis {
|
|
|
382
387
|
clientBoundaryImports: readonly string[];
|
|
383
388
|
clientBoundaryFallbackImports: readonly string[];
|
|
384
389
|
clientRoute: boolean;
|
|
390
|
+
components: readonly ClientRouteComponent[];
|
|
391
|
+
diagnostics: readonly ClientRouteInferenceDiagnostic[];
|
|
385
392
|
file: string;
|
|
386
393
|
route: AppRoute & { kind: "page" };
|
|
387
394
|
routeCode: string;
|
|
@@ -389,6 +396,7 @@ interface BuildRouteSourceAnalysis extends BuildSourceAnalysis {
|
|
|
389
396
|
}
|
|
390
397
|
|
|
391
398
|
interface BuildSourceAnalysisScope {
|
|
399
|
+
boundaryReport: BoundaryReport;
|
|
392
400
|
byFile: ReadonlyMap<string, BuildSourceAnalysis>;
|
|
393
401
|
byRouteFile: ReadonlyMap<string, BuildRouteSourceAnalysis>;
|
|
394
402
|
}
|
|
@@ -485,6 +493,7 @@ async function buildAppWithResolvedProject(
|
|
|
485
493
|
vitePlugins,
|
|
486
494
|
}),
|
|
487
495
|
);
|
|
496
|
+
options.onBoundaryReport?.(sourceAnalysis.boundaryReport);
|
|
488
497
|
|
|
489
498
|
if (shouldTrackBuildPhases === false) {
|
|
490
499
|
await validateProductionRoutes({
|
|
@@ -1347,6 +1356,7 @@ async function analyzeBuildRouteSources(options: {
|
|
|
1347
1356
|
appDir: options.project.routesDir,
|
|
1348
1357
|
cache: options.clientRouteInferenceCache,
|
|
1349
1358
|
code: stripRouteClientSource({ code: source, filename: route.file }),
|
|
1359
|
+
collectComponents: true,
|
|
1350
1360
|
filename: route.file,
|
|
1351
1361
|
routePath: route.path,
|
|
1352
1362
|
vitePlugins: options.vitePlugins,
|
|
@@ -1363,6 +1373,8 @@ async function analyzeBuildRouteSources(options: {
|
|
|
1363
1373
|
clientBoundaryImports: clientInference.clientBoundaryImports,
|
|
1364
1374
|
clientBoundaryFallbackImports: clientInference.clientBoundaryFallbackImports,
|
|
1365
1375
|
clientRoute: clientInference.client,
|
|
1376
|
+
components: clientInference.components ?? [],
|
|
1377
|
+
diagnostics: clientInference.diagnostics,
|
|
1366
1378
|
file,
|
|
1367
1379
|
route,
|
|
1368
1380
|
routeCode,
|
|
@@ -1384,7 +1396,19 @@ async function analyzeBuildRouteSources(options: {
|
|
|
1384
1396
|
}
|
|
1385
1397
|
}
|
|
1386
1398
|
|
|
1387
|
-
return {
|
|
1399
|
+
return {
|
|
1400
|
+
boundaryReport: createBoundaryReport({
|
|
1401
|
+
projectRoot: options.projectRoot,
|
|
1402
|
+
routes: Array.from(byRouteFile.values(), (analysis) => ({
|
|
1403
|
+
components: analysis.components,
|
|
1404
|
+
diagnostics: analysis.diagnostics,
|
|
1405
|
+
entry: analysis.route.file,
|
|
1406
|
+
path: analysis.route.path,
|
|
1407
|
+
})),
|
|
1408
|
+
}),
|
|
1409
|
+
byFile,
|
|
1410
|
+
byRouteFile,
|
|
1411
|
+
};
|
|
1388
1412
|
}
|
|
1389
1413
|
|
|
1390
1414
|
function analyzeBuildSource(source: string, filename: string): BuildSourceAnalysis {
|
package/src/cli-options.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface ParsedCliArguments {
|
|
|
21
21
|
help?: boolean | undefined;
|
|
22
22
|
host?: string | undefined;
|
|
23
23
|
hostPolicy?: RequestHostPolicy | undefined;
|
|
24
|
+
json?: boolean | undefined;
|
|
24
25
|
log?: CliRequestLogMode | undefined;
|
|
25
26
|
out?: string | undefined;
|
|
26
27
|
port?: number | undefined;
|
|
@@ -49,6 +50,14 @@ export function parseCliArguments(argv: readonly string[]): ParsedCliArguments {
|
|
|
49
50
|
continue;
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
if (value === "--json") {
|
|
54
|
+
if (command !== "boundaries") {
|
|
55
|
+
throw new Error("--json is only supported by the boundaries command");
|
|
56
|
+
}
|
|
57
|
+
parsed.json = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
if (value === "--log") {
|
|
53
62
|
parsed.log = parseCliRequestLogMode(readOptionValue(argv, index, "log"));
|
|
54
63
|
index += 1;
|
|
@@ -255,6 +264,29 @@ export function formatCliHelp(command?: string | undefined): string {
|
|
|
255
264
|
].join("\n");
|
|
256
265
|
}
|
|
257
266
|
|
|
267
|
+
if (command === "boundaries") {
|
|
268
|
+
return [
|
|
269
|
+
"Usage: mreact-router boundaries [appDir] [options]",
|
|
270
|
+
"",
|
|
271
|
+
"Inspect server and client component boundaries for every route without building.",
|
|
272
|
+
"",
|
|
273
|
+
"Project resolution:",
|
|
274
|
+
" Without appDir, load the same Vite project configuration as build.",
|
|
275
|
+
" With appDir, inspect that directory directly.",
|
|
276
|
+
"",
|
|
277
|
+
"Classifications:",
|
|
278
|
+
" server-render, client-boundary, client-route, server-only, shared, unknown",
|
|
279
|
+
"",
|
|
280
|
+
"Options:",
|
|
281
|
+
" --json Print a machine-readable versioned report.",
|
|
282
|
+
" -h, --help Show this help message.",
|
|
283
|
+
"",
|
|
284
|
+
"Examples:",
|
|
285
|
+
" mreact-router boundaries",
|
|
286
|
+
" mreact-router boundaries src/app --json",
|
|
287
|
+
].join("\n");
|
|
288
|
+
}
|
|
289
|
+
|
|
258
290
|
if (command === "package") {
|
|
259
291
|
return [
|
|
260
292
|
"Usage: mreact-router package <target> [options]",
|
|
@@ -335,6 +367,7 @@ export function formatCliHelp(command?: string | undefined): string {
|
|
|
335
367
|
"Commands:",
|
|
336
368
|
" dev [appDir] Start the development server.",
|
|
337
369
|
` build [appDir] Build ${defaultTargetLabel} artifacts by default.`,
|
|
370
|
+
" boundaries [appDir] Inspect route and component boundaries.",
|
|
338
371
|
" build --target=aws-lambda Build Lambda artifacts including generated handler and import policy.",
|
|
339
372
|
" start [outDir] Serve built Node output.",
|
|
340
373
|
" package aws-lambda --from .mreact --out .lambda",
|
|
@@ -477,7 +510,9 @@ function parseCliPort(value: string): number {
|
|
|
477
510
|
return port;
|
|
478
511
|
}
|
|
479
512
|
|
|
480
|
-
throw new Error(
|
|
513
|
+
throw new Error(
|
|
514
|
+
`Unsupported port ${JSON.stringify(value)}. Expected an integer from 0 to 65535.`,
|
|
515
|
+
);
|
|
481
516
|
}
|
|
482
517
|
|
|
483
518
|
function parseCliHostPolicy(value: string): RequestHostPolicy {
|
package/src/cli.ts
CHANGED
|
@@ -9,6 +9,11 @@ import {
|
|
|
9
9
|
type BuildAppPhase,
|
|
10
10
|
type BuildAppProgressEvent,
|
|
11
11
|
} from "./build.js";
|
|
12
|
+
import {
|
|
13
|
+
analyzeAppBoundaries,
|
|
14
|
+
formatBoundaryReport,
|
|
15
|
+
formatBoundaryReportJson,
|
|
16
|
+
} from "./boundaries.js";
|
|
12
17
|
import {
|
|
13
18
|
buildTargetsFromCliTarget,
|
|
14
19
|
createCliRequestLogger,
|
|
@@ -70,6 +75,9 @@ if (parsed !== undefined) {
|
|
|
70
75
|
...(parsed.clientSourceMaps === undefined
|
|
71
76
|
? {}
|
|
72
77
|
: { clientSourceMaps: parsed.clientSourceMaps }),
|
|
78
|
+
onBoundaryReport(report) {
|
|
79
|
+
console.log(formatBoundaryReport(report).trimEnd());
|
|
80
|
+
},
|
|
73
81
|
onBuildProgress(event) {
|
|
74
82
|
activeBuildPhase = updateBuildProgressLog(event, activeBuildPhase);
|
|
75
83
|
},
|
|
@@ -90,6 +98,21 @@ if (parsed !== undefined) {
|
|
|
90
98
|
}
|
|
91
99
|
throw error;
|
|
92
100
|
}
|
|
101
|
+
} else if (command === "boundaries") {
|
|
102
|
+
const loaded =
|
|
103
|
+
routeArg === undefined
|
|
104
|
+
? await loadMreactRouterViteConfigDetails({ command: "build", cwd: process.cwd() })
|
|
105
|
+
: { project: { appDir: resolve(routeArg) }, viteConfig: undefined };
|
|
106
|
+
const report = await analyzeAppBoundaries({
|
|
107
|
+
...loaded.project,
|
|
108
|
+
viteConfig: loaded.viteConfig,
|
|
109
|
+
});
|
|
110
|
+
console.log(
|
|
111
|
+
(parsed.json === true
|
|
112
|
+
? formatBoundaryReportJson(report)
|
|
113
|
+
: formatBoundaryReport(report)
|
|
114
|
+
).trimEnd(),
|
|
115
|
+
);
|
|
93
116
|
} else if (command === "package") {
|
|
94
117
|
if (routeArg === "aws-lambda") {
|
|
95
118
|
const manifest = await packageAwsLambdaArtifact({
|