@rslib/core 0.0.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/LICENSE +21 -0
- package/README.md +19 -0
- package/bin/rslib.js +14 -0
- package/compiled/commander/index.d.ts +971 -0
- package/compiled/commander/index.js +3805 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/fast-glob/index.d.ts +237 -0
- package/compiled/fast-glob/index.js +7309 -0
- package/compiled/fast-glob/license +21 -0
- package/compiled/fast-glob/package.json +1 -0
- package/compiled/picocolors/index.d.ts +34 -0
- package/compiled/picocolors/index.js +130 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/dist/index.cjs +1131 -0
- package/dist/index.js +1093 -0
- package/dist-types/build.d.ts +4 -0
- package/dist-types/cli/commands.d.ts +14 -0
- package/dist-types/cli/prepare.d.ts +1 -0
- package/dist-types/config.d.ts +22 -0
- package/dist-types/constant.d.ts +2 -0
- package/dist-types/index.d.ts +7 -0
- package/dist-types/types/config/index.d.ts +36 -0
- package/dist-types/types/index.d.ts +2 -0
- package/dist-types/types/utils.d.ts +6 -0
- package/dist-types/utils/extension.d.ts +10 -0
- package/dist-types/utils/helper.d.ts +11 -0
- package/dist-types/utils/logger.d.ts +5 -0
- package/dist-types/utils/syntax.d.ts +3 -0
- package/package.json +75 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RsbuildMode } from '@rsbuild/core';
|
|
2
|
+
export type CommonOptions = {
|
|
3
|
+
config?: string;
|
|
4
|
+
envMode?: string;
|
|
5
|
+
};
|
|
6
|
+
export type BuildOptions = CommonOptions & {
|
|
7
|
+
watch?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type InspectOptions = CommonOptions & {
|
|
10
|
+
mode: RsbuildMode;
|
|
11
|
+
output: string;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function runCli(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prepareCli(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RsbuildConfig, type RsbuildInstance } from '@rsbuild/core';
|
|
2
|
+
import type { AutoExternal, Format, PkgJson, RslibConfig, RslibConfigAsyncFn, RslibConfigExport, RslibConfigSyncFn } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* This function helps you to autocomplete configuration types.
|
|
5
|
+
* It accepts a Rslib config object, or a function that returns a config.
|
|
6
|
+
*/
|
|
7
|
+
export declare function defineConfig(config: RslibConfig): RslibConfig;
|
|
8
|
+
export declare function defineConfig(config: RslibConfigSyncFn): RslibConfigSyncFn;
|
|
9
|
+
export declare function defineConfig(config: RslibConfigAsyncFn): RslibConfigAsyncFn;
|
|
10
|
+
export declare function defineConfig(config: RslibConfigExport): RslibConfigExport;
|
|
11
|
+
export declare function loadConfig(customConfig?: string, envMode?: string): Promise<RslibConfig>;
|
|
12
|
+
export declare const composeAutoExternalConfig: (options: {
|
|
13
|
+
autoExternal: AutoExternal;
|
|
14
|
+
pkgJson?: PkgJson;
|
|
15
|
+
userExternals?: NonNullable<RsbuildConfig["output"]>["externals"];
|
|
16
|
+
}) => RsbuildConfig;
|
|
17
|
+
export declare function createInternalRsbuildConfig(): Promise<RsbuildConfig>;
|
|
18
|
+
export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig, path?: string): Promise<{
|
|
19
|
+
format: Format;
|
|
20
|
+
config: RsbuildConfig;
|
|
21
|
+
}[]>;
|
|
22
|
+
export declare function initRsbuild(rslibConfig: RslibConfig): Promise<RsbuildInstance>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { prepareCli } from './cli/prepare';
|
|
2
|
+
export { runCli } from './cli/commands';
|
|
3
|
+
export { defineConfig, loadConfig } from './config';
|
|
4
|
+
export { build } from './build';
|
|
5
|
+
export { logger } from './utils/logger';
|
|
6
|
+
export type * from './types';
|
|
7
|
+
export declare const version: string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RsbuildConfig } from '@rsbuild/core';
|
|
2
|
+
export type Format = 'esm' | 'cjs' | 'umd';
|
|
3
|
+
export type EcmaScriptVersion = 'esnext' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024';
|
|
4
|
+
export type Syntax = EcmaScriptVersion | string[];
|
|
5
|
+
export type Dts = {
|
|
6
|
+
bundle: boolean;
|
|
7
|
+
distPath?: string;
|
|
8
|
+
abortOnError?: boolean;
|
|
9
|
+
} | false;
|
|
10
|
+
export type AutoExternal = boolean | {
|
|
11
|
+
dependencies?: boolean;
|
|
12
|
+
devDependencies?: boolean;
|
|
13
|
+
peerDependencies?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface LibConfig extends RsbuildConfig {
|
|
16
|
+
bundle?: boolean;
|
|
17
|
+
format?: Format;
|
|
18
|
+
autoExtension?: boolean;
|
|
19
|
+
autoExternal?: AutoExternal;
|
|
20
|
+
output?: RsbuildConfig['output'] & {
|
|
21
|
+
/** Support esX and browserslist query */
|
|
22
|
+
syntax?: Syntax;
|
|
23
|
+
};
|
|
24
|
+
dts?: Dts;
|
|
25
|
+
}
|
|
26
|
+
export interface RslibConfig extends RsbuildConfig {
|
|
27
|
+
lib: LibConfig[];
|
|
28
|
+
}
|
|
29
|
+
export type ConfigParams = {
|
|
30
|
+
env: string;
|
|
31
|
+
command: string;
|
|
32
|
+
envMode?: string;
|
|
33
|
+
};
|
|
34
|
+
export type RslibConfigSyncFn = (env: ConfigParams) => RslibConfig;
|
|
35
|
+
export type RslibConfigAsyncFn = (env: ConfigParams) => Promise<RslibConfig>;
|
|
36
|
+
export type RslibConfigExport = RslibConfig | RslibConfigSyncFn | RslibConfigAsyncFn;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import color from '../../compiled/picocolors';
|
|
2
|
+
import type { PkgJson } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js built-in modules.
|
|
5
|
+
* Copied from https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L12-L72
|
|
6
|
+
*/
|
|
7
|
+
export declare const nodeBuiltInModules: Array<string | RegExp>;
|
|
8
|
+
export declare function calcLongestCommonPath(absPaths: string[]): Promise<string | null>;
|
|
9
|
+
export declare const readPackageJson: (rootPath: string) => undefined | PkgJson;
|
|
10
|
+
export declare const isObject: (obj: unknown) => obj is Record<string, any>;
|
|
11
|
+
export { color };
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rslib/core",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "The Rspack-based library build tool.",
|
|
5
|
+
"homepage": "https://rslib.dev",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/web-infra-dev/rslib/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/web-infra-dev/rslib",
|
|
12
|
+
"directory": "packages/core"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist-types/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
|
+
"types": "./dist-types/index.d.ts",
|
|
26
|
+
"bin": {
|
|
27
|
+
"rslib": "./bin/rslib.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"dist",
|
|
32
|
+
"dist-types",
|
|
33
|
+
"compiled"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@rsbuild/core": "1.0.1-beta.11",
|
|
37
|
+
"rsbuild-plugin-dts": "0.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/fs-extra": "^11.0.4",
|
|
41
|
+
"commander": "^12.1.0",
|
|
42
|
+
"fast-glob": "^3.3.2",
|
|
43
|
+
"fs-extra": "^11.2.0",
|
|
44
|
+
"memfs": "^4.11.1",
|
|
45
|
+
"picocolors": "1.0.1",
|
|
46
|
+
"prebundle": "1.1.0",
|
|
47
|
+
"rslog": "^1.2.2",
|
|
48
|
+
"typescript": "^5.5.4",
|
|
49
|
+
"@rslib/tsconfig": "0.0.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@microsoft/api-extractor": "^7",
|
|
53
|
+
"typescript": "^5"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"@microsoft/api-extractor": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"typescript": {
|
|
60
|
+
"optional": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=16.0.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "modern build",
|
|
72
|
+
"dev": "modern build --watch",
|
|
73
|
+
"prebundle": "prebundle"
|
|
74
|
+
}
|
|
75
|
+
}
|