Skip to content

Latest commit

 

History

History
1061 lines (500 loc) · 43.3 KB

CHANGELOG.md

File metadata and controls

1061 lines (500 loc) · 43.3 KB

0.3.8 (2021-10-07)

Bug Fixes

  • add option useClientRouter({ ensureHydration: boolean }) to mitigate "Hydration Mismatch" errors for Vue users" (c5891cd)
  • stop make superfluous .pageContext.json requests when there are no onBeforeRender() defined on the server-side (#95) (6a16049)
  • tolerate readable streams with missing read() handler (#138) (a214190)

0.3.7 (2021-10-05)

Bug Fixes

  • also add @brillout/json-s to optimizeDeps (ed255d1)

0.3.6 (2021-10-05)

Bug Fixes

  • tell Vite what to pre-bundle also for vite-plugin-ssr/client/router (#156) (64f7444)

0.3.5 (2021-10-05)

Bug Fixes

  • circumvent Vite bug that occurs when HTML has no <head> (e282837)
  • tell Vite what to pre-bundle (fix #156) (59dfb4c)

0.3.4 (2021-10-05)

Bug Fixes

  • make sure renderPage() never throws an error, gracefully handle errors instead (ec37859)

0.3.3 (2021-09-29)

Features

  • HTML streaming support (#138)

0.3.2 (2021-09-22)

Bug Fixes

  • correctly handle base URL that contains a URL origin (fix #149) (41fb77c)
  • filesystem routing: also map src/ directories to empty string (c629cbe)

Features

  • pageContext.httpResponse.bodyWebStream, pageContext.httpResponse.bodyNodeStream, pageContext.httpResponse.getBody() (c2e1ce2)

0.3.1 (2021-09-14)

Bug Fixes

0.3.0 (2021-09-14)

Bug Fixes

  • dx: forbid user to inject assets twice instead of silently failing (6d4166e)
  • support latest @types/node version (3078ac5)
  • ts: use all strict flags in order to accommodate for users with strict TS settings (#145) (fd5bae5)

Features

  • implement domain-drive file structure (closes #125) (fb368ff)
  • allow render() hook to modify pageContext (e.g. boilerplate-react/renderer/_default.page.server.jsx)
  • onBeforeRoute() out of beta
  • onBeforePrerender() out of beta
  • vite-plugin-ssr can now automatically inject assets to HTML in more situations (paving the way for built-in HTML streaming support)

BREAKING CHANGES

  • dangerouslySkipEscape is now a standalone import.

      // _default.page.server.js
    
    - import { html } from "vite-plugin-ssr"
    + import { html, dangerouslySkipEscape } from "vite-plugin-ssr"
    
      export function render() {
        return html`<!DOCTYPE html>
          <html>
            <body>
    -         <div id="page-view">${html.dangerouslySkipEscape(pageHtml)}</div>
    +         <div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
            </body>
          </html>`
      }
  • html template tag renamed to escapeInject.

      // _default.page.server.js
    
    - import { html, dangerouslySkipEscape } from "vite-plugin-ssr"
    + import { escapeInject, dangerouslySkipEscape } from "vite-plugin-ssr"
    
      export function render() {
    -   return html`<!DOCTYPE html>
    +   return escapeInject`<!DOCTYPE html>
          <html>
            <body>
              <div id="page-view">${dangerouslySkipEscape(pageHtml)}</div>
            </body>
          </html>`
      }
  • createPageRender() renamed createPageRenderer().

      // server.js
    
    - const renderPage = createPageRender(/*...*/)
    + const renderPage = createPageRenderer(/*...*/)
  • renderPage() changes:

      // server.js
    
      const renderPage = createPageRenderer(/*...*/)
      app.get('*', async (req, res, next) => {
        const url = req.originalUrl
    -   const pageContext = { url }
    -   const result = await renderPage(pageContext)
    -   if (result.nothingRendered) return next()
    -   res.status(result.statusCode).send(result.renderResult)
    +   const pageContextInit = { url }
    +   const pageContext = await renderPage(pageContextInit)
    +   if (!pageContext.httpResponse) return next()
    +   res.status(pageContext.httpResponse.statusCode).send(pageContext.httpResponse.body)
      })
  • Hook addPageContext() deprecated and replaced with onBeforeRender().

      // *.page.server.js
    
    - export function addPageContext(pageContext) {
    + export function onBeforeRender(pageContext) {
        const pageProps = /*...*/
    -   return { pageProps }
    +   return {
    +     pageContext: {
    +       pageProps
    +     }
    +   }
      }
  • _onBeforeRoute() and _onBeforePrerender() are out of beta: rename them to onBeforeRoute() and onBeforePrerender().

  • _injectAssets() is now a standalone import.

      // _default.page.server.js
    
    - import { html } from "vite-plugin-ssr"
    + import { _injectAssets } from "vite-plugin-ssr"
    
      export function render() {
    -   html._injectAssets(/*...*/)
    +   _injectAssets(/*...*/)
      }

0.2.13 (2021-09-03)

Bug Fixes

  • ts: fix typings for HTML Fragments (392268a)

0.2.12 (2021-09-01)

Bug Fixes

  • do not override page's render hook (0f51330)

Features

  • [beta feature] allow user to define _onBeforeRoute() hook (#136, fix #140) (91ed460)
  • allow _onBeforeRoute() to modify pageContext.url (bad2405)
  • allow missing .page.js when .page.client.js and .page.server.js is defined (37f6f6b)
  • [beta feature] allow user to define _onBeforePrerender() hook (fix #136) (9b6a135)
  • dx: improve no route matching warning (586e1c4)

0.2.11 (2021-08-22)

Bug Fixes

  • allow parallel option to be passed via cli (9a94bc9)

0.2.10 (2021-08-22)

Bug Fixes

  • pre-rendering: allow user to control concurrency (fix #134, fix (c7f9454)
  • ts: fix conflicting ViteDevServer type definitions (8d3aef3)
  • ts: make getPage() generic, e.g. getPage<SomeCustomPageContext>() (f56104d)

0.2.9 (2021-08-15)

Bug Fixes

  • allow pageContext to be Vue reactive (65ac828)
  • dx: improve pageContext not available in browser wrong usage message (0563c20)
  • help TS resolve plugin until TS supports package.json#exports (414ce14)
  • skip symbols and toJSON in pageContext proxy (361bca2)
  • ts: return plugin as any to avoid Plugin type mismatches when there are multiple Vite versions installed (34e9b6a)

0.2.8 (2021-08-12)

DX

  • dx: improve error message when user forgot to run $ vite build for production.

0.2.7 (2021-08-10)

Bug Fixes

  • make server-side test work again for CF (fix #130) (fe01932)
  • properly remove built-in props from error message (6e23c10)
  • resolve --root arg (6a51f2a)

0.2.6 (2021-08-09)

Bug Fixes

  • use utils/assert instead of assert of console module (#129) (8b4e39c)

0.2.5 (2021-08-06)

DX

  • dx: improve error message when pageContext is not serializable #127 (fix #128)

0.2.4 (2021-08-03)

Bug Fixes

  • don't overwrite but supplement rollupOptions.input (f3268a8)

Features

  • impl .page.server.js#doNotPrerender to enable pre-rendering skipping (bfb2dd1)

0.2.3 (2021-07-21)

Bug Fixes

  • don't return null upon several matching _default page files (fix #120) (801b92f)

0.2.2 (2021-07-20)

Bug Fixes

  • add support for server written in ESM (fix #118) (56e3885)

0.2.1 (2021-07-19)

Bug Fixes

0.2.0 (2021-07-16)

  • improve dist/server/importBuild.js ergonomics (cad8683)

BREAKING CHANGES

  • dist/server/importer.js has been renamed to dist/server/importBuild.js.

0.1.5 (2021-07-11)

Bug Fixes

  • error when route string is missing a leading slash instead of silently failing (21052c6)
  • properly handle URL suffix .pageContext.json for URL / (84b3e76)

0.1.4 (2021-07-07)

Features

  • add option $ vite-plugin-ssr prerender --no-extra-dir (c88e030)
  • provide TypeScript types for pageContext (fix #110) (ceb6ebd)

0.1.3 (2021-07-07)

Bug Fixes

  • don't lower case when matching URLs (333583f)
  • improve strategy to hunt down Vite cache bug (#108) (085207a)

0.1.2 (2021-06-17)

Features

  • also expose pageContext.pageExports on the client-side (83801ff)
  • support async route functions (fix #97) (0aca411)

0.1.1 (2021-06-09)

Features

  • enable Jest/Babel component unit testing (fix #91) (cb3417d)

0.1.0 (2021-06-06)

Nothing changed (0.1.0 is equivalent to 0.1.0-beta.50); vite-plugin-ssr is now out of beta :-).

0.1.0-beta.50 (2021-06-02)

Bug Fixes

  • define ESM build in tsconfig.ts instead of CLI (vitejs/vite#3617, fix #85) (4fdbf91)

0.1.0-beta.49 (2021-06-02)

Bug Fixes

0.1.0-beta.48 (2021-05-30)

  • rename dangerouslySetHtml to dangerouslySkipEscape (fix #84) (b14bd17), closes #84

Bug Fixes

BREAKING CHANGES

  • Replace dangerouslySetHtml with dangerouslySkipEscape. E.g. for linux users: git ls-files | xargs sed -i "s/dangerouslySetHtml/dangerouslySkipEscape/g"

0.1.0-beta.47 (2021-05-29)

Features

  • make *.page.js exports available to user as pageContext.pageExports (fix #80)

0.1.0-beta.46 (2021-05-28)

  • define everything on pageContext (fix #76) (15d68f8), closes #76

BREAKING CHANGES

  • Apply following changes:
  // *.page.server.js

  export { render }
- function render({ Page, pageContext }) {
+ function render(pageContext) {
+   const { Page } = pageContext
    /* ... */
  }

  export { addPageContext }
- function addPageContext({ Page, pageContext }) {
+ function addPageContext(pageContext) {
+   const { Page } = pageContext
    /* ... */
  }
  // *.page.client.js

  import { getPage } from "vite-plugin-ssr/client";

- const { Page, pageContext } = await getPage();
+ const pageContext = await getPage();
+ const { Page } = pageContext
  // *.page.client.js

  import { useClientRouter } from 'vite-plugin-ssr/client/router'

  useClientRouter({
-   render({ Page, pageContext, isHydration }) {
+   render(pageContext) {
+     const { Page, isHydration } = pageContext
      /* ... */
    },
  })
  // At your server integration point

  const express = require('express')
  const { createPageRender } = require('vite-plugin-ssr')

  /* ... */

  const pageRender = createPageRender(/*...*/)

  /* ... */

- pageRender({ url, pageContext })
+ pageContext.url = url
+ pageRender(pageContext)
  • pageContext.urlFull is deprecated; use pageContext.urlNormalized instead.

0.1.0-beta.45 (2021-05-26)

Bug Fixes

  • reload glob imports in dev (#66) (09b54c0)
  • Route Functions should return routeParams instead of contextProps (fix #63) (e03b918)

Features

  • always route on the server-side (fix #73) (ef3eb3c)
  • rename contextProps to pageContext, and addContextProps to addPageContext (fix #58) (aedf9fc), closes #58

BREAKING CHANGES

  • Replace all occurences in your source code of addContextProps to addPageContext, and all occurences of contextProps to pageContext. There is no need for semantic replacing: you can simply replace text, for example with a linux terminal:
    1. git ls-files | xargs sed -i "s/addContextProps/addPageContext/g"
    2. git ls-files | xargs sed -i "s/contextProps/pageContext/g"
  • Make your Route Functions return { match: true, routeParams: {/*...*/} } instead of { match: true, pageContext: {/*...*/} } (or { match: true, contextProps: {/*...*/} } if you didn't rename contextProps to pageContext yet).

0.1.0-beta.44 (2021-05-20)

Bug Fixes

  • Add mime types to preload tags, add common image preload tags (29a3b96)

0.1.0-beta.43 (2021-05-18)

Bug Fixes

  • use visibilitychange event instead of unload event (b2cc36e)

Features

  • implement <a keep-scroll-position /> and navigate(url, { keepScrollPosition: true }) (#62) (6a8515a)

0.1.0-beta.42 (2021-05-14)

Bug Fixes

  • write pre-render files sequentially (fix #59) (2339746)

0.1.0-beta.41 (2021-05-14)

Bug Fixes

  • on static hosts, fallback to Server Routing for 404 pages (#57) (56e0d0a)

Features

  • also generate dist/client/404.html when pre-rendering (fix #57) (d6072f2)

0.1.0-beta.40 (2021-05-05)

Bug Fixes

  • add empty .npmignore to ensure dist/ is always published (c241c53)

0.1.0-beta.38 (2021-05-05)

Bug Fixes

  • make sure Node.js doesn't try to use browser entry points (fix #55) (4e9c14b)

0.1.0-beta.37 (2021-05-04)

  • make route parameters available only at contextProps.routeParams (f98f94b)

BREAKING CHANGES

  • Route parameters are not available directly at contextProps anymore. E.g. use contextProps.routeParams.movieId instead of contextProps.movieId (for a route string /movie/:movieId).

0.1.0-beta.36 (2021-05-01)

Bug Fixes

  • also check windows path for usesClientRouter test (b3c1cab)
  • do not assume .page.js files to always be the root in the manifest (fix #51) (138a3f7)
  • fix preload tags paths when building on windows (9c2fd40)

0.1.0-beta.35 (2021-04-26)

Bug Fixes

  • vite-fix-2390 is not required anymore (& bump Vite dependency) (36fade0)
  • do not reload page when user only changes the URL hash (dbb6f9a)
  • do not use new URL for extracting URL search and URL hash (fix #47) (4f3d737)
  • throttle scroll event listener (fix #46) (c58d1ff)
  • use browser scroll restore for first page load (b6f701b)

Features

  • allow Route Functions to return a boolean and make returning match optional (963e488)
  • make contextProps.urlParsed available to user (97aa908)

0.1.0-beta.34 (2021-04-21)

Bug Fixes

  • simplify navigationState and avoid unnecessary contextProps fetching when navigating to /# (#43) (9e2196b)
  • use path.posix.relative instead of path.relative (5eadbb1)
  • version number in assertion messages (47a99a6)

Features

  • make contextProps.urlFull and contextProps.urlPathname available everywhere (fix #42, fix #42) (b3f46fc)

BREAKING CHANGES

  • contextProps.url and contextProps.urlNormalized are deprecated: use contextProps.urlFull and contextProps.urlPathname instead.

0.1.0-beta.33 (2021-04-17)

Bug Fixes

  • retrieve context props for 404 page, and expect missing context props for 404 page if no _error.page.js is defined (fix #41) (55cd596)

0.1.0-beta.32 (2021-04-16)

Features

BREAKING CHANGES

  • pageProps and setPageProps() are deprecated. Define your page props on contextProps.pageProps by returning pageProps in addContextProps(), and then export const passToClient = ['pageProps'] in .page.server.js to tell vite-plugin-ssr to serialize and pass contextProps.pageProps to the browser. In the browser contextProps is now available at const { Page, contextProps } = await getPage() and useClientRouter({ render({ Page, contextProps, isHydration }) }).

0.1.0-beta.31 (2021-04-15)

Bug Fixes

  • remove test files from boilerplates (c255dbb)
  • use parseUrl() instead of new URL() (fix #28) (447d095)

0.1.0-beta.30 (2021-04-10)

Bug Fixes

  • prevent dynamic dependency paths from mistakenly being statically analysed (a1eca47)

Features

  • accept any valid URL to be passed to renderPage() (930865e)
  • add contextProps.routeParams (512a253)
  • add contextProps.urlNormalized (9c932b0)

0.1.0-beta.29 (2021-04-10)

Bug Fixes

0.1.0-beta.28 (2021-04-10)

Bug Fixes

  • cli: process exit 1 on unhandled promise rejections (fix #33) (6ab3b49)
  • [cloudflare workers] do not import plugin code in prod (#1) (a6af9e7)
  • change url right before rendering new page (97530f0)
  • do not assume asset path to start with assets/ (fix #32) (9791c41)
  • improve error handling for CF workers (70a89e0)

Features

  • [cloudflare workers] generate importer.js (#1) (dfa4e76)
  • cli: add option to set root (4f1087a)
  • [cloudflare workers] allow user to manually set Vite Manifests (#1) (75aa55e)
  • [cloudflare workers] make loading vite entry user file loader self sufficient for build (#1) (0693184)
  • [cloudflare workers] remove client-side code in SSR bundles (#1) (557fabc)

BREAKING CHANGES

  • import ssr from 'vite-plugin-ssr' now throws an error; use import ssr from 'vite-plugin-ssr/plugin' instead.

0.1.0-beta.27 (2021-04-03)

Bug Fixes

Features

  • auto-detect whether useClientRouter() is used and pass that info to the pre-render + pass Vite's base value to the pre-render (698f060)
  • support base url for prod server (de8c0e0)

0.1.0-beta.26 (2021-03-30)

Bug Fixes

  • CJS default plugin export (09c3ee4)

0.1.0-beta.25 (2021-03-30)

Bug Fixes

0.1.0-beta.24 (2021-03-30)

Bug Fixes

Features

BREAKING CHANGES

  • This release only works with @vite@2.1.4; make sure to pin your vite dependency to 2.1.4 in your package.json.

0.1.0-beta.23 (2021-03-28)

Bug Fixes

  • add CJS default export for vite-plugin-ssr/plugin (40216d2)

0.1.0-beta.22 (2021-03-28)

Bug Fixes

  • only intercept regular left clicks on regular links (405a27f)
  • save & restore scroll position upon client-side routing (72815c7)

improve

  • don't load plugin code in production (95e7e0f)

BREAKING CHANGES

  • It's now recommended to do import ssr from 'vite-plugin-ssr/plugin'; instead of import ssr from 'vite-plugin-ssr';. A warning will be shown otherwise.

0.1.0-beta.21 (2021-03-26)

Bug Fixes

  • Filesystem Routing bug when common prefix ends in filename (06ccfaa)
  • fix mapping of pageId and page files (fix #18) (45436f5)
  • use some-path/index.html instead of some-path.html (fix #19) (7281ffe)

Features

  • expose CLI as JavaScript API (e16ec91)

0.1.0-beta.20 (2021-03-26)

Bug Fixes

Features

  • update peer dependency on vite 2.1.2->2.1.3 (6778f09)

BREAKING CHANGES

  • this release works only with vite@2.1.3 so make sure to pin your vite dependency to 2.1.3

0.1.0-beta.19 (2021-03-25)

Features

  • add --skip-git flag to boilerplates (18e1616)
  • add support for base url (fix #16) (b4a4f2f)

0.1.0-beta.18 (2021-03-24)

Bug Fixes

  • when injecting HTML: also recognize tags that have attributes (651428a)

Features

0.1.0-beta.17 (2021-03-19)

Bug Fixes

  • remove zero-js problematic example (69d662d)

Features

0.1.0-beta.16 (2021-03-18)

Bug Fixes

  • auto apply @brillout/vite-fix-2390 (f847a32), closes #5

0.1.0-beta.15 (2021-03-17)

Bug Fixes

  • support building in ts cjs projects (be5c7dc), closes #11

0.1.0-beta.14 (2021-03-17)

Bug Fixes

  • improve thenable check (62fca8e)
  • remove need for AntiFlicker by preloading styles in dev (debb9bd), closes #2

Reverts

0.1.0-beta.13 (2021-03-14)

Bug Fixes

  • do not assertUsage viteDevServer in production (d7f69c5)

0.1.0-beta.12 (2021-03-12)

Features

  • allow non-page .server file extensions (10a14d1), closes #3

0.1.0-beta.11 (2021-03-09)

Bug Fixes

  • skip /favicon.ico requests (f528784)

chore

  • rename createRender() to createPageRender() (f62dc8e)

Features

  • improve error handling (4a945bf)
  • improve route functions (9af7f7b)
  • improve usage error messages (cc0d678)

BREAKING CHANGES

  • server integration point createRender() renamed to createPageRender().
  • render() function (const render = createRender(/*...*/)) now returns an object { nothingRendered, renderResult, statusCode }.
  • _404.page.js and _500.page.js deprecated and replaced with _error.page.js.

0.1.0-beta.10 (2021-03-05)

Bug Fixes

  • convert windows path to posix for micromatch (cc9c405), closes #4
  • don't try to inject dynamic import polyfill (fdffd37)
  • boilerplates: remove duplicated file (4421aa6)

Features

  • allow render hook to return an object instead of HTML (a649eaf)
  • support _500.page.js and improve error handling (d492b9c)
  • support html tag composition (9a57006)

0.1.0-beta.9 (2021-03-01)

Bug Fixes

  • Fix released build

0.1.0-beta.8 (2021-03-01)

Bug Fixes

  • re-export default (cd43e6e)
  • use in operator only on objects (819dfe1)

Features

  • remove html.sanitize and make sanitized automatic (95d145c)

BREAKING CHANGES

  • Removed html.sanitize(); simply directly insert the string and vite-plugin-ssr will automatically sanitize it

0.1.0-beta.7 (2021-02-28)

Features

  • Pass Page to addContextProps. (2512ee3)

0.1.0-beta.6 (2021-02-22)

Initial public release