greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.

MIT License

Downloads
4.6K
Stars
97
Committers
8

Bot releases are visible (Hide)

greenwood - v0.28.4

Published by thescientist13 over 1 year ago

Overview

This patch release fixes the final known issue coming out of the v0.28.0 release related to stale content in the browser (JavaScript, CSS) seen in development.

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.28.4

  1. browsers inconsistently serving incorrect / stale content from dev server

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.28.3 v0.28.4 --stat | grep -v "www"
 lerna.json                                         |  2 +-
 packages/cli/package.json                          |  2 +-
 packages/cli/src/lifecycles/serve.js               | 45 ++++++++++++--------
 .../cases/develop.default/develop.default.spec.js  | 48 +++++++++++++++++++++-
 packages/init/package.json                         |  2 +-
 packages/plugin-babel/package.json                 |  4 +-
 packages/plugin-google-analytics/package.json      |  4 +-
 packages/plugin-graphql/package.json               |  4 +-
 packages/plugin-import-commonjs/package.json       |  4 +-
 packages/plugin-import-css/package.json            |  4 +-
 packages/plugin-import-json/package.json           |  4 +-
 packages/plugin-import-jsx/package.json            |  4 +-
 packages/plugin-include-html/package.json          |  4 +-
 packages/plugin-polyfills/package.json             |  4 +-
 packages/plugin-postcss/package.json               |  4 +-
 packages/plugin-renderer-lit/package.json          |  4 +-
 packages/plugin-renderer-puppeteer/package.json    |  4 +-
 packages/plugin-typescript/package.json            |  4 +-
 21 files changed, 111 insertions(+), 54 deletions(-)
greenwood - v0.28.3

Published by thescientist13 over 1 year ago

Overview

This patch release fixes a recently discovered breaking change in @apollo/client with a new entry point being needed for newer versions for use in our plugin-graphql.

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.28.3

  1. plugin-graphql importing apollo/client file that no longer exists in recent releases - thanks @hutchgrant 🚀

Breaking Changes

N / A

Known Issues

  1. browsers inconsistently serving incorrect / stale content from dev server

Diff

$ git diff v0.28.2 v0.28.3 --stat | grep -v "www"
  lerna.json                                      |   2 +-
 packages/cli/package.json                       |   2 +-
 packages/init/package.json                      |   2 +-
 packages/plugin-babel/package.json              |   4 +-
 packages/plugin-google-analytics/package.json   |   4 +-
 packages/plugin-graphql/package.json            |   6 +-
 packages/plugin-graphql/src/core/cache.js       |  10 +-
 packages/plugin-import-commonjs/package.json    |   4 +-
 packages/plugin-import-css/package.json         |   4 +-
 packages/plugin-import-json/package.json        |   4 +-
 packages/plugin-import-jsx/package.json         |   4 +-
 packages/plugin-include-html/package.json       |   4 +-
 packages/plugin-polyfills/package.json          |   4 +-
 packages/plugin-postcss/package.json            |   4 +-
 packages/plugin-renderer-lit/package.json       |   4 +-
 packages/plugin-renderer-puppeteer/package.json |   4 +-
 packages/plugin-typescript/package.json         |   4 +-
 yarn.lock                                       | 152 ++++++++++++------------
 19 files changed, 113 insertions(+), 111 deletions(-)
greenwood - v0.28.2

Published by thescientist13 over 1 year ago

Overview

This patch release aims to address the known issues coming out of the 0.28.0 release.

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.28.2

  1. SSR pages are not getting their resources (<link> and <script> tags) bundled and optimized with the serve command
  2. imported modules in API routes not reloading changes in development mode
  3. not found static assets are returning 500 status code when running the serve command

Breaking Changes

N / A

Known Issues

  1. browsers inconsistently serving incorrect / stale content from dev server

Diff

$ git diff v0.28.1 v0.28.2 --stat | grep -v "www"
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   2 +-
 packages/cli/src/commands/build.js                 |  60 +++++-
 packages/cli/src/lib/api-route-worker.js           |  43 ++++
 packages/cli/src/lib/resource-utils.js             |  67 +++++-
 packages/cli/src/lifecycles/bundle.js              |  23 +-
 packages/cli/src/lifecycles/compile.js             |   9 -
 packages/cli/src/lifecycles/graph.js               |  18 +-
 packages/cli/src/lifecycles/prerender.js           |  69 +-----
 packages/cli/src/lifecycles/serve.js               |  55 ++---
 .../cli/src/plugins/copy/plugin-copy-graph-json.js |  14 --
 .../cli/src/plugins/resource/plugin-api-routes.js  |  70 +++++-
 .../src/plugins/resource/plugin-standard-html.js   |   4 +-
 .../build.default.ssr-static-export.spec.js        |   5 +-
 .../cli/test/cases/develop.ssr/develop.ssr.spec.js |   2 +-
 .../serve.default.api/serve.default.api.spec.js    |  24 +++
 .../serve.default.ssr/serve.default.ssr.spec.js    |  51 ++++-
 .../serve.default.ssr/src/components/header.js     |  19 ++
 .../cases/serve.default.ssr/src/templates/app.html |   2 +
 .../test/cases/serve.default/serve.default.spec.js |  24 +++
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-import-jsx/package.json            |   4 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 yarn.lock                                          |   8 +-
 54 files changed, 681 insertions(+), 208 deletions(-)
greenwood - v0.28.1

Published by thescientist13 over 1 year ago

Overview

This patch release aims to fix a known issue coming out of the recent 0.28.0 release.

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.28.1

  1. SSR pages with prerender configuration are not getting served from static HTML
  2. align static server port being hardcoded for generic URL creation

Breaking Changes

N / A

Known Issues

  1. SSR pages are not getting their resources (<link> and <script> tags) bundled and optimized with the serve command
  2. imported modules in API routes not reloading changes in development mode
  3. not found static assets are returning 500 status code when running the serve command
  4. browsers inconsistently serving incorrect / stale content from dev server

Diff

$ git diff v0.28.0 v0.28.1 --stat | grep -v "www"
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   2 +-
 packages/cli/src/lifecycles/bundle.js              | 150 +++++++++--------
 packages/cli/src/lifecycles/serve.js               |   7 +-
 .../src/plugins/copy/plugin-copy-user-templates.js |  21 ---
 .../greenwood.config.js                            |   3 +
 .../serve.default.ssr-prerender-api-hybrid.spec.js | 181 +++++++++++++++++++++
 .../src/api/greeting.js                            |  11 ++
 .../src/components/footer.js                       |  16 ++
 .../src/pages/index.js                             |   7 +
 .../src/templates/app.html                         |  13 ++
 .../serve.default.ssr-prerender.spec.js            |  14 ++
 .../serve.default.ssr-static-export.spec.js        |   8 +
 .../serve.default.ssr/serve.default.ssr.spec.js    |  28 ++++
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-import-jsx/package.json            |   4 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 29 files changed, 394 insertions(+), 125 deletions(-)
greenwood - v0.28.0

Published by thescientist13 over 1 year ago

Overview

In addition to some general refactoring around bundling SSR routes and some breaking changes (see section on Breaking Changes below), this release introduces some exciting new feature and enhancements for Greenwood!

  • 📦 Node 18 (minimum) version upgrade
  • 🕸️ Web API Standardization
  • ⚡ API Routes

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.28.0

  1. upgrade to Node v18 as minimum supported version
  2. Standardize on Web APIs (Request / Response / URL / etc)
  3. API Routes
  4. Support web standard <audio> and <video> formats
  5. Create a plugin for import JSX plugin (using WCC)
  6. bundle and optimize server and API routes and serve from output directory (decouple serve task from source code)

Breaking Changes

Node 18

The new minimum supported Node version with Greenwood is now v18. So make sure you update your GitHub Actions, hosting configuration; e.g. _netlify.toml, .nvmrc, etc.

Additionally, Greenwood now longer depends on node-fetch however native fetch in Node 18 can / should be a drop in replacement for most cases. Just remove your import line for node-fetch and test, and if so, you should be good to go! (You can always self install node-fetch if you want it back though).

greenwood.config.js

Workspace

You can now pass in a URL object directly instead of having to convert it to a path

import { fileURLToPath } from 'url';

// before
export default {
  workspace: fileURLToPath(new URL('./www', import.meta.url))
};
// after
export default {
  workspace: new URL('./www', import.meta.url)
};

devServer.extensions

No period (.) is needed when passing in custom extensions.

// before
extensions: ['.txt', '.rtf']
// after
extensions: ['txt', 'rtf']

Plugins

Resource

Resource plugins have had their lifecycle signatures and return types refactored to align exclusively with Web APIs. The docs have been updated with more in depth examples so it is recommended to review those, but otherwise the business logic of those lifecycles should still apply. Below is a high level breakdown of the changes and an example.

shouldResolve / resolve

  • Function signature now provides an instance of URL instead of just a string path
  • Expects a Request to be returned
// before
async shouldResolve(url = '/') {
  const { userWorkspace } = this.compilation.context;

  return fs.existsSync(path.join(userWorkspace, url));
}

