@lark-apaas/miaoda-presets 0.1.0-alpha.14 → 0.1.0-alpha.16
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/lib/recommend/rspack.js +20 -0
- package/package.json +20 -19
package/lib/recommend/rspack.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createRecommendRspackConfig = createRecommendRspackConfig;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const core_1 = __importDefault(require("@rspack/core"));
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
10
|
const RouteParserPlugin = require('../rspack-plugins/route-parser-plugin');
|
|
10
11
|
// eslint-disable-next-line max-lines-per-function
|
|
11
12
|
function createRecommendRspackConfig(options) {
|
|
@@ -170,5 +171,24 @@ function createRecommendRspackConfig(options) {
|
|
|
170
171
|
splitChunks: false, // 禁用代码分割,保持单文件输出
|
|
171
172
|
},
|
|
172
173
|
devtool: isDev ? 'source-map' : false, // 对应vite的sourcemap配置
|
|
174
|
+
devServer: {
|
|
175
|
+
headers: (req) => {
|
|
176
|
+
// 获取请求的Origin头
|
|
177
|
+
const requestOrigin = req.headers.origin ?? '';
|
|
178
|
+
// 定义允许的域名白名单
|
|
179
|
+
const allowedOrigins = [
|
|
180
|
+
'https://miaoda.feishu.cn',
|
|
181
|
+
'https://miaoda.feishu-boe.cn',
|
|
182
|
+
'https://miaoda.feishu-pre.cn'
|
|
183
|
+
];
|
|
184
|
+
// 检查请求的Origin是否在允许的列表中
|
|
185
|
+
const allowedOrigin = allowedOrigins.includes(requestOrigin)
|
|
186
|
+
? requestOrigin
|
|
187
|
+
: allowedOrigins[0]; // 默认返回第一个允许的域名
|
|
188
|
+
return {
|
|
189
|
+
'Access-Control-Allow-Origin': allowedOrigin,
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
},
|
|
173
193
|
};
|
|
174
194
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/miaoda-presets",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.16",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib"
|
|
6
6
|
],
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc && npm run copy:json",
|
|
12
|
+
"copy:json": "cp -r src/*.json lib",
|
|
13
|
+
"watch": "tsc --watch",
|
|
14
|
+
"bump": "changeset version",
|
|
15
|
+
"change": "changeset",
|
|
16
|
+
"check": "biome check --write",
|
|
17
|
+
"dev": "rslib build --watch",
|
|
18
|
+
"format": "biome format --write",
|
|
19
|
+
"storybook": "storybook dev",
|
|
20
|
+
"test": "echo 0",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
10
23
|
"dependencies": {
|
|
11
24
|
"@babel/core": "^7.28.0",
|
|
12
25
|
"@babel/parser": "^7.28.0",
|
|
13
26
|
"@babel/traverse": "^7.28.0",
|
|
14
27
|
"@babel/types": "^7.28.2",
|
|
15
28
|
"@eslint/js": "^9.34.0",
|
|
29
|
+
"@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.5",
|
|
30
|
+
"@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.6",
|
|
16
31
|
"@react-dev-inspector/middleware": "^2.0.1",
|
|
17
32
|
"@rsdoctor/rspack-plugin": "^1.1.8",
|
|
18
33
|
"@rspack/dev-server": "^1.1.3",
|
|
@@ -24,14 +39,12 @@
|
|
|
24
39
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
25
40
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
26
41
|
"globals": "^15.15.0",
|
|
27
|
-
"postcss-import": "^16.1.1",
|
|
28
42
|
"magic-string": "^0.30.18",
|
|
43
|
+
"postcss-import": "^16.1.1",
|
|
44
|
+
"tailwindcss": "^4.1.13",
|
|
29
45
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
30
46
|
"typescript-eslint": "^8.41.0",
|
|
31
|
-
"webpack-merge": "^6.0.1"
|
|
32
|
-
"tailwindcss": "^4.1.13",
|
|
33
|
-
"@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.5",
|
|
34
|
-
"@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.6"
|
|
47
|
+
"webpack-merge": "^6.0.1"
|
|
35
48
|
},
|
|
36
49
|
"devDependencies": {
|
|
37
50
|
"@babel/parser": "^7.28.4",
|
|
@@ -48,17 +61,5 @@
|
|
|
48
61
|
"peerDependencies": {
|
|
49
62
|
"react": ">=16.14.0",
|
|
50
63
|
"react-dom": ">=16.14.0"
|
|
51
|
-
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"build": "tsc && npm run copy:json",
|
|
54
|
-
"copy:json": "cp -r src/*.json lib",
|
|
55
|
-
"watch": "tsc --watch",
|
|
56
|
-
"bump": "changeset version",
|
|
57
|
-
"change": "changeset",
|
|
58
|
-
"check": "biome check --write",
|
|
59
|
-
"dev": "rslib build --watch",
|
|
60
|
-
"format": "biome format --write",
|
|
61
|
-
"storybook": "storybook dev",
|
|
62
|
-
"test": "echo 0"
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
}
|