@qse/edu-scripts 2.0.4 → 2.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/CHANGELOG.md +4 -0
- package/README.md +5 -1
- package/dist/cli.mjs +367 -362
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/package.json +16 -16
- package/src/auto-refactor.ts +6 -6
- package/src/build.ts +15 -10
- package/src/cli.ts +5 -6
- package/src/commit-dist.ts +3 -2
- package/src/config/paths.ts +1 -1
- package/src/config/plugins/mock-server/defineMock.ts +1 -0
- package/src/config/plugins/mock-server/index.ts +9 -6
- package/src/config/plugins/postcss-safe-area.ts +1 -0
- package/src/config/webpackConfig.ts +11 -8
- package/src/config/webpackDevServerConfig.ts +6 -1
- package/src/deploy.ts +16 -10
- package/src/generator.ts +3 -2
- package/src/index.ts +1 -1
- package/src/start.ts +2 -1
- package/src/utils/FileSizeReporter.ts +5 -4
- package/src/utils/appConfig.ts +2 -1
- package/src/utils/beforeStart.ts +3 -2
- package/src/utils/changeDeployVersion.ts +1 -1
- package/src/utils/defineConfig.ts +1 -1
- package/src/utils/esm-register.ts +1 -0
- package/src/utils/exec.ts +1 -0
- package/src/utils/getConfig.ts +0 -2
- package/src/utils/getOverride.ts +4 -2
- package/tsdown.config.ts +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Chalk } from "chalk";
|
|
2
2
|
import { Compiler, Configuration, SwcLoaderOptions } from "@rspack/core";
|
|
3
|
-
import { Configuration as Configuration$1 } from "@rspack/dev-server";
|
|
4
3
|
import { RequestHandler } from "express";
|
|
4
|
+
import { Configuration as Configuration$1 } from "@rspack/dev-server";
|
|
5
5
|
|
|
6
|
+
//#region src/config/plugins/mock-server/defineMock.d.ts
|
|
7
|
+
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
|
|
8
|
+
type API = string;
|
|
9
|
+
type MockConfig = Record<`${Method} ${API}`, string | number | null | undefined | boolean | Record<string, any> | RequestHandler>;
|
|
10
|
+
declare function defineMock(config: MockConfig): MockConfig;
|
|
11
|
+
//#endregion
|
|
6
12
|
//#region src/utils/defineConfig.d.ts
|
|
7
13
|
type ProxyConfigArray = NonNullable<Configuration$1['proxy']>;
|
|
8
14
|
type Configuration$2 = {
|
|
@@ -81,10 +87,4 @@ type Configuration$2 = {
|
|
|
81
87
|
};
|
|
82
88
|
declare function defineConfig(config: Configuration$2): Configuration$2;
|
|
83
89
|
//#endregion
|
|
84
|
-
//#region src/config/plugins/mock-server/defineMock.d.ts
|
|
85
|
-
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
|
|
86
|
-
type API = string;
|
|
87
|
-
type MockConfig = Record<`${Method} ${API}`, string | number | null | undefined | boolean | Record<string, any> | RequestHandler>;
|
|
88
|
-
declare function defineMock(config: MockConfig): MockConfig;
|
|
89
|
-
//#endregion
|
|
90
90
|
export { defineConfig, defineMock };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
function
|
|
1
|
+
//#region src/config/plugins/mock-server/defineMock.ts
|
|
2
|
+
function defineMock(config) {
|
|
3
3
|
return config;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
//#endregion
|
|
7
|
-
//#region src/
|
|
8
|
-
function
|
|
7
|
+
//#region src/utils/defineConfig.ts
|
|
8
|
+
function defineConfig(config) {
|
|
9
9
|
return config;
|
|
10
10
|
}
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qse/edu-scripts",
|
|
3
|
-
"version": "2.0.4",
|
|
4
|
-
"author": "Kinoko",
|
|
5
|
-
"license": "MIT",
|
|
6
3
|
"type": "module",
|
|
4
|
+
"version": "2.1.1",
|
|
7
5
|
"description": "教育工程化基础框架",
|
|
6
|
+
"author": "Kinoko",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "http://192.168.10.19:3339/qsxxwapdev/edu-scripts/",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"registry": "https://registry.npmjs.org/",
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"main": "dist/index.mjs",
|
|
14
|
+
"types": "dist/index.d.mts",
|
|
15
|
+
"bin": {
|
|
16
|
+
"edu-scripts": "dist/cli.mjs",
|
|
17
|
+
"edu": "dist/cli.mjs"
|
|
18
|
+
},
|
|
8
19
|
"engines": {
|
|
9
20
|
"node": ">=18"
|
|
10
21
|
},
|
|
@@ -21,21 +32,10 @@
|
|
|
21
32
|
"postversion": "npm run release",
|
|
22
33
|
"test": "jest"
|
|
23
34
|
},
|
|
24
|
-
"homepage": "http://192.168.10.19:3339/qsxxwapdev/edu-scripts/",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"registry": "https://registry.npmjs.org/",
|
|
27
|
-
"access": "public"
|
|
28
|
-
},
|
|
29
|
-
"bin": {
|
|
30
|
-
"edu-scripts": "dist/cli.mjs",
|
|
31
|
-
"edu": "dist/cli.mjs"
|
|
32
|
-
},
|
|
33
|
-
"main": "dist/index.mjs",
|
|
34
|
-
"typings": "dist/index.d.mts",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/core": "~7.29.0",
|
|
37
37
|
"@inquirer/prompts": "^8.3.0",
|
|
38
|
-
"@qse/ssh-sftp": "^1.
|
|
38
|
+
"@qse/ssh-sftp": "^1.4.0",
|
|
39
39
|
"@rsdoctor/rspack-plugin": "^1.5.2",
|
|
40
40
|
"@rspack/core": "^1.7.6",
|
|
41
41
|
"@rspack/dev-server": "^1.2.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/preset-env": "~7.29.0",
|
|
86
86
|
"@babel/preset-typescript": "^7.28.5",
|
|
87
|
-
"@qse/eslint-config": "^1.
|
|
87
|
+
"@qse/eslint-config": "^1.1.2",
|
|
88
88
|
"@types/cookie-parser": "^1.4.10",
|
|
89
89
|
"@types/fs-extra": "^11.0.4",
|
|
90
90
|
"@types/jest": "^30.0.0",
|
package/src/auto-refactor.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import paths from './config/paths'
|
|
3
|
-
import path from 'path'
|
|
1
|
+
import { checkbox, input, select } from '@inquirer/prompts'
|
|
4
2
|
import chalk from 'chalk'
|
|
3
|
+
import fs from 'fs-extra'
|
|
5
4
|
import { globby } from 'globby'
|
|
6
5
|
import ora from 'ora'
|
|
7
|
-
import
|
|
6
|
+
import path from 'path'
|
|
7
|
+
|
|
8
|
+
import paths from './config/paths'
|
|
8
9
|
|
|
9
10
|
const pkg = fs.readJsonSync(paths.resolveOwn('package.json'))
|
|
10
11
|
|
|
@@ -39,8 +40,7 @@ export default async function autoRefactor() {
|
|
|
39
40
|
const version = await input({
|
|
40
41
|
message: '版本号',
|
|
41
42
|
default: '1.0.0',
|
|
42
|
-
validate: (v) =>
|
|
43
|
-
/^\d+\.\d+\.\d+$/.test(v) || '请按格式输入 /^\\d+\\.\\d+\\.\\d+$/ 例如: 1.0.0',
|
|
43
|
+
validate: (v) => /^\d+\.\d+\.\d+$/.test(v) || '请按格式输入 /^\\d+\\.\\d+\\.\\d+$/ 例如: 1.0.0',
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
const mode = await select({
|
package/src/build.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Stats } from '@rspack/core'
|
|
2
|
+
|
|
3
|
+
import { rspack } from '@rspack/core'
|
|
2
4
|
import chalk from 'chalk'
|
|
3
|
-
import getConfig from './utils/getConfig'
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { measureFileSizesBeforeBuild, printFileSizesAfterBuild } from './utils/FileSizeReporter'
|
|
6
|
-
import paths from './config/paths'
|
|
7
5
|
import fs from 'fs-extra'
|
|
8
|
-
import appConfig from './utils/appConfig'
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
import paths from './config/paths'
|
|
8
|
+
import appConfig from './utils/appConfig'
|
|
9
|
+
import { measureFileSizesBeforeBuild, printFileSizesAfterBuild } from './utils/FileSizeReporter'
|
|
10
|
+
import getConfig from './utils/getConfig'
|
|
12
11
|
|
|
13
12
|
interface BuildArgs {
|
|
14
13
|
analyze?: boolean
|
|
@@ -53,12 +52,18 @@ export default async function build(args: BuildArgs) {
|
|
|
53
52
|
process.exit(1)
|
|
54
53
|
}
|
|
55
54
|
|
|
55
|
+
const size = { maxEntrypointSize: 250000, maxAssetSize: 250000 }
|
|
56
|
+
if (typeof config.performance === 'object') {
|
|
57
|
+
config.performance.maxEntrypointSize = size.maxEntrypointSize
|
|
58
|
+
config.performance.maxAssetSize = size.maxAssetSize
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
printFileSizesAfterBuild(
|
|
57
62
|
stats,
|
|
58
63
|
previousSizeMap,
|
|
59
64
|
paths.dist,
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
size.maxEntrypointSize,
|
|
66
|
+
size.maxAssetSize
|
|
62
67
|
)
|
|
63
68
|
|
|
64
69
|
if (appConfig.single) {
|
package/src/cli.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import './utils/esm-register'
|
|
3
|
-
|
|
4
3
|
import './utils/beforeStart'
|
|
5
4
|
|
|
6
5
|
import fs from 'fs-extra'
|
|
7
6
|
import yargs from 'yargs'
|
|
8
|
-
import paths from './config/paths'
|
|
9
7
|
|
|
10
|
-
import start from './start'
|
|
11
|
-
import build from './build'
|
|
12
|
-
import deploy from './deploy'
|
|
13
8
|
import autoRefactor from './auto-refactor'
|
|
9
|
+
import build from './build'
|
|
14
10
|
import commitDist from './commit-dist'
|
|
11
|
+
import paths from './config/paths'
|
|
12
|
+
import deploy from './deploy'
|
|
15
13
|
import * as generator from './generator'
|
|
14
|
+
import start from './start'
|
|
16
15
|
|
|
17
16
|
const pkg = fs.readJsonSync(paths.resolveOwn('package.json'))
|
|
18
17
|
|
|
@@ -46,7 +45,7 @@ yargs(process.argv.slice(2))
|
|
|
46
45
|
)
|
|
47
46
|
.command(
|
|
48
47
|
'deploy',
|
|
49
|
-
'自动部署 dist 到 v1
|
|
48
|
+
'自动部署 dist 到 v1 服务器,可以使用 @qse/ssh-sftp 工具生成.sftprc.json文件,或者直接使用命令行参数指定上传目标',
|
|
50
49
|
(yargs) =>
|
|
51
50
|
yargs
|
|
52
51
|
.option('school', { alias: 's', desc: '上传到校端', default: false, boolean: true })
|
package/src/commit-dist.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
-
import paths from './config/paths'
|
|
3
|
-
import fs from 'fs-extra'
|
|
4
2
|
import cp from 'child_process'
|
|
3
|
+
import fs from 'fs-extra'
|
|
5
4
|
import tmp from 'tmp'
|
|
6
5
|
|
|
6
|
+
import paths from './config/paths'
|
|
7
|
+
|
|
7
8
|
const exec = (cmd: string, opts?: cp.ExecSyncOptions) =>
|
|
8
9
|
cp.execSync(cmd, { encoding: 'utf-8', stdio: 'pipe', ...opts }) as string
|
|
9
10
|
|
package/src/config/paths.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { globbySync } from 'globby'
|
|
1
|
+
import chalk from 'chalk'
|
|
3
2
|
import chokidar from 'chokidar'
|
|
3
|
+
import cookieParser from 'cookie-parser'
|
|
4
4
|
import { debounce, memoize } from 'es-toolkit'
|
|
5
|
-
import chalk from 'chalk'
|
|
6
|
-
import fs from 'fs-extra'
|
|
7
5
|
import express from 'express'
|
|
8
|
-
import
|
|
6
|
+
import fs from 'fs-extra'
|
|
7
|
+
import { globbySync } from 'globby'
|
|
9
8
|
import multer from 'multer'
|
|
10
|
-
import { pathToRegexp } from 'path-to-regexp'
|
|
11
9
|
import { createRequire } from 'node:module'
|
|
10
|
+
import { pathToRegexp } from 'path-to-regexp'
|
|
11
|
+
|
|
12
12
|
import { resolveModule } from '@/utils/resolveModule'
|
|
13
|
+
|
|
14
|
+
import paths from '../../paths'
|
|
15
|
+
|
|
13
16
|
const require = createRequire(import.meta.url)
|
|
14
17
|
|
|
15
18
|
let mockCache: Record<string, { handler: any; method: string; path: string }> = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolveModule } from '@/utils/resolveModule'
|
|
2
|
-
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
|
|
3
1
|
import type { Compiler, Configuration, RuleSetRule, SwcLoaderOptions } from '@rspack/core'
|
|
2
|
+
|
|
3
|
+
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
|
|
4
4
|
import { rspack } from '@rspack/core'
|
|
5
5
|
import ReactRefreshPlugin from '@rspack/plugin-react-refresh'
|
|
6
6
|
import chalk from 'chalk'
|
|
@@ -8,11 +8,15 @@ import fs from 'fs-extra'
|
|
|
8
8
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
|
9
9
|
import { createRequire } from 'node:module'
|
|
10
10
|
import path from 'node:path'
|
|
11
|
-
import
|
|
11
|
+
import { fileURLToPath } from 'node:url'
|
|
12
|
+
|
|
13
|
+
import { resolveModule } from '@/utils/resolveModule'
|
|
14
|
+
|
|
12
15
|
import type { Configuration as CustomConfiguration } from '../utils/defineConfig'
|
|
16
|
+
|
|
17
|
+
import appConfig from '../utils/appConfig'
|
|
13
18
|
import paths from './paths'
|
|
14
19
|
import PostcssSafeAreaPlugin from './plugins/postcss-safe-area'
|
|
15
|
-
import { fileURLToPath } from 'node:url'
|
|
16
20
|
|
|
17
21
|
const require = createRequire(import.meta.url)
|
|
18
22
|
const appPkg = fs.readJsonSync(paths.package) as { name: string; version: string }
|
|
@@ -242,10 +246,9 @@ export default function getWebpackConfig(args: any, override: CustomConfiguratio
|
|
|
242
246
|
...override.alias,
|
|
243
247
|
},
|
|
244
248
|
extensions: ['.web.js', '.web.mjs', '.js', '.mjs', '.jsx', '.ts', '.tsx', '.json', '.wasm'],
|
|
245
|
-
tsConfig:
|
|
246
|
-
configFile: paths.tsconfig,
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
+
tsConfig: fs.existsSync(paths.tsconfig)
|
|
250
|
+
? { configFile: paths.tsconfig, references: 'auto' }
|
|
251
|
+
: undefined,
|
|
249
252
|
},
|
|
250
253
|
stats: false,
|
|
251
254
|
devtool: isDev ? 'cheap-module-source-map' : false,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Configuration } from '@rspack/dev-server'
|
|
2
|
+
|
|
2
3
|
import type { Configuration as CustomConfiguration } from '../utils/defineConfig'
|
|
4
|
+
|
|
3
5
|
import setupMockServer from './plugins/mock-server'
|
|
4
6
|
|
|
5
7
|
interface ProxyConfig {
|
|
@@ -24,7 +26,10 @@ function createProxy(context: string, target: string, origin?: string): ProxyCon
|
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
export default function getWebpackDevServerConfig(
|
|
29
|
+
export default function getWebpackDevServerConfig(
|
|
30
|
+
args: any,
|
|
31
|
+
override: CustomConfiguration
|
|
32
|
+
): Configuration {
|
|
28
33
|
const host = process.env.HOST || '0.0.0.0'
|
|
29
34
|
|
|
30
35
|
const devServer: Configuration = {
|
package/src/deploy.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Options as SshSftpOptions } from '@qse/ssh-sftp'
|
|
2
|
+
|
|
2
3
|
import { sshSftp } from '@qse/ssh-sftp'
|
|
3
|
-
import paths from './config/paths.js'
|
|
4
4
|
import chalk from 'chalk'
|
|
5
5
|
import fs from 'fs-extra'
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import changeDeployVersion from './utils/changeDeployVersion'
|
|
8
6
|
import ora from 'ora'
|
|
9
|
-
import appConfig from './utils/appConfig.js'
|
|
10
7
|
import { format } from 'prettier'
|
|
11
8
|
|
|
9
|
+
import paths from './config/paths.js'
|
|
10
|
+
import appConfig from './utils/appConfig.js'
|
|
11
|
+
import changeDeployVersion from './utils/changeDeployVersion'
|
|
12
|
+
|
|
12
13
|
const appPkg = fs.readJsonSync(paths.package)
|
|
13
14
|
|
|
14
15
|
const baseConfig = {
|
|
@@ -54,9 +55,9 @@ async function normalDeploy(args: DeployArgs) {
|
|
|
54
55
|
return lines.slice(-50).join('\n')
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
async function upload(opts:
|
|
58
|
+
async function upload(opts: SshSftpOptions) {
|
|
58
59
|
// 上传dist文件
|
|
59
|
-
const { sftp, opts: fullOpts } = await sshSftp(opts)
|
|
60
|
+
const { sftp, opts: fullOpts } = (await sshSftp(opts))!
|
|
60
61
|
|
|
61
62
|
const spinner = ora('自动更新 ver.js 版本配置').start()
|
|
62
63
|
// 指定远程需要修改的文件
|
|
@@ -113,7 +114,7 @@ async function normalDeploy(args: DeployArgs) {
|
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
const presetConfig = {
|
|
117
|
+
const presetConfig: Record<string, SshSftpOptions> = {
|
|
117
118
|
s: { preset: { context: 'eduwebngv1', folder: 'userportal' } },
|
|
118
119
|
b: { preset: { context: 'eduwebngv1', folder: 'bureaupc' } },
|
|
119
120
|
d: { preset: { context: 'eduwebngv1', folder: 'documentshelves' } },
|
|
@@ -123,7 +124,7 @@ async function normalDeploy(args: DeployArgs) {
|
|
|
123
124
|
remotePath: '/erp/edumaven/dingcorrection-page-dev/compositionshelves',
|
|
124
125
|
},
|
|
125
126
|
}
|
|
126
|
-
const uploadSftpConfigs = []
|
|
127
|
+
const uploadSftpConfigs: SshSftpOptions[] = []
|
|
127
128
|
if (args.bureau) {
|
|
128
129
|
uploadSftpConfigs.push(presetConfig.b)
|
|
129
130
|
}
|
|
@@ -139,6 +140,11 @@ async function normalDeploy(args: DeployArgs) {
|
|
|
139
140
|
if (args.compositionshelvesDingtalk) {
|
|
140
141
|
uploadSftpConfigs.push(presetConfig.cd)
|
|
141
142
|
}
|
|
143
|
+
if (uploadSftpConfigs.length === 0 && fs.existsSync(paths.sshSftp)) {
|
|
144
|
+
const config = fs.readJsonSync(paths.sshSftp)
|
|
145
|
+
uploadSftpConfigs.push(config)
|
|
146
|
+
}
|
|
147
|
+
|
|
142
148
|
if (uploadSftpConfigs.length === 0) {
|
|
143
149
|
console.log(
|
|
144
150
|
`
|
|
@@ -146,7 +152,7 @@ async function normalDeploy(args: DeployArgs) {
|
|
|
146
152
|
执行 ${chalk.green('npx edu-scripts deploy -h')} 查看具体用法
|
|
147
153
|
`
|
|
148
154
|
)
|
|
149
|
-
process.exit()
|
|
155
|
+
process.exit(1)
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
const uploadConfig = { ...baseConfig, ignore: [...baseConfig.ignore, 'js/ver.js'] }
|
package/src/generator.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
1
2
|
import fs from 'fs-extra'
|
|
3
|
+
|
|
2
4
|
import paths from './config/paths'
|
|
3
|
-
import chalk from 'chalk'
|
|
4
5
|
|
|
5
6
|
const getTmpPath = (...args: string[]) => paths.resolveOwn('asset', 'template', ...args)
|
|
6
7
|
|
|
@@ -56,4 +57,4 @@ async function generatorTailwind() {
|
|
|
56
57
|
)
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export { generatorOverride as override,
|
|
60
|
+
export { generatorOverride as override, generatorTailwind as tailwind, generatorTsconfig as ts }
|
package/src/index.ts
CHANGED
package/src/start.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { rspack } from '@rspack/core'
|
|
2
2
|
import { RspackDevServer } from '@rspack/dev-server'
|
|
3
|
-
import getConfig from './utils/getConfig.js'
|
|
4
3
|
import chalk from 'chalk'
|
|
5
4
|
|
|
5
|
+
import getConfig from './utils/getConfig.js'
|
|
6
|
+
|
|
6
7
|
interface StartArgs {
|
|
7
8
|
port?: string
|
|
8
9
|
}
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import type { Stats } from '@rspack/core'
|
|
9
|
+
|
|
10
10
|
import chalk from 'chalk'
|
|
11
11
|
import filesize from 'filesize'
|
|
12
|
+
import fs from 'fs-extra'
|
|
13
|
+
import { gzipSizeSync } from 'gzip-size'
|
|
14
|
+
import path from 'path'
|
|
12
15
|
// @ts-ignore
|
|
13
16
|
import recursive from 'recursive-readdir'
|
|
14
17
|
import stripAnsi from 'strip-ansi'
|
|
15
|
-
import { gzipSizeSync } from 'gzip-size'
|
|
16
|
-
import type { Stats } from '@rspack/core'
|
|
17
18
|
|
|
18
19
|
interface SizeMap {
|
|
19
20
|
root: string
|
package/src/utils/appConfig.ts
CHANGED
package/src/utils/beforeStart.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import fs from 'fs-extra'
|
|
2
|
-
import paths from '../config/paths'
|
|
3
1
|
import chalk from 'chalk'
|
|
2
|
+
import fs from 'fs-extra'
|
|
4
3
|
import semver from 'semver'
|
|
4
|
+
|
|
5
|
+
import paths from '../config/paths'
|
|
5
6
|
import appConfig from './appConfig'
|
|
6
7
|
|
|
7
8
|
const pkg = fs.readJsonSync(paths.resolveOwn('package.json'))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Chalk } from 'chalk'
|
|
2
1
|
import type { Compiler, Configuration as RspackConfiguration, SwcLoaderOptions } from '@rspack/core'
|
|
3
2
|
import type { Configuration as DevServerConfiguration } from '@rspack/dev-server'
|
|
3
|
+
import type { Chalk } from 'chalk'
|
|
4
4
|
|
|
5
5
|
type ProxyConfigArray = NonNullable<DevServerConfiguration['proxy']>
|
|
6
6
|
|
package/src/utils/exec.ts
CHANGED
package/src/utils/getConfig.ts
CHANGED
package/src/utils/getOverride.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra'
|
|
2
|
-
import paths from '../config/paths'
|
|
3
2
|
import { createRequire } from 'node:module'
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
import type { Configuration } from './defineConfig'
|
|
5
|
+
|
|
6
|
+
import paths from '../config/paths'
|
|
5
7
|
import { resolveModule } from './resolveModule'
|
|
6
8
|
|
|
7
9
|
const require = createRequire(import.meta.url)
|
package/tsdown.config.ts
CHANGED