@rslib/core 0.0.16 → 0.0.18
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 +1 -1
- package/dist/index.js +109 -43
- package/dist-types/build.d.ts +1 -1
- package/dist-types/cli/commands.d.ts +2 -1
- package/dist-types/config.d.ts +3 -2
- package/dist-types/mf.d.ts +3 -0
- package/dist-types/types/config/index.d.ts +64 -2
- package/dist-types/utils/syntax.d.ts +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Rslib
|
|
6
6
|
|
|
7
|
-
Rslib is a library
|
|
7
|
+
Rslib is a library development tool powered by [Rsbuild](https://rsbuild.dev). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises__ from "node:fs/promises";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__ from "../compiled/picocolors/index.js";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__ from "../compiled/commander/index.js";
|
|
7
6
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__ from "../compiled/commander/index.js";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
|
|
@@ -150,7 +150,7 @@ function prepareCli() {
|
|
|
150
150
|
// Some package managers automatically output a blank line, some do not.
|
|
151
151
|
const { npm_execpath } = process.env;
|
|
152
152
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
153
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.
|
|
153
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.0.18\n`);
|
|
154
154
|
}
|
|
155
155
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
156
156
|
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
@@ -392,10 +392,6 @@ const LATEST_TARGET_VERSIONS = {
|
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
const calcEsnextBrowserslistByTarget = (target)=>{
|
|
395
|
-
if (!target) return [
|
|
396
|
-
...LATEST_TARGET_VERSIONS.node,
|
|
397
|
-
...LATEST_TARGET_VERSIONS.web
|
|
398
|
-
];
|
|
399
395
|
if ('node' === target) return LATEST_TARGET_VERSIONS.node;
|
|
400
396
|
return LATEST_TARGET_VERSIONS.web;
|
|
401
397
|
};
|
|
@@ -1565,6 +1561,7 @@ async function createConstantRsbuildConfig() {
|
|
|
1565
1561
|
}
|
|
1566
1562
|
},
|
|
1567
1563
|
output: {
|
|
1564
|
+
target: 'node',
|
|
1568
1565
|
filenameHash: false,
|
|
1569
1566
|
distPath: {
|
|
1570
1567
|
js: './'
|
|
@@ -1676,7 +1673,6 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
|
|
|
1676
1673
|
output: {
|
|
1677
1674
|
uniqueName: pkgJson.name
|
|
1678
1675
|
},
|
|
1679
|
-
// TODO when we provide dev mode for rslib mf format, this should be modified to as the same with config.mode
|
|
1680
1676
|
// can not set nodeEnv to false, because mf format should build shared module.
|
|
1681
1677
|
// If nodeEnv is false, the process.env.NODE_ENV in third-party packages's will not be replaced
|
|
1682
1678
|
// now we have not provide dev mode for users, so we can always set nodeEnv as 'production'
|
|
@@ -1684,6 +1680,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
|
|
|
1684
1680
|
nodeEnv: 'production'
|
|
1685
1681
|
}
|
|
1686
1682
|
}
|
|
1683
|
+
},
|
|
1684
|
+
output: {
|
|
1685
|
+
target: 'web'
|
|
1687
1686
|
}
|
|
1688
1687
|
};
|
|
1689
1688
|
default:
|
|
@@ -1783,7 +1782,7 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1783
1782
|
dtsExtension
|
|
1784
1783
|
};
|
|
1785
1784
|
};
|
|
1786
|
-
const composeSyntaxConfig = (
|
|
1785
|
+
const composeSyntaxConfig = (target, syntax)=>{
|
|
1787
1786
|
// Defaults to ESNext, Rslib will assume all of the latest JavaScript and CSS features are supported.
|
|
1788
1787
|
if (syntax) return {
|
|
1789
1788
|
tools: {
|
|
@@ -1933,34 +1932,42 @@ const composeDtsConfig = async (libConfig, dtsExtension)=>{
|
|
|
1933
1932
|
]
|
|
1934
1933
|
};
|
|
1935
1934
|
};
|
|
1936
|
-
const composeTargetConfig = (target
|
|
1937
|
-
|
|
1935
|
+
const composeTargetConfig = (target, format)=>{
|
|
1936
|
+
let defaultTarget = target;
|
|
1937
|
+
if (!defaultTarget) defaultTarget = 'mf' === format ? 'web' : 'node';
|
|
1938
|
+
switch(defaultTarget){
|
|
1938
1939
|
case 'web':
|
|
1939
1940
|
return {
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1941
|
+
config: {
|
|
1942
|
+
tools: {
|
|
1943
|
+
rspack: {
|
|
1944
|
+
target: [
|
|
1945
|
+
'web'
|
|
1946
|
+
]
|
|
1947
|
+
}
|
|
1945
1948
|
}
|
|
1946
|
-
}
|
|
1949
|
+
},
|
|
1950
|
+
target: 'web'
|
|
1947
1951
|
};
|
|
1948
1952
|
case 'node':
|
|
1949
1953
|
return {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1954
|
+
config: {
|
|
1955
|
+
tools: {
|
|
1956
|
+
rspack: {
|
|
1957
|
+
target: [
|
|
1958
|
+
'node'
|
|
1959
|
+
]
|
|
1960
|
+
}
|
|
1961
|
+
},
|
|
1962
|
+
output: {
|
|
1963
|
+
// When output.target is 'node', Node.js's built-in will be treated as externals of type `node-commonjs`.
|
|
1964
|
+
// Simply override the built-in modules to make them external.
|
|
1965
|
+
// https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L81
|
|
1966
|
+
externals: nodeBuiltInModules,
|
|
1967
|
+
target: 'node'
|
|
1955
1968
|
}
|
|
1956
1969
|
},
|
|
1957
|
-
|
|
1958
|
-
// When output.target is 'node', Node.js's built-in will be treated as externals of type `node-commonjs`.
|
|
1959
|
-
// Simply override the built-in modules to make them external.
|
|
1960
|
-
// https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L81
|
|
1961
|
-
externals: nodeBuiltInModules,
|
|
1962
|
-
target: 'node'
|
|
1963
|
-
}
|
|
1970
|
+
target: 'node'
|
|
1964
1971
|
};
|
|
1965
1972
|
// TODO: Support `neutral` target, however Rsbuild don't list it as an option in the target field.
|
|
1966
1973
|
// case 'neutral':
|
|
@@ -1972,7 +1979,7 @@ const composeTargetConfig = (target = 'web')=>{
|
|
|
1972
1979
|
// },
|
|
1973
1980
|
// };
|
|
1974
1981
|
default:
|
|
1975
|
-
throw new Error(`Unsupported platform: ${
|
|
1982
|
+
throw new Error(`Unsupported platform: ${defaultTarget}`);
|
|
1976
1983
|
}
|
|
1977
1984
|
};
|
|
1978
1985
|
const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
|
|
@@ -2021,8 +2028,8 @@ async function composeLibRsbuildConfig(config, configPath) {
|
|
|
2021
2028
|
const externalsConfig = composeExternalsConfig(format, config.output?.externals);
|
|
2022
2029
|
const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
|
|
2023
2030
|
const bundleConfig = composeBundleConfig(jsExtension, redirect, cssModulesAuto, bundle);
|
|
2024
|
-
const targetConfig = composeTargetConfig(config.output?.target);
|
|
2025
|
-
const syntaxConfig = composeSyntaxConfig(
|
|
2031
|
+
const { config: targetConfig, target } = composeTargetConfig(config.output?.target, format);
|
|
2032
|
+
const syntaxConfig = composeSyntaxConfig(target, config?.syntax);
|
|
2026
2033
|
const autoExternalConfig = composeAutoExternalConfig({
|
|
2027
2034
|
autoExternal,
|
|
2028
2035
|
pkgJson,
|
|
@@ -2084,7 +2091,7 @@ async function composeCreateRsbuildConfig(rslibConfig, path) {
|
|
|
2084
2091
|
const composedRsbuildConfig = await Promise.all(libConfigPromises);
|
|
2085
2092
|
return composedRsbuildConfig;
|
|
2086
2093
|
}
|
|
2087
|
-
async function
|
|
2094
|
+
async function composeRsbuildEnvironments(rslibConfig) {
|
|
2088
2095
|
const rsbuildConfigObject = await composeCreateRsbuildConfig(rslibConfig);
|
|
2089
2096
|
const environments = {};
|
|
2090
2097
|
const formatCount = rsbuildConfigObject.reduce((acc, { format })=>{
|
|
@@ -2102,31 +2109,72 @@ async function initRsbuild(rslibConfig) {
|
|
|
2102
2109
|
const currentFormatIndex = formatIndex[format]++;
|
|
2103
2110
|
environments[1 === currentFormatCount ? format : `${format}${currentFormatIndex}`] = config;
|
|
2104
2111
|
}
|
|
2105
|
-
return
|
|
2112
|
+
return environments;
|
|
2113
|
+
}
|
|
2114
|
+
const pruneEnvironments = (environments, libs)=>{
|
|
2115
|
+
if (!libs) return environments;
|
|
2116
|
+
return Object.fromEntries(Object.entries(environments).filter(([name])=>libs.includes(name)));
|
|
2117
|
+
};
|
|
2118
|
+
async function build(config, options) {
|
|
2119
|
+
const environments = await composeRsbuildEnvironments(config);
|
|
2120
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2106
2121
|
rsbuildConfig: {
|
|
2107
|
-
environments
|
|
2122
|
+
environments: pruneEnvironments(environments, options?.lib)
|
|
2108
2123
|
}
|
|
2109
2124
|
});
|
|
2110
|
-
}
|
|
2111
|
-
async function build(config, options) {
|
|
2112
|
-
const rsbuildInstance = await initRsbuild(config);
|
|
2113
2125
|
await rsbuildInstance.build({
|
|
2114
2126
|
watch: options?.watch
|
|
2115
2127
|
});
|
|
2116
2128
|
return rsbuildInstance;
|
|
2117
2129
|
}
|
|
2130
|
+
async function startMFDevServer(config) {
|
|
2131
|
+
const rsbuildInstance = await initMFRsbuild(config);
|
|
2132
|
+
return rsbuildInstance;
|
|
2133
|
+
}
|
|
2134
|
+
async function initMFRsbuild(rslibConfig) {
|
|
2135
|
+
const rsbuildConfigObject = await composeCreateRsbuildConfig(rslibConfig);
|
|
2136
|
+
const mfRsbuildConfig = rsbuildConfigObject.find((config)=>'mf' === config.format);
|
|
2137
|
+
if (!mfRsbuildConfig) // no mf format, return.
|
|
2138
|
+
return;
|
|
2139
|
+
mfRsbuildConfig.config = changeEnvToDev(mfRsbuildConfig.config);
|
|
2140
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2141
|
+
rsbuildConfig: mfRsbuildConfig.config
|
|
2142
|
+
});
|
|
2143
|
+
await rsbuildInstance.startDevServer();
|
|
2144
|
+
return rsbuildInstance;
|
|
2145
|
+
}
|
|
2146
|
+
function changeEnvToDev(rsbuildConfig) {
|
|
2147
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.mergeRsbuildConfig)(rsbuildConfig, {
|
|
2148
|
+
mode: 'development',
|
|
2149
|
+
dev: {
|
|
2150
|
+
writeToDisk: true
|
|
2151
|
+
},
|
|
2152
|
+
tools: {
|
|
2153
|
+
rspack: {
|
|
2154
|
+
optimization: {
|
|
2155
|
+
nodeEnv: 'development'
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2118
2161
|
const applyCommonOptions = (command)=>{
|
|
2119
2162
|
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file');
|
|
2120
2163
|
};
|
|
2164
|
+
const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
2165
|
+
value
|
|
2166
|
+
]);
|
|
2121
2167
|
function runCli() {
|
|
2122
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.
|
|
2168
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.18");
|
|
2123
2169
|
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
|
|
2124
2170
|
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
|
|
2171
|
+
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('mf dev');
|
|
2125
2172
|
[
|
|
2126
2173
|
buildCommand,
|
|
2127
|
-
inspectCommand
|
|
2174
|
+
inspectCommand,
|
|
2175
|
+
mfDevCommand
|
|
2128
2176
|
].forEach(applyCommonOptions);
|
|
2129
|
-
buildCommand.option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the library for production').action(async (options)=>{
|
|
2177
|
+
buildCommand.option('--lib <name>', 'build the specified library (may be repeated)', repeatableOption).option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the library for production').action(async (options)=>{
|
|
2130
2178
|
try {
|
|
2131
2179
|
const rslibConfig = await loadConfig({
|
|
2132
2180
|
path: options.config,
|
|
@@ -2139,14 +2187,19 @@ function runCli() {
|
|
|
2139
2187
|
process.exit(1);
|
|
2140
2188
|
}
|
|
2141
2189
|
});
|
|
2142
|
-
inspectCommand.description('inspect the Rsbuild / Rspack configs of Rslib projects').option('--output <output>', 'specify inspect content output path', '.rsbuild').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
2190
|
+
inspectCommand.description('inspect the Rsbuild / Rspack configs of Rslib projects').option('--lib <name>', 'inspect the specified library (may be repeated)', repeatableOption).option('--output <output>', 'specify inspect content output path', '.rsbuild').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
2143
2191
|
try {
|
|
2144
2192
|
// TODO: inspect should output Rslib's config
|
|
2145
2193
|
const rslibConfig = await loadConfig({
|
|
2146
2194
|
path: options.config,
|
|
2147
2195
|
envMode: options.envMode
|
|
2148
2196
|
});
|
|
2149
|
-
const
|
|
2197
|
+
const environments = await composeRsbuildEnvironments(rslibConfig);
|
|
2198
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2199
|
+
rsbuildConfig: {
|
|
2200
|
+
environments: pruneEnvironments(environments, options.lib)
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2150
2203
|
await rsbuildInstance.inspectConfig({
|
|
2151
2204
|
mode: options.mode,
|
|
2152
2205
|
verbose: options.verbose,
|
|
@@ -2159,8 +2212,21 @@ function runCli() {
|
|
|
2159
2212
|
process.exit(1);
|
|
2160
2213
|
}
|
|
2161
2214
|
});
|
|
2215
|
+
mfDevCommand.description('start Rsbuild dev server of Module Federation format').action(async (options)=>{
|
|
2216
|
+
try {
|
|
2217
|
+
const rslibConfig = await loadConfig({
|
|
2218
|
+
path: options.config,
|
|
2219
|
+
envMode: options.envMode
|
|
2220
|
+
});
|
|
2221
|
+
await startMFDevServer(rslibConfig);
|
|
2222
|
+
} catch (err) {
|
|
2223
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.error('Failed to start mf dev.');
|
|
2224
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.error(err);
|
|
2225
|
+
process.exit(1);
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2162
2228
|
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
|
|
2163
2229
|
}
|
|
2164
|
-
const src_version = "0.0.
|
|
2230
|
+
const src_version = "0.0.18";
|
|
2165
2231
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
|
|
2166
2232
|
export { build, defineConfig, loadConfig, prepareCli, runCli, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger };
|
package/dist-types/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RsbuildInstance } from '@rsbuild/core';
|
|
2
2
|
import type { BuildOptions } from './cli/commands';
|
|
3
3
|
import type { RslibConfig } from './types/config';
|
|
4
4
|
export declare function build(config: RslibConfig, options?: BuildOptions): Promise<RsbuildInstance>;
|
package/dist-types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type EnvironmentConfig, type RsbuildConfig } from '@rsbuild/core';
|
|
2
2
|
import type { AutoExternal, BannerAndFooter, Format, LibConfig, PkgJson, RslibConfig, RslibConfigAsyncFn, RslibConfigExport, RslibConfigSyncFn } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* This function helps you to autocomplete configuration types.
|
|
@@ -27,4 +27,5 @@ export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig, pat
|
|
|
27
27
|
format: Format;
|
|
28
28
|
config: RsbuildConfig;
|
|
29
29
|
}[]>;
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function composeRsbuildEnvironments(rslibConfig: RslibConfig): Promise<Record<string, EnvironmentConfig>>;
|
|
31
|
+
export declare const pruneEnvironments: (environments: Record<string, EnvironmentConfig>, libs?: string[]) => Record<string, EnvironmentConfig>;
|
|
@@ -11,6 +11,7 @@ export type Dts = (Pick<PluginDtsOptions, 'bundle' | 'distPath' | 'abortOnError'
|
|
|
11
11
|
}) | boolean;
|
|
12
12
|
export type AutoExternal = boolean | {
|
|
13
13
|
dependencies?: boolean;
|
|
14
|
+
optionalDependencies?: boolean;
|
|
14
15
|
devDependencies?: boolean;
|
|
15
16
|
peerDependencies?: boolean;
|
|
16
17
|
};
|
|
@@ -33,18 +34,79 @@ export type Redirect = {
|
|
|
33
34
|
style?: boolean;
|
|
34
35
|
};
|
|
35
36
|
export interface LibConfig extends RsbuildConfig {
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Output format for the generated JavaScript files.
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
37
41
|
format?: Format;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to bundle the library.
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
bundle?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether to automatically set the file extension based on the `format` option in the JavaScript output files.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
38
51
|
autoExtension?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to automatically externalize dependencies of different dependency types and do not bundle them.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
39
56
|
autoExternal?: AutoExternal;
|
|
57
|
+
/**
|
|
58
|
+
* Configure the redirect of the import paths, applicable when `bundle: false`.
|
|
59
|
+
* @default {}
|
|
60
|
+
*/
|
|
40
61
|
redirect?: Redirect;
|
|
41
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Configure the syntax to which JavaScript and CSS will be downgraded.
|
|
64
|
+
* Support ECMAScript version and browserslist query.
|
|
65
|
+
* @default 'esnext'
|
|
66
|
+
*/
|
|
42
67
|
syntax?: Syntax;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to import SWC helper functions from `@swc/helpers` instead of inlining them.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
43
72
|
externalHelpers?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Inject content into the top of each JS, CSS or DTS file.
|
|
75
|
+
* @default {}
|
|
76
|
+
*/
|
|
44
77
|
banner?: BannerAndFooter;
|
|
78
|
+
/**
|
|
79
|
+
* Inject content into the bottom of each JS, CSS or DTS file.
|
|
80
|
+
* @default {}
|
|
81
|
+
*/
|
|
45
82
|
footer?: BannerAndFooter;
|
|
83
|
+
/**
|
|
84
|
+
* Configure the shims for CommonJS and ESM output.
|
|
85
|
+
*
|
|
86
|
+
* @default
|
|
87
|
+
* ```js
|
|
88
|
+
* const defaultShims = {
|
|
89
|
+
* cjs: {
|
|
90
|
+
* 'import.meta.url': true,
|
|
91
|
+
* },
|
|
92
|
+
* esm: {
|
|
93
|
+
* __filename: false,
|
|
94
|
+
* __dirname: false,
|
|
95
|
+
* require: false,
|
|
96
|
+
* },
|
|
97
|
+
* };
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
46
100
|
shims?: Shims;
|
|
101
|
+
/**
|
|
102
|
+
* Configure the generation of the TypeScript declaration files.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
47
105
|
dts?: Dts;
|
|
106
|
+
/**
|
|
107
|
+
* The export name of the UMD bundle.
|
|
108
|
+
* @default undefined
|
|
109
|
+
*/
|
|
48
110
|
umdName?: string;
|
|
49
111
|
}
|
|
50
112
|
export type LibOnlyConfig = Omit<LibConfig, keyof RsbuildConfig>;
|
|
@@ -10,4 +10,4 @@ export declare const LATEST_TARGET_VERSIONS: Record<NonNullable<RsbuildConfigOut
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string | string[]>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
|
|
12
12
|
export declare function transformSyntaxToRspackTarget(syntax: Syntax): Rspack.Configuration['target'];
|
|
13
|
-
export declare function transformSyntaxToBrowserslist(syntax: Syntax, target
|
|
13
|
+
export declare function transformSyntaxToBrowserslist(syntax: Syntax, target: NonNullable<RsbuildConfig['output']>['target']): NonNullable<NonNullable<RsbuildConfig['output']>['overrideBrowserslist']>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "The
|
|
3
|
+
"version": "0.0.18",
|
|
4
|
+
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/web-infra-dev/rslib/issues"
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"compiled"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rsbuild/core": "~1.0
|
|
35
|
+
"@rsbuild/core": "~1.1.0",
|
|
36
36
|
"tinyglobby": "^0.2.10",
|
|
37
|
-
"rsbuild-plugin-dts": "0.0.
|
|
37
|
+
"rsbuild-plugin-dts": "0.0.18"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@rspack/core": "1.0.8",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"memfs": "^4.14.0",
|
|
45
45
|
"picocolors": "1.1.1",
|
|
46
46
|
"prebundle": "1.2.5",
|
|
47
|
-
"rslib": "npm:@rslib/core@0.0.
|
|
47
|
+
"rslib": "npm:@rslib/core@0.0.17",
|
|
48
48
|
"rslog": "^1.2.3",
|
|
49
49
|
"tsconfck": "3.1.4",
|
|
50
50
|
"typescript": "^5.6.3",
|