Skip to content

Commit b99f1ad

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/inject_dev_server_uri
2 parents 3e46dd2 + c7e8439 commit b99f1ad

56 files changed

Lines changed: 2943 additions & 2945 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ on:
1313
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1414
jobs:
1515
test:
16+
permissions:
17+
contents: read
18+
1619
name: Test - ${{ matrix.os }} - Node v${{ matrix.node }})
1720

1821
strategy:
1922
matrix:
2023
os: [ubuntu-latest, windows-latest, macos-latest]
21-
node: [18.x]
24+
node: [20.x]
2225

2326
runs-on: ${{ matrix.os }}
2427

@@ -47,3 +50,30 @@ jobs:
4750

4851
- name: Run Test
4952
run: pnpm run test
53+
54+
check:
55+
name: Check
56+
runs-on: ubuntu-latest
57+
permissions:
58+
contents: read
59+
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v4
63+
64+
- name: Install Pnpm
65+
run: |
66+
npm install -g corepack@latest
67+
corepack enable
68+
69+
- name: Setup Node.js
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: 20
73+
cache: "pnpm"
74+
75+
- name: Install Dependencies
76+
run: pnpm install
77+
78+
- name: Prettier
79+
run: pnpm run prettier:ci

.prettierrc.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ module.exports = {
88
files: "*.json",
99
options: {
1010
parser: "json",
11-
useTabs: false,
12-
},
11+
useTabs: false
12+
}
1313
},
1414
{
1515
files: "*.ts",
1616
options: {
17-
parser: "typescript",
18-
},
19-
},
20-
],
17+
parser: "typescript"
18+
}
19+
}
20+
]
2121
};

jest.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ const isWin = os.platform() === "win32";
44
const config = {
55
preset: "ts-jest",
66
testEnvironmentOptions: {
7-
url: "http://localhost/",
7+
url: "http://localhost/"
88
},
99
testMatch: [
1010
"<rootDir>/tests/*.test.ts",
1111
// TODO: enable after migrating to separated repo
12-
"<rootDir>/tests/e2e/*.test.js",
12+
"<rootDir>/tests/e2e/*.test.js"
1313
],
1414
testPathIgnorePatterns: [
1515
// TODO: check why http proxy server throw error with websocket server
@@ -19,26 +19,26 @@ const config = {
1919
// TODO: check why this test throw error when run with other tests
2020
"<rootDir>/tests/e2e/watch-files.test.js",
2121
// TODO: check why this test timeout
22-
"<rootDir>/tests/e2e/web-socket-server-url.test.js",
22+
"<rootDir>/tests/e2e/web-socket-server-url.test.js"
2323
],
2424
cache: false,
2525
testTimeout: process.env.CI ? 120000 : 30000,
2626
transform: {
2727
"(.*)\\.{js,ts}": [
2828
"ts-jest",
2929
{
30-
tsconfig: "<rootDir>/tests/tsconfig.json",
31-
},
32-
],
30+
tsconfig: "<rootDir>/tests/tsconfig.json"
31+
}
32+
]
3333
},
3434
// Add this to find out which test timeouts
3535
// testSequencer: "<rootDir>/tests/helpers/sequencer.js",
3636
snapshotResolver: "<rootDir>/tests/helpers/snapshot-resolver.js",
3737
setupFilesAfterEnv: ["<rootDir>/tests/helpers/setup-test.js"],
3838
globalSetup: "<rootDir>/tests/helpers/global-setup-test.js",
3939
moduleNameMapper: {
40-
"^uuid$": require.resolve("uuid"),
41-
},
40+
"^uuid$": require.resolve("uuid")
41+
}
4242
};
4343

4444
module.exports = config;

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"lint": "biome check .",
2626
"lint:write": "biome check . --write",
2727
"format": "prettier --write .",
28+
"prettier:ci": "prettier --check .",
2829
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
2930
"test": "pnpm run test:install && pnpm run build && cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ./node_modules/jest-cli/bin/jest --colors",
3031
"release": "node ./scripts/release.mjs"
@@ -33,8 +34,10 @@
3334
"pre-commit": "npx nano-staged"
3435
},
3536
"nano-staged": {
37+
"*.{yaml,yml,json,md,json5}": ["npm rum format"],
3638
"*.{js,jsx,ts,tsx,mjs,cjs}": [
37-
"biome check --write --no-errors-on-unmatched"
39+
"npm run format",
40+
"biome lint --write --no-errors-on-unmatched"
3841
]
3942
},
4043
"files": ["dist", "client"],

