Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add compiler.rspack #7434

Merged
merged 1 commit into from
Aug 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
Object {
"message": " × Error: test push\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test push\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-push.js:10:31)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test push\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-push.js:10:31)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
Object {
"loc": "1:0-33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
Object {
"message": " × Error: test unshift\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test unshift\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-shift.js:13:35)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test unshift\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-shift.js:13:35)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
],
"warnings": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
Object {
"message": " × Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-splice-1.js:10:39)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-splice-1.js:10:39)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
],
"warnings": Array [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
Object {
"message": " × Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-splice-2.js:10:39)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/error-test-splice-2.js:10:39)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
Object {
"loc": "1:0-33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
Object {
"message": " ⚠ Error: test push\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test push\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-push.js:10:33)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test push\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-push.js:10:33)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
Object {
"message": " ⚠ Module parse warning:\\n ╰─▶ ⚠ Unsupported feature: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 │ require.main.require('./file');\\n · ──────────────────────────────\\n ╰────\\n \\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
Object {
"message": " ⚠ Error: test unshift\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test unshift\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-shift.js:13:37)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test unshift\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-shift.js:13:37)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
Object {
"message": " ⚠ Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-1.js:10:41)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-1.js:10:41)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
Object {
"message": " ⚠ Error: test splice\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n │ at xxx\\n",
"moduleTrace": Array [],
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-2.js:10:41)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:458:41\\n at <cwd>packages/rspack/dist/Compiler.js:525:23",
"stack": "Error: test splice\\n at Object.fn (<cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-2.js:10:41)\\n at next (<cwd>packages/rspack-lite-tapable/dist/index.js:529:25)\\n at AsyncSeriesHook.callAsyncStageRange (<cwd>packages/rspack-lite-tapable/dist/index.js:549:9)\\n at AsyncSeriesHook.callAsync (<cwd>packages/rspack-lite-tapable/dist/index.js:88:21)\\n at <cwd>packages/rspack/dist/Compiler.js:459:41\\n at <cwd>packages/rspack/dist/Compiler.js:526:23",
},
Object {
"message": " ⚠ Module parse warning:\\n ╰─▶ ⚠ Unsupported feature: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 │ require.main.require('./file');\\n · ──────────────────────────────\\n ╰────\\n \\n",
Expand Down
2 changes: 2 additions & 0 deletions packages/rspack/etc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ export class Compiler {
// (undocumented)
root: Compiler;
// (undocumented)
rspack: typeof rspack;
// (undocumented)
run(callback: liteTapable.Callback<Error, Stats>): void;
// (undocumented)
runAsChild(callback: (err?: null | Error, entries?: Chunk[], compilation?: Compilation) => any): void;
Expand Down
2 changes: 2 additions & 0 deletions packages/rspack/src/Compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class Compiler {
};

webpack: typeof rspack;
rspack: typeof rspack;
name?: string;
parentCompilation?: Compilation;
root: Compiler;
Expand Down Expand Up @@ -210,6 +211,7 @@ class Compiler {
};

this.webpack = rspack;
this.rspack = rspack;
this.root = this;
this.outputPath = "";

Expand Down
Loading