crash-js 0.1.15 → 0.1.17

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
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
4
 
3
5
  // ----------------------------------------------------------------------
package/crash-js/fs-utils CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
4
 
3
5
  // ----------------------------------------------------------------------
@@ -19,18 +21,35 @@
19
21
  // You should have received a copy of the GNU Affero General Public License
20
22
  // along with this program. If not, see <https://www.gnu.org/licenses/>.
21
23
 
22
- _window_type = typeof window;
23
- if ( typeof window === 'undefined' ) {
24
- _fs_module_name =
25
- "fs";
26
- _path_module_name =
27
- "path";
24
+ function
25
+ _is_node() {
26
+ return typeof global !== 'undefined' && global.global === global;
27
+ }
28
+
29
+ function
30
+ _is_webpack() {
31
+ return typeof __webpack_require__ === 'function';
32
+ }
33
+
34
+ function
35
+ _is_not_browser() {
36
+ return typeof window === 'undefined';
37
+ }
38
+
39
+ if ( _is_not_browser() &&
40
+ _is_node() &&
41
+ ( ! is_webpack() ) ) {
42
+ _fs =
43
+ require(
44
+ "fs");
45
+ _path_module =
46
+ require("path");
28
47
  }
29
48
  else {
30
- _fs_module_name =
31
- "happy-opfs";
32
- _path_module_path =
33
- "@std/path";
49
+ _fs =
50
+ require("happy-opfs");
51
+ _path_module =
52
+ require("@std/path");
34
53
  // Maybe not neeeded here
35
54
  // window.addEventListener(
36
55
  // 'load',
@@ -40,14 +59,6 @@ else {
40
59
  // .register('/service-worker.js');
41
60
  // });
42
61
  }
43
- const
44
- _fs =
45
- require(
46
- _fs_module_path);
47
- const
48
- _path_module =
49
- require(
50
- _path_module_path);
51
62
  _path_module_basename =
52
63
  _path_module.basename;
53
64
  _path_module_dirname =
@@ -74,7 +85,6 @@ function
74
85
  return _dir;
75
86
  }
76
87
 
77
-
78
88
  function
79
89
  _dirname(
80
90
  _file_path) {
@@ -0,0 +1,6 @@
1
+ =====================================
2
+ Ahsi Authors
3
+ =====================================
4
+
5
+ * Pellegrino Prevete <pellegrinoprevete@gmail.com>
6
+ * Truocolo <truocolo@aol.com>