@lark-apaas/miaoda-presets 0.1.0-alpha.8 → 1.0.0

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.
@@ -15,8 +15,8 @@ function createEslintConfig() {
15
15
  return typescript_eslint_1.default.config({ ignores: ['dist', 'node_modules', 'build'] }, {
16
16
  extends: [
17
17
  js_1.default.configs.recommended,
18
- eslint_1.default,
19
18
  ...typescript_eslint_1.default.configs.recommended,
19
+ eslint_1.default,
20
20
  ],
21
21
  files: ['src/**/*.{ts,tsx}'],
22
22
  languageOptions: {
@@ -18,11 +18,26 @@ exports.default = {
18
18
  'react/no-unknown-property': 'off', // 允许未知属性
19
19
  'react-hooks/exhaustive-deps': 'off', // 不强制检查依赖数组
20
20
  // JavaScript 基础规则
21
- 'no-undef': 'error', // 禁止使用未声明的变量
21
+ // 通过 tsc 来控制,默认 AI 不写 js 文件
22
+ 'no-undef': 'off', // 禁止使用未声明的变量
22
23
  'no-console': 'off', // 允许使用 console
23
24
  'prefer-const': 'off', // 不强制使用 const
24
25
  // Import 相关检查
25
26
  'import/no-unresolved': 'error', // 检查导入路径是否存在
26
27
  'import/named': 'error', // 检查命名导入是否存在
28
+ // 效果相关:模型不会
29
+ 'no-constant-binary-expression': 'off', // 不强制使用常量二进制表达式
30
+ // 效果相关:希望模型使用内置 logger
31
+ 'no-restricted-syntax': [
32
+ 'error',
33
+ {
34
+ selector: "CallExpression[callee.object.name='console'][callee.property.name=/^(log|warn|info|debug|trace)$/]",
35
+ message: 'Avoid using console.log, console.warn, etc. Use `@byted/spark-framework/logger` instead.',
36
+ },
37
+ {
38
+ message: "Please don't use window.confirm, use `Dialog` component instead for better user experience and consistency",
39
+ selector: "MemberExpression[object.name='window'][property.name='confirm']",
40
+ },
41
+ ],
27
42
  },
28
43
  };
@@ -6,11 +6,11 @@ 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
10
+ const RouteParserPlugin = require('../rspack-plugins/route-parser-plugin');
9
11
  // eslint-disable-next-line max-lines-per-function
10
12
  function createRecommendRspackConfig(options) {
11
- const { enableReactRrefresh = false, isDev = true } = options;
12
- console.log('isDev:', isDev);
13
- console.log('enableReactRrefresh:', enableReactRrefresh);
13
+ const { enableReactRefresh = false, isDev = true, needRoutes = true, runtimeMode = 'fullstack', } = options;
14
14
  return {
15
15
  experiments: {
16
16
  css: true,
@@ -37,7 +37,31 @@ function createRecommendRspackConfig(options) {
37
37
  },
38
38
  {
39
39
  test: /\.css$/,
40
- use: ['postcss-loader'],
40
+ use: [
41
+ {
42
+ loader: 'postcss-loader',
43
+ options: {
44
+ postcssOptions: {
45
+ plugins: [
46
+ [
47
+ 'postcss-import',
48
+ {
49
+ resolve: (id, _basedir) => {
50
+ // 只有dev环境需要打包选中精调所需的一些预置样式, prod环境则不打包
51
+ if (id === '@/inspector.dev.css') {
52
+ return isDev
53
+ ? path_1.default.join(_basedir, '/inspector.dev.css')
54
+ : [];
55
+ }
56
+ return id;
57
+ },
58
+ },
59
+ ],
60
+ ],
61
+ },
62
+ },
63
+ },
64
+ ],
41
65
  type: 'css',
42
66
  },
43
67
  {
@@ -63,7 +87,7 @@ function createRecommendRspackConfig(options) {
63
87
  }
64
88
  : {}),
65
89
  development: isDev,
66
- refresh: enableReactRrefresh,
90
+ refresh: enableReactRefresh,
67
91
  },
68
92
  },
69
93
  },
@@ -91,52 +115,87 @@ function createRecommendRspackConfig(options) {
91
115
  new core_1.default.DefinePlugin({
92
116
  'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
93
117
  'process.env.CWD': JSON.stringify(process.cwd()),
118
+ 'process.env.runtimeMode': JSON.stringify(runtimeMode),
94
119
  }),
95
120
  new core_1.default.optimize.LimitChunkCountPlugin({
96
121
  maxChunks: 1,
97
122
  }),
123
+ // 开发环境下,解析路由
124
+ isDev &&
125
+ needRoutes &&
126
+ new RouteParserPlugin({
127
+ appPath: './client/src/app.tsx',
128
+ outputPath: path_1.default.resolve(__dirname, 'dist/client/routes.json'),
129
+ }),
98
130
  ],
99
- optimization: isDev ? {} : {
100
- moduleIds: 'deterministic',
101
- concatenateModules: true,
102
- minimize: true, // 对应vite的minify配置
103
- minimizer: [
104
- new core_1.default.SwcJsMinimizerRspackPlugin({
105
- minimizerOptions: {
106
- // 保持不压缩
107
- minify: !isDev,
108
- mangle: !isDev,
109
- format: {
110
- beautify: isDev,
111
- comments: false,
112
- },
113
- compress: {
114
- keep_classnames: true,
115
- keep_fnames: true,
116
- keep_fargs: !isDev,
117
- unused: true,
118
- dead_code: true,
119
- drop_debugger: true,
120
- // FIXME: 先临时开始 console.log
121
- // drop_console: !isDev,
122
- const_to_let: !isDev,
123
- booleans_as_integers: !isDev,
124
- booleans: !isDev,
125
- // maybe unsafe
126
- reduce_funcs: !isDev,
127
- reduce_vars: !isDev,
131
+ optimization: isDev
132
+ ? {}
133
+ : {
134
+ moduleIds: 'deterministic',
135
+ concatenateModules: true,
136
+ minimize: true, // 对应vite的minify配置
137
+ minimizer: [
138
+ new core_1.default.SwcJsMinimizerRspackPlugin({
139
+ minimizerOptions: {
140
+ // 保持不压缩
141
+ minify: !isDev,
142
+ mangle: !isDev,
143
+ format: {
144
+ beautify: isDev,
145
+ comments: false,
146
+ },
147
+ compress: {
148
+ keep_classnames: true,
149
+ keep_fnames: true,
150
+ keep_fargs: !isDev,
151
+ unused: true,
152
+ dead_code: true,
153
+ drop_debugger: true,
154
+ // FIXME: 先临时开始 console.log
155
+ // drop_console: !isDev,
156
+ const_to_let: !isDev,
157
+ booleans_as_integers: !isDev,
158
+ booleans: !isDev,
159
+ // maybe unsafe
160
+ reduce_funcs: !isDev,
161
+ reduce_vars: !isDev,
162
+ },
128
163
  },
129
- },
130
- }),
131
- new core_1.default.LightningCssMinimizerRspackPlugin(),
132
- ],
133
- sideEffects: true,
134
- usedExports: true,
135
- innerGraph: true,
136
- providedExports: true,
137
- mergeDuplicateChunks: true,
138
- splitChunks: false, // 禁用代码分割,保持单文件输出
139
- },
164
+ }),
165
+ new core_1.default.LightningCssMinimizerRspackPlugin(),
166
+ ],
167
+ sideEffects: true,
168
+ usedExports: true,
169
+ innerGraph: true,
170
+ providedExports: true,
171
+ mergeDuplicateChunks: true,
172
+ splitChunks: false, // 禁用代码分割,保持单文件输出
173
+ },
140
174
  devtool: isDev ? 'source-map' : false, // 对应vite的sourcemap配置
175
+ devServer: {
176
+ headers: (req) => {
177
+ // 获取请求的Origin头
178
+ const requestOrigin = req.headers.origin ?? '';
179
+ // 定义允许的域名白名单
180
+ const allowedOrigins = [
181
+ 'https://miaoda.feishu.cn',
182
+ 'https://miaoda.feishu-boe.cn',
183
+ 'https://miaoda.feishu-pre.cn',
184
+ ];
185
+ // 检查请求的Origin是否在允许的列表中
186
+ const allowedOrigin = allowedOrigins.includes(requestOrigin)
187
+ ? requestOrigin
188
+ : allowedOrigins[0]; // 默认返回第一个允许的域名
189
+ return {
190
+ 'Access-Control-Allow-Origin': allowedOrigin,
191
+ };
192
+ },
193
+ client: {
194
+ overlay: {
195
+ errors: false,
196
+ warnings: false,
197
+ }
198
+ }
199
+ },
141
200
  };
142
201
  }
@@ -37,12 +37,23 @@ exports.createRecommendTailwindConfig = createRecommendTailwindConfig;
37
37
  const path = __importStar(require("path"));
38
38
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
39
  function createRecommendTailwindConfig(options) {
40
+ // 默认扫描外网包依赖
41
+ const { packageName = '@lark-apaas/client-toolkit' } = options;
42
+ let pkgPath = '';
43
+ if (packageName) {
44
+ try {
45
+ // 扫描依赖中的tailwind样式
46
+ pkgPath = path.join(path.dirname(require.resolve(packageName)), '/**/*.js');
47
+ }
48
+ catch (e) {
49
+ console.warn(`Failed to resolve package ${packageName}, use default path`);
50
+ }
51
+ }
40
52
  return {
41
53
  darkMode: 'class',
42
54
  content: [
43
- // 让 framework 里的 tailwind 生效
44
- path.join(path.dirname(require.resolve('@lark-apaas/client-core')), '/**/*.js'),
45
- ],
55
+ pkgPath,
56
+ ].filter(Boolean),
46
57
  prefix: '',
47
58
  plugins: [],
48
59
  };
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const crypto = require('crypto');
5
+ const { parse } = require('@babel/parser');
6
+ const traverse = require('@babel/traverse').default;
7
+ const t = require('@babel/types');
8
+ class RouteParserPlugin {
9
+ constructor(options = {}) {
10
+ this.options = {
11
+ appPath: options.appPath || './client/src/app.tsx',
12
+ outputPath: options.outputPath || './dist/client/routes.json',
13
+ ...options
14
+ };
15
+ // 缓存相关属性 - 直接存储在实例上
16
+ this.lastAppPathHash = null;
17
+ this.cachedRoutes = null;
18
+ }
19
+ // 统一的日志函数
20
+ log(level, message, ...args) {
21
+ const prefix = '[route-parser]';
22
+ const logMessage = `${prefix} ${message}`;
23
+ switch (level) {
24
+ case 'log':
25
+ console.log(logMessage, ...args);
26
+ break;
27
+ case 'warn':
28
+ console.warn(logMessage, ...args);
29
+ break;
30
+ case 'error':
31
+ console.error(logMessage, ...args);
32
+ break;
33
+ case 'info':
34
+ console.info(logMessage, ...args);
35
+ break;
36
+ default:
37
+ console.log(logMessage, ...args);
38
+ }
39
+ }
40
+ apply(compiler) {
41
+ const pluginName = 'RouteParserPlugin';
42
+ compiler.hooks.emit.tapAsync(pluginName, (compilation, callback) => {
43
+ try {
44
+ // 检查是否需要重新生成路由
45
+ if (this.shouldRegenerateRoutes()) {
46
+ const routes = this.parseRoutes();
47
+ this.cachedRoutes = routes;
48
+ }
49
+ const routesJson = JSON.stringify(this.cachedRoutes, null, 2);
50
+ // 将 routes.json 添加到编译输出中
51
+ compilation.assets['routes.json'] = {
52
+ source: () => routesJson,
53
+ size: () => routesJson.length
54
+ };
55
+ callback();
56
+ }
57
+ catch (error) {
58
+ this.log('warn', '⚠️ 路由解析失败,使用默认路由:', error.message);
59
+ // 解析失败时使用默认路由
60
+ const defaultRoutes = [{ path: '/' }];
61
+ const routesJson = JSON.stringify(defaultRoutes, null, 2);
62
+ compilation.assets['routes.json'] = {
63
+ source: () => routesJson,
64
+ size: () => routesJson.length
65
+ };
66
+ callback();
67
+ }
68
+ });
69
+ }
70
+ shouldRegenerateRoutes() {
71
+ try {
72
+ const appFilePath = path.resolve(process.cwd(), this.options.appPath);
73
+ if (!fs.existsSync(appFilePath)) {
74
+ this.log('warn', `⚠️ App.tsx 文件不存在: ${appFilePath}`);
75
+ return false;
76
+ }
77
+ // 计算当前文件的哈希值
78
+ const currentHash = this.calculateFileHash(appFilePath);
79
+ // 检查内存中的缓存
80
+ if (this.lastAppPathHash === currentHash && this.cachedRoutes) {
81
+ return false; // 不需要重新生成
82
+ }
83
+ this.lastAppPathHash = currentHash;
84
+ return true; // 需要重新生成
85
+ }
86
+ catch (error) {
87
+ this.log('warn', '⚠️ 检查文件变更时出错:', error.message);
88
+ return true; // 出错时重新生成
89
+ }
90
+ }
91
+ calculateFileHash(filePath) {
92
+ try {
93
+ const content = fs.readFileSync(filePath, 'utf-8');
94
+ return crypto.createHash('md5').update(content).digest('hex');
95
+ }
96
+ catch (error) {
97
+ this.log('warn', '⚠️ 计算文件哈希失败:', error.message);
98
+ return null;
99
+ }
100
+ }
101
+ parseRoutes() {
102
+ try {
103
+ const appFilePath = path.resolve(process.cwd(), this.options.appPath);
104
+ if (!fs.existsSync(appFilePath)) {
105
+ throw new Error(`App.tsx 文件不存在: ${appFilePath}`);
106
+ }
107
+ const sourceCode = fs.readFileSync(appFilePath, 'utf-8');
108
+ // 解析 TypeScript/JSX 代码
109
+ const ast = parse(sourceCode, {
110
+ sourceType: 'module',
111
+ plugins: [
112
+ 'jsx',
113
+ 'typescript',
114
+ 'decorators-legacy',
115
+ 'classProperties',
116
+ 'objectRestSpread',
117
+ 'functionBind',
118
+ 'exportDefaultFrom',
119
+ 'exportNamespaceFrom',
120
+ 'dynamicImport',
121
+ 'nullishCoalescingOperator',
122
+ 'optionalChaining'
123
+ ]
124
+ });
125
+ // 使用 Set 来存储路径,自动去重
126
+ const routeSet = new Set();
127
+ // 用于跟踪路由嵌套
128
+ const routeStack = [];
129
+ const self = this;
130
+ traverse(ast, {
131
+ JSXElement: {
132
+ enter(path) {
133
+ const { openingElement } = path.node;
134
+ // 检查是否是 Route 组件
135
+ if (self.isRouteComponent(openingElement)) {
136
+ const routeInfo = self.extractRouteInfo(openingElement);
137
+ // 将当前路由信息推入堆栈
138
+ routeStack.push(routeInfo);
139
+ }
140
+ },
141
+ exit(path) {
142
+ const { openingElement } = path.node;
143
+ // 当离开 Route 元素时,从堆栈中弹出
144
+ if (self.isRouteComponent(openingElement)) {
145
+ const currentRoute = routeStack.pop();
146
+ // 跳过通配符路径
147
+ if (currentRoute && currentRoute.path === '*') {
148
+ return;
149
+ }
150
+ // 如果有路径或是索引路由
151
+ if (currentRoute && (currentRoute.path || currentRoute.index)) {
152
+ const fullPath = self.buildFullPath(routeStack, currentRoute);
153
+ if (fullPath) {
154
+ routeSet.add(fullPath);
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ });
161
+ // 将 Set 转换为数组返回
162
+ const routes = Array.from(routeSet).map(routePath => ({ path: routePath }));
163
+ return routes.length > 0 ? routes : [{ path: '/' }];
164
+ }
165
+ catch (error) {
166
+ // 如果解析失败,返回默认路由
167
+ this.log('warn', '⚠️ 路由解析失败,使用默认路由:', error.message);
168
+ return [{ path: '/' }];
169
+ }
170
+ }
171
+ isRouteComponent(openingElement) {
172
+ return (t.isJSXIdentifier(openingElement.name) &&
173
+ openingElement.name.name === 'Route');
174
+ }
175
+ isRoutesComponent(path) {
176
+ const openingElement = path.node.openingElement;
177
+ return (t.isJSXIdentifier(openingElement.name) &&
178
+ openingElement.name.name === 'Routes');
179
+ }
180
+ extractRouteInfo(openingElement) {
181
+ const routeInfo = {};
182
+ // 提取所有属性
183
+ openingElement.attributes.forEach((attr) => {
184
+ if (t.isJSXAttribute(attr)) {
185
+ const { name } = attr.name;
186
+ let value;
187
+ // 处理不同类型的属性值
188
+ if (attr.value) {
189
+ if (t.isStringLiteral(attr.value)) {
190
+ value = attr.value.value;
191
+ }
192
+ else if (t.isJSXExpressionContainer(attr.value)) {
193
+ const expression = attr.value.expression;
194
+ if (t.isStringLiteral(expression)) {
195
+ value = expression.value;
196
+ }
197
+ else if (t.isTemplateLiteral(expression)) {
198
+ // 处理模板字符串
199
+ value = this.evaluateTemplateLiteral(expression);
200
+ }
201
+ else {
202
+ // 对于其他表达式,设为 true
203
+ value = true;
204
+ }
205
+ }
206
+ }
207
+ else {
208
+ // 对于没有值的属性(如 index),设为 true
209
+ value = true;
210
+ }
211
+ routeInfo[name] = value;
212
+ }
213
+ });
214
+ return routeInfo;
215
+ }
216
+ getJSXAttribute(element, name) {
217
+ return element.attributes.find(attr => t.isJSXAttribute(attr) &&
218
+ t.isJSXIdentifier(attr.name) &&
219
+ attr.name.name === name);
220
+ }
221
+ buildFullPath(routeStack, currentRoute) {
222
+ // 构建完整路径
223
+ let fullPath = '';
224
+ // 遍历堆栈中的所有父路由
225
+ for (let i = 0; i < routeStack.length; i++) {
226
+ if (routeStack[i].path) {
227
+ // 确保路径格式正确(开头有/,结尾没有/)
228
+ let parentPath = routeStack[i].path;
229
+ if (!parentPath.startsWith('/'))
230
+ parentPath = `/${parentPath}`;
231
+ if (parentPath.endsWith('/') && parentPath !== '/') {
232
+ parentPath = parentPath.slice(0, -1);
233
+ }
234
+ fullPath += parentPath === '/' ? '' : parentPath;
235
+ }
236
+ }
237
+ // 添加当前路由的路径
238
+ if (currentRoute.index) {
239
+ // 索引路由使用父路由的路径
240
+ return fullPath || '/';
241
+ }
242
+ else if (currentRoute.path) {
243
+ const routePath = currentRoute.path;
244
+ // 跳过通配符路径
245
+ if (routePath === '*') {
246
+ return null;
247
+ }
248
+ // 处理相对路径(不以/开头的路径)
249
+ if (!routePath.startsWith('/')) {
250
+ fullPath = `${fullPath}/${routePath}`;
251
+ }
252
+ else {
253
+ fullPath = routePath; // 绝对路径覆盖父路径
254
+ }
255
+ // 确保路径格式正确
256
+ if (fullPath === '')
257
+ fullPath = '/';
258
+ if (!fullPath.startsWith('/'))
259
+ fullPath = `/${fullPath}`;
260
+ return fullPath;
261
+ }
262
+ return null;
263
+ }
264
+ evaluateTemplateLiteral(templateLiteral) {
265
+ // 简单处理模板字符串,这里主要处理 `*` 这种情况
266
+ const quasis = templateLiteral.quasis;
267
+ const expressions = templateLiteral.expressions;
268
+ if (quasis.length === 1 && expressions.length === 0) {
269
+ return quasis[0].value.raw;
270
+ }
271
+ // 对于复杂的模板字符串,返回原始字符串
272
+ return quasis.map(q => q.value.raw).join('');
273
+ }
274
+ }
275
+ module.exports = RouteParserPlugin;
@@ -8,13 +8,14 @@ const path_1 = __importDefault(require("path"));
8
8
  const core_1 = __importDefault(require("@rspack/core"));
9
9
  const rspack_1 = require("./recommend/rspack");
10
10
  const webpack_merge_1 = __importDefault(require("webpack-merge"));
11
+ // 妙搭应用使用的rspack配置
11
12
  // eslint-disable-next-line max-lines-per-function
12
13
  function createRspackConfig(options) {
13
- const { enableReactRrefresh = false, isDev = true } = options;
14
- console.log('isDev:', isDev);
15
- console.log('enableReactRrefresh:', enableReactRrefresh);
14
+ const { enableReactRefresh = false, isDevBuildMode = true } = options;
15
+ console.log('isDevBuildMode:', isDevBuildMode);
16
+ console.log('enableReactRefresh:', enableReactRefresh);
16
17
  // 构建外部依赖配置,对应vite的rollupOptions.external和globals
17
- const externals = isDev
18
+ const externals = isDevBuildMode
18
19
  ? {
19
20
  antd: 'antd',
20
21
  '@ant-design/icons': 'icons',
@@ -25,11 +26,13 @@ function createRspackConfig(options) {
25
26
  }
26
27
  : {};
27
28
  const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({
28
- enableReactRrefresh,
29
- isDev,
29
+ enableReactRefresh,
30
+ isDev: isDevBuildMode,
31
+ needRoutes: false,
32
+ runtimeMode: '',
30
33
  });
31
34
  return (0, webpack_merge_1.default)(recommendConfig, {
32
- mode: isDev ? 'development' : 'production',
35
+ mode: isDevBuildMode ? 'development' : 'production',
33
36
  entry: './src/index.tsx',
34
37
  output: {
35
38
  publicPath: '/',
@@ -60,7 +63,7 @@ function createRspackConfig(options) {
60
63
  },
61
64
  extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
62
65
  },
63
- devServer: isDev
66
+ devServer: isDevBuildMode
64
67
  ? undefined
65
68
  : {
66
69
  host: '::',
@@ -90,5 +93,46 @@ function createRspackConfig(options) {
90
93
  },
91
94
  }),
92
95
  ],
96
+ optimization: {
97
+ moduleIds: 'deterministic',
98
+ concatenateModules: true,
99
+ minimize: true, // 对应vite的minify配置
100
+ minimizer: [
101
+ new core_1.default.SwcJsMinimizerRspackPlugin({
102
+ minimizerOptions: {
103
+ // 保持不压缩
104
+ minify: !isDevBuildMode,
105
+ mangle: !isDevBuildMode,
106
+ format: {
107
+ beautify: isDevBuildMode,
108
+ comments: false,
109
+ },
110
+ compress: {
111
+ keep_classnames: true,
112
+ keep_fnames: true,
113
+ keep_fargs: !isDevBuildMode,
114
+ unused: true,
115
+ dead_code: true,
116
+ drop_debugger: true,
117
+ // FIXME: 先临时开始 console.log
118
+ // drop_console: !isDevBuildMode,
119
+ const_to_let: !isDevBuildMode,
120
+ booleans_as_integers: !isDevBuildMode,
121
+ booleans: !isDevBuildMode,
122
+ // maybe unsafe
123
+ reduce_funcs: !isDevBuildMode,
124
+ reduce_vars: !isDevBuildMode,
125
+ },
126
+ },
127
+ }),
128
+ new core_1.default.LightningCssMinimizerRspackPlugin(),
129
+ ],
130
+ sideEffects: true,
131
+ usedExports: true,
132
+ innerGraph: true,
133
+ providedExports: true,
134
+ mergeDuplicateChunks: true,
135
+ splitChunks: false, // 禁用代码分割,保持单文件输出
136
+ },
93
137
  });
94
138
  }
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createTailwindConfig = createTailwindConfig;
7
7
  const webpack_merge_1 = __importDefault(require("webpack-merge"));
8
8
  const tailwind_1 = require("./recommend/tailwind");
9
+ /** 妙搭使用的tailwind配置 */
9
10
  function createTailwindConfig(options) {
10
11
  const { isDevBuildMode = true } = options;
11
12
  const recommendConfig = (0, tailwind_1.createRecommendTailwindConfig)({
12
13
  isDev: isDevBuildMode,
14
+ // 妙搭需要扫描内网包
15
+ packageName: '@byted/spark-framework',
13
16
  });
14
17
  return (0, webpack_merge_1.default)(recommendConfig, {
15
18
  content: ['./src/**/*.{ts,tsx}'],
package/package.json CHANGED
@@ -1,18 +1,33 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-presets",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "1.0.0",
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": "^1.0.0",
30
+ "@lark-apaas/miaoda-inspector-jsx-runtime": "^1.0.0",
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",
@@ -25,14 +40,16 @@
25
40
  "eslint-plugin-react-refresh": "^0.4.20",
26
41
  "globals": "^15.15.0",
27
42
  "magic-string": "^0.30.18",
43
+ "postcss-import": "^16.1.1",
44
+ "tailwindcss": "^4.1.13",
28
45
  "tsconfig-paths-webpack-plugin": "^4.2.0",
29
46
  "typescript-eslint": "^8.41.0",
30
- "webpack-merge": "^6.0.1",
31
- "tailwindcss": "^4.1.13",
32
- "@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.1",
33
- "@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.2"
47
+ "webpack-merge": "^6.0.1"
34
48
  },
35
49
  "devDependencies": {
50
+ "@babel/parser": "^7.28.4",
51
+ "@babel/traverse": "^7.28.4",
52
+ "@babel/types": "^7.28.4",
36
53
  "@biomejs/biome": "2.0.6",
37
54
  "@changesets/cli": "^2.29.5",
38
55
  "@rspack/core": "^1.4.4",
@@ -44,17 +61,5 @@
44
61
  "peerDependencies": {
45
62
  "react": ">=16.14.0",
46
63
  "react-dom": ">=16.14.0"
47
- },
48
- "scripts": {
49
- "build": "tsc && npm run copy:json",
50
- "copy:json": "cp -r src/*.json lib",
51
- "watch": "tsc --watch",
52
- "bump": "changeset version",
53
- "change": "changeset",
54
- "check": "biome check --write",
55
- "dev": "rslib build --watch",
56
- "format": "biome format --write",
57
- "storybook": "storybook dev",
58
- "test": "echo 0"
59
64
  }
60
- }
65
+ }