crash-js 0.1.59 → 0.1.63
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/crash-js/crash-js +5 -4
- package/crash-js/fs-utils +125 -67
- package/crash-js/utils +6 -8
- package/package.json +7 -3
package/crash-js/crash-js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
// ----------------------------------------------------------------------
|
|
10
10
|
//
|
|
11
11
|
// This program is free software: you can redistribute it and/or modify
|
|
12
|
-
// it under the terms of the GNU Affero General Public License as
|
|
13
|
-
// the Free Software Foundation, either version 3 of
|
|
14
|
-
// (at your option) any later version.
|
|
12
|
+
// it under the terms of the GNU Affero General Public License as
|
|
13
|
+
// published by the Free Software Foundation, either version 3 of
|
|
14
|
+
// the License, or (at your option) any later version.
|
|
15
15
|
//
|
|
16
16
|
// This program is distributed in the hope that it will be useful,
|
|
17
17
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
@@ -42,7 +42,6 @@ const
|
|
|
42
42
|
_basename =
|
|
43
43
|
_fs_utils._basename;
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
function
|
|
47
46
|
_app_name_get() {
|
|
48
47
|
let
|
|
@@ -293,6 +292,8 @@ module.exports = {
|
|
|
293
292
|
_printf,
|
|
294
293
|
_sleep:
|
|
295
294
|
_sleep,
|
|
295
|
+
_split:
|
|
296
|
+
_fs_utils._split,
|
|
296
297
|
_yargv_get:
|
|
297
298
|
_yargv_get
|
|
298
299
|
};
|
package/crash-js/fs-utils
CHANGED
|
@@ -31,20 +31,70 @@ function
|
|
|
31
31
|
_fs =
|
|
32
32
|
require(
|
|
33
33
|
"fs");
|
|
34
|
-
_path_module =
|
|
35
|
-
require("path");
|
|
36
34
|
}
|
|
37
35
|
else {
|
|
38
36
|
_fs =
|
|
39
37
|
require("happy-opfs");
|
|
40
|
-
_path_module =
|
|
41
|
-
require("@std/path");
|
|
42
38
|
}
|
|
43
39
|
return _fs;
|
|
44
40
|
}
|
|
41
|
+
|
|
42
|
+
function
|
|
43
|
+
_path_module_get() {
|
|
44
|
+
let
|
|
45
|
+
_path;
|
|
46
|
+
if ( typeof window === 'undefined' &&
|
|
47
|
+
( typeof global !== 'undefined' && global.global === global ) &&
|
|
48
|
+
typeof __webpack_require__ !== 'function' ) {
|
|
49
|
+
_path =
|
|
50
|
+
require("path");
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
_path =
|
|
54
|
+
require("@std/path");
|
|
55
|
+
}
|
|
56
|
+
return _path;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function
|
|
60
|
+
_split_opfs() {
|
|
61
|
+
console.log(
|
|
62
|
+
"hello");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function
|
|
66
|
+
_split_module_get() {
|
|
67
|
+
let
|
|
68
|
+
_split;
|
|
69
|
+
if ( typeof window === 'undefined' &&
|
|
70
|
+
( typeof global !== 'undefined' && global.global === global ) &&
|
|
71
|
+
typeof __webpack_require__ !== 'function' ) {
|
|
72
|
+
_split =
|
|
73
|
+
require(
|
|
74
|
+
"split-file");
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
_split =
|
|
78
|
+
_split_opfs;
|
|
79
|
+
}
|
|
80
|
+
return _split;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const _worker_module =
|
|
84
|
+
require(
|
|
85
|
+
"web-worker");
|
|
45
86
|
const
|
|
46
87
|
_fs =
|
|
47
88
|
_fs_module_get();
|
|
89
|
+
const
|
|
90
|
+
_json_parse =
|
|
91
|
+
JSON.parse;
|
|
92
|
+
const
|
|
93
|
+
_json_display =
|
|
94
|
+
JSON.stringify;
|
|
95
|
+
const
|
|
96
|
+
_path_module =
|
|
97
|
+
_path_module_get();
|
|
48
98
|
_path_module_basename =
|
|
49
99
|
_path_module.basename;
|
|
50
100
|
_path_module_dirname =
|
|
@@ -54,11 +104,8 @@ _path_module_join =
|
|
|
54
104
|
_path_module_parse =
|
|
55
105
|
_path_module.parse;
|
|
56
106
|
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
_json_display =
|
|
61
|
-
JSON.stringify;
|
|
107
|
+
_split_module =
|
|
108
|
+
_split_module_get();
|
|
62
109
|
|
|
63
110
|
function
|
|
64
111
|
_basename(
|
|
@@ -82,6 +129,26 @@ function
|
|
|
82
129
|
return _dir;
|
|
83
130
|
}
|
|
84
131
|
|
|
132
|
+
function
|
|
133
|
+
_ext_rm(
|
|
134
|
+
_path) {
|
|
135
|
+
let
|
|
136
|
+
_dir,
|
|
137
|
+
_name,
|
|
138
|
+
_paths;
|
|
139
|
+
_dir =
|
|
140
|
+
_path_module_parse(
|
|
141
|
+
_path).dir;
|
|
142
|
+
_name =
|
|
143
|
+
_path_module_parse(
|
|
144
|
+
_path).name;
|
|
145
|
+
_paths = [
|
|
146
|
+
_dir,
|
|
147
|
+
_name];
|
|
148
|
+
return _path_join(
|
|
149
|
+
_paths);
|
|
150
|
+
}
|
|
151
|
+
|
|
85
152
|
function
|
|
86
153
|
_file_exists(
|
|
87
154
|
_path) {
|
|
@@ -127,66 +194,19 @@ function
|
|
|
127
194
|
_content);
|
|
128
195
|
}
|
|
129
196
|
|
|
130
|
-
function
|
|
131
|
-
_path_join(
|
|
132
|
-
_paths) {
|
|
133
|
-
let
|
|
134
|
-
_path;
|
|
135
|
-
_path =
|
|
136
|
-
_path_module_join.apply(
|
|
137
|
-
null,
|
|
138
|
-
_paths);
|
|
139
|
-
return _path;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function
|
|
143
|
-
_ext_rm(
|
|
144
|
-
_path) {
|
|
145
|
-
let
|
|
146
|
-
_dir,
|
|
147
|
-
_name,
|
|
148
|
-
_paths;
|
|
149
|
-
_dir =
|
|
150
|
-
_path_module_parse(
|
|
151
|
-
_path).dir;
|
|
152
|
-
_name =
|
|
153
|
-
_path_module_parse(
|
|
154
|
-
_path).name;
|
|
155
|
-
_paths = [
|
|
156
|
-
_dir,
|
|
157
|
-
_name];
|
|
158
|
-
return _path_join(
|
|
159
|
-
_paths);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function
|
|
163
|
-
_json_read(
|
|
164
|
-
_json_path) {
|
|
165
|
-
let
|
|
166
|
-
_json_str,
|
|
167
|
-
_json;
|
|
168
|
-
_json_str =
|
|
169
|
-
_file_read(
|
|
170
|
-
_json_path);
|
|
171
|
-
_json =
|
|
172
|
-
_json_parse(
|
|
173
|
-
_json_str);
|
|
174
|
-
return _json;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
197
|
function
|
|
178
198
|
_fs_worker_new(
|
|
179
199
|
_url) {
|
|
180
200
|
let
|
|
181
|
-
|
|
201
|
+
_fs_worker;
|
|
182
202
|
if ( typeof _url === 'undefined' ) {
|
|
183
203
|
_url =
|
|
184
204
|
"fs-worker.js";
|
|
185
205
|
}
|
|
186
|
-
|
|
187
|
-
new
|
|
206
|
+
_fs_worker =
|
|
207
|
+
new _worker(
|
|
188
208
|
_url);
|
|
189
|
-
return
|
|
209
|
+
return _fs_worker;
|
|
190
210
|
}
|
|
191
211
|
|
|
192
212
|
async function
|
|
@@ -198,7 +218,7 @@ async function
|
|
|
198
218
|
_agent,
|
|
199
219
|
_agent_connect,
|
|
200
220
|
_connect_opts,
|
|
201
|
-
|
|
221
|
+
_fs_worker;
|
|
202
222
|
if ( typeof _worker_path === 'undefined' ) {
|
|
203
223
|
_worker_path =
|
|
204
224
|
"fs-worker.js";
|
|
@@ -217,12 +237,12 @@ async function
|
|
|
217
237
|
}
|
|
218
238
|
_agent_connect =
|
|
219
239
|
_fs.connectSyncAgent;
|
|
220
|
-
|
|
240
|
+
_fs_worker =
|
|
221
241
|
_fs_worker_new(
|
|
222
242
|
_worker_path);
|
|
223
243
|
_connect_opts = {
|
|
224
244
|
worker:
|
|
225
|
-
|
|
245
|
+
_fs_worker,
|
|
226
246
|
bufferLength:
|
|
227
247
|
_buffer_length,
|
|
228
248
|
opTimeout:
|
|
@@ -234,6 +254,42 @@ async function
|
|
|
234
254
|
return _agent;
|
|
235
255
|
}
|
|
236
256
|
|
|
257
|
+
function
|
|
258
|
+
_json_read(
|
|
259
|
+
_json_path) {
|
|
260
|
+
let
|
|
261
|
+
_json_str,
|
|
262
|
+
_json;
|
|
263
|
+
_json_str =
|
|
264
|
+
_file_read(
|
|
265
|
+
_json_path);
|
|
266
|
+
_json =
|
|
267
|
+
_json_parse(
|
|
268
|
+
_json_str);
|
|
269
|
+
return _json;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function
|
|
273
|
+
_path_join(
|
|
274
|
+
_paths) {
|
|
275
|
+
let
|
|
276
|
+
_path;
|
|
277
|
+
_path =
|
|
278
|
+
_path_module_join.apply(
|
|
279
|
+
null,
|
|
280
|
+
_paths);
|
|
281
|
+
return _path;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function
|
|
285
|
+
_split(
|
|
286
|
+
_in,
|
|
287
|
+
_parts,
|
|
288
|
+
_out) {
|
|
289
|
+
console.log(
|
|
290
|
+
_split_module);
|
|
291
|
+
}
|
|
292
|
+
|
|
237
293
|
module.exports = {
|
|
238
294
|
_basename:
|
|
239
295
|
_basename,
|
|
@@ -251,14 +307,16 @@ module.exports = {
|
|
|
251
307
|
_fs_worker_new,
|
|
252
308
|
_fs_worker_start:
|
|
253
309
|
_fs_worker_start,
|
|
310
|
+
_json_display:
|
|
311
|
+
_json_display,
|
|
312
|
+
_json_read:
|
|
313
|
+
_json_read,
|
|
254
314
|
_ls:
|
|
255
315
|
_fs.readDirSync,
|
|
256
316
|
_mkdir:
|
|
257
317
|
_fs.mkdirSync,
|
|
258
318
|
_path_join:
|
|
259
319
|
_path_join,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
_json_read:
|
|
263
|
-
_json_read
|
|
320
|
+
_split:
|
|
321
|
+
_split
|
|
264
322
|
};
|
package/crash-js/utils
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// -----------------------------------------------------------------------
|
|
6
6
|
// Copyright © 2024, 2025 Pellegrino Prevete
|
|
7
7
|
//
|
|
8
8
|
// All rights reserved
|
|
9
|
-
//
|
|
9
|
+
// -----------------------------------------------------------------------
|
|
10
10
|
//
|
|
11
|
-
// This program is free software: you can redistribute it and/or modify
|
|
12
|
-
// it under the terms of the GNU Affero General Public License as
|
|
13
|
-
// the Free Software Foundation, either version 3 of the
|
|
14
|
-
// (at your option) any later version.
|
|
11
|
+
// This program is free software: you can redistribute it and/or modify it
|
|
12
|
+
// it under the terms of the GNU Affero General Public License as
|
|
13
|
+
// published by the Free Software Foundation, either version 3 of the
|
|
14
|
+
// License, or (at your option) any later version.
|
|
15
15
|
//
|
|
16
16
|
// This program is distributed in the hope that it will be useful,
|
|
17
17
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
@@ -21,8 +21,6 @@
|
|
|
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
|
-
|
|
25
|
-
|
|
26
24
|
function
|
|
27
25
|
_argv_url_get(
|
|
28
26
|
_key_name) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name":
|
|
3
3
|
"crash-js",
|
|
4
4
|
"version":
|
|
5
|
-
"0.1.
|
|
5
|
+
"0.1.63",
|
|
6
6
|
"description":
|
|
7
7
|
"Crash Javascript library.",
|
|
8
8
|
"funding":
|
|
@@ -58,10 +58,14 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"buffer":
|
|
60
60
|
"^6.0.3",
|
|
61
|
-
"
|
|
62
|
-
"npm:@themartiancompany/
|
|
61
|
+
"opfs":
|
|
62
|
+
"npm:@themartiancompany/opfs@^1.8.11",
|
|
63
|
+
"split-file":
|
|
64
|
+
"^2.3.0",
|
|
63
65
|
"stream-browserify":
|
|
64
66
|
"^3.0.0",
|
|
67
|
+
"web-worker":
|
|
68
|
+
"1.5.0",
|
|
65
69
|
"yargs":
|
|
66
70
|
"18.0.0"
|
|
67
71
|
},
|