{"dist":{"shasum":"bf91e943b94a2f7c7b11fa3ad6985903c33837a2","tarball":"https://registry.npmjs.org/solid-ssr/-/solid-ssr-0.17.0-beta.2.tgz","fileCount":8,"integrity":"sha512-uZdptlbelY0C+GFZEMfo5A8P8bSUNVb/vkc27zWcM4oq4H30936WdoqYz6GuesxvAM4HXAE2IYZ+2WDpTCt3ZA==","signatures":[{"sig":"MEYCIQCzmcV7cngzb6tKr6gpQ9UXitZES+ocdDeFpxewTeuUrgIhAMahVo8EZBcyEI8aNe3ahNTgcC1gdW5+T0ldFwm8DB4N","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7601,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeeEheCRA9TVsSAnZWagAAYj4QAJ2SMukhhnmYuuWHSuQB\neQ4X8e3TlnBt624iU6jIgeQY/y6X/zFEpg879QXWj0mM2F2ahKV5aU3FnPa8\nhcEaeoLfSCI1k/KVG5KrBHln0UUvv9Rp4FkvMOGGuN0vm8DCiE3cL/H1jjv9\n8IhyeS6w6lMq6o32W8TTbNJe0HVgWGXIYFDqUXMLm1Ek6tD/ZHOHSrOOj7e7\nm4T9O1LJBzQyBteXG4HcG5L1fPznqhwjD1osBOZEwnrqRX6O8yeSp0nS81/L\n7bECdvmnE6Gr6LeBkd43iD8YOLTnrImJgLAGjrrIauuo7wSI4PKmVlDAMCOd\nQcW0SWaYJXsd/5ddOdMdBWfiUqLYVnB0S2A2uqqGVP/oxxkB1KDVLhV5ltC9\nDyNcn9N/pqyEaVaEJSE74zoKUg2neZuqPJhx8f1Vi/rxh1TRMGb0jfDVPsaK\nwgrmlI9HxoihNlAgIQxRBas0EVyJqCHDDKPKXJpiMet1aRG9IbkBtIeICw5O\niqb83NSnUXUstUqgnVsMG9nd9MZ2OHrhG5HbmOpOBNqpgoEYyJAhoKwsDK/+\nywsT5zTINho8x40g4VY9YENtReBjPKAh3qdDv6mNdfoiZW1oyA6BkyP2VTUy\nFL1kNzd2KnmjpofbTi+AhUJ/tvGjWckk2Lf+WXM3IAJwu6lETMs5KY6iWDu+\nd3Ec\r\n=HFjU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"solid-ssr","types":"index.d.ts","author":{"name":"Ryan Carniato"},"readme":"# `solid-ssr`\n\nThis library sets up node compatible middleware to handle Solid's SSR. It uses JSDOM and isolated processes to handle environment injection. See instructions below. Also provides `solid-ssr/jest` which is a Jest environment to render Solid when testing (probably unnecessary at this point).\n\nThis project is still in progress. Server rendering is Async and supports Suspense including lazy components. However, client side hydration only supports lazy components. Any Suspense triggering due to data fetching during rehydration will cause loading states to be entered again. Similarly while Web Components are support, the Shadow DOM isn't yet.\n\n### To use SSR on the server:\n\n1. Install `solid-js`, `solid-preset-solid`, and `solid-ssr`.\n\n2. Configure babel-preset-solid with generate option 'ssr'\n\n```json\n\"presets\": [[\"solid\", { \"generate\": \"ssr\" }]]\n```\n\n3. Set up server application:\n```js\nconst createServer = require(\"solid-ssr/server\");\nconst render = createServer({ path: /* path to client entry*/ })\n\n// under request handler\napp.get(\"*\", (req, res) => {\n  const html = await render(req);\n  res.send(html);\n})\n```\n\n4. Use `renderToString` in client entry for SSR:\n\n```jsx\n// top of entry file, must be imported before any components\nimport ssr from \"solid-ssr\"\nimport { renderToString } from \"solid-js/dom\";\n\nssr(async (req) => {\n  // pull url off request to handle routing\n  const { url } = req;\n  const string = await renderToString(() => <App />);\n  return render(string);\n});\n```\n> Remember to mark all of \"solid-js\", \"solid-js/dom\", \"solid-ssr\" as externals as no need to bundle these for server rendering entry.\n\n### To rehydrate on the client:\n\n1. Configure babel-preset-solid with generate option 'hydrate'\n\n```json\n\"presets\": [[\"solid\", { \"generate\": \"hydrate\" }]]\n```\n\n2. Use `hydrate` entry:\n\n```jsx\nimport { hydrate } from \"solid-js/dom\";\n\nhydrate(() => <App />, document.getElementById(\"main\"));\n```\n\n### Example\n\nSee example folder. Runs on http://localhost:8080/.\n```\nlerna run build:example --stream\nlerna run start:example --stream\n```\n\nDemos Async server side rendering with routing using Lazy Components and Suspense. Notice how the browser skips any initial loading state as it is prerendered. `useTransition` smooths loading of other tabs when navigating suspending the current content for 250ms before showing any fallback. The example also includes progressive hydration although there are currently no input fields to show it off. It captures input events before hydration is complete and replays them as it hydrates when safe to, to minimize uncanny valley.","gitHead":"776c67880f2bdb84ab3a4617cdedfcc3c6d2ca15","license":"MIT","scripts":{"start":"node server.js","build:example":"rollup -c example/rollup.config.js","start:example":"node example/index.js"},"_npmUser":{"name":"ryansolid","email":"ryansolid@gmail.com"},"repository":{"url":"https://github.com/ryansolid/solid/solid-ssr","type":"git"},"_npmVersion":"lerna/3.20.2/node@v12.11.1+x64 (linux)","description":"Patches node to work with Solid's SSR","directories":{},"maintainers":[{"name":"ryansolid","email":"ryansolid@gmail.com"}],"_nodeVersion":"12.11.1","dependencies":{"jsdom":"^16.2.1","jest-environment-node":"^25.1.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"express":"^4.17.1","solid-js":"^0.17.0-beta.2","babel-preset-solid":"^0.17.0-beta.0"},"peerDependencies":{"solid-js":"*"},"_npmOperationalInternal":{"tmp":"tmp/solid-ssr_0.17.0-beta.2_1584941149758_0.6707826345141381","host":"s3://npm-registry-packages"},"_id":"solid-ssr@0.17.0-beta.2","version":"0.17.0-beta.2"}