expo-router 6.1.0-canary-20251013-623c5a6 → 7.0.0-canary-20251023-4c86f95
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/_error.js +36 -3
- package/build/ExpoRoot.js +1 -1
- package/build/ExpoRoot.js.map +1 -1
- package/build/global-state/router-store.d.ts +2 -0
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +16 -12
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +12 -4
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +35 -10
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/storeContext.d.ts +2 -0
- package/build/global-state/storeContext.d.ts.map +1 -1
- package/build/layouts/BaseStack.d.ts +3 -0
- package/build/layouts/BaseStack.d.ts.map +1 -0
- package/build/layouts/BaseStack.js +8 -0
- package/build/layouts/BaseStack.js.map +1 -0
- package/build/layouts/ExperimentalModalStack.d.ts +9 -0
- package/build/layouts/ExperimentalModalStack.d.ts.map +1 -0
- package/build/layouts/ExperimentalModalStack.js +15 -0
- package/build/layouts/ExperimentalModalStack.js.map +1 -0
- package/build/layouts/Stack.web.d.ts +1 -14
- package/build/layouts/Stack.web.d.ts.map +1 -1
- package/build/layouts/Stack.web.js +10 -13
- package/build/layouts/Stack.web.js.map +1 -1
- package/build/layouts/_web-modal.d.ts +3 -0
- package/build/layouts/_web-modal.d.ts.map +1 -0
- package/build/layouts/_web-modal.js +8 -0
- package/build/layouts/_web-modal.js.map +1 -0
- package/build/modal/web/ModalStack.d.ts.map +1 -1
- package/build/modal/web/ModalStack.js +7 -2
- package/build/modal/web/ModalStack.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js +4 -0
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +6 -2
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +7 -4
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js +15 -14
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.d.ts +8 -2
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/utils.d.ts +10 -1
- package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/utils.js +24 -0
- package/build/native-tabs/NativeBottomTabs/utils.js.map +1 -1
- package/build/renderRootComponent.d.ts.map +1 -1
- package/build/renderRootComponent.js +4 -7
- package/build/renderRootComponent.js.map +1 -1
- package/build/static/html.d.ts +1 -9
- package/build/static/html.d.ts.map +1 -1
- package/build/static/html.js +0 -26
- package/build/static/html.js.map +1 -1
- package/build/ui/TabRouter.d.ts +3 -4
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/TabRouter.js +14 -67
- package/build/ui/TabRouter.js.map +1 -1
- package/build/ui/TabTrigger.d.ts +4 -5
- package/build/ui/TabTrigger.d.ts.map +1 -1
- package/build/ui/TabTrigger.js +9 -8
- package/build/ui/TabTrigger.js.map +1 -1
- package/build/ui/Tabs.d.ts +0 -1
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js.map +1 -1
- package/html.js +1 -1
- package/package.json +9 -8
- package/build/getServerManifest.d.ts +0 -88
- package/build/getServerManifest.d.ts.map +0 -1
- package/build/getServerManifest.js +0 -238
- package/build/getServerManifest.js.map +0 -1
- package/build/routes-manifest.d.ts +0 -28
- package/build/routes-manifest.d.ts.map +0 -1
- package/build/routes-manifest.js +0 -30
- package/build/routes-manifest.js.map +0 -1
- package/build/static/getRootComponent.d.ts +0 -2
- package/build/static/getRootComponent.d.ts.map +0 -1
- package/build/static/getRootComponent.js +0 -25
- package/build/static/getRootComponent.js.map +0 -1
- package/build/static/getServerManifest.d.ts +0 -22
- package/build/static/getServerManifest.d.ts.map +0 -1
- package/build/static/getServerManifest.js +0 -50
- package/build/static/getServerManifest.js.map +0 -1
- package/build/static/renderStaticContent.d.ts +0 -15
- package/build/static/renderStaticContent.d.ts.map +0 -1
- package/build/static/renderStaticContent.js +0 -130
- package/build/static/renderStaticContent.js.map +0 -1
- package/build/utils/html.d.ts +0 -12
- package/build/utils/html.d.ts.map +0 -1
- package/build/utils/html.js +0 -29
- package/build/utils/html.js.map +0 -1
- package/node/render.js +0 -3
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Options } from './getRoutesSSR';
|
|
2
|
-
export { Options };
|
|
3
|
-
export type RouteInfo<TRegex = string> = {
|
|
4
|
-
file: string;
|
|
5
|
-
page: string;
|
|
6
|
-
namedRegex: TRegex;
|
|
7
|
-
routeKeys: Record<string, string>;
|
|
8
|
-
permanent?: boolean;
|
|
9
|
-
methods?: string[];
|
|
10
|
-
};
|
|
11
|
-
export type MiddlewareInfo = {
|
|
12
|
-
/**
|
|
13
|
-
* Path to the module that contains the middleware function as a default export.
|
|
14
|
-
*
|
|
15
|
-
* @example _expo/functions/+middleware.js
|
|
16
|
-
*/
|
|
17
|
-
file: string;
|
|
18
|
-
};
|
|
19
|
-
export type ExpoRoutesManifestV1<TRegex = string> = {
|
|
20
|
-
middleware?: MiddlewareInfo;
|
|
21
|
-
apiRoutes: RouteInfo<TRegex>[];
|
|
22
|
-
htmlRoutes: RouteInfo<TRegex>[];
|
|
23
|
-
notFoundRoutes: RouteInfo<TRegex>[];
|
|
24
|
-
redirects: RouteInfo<TRegex>[];
|
|
25
|
-
rewrites: RouteInfo<TRegex>[];
|
|
26
|
-
};
|
|
27
|
-
export declare function createRoutesManifest(paths: string[], options: Options): ExpoRoutesManifestV1 | null;
|
|
28
|
-
//# sourceMappingURL=routes-manifest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,MAAM,GAAG,MAAM,IAAI;IAClD,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;CAC/B,CAAC;AAYF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,OAAO,GACf,oBAAoB,GAAG,IAAI,CAe7B"}
|
package/build/routes-manifest.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRoutesManifest = createRoutesManifest;
|
|
4
|
-
// This file runs in Node.js environments.
|
|
5
|
-
// no relative imports
|
|
6
|
-
const getRoutesSSR_1 = require("./getRoutesSSR");
|
|
7
|
-
const getServerManifest_1 = require("./getServerManifest");
|
|
8
|
-
function createMockContextModule(map = []) {
|
|
9
|
-
const contextModule = (_key) => ({ default() { } });
|
|
10
|
-
Object.defineProperty(contextModule, 'keys', {
|
|
11
|
-
value: () => map,
|
|
12
|
-
});
|
|
13
|
-
return contextModule;
|
|
14
|
-
}
|
|
15
|
-
function createRoutesManifest(paths, options) {
|
|
16
|
-
// TODO: Drop this part for Node.js
|
|
17
|
-
const routeTree = (0, getRoutesSSR_1.getRoutes)(createMockContextModule(paths), {
|
|
18
|
-
...options,
|
|
19
|
-
preserveApiRoutes: true,
|
|
20
|
-
preserveRedirectAndRewrites: true,
|
|
21
|
-
ignoreRequireErrors: true,
|
|
22
|
-
ignoreEntryPoints: true,
|
|
23
|
-
platform: 'web',
|
|
24
|
-
});
|
|
25
|
-
if (!routeTree) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return (0, getServerManifest_1.getServerManifest)(routeTree, { headers: options.headers });
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=routes-manifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":";;AA6CA,oDAkBC;AA/DD,0CAA0C;AAC1C,sBAAsB;AACtB,iDAAyD;AACzD,2DAAwD;AAgCxD,SAAS,uBAAuB,CAAC,MAAgB,EAAE;IACjD,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAI,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE;QAC3C,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO,aAA+B,CAAC;AACzC,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAe,EACf,OAAgB;IAEhB,mCAAmC;IACnC,MAAM,SAAS,GAAG,IAAA,wBAAS,EAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;QAC1D,GAAG,OAAO;QACV,iBAAiB,EAAE,IAAI;QACvB,2BAA2B,EAAE,IAAI;QACjC,mBAAmB,EAAE,IAAI;QACzB,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAA,qCAAiB,EAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["// This file runs in Node.js environments.\n// no relative imports\nimport { type Options, getRoutes } from './getRoutesSSR';\nimport { getServerManifest } from './getServerManifest';\nimport { type RequireContext } from './types';\n\nexport { Options };\n\nexport type RouteInfo<TRegex = string> = {\n file: string;\n page: string;\n namedRegex: TRegex;\n routeKeys: Record<string, string>;\n permanent?: boolean;\n methods?: string[];\n};\n\nexport type MiddlewareInfo = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRoutesManifestV1<TRegex = string> = {\n middleware?: MiddlewareInfo;\n apiRoutes: RouteInfo<TRegex>[];\n htmlRoutes: RouteInfo<TRegex>[];\n notFoundRoutes: RouteInfo<TRegex>[];\n redirects: RouteInfo<TRegex>[];\n rewrites: RouteInfo<TRegex>[];\n};\n\nfunction createMockContextModule(map: string[] = []) {\n const contextModule = (_key: string) => ({ default() {} });\n\n Object.defineProperty(contextModule, 'keys', {\n value: () => map,\n });\n\n return contextModule as RequireContext;\n}\n\nexport function createRoutesManifest(\n paths: string[],\n options: Options\n): ExpoRoutesManifestV1 | null {\n // TODO: Drop this part for Node.js\n const routeTree = getRoutes(createMockContextModule(paths), {\n ...options,\n preserveApiRoutes: true,\n preserveRedirectAndRewrites: true,\n ignoreRequireErrors: true,\n ignoreEntryPoints: true,\n platform: 'web',\n });\n\n if (!routeTree) {\n return null;\n }\n return getServerManifest(routeTree, { headers: options.headers });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRootComponent.d.ts","sourceRoot":"","sources":["../../src/static/getRootComponent.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,QAe/B"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRootComponent = getRootComponent;
|
|
4
|
-
/**
|
|
5
|
-
* Copyright © 2023 650 Industries.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
const _ctx_html_1 = require("expo-router/_ctx-html");
|
|
11
|
-
function getRootComponent() {
|
|
12
|
-
const keys = _ctx_html_1.ctx.keys();
|
|
13
|
-
if (!keys.length) {
|
|
14
|
-
return require('./html').Html;
|
|
15
|
-
}
|
|
16
|
-
if (keys.length > 1) {
|
|
17
|
-
throw new Error(`Multiple components match the root HTML element: ${keys.join(', ')}`);
|
|
18
|
-
}
|
|
19
|
-
const exp = (0, _ctx_html_1.ctx)(keys[0]);
|
|
20
|
-
if (!exp.default) {
|
|
21
|
-
throw new Error(`The root HTML element "${keys[0]}" is missing the required default export.`);
|
|
22
|
-
}
|
|
23
|
-
return exp.default;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=getRootComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRootComponent.js","sourceRoot":"","sources":["../../src/static/getRootComponent.ts"],"names":[],"mappings":";;AAQA,4CAeC;AAvBD;;;;;GAKG;AACH,qDAA2D;AAE3D,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,eAAW,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAQ,OAAO,CAAC,QAAQ,CAA6B,CAAC,IAAI,CAAC;IAC7D,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,GAAG,GAAG,IAAA,eAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ctx as rootContext } from 'expo-router/_ctx-html';\n\nexport function getRootComponent() {\n const keys = rootContext.keys();\n if (!keys.length) {\n return (require('./html') as typeof import('./html')).Html;\n }\n if (keys.length > 1) {\n throw new Error(`Multiple components match the root HTML element: ${keys.join(', ')}`);\n }\n const exp = rootContext(keys[0]);\n\n if (!exp.default) {\n throw new Error(`The root HTML element \"${keys[0]}\" is missing the required default export.`);\n }\n\n return exp.default;\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2024 650 Industries.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { Options } from '../getRoutes';
|
|
8
|
-
import { ExpoRouterServerManifestV1 } from '../getServerManifest';
|
|
9
|
-
/**
|
|
10
|
-
* Get the server manifest with all dynamic routes loaded with `generateStaticParams`.
|
|
11
|
-
* Unlike the `expo-router/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which
|
|
12
|
-
* takes substantially longer and requires Metro bundling.
|
|
13
|
-
*
|
|
14
|
-
* This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getBuildTimeServerManifestAsync(options?: Options): Promise<ExpoRouterServerManifestV1>;
|
|
17
|
-
/** Get the linking manifest from a Node.js process. */
|
|
18
|
-
export declare function getManifest(options?: Options): Promise<{
|
|
19
|
-
initialRouteName: undefined;
|
|
20
|
-
screens: Record<string, import("../getReactNavigationConfig").Screen>;
|
|
21
|
-
}>;
|
|
22
|
-
//# sourceMappingURL=getServerManifest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getServerManifest.d.ts","sourceRoot":"","sources":["../../src/static/getServerManifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAa,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAqB,MAAM,sBAAsB,CAAC;AAGrF;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,GAAE,OAAY,GACpB,OAAO,CAAC,0BAA0B,CAAC,CAcrC;AAED,uDAAuD;AACvD,wBAAsB,WAAW,CAAC,OAAO,GAAE,OAAY;;;GAgBtD"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright © 2024 650 Industries.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getBuildTimeServerManifestAsync = getBuildTimeServerManifestAsync;
|
|
10
|
-
exports.getManifest = getManifest;
|
|
11
|
-
const _ctx_1 = require("../../_ctx");
|
|
12
|
-
const getReactNavigationConfig_1 = require("../getReactNavigationConfig");
|
|
13
|
-
const getRoutes_1 = require("../getRoutes");
|
|
14
|
-
const getServerManifest_1 = require("../getServerManifest");
|
|
15
|
-
const loadStaticParamsAsync_1 = require("../loadStaticParamsAsync");
|
|
16
|
-
/**
|
|
17
|
-
* Get the server manifest with all dynamic routes loaded with `generateStaticParams`.
|
|
18
|
-
* Unlike the `expo-router/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which
|
|
19
|
-
* takes substantially longer and requires Metro bundling.
|
|
20
|
-
*
|
|
21
|
-
* This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.
|
|
22
|
-
*/
|
|
23
|
-
async function getBuildTimeServerManifestAsync(options = {}) {
|
|
24
|
-
const routeTree = (0, getRoutes_1.getRoutes)(_ctx_1.ctx, {
|
|
25
|
-
platform: 'web',
|
|
26
|
-
...options,
|
|
27
|
-
});
|
|
28
|
-
if (!routeTree) {
|
|
29
|
-
throw new Error('No routes found');
|
|
30
|
-
}
|
|
31
|
-
// Evaluate all static params
|
|
32
|
-
await (0, loadStaticParamsAsync_1.loadStaticParamsAsync)(routeTree);
|
|
33
|
-
return (0, getServerManifest_1.getServerManifest)(routeTree, options);
|
|
34
|
-
}
|
|
35
|
-
/** Get the linking manifest from a Node.js process. */
|
|
36
|
-
async function getManifest(options = {}) {
|
|
37
|
-
const routeTree = (0, getRoutes_1.getRoutes)(_ctx_1.ctx, {
|
|
38
|
-
preserveApiRoutes: true,
|
|
39
|
-
preserveRedirectAndRewrites: true,
|
|
40
|
-
platform: 'web',
|
|
41
|
-
...options,
|
|
42
|
-
});
|
|
43
|
-
if (!routeTree) {
|
|
44
|
-
throw new Error('No routes found');
|
|
45
|
-
}
|
|
46
|
-
// Evaluate all static params
|
|
47
|
-
await (0, loadStaticParamsAsync_1.loadStaticParamsAsync)(routeTree);
|
|
48
|
-
return (0, getReactNavigationConfig_1.getReactNavigationConfig)(routeTree, false);
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=getServerManifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../../src/static/getServerManifest.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAeH,0EAgBC;AAGD,kCAgBC;AAhDD,qCAAiC;AACjC,0EAAuE;AACvE,4CAAkD;AAClD,4DAAqF;AACrF,oEAAiE;AAEjE;;;;;;GAMG;AACI,KAAK,UAAU,+BAA+B,CACnD,UAAmB,EAAE;IAErB,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,UAAG,EAAE;QAC/B,QAAQ,EAAE,KAAK;QACf,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,6BAA6B;IAC7B,MAAM,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,IAAA,qCAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,uDAAuD;AAChD,KAAK,UAAU,WAAW,CAAC,UAAmB,EAAE;IACrD,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,UAAG,EAAE;QAC/B,iBAAiB,EAAE,IAAI;QACvB,2BAA2B,EAAE,IAAI;QACjC,QAAQ,EAAE,KAAK;QACf,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,6BAA6B;IAC7B,MAAM,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,IAAA,mDAAwB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { ctx } from '../../_ctx';\nimport { getReactNavigationConfig } from '../getReactNavigationConfig';\nimport { getRoutes, Options } from '../getRoutes';\nimport { ExpoRouterServerManifestV1, getServerManifest } from '../getServerManifest';\nimport { loadStaticParamsAsync } from '../loadStaticParamsAsync';\n\n/**\n * Get the server manifest with all dynamic routes loaded with `generateStaticParams`.\n * Unlike the `expo-router/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which\n * takes substantially longer and requires Metro bundling.\n *\n * This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.\n */\nexport async function getBuildTimeServerManifestAsync(\n options: Options = {}\n): Promise<ExpoRouterServerManifestV1> {\n const routeTree = getRoutes(ctx, {\n platform: 'web',\n ...options,\n });\n\n if (!routeTree) {\n throw new Error('No routes found');\n }\n\n // Evaluate all static params\n await loadStaticParamsAsync(routeTree);\n\n return getServerManifest(routeTree, options);\n}\n\n/** Get the linking manifest from a Node.js process. */\nexport async function getManifest(options: Options = {}) {\n const routeTree = getRoutes(ctx, {\n preserveApiRoutes: true,\n preserveRedirectAndRewrites: true,\n platform: 'web',\n ...options,\n });\n\n if (!routeTree) {\n throw new Error('No routes found');\n }\n\n // Evaluate all static params\n await loadStaticParamsAsync(routeTree);\n\n return getReactNavigationConfig(routeTree, false);\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2023 650 Industries.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import '@expo/metro-runtime';
|
|
8
|
-
type GetStaticContentOptions = {
|
|
9
|
-
loader?: {
|
|
10
|
-
data?: any;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare function getStaticContent(location: URL, options?: GetStaticContentOptions): Promise<string>;
|
|
14
|
-
export { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';
|
|
15
|
-
//# sourceMappingURL=renderStaticContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,qBAAqB,CAAC;AA8B7B,KAAK,uBAAuB,GAAG;IAC7B,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,MAAM,CAAC,CA+DjB;AAmBD,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getManifest = exports.getBuildTimeServerManifestAsync = void 0;
|
|
40
|
-
exports.getStaticContent = getStaticContent;
|
|
41
|
-
/**
|
|
42
|
-
* Copyright © 2023 650 Industries.
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the MIT license found in the
|
|
45
|
-
* LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/
|
|
47
|
-
require("@expo/metro-runtime");
|
|
48
|
-
const native_1 = require("@react-navigation/native");
|
|
49
|
-
const Font = __importStar(require("expo-font/build/server"));
|
|
50
|
-
const react_1 = __importDefault(require("react"));
|
|
51
|
-
const server_node_1 = __importDefault(require("react-dom/server.node"));
|
|
52
|
-
// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)
|
|
53
|
-
const react_native_web_1 = require("react-native-web");
|
|
54
|
-
const getRootComponent_1 = require("./getRootComponent");
|
|
55
|
-
const _ctx_1 = require("../../_ctx");
|
|
56
|
-
const ExpoRoot_1 = require("../ExpoRoot");
|
|
57
|
-
const head_1 = require("../head");
|
|
58
|
-
const html_1 = require("./html");
|
|
59
|
-
const ServerDataLoaderContext_1 = require("../loaders/ServerDataLoaderContext");
|
|
60
|
-
const debug = require('debug')('expo:router:renderStaticContent');
|
|
61
|
-
react_native_web_1.AppRegistry.registerComponent('App', () => ExpoRoot_1.ExpoRoot);
|
|
62
|
-
function resetReactNavigationContexts() {
|
|
63
|
-
// https://github.com/expo/router/discussions/588
|
|
64
|
-
// https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1
|
|
65
|
-
// React Navigation is storing providers in a global, this is fine for the first static render
|
|
66
|
-
// but subsequent static renders of Stack or Tabs will cause React to throw a warning. To prevent this warning, we'll reset the globals before rendering.
|
|
67
|
-
const contexts = '__react_navigation__elements_contexts';
|
|
68
|
-
global[contexts] = new Map();
|
|
69
|
-
}
|
|
70
|
-
async function getStaticContent(location, options) {
|
|
71
|
-
const headContext = {};
|
|
72
|
-
const ref = react_1.default.createRef();
|
|
73
|
-
const {
|
|
74
|
-
// NOTE: The `element` that's returned adds two extra Views and
|
|
75
|
-
// the seemingly unused `RootTagContext.Provider`.
|
|
76
|
-
element, getStyleElement, } = react_native_web_1.AppRegistry.getApplication('App', {
|
|
77
|
-
initialProps: {
|
|
78
|
-
location,
|
|
79
|
-
context: _ctx_1.ctx,
|
|
80
|
-
wrapper: ({ children }) => (<Root>
|
|
81
|
-
<div id="root">{children}</div>
|
|
82
|
-
</Root>),
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
const Root = (0, getRootComponent_1.getRootComponent)();
|
|
86
|
-
// Clear any existing static resources from the global scope to attempt to prevent leaking between pages.
|
|
87
|
-
// This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree
|
|
88
|
-
Font.resetServerContext();
|
|
89
|
-
// This MUST be run before `ReactDOMServer.renderToString` to prevent
|
|
90
|
-
// "Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."
|
|
91
|
-
resetReactNavigationContexts();
|
|
92
|
-
const loadedData = options?.loader?.data ? { [location.pathname]: options.loader.data } : null;
|
|
93
|
-
const html = await server_node_1.default.renderToString(<head_1.Head.Provider context={headContext}>
|
|
94
|
-
<ServerDataLoaderContext_1.ServerDataLoaderContext value={loadedData}>
|
|
95
|
-
<native_1.ServerContainer ref={ref}>{element}</native_1.ServerContainer>
|
|
96
|
-
</ServerDataLoaderContext_1.ServerDataLoaderContext>
|
|
97
|
-
</head_1.Head.Provider>);
|
|
98
|
-
// Eval the CSS after the HTML is rendered so that the CSS is in the same order
|
|
99
|
-
const css = server_node_1.default.renderToStaticMarkup(getStyleElement());
|
|
100
|
-
let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);
|
|
101
|
-
output = output.replace('</head>', `${css}</head>`);
|
|
102
|
-
const fonts = Font.getServerResources();
|
|
103
|
-
debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);
|
|
104
|
-
// debug('Push static fonts:', fonts)
|
|
105
|
-
// Inject static fonts loaded with expo-font
|
|
106
|
-
output = output.replace('</head>', `${fonts.join('')}</head>`);
|
|
107
|
-
if (loadedData) {
|
|
108
|
-
const loaderDataScript = server_node_1.default.renderToStaticMarkup(<html_1.PreloadedDataScript data={loadedData}/>);
|
|
109
|
-
output = output.replace('</head>', `${loaderDataScript}</head>`);
|
|
110
|
-
}
|
|
111
|
-
return '<!DOCTYPE html>' + output;
|
|
112
|
-
}
|
|
113
|
-
function mixHeadComponentsWithStaticResults(helmet, html) {
|
|
114
|
-
// Head components
|
|
115
|
-
for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {
|
|
116
|
-
const result = helmet?.[key]?.toString();
|
|
117
|
-
if (result) {
|
|
118
|
-
html = html.replace('<head>', `<head>${result}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// attributes
|
|
122
|
-
html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);
|
|
123
|
-
html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);
|
|
124
|
-
return html;
|
|
125
|
-
}
|
|
126
|
-
// Re-export for use in server
|
|
127
|
-
var getServerManifest_1 = require("./getServerManifest");
|
|
128
|
-
Object.defineProperty(exports, "getBuildTimeServerManifestAsync", { enumerable: true, get: function () { return getServerManifest_1.getBuildTimeServerManifestAsync; } });
|
|
129
|
-
Object.defineProperty(exports, "getManifest", { enumerable: true, get: function () { return getServerManifest_1.getManifest; } });
|
|
130
|
-
//# sourceMappingURL=renderStaticContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport '@expo/metro-runtime';\n\nimport { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport * as Font from 'expo-font/build/server';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport { getRootComponent } from './getRootComponent';\nimport { ctx } from '../../_ctx';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { Head } from '../head';\nimport { PreloadedDataScript } from './html';\nimport { ServerDataLoaderContext } from '../loaders/ServerDataLoaderContext';\n\nconst debug = require('debug')('expo:router:renderStaticContent');\n\nAppRegistry.registerComponent('App', () => ExpoRoot);\n\nfunction resetReactNavigationContexts() {\n // https://github.com/expo/router/discussions/588\n // https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1\n\n // React Navigation is storing providers in a global, this is fine for the first static render\n // but subsequent static renders of Stack or Tabs will cause React to throw a warning. To prevent this warning, we'll reset the globals before rendering.\n const contexts = '__react_navigation__elements_contexts';\n global[contexts] = new Map<string, React.Context<any>>();\n}\n\ntype GetStaticContentOptions = {\n loader?: {\n data?: any;\n };\n};\n\nexport async function getStaticContent(\n location: URL,\n options?: GetStaticContentOptions\n): Promise<string> {\n const headContext: { helmet?: any } = {};\n\n const ref = React.createRef<ServerContainerRef>();\n\n const {\n // NOTE: The `element` that's returned adds two extra Views and\n // the seemingly unused `RootTagContext.Provider`.\n element,\n getStyleElement,\n } = AppRegistry.getApplication('App', {\n initialProps: {\n location,\n context: ctx,\n wrapper: ({ children }: React.ComponentProps<any>) => (\n <Root>\n <div id=\"root\">{children}</div>\n </Root>\n ),\n },\n });\n\n const Root = getRootComponent();\n\n // Clear any existing static resources from the global scope to attempt to prevent leaking between pages.\n // This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree\n Font.resetServerContext();\n\n // This MUST be run before `ReactDOMServer.renderToString` to prevent\n // \"Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.\"\n resetReactNavigationContexts();\n\n const loadedData = options?.loader?.data ? { [location.pathname]: options.loader.data } : null;\n\n const html = await ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <ServerDataLoaderContext value={loadedData}>\n <ServerContainer ref={ref}>{element}</ServerContainer>\n </ServerDataLoaderContext>\n </Head.Provider>\n );\n\n // Eval the CSS after the HTML is rendered so that the CSS is in the same order\n const css = ReactDOMServer.renderToStaticMarkup(getStyleElement());\n\n let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);\n\n output = output.replace('</head>', `${css}</head>`);\n\n const fonts = Font.getServerResources();\n debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);\n // debug('Push static fonts:', fonts)\n // Inject static fonts loaded with expo-font\n output = output.replace('</head>', `${fonts.join('')}</head>`);\n\n if (loadedData) {\n const loaderDataScript = ReactDOMServer.renderToStaticMarkup(\n <PreloadedDataScript data={loadedData} />\n );\n output = output.replace('</head>', `${loaderDataScript}</head>`);\n }\n\n return '<!DOCTYPE html>' + output;\n}\n\nfunction mixHeadComponentsWithStaticResults(helmet: any, html: string) {\n // Head components\n for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {\n const result = helmet?.[key]?.toString();\n if (result) {\n html = html.replace('<head>', `<head>${result}`);\n }\n }\n\n // attributes\n html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);\n html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);\n\n return html;\n}\n\n// Re-export for use in server\nexport { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';\n"]}
|
package/build/utils/html.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2023 650 Industries.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Replaces unsafe characters in a string with their escaped equivalents. This is to safely
|
|
9
|
-
* embed data in an HTML context to prevent XSS.
|
|
10
|
-
*/
|
|
11
|
-
export declare function escapeUnsafeCharacters(str: string): string;
|
|
12
|
-
//# sourceMappingURL=html.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
package/build/utils/html.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright © 2023 650 Industries.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.escapeUnsafeCharacters = escapeUnsafeCharacters;
|
|
10
|
-
// See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10
|
|
11
|
-
// License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE
|
|
12
|
-
// This utility is based on https://github.com/zertosh/htmlescape
|
|
13
|
-
// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
|
|
14
|
-
const UNSAFE_CHARACTERS_REGEX = /[&><\u2028\u2029]/g;
|
|
15
|
-
const ESCAPED_CHARACTERS = {
|
|
16
|
-
'&': '\\u0026',
|
|
17
|
-
'>': '\\u003e',
|
|
18
|
-
'<': '\\u003c',
|
|
19
|
-
'\u2028': '\\u2028',
|
|
20
|
-
'\u2029': '\\u2029',
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Replaces unsafe characters in a string with their escaped equivalents. This is to safely
|
|
24
|
-
* embed data in an HTML context to prevent XSS.
|
|
25
|
-
*/
|
|
26
|
-
function escapeUnsafeCharacters(str) {
|
|
27
|
-
return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=html.js.map
|
package/build/utils/html.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,wDAEC;AArBD,mIAAmI;AACnI,sGAAsG;AAEtG,iEAAiE;AACjE,uGAAuG;AAEvG,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,kBAAkB,GAAgC;IACtD,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10\n// License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst UNSAFE_CHARACTERS_REGEX = /[&><\\u2028\\u2029]/g;\nconst ESCAPED_CHARACTERS: { [match: string]: string } = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\n\n/**\n * Replaces unsafe characters in a string with their escaped equivalents. This is to safely\n * embed data in an HTML context to prevent XSS.\n */\nexport function escapeUnsafeCharacters(str: string): string {\n return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);\n}\n"]}
|
package/node/render.js
DELETED