@bundlekit/service 0.0.1 → 0.0.3
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 +111 -0
- package/dist/index.cjs +53 -36
- package/dist/index.mjs +44 -45
- package/package.json +14 -8
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# @bundlekit/service
|
|
2
|
+
|
|
3
|
+
BundleKit 核心服务,提供开发服务和生产构建功能,支持 5 种主流打包器。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @bundlekit/service
|
|
9
|
+
# 或
|
|
10
|
+
pnpm add -D @bundlekit/service
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 使用
|
|
14
|
+
|
|
15
|
+
### 开发服务
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ds serve
|
|
19
|
+
ds serve --bundler vite
|
|
20
|
+
ds serve --bundler webpack --https
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 生产构建
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
ds build
|
|
27
|
+
ds build --bundler vite --mode production
|
|
28
|
+
ds build --bundler rspack --mode staging
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 命令行选项
|
|
32
|
+
|
|
33
|
+
| 命令 | 说明 |
|
|
34
|
+
|------|------|
|
|
35
|
+
| `ds serve` | 启动开发服务 |
|
|
36
|
+
| `ds build` | 执行生产构建 |
|
|
37
|
+
|
|
38
|
+
| 选项 | 说明 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| `--bundler` | 指定打包器(vite/webpack/rspack/rollup/rolldown) |
|
|
41
|
+
| `--mode` | 构建模式(development/production/staging) |
|
|
42
|
+
| `--https` | 启用 HTTPS |
|
|
43
|
+
| `--skip-plugin` | 跳过指定插件 |
|
|
44
|
+
|
|
45
|
+
## 配置文件
|
|
46
|
+
|
|
47
|
+
在项目根目录创建 `.bundlekitrc.ts`:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { defineConfig } from '@bundlekit/service';
|
|
51
|
+
|
|
52
|
+
export default defineConfig({
|
|
53
|
+
config: {
|
|
54
|
+
development: {
|
|
55
|
+
entry: 'src/index.tsx',
|
|
56
|
+
output: { dir: 'dist', filename: '[name].js' },
|
|
57
|
+
devServer: {
|
|
58
|
+
open: true,
|
|
59
|
+
port: 3000,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
production: {
|
|
63
|
+
entry: 'src/index.tsx',
|
|
64
|
+
output: { dir: 'dist', filename: '[name].[hash].js' },
|
|
65
|
+
minify: true,
|
|
66
|
+
sourcemap: false,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## SSR 支持
|
|
73
|
+
|
|
74
|
+
所有 5 个 bundler 都支持 SSR 双产物构建:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
export default defineConfig({
|
|
78
|
+
config: {
|
|
79
|
+
production: {
|
|
80
|
+
entry: 'src/entry-client.tsx',
|
|
81
|
+
output: { dir: 'dist/client', filename: '[name].js' },
|
|
82
|
+
ssr: {
|
|
83
|
+
entry: 'src/entry-server.tsx',
|
|
84
|
+
output: { dir: 'dist/server', filename: 'server.cjs' },
|
|
85
|
+
externals: 'auto',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 插件系统
|
|
93
|
+
|
|
94
|
+
支持动态加载插件:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
plugins: [
|
|
99
|
+
'@bundlekit/plugin-react',
|
|
100
|
+
'@bundlekit/plugin-mock',
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 文档
|
|
106
|
+
|
|
107
|
+
完整文档请访问 [https://bundlekit.harhao.workers.dev](https://bundlekit.harhao.workers.dev)
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
ISC
|
package/dist/index.cjs
CHANGED
|
@@ -1030,46 +1030,55 @@ const isPrerelease = (type) => {
|
|
|
1030
1030
|
|
|
1031
1031
|
var truncate_1 = truncate$1;
|
|
1032
1032
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
this.max = 1000;
|
|
1036
|
-
this.map = new Map();
|
|
1037
|
-
}
|
|
1033
|
+
var lrucache;
|
|
1034
|
+
var hasRequiredLrucache;
|
|
1038
1035
|
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
return undefined
|
|
1043
|
-
} else {
|
|
1044
|
-
// Remove the key from the map and add it to the end
|
|
1045
|
-
this.map.delete(key);
|
|
1046
|
-
this.map.set(key, value);
|
|
1047
|
-
return value
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1036
|
+
function requireLrucache () {
|
|
1037
|
+
if (hasRequiredLrucache) return lrucache;
|
|
1038
|
+
hasRequiredLrucache = 1;
|
|
1050
1039
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1040
|
+
class LRUCache {
|
|
1041
|
+
constructor () {
|
|
1042
|
+
this.max = 1000;
|
|
1043
|
+
this.map = new Map();
|
|
1044
|
+
}
|
|
1054
1045
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1046
|
+
get (key) {
|
|
1047
|
+
const value = this.map.get(key);
|
|
1048
|
+
if (value === undefined) {
|
|
1049
|
+
return undefined
|
|
1050
|
+
} else {
|
|
1051
|
+
// Remove the key from the map and add it to the end
|
|
1052
|
+
this.map.delete(key);
|
|
1053
|
+
this.map.set(key, value);
|
|
1054
|
+
return value
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
1057
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
const firstKey = this.map.keys().next().value;
|
|
1062
|
-
this.delete(firstKey);
|
|
1063
|
-
}
|
|
1058
|
+
delete (key) {
|
|
1059
|
+
return this.map.delete(key)
|
|
1060
|
+
}
|
|
1064
1061
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1062
|
+
set (key, value) {
|
|
1063
|
+
const deleted = this.delete(key);
|
|
1067
1064
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1065
|
+
if (!deleted && value !== undefined) {
|
|
1066
|
+
// If cache is full, delete the least recently used item
|
|
1067
|
+
if (this.map.size >= this.max) {
|
|
1068
|
+
const firstKey = this.map.keys().next().value;
|
|
1069
|
+
this.delete(firstKey);
|
|
1070
|
+
}
|
|
1071
1071
|
|
|
1072
|
-
|
|
1072
|
+
this.map.set(key, value);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
return this
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
lrucache = LRUCache;
|
|
1080
|
+
return lrucache;
|
|
1081
|
+
}
|
|
1073
1082
|
|
|
1074
1083
|
var range;
|
|
1075
1084
|
var hasRequiredRange;
|
|
@@ -1292,7 +1301,7 @@ function requireRange () {
|
|
|
1292
1301
|
|
|
1293
1302
|
range = Range;
|
|
1294
1303
|
|
|
1295
|
-
const LRU =
|
|
1304
|
+
const LRU = requireLrucache();
|
|
1296
1305
|
const cache = new LRU();
|
|
1297
1306
|
|
|
1298
1307
|
const parseOptions = parseOptions_1;
|
|
@@ -2686,7 +2695,7 @@ var minimist = function (args, opts) {
|
|
|
2686
2695
|
var minimist$1 = /*@__PURE__*/getDefaultExportFromCjs(minimist);
|
|
2687
2696
|
|
|
2688
2697
|
var name = "@bundlekit/service";
|
|
2689
|
-
var version = "0.0.
|
|
2698
|
+
var version = "0.0.3";
|
|
2690
2699
|
var main = "./dist/index.cjs";
|
|
2691
2700
|
var module$1 = "./dist/index.mjs";
|
|
2692
2701
|
var cjs = "./dist/index.cjs";
|
|
@@ -2761,7 +2770,13 @@ var keywords = [
|
|
|
2761
2770
|
"ds"
|
|
2762
2771
|
];
|
|
2763
2772
|
var author = "harhao@163.com";
|
|
2764
|
-
var license = "
|
|
2773
|
+
var license = "MIT";
|
|
2774
|
+
var website = "https://bundlekit.harhao.workers.dev";
|
|
2775
|
+
var repository = {
|
|
2776
|
+
type: "git",
|
|
2777
|
+
url: "https://github.com/Harhao/bundlekit.git",
|
|
2778
|
+
directory: "packages/bundlekit-service"
|
|
2779
|
+
};
|
|
2765
2780
|
var publishConfig = {
|
|
2766
2781
|
registry: "https://registry.npmjs.org/",
|
|
2767
2782
|
access: "public"
|
|
@@ -2787,6 +2802,8 @@ var pkg = {
|
|
|
2787
2802
|
keywords: keywords,
|
|
2788
2803
|
author: author,
|
|
2789
2804
|
license: license,
|
|
2805
|
+
website: website,
|
|
2806
|
+
repository: repository,
|
|
2790
2807
|
publishConfig: publishConfig,
|
|
2791
2808
|
engines: engines
|
|
2792
2809
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1004,56 +1004,47 @@ const isPrerelease = (type) => {
|
|
|
1004
1004
|
|
|
1005
1005
|
var truncate_1 = truncate$1;
|
|
1006
1006
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
hasRequiredLrucache = 1;
|
|
1013
|
-
|
|
1014
|
-
class LRUCache {
|
|
1015
|
-
constructor () {
|
|
1016
|
-
this.max = 1000;
|
|
1017
|
-
this.map = new Map();
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
get (key) {
|
|
1021
|
-
const value = this.map.get(key);
|
|
1022
|
-
if (value === undefined) {
|
|
1023
|
-
return undefined
|
|
1024
|
-
} else {
|
|
1025
|
-
// Remove the key from the map and add it to the end
|
|
1026
|
-
this.map.delete(key);
|
|
1027
|
-
this.map.set(key, value);
|
|
1028
|
-
return value
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1007
|
+
class LRUCache {
|
|
1008
|
+
constructor () {
|
|
1009
|
+
this.max = 1000;
|
|
1010
|
+
this.map = new Map();
|
|
1011
|
+
}
|
|
1031
1012
|
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1013
|
+
get (key) {
|
|
1014
|
+
const value = this.map.get(key);
|
|
1015
|
+
if (value === undefined) {
|
|
1016
|
+
return undefined
|
|
1017
|
+
} else {
|
|
1018
|
+
// Remove the key from the map and add it to the end
|
|
1019
|
+
this.map.delete(key);
|
|
1020
|
+
this.map.set(key, value);
|
|
1021
|
+
return value
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1035
1024
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1025
|
+
delete (key) {
|
|
1026
|
+
return this.map.delete(key)
|
|
1027
|
+
}
|
|
1038
1028
|
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
if (this.map.size >= this.max) {
|
|
1042
|
-
const firstKey = this.map.keys().next().value;
|
|
1043
|
-
this.delete(firstKey);
|
|
1044
|
-
}
|
|
1029
|
+
set (key, value) {
|
|
1030
|
+
const deleted = this.delete(key);
|
|
1045
1031
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1032
|
+
if (!deleted && value !== undefined) {
|
|
1033
|
+
// If cache is full, delete the least recently used item
|
|
1034
|
+
if (this.map.size >= this.max) {
|
|
1035
|
+
const firstKey = this.map.keys().next().value;
|
|
1036
|
+
this.delete(firstKey);
|
|
1037
|
+
}
|
|
1048
1038
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
}
|
|
1039
|
+
this.map.set(key, value);
|
|
1040
|
+
}
|
|
1052
1041
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1042
|
+
return this
|
|
1043
|
+
}
|
|
1055
1044
|
}
|
|
1056
1045
|
|
|
1046
|
+
var lrucache = LRUCache;
|
|
1047
|
+
|
|
1057
1048
|
var range;
|
|
1058
1049
|
var hasRequiredRange;
|
|
1059
1050
|
|
|
@@ -1275,7 +1266,7 @@ function requireRange () {
|
|
|
1275
1266
|
|
|
1276
1267
|
range = Range;
|
|
1277
1268
|
|
|
1278
|
-
const LRU =
|
|
1269
|
+
const LRU = lrucache;
|
|
1279
1270
|
const cache = new LRU();
|
|
1280
1271
|
|
|
1281
1272
|
const parseOptions = parseOptions_1;
|
|
@@ -2669,7 +2660,7 @@ var minimist = function (args, opts) {
|
|
|
2669
2660
|
var minimist$1 = /*@__PURE__*/getDefaultExportFromCjs(minimist);
|
|
2670
2661
|
|
|
2671
2662
|
var name = "@bundlekit/service";
|
|
2672
|
-
var version = "0.0.
|
|
2663
|
+
var version = "0.0.3";
|
|
2673
2664
|
var main = "./dist/index.cjs";
|
|
2674
2665
|
var module$1 = "./dist/index.mjs";
|
|
2675
2666
|
var cjs = "./dist/index.cjs";
|
|
@@ -2744,7 +2735,13 @@ var keywords = [
|
|
|
2744
2735
|
"ds"
|
|
2745
2736
|
];
|
|
2746
2737
|
var author = "harhao@163.com";
|
|
2747
|
-
var license = "
|
|
2738
|
+
var license = "MIT";
|
|
2739
|
+
var website = "https://bundlekit.harhao.workers.dev";
|
|
2740
|
+
var repository = {
|
|
2741
|
+
type: "git",
|
|
2742
|
+
url: "https://github.com/Harhao/bundlekit.git",
|
|
2743
|
+
directory: "packages/bundlekit-service"
|
|
2744
|
+
};
|
|
2748
2745
|
var publishConfig = {
|
|
2749
2746
|
registry: "https://registry.npmjs.org/",
|
|
2750
2747
|
access: "public"
|
|
@@ -2770,6 +2767,8 @@ var pkg = {
|
|
|
2770
2767
|
keywords: keywords,
|
|
2771
2768
|
author: author,
|
|
2772
2769
|
license: license,
|
|
2770
|
+
website: website,
|
|
2771
|
+
repository: repository,
|
|
2773
2772
|
publishConfig: publishConfig,
|
|
2774
2773
|
engines: engines
|
|
2775
2774
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bundlekit/service",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"cjs": "./dist/index.cjs",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"jiti": "^2.4.2",
|
|
26
26
|
"minimist": "^1.2.8",
|
|
27
27
|
"semver": "^7.7.1",
|
|
28
|
-
"@bundlekit/shared-utils": "0.0.
|
|
28
|
+
"@bundlekit/shared-utils": "0.0.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@bundlekit/bundler-
|
|
32
|
-
"@bundlekit/bundler-
|
|
33
|
-
"@bundlekit/bundler-
|
|
34
|
-
"@bundlekit/bundler-
|
|
35
|
-
"@bundlekit/bundler-
|
|
31
|
+
"@bundlekit/bundler-webpack": "0.0.3",
|
|
32
|
+
"@bundlekit/bundler-vite": "0.0.3",
|
|
33
|
+
"@bundlekit/bundler-rspack": "0.0.3",
|
|
34
|
+
"@bundlekit/bundler-rollup": "0.0.3",
|
|
35
|
+
"@bundlekit/bundler-rolldown": "0.0.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@bundlekit/bundler-webpack": {
|
|
@@ -70,7 +70,13 @@
|
|
|
70
70
|
"ds"
|
|
71
71
|
],
|
|
72
72
|
"author": "harhao@163.com",
|
|
73
|
-
"license": "
|
|
73
|
+
"license": "MIT",
|
|
74
|
+
"website": "https://bundlekit.harhao.workers.dev",
|
|
75
|
+
"repository": {
|
|
76
|
+
"type": "git",
|
|
77
|
+
"url": "https://github.com/Harhao/bundlekit.git",
|
|
78
|
+
"directory": "packages/bundlekit-service"
|
|
79
|
+
},
|
|
74
80
|
"publishConfig": {
|
|
75
81
|
"registry": "https://registry.npmjs.org/",
|
|
76
82
|
"access": "public"
|