Skip to content

Commit

Permalink
fix(register): node18 compatible issues (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 13, 2024
1 parent 0be008e commit 6bbe5c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20, 22]

name: stable - ${{ matrix.os }} - node@20
name: stable - ${{ matrix.os }} - node@${{ matrix.node }}
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -27,7 +28,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: 'Install dependencies'
Expand Down Expand Up @@ -55,18 +56,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache NPM dependencies
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: npm-cache-ubuntu-latest-node@20

- uses: pnpm/action-setup@v4
cache: 'pnpm'

- name: 'Install dependencies'
run: pnpm install
Expand Down
8 changes: 8 additions & 0 deletions packages/register/esm.mts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ export const load: LoadHook = async (url, context, nextLoad) => {

const { source, format: resolvedFormat } = await nextLoad(url, context)

if (!source) {
debug('No source', url, resolvedFormat)
return {
source,
format: resolvedFormat,
}
}

debug('loaded', url, resolvedFormat)

const code = !source || typeof source === 'string' ? source : Buffer.from(source).toString()
Expand Down

0 comments on commit 6bbe5c2

Please sign in to comment.