@anansi/core 0.15.8 → 0.16.0
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 +15 -0
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/server.js +88 -17
- package/dist/server.js.map +1 -1
- package/lib/index.server.d.ts +1 -0
- package/lib/index.server.d.ts.map +1 -1
- package/lib/index.server.js +4 -2
- package/lib/laySpouts.js +2 -2
- package/lib/scripts/startDevserver.js +2 -2
- package/lib/spouts/DocumentComponent.d.ts +2 -1
- package/lib/spouts/DocumentComponent.d.ts.map +1 -1
- package/lib/spouts/DocumentComponent.js +4 -3
- package/lib/spouts/antd.js +18 -0
- package/lib/spouts/antd.server.d.ts +10 -0
- package/lib/spouts/antd.server.d.ts.map +1 -0
- package/lib/spouts/antd.server.js +34 -0
- package/lib/spouts/document copy.js +11 -0
- package/lib/spouts/document.js +1 -1
- package/lib/spouts/document.server.d.ts +3 -2
- package/lib/spouts/document.server.d.ts.map +1 -1
- package/lib/spouts/document.server.js +2 -1
- package/lib/spouts/router.js +2 -2
- package/lib/spouts/router.server.js +2 -2
- package/lib/spouts/types.js +1 -1
- package/package.json +9 -5
- package/src/index.server.ts +1 -0
- package/src/laySpouts.tsx +1 -1
- package/src/scripts/startDevserver.ts +1 -1
- package/src/spouts/DocumentComponent.tsx +3 -0
- package/src/spouts/antd.server.tsx +43 -0
- package/src/spouts/document.server.tsx +4 -2
- package/src/spouts/document.tsx +1 -1
- package/src/spouts/router.server.tsx +1 -1
- package/src/spouts/router.tsx +1 -1
- package/src/spouts/types.ts +3 -3
- package/lib/floodSpouts.d.ts +0 -7
- package/lib/floodSpouts.d.ts.map +0 -1
- package/lib/index.d.ts +0 -9
- package/lib/index.d.ts.map +0 -1
- package/lib/laySpouts.d.ts +0 -10
- package/lib/laySpouts.d.ts.map +0 -1
- package/lib/scripts/getProxyMiddlewares.d.ts +0 -3
- package/lib/scripts/getProxyMiddlewares.d.ts.map +0 -1
- package/lib/scripts/index.d.ts +0 -3
- package/lib/scripts/index.d.ts.map +0 -1
- package/lib/scripts/serve.d.ts +0 -7
- package/lib/scripts/serve.d.ts.map +0 -1
- package/lib/scripts/startDevserver.d.ts +0 -4
- package/lib/scripts/startDevserver.d.ts.map +0 -1
- package/lib/scripts/types.d.ts +0 -7
- package/lib/scripts/types.d.ts.map +0 -1
- package/lib/spouts/app.d.ts +0 -6
- package/lib/spouts/app.d.ts.map +0 -1
- package/lib/spouts/app.server.d.ts +0 -7
- package/lib/spouts/app.server.d.ts.map +0 -1
- package/lib/spouts/csp.d.ts +0 -5
- package/lib/spouts/csp.d.ts.map +0 -1
- package/lib/spouts/document.d.ts +0 -7
- package/lib/spouts/document.d.ts.map +0 -1
- package/lib/spouts/json.d.ts +0 -7
- package/lib/spouts/json.d.ts.map +0 -1
- package/lib/spouts/json.server.d.ts +0 -11
- package/lib/spouts/json.server.d.ts.map +0 -1
- package/lib/spouts/prefetch.server.d.ts +0 -8
- package/lib/spouts/prefetch.server.d.ts.map +0 -1
- package/lib/spouts/restHooks.d.ts +0 -8
- package/lib/spouts/restHooks.d.ts.map +0 -1
- package/lib/spouts/restHooks.server.d.ts +0 -15
- package/lib/spouts/restHooks.server.d.ts.map +0 -1
- package/lib/spouts/router.d.ts +0 -14
- package/lib/spouts/router.d.ts.map +0 -1
- package/lib/spouts/router.server.d.ts +0 -12
- package/lib/spouts/router.server.d.ts.map +0 -1
- package/lib/spouts/types.d.ts +0 -20
- package/lib/spouts/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.15.9...@anansi/core@0.16.0) (2023-01-18)
|
|
7
|
+
|
|
8
|
+
### 🚀 Features
|
|
9
|
+
|
|
10
|
+
* Add antdSpout ([651586d](https://github.com/ntucker/anansi/commit/651586d46213a4d91aec055720a6dc11bee64a46))
|
|
11
|
+
|
|
12
|
+
### 📦 Package
|
|
13
|
+
|
|
14
|
+
* Update `rimraf` to v4 ([#1817](https://github.com/ntucker/anansi/issues/1817)) ([1de7e67](https://github.com/ntucker/anansi/commit/1de7e67da2669bfe09f1c7ef5cd1f884dcf6ef60))
|
|
15
|
+
* Update linting packages ([#1811](https://github.com/ntucker/anansi/issues/1811)) ([51b95e6](https://github.com/ntucker/anansi/commit/51b95e64a755d64c6bc546602603f5a3fb175b59))
|
|
16
|
+
|
|
17
|
+
### [0.15.9](https://github.com/ntucker/anansi/compare/@anansi/core@0.15.8...@anansi/core@0.15.9) (2023-01-07)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @anansi/core
|
|
20
|
+
|
|
6
21
|
### [0.15.8](https://github.com/ntucker/anansi/compare/@anansi/core@0.15.7...@anansi/core@0.15.8) (2023-01-05)
|
|
7
22
|
|
|
8
23
|
### 📦 Package
|
package/dist/client.js
CHANGED
|
@@ -149,8 +149,8 @@ var _interopRequireDefault = (__webpack_require__("../../node_modules/@babel/run
|
|
|
149
149
|
exports.__esModule = true;
|
|
150
150
|
exports["default"] = routerSpout;
|
|
151
151
|
var _router = __webpack_require__("@anansi/router");
|
|
152
|
-
var _react = _interopRequireDefault(__webpack_require__("react"));
|
|
153
152
|
var _history = __webpack_require__("history");
|
|
153
|
+
var _react = _interopRequireDefault(__webpack_require__("react"));
|
|
154
154
|
var _jsxFileName = "/home/ntucker/src/anansi/packages/core/src/spouts/router.tsx";
|
|
155
155
|
function routerSpout(options) {
|
|
156
156
|
const createRouteComponent = router => function Router({
|
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;AAIA;AAGA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;;;;;;;;;;;;;AC1BA;AACA;
|
|
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;AAIA;AAGA;AAAA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;;;;;;;;;;;;;AC1BA;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;;;;;;;;;;;;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.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/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","import { CacheProvider, Manager, NetworkManager } from '@rest-hooks/react';\n\nimport type { ClientSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ClientSpout<{ getInitialData: (key: string) => Promise<any> }> {\n return next => async props => {\n const nextProps = await next(props);\n const data = await props.getInitialData('resthooks');\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;","// 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
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
var _interopRequireDefault = (__webpack_require__("../../node_modules/@babel/runtime/helpers/interopRequireDefault.js")["default"]);
|
|
11
11
|
exports.__esModule = true;
|
|
12
12
|
exports["default"] = laySpouts;
|
|
13
|
-
var _server = __webpack_require__("react-dom/server");
|
|
14
13
|
var _crypto = _interopRequireDefault(__webpack_require__("crypto"));
|
|
14
|
+
var _server = __webpack_require__("react-dom/server");
|
|
15
15
|
function laySpouts(spouts, {
|
|
16
16
|
timeoutMS = 10000,
|
|
17
17
|
onError
|
|
@@ -89,7 +89,8 @@ function Document({
|
|
|
89
89
|
charSet,
|
|
90
90
|
csPolicy,
|
|
91
91
|
nonce,
|
|
92
|
-
scripts
|
|
92
|
+
scripts,
|
|
93
|
+
extraStyle
|
|
93
94
|
}) {
|
|
94
95
|
let cspMeta = null;
|
|
95
96
|
if (csPolicy) {
|
|
@@ -112,7 +113,7 @@ function Document({
|
|
|
112
113
|
__self: this,
|
|
113
114
|
__source: {
|
|
114
115
|
fileName: _jsxFileName,
|
|
115
|
-
lineNumber:
|
|
116
|
+
lineNumber: 48,
|
|
116
117
|
columnNumber: 7
|
|
117
118
|
}
|
|
118
119
|
});
|
|
@@ -121,14 +122,14 @@ function Document({
|
|
|
121
122
|
__self: this,
|
|
122
123
|
__source: {
|
|
123
124
|
fileName: _jsxFileName,
|
|
124
|
-
lineNumber:
|
|
125
|
+
lineNumber: 52,
|
|
125
126
|
columnNumber: 5
|
|
126
127
|
}
|
|
127
128
|
}, /*#__PURE__*/_react.default.createElement("head", {
|
|
128
129
|
__self: this,
|
|
129
130
|
__source: {
|
|
130
131
|
fileName: _jsxFileName,
|
|
131
|
-
lineNumber:
|
|
132
|
+
lineNumber: 53,
|
|
132
133
|
columnNumber: 7
|
|
133
134
|
}
|
|
134
135
|
}, /*#__PURE__*/_react.default.createElement("meta", {
|
|
@@ -136,31 +137,31 @@ function Document({
|
|
|
136
137
|
__self: this,
|
|
137
138
|
__source: {
|
|
138
139
|
fileName: _jsxFileName,
|
|
139
|
-
lineNumber:
|
|
140
|
+
lineNumber: 54,
|
|
140
141
|
columnNumber: 9
|
|
141
142
|
}
|
|
142
|
-
}), cspMeta, head, assets.map((asset, i) => /*#__PURE__*/_react.default.createElement("link", {
|
|
143
|
+
}), cspMeta, head, extraStyle, assets.map((asset, i) => /*#__PURE__*/_react.default.createElement("link", {
|
|
143
144
|
key: i,
|
|
144
145
|
rel: "preload",
|
|
145
146
|
...asset,
|
|
146
147
|
__self: this,
|
|
147
148
|
__source: {
|
|
148
149
|
fileName: _jsxFileName,
|
|
149
|
-
lineNumber:
|
|
150
|
+
lineNumber: 59,
|
|
150
151
|
columnNumber: 11
|
|
151
152
|
}
|
|
152
153
|
})), /*#__PURE__*/_react.default.createElement("title", {
|
|
153
154
|
__self: this,
|
|
154
155
|
__source: {
|
|
155
156
|
fileName: _jsxFileName,
|
|
156
|
-
lineNumber:
|
|
157
|
+
lineNumber: 61,
|
|
157
158
|
columnNumber: 9
|
|
158
159
|
}
|
|
159
160
|
}, title)), /*#__PURE__*/_react.default.createElement("body", {
|
|
160
161
|
__self: this,
|
|
161
162
|
__source: {
|
|
162
163
|
fileName: _jsxFileName,
|
|
163
|
-
lineNumber:
|
|
164
|
+
lineNumber: 63,
|
|
164
165
|
columnNumber: 7
|
|
165
166
|
}
|
|
166
167
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -168,7 +169,7 @@ function Document({
|
|
|
168
169
|
__self: this,
|
|
169
170
|
__source: {
|
|
170
171
|
fileName: _jsxFileName,
|
|
171
|
-
lineNumber:
|
|
172
|
+
lineNumber: 64,
|
|
172
173
|
columnNumber: 9
|
|
173
174
|
}
|
|
174
175
|
}, children), scripts, assets.filter(({
|
|
@@ -182,7 +183,7 @@ function Document({
|
|
|
182
183
|
__self: this,
|
|
183
184
|
__source: {
|
|
184
185
|
fileName: _jsxFileName,
|
|
185
|
-
lineNumber:
|
|
186
|
+
lineNumber: 69,
|
|
186
187
|
columnNumber: 13
|
|
187
188
|
}
|
|
188
189
|
}))));
|
|
@@ -194,7 +195,7 @@ Document.defaultProps = {
|
|
|
194
195
|
__self: void 0,
|
|
195
196
|
__source: {
|
|
196
197
|
fileName: _jsxFileName,
|
|
197
|
-
lineNumber:
|
|
198
|
+
lineNumber: 78,
|
|
198
199
|
columnNumber: 7
|
|
199
200
|
}
|
|
200
201
|
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
@@ -203,7 +204,7 @@ Document.defaultProps = {
|
|
|
203
204
|
__self: void 0,
|
|
204
205
|
__source: {
|
|
205
206
|
fileName: _jsxFileName,
|
|
206
|
-
lineNumber:
|
|
207
|
+
lineNumber: 79,
|
|
207
208
|
columnNumber: 7
|
|
208
209
|
}
|
|
209
210
|
})),
|
|
@@ -214,6 +215,65 @@ Document.defaultProps = {
|
|
|
214
215
|
|
|
215
216
|
/***/ }),
|
|
216
217
|
|
|
218
|
+
/***/ "./src/spouts/antd.server.tsx":
|
|
219
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
220
|
+
|
|
221
|
+
"use strict";
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
var _interopRequireDefault = (__webpack_require__("../../node_modules/@babel/runtime/helpers/interopRequireDefault.js")["default"]);
|
|
225
|
+
exports.__esModule = true;
|
|
226
|
+
exports["default"] = antdSpout;
|
|
227
|
+
var _cssinjs = __webpack_require__("@ant-design/cssinjs");
|
|
228
|
+
var _react = _interopRequireDefault(__webpack_require__("react"));
|
|
229
|
+
var _jsxFileName = "/home/ntucker/src/anansi/packages/core/src/spouts/antd.server.tsx";
|
|
230
|
+
function antdSpout() {
|
|
231
|
+
return next => async props => {
|
|
232
|
+
var _nextProps$scripts;
|
|
233
|
+
const cache = (0, _cssinjs.createCache)();
|
|
234
|
+
const nextProps = await next(props);
|
|
235
|
+
const scripts = (_nextProps$scripts = nextProps.scripts) != null ? _nextProps$scripts : [];
|
|
236
|
+
const AntdSheets = () => {
|
|
237
|
+
return /*#__PURE__*/_react.default.createElement("script", {
|
|
238
|
+
dangerouslySetInnerHTML: {
|
|
239
|
+
__html: `</script>${(0, _cssinjs.extractStyle)(cache)}<script>`
|
|
240
|
+
},
|
|
241
|
+
__self: this,
|
|
242
|
+
__source: {
|
|
243
|
+
fileName: _jsxFileName,
|
|
244
|
+
lineNumber: 26,
|
|
245
|
+
columnNumber: 9
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
// unfortunately we have to inject this after the entire content has streamed in or it doesn't correctly populate
|
|
250
|
+
// see: https://github.com/ant-design/cssinjs/issues/79
|
|
251
|
+
scripts.push( /*#__PURE__*/_react.default.createElement(AntdSheets, {
|
|
252
|
+
__self: this,
|
|
253
|
+
__source: {
|
|
254
|
+
fileName: _jsxFileName,
|
|
255
|
+
lineNumber: 35,
|
|
256
|
+
columnNumber: 18
|
|
257
|
+
}
|
|
258
|
+
}));
|
|
259
|
+
return {
|
|
260
|
+
...nextProps,
|
|
261
|
+
app: /*#__PURE__*/_react.default.createElement(_cssinjs.StyleProvider, {
|
|
262
|
+
cache: cache,
|
|
263
|
+
__self: this,
|
|
264
|
+
__source: {
|
|
265
|
+
fileName: _jsxFileName,
|
|
266
|
+
lineNumber: 39,
|
|
267
|
+
columnNumber: 12
|
|
268
|
+
}
|
|
269
|
+
}, nextProps.app),
|
|
270
|
+
scripts
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/***/ }),
|
|
276
|
+
|
|
217
277
|
/***/ "./src/spouts/app.server.tsx":
|
|
218
278
|
/***/ ((__unused_webpack_module, exports) => {
|
|
219
279
|
|
|
@@ -308,6 +368,7 @@ function DocumentSpout(options) {
|
|
|
308
368
|
...nextProps,
|
|
309
369
|
app: /*#__PURE__*/_react.default.createElement(_DocumentComponent.default, {
|
|
310
370
|
...options,
|
|
371
|
+
extraStyle: nextProps.extraStyle,
|
|
311
372
|
title: (_nextProps$title = nextProps.title) != null ? _nextProps$title : options.title,
|
|
312
373
|
assets: assets,
|
|
313
374
|
rootId: options.rootId,
|
|
@@ -317,7 +378,7 @@ function DocumentSpout(options) {
|
|
|
317
378
|
__self: this,
|
|
318
379
|
__source: {
|
|
319
380
|
fileName: _jsxFileName,
|
|
320
|
-
lineNumber:
|
|
381
|
+
lineNumber: 77,
|
|
321
382
|
columnNumber: 9
|
|
322
383
|
}
|
|
323
384
|
}, nextProps.app)
|
|
@@ -491,8 +552,8 @@ var _interopRequireDefault = (__webpack_require__("../../node_modules/@babel/run
|
|
|
491
552
|
exports.__esModule = true;
|
|
492
553
|
exports["default"] = routerSpout;
|
|
493
554
|
var _router = __webpack_require__("@anansi/router");
|
|
494
|
-
var _react = _interopRequireDefault(__webpack_require__("react"));
|
|
495
555
|
var _history = __webpack_require__("history");
|
|
556
|
+
var _react = _interopRequireDefault(__webpack_require__("react"));
|
|
496
557
|
var _jsxFileName = "/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx";
|
|
497
558
|
function routerSpout(options) {
|
|
498
559
|
const createRouteComponent = router => function Router({
|
|
@@ -549,6 +610,14 @@ module.exports = require("@anansi/router");
|
|
|
549
610
|
|
|
550
611
|
/***/ }),
|
|
551
612
|
|
|
613
|
+
/***/ "@ant-design/cssinjs":
|
|
614
|
+
/***/ ((module) => {
|
|
615
|
+
|
|
616
|
+
"use strict";
|
|
617
|
+
module.exports = require("@ant-design/cssinjs");
|
|
618
|
+
|
|
619
|
+
/***/ }),
|
|
620
|
+
|
|
552
621
|
/***/ "@rest-hooks/react":
|
|
553
622
|
/***/ ((module) => {
|
|
554
623
|
|
|
@@ -708,13 +777,15 @@ var exports = __webpack_exports__;
|
|
|
708
777
|
|
|
709
778
|
var _interopRequireDefault = (__webpack_require__("../../node_modules/@babel/runtime/helpers/interopRequireDefault.js")["default"]);
|
|
710
779
|
exports.__esModule = true;
|
|
711
|
-
exports.routerSpout = exports.restHooksSpout = exports.prefetchSpout = exports.laySpouts = exports.documentSpout = exports.appSpout = exports.JSONSpout = void 0;
|
|
780
|
+
exports.routerSpout = exports.restHooksSpout = exports.prefetchSpout = exports.laySpouts = exports.documentSpout = exports.appSpout = exports.antdSpout = exports.JSONSpout = void 0;
|
|
712
781
|
var _laySpouts = _interopRequireDefault(__webpack_require__("./src/laySpouts.tsx"));
|
|
713
782
|
exports.laySpouts = _laySpouts.default;
|
|
714
783
|
var _document = _interopRequireDefault(__webpack_require__("./src/spouts/document.server.tsx"));
|
|
715
784
|
exports.documentSpout = _document.default;
|
|
716
785
|
var _restHooks = _interopRequireDefault(__webpack_require__("./src/spouts/restHooks.server.tsx"));
|
|
717
786
|
exports.restHooksSpout = _restHooks.default;
|
|
787
|
+
var _antd = _interopRequireDefault(__webpack_require__("./src/spouts/antd.server.tsx"));
|
|
788
|
+
exports.antdSpout = _antd.default;
|
|
718
789
|
var _router = _interopRequireDefault(__webpack_require__("./src/spouts/router.server.tsx"));
|
|
719
790
|
exports.routerSpout = _router.default;
|
|
720
791
|
var _prefetch = _interopRequireDefault(__webpack_require__("./src/spouts/prefetch.server.tsx"));
|
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;;;;;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ACA;AACA;AAEA;AACA;AAEA;AAAA;AAAA;AAGA;;;;;;;;;;;;;ACjGA;AAAA;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;;;;;;;;;;;;;;ACrCA;AAMA;AAAA;AAKA;AAGA;AAAA;AAMA;AACA;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;;;;;;;;;;;;;AC1CA;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;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","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/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 \"@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 { renderToPipeableStream as reactRender } from 'react-dom/server';\nimport crypto from 'crypto';\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 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}: 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 {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 { 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 React from 'react';\nimport type { Route } from '@anansi/router';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { ServerSpout } from './types';\nimport type { Policy } from './csp';\nimport Document from './DocumentComponent';\n\ntype NeededNext = {\n matchedRoutes: Route<any>[];\n title?: string;\n scripts?: 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 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 {\n type Controller,\n type Manager,\n NetworkManager,\n type State,\n} from '@rest-hooks/react';\nimport { createPersistedStore } from '@rest-hooks/ssr';\nimport type { Store } from 'redux';\n\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown>; scripts?: React.ReactNode[] }\n> {\n const managers = options.getManagers();\n return next => async props => {\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 React from 'react';\nimport { createMemoryHistory } from 'history';\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(\"@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 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;A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;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 { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs';\nimport 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 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 {\n type Controller,\n type Manager,\n NetworkManager,\n type State,\n} from '@rest-hooks/react';\nimport { createPersistedStore } from '@rest-hooks/ssr';\nimport type { Store } from 'redux';\n\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown>; scripts?: React.ReactNode[] }\n> {\n const managers = options.getManagers();\n return next => async props => {\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/index.server.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as laySpouts } from './laySpouts';
|
|
2
2
|
export { default as documentSpout } from './spouts/document.server';
|
|
3
3
|
export { default as restHooksSpout } from './spouts/restHooks.server';
|
|
4
|
+
export { default as antdSpout } from './spouts/antd.server';
|
|
4
5
|
export { default as routerSpout } from './spouts/router.server';
|
|
5
6
|
export { default as prefetchSpout } from './spouts/prefetch.server';
|
|
6
7
|
export { default as JSONSpout } from './spouts/json.server';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,WAAW,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,WAAW,IAAI,KAAK,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/index.server.js
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.routerSpout = exports.restHooksSpout = exports.prefetchSpout = exports.laySpouts = exports.documentSpout = exports.appSpout = exports.JSONSpout = void 0;
|
|
5
|
+
exports.routerSpout = exports.restHooksSpout = exports.prefetchSpout = exports.laySpouts = exports.documentSpout = exports.appSpout = exports.antdSpout = exports.JSONSpout = void 0;
|
|
6
6
|
var _laySpouts = _interopRequireDefault(require("./laySpouts"));
|
|
7
7
|
exports.laySpouts = _laySpouts.default;
|
|
8
8
|
var _document = _interopRequireDefault(require("./spouts/document.server"));
|
|
9
9
|
exports.documentSpout = _document.default;
|
|
10
10
|
var _restHooks = _interopRequireDefault(require("./spouts/restHooks.server"));
|
|
11
11
|
exports.restHooksSpout = _restHooks.default;
|
|
12
|
+
var _antd = _interopRequireDefault(require("./spouts/antd.server"));
|
|
13
|
+
exports.antdSpout = _antd.default;
|
|
12
14
|
var _router = _interopRequireDefault(require("./spouts/router.server"));
|
|
13
15
|
exports.routerSpout = _router.default;
|
|
14
16
|
var _prefetch = _interopRequireDefault(require("./spouts/prefetch.server"));
|
|
@@ -17,4 +19,4 @@ var _json = _interopRequireDefault(require("./spouts/json.server"));
|
|
|
17
19
|
exports.JSONSpout = _json.default;
|
|
18
20
|
var _app = _interopRequireDefault(require("./spouts/app.server"));
|
|
19
21
|
exports.appSpout = _app.default;
|
|
20
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnNlcnZlci50cyJdLCJzb3VyY2VzQ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RequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = laySpouts;
|
|
6
|
-
var _server = require("react-dom/server");
|
|
7
6
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
7
|
+
var _server = require("react-dom/server");
|
|
8
8
|
function laySpouts(spouts, {
|
|
9
9
|
timeoutMS = 10000,
|
|
10
10
|
onError
|
|
@@ -57,4 +57,4 @@ function laySpouts(spouts, {
|
|
|
57
57
|
};
|
|
58
58
|
return render;
|
|
59
59
|
}
|
|
60
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
60
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJsYXlTcG91dHMiLCJzcG91dHMiLCJ0aW1lb3V0TVMiLCJvbkVycm9yIiwicmVuZGVyIiwiY2xpZW50TWFuaWZlc3QiLCJyZXEiLCJyZXMiLCJub25jZSIsImNyeXB0byIsInJhbmRvbUJ5dGVzIiwidG9TdHJpbmciLCJhcHAiLCJkaWRFcnJvciIsInBpcGUiLCJhYm9ydCIsInJlYWN0UmVuZGVyIiwib25TaGVsbFJlYWR5Iiwic3RhdHVzQ29kZSIsInNldEhlYWRlciIsIm9uU2hlbGxFcnJvciIsImUiLCJjb25zb2xlIiwiZXJyb3IiLCJzZXRUaW1lb3V0Il0sInNvdXJjZXMiOlsiLi4vc3JjL2xheVNwb3V0cy50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNyeXB0byBmcm9tICdjcnlwdG8nO1xuaW1wb3J0IHsgcmVuZGVyVG9QaXBlYWJsZVN0cmVhbSBhcyByZWFjdFJlbmRlciB9IGZyb20gJ3JlYWN0LWRvbS9zZXJ2ZXInO1xuXG5pbXBvcnQgeyBSZW5kZXIgfSBmcm9tICcuL3NjcmlwdHMvdHlwZXMnO1xuaW1wb3J0IHsgU2VydmVyUHJvcHMgfSBmcm9tICcuL3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iAgICAgICAgICByZXMuc3RhdHVzQ29kZSA9IGRpZEVycm9yID8gNTAwIDogMjAwO1xuICAgICAgICAgIHJlcy5zZXRIZWFkZXIoJ0NvbnRlbnQtdHlwZScsICd0ZXh0L2h0bWwnKTtcbiAgICAgICAgICBwaXBlKHJlcyk7XG4gICAgICAgIH0sXG4gICAgICAgIG9uU2hlbGxFcnJvcigpIHtcbiAgICAgICAgICBkaWRFcnJvciA9IHRydWU7XG4gICAgICAgICAgcmVzLnN0YXR1c0NvZGUgPSA1MDA7XG4gICAgICAgICAgcGlwZShyZXMpO1xuICAgICAgICB9LFxuICAgICAgICBvbkVycm9yKGU6IGFueSkge1xuICAgICAgICAgIGRpZEVycm9yID0gdHJ1ZTtcbiAgICAgICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgICAgICAgIHJlcy5zdGF0dXNDb2RlID0gNTAwO1xuICAgICAgICAgIC8vcGlwZShyZXMpOyBSZW1vdmluZyB0aGlzIGF2b2lkcywgXCJSZWFjdCBjdXJyZW50bHkgb25seSBzdXBwb3J0cyBwaXBpbmcgdG8gb25lIHdyaXRhYmxlIHN0cmVhbS5cIlxuICAgICAgICAgIGlmIChvbkVycm9yKSBvbkVycm9yKGUpO1xuICAgICAgICB9LFxuICAgICAgfSk7XG4gICAgICAvLyBBYmFuZG9uIGFuZCBzd2l0Y2ggdG8gY2xpZW50IHJlbmRlcmluZyBpZiBlbm91Z2ggdGltZSBwYXNzZXMuXG4gICAgICAvLyBUcnkgbG93ZXJpbmcgdGhpcyB0byBzZWUgdGhlIGNsaWVudCByZWNvdmVyLlxuICAgICAgc2V0VGltZW91dChcbiAgICAgICAgKCkgPT4gKGFib3J0IGFzIGFueSkoYFRpbWVvdXQgb2YgJHt0aW1lb3V0TVN9bXMgZXhjZWVkZWRgKSxcbiAgICAgICAgdGltZW91dE1TLFxuICAgICAgKTtcbiAgICB9IGNhdGNoIChlOiB1bmtub3duKSB7XG4gICAgICBpZiAob25FcnJvcikgb25FcnJvcihl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