@winner-fed/bundler-rsbuild 0.11.15-alpha.0 → 0.11.15

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/build.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { MultiStats, Stats } from '@rsbuild/core/dist-types/types';
2
- import { IConfig } from './types';
1
+ import { IConfig, MultiStats, Stats } from './types';
3
2
  type IOpts = {
4
3
  cwd: string;
5
4
  rootDir?: string;
@@ -1,3 +1,4 @@
1
+ import { OutputConfig } from '@rsbuild/core';
1
2
  import { Env, IConfig } from '../types';
2
3
  interface IOpts {
3
4
  cwd: string;
@@ -5,45 +6,5 @@ interface IOpts {
5
6
  env: Env;
6
7
  hash?: boolean;
7
8
  }
8
- export declare function getOutConfig(opts: IOpts): {
9
- assetPrefix: string | undefined;
10
- cleanDistPath: any;
11
- copy: string[] | import("../types").ICopy[];
12
- cssModules: any;
13
- dataUriLimit: number;
14
- injectStyles: boolean;
15
- distPath: {
16
- root: string;
17
- js: string;
18
- jsAsync: string;
19
- css: string;
20
- cssAsync: string;
21
- };
22
- externals: Record<string, string> | never[];
23
- filenameHash: boolean;
24
- manifest: boolean | undefined;
25
- minify: true | {
26
- /**
27
- * Whether to enable JavaScript minification.
28
- */
29
- js?: boolean | undefined;
30
- /**
31
- * Minimizer options of JavaScript, which will be passed to SWC.
32
- */
33
- jsOptions?: object | undefined;
34
- /**
35
- * Whether to enable CSS minimization.
36
- */
37
- css?: boolean | undefined;
38
- /**
39
- * Minimizer options of CSS, which will be passed to LightningCSS.
40
- */
41
- cssOptions?: object | undefined;
42
- };
43
- overrideBrowserslist: any;
44
- sourceMap: {
45
- js: any;
46
- };
47
- legalComments: "inline";
48
- };
9
+ export declare function getOutConfig(opts: IOpts): OutputConfig;
49
10
  export {};
@@ -5,6 +5,7 @@
5
5
  * @LastEditTime: 2024-07-22 16:40
6
6
  * @Description: serverConfig
7
7
  */
8
+ import { ServerConfig } from '@rsbuild/core';
8
9
  import { Env } from '@winner-fed/bundler-webpack/dist/types';
9
10
  import { IConfig } from '../types';
10
11
  interface IOpts {
@@ -15,14 +16,5 @@ interface IOpts {
15
16
  userConfig: IConfig;
16
17
  env: Env;
17
18
  }
18
- export declare function getServerConfig(opts: IOpts): {
19
- compress: boolean;
20
- https: import("@winner-fed/bundler-utils").HttpsServerOptions | undefined;
21
- proxy: {
22
- [key: string]: import("@winner-fed/bundler-utils").ProxyOptions;
23
- } | undefined;
24
- host: string | undefined;
25
- port: number | undefined;
26
- open: boolean;
27
- };
19
+ export declare function getServerConfig(opts: IOpts): ServerConfig;
28
20
  export {};
@@ -75,9 +75,9 @@ function getSourceConfig(opts) {
75
75
  if ((userConfig == null ? void 0 : userConfig.alias) && (userConfig == null ? void 0 : userConfig.alias["@@"])) {
76
76
  tsconfigPath = `${userConfig == null ? void 0 : userConfig.alias["@@"]}/tsconfig.json`;
77
77
  }
78
- let extraInclude = [];
78
+ let extraIncludes = [];
79
79
  if (Array.isArray(userConfig == null ? void 0 : userConfig.extraBabelIncludes) && (userConfig == null ? void 0 : userConfig.extraBabelIncludes.length)) {
80
- extraInclude = userConfig.extraBabelIncludes.map((p) => {
80
+ extraIncludes = userConfig.extraBabelIncludes.map((p) => {
81
81
  if (import_utils.lodash.isRegExp(p)) {
82
82
  return p;
83
83
  }
@@ -111,7 +111,7 @@ function getSourceConfig(opts) {
111
111
  define: resolveDefine(opts),
112
112
  entry,
113
113
  tsconfigPath,
114
- include: [...extraInclude]
114
+ include: [...extraIncludes]
115
115
  };
116
116
  }
117
117
  // Annotate the CommonJS export names for ESM import in node:
@@ -5,7 +5,7 @@
5
5
  * @LastEditTime: 2024-07-22 16:57
6
6
  * @Description: toolsConfig
7
7
  */
8
- import type { ModifyBundlerChainUtils, ModifyRspackConfigUtils, Rspack, RspackChain } from '@rsbuild/core';
8
+ import type { ToolsConfig } from '@rsbuild/core';
9
9
  import { Env, IConfig } from '../types';
10
10
  interface IOpts {
11
11
  cwd: string;
@@ -17,15 +17,5 @@ interface IOpts {
17
17
  modifyRspackConfig?: Function;
18
18
  modifyBundlerChain?: Function;
19
19
  }
20
- export declare function getToolsConfig(opts: IOpts): {
21
- lightningcssLoader: any;
22
- bundlerChain: (chain: RspackChain, utils: ModifyBundlerChainUtils) => Promise<void>;
23
- rspack: (config: Rspack.Configuration, utils: ModifyRspackConfigUtils) => Promise<Rspack.Configuration>;
24
- cssLoader: any;
25
- postcss: () => {
26
- postcssOptions: any;
27
- };
28
- styleLoader: any;
29
- htmlPlugin: boolean;
30
- };
20
+ export declare function getToolsConfig(opts: IOpts): ToolsConfig;
31
21
  export {};
@@ -22,7 +22,7 @@ __export(toolsConfig_exports, {
22
22
  getToolsConfig: () => getToolsConfig
23
23
  });
24
24
  module.exports = __toCommonJS(toolsConfig_exports);
25
- var import_css = require("@winner-fed/bundler-vite/dist/config/transformer/css");
25
+ var import_getBrowsersList = require("../utils/getBrowsersList");
26
26
  function getToolsConfig(opts) {
27
27
  var _a;
28
28
  const { userConfig } = opts;
@@ -34,10 +34,11 @@ function getToolsConfig(opts) {
34
34
  }
35
35
  },
36
36
  rspack: async (config, utils) => {
37
+ let mergeConfig = config;
37
38
  if (opts.modifyRspackConfig) {
38
- config = await opts.modifyRspackConfig(config, utils);
39
+ mergeConfig = await opts.modifyRspackConfig(config, utils);
39
40
  }
40
- return config;
41
+ return mergeConfig;
41
42
  },
42
43
  cssLoader: userConfig.cssLoader || {},
43
44
  postcss: () => {
@@ -51,7 +52,7 @@ function getToolsConfig(opts) {
51
52
  // autoprefixer
52
53
  ((_d = userConfig.rsbuild) == null ? void 0 : _d.lightningcssLoader) === false && require("@winner-fed/bundler-utils/compiled/postcss-preset-env")({
53
54
  // handle targets for css
54
- browsers: (0, import_css.getBrowserlist)(userConfig.targets || {}),
55
+ browsers: (0, import_getBrowsersList.getBrowserlist)(userConfig.targets || {}),
55
56
  // handle autoprefixer
56
57
  autoprefixer: {
57
58
  flexbox: "no-2009",
package/dist/dev.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { MaybePromise, MultiStats, Stats } from '@rsbuild/core/dist-types/types';
1
+ import type { MaybePromise } from '@rsbuild/core/dist-types/types';
2
2
  import { Express, RequestHandler } from '@winner-fed/bundler-utils/compiled/express';
3
- import { IBabelPlugin, IConfig } from './types';
3
+ import { IBabelPlugin, IConfig, MultiStats, Stats } from './types';
4
4
  type IOpts = {
5
5
  beforeBabelPlugins?: IBabelPlugin[];
6
6
  beforeBabelPresets?: IBabelPlugin[];
@@ -43,9 +43,6 @@ async function createServer(opts) {
43
43
  cwd: opts.cwd,
44
44
  rsbuildConfig
45
45
  });
46
- try {
47
- } catch (e) {
48
- }
49
46
  const app = (0, import_express.default)();
50
47
  const rsbuildServer = await rsbuild.createDevServer();
51
48
  if (opts.onBeforeMiddleware) {
package/dist/types.d.ts CHANGED
@@ -5,11 +5,15 @@
5
5
  * @LastEditTime: 2024-07-16 09:15
6
6
  * @Description: types
7
7
  */
8
+ import { Rspack } from '@rsbuild/core';
8
9
  import type { HttpsServerOptions, ProxyOptions } from '@winner-fed/bundler-utils';
9
10
  export declare enum Env {
10
11
  development = "development",
11
12
  production = "production"
12
13
  }
14
+ export type MultiStats = Rspack.MultiStats;
15
+ export type Stats = Rspack.Stats;
16
+ export type StatsCompilation = Rspack.StatsCompilation;
13
17
  export declare enum JSMinifier {
14
18
  swc = "swc",
15
19
  none = "none"
@@ -2,4 +2,5 @@ interface IOpts {
2
2
  targets: Record<string, any>;
3
3
  }
4
4
  export declare function getBrowsersList({ targets }: IOpts): any;
5
+ export declare function getBrowserlist(targets: Record<string, string | boolean>): string | string[];
5
6
  export {};
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/utils/getBrowsersList.ts
20
20
  var getBrowsersList_exports = {};
21
21
  __export(getBrowsersList_exports, {
22
+ getBrowserlist: () => getBrowserlist,
22
23
  getBrowsersList: () => getBrowsersList
23
24
  });
24
25
  module.exports = __toCommonJS(getBrowsersList_exports);
@@ -27,7 +28,13 @@ function getBrowsersList({ targets = {} }) {
27
28
  return `${key} >= ${targets[key] === true ? "0" : targets[key]}`;
28
29
  });
29
30
  }
31
+ function getBrowserlist(targets) {
32
+ return typeof targets.browsers === "string" ? targets.browser : Object.keys(targets).map(
33
+ (key) => `${key} >= ${targets[key] === true ? "0" : targets[key]}`
34
+ );
35
+ }
30
36
  // Annotate the CommonJS export names for ESM import in node:
31
37
  0 && (module.exports = {
38
+ getBrowserlist,
32
39
  getBrowsersList
33
40
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winner-fed/bundler-rsbuild",
3
- "version": "0.11.15-alpha.0",
3
+ "version": "0.11.15",
4
4
  "description": "@winner-fed/bundler-rsbuild",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -9,15 +9,15 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@rsbuild/core": "1.1.0",
12
+ "@rsbuild/core": "1.0.19",
13
13
  "@rsbuild/plugin-babel": "1.0.3",
14
14
  "@rsbuild/plugin-less": "1.1.0",
15
15
  "@rsbuild/plugin-node-polyfill": "1.2.0",
16
16
  "@rsbuild/plugin-sass": "1.1.0",
17
17
  "@rsbuild/plugin-stylus": "1.0.5",
18
18
  "@rsbuild/plugin-type-check": "1.0.1",
19
- "@winner-fed/bundler-utils": "0.11.15-alpha.0",
20
- "@winner-fed/utils": "0.11.15-alpha.0"
19
+ "@winner-fed/bundler-utils": "0.11.15",
20
+ "@winner-fed/utils": "0.11.15"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"