xshell 1.0.148 → 1.0.149
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/builder.d.ts +5 -3
- package/builder.js +5 -3
- package/package.json +1 -1
package/builder.d.ts
CHANGED
|
@@ -35,9 +35,9 @@ export interface HtmlOptions {
|
|
|
35
35
|
/** 额外需要加载的脚本 */
|
|
36
36
|
scripts?: {
|
|
37
37
|
/** 在 index.js 之前加载 */
|
|
38
|
-
before?: string[];
|
|
38
|
+
before?: (string | AssetOption)[];
|
|
39
39
|
/** 在 index.js 之后加载 */
|
|
40
|
-
after?: string[];
|
|
40
|
+
after?: (string | AssetOption)[];
|
|
41
41
|
};
|
|
42
42
|
/** 额外需要加载的 module 脚本, 在 index.js 之前 */
|
|
43
43
|
mscripts?: (string | AssetOption)[];
|
|
@@ -66,6 +66,7 @@ export interface BundlerOptions {
|
|
|
66
66
|
assets_stats?: boolean;
|
|
67
67
|
globals?: Record<string, string>;
|
|
68
68
|
resolve_alias?: Record<string, string>;
|
|
69
|
+
resolve_fallback?: Record<string, string>;
|
|
69
70
|
analyzer?: boolean;
|
|
70
71
|
dts?: boolean;
|
|
71
72
|
cache_version?: string;
|
|
@@ -114,6 +115,7 @@ export declare class Bundler {
|
|
|
114
115
|
- single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
|
|
115
116
|
- dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
|
|
116
117
|
- resolve_alias?: 配置 resolve alias
|
|
118
|
+
- resolve_fallback?: 配置 resolve fallback
|
|
117
119
|
- assets_stats?: `true` 打印输出的文件信息
|
|
118
120
|
- analyzer?: `false` 启用 WebpackBundleAnalyzer 插件分析构建产物大小
|
|
119
121
|
- dts?: `false` 生成 .d.ts 文件
|
|
@@ -122,7 +124,7 @@ export declare class Bundler {
|
|
|
122
124
|
- production?: `true` webpack mode 设置为 'production'
|
|
123
125
|
- sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
|
|
124
126
|
- license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
|
|
125
|
-
constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, external_dayjs, externals, htmls, assets, commonjs2, single_chunk, dynamic_import, resolve_alias, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
|
|
127
|
+
constructor(name: string, target: 'web' | 'nodejs', fpd_root: string, fpd_out: string, fpdt_cache: string, entry: Record<string, string>, { source_map, globals, external_dayjs, externals, htmls, assets, commonjs2, single_chunk, dynamic_import, resolve_alias, resolve_fallback, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
|
|
126
128
|
build(print?: boolean): Promise<void>;
|
|
127
129
|
close(): Promise<void>;
|
|
128
130
|
build_all(print?: boolean): Promise<void>;
|
package/builder.js
CHANGED
|
@@ -134,6 +134,7 @@ export class Bundler {
|
|
|
134
134
|
- single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
|
|
135
135
|
- dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
|
|
136
136
|
- resolve_alias?: 配置 resolve alias
|
|
137
|
+
- resolve_fallback?: 配置 resolve fallback
|
|
137
138
|
- assets_stats?: `true` 打印输出的文件信息
|
|
138
139
|
- analyzer?: `false` 启用 WebpackBundleAnalyzer 插件分析构建产物大小
|
|
139
140
|
- dts?: `false` 生成 .d.ts 文件
|
|
@@ -142,7 +143,7 @@ export class Bundler {
|
|
|
142
143
|
- production?: `true` webpack mode 设置为 'production'
|
|
143
144
|
- sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
|
|
144
145
|
- license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
|
|
145
|
-
constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, commonjs2 = false, single_chunk = true, dynamic_import = true, resolve_alias, assets_stats = true, analyzer = false, dts = false, exclude_modules, cache_version, production = true, sass, dependencies, license, } = {}) {
|
|
146
|
+
constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, commonjs2 = false, single_chunk = true, dynamic_import = true, resolve_alias, resolve_fallback, assets_stats = true, analyzer = false, dts = false, exclude_modules, cache_version, production = true, sass, dependencies, license, } = {}) {
|
|
146
147
|
this.name = name;
|
|
147
148
|
this.analyzer = analyzer;
|
|
148
149
|
this.production = production;
|
|
@@ -222,6 +223,7 @@ export class Bundler {
|
|
|
222
223
|
// modules: [
|
|
223
224
|
// '',
|
|
224
225
|
// ],
|
|
226
|
+
...resolve_fallback ? { fallback: resolve_fallback } : {},
|
|
225
227
|
// fallback: {
|
|
226
228
|
// os: false,
|
|
227
229
|
// }
|
|
@@ -496,7 +498,7 @@ export class Bundler {
|
|
|
496
498
|
console.log(`已构建 ${fp_html}`);
|
|
497
499
|
}));
|
|
498
500
|
if (print.info)
|
|
499
|
-
console.log(
|
|
501
|
+
console.log(`${this.name}.htmls 已构建完成`);
|
|
500
502
|
}
|
|
501
503
|
resolve_dependencies(dependency_ids = this.dependencies, resolveds = new Set()) {
|
|
502
504
|
dependency_ids.forEach(id => {
|
|
@@ -525,7 +527,7 @@ export class Bundler {
|
|
|
525
527
|
}
|
|
526
528
|
async copy_files({ dependencies = this.dependencies, production = this.production, assets = this.assets, fpd_root = this.fpd_root, fpd_out = this.fpd_out, print = { info: true, files: false } } = {}) {
|
|
527
529
|
if (print.info)
|
|
528
|
-
console.log(`复制 ${this.name}
|
|
530
|
+
console.log(`复制 ${this.name} 项目文件及依赖 → ${this.fpd_out}`);
|
|
529
531
|
if (dependencies)
|
|
530
532
|
await fmkdir(`${fpd_out}vendors/`, { print: false });
|
|
531
533
|
async function fcopy_asset(asset) {
|