crash-js 0.1.108 → 0.1.111
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 +128 -48
- package/crash-js/utils +16 -3
- package/package.json +2 -2
package/crash-js/crash-js
CHANGED
|
@@ -29,45 +29,49 @@
|
|
|
29
29
|
|
|
30
30
|
const
|
|
31
31
|
_utils =
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
require(
|
|
33
|
+
"./utils");
|
|
34
34
|
const
|
|
35
35
|
_argv_get =
|
|
36
|
-
|
|
36
|
+
_utils._argv_get;
|
|
37
37
|
const
|
|
38
38
|
_argv_url_get =
|
|
39
|
-
|
|
39
|
+
_utils._argv_url_get;
|
|
40
40
|
const
|
|
41
41
|
_child_process_spawn_get =
|
|
42
|
-
|
|
42
|
+
_utils._child_process_spawn_get;
|
|
43
43
|
const
|
|
44
|
-
_spawn =
|
|
45
|
-
|
|
44
|
+
_spawn =
|
|
45
|
+
_child_process_spawn_get();
|
|
46
|
+
const
|
|
47
|
+
_spawn_async =
|
|
48
|
+
_child_process_spawn_get(
|
|
49
|
+
"async");
|
|
46
50
|
const
|
|
47
51
|
_process_exit_get =
|
|
48
|
-
|
|
52
|
+
_utils._process_exit_get;
|
|
49
53
|
const
|
|
50
54
|
_process_exit =
|
|
51
|
-
|
|
55
|
+
_process_exit_get();
|
|
52
56
|
const
|
|
53
57
|
_process_cwd_get =
|
|
54
|
-
|
|
58
|
+
_utils._process_cwd_get;
|
|
55
59
|
const
|
|
56
60
|
_process_cwd =
|
|
57
|
-
|
|
61
|
+
_process_cwd_get();
|
|
58
62
|
const
|
|
59
63
|
_pwd =
|
|
60
|
-
|
|
64
|
+
_process_cwd;
|
|
61
65
|
const
|
|
62
66
|
_yargv_get =
|
|
63
|
-
|
|
67
|
+
_utils._yargv_get;
|
|
64
68
|
const
|
|
65
69
|
_fs_utils =
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
require(
|
|
71
|
+
"./fs-utils");
|
|
68
72
|
const
|
|
69
73
|
_dirname =
|
|
70
|
-
|
|
74
|
+
_fs_utils._dirname;
|
|
71
75
|
const
|
|
72
76
|
_file_exists =
|
|
73
77
|
_fs_utils._file_exists;
|
|
@@ -465,13 +469,19 @@ function
|
|
|
465
469
|
_index + _start);
|
|
466
470
|
}
|
|
467
471
|
|
|
468
|
-
function
|
|
472
|
+
async function
|
|
469
473
|
_run(
|
|
470
474
|
_run_mode,
|
|
471
|
-
_cmd
|
|
475
|
+
_cmd,
|
|
476
|
+
_name,
|
|
477
|
+
_timeout,
|
|
478
|
+
_run_type,
|
|
479
|
+
_method) {
|
|
472
480
|
let
|
|
481
|
+
_array,
|
|
473
482
|
_index,
|
|
474
|
-
_msg
|
|
483
|
+
_msg,
|
|
484
|
+
_out;
|
|
475
485
|
if ( typeof(
|
|
476
486
|
_cmd) == "undefined" ||
|
|
477
487
|
_cmd == "" ||
|
|
@@ -482,28 +492,44 @@ function
|
|
|
482
492
|
_msg,
|
|
483
493
|
1);
|
|
484
494
|
}
|
|
485
|
-
if ( typeof(
|
|
486
|
-
_run_mode) == "undefined" ||
|
|
487
|
-
_run_mode == "" ) {
|
|
488
|
-
_run_mode =
|
|
489
|
-
"sync";
|
|
490
|
-
}
|
|
491
|
-
const
|
|
492
|
-
_args =
|
|
493
|
-
[];
|
|
494
495
|
const
|
|
495
496
|
_program =
|
|
496
497
|
_cmd[
|
|
497
498
|
0];
|
|
498
499
|
const
|
|
499
|
-
|
|
500
|
-
|
|
500
|
+
_args =
|
|
501
|
+
_cmd.slice(
|
|
501
502
|
1,
|
|
502
|
-
_cmd.length
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
503
|
+
_cmd.length);
|
|
504
|
+
if ( typeof(
|
|
505
|
+
_run_mode) == "undefined" ||
|
|
506
|
+
_run_mode == "" ) {
|
|
507
|
+
_run_mode =
|
|
508
|
+
"sync";
|
|
509
|
+
}
|
|
510
|
+
if ( typeof(
|
|
511
|
+
_name) == "undefined" ||
|
|
512
|
+
_name == "" ) {
|
|
513
|
+
_name =
|
|
514
|
+
"";
|
|
515
|
+
}
|
|
516
|
+
if ( typeof(
|
|
517
|
+
_timeout) == "undefined" ||
|
|
518
|
+
_timeout == "" ) {
|
|
519
|
+
_timeout =
|
|
520
|
+
"0";
|
|
521
|
+
}
|
|
522
|
+
if ( typeof(
|
|
523
|
+
_run_type) == "undefined" ||
|
|
524
|
+
_run_type == "" ) {
|
|
525
|
+
_run_type =
|
|
526
|
+
"spawn";
|
|
527
|
+
}
|
|
528
|
+
if ( typeof(
|
|
529
|
+
_method) == "undefined" ||
|
|
530
|
+
_method == "" ) {
|
|
531
|
+
_method =
|
|
532
|
+
"";
|
|
507
533
|
}
|
|
508
534
|
_msg =
|
|
509
535
|
`Running '${_program}' ` +
|
|
@@ -513,6 +539,7 @@ function
|
|
|
513
539
|
_out =
|
|
514
540
|
"";
|
|
515
541
|
if ( _run_mode == "async" ) {
|
|
542
|
+
// currently not working well id say
|
|
516
543
|
const
|
|
517
544
|
_print =
|
|
518
545
|
function
|
|
@@ -547,7 +574,7 @@ function
|
|
|
547
574
|
};
|
|
548
575
|
const
|
|
549
576
|
_process =
|
|
550
|
-
|
|
577
|
+
_spawn_async(
|
|
551
578
|
_program,
|
|
552
579
|
_args);
|
|
553
580
|
_process.stdout.on(
|
|
@@ -557,23 +584,76 @@ function
|
|
|
557
584
|
'close',
|
|
558
585
|
_close);
|
|
559
586
|
_array =
|
|
560
|
-
_out.split(
|
|
587
|
+
_out.split(
|
|
588
|
+
"\n");
|
|
561
589
|
_msg_info(
|
|
562
590
|
_array.length);
|
|
563
591
|
return _array;
|
|
564
592
|
}
|
|
565
593
|
else if ( _run_mode == "sync" ) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
594
|
+
if ( _run_type == "spawn" ) {
|
|
595
|
+
const
|
|
596
|
+
_process =
|
|
597
|
+
_spawn(
|
|
598
|
+
_program,
|
|
599
|
+
_args,
|
|
600
|
+
{ "encoding":
|
|
601
|
+
"utf-8" });
|
|
602
|
+
_array =
|
|
603
|
+
_process.stdout.split(
|
|
604
|
+
"\n");
|
|
605
|
+
return _array;
|
|
606
|
+
}
|
|
607
|
+
else if ( _run_type == "native" ) {
|
|
608
|
+
if ( 0 < _timeout ) {
|
|
609
|
+
_msg_timeout =
|
|
610
|
+
`Timeout of length ` +
|
|
611
|
+
`'${_timeout}' ms reached for task '${_name}'.`;
|
|
612
|
+
_time_over =
|
|
613
|
+
false;
|
|
614
|
+
const
|
|
615
|
+
_exit_timeout =
|
|
616
|
+
() => {
|
|
617
|
+
throw _msg_timeout;
|
|
618
|
+
};
|
|
619
|
+
try {
|
|
620
|
+
setTimeout(
|
|
621
|
+
_exit_timeout,
|
|
622
|
+
_timeout);
|
|
623
|
+
if ( _method != "" ) {
|
|
624
|
+
_out =
|
|
625
|
+
await _program[
|
|
626
|
+
_method].apply(
|
|
627
|
+
_program,
|
|
628
|
+
_args);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
_out =
|
|
632
|
+
await _program.apply(
|
|
633
|
+
_program,
|
|
634
|
+
_args);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
catch(
|
|
638
|
+
_error) {
|
|
639
|
+
_time_over =
|
|
640
|
+
true;
|
|
641
|
+
}
|
|
642
|
+
if ( _time_over ) {
|
|
643
|
+
throw _msg_timeout;
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
return _out;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
_out =
|
|
651
|
+
await _program[
|
|
652
|
+
_method].apply(
|
|
653
|
+
_program,
|
|
654
|
+
_args);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
577
657
|
}
|
|
578
658
|
}
|
|
579
659
|
|
package/crash-js/utils
CHANGED
|
@@ -230,9 +230,16 @@ function
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
function
|
|
233
|
-
_child_process_spawn_get(
|
|
233
|
+
_child_process_spawn_get(
|
|
234
|
+
_spawn_type) {
|
|
234
235
|
let
|
|
235
236
|
_child_process_spawn;
|
|
237
|
+
if ( typeof(
|
|
238
|
+
_spawn_type) == "undefined" ||
|
|
239
|
+
_spawn_type == "" ) {
|
|
240
|
+
_spawn_type =
|
|
241
|
+
"sync";
|
|
242
|
+
}
|
|
236
243
|
if ( typeof window === 'undefined' &&
|
|
237
244
|
( typeof global !== 'undefined' && global.global === global ) &&
|
|
238
245
|
typeof __webpack_require__ !== 'function' ) {
|
|
@@ -240,8 +247,14 @@ function
|
|
|
240
247
|
_child_process_module =
|
|
241
248
|
require(
|
|
242
249
|
"node:child_process");
|
|
243
|
-
|
|
244
|
-
|
|
250
|
+
if ( _spawn_type == "sync" ) {
|
|
251
|
+
_child_process_spawn =
|
|
252
|
+
_child_process_module.spawnSync;
|
|
253
|
+
}
|
|
254
|
+
else if ( _spawn_type == "async" ) {
|
|
255
|
+
_child_process_spawn =
|
|
256
|
+
_child_process_module.spawn;
|
|
257
|
+
}
|
|
245
258
|
}
|
|
246
259
|
else {
|
|
247
260
|
_child_process_spawn =
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name":
|
|
3
3
|
"crash-js",
|
|
4
4
|
"version":
|
|
5
|
-
"0.1.
|
|
5
|
+
"0.1.111",
|
|
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.
|
|
64
|
+
"^0.0.10",
|
|
65
65
|
"eslint":
|
|
66
66
|
"^10.0.3",
|
|
67
67
|
"globals":
|