@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/dist/index.d.ts
CHANGED
|
@@ -1,207 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* https://github.com/microsoft/rushstack/blob/main/libraries/node-core-library/src/IPackageJson.ts
|
|
6
|
-
*
|
|
7
|
-
* MIT Licensed
|
|
8
|
-
* Copyright (c) Microsoft Corporation
|
|
9
|
-
* https://github.com/microsoft/rushstack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* This interface is part of the {@link IPackageJson} file format. It is used for the
|
|
13
|
-
* "dependencies", "optionalDependencies", and "devDependencies" fields.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
interface IPackageJsonDependencyTable {
|
|
17
|
-
/**
|
|
18
|
-
* The key is the name of a dependency. The value is a Semantic Versioning (SemVer)
|
|
19
|
-
* range specifier.
|
|
20
|
-
*/
|
|
21
|
-
[dependencyName: string]: string;
|
|
22
|
-
}
|
|
23
|
-
interface IPackageJsonRepository {
|
|
24
|
-
/**
|
|
25
|
-
* The source control type for the repository that hosts the project. This is typically "git".
|
|
26
|
-
*/
|
|
27
|
-
type: string;
|
|
28
|
-
/**
|
|
29
|
-
* The URL of the repository that hosts the project.
|
|
30
|
-
*/
|
|
31
|
-
url: string;
|
|
32
|
-
/**
|
|
33
|
-
* If the project does not exist at the root of the repository, its path is specified here.
|
|
34
|
-
*/
|
|
35
|
-
directory?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* This interface is part of the {@link IPackageJson} file format. It is used for the
|
|
39
|
-
* "scripts" field.
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
interface IPackageJsonScriptTable {
|
|
43
|
-
/**
|
|
44
|
-
* The key is the name of the script hook. The value is the script body which may
|
|
45
|
-
* be a file path or shell script command.
|
|
46
|
-
*/
|
|
47
|
-
[scriptName: string]: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* This interface is part of the {@link IPackageJson} file format. It is used for the
|
|
51
|
-
* "peerDependenciesMeta" field.
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
interface IPeerDependenciesMetaTable {
|
|
55
|
-
[dependencyName: string]: {
|
|
56
|
-
optional?: boolean;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
type ExportsModuleRules = string | Record<string, string> | Record<string, string | Record<string, string>>;
|
|
60
|
-
interface ExportsConfig {
|
|
61
|
-
[modulePath: string]: ExportsModuleRules;
|
|
62
|
-
}
|
|
63
|
-
interface INodePackageJson {
|
|
64
|
-
/**
|
|
65
|
-
* The name of the package.
|
|
66
|
-
*/
|
|
67
|
-
name: string;
|
|
68
|
-
/**
|
|
69
|
-
* A version number conforming to the Semantic Versioning (SemVer) standard.
|
|
70
|
-
*/
|
|
71
|
-
version?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Indicates whether this package is allowed to be published or not.
|
|
74
|
-
*/
|
|
75
|
-
private?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* A brief description of the package.
|
|
78
|
-
*/
|
|
79
|
-
description?: string;
|
|
80
|
-
/**
|
|
81
|
-
* The URL of the project's repository.
|
|
82
|
-
*/
|
|
83
|
-
repository?: string | IPackageJsonRepository;
|
|
84
|
-
/**
|
|
85
|
-
* The URL to the project's web page.
|
|
86
|
-
*/
|
|
87
|
-
homepage?: string;
|
|
88
|
-
/**
|
|
89
|
-
* The name of the license.
|
|
90
|
-
*/
|
|
91
|
-
license?: string;
|
|
92
|
-
/**
|
|
93
|
-
* The path to the module file that will act as the main entry point.
|
|
94
|
-
*/
|
|
95
|
-
main?: string;
|
|
96
|
-
exports?: ExportsConfig;
|
|
97
|
-
/**
|
|
98
|
-
* The path to the TypeScript *.d.ts file describing the module file
|
|
99
|
-
* that will act as the main entry point.
|
|
100
|
-
*/
|
|
101
|
-
types?: string;
|
|
102
|
-
/**
|
|
103
|
-
* Alias for `types`
|
|
104
|
-
*/
|
|
105
|
-
typings?: string;
|
|
106
|
-
/**
|
|
107
|
-
* The path to the TSDoc metadata file.
|
|
108
|
-
* This is still being standardized: https://github.com/microsoft/tsdoc/issues/7#issuecomment-442271815
|
|
109
|
-
* @beta
|
|
110
|
-
*/
|
|
111
|
-
tsdocMetadata?: string;
|
|
112
|
-
/**
|
|
113
|
-
* The main entry point for the package.
|
|
114
|
-
*/
|
|
115
|
-
bin?: string;
|
|
116
|
-
/**
|
|
117
|
-
* An array of dependencies that must always be installed for this package.
|
|
118
|
-
*/
|
|
119
|
-
dependencies?: IPackageJsonDependencyTable;
|
|
120
|
-
/**
|
|
121
|
-
* An array of optional dependencies that may be installed for this package.
|
|
122
|
-
*/
|
|
123
|
-
optionalDependencies?: IPackageJsonDependencyTable;
|
|
124
|
-
/**
|
|
125
|
-
* An array of dependencies that must only be installed for developers who will
|
|
126
|
-
* build this package.
|
|
127
|
-
*/
|
|
128
|
-
devDependencies?: IPackageJsonDependencyTable;
|
|
129
|
-
/**
|
|
130
|
-
* An array of dependencies that must be installed by a consumer of this package,
|
|
131
|
-
* but which will not be automatically installed by this package.
|
|
132
|
-
*/
|
|
133
|
-
peerDependencies?: IPackageJsonDependencyTable;
|
|
134
|
-
/**
|
|
135
|
-
* An array of metadata about peer dependencies.
|
|
136
|
-
*/
|
|
137
|
-
peerDependenciesMeta?: IPeerDependenciesMetaTable;
|
|
138
|
-
/**
|
|
139
|
-
* A table of script hooks that a package manager or build tool may invoke.
|
|
140
|
-
*/
|
|
141
|
-
scripts?: IPackageJsonScriptTable;
|
|
142
|
-
/**
|
|
143
|
-
* A table of package version resolutions. This feature is only implemented by the Yarn package manager.
|
|
144
|
-
*
|
|
145
|
-
* @remarks
|
|
146
|
-
* See the {@link https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md
|
|
147
|
-
* | 0000-selective-versions-resolutions.md RFC} for details.
|
|
148
|
-
*/
|
|
149
|
-
resolutions?: Record<string, string>;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
declare class Project {
|
|
153
|
-
#private;
|
|
154
|
-
name: string;
|
|
155
|
-
dir: string;
|
|
156
|
-
metaData: INodePackageJson;
|
|
157
|
-
constructor(name: string, dir: string);
|
|
158
|
-
init(): Promise<void>;
|
|
159
|
-
getMetaData(): INodePackageJson;
|
|
160
|
-
getDependentProjects(monorepoProjects: Project[], options?: {
|
|
161
|
-
recursive?: boolean;
|
|
162
|
-
}): Project[];
|
|
163
|
-
getDirectDependentProjects(allProjectMap: Map<string, Project>): Project[];
|
|
164
|
-
getSourceEntryPaths(options?: {
|
|
165
|
-
field?: string;
|
|
166
|
-
exports?: boolean;
|
|
167
|
-
}): string[];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
interface IMonorepoBaseData {
|
|
171
|
-
isMonorepo: boolean;
|
|
172
|
-
type: string;
|
|
173
|
-
rootPath: string;
|
|
174
|
-
getProjects?: GetProjectsFunc;
|
|
175
|
-
}
|
|
176
|
-
declare const getMonorepoBaseData: (starFindPath: string, otherMonorepoAnalyzer?: Record<string, MonorepoAnalyzer>) => Promise<IMonorepoBaseData>;
|
|
177
|
-
|
|
178
|
-
type GetProjectsFunc = (rootPath: string) => Promise<Project[]> | Project[];
|
|
179
|
-
declare const getMonorepoSubProjects: (monorepoBaseData: IMonorepoBaseData) => Promise<Project[]>;
|
|
180
|
-
|
|
181
|
-
type IsMonorepoFn = (monorepoRootPath: string) => Promise<boolean> | boolean;
|
|
182
|
-
|
|
183
|
-
interface MonorepoAnalyzer {
|
|
184
|
-
check: IsMonorepoFn;
|
|
185
|
-
getProjects: GetProjectsFunc;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
type ExtraMonorepoStrategies = Record<string, MonorepoAnalyzer>;
|
|
189
|
-
|
|
190
|
-
declare const PLUGIN_SOURCE_BUILD_NAME = "rsbuild:source-build";
|
|
191
|
-
interface PluginSourceBuildOptions {
|
|
192
|
-
/**
|
|
193
|
-
* Used to configure the resolve field of the source code files.
|
|
194
|
-
* @default 'source''
|
|
195
|
-
*/
|
|
196
|
-
sourceField?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Whether to read source code or output code first.
|
|
199
|
-
* @default 'source'
|
|
200
|
-
*/
|
|
201
|
-
resolvePriority?: 'source' | 'output';
|
|
202
|
-
projectName?: string;
|
|
203
|
-
extraMonorepoStrategies?: ExtraMonorepoStrategies;
|
|
204
|
-
}
|
|
205
|
-
declare function pluginSourceBuild(options?: PluginSourceBuildOptions): RsbuildPlugin;
|
|
206
|
-
|
|
207
|
-
export { type MonorepoAnalyzer, PLUGIN_SOURCE_BUILD_NAME, type PluginSourceBuildOptions, Project, getMonorepoBaseData, getMonorepoSubProjects, pluginSourceBuild };
|
|
1
|
+
export { PLUGIN_SOURCE_BUILD_NAME, pluginSourceBuild, type PluginSourceBuildOptions, } from './plugin.js';
|
|
2
|
+
export { Project } from './project.js';
|
|
3
|
+
export { getMonorepoBaseData, getMonorepoSubProjects } from './common/index.js';
|
|
4
|
+
export type { MonorepoAnalyzer } from './types/index.js';
|