Skip to content

Use ts-bridge instead of tsc; restrict imports #226

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

Merged
merged 3 commits into from
Mar 28, 2025
Merged

Use ts-bridge instead of tsc; restrict imports #226

merged 3 commits into from
Mar 28, 2025

Conversation

mcmire
Copy link
Contributor

@mcmire mcmire commented Mar 5, 2025

  • Use ts-bridge instead of tsc to generate a JavaScript build.
    • This now produces two variants to cater to CommonJS-only and ESM-compatible bundlers.
  • Define exports in package.json
    • BREAKING: Custom, on-demand subpath imports are no longer supported.

Manual testing steps

  • Run yarn build and inspect dist. You should see .cjs, .mjs, .d.cts, and .d.mts files for each TypeScript file in src/.
  • Run yarn test. This now runs a second command, attw --pack, which verifies that the built files are correct. This should pass.

Copy link

socket-security bot commented Mar 5, 2025

New and updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@andrewbranch/[email protected] None 0 10.7 kB andrewbranch
npm/@arethetypeswrong/[email protected] None 0 50 kB andrewbranch
npm/@arethetypeswrong/[email protected] None 0 257 kB andrewbranch
npm/@colors/[email protected] environment 0 39.5 kB dabh
npm/@sindresorhus/[email protected] None 0 57.5 kB sindresorhus
npm/@ts-bridge/[email protected] None 0 196 kB mrten
npm/@ts-bridge/[email protected] filesystem, unsafe 0 72.9 kB mrten
npm/[email protected] environment 0 17.9 kB sindresorhus
npm/[email protected] None 0 22.2 kB kevinbeaty
npm/[email protected]1.4.3 None 0 138 kB guybedford, mhdawson1, nodejs-foundation
npm/[email protected] None 0 42.7 kB felixfbecker
npm/[email protected] None 0 46.2 kB speedytwenty
npm/[email protected] environment, filesystem, shell 0 174 kB abetomo
npm/[email protected] None 0 327 kB muan
npm/[email protected] None 0 8.89 kB sindresorhus
npm/[email protected] None 0 773 kB 101arrowz
npm/[email protected] None 0 1.71 MB highlightjs_bot
npm/[email protected] None 0 1.96 MB mikaelb
npm/[email protected] None 0 914 kB tonybrix
npm/[email protected] filesystem, network, shell 0 9.77 kB jongleberry
npm/[email protected] None 0 64.5 kB omnidan
npm/[email protected] None 0 11.4 kB inikulin
npm/[email protected] None 0 331 kB inikulin
npm/[email protected] None 0 4.74 kB sindresorhus
npm/[email protected] None 0 7.01 kB jamestalmage, novemberborn, sindresorhus
npm/[email protected] None 0 6.59 kB dead_horse
npm/[email protected] None 0 7.92 kB dead_horse
npm/[email protected] None 0 909 B andrewbranch
npm/[email protected]5.3.3 None 0 32 MB typescript-bot
npm/[email protected] None 0 3.25 kB mathias
npm/[email protected] unsafe 0 7.77 kB npm-cli-ops

View full report↗︎

Copy link

socket-security bot commented Mar 5, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@mcmire
Copy link
Contributor Author

mcmire commented Mar 5, 2025

@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]
@SocketSecurity ignore npm/[email protected]

commander is used by @arethetypeswrong/cli. This package is a wrapper around child_process, so shell access makes sense.

mz is a transitive dependency of @arethetypeswrong/cli. It wraps child_process, fs, and other Node libraries to provide promisified versions. So shell access makes sense here too.

New author for validate-npm-package-name is OK, lukekarrys is a known member of the JS community.

Base automatically changed from update-github-workflows to main March 25, 2025 16:33
- Use `ts-bridge` instead of `tsc` to generate a JavaScript build.
  - This now produces two variants to cater to CommonJS-only and
    ESM-compatible bundlers.
- Define exports in `package.json`
  - Custom, on-demand subpath imports are no longer supported.
@mcmire mcmire marked this pull request as ready for review March 25, 2025 16:38
@mcmire mcmire requested a review from a team as a code owner March 25, 2025 16:38
@mcmire mcmire marked this pull request as draft March 25, 2025 16:39
@mcmire mcmire marked this pull request as ready for review March 27, 2025 13:44
Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mcmire mcmire merged commit 9577a9b into main Mar 28, 2025
25 checks passed
@mcmire mcmire deleted the use-ts-bridge branch March 28, 2025 14:56
@Mrtenz Mrtenz mentioned this pull request Mar 31, 2025
Mrtenz added a commit that referenced this pull request Mar 31, 2025
`bin` was pointing to `dist/cli.js` which no longer exists after #226,
causing the CLI to break:

```
$ yarn changelog:validate
node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module './node_modules/@metamask/auto-changelog/dist/cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants