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
10 changes: 10 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"endOfLine": "lf",
"printWidth": 100,
"singleQuote": true,
"useTabs": true,
"sortImports": true,
"sortPackageJson": false,
"ignorePatterns": []
}
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
],
"scripts": {
"prepack": "npm run build && npm test",
"build": "node scripts/prebuild.js && tsc -p tsconfig.json --listEmittedFiles && prettier --ignore-path='' --write 'lib/*.js'",
"format": "prettier --write '**/*.{css,js,ts}' '**/*config*.json'",
"build": "node scripts/prebuild.js && tsc -p tsconfig.json --listEmittedFiles && oxfmt --write lib",
"format": "oxfmt --write '**/*.{css,js,ts}' '**/*config*.json'",
"test": "vitest --run test/*.test.ts",
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p test/tsconfig.json --noEmit"
},
"devDependencies": {
"@types/node": "^24.12.0",
"fs-fixture": "^2.12.0",
"linkedom": "^0.18.12",
"prettier": "^3.8.1",
"typescript": "~6.0.2",
"vitest": "^4.1.2"
"oxfmt": "^0.47.0",
"typescript": "~6.0.3",
"vitest": "^4.1.5"
}
}
533 changes: 370 additions & 163 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createGzip, gzipSync } from 'node:zlib';
import { MAX_COMPRESS_SIZE, SUPPORTED_METHODS } from './constants.ts';
import { getContentType, typeForFilePath } from './content-type.ts';
import { dirListPage, errorPage } from './pages.ts';
import { FileResolver } from './resolver.ts';
import { type FileResolver } from './resolver.ts';
import type {
FSLocation,
HttpHeaderRule,
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { env, versions } from 'node:process';
import { isAbsolute, sep as dirSep } from 'node:path';
import { env, versions } from 'node:process';

export class PathMatcher {
#positive: Array<string | RegExp> = [];
Expand Down
1 change: 1 addition & 0 deletions test/content-type.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { open } from 'node:fs/promises';
import { join } from 'node:path';

import { expect, suite, test } from 'vitest';

import {
Expand Down
3 changes: 2 additions & 1 deletion test/fs-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { platform } from 'node:os';
import { chmod } from 'node:fs/promises';
import { platform } from 'node:os';

import { afterAll, expect, suite, test } from 'vitest';

import { checkDirAccess, getIndex, getKind, getRealpath, isReadable } from '../src/fs-utils.ts';
Expand Down
1 change: 1 addition & 0 deletions test/handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IncomingMessage, ServerResponse } from 'node:http';
import { Duplex } from 'node:stream';

import { afterAll, expect, suite, test } from 'vitest';

import { extractUrlPath, fileHeaders, isValidUrlPath, RequestHandler } from '../src/handler.ts';
Expand Down
1 change: 1 addition & 0 deletions test/logger.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type Buffer } from 'node:buffer';
import { Writable } from 'node:stream';
import { stripVTControlCharacters } from 'node:util';

import { expect, suite, test } from 'vitest';

import { ColorUtils, Logger, requestLogLine } from '../src/logger.ts';
Expand Down
1 change: 1 addition & 0 deletions test/options.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cwd } from 'node:process';

import { expect, suite, test } from 'vitest';

import { DEFAULT_OPTIONS } from '../src/constants.ts';
Expand Down
1 change: 1 addition & 0 deletions test/package.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createRequire } from 'node:module';

import { expect, suite, test } from 'vitest';

suite('package.json', async () => {
Expand Down
1 change: 1 addition & 0 deletions test/shared.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { join, resolve, sep as dirSep } from 'node:path';
import { cwd } from 'node:process';

import { createFixture } from 'fs-fixture';

import { DEFAULT_OPTIONS } from '../src/constants.ts';
Expand Down
4 changes: 2 additions & 2 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { join, sep as dirSep } from 'node:path';
import { expect, suite, test } from 'vitest';

import { loc } from './shared.ts';
import { expect, suite, test } from 'vitest';

import {
clamp,
Expand All @@ -17,6 +16,7 @@ import {
trimSlash,
withResolvers,
} from '../src/utils.ts';
import { loc } from './shared.ts';

suite('clamp', () => {
test('keeps the value when between bounds', () => {
Expand Down
Loading