@lark-apaas/miaoda-presets 0.1.0-alpha.4 → 0.1.0-alpha.6
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/eslint.config.js +5 -1
- package/lib/external-js-loader.js +2 -2
- package/lib/recommend/rspack.js +4 -2
- package/lib/rspack.config.js +8 -3
- package/lib/tailwind.config.js +3 -1
- package/package.json +17 -18
package/lib/eslint.config.js
CHANGED
|
@@ -13,7 +13,11 @@ const eslint_1 = __importDefault(require("./recommend/eslint"));
|
|
|
13
13
|
const importPlugin = require('eslint-plugin-import');
|
|
14
14
|
function createEslintConfig() {
|
|
15
15
|
return typescript_eslint_1.default.config({ ignores: ['dist', 'node_modules', 'build'] }, {
|
|
16
|
-
extends: [
|
|
16
|
+
extends: [
|
|
17
|
+
js_1.default.configs.recommended,
|
|
18
|
+
eslint_1.default,
|
|
19
|
+
...typescript_eslint_1.default.configs.recommended,
|
|
20
|
+
],
|
|
17
21
|
files: ['src/**/*.{ts,tsx}'],
|
|
18
22
|
languageOptions: {
|
|
19
23
|
ecmaVersion: 2020,
|
|
@@ -58,7 +58,7 @@ function loadScriptsWithDeps() {
|
|
|
58
58
|
// Create loading promise for this script
|
|
59
59
|
const loadingPromise = Promise.all(
|
|
60
60
|
// Map dependencies to promises
|
|
61
|
-
script.deps.map(
|
|
61
|
+
script.deps.map(dep => loadWithDeps(dep)))
|
|
62
62
|
.then(() => {
|
|
63
63
|
// After all dependencies are loaded, load this script
|
|
64
64
|
return loadScript(script.src);
|
|
@@ -73,7 +73,7 @@ function loadScriptsWithDeps() {
|
|
|
73
73
|
return loadingPromise;
|
|
74
74
|
}
|
|
75
75
|
// Load all scripts
|
|
76
|
-
return Promise.all(Object.keys(scripts).map(
|
|
76
|
+
return Promise.all(Object.keys(scripts).map(name => loadWithDeps(name)));
|
|
77
77
|
}
|
|
78
78
|
// Start loading all scripts
|
|
79
79
|
window.__FEISUDA_SCRIPTS_LOADED__ = loadScriptsWithDeps();
|
package/lib/recommend/rspack.js
CHANGED
|
@@ -69,7 +69,9 @@ function createRecommendRspackConfig(options) {
|
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
|
-
...(isDev
|
|
72
|
+
...(isDev
|
|
73
|
+
? [require.resolve('@lark-apaas/miaoda-inspector-babel-plugin')]
|
|
74
|
+
: []),
|
|
73
75
|
],
|
|
74
76
|
},
|
|
75
77
|
],
|
|
@@ -94,7 +96,7 @@ function createRecommendRspackConfig(options) {
|
|
|
94
96
|
maxChunks: 1,
|
|
95
97
|
}),
|
|
96
98
|
],
|
|
97
|
-
optimization: {
|
|
99
|
+
optimization: isDev ? {} : {
|
|
98
100
|
moduleIds: 'deterministic',
|
|
99
101
|
concatenateModules: true,
|
|
100
102
|
minimize: true, // 对应vite的minify配置
|
package/lib/rspack.config.js
CHANGED
|
@@ -24,7 +24,10 @@ function createRspackConfig(options) {
|
|
|
24
24
|
echarts: 'echarts',
|
|
25
25
|
}
|
|
26
26
|
: {};
|
|
27
|
-
const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({
|
|
27
|
+
const recommendConfig = (0, rspack_1.createRecommendRspackConfig)({
|
|
28
|
+
enableReactRrefresh,
|
|
29
|
+
isDev,
|
|
30
|
+
});
|
|
28
31
|
return (0, webpack_merge_1.default)(recommendConfig, {
|
|
29
32
|
mode: isDev ? 'development' : 'production',
|
|
30
33
|
entry: './src/index.tsx',
|
|
@@ -33,13 +36,15 @@ function createRspackConfig(options) {
|
|
|
33
36
|
// path: path.resolve(__dirname, 'dist'),
|
|
34
37
|
filename: 'assets/index.js',
|
|
35
38
|
cssFilename: 'assets/index.css',
|
|
36
|
-
assetModuleFilename:
|
|
39
|
+
assetModuleFilename: pathData => {
|
|
37
40
|
// 对应vite的assetFileNames逻辑
|
|
38
41
|
const ext = path_1.default.extname(pathData.filename || '');
|
|
39
42
|
if (ext === '.css') {
|
|
40
43
|
return 'assets/index.css';
|
|
41
44
|
}
|
|
42
|
-
return pathData.filename
|
|
45
|
+
return pathData.filename
|
|
46
|
+
? `assets/${pathData.filename}`
|
|
47
|
+
: 'assets/asset-[hash][ext]';
|
|
43
48
|
},
|
|
44
49
|
library: {
|
|
45
50
|
type: 'self', // 对应vite的iife格式
|
package/lib/tailwind.config.js
CHANGED
|
@@ -8,7 +8,9 @@ const webpack_merge_1 = __importDefault(require("webpack-merge"));
|
|
|
8
8
|
const tailwind_1 = require("./recommend/tailwind");
|
|
9
9
|
function createTailwindConfig(options) {
|
|
10
10
|
const { isDevBuildMode = true } = options;
|
|
11
|
-
const recommendConfig = (0, tailwind_1.createRecommendTailwindConfig)({
|
|
11
|
+
const recommendConfig = (0, tailwind_1.createRecommendTailwindConfig)({
|
|
12
|
+
isDev: isDevBuildMode,
|
|
13
|
+
});
|
|
12
14
|
return (0, webpack_merge_1.default)(recommendConfig, {
|
|
13
15
|
content: ['./src/**/*.{ts,tsx}'],
|
|
14
16
|
});
|
package/package.json
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/miaoda-presets",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.6",
|
|
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
|
-
},
|
|
23
10
|
"dependencies": {
|
|
24
|
-
"@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.1",
|
|
25
|
-
"@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.2",
|
|
26
11
|
"@babel/core": "^7.28.0",
|
|
27
12
|
"@babel/parser": "^7.28.0",
|
|
28
13
|
"@babel/traverse": "^7.28.0",
|
|
@@ -43,7 +28,9 @@
|
|
|
43
28
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
44
29
|
"typescript-eslint": "^8.41.0",
|
|
45
30
|
"webpack-merge": "^6.0.1",
|
|
46
|
-
"tailwindcss": "^4.1.13"
|
|
31
|
+
"tailwindcss": "^4.1.13",
|
|
32
|
+
"@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.2",
|
|
33
|
+
"@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.1"
|
|
47
34
|
},
|
|
48
35
|
"devDependencies": {
|
|
49
36
|
"@biomejs/biome": "2.0.6",
|
|
@@ -57,5 +44,17 @@
|
|
|
57
44
|
"peerDependencies": {
|
|
58
45
|
"react": ">=16.14.0",
|
|
59
46
|
"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"
|
|
60
59
|
}
|
|
61
|
-
}
|
|
60
|
+
}
|