filecat 1.0.7 → 1.0.9

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.
@@ -0,0 +1,408 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ * Array of passes.
9
+ *
10
+ * A `pass` is just a function that is executed on `req, res, options`
11
+ * so that you can easily add new checks while still keeping the base
12
+ * flexible.
13
+ */
14
+
15
+ /*!
16
+ * Array of passes.
17
+ *
18
+ * A `pass` is just a function that is executed on `req, socket, options`
19
+ * so that you can easily add new checks while still keeping the base
20
+ * flexible.
21
+ */
22
+
23
+ /*!
24
+ * Caron dimonio, con occhi di bragia
25
+ * loro accennando, tutte le raccoglie;
26
+ * batte col remo qualunque s’adagia
27
+ *
28
+ * Charon the demon, with the eyes of glede,
29
+ * Beckoning to them, collects them all together,
30
+ * Beats with his oar whoever lags behind
31
+ *
32
+ * Dante - The Divine Comedy (Canto III)
33
+ */
34
+
35
+ /*!
36
+ * accepts
37
+ * Copyright(c) 2014 Jonathan Ong
38
+ * Copyright(c) 2015 Douglas Christopher Wilson
39
+ * MIT Licensed
40
+ */
41
+
42
+ /*!
43
+ * body-parser
44
+ * Copyright(c) 2014 Jonathan Ong
45
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
46
+ * MIT Licensed
47
+ */
48
+
49
+ /*!
50
+ * body-parser
51
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
52
+ * MIT Licensed
53
+ */
54
+
55
+ /*!
56
+ * bytes
57
+ * Copyright(c) 2012-2014 TJ Holowaychuk
58
+ * Copyright(c) 2015 Jed Watson
59
+ * MIT Licensed
60
+ */
61
+
62
+ /*!
63
+ * content-disposition
64
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
65
+ * MIT Licensed
66
+ */
67
+
68
+ /*!
69
+ * content-type
70
+ * Copyright(c) 2015 Douglas Christopher Wilson
71
+ * MIT Licensed
72
+ */
73
+
74
+ /*!
75
+ * cookie
76
+ * Copyright(c) 2012-2014 Roman Shtylman
77
+ * Copyright(c) 2015 Douglas Christopher Wilson
78
+ * MIT Licensed
79
+ */
80
+
81
+ /*!
82
+ * cookies
83
+ * Copyright(c) 2014 Jed Schmidt, http://jed.is/
84
+ * Copyright(c) 2015-2016 Douglas Christopher Wilson
85
+ * MIT Licensed
86
+ */
87
+
88
+ /*!
89
+ * copy-to - index.js
90
+ * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
91
+ * MIT Licensed
92
+ */
93
+
94
+ /*!
95
+ * depd
96
+ * Copyright(c) 2014 Douglas Christopher Wilson
97
+ * MIT Licensed
98
+ */
99
+
100
+ /*!
101
+ * depd
102
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
103
+ * MIT Licensed
104
+ */
105
+
106
+ /*!
107
+ * depd
108
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
109
+ * MIT Licensed
110
+ */
111
+
112
+ /*!
113
+ * depd
114
+ * Copyright(c) 2014-2018 Douglas Christopher Wilson
115
+ * MIT Licensed
116
+ */
117
+
118
+ /*!
119
+ * depd
120
+ * Copyright(c) 2015 Douglas Christopher Wilson
121
+ * MIT Licensed
122
+ */
123
+
124
+ /*!
125
+ * destroy
126
+ * Copyright(c) 2014 Jonathan Ong
127
+ * Copyright(c) 2015-2022 Douglas Christopher Wilson
128
+ * MIT Licensed
129
+ */
130
+
131
+ /*!
132
+ * ee-first
133
+ * Copyright(c) 2014 Jonathan Ong
134
+ * MIT Licensed
135
+ */
136
+
137
+ /*!
138
+ * encodeurl
139
+ * Copyright(c) 2016 Douglas Christopher Wilson
140
+ * MIT Licensed
141
+ */
142
+
143
+ /*!
144
+ * escape-html
145
+ * Copyright(c) 2012-2013 TJ Holowaychuk
146
+ * Copyright(c) 2015 Andreas Lubbe
147
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
148
+ * MIT Licensed
149
+ */
150
+
151
+ /*!
152
+ * etag
153
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
154
+ * MIT Licensed
155
+ */
156
+
157
+ /*!
158
+ * express
159
+ * Copyright(c) 2009-2013 TJ Holowaychuk
160
+ * Copyright(c) 2013 Roman Shtylman
161
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
162
+ * MIT Licensed
163
+ */
164
+
165
+ /*!
166
+ * express
167
+ * Copyright(c) 2009-2013 TJ Holowaychuk
168
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
169
+ * MIT Licensed
170
+ */
171
+
172
+ /*!
173
+ * finalhandler
174
+ * Copyright(c) 2014-2022 Douglas Christopher Wilson
175
+ * MIT Licensed
176
+ */
177
+
178
+ /*!
179
+ * forwarded
180
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
181
+ * MIT Licensed
182
+ */
183
+
184
+ /*!
185
+ * fresh
186
+ * Copyright(c) 2012 TJ Holowaychuk
187
+ * Copyright(c) 2016-2017 Douglas Christopher Wilson
188
+ * MIT Licensed
189
+ */
190
+
191
+ /*!
192
+ * http-errors
193
+ * Copyright(c) 2014 Jonathan Ong
194
+ * Copyright(c) 2016 Douglas Christopher Wilson
195
+ * MIT Licensed
196
+ */
197
+
198
+ /*!
199
+ * keygrip
200
+ * Copyright(c) 2011-2014 Jed Schmidt
201
+ * MIT Licensed
202
+ */
203
+
204
+ /*!
205
+ * media-typer
206
+ * Copyright(c) 2014 Douglas Christopher Wilson
207
+ * MIT Licensed
208
+ */
209
+
210
+ /*!
211
+ * merge-descriptors
212
+ * Copyright(c) 2014 Jonathan Ong
213
+ * Copyright(c) 2015 Douglas Christopher Wilson
214
+ * MIT Licensed
215
+ */
216
+
217
+ /*!
218
+ * methods
219
+ * Copyright(c) 2013-2014 TJ Holowaychuk
220
+ * Copyright(c) 2015-2016 Douglas Christopher Wilson
221
+ * MIT Licensed
222
+ */
223
+
224
+ /*!
225
+ * mime-db
226
+ * Copyright(c) 2014 Jonathan Ong
227
+ * Copyright(c) 2015-2022 Douglas Christopher Wilson
228
+ * MIT Licensed
229
+ */
230
+
231
+ /*!
232
+ * mime-types
233
+ * Copyright(c) 2014 Jonathan Ong
234
+ * Copyright(c) 2015 Douglas Christopher Wilson
235
+ * MIT Licensed
236
+ */
237
+
238
+ /*!
239
+ * multer
240
+ * Copyright(c) 2014 Hage Yaapa
241
+ * Copyright(c) 2015 Fangdun Cai
242
+ * MIT Licensed
243
+ */
244
+
245
+ /*!
246
+ * negotiator
247
+ * Copyright(c) 2012 Federico Romero
248
+ * Copyright(c) 2012-2014 Isaac Z. Schlueter
249
+ * Copyright(c) 2015 Douglas Christopher Wilson
250
+ * MIT Licensed
251
+ */
252
+
253
+ /*!
254
+ * normalize-path <https://github.com/jonschlinkert/normalize-path>
255
+ *
256
+ * Copyright (c) 2014-2018, Jon Schlinkert.
257
+ * Released under the MIT License.
258
+ */
259
+
260
+ /*!
261
+ * on-finished
262
+ * Copyright(c) 2013 Jonathan Ong
263
+ * Copyright(c) 2014 Douglas Christopher Wilson
264
+ * MIT Licensed
265
+ */
266
+
267
+ /*!
268
+ * parseurl
269
+ * Copyright(c) 2014 Jonathan Ong
270
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
271
+ * MIT Licensed
272
+ */
273
+
274
+ /*!
275
+ * proxy-addr
276
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
277
+ * MIT Licensed
278
+ */
279
+
280
+ /*!
281
+ * range-parser
282
+ * Copyright(c) 2012-2014 TJ Holowaychuk
283
+ * Copyright(c) 2015-2016 Douglas Christopher Wilson
284
+ * MIT Licensed
285
+ */
286
+
287
+ /*!
288
+ * raw-body
289
+ * Copyright(c) 2013-2014 Jonathan Ong
290
+ * Copyright(c) 2014-2022 Douglas Christopher Wilson
291
+ * MIT Licensed
292
+ */
293
+
294
+ /*!
295
+ * send
296
+ * Copyright(c) 2012 TJ Holowaychuk
297
+ * Copyright(c) 2014-2022 Douglas Christopher Wilson
298
+ * MIT Licensed
299
+ */
300
+
301
+ /*!
302
+ * serve-static
303
+ * Copyright(c) 2010 Sencha Inc.
304
+ * Copyright(c) 2011 TJ Holowaychuk
305
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
306
+ * MIT Licensed
307
+ */
308
+
309
+ /*!
310
+ * statuses
311
+ * Copyright(c) 2014 Jonathan Ong
312
+ * Copyright(c) 2016 Douglas Christopher Wilson
313
+ * MIT Licensed
314
+ */
315
+
316
+ /*!
317
+ * toidentifier
318
+ * Copyright(c) 2016 Douglas Christopher Wilson
319
+ * MIT Licensed
320
+ */
321
+
322
+ /*!
323
+ * type-is
324
+ * Copyright(c) 2014 Jonathan Ong
325
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
326
+ * MIT Licensed
327
+ */
328
+
329
+ /*!
330
+ * unpipe
331
+ * Copyright(c) 2015 Douglas Christopher Wilson
332
+ * MIT Licensed
333
+ */
334
+
335
+ /*!
336
+ * vary
337
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
338
+ * MIT Licensed
339
+ */
340
+
341
+ /*! *****************************************************************************
342
+ Copyright (C) Microsoft. All rights reserved.
343
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
344
+ this file except in compliance with the License. You may obtain a copy of the
345
+ License at http://www.apache.org/licenses/LICENSE-2.0
346
+
347
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
348
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
349
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
350
+ MERCHANTABLITY OR NON-INFRINGEMENT.
351
+
352
+ See the Apache Version 2.0 License for specific language governing permissions
353
+ and limitations under the License.
354
+ ***************************************************************************** */
355
+
356
+ /*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
357
+
358
+ /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
359
+
360
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
361
+
362
+ /**
363
+ * Archiver Core
364
+ *
365
+ * @ignore
366
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
367
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
368
+ */
369
+
370
+ /**
371
+ * Archiver Vending
372
+ *
373
+ * @ignore
374
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
375
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
376
+ */
377
+
378
+ /**
379
+ * JSON Format Plugin
380
+ *
381
+ * @module plugins/json
382
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
383
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
384
+ */
385
+
386
+ /**
387
+ * TAR Format Plugin
388
+ *
389
+ * @module plugins/tar
390
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
391
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
392
+ */
393
+
394
+ /**
395
+ * ZIP Format Plugin
396
+ *
397
+ * @module plugins/zip
398
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
399
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
400
+ */
401
+
402
+ /**
403
+ * ZipStream
404
+ *
405
+ * @ignore
406
+ * @license [MIT]{@link https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE}
407
+ * @copyright (c) 2014 Chris Talkington, contributors.
408
+ */
package/package.json CHANGED
@@ -1,26 +1,29 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "filecat 文件管理器",
5
5
  "author": "xiaobaidadada",
