@anansi/core 0.7.4 → 0.10.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 +60 -0
- package/dist/client.js +3 -2
- package/dist/client.js.map +1 -1
- package/dist/server.js +27 -23
- package/dist/server.js.map +1 -1
- package/lib/floodSpouts.d.ts +6 -0
- package/lib/floodSpouts.d.ts.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.server.d.ts +6 -0
- package/lib/index.server.d.ts.map +1 -0
- package/lib/laySpouts.d.ts +8 -0
- package/lib/laySpouts.d.ts.map +1 -0
- package/lib/scripts/getProxyMiddlewares.d.ts +3 -0
- package/lib/scripts/getProxyMiddlewares.d.ts.map +1 -0
- package/lib/scripts/getProxyMiddlewares.js +106 -0
- package/lib/scripts/index.d.ts +3 -0
- package/lib/scripts/index.d.ts.map +1 -0
- package/lib/scripts/index.js +15 -0
- package/lib/scripts/serve.d.ts +7 -0
- package/lib/scripts/serve.d.ts.map +1 -0
- package/lib/scripts/serve.js +188 -0
- package/lib/scripts/startDevserver.d.ts +4 -0
- package/lib/scripts/startDevserver.d.ts.map +1 -0
- package/lib/scripts/startDevserver.js +171 -167
- package/lib/scripts/types.d.ts +7 -0
- package/lib/scripts/types.d.ts.map +1 -0
- package/lib/spouts/DocumentComponent.d.ts +23 -0
- package/lib/spouts/DocumentComponent.d.ts.map +1 -0
- package/lib/spouts/DocumentComponent.js +10 -6
- package/lib/spouts/document.d.ts +13 -0
- package/lib/spouts/document.d.ts.map +1 -0
- package/lib/spouts/document.server.d.ts +17 -0
- package/lib/spouts/document.server.d.ts.map +1 -0
- package/lib/spouts/document.server.js +1 -1
- package/lib/spouts/prefetch.server.d.ts +8 -0
- package/lib/spouts/prefetch.server.d.ts.map +1 -0
- package/lib/spouts/restHooks.d.ts +8 -0
- package/lib/spouts/restHooks.d.ts.map +1 -0
- package/lib/spouts/restHooks.server.d.ts +9 -0
- package/lib/spouts/restHooks.server.d.ts.map +1 -0
- package/lib/spouts/router.d.ts +14 -0
- package/lib/spouts/router.d.ts.map +1 -0
- package/lib/spouts/router.js +3 -2
- package/lib/spouts/router.server.d.ts +12 -0
- package/lib/spouts/router.server.d.ts.map +1 -0
- package/lib/spouts/types.d.ts +16 -0
- package/lib/spouts/types.d.ts.map +1 -0
- package/package.json +15 -8
- package/src/scripts/getProxyMiddlewares.ts +129 -0
- package/src/scripts/index.ts +2 -0
- package/src/scripts/serve.ts +211 -0
- package/src/scripts/startDevserver.ts +204 -198
- package/src/spouts/DocumentComponent.tsx +8 -2
- package/src/spouts/document.server.tsx +2 -1
- package/src/spouts/router.tsx +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,66 @@
|
|
|
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.10.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.9.0...@anansi/core@0.10.0) (2022-06-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
* add router onChange() ([5c981ed](https://github.com/ntucker/anansi/commit/5c981ed587b55a80fd4f604fc24fb143d2355a06))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### 💅 Enhancement
|
|
15
|
+
|
|
16
|
+
* Do require cache invalidation ourselves ([22b4e4c](https://github.com/ntucker/anansi/commit/22b4e4c2e4ce3d7de999813bd4e9397e770fe788))
|
|
17
|
+
* Improve devserver node 'require' reliability ([#1538](https://github.com/ntucker/anansi/issues/1538)) ([96b6a54](https://github.com/ntucker/anansi/commit/96b6a54562b97f116fc987b41fbf7547770debc8))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### 🐛 Bug Fix
|
|
21
|
+
|
|
22
|
+
* rootId is optional ([ff43166](https://github.com/ntucker/anansi/commit/ff43166d457ac93ffca2eae0738d81e734b6936e))
|
|
23
|
+
* SSR hot-reloading ([9809ad5](https://github.com/ntucker/anansi/commit/9809ad5798e9082554f0358fcd9c301a87e4acbf))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 📦 Package
|
|
27
|
+
|
|
28
|
+
* Move compression to correct package ([1ce18ba](https://github.com/ntucker/anansi/commit/1ce18ba9d7dc4d04682184bc1fa74354684294bb))
|
|
29
|
+
* Update all non-major dependencies ([#1531](https://github.com/ntucker/anansi/issues/1531)) ([2677241](https://github.com/ntucker/anansi/commit/26772415c2763f35c1720a08bb4b5417214f20d3))
|
|
30
|
+
* Update jest monorepo to ^28.1.1 ([#1534](https://github.com/ntucker/anansi/issues/1534)) ([b73dea2](https://github.com/ntucker/anansi/commit/b73dea2ee14f914bdbca189000265693d7fb112f))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [0.9.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.8.0...@anansi/core@0.9.0) (2022-05-29)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### 🚀 Features
|
|
38
|
+
|
|
39
|
+
* --serveProxy: [non-dev] uses webpack proxy config ([774f826](https://github.com/ntucker/anansi/commit/774f82646542d8acfcb0ddceb6fc75fcc2851a01))
|
|
40
|
+
* Add option to serve assets with production server ([bfb20eb](https://github.com/ntucker/anansi/commit/bfb20eb1564fc2c6b72fea79d0722ac6186797fe))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### 💅 Enhancement
|
|
44
|
+
|
|
45
|
+
* Handle root asset path ([a770c77](https://github.com/ntucker/anansi/commit/a770c77c4775b09ff86f26cfd5983eab5d211f74))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### 🐛 Bug Fix
|
|
49
|
+
|
|
50
|
+
* documentSpout options type ([6707d35](https://github.com/ntucker/anansi/commit/6707d3592f7f0ab772a10d623d1d765a9301c3ae))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [0.8.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.4...@anansi/core@0.8.0) (2022-05-29)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### 🚀 Features
|
|
58
|
+
|
|
59
|
+
* Add anansi serve command ([#1525](https://github.com/ntucker/anansi/issues/1525)) ([ac5a396](https://github.com/ntucker/anansi/commit/ac5a396f9640ce18058813c1594d49367a8aa468))
|
|
60
|
+
* Add charSet option to documentSpout ([51d3168](https://github.com/ntucker/anansi/commit/51d31681d27144d06b8ed4c7da9aae43fd10f12b))
|
|
61
|
+
* Add production node service ([bceeb56](https://github.com/ntucker/anansi/commit/bceeb56c23c8f8c3dc4a15d35dc8877f277e3d2f))
|
|
62
|
+
* Handle devserver proxy ([e7c5b38](https://github.com/ntucker/anansi/commit/e7c5b38cdb60b236db15ffb28622889b0b771515))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
6
66
|
### [0.7.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.3...@anansi/core@0.7.4) (2022-05-28)
|
|
7
67
|
|
|
8
68
|
|
package/dist/client.js
CHANGED
|
@@ -139,10 +139,11 @@ function routerSpout(options) {
|
|
|
139
139
|
return /*#__PURE__*/external_react_default().createElement(router_namespaceObject.RouteProvider, {
|
|
140
140
|
router: router,
|
|
141
141
|
resolveWith: resolveWith,
|
|
142
|
+
onChange: options.onChange,
|
|
142
143
|
__self: this,
|
|
143
144
|
__source: {
|
|
144
145
|
fileName: router_jsxFileName,
|
|
145
|
-
lineNumber:
|
|
146
|
+
lineNumber: 23,
|
|
146
147
|
columnNumber: 9
|
|
147
148
|
}
|
|
148
149
|
}, children);
|
|
@@ -162,7 +163,7 @@ function routerSpout(options) {
|
|
|
162
163
|
__self: this,
|
|
163
164
|
__source: {
|
|
164
165
|
fileName: router_jsxFileName,
|
|
165
|
-
lineNumber:
|
|
166
|
+
lineNumber: 46,
|
|
166
167
|
columnNumber: 14
|
|
167
168
|
}
|
|
168
169
|
}, nextProps.app)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAEA;AAIA;AAAA;AACA;;AACA;AAAA;AAAA;AAEA;AACA;;ACDA;AAIA;AACA;AACA;AAEA;AACA;AACA;AACA;;ACrBA;;;ACAA;;ACAA;;;;ACAA;AACA;AAMA;AAGA;AAAA;AAEA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AALA;AASA;AACA;AACA;;AC7BA;;ACAA;;;ACAA;AACA;AACA;AAMA;
|
|
1
|
+
{"version":3,"file":"client.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAEA;AAIA;AAAA;AACA;;AACA;AAAA;AAAA;AAEA;AACA;;ACDA;AAIA;AACA;AACA;AAEA;AACA;AACA;AACA;;ACrBA;;;ACAA;;ACAA;;;;ACAA;AACA;AAMA;AAGA;AAAA;AAEA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AALA;AASA;AACA;AACA;;AC7BA;;ACAA;;;ACAA;AACA;AACA;AAOA;AAMA;AAGA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AAHA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;;AAEA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAJA;AAMA;AACA;AACA;;ACjDA;AACA;AACA","sources":["/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/client\"","/home/ntucker/src/anansi/packages/core/src/floodSpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/ssr\"","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.tsx","/home/ntucker/src/anansi/packages/core/src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/client\");","import { hydrateRoot } from 'react-dom/client';\n\nexport default async function floodSpouts(\n spouts: () => 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","import React from 'react';\nimport type { Route } from '@anansi/router';\n\nimport type { ResolveProps } from './types';\n\ntype NeededProps = {\n matchedRoutes: Route<any>[];\n title?: string;\n} & ResolveProps;\n\nexport default function documentSpout(options: {\n head?: React.ReactNode;\n title: string;\n}) {\n return function <T extends NeededProps>(next: () => Promise<T>) {\n return async () => {\n const nextProps = await next();\n\n return nextProps;\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/ssr\");","import { CacheProvider, Manager, NetworkManager } from '@rest-hooks/core';\nimport { ServerDataComponent, getDatafromDOM } from '@rest-hooks/ssr';\n\nimport type { ResolveProps } from './types';\n\ntype NeededProps = ResolveProps;\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n) {\n return function <T extends NeededProps>(next: () => Promise<T>) {\n return async () => {\n const data = getDatafromDOM();\n\n const nextProps = await next();\n\n return {\n ...nextProps,\n app: (\n <CacheProvider initialState={data} managers={options.getManagers()}>\n {nextProps.app}\n <ServerDataComponent data={data} />\n </CacheProvider>\n ),\n };\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createBrowserHistory } from 'history';\nimport type { Update } from 'history';\n\nimport type { ResolveProps, CreateRouter } from './types';\n\ntype NeededProps = ResolveProps;\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}) {\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 function <T extends NeededProps>(next: () => Promise<T>) {\n return async () => {\n const history = createBrowserHistory();\n const router = options.createRouter(history);\n const matchedRoutes = router.getMatchedRoutes(history.location.pathname);\n\n const nextProps = await next();\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\n };\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';\n"],"names":[],"sourceRoot":""}
|
package/dist/server.js
CHANGED
|
@@ -128,51 +128,62 @@ function laySpouts(spouts, {
|
|
|
128
128
|
const external_react_namespaceObject = require("react");
|
|
129
129
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
|
|
130
130
|
;// CONCATENATED MODULE: ./src/spouts/DocumentComponent.tsx
|
|
131
|
-
var _jsxFileName = "/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx"
|
|
131
|
+
var _jsxFileName = "/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx",
|
|
132
|
+
_process$env$WEBPACK_;
|
|
133
|
+
|
|
132
134
|
|
|
133
135
|
function Document({
|
|
134
136
|
assets,
|
|
135
137
|
head,
|
|
136
138
|
children,
|
|
137
139
|
title,
|
|
138
|
-
rootId
|
|
140
|
+
rootId,
|
|
141
|
+
charSet
|
|
139
142
|
}) {
|
|
140
143
|
return /*#__PURE__*/external_react_default().createElement("html", {
|
|
141
144
|
__self: this,
|
|
142
145
|
__source: {
|
|
143
146
|
fileName: _jsxFileName,
|
|
144
|
-
lineNumber:
|
|
147
|
+
lineNumber: 19,
|
|
145
148
|
columnNumber: 5
|
|
146
149
|
}
|
|
147
150
|
}, /*#__PURE__*/external_react_default().createElement("head", {
|
|
148
151
|
__self: this,
|
|
149
152
|
__source: {
|
|
150
153
|
fileName: _jsxFileName,
|
|
151
|
-
lineNumber:
|
|
154
|
+
lineNumber: 20,
|
|
152
155
|
columnNumber: 7
|
|
153
156
|
}
|
|
154
|
-
},
|
|
157
|
+
}, /*#__PURE__*/external_react_default().createElement("meta", {
|
|
158
|
+
charSet: charSet,
|
|
159
|
+
__self: this,
|
|
160
|
+
__source: {
|
|
161
|
+
fileName: _jsxFileName,
|
|
162
|
+
lineNumber: 21,
|
|
163
|
+
columnNumber: 9
|
|
164
|
+
}
|
|
165
|
+
}), head, assets.map((asset, i) => /*#__PURE__*/external_react_default().createElement("link", {
|
|
155
166
|
key: i,
|
|
156
167
|
rel: "preload",
|
|
157
168
|
...asset,
|
|
158
169
|
__self: this,
|
|
159
170
|
__source: {
|
|
160
171
|
fileName: _jsxFileName,
|
|
161
|
-
lineNumber:
|
|
172
|
+
lineNumber: 24,
|
|
162
173
|
columnNumber: 11
|
|
163
174
|
}
|
|
164
175
|
})), /*#__PURE__*/external_react_default().createElement("title", {
|
|
165
176
|
__self: this,
|
|
166
177
|
__source: {
|
|
167
178
|
fileName: _jsxFileName,
|
|
168
|
-
lineNumber:
|
|
179
|
+
lineNumber: 26,
|
|
169
180
|
columnNumber: 9
|
|
170
181
|
}
|
|
171
182
|
}, title)), /*#__PURE__*/external_react_default().createElement("body", {
|
|
172
183
|
__self: this,
|
|
173
184
|
__source: {
|
|
174
185
|
fileName: _jsxFileName,
|
|
175
|
-
lineNumber:
|
|
186
|
+
lineNumber: 28,
|
|
176
187
|
columnNumber: 7
|
|
177
188
|
}
|
|
178
189
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
@@ -180,7 +191,7 @@ function Document({
|
|
|
180
191
|
__self: this,
|
|
181
192
|
__source: {
|
|
182
193
|
fileName: _jsxFileName,
|
|
183
|
-
lineNumber:
|
|
194
|
+
lineNumber: 29,
|
|
184
195
|
columnNumber: 9
|
|
185
196
|
}
|
|
186
197
|
}, children), /*#__PURE__*/external_react_default().createElement("script", {
|
|
@@ -190,7 +201,7 @@ function Document({
|
|
|
190
201
|
__self: this,
|
|
191
202
|
__source: {
|
|
192
203
|
fileName: _jsxFileName,
|
|
193
|
-
lineNumber:
|
|
204
|
+
lineNumber: 31,
|
|
194
205
|
columnNumber: 9
|
|
195
206
|
}
|
|
196
207
|
}), assets.filter(({
|
|
@@ -204,39 +215,32 @@ function Document({
|
|
|
204
215
|
__self: this,
|
|
205
216
|
__source: {
|
|
206
217
|
fileName: _jsxFileName,
|
|
207
|
-
lineNumber:
|
|
218
|
+
lineNumber: 39,
|
|
208
219
|
columnNumber: 13
|
|
209
220
|
}
|
|
210
221
|
}))));
|
|
211
222
|
}
|
|
212
223
|
Document.defaultProps = {
|
|
213
224
|
head: /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement("meta", {
|
|
214
|
-
charSet: "utf-8",
|
|
215
|
-
__self: undefined,
|
|
216
|
-
__source: {
|
|
217
|
-
fileName: _jsxFileName,
|
|
218
|
-
lineNumber: 45,
|
|
219
|
-
columnNumber: 7
|
|
220
|
-
}
|
|
221
|
-
}), /*#__PURE__*/external_react_default().createElement("meta", {
|
|
222
225
|
name: "viewport",
|
|
223
226
|
content: "width=device-width, initial-scale=1",
|
|
224
227
|
__self: undefined,
|
|
225
228
|
__source: {
|
|
226
229
|
fileName: _jsxFileName,
|
|
227
|
-
lineNumber:
|
|
230
|
+
lineNumber: 48,
|
|
228
231
|
columnNumber: 7
|
|
229
232
|
}
|
|
230
233
|
}), /*#__PURE__*/external_react_default().createElement("link", {
|
|
231
234
|
rel: "shortcut icon",
|
|
232
|
-
href:
|
|
235
|
+
href: `${(_process$env$WEBPACK_ = process.env.WEBPACK_PUBLIC_PATH) != null ? _process$env$WEBPACK_ : '/'}favicon.ico`,
|
|
233
236
|
__self: undefined,
|
|
234
237
|
__source: {
|
|
235
238
|
fileName: _jsxFileName,
|
|
236
|
-
lineNumber:
|
|
239
|
+
lineNumber: 49,
|
|
237
240
|
columnNumber: 7
|
|
238
241
|
}
|
|
239
242
|
})),
|
|
243
|
+
charSet: 'utf-8',
|
|
240
244
|
rootId: 'anansi-root'
|
|
241
245
|
};
|
|
242
246
|
;// CONCATENATED MODULE: ./src/spouts/document.server.tsx
|
|
@@ -289,7 +293,7 @@ function DocumentSpout(options) {
|
|
|
289
293
|
__self: this,
|
|
290
294
|
__source: {
|
|
291
295
|
fileName: document_server_jsxFileName,
|
|
292
|
-
lineNumber:
|
|
296
|
+
lineNumber: 53,
|
|
293
297
|
columnNumber: 14
|
|
294
298
|
}
|
|
295
299
|
}, nextProps.app)
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAKA;AAIA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAHA;AAKA;AACA;AACA;;AC7BA;;ACAA;;;ACAA;AACA;AACA;AAMA;AAKA;AAGA;AAAA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA;;AAEA;AAGA;AACA;AACA;AACA;AAAA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAJA;AAMA;AACA;AACA;;ACvCA;AACA;AAOA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA","sources":["/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/ssr\"","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/server\");","import { 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 { timeoutMS = 200 }: { timeoutMS?: number } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const { app } = await spouts({ clientManifest, req, res });\n let didError = false;\n const { pipe, abort } = reactRender(\n app,\n /*\n This is not documented, so included the types here for reference:\ntype Options = {|\n identifierPrefix?: string,\n namespaceURI?: string,\n nonce?: string,\n bootstrapScriptContent?: string,\n bootstrapScripts?: Array<string>,\n bootstrapModules?: Array<string>,\n progressiveChunkSize?: number,\n onShellReady?: () => void,\n onShellError?: () => void,\n onAllReady?: () => void,\n onError?: (error: mixed) => void,\n|};\n */\n {\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(x: any) {\n didError = true;\n console.error(x);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n },\n },\n );\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(abort, timeoutMS);\n };\n return render;\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","type Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n title: string;\n rootId: string;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n}: Props) {\n return (\n <html>\n <head>\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 {/* this ensures the client can hydrate the assets prop */}\n <script\n dangerouslySetInnerHTML={{\n __html: `assetManifest = ${JSON.stringify(assets)};`,\n }}\n />\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 charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"shortcut icon\" href=\"/assets/favicon.ico\" />\n </>\n ),\n rootId: 'anansi-root',\n};\n","import React from 'react';\nimport type { Route } from '@anansi/router';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { ServerProps, ResolveProps } from './types';\nimport Document from './DocumentComponent';\n\ntype NeededProps = {\n matchedRoutes: Route<any>[];\n title?: string;\n} & ResolveProps;\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId: string;\n}) {\n return function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\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 >\n {nextProps.app}\n </Document>\n ),\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","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/ssr\");","import { Manager, NetworkManager } from '@rest-hooks/core';\nimport { createPersistedStore } from '@rest-hooks/ssr';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps = ResolveProps;\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n) {\n return function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\n const [ServerCacheProvider, controller] = createPersistedStore(\n options.getManagers(),\n );\n\n const nextProps = await next(props);\n\n return {\n ...nextProps,\n controller,\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n };\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createMemoryHistory } from 'history';\n\nimport type { ResolveProps, ServerProps, CreateRouter } from './types';\n\ntype NeededProps = ResolveProps;\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\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 function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\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(props);\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\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 <RouteWith, T extends NeededProps<RouteWith>>(\n next: (props: ServerProps) => Promise<\n {\n [K in F]: RouteWith;\n } & T\n >,\n ) {\n return async (props: ServerProps) => {\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","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';\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"server.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAKA;AAIA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;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;AAEA;;AAnBA;AAuBA;;AACA;AACA;;AACA;AACA;;AC3DA;;;;;;;ACSA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;A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/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/ssr\"","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/server\");","import { 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 { timeoutMS = 200 }: { timeoutMS?: number } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const { app } = await spouts({ clientManifest, req, res });\n let didError = false;\n const { pipe, abort } = reactRender(\n app,\n /*\n This is not documented, so included the types here for reference:\ntype Options = {|\n identifierPrefix?: string,\n namespaceURI?: string,\n nonce?: string,\n bootstrapScriptContent?: string,\n bootstrapScripts?: Array<string>,\n bootstrapModules?: Array<string>,\n progressiveChunkSize?: number,\n onShellReady?: () => void,\n onShellError?: () => void,\n onAllReady?: () => void,\n onError?: (error: mixed) => void,\n|};\n */\n {\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(x: any) {\n didError = true;\n console.error(x);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n },\n },\n );\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(abort, timeoutMS);\n };\n return render;\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","type Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n title: string;\n rootId: string;\n charSet: string;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n charSet,\n}: Props) {\n return (\n <html>\n <head>\n <meta charSet={charSet} />\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 {/* this ensures the client can hydrate the assets prop */}\n <script\n dangerouslySetInnerHTML={{\n __html: `assetManifest = ${JSON.stringify(assets)};`,\n }}\n />\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};\n","import React from 'react';\nimport type { Route } from '@anansi/router';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { ServerProps, ResolveProps } from './types';\nimport Document from './DocumentComponent';\n\ntype NeededProps = {\n matchedRoutes: Route<any>[];\n title?: string;\n} & ResolveProps;\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId?: string;\n charSet?: string;\n}) {\n return function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\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 >\n {nextProps.app}\n </Document>\n ),\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","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/ssr\");","import { Manager, NetworkManager } from '@rest-hooks/core';\nimport { createPersistedStore } from '@rest-hooks/ssr';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps = ResolveProps;\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n) {\n return function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\n const [ServerCacheProvider, controller] = createPersistedStore(\n options.getManagers(),\n );\n\n const nextProps = await next(props);\n\n return {\n ...nextProps,\n controller,\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n };\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createMemoryHistory } from 'history';\n\nimport type { ResolveProps, ServerProps, CreateRouter } from './types';\n\ntype NeededProps = ResolveProps;\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\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 function <T extends NeededProps>(\n next: (props: ServerProps) => Promise<T>,\n ) {\n return async (props: ServerProps) => {\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(props);\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\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 <RouteWith, T extends NeededProps<RouteWith>>(\n next: (props: ServerProps) => Promise<\n {\n [K in F]: RouteWith;\n } & T\n >,\n ) {\n return async (props: ServerProps) => {\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","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';\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floodSpouts.d.ts","sourceRoot":"","sources":["../src/floodSpouts.tsx"],"names":[],"mappings":"AAEA,wBAA8B,WAAW,CACvC,MAAM,EAAE,MAAM,OAAO,CAAC;IACpB,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EAAE,MAAsB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBAKrD"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as floodSpouts } from './floodSpouts';
|
|
2
|
+
export { default as documentSpout } from './spouts/document';
|
|
3
|
+
export { default as restHooksSpout } from './spouts/restHooks';
|
|
4
|
+
export { default as routerSpout } from './spouts/router';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as laySpouts } from './laySpouts';
|
|
2
|
+
export { default as documentSpout } from './spouts/document.server';
|
|
3
|
+
export { default as restHooksSpout } from './spouts/restHooks.server';
|
|
4
|
+
export { default as routerSpout } from './spouts/router.server';
|
|
5
|
+
export { default as prefetchSpout } from './spouts/prefetch.server';
|
|
6
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Render } from './scripts/types';
|
|
2
|
+
import { ServerProps } from './spouts/types';
|
|
3
|
+
export default function laySpouts(spouts: (props: ServerProps) => Promise<{
|
|
4
|
+
app: JSX.Element;
|
|
5
|
+
}>, { timeoutMS }?: {
|
|
6
|
+
timeoutMS?: number;
|
|
7
|
+
}): Render;
|
|
8
|
+
//# sourceMappingURL=laySpouts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"laySpouts.d.ts","sourceRoot":"","sources":["../src/laySpouts.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC;IACtC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EAAE,SAAe,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,UAkDjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getProxyMiddlewares.d.ts","sourceRoot":"","sources":["../../src/scripts/getProxyMiddlewares.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAKhB,oBAAoB,EACpB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAG5B,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,WAAW,EAAE,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,SAmHtE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = getProxyMiddlewares;
|
|
5
|
+
|
|
6
|
+
// Essentially taken from https://github.com/webpack/webpack-dev-server/blob/b5e5b67398f97c7a2934e12ebe34fb03cc06c473/lib/Server.js#L2123
|
|
7
|
+
function getProxyMiddlewares(proxyConfig) {
|
|
8
|
+
const middlewares = []; // eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
createProxyMiddleware
|
|
12
|
+
} = require('http-proxy-middleware');
|
|
13
|
+
|
|
14
|
+
const proxy = !Array.isArray(proxyConfig) && typeof proxyConfig === 'object' ? Object.keys(proxyConfig).length && Object.keys(proxyConfig)[0].startsWith('/') ? Object.entries(proxyConfig).map(([path, v]) => ({
|
|
15
|
+
path,
|
|
16
|
+
...v
|
|
17
|
+
})) : [proxyConfig] : proxyConfig;
|
|
18
|
+
|
|
19
|
+
const getProxyMiddleware = proxyConfig => {
|
|
20
|
+
// It is possible to use the `bypass` method without a `target` or `router`.
|
|
21
|
+
// However, the proxy middleware has no use in this case, and will fail to instantiate.
|
|
22
|
+
if (proxyConfig.target) {
|
|
23
|
+
const context = proxyConfig.context || proxyConfig.path;
|
|
24
|
+
return createProxyMiddleware(
|
|
25
|
+
/** @type {string} */
|
|
26
|
+
context, proxyConfig);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (proxyConfig.router) {
|
|
30
|
+
return createProxyMiddleware(proxyConfig);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Assume a proxy configuration specified as:
|
|
35
|
+
* proxy: [
|
|
36
|
+
* {
|
|
37
|
+
* context: "value",
|
|
38
|
+
* ...options,
|
|
39
|
+
* },
|
|
40
|
+
* // or:
|
|
41
|
+
* function() {
|
|
42
|
+
* return {
|
|
43
|
+
* context: "context",
|
|
44
|
+
* ...options,
|
|
45
|
+
* };
|
|
46
|
+
* }
|
|
47
|
+
* ]
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
proxy.forEach(proxyConfigOrCallback => {
|
|
52
|
+
let proxyMiddleware;
|
|
53
|
+
let proxyConfig = typeof proxyConfigOrCallback === 'function' ? proxyConfigOrCallback() : proxyConfigOrCallback;
|
|
54
|
+
proxyMiddleware = getProxyMiddleware(proxyConfig);
|
|
55
|
+
/* TODO: figure out how to make this work
|
|
56
|
+
if (proxyConfig.ws) {
|
|
57
|
+
this.webSocketProxies.push(proxyMiddleware);
|
|
58
|
+
}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
const handler = async (req, res, next) => {
|
|
62
|
+
if (typeof proxyConfigOrCallback === 'function') {
|
|
63
|
+
const newProxyConfig = proxyConfigOrCallback(req, res, next);
|
|
64
|
+
|
|
65
|
+
if (newProxyConfig !== proxyConfig) {
|
|
66
|
+
proxyConfig = newProxyConfig;
|
|
67
|
+
proxyMiddleware = getProxyMiddleware(proxyConfig);
|
|
68
|
+
}
|
|
69
|
+
} // - Check if we have a bypass function defined
|
|
70
|
+
// - In case the bypass function is defined we'll retrieve the
|
|
71
|
+
// bypassUrl from it otherwise bypassUrl would be null
|
|
72
|
+
// TODO remove in the next major in favor `context` and `router` options
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const bypassUrl = typeof proxyConfig.bypass === 'function' ? await proxyConfig.bypass(req, res, proxyConfig) : null;
|
|
76
|
+
|
|
77
|
+
if (typeof bypassUrl === 'boolean') {
|
|
78
|
+
// skip the proxy
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
req.url = null;
|
|
82
|
+
next();
|
|
83
|
+
} else if (typeof bypassUrl === 'string') {
|
|
84
|
+
// byPass to that url
|
|
85
|
+
req.url = bypassUrl;
|
|
86
|
+
next();
|
|
87
|
+
} else if (proxyMiddleware) {
|
|
88
|
+
return proxyMiddleware(req, res, next);
|
|
89
|
+
} else {
|
|
90
|
+
next();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
middlewares.push({
|
|
95
|
+
name: 'http-proxy-middleware',
|
|
96
|
+
middleware: handler
|
|
97
|
+
}); // Also forward error requests to the proxy so it can handle them.
|
|
98
|
+
|
|
99
|
+
middlewares.push({
|
|
100
|
+
name: 'http-proxy-middleware-error-handler',
|
|
101
|
+
middleware: (error, req, res, next) => handler(req, res, next)
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
return middlewares;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRQcm94eU1pZGRsZXdhcmVzIiwicHJveHlDb25maWciLCJtaWRkbGV3YXJlcyIsImNyZWF0ZVByb3h5TWlkZGxld2FyZSIsInJlcXVpcmUiLCJwcm94eSIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJsZW5ndGgiLCJzdGFydHNXaXRoIiwiZW50cmllcyIsIm1hcCIsInBhdGgiLCJ2IiwiZ2V0UHJveHlNaWRkbGV3YXJlIiwidGFyZ2V0IiwiY29udGV4dCIsInJvdXRlciIsImZvckVhY2giLCJwcm94eUNvbmZpZ09yQ2FsbGJhY2siLCJwcm94eU1pZGRsZXdhcmUiLCJoYW5kbGVyIiwicmVxIiwicmVzIiwibmV4dCIsIm5ld1Byb3h5Q29uZmlnIiwiYnlwYXNzVXJsIiwiYnlwYXNzIiwidXJsIiwicHVzaCIsIm5hbWUiLCJtaWRkbGV3YXJlIiwiZXJyb3IiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NyaXB0cy9nZXRQcm94eU1pZGRsZXdhcmVzLnRzIl0sInNvdXJjZ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nMsXG4gICAqICAgfSxcbiAgICogICAvLyBvcjpcbiAgICogICBmdW5jdGlvbigpIHtcbiAgICogICAgIHJldHVybiB7XG4gICAqICAgICAgIGNvbnRleHQ6IFwiY29udGV4dFwiLFxuICAgKiAgICAgICAuLi5vcHRpb25zLFxuICAgKiAgICAgfTtcbiAgICogICB9XG4gICAqIF1cbiAgICovXG4gIHByb3h5LmZvckVhY2gocHJveHlDb25maWdPckNhbGxiYWNrID0+IHtcbiAgICBsZXQgcHJveHlNaWRkbGV3YXJlOiBSZXF1ZXN0SGFuZGxlciB8IHVuZGVmaW5lZDtcblxuICAgIGxldCBwcm94eUNvbmZpZyA9XG4gICAgICB0eXBlb2YgcHJveHlDb25maWdPckNhbGxiYWNrID09PSAnZnVuY3Rpb24nXG4gICAgICAgID8gcHJveHlDb25maWdPckNhbGxiYWNrKClcbiAgICAgICAgOiBwcm94eUNvbmZpZ09yQ2FsbGJhY2s7XG5cbiAgICBwcm94eU1pZGRsZXdhcmUgPSBnZXRQcm94eU1pZGRsZXdhcmUocHJveHlDb25maWcpO1xuXG4gICAgLyogVE9ETzogZmlndXJlIG91dCBob3cgdG8gbWFrZSB0aGlzIHdvcmtcbiAgICBpZiAocHJveHlDb25maWcud3MpIHtcbiAgICAgIHRoaXMud2ViU29ja2V0UHJveGllcy5wdXNoKHByb3h5TWlkZGxld2FyZSk7XG4gICAgfVxuICAgICovXG5cbiAgICBjb25zdCBoYW5kbGVyID0gYXN5bmMgKHJlcTogUmVxdWVzdCwgcmVzOiBSZXNwb25zZSwgbmV4dDogTmV4dEZ1bmN0aW9uKSA9PiB7XG4gICAgICBpZiAodHlwZW9mIHByb3h5Q29uZmlnT3JDYWxsYmFjayA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICBjb25zdCBuZXdQcm94eUNvbmZpZyA9IHByb3h5Q29uZmlnT3JDYWxsYmFjayhyZXEsIHJlcywgbmV4dCk7XG5cbiAgICAgICAgaWYgKG5ld1Byb3h5Q29uZmlnICE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DQUFDTSxHQUFKLEdBQVVGLFNBQVY7UUFDQUYsSUFBSTtNQUNMLENBSk0sTUFJQSxJQUFJSixlQUFKLEVBQXFCO1FBQzFCLE9BQU9BLGVBQWUsQ0FBQ0UsR0FBRCxFQUFNQyxHQUFOLEVBQVdDLElBQVgsQ0FBdEI7TUFDRCxDQUZNLE1BRUE7UUFDTEEsSUFBSTtNQUNMO0lBQ0YsQ0FsQ0Q7O0lBb0NBeEIsV0FBVyxDQUFDNkIsSUFBWixDQUFpQjtNQUNmQyxJQUFJLEVBQUUsdUJBRFM7TUFFZkMsVUFBVSxFQUFFVjtJQUZHLENBQWpCLEVBcERxQyxDQXdEckM7O0lBQ0FyQixXQUFXLENBQUM2QixJQUFaLENBQWlCO01BQ2ZDLElBQUksRUFBRSxxQ0FEUztNQUVmQyxVQUFVLEVBQUUsQ0FDVkMsS0FEVSxFQUVWVixHQUZVLEVBR1ZDLEdBSFUsRUFJVkMsSUFKVSxLQUtQSCxPQUFPLENBQUNDLEdBQUQsRUFBTUMsR0FBTixFQUFXQyxJQUFYO0lBUEcsQ0FBakI7RUFTRCxDQWxFRDtFQW9FQSxPQUFPeEIsV0FBUDtBQUNEIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.serve = exports.devServe = void 0;
|
|
7
|
+
|
|
8
|
+
var _serve = _interopRequireDefault(require("./serve"));
|
|
9
|
+
|
|
10
|
+
exports.serve = _serve.default;
|
|
11
|
+
|
|
12
|
+
var _startDevserver = _interopRequireDefault(require("./startDevserver"));
|
|
13
|
+
|
|
14
|
+
exports.devServe = _startDevserver.default;
|
|
15
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjcmlwdHMvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZGVmYXVsdCBhcyBzZXJ2ZSB9IGZyb20gJy4vc2VydmUnO1xuZXhwb3J0IHsgZGVmYXVsdCBhcyBkZXZTZXJ2ZSB9IGZyb20gJy4vc3RhcnREZXZzZXJ2ZXInO1xuIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7Ozs7QUFDQSJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/scripts/serve.ts"],"names":[],"mappings":";AAWA,OAAO,sBAAsB,CAAC;AAe9B,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,QAqK9D"}
|