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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
},
"dependencies": {
"arg": "^5.0.2",
"globby": "^14.1.0",
"fast-glob": "^3.3.2",
"table": "^6.9.0"
},
"scripts": {
"build": "tsx src/index.ts",
"test": "vitest run",
"test:basic": "tsx ./src/index.ts --project ./test/tsconfig.basic.json",
"test:basic": "tsx ./src/index.ts --project ./test/basic/tsconfig.json --dry-run",
"clean": "git clean -xdf . -e node_modules"
},
"zshy": {
Expand Down
49 changes: 3 additions & 46 deletions pnpm-lock.yaml

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

22 changes: 12 additions & 10 deletions src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ export async function compileProject(config: ProjectOptions, entryPoints: string
});

// Create a transformer factory to resolve tsconfig paths
const pathsResolverTransformer = config.paths ? createPathsResolverTransformer({
baseUrl: config.baseUrl,
paths: config.paths,
tsconfigDir: path.dirname(config.configPath),
rootDir: config.rootDir,
}) : null;
const pathsResolverTransformer = config.paths
? createPathsResolverTransformer({
baseUrl: config.baseUrl,
paths: config.paths,
tsconfigDir: path.dirname(config.configPath),
rootDir: config.rootDir,
})
: null;

// Create a transformer factory to rewrite extensions
const extensionRewriteTransformer = createExtensionRewriteTransformer({
Expand Down Expand Up @@ -147,18 +149,18 @@ export async function compileProject(config: ProjectOptions, entryPoints: string

// Prepare transformers
const before: ts.TransformerFactory<ts.SourceFile>[] = [];

// Add paths resolver transformer first if paths are configured
if (pathsResolverTransformer) {
before.push(pathsResolverTransformer as ts.TransformerFactory<ts.SourceFile>);
}

// Then add extension rewriter
before.push(extensionRewriteTransformer as ts.TransformerFactory<ts.SourceFile>);

const after: ts.TransformerFactory<ts.SourceFile>[] = [];
const afterDeclarations: ts.TransformerFactory<ts.SourceFile | ts.Bundle>[] = [];

// Add transformers for declarations
if (pathsResolverTransformer) {
afterDeclarations.push(pathsResolverTransformer);
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from "node:fs";
import * as path from "node:path";
import parseArgs from "arg";
import { globby } from "globby";
import glob from "fast-glob";
import { table } from "table";
import * as ts from "typescript";
import { type BuildContext, compileProject } from "./compile.js";
Expand Down Expand Up @@ -458,7 +458,7 @@ Examples:
if (isVerbose) {
emojiLog("🔍", `Matching glob: ${pattern}`);
}
const wildcardFiles = await globby([pattern], {
const wildcardFiles = await glob(pattern, {
ignore: ["**/*.d.ts", "**/*.d.mts", "**/*.d.cts"],
cwd: pkgJsonDir,
});
Expand Down