@rsbuild/core 0.0.22 → 0.0.24
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/bin/rsbuild.js +1 -1
- package/compiled/commander/index.js +1 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/commander/typings/index.d.ts +889 -0
- package/compiled/http-compression/index.d.ts +1 -0
- package/compiled/http-compression/index.js +1 -0
- package/compiled/http-compression/package.json +1 -0
- package/dist/cli/commands.js +36 -12
- package/dist/cli/config.d.ts +2 -9
- package/dist/cli/config.js +0 -18
- package/dist/cli/run.d.ts +0 -2
- package/dist/cli/run.js +0 -8
- package/dist/createRsbuild.d.ts +1 -1
- package/dist/createRsbuild.js +5 -2
- package/dist/index.d.ts +2 -2
- package/dist/plugins/entry.d.ts +2 -2
- package/dist/plugins/entry.js +11 -0
- package/dist/plugins/fileSize.js +2 -2
- package/dist/plugins/html.js +1 -1
- package/dist/plugins/startUrl.js +7 -3
- package/dist/rspack-provider/core/createContext.js +3 -2
- package/dist/rspack-provider/core/initConfigs.js +1 -0
- package/dist/rspack-provider/core/rspackConfig.js +1 -1
- package/dist/rspack-provider/index.d.ts +1 -1
- package/dist/rspack-provider/plugins/{rspack-profile.js → rspackProfile.js} +3 -3
- package/dist/rspack-provider/provider.js +4 -3
- package/dist/rspack-provider/shared/plugin.js +1 -1
- package/dist/rspack-provider/types/plugin.d.ts +1 -1
- package/dist/server/dev-middleware/index.d.ts +1 -0
- package/dist/server/dev-middleware/index.js +5 -5
- package/dist/server/devServer.js +2 -1
- package/package.json +3 -7
- /package/dist/rspack-provider/plugins/{rspack-profile.d.ts → rspackProfile.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={323:(e,t,r)=>{const n=r(796);const s=/text|javascript|\/json|xml/i;const noop=()=>{};const getChunkSize=(e,t)=>e?Buffer.byteLength(e,t):0;e.exports=({threshold:e=1024,level:t=-1,brotli:r=true,gzip:i=true,mimes:o=s}={})=>{const a=typeof r==="object"&&r||{};const c=typeof i==="object"&&i||{};if(r&&!n.createBrotliCompress)r=false;return(s,l,p=noop)=>{const f=s.headers["accept-encoding"];const u=f&&(r&&f.match(/\bbr\b/)||i&&f.match(/\bgzip\b/)||[])[0];if(s.method==="HEAD"||!u)return p();let _;let d;let b=[];let h=false;let g=0;function start(){h=true;g=l.getHeader("Content-Length")|0||g;const r=o.test(String(l.getHeader("Content-Type")||"text/plain"));const s=!l.getHeader("Content-Encoding");const i=b||[];if(r&&s&&g>=e){l.setHeader("Content-Encoding",u);l.removeHeader("Content-Length");if(u==="br"){const e={[n.constants.BROTLI_PARAM_QUALITY]:t,[n.constants.BROTLI_PARAM_SIZE_HINT]:g};_=n.createBrotliCompress({params:Object.assign(e,a)})}else{_=n.createGzip(Object.assign({level:t},c))}_.on("data",(e=>m.call(l,e)===false&&_.pause()));v.call(l,"drain",(()=>_.resume()));_.on("end",(()=>y.call(l)));i.forEach((e=>_.on.apply(_,e)))}else{b=null;i.forEach((e=>v.apply(l,e)))}w.call(l,d||l.statusCode)}const{end:y,write:m,on:v,writeHead:w}=l;l.writeHead=function(e,t,r){if(typeof t!=="string")[r,t]=[t,r];if(r)for(const e in r)l.setHeader(e,r[e]);d=e;return this};l.write=function(e,t){g+=getChunkSize(e,t);if(!h)start();if(!_)return m.apply(this,arguments);return _.write.apply(_,arguments)};l.end=function(e,t){if(arguments.length>0&&typeof e!=="function"){g+=getChunkSize(e,t)}if(!h)start();if(!_)return y.apply(this,arguments);return _.end.apply(_,arguments)};l.on=function(e,t){if(!b||e!=="drain")v.call(this,e,t);else if(_)_.on(e,t);else b.push([e,t]);return this};p()}}},796:e=>{e.exports=require("zlib")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={exports:{}};var i=true;try{e[r](s,s.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(323);module.exports=r})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"http-compression","author":{"email":"josefrancisco.verdu@gmail.com","name":"Kiko Beats","url":"https://kikobeats.com"},"version":"1.0.6","license":"MIT","types":"index.d.ts"}
|
package/dist/cli/commands.js
CHANGED
|
@@ -23,29 +23,53 @@ __export(commands_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(commands_exports);
|
|
24
24
|
var import_path = require("path");
|
|
25
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
|
-
var import_commander = require("commander");
|
|
26
|
+
var import_commander = require("../../compiled/commander");
|
|
27
27
|
function setupProgram(rsbuild) {
|
|
28
28
|
const pkgJson = (0, import_path.join)(__dirname, "../../package.json");
|
|
29
29
|
const { version } = import_shared.fse.readJSONSync(pkgJson);
|
|
30
30
|
import_commander.program.name("rsbuild").usage("<command> [options]").version(version);
|
|
31
31
|
import_commander.program.command("dev").option(`--open`, "open the page in browser on startup").description("starting the dev server").action(async (options) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
try {
|
|
33
|
+
await rsbuild.startDevServer({
|
|
34
|
+
open: options.open
|
|
35
|
+
});
|
|
36
|
+
} catch (err) {
|
|
37
|
+
import_shared.logger.error("Failed to start dev server, please check logs.");
|
|
38
|
+
import_shared.logger.error(err);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
35
41
|
});
|
|
36
42
|
import_commander.program.command("build").description("build the app for production").action(async () => {
|
|
37
|
-
|
|
43
|
+
try {
|
|
44
|
+
await rsbuild.build();
|
|
45
|
+
} catch (err) {
|
|
46
|
+
import_shared.logger.error("Failed to build, please check logs.");
|
|
47
|
+
import_shared.logger.error(err);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
38
50
|
});
|
|
39
51
|
import_commander.program.command("preview").description("preview the production build locally").action(async () => {
|
|
40
|
-
|
|
52
|
+
try {
|
|
53
|
+
await rsbuild.preview();
|
|
54
|
+
} catch (err) {
|
|
55
|
+
import_shared.logger.error("Failed to start preview server, please check logs.");
|
|
56
|
+
import_shared.logger.error(err);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
41
59
|
});
|
|
42
60
|
import_commander.program.command("inspect").description("inspect the Rspack and Rsbuild configs").option(`--env <env>`, "specify env mode", "development").option("--output <output>", "specify inspect content output path", "/").option("--verbose", "show full function definitions in output").action(async (options) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
try {
|
|
62
|
+
await rsbuild.inspectConfig({
|
|
63
|
+
env: options.env,
|
|
64
|
+
verbose: options.verbose,
|
|
65
|
+
outputPath: (0, import_path.join)(rsbuild.context.distPath, options.output),
|
|
66
|
+
writeToDisk: true
|
|
67
|
+
});
|
|
68
|
+
} catch (err) {
|
|
69
|
+
import_shared.logger.error("Failed to inspect config, please check logs.");
|
|
70
|
+
import_shared.logger.error(err);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
49
73
|
});
|
|
50
74
|
import_commander.program.parse();
|
|
51
75
|
}
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RsbuildConfig as BaseRsbuildConfig } from '@rsbuild/shared';
|
|
2
2
|
export type RsbuildConfig = BaseRsbuildConfig & {
|
|
3
|
-
source?: {
|
|
4
|
-
entries?: RsbuildEntry;
|
|
5
|
-
};
|
|
6
|
-
plugins?: RsbuildPlugin[];
|
|
7
3
|
/**
|
|
8
4
|
* @private only for testing
|
|
9
5
|
*/
|
|
10
6
|
provider?: any;
|
|
11
7
|
};
|
|
12
8
|
export declare const defineConfig: (config: RsbuildConfig) => RsbuildConfig;
|
|
13
|
-
export declare function loadConfig(): Promise<ReturnType<typeof defineConfig>>;
|
|
14
|
-
export declare function getDefaultEntries(): {
|
|
15
|
-
index: string;
|
|
16
|
-
};
|
|
9
|
+
export declare function loadConfig(): Promise<ReturnType<typeof defineConfig>>;
|
package/dist/cli/config.js
CHANGED
|
@@ -29,14 +29,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var config_exports = {};
|
|
30
30
|
__export(config_exports, {
|
|
31
31
|
defineConfig: () => defineConfig,
|
|
32
|
-
getDefaultEntries: () => getDefaultEntries,
|
|
33
32
|
loadConfig: () => loadConfig
|
|
34
33
|
});
|
|
35
34
|
module.exports = __toCommonJS(config_exports);
|
|
36
35
|
var import_fs = __toESM(require("fs"));
|
|
37
36
|
var import_jiti = __toESM(require("jiti"));
|
|
38
37
|
var import_path = require("path");
|
|
39
|
-
var import_shared = require("@rsbuild/shared");
|
|
40
38
|
var import_restart = require("../server/restart");
|
|
41
39
|
const defineConfig = (config) => config;
|
|
42
40
|
const resolveConfigPath = () => {
|
|
@@ -84,24 +82,8 @@ async function loadConfig() {
|
|
|
84
82
|
}
|
|
85
83
|
return {};
|
|
86
84
|
}
|
|
87
|
-
function getDefaultEntries() {
|
|
88
|
-
const cwd = process.cwd();
|
|
89
|
-
const files = ["ts", "tsx", "js", "jsx"].map(
|
|
90
|
-
(ext) => (0, import_path.join)(cwd, `src/index.${ext}`)
|
|
91
|
-
);
|
|
92
|
-
const entryFile = (0, import_shared.findExists)(files);
|
|
93
|
-
if (entryFile) {
|
|
94
|
-
return {
|
|
95
|
-
index: entryFile
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
throw new Error(
|
|
99
|
-
"Could not find the entry file, please make sure that `src/index.(js|ts|tsx|jsx)` exists, or customize entry through the `source.entries` configuration."
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
85
|
// Annotate the CommonJS export names for ESM import in node:
|
|
103
86
|
0 && (module.exports = {
|
|
104
87
|
defineConfig,
|
|
105
|
-
getDefaultEntries,
|
|
106
88
|
loadConfig
|
|
107
89
|
});
|
package/dist/cli/run.d.ts
CHANGED
package/dist/cli/run.js
CHANGED
|
@@ -25,19 +25,11 @@ var import__ = require("..");
|
|
|
25
25
|
var import_commands = require("./commands");
|
|
26
26
|
var import_config = require("./config");
|
|
27
27
|
async function runCli(options = {}) {
|
|
28
|
-
var _a;
|
|
29
28
|
const config = await (0, import_config.loadConfig)();
|
|
30
29
|
const rsbuild = await (0, import__.createRsbuild)({
|
|
31
30
|
rsbuildConfig: config,
|
|
32
|
-
entry: ((_a = config.source) == null ? void 0 : _a.entries) || (0, import_config.getDefaultEntries)(),
|
|
33
31
|
provider: config.provider
|
|
34
32
|
});
|
|
35
|
-
if (options.defaultPlugins) {
|
|
36
|
-
rsbuild.addPlugins(options.defaultPlugins);
|
|
37
|
-
}
|
|
38
|
-
if (config.plugins) {
|
|
39
|
-
rsbuild.addPlugins(config.plugins);
|
|
40
|
-
}
|
|
41
33
|
if (!options.isRestart) {
|
|
42
34
|
(0, import_commands.setupProgram)(rsbuild);
|
|
43
35
|
}
|
package/dist/createRsbuild.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function createRsbuild<P extends ({
|
|
|
5
5
|
rsbuildConfig
|
|
6
6
|
}: {
|
|
7
7
|
rsbuildConfig: T;
|
|
8
|
-
}) => RsbuildProvider, T
|
|
8
|
+
}) => RsbuildProvider, T extends RsbuildConfig>(options: CreateRsbuildOptions & {
|
|
9
9
|
rsbuildConfig: T;
|
|
10
10
|
provider?: P;
|
|
11
11
|
}): Promise<RsbuildInstance<ReturnType<P>>>;
|
package/dist/createRsbuild.js
CHANGED
|
@@ -42,7 +42,6 @@ const getRspackProvider = async (rsbuildConfig) => {
|
|
|
42
42
|
};
|
|
43
43
|
const getCreateRsbuildDefaultOptions = () => ({
|
|
44
44
|
cwd: process.cwd(),
|
|
45
|
-
entry: {},
|
|
46
45
|
target: ["web"],
|
|
47
46
|
configPath: null
|
|
48
47
|
});
|
|
@@ -72,7 +71,7 @@ async function createRsbuild(options) {
|
|
|
72
71
|
(0, import_shared.debug)("add default plugins");
|
|
73
72
|
await applyDefaultPlugins(pluginStore);
|
|
74
73
|
(0, import_shared.debug)("add default plugins done");
|
|
75
|
-
|
|
74
|
+
const rsbuild = {
|
|
76
75
|
...(0, import_shared.pick)(pluginStore, ["addPlugins", "removePlugins", "isPluginExists"]),
|
|
77
76
|
...(0, import_shared.pick)(pluginAPI, [
|
|
78
77
|
"onBeforeBuild",
|
|
@@ -95,6 +94,10 @@ async function createRsbuild(options) {
|
|
|
95
94
|
startDevServer,
|
|
96
95
|
context: publicContext
|
|
97
96
|
};
|
|
97
|
+
if (rsbuildConfig.plugins) {
|
|
98
|
+
rsbuild.addPlugins(rsbuildConfig.plugins);
|
|
99
|
+
}
|
|
100
|
+
return rsbuild;
|
|
98
101
|
}
|
|
99
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
100
103
|
0 && (module.exports = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createRsbuild, getCreateRsbuildDefaultOptions } from './createRsbuild';
|
|
2
2
|
export { mergeRsbuildConfig } from '@rsbuild/shared';
|
|
3
3
|
export { defineConfig } from './cli';
|
|
4
|
-
export type {
|
|
5
|
-
export type { RsbuildMode, RsbuildEntry, RsbuildTarget,
|
|
4
|
+
export type { Rspack, RsbuildConfig, RsbuildPlugin, RsbuildPluginAPI } from './rspack-provider';
|
|
5
|
+
export type { Context, RsbuildMode, RsbuildEntry, RsbuildTarget, RsbuildInstance, CreateRsbuildOptions, InspectConfigOptions, OnExitFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnBeforeBuildFn, OnBeforeStartDevServerFn, OnBeforeCreateCompilerFn, OnDevCompileDoneFn, ModifyRsbuildConfigFn } from '@rsbuild/shared';
|
package/dist/plugins/entry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const pluginEntry: () =>
|
|
1
|
+
import type { RsbuildPlugin } from '../rspack-provider/types';
|
|
2
|
+
export declare const pluginEntry: () => RsbuildPlugin;
|
package/dist/plugins/entry.js
CHANGED
|
@@ -34,6 +34,17 @@ const pluginEntry = () => ({
|
|
|
34
34
|
(0, import_shared.castArray)(entry[entryName]).forEach(appendEntry);
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
|
+
api.onBeforeCreateCompiler(({ bundlerConfigs }) => {
|
|
38
|
+
if (bundlerConfigs.every((config) => !config.entry)) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
`Could not find any entry module, please make sure that ${import_shared.color.cyan(
|
|
41
|
+
`src/index.(ts|js|tsx|jsx|mjs|cjs)`
|
|
42
|
+
)} exists, or customize entry through the ${import_shared.color.cyan(
|
|
43
|
+
`source.entry`
|
|
44
|
+
)} configuration.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
37
48
|
}
|
|
38
49
|
});
|
|
39
50
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/plugins/fileSize.js
CHANGED
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(fileSize_exports);
|
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_shared = require("@rsbuild/shared");
|
|
37
37
|
var import_shared2 = require("@rsbuild/shared");
|
|
38
|
-
var import_gzip_size = __toESM(require("gzip-size"));
|
|
39
38
|
const filterAsset = (asset) => !/\.map$/.test(asset) && !/\.LICENSE\.txt$/.test(asset);
|
|
40
39
|
const getAssetColor = (size) => {
|
|
41
40
|
if (size > 300 * 1e3) {
|
|
@@ -63,10 +62,11 @@ const calcFileSize = (len) => {
|
|
|
63
62
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
64
63
|
};
|
|
65
64
|
async function printFileSizes(stats, distPath) {
|
|
65
|
+
const { default: gzipSize } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared/gzip-size")));
|
|
66
66
|
const formatAsset = (asset) => {
|
|
67
67
|
const contents = import_shared.fse.readFileSync(import_path.default.join(distPath, asset.name));
|
|
68
68
|
const size = contents.length;
|
|
69
|
-
const gzippedSize =
|
|
69
|
+
const gzippedSize = gzipSize.sync(contents);
|
|
70
70
|
return {
|
|
71
71
|
size,
|
|
72
72
|
folder: import_path.default.join(import_path.default.basename(distPath), import_path.default.dirname(asset.name)),
|
package/dist/plugins/html.js
CHANGED
|
@@ -178,7 +178,7 @@ const pluginHtml = () => ({
|
|
|
178
178
|
const htmlPaths = api.getHTMLPaths();
|
|
179
179
|
const htmlInfoMap = {};
|
|
180
180
|
await Promise.all(
|
|
181
|
-
entryNames.map(async (entryName
|
|
181
|
+
entryNames.map(async (entryName) => {
|
|
182
182
|
const entryValue = entries[entryName].values();
|
|
183
183
|
const chunks = getChunks(entryName, entryValue);
|
|
184
184
|
const inject = getInject(entryName, config);
|
package/dist/plugins/startUrl.js
CHANGED
|
@@ -107,9 +107,13 @@ function pluginStartUrl() {
|
|
|
107
107
|
const urls = [];
|
|
108
108
|
if (startUrl === true || !startUrl) {
|
|
109
109
|
const protocol = https ? "https" : "http";
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
if (routes.length) {
|
|
111
|
+
urls.push(
|
|
112
|
+
(0, import_shared.normalizeUrl)(
|
|
113
|
+
`${protocol}://localhost:${port}/${routes[0].route}`
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
113
117
|
} else {
|
|
114
118
|
urls.push(
|
|
115
119
|
...(0, import_shared.castArray)(startUrl).map(
|
|
@@ -29,8 +29,9 @@ async function createContext(options, userRsbuildConfig) {
|
|
|
29
29
|
const rsbuildConfig = (0, import_defaults.withDefaultConfig)(userRsbuildConfig);
|
|
30
30
|
const context = (0, import_shared.createContextByConfig)(
|
|
31
31
|
options,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
"rspack",
|
|
33
|
+
rsbuildConfig.source,
|
|
34
|
+
rsbuildConfig.output
|
|
34
35
|
);
|
|
35
36
|
const tsconfigPath = (0, import_path.join)(context.rootPath, import_shared.TS_CONFIG_FILE);
|
|
36
37
|
return {
|
|
@@ -45,6 +45,7 @@ async function initConfigs({
|
|
|
45
45
|
});
|
|
46
46
|
await modifyRsbuildConfig(context);
|
|
47
47
|
context.normalizedConfig = (0, import_normalize.normalizeConfig)(context.config);
|
|
48
|
+
(0, import_shared.updateContextByNormalizedConfig)(context, context.normalizedConfig);
|
|
48
49
|
const targets = (0, import_shared.castArray)(rsbuildOptions.target);
|
|
49
50
|
const rspackConfigs = await Promise.all(
|
|
50
51
|
targets.map((target) => (0, import_rspackConfig.generateRspackConfig)({ target, context }))
|
|
@@ -53,7 +53,7 @@ async function modifyRspackConfig(context, rspackConfig, utils) {
|
|
|
53
53
|
}
|
|
54
54
|
async function getConfigUtils(config, chainUtils) {
|
|
55
55
|
const { merge } = await Promise.resolve().then(() => __toESM(require("@rsbuild/shared/webpack-merge")));
|
|
56
|
-
const
|
|
56
|
+
const rspack = await Promise.resolve().then(() => __toESM(require("@rspack/core")));
|
|
57
57
|
return {
|
|
58
58
|
...chainUtils,
|
|
59
59
|
rspack,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getRspackVersion } from './shared/rspackVersion';
|
|
2
2
|
export { rspackProvider } from './provider';
|
|
3
3
|
export type { RspackProvider } from './provider';
|
|
4
|
-
export type { RsbuildConfig, NormalizedConfig, RsbuildPluginAPI } from './types';
|
|
4
|
+
export type { RsbuildConfig, NormalizedConfig, RsbuildPlugin, RsbuildPluginAPI } from './types';
|
|
5
5
|
export type { Rspack, RspackConfig } from '@rsbuild/shared';
|
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var rspackProfile_exports = {};
|
|
30
|
+
__export(rspackProfile_exports, {
|
|
31
31
|
pluginRspackProfile: () => pluginRspackProfile,
|
|
32
32
|
stopProfiler: () => stopProfiler
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(rspackProfile_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
36
|
var import_core = require("@rspack/core");
|
|
37
37
|
var import_inspector = __toESM(require("inspector"));
|
|
@@ -37,7 +37,6 @@ var import_initConfigs = require("./core/initConfigs");
|
|
|
37
37
|
var import_initPlugins = require("./core/initPlugins");
|
|
38
38
|
var import_plugin = require("./shared/plugin");
|
|
39
39
|
var import_rspackVersion = require("./shared/rspackVersion");
|
|
40
|
-
var import_server = require("../server");
|
|
41
40
|
function rspackProvider({
|
|
42
41
|
rsbuildConfig: originalRsbuildConfig
|
|
43
42
|
}) {
|
|
@@ -73,15 +72,17 @@ function rspackProvider({
|
|
|
73
72
|
});
|
|
74
73
|
},
|
|
75
74
|
async startDevServer(options) {
|
|
75
|
+
const { startDevServer } = await Promise.resolve().then(() => __toESM(require("../server/devServer")));
|
|
76
76
|
const { createDevMiddleware } = await Promise.resolve().then(() => __toESM(require("./core/createCompiler")));
|
|
77
|
-
return
|
|
77
|
+
return startDevServer(
|
|
78
78
|
{ context, pluginStore, rsbuildOptions },
|
|
79
79
|
createDevMiddleware,
|
|
80
80
|
options
|
|
81
81
|
);
|
|
82
82
|
},
|
|
83
83
|
async preview(options) {
|
|
84
|
-
|
|
84
|
+
const { startProdServer } = await Promise.resolve().then(() => __toESM(require("../server/prodServer")));
|
|
85
|
+
return startProdServer(context, context.config, options);
|
|
85
86
|
},
|
|
86
87
|
async build(options) {
|
|
87
88
|
const { build: buildImpl, rspackBuild } = await Promise.resolve().then(() => __toESM(require("./core/build")));
|
|
@@ -67,7 +67,7 @@ const applyDefaultPlugins = (plugins) => (0, import_shared.awaitableGetter)([
|
|
|
67
67
|
plugins.networkPerformance(),
|
|
68
68
|
plugins.preloadOrPrefetch(),
|
|
69
69
|
plugins.performance(),
|
|
70
|
-
Promise.resolve().then(() => __toESM(require("../plugins/
|
|
70
|
+
Promise.resolve().then(() => __toESM(require("../plugins/rspackProfile"))).then((m) => m.pluginRspackProfile())
|
|
71
71
|
]);
|
|
72
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
73
|
0 && (module.exports = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RsbuildConfig, NormalizedConfig, DefaultRsbuildPluginAPI, RsbuildPlugin as BaseRsbuildPlugin } from '@rsbuild/shared';
|
|
2
2
|
import type { RspackConfig, RspackCompiler, RspackMultiCompiler } from '@rsbuild/shared';
|
|
3
3
|
export interface RsbuildPluginAPI extends DefaultRsbuildPluginAPI<RsbuildConfig, NormalizedConfig, RspackConfig, RspackCompiler | RspackMultiCompiler> {}
|
|
4
|
-
export type RsbuildPlugin = BaseRsbuildPlugin<
|
|
4
|
+
export type RsbuildPlugin<T = RsbuildPluginAPI> = BaseRsbuildPlugin<T>;
|
|
@@ -57,11 +57,11 @@ class DevMiddleware extends import_events.EventEmitter {
|
|
|
57
57
|
app.on("listening", () => {
|
|
58
58
|
this.socketServer.prepare(app);
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
}
|
|
61
|
+
close() {
|
|
62
|
+
var _a;
|
|
63
|
+
this.socketServer.close();
|
|
64
|
+
(_a = this.middleware) == null ? void 0 : _a.close(noop);
|
|
65
65
|
}
|
|
66
66
|
sockWrite(type, data) {
|
|
67
67
|
this.socketServer.sockWrite(type, data);
|
package/dist/server/devServer.js
CHANGED
|
@@ -82,7 +82,7 @@ class RsbuildDevServer {
|
|
|
82
82
|
async applyDefaultMiddlewares(app) {
|
|
83
83
|
const { dev, devMiddleware } = this;
|
|
84
84
|
if (dev.compress) {
|
|
85
|
-
const { default: compression } = await Promise.resolve().then(() => __toESM(require("http-compression")));
|
|
85
|
+
const { default: compression } = await Promise.resolve().then(() => __toESM(require("../../compiled/http-compression")));
|
|
86
86
|
this.middlewares.use((req, res, next) => {
|
|
87
87
|
compression({
|
|
88
88
|
gzip: true,
|
|
@@ -153,6 +153,7 @@ class RsbuildDevServer {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
close() {
|
|
156
|
+
this.devMiddleware.close();
|
|
156
157
|
this.app.close();
|
|
157
158
|
}
|
|
158
159
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Unleash the power of Rspack with the out-of-the-box build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -58,20 +58,16 @@
|
|
|
58
58
|
"types.d.ts"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@rspack/core": "0.3.
|
|
62
|
-
"commander": "^10.0.1",
|
|
61
|
+
"@rspack/core": "0.3.13",
|
|
63
62
|
"core-js": "~3.32.2",
|
|
64
|
-
"gzip-size": "^6.0.0",
|
|
65
63
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.5.5",
|
|
66
|
-
"http-compression": "1.0.6",
|
|
67
64
|
"http-proxy-middleware": "^2.0.1",
|
|
68
65
|
"jiti": "^1.20.0",
|
|
69
66
|
"postcss": "8.4.31",
|
|
70
|
-
"rslog": "^1.1.0",
|
|
71
67
|
"semver": "^7.5.4",
|
|
72
68
|
"sirv": "^2.0.3",
|
|
73
69
|
"ws": "^8.2.0",
|
|
74
|
-
"@rsbuild/shared": "0.0.
|
|
70
|
+
"@rsbuild/shared": "0.0.24"
|
|
75
71
|
},
|
|
76
72
|
"devDependencies": {
|
|
77
73
|
"@types/node": "^16",
|
|
File without changes
|