async resolve(url = '/') {
  const { userWorkspace } = this.compilation.context;

  return path.join(userWorkspace, bareUrl));
}
// after
async shouldResolve(url) {
  const { userWorkspace } = this.compilation.context;
  const { pathname } = url;
 
  try {
    await fs.access(new URL(`.${pathname}`, userWorkspace);
    return true;
  } catch(}{
    return false;
  }
}

async resolve(url) {
  const { pathname } = url;
  const { userWorkspace } = this.compilation.context;

  return new Request(new URL(`.${pathname}`, userWorkspace));
}

shouldServe / serve

  • Function signature now provides an instance of URL and Request
  • Expects a Response to be returned
// before
async shouldServe(url) {
   return path.extname(url) === '.css' && fs.existsSync(url);
}

async serve(url) {
  const css = await fs.promises.readFile(url, 'utf-8');

  resolve({
    body: css,
    contentType: this.contentType
  });
}
// after
async shouldServe(url) {
  return url.protocol === 'file:' && this.extensions.indexOf(url.pathname.split('.').pop()) >= 0;
}

async serve(url) {
  const body = await fs.readFile(url, 'utf-8');

  return new Response(body, {
    headers: {
      'Content-Type': 'text/css'
    }
  });
}

shouldIntercept / intercept

  • Function signature now provides an instance of URL, Request, and Response
  • Expects a Response to be returned
// before
async shouldIntercept(url, body, headers = { request: {} }) {
  const { originalUrl = '' } = headers.request;
  const accept = headers.request.accept || '';
  const isCssFile = path.extname(url) === '.css';
  const notFromBrowser = accept.indexOf('text/css') < 0 && accept.indexOf('application/signed-exchange') < 0;

  // https://github.com/ProjectEvergreen/greenwood/issues/492
  const isCssInJs = originalUrl.indexOf('?type=css') >= 0
    || isCssFile && notFromBrowser
    || isCssFile && notFromBrowser && url.indexOf('/node_modules/') >= 0;

  return isCssInJs
}

async intercept(url, body) {
  const finalBody = body || await fs.promises.readFile(pathToFileURL(url), 'utf-8');
  const cssInJsBody = `const css = \`${finalBody.replace(/\r?\n|\r/g, ' ').replace(/\\/g, '\\\\')}\`;\nexport default css;`;
  
  return {
    body: cssInJsBody,
    contentType: this.contentType
  };
}
// after
async shouldIntercept(url, request) {
  const { pathname } = url;
  const accepts = request.headers.get('accept') || '';
  const isCssFile = pathname.split('.').pop() === 'css';
  const notFromBrowser = accepts.indexOf('text/css') < 0 && accepts.indexOf('application/signed-exchange') < 0;

  // https://github.com/ProjectEvergreen/greenwood/issues/492
  const isCssInJs = url.searchParams.has('type') && url.searchParams.get('type') === this.extensions[0]
    || isCssFile && notFromBrowser
    || isCssFile && notFromBrowser && pathname.startsWith('/node_modules/');

  return isCssInJs;
}

async intercept(url, request, response) {
  const body = await response.text();
  const cssInJsBody = `const css = \`${body.replace(/\r?\n|\r/g, ' ').replace(/\\/g, '\\\\')}\`;\nexport default css;`;
  
  return new Response(cssInJsBody, {
    headers: new Headers({
      'Content-Type': this.contentType
    })
  });
}

shouldOptimize / optimize

  • Function signature now provides an instance of URL and Response
  • Expects a Response to be returned
// before
async shouldOptimize(url) {
  return path.extname(url) === '.css' && this.compilation.config.optimization !== 'none'
}

async optimize(url, body) {
  return bundleCss(body);
}
// after
async shouldOptimize(url, response) {
  const { protocol, pathname } = url;
  const isValidCss = pathname.split('.').pop() === 'css'
    && protocol === 'file:'
    && response.headers.get('Content-Type').indexOf('text/css') >= 0;

  return this.compilation.config.optimization !== 'none' && isValidCss;
}

async optimize(url, response) {
  const body = await response.text();
  const optimizedBody = bundleCss(body);

  return new Response(optimizedBody);
}

Copy

Now the Copy plugin expects to the to and from properties to be URLs.

For directories, make sure to add a trailing /!

// before
[{
  // copy a file
  from: path.join(context.userWorkspace, 'robots.txt'),
  to: path.join(context.outputDir, 'robots.txt')
}, {
  // copy a directory
  from: path.join(context.userWorkspace, 'pdfs'),
  to: path.join(context.outputDir, 'pdfs')
}];
// after
[{
  // copy a file
  from: new URL('./robots.txt', context.userWorkspace),
  to: new URL('./robots.txt', context.outputDir)
}, {
  // copy a directory
  from: new URL('./pdfs/', context.userWorkspace),
  to: new URL('./pdfs/', context.outputDir)
}];

Context (Theme Packs)

For Context plugins, a URL is now expected for template locations.

// before
import { fileURLToPath } from 'urt';

return {
  templates: [
    fileURLToPath(new URL('./dist/layouts', import.meta.url))
  ]
};
// after
return {
  templates: [
    new URL('./dist/layouts/', import.meta.url)
  ]
};

Integrations (e.g. WTR)

For custom 3rd party tools like WTR (Web Test Runner), you can still use your resource plugins, updated for the new API. Below are a couple examples for supporting TypeScript and importing CSS-in-JS.

import fs from 'fs/promises';
import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css/src/index.js';
import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript/src/index.js';

// create a direct instance of ImportCssResource
const importCssResource = greenwoodPluginImportCss()[0].provider({});

// create a direct instance of TypeScriptResource
const typeScriptResource = greenwoodPluginTypeScript()[0].provider({
  context: {
    projectDirectory: new URL(import.meta.url)
  }
});

export default {
  plugins: [{
    name: 'transpile-typescript',
    async transform(context) {
      const { url } = context.request;

      if (url.endsWith('.ts')) {
        const response = await typeScriptResource.serve(new URL(`.${url}`, import.meta.url));
        // https://github.com/ProjectEvergreen/greenwood/issues/661
        const body = (await response.text()).replace(/\/\/# sourceMappingURL=module.js.map/, '');

        return {
          body,
          type: 'js'
        };
      }
    }
  }, {
    name: 'import-css',
    async transform(context) {
      const url = new URL(`.${context.request.url}`, import.meta.url);
      const request = new Request(url, { headers: new Headers(context.headers) });
      const shouldIntercept = await importCssResource.shouldIntercept(url, request);

      if (shouldIntercept) {
        const contents = await fs.readFile(url);
        const initResponse = new Response(contents, { headers: new Headers(context.headers) });
        const response = await importCssResource.intercept(url, request, initResponse.clone());

        return {
          body: await response.text(),
          headers: {
            'Content-Type': response.headers.get('Content-Type')
          }
        };
      }
    }
  }]
};

ESM

To be compliant with the ESM spec, all your files referenced within JavaScript must start with a .. Using a / is not part of the spec.

<script>
  // before
  import { foo } from '/some/thing.js';

  // after
  import { foo } from '../some/thing.js';
</script>

greenwood serve

It will now be required to run greenwood build before running greenwood serve.

Known Issues

  1. SSR pages are not getting their resources (<link> and <script> tags) bundled and optimized with the serve command
  2. SSR pages with prerender configuration are not getting served from static HTML
  3. not found static assets are returning 500 status code when running the serve command
  4. imported modules in API routes not reloading changes in development mode
  5. browsers inconsistently serving incorrect / stale content from dev server

Diff

$ git diff v0.27.0 v0.28.0 --stat | grep -v "www"
 .eslintrc.cjs                                      |   1 +
 .gitattributes                                     |  13 +-
 .github/CONTRIBUTING.md                            |  24 +-
 .github/ISSUE_TEMPLATE.md                          |   6 +-
 .github/workflows/ci-exp.yml                       |   6 +-
 .github/workflows/ci-win-exp.yml                   |   4 +-
 .github/workflows/ci-win.yml                       |   4 +-
 .github/workflows/ci.yml                           |   6 +-
 .github/workflows/master.yml                       |   6 +-
 .github/workflows/release.yml                      |   6 +-
 .gitignore                                         |   1 +
 .nvmrc                                             |   2 +-
 greenwood.config.js                                |  10 +-
 lerna.json                                         |   2 +-
 netlify.toml                                       |   2 +-
 package.json                                       |   5 +-
 packages/cli/package.json                          |  21 +-
 packages/cli/src/commands/build.js                 |  13 +-
 packages/cli/src/commands/eject.js                 |  20 +-
 packages/cli/src/commands/serve.js                 |   6 +-
 packages/cli/src/config/rollup.config.js           | 159 +++--
 packages/cli/src/index.js                          |  14 +-
 packages/cli/src/lib/node-modules-utils.js         |  24 +-
 packages/cli/src/lib/resource-interface.js         |  88 ---
 packages/cli/src/lib/resource-utils.js             | 116 +++-
 packages/cli/src/lib/router.js                     |  41 +-
 packages/cli/src/lib/ssr-route-worker.js           |   7 +-
 packages/cli/src/lib/templating-utils.js           | 201 ++++++
 packages/cli/src/lifecycles/bundle.js              | 252 ++++++--
 packages/cli/src/lifecycles/compile.js             |  99 ++-
 packages/cli/src/lifecycles/config.js              |  76 +--
 packages/cli/src/lifecycles/context.js             |  31 +-
 packages/cli/src/lifecycles/copy.js                | 112 ++--
 packages/cli/src/lifecycles/graph.js               | 111 ++--
 packages/cli/src/lifecycles/prerender.js           | 156 ++---
 packages/cli/src/lifecycles/serve.js               | 395 ++++++------
 packages/cli/src/loader.js                         |  92 +--
 .../cli/src/plugins/copy/plugin-copy-assets.js     |  15 +-
 .../cli/src/plugins/copy/plugin-copy-favicon.js    |  15 +-
 .../cli/src/plugins/copy/plugin-copy-graph-json.js |   8 +-
 .../src/plugins/copy/plugin-copy-manifest-json.js  |  14 +
 .../cli/src/plugins/copy/plugin-copy-robots.js     |  15 +-
 .../src/plugins/copy/plugin-copy-user-templates.js |  21 +
 .../cli/src/plugins/resource/plugin-api-routes.js  |  42 ++
 .../cli/src/plugins/resource/plugin-dev-proxy.js   |  26 +-
 .../src/plugins/resource/plugin-node-modules.js    | 151 ++---
 .../cli/src/plugins/resource/plugin-source-maps.js |  26 +-
 .../src/plugins/resource/plugin-standard-audio.js  |  76 +++
 .../src/plugins/resource/plugin-standard-css.js    |  65 +-
 .../src/plugins/resource/plugin-standard-font.js   |  30 +-
 .../src/plugins/resource/plugin-standard-html.js   | 648 +++++++-------------
 .../src/plugins/resource/plugin-standard-image.js  |  57 +-
 .../plugins/resource/plugin-standard-javascript.js |  25 +-
 .../src/plugins/resource/plugin-standard-json.js   |  42 +-
 .../src/plugins/resource/plugin-standard-video.js  |  78 +++
 .../src/plugins/resource/plugin-static-router.js   | 179 +++---
 .../src/plugins/resource/plugin-user-workspace.js  |  33 +-
 .../cli/src/plugins/server/plugin-livereload.js    |  49 +-
 .../greenwood.config.js                            |   4 +-
 .../build.config.error-workspace.spec.js           |   4 +-
 .../build.config-optimization-default.spec.js      |  28 +-
 .../fixtures/expected.css                          |   2 +-
 .../src/pages/index.html                           |  11 +-
 .../src/styles/main.css                            |   2 +
 .../build.config-optimization-inline.spec.js       |   4 +-
 .../greenwood.config.js                            |   4 +-
 .../build.default.ssr-prerender.spec.js            |   4 +-
 .../build.default.ssr-static-export.spec.js        |  21 +-
 .../src/pages/artists.js                           |   2 -
 .../cases/build.default.ssr/greenwood.config.js    |   3 -
 .../build.default.workspace-javascript-css.spec.js |   6 +-
 .../theme-pack-context-plugin.js                   |  11 +-
 .../build.plugins.copy/build.plugins.copy.spec.js  |  70 +++
 .../cases/build.plugins.copy/greenwood.config.js   |  14 +
 .../build.plugins.resource/greenwood.config.js     |  34 +-
 .../cases/develop.default/develop.default.spec.js  | 172 ++++--
 .../test/cases/develop.default/src/api/greeting.js |  11 +
 .../develop.default/src/assets/song-sample.mp3     | Bin 0 -> 5709921 bytes
 .../develop.default/src/assets/splash-clip.mp4     | Bin 0 -> 2636174 bytes
 .../develop.plugins.context.spec.js                |   4 +-
 .../develop.plugins.context/greenwood.config.js    |  14 +-
 .../cli/test/cases/develop.spa/develop.spa.spec.js |  40 +-
 packages/cli/test/cases/develop.spa/src/main.css   |   3 +
 .../test/cases/develop.ssr/src/pages/artists.js    |   2 -
 .../serve.config.static-router.spec.js             |  65 +-
 .../serve.default.api/serve.default.api.spec.js    | 137 +++++
 .../cases/serve.default.api/src/api/fragment.js    |  18 +
 .../cases/serve.default.api/src/api/greeting.js    |  11 +
 .../cases/serve.default.api/src/components/card.js |  11 +
 .../serve.default.error.spec.js                    |  52 ++
 .../greenwood.config.js                            |   3 +
 .../serve.default.ssr-prerender.spec.js            | 119 ++++
 .../src/components/footer.js                       |  16 +
 .../serve.default.ssr-prerender/src/pages/index.js |   7 +
 .../src/templates/app.html                         |  13 +
 .../serve.default.ssr-static-export/package.json   |   6 +
 .../serve.default.ssr-static-export.spec.js        | 246 ++++++++
 .../src/components/counter.js                      |   0
 .../src/components/footer.js                       |   0
 .../src/pages/artists.js                           |  90 +++
 .../src/pages/index.md                             |   3 +
 .../src/templates/app.html                         |  13 +
 .../cases/serve.default.ssr/greenwood.config.js    |   3 +
 .../serve.default.ssr.spec.js}                     |  19 +-
 .../src/components/card.js                         |   0
 .../serve.default.ssr/src/components/counter.js    |  42 ++
 .../src/pages/about.md                             |   0
 .../src/pages/artists.js                           |   2 -
 .../src/pages/index.js                             |   0
 .../src/pages/users.js                             |   1 -
 .../src/templates/app.html                         |   0
 .../test/cases/serve.default/serve.default.spec.js | 136 ++++-
 .../cases/serve.default/src/assets/song-sample.mp3 | Bin 0 -> 5709921 bytes
 .../cases/serve.default/src/assets/splash-clip.mp4 | Bin 0 -> 2636174 bytes
 .../cli/test/cases/serve.spa/serve.spa.spec.js     | 193 ++++++
 packages/cli/test/cases/serve.spa/src/index.html   |  12 +
 .../cli/test/cases/theme-pack/greenwood.config.js  |  13 +-
 .../cli/test/cases/theme-pack/my-theme-pack.js     |  10 +-
 .../test/cases/theme-pack/theme-pack.build.spec.js |  10 +-
 .../cases/theme-pack/theme-pack.develop.spec.js    |   4 +-
 packages/init/package.json                         |  10 +-
 packages/init/src/index.js                         |   1 -
 packages/plugin-babel/README.md                    |   4 +-
 packages/plugin-babel/package.json                 |  11 +-
 packages/plugin-babel/src/index.js                 |  38 +-
 packages/plugin-google-analytics/README.md         |   1 +
 packages/plugin-google-analytics/package.json      |   9 +-
 packages/plugin-google-analytics/src/index.js      |  55 +-
 .../test/cases/default/default.spec.js             |  24 +-
 .../option-anonymous/option-anonymous.spec.js      |   4 +-
 packages/plugin-graphql/README.md                  |  10 +-
 packages/plugin-graphql/package.json               |  14 +-
 packages/plugin-graphql/src/core/cache.js          |  14 +-
 packages/plugin-graphql/src/index.js               |  77 +--
 packages/plugin-graphql/src/schema/schema.js       |  15 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 .../cases/qraphql-server/graphql-server.spec.js    |   2 +-
 .../cases/query-children/query-children.spec.js    |   2 +-
 .../test/cases/query-config/query-config.spec.js   |   2 +-
 .../query-custom-frontmatter.spec.js               |   2 +-
 .../query-custom-schema.spec.js                    |   2 +-
 .../cases/query-custom-schema/src/pages/index.html |   2 +-
 .../test/cases/query-graph/query-graph.spec.js     |   2 +-
 .../test/cases/query-menu/query-menu.spec.js       |   2 +-
 packages/plugin-import-commonjs/package.json       |  13 +-
 packages/plugin-import-commonjs/src/index.js       |  35 +-
 .../test/cases/default/default.spec.js             |   2 +-
 packages/plugin-import-css/README.md               |  17 +-
 packages/plugin-import-css/package.json            |  13 +-
 packages/plugin-import-css/src/index.js            |  54 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 packages/plugin-import-json/README.md              |  11 +-
 packages/plugin-import-json/package.json           |  11 +-
 packages/plugin-import-json/src/index.js           |  38 +-
 .../test/cases/default/default.spec.js             |   2 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 .../test/cases/develop.default/src/main.json       |   5 +-
 packages/plugin-import-jsx/README.md               |  61 ++
 packages/plugin-import-jsx/package.json            |  35 ++
 packages/plugin-import-jsx/src/index.js            |  43 ++
 .../test/cases/default/default.prerender.spec.js   |  87 +++
 .../test/cases/default/greenwood.config.js         |   7 +
 .../test/cases/default/package.json                |   5 +
 .../test/cases/default/src/components/footer.jsx   |  15 +
 .../test/cases/default/src/pages/index.md          |   3 +
 .../test/cases/default/src/templates/app.html      |  12 +
 .../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.jsx  |  17 +
 .../cases/exp-build.prerender/src/pages/index.md   |   3 +
 .../exp-build.prerender/src/templates/app.html     |  12 +
 packages/plugin-include-html/package.json          |   9 +-
 packages/plugin-include-html/src/index.js          |  72 ++-
 .../src/components/footer.js                       |   8 +-
 .../build.default.link-tag.spec.js                 |   2 +-
 packages/plugin-polyfills/package.json             |   9 +-
 packages/plugin-polyfills/src/index.js             | 104 ++--
 packages/plugin-postcss/README.md                  |   4 +-
 packages/plugin-postcss/package.json               |   9 +-
 packages/plugin-postcss/src/index.js               |  52 +-
 packages/plugin-renderer-lit/package.json          |  10 +-
 .../src/ssr-route-worker-lit.js                    |   6 +-
 .../{build.default => serve.default}/artists.json  |   0
 .../greenwood.config.js                            |   0
 .../{build.default => serve.default}/package.json  |   0
 .../serve.default.spec.js}                         |   5 +-
 .../cases/serve.default/src/components/footer.js   |  49 ++
 .../src/components/greeting.js                     |   0
 .../src/pages/artists.js                           |   0
 .../src/pages/users.js                             |   0
 .../src/templates/app.html                         |   0
 packages/plugin-renderer-puppeteer/package.json    |   9 +-
 .../src/plugins/resource.js                        |  17 +-
 packages/plugin-typescript/README.md               |   8 +-
 packages/plugin-typescript/package.json            |   9 +-
 packages/plugin-typescript/src/index.js            |  40 +-
 .../test/cases/default/default.spec.js             |   2 +-
 .../cases/develop.default/develop.default.spec.js  |   2 +-
 test/smoke-test.js                                 |   4 +-
 test/test-loader.js                                |  10 +-
 yarn.lock                                          | 672 ++++++++++++---------
 236 files changed, 5495 insertions(+), 2829 deletions(-)