scripts/release.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const currentVersion = pkg.version;
1515
const nextVersion = inc(currentVersion, RELEASE_VERSION_TYPE);
1616
if (!nextVersion) {
1717
throw new Error(
18-
`Failed to generate next version from "${currentVersion}" with type "${RELEASE_VERSION_TYPE}"`,
18+
`Failed to generate next version from "${currentVersion}" with type "${RELEASE_VERSION_TYPE}"`
1919
);
2020
}
2121

src/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const getFreePort = async function getFreePort(port: string, host: string) {
4040
: 3;
4141

4242
return pRetry(() => getPort(basePort, host), {
43-
retries: defaultPortRetry,
43+
retries: defaultPortRetry
4444
});
4545
};
4646

@@ -85,15 +85,15 @@ export class RspackDevServer extends WebpackDevServer {
8585
if (mode === "production") {
8686
this.logger.warn(
8787
"Hot Module Replacement (HMR) is enabled for the production build. \n" +
88-
"Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration.",
88+
"Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration."
8989
);
9090
}
9191

9292
compiler.options.resolve.alias = {
9393
"ansi-html-community": require.resolve(
94-
"@rspack/dev-server/client/utils/ansiHTML",
94+
"@rspack/dev-server/client/utils/ansiHTML"
9595
),
96-
...compiler.options.resolve.alias,
96+
...compiler.options.resolve.alias
9797
};
9898
}
9999
}

tests/ansiHTML.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ import ansiHTML from "../client-src/utils/ansiHTML";
33
describe("ansi-html", () => {
44
it("should transform 24-bit rgb ansi colors", () => {
55
expect(ansiHTML("\u001b[38;2;255;30;30m×\u001b[0m")).toMatchInlineSnapshot(
6-
`"<span style="color: rgb(255,30,30);">×</span><span style="font-weight:normal;opacity:1;color:#fff;background:#000;"></span>"`,
6+
`"<span style="color: rgb(255,30,30);">×</span><span style="font-weight:normal;opacity:1;color:#fff;background:#000;"></span>"`
77
);
88
});
99

1010
it("should transform 24-bit rgb ansi colors with additional properties", () => {
1111
expect(
12-
ansiHTML("[\u001b[38;2;92;157;255;1;4m/root/index.js\u001b[0m:1:1]"),
12+
ansiHTML("[\u001b[38;2;92;157;255;1;4m/root/index.js\u001b[0m:1:1]")
1313
).toMatchInlineSnapshot(
14-
`"[<span style="color: rgb(92,157,255);"><span style="font-weight:bold;"><u>/root/index.js</u></span></span><span style="font-weight:normal;opacity:1;color:#fff;background:#000;">:1:1]</span>"`,
14+
`"[<span style="color: rgb(92,157,255);"><span style="font-weight:bold;"><u>/root/index.js</u></span></span><span style="font-weight:normal;opacity:1;color:#fff;background:#000;">:1:1]</span>"`
1515
);
1616
});
1717

1818
it("should transform basic ansi colors", () => {
1919
expect(ansiHTML("\u001b[0mcontent")).toMatchInlineSnapshot(
20-
`"<span style="font-weight:normal;opacity:1;color:#fff;background:#000;">content</span>"`,
20+
`"<span style="font-weight:normal;opacity:1;color:#fff;background:#000;">content</span>"`
2121
);
2222
expect(
2323
ansiHTML(
24-
"\u001b[33m<\u001b[39m\u001b[33mheader\u001b[39m\u001b[33m>\u001b[39m",
25-
),
24+
"\u001b[33m<\u001b[39m\u001b[33mheader\u001b[39m\u001b[33m>\u001b[39m"
25+
)
2626
).toMatchInlineSnapshot(
27-
`"<span style="color:#e8bf03;"><</span><span style="color:#e8bf03;">header</span><span style="color:#e8bf03;">></span>"`,
27+
`"<span style="color:#e8bf03;"><</span><span style="color:#e8bf03;">header</span><span style="color:#e8bf03;">></span>"`
2828
);
2929
});
3030
});

0 commit comments

Comments
 (0)