hfs 0.29.0 → 0.29.1-rc2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfs",
3
- "version": "0.29.0",
3
+ "version": "0.29.1-rc2",
4
4
  "description": "HTTP File Server",
5
5
  "keywords": [
6
6
  "file server",
@@ -16,7 +16,7 @@
16
16
  "start-frontend": "npm run start --workspace=frontend",
17
17
  "start-admin": "npm run start --workspace=admin",
18
18
  "build-all": "npm audit --omit=dev && rm -rf dist && npm i && npm run build-server && npm run build-frontend && npm run build-admin && echo COMPLETED",
19
- "build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json README* LICENSE* plugins dist && find dist -name .DS_Store -delete",
19
+ "build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json README* LICENSE* plugins dist && find dist -name .DS_Store -delete && node afterbuild.js",
20
20
  "build-frontend": "npm run build --workspace=frontend",
21
21
  "build-admin": "npm run build --workspace=admin",
22
22
  "server-for-test": "node dist/src --cwd . --config tests",
@@ -1,5 +1,28 @@
1
1
  "use strict";
2
2
  // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
3
26
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
28
  };
@@ -12,7 +35,7 @@ const assert_1 = __importDefault(require("assert"));
12
35
  const ZIP64_SIZE_LIMIT = 0xffffffff;
13
36
  const ZIP64_NUMBER_LIMIT = 0xffff;
14
37
  let crc32function;
15
- import('@node-rs/crc32').then(lib => crc32function = lib.crc32, () => {
38
+ Promise.resolve().then(() => __importStar(require('@node-rs/crc32'))).then(lib => crc32function = lib.crc32, () => {
16
39
  console.log('using generic lib for crc32');
17
40
  crc32function = buffer_crc32_1.unsigned;
18
41
  });
package/src/commands.js CHANGED
@@ -33,7 +33,7 @@ function parseCommandLine(line) {
33
33
  return console.error("cannot understand entered command, try 'help'");
34
34
  if (cmd.cb.length > params.length)
35
35
  return console.error("insufficient parameters, expected: " + cmd.params);
36
- cmd.cb(...params).then(() => console.log("+++ command executed"), (err) => {
36
+ Promise.resolve(cmd.cb(...params)).then(() => console.log("+++ command executed"), (err) => {
37
37
  if (typeof err === 'string')
38
38
  console.error("command failed:", err);
39
39
  else
@@ -43,7 +43,7 @@ function parseCommandLine(line) {
43
43
  const commands = {
44
44
  help: {
45
45
  params: '',
46
- async cb() {
46
+ cb() {
47
47
  console.log("supported commands:", ...lodash_1.default.map(commands, ({ params }, name) => '\n - ' + name + ' ' + params));
48
48
  }
49
49
  },
@@ -77,7 +77,7 @@ const commands = {
77
77
  },
78
78
  config: {
79
79
  params: '<key> <value>',
80
- async cb(key, value) {
80
+ cb(key, value) {
81
81
  const conf = (0, config_1.getConfigDefinition)(key);
82
82
  if (!conf)
83
83
  throw "specified key doesn't exist";
@@ -91,7 +91,7 @@ const commands = {
91
91
  },
92
92
  'show-config': {
93
93
  params: '<key>',
94
- async cb(key) {
94
+ cb(key) {
95
95
  const conf = (0, config_1.getConfigDefinition)(key);
96
96
  if (!conf)
97
97
  throw "specified key doesn't exist";
@@ -100,7 +100,7 @@ const commands = {
100
100
  },
101
101
  quit: {
102
102
  params: '',
103
- async cb() {
103
+ cb() {
104
104
  process.exit(0);
105
105
  }
106
106
  },
@@ -117,7 +117,7 @@ const commands = {
117
117
  },
118
118
  version: {
119
119
  params: '',
120
- async cb() {
120
+ cb() {
121
121
  console.log(const_1.VERSION);
122
122
  console.log(const_1.BUILD_TIMESTAMP);
123
123
  }
package/src/const.js CHANGED
@@ -38,7 +38,7 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
38
38
  exports.ORIGINAL_CWD = process.cwd();
39
39
  exports.HFS_STARTED = new Date();
40
40
  const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
41
- exports.BUILD_TIMESTAMP = fs.statSync(PKG_PATH).mtime.toISOString();
41
+ exports.BUILD_TIMESTAMP = "2023-01-27T14:09:35.790Z";
42
42
  const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
43
43
  exports.VERSION = pkg.version;
44
44
  exports.DAY = 86400000;
package/src/plugins.js CHANGED
@@ -224,7 +224,7 @@ async function rescan() {
224
224
  try {
225
225
  const alreadyRunning = plugins[id];
226
226
  console.log(alreadyRunning ? "reloading plugin" : "loading plugin", id);
227
- const { init, ...data } = await import(module);
227
+ const { init, ...data } = await Promise.resolve().then(() => __importStar(require(module)));
228
228
  delete data.default;
229
229
  deleteModule(require.resolve(module)); // avoid caching at next import
230
230
  calculateBadApi(data);
@@ -1,5 +1,28 @@
1
1
  "use strict";
2
2
  // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
3
26
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
28
  };
@@ -66,7 +89,7 @@ function serveProxied(port, uri) {
66
89
  return;
67
90
  console.debug('proxied on port', port);
68
91
  let proxy;
69
- import('koa-better-http-proxy').then(lib => // dynamic import to avoid having this in final distribution
92
+ Promise.resolve().then(() => __importStar(require('koa-better-http-proxy'))).then(lib => // dynamic import to avoid having this in final distribution
70
93
  proxy = lib.default('127.0.0.1:' + port, {
71
94
  proxyReqPathResolver: (ctx) => shouldServeApp(ctx) ? '/' : ctx.path,
72
95
  userResDecorator(res, data, ctx) {