@savvy-web/rslib-builder 0.4.0 → 0.5.0
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 +0 -6
- package/index.d.ts +555 -7
- package/index.js +17 -25
- package/package.json +12 -18
- package/tsconfig/ecma/lib.json +1 -1
package/README.md
CHANGED
|
@@ -50,12 +50,6 @@ Install the required peer dependencies:
|
|
|
50
50
|
pnpm add -D @rslib/core @microsoft/api-extractor @typescript/native-preview
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
For TSDoc validation (optional):
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pnpm add -D eslint @typescript-eslint/parser eslint-plugin-tsdoc
|
|
57
|
-
```
|
|
58
|
-
|
|
59
53
|
## Quick Start
|
|
60
54
|
|
|
61
55
|
Extend the provided tsconfig for optimal settings:
|
package/index.d.ts
CHANGED
|
@@ -40,9 +40,7 @@
|
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
import type { ConfigParams } from '@rslib/core';
|
|
43
|
-
import type { PackageJson } from 'type-fest';
|
|
44
43
|
import type { PathLike } from 'node:fs';
|
|
45
|
-
import type { RawCopyPattern } from '@rspack/binding';
|
|
46
44
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
47
45
|
import type { RslibConfig } from '@rslib/core';
|
|
48
46
|
import type { SourceConfig } from '@rsbuild/core';
|
|
@@ -228,6 +226,52 @@ export declare interface AutoEntryPluginOptions {
|
|
|
228
226
|
*/
|
|
229
227
|
export declare type BuildTarget = "dev" | "npm";
|
|
230
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Configuration for copying files during the build process.
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* This interface mirrors rspack's copy pattern configuration and is passed directly
|
|
234
|
+
* to the rspack CopyPlugin. All properties except `from` are optional.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* // Copy a directory
|
|
239
|
+
* { from: "./public", to: "./", context: process.cwd() }
|
|
240
|
+
*
|
|
241
|
+
* // Copy specific files
|
|
242
|
+
* { from: "**\/*.json", to: "./config" }
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
export declare interface CopyPatternConfig {
|
|
248
|
+
/** Source path or glob pattern to copy from */
|
|
249
|
+
from: string;
|
|
250
|
+
/** Destination path (relative to output directory) */
|
|
251
|
+
to?: string;
|
|
252
|
+
/** Base directory for resolving `from` path */
|
|
253
|
+
context?: string;
|
|
254
|
+
/** Type of destination: "dir", "file", or "template" */
|
|
255
|
+
toType?: "dir" | "file" | "template";
|
|
256
|
+
/** If true, does not emit an error if the source is missing */
|
|
257
|
+
noErrorOnMissing?: boolean;
|
|
258
|
+
/** Glob options for pattern matching */
|
|
259
|
+
globOptions?: {
|
|
260
|
+
/** Patterns to ignore */
|
|
261
|
+
ignore?: string[];
|
|
262
|
+
/** Whether to match dotfiles */
|
|
263
|
+
dot?: boolean;
|
|
264
|
+
};
|
|
265
|
+
/** Filter function to include/exclude files */
|
|
266
|
+
filter?: (filepath: string) => boolean | Promise<boolean>;
|
|
267
|
+
/** Transform function to modify file contents */
|
|
268
|
+
transform?: {
|
|
269
|
+
transformer: (input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>;
|
|
270
|
+
} | ((input: Buffer, absoluteFilename: string) => string | Buffer | Promise<string> | Promise<Buffer>);
|
|
271
|
+
/** Priority for conflicting files (higher = higher priority) */
|
|
272
|
+
priority?: number;
|
|
273
|
+
}
|
|
274
|
+
|
|
231
275
|
/**
|
|
232
276
|
* Plugin to generate TypeScript declaration files using tsgo and emit them through Rslib's asset pipeline.
|
|
233
277
|
*
|
|
@@ -827,6 +871,71 @@ export declare interface ImportGraphResult {
|
|
|
827
871
|
errors: ImportGraphError[];
|
|
828
872
|
}
|
|
829
873
|
|
|
874
|
+
/**
|
|
875
|
+
* Matches a JSON array.
|
|
876
|
+
*
|
|
877
|
+
* @public
|
|
878
|
+
*/
|
|
879
|
+
export declare type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Matches a JSON object.
|
|
883
|
+
*
|
|
884
|
+
* @remarks
|
|
885
|
+
* This type can be useful to enforce some input to be JSON-compatible or as a
|
|
886
|
+
* super-type to be extended from.
|
|
887
|
+
*
|
|
888
|
+
* @public
|
|
889
|
+
*/
|
|
890
|
+
export declare type JsonObject = {
|
|
891
|
+
[Key in string]: JsonValue;
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Package.json type definitions.
|
|
896
|
+
*
|
|
897
|
+
* @remarks
|
|
898
|
+
* This is a local copy of type-fest's PackageJson types with TSDoc fixes.
|
|
899
|
+
* Original source: https://github.com/sindresorhus/type-fest
|
|
900
|
+
*
|
|
901
|
+
* TSDoc fixes applied:
|
|
902
|
+
* - Added deprecation messages to `@deprecated` tags
|
|
903
|
+
* - Fixed code fence formatting in `packageManager` docs
|
|
904
|
+
*
|
|
905
|
+
*/
|
|
906
|
+
/**
|
|
907
|
+
* Matches any valid JSON primitive value.
|
|
908
|
+
*
|
|
909
|
+
* @public
|
|
910
|
+
*/
|
|
911
|
+
export declare type JsonPrimitive = string | number | boolean | null;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Matches any valid JSON value.
|
|
915
|
+
*
|
|
916
|
+
* @public
|
|
917
|
+
*/
|
|
918
|
+
export declare type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Allows creating a union type by combining primitive types and literal types
|
|
922
|
+
* without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
923
|
+
*
|
|
924
|
+
* @remarks
|
|
925
|
+
* Currently, when a union type of a primitive type is combined with literal types,
|
|
926
|
+
* TypeScript loses all information about the combined literals. Thus, when such
|
|
927
|
+
* type is used in an IDE with autocompletion, no suggestions are made for the
|
|
928
|
+
* declared literals.
|
|
929
|
+
*
|
|
930
|
+
* This type is a workaround for Microsoft/TypeScript#29729.
|
|
931
|
+
*
|
|
932
|
+
* @typeParam LiteralType - The literal type(s) to include
|
|
933
|
+
* @typeParam BaseType - The base primitive type
|
|
934
|
+
*
|
|
935
|
+
* @public
|
|
936
|
+
*/
|
|
937
|
+
declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
938
|
+
|
|
830
939
|
/**
|
|
831
940
|
* Builder for Node.js ESM libraries using RSlib.
|
|
832
941
|
*
|
|
@@ -929,7 +1038,7 @@ export declare interface NodeLibraryBuilderOptions {
|
|
|
929
1038
|
* ```
|
|
930
1039
|
*/
|
|
931
1040
|
exportsAsIndexes?: boolean;
|
|
932
|
-
copyPatterns: (string |
|
|
1041
|
+
copyPatterns: (string | CopyPatternConfig)[];
|
|
933
1042
|
/** Additional plugins */
|
|
934
1043
|
plugins: RsbuildPlugin[];
|
|
935
1044
|
define: SourceConfig["define"];
|
|
@@ -1103,6 +1212,433 @@ export declare interface NodeLibraryBuilderOptions {
|
|
|
1103
1212
|
tsdocLint?: TsDocLintPluginOptions | boolean;
|
|
1104
1213
|
}
|
|
1105
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* PackageJson namespace containing all sub-types.
|
|
1217
|
+
*
|
|
1218
|
+
* @public
|
|
1219
|
+
*/
|
|
1220
|
+
export declare namespace PackageJson {
|
|
1221
|
+
/**
|
|
1222
|
+
* A person who has been involved in creating or maintaining the package.
|
|
1223
|
+
*/
|
|
1224
|
+
export type Person = string | {
|
|
1225
|
+
name: string;
|
|
1226
|
+
url?: string;
|
|
1227
|
+
email?: string;
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* Location for reporting bugs.
|
|
1231
|
+
*/
|
|
1232
|
+
export type BugsLocation = string | {
|
|
1233
|
+
/** The URL to the package's issue tracker. */
|
|
1234
|
+
url?: string;
|
|
1235
|
+
/** The email address to which issues should be reported. */
|
|
1236
|
+
email?: string;
|
|
1237
|
+
};
|
|
1238
|
+
/**
|
|
1239
|
+
* Directory locations within the package.
|
|
1240
|
+
*/
|
|
1241
|
+
export interface DirectoryLocations {
|
|
1242
|
+
[directoryType: string]: JsonValue | undefined;
|
|
1243
|
+
/** Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder. */
|
|
1244
|
+
bin?: string;
|
|
1245
|
+
/** Location for Markdown files. */
|
|
1246
|
+
doc?: string;
|
|
1247
|
+
/** Location for example scripts. */
|
|
1248
|
+
example?: string;
|
|
1249
|
+
/** Location for the bulk of the library. */
|
|
1250
|
+
lib?: string;
|
|
1251
|
+
/** Location for man pages. Sugar to generate a `man` array by walking the folder. */
|
|
1252
|
+
man?: string;
|
|
1253
|
+
/** Location for test files. */
|
|
1254
|
+
test?: string;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Script commands that are run at various times in the lifecycle of the package.
|
|
1258
|
+
*/
|
|
1259
|
+
export type Scripts = {
|
|
1260
|
+
/** Run before the package is published (Also run on local `npm install` without any arguments). */
|
|
1261
|
+
prepublish?: string;
|
|
1262
|
+
/** Run both before the package is packed and published, and on local `npm install` without any arguments. */
|
|
1263
|
+
prepare?: string;
|
|
1264
|
+
/** Run before the package is prepared and packed, only on `npm publish`. */
|
|
1265
|
+
prepublishOnly?: string;
|
|
1266
|
+
/** Run before a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies). */
|
|
1267
|
+
prepack?: string;
|
|
1268
|
+
/** Run after the tarball has been generated and moved to its final destination. */
|
|
1269
|
+
postpack?: string;
|
|
1270
|
+
/** Run after the package is published. */
|
|
1271
|
+
publish?: string;
|
|
1272
|
+
/** Run after the package is published. */
|
|
1273
|
+
postpublish?: string;
|
|
1274
|
+
/** Run before the package is installed. */
|
|
1275
|
+
preinstall?: string;
|
|
1276
|
+
/** Run after the package is installed. */
|
|
1277
|
+
install?: string;
|
|
1278
|
+
/** Run after the package is installed and after `install`. */
|
|
1279
|
+
postinstall?: string;
|
|
1280
|
+
/** Run before the package is uninstalled and before `uninstall`. */
|
|
1281
|
+
preuninstall?: string;
|
|
1282
|
+
/** Run before the package is uninstalled. */
|
|
1283
|
+
uninstall?: string;
|
|
1284
|
+
/** Run after the package is uninstalled. */
|
|
1285
|
+
postuninstall?: string;
|
|
1286
|
+
/** Run before bump the package version and before `version`. */
|
|
1287
|
+
preversion?: string;
|
|
1288
|
+
/** Run before bump the package version. */
|
|
1289
|
+
version?: string;
|
|
1290
|
+
/** Run after bump the package version. */
|
|
1291
|
+
postversion?: string;
|
|
1292
|
+
/** Run with the `npm test` command, before `test`. */
|
|
1293
|
+
pretest?: string;
|
|
1294
|
+
/** Run with the `npm test` command. */
|
|
1295
|
+
test?: string;
|
|
1296
|
+
/** Run with the `npm test` command, after `test`. */
|
|
1297
|
+
posttest?: string;
|
|
1298
|
+
/** Run with the `npm stop` command, before `stop`. */
|
|
1299
|
+
prestop?: string;
|
|
1300
|
+
/** Run with the `npm stop` command. */
|
|
1301
|
+
stop?: string;
|
|
1302
|
+
/** Run with the `npm stop` command, after `stop`. */
|
|
1303
|
+
poststop?: string;
|
|
1304
|
+
/** Run with the `npm start` command, before `start`. */
|
|
1305
|
+
prestart?: string;
|
|
1306
|
+
/** Run with the `npm start` command. */
|
|
1307
|
+
start?: string;
|
|
1308
|
+
/** Run with the `npm start` command, after `start`. */
|
|
1309
|
+
poststart?: string;
|
|
1310
|
+
/** Run with the `npm restart` command, before `restart`. */
|
|
1311
|
+
prerestart?: string;
|
|
1312
|
+
/** Run with the `npm restart` command. */
|
|
1313
|
+
restart?: string;
|
|
1314
|
+
/** Run with the `npm restart` command, after `restart`. */
|
|
1315
|
+
postrestart?: string;
|
|
1316
|
+
} & Partial<Record<string, string>>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Dependencies of the package. The version range is a string which has one or
|
|
1319
|
+
* more space-separated descriptors.
|
|
1320
|
+
*/
|
|
1321
|
+
export type Dependency = Partial<Record<string, string>>;
|
|
1322
|
+
/**
|
|
1323
|
+
* Recursive map describing selective dependency version overrides supported by npm.
|
|
1324
|
+
*/
|
|
1325
|
+
export type DependencyOverrides = {
|
|
1326
|
+
[packageName in string]: string | undefined | DependencyOverrides;
|
|
1327
|
+
};
|
|
1328
|
+
/**
|
|
1329
|
+
* Specifies requirements for development environment components.
|
|
1330
|
+
*/
|
|
1331
|
+
export interface DevEngineDependency {
|
|
1332
|
+
name: string;
|
|
1333
|
+
version?: string;
|
|
1334
|
+
onFail?: "ignore" | "warn" | "error" | "download";
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* A mapping of conditions and the paths to which they resolve.
|
|
1338
|
+
*/
|
|
1339
|
+
export interface ExportConditions {
|
|
1340
|
+
[condition: string]: Exports;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Entry points of a module, optionally with conditions and subpath exports.
|
|
1344
|
+
*/
|
|
1345
|
+
export type Exports = null | string | Array<string | ExportConditions> | ExportConditions;
|
|
1346
|
+
/**
|
|
1347
|
+
* Import map entries of a module, optionally with conditions and subpath imports.
|
|
1348
|
+
*/
|
|
1349
|
+
export interface Imports {
|
|
1350
|
+
[key: `#${string}`]: Exports;
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Non-standard entry point fields used by various bundlers.
|
|
1354
|
+
*/
|
|
1355
|
+
export interface NonStandardEntryPoints {
|
|
1356
|
+
/** An ECMAScript module ID that is the primary entry point to the program. */
|
|
1357
|
+
module?: string;
|
|
1358
|
+
/** A module ID with untranspiled code that is the primary entry point to the program. */
|
|
1359
|
+
esnext?: string | {
|
|
1360
|
+
[moduleName: string]: string | undefined;
|
|
1361
|
+
main?: string;
|
|
1362
|
+
browser?: string;
|
|
1363
|
+
};
|
|
1364
|
+
/** A hint to JavaScript bundlers or component tools when packaging modules for client side use. */
|
|
1365
|
+
browser?: string | Partial<Record<string, string | false>>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
|
|
1368
|
+
*
|
|
1369
|
+
* @see {@link https://webpack.js.org/guides/tree-shaking/ | Webpack Tree Shaking}
|
|
1370
|
+
*/
|
|
1371
|
+
sideEffects?: boolean | string[];
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* TypeScript-specific configuration fields.
|
|
1375
|
+
*/
|
|
1376
|
+
export interface TypeScriptConfiguration {
|
|
1377
|
+
/** Location of the bundled TypeScript declaration file. */
|
|
1378
|
+
types?: string;
|
|
1379
|
+
/** Version selection map of TypeScript. */
|
|
1380
|
+
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
|
|
1381
|
+
/** Location of the bundled TypeScript declaration file. Alias of `types`. */
|
|
1382
|
+
typings?: string;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* An alternative configuration for workspaces.
|
|
1386
|
+
*/
|
|
1387
|
+
export interface WorkspaceConfig {
|
|
1388
|
+
/** An array of workspace pattern strings which contain the workspace packages. */
|
|
1389
|
+
packages?: WorkspacePattern[];
|
|
1390
|
+
/**
|
|
1391
|
+
* Designed to solve the problem of packages which break when their `node_modules`
|
|
1392
|
+
* are moved to the root workspace directory - a process known as hoisting.
|
|
1393
|
+
*
|
|
1394
|
+
* @see {@link https://classic.yarnpkg.com/blog/2018/02/15/nohoist/ | Yarn nohoist}
|
|
1395
|
+
*/
|
|
1396
|
+
nohoist?: WorkspacePattern[];
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* A workspace pattern points to a directory or group of directories which
|
|
1400
|
+
* contain packages that should be included in the workspace installation process.
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* `docs` - Include the docs directory and install its dependencies.
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* `packages/*` - Include all nested directories within the packages directory.
|
|
1407
|
+
*/
|
|
1408
|
+
export type WorkspacePattern = string;
|
|
1409
|
+
/**
|
|
1410
|
+
* Yarn-specific configuration fields.
|
|
1411
|
+
*/
|
|
1412
|
+
export interface YarnConfiguration {
|
|
1413
|
+
/**
|
|
1414
|
+
* If your package only allows one version of a given dependency, and you'd like
|
|
1415
|
+
* to enforce the same behavior as `yarn install --flat` on the command-line,
|
|
1416
|
+
* set this to `true`.
|
|
1417
|
+
*/
|
|
1418
|
+
flat?: boolean;
|
|
1419
|
+
/** Selective version resolutions. Allows the definition of custom package versions inside dependencies. */
|
|
1420
|
+
resolutions?: Dependency;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* JSPM-specific configuration fields.
|
|
1424
|
+
*/
|
|
1425
|
+
export interface JSPMConfiguration {
|
|
1426
|
+
/** JSPM configuration. */
|
|
1427
|
+
jspm?: PackageJson;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Publish configuration options.
|
|
1431
|
+
*/
|
|
1432
|
+
export interface PublishConfig {
|
|
1433
|
+
/** Additional properties from the npm docs on `publishConfig`. */
|
|
1434
|
+
[additionalProperties: string]: JsonValue | undefined;
|
|
1435
|
+
/**
|
|
1436
|
+
* When publishing scoped packages, the access level defaults to restricted.
|
|
1437
|
+
* If you want your scoped package to be publicly viewable set `--access=public`.
|
|
1438
|
+
*/
|
|
1439
|
+
access?: "public" | "restricted";
|
|
1440
|
+
/**
|
|
1441
|
+
* The base URL of the npm registry.
|
|
1442
|
+
*
|
|
1443
|
+
* @defaultValue `'https://registry.npmjs.org/'`
|
|
1444
|
+
*/
|
|
1445
|
+
registry?: string;
|
|
1446
|
+
/**
|
|
1447
|
+
* The tag to publish the package under.
|
|
1448
|
+
*
|
|
1449
|
+
* @defaultValue `'latest'`
|
|
1450
|
+
*/
|
|
1451
|
+
tag?: string;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Type for npm's `package.json` file containing standard npm properties.
|
|
1455
|
+
*
|
|
1456
|
+
* @see {@link https://docs.npmjs.com/creating-a-package-json-file | npm docs}
|
|
1457
|
+
*/
|
|
1458
|
+
export interface PackageJsonStandard {
|
|
1459
|
+
/** The name of the package. */
|
|
1460
|
+
name?: string;
|
|
1461
|
+
/** Package version, parseable by `node-semver`. */
|
|
1462
|
+
version?: string;
|
|
1463
|
+
/** Package description, listed in `npm search`. */
|
|
1464
|
+
description?: string;
|
|
1465
|
+
/** Keywords associated with package, listed in `npm search`. */
|
|
1466
|
+
keywords?: string[];
|
|
1467
|
+
/** The URL to the package's homepage. */
|
|
1468
|
+
homepage?: LiteralUnion<".", string>;
|
|
1469
|
+
/** The URL to the package's issue tracker and/or the email address to which issues should be reported. */
|
|
1470
|
+
bugs?: BugsLocation;
|
|
1471
|
+
/** The license for the package. */
|
|
1472
|
+
license?: string;
|
|
1473
|
+
/** The licenses for the package. */
|
|
1474
|
+
licenses?: Array<{
|
|
1475
|
+
type?: string;
|
|
1476
|
+
url?: string;
|
|
1477
|
+
}>;
|
|
1478
|
+
/** The author of the package. */
|
|
1479
|
+
author?: Person;
|
|
1480
|
+
/** A list of people who contributed to the package. */
|
|
1481
|
+
contributors?: Person[];
|
|
1482
|
+
/** A list of people who maintain the package. */
|
|
1483
|
+
maintainers?: Person[];
|
|
1484
|
+
/** The files included in the package. */
|
|
1485
|
+
files?: string[];
|
|
1486
|
+
/**
|
|
1487
|
+
* Resolution algorithm for importing ".js" files from the package's scope.
|
|
1488
|
+
*
|
|
1489
|
+
* @see {@link https://nodejs.org/api/esm.html#esm_package_json_type_field | Node.js ESM docs}
|
|
1490
|
+
*/
|
|
1491
|
+
type?: "module" | "commonjs";
|
|
1492
|
+
/** The module ID that is the primary entry point to the program. */
|
|
1493
|
+
main?: string;
|
|
1494
|
+
/**
|
|
1495
|
+
* Subpath exports to define entry points of the package.
|
|
1496
|
+
*
|
|
1497
|
+
* @see {@link https://nodejs.org/api/packages.html#subpath-exports | Node.js Subpath exports}
|
|
1498
|
+
*/
|
|
1499
|
+
exports?: Exports;
|
|
1500
|
+
/**
|
|
1501
|
+
* Subpath imports to define internal package import maps.
|
|
1502
|
+
*
|
|
1503
|
+
* @see {@link https://nodejs.org/api/packages.html#subpath-imports | Node.js Subpath imports}
|
|
1504
|
+
*/
|
|
1505
|
+
imports?: Imports;
|
|
1506
|
+
/** The executable files that should be installed into the `PATH`. */
|
|
1507
|
+
bin?: string | Partial<Record<string, string>>;
|
|
1508
|
+
/** Filenames to put in place for the `man` program to find. */
|
|
1509
|
+
man?: string | string[];
|
|
1510
|
+
/** Indicates the structure of the package. */
|
|
1511
|
+
directories?: DirectoryLocations;
|
|
1512
|
+
/** Location for the code repository. */
|
|
1513
|
+
repository?: string | {
|
|
1514
|
+
type: string;
|
|
1515
|
+
url: string;
|
|
1516
|
+
/** Relative path to package.json if it is placed in non-root directory (for monorepos). */
|
|
1517
|
+
directory?: string;
|
|
1518
|
+
};
|
|
1519
|
+
/** Script commands that are run at various times in the lifecycle of the package. */
|
|
1520
|
+
scripts?: Scripts;
|
|
1521
|
+
/** Is used to set configuration parameters used in package scripts that persist across upgrades. */
|
|
1522
|
+
config?: JsonObject;
|
|
1523
|
+
/** The dependencies of the package. */
|
|
1524
|
+
dependencies?: Dependency;
|
|
1525
|
+
/** Additional tooling dependencies that are not required for the package to work. */
|
|
1526
|
+
devDependencies?: Dependency;
|
|
1527
|
+
/** Dependencies that are skipped if they fail to install. */
|
|
1528
|
+
optionalDependencies?: Dependency;
|
|
1529
|
+
/** Dependencies that will usually be required by the package user directly or via another dependency. */
|
|
1530
|
+
peerDependencies?: Dependency;
|
|
1531
|
+
/** Indicate peer dependencies that are optional. */
|
|
1532
|
+
peerDependenciesMeta?: Partial<Record<string, {
|
|
1533
|
+
optional: true;
|
|
1534
|
+
}>>;
|
|
1535
|
+
/** Package names that are bundled when the package is published. */
|
|
1536
|
+
bundledDependencies?: string[];
|
|
1537
|
+
/** Alias of `bundledDependencies`. */
|
|
1538
|
+
bundleDependencies?: string[];
|
|
1539
|
+
/** Overrides is used to support selective version overrides using npm. */
|
|
1540
|
+
overrides?: DependencyOverrides;
|
|
1541
|
+
/** Engines that this package runs on. */
|
|
1542
|
+
engines?: {
|
|
1543
|
+
[EngineName in "npm" | "node" | string]?: string;
|
|
1544
|
+
};
|
|
1545
|
+
/**
|
|
1546
|
+
* Whether to enforce engine requirements strictly.
|
|
1547
|
+
*
|
|
1548
|
+
* @deprecated This field is no longer used by npm. Use the `engine-strict` npm config instead.
|
|
1549
|
+
*/
|
|
1550
|
+
engineStrict?: boolean;
|
|
1551
|
+
/** Operating systems the module runs on. */
|
|
1552
|
+
os?: Array<LiteralUnion<"aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "!aix" | "!darwin" | "!freebsd" | "!linux" | "!openbsd" | "!sunos" | "!win32", string>>;
|
|
1553
|
+
/** CPU architectures the module runs on. */
|
|
1554
|
+
cpu?: Array<LiteralUnion<"arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x32" | "x64" | "!arm" | "!arm64" | "!ia32" | "!mips" | "!mipsel" | "!ppc" | "!ppc64" | "!s390" | "!s390x" | "!x32" | "!x64", string>>;
|
|
1555
|
+
/** Define the runtime and package manager for developing the current project. */
|
|
1556
|
+
devEngines?: {
|
|
1557
|
+
os?: DevEngineDependency | DevEngineDependency[];
|
|
1558
|
+
cpu?: DevEngineDependency | DevEngineDependency[];
|
|
1559
|
+
libc?: DevEngineDependency | DevEngineDependency[];
|
|
1560
|
+
runtime?: DevEngineDependency | DevEngineDependency[];
|
|
1561
|
+
packageManager?: DevEngineDependency | DevEngineDependency[];
|
|
1562
|
+
};
|
|
1563
|
+
/**
|
|
1564
|
+
* If set to `true`, a warning will be shown if package is installed locally.
|
|
1565
|
+
*
|
|
1566
|
+
* @deprecated This field is no longer used by npm. Use the `bin` field to create CLI tools instead.
|
|
1567
|
+
*/
|
|
1568
|
+
preferGlobal?: boolean;
|
|
1569
|
+
/** If set to `true`, then npm will refuse to publish it. */
|
|
1570
|
+
private?: boolean;
|
|
1571
|
+
/** A set of config values that will be used at publish-time. */
|
|
1572
|
+
publishConfig?: PublishConfig;
|
|
1573
|
+
/**
|
|
1574
|
+
* Describes and notifies consumers of a package's monetary support information.
|
|
1575
|
+
*
|
|
1576
|
+
* @see {@link https://github.com/npm/rfcs/blob/main/implemented/0017-add-funding-support.md | npm funding RFC}
|
|
1577
|
+
*/
|
|
1578
|
+
funding?: string | {
|
|
1579
|
+
/** The type of funding. */
|
|
1580
|
+
type?: LiteralUnion<"github" | "opencollective" | "patreon" | "individual" | "foundation" | "corporation", string>;
|
|
1581
|
+
/** The URL to the funding page. */
|
|
1582
|
+
url: string;
|
|
1583
|
+
};
|
|
1584
|
+
/**
|
|
1585
|
+
* Used to configure npm workspaces / Yarn workspaces.
|
|
1586
|
+
*
|
|
1587
|
+
* @remarks
|
|
1588
|
+
* Workspaces allow you to manage multiple packages within the same repository
|
|
1589
|
+
* in such a way that you only need to run your install command once in order
|
|
1590
|
+
* to install all of them in a single pass.
|
|
1591
|
+
*
|
|
1592
|
+
* Please note that the top-level `private` property of `package.json` must
|
|
1593
|
+
* be set to `true` in order to use workspaces.
|
|
1594
|
+
*
|
|
1595
|
+
* @see {@link https://docs.npmjs.com/cli/using-npm/workspaces | npm workspaces}
|
|
1596
|
+
* @see {@link https://classic.yarnpkg.com/docs/workspaces/ | Yarn workspaces}
|
|
1597
|
+
*/
|
|
1598
|
+
workspaces?: WorkspacePattern[] | WorkspaceConfig;
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Type for `package.json` file used by the Node.js runtime.
|
|
1602
|
+
*
|
|
1603
|
+
* @see {@link https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions | Node.js docs}
|
|
1604
|
+
*/
|
|
1605
|
+
export interface NodeJsStandard {
|
|
1606
|
+
/**
|
|
1607
|
+
* Defines which package manager is expected to be used when working on the current project.
|
|
1608
|
+
*
|
|
1609
|
+
* @remarks
|
|
1610
|
+
* It can be set to any of the supported package managers, and will ensure that
|
|
1611
|
+
* your teams use the exact same package manager versions without having to
|
|
1612
|
+
* install anything else other than Node.js.
|
|
1613
|
+
*
|
|
1614
|
+
* This field is currently experimental and needs to be opted-in; check the
|
|
1615
|
+
* Corepack page for details about the procedure.
|
|
1616
|
+
*
|
|
1617
|
+
* @example
|
|
1618
|
+
* ```json
|
|
1619
|
+
* {
|
|
1620
|
+
* "packageManager": "pnpm@8.0.0"
|
|
1621
|
+
* }
|
|
1622
|
+
* ```
|
|
1623
|
+
*
|
|
1624
|
+
* @see {@link https://nodejs.org/api/corepack.html | Node.js Corepack docs}
|
|
1625
|
+
*/
|
|
1626
|
+
packageManager?: string;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Type for npm's `package.json` file.
|
|
1632
|
+
*
|
|
1633
|
+
* @remarks
|
|
1634
|
+
* Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
|
1635
|
+
*
|
|
1636
|
+
* @see {@link https://docs.npmjs.com/creating-a-package-json-file | npm docs}
|
|
1637
|
+
*
|
|
1638
|
+
* @public
|
|
1639
|
+
*/
|
|
1640
|
+
export declare type PackageJson = JsonObject & PackageJson.NodeJsStandard & PackageJson.PackageJsonStandard & PackageJson.NonStandardEntryPoints & PackageJson.TypeScriptConfiguration & PackageJson.YarnConfiguration & PackageJson.JSPMConfiguration;
|
|
1641
|
+
|
|
1106
1642
|
/**
|
|
1107
1643
|
* Plugin to transform package.json for distribution.
|
|
1108
1644
|
*
|
|
@@ -1254,6 +1790,15 @@ export declare interface PackageJsonTransformPluginOptions {
|
|
|
1254
1790
|
transform?: (pkg: PackageJson) => PackageJson;
|
|
1255
1791
|
}
|
|
1256
1792
|
|
|
1793
|
+
/**
|
|
1794
|
+
* Matches any primitive value.
|
|
1795
|
+
*
|
|
1796
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive | MDN Primitive}
|
|
1797
|
+
*
|
|
1798
|
+
* @public
|
|
1799
|
+
*/
|
|
1800
|
+
declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
1801
|
+
|
|
1257
1802
|
/**
|
|
1258
1803
|
* Async RSLib configuration function type.
|
|
1259
1804
|
* @public
|
|
@@ -1442,15 +1987,13 @@ export declare type TsDocLintErrorBehavior = "warn" | "error" | "throw";
|
|
|
1442
1987
|
* | Local | `"error"` | Log and continue |
|
|
1443
1988
|
* | CI | `"throw"` | Fail the build |
|
|
1444
1989
|
*
|
|
1445
|
-
* ##
|
|
1990
|
+
* ## Dependencies
|
|
1446
1991
|
*
|
|
1447
|
-
* This plugin
|
|
1992
|
+
* This plugin uses ESLint programmatically with the following packages:
|
|
1448
1993
|
* - `eslint`
|
|
1449
1994
|
* - `@typescript-eslint/parser`
|
|
1450
1995
|
* - `eslint-plugin-tsdoc`
|
|
1451
1996
|
*
|
|
1452
|
-
* Install with: `pnpm add -D eslint @typescript-eslint/parser eslint-plugin-tsdoc`
|
|
1453
|
-
*
|
|
1454
1997
|
* @param options - Plugin configuration options
|
|
1455
1998
|
* @returns An Rsbuild plugin that validates TSDoc comments before the build
|
|
1456
1999
|
*
|
|
@@ -1663,6 +2206,11 @@ export declare interface TsDocOptions {
|
|
|
1663
2206
|
* TSDoc warnings include unknown tags, malformed syntax, and other
|
|
1664
2207
|
* documentation issues detected by API Extractor during processing.
|
|
1665
2208
|
*
|
|
2209
|
+
* **Important:** This setting only applies to first-party warnings (from your
|
|
2210
|
+
* project's source code). Third-party warnings from dependencies in
|
|
2211
|
+
* `node_modules/` are always logged but never fail the build, since they
|
|
2212
|
+
* cannot be fixed by the consuming project.
|
|
2213
|
+
*
|
|
1666
2214
|
* @defaultValue `"fail"` in CI environments (`CI` or `GITHUB_ACTIONS` env vars),
|
|
1667
2215
|
* `"log"` otherwise
|
|
1668
2216
|
*/
|
package/index.js
CHANGED
|
@@ -265,7 +265,7 @@ const AutoEntryPlugin = (options)=>{
|
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
|
-
var lib_namespaceObject = JSON.parse('{"$schema":"https://json.schemastore.org/tsconfig.json","compilerOptions":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"${configDir}/dist","declarationMap":false,"emitDeclarationOnly":false,"esModuleInterop":true,"explainFiles":false,"forceConsistentCasingInFileNames":true,"incremental":true,"isolatedDeclarations":
|
|
268
|
+
var lib_namespaceObject = JSON.parse('{"$schema":"https://json.schemastore.org/tsconfig.json","compilerOptions":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"${configDir}/dist","declarationMap":false,"emitDeclarationOnly":false,"esModuleInterop":true,"explainFiles":false,"forceConsistentCasingInFileNames":true,"incremental":true,"isolatedDeclarations":false,"isolatedModules":true,"jsx":"preserve","lib":["esnext"],"module":"nodenext","moduleResolution":"nodenext","outDir":"${configDir}/dist","resolveJsonModule":true,"rootDir":"${configDir}","skipLibCheck":true,"sourceMap":false,"strict":true,"strictNullChecks":true,"target":"es2023","tsBuildInfoFile":"${configDir}/dist/.tsbuildinfo.lib","typeRoots":["${configDir}/node_modules/@types","${configDir}/types"],"verbatimModuleSyntax":true},"exclude":["${configDir}/node_modules","${configDir}/dist/**/*"],"include":["${configDir}/types/*.ts","${configDir}/package.json","${configDir}/*.ts","${configDir}/*.cts","${configDir}/*.mts","${configDir}/src/**/*.ts","${configDir}/src/**/*.tsx","${configDir}/src/**/*.cts","${configDir}/src/**/*.mts","${configDir}/lib/**/*.ts","${configDir}/lib/**/*.tsx","${configDir}/lib/**/*.cts","${configDir}/lib/**/*.mts","${configDir}/public/**/*.json"]}');
|
|
269
269
|
const requireCJS = createRequire(import.meta.url);
|
|
270
270
|
const jsonImports = new Map([
|
|
271
271
|
[
|
|
@@ -617,13 +617,22 @@ async function bundleDtsFiles(options) {
|
|
|
617
617
|
});
|
|
618
618
|
if (!extractorResult.succeeded) throw new Error(`API Extractor failed for entry "${entryName}"`);
|
|
619
619
|
if (collectedTsdocWarnings.length > 0) {
|
|
620
|
+
const isThirdParty = (warning)=>warning.sourceFilePath?.includes("node_modules/") ?? false;
|
|
621
|
+
const firstPartyWarnings = collectedTsdocWarnings.filter((w)=>!isThirdParty(w));
|
|
622
|
+
const thirdPartyWarnings = collectedTsdocWarnings.filter(isThirdParty);
|
|
620
623
|
const formatWarning = (warning)=>{
|
|
621
624
|
const location = warning.sourceFilePath ? `${picocolors.cyan((0, external_node_path_.relative)(cwd, warning.sourceFilePath))}${warning.sourceFileLine ? `:${warning.sourceFileLine}` : ""}${warning.sourceFileColumn ? `:${warning.sourceFileColumn}` : ""}` : null;
|
|
622
625
|
return location ? `${location}: ${picocolors.yellow(warning.text)}` : picocolors.yellow(warning.text);
|
|
623
626
|
};
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
+
if (thirdPartyWarnings.length > 0) {
|
|
628
|
+
const thirdPartyMessages = thirdPartyWarnings.map(formatWarning).join("\n ");
|
|
629
|
+
core_logger.warn(`TSDoc warnings from dependencies for entry "${entryName}" (cannot be fixed, bundled types may have documentation issues):\n ${thirdPartyMessages}`);
|
|
630
|
+
}
|
|
631
|
+
if (firstPartyWarnings.length > 0) {
|
|
632
|
+
const firstPartyMessages = firstPartyWarnings.map(formatWarning).join("\n ");
|
|
633
|
+
if ("fail" === tsdocWarnings) throw new Error(`TSDoc validation failed for entry "${entryName}":\n ${firstPartyMessages}`);
|
|
634
|
+
if ("log" === tsdocWarnings) core_logger.warn(`TSDoc warnings for entry "${entryName}":\n ${firstPartyMessages}`);
|
|
635
|
+
}
|
|
627
636
|
}
|
|
628
637
|
if (generateApiModel && tempApiModelPath) apiModelPath = tempApiModelPath;
|
|
629
638
|
if (generateTsdocMetadata && tempTsdocMetadataPath) tsdocMetadataPath = tempTsdocMetadataPath;
|
|
@@ -1714,27 +1723,10 @@ async function runTsDocLint(options, cwd) {
|
|
|
1714
1723
|
const shouldPersist = TsDocConfigBuilder.shouldPersist(persistConfig);
|
|
1715
1724
|
const tsdocConfigOutputPath = TsDocConfigBuilder.getConfigPath(persistConfig, cwd);
|
|
1716
1725
|
const tsdocConfigPath = await TsDocConfigBuilder.writeConfigFile(tsdocOptions, (0, external_node_path_.dirname)(tsdocConfigOutputPath));
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
const
|
|
1721
|
-
try {
|
|
1722
|
-
const eslintModule = await import("eslint");
|
|
1723
|
-
ESLint = eslintModule.ESLint;
|
|
1724
|
-
} catch {
|
|
1725
|
-
missingPackages.push("eslint");
|
|
1726
|
-
}
|
|
1727
|
-
try {
|
|
1728
|
-
tsParserModule = await import("@typescript-eslint/parser");
|
|
1729
|
-
} catch {
|
|
1730
|
-
missingPackages.push("@typescript-eslint/parser");
|
|
1731
|
-
}
|
|
1732
|
-
try {
|
|
1733
|
-
tsdocPluginModule = await import("eslint-plugin-tsdoc");
|
|
1734
|
-
} catch {
|
|
1735
|
-
missingPackages.push("eslint-plugin-tsdoc");
|
|
1736
|
-
}
|
|
1737
|
-
if (missingPackages.length > 0 || !ESLint) throw new Error(`TsDocLintPlugin requires: ${missingPackages.join(", ")}\nInstall with: pnpm add -D ${missingPackages.join(" ")}`);
|
|
1726
|
+
const eslintModule = await import("eslint");
|
|
1727
|
+
const tsParserModule = await import("@typescript-eslint/parser");
|
|
1728
|
+
const tsdocPluginModule = await import("eslint-plugin-tsdoc");
|
|
1729
|
+
const { ESLint } = eslintModule;
|
|
1738
1730
|
const tsParser = tsParserModule.default ?? tsParserModule;
|
|
1739
1731
|
const tsdocPlugin = tsdocPluginModule.default ?? tsdocPluginModule;
|
|
1740
1732
|
const discovery = discoverFilesToLint(options, cwd);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/rslib-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSlib-based build system for Node.js libraries with automatic package.json transformation, TypeScript declaration bundling, and multi-target support",
|
|
6
6
|
"homepage": "https://github.com/savvy-web/rslib-builder",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"@microsoft/tsdoc": "^0.16.0",
|
|
28
28
|
"@microsoft/tsdoc-config": "^0.18.0",
|
|
29
29
|
"@pnpm/exportable-manifest": "^1000.3.1",
|
|
30
|
+
"@typescript-eslint/parser": "^8.53.1",
|
|
30
31
|
"deep-equal": "^2.2.3",
|
|
32
|
+
"eslint": "^9.39.2",
|
|
33
|
+
"eslint-plugin-tsdoc": "^0.5.0",
|
|
31
34
|
"glob": "^13.0.0",
|
|
32
35
|
"picocolors": "^1.1.1",
|
|
33
|
-
"sort-package-json": "^3.6.
|
|
36
|
+
"sort-package-json": "^3.6.1",
|
|
34
37
|
"tmp": "^0.2.5",
|
|
35
|
-
"workspace-tools": "^0.40.
|
|
38
|
+
"workspace-tools": "^0.40.4",
|
|
36
39
|
"yaml": "^2.8.2"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
39
42
|
"@microsoft/api-extractor": "^7.55.2",
|
|
40
|
-
"@rslib/core": "^0.19.
|
|
41
|
-
"@types/node": "^25.0.
|
|
42
|
-
"@typescript-
|
|
43
|
-
"@typescript/native-preview": "^7.0.0-dev.20260120.1",
|
|
44
|
-
"eslint": "^9.0.0",
|
|
45
|
-
"eslint-plugin-tsdoc": "^0.5.0",
|
|
43
|
+
"@rslib/core": "^0.19.3",
|
|
44
|
+
"@types/node": "^25.0.10",
|
|
45
|
+
"@typescript/native-preview": "^7.0.0-dev.20260124.1",
|
|
46
46
|
"typescript": "^5.9.3"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
@@ -52,20 +52,14 @@
|
|
|
52
52
|
"@rslib/core": {
|
|
53
53
|
"optional": false
|
|
54
54
|
},
|
|
55
|
-
"@
|
|
56
|
-
"optional":
|
|
55
|
+
"@types/node": {
|
|
56
|
+
"optional": false
|
|
57
57
|
},
|
|
58
58
|
"@typescript/native-preview": {
|
|
59
59
|
"optional": false
|
|
60
60
|
},
|
|
61
|
-
"eslint": {
|
|
62
|
-
"optional": true
|
|
63
|
-
},
|
|
64
|
-
"eslint-plugin-tsdoc": {
|
|
65
|
-
"optional": true
|
|
66
|
-
},
|
|
67
61
|
"typescript": {
|
|
68
|
-
"optional":
|
|
62
|
+
"optional": true
|
|
69
63
|
}
|
|
70
64
|
},
|
|
71
65
|
"files": [
|
package/tsconfig/ecma/lib.json
CHANGED