@rslib/core 0.0.15 → 0.0.17
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/bin/rslib.js +13 -1
- package/dist/index.js +104 -41
- 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/index.d.ts +1 -1
- package/dist-types/mf.d.ts +3 -0
- package/dist-types/types/config/index.d.ts +65 -3
- package/dist-types/utils/syntax.d.ts +1 -1
- package/package.json +6 -6
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/bin/rslib.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import nodeModule from 'node:module';
|
|
3
|
+
|
|
4
|
+
// enable on-disk code caching of all modules loaded by Node.js
|
|
5
|
+
// requires Nodejs >= 22.8.0
|
|
6
|
+
const { enableCompileCache } = nodeModule;
|
|
7
|
+
if (enableCompileCache) {
|
|
8
|
+
try {
|
|
9
|
+
enableCompileCache();
|
|
10
|
+
} catch {
|
|
11
|
+
// ignore errors
|
|
12
|
+
}
|
|
13
|
+
}
|
|
3
14
|
|
|
4
15
|
async function main() {
|
|
16
|
+
const { logger, prepareCli, runCli } = await import('../dist/index.js');
|
|
5
17
|
prepareCli();
|
|
6
18
|
|
|
7
19
|
try {
|
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.17\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: './'
|
|
@@ -1783,7 +1780,7 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1783
1780
|
dtsExtension
|
|
1784
1781
|
};
|
|
1785
1782
|
};
|
|
1786
|
-
const composeSyntaxConfig = (
|
|
1783
|
+
const composeSyntaxConfig = (target, syntax)=>{
|
|
1787
1784
|
// Defaults to ESNext, Rslib will assume all of the latest JavaScript and CSS features are supported.
|
|
1788
1785
|
if (syntax) return {
|
|
1789
1786
|
tools: {
|
|
@@ -1923,6 +1920,7 @@ const composeDtsConfig = async (libConfig, dtsExtension)=>{
|
|
|
1923
1920
|
// Only setting dts.bundle to true will generate the bundled d.ts.
|
|
1924
1921
|
bundle: dts?.bundle ?? false,
|
|
1925
1922
|
distPath: dts?.distPath ?? output?.distPath?.root ?? './dist',
|
|
1923
|
+
build: dts?.build ?? false,
|
|
1926
1924
|
abortOnError: dts?.abortOnError ?? true,
|
|
1927
1925
|
dtsExtension: dts?.autoExtension ? dtsExtension : '.d.ts',
|
|
1928
1926
|
autoExternal,
|
|
@@ -1932,34 +1930,40 @@ const composeDtsConfig = async (libConfig, dtsExtension)=>{
|
|
|
1932
1930
|
]
|
|
1933
1931
|
};
|
|
1934
1932
|
};
|
|
1935
|
-
const composeTargetConfig = (target = '
|
|
1933
|
+
const composeTargetConfig = (target = 'node')=>{
|
|
1936
1934
|
switch(target){
|
|
1937
1935
|
case 'web':
|
|
1938
1936
|
return {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1937
|
+
config: {
|
|
1938
|
+
tools: {
|
|
1939
|
+
rspack: {
|
|
1940
|
+
target: [
|
|
1941
|
+
'web'
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
1944
|
}
|
|
1945
|
-
}
|
|
1945
|
+
},
|
|
1946
|
+
target: 'web'
|
|
1946
1947
|
};
|
|
1947
1948
|
case 'node':
|
|
1948
1949
|
return {
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1950
|
+
config: {
|
|
1951
|
+
tools: {
|
|
1952
|
+
rspack: {
|
|
1953
|
+
target: [
|
|
1954
|
+
'node'
|
|
1955
|
+
]
|
|
1956
|
+
}
|
|
1957
|
+
},
|
|
1958
|
+
output: {
|
|
1959
|
+
// When output.target is 'node', Node.js's built-in will be treated as externals of type `node-commonjs`.
|
|
1960
|
+
// Simply override the built-in modules to make them external.
|
|
1961
|
+
// https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L81
|
|
1962
|
+
externals: nodeBuiltInModules,
|
|
1963
|
+
target: 'node'
|
|
1954
1964
|
}
|
|
1955
1965
|
},
|
|
1956
|
-
|
|
1957
|
-
// When output.target is 'node', Node.js's built-in will be treated as externals of type `node-commonjs`.
|
|
1958
|
-
// Simply override the built-in modules to make them external.
|
|
1959
|
-
// https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L81
|
|
1960
|
-
externals: nodeBuiltInModules,
|
|
1961
|
-
target: 'node'
|
|
1962
|
-
}
|
|
1966
|
+
target: 'node'
|
|
1963
1967
|
};
|
|
1964
1968
|
// TODO: Support `neutral` target, however Rsbuild don't list it as an option in the target field.
|
|
1965
1969
|
// case 'neutral':
|
|
@@ -2020,8 +2024,8 @@ async function composeLibRsbuildConfig(config, configPath) {
|
|
|
2020
2024
|
const externalsConfig = composeExternalsConfig(format, config.output?.externals);
|
|
2021
2025
|
const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
|
|
2022
2026
|
const bundleConfig = composeBundleConfig(jsExtension, redirect, cssModulesAuto, bundle);
|
|
2023
|
-
const targetConfig = composeTargetConfig(config.output?.target);
|
|
2024
|
-
const syntaxConfig = composeSyntaxConfig(
|
|
2027
|
+
const { config: targetConfig, target } = composeTargetConfig(config.output?.target);
|
|
2028
|
+
const syntaxConfig = composeSyntaxConfig(target, config?.syntax);
|
|
2025
2029
|
const autoExternalConfig = composeAutoExternalConfig({
|
|
2026
2030
|
autoExternal,
|
|
2027
2031
|
pkgJson,
|
|
@@ -2083,7 +2087,7 @@ async function composeCreateRsbuildConfig(rslibConfig, path) {
|
|
|
2083
2087
|
const composedRsbuildConfig = await Promise.all(libConfigPromises);
|
|
2084
2088
|
return composedRsbuildConfig;
|
|
2085
2089
|
}
|
|
2086
|
-
async function
|
|
2090
|
+
async function composeRsbuildEnvironments(rslibConfig) {
|
|
2087
2091
|
const rsbuildConfigObject = await composeCreateRsbuildConfig(rslibConfig);
|
|
2088
2092
|
const environments = {};
|
|
2089
2093
|
const formatCount = rsbuildConfigObject.reduce((acc, { format })=>{
|
|
@@ -2101,31 +2105,72 @@ async function initRsbuild(rslibConfig) {
|
|
|
2101
2105
|
const currentFormatIndex = formatIndex[format]++;
|
|
2102
2106
|
environments[1 === currentFormatCount ? format : `${format}${currentFormatIndex}`] = config;
|
|
2103
2107
|
}
|
|
2104
|
-
return
|
|
2108
|
+
return environments;
|
|
2109
|
+
}
|
|
2110
|
+
const pruneEnvironments = (environments, libs)=>{
|
|
2111
|
+
if (!libs) return environments;
|
|
2112
|
+
return Object.fromEntries(Object.entries(environments).filter(([name])=>libs.includes(name)));
|
|
2113
|
+
};
|
|
2114
|
+
async function build(config, options) {
|
|
2115
|
+
const environments = await composeRsbuildEnvironments(config);
|
|
2116
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2105
2117
|
rsbuildConfig: {
|
|
2106
|
-
environments
|
|
2118
|
+
environments: pruneEnvironments(environments, options?.lib)
|
|
2107
2119
|
}
|
|
2108
2120
|
});
|
|
2109
|
-
}
|
|
2110
|
-
async function build(config, options) {
|
|
2111
|
-
const rsbuildInstance = await initRsbuild(config);
|
|
2112
2121
|
await rsbuildInstance.build({
|
|
2113
2122
|
watch: options?.watch
|
|
2114
2123
|
});
|
|
2115
2124
|
return rsbuildInstance;
|
|
2116
2125
|
}
|
|
2126
|
+
async function startMFDevServer(config) {
|
|
2127
|
+
const rsbuildInstance = await initMFRsbuild(config);
|
|
2128
|
+
return rsbuildInstance;
|
|
2129
|
+
}
|
|
2130
|
+
async function initMFRsbuild(rslibConfig) {
|
|
2131
|
+
const rsbuildConfigObject = await composeCreateRsbuildConfig(rslibConfig);
|
|
2132
|
+
const mfRsbuildConfig = rsbuildConfigObject.find((config)=>'mf' === config.format);
|
|
2133
|
+
if (!mfRsbuildConfig) // no mf format, return.
|
|
2134
|
+
return;
|
|
2135
|
+
mfRsbuildConfig.config = changeEnvToDev(mfRsbuildConfig.config);
|
|
2136
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2137
|
+
rsbuildConfig: mfRsbuildConfig.config
|
|
2138
|
+
});
|
|
2139
|
+
await rsbuildInstance.startDevServer();
|
|
2140
|
+
return rsbuildInstance;
|
|
2141
|
+
}
|
|
2142
|
+
function changeEnvToDev(rsbuildConfig) {
|
|
2143
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.mergeRsbuildConfig)(rsbuildConfig, {
|
|
2144
|
+
mode: 'development',
|
|
2145
|
+
dev: {
|
|
2146
|
+
writeToDisk: true
|
|
2147
|
+
},
|
|
2148
|
+
tools: {
|
|
2149
|
+
rspack: {
|
|
2150
|
+
optimization: {
|
|
2151
|
+
nodeEnv: 'development'
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2117
2157
|
const applyCommonOptions = (command)=>{
|
|
2118
2158
|
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');
|
|
2119
2159
|
};
|
|
2160
|
+
const repeatableOption = (value, previous)=>(previous ?? []).concat([
|
|
2161
|
+
value
|
|
2162
|
+
]);
|
|
2120
2163
|
function runCli() {
|
|
2121
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.
|
|
2164
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.0.17");
|
|
2122
2165
|
const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
|
|
2123
2166
|
const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
|
|
2167
|
+
const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('mf dev');
|
|
2124
2168
|
[
|
|
2125
2169
|
buildCommand,
|
|
2126
|
-
inspectCommand
|
|
2170
|
+
inspectCommand,
|
|
2171
|
+
mfDevCommand
|
|
2127
2172
|
].forEach(applyCommonOptions);
|
|
2128
|
-
buildCommand.option('-w --watch', 'turn on watch mode, watch for changes and rebuild').description('build the library for production').action(async (options)=>{
|
|
2173
|
+
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)=>{
|
|
2129
2174
|
try {
|
|
2130
2175
|
const rslibConfig = await loadConfig({
|
|
2131
2176
|
path: options.config,
|
|
@@ -2138,14 +2183,19 @@ function runCli() {
|
|
|
2138
2183
|
process.exit(1);
|
|
2139
2184
|
}
|
|
2140
2185
|
});
|
|
2141
|
-
inspectCommand.description('inspect the
|
|
2186
|
+
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)=>{
|
|
2142
2187
|
try {
|
|
2143
2188
|
// TODO: inspect should output Rslib's config
|
|
2144
2189
|
const rslibConfig = await loadConfig({
|
|
2145
2190
|
path: options.config,
|
|
2146
2191
|
envMode: options.envMode
|
|
2147
2192
|
});
|
|
2148
|
-
const
|
|
2193
|
+
const environments = await composeRsbuildEnvironments(rslibConfig);
|
|
2194
|
+
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.createRsbuild)({
|
|
2195
|
+
rsbuildConfig: {
|
|
2196
|
+
environments: pruneEnvironments(environments, options.lib)
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2149
2199
|
await rsbuildInstance.inspectConfig({
|
|
2150
2200
|
mode: options.mode,
|
|
2151
2201
|
verbose: options.verbose,
|
|
@@ -2158,8 +2208,21 @@ function runCli() {
|
|
|
2158
2208
|
process.exit(1);
|
|
2159
2209
|
}
|
|
2160
2210
|
});
|
|
2211
|
+
mfDevCommand.description('start Rsbuild dev server of Module Federation format').action(async (options)=>{
|
|
2212
|
+
try {
|
|
2213
|
+
const rslibConfig = await loadConfig({
|
|
2214
|
+
path: options.config,
|
|
2215
|
+
envMode: options.envMode
|
|
2216
|
+
});
|
|
2217
|
+
await startMFDevServer(rslibConfig);
|
|
2218
|
+
} catch (err) {
|
|
2219
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.error('Failed to start mf dev.');
|
|
2220
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.error(err);
|
|
2221
|
+
process.exit(1);
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2161
2224
|
__WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
|
|
2162
2225
|
}
|
|
2163
|
-
const src_version = "0.0.
|
|
2226
|
+
const src_version = "0.0.17";
|
|
2164
2227
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
|
|
2165
|
-
export { build, defineConfig, loadConfig, prepareCli, runCli, src_version as version, __webpack_exports__logger as logger };
|
|
2228
|
+
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>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { prepareCli } from './cli/prepare';
|
|
2
2
|
export { runCli } from './cli/commands';
|
|
3
|
-
export { defineConfig, loadConfig } from './config';
|
|
3
|
+
export { defineConfig, loadConfig, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, } from './config';
|
|
4
4
|
export { build } from './build';
|
|
5
5
|
export { logger } from './utils/logger';
|
|
6
6
|
export type * from './types';
|
|
@@ -6,11 +6,12 @@ export type LatestEcmaVersions = 'es2024' | 'esnext';
|
|
|
6
6
|
export type EcmaScriptVersion = FixedEcmaVersions | LatestEcmaVersions;
|
|
7
7
|
export type RsbuildConfigOutputTarget = NonNullable<RsbuildConfig['output']>['target'];
|
|
8
8
|
export type Syntax = EcmaScriptVersion | string[];
|
|
9
|
-
export type Dts = (Pick<PluginDtsOptions, 'bundle' | 'distPath' | 'abortOnError'> & {
|
|
9
|
+
export type Dts = (Pick<PluginDtsOptions, 'bundle' | 'distPath' | 'abortOnError' | 'build'> & {
|
|
10
10
|
autoExtension?: boolean;
|
|
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.17",
|
|
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.17"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@rspack/core": "1.0.8",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"fs-extra": "^11.2.0",
|
|
44
44
|
"memfs": "^4.14.0",
|
|
45
45
|
"picocolors": "1.1.1",
|
|
46
|
-
"prebundle": "1.2.
|
|
47
|
-
"rslib": "npm:@rslib/core@0.0.
|
|
46
|
+
"prebundle": "1.2.5",
|
|
47
|
+
"rslib": "npm:@rslib/core@0.0.16",
|
|
48
48
|
"rslog": "^1.2.3",
|
|
49
49
|
"tsconfck": "3.1.4",
|
|
50
50
|
"typescript": "^5.6.3",
|