@rsbuild/core 0.0.22 → 0.0.23
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 +1 -1
- package/dist/cli/config.d.ts +2 -8
- package/dist/cli/config.js +0 -18
- package/dist/cli/run.d.ts +1 -1
- package/dist/cli/run.js +0 -2
- package/dist/createRsbuild.js +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/plugins/fileSize.js +2 -2
- package/dist/plugins/html.js +1 -1
- package/dist/rspack-provider/core/createContext.js +3 -2
- 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 +2 -6
- /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,7 +23,7 @@ __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);
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RsbuildPlugin, RsbuildConfig as BaseRsbuildConfig } from '@rsbuild/shared';
|
|
2
2
|
export type RsbuildConfig = BaseRsbuildConfig & {
|
|
3
|
-
source?: {
|
|
4
|
-
entries?: RsbuildEntry;
|
|
5
|
-
};
|
|
6
3
|
plugins?: RsbuildPlugin[];
|
|
7
4
|
/**
|
|
8
5
|
* @private only for testing
|
|
@@ -10,7 +7,4 @@ export type RsbuildConfig = BaseRsbuildConfig & {
|
|
|
10
7
|
provider?: any;
|
|
11
8
|
};
|
|
12
9
|
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
|
-
};
|
|
10
|
+
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,11 +25,9 @@ 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
33
|
if (options.defaultPlugins) {
|
package/dist/createRsbuild.js
CHANGED
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/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);
|
|
@@ -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 {
|
|
@@ -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.23",
|
|
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": {
|
|
@@ -59,19 +59,15 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@rspack/core": "0.3.12",
|
|
62
|
-
"commander": "^10.0.1",
|
|
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.23"
|
|
75
71
|
},
|
|
76
72
|
"devDependencies": {
|
|
77
73
|
"@types/node": "^16",
|
|
File without changes
|