8000 fix: `.cts` should never be treated as esm by JounQin · Pull Request #226 · un-ts/synckit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: .cts should never be treated as esm #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
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-socks-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"synckit": patch
---

fix: `.cts` should never be treated as esm
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ jobs:
# eslint-plugin-unicorn using `with` syntax is not supported
if: ${{ matrix.node != 18 && matrix.node != 18.18 }}
env:
EFF_NO_LINK_RULES: true
PARSER_NO_WATCH: true

- name: Benchmark
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ jobs:
- name: Build
run: yarn build

- run: yarn dlx pkg-pr-new publish --compact
- name: Publish
run: yarn dlx pkg-pr-new publish --compact
13 changes: 5 additions & 8 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ name: Size Limit
on:
pull_request:
branches:
- master
- v3.x

permissions:
contents: read
pull-requests: write
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -18,7 +13,8 @@ jobs:
size-limit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Node.js LTS
uses: actions/setup-node@v4
Expand All @@ -29,7 +25,8 @@ jobs:
- name: Install Dependencies
run: yarn --immutable

- uses: andresz1/size-limit-action@v1.8.0
- name: Check Size Limit
uses: andresz1/size-limit-action@94bc357df29c36c8f8d50ea497c3e225c3c95d1d # v1.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_step: install
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
[`@oxc-node/core`]: https://github.com/oxc-project/oxc-node
[`@swc-node/register`]: https://github.com/swc-project/swc-node/tree/master/packages/register
[`tsx`]: https://github.com/esbuild-kit/tsx
[1stg.me]: https://www.1stg.me
< 8000 /td> [jounqin]: https://GitHub.com/JounQin
[mit]: http://opensource.org/licenses/MIT
[1stG.me]: https://www.1stG.me
[JounQin]: https://github.com/JounQin
[MIT]: http://opensource.org/licenses/MIT
8 changes: 4 additions & 4 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export const setupTsRunner = (

const isTs = /\.[cm]?ts$/.test(workerPath)

let jsUseEsm = workerPath.endsWith('.mjs')
let tsUseEsm = workerPath.endsWith('.mts')
let jsUseEsm = ext === '.mjs'
let tsUseEsm = ext === '.mts'

if (isTs) {
if (!tsUseEsm) {
if (!tsUseEsm && ext !== '.cts') {
const pkg = findUp(workerPath)
if (pkg) {
tsUseEsm = cjsRequire<PackageJson>(pkg).type === 'module'
Expand Down Expand Up @@ -281,7 +281,7 @@ export const setupTsRunner = (
throw new Error(`Unknown ts runner: ${String(tsRunner)}`)
}
}
} else if (!jsUseEsm && !workerPath.endsWith('.cjs')) {
} else if (!jsUseEsm && ext !== '.cjs') {
const pkg = findUp(workerPath)
if (pkg) {
jsUseEsm = cjsRequire<PackageJson>(pkg).type === 'module'
Expand Down
Loading
Loading
0