@rslib/core 0.17.1 → 0.18.0
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/121.js +43 -0
- package/dist/800.js +52 -0
- package/dist/entryModuleLoader.js +2 -33
- package/dist/index.js +39 -106
- package/dist/libCssExtractLoader.js +3 -56
- package/package.json +6 -6
package/dist/121.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
2
|
+
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
3
|
+
'.js',
|
|
4
|
+
'.ts',
|
|
5
|
+
'.mjs',
|
|
6
|
+
'.mts',
|
|
7
|
+
'.cjs',
|
|
8
|
+
'.cts'
|
|
9
|
+
];
|
|
10
|
+
const SWC_HELPERS = '@swc/helpers';
|
|
11
|
+
const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
|
|
12
|
+
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
13
|
+
const DTS_EXTENSIONS = [
|
|
14
|
+
'd.ts',
|
|
15
|
+
'd.mts',
|
|
16
|
+
'd.cts'
|
|
17
|
+
];
|
|
18
|
+
const JS_EXTENSIONS = [
|
|
19
|
+
'js',
|
|
20
|
+
'mjs',
|
|
21
|
+
'jsx',
|
|
22
|
+
'(?<!\\.d\\.)ts',
|
|
23
|
+
'(?<!\\.d\\.)mts',
|
|
24
|
+
'(?<!\\.d\\.)cts',
|
|
25
|
+
'tsx',
|
|
26
|
+
'cjs',
|
|
27
|
+
'cjsx',
|
|
28
|
+
'mjsx',
|
|
29
|
+
'mtsx',
|
|
30
|
+
'ctsx'
|
|
31
|
+
];
|
|
32
|
+
const CSS_EXTENSIONS = [
|
|
33
|
+
'css',
|
|
34
|
+
'sass',
|
|
35
|
+
'scss',
|
|
36
|
+
'less',
|
|
37
|
+
'styl',
|
|
38
|
+
'stylus'
|
|
39
|
+
];
|
|
40
|
+
const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
41
|
+
const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
42
|
+
const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
43
|
+
export { CSS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DTS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, REACT_DIRECTIVE_REGEX, SHEBANG_REGEX, SWC_HELPERS };
|
package/dist/800.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import node_path, { basename, dirname, extname, isAbsolute, join } from "node:path";
|
|
2
|
+
import { CSS_EXTENSIONS_PATTERN } from "./121.js";
|
|
3
|
+
function getUndoPath(filename, outputPathArg, enforceRelative) {
|
|
4
|
+
let depth = -1;
|
|
5
|
+
let append = '';
|
|
6
|
+
let outputPath = outputPathArg.replace(/[\\/]$/, '');
|
|
7
|
+
for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
|
|
8
|
+
else {
|
|
9
|
+
const i = outputPath.lastIndexOf('/');
|
|
10
|
+
const j = outputPath.lastIndexOf('\\');
|
|
11
|
+
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
12
|
+
if (pos < 0) return `${outputPath}/`;
|
|
13
|
+
append = `${outputPath.slice(pos + 1)}/${append}`;
|
|
14
|
+
outputPath = outputPath.slice(0, pos);
|
|
15
|
+
}
|
|
16
|
+
else if ('.' !== part) depth++;
|
|
17
|
+
return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
|
|
18
|
+
}
|
|
19
|
+
function isCssFile(filepath) {
|
|
20
|
+
return CSS_EXTENSIONS_PATTERN.test(filepath);
|
|
21
|
+
}
|
|
22
|
+
const CSS_MODULE_REG = /\.module\.\w+$/i;
|
|
23
|
+
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
|
|
24
|
+
function parsePathQueryFragment(str) {
|
|
25
|
+
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
26
|
+
return {
|
|
27
|
+
path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
|
|
28
|
+
query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
29
|
+
fragment: match?.[3] || ''
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function isCssModulesFile(filepath, auto) {
|
|
33
|
+
const filename = node_path.basename(filepath);
|
|
34
|
+
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
35
|
+
if (auto instanceof RegExp) return auto.test(filepath);
|
|
36
|
+
if ('function' == typeof auto) {
|
|
37
|
+
const { path, query, fragment } = parsePathQueryFragment(filepath);
|
|
38
|
+
return auto(path, query, fragment);
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function isCssGlobalFile(filepath, auto) {
|
|
43
|
+
const isCss = isCssFile(filepath);
|
|
44
|
+
if (!isCss) return false;
|
|
45
|
+
const isCssModules = isCssModulesFile(filepath, auto);
|
|
46
|
+
return !isCssModules;
|
|
47
|
+
}
|
|
48
|
+
const BASE_URI = 'webpack://';
|
|
49
|
+
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
50
|
+
const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
|
|
51
|
+
const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
52
|
+
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, SINGLE_DOT_PATH_SEGMENT, basename, dirname, extname, getUndoPath, isAbsolute, isCssFile, isCssGlobalFile, isCssModulesFile, join, node_path };
|
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
3
|
-
const DTS_EXTENSIONS = [
|
|
4
|
-
'd.ts',
|
|
5
|
-
'd.mts',
|
|
6
|
-
'd.cts'
|
|
7
|
-
];
|
|
8
|
-
const JS_EXTENSIONS = [
|
|
9
|
-
'js',
|
|
10
|
-
'mjs',
|
|
11
|
-
'jsx',
|
|
12
|
-
'(?<!\\.d\\.)ts',
|
|
13
|
-
'(?<!\\.d\\.)mts',
|
|
14
|
-
'(?<!\\.d\\.)cts',
|
|
15
|
-
'tsx',
|
|
16
|
-
'cjs',
|
|
17
|
-
'cjsx',
|
|
18
|
-
'mjsx',
|
|
19
|
-
'mtsx',
|
|
20
|
-
'ctsx'
|
|
21
|
-
];
|
|
22
|
-
const CSS_EXTENSIONS = [
|
|
23
|
-
'css',
|
|
24
|
-
'sass',
|
|
25
|
-
'scss',
|
|
26
|
-
'less',
|
|
27
|
-
'styl',
|
|
28
|
-
'stylus'
|
|
29
|
-
];
|
|
30
|
-
new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
31
|
-
new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
32
|
-
new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
1
|
+
import { SHEBANG_REGEX, REACT_DIRECTIVE_REGEX } from "./121.js";
|
|
33
2
|
function splitFromFirstLine(text) {
|
|
34
3
|
const match = text.match(/(\r\n|\n)/);
|
|
35
4
|
if (!match) return [
|
|
@@ -50,4 +19,4 @@ const entryModuleLoader_loader = function(source) {
|
|
|
50
19
|
return result;
|
|
51
20
|
};
|
|
52
21
|
const entryModuleLoader = entryModuleLoader_loader;
|
|
53
|
-
export
|
|
22
|
+
export default entryModuleLoader;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
1
2
|
import node_fs, { chmodSync, promises } from "node:fs";
|
|
2
|
-
import node_path, { basename as external_node_path_basename, dirname, extname, isAbsolute, join } from "node:path";
|
|
3
3
|
import { glob } from "../compiled/tinyglobby/index.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import picocolors from "../compiled/picocolors/index.js";
|
|
@@ -8,94 +8,8 @@ import node_fs_promises from "node:fs/promises";
|
|
|
8
8
|
import { createRequire as external_module_createRequire } from "module";
|
|
9
9
|
import { EventEmitter } from "events";
|
|
10
10
|
import node_util from "node:util";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
14
|
-
'.js',
|
|
15
|
-
'.ts',
|
|
16
|
-
'.mjs',
|
|
17
|
-
'.mts',
|
|
18
|
-
'.cjs',
|
|
19
|
-
'.cts'
|
|
20
|
-
];
|
|
21
|
-
const SWC_HELPERS = '@swc/helpers';
|
|
22
|
-
const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
|
|
23
|
-
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
24
|
-
const DTS_EXTENSIONS = [
|
|
25
|
-
'd.ts',
|
|
26
|
-
'd.mts',
|
|
27
|
-
'd.cts'
|
|
28
|
-
];
|
|
29
|
-
const JS_EXTENSIONS = [
|
|
30
|
-
'js',
|
|
31
|
-
'mjs',
|
|
32
|
-
'jsx',
|
|
33
|
-
'(?<!\\.d\\.)ts',
|
|
34
|
-
'(?<!\\.d\\.)mts',
|
|
35
|
-
'(?<!\\.d\\.)cts',
|
|
36
|
-
'tsx',
|
|
37
|
-
'cjs',
|
|
38
|
-
'cjsx',
|
|
39
|
-
'mjsx',
|
|
40
|
-
'mtsx',
|
|
41
|
-
'ctsx'
|
|
42
|
-
];
|
|
43
|
-
const CSS_EXTENSIONS = [
|
|
44
|
-
'css',
|
|
45
|
-
'sass',
|
|
46
|
-
'scss',
|
|
47
|
-
'less',
|
|
48
|
-
'styl',
|
|
49
|
-
'stylus'
|
|
50
|
-
];
|
|
51
|
-
const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
52
|
-
const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
53
|
-
const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
54
|
-
function getUndoPath(filename, outputPathArg, enforceRelative) {
|
|
55
|
-
let depth = -1;
|
|
56
|
-
let append = '';
|
|
57
|
-
let outputPath = outputPathArg.replace(/[\\/]$/, '');
|
|
58
|
-
for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
|
|
59
|
-
else {
|
|
60
|
-
const i = outputPath.lastIndexOf('/');
|
|
61
|
-
const j = outputPath.lastIndexOf('\\');
|
|
62
|
-
const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
63
|
-
if (pos < 0) return `${outputPath}/`;
|
|
64
|
-
append = `${outputPath.slice(pos + 1)}/${append}`;
|
|
65
|
-
outputPath = outputPath.slice(0, pos);
|
|
66
|
-
}
|
|
67
|
-
else if ('.' !== part) depth++;
|
|
68
|
-
return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
|
|
69
|
-
}
|
|
70
|
-
function isCssFile(filepath) {
|
|
71
|
-
return CSS_EXTENSIONS_PATTERN.test(filepath);
|
|
72
|
-
}
|
|
73
|
-
const CSS_MODULE_REG = /\.module\.\w+$/i;
|
|
74
|
-
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
|
|
75
|
-
function parsePathQueryFragment(str) {
|
|
76
|
-
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
77
|
-
return {
|
|
78
|
-
path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
|
|
79
|
-
query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
80
|
-
fragment: match?.[3] || ''
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function isCssModulesFile(filepath, auto) {
|
|
84
|
-
const filename = node_path.basename(filepath);
|
|
85
|
-
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
86
|
-
if (auto instanceof RegExp) return auto.test(filepath);
|
|
87
|
-
if ('function' == typeof auto) {
|
|
88
|
-
const { path, query, fragment } = parsePathQueryFragment(filepath);
|
|
89
|
-
return auto(path, query, fragment);
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
function isCssGlobalFile(filepath, auto) {
|
|
94
|
-
const isCss = isCssFile(filepath);
|
|
95
|
-
if (!isCss) return false;
|
|
96
|
-
const isCssModules = isCssModulesFile(filepath, auto);
|
|
97
|
-
return !isCssModules;
|
|
98
|
-
}
|
|
11
|
+
import { basename as external_node_path_basename, node_path, extname, getUndoPath, ABSOLUTE_PUBLIC_PATH, isCssFile, dirname, AUTO_PUBLIC_PATH, join, isAbsolute, SINGLE_DOT_PATH_SEGMENT, isCssGlobalFile, BASE_URI, isCssModulesFile } from "./800.js";
|
|
12
|
+
import { DEFAULT_CONFIG_NAME, SHEBANG_REGEX, DTS_EXTENSIONS_PATTERN, SWC_HELPERS, CSS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, REACT_DIRECTIVE_REGEX } from "./121.js";
|
|
99
13
|
const LibSvgrPatchPlugin_pluginName = 'LIB_SVGR_PATCH_PLUGIN';
|
|
100
14
|
const PUBLIC_PATH_PLACEHOLDER = '__RSLIB_SVGR_AUTO_PUBLIC_PATH__';
|
|
101
15
|
class LibSvgrPatchPlugin {
|
|
@@ -238,10 +152,6 @@ const composeAssetConfig = (bundle, format)=>{
|
|
|
238
152
|
}
|
|
239
153
|
return {};
|
|
240
154
|
};
|
|
241
|
-
const BASE_URI = 'webpack://';
|
|
242
|
-
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
243
|
-
const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
|
|
244
|
-
const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
245
155
|
const LibCssExtractPlugin_pluginName = 'LIB_CSS_EXTRACT_PLUGIN';
|
|
246
156
|
class LibCssExtractPlugin {
|
|
247
157
|
name = LibCssExtractPlugin_pluginName;
|
|
@@ -862,13 +772,13 @@ const TS_EXTENSIONS = [
|
|
|
862
772
|
'.mts',
|
|
863
773
|
'.cts'
|
|
864
774
|
];
|
|
865
|
-
const
|
|
775
|
+
const JS_EXTENSIONS = [
|
|
866
776
|
'.js',
|
|
867
777
|
'.jsx',
|
|
868
778
|
'.mjs',
|
|
869
779
|
'.cjs'
|
|
870
780
|
];
|
|
871
|
-
const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(
|
|
781
|
+
const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
|
|
872
782
|
const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
873
783
|
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
|
|
874
784
|
const IS_POSIX = node_path.posix.sep === node_path.sep;
|
|
@@ -1610,7 +1520,8 @@ async function createConstantRsbuildConfig() {
|
|
|
1610
1520
|
performance: {
|
|
1611
1521
|
chunkSplit: {
|
|
1612
1522
|
strategy: 'custom'
|
|
1613
|
-
}
|
|
1523
|
+
},
|
|
1524
|
+
buildCache: true
|
|
1614
1525
|
},
|
|
1615
1526
|
tools: {
|
|
1616
1527
|
htmlPlugin: false,
|
|
@@ -1652,7 +1563,6 @@ async function createConstantRsbuildConfig() {
|
|
|
1652
1563
|
},
|
|
1653
1564
|
output: {
|
|
1654
1565
|
target: 'node',
|
|
1655
|
-
filenameHash: false,
|
|
1656
1566
|
distPath: {
|
|
1657
1567
|
js: './',
|
|
1658
1568
|
jsAsync: './',
|
|
@@ -1691,6 +1601,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1691
1601
|
switch(format){
|
|
1692
1602
|
case 'esm':
|
|
1693
1603
|
return {
|
|
1604
|
+
output: {
|
|
1605
|
+
filenameHash: false
|
|
1606
|
+
},
|
|
1694
1607
|
tools: {
|
|
1695
1608
|
rspack: {
|
|
1696
1609
|
module: {
|
|
@@ -1731,6 +1644,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1731
1644
|
};
|
|
1732
1645
|
case 'cjs':
|
|
1733
1646
|
return {
|
|
1647
|
+
output: {
|
|
1648
|
+
filenameHash: false
|
|
1649
|
+
},
|
|
1734
1650
|
tools: {
|
|
1735
1651
|
rspack: {
|
|
1736
1652
|
module: {
|
|
@@ -1764,6 +1680,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1764
1680
|
{
|
|
1765
1681
|
if (!bundle) throw new Error('When using "umd" format, "bundle" must be set to "true". Since the default value for "bundle" is "true", so you can either explicitly set it to "true" or remove the field entirely.');
|
|
1766
1682
|
const config = {
|
|
1683
|
+
output: {
|
|
1684
|
+
filenameHash: false
|
|
1685
|
+
},
|
|
1767
1686
|
tools: {
|
|
1768
1687
|
rspack: {
|
|
1769
1688
|
module: {
|
|
@@ -1799,6 +1718,7 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
|
|
|
1799
1718
|
if (!bundle) throw new Error('When using "iife" format, "bundle" must be set to "true". Since the default value for "bundle" is "true", so you can either explicitly set it to "true" or remove the field entirely.');
|
|
1800
1719
|
const config = {
|
|
1801
1720
|
output: {
|
|
1721
|
+
filenameHash: false,
|
|
1802
1722
|
minify: {
|
|
1803
1723
|
jsOptions: {
|
|
1804
1724
|
minimizerOptions: {
|
|
@@ -2057,7 +1977,7 @@ const composeOutputFilenameConfig = (config, format, autoExtension, multiCompile
|
|
|
2057
1977
|
}
|
|
2058
1978
|
});
|
|
2059
1979
|
return {
|
|
2060
|
-
config: finalConfig,
|
|
1980
|
+
config: 'mf' === format ? {} : finalConfig,
|
|
2061
1981
|
jsExtension: finalJsExtension,
|
|
2062
1982
|
dtsExtension
|
|
2063
1983
|
};
|
|
@@ -3213,7 +3133,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3213
3133
|
};
|
|
3214
3134
|
function runCli() {
|
|
3215
3135
|
const cli = dist('rslib');
|
|
3216
|
-
cli.version("0.
|
|
3136
|
+
cli.version("0.18.0");
|
|
3217
3137
|
applyCommonOptions(cli);
|
|
3218
3138
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3219
3139
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3233,10 +3153,21 @@ function runCli() {
|
|
|
3233
3153
|
try {
|
|
3234
3154
|
const cliBuild = async ()=>{
|
|
3235
3155
|
const { config, watchFiles } = await initConfig(options);
|
|
3156
|
+
if (options.watch) {
|
|
3157
|
+
config.plugins = config.plugins || [];
|
|
3158
|
+
config.plugins.push({
|
|
3159
|
+
name: 'rslib:on-after-build',
|
|
3160
|
+
setup (api) {
|
|
3161
|
+
api.onAfterBuild(({ isFirstCompile })=>{
|
|
3162
|
+
if (isFirstCompile) logger.success('build complete, watching for changes...');
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
});
|
|
3166
|
+
watchFilesForRestart(watchFiles, async ()=>{
|
|
3167
|
+
await cliBuild();
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3236
3170
|
await build(config, options);
|
|
3237
|
-
if (options.watch) watchFilesForRestart(watchFiles, async ()=>{
|
|
3238
|
-
await cliBuild();
|
|
3239
|
-
});
|
|
3240
3171
|
};
|
|
3241
3172
|
await cliBuild();
|
|
3242
3173
|
} catch (err) {
|
|
@@ -3318,8 +3249,10 @@ function prepareCli() {
|
|
|
3318
3249
|
setupLogLevel();
|
|
3319
3250
|
const { npm_execpath } = process.env;
|
|
3320
3251
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
|
|
3321
|
-
logger.greet(` Rslib v0.
|
|
3252
|
+
logger.greet(` Rslib v0.18.0\n`);
|
|
3322
3253
|
}
|
|
3323
|
-
const src_version = "0.
|
|
3324
|
-
|
|
3325
|
-
export {
|
|
3254
|
+
const src_version = "0.18.0";
|
|
3255
|
+
export * as rsbuild from "@rsbuild/core";
|
|
3256
|
+
export { logger } from "../compiled/rslog/index.js";
|
|
3257
|
+
export { rspack } from "@rsbuild/core";
|
|
3258
|
+
export { build, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, defineConfig, inspect, loadConfig, prepareCli, runCli, src_version as version, startMFDevServer };
|
|
@@ -1,58 +1,4 @@
|
|
|
1
|
-
import node_path,
|
|
2
|
-
const BASE_URI = 'webpack://';
|
|
3
|
-
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
4
|
-
const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
|
|
5
|
-
const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
6
|
-
const DTS_EXTENSIONS = [
|
|
7
|
-
'd.ts',
|
|
8
|
-
'd.mts',
|
|
9
|
-
'd.cts'
|
|
10
|
-
];
|
|
11
|
-
const JS_EXTENSIONS = [
|
|
12
|
-
'js',
|
|
13
|
-
'mjs',
|
|
14
|
-
'jsx',
|
|
15
|
-
'(?<!\\.d\\.)ts',
|
|
16
|
-
'(?<!\\.d\\.)mts',
|
|
17
|
-
'(?<!\\.d\\.)cts',
|
|
18
|
-
'tsx',
|
|
19
|
-
'cjs',
|
|
20
|
-
'cjsx',
|
|
21
|
-
'mjsx',
|
|
22
|
-
'mtsx',
|
|
23
|
-
'ctsx'
|
|
24
|
-
];
|
|
25
|
-
const CSS_EXTENSIONS = [
|
|
26
|
-
'css',
|
|
27
|
-
'sass',
|
|
28
|
-
'scss',
|
|
29
|
-
'less',
|
|
30
|
-
'styl',
|
|
31
|
-
'stylus'
|
|
32
|
-
];
|
|
33
|
-
new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
34
|
-
new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
35
|
-
new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
36
|
-
const CSS_MODULE_REG = /\.module\.\w+$/i;
|
|
37
|
-
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
|
|
38
|
-
function parsePathQueryFragment(str) {
|
|
39
|
-
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
40
|
-
return {
|
|
41
|
-
path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
|
|
42
|
-
query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
|
|
43
|
-
fragment: match?.[3] || ''
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function isCssModulesFile(filepath, auto) {
|
|
47
|
-
const filename = node_path.basename(filepath);
|
|
48
|
-
if (true === auto) return CSS_MODULE_REG.test(filename);
|
|
49
|
-
if (auto instanceof RegExp) return auto.test(filepath);
|
|
50
|
-
if ('function' == typeof auto) {
|
|
51
|
-
const { path, query, fragment } = parsePathQueryFragment(filepath);
|
|
52
|
-
return auto(path, query, fragment);
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
1
|
+
import { isCssModulesFile, node_path, extname, ABSOLUTE_PUBLIC_PATH, SINGLE_DOT_PATH_SEGMENT, BASE_URI, AUTO_PUBLIC_PATH } from "./800.js";
|
|
56
2
|
const LOADER_NAME = 'LIB_CSS_EXTRACT_LOADER';
|
|
57
3
|
function stringifyLocal(value) {
|
|
58
4
|
return 'function' == typeof value ? value.toString() : JSON.stringify(value);
|
|
@@ -190,4 +136,5 @@ const pitch = function(request, _, _data) {
|
|
|
190
136
|
});
|
|
191
137
|
};
|
|
192
138
|
const libCssExtractLoader = libCssExtractLoader_loader;
|
|
193
|
-
export
|
|
139
|
+
export default libCssExtractLoader;
|
|
140
|
+
export { pitch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "~1.6.
|
|
40
|
-
"rsbuild-plugin-dts": "0.
|
|
39
|
+
"@rsbuild/core": "~1.6.6",
|
|
40
|
+
"rsbuild-plugin-dts": "0.18.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@module-federation/rsbuild-plugin": "^0.21.
|
|
43
|
+
"@module-federation/rsbuild-plugin": "^0.21.4",
|
|
44
44
|
"@types/fs-extra": "^11.0.4",
|
|
45
45
|
"cac": "^6.7.14",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
47
|
"fs-extra": "^11.3.2",
|
|
48
|
-
"memfs": "^4.
|
|
48
|
+
"memfs": "^4.51.0",
|
|
49
49
|
"path-serializer": "0.5.1",
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
51
|
"prebundle": "1.5.0",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.17.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.17.2",
|
|
54
54
|
"rslog": "^1.3.0",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|