@qse/edu-scripts 2.0.0 → 2.0.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/CHANGELOG.md +4 -0
- package/dist/cli.mjs +14 -8
- package/package.json +21 -15
- package/pnpm-workspace.yaml +2 -0
- package/src/cli.ts +2 -1
- package/src/config/plugins/mock-server/index.ts +1 -1
- package/src/config/webpackConfig.ts +8 -3
- package/src/utils/esm-register.ts +6 -0
package/CHANGELOG.md
CHANGED
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import "@swc-node/register/esm-register";
|
|
4
3
|
import fs from "fs-extra";
|
|
5
4
|
import path from "path";
|
|
6
5
|
import { globby, globbySync } from "globby";
|
|
@@ -13,8 +12,9 @@ import { RspackDevServer } from "@rspack/dev-server";
|
|
|
13
12
|
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
|
|
14
13
|
import ReactRefreshPlugin from "@rspack/plugin-react-refresh";
|
|
15
14
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
15
|
+
import path$1 from "node:path";
|
|
16
16
|
import chokidar from "chokidar";
|
|
17
|
-
import { debounce, memoize } from "
|
|
17
|
+
import { debounce, memoize } from "es-toolkit";
|
|
18
18
|
import express from "express";
|
|
19
19
|
import cookieParser from "cookie-parser";
|
|
20
20
|
import multer from "multer";
|
|
@@ -31,6 +31,11 @@ import { checkbox, input, select } from "@inquirer/prompts";
|
|
|
31
31
|
import cp from "child_process";
|
|
32
32
|
import tmp from "tmp";
|
|
33
33
|
|
|
34
|
+
//#region src/utils/esm-register.ts
|
|
35
|
+
const { register } = createRequire(import.meta.url)("@swc-node/register/register");
|
|
36
|
+
register();
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
34
39
|
//#region src/config/paths.ts
|
|
35
40
|
function resolveApp(...filePath) {
|
|
36
41
|
return path.resolve(process.cwd(), ...filePath);
|
|
@@ -147,6 +152,12 @@ if (appPkg$2.eslintConfig) {
|
|
|
147
152
|
console.log(chalk.yellow("export default config"));
|
|
148
153
|
}
|
|
149
154
|
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/utils/resolveModule.ts
|
|
157
|
+
function resolveModule(mod) {
|
|
158
|
+
return mod.default ? mod.default : mod;
|
|
159
|
+
}
|
|
160
|
+
|
|
150
161
|
//#endregion
|
|
151
162
|
//#region src/config/plugins/postcss-safe-area.ts
|
|
152
163
|
const expr = new RegExp(`env\\(\\s*(${[
|
|
@@ -165,12 +176,6 @@ const PostcssSafeAreaPlugin = () => {
|
|
|
165
176
|
};
|
|
166
177
|
};
|
|
167
178
|
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region src/utils/resolveModule.ts
|
|
170
|
-
function resolveModule(mod) {
|
|
171
|
-
return mod.default ? mod.default : mod;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
179
|
//#endregion
|
|
175
180
|
//#region src/config/webpackConfig.ts
|
|
176
181
|
const require$2 = createRequire(import.meta.url);
|
|
@@ -294,6 +299,7 @@ function getWebpackConfig(args, override) {
|
|
|
294
299
|
resolve: {
|
|
295
300
|
alias: {
|
|
296
301
|
"@": paths.src,
|
|
302
|
+
"@swc/helpers": path$1.dirname(require$2.resolve("@swc/helpers/package.json")),
|
|
297
303
|
...override.alias
|
|
298
304
|
},
|
|
299
305
|
extensions: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qse/edu-scripts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"author": "Kinoko",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"homepage": "http://192.168.10.19:3339/qsxxwapdev/edu-scripts/",
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"registry": "https://registry.npmjs.org/",
|
|
27
|
-
"access": "public"
|
|
28
|
-
"tag": "beta"
|
|
27
|
+
"access": "public"
|
|
29
28
|
},
|
|
30
29
|
"bin": {
|
|
31
30
|
"edu-scripts": "dist/cli.mjs",
|
|
@@ -35,6 +34,7 @@
|
|
|
35
34
|
"typings": "dist/index.d.mts",
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@babel/core": "~7.29.0",
|
|
37
|
+
"@inquirer/prompts": "^8.3.0",
|
|
38
38
|
"@qse/ssh-sftp": "^1.3.1",
|
|
39
39
|
"@rsdoctor/rspack-plugin": "^1.5.2",
|
|
40
40
|
"@rspack/core": "^1.7.6",
|
|
@@ -48,38 +48,37 @@
|
|
|
48
48
|
"chokidar": "^3.6.0",
|
|
49
49
|
"cookie-parser": "^1.4.7",
|
|
50
50
|
"css-loader": "^6.11.0",
|
|
51
|
-
"cssnano": "^
|
|
51
|
+
"cssnano": "^7.1.3",
|
|
52
|
+
"es-toolkit": "^1.45.1",
|
|
52
53
|
"express": "^4.21.2",
|
|
53
54
|
"filesize": "^8.0.7",
|
|
54
55
|
"fs-extra": "^11.3.3",
|
|
55
56
|
"globby": "^16.1.1",
|
|
56
57
|
"gzip-size": "^7.0.0",
|
|
57
58
|
"html-webpack-plugin": "^5.6.6",
|
|
58
|
-
"@inquirer/prompts": "^8.3.0",
|
|
59
59
|
"less": "^3.13.1",
|
|
60
60
|
"less-loader": "^10.2.0",
|
|
61
|
-
"lodash-es": "^4.17.23",
|
|
62
61
|
"multer": "^2.1.0",
|
|
63
62
|
"ora": "^9.3.0",
|
|
64
|
-
"path-to-regexp": "^
|
|
63
|
+
"path-to-regexp": "^8.3.0",
|
|
65
64
|
"postcss": "^8.5.3",
|
|
66
65
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
67
|
-
"postcss-loader": "^
|
|
66
|
+
"postcss-loader": "^8.2.1",
|
|
68
67
|
"postcss-momentum-scrolling": "^3.14.22",
|
|
69
|
-
"postcss-normalize": "^
|
|
70
|
-
"postcss-preset-env": "^
|
|
68
|
+
"postcss-normalize": "^13.0.1",
|
|
69
|
+
"postcss-preset-env": "^11.2.0",
|
|
71
70
|
"prettier": "^3.8.1",
|
|
72
71
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
73
|
-
"react-refresh": "^0.
|
|
72
|
+
"react-refresh": "^0.18.0",
|
|
74
73
|
"recursive-readdir": "^2.2.3",
|
|
75
74
|
"semver": "^7.7.1",
|
|
76
|
-
"strip-ansi": "^
|
|
77
|
-
"style-loader": "^
|
|
75
|
+
"strip-ansi": "^7.2.0",
|
|
76
|
+
"style-loader": "^4.0.0",
|
|
78
77
|
"tailwindcss": "^3.4.19",
|
|
79
78
|
"tmp": "^0.2.3",
|
|
80
79
|
"typescript": "^5.9.3",
|
|
81
80
|
"url-loader": "^4.1.1",
|
|
82
|
-
"yargs": "^
|
|
81
|
+
"yargs": "^18.0.0"
|
|
83
82
|
},
|
|
84
83
|
"devDependencies": {
|
|
85
84
|
"@babel/preset-env": "~7.29.0",
|
|
@@ -88,7 +87,6 @@
|
|
|
88
87
|
"@types/cookie-parser": "^1.4.10",
|
|
89
88
|
"@types/fs-extra": "^11.0.4",
|
|
90
89
|
"@types/jest": "^30.0.0",
|
|
91
|
-
"@types/lodash-es": "^4.17.12",
|
|
92
90
|
"@types/multer": "^2.0.0",
|
|
93
91
|
"@types/semver": "^7.7.1",
|
|
94
92
|
"@types/tmp": "^0.2.6",
|
|
@@ -98,5 +96,13 @@
|
|
|
98
96
|
"rimraf": "^6.1.3",
|
|
99
97
|
"tsdown": "^0.20.3",
|
|
100
98
|
"vitepress": "^1.6.4"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"tailwindcss": "^3.0.0"
|
|
102
|
+
},
|
|
103
|
+
"peerDependenciesMeta": {
|
|
104
|
+
"tailwindcss": {
|
|
105
|
+
"optional": true
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import paths from '../../paths'
|
|
2
2
|
import { globbySync } from 'globby'
|
|
3
3
|
import chokidar from 'chokidar'
|
|
4
|
-
import { debounce, memoize } from '
|
|
4
|
+
import { debounce, memoize } from 'es-toolkit'
|
|
5
5
|
import chalk from 'chalk'
|
|
6
6
|
import fs from 'fs-extra'
|
|
7
7
|
import express from 'express'
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { resolveModule } from '@/utils/resolveModule'
|
|
1
2
|
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
|
|
3
|
+
import type { Compiler, Configuration, RuleSetRule, SwcLoaderOptions } from '@rspack/core'
|
|
2
4
|
import { rspack } from '@rspack/core'
|
|
3
|
-
import type { Configuration, Compiler, RuleSetRule, SwcLoaderOptions } from '@rspack/core'
|
|
4
5
|
import ReactRefreshPlugin from '@rspack/plugin-react-refresh'
|
|
5
6
|
import chalk from 'chalk'
|
|
6
7
|
import fs from 'fs-extra'
|
|
7
8
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
8
9
|
import { createRequire } from 'node:module'
|
|
10
|
+
import path from 'node:path'
|
|
9
11
|
import appConfig from '../utils/appConfig'
|
|
10
12
|
import type { Configuration as CustomConfiguration } from '../utils/defineConfig'
|
|
11
13
|
import paths from './paths'
|
|
12
14
|
import PostcssSafeAreaPlugin from './plugins/postcss-safe-area'
|
|
13
|
-
import { resolveModule } from '@/utils/resolveModule'
|
|
14
15
|
|
|
15
16
|
const require = createRequire(import.meta.url)
|
|
16
17
|
const appPkg = fs.readJsonSync(paths.package) as { name: string; version: string }
|
|
@@ -200,6 +201,7 @@ export default function getWebpackConfig(args: any, override: CustomConfiguratio
|
|
|
200
201
|
resolve: {
|
|
201
202
|
alias: {
|
|
202
203
|
'@': paths.src,
|
|
204
|
+
'@swc/helpers': path.dirname(require.resolve('@swc/helpers/package.json')),
|
|
203
205
|
...override.alias,
|
|
204
206
|
},
|
|
205
207
|
extensions: ['.web.js', '.web.mjs', '.js', '.mjs', '.jsx', '.ts', '.tsx', '.json', '.wasm'],
|
|
@@ -402,7 +404,10 @@ export default function getWebpackConfig(args: any, override: CustomConfiguratio
|
|
|
402
404
|
/@rspack\/dev-server\/client\/index\.js/,
|
|
403
405
|
(resource) => {
|
|
404
406
|
const myClientPath = paths.resolveOwn('asset', 'rspack-dev-server-client.js')
|
|
405
|
-
resource.request = resource.request.replace(
|
|
407
|
+
resource.request = resource.request.replace(
|
|
408
|
+
/.*dev-server\/client\/index\.js/,
|
|
409
|
+
myClientPath
|
|
410
|
+
)
|
|
406
411
|
}
|
|
407
412
|
),
|
|
408
413
|
new rspack.IgnorePlugin({
|