6
6
  "scripts": {
7
7
  "dev": "node --require ts-node/register ./shell/dev.js --env ./env",
8
- "dev-debug": "node --inspect=0.0.0.0:9001 --require ts-node/register ./shell/dev.js --env ./env",
8
+ "server-debug-js": "tsc && node build/server/main/server.js --env ./env",
9
+ "server-dev-inspect": "node --inspect=0.0.0.0:9001 --require ts-node/register ./shell/dev.js --env ./env",
9
10
  "server-dev": "node --require ts-node/register ./src/main/server.ts --env ./env",
10
11
  "webpack-dev": "npx webpack serve --mode development --config shell/config/webpack.config.js",
11
12
  "generate-proto": "node --require ts-node/register ./src/common/proto/proto.generate.ts",
12
13
  "hot-server-dev": "node --require ts-node/register ./src/main/piping.main.ts ",
13
14
  "webpack-build": "npx webpack --config shell/config/webpack.config.js",
14
15
  "i-dev": "npm i --omit=dev",
15
- "build": "tsc && node shell/build.js",
16
+ "build": "npm run npm-build",
17
+ "npm-build": "tsc && node shell/build.js npm",
18
+ "docker-build": "tsc && node shell/build.js docker",
19
+ "pkg-build": "tsc && node shell/build.js pkg",
16
20
  "start": "node build/main.js",
17
- "pkg-win-amd64": "npm run build && pkg . --targets node18-win-x64 --output filecat-win.exe",
18
- "pkg-linux-amd64": "npm run build && pkg . --targets node18-linux-x64 --output filecat-linux"
21
+ "pkg-win-amd64": "npm run pkg-build && pkg . --no-dependencies --targets node18-win-x64 --output filecat-win.exe",
22
+ "pkg-linux-amd64": "npm run pkg-build && pkg . --no-dependencies --targets node18-linux-x64 --output filecat-linux"
19
23
  },
