@rslib/core 0.9.0 → 0.9.1

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 CHANGED
@@ -1,14 +1,14 @@
1
1
  <picture>
2
- <img alt="Rslib Banner" src="https://assets.rspack.dev/rslib/rslib-banner.png">
2
+ <img alt="Rslib Banner" src="https://assets.rspack.rs/rslib/rslib-banner.png">
3
3
  </picture>
4
4
 
5
5
  # Rslib
6
6
 
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.
7
+ Rslib is a library development tool powered by [Rsbuild](https://rsbuild.rs). It allows library developers to leverage the knowledge and ecosystem of webpack and Rspack.
8
8
 
9
9
  ## Documentation
10
10
 
11
- https://lib.rsbuild.dev/
11
+ https://rslib.rs/
12
12
 
13
13
  ## Contributing
14
14
 
package/dist/index.js CHANGED
@@ -181,7 +181,7 @@ function prepareCli() {
181
181
  initNodeEnv();
182
182
  const { npm_execpath } = process.env;
183
183
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
184
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.9.0\n`);
184
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.9.1\n`);
185
185
  }
186
186
  function toArr(any) {
187
187
  return null == any ? [] : Array.isArray(any) ? any : [
@@ -1156,7 +1156,7 @@ const pluginEsmRequireShim = ()=>({
1156
1156
  banner: requireShim,
1157
1157
  stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
1158
1158
  raw: true,
1159
- include: /\.(js|cjs)$/
1159
+ include: /\.(js|mjs)$/
1160
1160
  }));
1161
1161
  });
1162
1162
  }
@@ -2495,13 +2495,13 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
2495
2495
  index: 'src/**'
2496
2496
  };
2497
2497
  }
