@rsbuild/core 1.0.0-alpha.3 → 1.0.0-alpha.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.
@@ -1 +1 @@
1
- {"name":"ws","author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","version":"8.17.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"ws","author":"Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)","version":"8.18.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
package/dist/index.cjs CHANGED
@@ -982,46 +982,59 @@ async function loadConfig({
982
982
  config._privateMeta = { configFilePath };
983
983
  return config;
984
984
  };
985
+ let configExport;
986
+ if (/\.(?:js|mjs|cjs)$/.test(configFilePath)) {
987
+ try {
988
+ const exportModule = await import(`${configFilePath}?t=${Date.now()}`);
989
+ configExport = exportModule.default ? exportModule.default : exportModule;
990
+ } catch (err) {
991
+ import_rslog.logger.debug(
992
+ `Failed to load file with dynamic import: ${import_picocolors4.default.dim(configFilePath)}`
993
+ );
994
+ }
995
+ }
985
996
  try {
986
- const { default: jiti } = await import("../compiled/jiti/index.js");
987
- const loadConfig2 = jiti(__filename, {
988
- esmResolve: true,
989
- // disable require cache to support restart CLI and read the new config
990
- requireCache: false,
991
- interopDefault: true
992
- });
993
- const configExport = loadConfig2(configFilePath);
994
- if (typeof configExport === "function") {
995
- const command = process.argv[2];
996
- const params = {
997
- env: getNodeEnv(),
998
- command,
999
- envMode: envMode || getNodeEnv()
1000
- };
1001
- const result = await configExport(params);
1002
- if (result === void 0) {
1003
- throw new Error("The config function must return a config object.");
1004
- }
1005
- return {
1006
- content: applyMetaInfo(result),
1007
- filePath: configFilePath
1008
- };
997
+ if (configExport === void 0) {
998
+ const { default: jiti } = await import("../compiled/jiti/index.js");
999
+ const loadConfig2 = jiti(__filename, {
1000
+ esmResolve: true,
1001
+ // disable require cache to support restart CLI and read the new config
1002
+ requireCache: false,
1003
+ interopDefault: true
1004
+ });
1005
+ configExport = loadConfig2(configFilePath);
1009
1006
  }
1010
- if (!isObject(configExport)) {
1011
- throw new Error(
1012
- `The config must be an object or a function that returns an object, get ${import_picocolors4.default.yellow(
1013
- configExport
1014
- )}`
1015
- );
1007
+ } catch (err) {
1008
+ import_rslog.logger.error(`Failed to load file with jiti: ${import_picocolors4.default.dim(configFilePath)}`);
1009
+ throw err;
1010
+ }
1011
+ if (typeof configExport === "function") {
1012
+ const command = process.argv[2];
1013
+ const params = {
1014
+ env: getNodeEnv(),
1015
+ command,
1016
+ envMode: envMode || getNodeEnv()
1017
+ };
1018
+ const result = await configExport(params);
1019
+ if (result === void 0) {
1020
+ throw new Error("The config function must return a config object.");
1016
1021
  }
1017
1022
  return {
1018
- content: applyMetaInfo(configExport),
1023
+ content: applyMetaInfo(result),
1019
1024
  filePath: configFilePath
1020
1025
  };
1021
- } catch (err) {
1022
- import_rslog.logger.error(`Failed to load file: ${import_picocolors4.default.dim(configFilePath)}`);
1023
- throw err;
1024
1026
  }
1027
+ if (!isObject(configExport)) {
1028
+ throw new Error(
1029
+ `The config must be an object or a function that returns an object, get ${import_picocolors4.default.yellow(
1030
+ configExport
1031
+ )}`
1032
+ );
1033
+ }
1034
+ return {
1035
+ content: applyMetaInfo(configExport),
1036
+ filePath: configFilePath
1037
+ };
1025
1038
  }
1026
1039
  async function outputInspectConfigFiles({
1027
1040
  rawBundlerConfigs,
@@ -1180,7 +1193,7 @@ var init_config = __esm({
1180
1193
  assetPrefix: DEFAULT_ASSET_PREFIX,
1181
1194
  filename: {},
1182
1195
  charset: "ascii",
1183
- polyfill: "usage",
1196
+ polyfill: "off",
1184
1197
  dataUriLimit: {
1185
1198
  svg: DEFAULT_DATA_URL_SIZE,
1186
1199
  font: DEFAULT_DATA_URL_SIZE,
@@ -1626,7 +1639,7 @@ async function createContextByConfig(options, bundlerType) {
1626
1639
  const rootPath = cwd;
1627
1640
  const cachePath = (0, import_node_path8.join)(rootPath, "node_modules", ".cache");
1628
1641
  return {
1629
- version: "1.0.0-alpha.3",
1642
+ version: "1.0.0-alpha.4",
1630
1643
  rootPath,
1631
1644
  distPath: "",
1632
1645
  cachePath,
@@ -8029,7 +8042,7 @@ var init_rspackProfile = __esm({
8029
8042
  import_node_fs11 = __toESM(require("fs"));
8030
8043
  import_node_inspector = __toESM(require("inspector"));
8031
8044
  import_node_path32 = __toESM(require("path"));
8032
- import_core9 = require("@rspack/core");
8045
+ import_core9 = __toESM(require("@rspack/core"));
8033
8046
  init_logger();
8034
8047
  stopProfiler = (output, profileSession) => {
8035
8048
  if (!profileSession) {
@@ -8066,7 +8079,7 @@ var init_rspackProfile = __esm({
8066
8079
  import_node_fs11.default.mkdirSync(profileDir, { recursive: true });
8067
8080
  }
8068
8081
  if (enableProfileTrace) {
8069
- import_core9.rspack.experimental_registerGlobalTrace(
8082
+ import_core9.default.experiments.globalTrace.register(
8070
8083
  "trace",
8071
8084
  "chrome",
8072
8085
  traceFilePath
@@ -8098,7 +8111,7 @@ var init_rspackProfile = __esm({
8098
8111
  });
8099
8112
  api.onExit(() => {
8100
8113
  if (enableProfileTrace) {
8101
- import_core9.rspack.experimental_cleanupGlobalTrace();
8114
+ import_core9.default.experiments.globalTrace.cleanup();
8102
8115
  }
8103
8116
  const profileDir = import_node_path32.default.join(api.context.distPath, profileDirName);
8104
8117
  const cpuProfilePath = import_node_path32.default.join(profileDir, "jscpuprofile.json");
@@ -8773,7 +8786,7 @@ var init_init = __esm({
8773
8786
 
8774
8787
  // src/cli/commands.ts
8775
8788
  function runCli() {
8776
- import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.0-alpha.3");
8789
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("1.0.0-alpha.4");
8777
8790
  const devCommand = import_commander.program.command("dev");
8778
8791
  const buildCommand = import_commander.program.command("build");
8779
8792
  const previewCommand = import_commander.program.command("preview");
@@ -8887,7 +8900,7 @@ function prepareCli() {
8887
8900
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
8888
8901
  console.log();
8889
8902
  }
8890
- import_rslog.logger.greet(` ${`Rsbuild v${"1.0.0-alpha.3"}`}
8903
+ import_rslog.logger.greet(` ${`Rsbuild v${"1.0.0-alpha.4"}`}
8891
8904
  `);
8892
8905
  }
8893
8906
  var init_prepare = __esm({
@@ -8970,7 +8983,7 @@ init_logger();
8970
8983
  init_mergeConfig();
8971
8984
  init_helpers();
8972
8985
  init_constants();
8973
- var version = "1.0.0-alpha.3";
8986
+ var version = "1.0.0-alpha.4";
8974
8987
  // Annotate the CommonJS export names for ESM import in node:
8975
8988
  0 && (module.exports = {
8976
8989
  PLUGIN_CSS_NAME,
package/dist/index.js CHANGED
@@ -1015,46 +1015,59 @@ async function loadConfig({
1015
1015
  config._privateMeta = { configFilePath };
1016
1016
  return config;
1017
1017
  };
1018
+ let configExport;
1019
+ if (/\.(?:js|mjs|cjs)$/.test(configFilePath)) {
1020
+ try {
1021
+ const exportModule = await import(`${configFilePath}?t=${Date.now()}`);
1022
+ configExport = exportModule.default ? exportModule.default : exportModule;
1023
+ } catch (err) {
1024
+ logger.debug(
1025
+ `Failed to load file with dynamic import: ${import_picocolors4.default.dim(configFilePath)}`
1026
+ );
1027
+ }
1028
+ }
1018
1029
  try {
1019
- const { default: jiti } = await import("../compiled/jiti/index.js");
1020
- const loadConfig2 = jiti(__filename, {
1021
- esmResolve: true,
1022
- // disable require cache to support restart CLI and read the new config
1023
- requireCache: false,
1024
- interopDefault: true
1025
- });
1026
- const configExport = loadConfig2(configFilePath);
1027
- if (typeof configExport === "function") {
1028
- const command = process.argv[2];
1029
- const params = {
1030
- env: getNodeEnv(),
1031
- command,
1032
- envMode: envMode || getNodeEnv()
1033
- };
1034
- const result = await configExport(params);
1035
- if (result === void 0) {
1036
- throw new Error("The config function must return a config object.");
1037
- }
1038
- return {
1039
- content: applyMetaInfo(result),
1040
- filePath: configFilePath
1041
- };
1030
+ if (configExport === void 0) {
1031
+ const { default: jiti } = await import("../compiled/jiti/index.js");
1032
+ const loadConfig2 = jiti(__filename, {
1033
+ esmResolve: true,
1034
+ // disable require cache to support restart CLI and read the new config
1035
+ requireCache: false,
1036
+ interopDefault: true
1037
+ });
1038
+ configExport = loadConfig2(configFilePath);
1042
1039
  }
1043
- if (!isObject(configExport)) {
1044
- throw new Error(
1045
- `The config must be an object or a function that returns an object, get ${import_picocolors4.default.yellow(
1046
- configExport
1047
- )}`
1048
- );
1040
+ } catch (err) {
1041
+ logger.error(`Failed to load file with jiti: ${import_picocolors4.default.dim(configFilePath)}`);
1042
+ throw err;
1043
+ }
1044
+ if (typeof configExport === "function") {
1045
+ const command = process.argv[2];
1046
+ const params = {
1047
+ env: getNodeEnv(),
1048
+ command,
1049
+ envMode: envMode || getNodeEnv()
1050
+ };
1051
+ const result = await configExport(params);
1052
+ if (result === void 0) {
1053
+ throw new Error("The config function must return a config object.");
1049
1054
  }
1050
1055
  return {
1051
- content: applyMetaInfo(configExport),
1056
+ content: applyMetaInfo(result),
1052
1057
  filePath: configFilePath
1053
1058
  };
1054
- } catch (err) {
1055
- logger.error(`Failed to load file: ${import_picocolors4.default.dim(configFilePath)}`);
1056
- throw err;
1057
1059
  }
1060
+ if (!isObject(configExport)) {
1061
+ throw new Error(
1062
+ `The config must be an object or a function that returns an object, get ${import_picocolors4.default.yellow(
1063
+ configExport
1064
+ )}`
1065
+ );
1066
+ }
1067
+ return {
1068
+ content: applyMetaInfo(configExport),
1069
+ filePath: configFilePath
1070
+ };
1058
1071
  }
1059
1072
  async function outputInspectConfigFiles({
1060
1073
  rawBundlerConfigs,
@@ -1211,7 +1224,7 @@ var init_config = __esm({
1211
1224
  assetPrefix: DEFAULT_ASSET_PREFIX,
1212
1225
  filename: {},
1213
1226
  charset: "ascii",
1214
- polyfill: "usage",
1227
+ polyfill: "off",
1215
1228
  dataUriLimit: {
1216
1229
  svg: DEFAULT_DATA_URL_SIZE,
1217
1230
  font: DEFAULT_DATA_URL_SIZE,
@@ -1661,7 +1674,7 @@ async function createContextByConfig(options, bundlerType) {
1661
1674
  const rootPath = cwd;
1662
1675
  const cachePath = join6(rootPath, "node_modules", ".cache");
1663
1676
  return {
1664
- version: "1.0.0-alpha.3",
1677
+ version: "1.0.0-alpha.4",
1665
1678
  rootPath,
1666
1679
  distPath: "",
1667
1680
  cachePath,
@@ -8122,7 +8135,7 @@ __export(rspackProfile_exports, {
8122
8135
  import fs11 from "fs";
8123
8136
  import inspector from "inspector";
8124
8137
  import path16 from "path";
8125
- import { rspack as rspack9 } from "@rspack/core";
8138
+ import rspack9 from "@rspack/core";
8126
8139
  var stopProfiler, pluginRspackProfile;
8127
8140
  var init_rspackProfile = __esm({
8128
8141
  "src/plugins/rspackProfile.ts"() {
@@ -8164,7 +8177,7 @@ var init_rspackProfile = __esm({
8164
8177
  fs11.mkdirSync(profileDir, { recursive: true });
8165
8178
  }
8166
8179
  if (enableProfileTrace) {
8167
- rspack9.experimental_registerGlobalTrace(
8180
+ rspack9.experiments.globalTrace.register(
8168
8181
  "trace",
8169
8182
  "chrome",
8170
8183
  traceFilePath
@@ -8196,7 +8209,7 @@ var init_rspackProfile = __esm({
8196
8209
  });
8197
8210
  api.onExit(() => {
8198
8211
  if (enableProfileTrace) {
8199
- rspack9.experimental_cleanupGlobalTrace();
8212
+ rspack9.experiments.globalTrace.cleanup();
8200
8213
  }
8201
8214
  const profileDir = path16.join(api.context.distPath, profileDirName);
8202
8215
  const cpuProfilePath = path16.join(profileDir, "jscpuprofile.json");
@@ -8879,7 +8892,7 @@ var init_init = __esm({
8879
8892
  import { existsSync } from "fs";
8880
8893
  import { program } from "../compiled/commander/index.js";
8881
8894
  function runCli() {
8882
- program.name("rsbuild").usage("<command> [options]").version("1.0.0-alpha.3");
8895
+ program.name("rsbuild").usage("<command> [options]").version("1.0.0-alpha.4");
8883
8896
  const devCommand = program.command("dev");
8884
8897
  const buildCommand = program.command("build");
8885
8898
  const previewCommand = program.command("preview");
@@ -8992,7 +9005,7 @@ function prepareCli() {
8992
9005
  if (!npm_execpath || npm_execpath.includes("npx-cli.js") || npm_execpath.includes(".bun")) {
8993
9006
  console.log();
8994
9007
  }
8995
- logger.greet(` ${`Rsbuild v${"1.0.0-alpha.3"}`}
9008
+ logger.greet(` ${`Rsbuild v${"1.0.0-alpha.4"}`}
8996
9009
  `);
8997
9010
  }
8998
9011
  var init_prepare = __esm({
@@ -9062,7 +9075,7 @@ init_mergeConfig();
9062
9075
  init_helpers();
9063
9076
  init_constants();
9064
9077
  import { rspack as rspack10 } from "@rspack/core";
9065
- var version = "1.0.0-alpha.3";
9078
+ var version = "1.0.0-alpha.4";
9066
9079
  export {
9067
9080
  PLUGIN_CSS_NAME,
9068
9081
  PLUGIN_SWC_NAME,
@@ -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 { RsbuildConfig, DevConfig, HtmlConfig, ToolsConfig, SourceConfig, ServerConfig, OutputConfig, SecurityConfig, PerformanceConfig, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedHtmlConfig, NormalizedToolsConfig, NormalizedSourceConfig, NormalizedServerConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig, NormalizedModuleFederationConfig, NormalizedEnvironmentConfig, RsbuildPlugin, RsbuildPlugins, RsbuildPluginAPI, RsbuildMode, RsbuildEntry, RsbuildTarget, RsbuildContext, BuildOptions, CreateCompiler, CreateCompilerOptions, CreateRsbuildOptions, RsbuildInstance, RsbuildProvider, EnvironmentContext, InspectConfigResult, InspectConfigOptions, Minify, Polyfill, PrintUrls, PublicDir, Decorators, RspackRule, RspackChain, WatchFiles, CSSModules, CrossOrigin, ConsoleType, SplitChunks, ClientConfig, ScriptInject, ConfigChain, PostCSSPlugin, ScriptLoading, LegalComments, AliasStrategy, FilenameConfig, DistPathConfig, OutputStructure, TransformImport, PublicDirOptions, PreconnectOption, CSSLoaderOptions, ModifyChainUtils, StyleLoaderOptions, PostCSSLoaderOptions, ConfigChainWithContext, ModifyRspackConfigUtils, CSSModulesLocalsConvention, OnExitFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnBeforeCreateCompilerFn, OnCloseDevServerFn, OnDevCompileDoneFn, ModifyBundlerChainFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyRsbuildConfigFn, ModifyWebpackChainUtils, ModifyWebpackConfigUtils, ModifyBundlerChainUtils, TransformFn, TransformHandler, ServerAPIs, RequestHandler, PluginManager, CacheGroup, CacheGroups, BundlerPluginInstance, } from './types';
18
+ export type { AliasStrategy, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, ClientConfig, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateCompilerOptions, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, Decorators, DevConfig, DistPathConfig, EnvironmentContext, FilenameConfig, HtmlConfig, InspectConfigOptions, InspectConfigResult, LegalComments, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigUtils, ModuleFederationConfig, 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, PreconnectOption, PrintUrls, PublicDir, PublicDirOptions, RequestHandler, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerAPIs, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
19
19
  export type { ChainIdentifier } from './configChain';
20
20
  export {
21
21
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.0.0-alpha.0",
49
+ "@rspack/core": "1.0.0-alpha.1",
50
50
  "@swc/helpers": "0.5.11",
51
51
  "caniuse-lite": "^1.0.30001640",
52
52
  "core-js": "~3.37.1",
@@ -98,7 +98,7 @@
98
98
  "webpack-bundle-analyzer": "^4.10.2",
99
99
  "webpack-dev-middleware": "7.2.1",
100
100
  "webpack-merge": "5.10.0",
101
- "ws": "^8.17.1"
101
+ "ws": "^8.18.0"
102
102
  },
103
103
  "optionalDependencies": {
104
104
  "fsevents": "~2.3.3"