Skip to content

Commit 372c21e

Browse files
authored
chore: upgrade rspack to 2.0.0-beta.2 (#20)
1 parent 29b70e5 commit 372c21e

File tree

267 files changed

+2981
-3130
lines changed

Some content is hidden

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

267 files changed

+2981
-3130
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
matrix:
2020
os: [ubuntu-latest, windows-latest, macos-latest]
21-
node: [18.x]
21+
node: [22.x]
2222

2323
runs-on: ${{ matrix.os }}
2424

copy-plugin/CopyPlugin.test.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
const path = require("path");
2-
const fs = require("fs");
3-
4-
const { rspack } = require("@rspack/core");
5-
6-
const { run, runEmit, runChange } = require("./helpers/run");
7-
8-
const { readAssets, getCompiler, compile } = require("./helpers");
9-
const { rimrafSync } = require("rimraf");
1+
import path from "path";
2+
import fs from "fs";
3+
import rspack from "@rspack/core";
4+
5+
import { run, runEmit, runChange } from "./helpers/run";
6+
import { readAssets, getCompiler, compile } from "./helpers";
7+
import { rimrafSync } from "rimraf";
8+
import { createRequire } from "module";
9+
import { fileURLToPath } from 'url';
10+
import { dirname } from 'path';
11+
import { jest, test, describe } from "@jest/globals";
12+
const require = createRequire(import.meta.url);
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = dirname(__filename);
1015

1116
const FIXTURES_DIR = path.join(__dirname, "fixtures");
1217

@@ -409,7 +414,7 @@ describe("CopyPlugin", () => {
409414
]
410415
})
411416
.then(({ stats }) => {
412-
const stringStats = stats.toString();
417+
const stringStats = stats.toString({ assets: true });
413418

414419
expect(stringStats.match(/\[copied]/g).length).toBe(4);
415420
})
@@ -422,6 +427,7 @@ describe("CopyPlugin", () => {
422427
{
423428
mode: "development",
424429
context: path.resolve(__dirname, "./fixtures"),
430+
devtool: false,
425431
plugins: [
426432
new rspack.CopyRspackPlugin({
427433
patterns: [
@@ -449,6 +455,7 @@ describe("CopyPlugin", () => {
449455
],
450456
mode: "development",
451457
entry: path.resolve(__dirname, "./helpers/enter.js"),
458+
devtool: false,
452459
output: {
453460
path: path.resolve(__dirname, "./outputs/multi-compiler/dist/b")
454461
}
@@ -477,6 +484,7 @@ describe("CopyPlugin", () => {
477484
{
478485
mode: "development",
479486
context: path.resolve(__dirname, "./fixtures"),
487+
devtool: false,
480488
plugins: [
481489
new rspack.CopyRspackPlugin({
482490
patterns: [
@@ -510,6 +518,7 @@ describe("CopyPlugin", () => {
510518
{
511519
mode: "development",
512520
context: path.resolve(__dirname, "./fixtures"),
521+
devtool: false,
513522
plugins: [
514523
new rspack.CopyRspackPlugin({
515524
patterns: [
@@ -544,6 +553,7 @@ describe("CopyPlugin", () => {
544553
{
545554
mode: "development",
546555
context: path.resolve(__dirname, "./fixtures"),
556+
devtool: false,
547557
plugins: [
548558
new rspack.CopyRspackPlugin({
549559
patterns: [

copy-plugin/__snapshots__/CopyPlugin.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`CopyPlugin basic should work with multi compiler mode: assets 1`] = `
44
Object {

copy-plugin/helpers/AsyncEventIterator.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @extends {AsyncIterableIterator<T>}
44
* @extends {AsyncIterator<T>}
55
*/
6-
class AsyncEventIterator {
6+
export default class AsyncEventIterator {
77
constructor() {
88
/**
99
* @member {(data: T) => any} resolve
@@ -44,4 +44,3 @@ class AsyncEventIterator {
4444
}
4545
}
4646

47-
module.exports = AsyncEventIterator;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("fs");
1+
import fs from "fs";
2+
export default fs;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("path");
1+
import path from "path";
2+
export default path;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("process");
1+
import process from "process";
2+
export default process;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("stream");
1+
import stream from "stream";
2+
export default stream;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("url");
1+
import url from "url";
2+
export default url;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
module.exports = require("util");
1+
import util from "util";
2+
export default util;

0 commit comments

Comments
 (0)