Skip to content

Commit

Permalink
feat: deprecate Compilation API
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed May 14, 2024
1 parent f726b04 commit 197d391
Show file tree
Hide file tree
Showing 21 changed files with 161 additions and 281 deletions.
2 changes: 0 additions & 2 deletions crates/node_binding/binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ export interface JsStatsChunkGroupAsset {

export interface JsStatsError {
message: string
formatted: string
moduleIdentifier?: string
moduleName?: string
moduleId?: string
Expand Down Expand Up @@ -573,7 +572,6 @@ export interface JsStatsOptimizationBailout {

export interface JsStatsWarning {
message: string
formatted: string
moduleIdentifier?: string
moduleName?: string
moduleId?: string
Expand Down
4 changes: 0 additions & 4 deletions crates/rspack_binding_values/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use super::{JsCompilation, ToJsCompatSource};
#[derive(Debug)]
pub struct JsStatsError {
pub message: String,
pub formatted: String,
pub module_identifier: Option<String>,
pub module_name: Option<String>,
pub module_id: Option<String>,
Expand All @@ -24,7 +23,6 @@ impl From<rspack_core::StatsError> for JsStatsError {
fn from(stats: rspack_core::StatsError) -> Self {
Self {
message: stats.message,
formatted: stats.formatted,
module_identifier: stats.module_identifier,
module_name: stats.module_name,
module_id: stats.module_id,
Expand All @@ -35,7 +33,6 @@ impl From<rspack_core::StatsError> for JsStatsError {
#[napi(object)]
pub struct JsStatsWarning {
pub message: String,
pub formatted: String,
pub module_identifier: Option<String>,
pub module_name: Option<String>,
pub module_id: Option<String>,
Expand All @@ -45,7 +42,6 @@ impl From<rspack_core::StatsWarning> for JsStatsWarning {
fn from(stats: rspack_core::StatsWarning) -> Self {
Self {
message: stats.message,
formatted: stats.formatted,
module_identifier: stats.module_identifier,
module_name: stats.module_name,
module_id: stats.module_id,
Expand Down
8 changes: 0 additions & 8 deletions crates/rspack_core/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ impl Stats<'_> {
message: diagnostic_displayer
.emit_diagnostic(d)
.expect("should print diagnostics"),
formatted: diagnostic_displayer
.emit_diagnostic(d)
.expect("should print diagnostics"),
module_identifier: module_identifier.map(|i| i.to_string()),
module_name,
module_id: module_id.flatten(),
Expand Down Expand Up @@ -369,9 +366,6 @@ impl Stats<'_> {
message: diagnostic_displayer
.emit_diagnostic(d)
.expect("should print diagnostics"),
formatted: diagnostic_displayer
.emit_diagnostic(d)
.expect("should print diagnostics"),
module_identifier: module_identifier.map(|i| i.to_string()),
module_name,
module_id: module_id.flatten(),
Expand Down Expand Up @@ -703,7 +697,6 @@ fn get_stats_module_name_and_id(
#[derive(Debug)]
pub struct StatsError {
pub message: String,
pub formatted: String,
pub module_identifier: Option<String>,
pub module_name: Option<String>,
pub module_id: Option<String>,
Expand All @@ -712,7 +705,6 @@ pub struct StatsError {
#[derive(Debug)]
pub struct StatsWarning {
pub message: String,
pub formatted: String,
pub module_identifier: Option<String>,
pub module_name: Option<String>,
pub module_id: Option<String>,
Expand Down
1 change: 0 additions & 1 deletion packages/rspack-test-tools/tests/errorCases/error-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
expect(errors).toMatchInlineSnapshot(`
Array [
Object {
"formatted": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"index": 0,
"message": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"moduleId": "./resolve-fail-esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ module.exports = {
Object {
"errors": Array [
Object {
"formatted": " Γ— test push\\n",
"message": " Γ— test push\\n",
},
Object {
"formatted": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"message": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"moduleId": "./resolve-fail-esm/index.js",
"moduleIdentifier": "javascript/esm|<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module.exports = {
Object {
"errors": Array [
Object {
"formatted": " Γ— test unshift\\n",
"message": " Γ— test unshift\\n",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
Object {
"errors": Array [
Object {
"formatted": " Γ— test splice\\n",
"message": " Γ— test splice\\n",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ module.exports = {
Object {
"errors": Array [
Object {
"formatted": " Γ— test splice\\n",
"message": " Γ— test splice\\n",
},
Object {
"formatted": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"message": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"moduleId": "./resolve-fail-esm/index.js",
"moduleIdentifier": "javascript/esm|<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
Object {
"errors": Array [
Object {
"formatted": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"message": " Γ— Resolve error: Can't resolve './answer' in '<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm'\\n ╭────\\n 1 β”‚ import { answer } from './answer';\\n Β· ──────────\\n ╰────\\n help: Did you mean './answer.js'?\\n \\n The request './answer' failed to resolve only because it was resolved as fully specified,\\n probably because the origin is strict EcmaScript Module,\\n e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '\\"type\\": \\"module\\"'.\\n \\n The extension in the request is mandatory for it to be fully specified.\\n Add the extension to the request.\\n",
"moduleId": "./resolve-fail-esm/index.js",
"moduleIdentifier": "javascript/esm|<cwd>packages/rspack-test-tools/tests/fixtures/errors/resolve-fail-esm/index.js",
Expand Down
1 change: 0 additions & 1 deletion packages/rspack-test-tools/tests/errorCases/warning-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
expect(warnings).toMatchInlineSnapshot(`
Array [
Object {
"formatted": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"index": 0,
"message": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"moduleId": "./require.main.require.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ module.exports = {
"errors": Array [],
"warnings": Array [
Object {
"formatted": " ⚠ Error: test push\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-push.js:10:33\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
"message": " ⚠ Error: test push\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-push.js:10:33\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
},
Object {
"formatted": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"message": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"moduleId": "./require.main.require.js",
"moduleIdentifier": "<cwd>packages/rspack-test-tools/tests/fixtures/errors/require.main.require.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
"errors": Array [],
"warnings": Array [
Object {
"formatted": " ⚠ Error: test unshift\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-shift.js:13:37\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
"message": " ⚠ Error: test unshift\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-shift.js:13:37\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = {
"errors": Array [],
"warnings": Array [
Object {
"formatted": " ⚠ Error: test splice\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-1.js:10:41\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
"message": " ⚠ Error: test splice\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-1.js:10:41\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ module.exports = {
"errors": Array [],
"warnings": Array [
Object {
"formatted": " ⚠ Error: test splice\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-2.js:10:41\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
"message": " ⚠ Error: test splice\\n β”‚ at <cwd>packages/rspack-test-tools/tests/errorCases/warning-test-splice-2.js:10:41\\n β”‚ at Hook.eval [as callAsync] (eval at create (<cwd>node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\\n β”‚ at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (<cwd>node_modules/tapable/lib/Hook.js:18:14)\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:466:41\\n β”‚ at <cwd>packages/rspack/dist/Compiler.js:533:65\\n",
},
Object {
"formatted": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"message": " ⚠ Module parse warning:\\n ╰─▢ ⚠ Module parse failed: require.main.require() is not supported by Rspack.\\n ╭────\\n 1 β”‚ require.main.require('./file');\\n Β· ──────────────────────────────\\n ╰────\\n \\n",
"moduleId": "./require.main.require.js",
"moduleIdentifier": "<cwd>packages/rspack-test-tools/tests/fixtures/errors/require.main.require.js",
Expand Down
Loading

0 comments on commit 197d391

Please sign in to comment.