safely-serve 0.0.8 → 0.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.
package/eslint.config.mjs CHANGED
@@ -1,38 +1,74 @@
1
-
2
1
  // SPDX-License-Identifier: GPL-3.0-or-later
3
2
 
4
- // ----------------------------------------------------------------------
5
- // Copyright © 2024, 2025
6
- // Jiang Jie
7
- // Copyright © 2025
8
- // Pellegrino Prevete
9
- //
10
- // All rights reserved
11
- // ----------------------------------------------------------------------
12
- //
13
- // This program is free software: you can redistribute it and/or modify
14
- // it under the terms of the GNU General Public License as published by
15
- // the Free Software Foundation, either version 3 of the License, or
16
- // (at your option) any later version.
17
- //
18
- // This program is distributed in the hope that it will be useful,
19
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- // GNU General Public License for more details.
22
- //
23
- // You should have received a copy of the GNU General Public License
24
- // along with this program. If not, see <https://www.gnu.org/licenses/>.
3
+ /** ----------------------------------------------------------------------
4
+ * Copyright ©
5
+ * Pellegrino Prevete
6
+ * 2024, 2025, 2026
7
+ *
8
+ * All rights reserved
9
+ * ----------------------------------------------------------------------
10
+ *
11
+ * This program is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
23
+ */
24
+
25
25
 
26
+ import js from "@eslint/js";
27
+ import globals from "globals";
26
28
  import { defineConfig } from "eslint/config";
27
29
 
30
+ const
31
+ _project =
32
+ "safely-serve";
33
+
28
34
  export default defineConfig([
29
- { ignores: [
30
- "build/**",
31
- "eslint.config.js"
32
- ],
33
- rules:
34
- { semi:
35
- "error",
36
- "prefer-const":
37
- "error" } },
35
+ { ignores: [
36
+ "build/**",
37
+ "eslint.config.js",
38
+ "man/**"
39
+ ],
40
+ rules:
41
+ { semi:
42
+ "error",
43
+ "prefer-const":
44
+ "error" },
45
+ files:
46
+ [ "**/*js,mjs,cjs}",
47
+ `**/${_project}*`,
48
+ `**/lib${_project}` ],
49
+ plugins:
50
+ { js },
51
+ extends:
52
+ [ "js/recommended" ],
53
+ languageOptions:
54
+ { globals:
55
+ { ...globals.browser,
56
+ ...globals.node} } },
57
+ { ignores: [
58
+ "build/**",
59
+ "eslint.config.js",
60
+ "man/**"
61
+ ],
62
+ rules:
63
+ { semi:
64
+ "error",
65
+ "prefer-const":
66
+ "error" },
67
+ files:
68
+ [ "**/*.js",
69
+ `**/${_project}*`,
70
+ `**/lib${_project}` ],
71
+ languageOptions:
72
+ { sourceType:
73
+ "commonjs" } },
38
74
  ]);
