Skip to content

Conversation

@rekmarks
Copy link
Member

@rekmarks rekmarks commented Aug 2, 2024

Awaiting #13

Introduces a new package, @ocap/streams, based on @endo/stream. As a side effect, migrates the monorepo's test framework from jest to vitest, which was already used for the extension.

Complete description forthcoming. This will probably be broken up into multiple distinct PRs.

@socket-security

This comment was marked as spam.

@socket-security

This comment was marked as resolved.

@rekmarks
Copy link
Member Author

rekmarks commented Aug 5, 2024

@SocketSecurity ignore npm/domutils@3.1.0 npm/parse5-htmlparser2-tree-adapter@7.0.0

Both are transitive dev dependencies due to a 2-year-old version of widely used package cheerio.

@rekmarks rekmarks mentioned this pull request Aug 7, 2024
@rekmarks
Copy link
Member Author

rekmarks commented Aug 7, 2024

Superseded by #15 and #16.

@rekmarks rekmarks closed this Aug 7, 2024
@rekmarks rekmarks deleted the rekm/streams branch August 7, 2024 10:13
rekmarks added a commit that referenced this pull request Aug 9, 2024
In the course of implementing #11, I made various changes to the
monorepo that I deemed either necessary or simply beneficial. Here these
changes are extracted from #11, which has been separated into this PR
and #16. Contains the following changes:

- Upgrade `ts-bridge` and migrate all packages to ESM
- In the course of implementing #11, I ran into a [TypeScript project
references](https://www.typescriptlang.org/docs/handbook/project-references.html)-related
error, because [`ts-bridge`](https://ts-bridge.dev/) originally did not
support this feature. However, [`ts-bridge` recently added support for
project
references](https://github.com/ts-bridge/ts-bridge/releases/tag/v7.0.0),
and updating fixed the problem.
- This, however, necessitated migrating all monorepo packages to be
ESM-first (`"type": "module"`), and setting TypeScript's
`moduleResolution` algorithm to `Node16`. So, now the entire monorepo is
ESM-first, but any libraries we publish will still be importable in
CommonJS, due to `ts-bridge`.
- As part of this change, `.js` files were renamed to `.cjs`, and `.mjs`
files to `.js`. The same goes for their `.ts` equivalents.
- A notable exception includes the published files in `@ocap/shims`,
which retain their `.mjs` extensions as a redundancy measure.
- Fix intra-repo path resolution in tests
- In the `/snaps` and `/core` monorepos, Jest's `moduleNameMapper`
option is manually configured to match the `paths` property in
`tsconfig.json` to ensure that tests use source code as opposed to build
outputs.
- In `vite`, we accomplish the same by dropping in the plugin
`vite-tsconfig-paths`, with no additional configuration whatsoever.
- Add internal `test-utils` package
- Rather than keeping a folder of test utilities at the monorepo root, I
decided to just create an internal package for this purpose.
- Set the version of all intra-monorepo dependencies to `workspace:^`
- This takes a queue from the Snaps monorepo. In this way, we will never
accidentally pull a workspace package from npm.
- Note that this required stealing some of the Snaps monorepo's
constraints for our `constraints.pro`. However, don't spend too much
time on that file, because it will be replaced soon: #17
- Externalize `endoify.mjs` in `extension` HTML files
- Introduces our own tiny `vite` plugin, `endoifyHtmlFilesPlugin`, that
inserts the `endoify.mjs` in the correct place just before HTML files
are built. `vite`'s aggressive optimization and module resolution logic
otherwise prevents us from doing this.
- Add `clean` script to all packages
- After experiencing some issues with cached builds, I decided to make
sure every package has a `clean` script.
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.

2 participants