Skip to content

Conversation

@tknickman
Copy link
Member

@tknickman tknickman commented Aug 8, 2025

[@anthonyshew took over this PR, description is mine]

Description

Dual-compiling this package so we can have an easier time converting its dependents to ESM.

Note that I'm using zshy for compilation, which uses an interesting pattern that breaks the strictness of publint and attw. For that reason, I'm opting to:

  • Trust zshy
  • Remove publint from this package
  • Ease attw for this package

This commit converts the turbo-types package from CommonJS to ESM:

- Renamed .eslintrc.js to .eslintrc.cjs for CommonJS config
- Updated package.json to add "type": "module" and proper ESM exports
- Modified import statements in src/index.ts to use .js extensions
- Added JSON import using createRequire for compatibility
- Updated tsconfig.json for ESM compilation with proper output directory

The package now properly supports ESM with appropriate module resolution
and export configurations for TypeScript consumers.
@tknickman tknickman requested a review from a team as a code owner August 8, 2025 14:10
@vercel
Copy link
Contributor

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
examples-basic-web Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-designsystem-docs Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-gatsby-web Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-kitchensink-blog Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-nonmonorepo Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-svelte-web Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-tailwind-web Ready Ready Preview Comment Sep 16, 2025 3:39am
examples-vite-web Ready Ready Preview Comment Sep 16, 2025 3:39am
turbo-site Error Error Sep 16, 2025 3:39am

tknickman and others added 2 commits August 8, 2025 10:17
Add explicit export for frameworks.json file to support direct imports
from documentation site, maintaining backwards compatibility during
ESM conversion.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Implement dual package exports to support both ESM and CommonJS consumers:
- Add separate build outputs for ESM (dist/esm) and CommonJS (dist/cjs)
- Create dedicated TypeScript configs for each module format
- Update package.json exports with proper conditional exports
- Fix Jest compatibility issues by providing CommonJS build
- Maintain backwards compatibility for existing consumers

This resolves the "Cannot use import statement outside a module" error
in Jest environments while preserving ESM functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
anthonyshew added a commit that referenced this pull request Aug 25, 2025
### Description

Because JavaScript packaging is so finnicky, I'm thinking its a good
idea to make sure our interfaces stay ecosystem compliant. PRs like
#10747 and
#10754 have potential to break
things, so its nice to have some sanity checking. (I haven't checked yet
if those PRs specifically are right, but they made me think about adding
some tooling like this.)

### Testing Instructions

CI
@anthonyshew anthonyshew changed the title chore(turbo-types): convert to ESM chore(turbo-types): add ESM exports Sep 15, 2025
@turbo-orchestrator turbo-orchestrator bot added the pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo label Sep 16, 2025
@turbo-orchestrator turbo-orchestrator bot removed the pkg: turbo-eslint eslint-config-turbo and eslint-plugin-turbo label Sep 16, 2025
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.

4 participants