20
24
  "pkg": {
21
25
  "assets": [
22
- "build/dist/**/**",
23
- "node_modules/@xiaobaidadada/node-tuntap2-wintun/wintun_dll/*.dll"
26
+ "build/**/**"
24
27
  ]
25
28
  },
26
29
  "bin": {
@@ -51,39 +54,11 @@
51
54
  "package.json"
52
55
  ],
53
56
  "dependencies": {
54
- "@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
55
- "@koa/cors": "^5.0.0",
57
+ "@xiaobaidadada/node-pty-prebuilt": "^1.0.3",
56
58
  "@xiaobaidadada/node-tuntap2-wintun": "^1.0.6",
57
- "archiver": "^7.0.1",
58
- "fluent-ffmpeg": "^2.1.3",
59
- "fs-extra": "^11.2.0",
60
- "jmespath": "^0.16.0",
61
- "koa": "^2.15.2",
62
- "koa-body": "^6.0.1",
63
- "koa-proxies": "^0.12.4",
64
- "koa-router": "^12.0.1",
65
- "mime-types": "^2.1.35",
66
- "multer": "^1.4.5-lts.1",
67
- "needle": "^3.3.1",
68
- "node-forge": "^1.3.1",
69
59
  "node-process-watcher": "^1.0.2",
70
60
  "node-unrar-js": "^2.0.2",
71
- "protobufjs-cli": "^1.1.3",
72
- "reflect-metadata": "^0.2.1",
73
- "rimraf": "^5.0.5",
74
- "routing-controllers": "^0.10.4",
75
- "serialize-javascript": "^6.0.2",
76
- "socket.io-parser": "^4.2.4",
77
- "ssh2": "^1.15.0",
78
- "sshpk": "^1.18.0",
79
- "systeminformation": "^5.22.11",
80
- "tar": "^7.4.3",
81
- "tencentcloud-sdk-nodejs": "^4.0.858",
82
- "tldts": "^6.1.20",
83
- "tslib": "^2.6.3",
84
- "typedi": "^0.10.0",
85
- "unzipper": "^0.12.2",
86
- "ws": "^8.16.0"
61
+ "ssh2": "^1.15.0"
87
62
  },
