-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: Migrate monorepo to ESM, make various tweaks #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@ts-bridge/[email protected], npm/[email protected] |
This comment was marked as resolved.
This comment was marked as resolved.
8947197
to
46600ea
Compare
@SocketSecurity ignore npm/[email protected] npm/[email protected] Due to well-known and widely used dev dependency |
- test: Add internal test-utils package - chore: Synchronize workspace package dependencies - Accomplished by copying over sections of the Snaps monorepo constraints, which allow the `workspace:^` dependency version. In this way, we will never accidentally pull a workspace package from npm. - build(extension): Externalize endoify.mjs in HTML files - refactor: Upgrade ts-bridge and migrate all packages to ESM - chore: Add "clean" script to all packages - fix: Fix intra-repo path resolution in tests - By means of the plugin `vite-tsconfig-paths`
46600ea
to
c2a46ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #17, this file will be removed in the near future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM — I've reviewed the commits and the final changes. I did not spot concerns that would need to be addressed at this point.
Renamed Files
-.eslintrc.js
+.eslintrc.cjs
-.prettierrc.js
+.prettierrc.cjs
.yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
-packages/extension/.eslintrc.js
+packages/extension/.eslintrc.cjs
packages/extension/src/background.ts
-packages/extension/src/dev-console.mjs
+packages/extension/src/dev-console.js
packages/extension/src/iframe-manager.test.ts
packages/extension/src/iframe-manager.ts
packages/extension/src/iframe.ts
packages/extension/src/offscreen.ts
packages/extension/src/shared.test.ts
packages/extension/src/shared.ts
-packages/extension/vite.config.mts
+packages/extension/vite.config.ts
-packages/extension/vitest.config.mts
+packages/extension/vitest.config.ts
-packages/shims/.eslintrc.js
+packages/shims/.eslintrc.cjs
-packages/shims/scripts/bundle.mjs
+packages/shims/scripts/bundle.js
packages/shims/src/apply-lockdown.mjs
packages/shims/src/endoify.mjs
packages/shims/src/eventual-send.mjs
-packages/shims/vitest.config.mts
+packages/shims/vitest.config.ts
-vitest.config.packages.mjs
+vitest.config.packages.js
+packages/test-utils/src/env/mock-endo.ts
+packages/test-utils/src/index.ts
+packages/test-utils/src/mocks.ts
+packages/test-utils/src/utils.ts
Extracted from #11
Requires #13Unblocks #16
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:
ts-bridge
and migrate all packages to ESMstreams
package #11, I ran into a TypeScript project references-related error, becausets-bridge
originally did not support this feature. However,ts-bridge
recently added support for project references, and updating fixed the problem."type": "module"
), and setting TypeScript'smoduleResolution
algorithm toNode16
. So, now the entire monorepo is ESM-first, but any libraries we publish will still be importable in CommonJS, due tots-bridge
..js
files were renamed to.cjs
, and.mjs
files to.js
. The same goes for their.ts
equivalents.@ocap/shims
, which retain their.mjs
extensions as a redundancy measure./snaps
and/core
monorepos, Jest'smoduleNameMapper
option is manually configured to match thepaths
property intsconfig.json
to ensure that tests use source code as opposed to build outputs.vite
, we accomplish the same by dropping in the pluginvite-tsconfig-paths
, with no additional configuration whatsoever.test-utils
packageworkspace:^
constraints.pro
. However, don't spend too much time on that file, because it will be replaced soon: monorepo: Migrate constraints from Prolog to JavaScript #17endoify.mjs
inextension
HTML filesvite
plugin,endoifyHtmlFilesPlugin
, that inserts theendoify.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.clean
script to all packagesclean
script.