greenwood - v0.28.0-alpha.5

Published by thescientist13 over 1 year ago

Overview

This alpha release improves the relationship between build output and source code, adds a plugin for using WCC's (experimental) JSX transpiling, and some regressions coming out of the last release.

In development docs here, full release blog will come out with the final release.

To adopt alpha releases, you can do the following

# yarn 1.x
$ yarn upgrade @greenwood/cli@alpha

# npm
$ npm install @greenwood/cli@alpha

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.28.0+label%3Aalpha.5

  1. bundle and optimize server and API routes and serve from output directory (decouple serve task from source code)
  2. Create a plugin for import JSX plugin (using WCC)
  3. break after first found resource match for dev server serve lifecycle

Breaking Changes

greenwood serve

It will now be required to run greenwood build before running greenwood serve.

Known Issues

  1. matching for bundling inline script tags
  2. port was hardcoded with serve command and SSR

Diff

$ git diff v0.28.0-alpha.4 v0.28.0-alpha.5 --stat | grep -v "www"
 .github/CONTRIBUTING.md                            |  24 ++-
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   6 +-
 packages/cli/src/config/rollup.config.js           |  74 +++++++-
 packages/cli/src/index.js                          |   6 +-
 packages/cli/src/lib/node-modules-utils.js         |   2 +-
 packages/cli/src/lib/resource-utils.js             |   4 +-
 packages/cli/src/lib/ssr-route-worker.js           |   2 +-
 packages/cli/src/lib/templating-utils.js           | 201 +++++++++++++++++++++
 packages/cli/src/lifecycles/bundle.js              | 151 +++++++++++++++-
 packages/cli/src/lifecycles/compile.js             |  99 +++++++++-
 packages/cli/src/lifecycles/config.js              |   3 +
 packages/cli/src/lifecycles/context.js             |   5 +-
 packages/cli/src/lifecycles/graph.js               |  50 ++++-
 packages/cli/src/lifecycles/serve.js               |  41 ++---
 .../src/plugins/copy/plugin-copy-manifest-json.js  |  14 ++
 .../src/plugins/copy/plugin-copy-user-templates.js |  21 +++
 .../cli/src/plugins/resource/plugin-api-routes.js  |  16 +-
 .../src/plugins/resource/plugin-standard-html.js   | 198 +-------------------
 .../cli/src/plugins/server/plugin-livereload.js    |   4 +-
 .../build.plugins.resource/greenwood.config.js     |   7 +-
 .../serve.config.static-router.spec.js             |  65 ++++++-
 .../serve.default.api/serve.default.api.spec.js    |   2 +-
 .../serve.default.error.spec.js                    |  52 ++++++
 .../serve.default.ssr-prerender.spec.js            |   1 +
 .../serve.default.ssr-static-export.spec.js        |   2 +-
 .../serve.default.ssr/serve.default.ssr.spec.js    |   3 +-
 .../test/cases/serve.default/serve.default.spec.js |   1 +
 .../cli/test/cases/serve.spa/serve.spa.spec.js     |   1 +
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-import-jsx/README.md               |  61 +++++++
 packages/plugin-import-jsx/package.json            |  33 ++++
 packages/plugin-import-jsx/src/index.js            |  43 +++++
 .../test/cases/default/default.prerender.spec.js   |  87 +++++++++
 .../test/cases/default/greenwood.config.js         |   7 +
 .../test/cases/default/package.json                |   5 +
 .../test/cases/default/src/components/footer.jsx   |  15 ++
 .../test/cases/default/src/pages/index.md          |   3 +
 .../test/cases/default/src/templates/app.html      |  12 ++
 .../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.jsx  |  17 ++
 .../cases/exp-build.prerender/src/pages/index.md   |   3 +
 .../exp-build.prerender/src/templates/app.html     |  12 ++
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 .../{build.default => serve.default}/artists.json  |   0
 .../greenwood.config.js                            |   0
 .../{build.default => serve.default}/package.json  |   0
 .../serve.default.spec.js}                         |   5 +-
 .../src/components/footer.js                       |   0
 .../src/components/greeting.js                     |   0
 .../src/pages/artists.js                           |   4 +-
 .../src/pages/users.js                             |   0
 .../src/templates/app.html                         |   0
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 yarn.lock                                          |  33 +++-
 70 files changed, 1247 insertions(+), 314 deletions(-)
