@rsbuild/core 1.1.0 → 1.1.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/compiled/chokidar/index.d.ts +318 -189
- package/compiled/chokidar/index.js +1069 -4439
- package/compiled/chokidar/license +1 -1
- package/compiled/chokidar/package.json +1 -1
- package/compiled/css-loader/index.js +46 -46
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +4 -3
- package/compiled/postcss/index.js +120 -114
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +11 -11
- package/compiled/rsbuild-dev-middleware/index.js +64 -101
- package/compiled/rsbuild-dev-middleware/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/tinyglobby/index.d.ts +25 -0
- package/compiled/tinyglobby/index.js +2749 -0
- package/compiled/tinyglobby/index1.js +17 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/dist/client/hmr.js +195 -213
- package/dist/client/overlay.js +88 -90
- package/dist/ignoreCssLoader.cjs +43 -29
- package/dist/index.cjs +6931 -13749
- package/dist/index.cjs.LICENSE.txt +13 -0
- package/dist/index.js +6754 -13826
- package/dist/index.js.LICENSE.txt +13 -0
- package/dist/transformLoader.cjs +59 -51
- package/dist/transformRawLoader.cjs +78 -60
- package/dist-types/cli/init.d.ts +2 -1
- package/dist-types/config.d.ts +2 -2
- package/dist-types/configChain.d.ts +1 -1
- package/dist-types/helpers/index.d.ts +3 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/internal.d.ts +1 -13
- package/dist-types/logger.d.ts +1 -1
- package/dist-types/plugins/css.d.ts +1 -2
- package/dist-types/plugins/lazyCompilation.d.ts +1 -1
- package/dist-types/provider/createCompiler.d.ts +1 -1
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/server/compilerDevMiddleware.d.ts +4 -3
- package/dist-types/server/devServer.d.ts +1 -1
- package/dist-types/server/helper.d.ts +1 -0
- package/dist-types/server/httpServer.d.ts +1 -1
- package/dist-types/server/middlewares.d.ts +2 -2
- package/dist-types/server/prodServer.d.ts +1 -1
- package/dist-types/server/restart.d.ts +4 -0
- package/dist-types/server/watchFiles.d.ts +4 -1
- package/dist-types/types/config.d.ts +20 -12
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +2 -2
- package/dist-types/types/rsbuild.d.ts +3 -1
- package/dist-types/types/rspack.d.ts +1 -1
- package/dist-types/types/thirdParty.d.ts +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12
|
+
* Released under the MIT License.
|
|
13
|
+
*/
|
package/dist/transformLoader.cjs
CHANGED
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
4
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
5
|
+
enumerable: !0,
|
|
6
|
+
get: definition[key]
|
|
7
|
+
});
|
|
8
|
+
}, __webpack_require__.o = function(obj, prop) {
|
|
9
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
10
|
+
}, __webpack_require__.r = function(exports1) {
|
|
11
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
12
|
+
value: 'Module'
|
|
13
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
14
|
+
value: !0
|
|
15
|
+
});
|
|
9
16
|
};
|
|
10
|
-
var
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/loader/transformLoader.ts
|
|
21
|
-
var transformLoader_exports = {};
|
|
22
|
-
__export(transformLoader_exports, {
|
|
23
|
-
default: () => transform
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(transformLoader_exports);
|
|
17
|
+
var __webpack_exports__ = {};
|
|
26
18
|
async function transform(source, map) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return bypass();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
if (result === null || result === void 0) {
|
|
47
|
-
return bypass();
|
|
48
|
-
}
|
|
49
|
-
if (typeof result === "string") {
|
|
50
|
-
return callback(null, result, map);
|
|
51
|
-
}
|
|
52
|
-
const useMap = map !== void 0 && map !== null;
|
|
53
|
-
const finalMap = result.map ?? map;
|
|
54
|
-
callback(null, result.code, useMap ? finalMap : void 0);
|
|
19
|
+
var _this__compiler___rsbuildTransformer, _this__compiler;
|
|
20
|
+
let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
|
|
21
|
+
if (!transformId) return bypass();
|
|
22
|
+
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
23
|
+
if (!transform) return bypass();
|
|
24
|
+
let result = await transform({
|
|
25
|
+
code: source,
|
|
26
|
+
resource: this.resource,
|
|
27
|
+
resourcePath: this.resourcePath,
|
|
28
|
+
resourceQuery: this.resourceQuery,
|
|
29
|
+
environment: getEnvironment(),
|
|
30
|
+
addDependency: this.addDependency,
|
|
31
|
+
emitFile: this.emitFile
|
|
32
|
+
});
|
|
33
|
+
if (null == result) return bypass();
|
|
34
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
35
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
36
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
55
37
|
}
|
|
38
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
39
|
+
default: function() {
|
|
40
|
+
return transform;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
var __webpack_export_target__ = exports;
|
|
44
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
45
|
+
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
46
|
+
value: !0
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
PLUGIN_CSS_NAME,
|
|
52
|
+
PLUGIN_SWC_NAME,
|
|
53
|
+
__internalHelper,
|
|
54
|
+
createRsbuild,
|
|
55
|
+
defineConfig,
|
|
56
|
+
ensureAssetPrefix,
|
|
57
|
+
loadConfig,
|
|
58
|
+
loadEnv,
|
|
59
|
+
logger,
|
|
60
|
+
mergeRsbuildConfig,
|
|
61
|
+
rspack,
|
|
62
|
+
version
|
|
63
|
+
});
|
|
@@ -1,66 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./src/loader/transformLoader.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
+
default: function() {
|
|
6
|
+
return transform;
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
async function transform(source, map) {
|
|
10
|
+
var _this__compiler___rsbuildTransformer, _this__compiler;
|
|
11
|
+
let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
|
|
12
|
+
if (!transformId) return bypass();
|
|
13
|
+
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
14
|
+
if (!transform) return bypass();
|
|
15
|
+
let result = await transform({
|
|
16
|
+
code: source,
|
|
17
|
+
resource: this.resource,
|
|
18
|
+
resourcePath: this.resourcePath,
|
|
19
|
+
resourceQuery: this.resourceQuery,
|
|
20
|
+
environment: getEnvironment(),
|
|
21
|
+
addDependency: this.addDependency,
|
|
22
|
+
emitFile: this.emitFile
|
|
23
|
+
});
|
|
24
|
+
if (null == result) return bypass();
|
|
25
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
26
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
27
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, __webpack_module_cache__ = {};
|
|
31
|
+
function __webpack_require__(moduleId) {
|
|
32
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
33
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
34
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
35
|
+
exports: {}
|
|
36
|
+
};
|
|
37
|
+
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
38
|
+
}
|
|
39
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
40
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
41
|
+
enumerable: !0,
|
|
42
|
+
get: definition[key]
|
|
43
|
+
});
|
|
44
|
+
}, __webpack_require__.o = function(obj, prop) {
|
|
45
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
46
|
+
}, __webpack_require__.r = function(exports1) {
|
|
47
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
48
|
+
value: 'Module'
|
|
49
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
50
|
+
value: !0
|
|
51
|
+
});
|
|
17
52
|
};
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
53
|
+
var __webpack_exports__ = {};
|
|
54
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
55
|
+
default: function() {
|
|
56
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
57
|
+
},
|
|
58
|
+
raw: function() {
|
|
59
|
+
return raw;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var _transformLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/loader/transformLoader.ts");
|
|
63
|
+
let __WEBPACK_DEFAULT_EXPORT__ = _transformLoader__WEBPACK_IMPORTED_MODULE_0__.default, raw = !0;
|
|
64
|
+
var __webpack_export_target__ = exports;
|
|
65
|
+
for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
|
|
66
|
+
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
67
|
+
value: !0
|
|
25
68
|
});
|
|
26
|
-
module.exports = __toCommonJS(transformRawLoader_exports);
|
|
27
|
-
|
|
28
|
-
// src/loader/transformLoader.ts
|
|
29
|
-
async function transform(source, map) {
|
|
30
|
-
const callback = this.async();
|
|
31
|
-
const bypass = () => callback(null, source, map);
|
|
32
|
-
const { id: transformId, getEnvironment } = this.getOptions();
|
|
33
|
-
if (!transformId) {
|
|
34
|
-
return bypass();
|
|
35
|
-
}
|
|
36
|
-
const transform2 = this._compiler?.__rsbuildTransformer?.[transformId];
|
|
37
|
-
if (!transform2) {
|
|
38
|
-
return bypass();
|
|
39
|
-
}
|
|
40
|
-
const result = await transform2({
|
|
41
|
-
code: source,
|
|
42
|
-
resource: this.resource,
|
|
43
|
-
resourcePath: this.resourcePath,
|
|
44
|
-
resourceQuery: this.resourceQuery,
|
|
45
|
-
environment: getEnvironment(),
|
|
46
|
-
addDependency: this.addDependency,
|
|
47
|
-
emitFile: this.emitFile
|
|
48
|
-
});
|
|
49
|
-
if (result === null || result === void 0) {
|
|
50
|
-
return bypass();
|
|
51
|
-
}
|
|
52
|
-
if (typeof result === "string") {
|
|
53
|
-
return callback(null, result, map);
|
|
54
|
-
}
|
|
55
|
-
const useMap = map !== void 0 && map !== null;
|
|
56
|
-
const finalMap = result.map ?? map;
|
|
57
|
-
callback(null, result.code, useMap ? finalMap : void 0);
|
|
58
|
-
}
|
|
59
69
|
|
|
60
|
-
// src/loader/transformRawLoader.ts
|
|
61
|
-
var transformRawLoader_default = transform;
|
|
62
|
-
var raw = true;
|
|
63
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64
71
|
0 && (module.exports = {
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
PLUGIN_CSS_NAME,
|
|
73
|
+
PLUGIN_SWC_NAME,
|
|
74
|
+
__internalHelper,
|
|
75
|
+
createRsbuild,
|
|
76
|
+
defineConfig,
|
|
77
|
+
ensureAssetPrefix,
|
|
78
|
+
loadConfig,
|
|
79
|
+
loadEnv,
|
|
80
|
+
logger,
|
|
81
|
+
mergeRsbuildConfig,
|
|
82
|
+
rspack,
|
|
83
|
+
version
|
|
84
|
+
});
|
package/dist-types/cli/init.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RsbuildInstance } from '../types';
|
|
2
2
|
import type { CommonOptions } from './commands';
|
|
3
|
-
export declare function init({ cliOptions, isRestart, }: {
|
|
3
|
+
export declare function init({ cliOptions, isRestart, isBuildWatch, }: {
|
|
4
4
|
cliOptions?: CommonOptions;
|
|
5
5
|
isRestart?: boolean;
|
|
6
|
+
isBuildWatch?: boolean;
|
|
6
7
|
}): Promise<RsbuildInstance | undefined>;
|
package/dist-types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChokidarOptions } from '../compiled/chokidar/index.js';
|
|
2
2
|
import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
|
|
3
3
|
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
4
4
|
export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
@@ -24,7 +24,7 @@ export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
|
|
|
24
24
|
export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
|
|
25
25
|
export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
|
|
26
26
|
export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
|
|
27
|
-
export declare function watchFilesForRestart(files: string[], watchOptions?:
|
|
27
|
+
export declare function watchFilesForRestart(files: string[], root: string, isBuildWatch: boolean, watchOptions?: ChokidarOptions): Promise<void>;
|
|
28
28
|
export declare function loadConfig({ cwd, path, envMode, }?: {
|
|
29
29
|
cwd?: string;
|
|
30
30
|
path?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RspackChain from '../compiled/rspack-chain';
|
|
1
|
+
import RspackChain from '../compiled/rspack-chain/index.js';
|
|
2
2
|
import type { InternalContext, ModifyBundlerChainUtils, Rspack } from './types';
|
|
3
3
|
export declare function getBundlerChain(): RspackChain;
|
|
4
4
|
export declare function modifyBundlerChain(context: InternalContext, utils: ModifyBundlerChainUtils): Promise<RspackChain>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type RspackChain from '../../compiled/rspack-chain';
|
|
2
1
|
import type { Compiler as WebpackCompiler, MultiCompiler as WebpackMultiCompiler } from 'webpack';
|
|
2
|
+
import color from '../../compiled/picocolors/index.js';
|
|
3
|
+
import type RspackChain from '../../compiled/rspack-chain/index.js';
|
|
3
4
|
import type { FilenameConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildTarget, Rspack } from '../types';
|
|
4
5
|
export * from './fs';
|
|
5
6
|
export * from './path';
|
|
6
7
|
export * from './stats';
|
|
8
|
+
export { color };
|
|
7
9
|
export declare const rspackMinVersion = "1.0.0";
|
|
8
10
|
export declare const getNodeEnv: () => string;
|
|
9
11
|
export declare const setNodeEnv: (env: string) => void;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { logger } from './logger';
|
|
|
15
15
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
16
16
|
export { ensureAssetPrefix } from './helpers';
|
|
17
17
|
export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
|
|
18
|
-
export type { AppIcon, AppIconItem, AliasStrategy, Build, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, Charset, ClientConfig, CliShortcut, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlFallback, HtmlTagHandler, HtmlTagDescriptor, HtmlTagContext, InspectConfigOptions, InspectConfigResult, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, LegalComments, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, MergedEnvironmentConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSPlugin, PreviewOptions, PreconnectOption, ProxyConfig, ProxyOptions, PrintUrls, PublicDir, PublicDirOptions, ProgressBarConfig, RequestHandler, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildTarget, RspackChain, RspackRule, SriOptions, SriAlgorithm, ScriptInject, ScriptLoading, SecurityConfig, SourceMap, SetupMiddlewaresFn, SetupMiddlewaresServer, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
18
|
+
export type { AppIcon, AppIconItem, AliasStrategy, Build, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, Charset, ClientConfig, CliShortcut, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlFallback, HtmlTagHandler, HtmlTagDescriptor, HtmlTagContext, InspectConfigOptions, InspectConfigResult, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InternalContext, LegalComments, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, MergedEnvironmentConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSPlugin, PreviewOptions, PreconnectOption, ProxyConfig, ProxyOptions, PrintUrls, PublicDir, PublicDirOptions, ProgressBarConfig, RequestHandler, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, SriOptions, SriAlgorithm, ScriptInject, ScriptLoading, SecurityConfig, SourceMap, SetupMiddlewaresFn, SetupMiddlewaresServer, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
19
19
|
export type { ChainIdentifier } from './configChain';
|
|
20
20
|
export {
|
|
21
21
|
/**
|
package/dist-types/internal.d.ts
CHANGED
|
@@ -5,16 +5,4 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { runCli } from './cli/commands';
|
|
7
7
|
export { prepareCli } from './cli/prepare';
|
|
8
|
-
export {
|
|
9
|
-
export { initHooks, type Hooks } from './hooks';
|
|
10
|
-
export { initRsbuildConfig } from './provider/initConfigs';
|
|
11
|
-
export { stringifyConfig, getRsbuildInspectConfig, outputInspectConfigFiles, } from './config';
|
|
12
|
-
export type { InternalContext } from './types';
|
|
13
|
-
export { setHTMLPlugin, getHTMLPlugin } from './pluginHelper';
|
|
14
|
-
export { formatStats, getStatsOptions, prettyTime, isPlainObject, } from './helpers';
|
|
15
|
-
export { registerBuildHook, registerDevHook, onCompileDone } from './hooks';
|
|
16
|
-
export { getChainUtils, getConfigUtils } from './provider/rspackConfig';
|
|
17
|
-
export { chainToConfig, modifyBundlerChain } from './configChain';
|
|
18
|
-
export { applySwcDecoratorConfig } from './plugins/swc';
|
|
19
|
-
export { getSwcMinimizerOptions } from './plugins/minimize';
|
|
20
|
-
export { createDevServer } from './server/devServer';
|
|
8
|
+
export { setHTMLPlugin } from './pluginHelper';
|
package/dist-types/logger.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CSSLoaderOptions,
|
|
2
|
-
export declare const isUseCssExtract: (config: NormalizedEnvironmentConfig, target: RsbuildTarget) => boolean;
|
|
1
|
+
import type { CSSLoaderOptions, RsbuildPlugin } from '../types';
|
|
3
2
|
export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
|
|
4
3
|
export declare const pluginCss: () => RsbuildPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RsbuildPlugin } from '
|
|
1
|
+
import type { RsbuildPlugin } from '../types';
|
|
2
2
|
export declare const pluginLazyCompilation: () => RsbuildPlugin;
|
|
@@ -18,7 +18,7 @@ export type DevMiddlewareOptions = {
|
|
|
18
18
|
etag?: 'weak' | 'strong';
|
|
19
19
|
/** The options need by compiler middleware (like webpackMiddleware) */
|
|
20
20
|
headers?: Record<string, string | string[]>;
|
|
21
|
-
writeToDisk?: boolean | ((filename: string) => boolean);
|
|
21
|
+
writeToDisk?: boolean | ((filename: string, compilationName?: string) => boolean);
|
|
22
22
|
stats?: boolean;
|
|
23
23
|
/** should trigger when compiler hook called */
|
|
24
24
|
callbacks: MiddlewareCallbacks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for `@rsbuild/webpack`.
|
|
3
|
+
*/
|
|
4
|
+
export { setCssExtractPlugin } from '../pluginHelper';
|
|
5
|
+
export { initRsbuildConfig } from './initConfigs';
|
|
6
|
+
export { stringifyConfig, getRsbuildInspectConfig, outputInspectConfigFiles, } from '../config';
|
|
7
|
+
export { getHTMLPlugin } from '../pluginHelper';
|
|
8
|
+
export { formatStats, getStatsOptions, prettyTime } from '../helpers';
|
|
9
|
+
export { registerBuildHook, registerDevHook } from '../hooks';
|
|
10
|
+
export { getChainUtils, getConfigUtils } from './rspackConfig';
|
|
11
|
+
export { chainToConfig, modifyBundlerChain } from '../configChain';
|
|
12
|
+
export { createDevServer } from '../server/devServer';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'node:http';
|
|
2
2
|
import type { Socket } from 'node:net';
|
|
3
|
-
import type { DevConfig, Rspack, ServerConfig } from '../types';
|
|
3
|
+
import type { EnvironmentContext, DevConfig as OriginDevConfig, Rspack, ServerConfig } from '../types';
|
|
4
4
|
import { type DevMiddlewareAPI } from './devMiddleware';
|
|
5
5
|
type Options = {
|
|
6
6
|
publicPaths: string[];
|
|
7
|
-
|
|
7
|
+
environments: Record<string, EnvironmentContext>;
|
|
8
|
+
dev: OriginDevConfig;
|
|
8
9
|
server: ServerConfig;
|
|
9
10
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
10
11
|
};
|
|
@@ -20,7 +21,7 @@ export declare class CompilerDevMiddleware {
|
|
|
20
21
|
private compiler;
|
|
21
22
|
private publicPaths;
|
|
22
23
|
private socketServer;
|
|
23
|
-
constructor({ dev, server, compiler, publicPaths }: Options);
|
|
24
|
+
constructor({ dev, server, compiler, publicPaths, environments }: Options);
|
|
24
25
|
init(): Promise<void>;
|
|
25
26
|
upgrade(req: IncomingMessage, sock: Socket, head: any): void;
|
|
26
27
|
close(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
2
|
import type { Http2SecureServer } from 'node:http2';
|
|
3
|
-
import type Connect from '../../compiled/connect';
|
|
3
|
+
import type Connect from '../../compiled/connect/index.js';
|
|
4
4
|
import type { CreateCompiler, CreateDevServerOptions, EnvironmentAPI, InternalContext, NormalizedConfig } from '../types';
|
|
5
5
|
type HTTPServer = Server | Http2SecureServer;
|
|
6
6
|
export type RsbuildDevServer = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
2
|
import type { Http2SecureServer } from 'node:http2';
|
|
3
|
-
import type Connect from '../../compiled/connect';
|
|
3
|
+
import type Connect from '../../compiled/connect/index.js';
|
|
4
4
|
import type { ServerConfig } from '../types';
|
|
5
5
|
export declare const createHttpServer: ({ serverConfig, middlewares, }: {
|
|
6
6
|
serverConfig: ServerConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type Connect from '../../compiled/connect';
|
|
1
|
+
import type Connect from '../../compiled/connect/index.js';
|
|
2
2
|
import type { EnvironmentAPI, HtmlFallback, RequestHandler as Middleware, Rspack } from '../types';
|
|
3
3
|
export declare const faviconFallbackMiddleware: Middleware;
|
|
4
4
|
export declare const getRequestLoggerMiddleware: () => Promise<Connect.NextHandleFunction>;
|
|
@@ -27,7 +27,7 @@ export declare const getHtmlFallbackMiddleware: (params: {
|
|
|
27
27
|
outputFileSystem: Rspack.OutputFileSystem;
|
|
28
28
|
}) => Middleware;
|
|
29
29
|
/**
|
|
30
|
-
* Support viewing served files via
|
|
30
|
+
* Support viewing served files via `/rsbuild-dev-server` route
|
|
31
31
|
*/
|
|
32
32
|
export declare const viewingServedFilesMiddleware: (params: {
|
|
33
33
|
environments: EnvironmentAPI;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Server } from 'node:http';
|
|
2
2
|
import type { Http2SecureServer } from 'node:http2';
|
|
3
|
-
import type Connect from '../../compiled/connect';
|
|
3
|
+
import type Connect from '../../compiled/connect/index.js';
|
|
4
4
|
import type { InternalContext, NormalizedConfig, PreviewOptions, ServerConfig } from '../types';
|
|
5
5
|
import { type StartServerResult } from './helper';
|
|
6
6
|
type RsbuildProdServerOptions = {
|
|
@@ -7,4 +7,8 @@ export declare const restartDevServer: ({ filePath, clear, }?: {
|
|
|
7
7
|
filePath?: string;
|
|
8
8
|
clear?: boolean;
|
|
9
9
|
}) => Promise<void>;
|
|
10
|
+
export declare const restartBuild: ({ filePath, clear, }?: {
|
|
11
|
+
filePath?: string;
|
|
12
|
+
clear?: boolean;
|
|
13
|
+
}) => Promise<void>;
|
|
10
14
|
export {};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FSWatcher } from '../../compiled/chokidar/index.js';
|
|
2
|
+
import type { ChokidarOptions, DevConfig, ServerConfig } from '../types';
|
|
2
3
|
import type { CompileMiddlewareAPI } from './getDevMiddlewares';
|
|
3
4
|
type WatchFilesOptions = {
|
|
4
5
|
dev: DevConfig;
|
|
5
6
|
server: ServerConfig;
|
|
6
7
|
compileMiddlewareAPI?: CompileMiddlewareAPI;
|
|
8
|
+
root: string;
|
|
7
9
|
};
|
|
8
10
|
export declare function setupWatchFiles(options: WatchFilesOptions): Promise<{
|
|
9
11
|
close(): Promise<void>;
|
|
10
12
|
} | undefined>;
|
|
13
|
+
export declare function createChokidar(pathOrGlobs: string[], root: string, options: ChokidarOptions): Promise<FSWatcher>;
|
|
11
14
|
export {};
|
|
@@ -2,10 +2,10 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
|
2
2
|
import type { SecureServerSessionOptions } from 'node:http2';
|
|
3
3
|
import type { ServerOptions as HttpsServerOptions } from 'node:https';
|
|
4
4
|
import type { Configuration, CopyRspackPluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, ModuleFederationPluginOptions, RuleSetCondition, SwcJsMinimizerRspackPluginOptions, SwcLoaderOptions, rspack } from '@rspack/core';
|
|
5
|
-
import type {
|
|
6
|
-
import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../compiled/http-proxy-middleware';
|
|
7
|
-
import type RspackChain from '../../compiled/rspack-chain';
|
|
8
|
-
import type { BundleAnalyzerPlugin } from '../../compiled/webpack-bundle-analyzer';
|
|
5
|
+
import type { ChokidarOptions } from '../../compiled/chokidar/index.js';
|
|
6
|
+
import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../compiled/http-proxy-middleware/index.js';
|
|
7
|
+
import type RspackChain from '../../compiled/rspack-chain/index.js';
|
|
8
|
+
import type { BundleAnalyzerPlugin } from '../../compiled/webpack-bundle-analyzer/index.js';
|
|
9
9
|
import type { ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
|
|
10
10
|
import type { ModifyWebpackChainUtils, ModifyWebpackConfigUtils, RsbuildPlugins } from './plugin';
|
|
11
11
|
import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
|
|
@@ -29,7 +29,7 @@ export type ModifyRspackConfigUtils = ModifyChainUtils & {
|
|
|
29
29
|
prependPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
|
|
30
30
|
appendPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
|
|
31
31
|
removePlugin: (pluginName: string) => void;
|
|
32
|
-
mergeConfig: typeof import('../../compiled/webpack-merge').merge;
|
|
32
|
+
mergeConfig: typeof import('../../compiled/webpack-merge/index.js').merge;
|
|
33
33
|
rspack: typeof rspack;
|
|
34
34
|
};
|
|
35
35
|
export type ToolsRspackConfig = ConfigChainAsyncWithContext<Rspack.Configuration, ModifyRspackConfigUtils>;
|
|
@@ -377,7 +377,8 @@ export interface PerformanceConfig {
|
|
|
377
377
|
/**
|
|
378
378
|
* Used to control resource `Prefetch`.
|
|
379
379
|
*
|
|
380
|
-
* Specifies that the user agent should preemptively fetch and cache the target resource as it
|
|
380
|
+
* Specifies that the user agent should preemptively fetch and cache the target resource as it
|
|
381
|
+
* is likely to be required for a followup navigation.
|
|
381
382
|
*/
|
|
382
383
|
prefetch?: true | PreloadOrPreFetchOption;
|
|
383
384
|
/**
|
|
@@ -643,7 +644,8 @@ export interface OutputConfig {
|
|
|
643
644
|
*/
|
|
644
645
|
target?: RsbuildTarget;
|
|
645
646
|
/**
|
|
646
|
-
* At build time, prevent some `import` dependencies from being packed into bundles in your code,
|
|
647
|
+
* At build time, prevent some `import` dependencies from being packed into bundles in your code,
|
|
648
|
+
* and instead fetch them externally at runtime.
|
|
647
649
|
* For more information, please see: [Rspack Externals](https://rspack.dev/config/externals)
|
|
648
650
|
* @default undefined
|
|
649
651
|
*/
|
|
@@ -759,6 +761,13 @@ export interface OutputConfig {
|
|
|
759
761
|
* @default true
|
|
760
762
|
*/
|
|
761
763
|
emitAssets?: boolean;
|
|
764
|
+
/**
|
|
765
|
+
* Whether to emit CSS to the output bundles.
|
|
766
|
+
* If `false`, the CSS will not be extracted to separate files or injected into the JavaScript
|
|
767
|
+
* bundles via `output.injectStyles`.
|
|
768
|
+
* @default `true` when `output.target` is `web`, otherwise `false`
|
|
769
|
+
*/
|
|
770
|
+
emitCss?: boolean;
|
|
762
771
|
}
|
|
763
772
|
export interface NormalizedOutputConfig extends OutputConfig {
|
|
764
773
|
target: RsbuildTarget;
|
|
@@ -1015,10 +1024,10 @@ export type ClientConfig = {
|
|
|
1015
1024
|
overlay?: boolean;
|
|
1016
1025
|
};
|
|
1017
1026
|
export type NormalizedClientConfig = Pick<ClientConfig, 'protocol'> & Omit<Required<ClientConfig>, 'protocol'>;
|
|
1018
|
-
export type
|
|
1027
|
+
export type { ChokidarOptions };
|
|
1019
1028
|
export type WatchFiles = {
|
|
1020
1029
|
paths: string | string[];
|
|
1021
|
-
options?:
|
|
1030
|
+
options?: ChokidarOptions;
|
|
1022
1031
|
type?: 'reload-page' | 'reload-server';
|
|
1023
1032
|
};
|
|
1024
1033
|
export type CliShortcut = {
|
|
@@ -1112,7 +1121,7 @@ export interface EnvironmentConfig {
|
|
|
1112
1121
|
/**
|
|
1113
1122
|
* Options for local development.
|
|
1114
1123
|
*/
|
|
1115
|
-
dev?: Pick<DevConfig, 'hmr' | 'assetPrefix' | 'progressBar' | 'lazyCompilation'>;
|
|
1124
|
+
dev?: Pick<DevConfig, 'hmr' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk'>;
|
|
1116
1125
|
/**
|
|
1117
1126
|
* Options for HTML generation.
|
|
1118
1127
|
*/
|
|
@@ -1186,7 +1195,7 @@ export interface RsbuildConfig extends EnvironmentConfig {
|
|
|
1186
1195
|
export type MergedEnvironmentConfig = {
|
|
1187
1196
|
mode: RsbuildMode;
|
|
1188
1197
|
root: string;
|
|
1189
|
-
dev: Pick<NormalizedDevConfig, 'hmr' | 'assetPrefix' | 'progressBar' | 'lazyCompilation'>;
|
|
1198
|
+
dev: Pick<NormalizedDevConfig, 'hmr' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk'>;
|
|
1190
1199
|
html: NormalizedHtmlConfig;
|
|
1191
1200
|
tools: NormalizedToolsConfig;
|
|
1192
1201
|
source: NormalizedSourceConfig;
|
|
@@ -1215,4 +1224,3 @@ export type NormalizedConfig = NormalizedEnvironmentConfig & {
|
|
|
1215
1224
|
[name: string]: NormalizedEnvironmentConfig;
|
|
1216
1225
|
};
|
|
1217
1226
|
};
|
|
1218
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type RspackChain from '../../compiled/rspack-chain';
|
|
2
1
|
import type { ChainIdentifier } from '..';
|
|
2
|
+
import type RspackChain from '../../compiled/rspack-chain/index.js';
|
|
3
3
|
import type { EnvironmentConfig, HtmlBasicTag, MergedEnvironmentConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
|
|
4
4
|
import type { RsbuildEntry, RsbuildTarget } from './rsbuild';
|
|
5
5
|
import type { Rspack } from './rspack';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type RspackChain from '../../compiled/rspack-chain';
|
|
2
1
|
import type { RuleSetRule, Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack';
|
|
2
|
+
import type RspackChain from '../../compiled/rspack-chain/index.js';
|
|
3
3
|
import type { ChainIdentifier } from '../configChain';
|
|
4
4
|
import type { ModifyRspackConfigUtils, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
|
|
5
5
|
import type { RsbuildContext } from './context';
|
|
@@ -55,7 +55,7 @@ export type ModifyWebpackConfigUtils = ModifyWebpackChainUtils & {
|
|
|
55
55
|
prependPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
|
|
56
56
|
appendPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
|
|
57
57
|
removePlugin: (pluginName: string) => void;
|
|
58
|
-
mergeConfig: typeof import('
|
|
58
|
+
mergeConfig: typeof import('../../compiled/webpack-merge/index.js').merge;
|
|
59
59
|
};
|
|
60
60
|
export type ModifyWebpackChainFn = (chain: RspackChain, utils: ModifyWebpackChainUtils) => Promise<void> | void;
|
|
61
61
|
export type ModifyWebpackConfigFn = (config: WebpackConfig, utils: ModifyWebpackConfigUtils) => Promise<WebpackConfig | void> | WebpackConfig | void;
|