safely-serve 0.0.9 → 0.0.11
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/AUTHORS.rst +1 -1
- package/README.md +1 -1
- package/dist/libsafely-serve/fs-worker.js +1 -0
- package/dist/libsafely-serve/index.html +24 -0
- package/dist/libsafely-serve/libsafely-serve.js +2 -0
- package/dist/safely-serve/fs-worker.js +1 -0
- package/dist/safely-serve/index.html +24 -0
- package/dist/safely-serve/safely-serve.js +2 -0
- package/eslint.config.mjs +15 -12
- package/fs-worker.webpack.config.cjs +58 -8
- package/libsafely-serve +23 -18
- package/libsafely-serve.webpack.config.cjs +35 -0
- package/man/safely-serve.1 +22 -1
- package/package.json +13 -15
- package/webpack.config.cjs +9 -14
- package/fs-worker.js +0 -1
- package/safely-serve.js +0 -2
package/eslint.config.mjs
CHANGED
|
@@ -30,20 +30,26 @@ import { defineConfig } from "eslint/config";
|
|
|
30
30
|
const
|
|
31
31
|
_project =
|
|
32
32
|
"safely-serve";
|
|
33
|
-
|
|
33
|
+
const
|
|
34
|
+
_ignores = [
|
|
35
|
+
"build/**",
|
|
36
|
+
"dist/**",
|
|
37
|
+
"eslint.config.js",
|
|
38
|
+
"fs-worker.js",
|
|
39
|
+
`${_project}.js`,
|
|
40
|
+
`lib${_project}.js`,
|
|
41
|
+
"man/**"
|
|
42
|
+
];
|
|
34
43
|
export default defineConfig([
|
|
35
|
-
{ ignores:
|
|
36
|
-
|
|
37
|
-
"eslint.config.js",
|
|
38
|
-
"man/**"
|
|
39
|
-
],
|
|
44
|
+
{ ignores:
|
|
45
|
+
_ignores,
|
|
40
46
|
rules:
|
|
41
47
|
{ semi:
|
|
42
48
|
"error",
|
|
43
49
|
"prefer-const":
|
|
44
50
|
"error" },
|
|
45
51
|
files:
|
|
46
|
-
[ "
|
|
52
|
+
[ "**/*.{js,mjs,cjs}",
|
|
47
53
|
`**/${_project}*`,
|
|
48
54
|
`**/lib${_project}` ],
|
|
49
55
|
plugins:
|
|
@@ -54,11 +60,8 @@ export default defineConfig([
|
|
|
54
60
|
{ globals:
|
|
55
61
|
{ ...globals.browser,
|
|
56
62
|
...globals.node} } },
|
|
57
|
-
{ ignores:
|
|
58
|
-
|
|
59
|
-
"eslint.config.js",
|
|
60
|
-
"man/**"
|
|
61
|
-
],
|
|
63
|
+
{ ignores:
|
|
64
|
+
_ignores,
|
|
62
65
|
rules:
|
|
63
66
|
{ semi:
|
|
64
67
|
"error",
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
|
|
3
|
+
/** ----------------------------------------------------------------
|
|
4
|
+
* fs-worker.webpack.config.cjs
|
|
5
|
+
* ----------------------------------------------------------------
|
|
6
|
+
* Copyright ©
|
|
7
|
+
* Pellegrino Prevete
|
|
8
|
+
* 2025, 2026
|
|
9
|
+
*
|
|
10
|
+
* All rights reserved
|
|
11
|
+
* ----------------------------------------------------------------
|
|
12
|
+
*
|
|
13
|
+
* This program is free software: you can redistribute it and/or
|
|
14
|
+
* modify it under the terms of the GNU General Public License as
|
|
15
|
+
* published by the Free Software Foundation, either version 3 of
|
|
16
|
+
* the License, or (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
|
|
24
|
+
* License along with this program.
|
|
25
|
+
* If not, see <https://www.gnu.org/licenses/>.
|
|
26
|
+
*/
|
|
27
|
+
|
|
1
28
|
const
|
|
2
29
|
_path =
|
|
3
30
|
require(
|
|
@@ -15,12 +42,28 @@ const
|
|
|
15
42
|
const
|
|
16
43
|
_output_file_name =
|
|
17
44
|
`${_input_file_name}.js`;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
45
|
+
const
|
|
46
|
+
_output = {
|
|
47
|
+
path:
|
|
48
|
+
_output_dir,
|
|
49
|
+
filename:
|
|
50
|
+
_output_file_name
|
|
51
|
+
};
|
|
52
|
+
const
|
|
53
|
+
_node_fs_ignore =
|
|
54
|
+
{ resourceRegExp:
|
|
55
|
+
/^node:fs_process$/ };
|
|
56
|
+
const
|
|
57
|
+
_webpack =
|
|
58
|
+
require(
|
|
59
|
+
"webpack");
|
|
60
|
+
const
|
|
61
|
+
_ignore_plugin =
|
|
62
|
+
_webpack.IgnorePlugin;
|
|
63
|
+
const
|
|
64
|
+
_node_fs_ignore_plugin =
|
|
65
|
+
new _ignore_plugin(
|
|
66
|
+
_node_fs_ignore);
|
|
24
67
|
module.exports = {
|
|
25
68
|
entry:
|
|
26
69
|
_input_file_path,
|
|
@@ -38,11 +81,18 @@ module.exports = {
|
|
|
38
81
|
"opfs":
|
|
39
82
|
_path.resolve(
|
|
40
83
|
__dirname,
|
|
41
|
-
'node_modules/
|
|
84
|
+
'node_modules/opfs/opfs'),
|
|
42
85
|
"path":
|
|
43
86
|
_path.resolve(
|
|
44
87
|
__dirname,
|
|
45
88
|
'node_modules/path/mod.js'),
|
|
46
89
|
},
|
|
47
|
-
|
|
90
|
+
fallback: {
|
|
91
|
+
"node:fs":
|
|
92
|
+
false,
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
plugins: [
|
|
96
|
+
_node_fs_ignore_plugin,
|
|
97
|
+
]
|
|
48
98
|
};
|
package/libsafely-serve
CHANGED
|
@@ -2,24 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
/** ----------------------------------------------------------------------
|
|
6
|
+
* libsafely-serve
|
|
7
|
+
* --------------------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or modify
|
|
16
|
+
* it under the terms of the GNU General Public License as published by
|
|
17
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
18
|
+
* (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the GNU General Public License
|
|
26
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
|
+
*/
|
|
23
28
|
|
|
24
29
|
/* eslint
|
|
25
30
|
no-unused-vars: [
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/** ----------------------------------------------------------------------
|
|
2
|
+
* libsafely-serve.webpack.config.cjs
|
|
3
|
+
* --------------------------------------------------------------------------
|
|
4
|
+
* Copyright ©
|
|
5
|
+
* Pellegrino Prevete
|
|
6
|
+
* 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
|
+
|
|
1
25
|
const
|
|
2
26
|
_path =
|
|
3
27
|
require(
|
|
@@ -19,6 +43,10 @@ const
|
|
|
19
43
|
_child_process_ignore =
|
|
20
44
|
{ resourceRegExp:
|
|
21
45
|
/^node:child_process$/ };
|
|
46
|
+
const
|
|
47
|
+
_node_fs_ignore =
|
|
48
|
+
{ resourceRegExp:
|
|
49
|
+
/^node:fs$/ };
|
|
22
50
|
const
|
|
23
51
|
_serve_ignore =
|
|
24
52
|
{ resourceRegExp:
|
|
@@ -43,6 +71,10 @@ const
|
|
|
43
71
|
_child_process_ignore_plugin =
|
|
44
72
|
new _ignore_plugin(
|
|
45
73
|
_child_process_ignore);
|
|
74
|
+
const
|
|
75
|
+
_node_fs_ignore_plugin =
|
|
76
|
+
new _ignore_plugin(
|
|
77
|
+
_node_fs_ignore);
|
|
46
78
|
const
|
|
47
79
|
_serve_ignore_plugin =
|
|
48
80
|
new _ignore_plugin(
|
|
@@ -88,6 +120,8 @@ module.exports = {
|
|
|
88
120
|
fallback: {
|
|
89
121
|
"node:child_process":
|
|
90
122
|
false,
|
|
123
|
+
"node:fs":
|
|
124
|
+
false,
|
|
91
125
|
"serve":
|
|
92
126
|
false,
|
|
93
127
|
"utils":
|
|
@@ -105,6 +139,7 @@ module.exports = {
|
|
|
105
139
|
'yargs' },
|
|
106
140
|
plugins: [
|
|
107
141
|
_child_process_ignore_plugin,
|
|
142
|
+
_node_fs_ignore_plugin,
|
|
108
143
|
_serve_ignore_plugin,
|
|
109
144
|
_yargs_ignore_plugin,
|
|
110
145
|
_yargs_helpers_ignore_plugin
|
package/man/safely-serve.1
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.\" Man page generated from reStructuredText
|
|
2
|
-
.\" by the Docutils 0.
|
|
2
|
+
.\" by the Docutils 0.23 manpage writer.
|
|
3
3
|
.
|
|
4
4
|
.
|
|
5
5
|
.nr rst2man-indent-level 0
|
|
@@ -31,6 +31,27 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
|
|
31
31
|
.TH "safely-serve" "1" "" "safely-serve insert.version.here"
|
|
32
32
|
.SH Name
|
|
33
33
|
safely-serve \- Safe static file serving and directory listing
|
|
34
|
+
.\" SPDX-License-Identifier: AGPL-3.0-or-later
|
|
35
|
+
.\"
|
|
36
|
+
.\" ----------------------------------------------------------------------
|
|
37
|
+
.\" Copyright © 2024, 2025, 2026 Pellegrino Prevete
|
|
38
|
+
.\"
|
|
39
|
+
.\" All rights reserved
|
|
40
|
+
.\" ----------------------------------------------------------------------
|
|
41
|
+
.\"
|
|
42
|
+
.\" This program is free software: you can redistribute it and/or modify
|
|
43
|
+
.\" it under the terms of the GNU Affero General Public License as published by
|
|
44
|
+
.\" the Free Software Foundation, either version 3 of the License, or
|
|
45
|
+
.\" (at your option) any later version.
|
|
46
|
+
.\"
|
|
47
|
+
.\" This program is distributed in the hope that it will be useful,
|
|
48
|
+
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
49
|
+
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
50
|
+
.\" GNU Affero General Public License for more details.
|
|
51
|
+
.\"
|
|
52
|
+
.\" You should have received a copy of the GNU Affero General Public License
|
|
53
|
+
.\" along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
54
|
+
.
|
|
34
55
|
.SH Synopsis
|
|
35
56
|
.sp
|
|
36
57
|
safely\-serve \fIoption\fP
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name":
|
|
3
3
|
"safely-serve",
|
|
4
4
|
"version":
|
|
5
|
-
"0.0.
|
|
5
|
+
"0.0.11",
|
|
6
6
|
"description":
|
|
7
7
|
"Serve extension which auto-generates self-signed OpenSSL certificates' at runtime",
|
|
8
8
|
"funding": {
|
|
@@ -17,13 +17,11 @@
|
|
|
17
17
|
"AUTHORS.rst",
|
|
18
18
|
"COPYING",
|
|
19
19
|
"README.md",
|
|
20
|
+
"dist",
|
|
20
21
|
"eslint.config.mjs",
|
|
21
22
|
"package.json",
|
|
22
|
-
"safely-serve.js",
|
|
23
23
|
"safely-serve",
|
|
24
|
-
"fs-worker.js",
|
|
25
24
|
"fs-worker.webpack.config.cjs",
|
|
26
|
-
"index.html",
|
|
27
25
|
"libsafely-serve",
|
|
28
26
|
"libsafely-serve.webpack.config.cjs",
|
|
29
27
|
"man",
|
|
@@ -60,29 +58,29 @@
|
|
|
60
58
|
},
|
|
61
59
|
"devDependencies": {
|
|
62
60
|
"crash-js-webpack":
|
|
63
|
-
"^0.0.
|
|
61
|
+
"^0.0.45",
|
|
64
62
|
"eslint":
|
|
65
|
-
"^10.
|
|
63
|
+
"^10.3.0",
|
|
66
64
|
"globals":
|
|
67
65
|
"^17.3.0",
|
|
68
66
|
"@eslint/js":
|
|
69
67
|
"^10.0.1",
|
|
70
68
|
"webpack":
|
|
71
|
-
"^5.
|
|
69
|
+
"^5.109.2",
|
|
72
70
|
"webpack-cli":
|
|
73
|
-
"^
|
|
71
|
+
"^7.2.2"
|
|
74
72
|
},
|
|
75
73
|
"dependencies": {
|
|
76
74
|
"crash-js":
|
|
77
|
-
"^0.
|
|
75
|
+
"^0.1111.1111111111111111",
|
|
78
76
|
"cert-tools":
|
|
79
|
-
"^0.0.
|
|
77
|
+
"^0.0.12",
|
|
80
78
|
"js-sha256":
|
|
81
79
|
"^0.11.1",
|
|
82
80
|
"os":
|
|
83
81
|
"npm:os-browserify@^0.3.0",
|
|
84
82
|
"serve":
|
|
85
|
-
"^14.2.
|
|
83
|
+
"^14.2.6"
|
|
86
84
|
},
|
|
87
85
|
"type":
|
|
88
86
|
"commonjs",
|
|
@@ -93,11 +91,11 @@
|
|
|
93
91
|
"safely-serve" },
|
|
94
92
|
"scripts": {
|
|
95
93
|
"build-fs-worker":
|
|
96
|
-
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details",
|
|
94
|
+
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details; for _component in {'','lib'}'safely-serve'; do cp 'fs-worker.js' \"dist/${_component}\"; done",
|
|
97
95
|
"build-lib":
|
|
98
|
-
"npx webpack --mode 'production' --config 'libsafely-serve.webpack.config.cjs' --stats-error-details",
|
|
96
|
+
"npx webpack --mode 'production' --config 'libsafely-serve.webpack.config.cjs' --stats-error-details; mv 'libsafely-serve.js' 'dist/libsafely-serve'",
|
|
99
97
|
"build-bin":
|
|
100
|
-
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details",
|
|
98
|
+
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details; mv 'safely-serve.js' 'dist/safely-serve'",
|
|
101
99
|
"build":
|
|
102
100
|
"npm run lint && npm run build-fs-worker && npm run build-lib && npm run build-bin",
|
|
103
101
|
"lint":
|
|
@@ -105,7 +103,7 @@
|
|
|
105
103
|
"publish-pnm":
|
|
106
104
|
"npm run build && npm publish --access public",
|
|
107
105
|
"start":
|
|
108
|
-
"npx safely-serve -d
|
|
106
|
+
"npx safely-serve -d 'dist/safely-serve'",
|
|
109
107
|
"test":
|
|
110
108
|
"echo \"Error: no test specified\" && exit 1"
|
|
111
109
|
}
|
package/webpack.config.cjs
CHANGED
|
@@ -27,13 +27,9 @@ const
|
|
|
27
27
|
{ resourceRegExp:
|
|
28
28
|
/^node:child_process$/ };
|
|
29
29
|
const
|
|
30
|
-
|
|
30
|
+
_node_fs_ignore =
|
|
31
31
|
{ resourceRegExp:
|
|
32
|
-
/^
|
|
33
|
-
const
|
|
34
|
-
_web_worker_ignore =
|
|
35
|
-
{ resourceRegExp:
|
|
36
|
-
/^web-worker$/ };
|
|
32
|
+
/^node:fs$/ };
|
|
37
33
|
const
|
|
38
34
|
_serve_ignore =
|
|
39
35
|
{ resourceRegExp:
|
|
@@ -58,17 +54,13 @@ const
|
|
|
58
54
|
new _ignore_plugin(
|
|
59
55
|
_child_process_ignore);
|
|
60
56
|
const
|
|
61
|
-
|
|
57
|
+
_node_fs_ignore_plugin =
|
|
62
58
|
new _ignore_plugin(
|
|
63
|
-
|
|
59
|
+
_node_fs_ignore);
|
|
64
60
|
const
|
|
65
|
-
|
|
66
|
-
new _ignore_plugin(
|
|
67
|
-
_utils_ignore);
|
|
68
|
-
const
|
|
69
|
-
_web_worker_ignore_plugin =
|
|
61
|
+
_serve_ignore_plugin =
|
|
70
62
|
new _ignore_plugin(
|
|
71
|
-
|
|
63
|
+
_serve_ignore);
|
|
72
64
|
const
|
|
73
65
|
_yargs_ignore_plugin =
|
|
74
66
|
new _ignore_plugin(
|
|
@@ -117,6 +109,8 @@ module.exports = {
|
|
|
117
109
|
'node_modules/yargs-parser/browser.mjs'),
|
|
118
110
|
},
|
|
119
111
|
fallback: {
|
|
112
|
+
"node:fs":
|
|
113
|
+
false,
|
|
120
114
|
"node:child_process":
|
|
121
115
|
false,
|
|
122
116
|
"serve":
|
|
@@ -139,6 +133,7 @@ module.exports = {
|
|
|
139
133
|
"yargs":
|
|
140
134
|
'yargs' },
|
|
141
135
|
plugins: [
|
|
136
|
+
_node_fs_ignore_plugin,
|
|
142
137
|
_child_process_ignore_plugin,
|
|
143
138
|
_serve_ignore_plugin,
|
|
144
139
|
_yargs_ignore_plugin,
|
package/fs-worker.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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)})();
|