88
63
  "devDependencies": {
89
64
  "@babel/core": "^7.24.3",
@@ -92,17 +67,24 @@
92
67
  "@babel/preset-react": "^7.24.1",
93
68
  "@babel/preset-typescript": "^7.24.1",
94
69
  "@excalidraw/excalidraw": "^0.17.6",
70
+ "@koa/cors": "^5.0.0",
95
71
  "@xterm/addon-fit": "^0.10.0",
96
72
  "@xterm/xterm": "^5.5.0",
97
73
  "ace-builds": "^1.32.9",
74
+ "archiver": "^7.0.1",
98
75
  "axios": "^1.6.8",
99
76
  "babel-loader": "^9.1.3",
100
77
  "chart.js": "^4.4.2",
78
+ "copy-webpack-plugin": "^12.0.2",
101
79
  "css-loader": "^6.10.0",
80
+ "fluent-ffmpeg": "^2.1.3",
102
81
  "flv.js": "^1.6.2",
82
+ "fs-extra": "^11.2.0",
103
83
  "github-markdown-css": "^5.6.1",
104
84
  "html-webpack-plugin": "^5.6.0",
85
+ "http-proxy-middleware": "^3.0.3",
105
86
  "i18next": "^23.12.2",
87
+ "koa-proxies": "^0.12.4",
106
88
  "listr2": "^8.2.1",
107
89
  "lodash": "^4.17.21",
108
90
  "markdown-it": "^14.1.0",
@@ -112,25 +94,42 @@
112
94
  "markdown-it-sup": "^2.0.0",
113
95
  "markdown-it-task-lists": "^2.1.1",
114
96
  "material-icons": "^1.13.12",
97
+ "mime-types": "^2.1.35",
98
+ "needle": "^3.3.1",
99
+ "node-forge": "^1.3.1",
100
+ "node-loader": "^2.1.0",
115
101
  "normalize.css": "^8.0.1",
116
102
  "noty": "^3.2.0-beta-deprecated",
117
103
  "piping": "^1.0.0-rc.4",
118
104
  "pkg": "^5.8.1",
105
+ "protobufjs-cli": "^1.1.3",
119
106
  "react": "^18.3.1",
120
107
  "react-ace": "^12.0.0",
121
108
  "react-dom": "^18.3.1",
122
109
  "react-i18next": "^15.0.0",
123
110
  "react-router-dom": "^6.26.2",
124
111
  "recoil": "^0.7.7",
112
+ "reflect-metadata": "^0.2.1",
113
+ "rimraf": "^5.0.5",
114
+ "routing-controllers": "^0.10.4",
115
+ "serialize-javascript": "^6.0.2",
116
+ "socket.io-parser": "^4.2.4",
117
+ "sshpk": "^1.18.0",
125
118
  "style-loader": "^3.3.4",
119
+ "systeminformation": "^5.22.11",
120
+ "tar": "^7.4.3",
121
+ "tldts": "^6.1.20",
126
122
  "ts-node": "^10.9.2",
123
+ "typedi": "^0.10.0",
127
124
  "typescript": "^5.6.3",
125
+ "unzipper": "^0.12.3",
128
126
  "video.js": "^8.17.2",
129
127
  "videojs-hotkeys": "^0.2.28",
130
- "webpack": "^5.91.0",
128
+ "webpack": "^5.96.1",
131
129
  "webpack-bundle-analyzer": "^4.10.2",
132
130
  "webpack-cli": "^5.1.4",
133
131
  "webpack-dev-server": "^5.0.4",
134
- "webpack-node-externals": "^3.0.0"
132
+ "webpack-node-externals": "^3.0.0",
133
+ "ws": "^8.16.0"
135
134
  }
