@reckona/mreact-router 0.0.74 → 0.0.76

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChE,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,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,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,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,eAAe,EACf,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,OAAO,EACP,SAAS,GACV,MAAM,iBAAiB,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AA4B,EAC5B,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,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,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,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxD,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,4 +1,4 @@
1
- export { buildApp, packageAwsLambdaArtifact } from "./build.js";
1
+ export { buildApp, packageAwsLambdaArtifact, packageCloudflarePagesArtifact } from "./build.js";
2
2
  export { assetHref, assetPreloadLinks } from "./assets.js";
3
3
  export { cacheControl, createMemoryRouteCache, revalidatePath } from "./cache.js";
4
4
  export { deleteCookie, parseCookieHeader, serializeCookie, setCookie } from "./cookies.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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aAAa,GAAG,qBAAqB,CAAC;AACnD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC7C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAgFnD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAkBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASxF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { buildApp, packageAwsLambdaArtifact } 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 { Link, linkProps } from \"./link.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} from \"./navigation.js\";\nexport type { ParseSchema } 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 * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppOptions,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n PackageAwsLambdaArtifactOptions,\n} from \"./build.js\";\nexport type {\n InferLoaderData,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\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\";\nexport type {\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n LinkScroll,\n LinkTransition,\n} from \"./link.js\";\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\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 * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionStore<TData = unknown> = SessionStoreInternal<TData>;\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\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 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 StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } 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,EAAE,YAAY,EAAE,sBAAsB,E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H,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAkFnD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAkBnB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAiBpB,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASxF,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 { Link, linkProps } from \"./link.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} from \"./navigation.js\";\nexport type { ParseSchema } 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 * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppOptions,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.js\";\nexport type {\n InferLoaderData,\n LayoutProps,\n LoaderContext,\n GenerateMetadataContext,\n ManifestContext,\n ManifestDescriptor,\n MetadataImage,\n MetadataScalar,\n MetadataThemeColor,\n MetadataViewport,\n MReactNode,\n PageProps,\n RobotsContext,\n RobotsManifest,\n RobotsRule,\n RouteHeadDescriptor,\n RouteHandlerContext,\n RouteMetadata,\n RouteParams,\n RouteSecurityHeaders,\n RouteStrictTransportSecurity,\n SitemapContext,\n SitemapEntry,\n} from \"./types.js\";\nexport type {\n AppRouterBuildTarget,\n AppRouterClientSourceMapMode,\n AppRouterClientSourceMapOption,\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\";\nexport type {\n LinkOptions,\n LinkPrefetch,\n LinkProps,\n LinkScroll,\n LinkTransition,\n} from \"./link.js\";\nexport type {\n AppRouterNavigationState,\n AppRouterNavigationStateListener,\n AppRouterNavigationType,\n} from \"./navigation-state.js\";\nexport type { RouterRuntimeCacheStat } from \"./runtime-cache.js\";\nexport type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\nexport type {\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 * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionCookieOptions = SessionCookieOptionsInternal;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;\n/**\n * @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.\n */\nexport type SessionStore<TData = unknown> = SessionStoreInternal<TData>;\nexport { startDevServer } from \"./dev-server.js\";\nexport type { StartDevServerOptions } from \"./dev-server.js\";\nexport { renderAppRequest } from \"./render.js\";\nexport type {\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 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 StartServerOptions,\n} from \"./serve.js\";\nexport { matchRoute, scanAppRoutes } 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.74",
3
+ "version": "0.0.76",
4
4
  "description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
5
5
  "keywords": [
6
6
  "jsx",
@@ -105,20 +105,20 @@
105
105
  },
106
106
  "dependencies": {
107
107
  "typescript": "^6.0.3",
108
- "@reckona/mreact": "0.0.74",
109
- "@reckona/mreact-compat": "0.0.74",
110
- "@reckona/mreact-devtools": "0.0.74",
111
- "@reckona/mreact-query": "0.0.74",
112
- "@reckona/mreact-compiler": "0.0.74",
113
- "@reckona/mreact-reactive-core": "0.0.74",
114
- "@reckona/mreact-reactive-dom": "0.0.74",
115
- "@reckona/mreact-server": "0.0.74",
116
- "@reckona/mreact-shared": "0.0.74"
108
+ "@reckona/mreact": "0.0.76",
109
+ "@reckona/mreact-compat": "0.0.76",
110
+ "@reckona/mreact-compiler": "0.0.76",
111
+ "@reckona/mreact-devtools": "0.0.76",
112
+ "@reckona/mreact-reactive-core": "0.0.76",
113
+ "@reckona/mreact-query": "0.0.76",
114
+ "@reckona/mreact-reactive-dom": "0.0.76",
115
+ "@reckona/mreact-server": "0.0.76",
116
+ "@reckona/mreact-shared": "0.0.76"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "vite": ">=8 <9"
120
120
  },
121
121
  "optionalDependencies": {
122
- "@reckona/mreact-router-native": "0.0.74"
122
+ "@reckona/mreact-router-native": "0.0.76"
123
123
  }
124
124
  }
