@rslib/core 0.18.1 → 0.18.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -29
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
1
+ import * as __rspack_external__rsbuild_core_1b356efc from "@rsbuild/core";
2
2
  import node_fs, { promises } from "node:fs";
3
3
  import { glob } from "../compiled/tinyglobby/index.js";
4
4
  import { createRequire } from "node:module";
@@ -20,7 +20,7 @@ class LibSvgrPatchPlugin {
20
20
  const chunkAsset = Object.keys(assets).filter((name)=>/js$/.test(name));
21
21
  for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
22
22
  const oldSource = old.source().toString();
23
- const newSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
23
+ const newSource = new __rspack_external__rsbuild_core_1b356efc.rspack.sources.ReplaceSource(old);
24
24
  const pattern = new RegExp(`\\(?['"]${PUBLIC_PATH_PLACEHOLDER}(.*)['"]\\)?`, 'g');
25
25
  const matches = [
26
26
  ...oldSource.matchAll(pattern)
@@ -164,7 +164,7 @@ class LibCssExtractPlugin {
164
164
  const chunkAsset = Object.keys(assets).filter((name)=>/\.css/.test(name));
165
165
  for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
166
166
  const oldSource = old.source().toString();
167
- const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
167
+ const replaceSource = new __rspack_external__rsbuild_core_1b356efc.rspack.sources.ReplaceSource(old);
168
168
  function replace(searchValue, replaceValue) {
169
169
  let start = oldSource.indexOf(searchValue);
170
170
  while(-1 !== start){
@@ -291,7 +291,7 @@ class EntryChunkPlugin {
291
291
  const chunkAsset = Object.keys(assets).filter((name)=>JS_EXTENSIONS_PATTERN.test(name) && this.shimsInjectedAssets.has(name));
292
292
  for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
293
293
  const oldSource = old.source().toString();
294
- const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
294
+ const replaceSource = new __rspack_external__rsbuild_core_1b356efc.rspack.sources.ReplaceSource(old);
295
295
  if (oldSource.startsWith('#!')) {
296
296
  const firstLineEnd = oldSource.indexOf('\n');
297
297
  replaceSource.insert(firstLineEnd + 1, IMPORT_META_URL_SHIM);
@@ -346,9 +346,9 @@ const pluginEsmRequireShim = ()=>({
346
346
  setup (api) {
347
347
  api.modifyRspackConfig((config)=>{
348
348
  config.plugins ??= [];
349
- config.plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
349
+ config.plugins.push(new __rspack_external__rsbuild_core_1b356efc.rspack.BannerPlugin({
350
350
  banner: requireShim,
351
- stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
351
+ stage: __rspack_external__rsbuild_core_1b356efc.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
352
352
  raw: true,
353
353
  include: /\.(js|mjs)$/
354
354
  }));
@@ -1229,7 +1229,7 @@ async function loadConfig({ cwd = process.cwd(), path, envMode, loader }) {
1229
1229
  },
1230
1230
  filePath: void 0
1231
1231
  };
1232
- const { content } = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadConfig)({
1232
+ const { content } = await (0, __rspack_external__rsbuild_core_1b356efc.loadConfig)({
1233
1233
  cwd: dirname(configFilePath),
1234
1234
  path: configFilePath,
1235
1235
  envMode,
@@ -1392,30 +1392,30 @@ function composeBannerFooterConfig(banner, footer) {
1392
1392
  if (isEmptyObject(bannerConfig) && isEmptyObject(footerConfig)) return {};
1393
1393
  const plugins = [];
1394
1394
  if (!isEmptyObject(bannerConfig)) {
1395
- if (bannerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
1395
+ if (bannerConfig.js) plugins.push(new __rspack_external__rsbuild_core_1b356efc.rspack.BannerPlugin({
1396
1396
  banner: bannerConfig.js,
1397
- stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1397
+ stage: __rspack_external__rsbuild_core_1b356efc.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1398
1398
  raw: true,
1399
1399
  include: /\.(js|mjs|cjs)$/
1400
1400
  }));
1401
- if (bannerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
1401
+ if (bannerConfig.css) plugins.push(new __rspack_external__rsbuild_core_1b356efc.rspack.BannerPlugin({
1402
1402
  banner: bannerConfig.css,
1403
- stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1403
+ stage: __rspack_external__rsbuild_core_1b356efc.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1404
1404
  raw: true,
1405
1405
  include: /\.(css)$/
1406
1406
  }));
1407
1407
  }
1408
1408
  if (!isEmptyObject(footerConfig)) {
1409
- if (footerConfig.js) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
1409
+ if (footerConfig.js) plugins.push(new __rspack_external__rsbuild_core_1b356efc.rspack.BannerPlugin({
1410
1410
  banner: footerConfig.js,
1411
- stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1411
+ stage: __rspack_external__rsbuild_core_1b356efc.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1412
1412
  raw: true,
1413
1413
  footer: true,
1414
1414
  include: /\.(js|mjs|cjs)$/
1415
1415
  }));
1416
- if (footerConfig.css) plugins.push(new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.BannerPlugin({
1416
+ if (footerConfig.css) plugins.push(new __rspack_external__rsbuild_core_1b356efc.rspack.BannerPlugin({
1417
1417
  banner: footerConfig.css,
1418
- stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1418
+ stage: __rspack_external__rsbuild_core_1b356efc.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
1419
1419
  raw: true,
1420
1420
  footer: true,
1421
1421
  include: /\.(css)$/
@@ -1457,7 +1457,7 @@ function composePrintFileSizeConfig(bundle, target) {
1457
1457
  };
1458
1458
  }
1459
1459
  async function createConstantRsbuildConfig() {
1460
- return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.defineConfig)({
1460
+ return (0, __rspack_external__rsbuild_core_1b356efc.defineConfig)({
1461
1461
  performance: {
1462
1462
  chunkSplit: {
1463
1463
  strategy: 'custom'
@@ -1533,11 +1533,11 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1533
1533
  };
1534
1534
  const experimentalEsmOutput = bundle && 'esm' === format && advancedEsm;
1535
1535
  const plugins = [
1536
- new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.experiments.RslibPlugin({
1536
+ new __rspack_external__rsbuild_core_1b356efc.rspack.experiments.RslibPlugin({
1537
1537
  interceptApiPlugin: true,
1538
1538
  forceNodeShims: enabledShims.esm.__dirname || enabledShims.esm.__filename
1539
1539
  }),
1540
- experimentalEsmOutput && new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.experiments.EsmLibraryPlugin()
1540
+ experimentalEsmOutput && new __rspack_external__rsbuild_core_1b356efc.rspack.experiments.EsmLibraryPlugin()
1541
1541
  ].filter(Boolean);
1542
1542
  switch(format){
1543
1543
  case 'esm':
@@ -1910,7 +1910,7 @@ const composeOutputFilenameConfig = (config, format, autoExtension, multiCompile
1910
1910
  }
1911
1911
  }
1912
1912
  };
1913
- const finalConfig = userJsFilename ? chunkFilename : (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(chunkFilename, {
1913
+ const finalConfig = userJsFilename ? chunkFilename : (0, __rspack_external__rsbuild_core_1b356efc.mergeRsbuildConfig)(chunkFilename, {
1914
1914
  output: {
1915
1915
  filename: {
1916
1916
  js: defaultJsFilename
@@ -2276,7 +2276,7 @@ async function composeLibRsbuildConfig(config, multiCompilerIndex, root, sharedP
2276
2276
  const bannerFooterConfig = composeBannerFooterConfig(banner, footer);
2277
2277
  const decoratorsConfig = composeDecoratorsConfig(compilerOptions, config.source?.decorators?.version);
2278
2278
  const printFileSizeConfig = composePrintFileSizeConfig(bundle, target);
2279
- return (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(bundleConfig, formatConfig, shimsConfig, syntaxConfig, externalHelpersConfig, outputFilenameConfig, targetConfig, externalsWarnConfig, userExternalsConfig, autoExternalConfig, targetExternalsConfig, bundlelessExternalConfig, entryConfig, cssConfig, assetConfig, entryChunkConfig, minifyConfig, dtsConfig, bannerFooterConfig, decoratorsConfig, printFileSizeConfig);
2279
+ return (0, __rspack_external__rsbuild_core_1b356efc.mergeRsbuildConfig)(bundleConfig, formatConfig, shimsConfig, syntaxConfig, externalHelpersConfig, outputFilenameConfig, targetConfig, externalsWarnConfig, userExternalsConfig, autoExternalConfig, targetExternalsConfig, bundlelessExternalConfig, entryConfig, cssConfig, assetConfig, entryChunkConfig, minifyConfig, dtsConfig, bannerFooterConfig, decoratorsConfig, printFileSizeConfig);
2280
2280
  }
2281
2281
  async function composeCreateRsbuildConfig(rslibConfig) {
2282
2282
  const constantRsbuildConfig = await createConstantRsbuildConfig();
@@ -2284,7 +2284,7 @@ async function composeCreateRsbuildConfig(rslibConfig) {
2284
2284
  if (logLevel && !isDebug()) logger.level = logLevel;
2285
2285
  if (!Array.isArray(libConfigsArray) || 0 === libConfigsArray.length) throw new Error(`Expect "lib" field to be a non-empty array, but got: ${picocolors.cyan(JSON.stringify(libConfigsArray))}.`);
2286
2286
  const libConfigPromises = libConfigsArray.map(async (libConfig, index)=>{
2287
- const userConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
2287
+ const userConfig = (0, __rspack_external__rsbuild_core_1b356efc.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
2288
2288
  const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, libConfigsArray.length > 1 ? index : null, root, sharedPlugins);
2289
2289
  userConfig.source ??= {};
2290
2290
  userConfig.source.entry = {};
@@ -2292,7 +2292,7 @@ async function composeCreateRsbuildConfig(rslibConfig) {
2292
2292
  delete userConfig.output.externals;
2293
2293
  const config = {
2294
2294
  format: libConfig.format ?? 'esm',
2295
- config: (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
2295
+ config: (0, __rspack_external__rsbuild_core_1b356efc.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
2296
2296
  id: true,
2297
2297
  bundle: true,
2298
2298
  format: true,
@@ -2391,7 +2391,7 @@ const beforeRestart = async ({ filePath, clear = true } = {})=>{
2391
2391
  };
2392
2392
  async function build(config, options = {}) {
2393
2393
  const { environments } = await composeRsbuildEnvironments(config);
2394
- const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2394
+ const rsbuildInstance = await (0, __rspack_external__rsbuild_core_1b356efc.createRsbuild)({
2395
2395
  callerName: 'rslib',
2396
2396
  config: {
2397
2397
  mode: 'production',
@@ -2972,7 +2972,7 @@ const applyCliOptions = (config, options, root)=>{
2972
2972
  async function initConfig(options) {
2973
2973
  const cwd = process.cwd();
2974
2974
  const root = options.root ? getAbsolutePath(cwd, options.root) : cwd;
2975
- const envs = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadEnv)({
2975
+ const envs = (0, __rspack_external__rsbuild_core_1b356efc.loadEnv)({
2976
2976
  cwd: getEnvDir(root, options.envDir),
2977
2977
  mode: options.envMode
2978
2978
  });
@@ -3015,7 +3015,7 @@ async function initConfig(options) {
3015
3015
  }
3016
3016
  async function inspect(config, options = {}) {
3017
3017
  const { environments } = await composeRsbuildEnvironments(config);
3018
- const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3018
+ const rsbuildInstance = await (0, __rspack_external__rsbuild_core_1b356efc.createRsbuild)({
3019
3019
  callerName: 'rslib',
3020
3020
  config: {
3021
3021
  mode: 'production',
@@ -3051,7 +3051,7 @@ async function initMFRsbuild(config, options = {}) {
3051
3051
  }).map((env)=>env.id);
3052
3052
  if (!selectedEnvironmentIds.length) throw new Error(`No mf format found in ${options.lib ? `libs ${options.lib.map((lib)=>`"${lib}"`).join(', ')}` : 'your config'}, please check your config to ensure that the mf format is enabled correctly.`);
3053
3053
  const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
3054
- const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3054
+ const rsbuildInstance = await (0, __rspack_external__rsbuild_core_1b356efc.createRsbuild)({
3055
3055
  callerName: 'rslib',
3056
3056
  config: {
3057
3057
  mode: 'development',
@@ -3079,7 +3079,7 @@ const applyCommonOptions = (cli)=>{
3079
3079
  };
3080
3080
  function runCli() {
3081
3081
  const cli = dist('rslib');
3082
- cli.version("0.18.1");
3082
+ cli.version("0.18.2");
3083
3083
  applyCommonOptions(cli);
3084
3084
  const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
3085
3085
  const buildCommand = cli.command('', buildDescription).alias('build');
@@ -3195,9 +3195,9 @@ function prepareCli() {
3195
3195
  setupLogLevel();
3196
3196
  const { npm_execpath } = process.env;
3197
3197
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
3198
- logger.greet(` Rslib v0.18.1\n`);
3198
+ logger.greet(` Rslib v0.18.2\n`);
3199
3199
  }
3200
- const src_version = "0.18.1";
3200
+ const src_version = "0.18.2";
3201
3201
  export * as rsbuild from "@rsbuild/core";
3202
3202
  export { logger } from "../compiled/rslog/index.js";
3203
3203
  export { rspack } from "@rsbuild/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.18.1",
3
+ "version": "0.18.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": "~1.6.8",
40
- "rsbuild-plugin-dts": "0.18.1"
39
+ "@rsbuild/core": "~1.6.9",
40
+ "rsbuild-plugin-dts": "0.18.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@module-federation/rsbuild-plugin": "^0.21.6",