136
135
  }
package/shell/build.js CHANGED
@@ -1,13 +1,42 @@
1
1
  const {Listr} = require("listr2");
2
2
  const webpack = require('webpack');
3
3
  const config = require('./config/webpack.config.js');
4
- const serverConfig = require('./config/webpack.server.config.js');
4
+ const args = process.argv.slice(2); // slice to remove the first two default values
5
+ let serverConfig ;
6
+ if (args.length ===0 || args[0]==="npm") {
7
+ serverConfig = require('./config/webpack.npm.config.js');
8
+ } else if (args[0]==="pkg") {
9
+ serverConfig = require('./config/webpack.pkg.config.js');
10
+ } else if (args[0]==="docker") {
11
+ serverConfig = require('./config/webpack.docker.config.js');
12
+ }
5
13
  const {copyFileSync} = require("fs");
14
+ const fs = require("fs");
6
15
  const path = require("path");
7
16
  const {rimraf} = require("rimraf");
8
17
  const fse = require("fs-extra");
9
18
 
19
+ // 只能复制文件
20
+ function copyFiles(sourceDir,destDir) {
21
+ try {
22
+ const files = fs.readdirSync(sourceDir); // 获取源目录下的所有文件/文件夹
10
23
 
24
+ for (const file of files) {
25
+ const sourcePath = path.join(sourceDir, file);
26
+ const destPath = path.join(destDir, file);
27
+ const stat = fs.statSync(sourcePath); // 获取文件信息,判断是文件还是目录
28
+ if (stat.isDirectory()) {
29
+ // 如果是目录 暂时不做处理
30
+ } else {
31
+ // 如果是文件,则直接复制
32
+ fs.copyFileSync(sourcePath, destPath);
33
+ }
34
+ }
35
+ console.log(`${sourceDir}:下所有文件复制完成!\n`);
36
+ } catch (err) {
37
+ console.error('复制文件时出错:', err);
38
+ }
39
+ }
11
40
  const tasksLister = new Listr(
12
41
  [
13
42
  {
@@ -30,6 +59,9 @@ const tasksLister = new Listr(
30
59
  // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "net", "wintun-x86.dll"), path.join(__dirname, "..", "build", "wintun-x86.dll"))
31
60
  // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg"), path.join(__dirname, "..", "build", "ffmpeg"))
32
61
  // copyFileSync(path.join(__dirname, "..", "src", "main", "domain", "bin", "ffmpeg.exe"), path.join(__dirname, "..", "build", "ffmpeg.exe"))
62
+ if (args[0]!=="npm") {
63
+ copyFiles(path.resolve("node_modules/@xiaobaidadada/node-tuntap2-wintun/wintun_dll"),path.join(__dirname, "..", "build"))
64
+ }
33
65
  rimraf(path.join(__dirname,"..","build","server"));
34
66
  res(true);
35
67
  });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ptyPath = void 0;
4
+ var fs = require("fs");
5
+ var os = require("os");
6
+ var path = require("path");
7
+ function prebuildName() {
8
+ var tags = [];
9
+ tags.push(process.versions.hasOwnProperty('electron') ? 'electron' : 'node');
10
+ tags.push('abi' + process.versions.modules);
11
+ if (os.platform() === 'linux' && fs.existsSync('/etc/alpine-release')) {
12
+ tags.push('musl');
13
+ }
14
+ return tags.join('.') + '.node';
15
+ }
16
+ var pathToBuild = path.resolve(__dirname, "../prebuilds/".concat(os.platform(), "-").concat(os.arch(), "/").concat(prebuildName()));
17
+ exports.ptyPath = fs.existsSync(pathToBuild) ? pathToBuild : null;
18
+ //# sourceMappingURL=prebuild-file-path.js.map
@@ -0,0 +1,62 @@
1
+ const path = require('path');
2
+ const nodeExternals = require('webpack-node-externals');
3
+ const webpack = require('webpack');
4
+ const TerserPlugin = require("terser-webpack-plugin");
5
+ const package_data = require("../../package.json")
6
+ var prebuild_file_path_1 = require("./prebuild-file-path");
7
+ const plugins = [
8
+ new webpack.DefinePlugin({
9
+ 'process.env.NODE_ENV': JSON.stringify('production'),
10
+ }),
11
+ new webpack.DefinePlugin({
12
+ 'process.env.version': JSON.stringify(package_data.version),
13
+ }),
14
+ new webpack.DefinePlugin({
15
+ 'process.platform': JSON.stringify(process.platform) // 这里将 process.platform 替换为实际的值 在遇到动态打包的时候require 可以判断类型 函数内部的无法判断
16
+ }),
17
+ new webpack.DefinePlugin({
18
+ 'process.env.run_env': JSON.stringify("docker") // 必须用 JSON.stringify
19
+ }),
20
+ new webpack.IgnorePlugin({
21
+ resourceRegExp: /Debug/,
22
+ })
23
+ ];
24
+ module.exports = {
25
+ target: 'node', // 指定打包结果运行在node环境下
26
+ mode: 'production', // 或者 'production'
27
+ entry: path.join(__dirname, "..", "..", "build", "server", "main", "server.js"), // 你的TypeScript入口文件路径
28
+ output: {
29
+ path: path.resolve(__dirname, "..", "..", "build"), // 输出目录
30
+ filename: 'main.js', // 输出文件名
31
+ },
32
+ resolve: {
33
+ extensions: ['.ts', '.js', '.node'], // 解析文件时自动补全的文件扩展名
34
+ },
35
+ module: {
36
+ rules: [
37
+ {
38
+ test: /\.node$|Addon$/,
39
+ loader: 'node-loader', // 会拷贝.node 并改变require路径 到build目录下 但是如果 .node 有更新 他是不会不更新的需要先删除?
40
+ }
41
+ ]
42
+ },
43
+ externalsPresets: { node: true },
44
+ externals: [
45
+ {
46
+ '@aws-sdk/client-s3': 'S3', // 假设全局变量名为 S3 是 @aws-sdk/client-s3带 @符号的话会无法压缩
47
+ 'cors':'commonjs cors' // 动态加载无法打包 如果需要可以使用 import "cors"
48
+ // 'routing-controllers':'commonjs routing-controllers', // 有一些动态引入(他需要的动态引入也需要导入),或者含有.node(使用用户自己安装编译的版本) 无法被打包 直接忽略这个包
49
+ }
50
+ ],
51
+ // externals: [nodeExternals()], // 将所有的外部模块排除打包
52
+ plugins,
53
+ optimization: {
54
+ minimize: true, // 压缩Js代码
55
+ minimizer: [
56
+ new TerserPlugin({
57
+ extractComments: true,//不将注释提取到单独的文件中
58
+ }),
59
+ ],
60
+ }
61
+
62
+ };