@anansi/core 0.16.3 → 0.16.4
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 +11 -0
- package/dist/client.js +3 -1
- package/dist/client.js.map +1 -1
- package/dist/server.js +14 -20
- package/dist/server.js.map +1 -1
- package/lib/floodSpouts.js +8 -4
- package/lib/index.js +18 -7
- package/lib/index.server.js +22 -9
- package/lib/laySpouts.js +11 -6
- package/lib/scripts/getProxyMiddlewares.js +6 -2
- package/lib/scripts/index.js +10 -3
- package/lib/scripts/serve.js +25 -20
- package/lib/scripts/startDevserver.js +34 -29
- package/lib/scripts/types.js +3 -1
- package/lib/spouts/DocumentComponent.d.ts.map +1 -1
- package/lib/spouts/DocumentComponent.js +21 -16
- package/lib/spouts/antd.server.js +14 -8
- package/lib/spouts/app.js +7 -2
- package/lib/spouts/app.server.js +7 -2
- package/lib/spouts/csp.js +6 -2
- package/lib/spouts/document.js +6 -2
- package/lib/spouts/document.server.js +10 -5
- package/lib/spouts/json.js +6 -2
- package/lib/spouts/json.server.js +12 -6
- package/lib/spouts/prefetch.server.js +6 -2
- package/lib/spouts/restHooks.d.ts.map +1 -1
- package/lib/spouts/restHooks.js +14 -6
- package/lib/spouts/restHooks.provider.js +7 -2
- package/lib/spouts/restHooks.server.js +13 -7
- package/lib/spouts/router.js +14 -9
- package/lib/spouts/router.server.js +14 -9
- package/lib/spouts/types.js +3 -1
- package/package.json +6 -6
- package/src/spouts/DocumentComponent.tsx +2 -3
- package/src/spouts/restHooks.tsx +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [0.16.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.16.3...@anansi/core@0.16.4) (2023-02-09)
|
|
7
|
+
|
|
8
|
+
### 💅 Enhancement
|
|
9
|
+
|
|
10
|
+
* Use unsafe-inline for better legacy browser compat ([595cacb](https://github.com/ntucker/anansi/commit/595cacb9f157537bd0db7b71df8cc5e39dabfd85))
|
|
11
|
+
|
|
12
|
+
### 📦 Package
|
|
13
|
+
|
|
14
|
+
* Update all non-major dependencies ([#1838](https://github.com/ntucker/anansi/issues/1838)) ([0bd6008](https://github.com/ntucker/anansi/commit/0bd60089c57d81801d24fa1927cb50a285dde121))
|
|
15
|
+
* Update JS test packages to ^29.4.2 ([#1842](https://github.com/ntucker/anansi/issues/1842)) ([2a8c989](https://github.com/ntucker/anansi/commit/2a8c989127268c46524558f4c69714df20d6ca58))
|
|
16
|
+
|
|
6
17
|
### [0.16.3](https://github.com/ntucker/anansi/compare/@anansi/core@0.16.2...@anansi/core@0.16.3) (2023-01-30)
|
|
7
18
|
|
|
8
19
|
### 💅 Enhancement
|
package/dist/client.js
CHANGED
|
@@ -133,6 +133,8 @@ function restHooksSpout(options = {}) {
|
|
|
133
133
|
}] = await Promise.all([props.getInitialData('resthooks'), Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(__webpack_require__("./src/spouts/restHooks.provider.tsx")))]);
|
|
134
134
|
if ( true && !data) {
|
|
135
135
|
console.error('Rest Hooks init data not found');
|
|
136
|
+
} else if (!data) {
|
|
137
|
+
console.info('Rest Hooks init missing');
|
|
136
138
|
}
|
|
137
139
|
return {
|
|
138
140
|
...nextProps,
|
|
@@ -142,7 +144,7 @@ function restHooksSpout(options = {}) {
|
|
|
142
144
|
__self: this,
|
|
143
145
|
__source: {
|
|
144
146
|
fileName: _jsxFileName,
|
|
145
|
-
lineNumber:
|
|
147
|
+
lineNumber: 26,
|
|
146
148
|
columnNumber: 9
|
|
147
149
|
}
|
|
148
150
|
}, nextProps.app)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","mappings":";;;;;;;;;;;AAAA;AAEA;AAIA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;;;;;;;;;;;;ACXA;AAGA;AAAA;AAAA;AAAA;AAEA;;;;;;;;;;;;ACAA;AAIA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;ACZA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;;;;;;;;;;;;ACnCA;AAAA;;;;;;;;;;;;;;;;ACIA;AAKA;AACA;AACA;AAAA;AAAA;AAKA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;;;;;;;;;;;;;AC7BA;AACA;AAEA;AAAA;AAIA;AAaA;AAGA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAEA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;;ACpDA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvBA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA","sources":["/home/ntucker/src/anansi/packages/core/src/floodSpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.provider.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/router.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/client\"","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireDefault.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireWildcard.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/typeof.js","/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/src/index.ts"],"sourcesContent":["import { hydrateRoot } from 'react-dom/client';\n\nexport default async function floodSpouts(\n spouts: (props: Record<string, unknown>) => Promise<{\n app: JSX.Element;\n }>,\n { rootId = 'anansi-root' }: { rootId?: string } = {},\n) {\n const { app } = await spouts({});\n\n hydrateRoot(document.getElementById(rootId) ?? document, app);\n}\n","const appSpout =\n (app: JSX.Element) =>\n <P extends Record<string, unknown>>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","import type { Route } from '@anansi/router';\nimport React from 'react';\n\nimport type { ClientSpout } from './types';\n\nexport default function documentSpout(options: {\n head?: React.ReactNode;\n title: string;\n}): ClientSpout {\n return next => async props => {\n const nextProps = await next(props);\n\n return nextProps;\n };\n}\n","import type { ClientSpout } from './types';\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ClientSpout<\n Record<string, unknown>,\n { getInitialData: (key: string) => Promise<any> }\n> {\n return next => async props => {\n const getInitialData = (key: string) => {\n const globalId = `${id}.${key}`;\n return new Promise<any>((resolve, reject) => {\n let el: HTMLScriptElement | null;\n if ((el = document.getElementById(globalId) as any)) {\n resolve(getDataFromEl(el, globalId));\n return;\n }\n document.addEventListener('DOMContentLoaded', () => {\n el = document.getElementById(globalId) as any;\n if (el) resolve(getDataFromEl(el, globalId));\n else reject(new Error(`failed to find DOM with ${key} state`));\n });\n });\n };\n return { ...(await next({ ...props, getInitialData })), getInitialData };\n };\n}\n\nfunction getDataFromEl(el: HTMLScriptElement, key: string) {\n if (el.text === undefined) {\n console.error(\n `#${key} is completely empty. This could be due to CSP issues.`,\n );\n }\n return el?.text ? JSON.parse(el?.text) : undefined;\n}\n","export { CacheProvider } from '@rest-hooks/react';\n","import { type Manager } from '@rest-hooks/react';\n\nimport type { ClientSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers?: () => Manager[];\n } = {},\n): ClientSpout<{ getInitialData: (key: string) => Promise<any> }> {\n return next => async props => {\n const nextProps = await next(props);\n const [data, { CacheProvider }] = await Promise.all([\n props.getInitialData('resthooks'),\n import('./restHooks.provider'),\n ]);\n\n if (process.env.NODE_ENV !== 'production' && !data) {\n console.error('Rest Hooks init data not found');\n }\n\n return {\n ...nextProps,\n app: (\n <CacheProvider initialState={data} managers={options?.getManagers?.()}>\n {nextProps.app}\n </CacheProvider>\n ),\n };\n };\n}\n","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport { createBrowserHistory } from 'history';\nimport type { Update } from 'history';\nimport React from 'react';\n\nimport type { CreateRouter, ClientSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n onChange?: (update: Update, callback: () => void | undefined) => void;\n}): ClientSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith, any>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider\n router={router}\n resolveWith={resolveWith}\n onChange={options.onChange}\n >\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const history = createBrowserHistory();\n const router = options.createRouter(history);\n const matchedRoutes = router.getMatchedRoutes(history.location.pathname);\n\n const nextProps = await next({ ...props, matchedRoutes, router });\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\n };\n}\n","module.exports = require(\"@anansi/router\");","module.exports = require(\"@rest-hooks/react\");","module.exports = require(\"history\");","module.exports = require(\"react\");","module.exports = require(\"react-dom/client\");","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interopRequireWildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") {\n return {\n \"default\": obj\n };\n }\n var cache = _getRequireWildcardCache(nodeInterop);\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj[\"default\"] = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\nmodule.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export { default as floodSpouts } from './floodSpouts';\nexport { default as documentSpout } from './spouts/document';\nexport { default as restHooksSpout } from './spouts/restHooks';\nexport { default as routerSpout } from './spouts/router';\nexport { default as JSONSpout } from './spouts/json';\nexport { default as appSpout } from './spouts/app';\nexport type { ServerProps } from './spouts/types';\nexport type { ClientSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"client.js","mappings":";;;;;;;;;;;AAAA;AAEA;AAIA;AAAA;AACA;AACA;AAAA;AAAA;AAEA;AACA;;;;;;;;;;;;ACXA;AAGA;AAAA;AAAA;AAAA;AAEA;;;;;;;;;;;;ACAA;AAIA;AACA;AAEA;AACA;AACA;;;;;;;;;;;;ACZA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AAGA;AACA;AACA;;;;;;;;;;;;ACnCA;AAAA;;;;;;;;;;;;;;;;ACIA;AAKA;AACA;AACA;AAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;;;;;;;;;;;;;AC/BA;AACA;AAEA;AAAA;AAIA;AAaA;AAGA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAEA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;;ACpDA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvBA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA","sources":["/home/ntucker/src/anansi/packages/core/src/floodSpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.provider.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/router.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/client\"","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireDefault.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireWildcard.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/typeof.js","/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/src/index.ts"],"sourcesContent":["import { hydrateRoot } from 'react-dom/client';\n\nexport default async function floodSpouts(\n spouts: (props: Record<string, unknown>) => Promise<{\n app: JSX.Element;\n }>,\n { rootId = 'anansi-root' }: { rootId?: string } = {},\n) {\n const { app } = await spouts({});\n\n hydrateRoot(document.getElementById(rootId) ?? document, app);\n}\n","const appSpout =\n (app: JSX.Element) =>\n <P extends Record<string, unknown>>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","import type { Route } from '@anansi/router';\nimport React from 'react';\n\nimport type { ClientSpout } from './types';\n\nexport default function documentSpout(options: {\n head?: React.ReactNode;\n title: string;\n}): ClientSpout {\n return next => async props => {\n const nextProps = await next(props);\n\n return nextProps;\n };\n}\n","import type { ClientSpout } from './types';\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ClientSpout<\n Record<string, unknown>,\n { getInitialData: (key: string) => Promise<any> }\n> {\n return next => async props => {\n const getInitialData = (key: string) => {\n const globalId = `${id}.${key}`;\n return new Promise<any>((resolve, reject) => {\n let el: HTMLScriptElement | null;\n if ((el = document.getElementById(globalId) as any)) {\n resolve(getDataFromEl(el, globalId));\n return;\n }\n document.addEventListener('DOMContentLoaded', () => {\n el = document.getElementById(globalId) as any;\n if (el) resolve(getDataFromEl(el, globalId));\n else reject(new Error(`failed to find DOM with ${key} state`));\n });\n });\n };\n return { ...(await next({ ...props, getInitialData })), getInitialData };\n };\n}\n\nfunction getDataFromEl(el: HTMLScriptElement, key: string) {\n if (el.text === undefined) {\n console.error(\n `#${key} is completely empty. This could be due to CSP issues.`,\n );\n }\n return el?.text ? JSON.parse(el?.text) : undefined;\n}\n","export { CacheProvider } from '@rest-hooks/react';\n","import { type Manager } from '@rest-hooks/react';\n\nimport type { ClientSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers?: () => Manager[];\n } = {},\n): ClientSpout<{ getInitialData: (key: string) => Promise<any> }> {\n return next => async props => {\n const nextProps = await next(props);\n const [data, { CacheProvider }] = await Promise.all([\n props.getInitialData('resthooks'),\n import('./restHooks.provider'),\n ]);\n\n if (process.env.NODE_ENV !== 'production' && !data) {\n console.error('Rest Hooks init data not found');\n } else if (!data) {\n console.info('Rest Hooks init missing');\n }\n\n return {\n ...nextProps,\n app: (\n <CacheProvider initialState={data} managers={options?.getManagers?.()}>\n {nextProps.app}\n </CacheProvider>\n ),\n };\n };\n}\n","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport { createBrowserHistory } from 'history';\nimport type { Update } from 'history';\nimport React from 'react';\n\nimport type { CreateRouter, ClientSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n onChange?: (update: Update, callback: () => void | undefined) => void;\n}): ClientSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith, any>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider\n router={router}\n resolveWith={resolveWith}\n onChange={options.onChange}\n >\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const history = createBrowserHistory();\n const router = options.createRouter(history);\n const matchedRoutes = router.getMatchedRoutes(history.location.pathname);\n\n const nextProps = await next({ ...props, matchedRoutes, router });\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\n };\n}\n","module.exports = require(\"@anansi/router\");","module.exports = require(\"@rest-hooks/react\");","module.exports = require(\"history\");","module.exports = require(\"react\");","module.exports = require(\"react-dom/client\");","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interopRequireWildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") {\n return {\n \"default\": obj\n };\n }\n var cache = _getRequireWildcardCache(nodeInterop);\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj[\"default\"] = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\nmodule.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export { default as floodSpouts } from './floodSpouts';\nexport { default as documentSpout } from './spouts/document';\nexport { default as restHooksSpout } from './spouts/restHooks';\nexport { default as routerSpout } from './spouts/router';\nexport { default as JSONSpout } from './spouts/json';\nexport { default as appSpout } from './spouts/app';\nexport type { ServerProps } from './spouts/types';\nexport type { ClientSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
package/dist/server.js
CHANGED
|
@@ -98,22 +98,16 @@ function Document({
|
|
|
98
98
|
const policy = {
|
|
99
99
|
...csPolicy
|
|
100
100
|
};
|
|
101
|
-
if (nonce &&
|
|
102
|
-
// nonces negate 'unsafe-inline' so do not add it
|
|
103
|
-
|
|
104
|
-
if (typeof policy['script-src'] === 'string') {
|
|
105
|
-
policy['script-src'] = [policy['script-src'], `'nonce-${nonce}'`];
|
|
106
|
-
} else {
|
|
107
|
-
policy['script-src'] = [...policy['script-src'], `'nonce-${nonce}'`];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
101
|
+
if (nonce &&
|
|
102
|
+
// nonces negate 'unsafe-inline' so do not add it in development to keep things easier
|
|
103
|
+
"development" === 'production') {}
|
|
110
104
|
cspMeta = /*#__PURE__*/_react.default.createElement("meta", {
|
|
111
105
|
httpEquiv: "Content-Security-Policy",
|
|
112
106
|
content: (0, _csp.buildPolicy)(policy),
|
|
113
107
|
__self: this,
|
|
114
108
|
__source: {
|
|
115
109
|
fileName: _jsxFileName,
|
|
116
|
-
lineNumber:
|
|
110
|
+
lineNumber: 47,
|
|
117
111
|
columnNumber: 7
|
|
118
112
|
}
|
|
119
113
|
});
|
|
@@ -122,14 +116,14 @@ function Document({
|
|
|
122
116
|
__self: this,
|
|
123
117
|
__source: {
|
|
124
118
|
fileName: _jsxFileName,
|
|
125
|
-
lineNumber:
|
|
119
|
+
lineNumber: 51,
|
|
126
120
|
columnNumber: 5
|
|
127
121
|
}
|
|
128
122
|
}, /*#__PURE__*/_react.default.createElement("head", {
|
|
129
123
|
__self: this,
|
|
130
124
|
__source: {
|
|
131
125
|
fileName: _jsxFileName,
|
|
132
|
-
lineNumber:
|
|
126
|
+
lineNumber: 52,
|
|
133
127
|
columnNumber: 7
|
|
134
128
|
}
|
|
135
129
|
}, /*#__PURE__*/_react.default.createElement("meta", {
|
|
@@ -137,7 +131,7 @@ function Document({
|
|
|
137
131
|
__self: this,
|
|
138
132
|
__source: {
|
|
139
133
|
fileName: _jsxFileName,
|
|
140
|
-
lineNumber:
|
|
134
|
+
lineNumber: 53,
|
|
141
135
|
columnNumber: 9
|
|
142
136
|
}
|
|
143
137
|
}), cspMeta, head, extraStyle, assets.map((asset, i) => /*#__PURE__*/_react.default.createElement("link", {
|
|
@@ -147,21 +141,21 @@ function Document({
|
|
|
147
141
|
__self: this,
|
|
148
142
|
__source: {
|
|
149
143
|
fileName: _jsxFileName,
|
|
150
|
-
lineNumber:
|
|
144
|
+
lineNumber: 58,
|
|
151
145
|
columnNumber: 11
|
|
152
146
|
}
|
|
153
147
|
})), /*#__PURE__*/_react.default.createElement("title", {
|
|
154
148
|
__self: this,
|
|
155
149
|
__source: {
|
|
156
150
|
fileName: _jsxFileName,
|
|
157
|
-
lineNumber:
|
|
151
|
+
lineNumber: 60,
|
|
158
152
|
columnNumber: 9
|
|
159
153
|
}
|
|
160
154
|
}, title)), /*#__PURE__*/_react.default.createElement("body", {
|
|
161
155
|
__self: this,
|
|
162
156
|
__source: {
|
|
163
157
|
fileName: _jsxFileName,
|
|
164
|
-
lineNumber:
|
|
158
|
+
lineNumber: 62,
|
|
165
159
|
columnNumber: 7
|
|
166
160
|
}
|
|
167
161
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -169,7 +163,7 @@ function Document({
|
|
|
169
163
|
__self: this,
|
|
170
164
|
__source: {
|
|
171
165
|
fileName: _jsxFileName,
|
|
172
|
-
lineNumber:
|
|
166
|
+
lineNumber: 63,
|
|
173
167
|
columnNumber: 9
|
|
174
168
|
}
|
|
175
169
|
}, children), scripts, assets.filter(({
|
|
@@ -183,7 +177,7 @@ function Document({
|
|
|
183
177
|
__self: this,
|
|
184
178
|
__source: {
|
|
185
179
|
fileName: _jsxFileName,
|
|
186
|
-
lineNumber:
|
|
180
|
+
lineNumber: 68,
|
|
187
181
|
columnNumber: 13
|
|
188
182
|
}
|
|
189
183
|
}))));
|
|
@@ -195,7 +189,7 @@ Document.defaultProps = {
|
|
|
195
189
|
__self: void 0,
|
|
196
190
|
__source: {
|
|
197
191
|
fileName: _jsxFileName,
|
|
198
|
-
lineNumber:
|
|
192
|
+
lineNumber: 77,
|
|
199
193
|
columnNumber: 7
|
|
200
194
|
}
|
|
201
195
|
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
@@ -204,7 +198,7 @@ Document.defaultProps = {
|
|
|
204
198
|
__self: void 0,
|
|
205
199
|
__source: {
|
|
206
200
|
fileName: _jsxFileName,
|
|
207
|
-
lineNumber:
|
|
201
|
+
lineNumber: 78,
|
|
208
202
|
columnNumber: 7
|
|
209
203
|
}
|
|
210
204
|
})),
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","mappings":";;;;;;;;;;;;AAAA;AACA;AAKA;AAKA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACxDA;AAAA;AAAA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAAA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AASA;AACA;AACA;AAKA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChDA;AACA;AAWA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AChCA;AASA;AAAA;AACA;AAGA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACvCA;AACA;AACA;AAAA;AAIA;AAYA;AAGA;AAAA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AAEA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtDA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvBA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA","sources":["/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/antd.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/csp.ts","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@ant-design/cssinjs\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/ssr\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/external node-commonjs \"crypto\"","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireDefault.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireWildcard.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/typeof.js","/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["import crypto from 'crypto';\nimport { renderToPipeableStream as reactRender } from 'react-dom/server';\n\nimport { Render } from './scripts/types';\nimport { ServerProps } from './spouts/types';\n\nexport default function laySpouts(\n spouts: (props: ServerProps) => Promise<{\n app: JSX.Element;\n }>,\n {\n timeoutMS = 10000,\n onError,\n }: { timeoutMS?: number; onError?: (error: unknown) => void } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const nonce = crypto.randomBytes(16).toString('base64');\n\n try {\n const { app } = await spouts({ clientManifest, req, res, nonce });\n\n let didError = false;\n const { pipe, abort } = reactRender(app, {\n nonce,\n //bootstrapScripts: assets.filter(asset => asset.endsWith('.js')),\n onShellReady() {\n //managers.forEach(manager => manager.cleanup());\n // If something errored before we started streaming, we set the error code appropriately.\n res.statusCode = didError ? 500 : 200;\n res.setHeader('Content-type', 'text/html');\n pipe(res);\n },\n onShellError() {\n didError = true;\n res.statusCode = 500;\n pipe(res);\n },\n onError(e: any) {\n didError = true;\n console.error(e);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n if (onError) onError(e);\n },\n });\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(\n () => (abort as any)(`Timeout of ${timeoutMS}ms exceeded`),\n timeoutMS,\n );\n } catch (e: unknown) {\n if (onError) onError(e);\n throw e;\n }\n };\n return render;\n}\n","import type { Policy } from './csp';\nimport { buildPolicy } from './csp';\n\ntype Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n extraStyle: React.ReactNode;\n scripts: React.ReactNode;\n title: string;\n rootId: string;\n charSet: string;\n csPolicy?: Policy;\n nonce?: string | undefined;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n charSet,\n csPolicy,\n nonce,\n scripts,\n extraStyle,\n}: Props) {\n let cspMeta: null | React.ReactNode = null;\n if (csPolicy) {\n // add nonce to policy\n const policy = {\n ...csPolicy,\n };\n if (\n nonce &&\n // nonces negate 'unsafe-inline' so do not add it if that directive exists\n (!policy['script-src'] ||\n !policy['script-src'].includes(\"'unsafe-inline'\"))\n ) {\n if (typeof policy['script-src'] === 'string') {\n policy['script-src'] = [policy['script-src'], `'nonce-${nonce}'`];\n } else {\n policy['script-src'] = [...policy['script-src'], `'nonce-${nonce}'`];\n }\n }\n cspMeta = (\n <meta httpEquiv=\"Content-Security-Policy\" content={buildPolicy(policy)} />\n );\n }\n return (\n <html>\n <head>\n <meta charSet={charSet} />\n {cspMeta}\n {head}\n {extraStyle}\n {assets.map((asset, i) => (\n <link key={i} rel=\"preload\" {...asset} />\n ))}\n <title>{title}</title>\n </head>\n <body>\n <div id={rootId}>{children}</div>\n {scripts}\n {assets\n .filter(({ href }) => href.endsWith('.js'))\n .map(({ href }, i) => (\n <script key={i} src={href} async />\n ))}\n </body>\n </html>\n );\n}\nDocument.defaultProps = {\n head: (\n <>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link\n rel=\"shortcut icon\"\n href={`${process.env.WEBPACK_PUBLIC_PATH ?? '/'}favicon.ico`}\n />\n </>\n ),\n charSet: 'utf-8',\n rootId: 'anansi-root',\n scripts: null,\n};\n","import React from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n extraStyle?: React.ReactNode[];\n};\n\nexport default function antdSpout(): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const { createCache, extractStyle, StyleProvider } = await import(\n '@ant-design/cssinjs'\n );\n const cache = createCache();\n\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n\n const AntdSheets = (): JSX.Element => {\n return (\n <script\n dangerouslySetInnerHTML={{\n __html: `</script>${extractStyle(cache)}<script>`,\n }}\n />\n );\n };\n // unfortunately we have to inject this after the entire content has streamed in or it doesn't correctly populate\n // see: https://github.com/ant-design/cssinjs/issues/79\n scripts.push(<AntdSheets />);\n\n return {\n ...nextProps,\n app: <StyleProvider cache={cache}>{nextProps.app}</StyleProvider>,\n scripts,\n };\n };\n}\n","import { ServerProps } from './types';\n\nconst appSpout =\n (app: JSX.Element) =>\n <P extends ServerProps>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","export interface Policy {\n [directive: string]: string | string[];\n}\n\n// TODO: memoize this\nexport function buildPolicy(policyObj: Policy) {\n return Object.keys(policyObj)\n .map(key => {\n const val = Array.isArray(policyObj[key])\n ? [...new Set(policyObj[key]).values()].filter(v => v).join(' ')\n : policyObj[key];\n\n // move strict dynamic to the end of the policy if it exists to be backwards compatible with csp2\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic\n if (typeof val === 'string' && val.includes(\"'strict-dynamic'\")) {\n const newVal = `${val\n .replace(/\\s?'strict-dynamic'\\s?/gi, ' ')\n .trim()} 'strict-dynamic'`;\n return `${key} ${newVal}`;\n }\n\n return `${key} ${val}`;\n })\n .join('; ');\n}\n","import type { Route } from '@anansi/router';\nimport React from 'react';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { Policy } from './csp';\nimport Document from './DocumentComponent';\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n matchedRoutes: Route<any>[];\n title?: string;\n scripts?: React.ReactNode[];\n extraStyle?: React.ReactNode[];\n};\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId?: string;\n charSet?: string;\n csPolicy?: Policy;\n}): ServerSpout<Record<string, unknown>, Record<string, unknown>, NeededNext> {\n return next => async props => {\n const nextProps = await next(props);\n\n const publicPath = props.clientManifest.publicPath;\n\n if (\n Object.keys(props.clientManifest?.entrypoints ?? {}).length < 1 ||\n publicPath === undefined\n )\n throw new Error('Manifest missing entries needed');\n\n // TODO: consider using this package for build stats in future:\n // https://github.com/facebook/react/tree/main/packages/react-server-dom-webpack\n const assetMap = (assets: { name: string; size?: number }[]) =>\n assets.map(({ name }) => `${publicPath}${name}`);\n\n const assetList: string[] = [];\n Object.values(props.clientManifest?.entrypoints ?? {}).forEach(\n entrypoint => {\n assetList.push(...assetMap(entrypoint.assets ?? []));\n },\n );\n new Set(\n assetMap(\n Object.values(props.clientManifest.namedChunkGroups ?? {})\n .filter(({ name }) =>\n nextProps.matchedRoutes.some(route => name?.includes(route.name)),\n )\n .flatMap(chunk => [\n ...(chunk.assets ?? []),\n // any chunk preloads\n ...childrenAssets(chunk),\n ]),\n ),\n ).forEach(asset => assetList.push(asset));\n\n // find additional assets to preload based on matched route\n const assets: {\n href: string;\n as?: string | undefined;\n rel?: string | undefined;\n }[] = assetList\n .filter(asset => !asset.endsWith('.hot-update.js'))\n .map(asset =>\n asset.endsWith('.css')\n ? { href: asset, rel: 'stylesheet' }\n : asset.endsWith('.js')\n ? { href: asset, as: 'script' }\n : { href: asset },\n );\n\n return {\n ...nextProps,\n app: (\n <Document\n {...options}\n extraStyle={nextProps.extraStyle}\n title={nextProps.title ?? options.title}\n assets={assets}\n rootId={options.rootId}\n nonce={props.nonce}\n csPolicy={options.csPolicy}\n scripts={nextProps.scripts}\n >\n {nextProps.app}\n </Document>\n ),\n };\n };\n}\n\nfunction childrenAssets(chunk: StatsChunkGroup) {\n return chunk.children\n ? Object.values(chunk.children).flatMap(preload =>\n preload.flatMap(c => c.assets ?? []),\n )\n : [];\n}\n","import React, { Suspense } from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n};\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n\n Object.entries(nextProps.initData ?? {}).forEach(([key, useData]) => {\n const globalId = `${id}.${key}`;\n const Script = () => {\n const data: any = useData();\n try {\n const encoded = JSON.stringify(data);\n return (\n <script\n id={globalId}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error(`Error serializing json for ${key}`);\n console.error(e);\n return null;\n }\n };\n scripts.push(\n <Suspense key={globalId}>\n <Script />\n </Suspense>,\n );\n });\n\n return {\n ...nextProps,\n scripts,\n };\n };\n}\n","import { Route } from '@anansi/router';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps<RouteWith> = {\n matchedRoutes: Route<RouteWith>[];\n} & ResolveProps;\n\nexport default function prefetchSpout<F extends string>(field: F) {\n return function <\n RouteWith,\n N extends NeededProps<RouteWith>,\n I extends ServerProps,\n >(\n next: (props: I) => Promise<\n {\n [K in F]: RouteWith;\n } & N\n >,\n ) {\n return async (props: I) => {\n const nextProps = await next(props);\n\n try {\n const toFetch: Promise<unknown>[] = [];\n nextProps.matchedRoutes.forEach(route => {\n if (typeof route.resolveData === 'function') {\n toFetch.push(route.resolveData(nextProps[field], route));\n }\n });\n await Promise.all(toFetch);\n } catch (e) {\n console.error(e);\n }\n return nextProps;\n };\n };\n}\n","import { type Controller, type Manager, type State } from '@rest-hooks/react';\nimport type { Store } from 'redux';\n\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers?: () => Manager[];\n } = {},\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown>; scripts?: React.ReactNode[] }\n> {\n return next => async props => {\n const managers = options?.getManagers?.() ?? [\n new (await import('@rest-hooks/react')).NetworkManager(),\n ];\n const { createPersistedStore } = await import('@rest-hooks/ssr');\n const [ServerCacheProvider, useReadyCacheState, controller, store] =\n createPersistedStore(managers);\n\n const nextProps = await next({\n ...props,\n controller,\n store,\n });\n return {\n ...nextProps,\n initData: {\n ...nextProps.initData,\n resthooks: useReadyCacheState,\n },\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n // TODO: figure out how to only inject in next and not have to also put here\n controller,\n store,\n };\n };\n}\n","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport { createMemoryHistory } from 'history';\nimport React from 'react';\n\nimport type { CreateRouter, ServerSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n}): ServerSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider router={router} resolveWith={resolveWith}>\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const url = props.req.url || '';\n const router = options.createRouter(\n createMemoryHistory({ initialEntries: [url] }),\n );\n const matchedRoutes: Route<ResolveWith>[] = router.getMatchedRoutes(url);\n\n const nextProps = await next({\n ...props,\n matchedRoutes,\n router,\n });\n\n const Router = createRouteComponent(router);\n\n return {\n ...nextProps,\n app: <Router>{nextProps.app}</Router>,\n // TODO: figure out how to only inject in next and not have to also put here\n matchedRoutes,\n router,\n };\n };\n}\n","module.exports = require(\"@anansi/router\");","module.exports = require(\"@ant-design/cssinjs\");","module.exports = require(\"@rest-hooks/react\");","module.exports = require(\"@rest-hooks/ssr\");","module.exports = require(\"history\");","module.exports = require(\"react\");","module.exports = require(\"react-dom/server\");","module.exports = require(\"crypto\");","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interopRequireWildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") {\n return {\n \"default\": obj\n };\n }\n var cache = _getRequireWildcardCache(nodeInterop);\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj[\"default\"] = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\nmodule.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export { default as laySpouts } from './laySpouts';\nexport { default as documentSpout } from './spouts/document.server';\nexport { default as restHooksSpout } from './spouts/restHooks.server';\nexport { default as antdSpout } from './spouts/antd.server';\nexport { default as routerSpout } from './spouts/router.server';\nexport { default as prefetchSpout } from './spouts/prefetch.server';\nexport { default as JSONSpout } from './spouts/json.server';\nexport { default as appSpout } from './spouts/app.server';\nexport type { ServerProps } from './spouts/types';\nexport type { ServerSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"server.js","mappings":";;;;;;;;;;;;AAAA;AACA;AAKA;AAKA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACxDA;AAAA;AAAA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAQA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAA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A;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChDA;AACA;AAWA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AChCA;AASA;AAAA;AACA;AAGA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACvCA;AACA;AACA;AAAA;AAIA;AAYA;AAGA;AAAA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AAEA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACtDA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvBA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA","sources":["/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/antd.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/csp.ts","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@ant-design/cssinjs\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/ssr\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/external node-commonjs \"crypto\"","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireDefault.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/interopRequireWildcard.js","/home/ntucker/src/anansi/node_modules/@babel/runtime/helpers/typeof.js","/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["import crypto from 'crypto';\nimport { renderToPipeableStream as reactRender } from 'react-dom/server';\n\nimport { Render } from './scripts/types';\nimport { ServerProps } from './spouts/types';\n\nexport default function laySpouts(\n spouts: (props: ServerProps) => Promise<{\n app: JSX.Element;\n }>,\n {\n timeoutMS = 10000,\n onError,\n }: { timeoutMS?: number; onError?: (error: unknown) => void } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const nonce = crypto.randomBytes(16).toString('base64');\n\n try {\n const { app } = await spouts({ clientManifest, req, res, nonce });\n\n let didError = false;\n const { pipe, abort } = reactRender(app, {\n nonce,\n //bootstrapScripts: assets.filter(asset => asset.endsWith('.js')),\n onShellReady() {\n //managers.forEach(manager => manager.cleanup());\n // If something errored before we started streaming, we set the error code appropriately.\n res.statusCode = didError ? 500 : 200;\n res.setHeader('Content-type', 'text/html');\n pipe(res);\n },\n onShellError() {\n didError = true;\n res.statusCode = 500;\n pipe(res);\n },\n onError(e: any) {\n didError = true;\n console.error(e);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n if (onError) onError(e);\n },\n });\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(\n () => (abort as any)(`Timeout of ${timeoutMS}ms exceeded`),\n timeoutMS,\n );\n } catch (e: unknown) {\n if (onError) onError(e);\n throw e;\n }\n };\n return render;\n}\n","import type { Policy } from './csp';\nimport { buildPolicy } from './csp';\n\ntype Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n extraStyle: React.ReactNode;\n scripts: React.ReactNode;\n title: string;\n rootId: string;\n charSet: string;\n csPolicy?: Policy;\n nonce?: string | undefined;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n charSet,\n csPolicy,\n nonce,\n scripts,\n extraStyle,\n}: Props) {\n let cspMeta: null | React.ReactNode = null;\n if (csPolicy) {\n // add nonce to policy\n const policy = {\n ...csPolicy,\n };\n if (\n nonce &&\n // nonces negate 'unsafe-inline' so do not add it in development to keep things easier\n process.env.NODE_ENV === 'production'\n ) {\n if (typeof policy['script-src'] === 'string') {\n policy['script-src'] = [policy['script-src'], `'nonce-${nonce}'`];\n } else {\n policy['script-src'] = [...policy['script-src'], `'nonce-${nonce}'`];\n }\n }\n cspMeta = (\n <meta httpEquiv=\"Content-Security-Policy\" content={buildPolicy(policy)} />\n );\n }\n return (\n <html>\n <head>\n <meta charSet={charSet} />\n {cspMeta}\n {head}\n {extraStyle}\n {assets.map((asset, i) => (\n <link key={i} rel=\"preload\" {...asset} />\n ))}\n <title>{title}</title>\n </head>\n <body>\n <div id={rootId}>{children}</div>\n {scripts}\n {assets\n .filter(({ href }) => href.endsWith('.js'))\n .map(({ href }, i) => (\n <script key={i} src={href} async />\n ))}\n </body>\n </html>\n );\n}\nDocument.defaultProps = {\n head: (\n <>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link\n rel=\"shortcut icon\"\n href={`${process.env.WEBPACK_PUBLIC_PATH ?? '/'}favicon.ico`}\n />\n </>\n ),\n charSet: 'utf-8',\n rootId: 'anansi-root',\n scripts: null,\n};\n","import React from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n extraStyle?: React.ReactNode[];\n};\n\nexport default function antdSpout(): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const { createCache, extractStyle, StyleProvider } = await import(\n '@ant-design/cssinjs'\n );\n const cache = createCache();\n\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n\n const AntdSheets = (): JSX.Element => {\n return (\n <script\n dangerouslySetInnerHTML={{\n __html: `</script>${extractStyle(cache)}<script>`,\n }}\n />\n );\n };\n // unfortunately we have to inject this after the entire content has streamed in or it doesn't correctly populate\n // see: https://github.com/ant-design/cssinjs/issues/79\n scripts.push(<AntdSheets />);\n\n return {\n ...nextProps,\n app: <StyleProvider cache={cache}>{nextProps.app}</StyleProvider>,\n scripts,\n };\n };\n}\n","import { ServerProps } from './types';\n\nconst appSpout =\n (app: JSX.Element) =>\n <P extends ServerProps>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","export interface Policy {\n [directive: string]: string | string[];\n}\n\n// TODO: memoize this\nexport function buildPolicy(policyObj: Policy) {\n return Object.keys(policyObj)\n .map(key => {\n const val = Array.isArray(policyObj[key])\n ? [...new Set(policyObj[key]).values()].filter(v => v).join(' ')\n : policyObj[key];\n\n // move strict dynamic to the end of the policy if it exists to be backwards compatible with csp2\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic\n if (typeof val === 'string' && val.includes(\"'strict-dynamic'\")) {\n const newVal = `${val\n .replace(/\\s?'strict-dynamic'\\s?/gi, ' ')\n .trim()} 'strict-dynamic'`;\n return `${key} ${newVal}`;\n }\n\n return `${key} ${val}`;\n })\n .join('; ');\n}\n","import type { Route } from '@anansi/router';\nimport React from 'react';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { Policy } from './csp';\nimport Document from './DocumentComponent';\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n matchedRoutes: Route<any>[];\n title?: string;\n scripts?: React.ReactNode[];\n extraStyle?: React.ReactNode[];\n};\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId?: string;\n charSet?: string;\n csPolicy?: Policy;\n}): ServerSpout<Record<string, unknown>, Record<string, unknown>, NeededNext> {\n return next => async props => {\n const nextProps = await next(props);\n\n const publicPath = props.clientManifest.publicPath;\n\n if (\n Object.keys(props.clientManifest?.entrypoints ?? {}).length < 1 ||\n publicPath === undefined\n )\n throw new Error('Manifest missing entries needed');\n\n // TODO: consider using this package for build stats in future:\n // https://github.com/facebook/react/tree/main/packages/react-server-dom-webpack\n const assetMap = (assets: { name: string; size?: number }[]) =>\n assets.map(({ name }) => `${publicPath}${name}`);\n\n const assetList: string[] = [];\n Object.values(props.clientManifest?.entrypoints ?? {}).forEach(\n entrypoint => {\n assetList.push(...assetMap(entrypoint.assets ?? []));\n },\n );\n new Set(\n assetMap(\n Object.values(props.clientManifest.namedChunkGroups ?? {})\n .filter(({ name }) =>\n nextProps.matchedRoutes.some(route => name?.includes(route.name)),\n )\n .flatMap(chunk => [\n ...(chunk.assets ?? []),\n // any chunk preloads\n ...childrenAssets(chunk),\n ]),\n ),\n ).forEach(asset => assetList.push(asset));\n\n // find additional assets to preload based on matched route\n const assets: {\n href: string;\n as?: string | undefined;\n rel?: string | undefined;\n }[] = assetList\n .filter(asset => !asset.endsWith('.hot-update.js'))\n .map(asset =>\n asset.endsWith('.css')\n ? { href: asset, rel: 'stylesheet' }\n : asset.endsWith('.js')\n ? { href: asset, as: 'script' }\n : { href: asset },\n );\n\n return {\n ...nextProps,\n app: (\n <Document\n {...options}\n extraStyle={nextProps.extraStyle}\n title={nextProps.title ?? options.title}\n assets={assets}\n rootId={options.rootId}\n nonce={props.nonce}\n csPolicy={options.csPolicy}\n scripts={nextProps.scripts}\n >\n {nextProps.app}\n </Document>\n ),\n };\n };\n}\n\nfunction childrenAssets(chunk: StatsChunkGroup) {\n return chunk.children\n ? Object.values(chunk.children).flatMap(preload =>\n preload.flatMap(c => c.assets ?? []),\n )\n : [];\n}\n","import React, { Suspense } from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n};\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n\n Object.entries(nextProps.initData ?? {}).forEach(([key, useData]) => {\n const globalId = `${id}.${key}`;\n const Script = () => {\n const data: any = useData();\n try {\n const encoded = JSON.stringify(data);\n return (\n <script\n id={globalId}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error(`Error serializing json for ${key}`);\n console.error(e);\n return null;\n }\n };\n scripts.push(\n <Suspense key={globalId}>\n <Script />\n </Suspense>,\n );\n });\n\n return {\n ...nextProps,\n scripts,\n };\n };\n}\n","import { Route } from '@anansi/router';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps<RouteWith> = {\n matchedRoutes: Route<RouteWith>[];\n} & ResolveProps;\n\nexport default function prefetchSpout<F extends string>(field: F) {\n return function <\n RouteWith,\n N extends NeededProps<RouteWith>,\n I extends ServerProps,\n >(\n next: (props: I) => Promise<\n {\n [K in F]: RouteWith;\n } & N\n >,\n ) {\n return async (props: I) => {\n const nextProps = await next(props);\n\n try {\n const toFetch: Promise<unknown>[] = [];\n nextProps.matchedRoutes.forEach(route => {\n if (typeof route.resolveData === 'function') {\n toFetch.push(route.resolveData(nextProps[field], route));\n }\n });\n await Promise.all(toFetch);\n } catch (e) {\n console.error(e);\n }\n return nextProps;\n };\n };\n}\n","import { type Controller, type Manager, type State } from '@rest-hooks/react';\nimport type { Store } from 'redux';\n\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers?: () => Manager[];\n } = {},\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown>; scripts?: React.ReactNode[] }\n> {\n return next => async props => {\n const managers = options?.getManagers?.() ?? [\n new (await import('@rest-hooks/react')).NetworkManager(),\n ];\n const { createPersistedStore } = await import('@rest-hooks/ssr');\n const [ServerCacheProvider, useReadyCacheState, controller, store] =\n createPersistedStore(managers);\n\n const nextProps = await next({\n ...props,\n controller,\n store,\n });\n return {\n ...nextProps,\n initData: {\n ...nextProps.initData,\n resthooks: useReadyCacheState,\n },\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n // TODO: figure out how to only inject in next and not have to also put here\n controller,\n store,\n };\n };\n}\n","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport { createMemoryHistory } from 'history';\nimport React from 'react';\n\nimport type { CreateRouter, ServerSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n}): ServerSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider router={router} resolveWith={resolveWith}>\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const url = props.req.url || '';\n const router = options.createRouter(\n createMemoryHistory({ initialEntries: [url] }),\n );\n const matchedRoutes: Route<ResolveWith>[] = router.getMatchedRoutes(url);\n\n const nextProps = await next({\n ...props,\n matchedRoutes,\n router,\n });\n\n const Router = createRouteComponent(router);\n\n return {\n ...nextProps,\n app: <Router>{nextProps.app}</Router>,\n // TODO: figure out how to only inject in next and not have to also put here\n matchedRoutes,\n router,\n };\n };\n}\n","module.exports = require(\"@anansi/router\");","module.exports = require(\"@ant-design/cssinjs\");","module.exports = require(\"@rest-hooks/react\");","module.exports = require(\"@rest-hooks/ssr\");","module.exports = require(\"history\");","module.exports = require(\"react\");","module.exports = require(\"react-dom/server\");","module.exports = require(\"crypto\");","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interopRequireWildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") {\n return {\n \"default\": obj\n };\n }\n var cache = _getRequireWildcardCache(nodeInterop);\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n newObj[\"default\"] = obj;\n if (cache) {\n cache.set(obj, newObj);\n }\n return newObj;\n}\nmodule.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export { default as laySpouts } from './laySpouts';\nexport { default as documentSpout } from './spouts/document.server';\nexport { default as restHooksSpout } from './spouts/restHooks.server';\nexport { default as antdSpout } from './spouts/antd.server';\nexport { default as routerSpout } from './spouts/router.server';\nexport { default as prefetchSpout } from './spouts/prefetch.server';\nexport { default as JSONSpout } from './spouts/json.server';\nexport { default as appSpout } from './spouts/app.server';\nexport type { ServerProps } from './spouts/types';\nexport type { ServerSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
package/lib/floodSpouts.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = floodSpouts;
|
|
5
|
+
var _client = require("react-dom/client");
|
|
6
|
+
async function floodSpouts(spouts, {
|
|
3
7
|
rootId = 'anansi-root'
|
|
4
8
|
} = {}) {
|
|
5
9
|
var _document$getElementB;
|
|
6
10
|
const {
|
|
7
11
|
app
|
|
8
12
|
} = await spouts({});
|
|
9
|
-
hydrateRoot((_document$getElementB = document.getElementById(rootId)) != null ? _document$getElementB : document, app);
|
|
13
|
+
(0, _client.hydrateRoot)((_document$getElementB = document.getElementById(rootId)) != null ? _document$getElementB : document, app);
|
|
10
14
|
}
|
|
11
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
15
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJmbG9vZFNwb3V0cyIsInNwb3V0cyIsInJvb3RJZCIsImFwcCIsImh5ZHJhdGVSb290IiwiZG9jdW1lbnQiLCJnZXRFbGVtZW50QnlJZCJdLCJzb3VyY2VzIjpbIi4uL3NyYy9mbG9vZFNwb3V0cy50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgaHlkcmF0ZVJvb3QgfSBmcm9tICdyZWFjdC1kb20vY2xpZW50JztcblxuZXhwb3J0IGRlZmF1bHQgYXN5bmMgZnVuY3Rpb24gZmxvb2RTcG91dHMoXG4gIHNwb3V0czogKHByb3BzOiBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPikgPT4gUHJvbWlzZTx7XG4gICAgYXBwOiBKU1guRWxlbWVudDtcbiAgfT4sXG4gIHsgcm9vdElkID0gJ2FuYW5zaS1yb290JyB9OiB7IHJvb3RJZD86IHN0cmluZyB9ID0ge30sXG4pIHtcbiAgY29uc3QgeyBhcHAgfSA9IGF3YWl0IHNwb3V0cyh7fSk7XG5cbiAgaHlkcmF0ZVJvb3QoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQocm9vdElkKSA/PyBkb2N1bWVudCwgYXBwKTtcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7OztBQUFBO0FBRWUsZUFBZUEsV0FBVyxDQUN2Q0MsTUFFRSxFQUNGO0VBQUVDLE1BQU0sR0FBRztBQUFtQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQ3BEO0VBQUE7RUFDQSxNQUFNO0lBQUVDO0VBQUksQ0FBQyxHQUFHLE1BQU1GLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztFQUVoQyxJQUFBRyxtQkFBVywyQkFBQ0MsUUFBUSxDQUFDQyxjQUFjLENBQUNKLE1BQU0sQ0FBQyxvQ0FBSUcsUUFBUSxFQUFFRixHQUFHLENBQUM7QUFDL0QifQ==
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.routerSpout = exports.restHooksSpout = exports.floodSpouts = exports.documentSpout = exports.appSpout = exports.JSONSpout = void 0;
|
|
6
|
+
var _floodSpouts = _interopRequireDefault(require("./floodSpouts"));
|
|
7
|
+
exports.floodSpouts = _floodSpouts.default;
|
|
8
|
+
var _document = _interopRequireDefault(require("./spouts/document"));
|
|
9
|
+
exports.documentSpout = _document.default;
|
|
10
|
+
var _restHooks = _interopRequireDefault(require("./spouts/restHooks"));
|
|
11
|
+
exports.restHooksSpout = _restHooks.default;
|
|
12
|
+
var _router = _interopRequireDefault(require("./spouts/router"));
|
|
13
|
+
exports.routerSpout = _router.default;
|
|
14
|
+
var _json = _interopRequireDefault(require("./spouts/json"));
|
|
15
|
+
exports.JSONSpout = _json.default;
|
|
16
|
+
var _app = _interopRequireDefault(require("./spouts/app"));
|
|
17
|
+
exports.appSpout = _app.default;
|
|
18
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IGRlZmF1bHQgYXMgZmxvb2RTcG91dHMgfSBmcm9tICcuL2Zsb29kU3BvdXRzJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZG9jdW1lbnRTcG91dCB9IGZyb20gJy4vc3BvdXRzL2RvY3VtZW50JztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgcmVzdEhvb2tzU3BvdXQgfSBmcm9tICcuL3Nwb3V0cy9yZXN0SG9va3MnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyByb3V0ZXJTcG91dCB9IGZyb20gJy4vc3BvdXRzL3JvdXRlcic7XG5leHBvcnQgeyBkZWZhdWx0IGFzIEpTT05TcG91dCB9IGZyb20gJy4vc3BvdXRzL2pzb24nO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBhcHBTcG91dCB9IGZyb20gJy4vc3BvdXRzL2FwcCc7XG5leHBvcnQgdHlwZSB7IFNlcnZlclByb3BzIH0gZnJvbSAnLi9zcG91dHMvdHlwZXMnO1xuZXhwb3J0IHR5cGUgeyBDbGllbnRTcG91dCBhcyBTcG91dCB9IGZyb20gJy4vc3BvdXRzL3R5cGVzJztcbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTtBQUF1RDtBQUN2RDtBQUE2RDtBQUM3RDtBQUErRDtBQUMvRDtBQUF5RDtBQUN6RDtBQUFxRDtBQUNyRDtBQUFtRCJ9
|
package/lib/index.server.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.routerSpout = exports.restHooksSpout = exports.prefetchSpout = exports.laySpouts = exports.documentSpout = exports.appSpout = exports.antdSpout = exports.JSONSpout = void 0;
|
|
6
|
+
var _laySpouts = _interopRequireDefault(require("./laySpouts"));
|
|
7
|
+
exports.laySpouts = _laySpouts.default;
|
|
8
|
+
var _document = _interopRequireDefault(require("./spouts/document.server"));
|
|
9
|
+
exports.documentSpout = _document.default;
|
|
10
|
+
var _restHooks = _interopRequireDefault(require("./spouts/restHooks.server"));
|
|
11
|
+
exports.restHooksSpout = _restHooks.default;
|
|
12
|
+
var _antd = _interopRequireDefault(require("./spouts/antd.server"));
|
|
13
|
+
exports.antdSpout = _antd.default;
|
|
14
|
+
var _router = _interopRequireDefault(require("./spouts/router.server"));
|
|
15
|
+
exports.routerSpout = _router.default;
|
|
16
|
+
var _prefetch = _interopRequireDefault(require("./spouts/prefetch.server"));
|
|
17
|
+
exports.prefetchSpout = _prefetch.default;
|
|
18
|
+
var _json = _interopRequireDefault(require("./spouts/json.server"));
|
|
19
|
+
exports.JSONSpout = _json.default;
|
|
20
|
+
var _app = _interopRequireDefault(require("./spouts/app.server"));
|
|
21
|
+
exports.appSpout = _app.default;
|
|
22
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnNlcnZlci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBkZWZhdWx0IGFzIGxheVNwb3V0cyB9IGZyb20gJy4vbGF5U3BvdXRzJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgZG9jdW1lbnRTcG91dCB9IGZyb20gJy4vc3BvdXRzL2RvY3VtZW50LnNlcnZlcic7XG5leHBvcnQgeyBkZWZhdWx0IGFzIHJlc3RIb29rc1Nwb3V0IH0gZnJvbSAnLi9zcG91dHMvcmVzdEhvb2tzLnNlcnZlcic7XG5leHBvcnQgeyBkZWZhdWx0IGFzIGFudGRTcG91dCB9IGZyb20gJy4vc3BvdXRzL2FudGQuc2VydmVyJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgcm91dGVyU3BvdXQgfSBmcm9tICcuL3Nwb3V0cy9yb3V0ZXIuc2VydmVyJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgcHJlZmV0Y2hTcG91dCB9IGZyb20gJy4vc3BvdXRzL3ByZWZldGNoLnNlcnZlcic7XG5leHBvcnQgeyBkZWZhdWx0IGFzIEpTT05TcG91dCB9IGZyb20gJy4vc3BvdXRzL2pzb24uc2VydmVyJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgYXBwU3BvdXQgfSBmcm9tICcuL3Nwb3V0cy9hcHAuc2VydmVyJztcbmV4cG9ydCB0eXBlIHsgU2VydmVyUHJvcHMgfSBmcm9tICcuL3Nwb3V0cy90eXBlcyc7XG5leHBvcnQgdHlwZSB7IFNlcnZlclNwb3V0IGFzIFNwb3V0IH0gZnJvbSAnLi9zcG91dHMvdHlwZXMnO1xuIl0sIm1hcHBpbmdzIjoiOzs7OztBQUFBO0FBQW1EO0FBQ25EO0FBQW9FO0FBQ3BFO0FBQXNFO0FBQ3RFO0FBQTREO0FBQzVEO0FBQWdFO0FBQ2hFO0FBQW9FO0FBQ3BFO0FBQTREO0FBQzVEO0FBQTBEIn0=
|
package/lib/laySpouts.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = laySpouts;
|
|
6
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
7
|
+
var _server = require("react-dom/server");
|
|
8
|
+
function laySpouts(spouts, {
|
|
4
9
|
timeoutMS = 10000,
|
|
5
10
|
onError
|
|
6
11
|
} = {}) {
|
|
7
12
|
const render = async (clientManifest, req, res) => {
|
|
8
|
-
const nonce =
|
|
13
|
+
const nonce = _crypto.default.randomBytes(16).toString('base64');
|
|
9
14
|
try {
|
|
10
15
|
const {
|
|
11
16
|
app
|
|
@@ -19,7 +24,7 @@ export default function laySpouts(spouts, {
|
|
|
19
24
|
const {
|
|
20
25
|
pipe,
|
|
21
26
|
abort
|
|
22
|
-
} =
|
|
27
|
+
} = (0, _server.renderToPipeableStream)(app, {
|
|
23
28
|
nonce,
|
|
24
29
|
//bootstrapScripts: assets.filter(asset => asset.endsWith('.js')),
|
|
25
30
|
onShellReady() {
|
|
@@ -52,4 +57,4 @@ export default function laySpouts(spouts, {
|
|
|
52
57
|
};
|
|
53
58
|
return render;
|
|
54
59
|
}
|
|
55
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
60
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJsYXlTcG91dHMiLCJzcG91dHMiLCJ0aW1lb3V0TVMiLCJvbkVycm9yIiwicmVuZGVyIiwi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TyxFQUFFQSxPQUFPLENBQUNrQixDQUFDLENBQUM7TUFDdkIsTUFBTUEsQ0FBQztJQUNUO0VBQ0YsQ0FBQztFQUNELE9BQU9qQixNQUFNO0FBQ2YifQ==
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = getProxyMiddlewares;
|
|
1
5
|
// Essentially taken from https://github.com/webpack/webpack-dev-server/blob/b5e5b67398f97c7a2934e12ebe34fb03cc06c473/lib/Server.js#L2123
|
|
2
|
-
|
|
6
|
+
function getProxyMiddlewares(proxyConfig) {
|
|
3
7
|
const middlewares = [];
|
|
4
8
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
9
|
const {
|
|
@@ -90,4 +94,4 @@ export default function getProxyMiddlewares(proxyConfig) {
|
|
|
90
94
|
});
|
|
91
95
|
return middlewares;
|
|
92
96
|
}
|
|
93
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRQcm94eU1pZGRsZXdhcmVzIiwicHJveHlDb25maWciLCJtaWRkbGV3YXJlcyIsImNyZWF0ZVByb3h5TWlkZGxld2FyZSIsInJlcXVpcmUiLCJwcm94eSIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJsZW5ndGgiLCJzdGFydHNXaXRoIiwiZW50cmllcyIsIm1hcCIsInBhdGgiLCJ2IiwiZ2V0UHJveHlNaWRkbGV3YXJlIiwidGFyZ2V0IiwiY29udGV4dCIsInJvdXRlciIsImZvckVhY2giLCJwcm94eUNvbmZpZ09yQ2FsbGJhY2siLCJwcm94eU1pZGRsZXdhcmUiLCJoYW5kbGVyIiwicmVxIiwicmVzIiwibmV4dCIsIm5ld1Byb3h5Q29uZmlnIiwiYnlwYXNzVXJsIiwiYnlwYXNzIiwidXJsIiwicHVzaCIsIm5hbWUiLCJtaWRkbGV3YXJlIiw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OlxuICAgKiBwcm94eTogW1xuICAgKiAgIHtcbiAgICogICAgIGNvbnRleHQ6IFwidmFsdWVcIixcbiAgICogICAgIC4uLm9wdGlvbnMsXG4gICAqICAgfSxcbiAgICogICAvLyBvcjpcbiAgICogICBmdW5jdGlvbigpIHtcbiAgICogICAgIHJldHVybiB7XG4gICAqICAgICAgIGNvbnRleHQ6IFwiY29udGV4dFwiLFxuICAgKiAgICAgICAuLi5vcHRpb25zLFxuICAgKiAgICAgfTtcbiAgICogICB9XG4gICAqIF1cbiAgICovXG4gIHByb3h5LmZvckVhY2gocHJveHlDb25maWdPckNhbGxiYWNrID0+IHtcbiAgICBsZXQgcHJveHlNaWRkbGV3YXJlOiBSZXF1ZXN0SGFuZGxlciB8IHVuZGVmaW5lZDtcblxuICAgIGxldCBwcm94eUNvbmZpZyA9XG4gICAgICB0eXBlb2YgcHJveHlDb25maWdPckNhbGxiYWNrID09PSAnZnVuY3Rpb24nXG4gICAgICAgID8gcHJveHlDb25maWdPckNhbGxiYWNrKClcbiAgICAgICAgOiBwcm94eUNvbmZpZ09yQ2FsbGJhY2s7XG5cbiAgICBwcm94eU1pZGRsZXdhcmUgPSBnZXRQcm94eU1pZGRsZXdhcmUocHJveHlDb25maWcpO1xuXG4gICAgLyogVE9ETzogZmlndXJlIG91dCBob3cgdG8gbWFrZSB0aGlzIHdvcmtcbiAgICBpZiAocHJveHlDb25maWcud3MpIHtcbiAgICAgIHRoaXMud2ViU29ja2V0UHJveGllcy5wdXNoKHByb3h5TWlkZGxld2FyZSk7XG4gICAgfVxuICAgICovXG5cbiAgICBjb25zdCBoYW5kbGVyID0gYXN5bmMgKHJlcTogUmVxdWVzdCwgcmVzOiBSZXNwb25zZSwgbmV4dDogTmV4dEZ1bmN0aW9uKSA9PiB7XG4gICAgICBpZiAodHlwZW9mIHByb3h5Q29uZmlnT3JDYWxsYmFjayA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICBjb25zdCBuZXdQcm94eUNvbmZpZyA9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G51bGw7XG4gICAgICAgIG5leHQoKTtcbiAgICAgIH0gZWxzZSBpZiAodHlwZW9mIGJ5cGFzc1VybCA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgLy8gYnlQYXNzIHRvIHRoYXQgdXJsXG4gICAgICAgIHJlcS51cmwgPSBieXBhc3NVcmw7XG4gICAgICAgIG5leHQoKTtcbiAgICAgIH0gZWxzZSBpZiAocHJveHlNaWRkbGV3YXJlKSB7XG4gICAgICAgIHJldHVybiBwcm94eU1pZGRsZXdhcmUocmVxLCByZXMsIG5leHQpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgbmV4dCgpO1xuICAgICAgfVxuICAgIH07XG5cbiAgICBtaWRkbGV3YXJlcy5wdXNoKHtcbiAgICAgIG5hbWU6ICdodHRwLXByb3h5LW1pZGRsZXdhcmUnLFxuICAgICAgbWlkZGxld2FyZTogaGFuZGxlcixcbiAgICB9KTtcbiAgICAvLyBBbHNvIGZvcndhcmQgZXJyb3IgcmVxdWVzdHMgdG8gdGhlIHByb3h5IHNvIGl0IGNhbiBoYW5kbGUgdGhlbS5cbiAgICBtaWRkbGV3YXJlcy5wdXNoKHtcbiAgICAgIG5hbWU6ICdodHRwLXByb3h5LW1pZGRsZXdhcmUtZXJyb3ItaGFuZGxlcicsXG4gICAgICBtaWRkbGV3YXJlOiAoXG4gICAgICAgIGVycm9yOiBFcnJvcixcbiAgICAgICAgcmVxOiBSZXF1ZXN0LFxuICAgICAgICByZXM6IFJlc3BvbnNlLFxuICAgICAgICBuZXh0OiBOZXh0RnVuY3Rpb24sXG4gICAgICApID0+
|
|
97
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRQcm94eU1pZGRsZXdhcmVzIiwicHJveHlDb25maWciLCJtaWRkbGV3YXJlcyIsImNyZWF0ZVByb3h5TWlkZGxld2FyZSIsInJlcXVpcmUiLCJwcm94eSIsIkFycmF5IiwiaXNBcnJheSIs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jb250ZXh0IHx8IHByb3h5Q29uZmlnLnBhdGg7XG5cbiAgICAgIHJldHVybiBjcmVhdGVQcm94eU1pZGRsZXdhcmUoLyoqIEB0eXBlIHtzdHJpbmd9ICovIGNvbnRleHQsIHByb3h5Q29uZmlnKTtcbiAgICB9XG5cbiAgICBpZiAocHJveHlDb25maWcucm91dGVyKSB7XG4gICAgICByZXR1cm4gY3JlYXRlUHJveHlNaWRkbGV3YXJlKHByb3h5Q29uZmlnKTtcbiAgICB9XG4gIH07XG5cbiAgLyoqXG4gICAqIEFzc3VtZSBhIHByb3h5IGNvbmZpZ3VyYXRpb24gc3BlY2lmaWVkIGFzOlxuICAgKiBwcm94eTogW1xuICAgKiAgIHtcbiAgICogICAgIGNvbnRleHQ6IFwidmFsdWVcIixcbiAgICogICAgIC4uLm9wdGlvbnMsXG4gICAqICAgfSxcbiAgICogICAvLyBvcjpcbiAgICogICBmdW5jdGlvbigpIHtcbiAgICogICAgIHJldHVybiB7XG4gICAqICAgICAgIGNvbnRleHQ6IFwiY29udGV4dFwiLFxuICAgKiAgICAgICAuLi5vcHRpb25zLFxuICAgKiAgICAgfTtcbiAgICogICB9XG4gICAqIF1cbiAgICovXG4gIHByb3h5LmZvckVhY2gocHJveHlDb25maWdPckNhbGxiYWNrID0+IHtcbiAgICBsZXQgcHJveHlNaWRkbGV3YXJlOiBSZXF1ZXN0SGFuZGxlciB8IHVuZGVmaW5lZDtcblxuICAgIGxldCBwcm94eUNvbmZpZyA9XG4gICAgICB0eXBlb2YgcHJveHlDb25maWdPckNhbGxiYWNrID09PSAnZnVuY3Rpb24nXG4gICAgICAgID8gcHJveHlDb25maWdPckNhbGxiYWNrKClcbiAgICAgICAgOiBwcm94eUNvbmZpZ09yQ2FsbGJhY2s7XG5cbiAgICBwcm94eU1pZGRsZXdhcmUgPSBnZXRQcm94eU1pZGRsZXdhcmUocHJveHlDb25maWcpO1xuXG4gICAgLyogVE9ETzogZmlndXJlIG91dCBob3cgdG8gbWFrZSB0a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BQUNwQiJ9
|
package/lib/scripts/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.serve = exports.devServe = void 0;
|
|
6
|
+
var _serve = _interopRequireDefault(require("./serve"));
|
|
7
|
+
exports.serve = _serve.default;
|
|
8
|
+
var _startDevserver = _interopRequireDefault(require("./startDevserver"));
|
|
9
|
+
exports.devServe = _startDevserver.default;
|
|
10
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjcmlwdHMvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBzZXJ2ZSB9IGZyb20gJy4vc2VydmUnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBkZXZTZXJ2ZSB9IGZyb20gJy4vc3RhcnREZXZzZXJ2ZXInO1xuIl0sIm1hcHBpbmdzIjoiOzs7OztBQUFBO0FBQTJDO0FBQzNDO0FBQXVEIn0=
|