@rsbuild/plugin-source-build 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/README.zh-CN.md +11 -4
- package/dist/common/getBaseData.d.ts +9 -0
- package/dist/common/getProjects.d.ts +4 -0
- package/dist/common/index.d.ts +6 -0
- package/dist/common/isMonorepo.d.ts +8 -0
- package/dist/common/pnpm.d.ts +2 -0
- package/dist/common/rush.d.ts +2 -0
- package/dist/constants.d.ts +3 -0
- package/dist/index.cjs +442 -522
- package/dist/index.d.ts +4 -207
- package/dist/index.js +363 -485
- package/dist/plugin.d.ts +23 -0
- package/dist/project-utils/filter.d.ts +4 -0
- package/dist/project-utils/getDependentProjects.d.ts +12 -0
- package/dist/project-utils/index.d.ts +2 -0
- package/dist/project.d.ts +18 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/{index.d.cts → types/packageJson.d.ts} +10 -65
- package/dist/types/rushJson.d.ts +7 -0
- package/dist/utils.d.ts +4 -0
- package/package.json +27 -25
package/README.md
CHANGED
|
@@ -136,13 +136,10 @@ Project reference provides the following capabilities:
|
|
|
136
136
|
|
|
137
137
|
### Example
|
|
138
138
|
|
|
139
|
-
In the example mentioned earlier, since the app project references the lib sub-project, we need to configure the `
|
|
139
|
+
In the example mentioned earlier, since the app project references the lib sub-project, we need to configure the `references` options in the app project's `tsconfig.json` to point to the relative directory of the lib:
|
|
140
140
|
|
|
141
141
|
```json title="app/tsconfig.json"
|
|
142
142
|
{
|
|
143
|
-
"compilerOptions": {
|
|
144
|
-
"composite": true
|
|
145
|
-
},
|
|
146
143
|
"references": [
|
|
147
144
|
{
|
|
148
145
|
"path": "../lib"
|
|
@@ -151,6 +148,16 @@ In the example mentioned earlier, since the app project references the lib sub-p
|
|
|
151
148
|
}
|
|
152
149
|
```
|
|
153
150
|
|
|
151
|
+
At the same time, we need to set `composite` to `true` in the lib project's `tsconfig.json`:
|
|
152
|
+
|
|
153
|
+
```json title="lib/A/tsconfig.json"
|
|
154
|
+
{
|
|
155
|
+
"compilerOptions": {
|
|
156
|
+
"composite": true
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
154
161
|
After adding these two options, the project reference is already configured. You can restart VS Code to see the effects of the configuration.
|
|
155
162
|
|
|
156
163
|
Note that the above example is a simplified one. In real monorepo projects, there may be more complex dependency relationships. You need to add a complete `references` configuration for the functionality to work correctly.
|
package/README.zh-CN.md
CHANGED
|
@@ -134,13 +134,10 @@ Project reference 提供了以下能力:
|
|
|
134
134
|
|
|
135
135
|
### 示例
|
|
136
136
|
|
|
137
|
-
在上文的例子中,由于 app 引用了 lib 子项目,我们需要在 app 的 `tsconfig.json` 内配置 `
|
|
137
|
+
在上文的例子中,由于 app 引用了 lib 子项目,我们需要在 app 的 `tsconfig.json` 内配置 `references`,并指向 lib 对应的相对目录:
|
|
138
138
|
|
|
139
139
|
```json title="app/tsconfig.json"
|
|
140
140
|
{
|
|
141
|
-
"compilerOptions": {
|
|
142
|
-
"composite": true
|
|
143
|
-
},
|
|
144
141
|
"references": [
|
|
145
142
|
{
|
|
146
143
|
"path": "../lib"
|
|
@@ -149,6 +146,16 @@ Project reference 提供了以下能力:
|
|
|
149
146
|
}
|
|
150
147
|
```
|
|
151
148
|
|
|
149
|
+
同时,需要在 lib 子项目的 `tsconfig.json` 内配置 `composite` 为 `true`:
|
|
150
|
+
|
|
151
|
+
```json title="lib/A/tsconfig.json"
|
|
152
|
+
{
|
|
153
|
+
"compilerOptions": {
|
|
154
|
+
"composite": true
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
152
159
|
添加以上两个选项后,project reference 就已经配置完成了,你可以重新启动 VS Code 来查看配置以后的效果。
|
|
153
160
|
|
|
154
161
|
注意以上只是一个最简单的例子,在实际的 monorepo 项目中,可能会有更复杂的依赖关系,你需要添加完整的 `references` 配置,才能使上述功能正确运作。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MonorepoAnalyzer } from '../types/index.js';
|
|
2
|
+
import type { GetProjectsFunc } from './getProjects.js';
|
|
3
|
+
export interface IMonorepoBaseData {
|
|
4
|
+
isMonorepo: boolean;
|
|
5
|
+
type: string;
|
|
6
|
+
rootPath: string;
|
|
7
|
+
getProjects?: GetProjectsFunc;
|
|
8
|
+
}
|
|
9
|
+
export declare const getMonorepoBaseData: (starFindPath: string, otherMonorepoAnalyzer?: Record<string, MonorepoAnalyzer>) => Promise<IMonorepoBaseData>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Project } from '../project.js';
|
|
2
|
+
import type { IMonorepoBaseData } from './getBaseData.js';
|
|
3
|
+
export type GetProjectsFunc = (rootPath: string) => Promise<Project[]> | Project[];
|
|
4
|
+
export declare const getMonorepoSubProjects: (monorepoBaseData: IMonorepoBaseData) => Promise<Project[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './getBaseData.js';
|
|
2
|
+
export * from './isMonorepo.js';
|
|
3
|
+
export { getMonorepoSubProjects } from './getProjects.js';
|
|
4
|
+
export { getProjects as getPnpmMonorepoSubProjects } from './pnpm.js';
|
|
5
|
+
export { getProjects as getRushMonorepoSubProjects } from './rush.js';
|
|
6
|
+
export type { GetProjectsFunc } from './getProjects.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type IsMonorepoFn = (monorepoRootPath: string) => Promise<boolean> | boolean;
|
|
2
|
+
export type IsMonorepoResult = {
|
|
3
|
+
isMonorepo: boolean;
|
|
4
|
+
type: 'rush' | 'pnpm' | string;
|
|
5
|
+
};
|
|
6
|
+
export declare const isPnpmMonorepo: IsMonorepoFn;
|
|
7
|
+
export declare const isRushMonorepo: IsMonorepoFn;
|
|
8
|
+
export declare const isMonorepo: (monorepoRootPath: string, otherMonorepoChecks?: Record<string, IsMonorepoFn>) => Promise<IsMonorepoResult>;
|