Skip to content

Commit

Permalink
chore: mark compiler.compile as private method (#9472)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Feb 26, 2025
1 parent 9e378b1 commit a04609d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 41 deletions.
1 change: 0 additions & 1 deletion packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,6 @@ export class Compiler {
cache: Cache_2;
// (undocumented)
close(callback: (error?: Error | null) => void): void;
// (undocumented)
compile(callback: liteTapable.Callback<Error, Compilation>): void;
// (undocumented)
compilerPath: string;
Expand Down
5 changes: 5 additions & 0 deletions packages/rspack/src/Compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,11 @@ class Compiler {
return !isRoot;
}

/**
* Create a compilation and run it, which is the basic method that `compiler.run` and `compiler.watch` depend on.
* TODO: make this method private in the next major release
* @private this method is only used in Rspack core
*/
compile(callback: liteTapable.Callback<Error, Compilation>) {
const startTime = Date.now();
const params = this.#newCompilationParams();
Expand Down
20 changes: 0 additions & 20 deletions website/docs/en/api/javascript-api/compiler.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,6 @@ The Watching object provides the following methods:
</CollapsePanel>
</Collapse>

### compile

Create a compilation and run it, which is the basic method that `compiler.run` and `compiler.watch` depend on.

```ts
compile(
callback: (compilation: Compilation) => void // callback after this compilation
): void
```

<Collapse>
<CollapsePanel
className="collapse-code-panel"
header="Compilation.ts"
key="Compilation"
>
<CompilationType />
</CollapsePanel>
</Collapse>

### close

Close the current compiler, and handle low-priority tasks such as caching during this period.
Expand Down
20 changes: 0 additions & 20 deletions website/docs/zh/api/javascript-api/compiler.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,6 @@ Watching 对象提供如下方法:
</CollapsePanel>
</Collapse>

### compile

创建 Compilation 并执行编译流程,是 `compiler.run``compiler.watch` 依赖的底层方法。

```ts
function compile(
callback: (compilation: Compilation) => void, // 编译流程完成后回调
): void;
```

<Collapse>
<CollapsePanel
className="collapse-code-panel"
header="Compilation.ts"
key="Compilation"
>
<CompilationType />
</CollapsePanel>
</Collapse>

### close

关闭当前构建器,在此期间处理低优先级任务,如缓存等。
Expand Down

2 comments on commit a04609d

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on a04609d Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2025-02-26 50bdb20) Current Change
10000_big_production-mode_disable-minimize + exec 36.8 s ± 476 ms 37.5 s ± 582 ms +1.72 %
10000_development-mode + exec 1.7 s ± 20 ms 1.72 s ± 65 ms +1.39 %
10000_development-mode_hmr + exec 674 ms ± 19 ms 673 ms ± 12 ms -0.15 %
10000_production-mode + exec 2.21 s ± 66 ms 2.18 s ± 111 ms -1.59 %
10000_production-mode_persistent-cold + exec 2.34 s ± 55 ms 2.36 s ± 169 ms +0.85 %
10000_production-mode_persistent-hot + exec 1.62 s ± 60 ms 1.64 s ± 53 ms +1.24 %
arco-pro_development-mode + exec 1.71 s ± 122 ms 1.75 s ± 118 ms +2.17 %
arco-pro_development-mode_hmr + exec 375 ms ± 2.1 ms 376 ms ± 3.3 ms +0.40 %
arco-pro_production-mode + exec 3.55 s ± 173 ms 3.56 s ± 108 ms +0.25 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.64 s ± 178 ms 3.61 s ± 169 ms -0.97 %
arco-pro_production-mode_persistent-cold + exec 3.66 s ± 57 ms 3.58 s ± 203 ms -2.21 %
arco-pro_production-mode_persistent-hot + exec 2.24 s ± 125 ms 2.33 s ± 97 ms +3.88 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.61 s ± 181 ms 3.54 s ± 188 ms -1.87 %
large-dyn-imports_development-mode + exec 1.96 s ± 22 ms 1.96 s ± 41 ms +0.11 %
large-dyn-imports_production-mode + exec 2.02 s ± 29 ms 2.03 s ± 18 ms +0.57 %
threejs_development-mode_10x + exec 1.45 s ± 43 ms 1.45 s ± 36 ms +0.54 %
threejs_development-mode_10x_hmr + exec 786 ms ± 8.4 ms 814 ms ± 19 ms +3.63 %
threejs_production-mode_10x + exec 5.04 s ± 169 ms 5.08 s ± 57 ms +0.97 %
threejs_production-mode_10x_persistent-cold + exec 5.15 s ± 294 ms 5.09 s ± 78 ms -1.08 %
threejs_production-mode_10x_persistent-hot + exec 4.46 s ± 215 ms 4.47 s ± 304 ms +0.15 %
10000_big_production-mode_disable-minimize + rss memory 8667 MiB ± 41.1 MiB 8697 MiB ± 84.7 MiB +0.34 %
10000_development-mode + rss memory 655 MiB ± 19.2 MiB 676 MiB ± 32.8 MiB +3.31 %
10000_development-mode_hmr + rss memory 1201 MiB ± 64.3 MiB 1370 MiB ± 166 MiB +14.08 %
10000_production-mode + rss memory 617 MiB ± 6.87 MiB 645 MiB ± 32.9 MiB +4.46 %
10000_production-mode_persistent-cold + rss memory 732 MiB ± 6 MiB 753 MiB ± 25.2 MiB +2.93 %
10000_production-mode_persistent-hot + rss memory 699 MiB ± 31.9 MiB 734 MiB ± 22.8 MiB +5.04 %
arco-pro_development-mode + rss memory 571 MiB ± 31 MiB 589 MiB ± 31.7 MiB +3.18 %
arco-pro_development-mode_hmr + rss memory 650 MiB ± 51.6 MiB 680 MiB ± 61.4 MiB +4.74 %
arco-pro_production-mode + rss memory 709 MiB ± 41.3 MiB 726 MiB ± 30.5 MiB +2.42 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 725 MiB ± 15.4 MiB 737 MiB ± 23 MiB +1.64 %
arco-pro_production-mode_persistent-cold + rss memory 804 MiB ± 25.7 MiB 797 MiB ± 17.4 MiB -0.86 %
arco-pro_production-mode_persistent-hot + rss memory 655 MiB ± 23.2 MiB 685 MiB ± 19.9 MiB +4.55 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 731 MiB ± 23.4 MiB 733 MiB ± 24.1 MiB +0.27 %
large-dyn-imports_development-mode + rss memory 650 MiB ± 5.99 MiB 671 MiB ± 8.23 MiB +3.31 %
large-dyn-imports_production-mode + rss memory 529 MiB ± 6.89 MiB 556 MiB ± 13.2 MiB +5.04 %
threejs_development-mode_10x + rss memory 571 MiB ± 14.4 MiB 567 MiB ± 25.2 MiB -0.64 %
threejs_development-mode_10x_hmr + rss memory 1212 MiB ± 166 MiB 1215 MiB ± 133 MiB +0.32 %
threejs_production-mode_10x + rss memory 858 MiB ± 32.6 MiB 861 MiB ± 35 MiB +0.31 %
threejs_production-mode_10x_persistent-cold + rss memory 963 MiB ± 58.5 MiB 963 MiB ± 45.5 MiB +0.04 %
threejs_production-mode_10x_persistent-hot + rss memory 815 MiB ± 40.3 MiB 821 MiB ± 35 MiB +0.65 %

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on a04609d Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rspress ✅ success
rslib ❌ failure
rsbuild ✅ success
rsdoctor ❌ failure
examples ✅ success
devserver ✅ success
nuxt ✅ success

Please sign in to comment.