Skip to content

v0.27.0

Compare
Choose a tag to compare
@thescientist13 thescientist13 released this 23 Nov 21:22
· 202 commits to master since this release

Overview

In addition to some general refactoring around bundling, this release introduces some exciting new feature and enhancements for Greenwood!

  • 📚 Full Stack Web Components
  • 📦 CSS Bundling and Minification (custom implementation)
  • ⚙️ Improved Build Capacity

Checkout the accompanying blog post for more information on all these features.

If using Yarn, you can can upgrade all your @greenwood packages at once

$ yarn upgrade --scope @greenwood --latest

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.27.0

  1. CSS Bundling (and dropping PostCSS as core dependency)
  2. refactor bundling lifecycle and resource optimizations
  3. avoid Rollup double bundling for pre-bundled static assets for server routes
  4. ensure inline <script> and <style> tags are getting minified / optimized when running build command
  5. fix incorrect HUD noopener implementation
  6. auto spread arrays of plugins
  7. remove hardcoded directory references in rollup configuration
  8. introduce worker thread pools for SSR page generation
  9. upgrade to WCC 0.6.x
  10. update rollup preserveEntrySignatures to neutral setting to silence warning output
  11. support resource plugin based transformations for standard module formats (ex: import JSON, CSS) for SSR

Breaking Changes

Import CSS Plugin

Not a breaking change per se, but if using the plugin "externally" like with Web Test Runner, you will need to ensure certain headers are polyfilled

// before
const url = importCssResource.getBareUrlPath(context.request.url); // need to remove query strings first
const shouldIntercept = await importCssResource.shouldIntercept(url, context.body, { request: context.headers })

if (shouldIntercept) {
  const cssResource = await importCssResource.intercept(url, context.body);
  
  ...
}      

// after
const url = importCssResource.getBareUrlPath(context.request.url); // need to remove query strings first
const customHeaders = {
  request: {
    originalUrl: url,
    ...context.headers
  }
};
const shouldIntercept = await importCssResource.shouldIntercept(url, context.body, customHeaders);

if (shouldIntercept) {
  const cssResource = await importCssResource.intercept(url, context.body, customHeaders);
  ...
}

Known Issues

  1. CSS functions in declarations not getting padded with a space
  2. CSS minification not handling / relative paths to node_modules
  3. <style> tags in the <body> are not getting optimized

Diff

