@rsbuild/core 0.6.3 → 0.6.4
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/cli/commands.js +1 -1
- package/dist/cli/prepare.js +1 -1
- package/dist/client/hmr/index.d.ts +0 -3
- package/dist/client/overlay.mjs +2 -2
- package/dist/config.js +2 -1
- package/dist/{provider/createContext.d.ts → createContext.d.ts} +1 -1
- package/dist/{provider/createContext.js → createContext.js} +4 -4
- package/dist/index.js +1 -1
- package/dist/{provider/initPlugins.d.ts → initPlugins.d.ts} +1 -1
- package/dist/{provider/initPlugins.js → initPlugins.js} +1 -1
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +3 -3
- package/dist/mergeConfig.js +1 -0
- package/dist/plugins/asset.js +20 -11
- package/dist/provider/createCompiler.js +1 -1
- package/dist/provider/initConfigs.js +1 -1
- package/dist/provider/provider.js +2 -2
- package/dist/server/helper.d.ts +4 -4
- package/package.json +2 -2
- /package/dist/{provider → server}/devMiddleware.d.ts +0 -0
- /package/dist/{provider → server}/devMiddleware.js +0 -0
package/dist/cli/commands.js
CHANGED
|
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
|
|
|
39
39
|
command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
|
|
40
40
|
};
|
|
41
41
|
function runCli() {
|
|
42
|
-
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.
|
|
42
|
+
import_commander.program.name("rsbuild").usage("<command> [options]").version("0.6.4");
|
|
43
43
|
const devCommand = import_commander.program.command("dev");
|
|
44
44
|
const buildCommand = import_commander.program.command("build");
|
|
45
45
|
const previewCommand = import_commander.program.command("preview");
|
package/dist/cli/prepare.js
CHANGED
|
@@ -34,7 +34,7 @@ function prepareCli() {
|
|
|
34
34
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
35
35
|
console.log();
|
|
36
36
|
}
|
|
37
|
-
import_rslog.logger.greet(` ${`Rsbuild v${"0.6.
|
|
37
|
+
import_rslog.logger.greet(` ${`Rsbuild v${"0.6.4"}`}
|
|
38
38
|
`);
|
|
39
39
|
}
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
declare let createOverlay: undefined | ((err: string[]) => void);
|
|
2
|
-
declare let clearOverlay: undefined | (() => void);
|
|
3
1
|
export declare const registerOverlay: (options: {
|
|
4
2
|
createOverlay: (err: string[]) => void;
|
|
5
3
|
clearOverlay: () => void;
|
|
6
4
|
}) => void;
|
|
7
|
-
export {};
|
package/dist/client/overlay.mjs
CHANGED
|
@@ -164,10 +164,10 @@ function linkedText(root, selector, text) {
|
|
|
164
164
|
el.appendChild(document.createTextNode(frag));
|
|
165
165
|
}
|
|
166
166
|
var overlayTemplate = '\n<style>\n.root {\n position: fixed;\n z-index: 9999;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n margin: 0;\n background: rgba(0, 0, 0, 0.66);\n cursor: pointer;\n}\n.container {\n font-family: Menlo, Consolas, monospace;\n line-height: 1.6;\n width: 800px;\n max-width: 85%;\n color: #d8d8d8;\n margin: 32px auto;\n padding: 32px 40px;\n position: relative;\n background: #181818;\n border-radius: 24px;\n box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);\n overflow: hidden;\n direction: ltr;\n text-align: left;\n box-sizing: border-box;\n cursor: default;\n}\n.title {\n margin: 0 0 20px;\n padding-bottom: 12px;\n font-size: 17px;\n font-weight: 600;\n color: #fc5e5e;\n border-bottom: 2px solid rgba(252,94,94,.66);\n}\n.content {\n margin: 0;\n font-size: 14px;\n font-family: inherit;\n overflow-x: scroll;\n scrollbar-width: none;\n color: #b8b8b8;\n}\n.content::-webkit-scrollbar {\n display: none;\n}\n.file-link {\n cursor: pointer;\n color: #27caca;\n text-decoration: underline;\n &:hover {\n opacity: 0.8;\n }\n &:active {\n opacity: 0.6;\n }\n}\n.close {\n position: absolute;\n top: 27px;\n right: 32px;\n width: 32px;\n height: 32px;\n cursor: pointer;\n}\n.close:hover {\n opacity: 0.8;\n}\n.close:active {\n opacity: 0.6;\n}\n.close:before,\n.close:after {\n position: absolute;\n left: 16px;\n top: 8px;\n content: \' \';\n height: 18px;\n width: 2px;\n border-radius: 4px;\n background-color: #b8b8b8;\n}\n.close:before {\n transform: rotate(45deg);\n}\n.close:after {\n transform: rotate(-45deg);\n}\n.footer {\n font-size: 12px;\n color: #7e6a92;\n margin-top: 20px;\n padding-top: 12px;\n border-top: 2px solid rgba(126,106,146,.6);\n}\n.footer p {\n margin: 4px 0 0;\n}\n.footer span {\n color: #a88dc3;\n}\n</style>\n\n<div class="root">\n <div class="container">\n <div class="close"></div>\n <p class="title">Compilation failed</p>\n <pre class="content"></pre>\n <footer class="footer">\n <p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>\n <p>Disable overlay by setting Rsbuild\'s <span>dev.client.overlay</span> config to false.<p>\n </footer>\n </div>\n</div>\n';
|
|
167
|
-
var
|
|
167
|
+
var _ref = typeof window !== "undefined" ? window : globalThis, _ref_HTMLElement = _ref.HTMLElement, HTMLElement = _ref_HTMLElement === void 0 ? function HTMLElement() {
|
|
168
168
|
"use strict";
|
|
169
169
|
_class_call_check(this, HTMLElement);
|
|
170
|
-
} :
|
|
170
|
+
} : _ref_HTMLElement, customElements = _ref.customElements;
|
|
171
171
|
var ErrorOverlay = /*#__PURE__*/ function(HTMLElement) {
|
|
172
172
|
"use strict";
|
|
173
173
|
_inherits(ErrorOverlay, HTMLElement);
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BundlerType, type RsbuildConfig, type RsbuildContext, type NormalizedConfig, type CreateRsbuildOptions } from '@rsbuild/shared';
|
|
2
|
-
import type { InternalContext } from '
|
|
2
|
+
import type { InternalContext } from './types';
|
|
3
3
|
export declare function updateContextByNormalizedConfig(context: RsbuildContext, config: NormalizedConfig): void;
|
|
4
4
|
export declare function createPublicContext(context: RsbuildContext): Readonly<RsbuildContext>;
|
|
5
5
|
/**
|
|
@@ -25,9 +25,9 @@ __export(createContext_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(createContext_exports);
|
|
26
26
|
var import_node_path = require("node:path");
|
|
27
27
|
var import_shared = require("@rsbuild/shared");
|
|
28
|
-
var import_initHooks = require("
|
|
29
|
-
var import_config = require("
|
|
30
|
-
var import_entry = require("
|
|
28
|
+
var import_initHooks = require("./initHooks");
|
|
29
|
+
var import_config = require("./config");
|
|
30
|
+
var import_entry = require("./plugins/entry");
|
|
31
31
|
function getAbsolutePath(root, filepath) {
|
|
32
32
|
return (0, import_node_path.isAbsolute)(filepath) ? filepath : (0, import_node_path.join)(root, filepath);
|
|
33
33
|
}
|
|
@@ -44,7 +44,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
|
|
|
44
44
|
const context = {
|
|
45
45
|
entry: (0, import_entry.getEntryObject)(config, "web"),
|
|
46
46
|
targets: config.output?.targets || [],
|
|
47
|
-
version: "0.6.
|
|
47
|
+
version: "0.6.4",
|
|
48
48
|
rootPath,
|
|
49
49
|
distPath,
|
|
50
50
|
cachePath,
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var import_config = require("./config");
|
|
|
38
38
|
var import_shared = require("@rsbuild/shared");
|
|
39
39
|
var import_mergeConfig = require("./mergeConfig");
|
|
40
40
|
var import_constants = require("./constants");
|
|
41
|
-
const version = "0.6.
|
|
41
|
+
const version = "0.6.4";
|
|
42
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
43
|
0 && (module.exports = {
|
|
44
44
|
PLUGIN_CSS_NAME,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PluginManager, type RsbuildPluginAPI } from '@rsbuild/shared';
|
|
2
|
-
import type { InternalContext, NormalizedConfig } from '
|
|
2
|
+
import type { InternalContext, NormalizedConfig } from './types';
|
|
3
3
|
export declare function getHTMLPathByEntry(entryName: string, config: NormalizedConfig): string;
|
|
4
4
|
export declare function getPluginAPI({ context, pluginManager, }: {
|
|
5
5
|
context: InternalContext;
|
|
@@ -104,7 +104,7 @@ function getPluginAPI({
|
|
|
104
104
|
if (descriptor.resourceQuery) {
|
|
105
105
|
rule.resourceQuery(descriptor.resourceQuery);
|
|
106
106
|
}
|
|
107
|
-
rule.use(id).loader((0, import_node_path.join)(__dirname, "
|
|
107
|
+
rule.use(id).loader((0, import_node_path.join)(__dirname, "./rspack/transformLoader")).options({ id });
|
|
108
108
|
applyTransformPlugin(chain, transformer);
|
|
109
109
|
});
|
|
110
110
|
};
|
package/dist/internal.d.ts
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
* Please do not use them in your Rsbuild project or plugins.
|
|
5
5
|
*/
|
|
6
6
|
export { rspackProvider } from './provider/provider';
|
|
7
|
-
export { createContext, createPublicContext } from './
|
|
7
|
+
export { createContext, createPublicContext } from './createContext';
|
|
8
8
|
export { initPlugins, createPluginManager } from './pluginManager';
|
|
9
9
|
export { initHooks, type Hooks } from './initHooks';
|
|
10
10
|
export { initRsbuildConfig } from './provider/initConfigs';
|
|
11
|
-
export { getPluginAPI } from './
|
|
11
|
+
export { getPluginAPI } from './initPlugins';
|
|
12
12
|
export { applyBaseCSSRule, applyCSSModuleRule } from './provider/plugins/css';
|
|
13
13
|
export type { InternalContext } from './types';
|
|
14
14
|
export { setHTMLPlugin, getHTMLPlugin } from './htmlUtils';
|
|
15
15
|
export { formatStats, getStatsOptions } from './provider/shared';
|
|
16
16
|
export { getChainUtils } from './provider/rspackConfig';
|
|
17
17
|
export { applySwcDecoratorConfig } from './provider/plugins/swc';
|
|
18
|
-
export { getDevMiddleware } from './
|
|
18
|
+
export { getDevMiddleware } from './server/devMiddleware';
|
|
19
19
|
export { createDevServer, startProdServer } from './server';
|
|
20
20
|
export { plugins } from './plugins';
|
package/dist/internal.js
CHANGED
|
@@ -41,17 +41,17 @@ __export(internal_exports, {
|
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(internal_exports);
|
|
43
43
|
var import_provider = require("./provider/provider");
|
|
44
|
-
var import_createContext = require("./
|
|
44
|
+
var import_createContext = require("./createContext");
|
|
45
45
|
var import_pluginManager = require("./pluginManager");
|
|
46
46
|
var import_initHooks = require("./initHooks");
|
|
47
47
|
var import_initConfigs = require("./provider/initConfigs");
|
|
48
|
-
var import_initPlugins = require("./
|
|
48
|
+
var import_initPlugins = require("./initPlugins");
|
|
49
49
|
var import_css = require("./provider/plugins/css");
|
|
50
50
|
var import_htmlUtils = require("./htmlUtils");
|
|
51
51
|
var import_shared = require("./provider/shared");
|
|
52
52
|
var import_rspackConfig = require("./provider/rspackConfig");
|
|
53
53
|
var import_swc = require("./provider/plugins/swc");
|
|
54
|
-
var import_devMiddleware = require("./
|
|
54
|
+
var import_devMiddleware = require("./server/devMiddleware");
|
|
55
55
|
var import_server = require("./server");
|
|
56
56
|
var import_plugins = require("./plugins");
|
|
57
57
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/mergeConfig.js
CHANGED
package/dist/plugins/asset.js
CHANGED
|
@@ -35,22 +35,25 @@ module.exports = __toCommonJS(asset_exports);
|
|
|
35
35
|
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
var import_shared = require("@rsbuild/shared");
|
|
37
37
|
const chainStaticAssetRule = ({
|
|
38
|
+
emit,
|
|
38
39
|
rule,
|
|
39
40
|
maxSize,
|
|
40
41
|
filename,
|
|
41
42
|
assetType
|
|
42
43
|
}) => {
|
|
43
|
-
|
|
44
|
+
const generatorOptions = {
|
|
44
45
|
filename
|
|
45
|
-
}
|
|
46
|
+
};
|
|
47
|
+
if (emit === false) {
|
|
48
|
+
generatorOptions.emit = false;
|
|
49
|
+
}
|
|
50
|
+
rule.oneOf(`${assetType}-asset-url`).type("asset/resource").resourceQuery(/(__inline=false|url)/).set("generator", generatorOptions);
|
|
46
51
|
rule.oneOf(`${assetType}-asset-inline`).type("asset/inline").resourceQuery(/inline/);
|
|
47
52
|
rule.oneOf(`${assetType}-asset`).type("asset").parser({
|
|
48
53
|
dataUrlCondition: {
|
|
49
54
|
maxSize
|
|
50
55
|
}
|
|
51
|
-
}).set("generator",
|
|
52
|
-
filename
|
|
53
|
-
});
|
|
56
|
+
}).set("generator", generatorOptions);
|
|
54
57
|
};
|
|
55
58
|
function getRegExpForExts(exts) {
|
|
56
59
|
const matcher = exts.map((ext) => ext.trim()).map((ext) => ext.startsWith(".") ? ext.slice(1) : ext).join("|");
|
|
@@ -62,9 +65,9 @@ function getRegExpForExts(exts) {
|
|
|
62
65
|
const pluginAsset = () => ({
|
|
63
66
|
name: "rsbuild:asset",
|
|
64
67
|
setup(api) {
|
|
65
|
-
api.modifyBundlerChain((chain, { isProd }) => {
|
|
68
|
+
api.modifyBundlerChain((chain, { isProd, target }) => {
|
|
66
69
|
const config = api.getNormalizedConfig();
|
|
67
|
-
const createAssetRule = (assetType, exts) => {
|
|
70
|
+
const createAssetRule = (assetType, exts, emit2) => {
|
|
68
71
|
const regExp = getRegExpForExts(exts);
|
|
69
72
|
const distDir = (0, import_shared.getDistPath)(config, assetType);
|
|
70
73
|
const filename = (0, import_shared.getFilename)(config, assetType, isProd);
|
|
@@ -72,16 +75,22 @@ const pluginAsset = () => ({
|
|
|
72
75
|
const maxSize = typeof dataUriLimit === "number" ? dataUriLimit : dataUriLimit[assetType];
|
|
73
76
|
const rule = chain.module.rule(assetType).test(regExp);
|
|
74
77
|
chainStaticAssetRule({
|
|
78
|
+
emit: emit2,
|
|
75
79
|
rule,
|
|
76
80
|
maxSize,
|
|
77
81
|
filename: import_node_path.default.posix.join(distDir, filename),
|
|
78
82
|
assetType
|
|
79
83
|
});
|
|
80
84
|
};
|
|
81
|
-
|
|
82
|
-
createAssetRule("
|
|
83
|
-
createAssetRule("
|
|
84
|
-
createAssetRule(
|
|
85
|
+
const emit = config.output.emitAssets({ target });
|
|
86
|
+
createAssetRule("image", import_shared.IMAGE_EXTENSIONS, emit);
|
|
87
|
+
createAssetRule("svg", ["svg"], emit);
|
|
88
|
+
createAssetRule(
|
|
89
|
+
"media",
|
|
90
|
+
[...import_shared.VIDEO_EXTENSIONS, ...import_shared.AUDIO_EXTENSIONS],
|
|
91
|
+
emit
|
|
92
|
+
);
|
|
93
|
+
createAssetRule("font", import_shared.FONT_EXTENSIONS, emit);
|
|
85
94
|
});
|
|
86
95
|
}
|
|
87
96
|
});
|
|
@@ -131,7 +131,7 @@ async function createDevMiddleware(options, customCompiler) {
|
|
|
131
131
|
rspackConfigs
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
const { getDevMiddleware } = await Promise.resolve().then(() => __toESM(require("
|
|
134
|
+
const { getDevMiddleware } = await Promise.resolve().then(() => __toESM(require("../server/devMiddleware")));
|
|
135
135
|
return {
|
|
136
136
|
devMiddleware: getDevMiddleware(compiler),
|
|
137
137
|
compiler
|
|
@@ -24,7 +24,7 @@ __export(initConfigs_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(initConfigs_exports);
|
|
25
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
26
|
var import_mergeConfig = require("../mergeConfig");
|
|
27
|
-
var import_createContext = require("
|
|
27
|
+
var import_createContext = require("../createContext");
|
|
28
28
|
var import_inspectConfig = require("./inspectConfig");
|
|
29
29
|
var import_rspackConfig = require("./rspackConfig");
|
|
30
30
|
var import_config = require("../config");
|
|
@@ -32,9 +32,9 @@ __export(provider_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(provider_exports);
|
|
34
34
|
var import_shared = require("@rsbuild/shared");
|
|
35
|
-
var import_createContext = require("
|
|
35
|
+
var import_createContext = require("../createContext");
|
|
36
36
|
var import_initConfigs = require("./initConfigs");
|
|
37
|
-
var import_initPlugins = require("
|
|
37
|
+
var import_initPlugins = require("../initPlugins");
|
|
38
38
|
var import_plugins = require("../plugins");
|
|
39
39
|
const rspackProvider = async ({
|
|
40
40
|
pluginManager,
|
package/dist/server/helper.d.ts
CHANGED
|
@@ -29,12 +29,12 @@ export declare const getPort: ({ host, port, strictPort, tryLimits, silent, }: {
|
|
|
29
29
|
host: string;
|
|
30
30
|
port: string | number;
|
|
31
31
|
strictPort: boolean;
|
|
32
|
-
tryLimits?: number
|
|
33
|
-
silent?: boolean
|
|
32
|
+
tryLimits?: number;
|
|
33
|
+
silent?: boolean;
|
|
34
34
|
}) => Promise<number>;
|
|
35
35
|
export declare const getServerOptions: ({ rsbuildConfig, getPortSilently, }: {
|
|
36
36
|
rsbuildConfig: RsbuildConfig;
|
|
37
|
-
getPortSilently?: boolean
|
|
37
|
+
getPortSilently?: boolean;
|
|
38
38
|
}) => Promise<{
|
|
39
39
|
port: number;
|
|
40
40
|
host: string;
|
|
@@ -43,7 +43,7 @@ export declare const getServerOptions: ({ rsbuildConfig, getPortSilently, }: {
|
|
|
43
43
|
}>;
|
|
44
44
|
export declare const getDevOptions: ({ rsbuildConfig, getPortSilently, }: {
|
|
45
45
|
rsbuildConfig: RsbuildConfig;
|
|
46
|
-
getPortSilently?: boolean
|
|
46
|
+
getPortSilently?: boolean;
|
|
47
47
|
}) => Promise<{
|
|
48
48
|
devConfig: DevConfig;
|
|
49
49
|
serverConfig: import("@rsbuild/shared").ServerConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"core-js": "~3.36.0",
|
|
54
54
|
"html-webpack-plugin": "npm:html-rspack-plugin@5.6.2",
|
|
55
55
|
"postcss": "^8.4.38",
|
|
56
|
-
"@rsbuild/shared": "0.6.
|
|
56
|
+
"@rsbuild/shared": "0.6.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "16.x",
|
|
File without changes
|
|
File without changes
|