xshell 1.3.80 → 1.4.2
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 +86194 -144895
- package/antd.production.js +82353 -118684
- package/builder.d.ts +61 -160
- package/builder.js +350 -661
- package/file.d.ts +4 -0
- package/file.js +5 -4
- package/net.d.ts +0 -3
- package/net.js +1 -2
- package/package.json +20 -29
- package/prototype.common.js +2 -1
- package/prototype.js +1 -1
- package/react.development.js +15560 -30856
- package/react.production.js +9953 -17459
- package/repl.js +8 -1
- package/server.js +2 -5
- package/tsconfig.json +3 -2
- package/i18n/scanner/checker.d.ts +0 -5
- package/i18n/scanner/checker.js +0 -64
package/builder.d.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import type * as Rolldown from 'rolldown';
|
|
2
|
+
export interface RolldownOptions {
|
|
3
|
+
cjs?: boolean;
|
|
4
|
+
single_chunk?: boolean;
|
|
5
|
+
dynamic_import?: boolean;
|
|
6
|
+
externals?: (string | RegExp)[];
|
|
7
|
+
globals?: Record<string, string>;
|
|
8
|
+
plugins?: (Rolldown.Plugin | Promise<Rolldown.Plugin>)[];
|
|
9
|
+
styles?: boolean;
|
|
10
|
+
assets?: boolean;
|
|
11
|
+
defines?: Record<string, string>;
|
|
12
|
+
production?: boolean | null;
|
|
13
|
+
analyze?: boolean;
|
|
14
|
+
print?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** 通过 rolldown 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
|
|
17
|
+
- target: 目标环境 nodejs | web
|
|
18
|
+
- fpd_root: 项目根目录
|
|
19
|
+
- fpd_out: 输出文件目录
|
|
20
|
+
- entries: 入口文件 Record<输出文件路径, 输入文件路径>
|
|
21
|
+
- options?:
|
|
22
|
+
- cjs?: `false`
|
|
23
|
+
- single_chunk?: `true` 对于 await import(), 或者多个 entry 公用的部分,
|
|
24
|
+
不要创建分块,总是打包到一个 .js 中
|
|
25
|
+
- dynamic_import?: `true` 设置为 false 时可以忽略打包这些依赖
|
|
26
|
+
- externals?: string[] 或 RegExp[] 哪些导入模块不打包
|
|
27
|
+
- globals?: Record<包名, 全局变量名>, 替换模块为 globalThis 上的变量,避免打包
|
|
28
|
+
- plugins?: rolldown 插件
|
|
29
|
+
- styles?: `false` 加上 styles_plugin 插件,支持 .sass, .css 等样式导入
|
|
30
|
+
- assets?: `false` 加上 inline_assets 插件,支持 .svg, .png, 等资源导入为 data url
|
|
31
|
+
- defines?: Record<string, string> 定义如 process.env.NODE_ENV 的值为常数
|
|
32
|
+
- production?: `true` 如果设置了 true / false,则会定义 process.env.NODE_ENV 为 'production' / 'development'
|
|
33
|
+
- analyze?: `false` 生成 stats.html 用于生成文件大小分析
|
|
34
|
+
- print?: `true` 打印生成的文件
|
|
35
|
+
@example await rolldown('web', 'D:/0/web/', 'T:/test/', { 'react.js': 'react.ts' }) */
|
|
36
|
+
export declare function rolldown(target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, entries: Record<string, string>, { cjs, single_chunk, dynamic_import, externals, globals, plugins, styles, assets, production, defines, analyze, print }?: RolldownOptions): Promise<void>;
|
|
3
37
|
/** target web 时的 npm 包依赖管理
|
|
4
38
|
有 productions 但无 devs 时,大部分情况是相同配置,因此在 dev 模式下会用 productions
|
|
5
39
|
也可以手动设置 [ ] 禁用 fallback */
|
|
@@ -25,7 +59,19 @@ export interface Dependency {
|
|
|
25
59
|
devs?: (string | AssetOption)[];
|
|
26
60
|
};
|
|
27
61
|
}
|
|
28
|
-
type DependencyId = 'react' | 'lodash' | 'jquery' | 'xterm' | 'swiper' | '
|
|
62
|
+
type DependencyId = 'react' | 'lodash' | 'jquery' | 'xterm' | 'swiper' | 'antd' | 'vscode-oniguruma' | 'antd-plots' | 'gridstack' | 'quill' | 'monaco' | 'echarts';
|
|
63
|
+
interface AssetOption {
|
|
64
|
+
/** 相对 fpd_root 的路径,或者绝对路径 */
|
|
65
|
+
src: string;
|
|
66
|
+
/** 相对 fpd_out 的路径,或者绝对路径,默认等于 src 的值 */
|
|
67
|
+
out?: string;
|
|
68
|
+
/** 直接设置 html 的路径,强制覆盖 */
|
|
69
|
+
value?: string;
|
|
70
|
+
}
|
|
71
|
+
interface Assets {
|
|
72
|
+
productions?: (string | AssetOption)[];
|
|
73
|
+
devs?: (string | AssetOption)[];
|
|
74
|
+
}
|
|
29
75
|
export interface HtmlOptions {
|
|
30
76
|
title: string;
|
|
31
77
|
/** `index.js` 也可以设置 entries 中的其他项, 应填写相对于 fpd_out 的路径 */
|
|
@@ -33,7 +79,7 @@ export interface HtmlOptions {
|
|
|
33
79
|
device_viewport?: boolean;
|
|
34
80
|
/** 也会在 copy_files 中一并被复制,应填写相对于 fpd_root 和 fpd_out 的路径 */
|
|
35
81
|
icon?: string | AssetOption;
|
|
36
|
-
/** 仅用于生成 html 中 script 标签,文件复制由
|
|
82
|
+
/** 仅用于生成 html 中 script 标签,文件复制由 copy_assets 的 dependencies 参数决定 */
|
|
37
83
|
dependencies?: DependencyId[];
|
|
38
84
|
manifest?: string | AssetOption;
|
|
39
85
|
/** 额外需要加载的脚本 */
|
|
@@ -42,169 +88,24 @@ export interface HtmlOptions {
|
|
|
42
88
|
before?: (string | AssetOption)[];
|
|
43
89
|
/** 在 index.js 之后加载 */
|
|
44
90
|
after?: (string | AssetOption)[];
|
|
91
|
+
/** 在 index.js 之后通过 defer 而非 module 加载 */
|
|
92
|
+
after_legacy?: (string | AssetOption)[];
|
|
45
93
|
};
|
|
46
|
-
/** 额外需要加载的 module 脚本, 在 index.js 之前 */
|
|
47
|
-
mscripts?: (string | AssetOption)[];
|
|
48
94
|
heads?: string[];
|
|
49
95
|
notice?: boolean;
|
|
50
96
|
}
|
|
51
|
-
interface
|
|
52
|
-
/** 相对 fpd_root 的路径,或者绝对路径 */
|
|
53
|
-
src: string;
|
|
54
|
-
/** 相对 fpd_out 的路径,或者绝对路径,默认等于 src 的值 */
|
|
55
|
-
out?: string;
|
|
56
|
-
/** 直接设置 html 的路径,强制覆盖 */
|
|
57
|
-
value?: string;
|
|
58
|
-
}
|
|
59
|
-
type Assets = {
|
|
60
|
-
productions?: (string | AssetOption)[];
|
|
61
|
-
devs?: (string | AssetOption)[];
|
|
62
|
-
};
|
|
63
|
-
/** 从 tsconfig.json 中解析 paths 配置为 resolve alias
|
|
64
|
-
文件不存在或无 paths alias 配置时返回 null */
|
|
65
|
-
export declare function get_resolve_alias(fpd_root: string): Promise<Record<string, string> | null>;
|
|
66
|
-
export interface BundlerOptions {
|
|
67
|
-
dependencies?: DependencyId[];
|
|
68
|
-
source_map?: boolean;
|
|
69
|
-
production?: boolean;
|
|
70
|
-
external_dayjs?: boolean;
|
|
71
|
-
externals?: Record<string, string | string[]>;
|
|
72
|
-
dynamic_import?: boolean;
|
|
73
|
-
commonjs2?: boolean;
|
|
74
|
-
expose?: boolean;
|
|
75
|
-
assets_stats?: boolean;
|
|
76
|
-
globals?: Record<string, string>;
|
|
77
|
-
resolve_alias?: Record<string, string>;
|
|
78
|
-
resolve_fallback?: Record<string, any>;
|
|
79
|
-
analyzer?: boolean;
|
|
80
|
-
dts?: boolean;
|
|
81
|
-
cache_version?: string;
|
|
82
|
-
single_chunk?: boolean;
|
|
83
|
-
exclude_modules?: RegExp;
|
|
84
|
-
assets?: Assets;
|
|
97
|
+
interface BuildHtmlOptions {
|
|
85
98
|
assets_root?: string;
|
|
86
99
|
template?: boolean;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
single_js?: {
|
|
90
|
-
js: string;
|
|
91
|
-
entry: string;
|
|
92
|
-
};
|
|
93
|
-
plugins?: Webpack.Configuration['plugins'];
|
|
94
|
-
polyfill_node_sea?: boolean;
|
|
95
|
-
}
|
|
96
|
-
export declare class Bundler {
|
|
97
|
-
name: string;
|
|
98
|
-
target: 'nodejs' | 'web';
|
|
99
|
-
fpd_root: string;
|
|
100
|
-
fpd_out: string;
|
|
101
|
-
fpdt_cache: string;
|
|
102
|
-
entry: Record<string, string>;
|
|
103
|
-
production: boolean;
|
|
104
|
-
dependencies: DependencyId[];
|
|
105
|
-
source_map: boolean;
|
|
106
|
-
globals?: BundlerOptions['globals'];
|
|
107
|
-
external_dayjs: boolean;
|
|
108
|
-
externals: BundlerOptions['externals'];
|
|
109
|
-
htmls?: BundlerOptions['htmls'];
|
|
110
|
-
assets?: Assets;
|
|
111
|
-
assets_root: string;
|
|
112
|
-
template: boolean;
|
|
113
|
-
single_js?: BundlerOptions['single_js'];
|
|
114
|
-
commonjs2: boolean;
|
|
115
|
-
expose: boolean;
|
|
116
|
-
single_chunk: boolean;
|
|
117
|
-
dynamic_import: boolean;
|
|
118
|
-
resolve_alias?: BundlerOptions['resolve_alias'];
|
|
119
|
-
resolve_fallback?: BundlerOptions['resolve_fallback'];
|
|
120
|
-
assets_stats: boolean;
|
|
121
|
-
analyzer: boolean;
|
|
122
|
-
dts: boolean;
|
|
123
|
-
exclude_modules?: BundlerOptions['exclude_modules'];
|
|
124
|
-
cache_version?: string;
|
|
125
|
-
plugins?: BundlerOptions['plugins'];
|
|
126
|
-
license?: boolean;
|
|
127
|
-
polyfill_node_sea?: boolean;
|
|
128
|
-
config: Webpack.Configuration;
|
|
129
|
-
lcompiler: Lock<Webpack.Compiler>;
|
|
130
|
-
/** 通过 webpack 从入口文件打包所有依赖生成单个 index.{mjs,cjs} 文件
|
|
131
|
-
- name: 项目名称
|
|
132
|
-
- target: 目标环境 nodejs | web
|
|
133
|
-
- fpd_root: 项目根目录
|
|
134
|
-
- fpd_out: 输出文件目录
|
|
135
|
-
- fpdt_cache?: webpack 缓存目录,可以设置为 undefined 使用默认路径 node_modules/.cache/webpack/
|
|
136
|
-
- entry: 入口文件
|
|
137
|
-
- options?: 打包配置, 按常用顺序排列
|
|
138
|
-
- production?: `true` webpack mode 设置为 'production'
|
|
139
|
-
- dependencies?: DependencyId[], 决定 bundler 在 build_all (copy_files) 时需要复制到 fpd_out 的资源
|
|
140
|
-
- source_map?: `true` 启用源码映射 .map 文件
|
|
141
|
-
- globals?: 全局变量定义
|
|
142
|
-
- external_dayjs?: `false` 配置 dayjs 为 external 来配合 antd 使用, 减小一点体积
|
|
143
|
-
- externals?: 配置外部模块
|
|
144
|
-
- htmls?: 配置要生成的 html, 比如 { 'index.html', { title: '文件', ... } }
|
|
145
|
-
- assets?: 项目中需要直接复制到输出目录的资源,有 productions 但无 devs 时 (是同一套),
|
|
146
|
-
在 dev 模式下会用 productions 中的资源,如果不需要 productions 资源, devs 可以设置为 [ ],
|
|
147
|
-
每一项是 string 或者 { src: '...', out: '...' },路径相对于 fpd_root 和 fpd_out
|
|
148
|
-
- assets_root?: `'/'` 生成的 html 中替换 {root} 作为部署路径,以支持 browser router 路由能力
|
|
149
|
-
assets, html 中的 icon, scripts 路径直接在前面添加 assets_root 来生成最终 html href
|
|
150
|
-
未启用时使用相对 html 路径来生成最终 html href
|
|
151
|
-
- template?: `false` 除了生成对应的 html 之外,还生成所有路径为 `{root}/...` 的模板 html 文件, 方便后续 server 替换渲染
|
|
152
|
-
- single_js?: 设置生成的单个 js 入口文件,无其他依赖,通过 script module 作为入口加载,含有 import 加载其他 externals 和某个 entry,类似 htmls 配置要生成的 html
|
|
153
|
-
- js: js 入口文件名
|
|
154
|
-
- entry: 使用的 entry
|
|
155
|
-
- commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
|
|
156
|
-
- expose?: `false` 入口模块所有导出的属性赋值到全局对象 globalThis 上
|
|
157
|
-
- single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
|
|
158
|
-
- dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
|
|
159
|
-
- resolve_alias?: 配置 resolve alias,会自动从项目 tsconfig.json 的 paths 中读取,用户配置作为覆盖
|
|
160
|
-
- resolve_fallback?: 配置 resolve fallback
|
|
161
|
-
- assets_stats?: `true` 打印输出的文件信息
|
|
162
|
-
- analyzer?: `false` 启用 WebpackBundleAnalyzer 插件分析构建产物大小
|
|
163
|
-
- dts?: `false` 生成 .d.ts 文件
|
|
164
|
-
- exclude_modules?: 传入正则表达式 ,匹配时使用 IgnorePlugin 强制不打包这个模块,但是一旦导入就会报错
|
|
165
|
-
- cache_version?: webpack cache version, 用于区分同一个 name 的不同版本
|
|
166
|
-
- plugins?: 可选传入的额外的 webpack 插件
|
|
167
|
-
- license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt
|
|
168
|
-
- polyfill_node_sea?: 避免依赖 node:sea 模块以兼容旧版本 node.js */
|
|
169
|
-
constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string | undefined, entry: Record<string, string>, options?: BundlerOptions);
|
|
170
|
-
build(print?: boolean): Promise<void>;
|
|
171
|
-
close(): Promise<void>;
|
|
172
|
-
build_all(print?: boolean): Promise<void>;
|
|
173
|
-
/** 打包构建 js, 构建 html, 复制依赖文件 */
|
|
174
|
-
build_all_and_close(print?: boolean): Promise<void>;
|
|
175
|
-
/** 仅打包构建 js, 不复制依赖 */
|
|
176
|
-
build_and_close(print?: boolean): Promise<void>;
|
|
177
|
-
build_htmls(print?: {
|
|
100
|
+
css?: boolean;
|
|
101
|
+
print?: {
|
|
178
102
|
info: boolean;
|
|
179
103
|
files: boolean;
|
|
180
|
-
}
|
|
181
|
-
build_single_js(print?: {
|
|
182
|
-
info: boolean;
|
|
183
|
-
files: boolean;
|
|
184
|
-
}): Promise<void>;
|
|
185
|
-
resolve_dependencies(dependency_ids: DependencyId[], resolveds?: Set<DependencyId>): Set<DependencyId>;
|
|
186
|
-
/** 解析依赖的文件
|
|
187
|
-
- dependencies: 依赖 id
|
|
188
|
-
- assets: false 时只包括在 script 标签加载的文件; true 时包括 assets, maps 等 */
|
|
189
|
-
resolve_dependency_assets(_dependencies: DependencyId[], assets: boolean, { production, source_map }?: {
|
|
190
|
-
production?: boolean;
|
|
191
|
-
source_map?: BundlerOptions['source_map'];
|
|
192
|
-
}): (string | AssetOption)[];
|
|
193
|
-
copy_files({ dependencies: _dependencies, production, assets, fpd_root, fpd_out, print }?: {
|
|
194
|
-
dependencies?: DependencyId[];
|
|
195
|
-
production?: boolean;
|
|
196
|
-
assets?: Assets;
|
|
197
|
-
fpd_root?: string;
|
|
198
|
-
fpd_out?: string;
|
|
199
|
-
print?: {
|
|
200
|
-
info: boolean;
|
|
201
|
-
files: boolean;
|
|
202
|
-
};
|
|
203
|
-
}): Promise<void>;
|
|
204
|
-
/** 为空时返回空数组 */
|
|
205
|
-
resolve_config(config: {
|
|
206
|
-
productions?: string[];
|
|
207
|
-
devs?: string[];
|
|
208
|
-
} | Assets | undefined, production: boolean): (string | AssetOption)[];
|
|
104
|
+
};
|
|
209
105
|
}
|
|
106
|
+
export declare function build_htmls(fpd_out: string, production: boolean, htmls: Record<string, HtmlOptions>, { print, assets_root, template, css, }?: BuildHtmlOptions): Promise<void>;
|
|
107
|
+
export declare function copy_assets(fpd_root: string, fpd_out: string, production: boolean, _dependencies: DependencyId[], htmls?: Record<string, HtmlOptions>, assets?: Assets, source_map?: boolean, print?: {
|
|
108
|
+
info: boolean;
|
|
109
|
+
files: boolean;
|
|
110
|
+
}): Promise<void>;
|
|
210
111
|
export {};
|