Skip to content

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

Merged
mcmire merged 3 commits intomainfrom
use-ts-bridge
Mar 28, 2025
Merged

Use ts-bridge instead of tsc; restrict imports#226
mcmire merged 3 commits intomainfrom
use-ts-bridge

Conversation

@mcmire
Copy link
Copy Markdown
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.

@socket-security
Copy link
Copy Markdown

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/untar.js@1.0.3 None 0 10.7 kB andrewbranch
npm/@arethetypeswrong/cli@0.15.4 None 0 50 kB andrewbranch
npm/@arethetypeswrong/core@0.15.1 None 0 257 kB andrewbranch
npm/@colors/colors@1.5.0 environment 0 39.5 kB dabh
npm/@sindresorhus/is@4.6.0 None 0 57.5 kB sindresorhus
npm/@ts-bridge/cli@0.6.3 None 0 196 kB mrten
npm/@ts-bridge/resolver@0.2.0 filesystem, unsafe 0 72.9 kB mrten
npm/ansi-escapes@7.0.0 environment 0 17.9 kB sindresorhus
npm/any-promise@1.3.0 None 0 22.2 kB kevinbeaty
npm/cjs-module-lexer@1.4.11.4.3 None 0 138 kB guybedford, mhdawson1, nodejs-foundation
npm/cli-highlight@2.1.11 None 0 42.7 kB felixfbecker
npm/cli-table3@0.6.5 None 0 46.2 kB speedytwenty
npm/commander@10.0.1 environment, filesystem, shell 0 174 kB abetomo
npm/emojilib@2.4.0 None 0 327 kB muan
npm/environment@1.1.0 None 0 8.89 kB sindresorhus
npm/fflate@0.8.2 None 0 773 kB 101arrowz
npm/highlight.js@10.7.3 None 0 1.71 MB highlightjs_bot
npm/marked-terminal@7.3.0 None 0 1.96 MB mikaelb
npm/marked@9.1.6 None 0 914 kB tonybrix
npm/mz@2.7.0 filesystem, network, shell 0 9.77 kB jongleberry
npm/node-emoji@2.2.0 None 0 64.5 kB omnidan
npm/parse5-htmlparser2-tree-adapter@6.0.1 None 0 11.4 kB inikulin
npm/parse5@5.1.1 None 0 331 kB inikulin
npm/skin-tone@2.0.0 None 0 4.74 kB sindresorhus
npm/supports-hyperlinks@3.2.0 None 0 7.01 kB jamestalmage, novemberborn, sindresorhus
npm/thenify-all@1.6.0 None 0 6.59 kB dead_horse
npm/thenify@3.3.1 None 0 7.92 kB dead_horse
npm/ts-expose-internals-conditionally@1.0.0-empty.0 None 0 909 B andrewbranch
npm/typescript@4.8.45.3.3 None 0 32 MB typescript-bot
npm/unicode-emoji-modifier-base@1.0.0 None 0 3.25 kB mathias
npm/validate-npm-package-name@5.0.1 unsafe 0 7.77 kB npm-cli-ops

View full report↗︎

@socket-security
Copy link
Copy Markdown

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/commander@10.0.1, npm/mz@2.7.0, npm/validate-npm-package-name@5.0.1

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/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

@mcmire
Copy link
Copy Markdown
Contributor Author

mcmire commented Mar 5, 2025

@SocketSecurity ignore npm/commander@10.0.1
@SocketSecurity ignore npm/mz@2.7.0
@SocketSecurity ignore npm/validate-npm-package-name@5.0.1

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
Copy Markdown
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