@reckona/mreact-router 0.0.160 → 0.0.161
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/dist/actions.d.ts +6 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js.map +1 -1
- package/dist/adapters/aws-lambda.d.ts +29 -0
- package/dist/adapters/aws-lambda.d.ts.map +1 -1
- package/dist/adapters/aws-lambda.js.map +1 -1
- package/dist/adapters/cloudflare.d.ts +78 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -1
- package/dist/adapters/cloudflare.js.map +1 -1
- package/dist/adapters/edge.d.ts +6 -0
- package/dist/adapters/edge.d.ts.map +1 -1
- package/dist/adapters/edge.js.map +1 -1
- package/dist/adapters/node.d.ts +7 -0
- package/dist/adapters/node.d.ts.map +1 -1
- package/dist/adapters/node.js.map +1 -1
- package/dist/adapters/static.d.ts +6 -0
- package/dist/adapters/static.d.ts.map +1 -1
- package/dist/adapters/static.js.map +1 -1
- package/dist/app-router-globals.d.ts +6 -0
- package/dist/app-router-globals.d.ts.map +1 -1
- package/dist/app-router-globals.js.map +1 -1
- package/dist/assets.d.ts +18 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +6 -0
- package/dist/assets.js.map +1 -1
- package/dist/build.d.ts +30 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +4 -0
- package/dist/build.js.map +1 -1
- package/dist/cache-stats.d.ts +3 -0
- package/dist/cache-stats.d.ts.map +1 -1
- package/dist/cache-stats.js.map +1 -1
- package/dist/cache.d.ts +15 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/cli-options.d.ts.map +1 -1
- package/dist/cli-options.js +2 -0
- package/dist/cli-options.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/cookies.d.ts +3 -0
- package/dist/cookies.d.ts.map +1 -1
- package/dist/cookies.js.map +1 -1
- package/dist/csrf.d.ts +12 -0
- package/dist/csrf.d.ts.map +1 -1
- package/dist/csrf.js +12 -0
- package/dist/csrf.js.map +1 -1
- package/dist/deferred.d.ts +9 -0
- package/dist/deferred.d.ts.map +1 -1
- package/dist/deferred.js +6 -0
- package/dist/deferred.js.map +1 -1
- package/dist/dev-server.d.ts +3 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js.map +1 -1
- package/dist/file-conventions.d.ts +3 -0
- package/dist/file-conventions.d.ts.map +1 -1
- package/dist/file-conventions.js.map +1 -1
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/import-policy.d.ts +3 -0
- package/dist/import-policy.d.ts.map +1 -1
- package/dist/import-policy.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +34 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js.map +1 -1
- package/dist/logger.d.ts +33 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js.map +1 -1
- package/dist/multipart.d.ts +15 -0
- package/dist/multipart.d.ts.map +1 -1
- package/dist/multipart.js +3 -0
- package/dist/multipart.js.map +1 -1
- package/dist/native-escape.d.ts +3 -0
- package/dist/native-escape.d.ts.map +1 -1
- package/dist/native-escape.js +3 -0
- package/dist/native-escape.js.map +1 -1
- package/dist/navigation-state.d.ts +15 -0
- package/dist/navigation-state.d.ts.map +1 -1
- package/dist/navigation-state.js +6 -0
- package/dist/navigation-state.js.map +1 -1
- package/dist/navigation.d.ts +9 -0
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +6 -0
- package/dist/navigation.js.map +1 -1
- package/dist/prerender-store.d.ts +21 -0
- package/dist/prerender-store.d.ts.map +1 -1
- package/dist/prerender-store.js +9 -0
- package/dist/prerender-store.js.map +1 -1
- package/dist/render.d.ts +12 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +3 -0
- package/dist/render.js.map +1 -1
- package/dist/routes.d.ts +30 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +6 -0
- package/dist/routes.js.map +1 -1
- package/dist/runtime-cache.d.ts +4 -0
- package/dist/runtime-cache.d.ts.map +1 -1
- package/dist/runtime-cache.js +3 -0
- package/dist/runtime-cache.js.map +1 -1
- package/dist/runtime-state.d.ts +3 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +3 -0
- package/dist/runtime-state.js.map +1 -1
- package/dist/serve.d.ts +24 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +6 -0
- package/dist/serve.js.map +1 -1
- package/dist/session.d.ts +12 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/stream-list.d.ts +12 -0
- package/dist/stream-list.d.ts.map +1 -1
- package/dist/stream-list.js +3 -0
- package/dist/stream-list.js.map +1 -1
- package/dist/trace.d.ts +30 -0
- package/dist/trace.d.ts.map +1 -1
- package/dist/trace.js +6 -0
- package/dist/trace.js.map +1 -1
- package/dist/typed-routes.d.ts +33 -0
- package/dist/typed-routes.d.ts.map +1 -1
- package/dist/typed-routes.js.map +1 -1
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/upgrade.d.ts +3 -0
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js.map +1 -1
- package/dist/vite.d.ts +21 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +15 -0
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/actions.ts +6 -0
- package/src/adapters/aws-lambda.ts +29 -0
- package/src/adapters/cloudflare.ts +78 -0
- package/src/adapters/edge.ts +6 -0
- package/src/adapters/node.ts +7 -0
- package/src/adapters/static.ts +6 -0
- package/src/app-router-globals.ts +6 -0
- package/src/assets.ts +18 -0
- package/src/build.ts +38 -0
- package/src/cache-stats.ts +3 -0
- package/src/cache.ts +15 -0
- package/src/cli-options.ts +2 -0
- package/src/cli.ts +1 -0
- package/src/config.ts +15 -0
- package/src/cookies.ts +3 -0
- package/src/csrf.ts +12 -0
- package/src/deferred.ts +9 -0
- package/src/dev-server.ts +3 -0
- package/src/file-conventions.ts +3 -0
- package/src/i18n.ts +15 -0
- package/src/import-policy.ts +3 -0
- package/src/index.ts +19 -0
- package/src/link.ts +34 -0
- package/src/logger.ts +33 -0
- package/src/multipart.ts +15 -0
- package/src/native-escape.ts +3 -0
- package/src/navigation-state.ts +15 -0
- package/src/navigation.ts +9 -0
- package/src/prerender-store.ts +21 -0
- package/src/render.ts +12 -0
- package/src/routes.ts +30 -0
- package/src/runtime-cache.ts +5 -0
- package/src/runtime-state.ts +3 -0
- package/src/serve.ts +24 -0
- package/src/session.ts +12 -0
- package/src/stream-list.ts +12 -0
- package/src/trace.ts +30 -0
- package/src/typed-routes.ts +33 -0
- package/src/types.ts +72 -0
- package/src/upgrade.ts +3 -0
- package/src/vite.ts +21 -0
package/dist/index.d.ts
CHANGED
|
@@ -20,22 +20,32 @@ export { getServerRuntimeState } from "./runtime-state.js";
|
|
|
20
20
|
import { createMemorySessionStore as createMemorySessionStoreInternal, createSession as createSessionInternal, destroySession as destroySessionInternal, getSession as getSessionInternal, rotateSession as rotateSessionInternal } from "./session.js";
|
|
21
21
|
import type { MemorySessionStoreOptions as MemorySessionStoreOptionsInternal, SessionCookieOptions as SessionCookieOptionsInternal, SessionRecord as SessionRecordInternal, SessionStore as SessionStoreInternal } from "./session.js";
|
|
22
22
|
/**
|
|
23
|
+
* Creates a deprecated process-local session store alias.
|
|
24
|
+
*
|
|
23
25
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
24
26
|
*/
|
|
25
27
|
export declare const createMemorySessionStore: typeof createMemorySessionStoreInternal;
|
|
26
28
|
/**
|
|
29
|
+
* Creates a deprecated session record and cookie alias.
|
|
30
|
+
*
|
|
27
31
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
28
32
|
*/
|
|
29
33
|
export declare const createSession: typeof createSessionInternal;
|
|
30
34
|
/**
|
|
35
|
+
* Destroys a session through a deprecated router session alias.
|
|
36
|
+
*
|
|
31
37
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
32
38
|
*/
|
|
33
39
|
export declare const destroySession: typeof destroySessionInternal;
|
|
34
40
|
/**
|
|
41
|
+
* Reads a session through a deprecated router session alias.
|
|
42
|
+
*
|
|
35
43
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
36
44
|
*/
|
|
37
45
|
export declare const getSession: typeof getSessionInternal;
|
|
38
46
|
/**
|
|
47
|
+
* Rotates a session through a deprecated router session alias.
|
|
48
|
+
*
|
|
39
49
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
40
50
|
*/
|
|
41
51
|
export declare const rotateSession: typeof rotateSessionInternal;
|
|
@@ -48,23 +58,32 @@ export type { AssetHelperOptions, AssetLinkDescriptor, AssetManifest, AssetManif
|
|
|
48
58
|
export type { AppRouterCache, AppRouterCacheEntry, CacheControlOptions, MemoryRouteCacheOptions, RouteCachePolicy, } from "./cache.js";
|
|
49
59
|
export type { CookieOptions } from "./cookies.js";
|
|
50
60
|
export type { AppRouterImportPolicy } from "./import-policy.js";
|
|
61
|
+
/** Re-exports link types used by the router root entrypoint. */
|
|
51
62
|
export type { AppRouteDeclarations, ConcreteLinkHrefGuard, LinkChild, LinkHref, LinkOptions, LinkPrefetch, LinkProps, RegisteredAppRoutePath, LinkScroll, LinkTransition, TrustedLinkHtml, } from "./link.js";
|
|
63
|
+
/** Re-exports client navigation state types used by the router root entrypoint. */
|
|
52
64
|
export type { AppRouterNavigationState, AppRouterNavigationStateListener, AppRouterNavigationType, } from "./navigation-state.js";
|
|
53
65
|
export type { RouterRuntimeCacheStat } from "./runtime-cache.js";
|
|
66
|
+
/** Configures the deprecated router memory session store alias. */
|
|
54
67
|
export type { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };
|
|
55
68
|
export type { AppRouterCspInlineNonceWarningLogEvent, AppRouterLogError, AppRouterLogEvent, AppRouterLogger, AppRouterLogLevel, AppRouterRuntime, AppRouterRequestEndLogEvent, AppRouterRequestErrorLogEvent, AppRouterRenderTimingLogEvent, AppRouterRequestStartLogEvent, AppRouterRequestTimingLogEvent, } from "./logger.js";
|
|
56
69
|
export type { DetectedLocale, LocaleRoutingOptions, MessageTree } from "./i18n.js";
|
|
57
70
|
export { createFormCsrfToken, formCsrfCookie, formCsrfFieldName, validateFormCsrf, } from "./csrf.js";
|
|
58
71
|
export type { AppRouterAllowedServerAction, AppRouterServerActionOptions, PreparedFormActionReference, } from "./actions.js";
|
|
59
72
|
/**
|
|
73
|
+
* Configures the deprecated router session cookie alias.
|
|
74
|
+
*
|
|
60
75
|
* @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
|
|
61
76
|
*/
|
|
62
77
|
export type SessionCookieOptions = SessionCookieOptionsInternal;
|
|
63
78
|
/**
|
|
79
|
+
* Stores session data through the deprecated router session record alias.
|
|
80
|
+
*
|
|
64
81
|
* @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
|
|
65
82
|
*/
|
|
66
83
|
export type SessionRecord<TData = unknown> = SessionRecordInternal<TData>;
|
|
67
84
|
/**
|
|
85
|
+
* Defines session persistence through the deprecated router session store alias.
|
|
86
|
+
*
|
|
68
87
|
* @deprecated Import session helpers and types from `@reckona/mreact-auth` instead.
|
|
69
88
|
*/
|
|
70
89
|
export type SessionStore<TData = unknown> = SessionStoreInternal<TData>;
|
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,wBAA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BAAuB,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
|
@@ -15,22 +15,32 @@ export { createMemoryPrerenderStore } from "./prerender-store.js";
|
|
|
15
15
|
export { getServerRuntimeState } from "./runtime-state.js";
|
|
16
16
|
import { createMemorySessionStore as createMemorySessionStoreInternal, createSession as createSessionInternal, destroySession as destroySessionInternal, getSession as getSessionInternal, rotateSession as rotateSessionInternal, } from "./session.js";
|
|
17
17
|
/**
|
|
18
|
+
* Creates a deprecated process-local session store alias.
|
|
19
|
+
*
|
|
18
20
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
19
21
|
*/
|
|
20
22
|
export const createMemorySessionStore = createMemorySessionStoreInternal;
|
|
21
23
|
/**
|
|
24
|
+
* Creates a deprecated session record and cookie alias.
|
|
25
|
+
*
|
|
22
26
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
23
27
|
*/
|
|
24
28
|
export const createSession = createSessionInternal;
|
|
25
29
|
/**
|
|
30
|
+
* Destroys a session through a deprecated router session alias.
|
|
31
|
+
*
|
|
26
32
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
27
33
|
*/
|
|
28
34
|
export const destroySession = destroySessionInternal;
|
|
29
35
|
/**
|
|
36
|
+
* Reads a session through a deprecated router session alias.
|
|
37
|
+
*
|
|
30
38
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
31
39
|
*/
|
|
32
40
|
export const getSession = getSessionInternal;
|
|
33
41
|
/**
|
|
42
|
+
* Rotates a session through a deprecated router session alias.
|
|
43
|
+
*
|
|
34
44
|
* @deprecated Import session helpers from `@reckona/mreact-auth` instead.
|
|
35
45
|
*/
|
|
36
46
|
export const rotateSession = rotateSessionInternal;
|
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,EAAE,SAAS,E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E,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 { definePage } from \"./types.js\";\nexport { Link, linkProps } 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 { 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 BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.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 StaticHrefOptions,\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\";\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\";\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 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 * @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.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IAAI,qBAAqB,GACvC,MAAM,cAAc,CAAC;AAQtB;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AACzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AACnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAkHnD,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;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 { definePage } from \"./types.js\";\nexport { Link, linkProps } 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 { 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 * Creates a deprecated process-local session store alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createMemorySessionStore = createMemorySessionStoreInternal;\n/**\n * Creates a deprecated session record and cookie alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const createSession = createSessionInternal;\n/**\n * Destroys a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const destroySession = destroySessionInternal;\n/**\n * Reads a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const getSession = getSessionInternal;\n/**\n * Rotates a session through a deprecated router session alias.\n *\n * @deprecated Import session helpers from `@reckona/mreact-auth` instead.\n */\nexport const rotateSession = rotateSessionInternal;\nexport type {\n AwsLambdaArtifactManifest,\n BuildAppPhase,\n BuildAppPhaseTiming,\n BuildAppOptions,\n BuildAppProgressEvent,\n BuildAppResult,\n BuiltImportPolicyArtifact,\n CloudflarePagesArtifactManifest,\n PackageAwsLambdaArtifactOptions,\n PackageCloudflarePagesArtifactOptions,\n} from \"./build.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 StaticHrefOptions,\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 { MemorySessionStoreOptionsInternal as MemorySessionStoreOptions };\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 = SessionCookieOptionsInternal;\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<TData = unknown> = SessionRecordInternal<TData>;\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<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/dist/link.d.ts
CHANGED
|
@@ -1,21 +1,49 @@
|
|
|
1
1
|
import type { HtmlSink } from "@reckona/mreact-shared/compiler-contract";
|
|
2
2
|
import type { ReactCompatElement, ReactCompatNode } from "@reckona/mreact-compat";
|
|
3
3
|
import type { AppRouteLinkHref } from "./typed-routes.js";
|
|
4
|
+
/** Re-exports typed route href helper types used by Link. */
|
|
4
5
|
export type { AppRouteLinkHref, AppRouteLinkHrefSuffix, AppRouteLinkPathname, AppRouteLinkSegment, AppRouteLinkSegments, } from "./typed-routes.js";
|
|
5
6
|
declare const TRUSTED_LINK_HTML: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Selects when the app router should prefetch a linked route.
|
|
9
|
+
*/
|
|
6
10
|
export type LinkPrefetch = "intent" | "viewport" | "none" | false;
|
|
11
|
+
/**
|
|
12
|
+
* Controls scroll restoration behavior after client navigation.
|
|
13
|
+
*/
|
|
7
14
|
export type LinkScroll = "top" | "preserve";
|
|
15
|
+
/**
|
|
16
|
+
* Controls whether client navigation participates in view transitions.
|
|
17
|
+
*/
|
|
8
18
|
export type LinkTransition = "auto" | "none" | false;
|
|
19
|
+
/**
|
|
20
|
+
* Wraps pre-escaped HTML that can be used as trusted link children.
|
|
21
|
+
*/
|
|
9
22
|
export type TrustedLinkHtml = {
|
|
10
23
|
readonly [TRUSTED_LINK_HTML]: string;
|
|
11
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Represents children accepted by the app-router Link renderer.
|
|
27
|
+
*/
|
|
12
28
|
export type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];
|
|
29
|
+
/**
|
|
30
|
+
* Allows applications to augment statically registered app route paths through `@reckona/mreact-router/link`.
|
|
31
|
+
*/
|
|
13
32
|
export interface AppRouteDeclarations {
|
|
14
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Extracts registered route paths from `AppRouteDeclarations`.
|
|
36
|
+
*/
|
|
15
37
|
export type RegisteredAppRoutePath = AppRouteDeclarations extends {
|
|
16
38
|
readonly path: infer Path;
|
|
17
39
|
} ? Extract<Path, `/${string}`> : never;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the accepted `href` type for app-router links.
|
|
42
|
+
*/
|
|
18
43
|
export type LinkHref = [RegisteredAppRoutePath] extends [never] ? string : AppRouteLinkHref<RegisteredAppRoutePath>;
|
|
44
|
+
/**
|
|
45
|
+
* Configures client navigation behavior for a router link.
|
|
46
|
+
*/
|
|
19
47
|
export interface LinkOptions<Href extends string = LinkHref> {
|
|
20
48
|
href: Href;
|
|
21
49
|
prefetch?: LinkPrefetch | undefined;
|
|
@@ -23,6 +51,9 @@ export interface LinkOptions<Href extends string = LinkHref> {
|
|
|
23
51
|
scroll?: LinkScroll | undefined;
|
|
24
52
|
transition?: LinkTransition | undefined;
|
|
25
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Combines router link options with anchor attributes and children.
|
|
56
|
+
*/
|
|
26
57
|
export interface LinkProps<Href extends string = LinkHref> extends LinkOptions<Href> {
|
|
27
58
|
children?: LinkChild;
|
|
28
59
|
[attribute: string]: unknown;
|
|
@@ -33,6 +64,9 @@ export interface LinkProps<Href extends string = LinkHref> extends LinkOptions<H
|
|
|
33
64
|
* Use this when rendering a custom anchor component that should still opt into mreact prefetch, scroll, reload, or transition behavior.
|
|
34
65
|
*/
|
|
35
66
|
export declare function linkProps(options: LinkOptions<string>): Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Produces a compile-time error shape when a typed Link receives an unresolved route pattern.
|
|
69
|
+
*/
|
|
36
70
|
export type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath] extends [never] ? unknown : Href extends Extract<RegisteredAppRoutePath, `${string}:${string}`> ? {
|
|
37
71
|
readonly __mreactRoutePatternHrefError__: never;
|
|
38
72
|
} : unknown;
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,iBAAiB,eAAuD,CAAC;AAE/E,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC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IAAI;QACd,iBAAiB,IAAI,KAAK;QAC1B,OAAQ,KAAyB,CAAC,iBAAiB,CAAC,KAAK,QAAQ,CAClE,CAAC;AACJ,CAAC","sourcesContent":["import { escapeHtmlAttribute, escapeHtmlText } from \"@reckona/mreact-shared/html-escape\";\nimport type { HtmlSink } from \"@reckona/mreact-shared/compiler-contract\";\nimport type { ReactCompatElement, ReactCompatNode } from \"@reckona/mreact-compat\";\nimport { safeUrlAttributeValue } from \"@reckona/mreact-shared/url-safety\";\nimport type { AppRouteLinkHref } from \"./typed-routes.js\";\nexport type {\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n} from \"./typed-routes.js\";\n\nconst TRUSTED_LINK_HTML = Symbol.for(\"modular.react.router.trusted_link_html\");\n\nexport type LinkPrefetch = \"intent\" | \"viewport\" | \"none\" | false;\nexport type LinkScroll = \"top\" | \"preserve\";\nexport type LinkTransition = \"auto\" | \"none\" | false;\nexport type TrustedLinkHtml = { readonly [TRUSTED_LINK_HTML]: string };\nexport type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];\nexport interface AppRouteDeclarations {}\nexport type RegisteredAppRoutePath = AppRouteDeclarations extends { readonly path: infer Path }\n ? Extract<Path, `/${string}`>\n : never;\nexport type LinkHref = [RegisteredAppRoutePath] extends [never]\n ? string\n : AppRouteLinkHref<RegisteredAppRoutePath>;\n\nexport interface LinkOptions<Href extends string = LinkHref> {\n href: Href;\n prefetch?: LinkPrefetch | undefined;\n reload?: boolean | undefined;\n scroll?: LinkScroll | undefined;\n transition?: LinkTransition | undefined;\n}\n\nexport interface LinkProps<Href extends string = LinkHref> extends LinkOptions<Href> {\n children?: LinkChild;\n [attribute: string]: unknown;\n}\n\n/**\n * Converts router link options into anchor attributes consumed by the client navigation runtime.\n *\n * Use this when rendering a custom anchor component that should still opt into mreact prefetch, scroll, reload, or transition behavior.\n */\nexport function linkProps(options: LinkOptions<string>): Record<string, string> {\n return {\n href: options.href,\n ...(options.prefetch === undefined || options.prefetch === \"intent\"\n ? {}\n : { \"data-mreact-prefetch\": options.prefetch === false ? \"none\" : options.prefetch }),\n ...(options.reload === true ? { \"data-mreact-reload\": \"true\" } : {}),\n ...(options.scroll === undefined || options.scroll === \"top\"\n ? {}\n : { \"data-mreact-scroll\": options.scroll }),\n ...(options.transition === undefined || options.transition === false || options.transition === \"none\"\n ? {}\n : { \"data-mreact-transition\": options.transition }),\n };\n}\n\nexport type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath] extends [never]\n ? unknown\n : Href extends Extract<RegisteredAppRoutePath, `${string}:${string}`>\n ? { readonly __mreactRoutePatternHrefError__: never }\n : unknown;\n\n/**\n * Renders an app-router anchor with typed `href` support and navigation runtime attributes.\n *\n * In JSX it returns an anchor element compatible with the mreact runtime; during server streaming it can also write directly to an `HtmlSink`. Unsafe URL attribute values are dropped during rendering.\n */\nexport function Link<const Href extends LinkHref>(\n props: LinkProps<Href> & ConcreteLinkHrefGuard<Href>,\n): ReactCompatElement;\nexport function Link(sink: HtmlSink, props: LinkProps<string>): void;\nexport function Link(\n sinkOrProps: HtmlSink | LinkProps<string>,\n maybeProps?: LinkProps<string>,\n): ReactCompatElement | string | HTMLAnchorElement | void {\n if (maybeProps !== undefined) {\n (sinkOrProps as HtmlSink).append(renderLinkString(maybeProps));\n return;\n }\n\n return renderLink(sinkOrProps as LinkProps);\n}\n\n(Link as typeof Link & { trustedHtml(html: string): TrustedLinkHtml }).trustedHtml = (\n html: string,\n): TrustedLinkHtml => ({\n [TRUSTED_LINK_HTML]: html,\n});\n\nfunction renderLink(props: LinkProps<string>): string | HTMLAnchorElement {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n const propsWithLinkAttrs = {\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n };\n\n if (typeof document !== \"undefined\" && typeof document.createElement === \"function\") {\n return createAnchorElement(propsWithLinkAttrs);\n }\n\n return renderAnchorString(propsWithLinkAttrs);\n}\n\nfunction renderLinkString(props: LinkProps<string>): string {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n\n return renderAnchorString({\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n });\n}\n\nfunction createAnchorElement(props: Record<string, unknown>): HTMLAnchorElement {\n const anchor = document.createElement(\"a\");\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") {\n appendLinkChild(anchor, value as LinkChild);\n continue;\n }\n\n if (!shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const safeValue = safeUrlAttributeValue(attrName, String(value));\n\n if (safeValue === undefined) {\n continue;\n }\n\n anchor.setAttribute(attrName, safeValue);\n }\n\n return anchor;\n}\n\nfunction appendLinkChild(parent: Node, child: LinkChild): void {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return;\n }\n\n if (Array.isArray(child)) {\n for (const item of child) {\n appendLinkChild(parent, item);\n }\n return;\n }\n\n if (child instanceof Node) {\n parent.appendChild(child);\n return;\n }\n\n parent.appendChild(document.createTextNode(String(child)));\n}\n\nfunction renderAnchorString(props: Record<string, unknown>): string {\n return `<a${renderAnchorAttributes(props)}>${renderChildren(props.children as LinkChild)}</a>`;\n}\n\nfunction renderAnchorAttributes(props: Record<string, unknown>): string {\n const attrs: string[] = [];\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\" || !shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const attrValue = String(value);\n const safeValue = safeUrlAttributeValue(attrName, attrValue);\n\n if (safeValue === undefined) {\n continue;\n }\n\n attrs.push(`${escapeHtmlAttribute(attrName)}=\"${escapeHtmlAttribute(safeValue)}\"`);\n }\n\n return attrs.length === 0 ? \"\" : ` ${attrs.join(\" \")}`;\n}\n\nfunction shouldSetAttribute(name: string, value: unknown): boolean {\n return (\n name !== \"key\" &&\n name !== \"ref\" &&\n value !== null &&\n value !== undefined &&\n value !== false &&\n typeof value !== \"function\" &&\n typeof value !== \"symbol\"\n );\n}\n\nfunction attributeName(name: string): string {\n return name === \"className\" ? \"class\" : name;\n}\n\nfunction renderChildren(child: LinkChild): string {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return \"\";\n }\n\n if (Array.isArray(child)) {\n return child.map(renderChildren).join(\"\");\n }\n\n if (isTrustedLinkHtml(child)) {\n return child[TRUSTED_LINK_HTML];\n }\n\n return escapeHtmlText(child);\n}\n\nfunction isTrustedLinkHtml(value: unknown): value is TrustedLinkHtml {\n return (\n typeof value === \"object\" &&\n value !== null &&\n TRUSTED_LINK_HTML in value &&\n typeof (value as TrustedLinkHtml)[TRUSTED_LINK_HTML] === \"string\"\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAW1E,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AA0D/E;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,OAA4B;IACpD,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;YACjE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,sBAAsB,EAAE,OAAO,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvF,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,OAAO,CAAC,MAA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ute, escapeHtmlText } from \"@reckona/mreact-shared/html-escape\";\nimport type { HtmlSink } from \"@reckona/mreact-shared/compiler-contract\";\nimport type { ReactCompatElement, ReactCompatNode } from \"@reckona/mreact-compat\";\nimport { safeUrlAttributeValue } from \"@reckona/mreact-shared/url-safety\";\nimport type { AppRouteLinkHref } from \"./typed-routes.js\";\n/** Re-exports typed route href helper types used by Link. */\nexport type {\n AppRouteLinkHref,\n AppRouteLinkHrefSuffix,\n AppRouteLinkPathname,\n AppRouteLinkSegment,\n AppRouteLinkSegments,\n} from \"./typed-routes.js\";\n\nconst TRUSTED_LINK_HTML = Symbol.for(\"modular.react.router.trusted_link_html\");\n\n/**\n * Selects when the app router should prefetch a linked route.\n */\nexport type LinkPrefetch = \"intent\" | \"viewport\" | \"none\" | false;\n/**\n * Controls scroll restoration behavior after client navigation.\n */\nexport type LinkScroll = \"top\" | \"preserve\";\n/**\n * Controls whether client navigation participates in view transitions.\n */\nexport type LinkTransition = \"auto\" | \"none\" | false;\n/**\n * Wraps pre-escaped HTML that can be used as trusted link children.\n */\nexport type TrustedLinkHtml = { readonly [TRUSTED_LINK_HTML]: string };\n/**\n * Represents children accepted by the app-router Link renderer.\n */\nexport type LinkChild = ReactCompatNode | Node | TrustedLinkHtml | readonly LinkChild[];\n/**\n * Allows applications to augment statically registered app route paths through `@reckona/mreact-router/link`.\n */\nexport interface AppRouteDeclarations {}\n/**\n * Extracts registered route paths from `AppRouteDeclarations`.\n */\nexport type RegisteredAppRoutePath = AppRouteDeclarations extends { readonly path: infer Path }\n ? Extract<Path, `/${string}`>\n : never;\n/**\n * Resolves the accepted `href` type for app-router links.\n */\nexport type LinkHref = [RegisteredAppRoutePath] extends [never]\n ? string\n : AppRouteLinkHref<RegisteredAppRoutePath>;\n\n/**\n * Configures client navigation behavior for a router link.\n */\nexport interface LinkOptions<Href extends string = LinkHref> {\n href: Href;\n prefetch?: LinkPrefetch | undefined;\n reload?: boolean | undefined;\n scroll?: LinkScroll | undefined;\n transition?: LinkTransition | undefined;\n}\n\n/**\n * Combines router link options with anchor attributes and children.\n */\nexport interface LinkProps<Href extends string = LinkHref> extends LinkOptions<Href> {\n children?: LinkChild;\n [attribute: string]: unknown;\n}\n\n/**\n * Converts router link options into anchor attributes consumed by the client navigation runtime.\n *\n * Use this when rendering a custom anchor component that should still opt into mreact prefetch, scroll, reload, or transition behavior.\n */\nexport function linkProps(options: LinkOptions<string>): Record<string, string> {\n return {\n href: options.href,\n ...(options.prefetch === undefined || options.prefetch === \"intent\"\n ? {}\n : { \"data-mreact-prefetch\": options.prefetch === false ? \"none\" : options.prefetch }),\n ...(options.reload === true ? { \"data-mreact-reload\": \"true\" } : {}),\n ...(options.scroll === undefined || options.scroll === \"top\"\n ? {}\n : { \"data-mreact-scroll\": options.scroll }),\n ...(options.transition === undefined || options.transition === false || options.transition === \"none\"\n ? {}\n : { \"data-mreact-transition\": options.transition }),\n };\n}\n\n/**\n * Produces a compile-time error shape when a typed Link receives an unresolved route pattern.\n */\nexport type ConcreteLinkHrefGuard<Href extends string> = [RegisteredAppRoutePath] extends [never]\n ? unknown\n : Href extends Extract<RegisteredAppRoutePath, `${string}:${string}`>\n ? { readonly __mreactRoutePatternHrefError__: never }\n : unknown;\n\n/**\n * Renders an app-router anchor with typed `href` support and navigation runtime attributes.\n *\n * In JSX it returns an anchor element compatible with the mreact runtime; during server streaming it can also write directly to an `HtmlSink`. Unsafe URL attribute values are dropped during rendering.\n */\nexport function Link<const Href extends LinkHref>(\n props: LinkProps<Href> & ConcreteLinkHrefGuard<Href>,\n): ReactCompatElement;\nexport function Link(sink: HtmlSink, props: LinkProps<string>): void;\nexport function Link(\n sinkOrProps: HtmlSink | LinkProps<string>,\n maybeProps?: LinkProps<string>,\n): ReactCompatElement | string | HTMLAnchorElement | void {\n if (maybeProps !== undefined) {\n (sinkOrProps as HtmlSink).append(renderLinkString(maybeProps));\n return;\n }\n\n return renderLink(sinkOrProps as LinkProps);\n}\n\n(Link as typeof Link & { trustedHtml(html: string): TrustedLinkHtml }).trustedHtml = (\n html: string,\n): TrustedLinkHtml => ({\n [TRUSTED_LINK_HTML]: html,\n});\n\nfunction renderLink(props: LinkProps<string>): string | HTMLAnchorElement {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n const propsWithLinkAttrs = {\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n };\n\n if (typeof document !== \"undefined\" && typeof document.createElement === \"function\") {\n return createAnchorElement(propsWithLinkAttrs);\n }\n\n return renderAnchorString(propsWithLinkAttrs);\n}\n\nfunction renderLinkString(props: LinkProps<string>): string {\n const { href, prefetch, reload, scroll, transition, ...rest } = props;\n\n return renderAnchorString({\n ...rest,\n ...linkProps({ href, prefetch, reload, scroll, transition }),\n });\n}\n\nfunction createAnchorElement(props: Record<string, unknown>): HTMLAnchorElement {\n const anchor = document.createElement(\"a\");\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\") {\n appendLinkChild(anchor, value as LinkChild);\n continue;\n }\n\n if (!shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const safeValue = safeUrlAttributeValue(attrName, String(value));\n\n if (safeValue === undefined) {\n continue;\n }\n\n anchor.setAttribute(attrName, safeValue);\n }\n\n return anchor;\n}\n\nfunction appendLinkChild(parent: Node, child: LinkChild): void {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return;\n }\n\n if (Array.isArray(child)) {\n for (const item of child) {\n appendLinkChild(parent, item);\n }\n return;\n }\n\n if (child instanceof Node) {\n parent.appendChild(child);\n return;\n }\n\n parent.appendChild(document.createTextNode(String(child)));\n}\n\nfunction renderAnchorString(props: Record<string, unknown>): string {\n return `<a${renderAnchorAttributes(props)}>${renderChildren(props.children as LinkChild)}</a>`;\n}\n\nfunction renderAnchorAttributes(props: Record<string, unknown>): string {\n const attrs: string[] = [];\n\n for (const [name, value] of Object.entries(props)) {\n if (name === \"children\" || !shouldSetAttribute(name, value)) {\n continue;\n }\n\n const attrName = attributeName(name);\n const attrValue = String(value);\n const safeValue = safeUrlAttributeValue(attrName, attrValue);\n\n if (safeValue === undefined) {\n continue;\n }\n\n attrs.push(`${escapeHtmlAttribute(attrName)}=\"${escapeHtmlAttribute(safeValue)}\"`);\n }\n\n return attrs.length === 0 ? \"\" : ` ${attrs.join(\" \")}`;\n}\n\nfunction shouldSetAttribute(name: string, value: unknown): boolean {\n return (\n name !== \"key\" &&\n name !== \"ref\" &&\n value !== null &&\n value !== undefined &&\n value !== false &&\n typeof value !== \"function\" &&\n typeof value !== \"symbol\"\n );\n}\n\nfunction attributeName(name: string): string {\n return name === \"className\" ? \"class\" : name;\n}\n\nfunction renderChildren(child: LinkChild): string {\n if (child === null || child === undefined || typeof child === \"boolean\") {\n return \"\";\n }\n\n if (Array.isArray(child)) {\n return child.map(renderChildren).join(\"\");\n }\n\n if (isTrustedLinkHtml(child)) {\n return child[TRUSTED_LINK_HTML];\n }\n\n return escapeHtmlText(child);\n}\n\nfunction isTrustedLinkHtml(value: unknown): value is TrustedLinkHtml {\n return (\n typeof value === \"object\" &&\n value !== null &&\n TRUSTED_LINK_HTML in value &&\n typeof (value as TrustedLinkHtml)[TRUSTED_LINK_HTML] === \"string\"\n );\n}\n"]}
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the severity channel used for app-router structured logs.
|
|
3
|
+
*/
|
|
1
4
|
export type AppRouterLogLevel = "debug" | "info" | "warn" | "error";
|
|
5
|
+
/**
|
|
6
|
+
* Names the runtime that handled an app-router request.
|
|
7
|
+
*/
|
|
2
8
|
export type AppRouterRuntime = "aws-lambda" | "cloudflare" | "edge" | "node";
|
|
9
|
+
/**
|
|
10
|
+
* Receives structured app-router log events by severity.
|
|
11
|
+
*/
|
|
3
12
|
export interface AppRouterLogger {
|
|
4
13
|
debug?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;
|
|
5
14
|
error?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;
|
|
6
15
|
info?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;
|
|
7
16
|
warn?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;
|
|
8
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents every structured log event emitted by the app router.
|
|
20
|
+
*/
|
|
9
21
|
export type AppRouterLogEvent = AppRouterRequestStartLogEvent | AppRouterRequestEndLogEvent | AppRouterRequestErrorLogEvent | AppRouterRequestTimingLogEvent | AppRouterRenderTimingLogEvent | AppRouterCspInlineNonceWarningLogEvent;
|
|
22
|
+
/**
|
|
23
|
+
* Logs the start of an app-router request.
|
|
24
|
+
*/
|
|
10
25
|
export interface AppRouterRequestStartLogEvent {
|
|
11
26
|
method: string;
|
|
12
27
|
path: string;
|
|
13
28
|
runtime: AppRouterRuntime;
|
|
14
29
|
type: "router:request:start";
|
|
15
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Logs the successful completion of an app-router request.
|
|
33
|
+
*/
|
|
16
34
|
export interface AppRouterRequestEndLogEvent {
|
|
17
35
|
durationMs: number;
|
|
18
36
|
method: string;
|
|
@@ -21,6 +39,9 @@ export interface AppRouterRequestEndLogEvent {
|
|
|
21
39
|
status: number;
|
|
22
40
|
type: "router:request:end";
|
|
23
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Logs a request that ended with an app-router error response.
|
|
44
|
+
*/
|
|
24
45
|
export interface AppRouterRequestErrorLogEvent {
|
|
25
46
|
durationMs: number;
|
|
26
47
|
error: AppRouterLogError;
|
|
@@ -29,6 +50,9 @@ export interface AppRouterRequestErrorLogEvent {
|
|
|
29
50
|
runtime: AppRouterRuntime;
|
|
30
51
|
type: "router:request:error";
|
|
31
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Logs per-phase timings for a complete app-router request.
|
|
55
|
+
*/
|
|
32
56
|
export interface AppRouterRequestTimingLogEvent {
|
|
33
57
|
durationMs: number;
|
|
34
58
|
method: string;
|
|
@@ -38,6 +62,9 @@ export interface AppRouterRequestTimingLogEvent {
|
|
|
38
62
|
status: number;
|
|
39
63
|
type: "router:request:timing";
|
|
40
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Logs per-phase timings for route rendering.
|
|
67
|
+
*/
|
|
41
68
|
export interface AppRouterRenderTimingLogEvent {
|
|
42
69
|
method: string;
|
|
43
70
|
path: string;
|
|
@@ -45,12 +72,18 @@ export interface AppRouterRenderTimingLogEvent {
|
|
|
45
72
|
status: number;
|
|
46
73
|
type: "router:render:timing";
|
|
47
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Logs an inline CSP nonce warning emitted while rendering a route.
|
|
77
|
+
*/
|
|
48
78
|
export interface AppRouterCspInlineNonceWarningLogEvent {
|
|
49
79
|
directive: "script-src" | "style-src";
|
|
50
80
|
path: string;
|
|
51
81
|
tag: "script" | "style";
|
|
52
82
|
type: "router:csp:inline-nonce-warning";
|
|
53
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Serializes an error for app-router structured logs.
|
|
86
|
+
*/
|
|
54
87
|
export interface AppRouterLogError {
|
|
55
88
|
message: string;
|
|
56
89
|
name: string;
|
package/dist/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE7E,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACzE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,C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ACxB,KAAK,EAAE,iBAAiB,GACvB,IAAI,CAkBN;AAWD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,GACxB,sBAAsB,CAMxB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU/D;AAED,wBAAgB,MAAM,IAAI,MAAM,CAE/B;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAY1D"}
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAiHA,MAAM,UAAU,aAAa,CAC3B,MAAmC,EACnC,KAAwB,EACxB,KAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,cAAc,CAAC,GAAG,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAE3B,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;QACzE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,CAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAgB,EAChB,OAAyB;IAEzB,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ;QACnC,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAuB;IACrD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;QACpC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC,QAAQ,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO;KACd,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Names the severity channel used for app-router structured logs.\n */\nexport type AppRouterLogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\n/**\n * Names the runtime that handled an app-router request.\n */\nexport type AppRouterRuntime = \"aws-lambda\" | \"cloudflare\" | \"edge\" | \"node\";\n\n/**\n * Receives structured app-router log events by severity.\n */\nexport interface AppRouterLogger {\n debug?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;\n error?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;\n info?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;\n warn?: ((event: AppRouterLogEvent) => void | Promise<void>) | undefined;\n}\n\n/**\n * Represents every structured log event emitted by the app router.\n */\nexport type AppRouterLogEvent =\n | AppRouterRequestStartLogEvent\n | AppRouterRequestEndLogEvent\n | AppRouterRequestErrorLogEvent\n | AppRouterRequestTimingLogEvent\n | AppRouterRenderTimingLogEvent\n | AppRouterCspInlineNonceWarningLogEvent;\n\n/**\n * Logs the start of an app-router request.\n */\nexport interface AppRouterRequestStartLogEvent {\n method: string;\n path: string;\n runtime: AppRouterRuntime;\n type: \"router:request:start\";\n}\n\n/**\n * Logs the successful completion of an app-router request.\n */\nexport interface AppRouterRequestEndLogEvent {\n durationMs: number;\n method: string;\n path: string;\n runtime: AppRouterRuntime;\n status: number;\n type: \"router:request:end\";\n}\n\n/**\n * Logs a request that ended with an app-router error response.\n */\nexport interface AppRouterRequestErrorLogEvent {\n durationMs: number;\n error: AppRouterLogError;\n method: string;\n path: string;\n runtime: AppRouterRuntime;\n type: \"router:request:error\";\n}\n\n/**\n * Logs per-phase timings for a complete app-router request.\n */\nexport interface AppRouterRequestTimingLogEvent {\n durationMs: number;\n method: string;\n path: string;\n phases: Record<string, number>;\n runtime: AppRouterRuntime;\n status: number;\n type: \"router:request:timing\";\n}\n\n/**\n * Logs per-phase timings for route rendering.\n */\nexport interface AppRouterRenderTimingLogEvent {\n method: string;\n path: string;\n phases: Record<string, number>;\n status: number;\n type: \"router:render:timing\";\n}\n\n/**\n * Logs an inline CSP nonce warning emitted while rendering a route.\n */\nexport interface AppRouterCspInlineNonceWarningLogEvent {\n directive: \"script-src\" | \"style-src\";\n path: string;\n tag: \"script\" | \"style\";\n type: \"router:csp:inline-nonce-warning\";\n}\n\n/**\n * Serializes an error for app-router structured logs.\n */\nexport interface AppRouterLogError {\n message: string;\n name: string;\n}\n\nexport interface RouterRequestLogFields {\n method: string;\n path: string;\n runtime: AppRouterRuntime;\n}\n\nexport function emitRouterLog(\n logger: AppRouterLogger | undefined,\n level: AppRouterLogLevel,\n event: AppRouterLogEvent,\n): void {\n const sink = logger?.[level];\n\n if (sink === undefined) {\n return;\n }\n\n queueMicrotask(() => {\n try {\n const result = sink(event);\n\n if (isPromiseLike(result)) {\n result.catch(() => {});\n }\n } catch {\n // Logger sinks are best-effort and must never affect request handling.\n }\n });\n}\n\nfunction isPromiseLike(value: unknown): value is Promise<void> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"catch\" in value &&\n typeof value.catch === \"function\"\n );\n}\n\nexport function requestLogFields(\n request: Request,\n runtime: AppRouterRuntime,\n): RouterRequestLogFields {\n return {\n method: request.method,\n path: new URL(request.url).pathname,\n runtime,\n };\n}\n\nexport function nodeRequestPath(url: string | undefined): string {\n if (url === undefined || url === \"\") {\n return \"/\";\n }\n\n try {\n return new URL(url, \"http://mreact.local\").pathname;\n } catch {\n return \"/\";\n }\n}\n\nexport function logNow(): number {\n return performance.now();\n}\n\nexport function logDurationMs(startedAt: number): number {\n return Math.max(0, Math.round((logNow() - startedAt) * 1000) / 1000);\n}\n\nexport function logError(error: unknown): AppRouterLogError {\n if (error instanceof Error) {\n return {\n message: error.message,\n name: error.name,\n };\n }\n\n return {\n message: String(error),\n name: \"Error\",\n };\n}\n"]}
|
package/dist/multipart.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configures multipart stream parsing limits and field handling.
|
|
3
|
+
*/
|
|
1
4
|
export interface MultipartStreamParseOptions {
|
|
2
5
|
fields?: Readonly<Record<string, MultipartStreamFieldOptions>>;
|
|
3
6
|
maxParts?: number;
|
|
4
7
|
maxBytes?: number;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Configures parsing behavior for a named multipart field.
|
|
11
|
+
*/
|
|
6
12
|
export interface MultipartStreamFieldOptions {
|
|
7
13
|
type?: "stream" | "text";
|
|
8
14
|
maxBytes?: number;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents one parsed multipart field or file part.
|
|
18
|
+
*/
|
|
10
19
|
export interface MultipartStreamPart {
|
|
11
20
|
name: string;
|
|
12
21
|
filename?: string;
|
|
@@ -18,12 +27,18 @@ export interface MultipartStreamPart {
|
|
|
18
27
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
19
28
|
fixedLengthStream(length?: number | bigint): MultipartFixedLengthStream;
|
|
20
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Couples a readable multipart part stream with a completion signal.
|
|
32
|
+
*/
|
|
21
33
|
export interface MultipartFixedLengthStream {
|
|
22
34
|
readable: ReadableStream<Uint8Array<ArrayBufferLike>>;
|
|
23
35
|
done: Promise<void>;
|
|
24
36
|
}
|
|
25
37
|
export declare const defaultMultipartMaxBytes: number;
|
|
26
38
|
export declare const defaultMultipartMaxParts = 1000;
|
|
39
|
+
/**
|
|
40
|
+
* Parses a multipart request body as an async iterable of streamable parts.
|
|
41
|
+
*/
|
|
27
42
|
export declare function parseMultipartStream(request: Request, options?: MultipartStreamParseOptions): AsyncIterable<MultipartStreamPart>;
|
|
28
43
|
export declare function sanitizeMultipartFilename(filename: string): string;
|
|
29
44
|
//# sourceMappingURL=multipart.d.ts.map
|
package/dist/multipart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../src/multipart.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;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1024;
|
|
5
5
|
export const defaultMultipartMaxParts = 1_000;
|
|
6
|
+
/**
|
|
7
|
+
* Parses a multipart request body as an async iterable of streamable parts.
|
|
8
|
+
*/
|
|
6
9
|
export function parseMultipartStream(request, options = {}) {
|
|
7
10
|
return {
|
|
8
11
|
[Symbol.asyncIterator]() {
|