@winner-fed/bundler-rsbuild 0.9.2-alpha.1
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/README.md +3 -0
- package/dist/build.d.ts +24 -0
- package/dist/build.js +102 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.js +100 -0
- package/dist/config/devConfig.d.ts +14 -0
- package/dist/config/devConfig.js +36 -0
- package/dist/config/outConfig.d.ts +29 -0
- package/dist/config/outConfig.js +80 -0
- package/dist/config/performanceConfig.d.ts +21 -0
- package/dist/config/performanceConfig.js +60 -0
- package/dist/config/serverConfig.d.ts +28 -0
- package/dist/config/serverConfig.js +55 -0
- package/dist/config/sourceConfig.d.ts +15 -0
- package/dist/config/sourceConfig.js +82 -0
- package/dist/config/toolsConfig.d.ts +29 -0
- package/dist/config/toolsConfig.js +54 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +56 -0
- package/dist/dev.d.ts +16 -0
- package/dist/dev.js +67 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +29 -0
- package/dist/server/server.d.ts +16 -0
- package/dist/server/server.js +90 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.js +41 -0
- package/dist/utils/checkConfig.d.ts +1 -0
- package/dist/utils/checkConfig.js +50 -0
- package/dist/utils/getBrowsersList.d.ts +5 -0
- package/dist/utils/getBrowsersList.js +33 -0
- package/package.json +28 -0
package/README.md
ADDED
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IConfig } from './types';
|
|
2
|
+
type IOpts = {
|
|
3
|
+
cwd: string;
|
|
4
|
+
rootDir?: string;
|
|
5
|
+
entry: Record<string, string>;
|
|
6
|
+
config: IConfig;
|
|
7
|
+
onBuildComplete?: Function;
|
|
8
|
+
clean?: boolean;
|
|
9
|
+
watch?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function build(opts: IOpts): Promise<{
|
|
12
|
+
compilation: {
|
|
13
|
+
assets: any;
|
|
14
|
+
constructor?: Function | undefined;
|
|
15
|
+
toString?: (() => string) | undefined;
|
|
16
|
+
toLocaleString?: (() => string) | undefined;
|
|
17
|
+
valueOf?: (() => Object) | undefined;
|
|
18
|
+
hasOwnProperty?: ((v: PropertyKey) => boolean) | undefined;
|
|
19
|
+
isPrototypeOf?: ((v: Object) => boolean) | undefined;
|
|
20
|
+
propertyIsEnumerable?: ((v: PropertyKey) => boolean) | undefined;
|
|
21
|
+
};
|
|
22
|
+
hasErrors: () => boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export {};
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/build.ts
|
|
30
|
+
var build_exports = {};
|
|
31
|
+
__export(build_exports, {
|
|
32
|
+
build: () => build
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(build_exports);
|
|
35
|
+
var import_core = require("@rsbuild/core");
|
|
36
|
+
var import_utils = require("@winner-fed/utils");
|
|
37
|
+
var import_assert = __toESM(require("assert"));
|
|
38
|
+
var import_types = require("./types");
|
|
39
|
+
var import_checkConfig = require("./utils/checkConfig");
|
|
40
|
+
var configModule = (0, import_utils.importLazy)(
|
|
41
|
+
require.resolve("./config/config")
|
|
42
|
+
);
|
|
43
|
+
var statsJson = {};
|
|
44
|
+
var onBuildCompileDone = () => ({
|
|
45
|
+
name: "build-done",
|
|
46
|
+
setup(api) {
|
|
47
|
+
api.onAfterBuild(({ stats }) => {
|
|
48
|
+
statsJson = stats == null ? void 0 : stats.toJson();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
async function build(opts) {
|
|
53
|
+
var _a;
|
|
54
|
+
(0, import_assert.default)(opts, "opts should be supplied");
|
|
55
|
+
(0, import_checkConfig.checkConfig)(opts);
|
|
56
|
+
const { cwd, onBuildComplete } = opts;
|
|
57
|
+
const rsbuildConfig = await configModule.getRsbuildConfig({
|
|
58
|
+
userConfig: opts.config,
|
|
59
|
+
env: import_types.Env.production,
|
|
60
|
+
...opts
|
|
61
|
+
});
|
|
62
|
+
rsbuildConfig.plugins || (rsbuildConfig.plugins = []);
|
|
63
|
+
rsbuildConfig.plugins.push(onBuildCompileDone());
|
|
64
|
+
const rsbuild = await (0, import_core.createRsbuild)({
|
|
65
|
+
cwd,
|
|
66
|
+
rsbuildConfig
|
|
67
|
+
});
|
|
68
|
+
try {
|
|
69
|
+
await rsbuild.build({
|
|
70
|
+
mode: import_types.Env.production,
|
|
71
|
+
watch: false
|
|
72
|
+
});
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error(e == null ? void 0 : e.message);
|
|
75
|
+
const err = new Error("Build with rsbuild failed.");
|
|
76
|
+
err.stack = null;
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
const stats = {
|
|
80
|
+
compilation: {
|
|
81
|
+
...statsJson,
|
|
82
|
+
// convert assets to [key: value] for compilation data
|
|
83
|
+
assets: (_a = statsJson == null ? void 0 : statsJson.assets) == null ? void 0 : _a.reduce(
|
|
84
|
+
(acc, asset) => ({
|
|
85
|
+
...acc,
|
|
86
|
+
[asset.name]: { size: asset.size }
|
|
87
|
+
}),
|
|
88
|
+
{}
|
|
89
|
+
)
|
|
90
|
+
},
|
|
91
|
+
hasErrors: () => false
|
|
92
|
+
};
|
|
93
|
+
await onBuildComplete({
|
|
94
|
+
err: null,
|
|
95
|
+
stats
|
|
96
|
+
});
|
|
97
|
+
return stats;
|
|
98
|
+
}
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
build
|
|
102
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RsbuildConfig } from '@rsbuild/core';
|
|
2
|
+
import { Env, IConfig } from '../types';
|
|
3
|
+
export interface IOpts {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
env?: Env;
|
|
6
|
+
entry?: Record<string, string>;
|
|
7
|
+
modifyRsbuildConfig?: Function;
|
|
8
|
+
userConfig?: IConfig;
|
|
9
|
+
}
|
|
10
|
+
export declare function getRsbuildConfig(opts: IOpts): Promise<RsbuildConfig>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/config/config.ts
|
|
30
|
+
var config_exports = {};
|
|
31
|
+
__export(config_exports, {
|
|
32
|
+
getRsbuildConfig: () => getRsbuildConfig
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(config_exports);
|
|
35
|
+
var import_plugin_less = require("@rsbuild/plugin-less");
|
|
36
|
+
var import_plugin_node_polyfill = require("@rsbuild/plugin-node-polyfill");
|
|
37
|
+
var import_plugin_sass = require("@rsbuild/plugin-sass");
|
|
38
|
+
var import_plugin_type_check = require("@rsbuild/plugin-type-check");
|
|
39
|
+
var import_devConfig = require("./devConfig");
|
|
40
|
+
var import_outConfig = require("./outConfig");
|
|
41
|
+
var import_performanceConfig = require("./performanceConfig");
|
|
42
|
+
var import_serverConfig = require("./serverConfig");
|
|
43
|
+
var import_sourceConfig = require("./sourceConfig");
|
|
44
|
+
var import_toolsConfig = require("./toolsConfig");
|
|
45
|
+
async function getRsbuildConfig(opts) {
|
|
46
|
+
var _a;
|
|
47
|
+
const { userConfig } = opts;
|
|
48
|
+
const sourceConfig = (0, import_sourceConfig.getSourceConfig)(opts);
|
|
49
|
+
const outConfig = (0, import_outConfig.getOutConfig)(opts);
|
|
50
|
+
const htmlConfig = {};
|
|
51
|
+
const devConfig = (0, import_devConfig.getDevConfig)(opts);
|
|
52
|
+
const serverConfig = (0, import_serverConfig.getServerConfig)(opts);
|
|
53
|
+
const toolsConfig = (0, import_toolsConfig.getToolsConfig)(opts);
|
|
54
|
+
const performanceConfig = (0, import_performanceConfig.getPerformanceConfig)(opts);
|
|
55
|
+
let rsbuildConfig = {
|
|
56
|
+
source: sourceConfig,
|
|
57
|
+
output: outConfig,
|
|
58
|
+
html: htmlConfig,
|
|
59
|
+
tools: toolsConfig,
|
|
60
|
+
dev: devConfig,
|
|
61
|
+
server: serverConfig,
|
|
62
|
+
performance: performanceConfig,
|
|
63
|
+
plugins: [
|
|
64
|
+
(0, import_plugin_node_polyfill.pluginNodePolyfill)(),
|
|
65
|
+
(0, import_plugin_less.pluginLess)({
|
|
66
|
+
lessLoaderOptions: {
|
|
67
|
+
lessOptions: {
|
|
68
|
+
modifyVars: userConfig == null ? void 0 : userConfig.theme,
|
|
69
|
+
javascriptEnabled: true,
|
|
70
|
+
...userConfig == null ? void 0 : userConfig.lessLoader
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
(0, import_plugin_sass.pluginSass)({
|
|
75
|
+
...userConfig == null ? void 0 : userConfig.sassLoader
|
|
76
|
+
})
|
|
77
|
+
].filter(Boolean)
|
|
78
|
+
};
|
|
79
|
+
if (userConfig == null ? void 0 : userConfig.forkTSChecker) {
|
|
80
|
+
if ((_a = userConfig == null ? void 0 : userConfig.forkTSChecker.typescript) == null ? void 0 : _a.enable) {
|
|
81
|
+
userConfig.forkTSChecker.typescript.typescriptPath = require.resolve("typescript");
|
|
82
|
+
}
|
|
83
|
+
rsbuildConfig.plugins || (rsbuildConfig.plugins = []);
|
|
84
|
+
rsbuildConfig.plugins.push(
|
|
85
|
+
(0, import_plugin_type_check.pluginTypeCheck)({
|
|
86
|
+
typescriptPath: userConfig.forkTSChecker
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (opts.modifyRsbuildConfig) {
|
|
91
|
+
rsbuildConfig = await opts.modifyRsbuildConfig(rsbuildConfig, {
|
|
92
|
+
env: opts.env
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return rsbuildConfig;
|
|
96
|
+
}
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
getRsbuildConfig
|
|
100
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* devConfig
|
|
3
|
+
* @Author: liwb (lwbhtml@163.com)
|
|
4
|
+
* @Date: 2024-07-22 16:36
|
|
5
|
+
* @LastEditTime: 2024-07-22 16:36
|
|
6
|
+
* @Description: devConfig
|
|
7
|
+
*/
|
|
8
|
+
import { DevConfig } from '@rsbuild/core';
|
|
9
|
+
import { IConfig } from '../types';
|
|
10
|
+
interface IOpts {
|
|
11
|
+
userConfig: IConfig;
|
|
12
|
+
}
|
|
13
|
+
export declare function getDevConfig(opts: IOpts): DevConfig;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/devConfig.ts
|
|
20
|
+
var devConfig_exports = {};
|
|
21
|
+
__export(devConfig_exports, {
|
|
22
|
+
getDevConfig: () => getDevConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(devConfig_exports);
|
|
25
|
+
function getDevConfig(opts) {
|
|
26
|
+
const { userConfig } = opts;
|
|
27
|
+
return {
|
|
28
|
+
assetPrefix: userConfig.publicPath,
|
|
29
|
+
writeToDisk: userConfig.writeToDisk,
|
|
30
|
+
hmr: process.env.HMR !== "none"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
getDevConfig
|
|
36
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Env, IConfig } from '../types';
|
|
2
|
+
interface IOpts {
|
|
3
|
+
cwd: string;
|
|
4
|
+
userConfig: IConfig;
|
|
5
|
+
env: Env;
|
|
6
|
+
hash?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function getOutConfig(opts: IOpts): {
|
|
9
|
+
assetPrefix: string | undefined;
|
|
10
|
+
cleanDistPath: any;
|
|
11
|
+
copy: import("../types").ICopy[] | string[];
|
|
12
|
+
cssModules: any;
|
|
13
|
+
dataUriLimit: number;
|
|
14
|
+
distPath: {
|
|
15
|
+
root: string;
|
|
16
|
+
js: string;
|
|
17
|
+
css: string;
|
|
18
|
+
};
|
|
19
|
+
externals: Record<string, string> | never[];
|
|
20
|
+
filenameHash: boolean;
|
|
21
|
+
manifest: boolean | undefined;
|
|
22
|
+
minify: boolean;
|
|
23
|
+
overrideBrowserslist: any;
|
|
24
|
+
sourceMap: {
|
|
25
|
+
js: any;
|
|
26
|
+
};
|
|
27
|
+
legalComments: "none";
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/outConfig.ts
|
|
20
|
+
var outConfig_exports = {};
|
|
21
|
+
__export(outConfig_exports, {
|
|
22
|
+
getOutConfig: () => getOutConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(outConfig_exports);
|
|
25
|
+
var import_path = require("path");
|
|
26
|
+
var import_constants = require("../constants");
|
|
27
|
+
var import_types = require("../types");
|
|
28
|
+
var import_getBrowsersList = require("../utils/getBrowsersList");
|
|
29
|
+
function getOutConfig(opts) {
|
|
30
|
+
const { userConfig } = opts;
|
|
31
|
+
const isDev = opts.env === import_types.Env.development;
|
|
32
|
+
const inlineLimit = parseInt(userConfig.inlineLimit || "10000", 10);
|
|
33
|
+
const useHash = !!(opts.hash || userConfig.hash && !isDev);
|
|
34
|
+
const devtool = isDev ? userConfig.devtool === false ? false : userConfig.devtool || import_constants.DEFAULT_DEVTOOL : userConfig.devtool;
|
|
35
|
+
const outputPath = (0, import_path.resolve)(
|
|
36
|
+
opts.cwd,
|
|
37
|
+
userConfig.outputPath || import_constants.DEFAULT_OUTPUT_PATH
|
|
38
|
+
);
|
|
39
|
+
const {
|
|
40
|
+
publicPath,
|
|
41
|
+
manifest,
|
|
42
|
+
externals = [],
|
|
43
|
+
copy = [],
|
|
44
|
+
cssLoaderModules = {},
|
|
45
|
+
clean = true
|
|
46
|
+
} = userConfig;
|
|
47
|
+
const disableCompress = process.env.COMPRESS === "none";
|
|
48
|
+
const minify = !(isDev || disableCompress);
|
|
49
|
+
const legalComments = "none";
|
|
50
|
+
if (typeof externals === "string") {
|
|
51
|
+
throw new Error("externals string is not supported");
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
assetPrefix: publicPath,
|
|
55
|
+
cleanDistPath: clean,
|
|
56
|
+
copy,
|
|
57
|
+
cssModules: cssLoaderModules,
|
|
58
|
+
dataUriLimit: inlineLimit,
|
|
59
|
+
distPath: {
|
|
60
|
+
root: outputPath,
|
|
61
|
+
js: "",
|
|
62
|
+
css: ""
|
|
63
|
+
},
|
|
64
|
+
externals,
|
|
65
|
+
filenameHash: useHash,
|
|
66
|
+
manifest,
|
|
67
|
+
minify,
|
|
68
|
+
overrideBrowserslist: (0, import_getBrowsersList.getBrowsersList)({
|
|
69
|
+
targets: userConfig.targets
|
|
70
|
+
}),
|
|
71
|
+
sourceMap: {
|
|
72
|
+
js: devtool
|
|
73
|
+
},
|
|
74
|
+
legalComments
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
getOutConfig
|
|
80
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* performanceConfig
|
|
3
|
+
* @Author: liwb (lwbhtml@163.com)
|
|
4
|
+
* @Date: 2024-07-22 17:03
|
|
5
|
+
* @LastEditTime: 2024-07-22 17:03
|
|
6
|
+
* @Description: performanceConfig
|
|
7
|
+
*/
|
|
8
|
+
import { PerformanceConfig } from '@rsbuild/core';
|
|
9
|
+
import { Env } from '@winner-fed/bundler-webpack/dist/types';
|
|
10
|
+
import { IConfig } from '../types';
|
|
11
|
+
interface IOpts {
|
|
12
|
+
cwd: string;
|
|
13
|
+
port?: number;
|
|
14
|
+
host?: string;
|
|
15
|
+
ip?: string;
|
|
16
|
+
userConfig: IConfig;
|
|
17
|
+
env: Env;
|
|
18
|
+
modifyRspackConfig?: Function;
|
|
19
|
+
}
|
|
20
|
+
export declare function getPerformanceConfig(opts: IOpts): PerformanceConfig;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/performanceConfig.ts
|
|
20
|
+
var performanceConfig_exports = {};
|
|
21
|
+
__export(performanceConfig_exports, {
|
|
22
|
+
getPerformanceConfig: () => getPerformanceConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(performanceConfig_exports);
|
|
25
|
+
var import_types = require("@winner-fed/bundler-webpack/dist/types");
|
|
26
|
+
function getPerformanceConfig(opts) {
|
|
27
|
+
const { userConfig } = opts;
|
|
28
|
+
const isDev = opts.env === import_types.Env.development;
|
|
29
|
+
let strategy = "split-by-experience";
|
|
30
|
+
if (userConfig.codeSplitting) {
|
|
31
|
+
if (userConfig.codeSplitting.jsStrategy === "bigVendors") {
|
|
32
|
+
strategy = "all-in-one";
|
|
33
|
+
}
|
|
34
|
+
if (userConfig.codeSplitting.jsStrategy === "depPerChunk") {
|
|
35
|
+
strategy = "split-by-module";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let bundleAnalyze = void 0;
|
|
39
|
+
if (userConfig.analyze || process.env.ANALYZE) {
|
|
40
|
+
bundleAnalyze = {
|
|
41
|
+
analyzerMode: "server",
|
|
42
|
+
analyzerPort: process.env.ANALYZE_PORT || 8888,
|
|
43
|
+
openAnalyzer: false,
|
|
44
|
+
logLevel: "info",
|
|
45
|
+
defaultSizes: "parsed"
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
bundleAnalyze,
|
|
50
|
+
chunkSplit: {
|
|
51
|
+
strategy
|
|
52
|
+
},
|
|
53
|
+
removeMomentLocale: true,
|
|
54
|
+
printFileSize: !isDev
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
getPerformanceConfig
|
|
60
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* serverConfig
|
|
3
|
+
* @Author: liwb (lwbhtml@163.com)
|
|
4
|
+
* @Date: 2024-07-22 16:40
|
|
5
|
+
* @LastEditTime: 2024-07-22 16:40
|
|
6
|
+
* @Description: serverConfig
|
|
7
|
+
*/
|
|
8
|
+
import { Env } from '@winner-fed/bundler-webpack/dist/types';
|
|
9
|
+
import { IConfig } from '../types';
|
|
10
|
+
interface IOpts {
|
|
11
|
+
cwd: string;
|
|
12
|
+
port?: number;
|
|
13
|
+
host?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
userConfig: IConfig;
|
|
16
|
+
env: Env;
|
|
17
|
+
}
|
|
18
|
+
export declare function getServerConfig(opts: IOpts): {
|
|
19
|
+
compress: any;
|
|
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
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/serverConfig.ts
|
|
20
|
+
var serverConfig_exports = {};
|
|
21
|
+
__export(serverConfig_exports, {
|
|
22
|
+
getServerConfig: () => getServerConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(serverConfig_exports);
|
|
25
|
+
var import_utils = require("@winner-fed/utils");
|
|
26
|
+
function getServerConfig(opts) {
|
|
27
|
+
const { userConfig } = opts;
|
|
28
|
+
const httpsOpts = userConfig.https;
|
|
29
|
+
if (httpsOpts) {
|
|
30
|
+
if (!httpsOpts.hosts) {
|
|
31
|
+
httpsOpts.hosts = import_utils.lodash.uniq(
|
|
32
|
+
[
|
|
33
|
+
...httpsOpts.hosts || [],
|
|
34
|
+
// always add localhost, 127.0.0.1, ip and host
|
|
35
|
+
"127.0.0.1",
|
|
36
|
+
"localhost",
|
|
37
|
+
opts.ip,
|
|
38
|
+
opts.host !== "0.0.0.0" && opts.host
|
|
39
|
+
].filter(Boolean)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
compress: userConfig.compression,
|
|
45
|
+
https: httpsOpts,
|
|
46
|
+
proxy: userConfig.proxy,
|
|
47
|
+
host: opts.host,
|
|
48
|
+
port: opts.port,
|
|
49
|
+
open: true
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
getServerConfig
|
|
55
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SourceConfig } from '@rsbuild/core';
|
|
2
|
+
import { Env, IConfig } from '../types';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
entry: Record<string, string>;
|
|
5
|
+
userConfig: IConfig;
|
|
6
|
+
cwd: string;
|
|
7
|
+
env: Env;
|
|
8
|
+
host?: string;
|
|
9
|
+
port?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveDefine(opts: IOpts): {
|
|
12
|
+
'process.env': Record<string, any>;
|
|
13
|
+
};
|
|
14
|
+
export declare function getSourceConfig(opts: IOpts): SourceConfig;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/sourceConfig.ts
|
|
20
|
+
var sourceConfig_exports = {};
|
|
21
|
+
__export(sourceConfig_exports, {
|
|
22
|
+
getSourceConfig: () => getSourceConfig,
|
|
23
|
+
resolveDefine: () => resolveDefine
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(sourceConfig_exports);
|
|
26
|
+
var prefixRE = /^WIN_APP_/;
|
|
27
|
+
var ENV_SHOULD_PASS = ["NODE_ENV", "HMR", "SOCKET_SERVER", "ERROR_OVERLAY"];
|
|
28
|
+
var SOCKET_IGNORE_HOSTS = ["0.0.0.0", "127.0.0.1", "localhost"];
|
|
29
|
+
var CUSTOM_ENV_GETTER = {
|
|
30
|
+
SOCKET_SERVER: (opts) => {
|
|
31
|
+
const { userConfig, host, port } = opts;
|
|
32
|
+
const socketServer = process.env.SOCKET_SERVER;
|
|
33
|
+
if (socketServer) {
|
|
34
|
+
return socketServer;
|
|
35
|
+
}
|
|
36
|
+
if (host && !SOCKET_IGNORE_HOSTS.includes(host)) {
|
|
37
|
+
const protocol = userConfig.https ? "https:" : "http:";
|
|
38
|
+
return `${protocol}//${host}:${port || 8e3}`;
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function resolveDefine(opts) {
|
|
44
|
+
const { userConfig } = opts;
|
|
45
|
+
const env = {};
|
|
46
|
+
ENV_SHOULD_PASS.concat(
|
|
47
|
+
Object.keys(process.env).filter((k) => prefixRE.test(k))
|
|
48
|
+
).forEach((key) => {
|
|
49
|
+
const envValue = CUSTOM_ENV_GETTER[key] ? CUSTOM_ENV_GETTER[key](opts) : process.env[key];
|
|
50
|
+
if (typeof envValue === "undefined") {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
env[key] = envValue;
|
|
54
|
+
});
|
|
55
|
+
env.PUBLIC_PATH = (userConfig == null ? void 0 : userConfig.publicPath) || "/";
|
|
56
|
+
for (const key in env) {
|
|
57
|
+
env[key] = JSON.stringify(env[key]);
|
|
58
|
+
}
|
|
59
|
+
const define = {};
|
|
60
|
+
if (userConfig == null ? void 0 : userConfig.define) {
|
|
61
|
+
for (const key in userConfig.define) {
|
|
62
|
+
define[key] = JSON.stringify(userConfig.define[key]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
"process.env": env,
|
|
67
|
+
...define
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getSourceConfig(opts) {
|
|
71
|
+
const { userConfig, entry } = opts;
|
|
72
|
+
return {
|
|
73
|
+
alias: userConfig.alias || {},
|
|
74
|
+
define: resolveDefine(opts),
|
|
75
|
+
entry
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
getSourceConfig,
|
|
81
|
+
resolveDefine
|
|
82
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolsConfig
|
|
3
|
+
* @Author: liwb (lwbhtml@163.com)
|
|
4
|
+
* @Date: 2024-07-22 16:57
|
|
5
|
+
* @LastEditTime: 2024-07-22 16:57
|
|
6
|
+
* @Description: toolsConfig
|
|
7
|
+
*/
|
|
8
|
+
import { Env } from '@winner-fed/bundler-webpack/dist/types';
|
|
9
|
+
import { IConfig } from '../types';
|
|
10
|
+
interface IOpts {
|
|
11
|
+
cwd: string;
|
|
12
|
+
port?: number;
|
|
13
|
+
host?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
userConfig: IConfig;
|
|
16
|
+
env: Env;
|
|
17
|
+
modifyRspackConfig?: Function;
|
|
18
|
+
}
|
|
19
|
+
export declare function getToolsConfig(opts: IOpts): {
|
|
20
|
+
autoprefixer: any;
|
|
21
|
+
rspack: (config: any, { env }: {
|
|
22
|
+
env: any;
|
|
23
|
+
}) => Promise<any>;
|
|
24
|
+
cssLoader: any;
|
|
25
|
+
postcss: any;
|
|
26
|
+
styleLoader: any;
|
|
27
|
+
htmlPlugin: boolean;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/toolsConfig.ts
|
|
20
|
+
var toolsConfig_exports = {};
|
|
21
|
+
__export(toolsConfig_exports, {
|
|
22
|
+
getToolsConfig: () => getToolsConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(toolsConfig_exports);
|
|
25
|
+
function getToolsConfig(opts) {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const { userConfig } = opts;
|
|
28
|
+
return {
|
|
29
|
+
autoprefixer: userConfig.autoprefixer || {},
|
|
30
|
+
rspack: async (config, { env }) => {
|
|
31
|
+
if (opts.modifyRspackConfig) {
|
|
32
|
+
config = await opts.modifyRspackConfig(config, { env });
|
|
33
|
+
}
|
|
34
|
+
return config;
|
|
35
|
+
},
|
|
36
|
+
cssLoader: userConfig.cssLoader || {},
|
|
37
|
+
postcss: {
|
|
38
|
+
// handle postcssLoader
|
|
39
|
+
...((_a = userConfig.postcssLoader) == null ? void 0 : _a.postcssOptions) || {},
|
|
40
|
+
plugins: [
|
|
41
|
+
...((_c = (_b = userConfig.postcssLoader) == null ? void 0 : _b.postcssOptions) == null ? void 0 : _c.plugins) || [],
|
|
42
|
+
// handle extraPostCSSPlugins
|
|
43
|
+
...userConfig.extraPostCSSPlugins || []
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
styleLoader: userConfig.styleLoader || {},
|
|
47
|
+
// 自带的 htmlPlugin 不满足,禁掉了,可以参考 preset-win/src/features/rsbuild/rsbuid.ts
|
|
48
|
+
htmlPlugin: false
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
getToolsConfig
|
|
54
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const DEFAULT_DEVTOOL = "cheap-module-source-map";
|
|
2
|
+
export declare const DEFAULT_OUTPUT_PATH = "dist";
|
|
3
|
+
export declare enum MESSAGE_TYPE {
|
|
4
|
+
ok = "ok",
|
|
5
|
+
warnings = "warnings",
|
|
6
|
+
errors = "errors",
|
|
7
|
+
hash = "hash",
|
|
8
|
+
stillOk = "still-ok",
|
|
9
|
+
invalid = "invalid"
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_BROWSER_TARGETS: {
|
|
12
|
+
chrome: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const DEFAULT_ESBUILD_TARGET_KEYS: string[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
DEFAULT_BROWSER_TARGETS: () => DEFAULT_BROWSER_TARGETS,
|
|
23
|
+
DEFAULT_DEVTOOL: () => DEFAULT_DEVTOOL,
|
|
24
|
+
DEFAULT_ESBUILD_TARGET_KEYS: () => DEFAULT_ESBUILD_TARGET_KEYS,
|
|
25
|
+
DEFAULT_OUTPUT_PATH: () => DEFAULT_OUTPUT_PATH,
|
|
26
|
+
MESSAGE_TYPE: () => MESSAGE_TYPE
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
29
|
+
var DEFAULT_DEVTOOL = "cheap-module-source-map";
|
|
30
|
+
var DEFAULT_OUTPUT_PATH = "dist";
|
|
31
|
+
var MESSAGE_TYPE = /* @__PURE__ */ ((MESSAGE_TYPE2) => {
|
|
32
|
+
MESSAGE_TYPE2["ok"] = "ok";
|
|
33
|
+
MESSAGE_TYPE2["warnings"] = "warnings";
|
|
34
|
+
MESSAGE_TYPE2["errors"] = "errors";
|
|
35
|
+
MESSAGE_TYPE2["hash"] = "hash";
|
|
36
|
+
MESSAGE_TYPE2["stillOk"] = "still-ok";
|
|
37
|
+
MESSAGE_TYPE2["invalid"] = "invalid";
|
|
38
|
+
return MESSAGE_TYPE2;
|
|
39
|
+
})(MESSAGE_TYPE || {});
|
|
40
|
+
var DEFAULT_BROWSER_TARGETS = {
|
|
41
|
+
chrome: 80
|
|
42
|
+
};
|
|
43
|
+
var DEFAULT_ESBUILD_TARGET_KEYS = [
|
|
44
|
+
"chrome",
|
|
45
|
+
"firefox",
|
|
46
|
+
"edge",
|
|
47
|
+
"safari"
|
|
48
|
+
];
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
DEFAULT_BROWSER_TARGETS,
|
|
52
|
+
DEFAULT_DEVTOOL,
|
|
53
|
+
DEFAULT_ESBUILD_TARGET_KEYS,
|
|
54
|
+
DEFAULT_OUTPUT_PATH,
|
|
55
|
+
MESSAGE_TYPE
|
|
56
|
+
});
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IConfig } from './types';
|
|
2
|
+
type IOpts = {
|
|
3
|
+
afterMiddlewares?: any[];
|
|
4
|
+
beforeMiddlewares?: any[];
|
|
5
|
+
onDevCompileDone?: Function;
|
|
6
|
+
port?: number;
|
|
7
|
+
host?: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
rootDir?: string;
|
|
11
|
+
config: IConfig;
|
|
12
|
+
entry: Record<string, string>;
|
|
13
|
+
onBeforeMiddleware?: Function;
|
|
14
|
+
};
|
|
15
|
+
export declare function dev(opts: IOpts): Promise<void>;
|
|
16
|
+
export {};
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/dev.ts
|
|
30
|
+
var dev_exports = {};
|
|
31
|
+
__export(dev_exports, {
|
|
32
|
+
dev: () => dev
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(dev_exports);
|
|
35
|
+
var import_utils = require("@winner-fed/utils");
|
|
36
|
+
var import_assert = __toESM(require("assert"));
|
|
37
|
+
var import_server = require("./server/server");
|
|
38
|
+
var import_types = require("./types");
|
|
39
|
+
var import_checkConfig = require("./utils/checkConfig");
|
|
40
|
+
var configModule = (0, import_utils.importLazy)(
|
|
41
|
+
require.resolve("./config/config")
|
|
42
|
+
);
|
|
43
|
+
async function dev(opts) {
|
|
44
|
+
(0, import_assert.default)(opts, "opts should be supplied");
|
|
45
|
+
(0, import_checkConfig.checkConfig)(opts);
|
|
46
|
+
const rsbuildConfig = await configModule.getRsbuildConfig({
|
|
47
|
+
userConfig: opts.config,
|
|
48
|
+
env: import_types.Env.development,
|
|
49
|
+
...opts
|
|
50
|
+
});
|
|
51
|
+
await (0, import_server.createServer)({
|
|
52
|
+
cwd: opts.cwd,
|
|
53
|
+
rsbuildConfig,
|
|
54
|
+
userConfig: opts.config,
|
|
55
|
+
beforeMiddlewares: [...opts.beforeMiddlewares || []],
|
|
56
|
+
port: opts.port,
|
|
57
|
+
host: opts.host,
|
|
58
|
+
ip: opts.ip,
|
|
59
|
+
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
60
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
61
|
+
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
dev
|
|
67
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
__reExport(src_exports, require("./build"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./config/config"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./constants"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./dev"), module.exports);
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
...require("./build"),
|
|
26
|
+
...require("./config/config"),
|
|
27
|
+
...require("./constants"),
|
|
28
|
+
...require("./dev")
|
|
29
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RsbuildConfig } from '@rsbuild/core';
|
|
2
|
+
import { IConfig } from '../types';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
cwd: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
host?: string;
|
|
7
|
+
ip?: string;
|
|
8
|
+
userConfig: IConfig;
|
|
9
|
+
rsbuildConfig: RsbuildConfig;
|
|
10
|
+
beforeMiddlewares?: any[];
|
|
11
|
+
afterMiddlewares?: any[];
|
|
12
|
+
onDevCompileDone?: Function;
|
|
13
|
+
onBeforeMiddleware?: Function;
|
|
14
|
+
}
|
|
15
|
+
export declare function createServer(opts: IOpts): Promise<any>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/server/server.ts
|
|
30
|
+
var server_exports = {};
|
|
31
|
+
__export(server_exports, {
|
|
32
|
+
createServer: () => createServer
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(server_exports);
|
|
35
|
+
var import_core = require("@rsbuild/core");
|
|
36
|
+
var import_bundler_utils = require("@winner-fed/bundler-utils");
|
|
37
|
+
var import_express = __toESM(require("@winner-fed/bundler-utils/compiled/express"));
|
|
38
|
+
var import_utils = require("@winner-fed/utils");
|
|
39
|
+
async function createServer(opts) {
|
|
40
|
+
const { userConfig, rsbuildConfig } = opts;
|
|
41
|
+
const rsbuild = await (0, import_core.createRsbuild)({
|
|
42
|
+
cwd: opts.cwd,
|
|
43
|
+
rsbuildConfig
|
|
44
|
+
});
|
|
45
|
+
const app = (0, import_express.default)();
|
|
46
|
+
const rsbuildServer = await rsbuild.createDevServer();
|
|
47
|
+
if (opts.onBeforeMiddleware) {
|
|
48
|
+
opts.onBeforeMiddleware(app);
|
|
49
|
+
}
|
|
50
|
+
(opts.beforeMiddlewares || []).forEach((m) => app.use(m));
|
|
51
|
+
app.use(rsbuildServer.middlewares);
|
|
52
|
+
if (userConfig.proxy) {
|
|
53
|
+
(0, import_bundler_utils.createProxy)(userConfig.proxy, app);
|
|
54
|
+
}
|
|
55
|
+
(opts.afterMiddlewares || []).forEach((m) => {
|
|
56
|
+
app.use(m.toString().includes("{ compiler }") ? m({}) : m);
|
|
57
|
+
});
|
|
58
|
+
const httpServer = app.listen(rsbuildServer.port, async () => {
|
|
59
|
+
await rsbuildServer.afterListen();
|
|
60
|
+
const protocol = userConfig.https ? "https:" : "http:";
|
|
61
|
+
const banner = (0, import_utils.getDevBanner)(protocol, opts.host, rsbuildServer.port);
|
|
62
|
+
console.log(banner.before);
|
|
63
|
+
import_utils.logger.ready(banner.main);
|
|
64
|
+
console.log(banner.after);
|
|
65
|
+
});
|
|
66
|
+
httpServer.on("upgrade", rsbuildServer.onHTTPUpgrade);
|
|
67
|
+
rsbuild.onDevCompileDone(({ isFirstCompile, stats }) => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (opts.onDevCompileDone) {
|
|
70
|
+
const compilation = (stats == null ? void 0 : stats.compilation) || {};
|
|
71
|
+
const startTime = compilation.startTime;
|
|
72
|
+
const endTime = compilation.endTime;
|
|
73
|
+
(_a = opts.onDevCompileDone) == null ? void 0 : _a.call(opts, {
|
|
74
|
+
isFirstCompile,
|
|
75
|
+
time: endTime - startTime,
|
|
76
|
+
stats: {
|
|
77
|
+
startTime,
|
|
78
|
+
endTime
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
import_utils.logger.info(`Building with rsbuild for ${process.env.NODE_ENV}...
|
|
84
|
+
`);
|
|
85
|
+
return httpServer;
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
createServer
|
|
90
|
+
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types
|
|
3
|
+
* @Author: liwb (lwbhtml@163.com)
|
|
4
|
+
* @Date: 2024-07-16 09:15
|
|
5
|
+
* @LastEditTime: 2024-07-16 09:15
|
|
6
|
+
* @Description: types
|
|
7
|
+
*/
|
|
8
|
+
import type { HttpsServerOptions, ProxyOptions } from '@winner-fed/bundler-utils';
|
|
9
|
+
export declare enum Env {
|
|
10
|
+
development = "development",
|
|
11
|
+
production = "production"
|
|
12
|
+
}
|
|
13
|
+
export declare enum JSMinifier {
|
|
14
|
+
terser = "terser",
|
|
15
|
+
esbuild = "esbuild",
|
|
16
|
+
none = "none"
|
|
17
|
+
}
|
|
18
|
+
export interface ICopy {
|
|
19
|
+
from: string;
|
|
20
|
+
to: string;
|
|
21
|
+
}
|
|
22
|
+
export type IBabelPlugin = Function | string | [string, {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}] | [string, {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}, string];
|
|
27
|
+
export interface IConfig {
|
|
28
|
+
alias?: Record<string, string>;
|
|
29
|
+
autoCSSModules?: boolean;
|
|
30
|
+
autoprefixer?: any;
|
|
31
|
+
copy?: ICopy[] | string[];
|
|
32
|
+
define?: {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
externals?: Record<string, string>;
|
|
36
|
+
extraBabelPlugins?: IBabelPlugin[];
|
|
37
|
+
extraBabelPresets?: IBabelPlugin[];
|
|
38
|
+
extraPostCSSPlugins?: any[];
|
|
39
|
+
hash?: boolean;
|
|
40
|
+
manifest?: boolean;
|
|
41
|
+
jsMinifier?: JSMinifier | boolean;
|
|
42
|
+
jsMinifierOptions?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
lessLoader?: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
sassLoader?: {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
};
|
|
51
|
+
legacy?: {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
} | boolean;
|
|
54
|
+
outputPath?: string;
|
|
55
|
+
polyfill?: {
|
|
56
|
+
imports: string[];
|
|
57
|
+
};
|
|
58
|
+
postcssLoader?: {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
proxy?: {
|
|
62
|
+
[key: string]: ProxyOptions;
|
|
63
|
+
};
|
|
64
|
+
publicPath?: string;
|
|
65
|
+
targets?: {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
68
|
+
https?: HttpsServerOptions;
|
|
69
|
+
writeToDisk?: boolean;
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/types.ts
|
|
20
|
+
var types_exports = {};
|
|
21
|
+
__export(types_exports, {
|
|
22
|
+
Env: () => Env,
|
|
23
|
+
JSMinifier: () => JSMinifier
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
var Env = /* @__PURE__ */ ((Env2) => {
|
|
27
|
+
Env2["development"] = "development";
|
|
28
|
+
Env2["production"] = "production";
|
|
29
|
+
return Env2;
|
|
30
|
+
})(Env || {});
|
|
31
|
+
var JSMinifier = /* @__PURE__ */ ((JSMinifier2) => {
|
|
32
|
+
JSMinifier2["terser"] = "terser";
|
|
33
|
+
JSMinifier2["esbuild"] = "esbuild";
|
|
34
|
+
JSMinifier2["none"] = "none";
|
|
35
|
+
return JSMinifier2;
|
|
36
|
+
})(JSMinifier || {});
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Env,
|
|
40
|
+
JSMinifier
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkConfig(opts: any): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/utils/checkConfig.ts
|
|
30
|
+
var checkConfig_exports = {};
|
|
31
|
+
__export(checkConfig_exports, {
|
|
32
|
+
checkConfig: () => checkConfig
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(checkConfig_exports);
|
|
35
|
+
var import_assert = __toESM(require("assert"));
|
|
36
|
+
function checkConfig(opts) {
|
|
37
|
+
const unsupportedKeys = [
|
|
38
|
+
// 不支持 MFSU
|
|
39
|
+
"mfsu",
|
|
40
|
+
// 暂不支持多 entry
|
|
41
|
+
"mpa"
|
|
42
|
+
];
|
|
43
|
+
unsupportedKeys.forEach((key) => {
|
|
44
|
+
(0, import_assert.default)(!opts.config[key], `${key} is not supported in Rsbuild bundler`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
checkConfig
|
|
50
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/getBrowsersList.ts
|
|
20
|
+
var getBrowsersList_exports = {};
|
|
21
|
+
__export(getBrowsersList_exports, {
|
|
22
|
+
getBrowsersList: () => getBrowsersList
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getBrowsersList_exports);
|
|
25
|
+
function getBrowsersList({ targets = {} }) {
|
|
26
|
+
return (targets == null ? void 0 : targets.browsers) || Object.keys(targets).map((key) => {
|
|
27
|
+
return `${key} >= ${targets[key] === true ? "0" : targets[key]}`;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getBrowsersList
|
|
33
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@winner-fed/bundler-rsbuild",
|
|
3
|
+
"version": "0.9.2-alpha.1",
|
|
4
|
+
"description": "@winner-fed/bundler-rsbuild",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@rsbuild/core": "1.0.1-beta.4",
|
|
13
|
+
"@rsbuild/plugin-less": "1.0.1-beta.4",
|
|
14
|
+
"@rsbuild/plugin-node-polyfill": "1.0.3",
|
|
15
|
+
"@rsbuild/plugin-sass": "1.0.1-beta.4",
|
|
16
|
+
"@rsbuild/plugin-type-check": "1.0.1-beta.4",
|
|
17
|
+
"@winner-fed/utils": "0.9.2-alpha.1",
|
|
18
|
+
"@winner-fed/bundler-utils": "0.9.2-alpha.1"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "win-scripts father build",
|
|
25
|
+
"build:deps": "win-scripts bundleDeps",
|
|
26
|
+
"dev": "win-scripts father dev"
|
|
27
|
+
}
|
|
28
|
+
}
|