2498
- if ('object' != typeof entries) throw new Error(`The ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan('source.entry')} configuration should be an object, but received ${typeof entries}: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(entries)}. Checkout ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://lib.rsbuild.dev/config/rsbuild/source#sourceentry')} for more details.`);
2498
+ if ('object' != typeof entries) throw new Error(`The ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan('source.entry')} configuration should be an object, but received ${typeof entries}: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(entries)}. Checkout ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://rslib.rs/config/rsbuild/source#sourceentry')} for more details.`);
2499
2499
  if (false !== bundle) {
2500
2500
  const entryErrorReasons = [];
2501
2501
  traverseEntryQuery(entries, (entry)=>{
2502
2502
  const entryAbsPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(entry) ? entry : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, entry);
2503
2503
  const isDirLike = '' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(entryAbsPath);
2504
- const dirError = `Glob pattern ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} is not supported when "bundle" is "true", considering "bundle" to "false" to use bundleless mode, or specify a file entry to bundle. See ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://lib.rsbuild.dev/guide/basic/output-structure')} for more details.`;
2504
+ const dirError = `Glob pattern ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} is not supported when "bundle" is "true", considering "bundle" to "false" to use bundleless mode, or specify a file entry to bundle. See ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://rslib.rs/guide/basic/output-structure')} for more details.`;
2505
2505
  if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(entryAbsPath)) {
2506
2506
  const stats = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].statSync(entryAbsPath);
2507
2507
  if (!stats.isFile()) entryErrorReasons.push(dirError);
@@ -3001,7 +3001,7 @@ const applyCommonOptions = (cli)=>{
3001
3001
  function runCli() {
3002
3002
  const cli = dist('rslib');
3003
3003
  cli.help();
3004
- cli.version("0.9.0");
3004
+ cli.version("0.9.1");
3005
3005
  applyCommonOptions(cli);
3006
3006
  const buildCommand = cli.command('build', 'build the library for production');
3007
3007
  const inspectCommand = cli.command('inspect', 'inspect the Rsbuild / Rspack configs of Rslib projects');
@@ -3060,7 +3060,7 @@ function runCli() {
3060
3060
  });
3061
3061
  cli.parse();
3062
3062
  }
3063
- const src_version = "0.9.0";
3063
+ const src_version = "0.9.1";
3064
3064
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
3065
3065
  var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
3066
3066
  export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
@@ -18,31 +18,38 @@ export type Dts = {
18
18
  /**
19
19
  * Whether to bundle the declaration files.
20
20
  * @defaultValue `false`
21
- * @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsbundle}
21
+ * @see {@link https://rslib.rs/config/lib/dts#dtsbundle}
22
22
  */
23
- bundle?: boolean;
23
+ bundle?: boolean | {
24
+ /**
25
+ * Specifies the dependencies whose declaration files should be bundled.
26
+ * @defaultValue {@link https://rslib.rs/config/lib/dts#dtsbundlebundledpackages}
27
+ * @see {@link https://rslib.rs/config/lib/dts#dtsbundlebundledpackages}
28
+ */
29
+ bundledPackages?: string[];
30
+ };
24
31
  /**
25
32
  * The output directory of declaration files.
26
- * @defaultValue {@link https://lib.rsbuild.dev/config/lib/dts#default-value}
27
- * @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsdistpath}
33
+ * @defaultValue {@link https://rslib.rs/config/lib/dts#default-value}
34
+ * @see {@link https://rslib.rs/config/lib/dts#dtsdistpath}
28
35
  */
29
36
  distPath?: string;
30
37
  /**
31
38
  * Whether to generate declaration files with building the project references.
32
39
  * @defaultValue `false`
33
- * @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsbuild}
40
+ * @see {@link https://rslib.rs/config/lib/dts#dtsbuild}
34
41
  */
35
42
  build?: boolean;
36
43
  /**
37
44
  * Whether to abort the build process when an error occurs during declaration files generation.
38
45
  * @defaultValue `true`
39
- * @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsabortonerror}
46
+ * @see {@link https://rslib.rs/config/lib/dts#dtsabortonerror}
40
47
  */
41
48
  abortOnError?: boolean;
42
49
  /**
43
50
  * Whether to automatically set the declaration file extension based on the {@link format} option.
44
51
  * @defaultValue `false`
45
- * @see {@link https://lib.rsbuild.dev/config/lib/dts#dtsautoextension}
52
+ * @see {@link https://rslib.rs/config/lib/dts#dtsautoextension}
46
53
  */
47
54
  autoExtension?: boolean;
48
55
  } | boolean;
@@ -50,25 +57,25 @@ export type AutoExternal = boolean | {
50
57
  /**
51
58
  * Whether to automatically externalize dependencies of type `dependencies`.
52
59
  * @defaultValue `true`
53
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaldependencies}
60
+ * @see {@link https://rslib.rs/config/lib/auto-external#autoexternaldependencies}
54
61
  */
55
62
  dependencies?: boolean;
56
63
  /**
57
64
  * Whether to automatically externalize dependencies of type `optionalDependencies`.
58
65
  * @defaultValue `true`
59
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaloptionaldependencies}
66
+ * @see {@link https://rslib.rs/config/lib/auto-external#autoexternaloptionaldependencies}
60
67
  */
61
68
  optionalDependencies?: boolean;
62
69
  /**
63
70
  * Whether to automatically externalize dependencies of type `peerDependencies`.
64
71
  * @defaultValue `true`
65
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternalpeerdependencies}
72
+ * @see {@link https://rslib.rs/config/lib/auto-external#autoexternalpeerdependencies}
66
73
  */
67
74
  peerDependencies?: boolean;
68
75
  /**
69
76
  * Whether to automatically externalize dependencies of type `devDependencies`.
70
77
  * @defaultValue `false`
71
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-external#autoexternaldevdependencies}
78
+ * @see {@link https://rslib.rs/config/lib/auto-external#autoexternaldevdependencies}
72
79
  */
73
80
  devDependencies?: boolean;
74
81
  };
@@ -80,37 +87,37 @@ export type BannerAndFooter = {
80
87
  export type Shims = {
81
88
  /**
82
89
  * Configure the shims for CommonJS output.
83
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimscjs}
90
+ * @see {@link https://rslib.rs/config/lib/shims#shimscjs}
84
91
  */
85
92
  cjs?: {
86
93
  /**
87
94
  * Whether to inject shims for the `import.meta.url` in CommonJS output.
88
95
  * @defaultValue `true`
89
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimscjsimportmetaurl}
96
+ * @see {@link https://rslib.rs/config/lib/shims#shimscjsimportmetaurl}
90
97
  */
91
98
  'import.meta.url'?: boolean;
92
99
  };
93
100
  /**
94
101
  * Configure the shims for ESM output.
95
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm}
102
+ * @see {@link https://rslib.rs/config/lib/shims#shimsesm}
96
103
  */
97
104
  esm?: {
98
105
  /**
99
106
  * Whether to inject shims for the global `__filename` of CommonJS in ESM output.
100
107
  * @defaultValue `false`
101
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm__filename}
108
+ * @see {@link https://rslib.rs/config/lib/shims#shimsesm__filename}
102
109
  */
103
110
  __filename?: boolean;
104
111
  /**
105
112
  * Whether to inject shims for the global `__dirname` of CommonJS in ESM output.
106
113
  * @defaultValue `false`
107
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesm__dirname}
114
+ * @see {@link https://rslib.rs/config/lib/shims#shimsesm__dirname}
108
115
  */
109
116
  __dirname?: boolean;
110
117
  /**
111
118
  * Whether to inject shims for the global `require` of CommonJS in ESM output.
112
119
  * @defaultValue `false`
113
- * @see {@link https://lib.rsbuild.dev/config/lib/shims#shimsesmrequire}
120
+ * @see {@link https://rslib.rs/config/lib/shims#shimsesmrequire}
114
121
  */
115
122
  require?: boolean;
116
123
  };
@@ -165,61 +172,61 @@ export interface LibConfig extends EnvironmentConfig {
165
172
  /**
166
173
  * The unique identifier of the library.
167
174
  * @defaultValue `undefined`
168
- * @see {@link https://lib.rsbuild.dev/config/lib/id}
175
+ * @see {@link https://rslib.rs/config/lib/id}
169
176
  */
170
177
  id?: string;
171
178
  /**
172
179
  * Output format for the generated JavaScript files.
173
180
  * @defaultValue `'esm'`
174
- * @see {@link https://lib.rsbuild.dev/config/lib/format}
181
+ * @see {@link https://rslib.rs/config/lib/format}
175
182
  */
176
183
  format?: Format;
177
184
  /**
178
185
  * Whether to bundle the library.
179
186
  * @defaultValue `true`
180
- * @see {@link https://lib.rsbuild.dev/config/lib/bundle}
187
+ * @see {@link https://rslib.rs/config/lib/bundle}
181
188
  */
182
189
  bundle?: boolean;
183
190
  /**
184
191
  * Whether to automatically set the file extension based on {@link format} option in the JavaScript output files.
185
192
  * @defaultValue `true`
186
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-extension}
193
+ * @see {@link https://rslib.rs/config/lib/auto-extension}
187
194
  */
188
195
  autoExtension?: boolean;
189
196
  /**
190
197
  * Whether to automatically externalize dependencies of different dependency types and do not bundle them.
191
198
  * @defaultValue `true` when {@link format} is `cjs` or `esm`, `false` when {@link format} is `umd` or `mf`.
192
- * @see {@link https://lib.rsbuild.dev/config/lib/auto-external}
199
+ * @see {@link https://rslib.rs/config/lib/auto-external}
193
200
  */
194
201
  autoExternal?: AutoExternal;
195
202
  /**
196
203
  * Configure the redirect of the import paths, applicable {@link bundle} is set to `false`.
197
204
  * @defaultValue `{}`
198
- * @see {@link https://lib.rsbuild.dev/config/lib/redirect}
205
+ * @see {@link https://rslib.rs/config/lib/redirect}
199
206
  */
200
207
  redirect?: Redirect;
201
208
  /**
202
209
  * Configure the syntax to which JavaScript and CSS will be downgraded.
203
210
  * @defaultValue `'esnext'`
204
- * @see {@link https://lib.rsbuild.dev/config/lib/syntax}
211
+ * @see {@link https://rslib.rs/config/lib/syntax}
205
212
  */
206
213
  syntax?: Syntax;
207
214
  /**
208
215
  * Whether to import SWC helper functions from `@swc/helpers` instead of inlining them.
209
216
  * @defaultValue `false`
210
- * @see {@link https://lib.rsbuild.dev/config/lib/external-helpers}
217
+ * @see {@link https://rslib.rs/config/lib/external-helpers}
211
218
  */
212
219
  externalHelpers?: boolean;
213
220
  /**
214
221
  * Inject content into the top of each JavaScript, CSS or declaration file.
215
222
  * @defaultValue `{}`
216
- * @see {@link https://lib.rsbuild.dev/config/lib/banner}
223
+ * @see {@link https://rslib.rs/config/lib/banner}
217
224
  */
218
225
  banner?: BannerAndFooter;
219
226
  /**
220
227
  * Inject content into the bottom of each JavaScript, CSS or declaration file.
221
228
  * @defaultValue `{}`
222
- * @see {@link https://lib.rsbuild.dev/config/lib/footer}
229
+ * @see {@link https://rslib.rs/config/lib/footer}
223
230
  */
224
231
  footer?: BannerAndFooter;
225
232
  /**
@@ -238,25 +245,25 @@ export interface LibConfig extends EnvironmentConfig {
238
245
  * },
239
246
  * };
240
247
  * ```
241
- * @see {@link https://lib.rsbuild.dev/config/lib/shims}
248
+ * @see {@link https://rslib.rs/config/lib/shims}
242
249
  */
243
250
  shims?: Shims;
244
251
  /**
245
252
  * Configure the generation of the TypeScript declaration files.
246
253
  * @defaultValue `false`
247
- * @see {@link https://lib.rsbuild.dev/config/lib/dts}
254
+ * @see {@link https://rslib.rs/config/lib/dts}
248
255
  */
249
256
  dts?: Dts;
250
257
  /**
251
258
  * The export name of the UMD bundle.
252
259
  * @defaultValue `undefined`
253
- * @see {@link https://lib.rsbuild.dev/config/lib/umd-name}
260
+ * @see {@link https://rslib.rs/config/lib/umd-name}
254
261
  */
255
262
  umdName?: Rspack.LibraryName;
256
263
  /**
257
264
  * The base directory of the output files.
258
265
  * @defaultValue `undefined`
259
- * @see {@link https://lib.rsbuild.dev/config/lib/out-base}
266
+ * @see {@link https://rslib.rs/config/lib/out-base}
260
267
  */
261
268
  outBase?: string;
262
269
  /**
@@ -281,7 +288,7 @@ interface RslibOutputConfig extends OutputConfig {
281
288
  * When minify is not specified, Rslib will use a sane default for minify options.
282
289
  * The default options will only perform dead code elimination and unused code elimination.
283
290
  *
284
- * @see {@link https://lib.rsbuild.dev/config/rsbuild/output#outputminify}
291
+ * @see {@link https://rslib.rs/config/rsbuild/output#outputminify}
285
292
  */
286
293
  minify?: OutputConfig['minify'];
287
294
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "The Rsbuild-based library development tool.",
5
- "homepage": "https://lib.rsbuild.dev",
5
+ "homepage": "https://rslib.rs",
6
6
  "bugs": {
7
7
  "url": "https://github.com/web-infra-dev/rslib/issues"
8
8
  },
@@ -36,12 +36,12 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "1.3.21",
39
+ "@rsbuild/core": "~1.3.21",
40
40
  "tinyglobby": "^0.2.14",
41
- "rsbuild-plugin-dts": "0.9.0"
41
+ "rsbuild-plugin-dts": "0.9.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@module-federation/rsbuild-plugin": "^0.14.0",
44
+ "@module-federation/rsbuild-plugin": "^0.14.1",
45
45
  "@types/fs-extra": "^11.0.4",
46
46
  "cac": "^6.7.14",
47
47
  "chokidar": "^4.0.3",
@@ -50,7 +50,7 @@
50
50
  "picocolors": "1.1.1",
51
51
  "prebundle": "1.3.3",
52
52
  "rsbuild-plugin-publint": "^0.3.2",
53
- "rslib": "npm:@rslib/core@0.8.0",
53
+ "rslib": "npm:@rslib/core@0.9.0",
54
54
  "rslog": "^1.2.3",
55
55
  "tsconfck": "3.1.6",
56
56
  "typescript": "^5.8.3",