Plugin / Adapter Architecture #90
thescientist13
started this conversation in
Ideas
Replies: 1 comment
-
Would also be beneficial so as to keep transformation specific logic outside of core. For example, even with JSX, we have to use function registerDependencies(moduleURL, definitions, depth = 0) {
const moduleContents = fs.readFileSync(moduleURL, 'utf-8');
const nextDepth = depth += 1;
const customParser = getParser(moduleURL);
const parser = customParser ? customParser.parser : acorn;
const config = customParser ? customParser.config : {
...walk.base
};
walk.simple(acorn.parse(moduleContents, {
ecmaVersion: 'latest',
sourceType: 'module'
}), {
...
}, {
...walk.base
});
} So if this file ends in .jsx then, it has to manually get turned into JSX. TL;DR Custom loaders only help with transforming via ESM / |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
As part of introducing #69, it got me thinking about how WCC could be tapped into to help others deliver or augment the AST generation done by WCC. WCC could help facilitate getting to the output state, allowing anyone to build a custom transform on top of it.
Benefits
The overall benefit that come to mind would be:
Potential Use Cases
Custom Specification
Custom walker for any implementation you want, like for a SFC (Single File Component)
JSX Transformation
Custom walker for transforming JSX before WCC renders it down.
Beta Was this translation helpful? Give feedback.
All reactions