-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compartment-mapper): Thread commonjs- and module- languageForExt…
…ension options (for TS) (#2625) Refs: #2415 ## Description Toward support for type-erasure style TypeScript support in Endo, `.ts` files may correspond to `.mts` or `.cts` behavior in the same way that `.js` can correspond to either `.mjs` or `.cjs`, depending on `"type":` in the enveloping `package.json` (which is not necessarily the enveloping package, e.g., `src/package.json` beneath `package.json`!). We already implement this machinery for JavaScript, so this change threads additional options beside `languageForExtension` (which would map `.mts` and `.cts` to language behaviors) but also `commonjsLanguageForExtension` and `moduleLanguageForExtension`, which would get folded into the language-for-extension mapping on a package-by-package basis. ### Security Considerations None. Absent from this design is any possibility that a file would be alternately implemented as TypeScript or JavaScript. ### Scaling Considerations None. ### Documentation Considerations Includes an update to README for the new features and the undocumented features it is based upon. Includes a mention in NEWS. ### Testing Considerations TODO ### Compatibility Considerations By design error, `languageForExtension` threaded through `link` before this change, when it should have been threaded through `mapNodeModules`, since that is the machine that is aware of the `type` field in `package.json`. This change moves that internal mechanism and then adds `commonjsLanguageForExtension` and `moduleLanguageForExtension`. By common usage, this move is transparent since the option is taken at the top and simply diverted internally. However, the `languageForExtension` property could be manually threaded through `makeArchiveLite` and omitted from the options for `mapNodeModules`. I’ve elected to treat this breaking change as a bug fix since I find it unlikely anyone has taken advantage of these relatively new “lite” functions. The “lite” functions are part of the refactoring necessary to approach native XS compartment and modules. ### Upgrade Considerations None.
- Loading branch information
Showing
37 changed files
with
1,500 additions
and
177 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
Oops, something went wrong.