feat: mark custom layers as externals
#225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this pull request solving?
The key for making custom layers (added in #198) work is to make the ESZIP load treat them as
external
specifiers. This has been done in #201, and allows any specifier, likelayer:something
, to work.But using this type of specifier comes with the challenge of always requiring an import map for the code to even run, so we'd need to inject these custom specifiers into the import maps used for local development and for the in-source configuration extraction.
Alternatively, we could use valid URLs for layers (e.g. https://some-url.netlify.app/mod.ts) and still have the ESZIP load mark them as
external
, so that they're not included in the bundle and get stitched together at runtime. In other contexts, like local development or ISC, the URL will work as normal, with no additional work required.This PR introduces an
externals
property, which is a list of specifiers that the ESZIP loader should set asexternal
. When bundling, we'll read the internal configuration file and set every layer name as external.