Skip to content

Commit 7b26b71

Browse files
committed
build: migrate to obuild
Build time: 5359ms →1208ms (including shell overhead) Bundle size: 31787B → 31655B
1 parent 335caf0 commit 7b26b71

20 files changed

+245
-195
lines changed

build.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import { defineBuildConfig } from 'unbuild';
1+
import { defineBuildConfig } from 'obuild/config';
22

33
export default defineBuildConfig({
4-
declaration: true,
54
entries: [{
5+
type: 'transform',
66
input: './src',
77
outDir: './dist',
8-
format: 'esm',
9-
ext: 'js',
10-
builder: 'mkdist',
118
}],
129
});

bun.lock

Lines changed: 192 additions & 142 deletions
Large diffs are not rendered by default.

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export default ts({
66
'no-cond-assign': [0],
77
'no-console': [2],
88
'ts/explicit-function-return-type': [2],
9+
'import/extensions': [2, 'ignorePackages', {
10+
checkTypeImports: true,
11+
}],
912
},
1013
}, {
1114
files: ['scripts/*.ts'],

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
],
4040
"scripts": {
4141
"prepare": "husky",
42-
"build": "unbuild",
42+
"build": "obuild",
4343
"dev": "bun ./scripts/dev.ts",
4444
"lint": "eslint .",
4545
"type-check": "tsc --noEmit",
@@ -58,7 +58,7 @@
5858
"@types/bun": "^1.2.10",
5959
"eslint": "^9.24.0",
6060
"husky": "^9.1.7",
61-
"typescript": "^5.8.3",
62-
"unbuild": "^3.5.0"
61+
"obuild": "^0.2.1",
62+
"typescript": "^5.8.3"
6363
}
6464
}

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
*/
1515

1616
// eslint-disable-next-line unused-imports/no-unused-imports
17-
import type { Platform } from './platform';
17+
import type { Platform } from './platform.ts';
1818

19-
export * from './contest';
20-
export * from './platform';
21-
export * from './problem';
19+
export * from './contest.ts';
20+
export * from './platform.ts';
21+
export * from './problem.ts';

src/platform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { $Fetch, CreateFetchOptions, FetchOptions } from 'ofetch';
2-
import type { Contest } from './contest';
3-
import type { Problem } from './problem';
2+
import type { Contest } from './contest.ts';
3+
import type { Problem } from './problem.ts';
44
import { ofetch } from 'ofetch';
5-
import { addHeaders, UnOJError, version } from './utils';
5+
import { addHeaders, UnOJError, version } from './utils.ts';
66

77
/** General platform constructor options. */
88
export interface PlatformOptions<Locale extends string | never = never> {

src/platforms/atcoder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*/
55

66
import type { CheerioAPI } from 'cheerio';
7-
import type { PlatformOptions } from '../platform';
8-
import type { Problem as BaseProblem, ProblemIOSample } from '../problem';
7+
import type { PlatformOptions } from '../platform.ts';
8+
import type { Problem as BaseProblem, ProblemIOSample } from '../problem.ts';
99
import { load } from 'cheerio';
1010
import { FetchError } from 'ofetch';
11-
import { NotFoundError, Platform } from '../platform';
12-
import { parseMemory, parseTime, UnOJError } from '../utils';
11+
import { NotFoundError, Platform } from '../platform.ts';
12+
import { parseMemory, parseTime, UnOJError } from '../utils.ts';
1313

1414
export type ProblemType = 'traditional' | 'interactive';
1515
export type Locale = 'en' | 'ja';

src/platforms/codeforces.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @module
44
*/
55

6-
import type { PlatformOptions } from '../platform';
7-
import type { Problem as BaseProblem, ProblemIOSample } from '../problem';
6+
import type { PlatformOptions } from '../platform.ts';
7+
import type { Problem as BaseProblem, ProblemIOSample } from '../problem.ts';
88
import { load } from 'cheerio';
9-
import { NotFoundError, Platform } from '../platform';
10-
import { parseMemory, parseTime } from '../utils';
9+
import { NotFoundError, Platform } from '../platform.ts';
10+
import { parseMemory, parseTime } from '../utils.ts';
1111

1212
export type ProblemType = 'traditional' | 'interactive' | 'communication' | 'submission';
1313

src/platforms/hydro.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @module
44
*/
55

6-
import type { PlatformOptions } from '../platform';
7-
import type { Problem as BaseProblem, ProblemIOSample } from '../problem';
6+
import type { PlatformOptions } from '../platform.ts';
7+
import type { Problem as BaseProblem, ProblemIOSample } from '../problem.ts';
88
import { FetchError } from 'ofetch';
9-
import { NotFoundError, Platform, UnexpectedResponseError } from '../platform';
10-
import { getFirstKey, UnOJError } from '../utils';
9+
import { NotFoundError, Platform, UnexpectedResponseError } from '../platform.ts';
10+
import { getFirstKey, UnOJError } from '../utils.ts';
1111

1212
export type ProblemType = 'traditional' | 'interactive' | 'submission' | 'objective';
1313

src/platforms/leetcode.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* @module
44
*/
55

6-
import type { PlatformOptions } from '../platform';
7-
import type { Problem as BaseProblem, ProblemIOSample } from '../problem';
6+
import type { PlatformOptions } from '../platform.ts';
7+
import type { Problem as BaseProblem, ProblemIOSample } from '../problem.ts';
88
import { load } from 'cheerio';
99
import { FetchError } from 'ofetch';
10-
import { NotFoundError, Platform, UnexpectedResponseError } from '../platform';
11-
import { UnOJError } from '../utils';
10+
import { NotFoundError, Platform, UnexpectedResponseError } from '../platform.ts';
11+
import { UnOJError } from '../utils.ts';
1212

1313
export type Difficulty = 'Easy' | 'Medium' | 'Hard';
1414

0 commit comments

Comments
 (0)