package/src/build.ts CHANGED
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import type { Dirent } from "node:fs";
3
3
  import { copyFile, cp, mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { builtinModules } from "node:module";
5
- import { dirname, join, relative, sep } from "node:path";
5
+ import { dirname, join, relative, resolve, sep } from "node:path";
6
6
  import {
7
7
  collectStaticImportReferences,
8
8
  collectTopLevelValueExportNames,
@@ -100,11 +100,24 @@ export interface AwsLambdaArtifactManifest {
100
100
  version: 1;
101
101
  }
102
102
 
103
+ export interface CloudflarePagesArtifactManifest {
104
+ files: Array<{ bytes: number; path: string }>;
105
+ runtime: "cloudflare-pages";
106
+ totalBytes: number;
107
+ version: 1;
108
+ worker: "_worker.js";
109
+ }
110
+
103
111
  export interface PackageAwsLambdaArtifactOptions {
104
112
  fromDir: string;
105
113
  outDir: string;
106
114
  }
107
115
 
116
+ export interface PackageCloudflarePagesArtifactOptions {
117
+ fromDir: string;
118
+ outDir: string;
119
+ }
120
+
108
121
  export interface BuiltServerManifest {
109
122
  allowedSourceDirs?: readonly string[];
110
123
  assetBaseUrl?: string;
@@ -230,7 +243,7 @@ export async function buildApp(options: BuildAppOptions): Promise<BuildAppResult
230
243
  routes,
231
244
  vitePlugins,
232
245
  });
233
- const generatedImportPolicy = buildGeneratedImportPolicy({
246
+ const generatedImportPolicy = await buildGeneratedImportPolicy({
234
247
  files,
235
248
  projectRoot: project.projectRoot,
236
249
  routes,
@@ -485,22 +498,28 @@ const frameworkRuntimePackages = new Set([
485
498
  "@reckona/mreact-router",
486
499
  "@reckona/mreact-server",
487
500
  ]);
501
+ const maxRuntimePackageManifestReads = 1000;
488
502
 
489
- function buildGeneratedImportPolicy(options: {
503
+ async function buildGeneratedImportPolicy(options: {
490
504
  files: Record<string, string>;
491
505
  projectRoot: string;
492
506
  routes: readonly AppRoute[];
493
507
  routesDir: string;
494
- }): BuiltImportPolicyArtifact {
508
+ }): Promise<BuiltImportPolicyArtifact> {
495
509
  const routePackages = new Map<string, string[]>();
496
510
  const allPackages = new Set<string>();
497
511
  const relativeRoutesDir = relative(options.projectRoot, options.routesDir);
512
+ const packageJsonLookupCache = new Map<
513
+ string,
514
+ Promise<(RuntimePackageManifest & { packageJsonPath: string }) | undefined>
515
+ >();
498
516
 
499
517
  for (const route of options.routes) {
500
518
  const file = relative(options.projectRoot, route.file);
501
- const packages = collectRuntimePackagesForFile({
519
+ const packages = await collectRuntimePackagesForFile({
502
520
  file,
503
521
  files: options.files,
522
+ packageJsonLookupCache,
504
523
  projectRoot: options.projectRoot,
505
524
  seen: new Set(),
506
525
  });
@@ -518,9 +537,10 @@ function buildGeneratedImportPolicy(options: {
518
537
  .find((file) => options.files[file] !== undefined);
519
538
 
520
539
  if (middlewareFile !== undefined) {
521
- const packages = collectRuntimePackagesForFile({
540
+ const packages = await collectRuntimePackagesForFile({
522
541
  file: middlewareFile,
523
542
  files: options.files,
543
+ packageJsonLookupCache,
524
544
  projectRoot: options.projectRoot,
525
545
  seen: new Set(),
526
546
  });
@@ -542,12 +562,13 @@ function buildGeneratedImportPolicy(options: {
542
562
  };
543
563
  }
544
564
 
545
- function collectRuntimePackagesForFile(options: {
565
+ async function collectRuntimePackagesForFile(options: {
546
566
  file: string;
547
567
  files: Record<string, string>;
568
+ packageJsonLookupCache: RuntimePackageManifestCache;
548
569
  projectRoot: string;
549
570
  seen: Set<string>;
550
- }): string[] {
571
+ }): Promise<string[]> {
551
572
  if (options.seen.has(options.file)) {
552
573
  return [];
553
574
  }
@@ -572,7 +593,15 @@ function collectRuntimePackagesForFile(options: {
572
593
  filename: join(options.projectRoot, options.file),
573
594
  })) {
574
595
  if (isRuntimePackageSpecifier(reference.source)) {
575
- packages.add(runtimePackageNameForSpecifier(reference.source));
596
+ const packageName = runtimePackageNameForSpecifier(reference.source);
597
+ packages.add(packageName);
598
+ for (const optionalPackageName of await collectRuntimeOptionalPackages({
599
+ packageJsonLookupCache: options.packageJsonLookupCache,
600
+ packageName,
601
+ projectRoot: options.projectRoot,
602
+ })) {
603
+ packages.add(optionalPackageName);
604
+ }
576
605
  continue;
577
606
  }
578
607
 
@@ -581,7 +610,7 @@ function collectRuntimePackagesForFile(options: {
581
610
  continue;
582
611
  }
583
612
 
584
- for (const packageName of collectRuntimePackagesForFile({
613
+ for (const packageName of await collectRuntimePackagesForFile({
585
614
  ...options,
586
615
  file: localFile,
587
616
  })) {
@@ -594,13 +623,140 @@ function collectRuntimePackagesForFile(options: {
594
623
  return [...packages].sort();
595
624
  }
596
625
 
626
+ interface RuntimePackageManifest {
627
+ dependencies?: Record<string, unknown> | undefined;
628
+ optionalDependencies?: Record<string, unknown> | undefined;
629
+ }
630
+
631
+ type RuntimePackageManifestCache = Map<
632
+ string,
633
+ Promise<(RuntimePackageManifest & { packageJsonPath: string }) | undefined>
634
+ >;
635
+
636
+ async function collectRuntimeOptionalPackages(options: {
637
+ packageJsonLookupCache: RuntimePackageManifestCache;
638
+ packageName: string;
639
+ projectRoot: string;
640
+ }): Promise<string[]> {
641
+ const optionalPackages = new Set<string>();
642
+ const seenPackageJson = new Set<string>();
643
+ const queue: Array<{ packageName: string; optional: boolean; startDir: string }> = [
644
+ { packageName: options.packageName, optional: false, startDir: options.projectRoot },
645
+ ];
646
+
647
+ for (let index = 0; index < queue.length && seenPackageJson.size < maxRuntimePackageManifestReads; index += 1) {
648
+ const item = queue[index];
649
+ if (item === undefined || !isValidRuntimePackageName(item.packageName)) {
650
+ continue;
651
+ }
652
+
653
+ const manifest = await readRuntimePackageManifest({
654
+ cache: options.packageJsonLookupCache,
655
+ packageName: item.packageName,
656
+ startDir: item.startDir,
657
+ });
658
+
659
+ if (manifest === undefined || seenPackageJson.has(manifest.packageJsonPath)) {
660
+ continue;
661
+ }
662
+
663
+ seenPackageJson.add(manifest.packageJsonPath);
664
+ if (item.optional && isRuntimePackageName(item.packageName)) {
665
+ optionalPackages.add(item.packageName);
666
+ }
667
+
668
+ const packageDir = dirname(manifest.packageJsonPath);
669
+ for (const dependencyName of Object.keys(manifest.dependencies ?? {})) {
670
+ if (isValidRuntimePackageName(dependencyName)) {
671
+ queue.push({ packageName: dependencyName, optional: false, startDir: packageDir });
672
+ }
673
+ }
674
+
675
+ for (const optionalDependencyName of Object.keys(manifest.optionalDependencies ?? {})) {
676
+ if (isValidRuntimePackageName(optionalDependencyName)) {
677
+ queue.push({ packageName: optionalDependencyName, optional: true, startDir: packageDir });
678
+ }
679
+ }
680
+ }
681
+
682
+ return [...optionalPackages].sort();
683
+ }
684
+
685
+ async function readRuntimePackageManifest(options: {
686
+ cache: RuntimePackageManifestCache;
687
+ packageName: string;
688
+ startDir: string;
689
+ }): Promise<(RuntimePackageManifest & { packageJsonPath: string }) | undefined> {
690
+ const key = `${options.startDir}\0${options.packageName}`;
691
+ const cached = options.cache.get(key);
692
+ const manifest =
693
+ cached ??
694
+ findRuntimePackageJson(options.packageName, options.startDir).then(async (packageJsonPath) => {
695
+ if (packageJsonPath === undefined) {
696
+ return undefined;
697
+ }
698
+
699
+ try {
700
+ const json = JSON.parse(await readFile(packageJsonPath, "utf8")) as RuntimePackageManifest;
701
+ return { ...json, packageJsonPath };
702
+ } catch {
703
+ return undefined;
704
+ }
705
+ });
706
+
707
+ if (cached === undefined) {
708
+ options.cache.set(key, manifest);
709
+ }
710
+
711
+ return (await manifest) as (RuntimePackageManifest & { packageJsonPath: string }) | undefined;
712
+ }
713
+
714
+ async function findRuntimePackageJson(
715
+ packageName: string,
716
+ startDir: string,
717
+ ): Promise<string | undefined> {
718
+ if (!isValidRuntimePackageName(packageName)) {
719
+ return undefined;
720
+ }
721
+
722
+ let current = startDir;
723
+
724
+ while (true) {
725
+ const candidate = join(current, "node_modules", ...packageName.split("/"), "package.json");
726
+ try {
727
+ if ((await stat(candidate)).isFile()) {
728
+ return candidate;
729
+ }
730
+ } catch {
731
+ // Keep walking toward the filesystem root.
732
+ }
733
+
734
+ const parent = dirname(current);
735
+ if (parent === current) {
736
+ return undefined;
737
+ }
738
+ current = parent;
739
+ }
740
+ }
741
+
597
742
  function isRuntimePackageSpecifier(specifier: string): boolean {
598
743
  if (specifier.startsWith(".") || specifier.startsWith("/") || /^[A-Za-z][A-Za-z0-9+.-]*:/.test(specifier)) {
599
744
  return false;
600
745
  }
601
746
 
602
747
  const packageName = runtimePackageNameForSpecifier(specifier);
603
- return !nodeBuiltinPackages.has(specifier) && !frameworkRuntimePackages.has(packageName);
748
+ return !nodeBuiltinPackages.has(specifier) && isRuntimePackageName(packageName);
749
+ }
750
+
751
+ function isRuntimePackageName(packageName: string): boolean {
752
+ return !frameworkRuntimePackages.has(packageName);
753
+ }
754
+
755
+ function isValidRuntimePackageName(packageName: string): boolean {
756
+ return (
757
+ /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/u.test(packageName) &&
758
+ !packageName.includes("..")
759
+ );
604
760
  }
605
761
 
606
762
  function runtimePackageNameForSpecifier(specifier: string): string {
@@ -2330,6 +2486,10 @@ function cloudflareWorkspaceRuntimePlugin(): RouterCompatPlugin {
2330
2486
  ["@reckona/mreact-compat/scheduler", packageFile("react-compat", "@reckona/mreact-compat", "scheduler")],
2331
2487
  ["@reckona/mreact-query", packageFile("query", "@reckona/mreact-query", "index")],
2332
2488
  ["@reckona/mreact-reactive-core", packageFile("reactive-core", "@reckona/mreact-reactive-core", "index")],
2489
+ [
2490
+ "@reckona/mreact-router/adapters/cloudflare",
2491
+ packageFile("router", "@reckona/mreact-router", "adapters/cloudflare"),
2492
+ ],
2333
2493
  ["@reckona/mreact-router/link", routerLinkPath],
2334
2494
  ["@reckona/mreact-router/runtime-state", routerRuntimeStatePath],
2335
2495
  ["@reckona/mreact-router/session", packageFile("router", "@reckona/mreact-router", "session")],
@@ -2770,7 +2930,7 @@ export async function packageAwsLambdaArtifact(
2770
2930
  });
2771
2931
  await writeFile(join(options.outDir, "mreact-handler.mjs"), awsLambdaHandlerSource(".mreact"));
2772
2932
 
2773
- const files = await collectAwsLambdaArtifactFiles(options.outDir, "");
2933
+ const files = await collectArtifactFiles(options.outDir, "");
2774
2934
  const manifest = {
2775
2935
  files,
2776
2936
  handler: "mreact-handler.handler",
@@ -2787,6 +2947,63 @@ export async function packageAwsLambdaArtifact(
2787
2947
  return manifest;
2788
2948
  }
2789
2949
 
2950
+ export async function packageCloudflarePagesArtifact(
2951
+ options: PackageCloudflarePagesArtifactOptions,
2952
+ ): Promise<CloudflarePagesArtifactManifest> {
2953
+ const clientManifestPath = join(options.fromDir, "client", "manifest.json");
2954
+ const workerPath = join(options.fromDir, "cloudflare", "worker.mjs");
2955
+
2956
+ await assertRequiredBuildFile(clientManifestPath);
2957
+ await assertRequiredBuildFile(workerPath);
2958
+ await assertRequiredBuildFile(join(options.fromDir, "cloudflare", "route-modules.mjs"));
2959
+ assertPackageOutputDoesNotReplaceBuildOutput(options);
2960
+
2961
+ const clientManifest = JSON.parse(await readFile(clientManifestPath, "utf8")) as {
2962
+ publicAssets?: readonly string[] | undefined;
2963
+ };
2964
+
2965
+ await rm(options.outDir, { force: true, recursive: true });
2966
+ await mkdir(options.outDir, { recursive: true });
2967
+ await cp(join(options.fromDir, "client"), join(options.outDir, "_mreact", "client"), {
2968
+ force: true,
2969
+ recursive: true,
2970
+ });
2971
+ await copyCloudflarePagesPublicAssets({
2972
+ clientDir: join(options.fromDir, "client"),
2973
+ outDir: options.outDir,
2974
+ publicAssets: clientManifest.publicAssets ?? [],
2975
+ });
2976
+
2977
+ const bundledWorker = await bundleRouterModule({
2978
+ code: await readFile(workerPath, "utf8"),
2979
+ filename: workerPath,
2980
+ minify: true,
2981
+ modulePreload: false,
2982
+ outfile: "_worker.js",
2983
+ platform: "browser",
2984
+ plugins: [cloudflareWorkspaceRuntimePlugin()],
2985
+ preserveExports: true,
2986
+ target: "es2022",
2987
+ });
2988
+ await writeFile(join(options.outDir, "_worker.js"), bundledWorker.code);
2989
+
2990
+ const files = await collectArtifactFiles(options.outDir, "");
2991
+ const manifest = {
2992
+ files,
2993
+ runtime: "cloudflare-pages",
2994
+ totalBytes: files.reduce((total, file) => total + file.bytes, 0),
2995
+ version: 1,
2996
+ worker: "_worker.js",
2997
+ } satisfies CloudflarePagesArtifactManifest;
2998
+
2999
+ await writeFile(
3000
+ join(options.outDir, "mreact-cloudflare-pages-artifact.json"),
3001
+ JSON.stringify(manifest, null, 2),
3002
+ );
3003
+
3004
+ return manifest;
3005
+ }
3006
+
2790
3007
  async function assertRequiredBuildFile(path: string): Promise<void> {
2791
3008
  try {
2792
3009
  const info = await stat(path);
@@ -2800,6 +3017,31 @@ async function assertRequiredBuildFile(path: string): Promise<void> {
2800
3017
  throw new Error(`Missing required mreact build artifact: ${path}`);
2801
3018
  }
2802
3019
 
3020
+ function assertPackageOutputDoesNotReplaceBuildOutput(options: {
3021
+ fromDir: string;
3022
+ outDir: string;
3023
+ }): void {
3024
+ if (resolve(options.fromDir) === resolve(options.outDir)) {
3025
+ throw new Error("Package output directory must be different from the mreact build output directory.");
3026
+ }
3027
+ }
3028
+
3029
+ async function copyCloudflarePagesPublicAssets(options: {
3030
+ clientDir: string;
3031
+ outDir: string;
3032
+ publicAssets: readonly string[];
3033
+ }): Promise<void> {
3034
+ for (const asset of options.publicAssets) {
3035
+ if (!asset.startsWith("/") || asset.startsWith("//") || asset.includes("..")) {
3036
+ continue;
3037
+ }
3038
+
3039
+ const relativeAsset = asset.slice(1);
3040
+ await mkdir(dirname(join(options.outDir, relativeAsset)), { recursive: true });
3041
+ await copyFile(join(options.clientDir, relativeAsset), join(options.outDir, relativeAsset));
3042
+ }
3043
+ }
3044
+
2803
3045
  async function copyAwsLambdaProjectMetadata(options: {
2804
3046
  fromDir: string;
2805
3047
  outDir: string;
@@ -2822,7 +3064,7 @@ async function copyAwsLambdaProjectMetadata(options: {
2822
3064
  }
2823
3065
  }
2824
3066
 
2825
- async function collectAwsLambdaArtifactFiles(
3067
+ async function collectArtifactFiles(
2826
3068
  rootDir: string,
2827
3069
  relativeDir: string,
2828
3070
  ): Promise<Array<{ bytes: number; path: string }>> {
@@ -2834,7 +3076,7 @@ async function collectAwsLambdaArtifactFiles(
2834
3076
  const absolutePath = join(rootDir, relativePath);
2835
3077
 
2836
3078
  if (entry.isDirectory()) {
2837
- files.push(...(await collectAwsLambdaArtifactFiles(rootDir, relativePath)));
3079
+ files.push(...(await collectArtifactFiles(rootDir, relativePath)));
2838
3080
  continue;
2839
3081
  }
2840
3082
 
@@ -14,6 +14,7 @@ export interface RouterBundleOptions {
14
14
  define?: Record<string, string> | undefined;
15
15
  filename: string;
16
16
  minify?: boolean | undefined;
17
+ modulePreload?: boolean | undefined;
17
18
  outfile?: string | undefined;
18
19
  platform: "browser" | "node";
19
20
  preserveExports?: boolean | undefined;
@@ -157,6 +158,7 @@ export async function bundleRouterModule(options: RouterBundleOptions): Promise<
157
158
  }
158
159
  : false,
159
160
  minify: options.minify === true,
161
+ modulePreload: options.modulePreload ?? true,
160
162
  sourcemap: options.sourceMap === true,
161
163
  ssr: options.platform === "node",
162
164
  target: options.target ?? "es2022",