Skip to content

Commit 72ce63c

Browse files
authored
fix: should transpile ansiHTML to es5 (#10)
* fix: should transpile ansiHTML to es5 * fix: should transpile ansiHTML to es5
1 parent 18a8e4e commit 72ce63c

File tree

9 files changed

+25
-6
lines changed

9 files changed

+25
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
.DS_Store
33
*.local
44
*.log*
5+
*.tsbuildinfo
56

67
# Dist
78
node_modules
89
dist/
10+
client/
911
test-results
1012

1113
# Test

client/index.js renamed to client-src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
function ownKeys(object, enumerableOnly) {
23
var keys = Object.keys(object);
34
if (Object.getOwnPropertySymbols) {
File renamed without changes.

client/utils/reloadApp.js renamed to client-src/utils/reloadApp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-nocheck
2+
13
import hotEmitter from "@rspack/core/hot/emitter.js";
24
import { log } from "webpack-dev-server/client/utils/log.js";
35

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"./package.json": "./package.json"
2020
},
2121
"scripts": {
22-
"build": "tsc -b ./tsconfig.build.json",
22+
"build": "pnpm run build:server && pnpm run build:client",
23+
"build:server": "tsc -b ./tsconfig.build.json",
24+
"build:client": "tsc -b ./tsconfig.client.json",
2325
"dev": "tsc -b -w",
2426
"lint": "biome check .",
2527
"lint:write": "biome check . --write",

src/server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* Copyright (c) JS Foundation and other contributors
88
* https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/LICENSE
99
*/
10-
import path from "node:path";
11-
1210
import type { Server } from "node:http";
1311
import type { Socket } from "node:net";
1412
import { type Compiler, MultiCompiler } from "@rspack/core";
@@ -91,7 +89,7 @@ export class RspackDevServer extends WebpackDevServer {
9189
}
9290

9391
compiler.options.resolve.alias = {
94-
"ansi-html-community": path.resolve(__dirname, "./ansiHTML"),
92+
"ansi-html-community": require.resolve("@rspack/dev-server/client/utils/ansiHTML"),
9593
...compiler.options.resolve.alias
9694
};
9795
}

tests/ansiHTML.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ansiHTML from "../src/ansiHTML";
1+
import ansiHTML from "../client-src/utils/ansiHTML";
22

33
describe("ansi-html", () => {
44
it("should transform 24-bit rgb ansi colors", () => {

tests/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"checkJs": false,
66
"rootDir": "../"
77
},
8-
"include": ["../src", "../tests"],
8+
"include": ["../src", "../tests", "../client-src"],
99
"references": []
1010
}

tsconfig.client.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ES2020",
5+
"target": "ES5",
6+
"outDir": "client",
7+
"rootDir": "client-src",
8+
"composite": false,
9+
"sourceMap": false,
10+
"declarationMap": false,
11+
"declaration": false
12+
},
13+
"include": ["client-src"]
14+
}

0 commit comments

Comments
 (0)