-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates
prerender_component()
to accept *.js
prerender sources an…
…d a `js_library()` as a `scripts` dependency. Refs #39. This chooses to generate either a `ts_library()` or `js_library()` based on the sources provided to `prerender_component()`. Whatever is given is re-exported via `_js_reexport()` which propagates both `JSModuleInfo` and `JSEcmaScriptModuleInfo`. It sounds like we could use a `ts_library()` or `js_library()` re-export. However, we need to re-export *only* the `scripts` parameter but we must also depend upon component deps' scripts. So we need to re-export some targets as direct sources and other targets as transitive sources, which doesn't appear to be supported by either rule. As a reuslt, `_js_reexport()` is needed to fill this specific niche. This required an awkward change to support Rollup. `rollup_bundle()` *requires* a label-reference to its entry point. It explicitly rejects a target that returns multiple files. We also need to use ES6 sources (`JSEcmaScriptModuleInfo` so ensure we don't accidentally use UMD sources in Rollup. Unfortunately, `JSEcmaScriptModuleInfo` actually provides two generated files for any one source file from `ts_library()` (a `foo.mjs` file and another `foo.externs.js` file). This means that Rollup *cannot* have an entry point dependency on a `ts_library()` target, because it will always generate two ES6 source files. Normally, you would get around this by having a direct reference to the `:foo.ts` file, which Rollup has special code to translate to the actual generated `foo.mjs` file. To work around this I had to update the generated `.ts` entrypoint to a `.js` entry point, and actually export the file itself beyond the `js_library()` it is included in. That way `rollup_bundle()` can have a label reference to the `.js` entry point without going through a `js_library()` or `ts_library()` indirection that would confuse it.
- Loading branch information
Showing
6 changed files
with
129 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters