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
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
node_modules/
dist/
dist-docs/
coverage/

*.log
*.tsbuildinfo
*.tgz

.DS_Store
Thumbs.db

.env
.env.*
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"dev:docs": "npx http-server docs -p 8765 -o",
"bench": "vitest bench",
"bench:run": "vitest bench --run",
"typecheck": "tsc --noEmit",
"lint": "oxlint",
"lint:fix": "oxlint --fix",
"fmt": "oxfmt",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/fixtures/externals/entry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// eslint-disable-next-line no-unused-vars
import lodash from "lodash";
// eslint-disable-next-line no-unused-vars
import { useState } from "react";
import { local } from "./local";

Expand Down
1 change: 1 addition & 0 deletions src/__tests__/fixtures/externals/local.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-unused-vars
import { join } from "node:path";

export const local = "local";
3 changes: 3 additions & 0 deletions src/__tests__/fixtures/mixed/entry.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { staticDep } from "./static-dep";
// eslint-disable-next-line no-unused-vars
import type { SomeType } from "./types";
import "./side-effect";

// eslint-disable-next-line no-unused-vars
const dynamic = import("./dynamic-dep");
// eslint-disable-next-line no-unused-vars
const cjs = require("./cjs-dep");

export { everything } from "./reexport";
Expand Down
3 changes: 3 additions & 0 deletions src/__tests__/fixtures/strings/entry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { real } from "./real";

// eslint-disable-next-line no-unused-vars
const fakeImport = "import { fake } from './fake'";
// eslint-disable-next-line no-unused-vars
const anotherFake = `import { also } from './also-fake'`;
// eslint-disable-next-line no-unused-vars
const template = `some ${real} template`;

export const main = real;
2 changes: 1 addition & 1 deletion src/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
export function stripComments(code: string): string {
const len = code.length;
const result: string[] = new Array(len);
const result: string[] = Array.from<string>({ length: len });
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array.from({ length: len }) eagerly creates a dense array of len undefined values, which adds an extra O(n) initialization pass and more memory churn compared to the previous sparse new Array(len). Since result is fully assigned in the loop anyway, consider keeping the array sparse without using the Array constructor (e.g., initialize as [] and set result.length = len) to preserve performance while satisfying no-new-array.

Suggested change
const result: string[] = Array.from<string>({ length: len });
const result: string[] = [];
result.length = len;

Copilot uses AI. Check for mistakes.
let i = 0;

while (i < len) {
Expand Down
7 changes: 1 addition & 6 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ export default defineConfig({
coverage: {
provider: "v8",
include: ["src/**/*.ts"],
exclude: [
"src/**/*.test.ts",
"src/__tests__/**",
"src/__benchmarks__/**",
"src/types.ts",
],
exclude: ["src/**/*.test.ts", "src/__tests__/**", "src/__benchmarks__/**", "src/types.ts"],
thresholds: {
lines: 99,
functions: 99,
Expand Down