xshell 1.3.47 → 1.3.49
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/antd.development.js +3779 -3736
- package/antd.development.js.map +1 -1
- package/antd.production.js +939 -898
- package/antd.production.js.map +1 -1
- package/builder.js +2 -4
- package/git.d.ts +1 -0
- package/git.js +2 -1
- package/net.common.d.ts +1 -1
- package/net.common.js +4 -2
- package/net.js +7 -4
- package/package.json +15 -15
- package/path.d.ts +2 -2
- package/polyfill.browser.js +1 -0
- package/process.d.ts +1 -1
- package/react.production.js +29 -29
- package/react.production.js.map +1 -1
- package/server.d.ts +11 -4
- package/server.js +14 -6
- package/toaster.browser.js +1 -0
- package/tsconfig.json +3 -5
- package/xlint.js +6 -6
package/server.d.ts
CHANGED
|
@@ -129,14 +129,19 @@ export declare class Server {
|
|
|
129
129
|
- throw_error?: `false` 在遇到 request 请求错误时直接 throw 出来,而不是自动设置到 response */
|
|
130
130
|
request(ctx: Context, path_url: string | URL, { headers: headers_, redirect, queries, timeout, throw_error, proxy }?: ServerRequestOptions): Promise<true>;
|
|
131
131
|
static filter_response_headers(headers: RawResponse['headers']): Record<string, string>;
|
|
132
|
-
/**
|
|
132
|
+
/** 提供静态文件,返回是否成功
|
|
133
|
+
- ctx
|
|
134
|
+
- fp: 文件路径
|
|
135
|
+
- 有 fpd_root 时为相对路径或以 fpd_root 开头的绝对路径,会忽略开头的 /
|
|
136
|
+
- 无 fpd_root 时必须是绝对路径
|
|
137
|
+
- options?
|
|
133
138
|
@example
|
|
134
139
|
const prefix_docs = '/zh/'
|
|
135
140
|
if (path.startsWith(prefix_docs)) {
|
|
136
141
|
await this.try_send(
|
|
137
142
|
ctx,
|
|
138
143
|
(path.endsWith('/') ? `${path}index.html` : path).strip_start(prefix_docs),
|
|
139
|
-
{ fpd_root:
|
|
144
|
+
{ fpd_root: `${fpd_temp}docs${prefix_docs}`, },
|
|
140
145
|
)
|
|
141
146
|
return
|
|
142
147
|
} */
|
|
@@ -150,11 +155,13 @@ export declare class Server {
|
|
|
150
155
|
/** 将 body 设置为 fp 所指文件的 ReadStream
|
|
151
156
|
检查 fp 是否合法,设置对应的 content-type,支持缓存,支持分块下载
|
|
152
157
|
- ctx: Koa.Context
|
|
153
|
-
- fp:
|
|
158
|
+
- fp: 文件路径
|
|
159
|
+
- 有 fpd_root 时为相对路径或以 fpd_root 开头的绝对路径,会忽略开头的 /
|
|
160
|
+
- 无 fpd_root 时必须是绝对路径
|
|
154
161
|
- options?:
|
|
155
162
|
- fpd_root?: 只能访问 fpd_root 下面的文件
|
|
156
163
|
- absolute?: `false` 使用绝对路径指定发送的文件
|
|
157
|
-
- download?: `
|
|
164
|
+
- download?: `false` 在 response.headers 中加上 content-disposition: attachment 指示浏览器下载文件
|
|
158
165
|
- assets_root?: 替换模板 xxx.template.html 中 {root} 占位符 */
|
|
159
166
|
fsend(ctx: Context, fp: string, { fpd_root, absolute, download, assets_root, sea: _sea }?: {
|
|
160
167
|
fpd_root?: string;
|
package/server.js
CHANGED
|
@@ -121,6 +121,8 @@ export class Server {
|
|
|
121
121
|
app.on('error', this.on_error.bind(this));
|
|
122
122
|
app.use(this.entry.bind(this));
|
|
123
123
|
app.use(KoaCompress({
|
|
124
|
+
encodingPreference: ['br', 'zstd', 'gzip', 'identity'],
|
|
125
|
+
threshold: 512,
|
|
124
126
|
br: {
|
|
125
127
|
chunkSize: 64 * 1024,
|
|
126
128
|
// https://nodejs.org/api/zlib.html#zlib_class_brotlioptions
|
|
@@ -128,8 +130,7 @@ export class Server {
|
|
|
128
130
|
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,
|
|
129
131
|
[zlib.constants.BROTLI_PARAM_QUALITY]: 3 // 默认为 11 (最大压缩),会导致 news/get 生成的 14 mb 的 json 压缩时长高达 24s
|
|
130
132
|
},
|
|
131
|
-
}
|
|
132
|
-
threshold: 512
|
|
133
|
+
}
|
|
133
134
|
}));
|
|
134
135
|
app.use(KoaCors({
|
|
135
136
|
credentials: true,
|
|
@@ -640,14 +641,19 @@ export class Server {
|
|
|
640
641
|
static filter_response_headers(headers) {
|
|
641
642
|
return filter_keys(headers, key => !key.startsWith(':') && !this.drop_response_headers.has(key));
|
|
642
643
|
}
|
|
643
|
-
/**
|
|
644
|
+
/** 提供静态文件,返回是否成功
|
|
645
|
+
- ctx
|
|
646
|
+
- fp: 文件路径
|
|
647
|
+
- 有 fpd_root 时为相对路径或以 fpd_root 开头的绝对路径,会忽略开头的 /
|
|
648
|
+
- 无 fpd_root 时必须是绝对路径
|
|
649
|
+
- options?
|
|
644
650
|
@example
|
|
645
651
|
const prefix_docs = '/zh/'
|
|
646
652
|
if (path.startsWith(prefix_docs)) {
|
|
647
653
|
await this.try_send(
|
|
648
654
|
ctx,
|
|
649
655
|
(path.endsWith('/') ? `${path}index.html` : path).strip_start(prefix_docs),
|
|
650
|
-
{ fpd_root:
|
|
656
|
+
{ fpd_root: `${fpd_temp}docs${prefix_docs}`, },
|
|
651
657
|
)
|
|
652
658
|
return
|
|
653
659
|
} */
|
|
@@ -676,11 +682,13 @@ export class Server {
|
|
|
676
682
|
/** 将 body 设置为 fp 所指文件的 ReadStream
|
|
677
683
|
检查 fp 是否合法,设置对应的 content-type,支持缓存,支持分块下载
|
|
678
684
|
- ctx: Koa.Context
|
|
679
|
-
- fp:
|
|
685
|
+
- fp: 文件路径
|
|
686
|
+
- 有 fpd_root 时为相对路径或以 fpd_root 开头的绝对路径,会忽略开头的 /
|
|
687
|
+
- 无 fpd_root 时必须是绝对路径
|
|
680
688
|
- options?:
|
|
681
689
|
- fpd_root?: 只能访问 fpd_root 下面的文件
|
|
682
690
|
- absolute?: `false` 使用绝对路径指定发送的文件
|
|
683
|
-
- download?: `
|
|
691
|
+
- download?: `false` 在 response.headers 中加上 content-disposition: attachment 指示浏览器下载文件
|
|
684
692
|
- assets_root?: 替换模板 xxx.template.html 中 {root} 占位符 */
|
|
685
693
|
async fsend(ctx, fp, { fpd_root, absolute, download, assets_root, sea: _sea = sea } = {}) {
|
|
686
694
|
check(absolute || _sea || fpd_root?.isdir, t('fsend 必须传 absolute 选项, sea 选项, 或 fpd_root 文件夹'));
|
package/toaster.browser.js
CHANGED
package/tsconfig.json
CHANGED
|
@@ -5,15 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
"compilerOptions": {
|
|
7
7
|
// --- module
|
|
8
|
-
"module": "
|
|
9
|
-
"moduleResolution": "
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
10
|
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"esModuleInterop": false,
|
|
12
11
|
"resolveJsonModule": true,
|
|
13
12
|
"isolatedModules": true,
|
|
14
13
|
|
|
15
14
|
// --- build
|
|
16
|
-
"target": "
|
|
15
|
+
"target": "esnext",
|
|
17
16
|
"allowJs": false,
|
|
18
17
|
"checkJs": false,
|
|
19
18
|
"pretty": true,
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
|
|
51
50
|
// --- type checking
|
|
52
51
|
"strict": false,
|
|
53
|
-
"alwaysStrict": false,
|
|
54
52
|
"noImplicitAny": false,
|
|
55
53
|
"noImplicitReturns": false,
|
|
56
54
|
"noImplicitThis": true,
|
package/xlint.js
CHANGED
|
@@ -775,8 +775,8 @@ export const xlint_config = {
|
|
|
775
775
|
projectService: true,
|
|
776
776
|
ecmaFeatures: {
|
|
777
777
|
jsx: true
|
|
778
|
-
}
|
|
779
|
-
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
780
|
},
|
|
781
781
|
plugins: {
|
|
782
782
|
'@typescript-eslint': ts_plugin,
|
|
@@ -1044,7 +1044,7 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1044
1044
|
if (fext && fext !== 'js')
|
|
1045
1045
|
return ['subpath'];
|
|
1046
1046
|
source = source.strip_if_end('.js');
|
|
1047
|
-
return ['subpath', `${source}
|
|
1047
|
+
return ['subpath', `${source}${resolve_suffix(path.resolve(fp.fdir, source))}`];
|
|
1048
1048
|
}
|
|
1049
1049
|
// ../ 父级路径,或者 @/... 等 alias 路径
|
|
1050
1050
|
// 先 resolve 到完整路径,再修复后缀,最后通过 alias 简化
|
|
@@ -1056,7 +1056,7 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1056
1056
|
const { fext } = source;
|
|
1057
1057
|
if (!fext || fext === 'js') {
|
|
1058
1058
|
source = source.strip_if_end('.js');
|
|
1059
|
-
source = `${source}
|
|
1059
|
+
source = `${source}${resolve_suffix(source)}`;
|
|
1060
1060
|
}
|
|
1061
1061
|
const relative = source.strip_start(cwd, true);
|
|
1062
1062
|
const ialias = aliases.findIndex(({ fp }) => relative.startsWith(fp));
|
|
@@ -1066,8 +1066,8 @@ function format_source(pkgs, aliases, cwd, fp, source) {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
let cache_exists = new Map();
|
|
1068
1068
|
function resolve_suffix(fp_base) {
|
|
1069
|
-
for (const suffix of ['ts', 'tsx']) {
|
|
1070
|
-
const fp = `${fp_base}
|
|
1069
|
+
for (const suffix of ['.ts', '.tsx', '/index.ts', '/index.tsx']) {
|
|
1070
|
+
const fp = `${fp_base}${suffix}`;
|
|
1071
1071
|
const c = cache_exists.get(fp);
|
|
1072
1072
|
if (c !== undefined)
|
|
1073
1073
|
if (c)
|