greenwood - v0.28.0-alpha.4

Published by thescientist13 over 1 year ago

Overview

This alpha release restores original rollup bundling logic and introduces support for <audio> and <video> formats.

In development docs here, full release blog will come out with the final release.

To adopt alpha releases, you can do the following

# yarn 1.x
$ yarn upgrade @greenwood/cli@alpha

# npm
$ npm install @greenwood/cli@alpha

Changelog

https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.28.0+label%3Aalpha.4

  1. Support web standard <audio> and <video> formats
  2. restore rollup local workspace resolution

Breaking Changes

ESM

To be compliant with the ESM spec, all your files referenced within JavaScript must start with a .. Using a / is not part of the spec.

<script>
  // before
  import { foo } from '/some/thing.js';

  // after
  import { foo } from '../some/thing.js';
</script>

Known Issues

  1. dev proxy matches returning HTML for local dev server

Diff

$ git diff v0.28.0-alpha.3 v0.28.0-alpha.4 --stat | grep -v "www"
 .gitattributes                                     |  13 ++-
 .github/workflows/ci-exp.yml                       |   2 +-
 .github/workflows/ci-win-exp.yml                   |   2 +-
 .github/workflows/ci-win.yml                       |   2 +-
 .github/workflows/ci.yml                           |   2 +-
 .github/workflows/master.yml                       |   2 +-
 .github/workflows/release.yml                      |   2 +-
 .gitignore                                         |   1 +
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   5 +-
 packages/cli/src/config/rollup.config.js           |   9 +-
 packages/cli/src/lifecycles/copy.js                |  24 ++---
 packages/cli/src/lifecycles/serve.js               |  27 +++++-
 .../src/plugins/resource/plugin-standard-audio.js  |  76 +++++++++++++++
 .../src/plugins/resource/plugin-standard-video.js  |  78 +++++++++++++++
 .../cases/develop.default/develop.default.spec.js  | 106 +++++++++++++++++----
 .../develop.default/src/assets/song-sample.mp3     | Bin 0 -> 5709921 bytes
 .../develop.default/src/assets/splash-clip.mp4     | Bin 0 -> 2636174 bytes
 .../test/cases/serve.default/serve.default.spec.js |  98 ++++++++++++++++++-
 .../cases/serve.default/src/assets/song-sample.mp3 | Bin 0 -> 5709921 bytes
 .../cases/serve.default/src/assets/splash-clip.mp4 | Bin 0 -> 2636174 bytes
 packages/init/package.json                         |   5 +-
 packages/plugin-babel/package.json                 |   7 +-
 packages/plugin-google-analytics/package.json      |   7 +-
 packages/plugin-graphql/README.md                  |   2 +-
 packages/plugin-graphql/package.json               |   7 +-
 .../cases/query-custom-schema/src/pages/index.html |   2 +-
 packages/plugin-import-commonjs/package.json       |   7 +-
 packages/plugin-import-css/package.json            |   7 +-
 packages/plugin-import-json/package.json           |   7 +-
 packages/plugin-include-html/package.json          |   7 +-
 packages/plugin-polyfills/package.json             |   7 +-
 packages/plugin-postcss/package.json               |   7 +-
 packages/plugin-renderer-lit/package.json          |   7 +-
 packages/plugin-renderer-puppeteer/package.json    |   7 +-
 packages/plugin-typescript/package.json            |   7 +-
 38 files changed, 447 insertions(+), 101 deletions(-)
