@rslib/core 0.2.1 → 0.3.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/compiled/commander/index.d.ts +88 -12
- package/compiled/commander/index.js +511 -151
- package/compiled/commander/package.json +1 -1
- package/dist/entryModuleLoader.js +3 -3
- package/dist/index.js +255 -183
- package/dist/libCssExtractLoader.js +5 -5
- package/dist-types/config.d.ts +3 -2
- package/dist-types/constant.d.ts +0 -3
- package/dist-types/css/cssConfig.d.ts +1 -1
- package/dist-types/plugins/EntryChunkPlugin.d.ts +2 -1
- package/dist-types/types/config.d.ts +13 -1
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
2
2
|
const BASE_URI = 'webpack://';
|
|
3
3
|
const MODULE_TYPE = 'css/mini-extract';
|
|
4
4
|
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
@@ -96,17 +96,17 @@ const pitch = function(request, _, _data) {
|
|
|
96
96
|
let resultSource = `// extracted by ${LOADER_NAME}`;
|
|
97
97
|
let importCssFiles = '';
|
|
98
98
|
function getRelativePath(from, to) {
|
|
99
|
-
let relativePath =
|
|
100
|
-
if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !
|
|
99
|
+
let relativePath = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].relative(from, to);
|
|
100
|
+
if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !__WEBPACK_EXTERNAL_MODULE_node_path__["default"].isAbsolute(relativePath)) relativePath = `./${relativePath}`;
|
|
101
101
|
return relativePath;
|
|
102
102
|
}
|
|
103
103
|
const m = new Map();
|
|
104
104
|
for (const { content, filepath } of dependencies){
|
|
105
105
|
let distFilepath = getRelativePath(rootDir, filepath);
|
|
106
|
-
const ext = (0,
|
|
106
|
+
const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.extname)(distFilepath);
|
|
107
107
|
if ('css' !== ext) distFilepath = distFilepath.replace(ext, '.css');
|
|
108
108
|
distFilepath = distFilepath.replace(/\.module\.css/, '_module.css');
|
|
109
|
-
const cssFilename =
|
|
109
|
+
const cssFilename = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].basename(distFilepath);
|
|
110
110
|
if (content.trim()) {
|
|
111
111
|
m.get(distFilepath) ? m.set(distFilepath, `${m.get(distFilepath) + content}\n`) : m.set(distFilepath, `${content}\n`);
|
|
112
112
|
importCssFiles += '\n';
|
package/dist-types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EnvironmentConfig } from '@rsbuild/core';
|
|
1
|
+
import { type EnvironmentConfig, type RsbuildEntry } from '@rsbuild/core';
|
|
2
2
|
import type { AutoExternal, BannerAndFooter, Format, LibConfig, PkgJson, RequireKey, RsbuildConfigEntry, RsbuildConfigWithLibInfo, RslibConfig, RslibConfigAsyncFn, RslibConfigExport, RslibConfigSyncFn } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* This function helps you to autocomplete configuration types.
|
|
@@ -17,6 +17,7 @@ export declare function loadConfig({ cwd, path, envMode, }: {
|
|
|
17
17
|
filePath: string;
|
|
18
18
|
}>;
|
|
19
19
|
export declare const composeAutoExternalConfig: (options: {
|
|
20
|
+
bundle: boolean;
|
|
20
21
|
format: Format;
|
|
21
22
|
autoExternal?: AutoExternal;
|
|
22
23
|
pkgJson?: PkgJson;
|
|
@@ -27,7 +28,7 @@ export declare function composeBannerFooterConfig(banner: BannerAndFooter, foote
|
|
|
27
28
|
export declare function composeDecoratorsConfig(compilerOptions?: Record<string, any>, version?: NonNullable<NonNullable<EnvironmentConfig['source']>['decorators']>['version']): EnvironmentConfig;
|
|
28
29
|
export declare function createConstantRsbuildConfig(): Promise<EnvironmentConfig>;
|
|
29
30
|
export declare const composeModuleImportWarn: (request: string) => string;
|
|
30
|
-
export declare const appendEntryQuery: (
|
|
31
|
+
export declare const appendEntryQuery: (entries: RsbuildConfigEntry) => RsbuildEntry;
|
|
31
32
|
export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig): Promise<RsbuildConfigWithLibInfo[]>;
|
|
32
33
|
export declare function composeRsbuildEnvironments(rslibConfig: RslibConfig): Promise<{
|
|
33
34
|
environments: Record<string, EnvironmentConfig>;
|
package/dist-types/constant.d.ts
CHANGED
|
@@ -5,9 +5,6 @@ export declare const RSLIB_ENTRY_QUERY = "__rslib_entry__";
|
|
|
5
5
|
export declare const SHEBANG_PREFIX = "#!";
|
|
6
6
|
export declare const SHEBANG_REGEX: RegExp;
|
|
7
7
|
export declare const REACT_DIRECTIVE_REGEX: RegExp;
|
|
8
|
-
export declare const JS_EXTENSIONS: string[];
|
|
9
|
-
export declare const CSS_EXTENSIONS: string[];
|
|
10
|
-
export declare const ENTRY_EXTENSIONS: string[];
|
|
11
8
|
export declare const JS_EXTENSIONS_PATTERN: RegExp;
|
|
12
9
|
export declare const CSS_EXTENSIONS_PATTERN: RegExp;
|
|
13
10
|
export declare const ENTRY_EXTENSIONS_PATTERN: RegExp;
|
|
@@ -12,6 +12,6 @@ export declare function parsePathQueryFragment(str: string): {
|
|
|
12
12
|
export declare function isCssModulesFile(filepath: string, auto: CssLoaderOptionsAuto): boolean;
|
|
13
13
|
export declare function isCssGlobalFile(filepath: string, auto: CssLoaderOptionsAuto): boolean;
|
|
14
14
|
type ExternalCallback = (arg0?: undefined, arg1?: string) => void;
|
|
15
|
-
export declare function cssExternalHandler(request: string, callback: ExternalCallback, jsExtension: string, auto: CssLoaderOptionsAuto,
|
|
15
|
+
export declare function cssExternalHandler(request: string, callback: ExternalCallback, jsExtension: string, auto: CssLoaderOptionsAuto, styleRedirectPath: boolean, styleRedirectExtension: boolean, redirectPath: (request: string) => Promise<string | undefined>): Promise<false | void>;
|
|
16
16
|
export declare const composeCssConfig: (rootDir: string | null, bundle?: boolean) => EnvironmentConfig;
|
|
17
17
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EnvironmentConfig } from '@rsbuild/core';
|
|
2
|
-
export declare const composeEntryChunkConfig: ({ enabledImportMetaUrlShim, }: {
|
|
2
|
+
export declare const composeEntryChunkConfig: ({ enabledImportMetaUrlShim, contextToWatch, }: {
|
|
3
3
|
enabledImportMetaUrlShim: boolean;
|
|
4
|
+
contextToWatch: string | null;
|
|
4
5
|
}) => EnvironmentConfig;
|
|
@@ -51,11 +51,23 @@ export type JsRedirect = {
|
|
|
51
51
|
*/
|
|
52
52
|
extension?: boolean;
|
|
53
53
|
};
|
|
54
|
+
export type StyleRedirect = {
|
|
55
|
+
/**
|
|
56
|
+
* Whether to automatically redirect the import paths of style output files.
|
|
57
|
+
* @defaultValue `true`
|
|
58
|
+
*/
|
|
59
|
+
path?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to automatically add the file extension to import paths based on the style output files.
|
|
62
|
+
* @defaultValue `true`
|
|
63
|
+
*/
|
|
64
|
+
extension?: boolean;
|
|
65
|
+
};
|
|
54
66
|
export type Redirect = {
|
|
55
67
|
/** Controls the redirect of the import paths of output JavaScript files. */
|
|
56
68
|
js?: JsRedirect;
|
|
57
69
|
/** Whether to redirect the import path of the style file. */
|
|
58
|
-
style?:
|
|
70
|
+
style?: StyleRedirect;
|
|
59
71
|
};
|
|
60
72
|
export interface LibConfig extends EnvironmentConfig {
|
|
61
73
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -32,21 +32,21 @@
|
|
|
32
32
|
"compiled"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@rsbuild/core": "
|
|
35
|
+
"@rsbuild/core": "1.2.0-alpha.0",
|
|
36
36
|
"tinyglobby": "^0.2.10",
|
|
37
|
-
"rsbuild-plugin-dts": "0.
|
|
37
|
+
"rsbuild-plugin-dts": "0.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@module-federation/rsbuild-plugin": "^0.8.
|
|
40
|
+
"@module-federation/rsbuild-plugin": "^0.8.7",
|
|
41
41
|
"@types/fs-extra": "^11.0.4",
|
|
42
42
|
"chokidar": "^4.0.3",
|
|
43
|
-
"commander": "^
|
|
43
|
+
"commander": "^13.0.0",
|
|
44
44
|
"fs-extra": "^11.2.0",
|
|
45
|
-
"memfs": "^4.15.
|
|
45
|
+
"memfs": "^4.15.3",
|
|
46
46
|
"picocolors": "1.1.1",
|
|
47
47
|
"prebundle": "1.2.5",
|
|
48
48
|
"rsbuild-plugin-publint": "^0.2.1",
|
|
49
|
-
"rslib": "npm:@rslib/core@0.2.
|
|
49
|
+
"rslib": "npm:@rslib/core@0.2.2",
|
|
50
50
|
"rslog": "^1.2.3",
|
|
51
51
|
"tsconfck": "3.1.4",
|
|
52
52
|
"typescript": "^5.7.2",
|