Skip to content

Conversation

@julian-londono
Copy link
Contributor

So far added an initial set of thoughts regarding this API. Will delve more concretely into the actual pre-processors loader set up/syntax after this set of initial thoughts for resourceProviders, preProcessors, and postProcessors

@julian-londono julian-londono changed the title Define preProcessors API WIP: Define preProcessors API Jun 22, 2020
@julian-londono
Copy link
Contributor Author

Update: Working on defining what a preProcessor loader itself will look like and behave like this afternoon

@julian-londono
Copy link
Contributor Author

Please note I've added some initial thoughts on what a preprocessor could look like as well as a tweak to the API.md design doc

@julian-londono julian-londono changed the title WIP: Define preProcessors API RC: Define preProcessors API Jun 24, 2020
@hybrist hybrist changed the title RC: Define preProcessors API RFC: Define preProcessors API Jun 24, 2020
@julian-londono
Copy link
Contributor Author

To anyone here to review/comment, thank you. The crux of the idea is here: Implementation of Loader Workflow for On-the-Fly Running (api/EXPLORATION.md).

You can find the main loader here: src/loader.mjs

The API for preProcessors (converting from one format to some form of JS) is here: api/API.md

Finally, a I have 2 working loaders so far:

  • a preProcessor that converts from YAML to JSON
  • a postProcessor that adds appends a simple console.log("blah") to the end of any module

To run this prototype:
node --experimental-top-level-await --experimental-loader ./src/loader.mjs ./examples/loaders/test.mjs

@julian-londono
Copy link
Contributor Author

Acknowledging the further conversation that has to happen regarding esm: Modify getFormat and getSource loader hooks #34144, I've decided to have preProcessors wrap their output in modules with default exports. I've included an example on how this could work with the current YAML loader.

@julian-londono julian-londono merged commit fcc0e20 into master Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants