@anansi/core 0.6.0 → 0.6.1

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 ADDED
@@ -0,0 +1,162 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ### [0.6.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.6.0...@anansi/core@0.6.1) (2022-05-24)
7
+
8
+
9
+ ### 🐛 Bug Fix
10
+
11
+ * Don't error with 'React currently only supports piping to one writable stream' ([cf55fdb](https://github.com/ntucker/anansi/commit/cf55fdb82ee158e26ee596f86db0231faa8e98f5))
12
+
13
+
14
+
15
+ ## [0.6.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.2...@anansi/core@0.6.0) (2022-05-22)
16
+
17
+
18
+ ### 🚀 Features
19
+
20
+ * Return router in spout ([dfbb685](https://github.com/ntucker/anansi/commit/dfbb68577e05216178671262db488d8aab55021e))
21
+
22
+
23
+
24
+ ### [0.5.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.1...@anansi/core@0.5.2) (2022-05-21)
25
+
26
+ **Note:** Version bump only for package @anansi/core
27
+
28
+
29
+
30
+
31
+
32
+ ### [0.5.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.0...@anansi/core@0.5.1) (2022-05-20)
33
+
34
+
35
+ ### 📦 Package
36
+
37
+ * Update babel monorepo ([#1515](https://github.com/ntucker/anansi/issues/1515)) ([9d51b13](https://github.com/ntucker/anansi/commit/9d51b13218a67c17cfef56a1be88ac4af7933d03))
38
+
39
+
40
+
41
+ ## [0.5.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.4...@anansi/core@0.5.0) (2022-05-18)
42
+
43
+
44
+ ### 🚀 Features
45
+
46
+ * Add commonjs bundles ([#1508](https://github.com/ntucker/anansi/issues/1508)) ([3f1f5a2](https://github.com/ntucker/anansi/commit/3f1f5a2f881d3e314d9fd08d63607e0c8dbd34d1))
47
+
48
+
49
+ ### 💅 Enhancement
50
+
51
+ * Ensure output works without WEBPACK_PUBLIC_HOST set ([1df3f57](https://github.com/ntucker/anansi/commit/1df3f57cf0d3966a371e89f8c2333f3f29e23b65))
52
+ * Only hydrate body content ([1a6412c](https://github.com/ntucker/anansi/commit/1a6412c2e2b55b176fa0491228888490e45de98f))
53
+
54
+
55
+
56
+ ### [0.4.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.3...@anansi/core@0.4.4) (2022-05-18)
57
+
58
+
59
+ ### 💅 Enhancement
60
+
61
+ * Supress hydration warnings in head for stackblitz compat ([38ac992](https://github.com/ntucker/anansi/commit/38ac99237af30d97408fb23bfb95b3bbe5384a03))
62
+
63
+
64
+
65
+ ### [0.4.3](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.2...@anansi/core@0.4.3) (2022-05-18)
66
+
67
+
68
+ ### 💅 Enhancement
69
+
70
+ * Use relative asset paths ([799b69e](https://github.com/ntucker/anansi/commit/799b69e52394edc26290b9f01ff60ad772f739da))
71
+
72
+
73
+
74
+ ### [0.4.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.1...@anansi/core@0.4.2) (2022-05-18)
75
+
76
+ **Note:** Version bump only for package @anansi/core
77
+
78
+
79
+
80
+
81
+
82
+ ### [0.4.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.0...@anansi/core@0.4.1) (2022-05-18)
83
+
84
+
85
+ ### 🐛 Bug Fix
86
+
87
+ * Server compilation ([d8a1c9a](https://github.com/ntucker/anansi/commit/d8a1c9a05718cde13c99d56dcc79a5cc823fa6bb))
88
+
89
+
90
+
91
+ ## [0.4.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.3.1...@anansi/core@0.4.0) (2022-05-17)
92
+
93
+
94
+ ### 🚀 Features
95
+
96
+ * SSR uses webpack devserver and responds to code changes ([#1504](https://github.com/ntucker/anansi/issues/1504)) ([25803a5](https://github.com/ntucker/anansi/commit/25803a5b49316c7e73846efbe774d5cbe3eb28a3))
97
+
98
+
99
+ ### 📦 Package
100
+
101
+ * Update babel monorepo to v7.17.12 ([#1505](https://github.com/ntucker/anansi/issues/1505)) ([cdf449c](https://github.com/ntucker/anansi/commit/cdf449c234da377c6968847a500ef77d7340c5bb))
102
+ * Update jest monorepo to ^28.1.0 ([#1493](https://github.com/ntucker/anansi/issues/1493)) ([7cc9df4](https://github.com/ntucker/anansi/commit/7cc9df4a439a0743bf243a5ad8393c62c067aa44))
103
+
104
+
105
+
106
+ ### [0.3.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.3.0...@anansi/core@0.3.1) (2022-05-04)
107
+
108
+
109
+ ### 📦 Package
110
+
111
+ * Update all non-major dependencies ([#1490](https://github.com/ntucker/anansi/issues/1490)) ([c333a59](https://github.com/ntucker/anansi/commit/c333a595dd912e67f64e22b4c4af58e825e75cad))
112
+
113
+
114
+
115
+ ## [0.3.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.2...@anansi/core@0.3.0) (2022-04-30)
116
+
117
+
118
+ ### ⚠ 💥 BREAKING CHANGES
119
+
120
+ * Requires TypeScript 4.3 and Jest 28
121
+
122
+ Co-authored-by: Renovate Bot <bot@renovateapp.com>
123
+ Co-authored-by: Nathaniel Tucker <me@ntucker.me>
124
+
125
+ ### 📦 Package
126
+
127
+ * Update babel monorepo to v7.17.10 ([#1487](https://github.com/ntucker/anansi/issues/1487)) ([4cae6b5](https://github.com/ntucker/anansi/commit/4cae6b50855c2307ba1cf4e7293579d51614f978))
128
+ * Update jest monorepo to ^28.0.2 ([#1484](https://github.com/ntucker/anansi/issues/1484)) ([0792dbf](https://github.com/ntucker/anansi/commit/0792dbf9e9fe2c6b22eb5414ec2a7c7aaf1d9e48))
129
+ * Update jest monorepo to ^28.0.3 ([#1486](https://github.com/ntucker/anansi/issues/1486)) ([a5b325a](https://github.com/ntucker/anansi/commit/a5b325af0166351f40c421d4a3a0bef59f6d1218))
130
+ * Update jest monorepo to v28 (major) ([#1479](https://github.com/ntucker/anansi/issues/1479)) ([06338de](https://github.com/ntucker/anansi/commit/06338de8bf871945dac4b6b35155e49fd062bfdb))
131
+
132
+
133
+
134
+ ### [0.2.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.1...@anansi/core@0.2.2) (2022-04-22)
135
+
136
+
137
+ ### 💅 Enhancement
138
+
139
+ * Indicate compilation errors ([82682b9](https://github.com/ntucker/anansi/commit/82682b9ed22686eb58f5421b6043852d2006842e))
140
+
141
+
142
+
143
+ ### [0.2.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.0...@anansi/core@0.2.1) (2022-04-18)
144
+
145
+
146
+ ### 🐛 Bug Fix
147
+
148
+ * Make start-anansi command executable in bash ([4ae313c](https://github.com/ntucker/anansi/commit/4ae313c7d2137df63e74e5a8064237189c04adc8))
149
+
150
+
151
+
152
+ ## 0.2.0 (2022-04-18)
153
+
154
+
155
+ ### 🚀 Features
156
+
157
+ * React 18 partial hydration SSR ([#1427](https://github.com/ntucker/anansi/issues/1427)) ([afe12fe](https://github.com/ntucker/anansi/commit/afe12fea2e0a0f9d9a759c2f533ab925ba0e8957)), closes [#1456](https://github.com/ntucker/anansi/issues/1456)
158
+
159
+
160
+ ### 📦 Package
161
+
162
+ * Update all non-major dependencies ([#1472](https://github.com/ntucker/anansi/issues/1472)) ([903e452](https://github.com/ntucker/anansi/commit/903e452e58dfacb14808d23e1aa883d6126dae1f))
package/dist/server.js CHANGED
@@ -63,7 +63,7 @@ const server_namespaceObject = require("react-dom/server");
63
63
  ;// CONCATENATED MODULE: ./src/laySpouts.tsx
64
64
 
65
65
  function laySpouts(spouts, {
66
- timeoutMS = 100
66
+ timeoutMS = 200
67
67
  } = {}) {
68
68
  const render = async (clientManifest, req, res) => {
69
69
  const {
@@ -113,8 +113,7 @@ function laySpouts(spouts, {
113
113
  onError(x) {
114
114
  didError = true;
115
115
  console.error(x);
116
- res.statusCode = 500;
117
- pipe(res);
116
+ res.statusCode = 500; //pipe(res); Removing this avoids, "React currently only supports piping to one writable stream."
118
117
  }
119
118
 
120
119
  }); // Abandon and switch to client rendering if enough time passes.
@@ -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;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;;AAnBA;AAuBA;;AACA;AACA;;AACA;AACA;;AC3DA;;;;;ACQA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AACA;AADA;AADA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AARA;;;ACzCA;AAIA;AAOA;AAKA;AAGA;AAAA;;AACA;AAEA;AACA;AAEA;AAIA;;AACA;AACA;AAAA;;;AAEA;AAEA;AAAA;AAKA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAGA;AAEA;AAGA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAHA;AA3BA;AAHA;AA6CA;;AC7DA;;ACAA;;;;ACAA;AACA;AAMA;AAGA;AAAA;AAEA;AAGA;AACA;AAIA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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 = 100 }: { 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);\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';\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 entrypoint = props.clientManifest?.entrypoints?.main;\n const publicPath = props.clientManifest.publicPath;\n\n if (entrypoint === undefined || publicPath === undefined)\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 // find additional assets to preload based on matched route\n const assets = assetMap([\n ...(entrypoint.assets ?? []),\n ...(entrypoint.children?.prefetch?.find?.(({ name }) =>\n nextProps.matchedRoutes.some(route => name === route.name),\n )?.assets ?? []),\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","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;;;;;ACQA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AACA;AADA;AADA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA;AARA;;;ACzCA;AAIA;AAOA;AAKA;AAGA;AAAA;;AACA;AAEA;AACA;AAEA;AAIA;;AACA;AACA;AAAA;;;AAEA;AAEA;AAAA;AAKA;AAAA;AAAA;AAEA;AAAA;AAAA;AACA;AAAA;AAGA;AAEA;AAGA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAHA;AA3BA;AAHA;AA6CA;;AC7DA;;ACAA;;;;ACAA;AACA;AAMA;AAGA;AAAA;AAEA;AAGA;AACA;AAIA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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';\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 entrypoint = props.clientManifest?.entrypoints?.main;\n const publicPath = props.clientManifest.publicPath;\n\n if (entrypoint === undefined || publicPath === undefined)\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 // find additional assets to preload based on matched route\n const assets = assetMap([\n ...(entrypoint.assets ?? []),\n ...(entrypoint.children?.prefetch?.find?.(({ name }) =>\n nextProps.matchedRoutes.some(route => name === route.name),\n )?.assets ?? []),\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","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":""}
package/lib/laySpouts.js CHANGED
@@ -6,7 +6,7 @@ exports.default = laySpouts;
6
6
  var _server = require("react-dom/server");
7
7
 
8
8
  function laySpouts(spouts, {
9
- timeoutMS = 100
9
+ timeoutMS = 200
10
10
  } = {}) {
11
11
  const render = async (clientManifest, req, res) => {
12
12
  const {
@@ -56,8 +56,7 @@ function laySpouts(spouts, {
56
56
  onError(x) {
57
57
  didError = true;
58
58
  console.error(x);
59
- res.statusCode = 500;
60
- pipe(res);
59
+ res.statusCode = 500; //pipe(res); Removing this avoids, "React currently only supports piping to one writable stream."
61
60
  }
62
61
 
63
62
  }); // Abandon and switch to client rendering if enough time passes.
@@ -68,4 +67,4 @@ function laySpouts(spouts, {
68
67
 
69
68
  return render;
70
69
  }
71
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJsYXlTcG91dHMiLCJzcG91dHMiLCJ0aW1lb3V0TVMiLCJyZW5kZXIiLCJjbGllbnRNYW5pZmVzdCIsInJlcSIsInJlcyIsImFwcCIsImRpZE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DLDhCQUFBLEVBQ3RCSixHQURzQjtJQUV0QjtBQUNOO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtJQUNNO01BQ0U7TUFDQUssWUFBWSxHQUFHO1FBQ2I7UUFDQTtRQUNBTixHQUFHLENBQUNPLFVBQUosR0FBaUJMLFFBQVEsR0FBRyxHQUFILEdBQVMsR0FBbEM7UUFDQUYsR0FBRyxDQUFDUSxTQUFKLENBQWMsY0FBZCxFQUE4QixXQUE5QjtRQUNBTCxJQUFJLENBQUNILEdBQUQsQ0FBSjtNQUNELENBUkg7O01BU0VTLFlBQVksR0FBRztRQUNiUCxRQUFRLEdBQUcsSUFBWDtRQUNBRixHQUFHLENBQUNPLFVBQUosR0FBaUIsR0FBakI7UUFDQUosSUFBSSxDQUFDSCxHQUFELENBQUo7TUFDRCxDQWJIOztNQWNFVSxPQUFPLENBQUNDLENBQUQsRUFBUztRQUNkVCxRQUFRLEdBQUcsSUFBWDtRQUNBVSxPQUFPLENBQUNDLEtBQVIsQ0FBY0YsQ0FBZDtRQUNBWCxHQUFHLENBQUNPLFVBQUosR0FBaUIsR0FBakIsQ0FIYyxDQUlkO01BQ0Q7O0lBbkJILENBbEJzQixDQUF4QixDQUh5RCxDQTJDekQ7SUFDQTs7SUFDQU8sVUFBVSxDQUFDVixLQUFELEVBQVFSLFNBQVIsQ0FBVjtFQUNELENBOUNEOztFQStDQSxPQUFPQyxNQUFQO0FBQ0QifQ==
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anansi/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "React 18 Framework",
5
5
  "homepage": "https://github.com/ntucker/anansi/tree/master/packages/core#readme",
6
6
  "repository": {
@@ -30,8 +30,8 @@
30
30
  "module": "lib/index.js",
31
31
  "types": "lib/index.d.ts"
32
32
  },
33
- "module": "src/index.ts",
34
- "types": "src/index.ts",
33
+ "module": "lib/index.js",
34
+ "types": "lib/index.d.ts",
35
35
  "exports": {
36
36
  ".": {
37
37
  "node": {
@@ -60,9 +60,9 @@
60
60
  "browser"
61
61
  ],
62
62
  "devDependencies": {
63
- "@anansi/babel-preset": "^3.1.3",
63
+ "@anansi/babel-preset": "^3.2.1",
64
64
  "@anansi/browserslist-config": "1.3.3",
65
- "@anansi/webpack-config": "^11.5.2",
65
+ "@anansi/webpack-config": "^11.5.3",
66
66
  "@babel/cli": "7.17.10",
67
67
  "@babel/core": "7.18.0",
68
68
  "@types/compression": "^1.7.2",
@@ -75,7 +75,7 @@
75
75
  "webpack-cli": "^4.9.2"
76
76
  },
77
77
  "dependencies": {
78
- "@anansi/router": "^0.5.2",
78
+ "@anansi/router": "^0.5.3",
79
79
  "@babel/runtime": "^7.10.5",
80
80
  "@rest-hooks/ssr": "^0.1.3",
81
81
  "chalk": "^4.0.0",
@@ -130,4 +130,4 @@
130
130
  "build:clean": "rimraf lib dist ts3.4 legacy *.tsbuildinfo",
131
131
  "prepack": "yarn build"
132
132
  }
133
- }
133
+ }
package/src/laySpouts.tsx CHANGED
@@ -7,7 +7,7 @@ export default function laySpouts(
7
7
  spouts: (props: ServerProps) => Promise<{
8
8
  app: JSX.Element;
9
9
  }>,
10
- { timeoutMS = 100 }: { timeoutMS?: number } = {},
10
+ { timeoutMS = 200 }: { timeoutMS?: number } = {},
11
11
  ) {
12
12
  const render: Render = async (clientManifest, req, res) => {
13
13
  const { app } = await spouts({ clientManifest, req, res });
@@ -48,7 +48,7 @@ type Options = {|
48
48
  didError = true;
49
49
  console.error(x);
50
50
  res.statusCode = 500;
51
- pipe(res);
51
+ //pipe(res); Removing this avoids, "React currently only supports piping to one writable stream."
52
52
  },
53
53
  },
54
54
  );