rsbuild-pipe 1.0.7 → 1.1.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 +15 -0
- package/lib/rsbuild.extend.config.ts +29 -23
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -4,6 +4,21 @@ rsbuild开发和打包管道
|
|
|
4
4
|
|
|
5
5
|
## Change Log
|
|
6
6
|
|
|
7
|
+
### v1.1.1
|
|
8
|
+
```
|
|
9
|
+
修改cesium代码的处理逻辑
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### v1.1.0
|
|
13
|
+
```
|
|
14
|
+
rsbuild依赖升级到1.0.2
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### v1.0.7
|
|
18
|
+
```
|
|
19
|
+
临时修改getBabelConfig bug
|
|
20
|
+
```
|
|
21
|
+
|
|
7
22
|
### v1.0.6
|
|
8
23
|
```
|
|
9
24
|
将rsbuild.extend.config.ts中的getBabelConfig参数设置了修改
|
|
@@ -56,7 +56,10 @@ interface GetNodePolyfillParams {
|
|
|
56
56
|
srcDirPath: string, // cesium engine的基础目录路基
|
|
57
57
|
distDirPath: string, // 目标路径
|
|
58
58
|
modifyCodeEnable?: boolean, // 是否允许修改源代码
|
|
59
|
-
|
|
59
|
+
codeFindContent?: string | RegExp, // 查找内容
|
|
60
|
+
codeReplaceContent?: string, // 替换内容
|
|
61
|
+
},
|
|
62
|
+
extraDisposeFn?: (config: RsbuildConfig) => RsbuildConfig,
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -64,14 +67,14 @@ interface GetNodePolyfillParams {
|
|
|
64
67
|
* 配置node-polyfill
|
|
65
68
|
*/
|
|
66
69
|
export const getNodePolyfillConfig = ({nodePolyfillOptions = {}, cesiumEngine }: GetNodePolyfillParams): RsbuildConfig => {
|
|
67
|
-
|
|
70
|
+
let config: RsbuildConfig = {};
|
|
68
71
|
|
|
69
72
|
// 配置cesiumEngine
|
|
70
73
|
if (cesiumEngine) {
|
|
71
|
-
const { enable = true, options } = cesiumEngine;
|
|
74
|
+
const { enable = true, options, extraDisposeFn } = cesiumEngine;
|
|
72
75
|
|
|
73
76
|
if (enable) {
|
|
74
|
-
const { srcDirPath, distDirPath, modifyCodeEnable = true } = options;
|
|
77
|
+
const { srcDirPath, distDirPath, modifyCodeEnable = true, codeFindContent, codeReplaceContent } = options;
|
|
75
78
|
config.output = {
|
|
76
79
|
copy: [
|
|
77
80
|
// { from: path.join(srcDirPath, 'Build/Workers'), to: distDirPath+'/Workers' },
|
|
@@ -128,25 +131,25 @@ export const getNodePolyfillConfig = ({nodePolyfillOptions = {}, cesiumEngine }:
|
|
|
128
131
|
const fs = require('fs');
|
|
129
132
|
const srcFilePath = `${srcDirPath}/Source/Scene/Scene.js`;
|
|
130
133
|
const data = fs.readFileSync(srcFilePath, 'utf-8');
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
b
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
134
|
+
|
|
135
|
+
let findStr: string | RegExp = /function\s+frontToBack\s*\(([^)]*)\)\s*{([^}]*)}/
|
|
136
|
+
if(codeFindContent) findStr = codeFindContent;
|
|
137
|
+
|
|
138
|
+
let replacedStr = `function frontToBack(a, b, position) {
|
|
139
|
+
// When distances are equal equal favor sorting b before a. This gives render priority to commands later in the list.
|
|
140
|
+
try{
|
|
141
|
+
return (
|
|
142
|
+
a.boundingVolume.distanceSquaredTo(position) -
|
|
143
|
+
b.boundingVolume.distanceSquaredTo(position) +
|
|
144
|
+
CesiumMath.EPSILON12
|
|
145
|
+
);
|
|
146
|
+
}catch(e){
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
}`
|
|
150
|
+
if(codeReplaceContent) replacedStr = codeReplaceContent;
|
|
151
|
+
|
|
152
|
+
const replaced = data.replace(findStr, replacedStr);
|
|
150
153
|
|
|
151
154
|
fs.writeFileSync(srcFilePath, replaced, 'utf-8')
|
|
152
155
|
}
|
|
@@ -178,6 +181,9 @@ export const getNodePolyfillConfig = ({nodePolyfillOptions = {}, cesiumEngine }:
|
|
|
178
181
|
helper.copy(path.join(srcDirPath, 'Build/Workers'), dist)
|
|
179
182
|
}, 3000)
|
|
180
183
|
}
|
|
184
|
+
|
|
185
|
+
// 额外处理函数
|
|
186
|
+
if(extraDisposeFn) config = extraDisposeFn(config)
|
|
181
187
|
}
|
|
182
188
|
}
|
|
183
189
|
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsbuild-pipe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"author": "chencheng <daniel_txy@163.com>",
|
|
5
5
|
"description": "rsbuild pipe",
|
|
6
6
|
"main": "index",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@rsbuild/core": "0.
|
|
9
|
-
"@rsbuild/plugin-babel": "0.
|
|
10
|
-
"@rsbuild/plugin-basic-ssl": "
|
|
11
|
-
"@rsbuild/plugin-less": "0.
|
|
12
|
-
"@rsbuild/plugin-node-polyfill": "0.
|
|
13
|
-
"@rsbuild/plugin-react": "0.
|
|
14
|
-
"@rsbuild/plugin-sass": "0.
|
|
15
|
-
"@rsbuild/plugin-svgr": "0.
|
|
16
|
-
"@rsbuild/plugin-type-check": "0.
|
|
17
|
-
"@types/node": "
|
|
8
|
+
"@rsbuild/core": "1.0.2",
|
|
9
|
+
"@rsbuild/plugin-babel": "1.0.1",
|
|
10
|
+
"@rsbuild/plugin-basic-ssl": "1.1.1",
|
|
11
|
+
"@rsbuild/plugin-less": "1.0.1",
|
|
12
|
+
"@rsbuild/plugin-node-polyfill": "1.0.4",
|
|
13
|
+
"@rsbuild/plugin-react": "1.0.1",
|
|
14
|
+
"@rsbuild/plugin-sass": "1.0.1",
|
|
15
|
+
"@rsbuild/plugin-svgr": "1.0.1",
|
|
16
|
+
"@rsbuild/plugin-type-check": "1.0.1",
|
|
17
|
+
"@types/node": "22.5.4",
|
|
18
18
|
"deepmerge": "4.3.1",
|
|
19
|
-
"sass": "1.
|
|
19
|
+
"sass": "1.78.0"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://gitee.com/cloud_soldier/rsbuild-pipe#readme",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"typescript": "5.
|
|
31
|
+
"typescript": "5.6.2"
|
|
32
32
|
}
|
|
33
33
|
}
|