$ git diff v0.26.0 v0.27.0 --stat | grep -v "www"
 .github/workflows/ci-exp.yml                       |   28 +
 .github/workflows/ci-win-exp.yml                   |   25 +
 .mocharc.cjs                                       |    5 +-
 .nvmrc                                             |    2 +-
 greenwood.config.js                                |   12 +-
 lerna.json                                         |    2 +-
 netlify.toml                                       |    6 +-
 package.json                                       |    8 +-
 packages/cli/package.json                          |    8 +-
 packages/cli/src/commands/build.js                 |   17 +-
 packages/cli/src/commands/serve.js                 |    2 +-
 packages/cli/src/config/rollup.config.js           |  619 ++----------
 packages/cli/src/index.js                          |    2 +-
 packages/cli/src/lib/resource-utils.js             |   50 +
 packages/cli/src/lib/ssr-route-worker.js           |    6 +-
 packages/cli/src/lib/threadpool.js                 |   79 ++
 packages/cli/src/lifecycles/bundle.js              |  156 ++-
 packages/cli/src/lifecycles/compile.js             |    3 +-
 packages/cli/src/lifecycles/config.js              |   25 +-
 packages/cli/src/lifecycles/context.js             |    2 +-
 packages/cli/src/lifecycles/graph.js               |   94 +-
 packages/cli/src/lifecycles/prerender.js           |  207 ++--
 packages/cli/src/lifecycles/serve.js               |   14 -
 packages/cli/src/loader.js                         |   68 ++
 .../src/plugins/resource/plugin-node-modules.js    |    3 +-
 .../src/plugins/resource/plugin-standard-css.js    |  198 +++-
 .../src/plugins/resource/plugin-standard-html.js   |  314 +++---
 .../src/plugins/resource/plugin-standard-json.js   |    8 +
 .../src/plugins/resource/plugin-static-router.js   |   57 +-
 .../build.config.interpolate-frontmatter.spec.js   |    4 +-
 .../build.config-optimization-default.spec.js      |   17 +-
 .../fixtures/expected.css                          |   57 ++
 .../src/pages/index.html                           |    2 +-
 .../src/styles/main.css                            |  122 +++
 .../src/styles/theme.css                           |   11 +-
 .../src/system/variables.css                       |   16 +
 .../build.config-optimization-inline.spec.js       |   10 +-
 .../build.config-optimization-none.spec.js         |   12 +-
 .../build.config-optimization-overrides.spec.js    |    2 +-
 .../build.config.static-router.spec.js             |    5 +-
 .../build.default.import-node-modules.spec.js      |    7 +-
 .../build.default.meta/build.default.meta.spec.js  |    9 +
 .../cases/build.default.meta/src/pages/index.md    |    4 +
 .../build.default.spa/build.default.spa.spec.js    |    3 +-
 .../build.default.ssr-prerender.spec.js            |   88 ++
 .../greenwood.config.js                            |    3 +
 .../src/components/footer.js                       |   16 +
 .../build.default.ssr-prerender/src/pages/index.js |    7 +
 .../src/templates/app.html                         |   13 +
 .../build.default.ssr-static-export.spec.js        |   18 +-
 .../build.default.ssr/build.default.ssr.spec.js    |   42 +-
 .../cases/build.default.ssr/src/pages/about.md     |    3 +
 .../cases/build.default.ssr/src/pages/index.js     |    9 +
 .../cases/build.default.ssr/src/pages/index.md     |    3 -
 .../build.default.workspace-javascript-css.spec.js |   66 +-
 .../src/pages/index.html                           |   11 +-
 .../src/scripts/popup.js                           |    1 +
 ...default.workspace-template-page-and-app.spec.js |   15 +-
 .../build.default.workspace-template-page.spec.js  |    2 +-
 .../cases/develop.default/develop.default.spec.js  |    7 +-
 .../test/cases/develop.default/greenwood.config.js |    2 +-
 .../cli/test/cases/develop.ssr/develop.ssr.spec.js |    2 +-
 .../test/cases/serve.default/greenwood.config.js   |    2 +-
 .../test/cases/serve.default/serve.default.spec.js |    7 +-
 .../test/cases/theme-pack/theme-pack.build.spec.js |    2 +-
 packages/init/package.json                         |    2 +-
 packages/plugin-babel/README.md                    |    5 +-
 packages/plugin-babel/package.json                 |    4 +-
 packages/plugin-google-analytics/package.json      |    4 +-
 packages/plugin-google-analytics/src/index.js      |    2 +-
 .../test/cases/default/default.spec.js             |    2 +-
 .../option-anonymous/option-anonymous.spec.js      |    2 +-
 packages/plugin-graphql/README.md                  |    4 +-
 packages/plugin-graphql/package.json               |    4 +-
 packages/plugin-graphql/src/index.js               |   10 +-
 .../cases/query-children/query-children.spec.js    |    4 +-
 .../query-custom-schema.spec.js                    |    4 +-
 .../test/cases/query-graph/query-graph.spec.js     |    8 +-
 .../plugin-graphql/test/unit/schema/graph.spec.js  |    2 +-
 packages/plugin-import-commonjs/README.md          |    2 +-
 packages/plugin-import-commonjs/package.json       |    4 +-
 packages/plugin-import-css/README.md               |   53 +-
 packages/plugin-import-css/package.json            |   10 +-
 packages/plugin-import-css/src/index.js            |   35 +-
 .../test/cases/default/default.spec.js             |    3 +-
 .../exp-build.prerender.spec.js                    |   89 ++
 .../cases/exp-build.prerender/greenwood.config.js  |    8 +
 .../test/cases/exp-build.prerender/package.json    |    4 +
 .../exp-build.prerender/src/components/footer.css  |    1 +
 .../exp-build.prerender/src/components/footer.js   |   25 +
 .../cases/exp-build.prerender/src/pages/index.md   |    3 +
 .../exp-build.prerender/src/templates/app.html     |   12 +
 packages/plugin-import-json/README.md              |   25 +-
 packages/plugin-import-json/package.json           |    7 +-
 packages/plugin-import-json/src/index.js           |   29 +-
 .../test/cases/default/default.spec.js             |    2 +-
 .../cases/develop.default/develop.default.spec.js  |    4 +-
 .../exp-build.prerender.spec.js                    |   89 ++
 .../cases/exp-build.prerender/greenwood.config.js  |    8 +
 .../test/cases/exp-build.prerender/package.json    |    5 +
 .../exp-build.prerender/src/components/footer.js   |   22 +
 .../cases/exp-build.prerender/src/pages/index.md   |    3 +
 .../exp-build.prerender/src/templates/app.html     |   12 +
 packages/plugin-include-html/README.md             |    2 +-
 packages/plugin-include-html/package.json          |    4 +-
 packages/plugin-polyfills/README.md                |    2 +-
 packages/plugin-polyfills/package.json             |    4 +-
 packages/plugin-polyfills/src/index.js             |    8 +-
 .../plugin-polyfills/test/cases/dsd/dsd.spec.js    |    2 +-
 .../plugin-polyfills/test/cases/lit/lit.spec.js    |    4 +-
 packages/plugin-postcss/README.md                  |    2 +-
 packages/plugin-postcss/package.json               |   11 +-
 packages/plugin-postcss/src/index.js               |   23 +-
 packages/plugin-postcss/src/postcss.config.js      |    1 +
 .../options.extend-config.spec.js                  |    2 +-
 .../options.extend-config/src/styles/main.css      |    2 +
 .../options.extend-config/src/styles/theme.css     |    3 +
 packages/plugin-renderer-lit/package.json          |    4 +-
 .../src/ssr-route-worker-lit.js                    |    6 +-
 packages/plugin-renderer-puppeteer/README.md       |    5 +-
 packages/plugin-renderer-puppeteer/package.json    |    4 +-
 .../src/plugins/resource.js                        |   20 -
 .../src/puppeteer-handler.js                       |    9 +-
 .../test/cases/build.default/build.default.spec.js |    7 +-
 packages/plugin-typescript/README.md               |    5 +-
 packages/plugin-typescript/package.json            |    8 +-
 packages/plugin-typescript/src/index.js            |   15 +-
 .../test/cases/default/default.spec.js             |    5 +-
 .../options.extend-config.spec.js                  |    2 +-
 test/smoke-test.js                                 |   28 +-
 test/test-loader.js                                |   35 +
 .../blog-images/full-stack-web-components.webp     |  Bin 0 -> 22836 bytes
 yarn.lock                                          | 1030 +++++---------------
 149 files changed, 2492 insertions(+), 2067 deletions(-)