Add support for Import Attributes for JSON / CSS inside the CLI and added test cases
Had to add a preIntercept lifecycle hook for Resource plugins (for PostCSS to run prior to Greenwood transforming the CSS. Also updated Babel plugin to use it)
Created a "raw" plugin to support legacy import behaviors
Rename custom loaders naming convention from exp-* -> loaders-* and updated GitHub actions and the like accordingly
TL;DR
Without any plugins, you will be able to do this in Greenwood automatically
import sheet from './some.css' with { type: 'css' }; // you will get back a Constructable Stylesheet
import data from './some.json' with { type: 'json' }; // you will get back a JSON object
Related Issue
resolves #923
Summary of Changes
preIntercept
lifecycle hook for Resource plugins (for PostCSS to run prior to Greenwood transforming the CSS. Also updated Babel plugin to use it)18.20.0
exp-*
->loaders-*
and updated GitHub actions and the like accordinglyTL;DR
Without any plugins, you will be able to do this in Greenwood automatically
TODO
fetch
/ ESM requesttype=???
- query params are bad for node / URLsfetch-sec-dest
header is supported in all browsers now! - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-DestContent-Type
to return for an import attribute? - https://github.com/ProjectEvergreen/greenwood/discussions/1216initial implementationpackage.json / READMEtest cases (+matchers)resolve / rewrite refactor and remove patch for eve-container.cssimport css from './eve-button.css';
21.x
) - - https://github.com/ProjectEvergreen/greenwood/issues/1202type !== 'json'
check for greenwood-meta-import-url pluginacornInjectPlugins
for API routes and SSR pages rollup configs?type=xxx
)SSR Custom Importsdocument / track native import assertions with NodeJS and Rollup1218
1216
Add raw plugin to plugins listpreIntercept
lifecycle for resource pluginsQuestions / Follow Up Tasks
shouldIntercept
->shouldTransform
/shouldProcess
?CSSStylesheet
? - https://github.com/ProjectEvergreen/greenwood/discussions/1216Sec-Fetch-Dest
where applicable - https://github.com/ProjectEvergreen/greenwood/issues/1222shouldIntercept
, etc (good first issue)