greenwood - v0.27.5

Published by thescientist13 over 1 year ago

Overview

This patch release fixes an issue with the GraphQL plugin wherein the <script> tag for Apollo data was not correctly nested inside the <head> tag.

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.5

  1. GraphQL plugin data <script> tag is being inserted before the opening <head> tag - thanks @Yasir761 🚀

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.27.3 v0.27.4 --stat | grep -v "www"
 lerna.json                                                            | 2 +-
 packages/cli/package.json                                             | 2 +-
 packages/init/package.json                                            | 2 +-
 packages/plugin-babel/package.json                                    | 4 ++--
 packages/plugin-google-analytics/package.json                         | 4 ++--
 packages/plugin-graphql/package.json                                  | 4 ++--
 packages/plugin-graphql/src/index.js                                  | 2 +-
 .../plugin-graphql/test/cases/query-children/query-children.spec.js   | 2 +-
 packages/plugin-graphql/test/cases/query-config/query-config.spec.js  | 2 +-
 .../cases/query-custom-frontmatter/query-custom-frontmatter.spec.js   | 2 +-
 .../test/cases/query-custom-schema/query-custom-schema.spec.js        | 2 +-
 packages/plugin-graphql/test/cases/query-graph/query-graph.spec.js    | 2 +-
 packages/plugin-graphql/test/cases/query-menu/query-menu.spec.js      | 2 +-
 packages/plugin-import-commonjs/package.json                          | 4 ++--
 packages/plugin-import-css/package.json                               | 4 ++--
 packages/plugin-import-json/package.json                              | 4 ++--
 packages/plugin-include-html/package.json                             | 4 ++--
 packages/plugin-polyfills/package.json                                | 4 ++--
 packages/plugin-postcss/package.json                                  | 4 ++--
 packages/plugin-renderer-lit/package.json                             | 4 ++--
 packages/plugin-renderer-puppeteer/package.json                       | 4 ++--
 packages/plugin-typescript/package.json                               | 4 ++--
 23 files changed, 35 insertions(+), 35 deletions(-)
greenwood - v0.28.0-alpha.3

Published by thescientist13 over 1 year ago

Overview

This alpha release for the v0.28.0 line aims to fix a regression with serving prerendered or statically exported SSR content.

In development docs here, full release blog will come out with the final release.

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.28.0+label%3Aalpha.3

  1. serve command not serving prerendered SSR or static export content

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.28.0-alpha.2 v0.28.0-alpha.3 --stat | grep -v "www"
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   2 +-
 packages/cli/src/commands/serve.js                 |   4 +-
 packages/cli/src/lifecycles/serve.js               |   6 +-
 .../build.default.ssr-prerender.spec.js            |   4 +-
 .../build.default.ssr-static-export.spec.js        |  21 +-
 .../greenwood.config.js                            |   3 +
 .../serve.default.ssr-prerender.spec.js            | 118 ++++++++++
 .../src/components/footer.js                       |  16 ++
 .../serve.default.ssr-prerender/src/pages/index.js |   7 +
 .../src/templates/app.html                         |  13 ++
 .../serve.default.ssr-static-export/package.json   |   6 +
 .../serve.default.ssr-static-export.spec.js        | 246 +++++++++++++++++++++
 .../src/components/counter.js                      |   0
 .../src/components/footer.js                       |  49 ++++
 .../src/pages/artists.js                           |  90 ++++++++
 .../src/pages/index.md                             |   3 +
 .../src/templates/app.html                         |  13 ++
 .../greenwood.config.js                            |   0
 .../serve.default.ssr.spec.js}                     |   8 +-
 .../src/components/card.js                         |   0
 .../serve.default.ssr/src/components/counter.js    |  42 ++++
 .../src/pages/about.md                             |   0
 .../src/pages/artists.js                           |   0
 .../src/pages/index.js                             |   0
 .../src/pages/users.js                             |   0
 .../src/templates/app.html                         |   0
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 41 files changed, 659 insertions(+), 46 deletions(-)
greenwood - v0.27.4

Published by thescientist13 over 1 year ago

Overview

This patch release fixes an issue with staticRouter configuration to make it more cross-browser compatible after a recent change in behavior from a Chrome update.

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.4

  1. static router not working on Chrome / Edge browsers (anymore)
  2. make router standards compliant with consistent cross browser support

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.27.3 v0.27.4 --stat | grep -v "www"
 greenwood.config.js                             |   1 -
 lerna.json                                      |   2 +-
 packages/cli/package.json                       |   2 +-
 packages/cli/src/lib/router.js                  |  13 +++----
 packages/init/package.json                      |   2 +-
 packages/plugin-babel/package.json              |   4 +--
 packages/plugin-google-analytics/package.json   |   4 +--
 packages/plugin-graphql/package.json            |   4 +--
 packages/plugin-import-commonjs/package.json    |   4 +--
 packages/plugin-import-css/package.json         |   4 +--
 packages/plugin-import-json/package.json        |   4 +--
 packages/plugin-include-html/package.json       |   4 +--
 packages/plugin-polyfills/package.json          |   4 +--
 packages/plugin-postcss/package.json            |   4 +--
 packages/plugin-renderer-lit/package.json       |   4 +--
 packages/plugin-renderer-puppeteer/package.json |   4 +--
 packages/plugin-typescript/package.json         |   4 +--
 test/smoke-test.js                              |   2 +-
 23 files changed, 36 insertions(+), 84 deletions(-)
greenwood - v0.28.0-alpha.2

Published by thescientist13 over 1 year ago

Overview

This alpha release for the v0.28.0 line aims to fix some bugs identified with the previous release as well as including some refactoring and enhancements.

In development docs here, full release blog will come out with the final release.

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.28.0+label%3Aalpha.2

  1. API calls are getting treated as API routes with the serve command
  2. SPA fallback handling not working
  3. correctly name standard resource plugins
  4. remove setMaxListeners suppression call

Breaking Changes

N / A

Known Issues

  1. serve command not serving prerendered SSR content

Diff

git diff v0.28.0-alpha.1 v0.28.0-alpha.2 --stat | grep -v "www"
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   2 +-
 packages/cli/src/commands/serve.js                 |   3 +-
 packages/cli/src/index.js                          |   4 -
 packages/cli/src/lib/resource-utils.js             |   2 +-
 packages/cli/src/lifecycles/serve.js               |  21 ++-
 .../src/plugins/resource/plugin-standard-font.js   |   2 +-
 .../src/plugins/resource/plugin-standard-html.js   |   3 +-
 .../src/plugins/resource/plugin-standard-image.js  |   8 +-
 .../src/plugins/resource/plugin-standard-json.js   |   2 +-
 .../cli/test/cases/develop.spa/develop.spa.spec.js |  40 ++++-
 packages/cli/test/cases/develop.spa/src/main.css   |   3 +
 .../test/cases/serve.default/serve.default.spec.js |  35 ++++
 .../cli/test/cases/serve.spa/serve.spa.spec.js     | 192 +++++++++++++++++++++
 packages/cli/test/cases/serve.spa/src/index.html   |  12 ++
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 29 files changed, 333 insertions(+), 50 deletions(-)
greenwood - v0.28.0-alpha.1

Published by thescientist13 over 1 year ago

Overview

This alpha release for the v0.28.0 line introduces a big refactor throughout Greenwood to adopt more Web APIs where possible, like URL / Request / Response.

In development docs here, full release blog will come out with the final release.

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.28.0+label%3Aalpha.1

  1. Standardize on Web APIs (Request / Response / URL / etc)
  2. Standardize mapping of browser URLs to file paths (for Resource plugins)

Breaking Changes

There are a few breaking changes in this release due to the adoption of more web standard APIs.

greenwood.config.js

Workspace

You can now pass in a URL object directly instead of having to convert it to a path

import { fileURLToPath } from 'url';

// before
export default {
  workspace: fileURLToPath(new URL('./www', import.meta.url))
};
// after
export default {
  workspace: new URL('./www', import.meta.url)
};

devServer.extensions

No period (.) is needed when passing in custom extensions.

// before
extensions: ['.txt', '.rtf']
// after
extensions: ['txt', 'rtf']

Plugins

Resource

Resource plugins have had their lifecycle signatures and return types refactored to align exclusively with Web APIs. The docs have been updated with more in depth examples so it is recommended to review those, but otherwise the business logic of those lifecycles should still apply. Below is a high level breakdown of the changes and an example.

shouldResolve / resolve

  • Function signature now provides an instance of URL instead of just a string path
  • Expects a Request to be returned
// before
async shouldResolve(url = '/') {
  const { userWorkspace } = this.compilation.context;

  return fs.existsSync(path.join(userWorkspace, url));
}

