xshell 1.0.193 → 1.0.195

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.
Files changed (3) hide show
  1. package/builder.d.ts +3 -1
  2. package/builder.js +9 -5
  3. package/package.json +14 -14
package/builder.d.ts CHANGED
@@ -63,6 +63,7 @@ export interface BundlerOptions {
63
63
  sass?: typeof import('sass');
64
64
  dynamic_import?: boolean;
65
65
  commonjs2?: boolean;
66
+ expose?: boolean;
66
67
  assets_stats?: boolean;
67
68
  globals?: Record<string, string>;
68
69
  resolve_alias?: Record<string, string>;
@@ -118,6 +119,7 @@ export declare class Bundler {
118
119
  - template?: `false` 除了生成对应的 html 之外,还生成所有路径为 `{root}/...` 的模板 html 文件, 方便后续 server 替换渲染
119
120
  - local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
120
121
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
122
+ - expose?: `false` 入口模块所有导出的属性赋值到全局对象 globalThis 上
121
123
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
122
124
  - dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
123
125
  - resolve_alias?: 配置 resolve alias
@@ -130,7 +132,7 @@ export declare class Bundler {
130
132
  - production?: `true` webpack mode 设置为 'production'
131
133
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
132
134
  - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
133
- 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, assets_root, template, commonjs2, single_chunk, dynamic_import, resolve_alias, resolve_fallback, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
135
+ 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, assets_root, template, commonjs2, expose, single_chunk, dynamic_import, resolve_alias, resolve_fallback, assets_stats, analyzer, dts, exclude_modules, cache_version, production, sass, dependencies, license, }?: BundlerOptions);
134
136
  build(print?: boolean): Promise<void>;
135
137
  close(): Promise<void>;
136
138
  build_all(print?: boolean): Promise<void>;
package/builder.js CHANGED
@@ -144,6 +144,7 @@ export class Bundler {
144
144
  - template?: `false` 除了生成对应的 html 之外,还生成所有路径为 `{root}/...` 的模板 html 文件, 方便后续 server 替换渲染
145
145
  - local_loaders?: `true` true 时使用项目 node_modules/ 中的 loader; false 时使用 D:/0/ 下面的
146
146
  - commonjs2?: `false` 打包为 commonjs2 (.cjs) 的文件
147
+ - expose?: `false` 入口模块所有导出的属性赋值到全局对象 globalThis 上
147
148
  - single_chunk?: `true` 输出为单个文件,将依赖也打包到其中,不要生成多个 chunk
148
149
  - dynamic_import?: `true` 对于 await import('...') 要不要打包外部模块到输出文件中
149
150
  - resolve_alias?: 配置 resolve alias
@@ -156,7 +157,7 @@ export class Bundler {
156
157
  - production?: `true` webpack mode 设置为 'production'
157
158
  - sass?: 传入 sass 实例避免 webpack 重复加载 .cjs 版本
158
159
  - license?: 使用 license-webpack-plugin 构建 ThirdPartyNotice.txt */
159
- constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, assets_root = '/', template = false, 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, } = {}) {
160
+ constructor(name, target, fpd_root, fpd_out, fpdt_cache, entry, { source_map = true, globals, external_dayjs = false, externals, htmls, assets, assets_root = '/', template = false, commonjs2 = false, expose = 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, } = {}) {
160
161
  this.name = name;
161
162
  this.analyzer = analyzer;
162
163
  this.production = production;
@@ -174,6 +175,9 @@ export class Bundler {
174
175
  assert(target === 'web');
175
176
  this.dependencies = dependencies;
176
177
  }
178
+ if (expose && commonjs2)
179
+ throw new Error('expose 和 commonjs2 不能同时启用');
180
+ const output_module = !commonjs2 && !expose;
177
181
  this.license = license;
178
182
  // let smp = new SpeedMeasurePlugin()
179
183
  // const config: Webpack.Configuration = smp.wrap({
@@ -186,7 +190,7 @@ export class Bundler {
186
190
  context: fpd_root,
187
191
  entry,
188
192
  experiments: {
189
- outputModule: !commonjs2,
193
+ outputModule: output_module,
190
194
  },
191
195
  output: {
192
196
  path: fpd_out,
@@ -194,16 +198,16 @@ export class Bundler {
194
198
  publicPath: '/',
195
199
  pathinfo: true,
196
200
  globalObject: 'globalThis',
197
- module: !commonjs2,
201
+ module: output_module,
198
202
  // 在 bundle 中导出 entry 文件的 export
199
203
  library: {
200
- type: commonjs2 ? 'commonjs2' : 'module',
204
+ type: commonjs2 ? 'commonjs2' : expose ? 'global' : 'module',
201
205
  },
202
206
  ...single_chunk ? {
203
207
  chunkLoading: false
204
208
  } : {},
205
209
  },
206
- target: [target === 'web' ? 'web' : 'node22', 'es2024'],
210
+ target: [target === 'web' ? 'web' : 'node23', 'es2024'],
207
211
  // 结合 output.globalObject, 会生成 globalThis['React'] 这样的引用
208
212
  externalsType: target === 'nodejs' ? 'commonjs2' : 'global',
209
213
  // 以 react: 'React', 为例,含义为
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.193",
3
+ "version": "1.0.195",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -53,13 +53,13 @@
53
53
  "@babel/parser": "^7.26.2",
54
54
  "@babel/traverse": "^7.25.9",
55
55
  "@koa/cors": "^5.0.0",
56
- "@stylistic/eslint-plugin": "^2.10.0",
56
+ "@stylistic/eslint-plugin": "^2.10.1",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.9",
59
- "@types/ws": "^8.5.12",
60
- "@typescript-eslint/eslint-plugin": "^8.12.2",
61
- "@typescript-eslint/parser": "^8.12.2",
62
- "@typescript-eslint/utils": "^8.12.2",
59
+ "@types/ws": "^8.5.13",
60
+ "@typescript-eslint/eslint-plugin": "^8.13.0",
61
+ "@typescript-eslint/parser": "^8.13.0",
62
+ "@typescript-eslint/utils": "^8.13.0",
63
63
  "@xterm/addon-fit": "^0.10.0",
64
64
  "@xterm/addon-web-links": "^0.11.0",
65
65
  "@xterm/addon-webgl": "^0.18.0",
@@ -75,7 +75,7 @@
75
75
  "commander": "^12.1.0",
76
76
  "css-loader": "^7.1.2",
77
77
  "emoji-regex": "^10.4.0",
78
- "eslint": "^9.13.0",
78
+ "eslint": "^9.14.0",
79
79
  "eslint-plugin-import": "^2.31.0",
80
80
  "eslint-plugin-react": "^7.37.2",
81
81
  "gulp-sort": "^2.0.0",
@@ -89,26 +89,26 @@
89
89
  "lodash": "^4.17.21",
90
90
  "map-stream": "^0.0.7",
91
91
  "mime-types": "^2.1.35",
92
- "ora": "^8.1.0",
92
+ "ora": "^8.1.1",
93
93
  "react": "^18.3.1",
94
94
  "react-i18next": "^15.1.0",
95
95
  "react-object-model": "^1.2.15",
96
96
  "resolve-path": "^1.4.0",
97
- "sass": "^1.80.5",
98
- "sass-loader": "^16.0.2",
97
+ "sass": "^1.80.6",
98
+ "sass-loader": "^16.0.3",
99
99
  "source-map-loader": "^5.0.0",
100
100
  "strip-ansi": "^7.1.0",
101
101
  "style-loader": "^4.0.0",
102
102
  "through2": "^4.0.2",
103
103
  "tough-cookie": "^5.0.0-rc.4",
104
104
  "ts-loader": "^9.5.1",
105
- "tslib": "^2.8.0",
105
+ "tslib": "^2.8.1",
106
106
  "typescript": "^5.6.3",
107
- "ua-parser-js": "^2.0.0-beta.3",
107
+ "ua-parser-js": "^2.0.0-rc.1",
108
108
  "undici": "^6.20.1",
109
109
  "vinyl": "^3.0.0",
110
110
  "vinyl-fs": "^4.0.0",
111
- "webpack": "^5.95.0",
111
+ "webpack": "^5.96.1",
112
112
  "webpack-bundle-analyzer": "^4.10.2",
113
113
  "ws": "^8.18.0"
114
114
  },
@@ -126,7 +126,7 @@
126
126
  "@types/koa-compress": "^4.0.6",
127
127
  "@types/lodash": "^4.17.13",
128
128
  "@types/mime-types": "^2.1.4",
129
- "@types/node": "^22.8.5",
129
+ "@types/node": "^22.9.0",
130
130
  "@types/react": "^18.3.12",
131
131
  "@types/through2": "^2.0.41",
132
132
  "@types/tough-cookie": "^4.0.5",