@quilted/quilt 0.5.135 → 0.5.137
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/CHANGELOG.md +18 -0
- package/build/cjs/App.cjs +4 -9
- package/build/cjs/index.cjs +46 -4
- package/build/cjs/server/ServerContext.cjs +6 -4
- package/build/cjs/server/index.cjs +30 -7
- package/build/cjs/server/preload.cjs +37 -0
- package/build/cjs/server/request-router.cjs +75 -54
- package/build/cjs/static/StaticContext.cjs +6 -4
- package/build/cjs/static/index.cjs +29 -42
- package/build/cjs/static/render.cjs +8 -2
- package/build/esm/App.mjs +5 -10
- package/build/esm/index.mjs +4 -2
- package/build/esm/server/ServerContext.mjs +3 -1
- package/build/esm/server/index.mjs +3 -1
- package/build/esm/server/preload.mjs +35 -0
- package/build/esm/server/request-router.mjs +57 -36
- package/build/esm/static/StaticContext.mjs +3 -1
- package/build/esm/static/index.mjs +24 -37
- package/build/esm/static/render.mjs +6 -0
- package/build/esnext/App.esnext +5 -10
- package/build/esnext/index.esnext +4 -2
- package/build/esnext/server/ServerContext.esnext +3 -1
- package/build/esnext/server/index.esnext +3 -1
- package/build/esnext/server/preload.esnext +35 -0
- package/build/esnext/server/request-router.esnext +57 -36
- package/build/esnext/static/StaticContext.esnext +3 -1
- package/build/esnext/static/index.esnext +24 -37
- package/build/esnext/static/render.esnext +6 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/App.d.ts.map +1 -1
- package/build/typescript/assets.d.ts +7 -0
- package/build/typescript/assets.d.ts.map +1 -0
- package/build/typescript/index.d.ts +5 -2
- package/build/typescript/index.d.ts.map +1 -1
- package/build/typescript/magic/assets.d.ts +3 -0
- package/build/typescript/magic/assets.d.ts.map +1 -0
- package/build/typescript/server/ServerContext.d.ts +3 -1
- package/build/typescript/server/ServerContext.d.ts.map +1 -1
- package/build/typescript/server/index.d.ts +4 -2
- package/build/typescript/server/index.d.ts.map +1 -1
- package/build/typescript/server/preload.d.ts +8 -0
- package/build/typescript/server/preload.d.ts.map +1 -0
- package/build/typescript/server/request-router.d.ts +23 -12
- package/build/typescript/server/request-router.d.ts.map +1 -1
- package/build/typescript/static/StaticContext.d.ts +3 -1
- package/build/typescript/static/StaticContext.d.ts.map +1 -1
- package/build/typescript/static/index.d.ts +3 -5
- package/build/typescript/static/index.d.ts.map +1 -1
- package/build/typescript/static/render.d.ts +6 -2
- package/build/typescript/static/render.d.ts.map +1 -1
- package/package.json +5 -3
- package/source/App.tsx +8 -17
- package/source/assets.ts +7 -0
- package/source/index.ts +23 -1
- package/source/magic/assets.ts +5 -0
- package/source/server/ServerContext.tsx +15 -7
- package/source/server/index.ts +19 -9
- package/source/server/preload.ts +69 -0
- package/source/server/request-router.tsx +135 -64
- package/source/static/StaticContext.tsx +15 -7
- package/source/static/index.tsx +26 -41
- package/source/static/render.tsx +8 -4
- package/tsconfig.json +2 -0
- package/build/typescript/AppContext.d.ts +0 -8
- package/build/typescript/AppContext.d.ts.map +0 -1
- package/build/typescript/email.d.ts +0 -3
- package/build/typescript/email.d.ts.map +0 -1
- package/build/typescript/http-handlers/index.d.ts +0 -2
- package/build/typescript/http-handlers/index.d.ts.map +0 -1
- package/build/typescript/http-handlers/node.d.ts +0 -2
- package/build/typescript/http-handlers/node.d.ts.map +0 -1
- package/build/typescript/magic/http-handler.d.ts +0 -4
- package/build/typescript/magic/http-handler.d.ts.map +0 -1
- package/build/typescript/server/http-handler.d.ts +0 -13
- package/build/typescript/server/http-handler.d.ts.map +0 -1
- package/build/typescript/server/render.d.ts +0 -17
- package/build/typescript/server/render.d.ts.map +0 -1
- package/source/magic/asset-manifest.ts +0 -5
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export { styleAssetAttributes, styleAssetPreloadAttributes, scriptAssetAttributes, scriptAssetPreloadAttributes, createBrowserAssetsEntryFromManifest, createBrowserAssetsFromManifests, } from '@quilted/assets';
|
|
2
|
+
export type { Asset, AssetsCacheKey, BrowserAssets, BrowserAssetsEntry, BrowserAssetSelector, BrowserAssetModuleSelector, AssetsBuildManifest, AssetsBuildManifestEntry, } from '@quilted/assets';
|
|
1
3
|
export { createAsyncModule } from '@quilted/async';
|
|
2
4
|
export type { AsyncModule } from '@quilted/async';
|
|
3
|
-
export { on, once, createEmitter, AbortError, NestedAbortController, anyAbortSignal, raceAgainstAbortSignal, } from '@quilted/events';
|
|
5
|
+
export { on, once, sleep, createEmitter, AbortError, NestedAbortController, TimedAbortController, anyAbortSignal, raceAgainstAbortSignal, } from '@quilted/events';
|
|
4
6
|
export type { AbortBehavior, Emitter, EmitterHandler, EventTarget, EventTargetAddEventListener, EventTargetFunction, EventTargetOn, } from '@quilted/events';
|
|
7
|
+
export { useUpdateCacheKey } from '@quilted/react-assets';
|
|
5
8
|
export { useAsyncModule, useAsyncModulePreload, usePreload, createAsyncComponent, } from '@quilted/react-async';
|
|
6
9
|
export type { NoOptions, AssetLoadTiming, HydrationTiming, RenderTiming, AsyncComponentType, Preloadable, } from '@quilted/react-async';
|
|
7
10
|
export type { GraphQLResult, GraphQLFetch, GraphQLFetchContext, GraphQLData, GraphQLVariables, GraphQLError, GraphQLOperation, GraphQLOperationType, GraphQLDeepPartialData, GraphQLHttpFetchContext, GraphQLHttpFetchOptions, PickGraphQLType, GraphQLVariableOptions, } from '@quilted/react-graphql';
|
|
@@ -13,7 +16,7 @@ export { Localization, useLocale, useLocaleFromEnvironment, useLocalizedFormatti
|
|
|
13
16
|
export type { LocalizedFormatting, LocalizedFormattingCache, LocalizedNumberFormatOptions, LocalizedDateTimeFormatOptions, RouteLocalization, ResolvedRouteLocalization, DefaultLocaleDefinition, } from '@quilted/react-localize';
|
|
14
17
|
export { createPerformance, PerformanceContext, usePerformance, usePerformanceNavigation, usePerformanceNavigationEvent, } from '@quilted/react-performance';
|
|
15
18
|
export type { Performance, PerformanceNavigation, PerformanceInflightNavigation, } from '@quilted/react-performance';
|
|
16
|
-
export { Link, Redirect, Routing, RoutePreloading, NavigationBlock, useCurrentUrl, useInitialUrl, useRouter, useRoutes,
|
|
19
|
+
export { Link, Redirect, Routing, RoutePreloading, NavigationBlock, useCurrentUrl, useInitialUrl, useRouter, useRoutes, useRouteMatch, useRouteMatchDetails, useNavigate, useRedirect, useNavigationBlock, useScrollRestoration, useRouteChangeFocusRef, } from '@quilted/react-router';
|
|
17
20
|
export type { Router, NavigateTo, Routes, RouteDefinition, } from '@quilted/react-router';
|
|
18
21
|
export { useCookie, useCookies, CookieContext } from '@quilted/react-http';
|
|
19
22
|
export type { PropsWithChildren } from '@quilted/useful-react-types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,EAAE,EACF,IAAI,EACJ,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,OAAO,EACP,cAAc,EACd,WAAW,EACX,2BAA2B,EAC3B,mBAAmB,EACnB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,SAAS,EACT,eAAe,EACf,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,SAAS,EACT,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,SAAS,EACT,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,KAAK,EACL,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iBAAi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Q,EAAC,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../source/magic/assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,QAAQ,GAAG,cAAc,KACtB,aAAa,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { AssetsManager } from '@quilted/react-assets/server';
|
|
2
3
|
import type { HtmlManager } from '@quilted/react-html/server';
|
|
3
4
|
import type { AsyncAssetManager } from '@quilted/react-async/server';
|
|
4
5
|
import type { HttpManager } from '@quilted/react-http/server';
|
|
@@ -6,8 +7,9 @@ interface Props {
|
|
|
6
7
|
url?: string | URL;
|
|
7
8
|
html?: HtmlManager;
|
|
8
9
|
http?: HttpManager;
|
|
10
|
+
assets?: AssetsManager;
|
|
9
11
|
asyncAssets?: AsyncAssetManager;
|
|
10
12
|
}
|
|
11
|
-
export declare function ServerContext({ url, html, http, asyncAssets, children, }: PropsWithChildren<Props>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
|
+
export declare function ServerContext({ url, html, http, assets, asyncAssets, children, }: PropsWithChildren<Props>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
12
14
|
export {};
|
|
13
15
|
//# sourceMappingURL=ServerContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerContext.d.ts","sourceRoot":"","sources":["../../../source/server/ServerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ServerContext.d.ts","sourceRoot":"","sources":["../../../source/server/ServerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAG7C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAGhE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAI5D,UAAU,KAAK;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,GACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,0FAoB1B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Html, Serialize, HtmlManager, HtmlContext, renderHtmlToString, SERVER_ACTION_ID as HTML_SERVER_ACTION_ID, } from '@quilted/react-html/server';
|
|
2
2
|
export { ServerAction, useServerAction, ServerRenderManager, ServerRenderManagerContext, extract, } from '@quilted/react-server-render/server';
|
|
3
|
-
export {
|
|
4
|
-
export type { Asset,
|
|
3
|
+
export { styleAssetAttributes, styleAssetPreloadAttributes, scriptAssetAttributes, scriptAssetPreloadAttributes, createBrowserAssetsFromManifests, createBrowserAssetsEntryFromManifest, } from '@quilted/assets';
|
|
4
|
+
export type { Asset, AssetsCacheKey, BrowserAssets, BrowserAssetsEntry, BrowserAssetSelector, BrowserAssetModuleSelector, AssetsBuildManifest, AssetsBuildManifestEntry, } from '@quilted/assets';
|
|
5
|
+
export { useUpdateCacheKey, AssetsContext, AssetsManager, SERVER_ACTION_ID as ASSETS_SERVER_ACTION_ID, } from '@quilted/react-assets/server';
|
|
5
6
|
export { AsyncAssetContext, AsyncAssetManager, SERVER_ACTION_ID as ASYNC_ASSETS_SERVER_ACTION_ID, } from '@quilted/react-async/server';
|
|
6
7
|
export type { ServerActionKind, ServerActionOptions, ServerActionPerform, ServerRenderPass, } from '@quilted/react-server-render/server';
|
|
7
8
|
export type { HttpState } from '@quilted/react-http/server';
|
|
@@ -12,4 +13,5 @@ export type { Headers, BodyInit, ResponseInit, RequestInit, Cookies, CookieOptio
|
|
|
12
13
|
export { parseAcceptLanguageHeader } from '@quilted/react-localize';
|
|
13
14
|
export { ServerContext } from './ServerContext';
|
|
14
15
|
export { createServerRender, renderAppToResponse, renderAppToStreamedResponse, } from './request-router';
|
|
16
|
+
export { createAssetPreloader, type AssetPreloadOptions } from './preload';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,gBAAgB,IAAI,qBAAqB,GAC1C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,GACR,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,gBAAgB,IAAI,qBAAqB,GAC1C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,OAAO,GACR,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,qBAA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,mBAAmB,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AssetsCacheKey, BrowserAssets } from '@quilted/assets';
|
|
2
|
+
import { type EnhancedRequest, type RequestHandler, type RequestContext } from '@quilted/request-router';
|
|
3
|
+
export interface AssetPreloadOptions<Context = RequestContext, CacheKey = AssetsCacheKey> {
|
|
4
|
+
readonly assets: BrowserAssets<CacheKey>;
|
|
5
|
+
cacheKey?(request: EnhancedRequest, context: Context): CacheKey | Promise<CacheKey>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createAssetPreloader<Context = RequestContext, CacheKey = AssetsCacheKey>(options: AssetPreloadOptions<Context, CacheKey>): RequestHandler<Context>;
|
|
8
|
+
//# sourceMappingURL=preload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preload.d.ts","sourceRoot":"","sources":["../../../source/server/preload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,mBAAmB,CAClC,OAAO,GAAG,cAAc,EACxB,QAAQ,GAAG,cAAc;IAEzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC,QAAQ,CAAC,CACP,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,OAAO,GACf,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACjC;AAED,wBAAgB,oBAAoB,CAClC,OAAO,GAAG,cAAc,EACxB,QAAQ,GAAG,cAAc,EACzB,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CAS1E"}
|
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type AssetsCacheKey, type BrowserAssets, type BrowserAssetsEntry } from '@quilted/assets';
|
|
3
|
+
import { AssetsManager } from '@quilted/react-assets/server';
|
|
3
4
|
import { AsyncAssetManager } from '@quilted/react-async/server';
|
|
4
5
|
import { HttpManager } from '@quilted/react-http/server';
|
|
5
6
|
import { HtmlManager } from '@quilted/react-html/server';
|
|
6
7
|
import type { Options as ExtractOptions, ServerRenderRequestContext } from '@quilted/react-server-render/server';
|
|
7
8
|
import type { EnhancedRequest, RequestHandler, RequestContext } from '@quilted/request-router';
|
|
8
|
-
export interface ServerRenderOptions<Context = RequestContext> {
|
|
9
|
+
export interface ServerRenderOptions<Context = RequestContext, CacheKey = AssetsCacheKey> {
|
|
9
10
|
stream?: 'headers' | false;
|
|
10
|
-
assets?:
|
|
11
|
-
extract?: ExtractOptions
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly
|
|
11
|
+
assets?: BrowserAssets<CacheKey>;
|
|
12
|
+
extract?: Omit<ExtractOptions, 'context'> & {
|
|
13
|
+
readonly context?: ServerRenderRequestContext | ((request: EnhancedRequest, context: Context) => ServerRenderRequestContext);
|
|
14
|
+
};
|
|
15
|
+
renderHtml?(content: string | undefined, details: Pick<ServerRenderAppDetails, 'http' | 'html'> & {
|
|
16
|
+
readonly request: EnhancedRequest;
|
|
17
|
+
readonly context: Context;
|
|
18
|
+
readonly assets?: BrowserAssetsEntry;
|
|
19
|
+
readonly preloadAssets?: BrowserAssetsEntry;
|
|
16
20
|
}): ReactElement<any> | Promise<ReactElement<any>>;
|
|
17
21
|
}
|
|
18
|
-
export interface ServerRenderAppDetails {
|
|
22
|
+
export interface ServerRenderAppDetails<_Context = RequestContext, CacheKey = AssetsCacheKey> {
|
|
19
23
|
readonly http: HttpManager;
|
|
20
24
|
readonly html: HtmlManager;
|
|
25
|
+
readonly assets: AssetsManager<CacheKey>;
|
|
21
26
|
readonly rendered?: string;
|
|
22
27
|
readonly asyncAssets: AsyncAssetManager;
|
|
23
28
|
}
|
|
24
|
-
export declare function createServerRender<Context = RequestContext>(getApp: ReactElement<any> | ((request: EnhancedRequest, context: Context) => ReactElement<any> | Promise<ReactElement<any>>), {
|
|
25
|
-
export declare function renderAppToResponse(getApp: ReactElement<any> | (() => ReactElement<any> | Promise<ReactElement<any>>), request
|
|
26
|
-
|
|
29
|
+
export declare function createServerRender<Context = RequestContext, CacheKey = AssetsCacheKey>(getApp: ReactElement<any> | ((request: EnhancedRequest, context: Context) => ReactElement<any> | Promise<ReactElement<any>>), { stream, ...options }?: ServerRenderOptions<Context, CacheKey>): RequestHandler<Context>;
|
|
30
|
+
export declare function renderAppToResponse<Context = RequestContext, CacheKey = AssetsCacheKey>(getApp: ReactElement<any> | (() => ReactElement<any> | Promise<ReactElement<any>>), { request, context, assets, extract, renderHtml, }: Pick<ServerRenderOptions<Context, CacheKey>, 'assets' | 'renderHtml' | 'extract'> & {
|
|
31
|
+
readonly request: EnhancedRequest;
|
|
32
|
+
readonly context: Context;
|
|
33
|
+
}): Promise<import("@quilted/request-router").EnhancedResponse>;
|
|
34
|
+
export declare function renderAppToStreamedResponse<Context = RequestContext, CacheKey = AssetsCacheKey>(getApp: ReactElement<any> | (() => ReactElement<any> | Promise<ReactElement<any>>), { request, context, assets, extract, renderHtml, }: Pick<ServerRenderOptions<Context, CacheKey>, 'assets' | 'renderHtml' | 'extract'> & {
|
|
35
|
+
readonly request: EnhancedRequest;
|
|
36
|
+
readonly context: Context;
|
|
37
|
+
}): Promise<import("@quilted/request-router").EnhancedResponse>;
|
|
27
38
|
//# sourceMappingURL=request-router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-router.d.ts","sourceRoot":"","sources":["../../../source/server/request-router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"request-router.d.ts","sourceRoot":"","sources":["../../../source/server/request-router.tsx"],"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AAe,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAC,+DAmCnE;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,GAAG,cAAc,EACxB,QAAQ,GAAG,cAAc,EAEzB,MAAM,EACF,YAAY,CAAC,GAAG,CAAC,GACjB,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAC1D,EACE,OAAO,EACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,GACX,EAAE,IAAI,CACL,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,EACtC,QAAQ,GAAG,YAAY,GAAG,SAAS,CACpC,GAAG;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAC,+DAqDnE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { AssetsManager } from '@quilted/react-assets/server';
|
|
2
3
|
import type { HtmlManager } from '@quilted/react-html/server';
|
|
3
4
|
import type { AsyncAssetManager } from '@quilted/react-async/server';
|
|
4
5
|
import type { HttpManager } from '@quilted/react-http/server';
|
|
@@ -6,8 +7,9 @@ interface Props {
|
|
|
6
7
|
url?: string | URL;
|
|
7
8
|
html?: HtmlManager;
|
|
8
9
|
http?: HttpManager;
|
|
10
|
+
assets?: AssetsManager;
|
|
9
11
|
asyncAssets?: AsyncAssetManager;
|
|
10
12
|
}
|
|
11
|
-
export declare function StaticContext({ url, html, http, asyncAssets, children, }: PropsWithChildren<Props>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
|
+
export declare function StaticContext({ url, html, http, assets, asyncAssets, children, }: PropsWithChildren<Props>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
12
14
|
export {};
|
|
13
15
|
//# sourceMappingURL=StaticContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticContext.d.ts","sourceRoot":"","sources":["../../../source/static/StaticContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StaticContext.d.ts","sourceRoot":"","sources":["../../../source/static/StaticContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAG7C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAGhE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAI5D,UAAU,KAAK;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,GACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,0FAoB1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type
|
|
1
|
+
import { type ComponentType } from 'react';
|
|
2
|
+
import { type BrowserAssets } from '@quilted/assets';
|
|
3
3
|
import type { HttpState } from '@quilted/react-http/server';
|
|
4
4
|
export interface RenderDetails {
|
|
5
5
|
readonly route: string;
|
|
@@ -10,9 +10,7 @@ export interface RenderDetails {
|
|
|
10
10
|
}
|
|
11
11
|
export interface Options {
|
|
12
12
|
routes: string[];
|
|
13
|
-
assets:
|
|
14
|
-
modules: boolean;
|
|
15
|
-
}>;
|
|
13
|
+
assets: BrowserAssets<any>;
|
|
16
14
|
crawl?: boolean;
|
|
17
15
|
baseUrl?: string;
|
|
18
16
|
prettify?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/static/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/static/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,aAAa,EAAC,MAAM,OAAO,CAAC;AAEnD,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,4BAA4B,CAAC;AAI1D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAOD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAID,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,EACvB,EACE,MAAM,EACN,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,KAAY,EACZ,OAAkB,EAClB,QAAe,GAChB,EAAE,OAAO,iBAoPX"}
|
|
@@ -3,14 +3,18 @@ import type { Options as ExtractOptions } from '@quilted/react-server-render/ser
|
|
|
3
3
|
import { HtmlManager } from '@quilted/react-html/server';
|
|
4
4
|
import { HttpManager } from '@quilted/react-http/server';
|
|
5
5
|
import { AsyncAssetManager } from '@quilted/react-async/server';
|
|
6
|
-
|
|
6
|
+
import { AssetsManager } from '@quilted/react-assets/server';
|
|
7
|
+
import type { AssetsCacheKey } from '@quilted/assets';
|
|
8
|
+
interface Options<CacheKey = AssetsCacheKey> extends ExtractOptions {
|
|
7
9
|
url?: string | URL;
|
|
10
|
+
cacheKey?: CacheKey;
|
|
8
11
|
headers?: NonNullable<ConstructorParameters<typeof HttpManager>[0]>['headers'];
|
|
9
12
|
}
|
|
10
|
-
export declare function renderApp(app: ReactElement<any>, { decorate, url, headers, ...rest }?: Options): Promise<{
|
|
13
|
+
export declare function renderApp<CacheKey = AssetsCacheKey>(app: ReactElement<any>, { decorate, url, headers, cacheKey, ...rest }?: Options<CacheKey>): Promise<{
|
|
11
14
|
markup: string | undefined;
|
|
12
15
|
http: HttpManager;
|
|
13
16
|
html: HtmlManager;
|
|
17
|
+
assets: AssetsManager<CacheKey>;
|
|
14
18
|
asyncAssets: AsyncAssetManager;
|
|
15
19
|
}>;
|
|
16
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../source/static/render.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../source/static/render.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAIpD,UAAU,OAAO,CAAC,QAAQ,GAAG,cAAc,CAAE,SAAQ,cAAc;IACjE,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,CACnB,qBAAqB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAC7C,CAAC,SAAS,CAAC,CAAC;CACd;AAED,wBAAsB,SAAS,CAAC,QAAQ,GAAG,cAAc,EACvD,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,EACtB,EAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAC,GAAE,OAAO,CAAC,QAAQ,CAAM;;;;;;GAwBpE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quilted/quilt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.137",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/lemonmade/quilt.git",
|
|
@@ -197,8 +197,8 @@
|
|
|
197
197
|
"magic/app": [
|
|
198
198
|
"./build/typescript/magic/app.d.ts"
|
|
199
199
|
],
|
|
200
|
-
"magic/
|
|
201
|
-
"./build/typescript/magic/
|
|
200
|
+
"magic/assets": [
|
|
201
|
+
"./build/typescript/magic/assets.d.ts"
|
|
202
202
|
],
|
|
203
203
|
"magic/request-router": [
|
|
204
204
|
"./build/typescript/magic/request-router.d.ts"
|
|
@@ -214,11 +214,13 @@
|
|
|
214
214
|
"./build/esm/polyfills/*.mjs"
|
|
215
215
|
],
|
|
216
216
|
"dependencies": {
|
|
217
|
+
"@quilted/assets": "^0.0.1",
|
|
217
218
|
"@quilted/async": "^0.3.34",
|
|
218
219
|
"@quilted/events": "^0.1.0",
|
|
219
220
|
"@quilted/graphql": "^0.4.34",
|
|
220
221
|
"@quilted/polyfills": "^0.2.12",
|
|
221
222
|
"@quilted/react": "^18.2.0",
|
|
223
|
+
"@quilted/react-assets": "^0.0.1",
|
|
222
224
|
"@quilted/react-async": "^0.3.43",
|
|
223
225
|
"@quilted/react-dom": "^18.2.0",
|
|
224
226
|
"@quilted/react-graphql": "^0.4.30",
|
package/source/App.tsx
CHANGED
|
@@ -2,12 +2,7 @@ import type {ComponentProps, PropsWithChildren, ReactNode} from 'react';
|
|
|
2
2
|
|
|
3
3
|
import {HttpContext, CookieContext} from '@quilted/react-http';
|
|
4
4
|
import {useHtmlUpdater} from '@quilted/react-html';
|
|
5
|
-
import {
|
|
6
|
-
Routing,
|
|
7
|
-
useRoutes,
|
|
8
|
-
type Routes,
|
|
9
|
-
type Router,
|
|
10
|
-
} from '@quilted/react-router';
|
|
5
|
+
import {Routing, type Routes, type Router} from '@quilted/react-router';
|
|
11
6
|
import {PerformanceContext, type Performance} from '@quilted/react-performance';
|
|
12
7
|
import {Localization} from '@quilted/react-localize';
|
|
13
8
|
|
|
@@ -78,9 +73,6 @@ export function QuiltApp({
|
|
|
78
73
|
children,
|
|
79
74
|
performance = true,
|
|
80
75
|
}: PropsWithChildren<Props>) {
|
|
81
|
-
const routesContent =
|
|
82
|
-
routing !== false && routes ? <StaticRoutes routes={routes} /> : null;
|
|
83
|
-
|
|
84
76
|
const htmlContent =
|
|
85
77
|
typeof html === 'boolean' ? (
|
|
86
78
|
html ? (
|
|
@@ -99,7 +91,6 @@ export function QuiltApp({
|
|
|
99
91
|
<>
|
|
100
92
|
{httpContent}
|
|
101
93
|
{htmlContent}
|
|
102
|
-
{routesContent}
|
|
103
94
|
{children}
|
|
104
95
|
</>
|
|
105
96
|
);
|
|
@@ -107,14 +98,18 @@ export function QuiltApp({
|
|
|
107
98
|
const withMaybeRouting =
|
|
108
99
|
typeof routing === 'boolean' ? (
|
|
109
100
|
routing ? (
|
|
110
|
-
<Routing>{content}</Routing>
|
|
101
|
+
<Routing routes={routes}>{content}</Routing>
|
|
111
102
|
) : (
|
|
112
103
|
content
|
|
113
104
|
)
|
|
114
105
|
) : 'navigate' in routing ? (
|
|
115
|
-
<Routing router={routing}>
|
|
106
|
+
<Routing routes={routes} router={routing}>
|
|
107
|
+
{content}
|
|
108
|
+
</Routing>
|
|
116
109
|
) : (
|
|
117
|
-
<Routing {...routing}>
|
|
110
|
+
<Routing routes={routes} {...routing}>
|
|
111
|
+
{content}
|
|
112
|
+
</Routing>
|
|
118
113
|
);
|
|
119
114
|
|
|
120
115
|
const withMaybePerformance =
|
|
@@ -165,7 +160,3 @@ function HtmlUpdater() {
|
|
|
165
160
|
useHtmlUpdater();
|
|
166
161
|
return null;
|
|
167
162
|
}
|
|
168
|
-
|
|
169
|
-
function StaticRoutes({routes}: {routes: Routes}) {
|
|
170
|
-
return useRoutes(routes);
|
|
171
|
-
}
|
package/source/assets.ts
ADDED
package/source/index.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
|
+
export {
|
|
2
|
+
styleAssetAttributes,
|
|
3
|
+
styleAssetPreloadAttributes,
|
|
4
|
+
scriptAssetAttributes,
|
|
5
|
+
scriptAssetPreloadAttributes,
|
|
6
|
+
createBrowserAssetsEntryFromManifest,
|
|
7
|
+
createBrowserAssetsFromManifests,
|
|
8
|
+
} from '@quilted/assets';
|
|
9
|
+
export type {
|
|
10
|
+
Asset,
|
|
11
|
+
AssetsCacheKey,
|
|
12
|
+
BrowserAssets,
|
|
13
|
+
BrowserAssetsEntry,
|
|
14
|
+
BrowserAssetSelector,
|
|
15
|
+
BrowserAssetModuleSelector,
|
|
16
|
+
AssetsBuildManifest,
|
|
17
|
+
AssetsBuildManifestEntry,
|
|
18
|
+
} from '@quilted/assets';
|
|
1
19
|
export {createAsyncModule} from '@quilted/async';
|
|
2
20
|
export type {AsyncModule} from '@quilted/async';
|
|
3
21
|
export {
|
|
4
22
|
on,
|
|
5
23
|
once,
|
|
24
|
+
sleep,
|
|
6
25
|
createEmitter,
|
|
7
26
|
AbortError,
|
|
8
27
|
NestedAbortController,
|
|
28
|
+
TimedAbortController,
|
|
9
29
|
anyAbortSignal,
|
|
10
30
|
raceAgainstAbortSignal,
|
|
11
31
|
} from '@quilted/events';
|
|
@@ -18,6 +38,7 @@ export type {
|
|
|
18
38
|
EventTargetFunction,
|
|
19
39
|
EventTargetOn,
|
|
20
40
|
} from '@quilted/events';
|
|
41
|
+
export {useUpdateCacheKey} from '@quilted/react-assets';
|
|
21
42
|
export {
|
|
22
43
|
useAsyncModule,
|
|
23
44
|
useAsyncModulePreload,
|
|
@@ -108,7 +129,8 @@ export {
|
|
|
108
129
|
useInitialUrl,
|
|
109
130
|
useRouter,
|
|
110
131
|
useRoutes,
|
|
111
|
-
|
|
132
|
+
useRouteMatch,
|
|
133
|
+
useRouteMatchDetails,
|
|
112
134
|
useNavigate,
|
|
113
135
|
useRedirect,
|
|
114
136
|
useNavigationBlock,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type {PropsWithChildren} from 'react';
|
|
2
2
|
|
|
3
|
+
import {AssetsContext} from '@quilted/react-assets/server';
|
|
4
|
+
import type {AssetsManager} from '@quilted/react-assets/server';
|
|
3
5
|
import {InitialUrlContext} from '@quilted/react-router';
|
|
4
6
|
import {HtmlContext} from '@quilted/react-html/server';
|
|
5
7
|
import type {HtmlManager} from '@quilted/react-html/server';
|
|
@@ -14,6 +16,7 @@ interface Props {
|
|
|
14
16
|
url?: string | URL;
|
|
15
17
|
html?: HtmlManager;
|
|
16
18
|
http?: HttpManager;
|
|
19
|
+
assets?: AssetsManager;
|
|
17
20
|
asyncAssets?: AsyncAssetManager;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -21,21 +24,26 @@ export function ServerContext({
|
|
|
21
24
|
url,
|
|
22
25
|
html,
|
|
23
26
|
http,
|
|
27
|
+
assets,
|
|
24
28
|
asyncAssets,
|
|
25
29
|
children,
|
|
26
30
|
}: PropsWithChildren<Props>) {
|
|
27
31
|
const normalizedUrl = typeof url === 'string' ? new URL(url) : url;
|
|
28
32
|
|
|
29
33
|
return maybeWrapContext(
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
AssetsContext,
|
|
35
|
+
assets,
|
|
32
36
|
maybeWrapContext(
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
AsyncAssetContext,
|
|
38
|
+
asyncAssets,
|
|
35
39
|
maybeWrapContext(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
maybeWrapContext(
|
|
40
|
+
HttpServerContext,
|
|
41
|
+
http,
|
|
42
|
+
maybeWrapContext(
|
|
43
|
+
HtmlContext,
|
|
44
|
+
html,
|
|
45
|
+
maybeWrapContext(InitialUrlContext, normalizedUrl, children),
|
|
46
|
+
),
|
|
39
47
|
),
|
|
40
48
|
),
|
|
41
49
|
);
|
package/source/server/index.ts
CHANGED
|
@@ -13,22 +13,31 @@ export {
|
|
|
13
13
|
ServerRenderManagerContext,
|
|
14
14
|
extract,
|
|
15
15
|
} from '@quilted/react-server-render/server';
|
|
16
|
+
|
|
16
17
|
export {
|
|
17
|
-
createAssetManifest,
|
|
18
18
|
styleAssetAttributes,
|
|
19
19
|
styleAssetPreloadAttributes,
|
|
20
20
|
scriptAssetAttributes,
|
|
21
21
|
scriptAssetPreloadAttributes,
|
|
22
|
-
|
|
22
|
+
createBrowserAssetsFromManifests,
|
|
23
|
+
createBrowserAssetsEntryFromManifest,
|
|
24
|
+
} from '@quilted/assets';
|
|
23
25
|
export type {
|
|
24
26
|
Asset,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
AssetsCacheKey,
|
|
28
|
+
BrowserAssets,
|
|
29
|
+
BrowserAssetsEntry,
|
|
30
|
+
BrowserAssetSelector,
|
|
31
|
+
BrowserAssetModuleSelector,
|
|
32
|
+
AssetsBuildManifest,
|
|
33
|
+
AssetsBuildManifestEntry,
|
|
34
|
+
} from '@quilted/assets';
|
|
35
|
+
export {
|
|
36
|
+
useUpdateCacheKey,
|
|
37
|
+
AssetsContext,
|
|
38
|
+
AssetsManager,
|
|
39
|
+
SERVER_ACTION_ID as ASSETS_SERVER_ACTION_ID,
|
|
40
|
+
} from '@quilted/react-assets/server';
|
|
32
41
|
export {
|
|
33
42
|
AsyncAssetContext,
|
|
34
43
|
AsyncAssetManager,
|
|
@@ -78,3 +87,4 @@ export {
|
|
|
78
87
|
renderAppToResponse,
|
|
79
88
|
renderAppToStreamedResponse,
|
|
80
89
|
} from './request-router';
|
|
90
|
+
export {createAssetPreloader, type AssetPreloadOptions} from './preload';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AssetsCacheKey,
|
|
3
|
+
BrowserAssets,
|
|
4
|
+
BrowserAssetsEntry,
|
|
5
|
+
} from '@quilted/assets';
|
|
6
|
+
import {
|
|
7
|
+
json,
|
|
8
|
+
type EnhancedRequest,
|
|
9
|
+
type RequestHandler,
|
|
10
|
+
type RequestContext,
|
|
11
|
+
} from '@quilted/request-router';
|
|
12
|
+
|
|
13
|
+
export interface AssetPreloadOptions<
|
|
14
|
+
Context = RequestContext,
|
|
15
|
+
CacheKey = AssetsCacheKey,
|
|
16
|
+
> {
|
|
17
|
+
readonly assets: BrowserAssets<CacheKey>;
|
|
18
|
+
cacheKey?(
|
|
19
|
+
request: EnhancedRequest,
|
|
20
|
+
context: Context,
|
|
21
|
+
): CacheKey | Promise<CacheKey>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createAssetPreloader<
|
|
25
|
+
Context = RequestContext,
|
|
26
|
+
CacheKey = AssetsCacheKey,
|
|
27
|
+
>(options: AssetPreloadOptions<Context, CacheKey>): RequestHandler<Context> {
|
|
28
|
+
return async function handler(request, requestContext) {
|
|
29
|
+
const manifest = await assetsForRequest<Context, CacheKey>(request, {
|
|
30
|
+
...options,
|
|
31
|
+
context: requestContext,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return json(manifest);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function assetsForRequest<
|
|
39
|
+
Context = RequestContext,
|
|
40
|
+
CacheKey = AssetsCacheKey,
|
|
41
|
+
>(
|
|
42
|
+
request: EnhancedRequest,
|
|
43
|
+
{
|
|
44
|
+
assets,
|
|
45
|
+
context,
|
|
46
|
+
cacheKey: getCacheKey,
|
|
47
|
+
}: AssetPreloadOptions<Context, CacheKey> & {context: Context},
|
|
48
|
+
) {
|
|
49
|
+
const url = new URL(request.url);
|
|
50
|
+
const modules = url.searchParams.get('modules')?.split(',') ?? [];
|
|
51
|
+
const includeStyles = url.searchParams.get('styles') !== 'false';
|
|
52
|
+
const includeScripts = url.searchParams.get('scripts') !== 'false';
|
|
53
|
+
|
|
54
|
+
const cacheKey =
|
|
55
|
+
(await getCacheKey?.(request, context)) ??
|
|
56
|
+
((await assets.cacheKey?.(request)) as CacheKey);
|
|
57
|
+
|
|
58
|
+
const {styles, scripts} = await assets.entry({
|
|
59
|
+
modules,
|
|
60
|
+
cacheKey,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const result: Partial<BrowserAssetsEntry> = {};
|
|
64
|
+
|
|
65
|
+
if (includeStyles) (result as any).styles = styles;
|
|
66
|
+
if (includeScripts) (result as any).scripts = scripts;
|
|
67
|
+
|
|
68
|
+
return result as Partial<BrowserAssetsEntry>;
|
|
69
|
+
}
|