@rsbuild/core 1.0.4 → 1.0.6
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/css-loader/index.js +49 -53
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +153 -229
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +12 -15
- package/compiled/rsbuild-dev-middleware/index.js +27 -27
- package/compiled/rspack-chain/index.d.ts +1 -0
- package/compiled/rspack-chain/index.js +67 -67
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/style-loader/index.js +10 -10
- package/dist/client/overlay.js +1 -2
- package/dist/index.cjs +178 -165
- package/dist/index.js +181 -168
- package/dist-types/server/devServer.d.ts +4 -0
- package/dist-types/server/open.d.ts +10 -0
- package/dist-types/types/thirdParty.d.ts +0 -5
- package/package.json +5 -5
- package/types.d.ts +19 -0
- package/compiled/css-loader/semver.js +0 -1
- package/compiled/postcss-loader/semver.js +0 -1
- package/dist-types/plugins/open.d.ts +0 -13
package/dist/index.js
CHANGED
|
@@ -46,12 +46,12 @@ var __publicField = (obj, key, value) => {
|
|
|
46
46
|
return value;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
// ../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
49
|
+
// ../../node_modules/.pnpm/@modern-js+module-tools@2.60.1_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
|
|
50
50
|
import path from "path";
|
|
51
51
|
import { fileURLToPath } from "url";
|
|
52
52
|
var getFilename, getDirname, __dirname, __filename;
|
|
53
53
|
var init_esm = __esm({
|
|
54
|
-
"../../node_modules/.pnpm/@modern-js+module-tools@2.
|
|
54
|
+
"../../node_modules/.pnpm/@modern-js+module-tools@2.60.1_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
|
|
55
55
|
"use strict";
|
|
56
56
|
getFilename = () => fileURLToPath(import.meta.url);
|
|
57
57
|
getDirname = () => path.dirname(getFilename());
|
|
@@ -2342,7 +2342,7 @@ async function createContext(options, userConfig, bundlerType) {
|
|
|
2342
2342
|
const rsbuildConfig = await withDefaultConfig(rootPath, userConfig);
|
|
2343
2343
|
const cachePath = join6(rootPath, "node_modules", ".cache");
|
|
2344
2344
|
return {
|
|
2345
|
-
version: "1.0.
|
|
2345
|
+
version: "1.0.6",
|
|
2346
2346
|
rootPath,
|
|
2347
2347
|
distPath: "",
|
|
2348
2348
|
cachePath,
|
|
@@ -4463,6 +4463,144 @@ var init_httpServer = __esm({
|
|
|
4463
4463
|
}
|
|
4464
4464
|
});
|
|
4465
4465
|
|
|
4466
|
+
// src/server/open.ts
|
|
4467
|
+
import { exec } from "child_process";
|
|
4468
|
+
import { promisify } from "util";
|
|
4469
|
+
async function openBrowser(url2) {
|
|
4470
|
+
const shouldTryOpenChromeWithAppleScript = process.platform === "darwin";
|
|
4471
|
+
if (shouldTryOpenChromeWithAppleScript) {
|
|
4472
|
+
try {
|
|
4473
|
+
const targetBrowser = await getTargetBrowser();
|
|
4474
|
+
if (targetBrowser) {
|
|
4475
|
+
await execAsync(
|
|
4476
|
+
`osascript openChrome.applescript "${encodeURI(
|
|
4477
|
+
url2
|
|
4478
|
+
)}" "${targetBrowser}"`,
|
|
4479
|
+
{
|
|
4480
|
+
cwd: STATIC_PATH
|
|
4481
|
+
}
|
|
4482
|
+
);
|
|
4483
|
+
return true;
|
|
4484
|
+
}
|
|
4485
|
+
logger.debug("Failed to find the target browser.");
|
|
4486
|
+
} catch (err) {
|
|
4487
|
+
logger.debug("Failed to open start URL with apple script.");
|
|
4488
|
+
logger.debug(err);
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
try {
|
|
4492
|
+
const { default: open2 } = await import("../compiled/open/index.js");
|
|
4493
|
+
await open2(url2);
|
|
4494
|
+
return true;
|
|
4495
|
+
} catch (err) {
|
|
4496
|
+
logger.error("Failed to open start URL.");
|
|
4497
|
+
logger.error(err);
|
|
4498
|
+
return false;
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
function resolveUrl(str, base) {
|
|
4502
|
+
if (canParse(str)) {
|
|
4503
|
+
return str;
|
|
4504
|
+
}
|
|
4505
|
+
try {
|
|
4506
|
+
const url2 = new URL(str, base);
|
|
4507
|
+
return url2.href;
|
|
4508
|
+
} catch (e) {
|
|
4509
|
+
throw new Error(
|
|
4510
|
+
"[rsbuild:open]: Invalid input: not a valid URL or pathname"
|
|
4511
|
+
);
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
async function open({
|
|
4515
|
+
https,
|
|
4516
|
+
port,
|
|
4517
|
+
routes,
|
|
4518
|
+
config,
|
|
4519
|
+
clearCache
|
|
4520
|
+
}) {
|
|
4521
|
+
const { targets, before } = normalizeOpenConfig(config);
|
|
4522
|
+
const isCodesandbox = process.env.CSB === "true";
|
|
4523
|
+
if (isCodesandbox) {
|
|
4524
|
+
return;
|
|
4525
|
+
}
|
|
4526
|
+
if (clearCache) {
|
|
4527
|
+
clearOpenedURLs();
|
|
4528
|
+
}
|
|
4529
|
+
const urls = [];
|
|
4530
|
+
const protocol = https ? "https" : "http";
|
|
4531
|
+
const baseUrl = `${protocol}://localhost:${port}`;
|
|
4532
|
+
if (!targets.length) {
|
|
4533
|
+
if (routes.length) {
|
|
4534
|
+
urls.push(`${baseUrl}${routes[0].pathname}`);
|
|
4535
|
+
}
|
|
4536
|
+
} else {
|
|
4537
|
+
urls.push(
|
|
4538
|
+
...targets.map(
|
|
4539
|
+
(target) => resolveUrl(replacePortPlaceholder(target, port), baseUrl)
|
|
4540
|
+
)
|
|
4541
|
+
);
|
|
4542
|
+
}
|
|
4543
|
+
if (before) {
|
|
4544
|
+
await before();
|
|
4545
|
+
}
|
|
4546
|
+
for (const url2 of urls) {
|
|
4547
|
+
if (!openedURLs.includes(url2)) {
|
|
4548
|
+
openBrowser(url2);
|
|
4549
|
+
openedURLs.push(url2);
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
var execAsync, supportedChromiumBrowsers, getTargetBrowser, openedURLs, clearOpenedURLs, replacePortPlaceholder, normalizeOpenConfig;
|
|
4554
|
+
var init_open = __esm({
|
|
4555
|
+
"src/server/open.ts"() {
|
|
4556
|
+
"use strict";
|
|
4557
|
+
init_esm();
|
|
4558
|
+
init_constants();
|
|
4559
|
+
init_helpers();
|
|
4560
|
+
init_logger();
|
|
4561
|
+
execAsync = promisify(exec);
|
|
4562
|
+
supportedChromiumBrowsers = [
|
|
4563
|
+
"Google Chrome Canary",
|
|
4564
|
+
"Google Chrome Dev",
|
|
4565
|
+
"Google Chrome Beta",
|
|
4566
|
+
"Google Chrome",
|
|
4567
|
+
"Microsoft Edge",
|
|
4568
|
+
"Brave Browser",
|
|
4569
|
+
"Vivaldi",
|
|
4570
|
+
"Chromium"
|
|
4571
|
+
];
|
|
4572
|
+
getTargetBrowser = async () => {
|
|
4573
|
+
let targetBrowser = process.env.BROWSER;
|
|
4574
|
+
if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
|
|
4575
|
+
const { stdout: ps } = await execAsync("ps cax");
|
|
4576
|
+
targetBrowser = supportedChromiumBrowsers.find((b) => ps.includes(b));
|
|
4577
|
+
}
|
|
4578
|
+
return targetBrowser;
|
|
4579
|
+
};
|
|
4580
|
+
openedURLs = [];
|
|
4581
|
+
clearOpenedURLs = () => {
|
|
4582
|
+
openedURLs = [];
|
|
4583
|
+
};
|
|
4584
|
+
replacePortPlaceholder = (url2, port) => url2.replace(/<port>/g, String(port));
|
|
4585
|
+
normalizeOpenConfig = (config) => {
|
|
4586
|
+
const { open: open2 } = config.server;
|
|
4587
|
+
if (typeof open2 === "boolean") {
|
|
4588
|
+
return { targets: [] };
|
|
4589
|
+
}
|
|
4590
|
+
if (typeof open2 === "string") {
|
|
4591
|
+
return { targets: [open2] };
|
|
4592
|
+
}
|
|
4593
|
+
if (Array.isArray(open2)) {
|
|
4594
|
+
return { targets: open2 };
|
|
4595
|
+
}
|
|
4596
|
+
return {
|
|
4597
|
+
targets: open2.target ? castArray(open2.target) : [],
|
|
4598
|
+
before: open2.before
|
|
4599
|
+
};
|
|
4600
|
+
};
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4603
|
+
|
|
4466
4604
|
// src/server/watchFiles.ts
|
|
4467
4605
|
async function setupWatchFiles(options) {
|
|
4468
4606
|
const { dev, server, compileMiddlewareAPI } = options;
|
|
@@ -5140,7 +5278,16 @@ async function createDevServer(options, createCompiler2, config, {
|
|
|
5140
5278
|
await options.context.hooks.onCloseDevServer.call();
|
|
5141
5279
|
await Promise.all([devMiddlewares.close(), fileWatcher?.close()]);
|
|
5142
5280
|
},
|
|
5143
|
-
printUrls
|
|
5281
|
+
printUrls,
|
|
5282
|
+
open: async () => {
|
|
5283
|
+
return open({
|
|
5284
|
+
https,
|
|
5285
|
+
port,
|
|
5286
|
+
routes,
|
|
5287
|
+
config,
|
|
5288
|
+
clearCache: true
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5144
5291
|
};
|
|
5145
5292
|
logger.debug("create dev server done");
|
|
5146
5293
|
return devServerAPI;
|
|
@@ -5158,6 +5305,7 @@ var init_devServer = __esm({
|
|
|
5158
5305
|
init_helper();
|
|
5159
5306
|
init_httpServer();
|
|
5160
5307
|
init_middlewares();
|
|
5308
|
+
init_open();
|
|
5161
5309
|
init_restart();
|
|
5162
5310
|
init_watchFiles();
|
|
5163
5311
|
formatDevConfig = (config, port) => {
|
|
@@ -5802,8 +5950,7 @@ var init_css = __esm({
|
|
|
5802
5950
|
...cssModules,
|
|
5803
5951
|
localIdentName
|
|
5804
5952
|
},
|
|
5805
|
-
sourceMap: config.output.sourceMap.css
|
|
5806
|
-
_skipReuseAST: config.tools.lightningcssLoader !== false
|
|
5953
|
+
sourceMap: config.output.sourceMap.css
|
|
5807
5954
|
};
|
|
5808
5955
|
const mergedCssLoaderOptions = reduceConfigs({
|
|
5809
5956
|
initial: defaultOptions2,
|
|
@@ -5838,158 +5985,6 @@ var init_css = __esm({
|
|
|
5838
5985
|
}
|
|
5839
5986
|
});
|
|
5840
5987
|
|
|
5841
|
-
// src/plugins/open.ts
|
|
5842
|
-
var open_exports = {};
|
|
5843
|
-
__export(open_exports, {
|
|
5844
|
-
openBrowser: () => openBrowser,
|
|
5845
|
-
pluginOpen: () => pluginOpen,
|
|
5846
|
-
replacePortPlaceholder: () => replacePortPlaceholder,
|
|
5847
|
-
resolveUrl: () => resolveUrl
|
|
5848
|
-
});
|
|
5849
|
-
import { exec } from "child_process";
|
|
5850
|
-
import { promisify } from "util";
|
|
5851
|
-
async function openBrowser(url2) {
|
|
5852
|
-
const shouldTryOpenChromeWithAppleScript = process.platform === "darwin";
|
|
5853
|
-
if (shouldTryOpenChromeWithAppleScript) {
|
|
5854
|
-
try {
|
|
5855
|
-
const targetBrowser = await getTargetBrowser();
|
|
5856
|
-
if (targetBrowser) {
|
|
5857
|
-
await execAsync(
|
|
5858
|
-
`osascript openChrome.applescript "${encodeURI(
|
|
5859
|
-
url2
|
|
5860
|
-
)}" "${targetBrowser}"`,
|
|
5861
|
-
{
|
|
5862
|
-
cwd: STATIC_PATH
|
|
5863
|
-
}
|
|
5864
|
-
);
|
|
5865
|
-
return true;
|
|
5866
|
-
}
|
|
5867
|
-
logger.debug("Failed to find the target browser.");
|
|
5868
|
-
} catch (err) {
|
|
5869
|
-
logger.debug("Failed to open start URL with apple script.");
|
|
5870
|
-
logger.debug(err);
|
|
5871
|
-
}
|
|
5872
|
-
}
|
|
5873
|
-
try {
|
|
5874
|
-
const { default: open } = await import("../compiled/open/index.js");
|
|
5875
|
-
await open(url2);
|
|
5876
|
-
return true;
|
|
5877
|
-
} catch (err) {
|
|
5878
|
-
logger.error("Failed to open start URL.");
|
|
5879
|
-
logger.error(err);
|
|
5880
|
-
return false;
|
|
5881
|
-
}
|
|
5882
|
-
}
|
|
5883
|
-
function resolveUrl(str, base) {
|
|
5884
|
-
if (canParse(str)) {
|
|
5885
|
-
return str;
|
|
5886
|
-
}
|
|
5887
|
-
try {
|
|
5888
|
-
const url2 = new URL(str, base);
|
|
5889
|
-
return url2.href;
|
|
5890
|
-
} catch (e) {
|
|
5891
|
-
throw new Error(
|
|
5892
|
-
"[rsbuild:open]: Invalid input: not a valid URL or pathname"
|
|
5893
|
-
);
|
|
5894
|
-
}
|
|
5895
|
-
}
|
|
5896
|
-
function pluginOpen() {
|
|
5897
|
-
return {
|
|
5898
|
-
name: "rsbuild:open",
|
|
5899
|
-
setup(api) {
|
|
5900
|
-
const onStartServer = async (params) => {
|
|
5901
|
-
const { port, routes } = params;
|
|
5902
|
-
const config = api.getNormalizedConfig();
|
|
5903
|
-
const { https } = api.context.devServer || {};
|
|
5904
|
-
const { targets, before } = normalizeOpenConfig(config);
|
|
5905
|
-
const isCodesandbox = process.env.CSB === "true";
|
|
5906
|
-
const shouldOpen = targets !== void 0 && !isCodesandbox;
|
|
5907
|
-
if (!shouldOpen) {
|
|
5908
|
-
return;
|
|
5909
|
-
}
|
|
5910
|
-
const urls = [];
|
|
5911
|
-
const protocol = https ? "https" : "http";
|
|
5912
|
-
const baseUrl = `${protocol}://localhost:${port}`;
|
|
5913
|
-
if (!targets.length) {
|
|
5914
|
-
if (routes.length) {
|
|
5915
|
-
urls.push(`${baseUrl}${routes[0].pathname}`);
|
|
5916
|
-
}
|
|
5917
|
-
} else {
|
|
5918
|
-
urls.push(
|
|
5919
|
-
...targets.map(
|
|
5920
|
-
(target) => resolveUrl(replacePortPlaceholder(target, port), baseUrl)
|
|
5921
|
-
)
|
|
5922
|
-
);
|
|
5923
|
-
}
|
|
5924
|
-
const openUrls = () => {
|
|
5925
|
-
for (const url2 of urls) {
|
|
5926
|
-
if (!openedURLs.includes(url2)) {
|
|
5927
|
-
openBrowser(url2);
|
|
5928
|
-
openedURLs.push(url2);
|
|
5929
|
-
}
|
|
5930
|
-
}
|
|
5931
|
-
};
|
|
5932
|
-
if (before) {
|
|
5933
|
-
await before();
|
|
5934
|
-
}
|
|
5935
|
-
openUrls();
|
|
5936
|
-
};
|
|
5937
|
-
api.onAfterStartDevServer(onStartServer);
|
|
5938
|
-
api.onAfterStartProdServer(onStartServer);
|
|
5939
|
-
}
|
|
5940
|
-
};
|
|
5941
|
-
}
|
|
5942
|
-
var execAsync, supportedChromiumBrowsers, getTargetBrowser, replacePortPlaceholder, openedURLs, normalizeOpenConfig;
|
|
5943
|
-
var init_open = __esm({
|
|
5944
|
-
"src/plugins/open.ts"() {
|
|
5945
|
-
"use strict";
|
|
5946
|
-
init_esm();
|
|
5947
|
-
init_constants();
|
|
5948
|
-
init_helpers();
|
|
5949
|
-
init_logger();
|
|
5950
|
-
execAsync = promisify(exec);
|
|
5951
|
-
supportedChromiumBrowsers = [
|
|
5952
|
-
"Google Chrome Canary",
|
|
5953
|
-
"Google Chrome Dev",
|
|
5954
|
-
"Google Chrome Beta",
|
|
5955
|
-
"Google Chrome",
|
|
5956
|
-
"Microsoft Edge",
|
|
5957
|
-
"Brave Browser",
|
|
5958
|
-
"Vivaldi",
|
|
5959
|
-
"Chromium"
|
|
5960
|
-
];
|
|
5961
|
-
getTargetBrowser = async () => {
|
|
5962
|
-
let targetBrowser = process.env.BROWSER;
|
|
5963
|
-
if (!targetBrowser || !supportedChromiumBrowsers.includes(targetBrowser)) {
|
|
5964
|
-
const { stdout: ps } = await execAsync("ps cax");
|
|
5965
|
-
targetBrowser = supportedChromiumBrowsers.find((b) => ps.includes(b));
|
|
5966
|
-
}
|
|
5967
|
-
return targetBrowser;
|
|
5968
|
-
};
|
|
5969
|
-
replacePortPlaceholder = (url2, port) => url2.replace(/<port>/g, String(port));
|
|
5970
|
-
openedURLs = [];
|
|
5971
|
-
normalizeOpenConfig = (config) => {
|
|
5972
|
-
const { open } = config.server;
|
|
5973
|
-
if (open === false) {
|
|
5974
|
-
return {};
|
|
5975
|
-
}
|
|
5976
|
-
if (open === true) {
|
|
5977
|
-
return { targets: [] };
|
|
5978
|
-
}
|
|
5979
|
-
if (typeof open === "string") {
|
|
5980
|
-
return { targets: [open] };
|
|
5981
|
-
}
|
|
5982
|
-
if (Array.isArray(open)) {
|
|
5983
|
-
return { targets: open };
|
|
5984
|
-
}
|
|
5985
|
-
return {
|
|
5986
|
-
targets: open.target ? castArray(open.target) : [],
|
|
5987
|
-
before: open.before
|
|
5988
|
-
};
|
|
5989
|
-
};
|
|
5990
|
-
}
|
|
5991
|
-
});
|
|
5992
|
-
|
|
5993
5988
|
// src/plugins/output.ts
|
|
5994
5989
|
var output_exports = {};
|
|
5995
5990
|
__export(output_exports, {
|
|
@@ -6031,8 +6026,8 @@ var init_output = __esm({
|
|
|
6031
6026
|
init_constants();
|
|
6032
6027
|
init_helpers();
|
|
6033
6028
|
init_pluginHelper();
|
|
6034
|
-
init_css();
|
|
6035
6029
|
init_open();
|
|
6030
|
+
init_css();
|
|
6036
6031
|
getJsAsyncPath = (jsPath, isServer, jsAsync) => {
|
|
6037
6032
|
if (jsAsync !== void 0) {
|
|
6038
6033
|
return jsAsync;
|
|
@@ -6114,7 +6109,10 @@ function applyFullySpecified({
|
|
|
6114
6109
|
}) {
|
|
6115
6110
|
chain.module.rule(CHAIN_ID2.RULE.MJS).test(/\.m?js/).resolve.set("fullySpecified", false);
|
|
6116
6111
|
}
|
|
6117
|
-
function applyExtensions({
|
|
6112
|
+
function applyExtensions({
|
|
6113
|
+
chain,
|
|
6114
|
+
tsconfigPath
|
|
6115
|
+
}) {
|
|
6118
6116
|
const extensions = [
|
|
6119
6117
|
// most projects are using TypeScript, resolve .ts(x) files first to reduce resolve time.
|
|
6120
6118
|
".ts",
|
|
@@ -6125,6 +6123,11 @@ function applyExtensions({ chain }) {
|
|
|
6125
6123
|
".json"
|
|
6126
6124
|
];
|
|
6127
6125
|
chain.resolve.extensions.merge(extensions);
|
|
6126
|
+
if (tsconfigPath) {
|
|
6127
|
+
chain.resolve.extensionAlias.merge({
|
|
6128
|
+
".js": [".ts", ".tsx", ".js"]
|
|
6129
|
+
});
|
|
6130
|
+
}
|
|
6128
6131
|
}
|
|
6129
6132
|
function applyAlias({
|
|
6130
6133
|
chain,
|
|
@@ -6168,7 +6171,7 @@ var init_resolve = __esm({
|
|
|
6168
6171
|
order: "pre",
|
|
6169
6172
|
handler: (chain, { environment, CHAIN_ID: CHAIN_ID2 }) => {
|
|
6170
6173
|
const { config, tsconfigPath } = environment;
|
|
6171
|
-
applyExtensions({ chain });
|
|
6174
|
+
applyExtensions({ chain, tsconfigPath });
|
|
6172
6175
|
applyAlias({
|
|
6173
6176
|
chain,
|
|
6174
6177
|
config,
|
|
@@ -7589,9 +7592,6 @@ function getDefaultSwcConfig(browserslist3, cacheRoot) {
|
|
|
7589
7592
|
syntax: "typescript",
|
|
7590
7593
|
decorators: true
|
|
7591
7594
|
},
|
|
7592
|
-
// Avoid the webpack magic comment to be removed
|
|
7593
|
-
// https://github.com/swc-project/swc/issues/6403
|
|
7594
|
-
preserveAllComments: true,
|
|
7595
7595
|
experimental: {
|
|
7596
7596
|
cacheRoot
|
|
7597
7597
|
}
|
|
@@ -8699,9 +8699,23 @@ var init_server = __esm({
|
|
|
8699
8699
|
"use strict";
|
|
8700
8700
|
init_esm();
|
|
8701
8701
|
init_config();
|
|
8702
|
+
init_open();
|
|
8702
8703
|
pluginServer = () => ({
|
|
8703
8704
|
name: "rsbuild:server",
|
|
8704
8705
|
setup(api) {
|
|
8706
|
+
const onStartServer = async ({ port, routes }) => {
|
|
8707
|
+
const config = api.getNormalizedConfig();
|
|
8708
|
+
if (config.server.open) {
|
|
8709
|
+
open({
|
|
8710
|
+
https: api.context.devServer?.https,
|
|
8711
|
+
port,
|
|
8712
|
+
routes,
|
|
8713
|
+
config
|
|
8714
|
+
});
|
|
8715
|
+
}
|
|
8716
|
+
};
|
|
8717
|
+
api.onAfterStartDevServer(onStartServer);
|
|
8718
|
+
api.onAfterStartProdServer(onStartServer);
|
|
8705
8719
|
api.onBeforeBuild(async ({ isFirstCompile }) => {
|
|
8706
8720
|
if (!isFirstCompile) {
|
|
8707
8721
|
return;
|
|
@@ -9528,7 +9542,6 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
9528
9542
|
Promise.resolve().then(() => (init_splitChunks(), splitChunks_exports)).then(
|
|
9529
9543
|
({ pluginSplitChunks: pluginSplitChunks2 }) => pluginSplitChunks2()
|
|
9530
9544
|
),
|
|
9531
|
-
Promise.resolve().then(() => (init_open(), open_exports)).then(({ pluginOpen: pluginOpen2 }) => pluginOpen2()),
|
|
9532
9545
|
Promise.resolve().then(() => (init_inlineChunk(), inlineChunk_exports)).then(
|
|
9533
9546
|
({ pluginInlineChunk: pluginInlineChunk2 }) => pluginInlineChunk2()
|
|
9534
9547
|
),
|
|
@@ -9788,7 +9801,7 @@ import { existsSync } from "fs";
|
|
|
9788
9801
|
import { program } from "../compiled/commander/index.js";
|
|
9789
9802
|
import color16 from "../compiled/picocolors/index.js";
|
|
9790
9803
|
function runCli() {
|
|
9791
|
-
program.name("rsbuild").usage("<command> [options]").version("1.0.
|
|
9804
|
+
program.name("rsbuild").usage("<command> [options]").version("1.0.6");
|
|
9792
9805
|
const devCommand = program.command("dev");
|
|
9793
9806
|
const buildCommand = program.command("build");
|
|
9794
9807
|
const previewCommand = program.command("preview");
|
|
@@ -9909,7 +9922,7 @@ function prepareCli() {
|
|
|
9909
9922
|
if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
|
|
9910
9923
|
console.log();
|
|
9911
9924
|
}
|
|
9912
|
-
logger.greet(` ${`Rsbuild v${"1.0.
|
|
9925
|
+
logger.greet(` ${`Rsbuild v${"1.0.6"}`}
|
|
9913
9926
|
`);
|
|
9914
9927
|
}
|
|
9915
9928
|
var init_prepare = __esm({
|
|
@@ -9980,7 +9993,7 @@ init_mergeConfig();
|
|
|
9980
9993
|
init_helpers();
|
|
9981
9994
|
init_constants();
|
|
9982
9995
|
import { rspack as rspack10 } from "@rspack/core";
|
|
9983
|
-
var version = "1.0.
|
|
9996
|
+
var version = "1.0.6";
|
|
9984
9997
|
export {
|
|
9985
9998
|
PLUGIN_CSS_NAME,
|
|
9986
9999
|
PLUGIN_SWC_NAME,
|
|
@@ -49,6 +49,10 @@ export type RsbuildDevServer = {
|
|
|
49
49
|
* Print the server URLs.
|
|
50
50
|
*/
|
|
51
51
|
printUrls: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Open URL in the browser after starting the server.
|
|
54
|
+
*/
|
|
55
|
+
open: () => Promise<void>;
|
|
52
56
|
};
|
|
53
57
|
export declare function createDevServer<Options extends {
|
|
54
58
|
context: InternalContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NormalizedConfig, Routes } from '../types';
|
|
2
|
+
export declare const replacePortPlaceholder: (url: string, port: number) => string;
|
|
3
|
+
export declare function resolveUrl(str: string, base: string): string;
|
|
4
|
+
export declare function open({ https, port, routes, config, clearCache, }: {
|
|
5
|
+
https?: boolean;
|
|
6
|
+
port: number;
|
|
7
|
+
routes: Routes;
|
|
8
|
+
config: NormalizedConfig;
|
|
9
|
+
clearCache?: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
@@ -138,11 +138,6 @@ export interface CSSLoaderOptions {
|
|
|
138
138
|
* @default 'array'
|
|
139
139
|
*/
|
|
140
140
|
exportType?: 'array' | 'string' | 'css-style-sheet';
|
|
141
|
-
/**
|
|
142
|
-
* Temp fix for https://github.com/web-infra-dev/rspack/issues/7819
|
|
143
|
-
* @private
|
|
144
|
-
*/
|
|
145
|
-
_skipReuseAST?: boolean;
|
|
146
141
|
}
|
|
147
142
|
export type StyleLoaderInjectType = 'styleTag' | 'singletonStyleTag' | 'lazyStyleTag' | 'lazySingletonStyleTag' | 'linkTag';
|
|
148
143
|
export interface StyleLoaderOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "~1.0.
|
|
49
|
+
"@rspack/core": "~1.0.6",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.0",
|
|
51
51
|
"@swc/helpers": "^0.5.13",
|
|
52
|
-
"caniuse-lite": "^1.0.
|
|
52
|
+
"caniuse-lite": "^1.0.30001662",
|
|
53
53
|
"core-js": "~3.38.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -78,14 +78,14 @@
|
|
|
78
78
|
"on-finished": "2.4.1",
|
|
79
79
|
"open": "^8.4.0",
|
|
80
80
|
"picocolors": "^1.1.0",
|
|
81
|
-
"postcss": "^8.4.
|
|
81
|
+
"postcss": "^8.4.47",
|
|
82
82
|
"postcss-load-config": "6.0.1",
|
|
83
83
|
"postcss-loader": "8.1.1",
|
|
84
84
|
"prebundle": "1.2.2",
|
|
85
85
|
"reduce-configs": "^1.0.0",
|
|
86
86
|
"rsbuild-dev-middleware": "0.1.1",
|
|
87
87
|
"rslog": "^1.2.3",
|
|
88
|
-
"rspack-chain": "^1.0.
|
|
88
|
+
"rspack-chain": "^1.0.3",
|
|
89
89
|
"rspack-manifest-plugin": "5.0.1",
|
|
90
90
|
"sirv": "^2.0.4",
|
|
91
91
|
"style-loader": "3.3.4",
|
package/types.d.ts
CHANGED
|
@@ -149,6 +149,9 @@ declare module '*.opus' {
|
|
|
149
149
|
/**
|
|
150
150
|
* Configuration files
|
|
151
151
|
*/
|
|
152
|
+
/**
|
|
153
|
+
* @requires [@rsbuild/plugin-yaml](https://www.npmjs.com/package/@rsbuild/plugin-yaml)
|
|
154
|
+
*/
|
|
152
155
|
declare module '*.yaml' {
|
|
153
156
|
const content: Record<string, any>;
|
|
154
157
|
export default content;
|
|
@@ -157,6 +160,13 @@ declare module '*.yml' {
|
|
|
157
160
|
const content: Record<string, any>;
|
|
158
161
|
export default content;
|
|
159
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* @requires [@rsbuild/plugin-toml](https://www.npmjs.com/package/@rsbuild/plugin-toml)
|
|
165
|
+
*/
|
|
166
|
+
declare module '*.toml' {
|
|
167
|
+
const content: Record<string, any>;
|
|
168
|
+
export default content;
|
|
169
|
+
}
|
|
160
170
|
|
|
161
171
|
/**
|
|
162
172
|
* Queries
|
|
@@ -180,6 +190,9 @@ declare module '*.module.css' {
|
|
|
180
190
|
const classes: CSSModuleClasses;
|
|
181
191
|
export default classes;
|
|
182
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* @requires [@rsbuild/plugin-sass](https://www.npmjs.com/package/@rsbuild/plugin-sass)
|
|
195
|
+
*/
|
|
183
196
|
declare module '*.module.scss' {
|
|
184
197
|
const classes: CSSModuleClasses;
|
|
185
198
|
export default classes;
|
|
@@ -188,10 +201,16 @@ declare module '*.module.sass' {
|
|
|
188
201
|
const classes: CSSModuleClasses;
|
|
189
202
|
export default classes;
|
|
190
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* @requires [@rsbuild/plugin-less](https://www.npmjs.com/package/@rsbuild/plugin-less)
|
|
206
|
+
*/
|
|
191
207
|
declare module '*.module.less' {
|
|
192
208
|
const classes: CSSModuleClasses;
|
|
193
209
|
export default classes;
|
|
194
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* @requires [@rsbuild/plugin-stylus](https://www.npmjs.com/package/@rsbuild/plugin-stylus)
|
|
213
|
+
*/
|
|
195
214
|
declare module '*.module.styl' {
|
|
196
215
|
const classes: CSSModuleClasses;
|
|
197
216
|
export default classes;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports.satisfies = () => true;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports.satisfies = () => true;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { RsbuildPlugin } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* This method is modified based on source found in
|
|
4
|
-
* https://github.com/facebook/create-react-app
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
8
|
-
* https://github.com/facebook/create-react-app/blob/master/LICENSE
|
|
9
|
-
*/
|
|
10
|
-
export declare function openBrowser(url: string): Promise<boolean>;
|
|
11
|
-
export declare const replacePortPlaceholder: (url: string, port: number) => string;
|
|
12
|
-
export declare function resolveUrl(str: string, base: string): string;
|
|
13
|
-
export declare function pluginOpen(): RsbuildPlugin;
|