@rslib/core 0.0.4 → 0.0.6

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.
@@ -1,5 +1,5 @@
1
1
  import { type RsbuildConfig, type RsbuildInstance } from '@rsbuild/core';
2
- import type { AutoExternal, Format, PkgJson, RslibConfig, RslibConfigAsyncFn, RslibConfigExport, RslibConfigSyncFn } from './types';
2
+ import type { AutoExternal, BannerAndFooter, Format, PkgJson, RslibConfig, RslibConfigAsyncFn, RslibConfigExport, RslibConfigSyncFn } from './types';
3
3
  /**
4
4
  * This function helps you to autocomplete configuration types.
5
5
  * It accepts a Rslib config object, or a function that returns a config.
@@ -18,6 +18,9 @@ export declare const composeAutoExternalConfig: (options: {
18
18
  pkgJson?: PkgJson;
19
19
  userExternals?: NonNullable<RsbuildConfig["output"]>["externals"];
20
20
  }) => RsbuildConfig;
21
+ export declare function composeMinifyConfig(minify: NonNullable<RsbuildConfig['output']>['minify']): RsbuildConfig;
22
+ export declare function composeBannerFooterConfig(banner: BannerAndFooter, footer: BannerAndFooter): RsbuildConfig;
23
+ export declare function composeDecoratorsConfig(compilerOptions?: Record<string, any>, version?: NonNullable<NonNullable<RsbuildConfig['source']>['decorators']>['version']): RsbuildConfig;
21
24
  export declare function createConstantRsbuildConfig(): Promise<RsbuildConfig>;
22
25
  export declare const composeModuleImportWarn: (request: string) => string;
23
26
  export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig, path?: string): Promise<{
@@ -1,2 +1,3 @@
1
1
  export declare const DEFAULT_CONFIG_NAME = "rslib.config";
2
2
  export declare const DEFAULT_EXTENSIONS: readonly [".js", ".ts", ".mjs", ".mts", ".cjs", ".cts"];
3
+ export declare const SWC_HELPERS = "@swc/helpers";
@@ -1,6 +1,9 @@
1
1
  import type { RsbuildConfig } from '@rsbuild/core';
2
2
  export type Format = 'esm' | 'cjs' | 'umd';
3
- export type EcmaScriptVersion = 'esnext' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024';
3
+ export type FixedEcmaVersions = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023';
4
+ export type LatestEcmaVersions = 'es2024' | 'esnext';
5
+ export type EcmaScriptVersion = FixedEcmaVersions | LatestEcmaVersions;
6
+ export type RsbuildConfigOutputTarget = NonNullable<RsbuildConfig['output']>['target'];
4
7
  export type Syntax = EcmaScriptVersion | string[];
5
8
  export type Dts = {
6
9
  bundle: boolean;
@@ -12,15 +15,21 @@ export type AutoExternal = boolean | {
12
15
  devDependencies?: boolean;
13
16
  peerDependencies?: boolean;
14
17
  };
18
+ export type BannerAndFooter = {
19
+ js?: string;
20
+ css?: string;
21
+ dts?: string;
22
+ };
15
23
  export interface LibConfig extends RsbuildConfig {
16
24
  bundle?: boolean;
17
25
  format?: Format;
18
26
  autoExtension?: boolean;
19
27
  autoExternal?: AutoExternal;
20
- output?: RsbuildConfig['output'] & {
21
- /** Support esX and browserslist query */
22
- syntax?: Syntax;
23
- };
28
+ /** Support esX and browserslist query */
29
+ syntax?: Syntax;
30
+ externalHelpers?: boolean;
31
+ banner?: BannerAndFooter;
32
+ footer?: BannerAndFooter;
24
33
  dts?: Dts;
25
34
  }
26
35
  export interface RslibConfig extends RsbuildConfig {
@@ -8,8 +8,7 @@ export declare const nodeBuiltInModules: Array<string | RegExp>;
8
8
  export declare function calcLongestCommonPath(absPaths: string[]): Promise<string | null>;
9
9
  export declare const readPackageJson: (rootPath: string) => undefined | PkgJson;
10
10
  export declare const isObject: (obj: unknown) => obj is Record<string, any>;
11
- type OmitDeep<T, K extends string[]> = T extends (infer U)[] ? OmitDeep<U, K>[] : T extends Record<any, any> ? {
12
- [P in keyof T as P extends K[number] ? never : P]: OmitDeep<T[P], K>;
13
- } : T;
14
- export declare function omitDeep<T extends object, K extends string[]>(obj: T, keys: K): OmitDeep<T, K>;
11
+ export declare const isEmptyObject: (obj: object) => boolean;
12
+ export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Pick<T, U>;
13
+ export declare function omit<T extends object, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Omit<T, U>;
15
14
  export { color };
@@ -1,3 +1,12 @@
1
1
  import type { RsbuildConfig } from '@rsbuild/core';
2
- import type { Syntax } from '../types/config';
3
- export declare const transformSyntaxToBrowserslist: (syntax: Syntax) => NonNullable<NonNullable<RsbuildConfig["output"]>["overrideBrowserslist"]>;
2
+ import type { FixedEcmaVersions, LatestEcmaVersions, RsbuildConfigOutputTarget, Syntax } from '../types/config';
3
+ export declare const LATEST_TARGET_VERSIONS: Record<NonNullable<RsbuildConfigOutputTarget>, string[]>;
4
+ /**
5
+ * The esX to browserslist mapping is transformed from esbuild:
6
+ * https://github.com/evanw/esbuild/blob/main/internal/compat/js_table.go
7
+ * It does not completely align with the browserslist query of Rsbuild now:
8
+ * https://github.com/rspack-contrib/browserslist-to-es-version
9
+ * TODO: align with Rsbuild, we may should align with SWC
10
+ */
11
+ export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string | string[]>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
12
+ export declare function transformSyntaxToBrowserslist(syntax: Syntax, target?: NonNullable<RsbuildConfig['output']>['target']): NonNullable<NonNullable<RsbuildConfig['output']>['overrideBrowserslist']>;
@@ -0,0 +1,3 @@
1
+ export declare function loadTsconfig(root: string, tsconfigPath?: string): Promise<{
2
+ compilerOptions?: Record<string, any>;
3
+ }>;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "The Rspack-based library build tool.",
5
- "homepage": "https://rslib.dev",
5
+ "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
7
7
  "url": "https://github.com/web-infra-dev/rslib/issues"
8
8
  },
@@ -32,8 +32,8 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "1.0.1-rc.0",
36
- "rsbuild-plugin-dts": "0.0.4"
35
+ "@rsbuild/core": "1.0.3",
36
+ "rsbuild-plugin-dts": "0.0.6"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/fs-extra": "^11.0.4",
@@ -41,11 +41,12 @@
41
41
  "fast-glob": "^3.3.2",
42
42
  "fs-extra": "^11.2.0",
43
43
  "memfs": "^4.11.1",
44
- "picocolors": "1.0.1",
44
+ "picocolors": "1.1.0",
45
45
  "prebundle": "1.2.2",
46
- "rslib": "npm:@rslib/core@0.0.3",
47
- "rslog": "^1.2.2",
48
- "typescript": "^5.5.4",
46
+ "rslib": "npm:@rslib/core@0.0.5",
47
+ "rslog": "^1.2.3",
48
+ "tsconfck": "3.1.3",
49
+ "typescript": "^5.6.2",
49
50
  "@rslib/tsconfig": "0.0.1"
50
51
  },
51
52
  "peerDependencies": {