@rslib/core 0.19.1 → 0.19.2
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/dist/index.js
CHANGED
|
@@ -1029,19 +1029,27 @@ const composeEntryChunkConfig = ({ enabledImportMetaUrlShim, useLoader, contextT
|
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
1031
|
});
|
|
1032
|
-
const
|
|
1033
|
-
name: 'rsbuild:cjs-
|
|
1032
|
+
const pluginCjsShims = (enabledShims)=>({
|
|
1033
|
+
name: 'rsbuild:cjs-shims',
|
|
1034
1034
|
setup (api) {
|
|
1035
1035
|
api.modifyEnvironmentConfig((config)=>{
|
|
1036
1036
|
config.source.define = {
|
|
1037
1037
|
...config.source.define,
|
|
1038
|
-
'import.meta.url'
|
|
1038
|
+
...enabledShims['import.meta.url'] && {
|
|
1039
|
+
'import.meta.url': '__rslib_import_meta_url__'
|
|
1040
|
+
},
|
|
1041
|
+
...enabledShims['import.meta.dirname'] && {
|
|
1042
|
+
'import.meta.dirname': '__dirname'
|
|
1043
|
+
},
|
|
1044
|
+
...enabledShims['import.meta.filename'] && {
|
|
1045
|
+
'import.meta.filename': '__filename'
|
|
1046
|
+
}
|
|
1039
1047
|
};
|
|
1040
1048
|
});
|
|
1041
1049
|
}
|
|
1042
1050
|
});
|
|
1043
1051
|
const requireShim = `// Rslib ESM shims
|
|
1044
|
-
import __rslib_shim_module__ from
|
|
1052
|
+
import __rslib_shim_module__ from "node:module";
|
|
1045
1053
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
1046
1054
|
`;
|
|
1047
1055
|
const pluginEsmRequireShim = ()=>({
|
|
@@ -2267,7 +2275,9 @@ const composeBundleConfig = (bundle)=>{
|
|
|
2267
2275
|
const composeShimsConfig = (format, shims)=>{
|
|
2268
2276
|
const resolvedShims = {
|
|
2269
2277
|
cjs: {
|
|
2270
|
-
'import.meta.url': shims?.cjs?.['import.meta.url'] ?? true
|
|
2278
|
+
'import.meta.url': shims?.cjs?.['import.meta.url'] ?? true,
|
|
2279
|
+
'import.meta.dirname': shims?.cjs?.['import.meta.dirname'] ?? true,
|
|
2280
|
+
'import.meta.filename': shims?.cjs?.['import.meta.filename'] ?? true
|
|
2271
2281
|
},
|
|
2272
2282
|
esm: {
|
|
2273
2283
|
__filename: shims?.esm?.__filename ?? false,
|
|
@@ -2277,7 +2287,9 @@ const composeShimsConfig = (format, shims)=>{
|
|
|
2277
2287
|
};
|
|
2278
2288
|
const enabledShims = {
|
|
2279
2289
|
cjs: 'cjs' === format ? resolvedShims.cjs : {
|
|
2280
|
-
'import.meta.url': false
|
|
2290
|
+
'import.meta.url': false,
|
|
2291
|
+
'import.meta.dirname': false,
|
|
2292
|
+
'import.meta.filename': false
|
|
2281
2293
|
},
|
|
2282
2294
|
esm: 'esm' === format ? resolvedShims.esm : {
|
|
2283
2295
|
__filename: false,
|
|
@@ -2307,7 +2319,7 @@ const composeShimsConfig = (format, shims)=>{
|
|
|
2307
2319
|
case 'cjs':
|
|
2308
2320
|
rsbuildConfig = {
|
|
2309
2321
|
plugins: [
|
|
2310
|
-
resolvedShims.cjs
|
|
2322
|
+
pluginCjsShims(resolvedShims.cjs),
|
|
2311
2323
|
disableUrlParseRsbuildPlugin(),
|
|
2312
2324
|
fixJsModuleTypePlugin()
|
|
2313
2325
|
].filter(Boolean)
|
|
@@ -2947,8 +2959,8 @@ async function createRslib(options = {}) {
|
|
|
2947
2959
|
config.plugins.push({
|
|
2948
2960
|
name: 'rslib:on-after-build',
|
|
2949
2961
|
setup (api) {
|
|
2950
|
-
api.onAfterBuild(({ isFirstCompile })=>{
|
|
2951
|
-
if (isFirstCompile) logger.success('build
|
|
2962
|
+
api.onAfterBuild(({ isFirstCompile, stats })=>{
|
|
2963
|
+
if (isFirstCompile) stats?.hasErrors() ? logger.error('build completed with errors, watching for changes...') : logger.success('build completed, watching for changes...');
|
|
2952
2964
|
});
|
|
2953
2965
|
}
|
|
2954
2966
|
});
|
|
@@ -3169,7 +3181,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3169
3181
|
};
|
|
3170
3182
|
function setupCommands() {
|
|
3171
3183
|
const cli = dist('rslib');
|
|
3172
|
-
cli.version("0.19.
|
|
3184
|
+
cli.version("0.19.2");
|
|
3173
3185
|
applyCommonOptions(cli);
|
|
3174
3186
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3175
3187
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3269,7 +3281,7 @@ function showGreeting() {
|
|
|
3269
3281
|
const isBun = npm_execpath?.includes('.bun');
|
|
3270
3282
|
const isNodeRun = Boolean(NODE_RUN_SCRIPT_NAME);
|
|
3271
3283
|
const prefix = isNpx || isBun || isNodeRun ? '\n' : '';
|
|
3272
|
-
logger.greet(`${prefix}Rslib v0.19.
|
|
3284
|
+
logger.greet(`${prefix}Rslib v0.19.2\n`);
|
|
3273
3285
|
}
|
|
3274
3286
|
function setupLogLevel() {
|
|
3275
3287
|
const logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -3322,7 +3334,7 @@ function mergeRslibConfig(...originalConfigs) {
|
|
|
3322
3334
|
if (void 0 !== mergedLib) mergedConfig.lib = mergedLib;
|
|
3323
3335
|
return mergedConfig;
|
|
3324
3336
|
}
|
|
3325
|
-
const src_version = "0.19.
|
|
3337
|
+
const src_version = "0.19.2";
|
|
3326
3338
|
var loadEnv = __rspack_external__rsbuild_core_1b356efc.loadEnv;
|
|
3327
3339
|
var rspack = __rspack_external__rsbuild_core_1b356efc.rspack;
|
|
3328
3340
|
export { __rspack_external__rsbuild_core_1b356efc as rsbuild, createRslib, defineConfig, loadConfig, loadEnv, mergeRslibConfig, rspack, runCLI, src_version as version };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const pluginCjsShims: (enabledShims: {
|
|
3
|
+
"import.meta.url"?: boolean;
|
|
4
|
+
"import.meta.dirname"?: boolean;
|
|
5
|
+
"import.meta.filename"?: boolean;
|
|
6
|
+
}) => RsbuildPlugin;
|
|
3
7
|
export declare const pluginEsmRequireShim: () => RsbuildPlugin;
|
|
@@ -109,6 +109,18 @@ export type Shims = {
|
|
|
109
109
|
* @see {@link https://rslib.rs/config/lib/shims#shimscjsimportmetaurl}
|
|
110
110
|
*/
|
|
111
111
|
'import.meta.url'?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether to inject shims for the `import.meta.dirname` in CommonJS output.
|
|
114
|
+
* @defaultValue `true`
|
|
115
|
+
* @see {@link https://rslib.rs/config/lib/shims#shimscjsimportmetadirname}
|
|
116
|
+
*/
|
|
117
|
+
'import.meta.dirname'?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Whether to inject shims for the `import.meta.filename` in CommonJS output.
|
|
120
|
+
* @defaultValue `true`
|
|
121
|
+
* @see {@link https://rslib.rs/config/lib/shims#shimscjsimportmetafilename}
|
|
122
|
+
*/
|
|
123
|
+
'import.meta.filename'?: boolean;
|
|
112
124
|
};
|
|
113
125
|
/**
|
|
114
126
|
* Configure the shims for ESM output.
|
|
@@ -270,6 +282,8 @@ export interface LibConfig extends EnvironmentConfig {
|
|
|
270
282
|
* const defaultShims = {
|
|
271
283
|
* cjs: {
|
|
272
284
|
* 'import.meta.url': true,
|
|
285
|
+
* 'import.meta.dirname': true,
|
|
286
|
+
* 'import.meta.filename': true,
|
|
273
287
|
* },
|
|
274
288
|
* esm: {
|
|
275
289
|
* __filename: false,
|
|
@@ -3,7 +3,7 @@ import type { FixedEcmaVersions, LatestEcmaVersions, RsbuildConfigOutputTarget,
|
|
|
3
3
|
export declare const LATEST_TARGET_VERSIONS: Record<NonNullable<RsbuildConfigOutputTarget>, string[]>;
|
|
4
4
|
/**
|
|
5
5
|
* The esX to browserslist mapping is transformed from
|
|
6
|
-
* https://github.com/
|
|
6
|
+
* https://github.com/rstackjs/browserslist-to-es-version
|
|
7
7
|
*/
|
|
8
8
|
export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
|
|
9
9
|
export declare function transformSyntaxToRspackTarget(syntax: Syntax): Rspack.Configuration['target'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "
|
|
40
|
-
"rsbuild-plugin-dts": "0.19.
|
|
39
|
+
"@rsbuild/core": "1.7.1",
|
|
40
|
+
"rsbuild-plugin-dts": "0.19.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@module-federation/rsbuild-plugin": "^0.22.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
51
|
"prebundle": "1.6.0",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.19.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.19.1",
|
|
54
54
|
"rslog": "^1.3.2",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|