crash-js 0.1.113 → 0.1.115

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 CHANGED
@@ -66,27 +66,27 @@ const
66
66
  _yargv_get =
67
67
  _utils._yargv_get;
68
68
  const
69
- _fs_utils =
69
+ _fs_utils_module =
70
70
  require(
71
71
  "./fs-utils");
72
72
  const
73
73
  _dirname =
74
- _fs_utils._dirname;
74
+ _fs_utils_module._dirname;
75
75
  const
76
76
  _file_append =
77
- _fs_utils._file_append;
77
+ _fs_utils_module._file_append;
78
78
  const
79
79
  _file_exists =
80
- _fs_utils._file_exists;
80
+ _fs_utils_module._file_exists;
81
81
  const
82
82
  _path_join =
83
- _fs_utils._path_join;
83
+ _fs_utils_module._path_join;
84
84
  const
85
85
  _basename =
86
- _fs_utils._basename;
86
+ _fs_utils_module._basename;
87
87
  const
88
88
  _stat =
89
- _fs_utils._stat;
89
+ _fs_utils_module._stat;
90
90
 
91
91
  function
92
92
  _globals() {
@@ -726,9 +726,9 @@ module.exports = {
726
726
  _app_name_get:
727
727
  _app_name_get,
728
728
  _basename:
729
- _fs_utils._basename,
729
+ _fs_utils_module._basename,
730
730
  _cat:
731
- _fs_utils._cat,
731
+ _fs_utils_module._cat,
732
732
  _cmdline_check:
733
733
  _cmdline_check,
734
734
  _dirname:
@@ -738,19 +738,19 @@ module.exports = {
738
738
  _error_display:
739
739
  _error_display,
740
740
  _ext_rm:
741
- _fs_utils._ext_rm,
741
+ _fs_utils_module._ext_rm,
742
742
  _file_append:
743
- _fs_utils._file_append,
743
+ _fs_utils_module._file_append,
744
744
  _file_exists:
745
- _fs_utils._file_exists,
745
+ _fs_utils_module._file_exists,
746
746
  _file_read:
747
- _fs_utils._file_read,
747
+ _fs_utils_module._file_read,
748
748
  _file_write:
749
- _fs_utils._file_write,
749
+ _fs_utils_module._file_write,
750
750
  _fs_worker_new:
751
- _fs_utils._fs_worker_new,
751
+ _fs_utils_module._fs_worker_new,
752
752
  _fs_worker_start:
753
- _fs_utils._fs_worker_start,
753
+ _fs_utils_module._fs_worker_start,
754
754
  _get_date_human:
755
755
  _get_date_human,
756
756
  _globals:
@@ -758,15 +758,17 @@ module.exports = {
758
758
  _homedir_get:
759
759
  _homedir_get,
760
760
  _json_display:
761
- _fs_utils._json_display,
761
+ _fs_utils_module._json_display,
762
762
  _json_read:
763
- _fs_utils._json_read,
763
+ _fs_utils_module._json_read,
764
764
  _lib_get:
765
765
  _lib_get,
766
766
  _ls:
767
- _fs_utils._ls,
767
+ _fs_utils_module._ls,
768
768
  _mkdir:
769
- _fs_utils._mkdir,
769
+ _fs_utils_module._mkdir,
770
+ _mktemp:
771
+ _fs_utils_module._mktemp,
770
772
  _msg_info:
771
773
  _msg_info,
772
774
  _msg_error:
@@ -776,7 +778,7 @@ module.exports = {
776
778
  _msg_info_obj:
777
779
  _msg_info_obj,
778
780
  _mv:
779
- _fs_utils._mv,
781
+ _fs_utils_module._mv,
780
782
  _path_join:
781
783
  _path_join,
782
784
  _printf:
@@ -790,7 +792,7 @@ module.exports = {
790
792
  _range:
791
793
  _range,
792
794
  _rm:
793
- _fs_utils._rm,
795
+ _fs_utils_module._rm,
794
796
  _run:
795
797
  _run,
796
798
  _seq:
package/crash-js/fs-utils CHANGED
@@ -28,18 +28,28 @@
28
28
  */
29
29
 
30
30
  const
31
- _fs =
31
+ _utils_module =
32
+ require(
33
+ "utils");
34
+ const
35
+ _os_tmpdir_get =
36
+ _utils._os_tmpdir_get;
37
+ const
38
+ _fs_module =
32
39
  require(
33
40
  "fs");
34
41
  const
35
42
  _fs_worker_new =
36
- _fs.fsWorkerNew;
43
+ _fs_module.fsWorkerNew;
37
44
  const
38
45
  _fs_worker_start =
39
- _fs.fsWorkerStart;
46
+ _fs_module.fsWorkerStart;
47
+ const
48
+ _mkdtemp =
49
+ _fs_module.mkdtemp;
40
50
  const
41
51
  _stat =
42
- _fs.statSync;
52
+ _fs_module.statSync;
43
53
  const
44
54
  _json_parse =
45
55
  JSON.parse;
@@ -266,6 +276,53 @@ function
266
276
  return _return;
267
277
  }
268
278
 
279
+ async function
280
+ _mktemp(
281
+ _prefix,
282
+ _directory) {
283
+ const
284
+ _directory_type =
285
+ typeof(
286
+ _directory);
287
+ if ( typeof(
288
+ _prefix) == "undefined" ||
289
+ _prefix == "" ) {
290
+ const
291
+ _os_tmpdir =
292
+ _os_tmpdir_get();
293
+ _prefix =
294
+ `${_os_tmpdir}/`;
295
+ }
296
+ if ( _directory_type == "undefined" ||
297
+ _directory == "" ||
298
+ _directory == "true" ) {
299
+ _directory =
300
+ true;
301
+ }
302
+ if ( _directory == "false" ) {
303
+ _directory =
304
+ false;
305
+ }
306
+ if ( _directory ) {
307
+ try {
308
+ await _mkdtemp(
309
+ _prefix);
310
+ }
311
+ catch(
312
+ _error) {
313
+ throw _error;
314
+ }
315
+ }
316
+ else {
317
+ _msg =
318
+ "It only supports creating " +
319
+ "temporary directories.";
320
+ _msg_error(
321
+ _msg,
322
+ 1);
323
+ }
324
+ }
325
+
269
326
  module.exports = {
270
327
  _basename:
271
328
  _basename,
@@ -295,6 +352,8 @@ module.exports = {
295
352
  _ls,
296
353
  _mkdir:
297
354
  _fs.mkdirSync,
355
+ _mktemp:
356
+ _mktemp,
298
357
  _mv:
299
358
  _mv,
300
359
  _path_join:
package/crash-js/utils CHANGED
@@ -188,6 +188,26 @@ function
188
188
  }
189
189
  }
190
190
 
191
+ function
192
+ _os_tmpdir_get() {
193
+ let
194
+ _os_tmpdir;
195
+ if ( typeof window === 'undefined' &&
196
+ ( typeof global !== 'undefined' && global.global === global ) &&
197
+ typeof __webpack_require__ !== 'function' ) {
198
+ _os_tmpdir =
199
+ os.tmpdir;
200
+ }
201
+ else {
202
+ _os_tmpdir =
203
+ function
204
+ () {
205
+ return "/tmp";
206
+ };
207
+ }
208
+ return _os_tmpdir;
209
+ }
210
+
191
211
  function
192
212
  _process_exit_get() {
193
213
  let
@@ -272,6 +292,8 @@ module.exports = {
272
292
  _argv_url_get,
273
293
  _child_process_spawn_get:
274
294
  _child_process_spawn_get,
295
+ _os_tmpdir_get:
296
+ _os_tmpdir_get,
275
297
  _process_exit_get:
276
298
  _process_exit_get,
277
299
  _process_cwd_get:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "crash-js",
4
4
  "version":
5
- "0.1.113",
5
+ "0.1.115",
6
6
  "description":
7
7
  "Crash Javascript library.",
8
8
  "funding":
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "crash-js-webpack":
64
- "^0.0.10",
64
+ "^0.0.11",
65
65
  "eslint":
66
66
  "^10.0.3",
67
67
  "globals":