async resolve(url = '/') {
  const { userWorkspace } = this.compilation.context;

  return path.join(userWorkspace, bareUrl));
}
// after
async shouldResolve(url) {
  const { userWorkspace } = this.compilation.context;
  const { pathname } = url;
 
  try {
    await fs.access(new URL(`.${pathname}`, userWorkspace);
    return true;
  } catch(}{
    return false;
  }
}

async resolve(url) {
  const { pathname } = url;
  const { userWorkspace } = this.compilation.context;

  return new Request(new URL(`.${pathname}`, userWorkspace));
}

shouldServe / serve

  • Function signature now provides an instance of URL and Request
  • Expects a Response to be returned
// before
async shouldServe(url) {
   return path.extname(url) === '.css' && fs.existsSync(url);
}

async serve(url) {
  const css = await fs.promises.readFile(url, 'utf-8');

  resolve({
    body: css,
    contentType: this.contentType
  });
}
// after
async shouldServe(url) {
  return url.protocol === 'file:' && this.extensions.indexOf(url.pathname.split('.').pop()) >= 0;
}

async serve(url) {
  const body = await fs.readFile(url, 'utf-8');

  return new Response(body, {
    headers: {
      'Content-Type': 'text/css'
    }
  });
}

shouldIntercept / intercept

  • Function signature now provides an instance of URL, Request, and Response
  • Expects a Response to be returned
// before
async shouldIntercept(url, body, headers = { request: {} }) {
  const { originalUrl = '' } = headers.request;
  const accept = headers.request.accept || '';
  const isCssFile = path.extname(url) === '.css';
  const notFromBrowser = accept.indexOf('text/css') < 0 && accept.indexOf('application/signed-exchange') < 0;

  // https://github.com/ProjectEvergreen/greenwood/issues/492
  const isCssInJs = originalUrl.indexOf('?type=css') >= 0
    || isCssFile && notFromBrowser
    || isCssFile && notFromBrowser && url.indexOf('/node_modules/') >= 0;

  return isCssInJs
}

async intercept(url, body) {
  const finalBody = body || await fs.promises.readFile(pathToFileURL(url), 'utf-8');
  const cssInJsBody = `const css = \`${finalBody.replace(/\r?\n|\r/g, ' ').replace(/\\/g, '\\\\')}\`;\nexport default css;`;
  
  return {
    body: cssInJsBody,
    contentType: this.contentType
  };
}
// after
async shouldIntercept(url, request) {
  const { pathname } = url;
  const accepts = request.headers.get('accept') || '';
  const isCssFile = pathname.split('.').pop() === 'css';
  const notFromBrowser = accepts.indexOf('text/css') < 0 && accepts.indexOf('application/signed-exchange') < 0;

  // https://github.com/ProjectEvergreen/greenwood/issues/492
  const isCssInJs = url.searchParams.has('type') && url.searchParams.get('type') === this.extensions[0]
    || isCssFile && notFromBrowser
    || isCssFile && notFromBrowser && pathname.startsWith('/node_modules/');

  return isCssInJs;
}

async intercept(url, request, response) {
  const body = await response.text();
  const cssInJsBody = `const css = \`${body.replace(/\r?\n|\r/g, ' ').replace(/\\/g, '\\\\')}\`;\nexport default css;`;
  
  return new Response(cssInJsBody, {
    headers: new Headers({
      'Content-Type': this.contentType
    })
  });
}

shouldOptimize / optimize

  • Function signature now provides an instance of URL and Response
  • Expects a Response to be returned
// before
async shouldOptimize(url) {
  return path.extname(url) === '.css' && this.compilation.config.optimization !== 'none'
}

async optimize(url, body) {
  return bundleCss(body);
}
// after
async shouldOptimize(url, response) {
  const { protocol, pathname } = url;
  const isValidCss = pathname.split('.').pop() === 'css'
    && protocol === 'file:'
    && response.headers.get('Content-Type').indexOf('text/css') >= 0;

  return this.compilation.config.optimization !== 'none' && isValidCss;
}

async optimize(url, response) {
  const body = await response.text();
  const optimizedBody = bundleCss(body);

  return new Response(optimizedBody);
}

Copy

Now the Copy plugin expects to the to and from properties to be URLs.

For directories, make sure to add a trailing /!

// before
[{
  // copy a file
  from: path.join(context.userWorkspace, 'robots.txt'),
  to: path.join(context.outputDir, 'robots.txt')
}, {
  // copy a directory
  from: path.join(context.userWorkspace, 'pdfs'),
  to: path.join(context.outputDir, 'pdfs')
}];
// after
[{
  // copy a file
  from: new URL('./robots.txt', context.userWorkspace),
  to: new URL('./robots.txt', context.outputDir)
}, {
  // copy a directory
  from: new URL('./pdfs/', context.userWorkspace),
  to: new URL('./pdfs/', context.outputDir)
}];

Context (Theme Packs)

For Context plugins, a URL is now expected for template locations.

// before
import { fileURLToPath } from 'urt';

return {
  templates: [
    fileURLToPath(new URL('./dist/layouts', import.meta.url))
  ]
};
// after
return {
  templates: [
    new URL('./dist/layouts/', import.meta.url)
  ]
};

Integrations (e.g. WTR)

For custom 3rd party tools like WTR (Web Test Runner), you can still use your resource plugins, updated for the new API. Below are a couple examples for supporting TypeScript and importing CSS-in-JS.

import fs from 'fs/promises';
import { greenwoodPluginImportCss } from '@greenwood/plugin-import-css/src/index.js';
import { greenwoodPluginTypeScript } from '@greenwood/plugin-typescript/src/index.js';

// create a direct instance of ImportCssResource
const importCssResource = greenwoodPluginImportCss()[0].provider({});

// create a direct instance of TypeScriptResource
const typeScriptResource = greenwoodPluginTypeScript()[0].provider({
  context: {
    projectDirectory: new URL(import.meta.url)
  }
});

export default {
  plugins: [{
    name: 'transpile-typescript',
    async transform(context) {
      const { url } = context.request;

      if (url.endsWith('.ts')) {
        const response = await typeScriptResource.serve(new URL(`.${url}`, import.meta.url));
        // https://github.com/ProjectEvergreen/greenwood/issues/661
        const body = (await response.text()).replace(/\/\/# sourceMappingURL=module.js.map/, '');

        return {
          body,
          type: 'js'
        };
      }
    }
  }, {
    name: 'import-css',
    async transform(context) {
      const url = new URL(`.${context.request.url}`, import.meta.url);
      const request = new Request(url, { headers: new Headers(context.headers) });
      const shouldIntercept = await importCssResource.shouldIntercept(url, request);

      if (shouldIntercept) {
        const contents = await fs.readFile(url);
        const initResponse = new Response(contents, { headers: new Headers(context.headers) });
        const response = await importCssResource.intercept(url, request, initResponse.clone());

        return {
          body: await response.text(),
          headers: {
            'Content-Type': response.headers.get('Content-Type')
          }
        };
      }
    }
  }]
};

Known Issues

  1. API calls are getting treated as API routes with the serve command
  2. SPA fallback handling not working

Diff

$ git diff v0.28.0-alpha.0 v0.28.0-alpha.1 --stat | grep -v "www"
 greenwood.config.js                                |   9 +-
 lerna.json                                         |   2 +-
 packages/cli/package.json                          |   2 +-
 packages/cli/src/commands/build.js                 |  13 +-
 packages/cli/src/commands/eject.js                 |  20 +-
 packages/cli/src/config/rollup.config.js           |  80 +--
 packages/cli/src/index.js                          |   4 +-
 packages/cli/src/lib/node-modules-utils.js         |  24 +-
 packages/cli/src/lib/resource-interface.js         |  88 ----
 packages/cli/src/lib/resource-utils.js             | 114 ++++-
 packages/cli/src/lib/ssr-route-worker.js           |   7 +-
 packages/cli/src/lifecycles/bundle.js              | 105 ++--
 packages/cli/src/lifecycles/config.js              |  73 +--
 packages/cli/src/lifecycles/context.js             |  26 +-
 packages/cli/src/lifecycles/copy.js                |  92 ++--
 packages/cli/src/lifecycles/graph.js               |  69 ++-
 packages/cli/src/lifecycles/prerender.js           | 156 +++---
 packages/cli/src/lifecycles/serve.js               | 388 +++++++-------
 packages/cli/src/loader.js                         |  86 ++--
 .../cli/src/plugins/copy/plugin-copy-assets.js     |  15 +-
 .../cli/src/plugins/copy/plugin-copy-favicon.js    |  15 +-
 .../cli/src/plugins/copy/plugin-copy-graph-json.js |   8 +-
 .../cli/src/plugins/copy/plugin-copy-robots.js     |  15 +-
 .../cli/src/plugins/resource/plugin-api-routes.js  |  35 +-
 .../cli/src/plugins/resource/plugin-dev-proxy.js   |  25 +-
 .../src/plugins/resource/plugin-node-modules.js    | 151 +++---
 .../cli/src/plugins/resource/plugin-source-maps.js |  26 +-
 .../src/plugins/resource/plugin-standard-css.js    |  52 +-
 .../src/plugins/resource/plugin-standard-font.js   |  28 +-
 .../src/plugins/resource/plugin-standard-html.js   | 559 ++++++++++-----------
 .../src/plugins/resource/plugin-standard-image.js  |  49 +-
 .../plugins/resource/plugin-standard-javascript.js |  23 +-
 .../src/plugins/resource/plugin-standard-json.js   |  40 +-
 .../src/plugins/resource/plugin-static-router.js   | 179 +++----
 .../src/plugins/resource/plugin-user-workspace.js  |  33 +-
 .../cli/src/plugins/server/plugin-livereload.js    |  47 +-
 .../greenwood.config.js                            |   4 +-
 .../build.config.error-workspace.spec.js           |   4 +-
 .../greenwood.config.js                            |   4 +-
 .../build.default.ssr/build.default.ssr.spec.js    |   2 +-
 .../theme-pack-context-plugin.js                   |  11 +-
 .../cases/build.plugins.copy/greenwood.config.js   |  13 +-
 .../build.plugins.resource/greenwood.config.js     |  27 +-
 .../cases/develop.default/develop.default.spec.js  |  37 +-
 .../test/cases/develop.default/src/api/greeting.js |   4 +-
 .../develop.plugins.context.spec.js                |   4 +-
 .../develop.plugins.context/greenwood.config.js    |  14 +-
 .../serve.default.api/serve.default.api.spec.js    |   2 +-
 .../cases/serve.default.api/src/api/greeting.js    |   4 +-
 .../test/cases/serve.default/serve.default.spec.js |   2 +-
 .../cli/test/cases/theme-pack/greenwood.config.js  |  13 +-
 .../cli/test/cases/theme-pack/my-theme-pack.js     |  10 +-
 .../test/cases/theme-pack/theme-pack.build.spec.js |  10 +-
 .../cases/theme-pack/theme-pack.develop.spec.js    |   4 +-
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-babel/src/index.js                 |  38 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-google-analytics/src/index.js      |  55 +-
 .../test/cases/default/default.spec.js             |  24 +-
 .../option-anonymous/option-anonymous.spec.js      |   4 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-graphql/src/core/cache.js          |  13 +-
 packages/plugin-graphql/src/index.js               |  77 ++-
 packages/plugin-graphql/src/schema/schema.js       |  15 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 .../cases/qraphql-server/graphql-server.spec.js    |   2 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-commonjs/src/index.js       |  35 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-css/src/index.js            |  54 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-import-json/src/index.js           |  38 +-
 .../cases/develop.default/develop.default.spec.js  |   4 +-
 .../test/cases/develop.default/src/main.json       |   5 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-include-html/src/index.js          |  72 ++-
 .../src/components/footer.js                       |   8 +-
 .../build.default.link-tag.spec.js                 |   2 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-polyfills/src/index.js             | 104 ++--
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-postcss/src/index.js               |  52 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 .../src/ssr-route-worker-lit.js                    |   6 +-
 .../test/cases/build.default/src/pages/artists.js  |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 .../src/plugins/resource.js                        |  17 +-
 packages/plugin-typescript/package.json            |   4 +-
 packages/plugin-typescript/src/index.js            |  40 +-
 .../cases/develop.default/develop.default.spec.js  |   2 +-
 test/smoke-test.js                                 |   2 +-
 test/test-loader.js                                |  10 +-
 104 files changed, 1847 insertions(+), 2056 deletions(-)```
greenwood - v0.27.3

Published by thescientist13 almost 2 years ago

Overview

This patch release fixes an implementation error with Greenwood's experimental loader for supporting custom imports.

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.3

  1. invalid URL when using SSR custom imports

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.27.2 v0.27.3 --stat | grep -v "www"
 .github/ISSUE_TEMPLATE.md                       |   6 +-
 lerna.json                                      |   2 +-
 packages/cli/package.json                       |   2 +-
 packages/cli/src/loader.js                      |   4 +-
 packages/init/package.json                      |   2 +-
 packages/plugin-babel/package.json              |   4 +-
 packages/plugin-google-analytics/package.json   |   4 +-
 packages/plugin-graphql/package.json            |   4 +-
 packages/plugin-import-commonjs/package.json    |   4 +-
 packages/plugin-import-css/package.json         |   4 +-
 packages/plugin-import-json/package.json        |   4 +-
 packages/plugin-include-html/package.json       |   4 +-
 packages/plugin-polyfills/package.json          |   4 +-
 packages/plugin-postcss/package.json            |   4 +-
 packages/plugin-renderer-lit/package.json       |   4 +-
 packages/plugin-renderer-puppeteer/package.json |   4 +-
 packages/plugin-typescript/package.json         |   4 +-
 test/test-loader.js                             |  12 +-
 yarn.lock                                       | 509 ++++++++++++------------
 21 files changed, 313 insertions(+), 283 deletions(-)
greenwood - v0.28.0-alpha.0

Published by thescientist13 almost 2 years ago

Overview

This initial release for v0.28.0 sets Node v18 as the new minimum version and also introduces API routes.

In development docs here, full release blog will come out with the final release.

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.28.0+label%3Aalpha.0

  1. upgrade to Node v18 as minimum supported version
  2. API Routes

Breaking Changes

Node 18

The new minimum supported Node version with Greenwood is now v18. So make sure you update your GitHub Actions, hosting configuration; e.g. _netlify.toml, .nvmrc, etc.

Additionally, Greenwood now longer depends on node-fetch however native fetch in Node 18 can / should be a drop in replacement for most cases. Just remove your import line for node-fetch and test, and if so, you should be good to go! (You can always self install node-fetch if you want it back though).

Known Issues

N / A

Diff

$ git diff v0.27.2 v0.28.0-alpha.0 --stat | grep -v "www"
 .github/ISSUE_TEMPLATE.md                          |   6 +-
 .github/workflows/ci-exp.yml                       |   4 +-
 .github/workflows/ci-win-exp.yml                   |   2 +-
 .github/workflows/ci-win.yml                       |   2 +-
 .github/workflows/ci.yml                           |   4 +-
 .github/workflows/master.yml                       |   4 +-
 .github/workflows/release.yml                      |   4 +-
 .nvmrc                                             |   2 +-
 lerna.json                                         |   2 +-
 netlify.toml                                       |   2 +-
 package.json                                       |   2 +-
 packages/cli/package.json                          |   5 +-
 packages/cli/src/commands/serve.js                 |   3 +-
 packages/cli/src/lifecycles/context.js             |   2 +
 packages/cli/src/lifecycles/serve.js               |  16 +
 packages/cli/src/loader.js                         |   6 +-
 .../cli/src/plugins/resource/plugin-api-routes.js  |  53 +++
 .../cli/src/plugins/resource/plugin-dev-proxy.js   |   1 -
 .../src/pages/artists.js                           |   2 -
 .../cases/build.default.ssr/src/pages/artists.js   |   2 -
 .../cases/build.default.ssr/src/pages/users.js     |   1 -
 .../cases/develop.default/develop.default.spec.js  |  29 ++
 .../test/cases/develop.default/src/api/greeting.js |  11 +
 .../test/cases/develop.ssr/src/pages/artists.js    |   2 -
 .../serve.default.api/serve.default.api.spec.js    | 137 ++++++
 .../cases/serve.default.api/src/api/fragment.js    |  18 +
 .../cases/serve.default.api/src/api/greeting.js    |  11 +
 .../cases/serve.default.api/src/components/card.js |  11 +
 packages/init/package.json                         |   3 +-
 packages/init/src/index.js                         |   1 -
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/package.json               |   7 +-
 packages/plugin-graphql/src/core/cache.js          |   1 -
 packages/plugin-import-commonjs/package.json       |   4 +-
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/package.json           |   4 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/package.json            |   4 +-
 yarn.lock                                          | 511 +++++++++++----------
 50 files changed, 684 insertions(+), 318 deletions(-)
greenwood - v0.27.2

Published by thescientist13 almost 2 years ago

Overview

This patch release addresses critical bugs with CSS minification identified as part of the initial v0.27.0 release and resolving an issue with staticRouter (now marked as experimental in the docs) not deep linking to hash routes correctly. There was also a a technical enhancement upgrading a Rollup plugin dependency.

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.2

  1. CSS functions in declarations not getting padded with a space
  2. deeply nested direct hash link breaks the router if pathname not already present
  3. upgrade to official Rollup terser plugin

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.27.1 v0.27.2 --stat | grep -v "www"
.eslintrc.cjs                                      |   1 +
 lerna.json                                         |   2 +-
 package.json                                       |   3 +-
 packages/cli/package.json                          |   4 +-
 packages/cli/src/config/rollup.config.js           |   4 +-
 packages/cli/src/lib/router.js                     |  30 +++--
 .../src/plugins/resource/plugin-standard-css.js    |  12 +-
 .../plugins/resource/plugin-standard-javascript.js |   2 +-
 .../fixtures/expected.css                          |   2 +-
 .../src/styles/main.css                            |   2 +
 .../build.config-optimization-inline.spec.js       |   4 +-
 packages/init/package.json                         |   2 +-
 packages/plugin-babel/README.md                    |   4 +-
 packages/plugin-babel/package.json                 |   4 +-
 packages/plugin-google-analytics/README.md         |   1 +
 packages/plugin-google-analytics/package.json      |   4 +-
 packages/plugin-graphql/README.md                  |   8 +-
 packages/plugin-graphql/package.json               |   4 +-
 packages/plugin-import-commonjs/package.json       |   4 +-
 .../test/cases/default/default.spec.js             |   2 +-
 packages/plugin-import-css/README.md               |  17 +--
 packages/plugin-import-css/package.json            |   4 +-
 packages/plugin-import-json/README.md              |  11 +-
 packages/plugin-import-json/package.json           |   4 +-
 .../test/cases/default/default.spec.js             |   2 +-
 packages/plugin-include-html/package.json          |   4 +-
 packages/plugin-polyfills/package.json             |   4 +-
 packages/plugin-postcss/README.md                  |   4 +-
 packages/plugin-postcss/package.json               |   4 +-
 packages/plugin-renderer-lit/package.json          |   4 +-
 packages/plugin-renderer-puppeteer/package.json    |   4 +-
 packages/plugin-typescript/README.md               |   8 +-
 packages/plugin-typescript/package.json            |   4 +-
 .../test/cases/default/default.spec.js             |   2 +-
 yarn.lock                                          | 132 ++++++++++++++-------
 54 files changed, 310 insertions(+), 226 deletions(-)
greenwood - v0.27.1

Published by thescientist13 almost 2 years ago

Overview

This patch release addresses some bugs identified as part of the last release.

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.1

  1. CSS minification not handling / relative paths to node_modules
  2. <style> tags in the <body> are not getting optimized
  3. nested directories breaking copy plugin

Breaking Changes

N / A

Known Issues

N / A

Diff

$ git diff v0.27.0 v0.27.1 --stat | grep -v "www"
 lerna.json                                         |  2 +-
 packages/cli/package.json                          |  2 +-
 packages/cli/src/lifecycles/copy.js                | 10 ++--
 packages/cli/src/lifecycles/prerender.js           |  2 +-
 .../src/plugins/resource/plugin-standard-css.js    | 13 ++--
 .../build.config-optimization-default.spec.js      | 28 ++++++++-
 .../src/pages/index.html                           | 11 +++-
 .../build.default.workspace-javascript-css.spec.js |  6 +-
 .../build.plugins.copy/build.plugins.copy.spec.js  | 70 ++++++++++++++++++++++
 .../cases/build.plugins.copy/greenwood.config.js   | 19 ++++++
 packages/init/package.json                         |  2 +-
 packages/plugin-babel/package.json                 |  4 +-
 packages/plugin-google-analytics/package.json      |  4 +-
 packages/plugin-graphql/package.json               |  4 +-
 packages/plugin-import-commonjs/package.json       |  4 +-
 packages/plugin-import-css/package.json            |  4 +-
 packages/plugin-import-json/package.json           |  4 +-
 packages/plugin-include-html/package.json          |  4 +-
 packages/plugin-polyfills/package.json             |  4 +-
 packages/plugin-postcss/package.json               |  4 +-
 packages/plugin-renderer-lit/package.json          |  4 +-
 packages/plugin-renderer-puppeteer/package.json    |  4 +-
 packages/plugin-typescript/package.json            |  4 +-
 26 files changed, 173 insertions(+), 46 deletions(-)
greenwood - v0.27.0

Published by thescientist13 almost 2 years ago

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. refactor bundling lifecycle and resource optimizations
  2. avoid Rollup double bundling for pre-bundled static assets for server routes
  3. ensure inline <script> and <style> tags are getting minified / optimized when running build command
  4. fix incorrect HUD noopener implementation
  5. auto spread arrays of plugins
  6. remove hardcoded directory references in rollup configuration
  7. introduce worker thread pools for SSR page generation
  8. upgrade to WCC 0.6.x
  9. update rollup preserveEntrySignatures to neutral setting to silence warning output
  10. 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(-)
greenwood - v0.27.0-alpha.7

Published by thescientist13 almost 2 years ago

Overview

This version introduces the ability to leverage Greenwood's import plugins for CSS and JSON on the server side so that they can be used with ESM / import. Assuming all goes well, this will be the last alpha release prior to making v0.27.0 generally available. See the last release notes for prior breaking changes.

In development docs here, full release blog will come out with the final release.

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+label%3Aalpha.7

  1. support resource plugin based transformations for standard module formats (ex: import JSON, CSS) for SSR

Breaking Changes

None

Known Issues

N / A

Diff

$ git diff v0.27.0-alpha.6 v0.27.0-alpha.7 --stat | grep -v "www"
 .github/workflows/ci-exp.yml                       | 28 +++++++
 .github/workflows/ci-win-exp.yml                   | 25 ++++++
 .mocharc.cjs                                       |  5 +-
 .nvmrc                                             |  2 +-
 lerna.json                                         |  2 +-
 package.json                                       |  6 +-
 packages/cli/package.json                          |  2 +-
 packages/cli/src/config/rollup.config.js           |  3 +-
 packages/cli/src/lifecycles/graph.js               |  2 +-
 packages/cli/src/loader.js                         | 68 +++++++++++++++++
 packages/init/package.json                         |  2 +-
 packages/plugin-babel/package.json                 |  4 +-
 packages/plugin-google-analytics/package.json      |  4 +-
 packages/plugin-graphql/package.json               |  4 +-
 packages/plugin-import-commonjs/package.json       |  4 +-
 packages/plugin-import-css/README.md               | 51 ++++++-------
 packages/plugin-import-css/package.json            |  4 +-
 packages/plugin-import-css/src/index.js            |  5 +-
 .../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              | 23 +++---
 packages/plugin-import-json/package.json           |  4 +-
 packages/plugin-import-json/src/index.js           | 10 ++-
 .../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/package.json          |  4 +-
 packages/plugin-polyfills/package.json             |  4 +-
 packages/plugin-postcss/package.json               |  4 +-
 packages/plugin-renderer-lit/package.json          |  4 +-
 packages/plugin-renderer-puppeteer/package.json    |  4 +-
 packages/plugin-typescript/package.json            |  4 +-
 test/test-loader.js                                | 35 +++++++++
 yarn.lock                                          |  8 +-
 44 files changed, 547 insertions(+), 81 deletions(-)
greenwood - v0.27.0-alpha.6

Published by thescientist13 almost 2 years ago

Overview

Restored a reverted a commit around preserving expectations around default configuration for the PostCSS plugin. See the last release notes for prior breaking changes.

In development docs here, full release blog will come out with the final release.

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+label%3Aalpha.6

  1. Revert "Revert "Enhancement/issue 763 restore postcss import""

Breaking Changes

None

Known Issues

N / A

Diff

$ git diff v0.27.0-alpha.5 v0.27.0-alpha.6 --stat | grep -v "www"
 lerna.json                                         |  2 +-
 packages/cli/package.json                          |  2 +-
 packages/init/package.json                         |  2 +-
 packages/plugin-babel/package.json                 |  4 +--
 packages/plugin-google-analytics/package.json      |  4 +--
 packages/plugin-graphql/package.json               |  4 +--
 packages/plugin-import-commonjs/package.json       |  4 +--
 packages/plugin-import-css/package.json            |  4 +--
 packages/plugin-import-json/package.json           |  4 +--
 packages/plugin-include-html/package.json          |  4 +--
 packages/plugin-polyfills/package.json             |  4 +--
 packages/plugin-postcss/README.md                  |  1 +
 packages/plugin-postcss/package.json               |  5 +--
 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 +--
 packages/plugin-renderer-puppeteer/package.json    |  4 +--
 packages/plugin-typescript/package.json            |  4 +--
 yarn.lock                                          | 37 ++++++++++++++++++++++
 22 files changed, 74 insertions(+), 29 deletions(-)
greenwood - v0.27.0-alpha.5

Published by thescientist13 almost 2 years ago

Overview

Inadvertently reverted a commit that removed intended functionality around intended default configuration for the PostCSS plugin. Next release will restore it. See the last release notes for prior breaking changes.

In development docs here, full release blog will come out with the final release.

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+label%3Aalpha.5

  1. Revert "Enhancement/issue 763 restore postcss import"

Breaking Changes

None

Known Issues

  1. Need to restore removal of postcss-import to default PostCSS configuration

Diff

$ git diff v0.27.0-alpha.4 v0.27.0-alpha.5 --stat | grep -v "www"
 lerna.json                                         |  2 +-
 packages/cli/package.json                          |  2 +-
 packages/init/package.json                         |  2 +-
 packages/plugin-babel/package.json                 |  4 +--
 packages/plugin-google-analytics/package.json      |  4 +--
 packages/plugin-graphql/package.json               |  4 +--
 packages/plugin-import-commonjs/package.json       |  4 +--
 packages/plugin-import-css/package.json            |  4 +--
 packages/plugin-import-json/package.json           |  4 +--
 packages/plugin-include-html/package.json          |  4 +--
 packages/plugin-polyfills/package.json             |  4 +--
 packages/plugin-postcss/README.md                  |  1 -
 packages/plugin-postcss/package.json               |  5 ++-
 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 +--
 packages/plugin-renderer-puppeteer/package.json    |  4 +--
 packages/plugin-typescript/package.json            |  4 +--
 yarn.lock                                          | 37 ----------------------
 22 files changed, 29 insertions(+), 74 deletions(-)
Package Rankings
Top 4.55% on Npmjs.org
Top 8.17% on Proxy.golang.org
Badges
Extracted from project README
Netlify Status GitHub release GitHub issues GitHub license lerna