package/fs-worker.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={314:(e,o,n)=>{const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()},816:(e,o,n)=>{function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
1
+ (()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
package/libsafely-serve CHANGED
@@ -21,83 +21,116 @@
21
21
  // You should have received a copy of the GNU Affero General Public License
22
22
  // along with this program. If not, see <https://www.gnu.org/licenses/>.
23
23
 
24
+ /* eslint
25
+ no-unused-vars: [
26
+ "error",
27
+ { "vars":
28
+ "local",
29
+ "argsIgnorePattern":
30
+ "_output" } ] */
31
+ /* eslint
32
+ no-unassigned-vars:
33
+ "off" */
34
+
24
35
  const
25
36
  { spawn } =
26
37
  require(
27
38
  "node:child_process");
28
- _spawn =
29
- spawn;
39
+ /* global
40
+ _spawn */
41
+ const
42
+ _spawn =
43
+ spawn;
30
44
  const
31
45
  _cert_tools_module =
32
46
  require(
33
47
  'cert-tools');
34
- _cert_gen =
35
- _cert_tools_module._cert_gen;
48
+ /* global
49
+ _cert_gen */
50
+ const
51
+ _cert_gen =
52
+ _cert_tools_module._cert_gen;
36
53
  const
37
54
  _sha_module =
38
55
  require(
39
56
  'js-sha256');
40
- _sha256 =
41
- _sha_module.sha256;
57
+ /* global
58
+ _sha256 */
59
+ const
60
+ _sha256 =
61
+ _sha_module.sha256;
42
62
  const
43
63
  _libcrash =
44
64
  require(
45
65
  'crash-js');
46
- _dirname =
47
- _libcrash._dirname;
48
- _error_display =
49
- _libcrash._error_display;
50
- _file_exists =
51
- _libcrash._file_exists;
52
- _mkdir =
53
- _libcrash._mkdir;
54
- _msg_info =
55
- _libcrash._msg_info;
56
- _msg_error =
57
- _libcrash._msg_error;
66
+ /* global
67
+ _dirname */
68
+ const
69
+ _dirname =
70
+ _libcrash._dirname;
71
+ /* global
72
+ _file_exists */
73
+ const
74
+ _file_exists =
75
+ _libcrash._file_exists;
76
+ /* global
77
+ _mkdir */
78
+ const
79
+ _mkdir =
80
+ _libcrash._mkdir;
81
+ /* global
82
+ _msg_info */
83
+ const
84
+ _msg_info =
85
+ _libcrash._msg_info;
58
86
 
59
87
  function
60
88
  _path_encode(
61
89
  _path) {
62
- let
63
- _string;
64
- _string =
65
- _sha256(
66
- _path + "\n");
90
+ const
91
+ _string =
92
+ _sha256(
93
+ _path + "\n");
67
94
  return _string;
68
95
  }
69
96
 
70
97
  function
71
98
  _serve_close_callback_get(
72
99
  _output) {
73
- let
74
- _close_callback;
75
- _close_callback =
76
- function(
77
- _code) {
78
- console.log(
79
- `Exit code: ${_code}`);
80
- console.log(
81
- `Output: ${_output}`);
82
- };
100
+ const
101
+ _close_callback =
102
+ function(
103
+ _code) {
104
+ let
105
+ _msg;
106
+ _msg =
107
+ `Exit code: ${_code}`;
108
+ console.log(
109
+ _msg);
110
+ _msg =
111
+ `Output: ${_output}`;
112
+ console.log(
113
+ _msg);
114
+ };
83
115
  return _close_callback;
84
116
  }
85
117
 
86
118
  function
87
119
  _serve_data_callback_get(
88
120
  _output) {
89
- let
90
- _data_callback;
91
- _data_callback =
92
- function(
93
- _data) {
94
- _data =
95
- _data.toString();
96
- console.log(
97
- _data);
98
- _output +=
99
- _data;
100
- };
121
+ const
122
+ _data_callback =
123
+ function(
124
+ _data) {
125
+ _data =
126
+ _data.toString();
127
+ console.log(
128
+ _data);
129
+ /* global
130
+ _output */
131
+ _output +=
132
+ _data;
133
+ };
101
134
  return _data_callback;
102
135
  }
103
136
 
@@ -120,10 +153,11 @@ function
120
153
  _ssl_pass,
121
154
  _port_switching_disabled) {
122
155
  let
123
- _cmd_args;
124
- _cmd_args = [
125
- "serve"
126
- ];
156
+ _uri;
157
+ const
158
+ _cmd_args = [
159
+ "serve"
160
+ ];
127
161
  for ( _uri of _listen_uris ) {
128
162
  _cmd_args.push(
129
163
  "-l",
@@ -174,21 +208,26 @@ function
174
208
  "--no-port-switching");
175
209
  }
176
210
  if ( _ssl_cert != "" ) {
211
+ /* global
212
+ ssl_cert */
177
213
  _cmd_args.push(
178
214
  "--ssl-cert",
179
215
  ssl_cert);
180
216
  }
181
217
  if ( _ssl_key != "" ) {
218
+ /* global
219
+ ssl_key */
182
220
  _cmd_args.push(
183
221
  "--ssl-key",
184
222
  ssl_key);
185
223
  }
186
224
  if ( _ssl_pass != "" ) {
225
+ /* global
226
+ ssl_pass */
187
227
  _cmd_args.push(
188
228
  "--ssl-pass",
189
229
  ssl_pass);
190
230
  }
191
-
192
231
  }
193
232
 
194
233
  function
@@ -210,44 +249,45 @@ function
210
249
  _ssl_pass,
211
250
  _port_switching_disabled) {
212
251
  let
213
- _cmd,
214
- _cmd_args,
215
- _output,
216
- _serve_process,
217
- _uri;
218
- _cmd =
219
- "npx";
220
- _cmd_args =
221
- _npx_cmdline_get(
222
- _target_directory,
223
- _listen_uris,
224
- _target_port,
225
- _index_redirect,
226
- _debug_enabled,
227
- _config_file,
228
- _logging_disabled,
229
- _cors_enabled,
230
- _clipboard_disabled,
231
- _compression_disabled,
232
- _etag_disabled,
233
- _symlinks_enabled,
234
- _ssl_cert,
235
- _ssl_key,
236
- _ssl_pass,
237
- _port_switching_disabled);
238
- _serve_process =
239
- _spawn(
240
- _cmd,
241
- _cmd_args);
242
- _serve_data_callback =
243
- _serve_data_callback_get(
244
- _output);
252
+ _output;
253
+ const
254
+ _cmd =
255
+ "npx";
256
+ const
257
+ _cmd_args =
258
+ _npx_cmdline_get(
259
+ _target_directory,
260
+ _listen_uris,
261
+ _target_port,
262
+ _index_redirect,
263
+ _debug_enabled,
264
+ _config_file,
265
+ _logging_disabled,
266
+ _cors_enabled,
267
+ _clipboard_disabled,
268
+ _compression_disabled,
269
+ _etag_disabled,
270
+ _symlinks_enabled,
271
+ _ssl_cert,
272
+ _ssl_key,
273
+ _ssl_pass,
274
+ _port_switching_disabled);
275
+ const
276
+ _serve_process =
277
+ _spawn(
278
+ _cmd,
279
+ _cmd_args);
280
+ const
281
+ _serve_data_callback =
282
+ _serve_data_callback_get(
283
+ _output);
245
284
  _serve_process.stdout.on(
246
285
  'data',
247
286
  _serve_data_callback);
248
- _serve_close_callback =
249
- _serve_close_callback_get(
250
- _output);
287
+ const
288
+ _serve_close_callback =
289
+ _serve_close_callback_get(
290
+ _output);
251
291
  _serve_process.stdout.on(
252
292
  'close',
253
293
  _serve_close_callback);
@@ -283,62 +323,72 @@ async function
283
323
  _organization_name,
284
324
  _organization_unit) {
285
325
  let
286
- _cert_gen_opts,
287
- _mkdir_args,
288
- _mkdir_opts,
289
- _serve_opts;
326
+ _cert_gen_opts_str,
327
+ _msg;
290
328
  if ( ! _file_exists(
291
329
  _ssl_cert) &&
292
330
  _cert_new == "y" ) {
293
- _mkdir_opts =
294
- { "recursive":
295
- true,
296
- "mode":
297
- 0700 };
298
- _mkdir_args = [
299
- _dirname(
300
- _ssl_cert),
301
- _mkdir_opts
302
- ];
331
+ const
332
+ _mkdir_opts =
333
+ { "recursive":
334
+ true,
335
+ "mode":
336
+ "0700" };
337
+ const
338
+ _mkdir_args = [
339
+ _dirname(
340
+ _ssl_cert),
341
+ _mkdir_opts
342
+ ];
303
343
  _mkdir.apply(
304
344
  null,
305
345
  _mkdir_args);
306
- _cert_gen_opts = [
307
- _ssl_key,
308
- _keys_length,
309
- _serial_number,
310
- _validity_min,
311
- _validity_max,
312
- _domain_name,
313
- _country_name,
314
- _state_name,
315
- _locality_name,
316
- _organization_name,
317
- _organization_unit,
318
- _ssl_cert
319
- ];
346
+ const
347
+ _cert_gen_opts = [
348
+ _ssl_key,
349
+ _keys_length,
350
+ _serial_number,
351
+ _validity_min,
352
+ _validity_max,
353
+ _domain_name,
354
+ _country_name,
355
+ _state_name,
356
+ _locality_name,
357
+ _organization_name,
358
+ _organization_unit,
359
+ _ssl_cert
360
+ ];
361
+ _cert_gen_opts_str =
362
+ " ".join(
363
+ _cert_gen_opts);
364
+ _msg =
365
+ `Running 'cert-gen' ` +
366
+ `options '${_cert_gen_opts_str}'.`;
367
+ _msg_info(
368
+ _msg);
320
369
  await _cert_gen.apply(
321
370
  null,
322
371
  _cert_gen_opts);
323
372
  }
324
- _serve_opts = [
325
- _target_directory,
326
- _listen_uris,
327
- _target_port,
328
- _index_redirect,
329
- _debug_enabled,
330
- _config_file,
331
- _logging_disabled,
332
- _cors_enabled,
333
- _clipboard_disabled,
334
- _compression_disabled,
335
- _etag_disabled,
336
- _symlinks_enabled,
337
- _ssl_cert,
338
- _ssl_key,
339
- _ssl_pass,
340
- _port_switching_disabled
341
- ];
373
+ const
374
+ _serve_opts = [
375
+ _target_directory,
376
+ _listen_uris,
377
+ _target_port,
378
+ _index_redirect,
379
+ _debug_enabled,
380
+ _config_file,
381
+ _logging_disabled,
382
+ _cors_enabled,
383
+ _clipboard_disabled,
384
+ _compression_disabled,
385
+ _etag_disabled,
386
+ _symlinks_enabled,
387
+ _ssl_cert,
388
+ _ssl_key,
389
+ _ssl_pass,
390
+ _port_switching_disabled
391
+ ];
342
392
  _serve.apply(
343
393
  null,
344
394
  _serve_opts);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "safely-serve",
4
4
  "version":
5
- "0.0.8",
5
+ "0.0.9",
6
6
  "description":
7
7
  "Serve extension which auto-generates self-signed OpenSSL certificates' at runtime",
8
8
  "funding": {
@@ -62,7 +62,11 @@
62
62
  "crash-js-webpack":
63
63
  "^0.0.3",
64
64
  "eslint":
65
- "^9.32.0",
65
+ "^10.0.0",
66
+ "globals":
67
+ "^17.3.0",
68
+ "@eslint/js":
69
+ "^10.0.1",
66
70
  "webpack":
67
71
  "^5.102.1",
68
72
  "webpack-cli":
@@ -70,7 +74,7 @@
70
74
  },
71
75
  "dependencies": {
72
76
  "crash-js":
73
- "^0.1.67",
77
+ "^0.1.72",
74
78
  "cert-tools":
75
79
  "^0.0.7",
76
80
  "js-sha256":