Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
with:
egress-policy: audit

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
Expand All @@ -31,4 +33,8 @@ jobs:
- name: Install dependencies
run: npm ci
- name: npm test
if: matrix.node-version != '20.x'
run: npm run node:test
- name: npm test with amaro
if: matrix.node-version == '20.x'
run: NODE_OPTIONS="--import=./tools/strip.js" npm run node:test
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
},
"devDependencies": {
"@types/node": "^24.10.1"
},
"dependencies": {
"amaro": "^1.1.5"
}
}
24 changes: 24 additions & 0 deletions tools/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'node:path';

export async function resolve(specifier, context, nextResolve) {
const result = await nextResolve(specifier, context);
const ext = path.extname(new URL(result.url).pathname);
if (ext === '.ts') {
return {
...result,
format: 'module',
};
}
return result;
}

export async function load(url, context, nextLoad) {
const ext = path.extname(new URL(url).pathname);
if (ext === '.ts') {
return nextLoad(url, {
...context,
format: 'module-typescript',
});
}
return nextLoad(url, context);
}
4 changes: 4 additions & 0 deletions tools/strip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { register } from 'node:module';
import 'amaro/strip';

register('./loader.js', import.meta.url);