Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

fix: TypeScript file detection #34

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: pnpm type-check

- name: Build
run: pnpm build

- name: Test
run: pnpm test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "pkgroll --target node12.20 --minify",
"lint": "eslint .",
"type-check": "tsc --noEmit",
"test": "pnpm build && tsx tests/index.ts",
"test": "tsx tests/index.ts",
"prepack": "pnpm build && clean-pkg-json"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import type { TransformOptions } from 'esbuild';

const isPathPattern = /^\.{0,2}\//;
const isTsFilePatten = /\.[cm]?tsx?$/;
const nodeModulesPath = `${path.sep}node_modules${path.sep}`;

const tsconfig = (
Expand Down Expand Up @@ -185,7 +184,7 @@ function resolveTsFilename(

if (
parent?.filename
&& isTsFilePatten.test(parent.filename)
&& fileMatcher?.(parent.filename)
&& tsPath
) {
try {
Expand Down
4 changes: 3 additions & 1 deletion tests/utils/node-with-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export async function createNode(
nodeVersion: string,
fixturePath: string,
) {
const node = await getNode(nodeVersion);
const node = await getNode(nodeVersion, {
arch: 'x64',
});

return {
version: node.version,
Expand Down