@@ -2571,10 +2571,6 @@ function checkBypass(reqUrl) {
2571
2571
if ( ! reqUrl . hostname ) {
2572
2572
return false ;
2573
2573
}
2574
- const reqHost = reqUrl . hostname ;
2575
- if ( isLoopbackAddress ( reqHost ) ) {
2576
- return true ;
2577
- }
2578
2574
const noProxy = process . env [ 'no_proxy' ] || process . env [ 'NO_PROXY' ] || '' ;
2579
2575
if ( ! noProxy ) {
2580
2576
return false ;
@@ -2600,24 +2596,13 @@ function checkBypass(reqUrl) {
2600
2596
. split ( ',' )
2601
2597
. map ( x => x . trim ( ) . toUpperCase ( ) )
2602
2598
. filter ( x => x ) ) {
2603
- if ( upperNoProxyItem === '*' ||
2604
- upperReqHosts . some ( x => x === upperNoProxyItem ||
2605
- x . endsWith ( `.${ upperNoProxyItem } ` ) ||
2606
- ( upperNoProxyItem . startsWith ( '.' ) &&
2607
- x . endsWith ( `${ upperNoProxyItem } ` ) ) ) ) {
2599
+ if ( upperReqHosts . some ( x => x === upperNoProxyItem ) ) {
2608
2600
return true ;
2609
2601
}
2610
2602
}
2611
2603
return false ;
2612
2604
}
2613
2605
exports . checkBypass = checkBypass ;
2614
- function isLoopbackAddress ( host ) {
2615
- const hostLower = host . toLowerCase ( ) ;
2616
- return ( hostLower === 'localhost' ||
2617
- hostLower . startsWith ( '127.' ) ||
2618
- hostLower . startsWith ( '[::1]' ) ||
2619
- hostLower . startsWith ( '[0:0:0:0:0:0:0:1]' ) ) ;
2620
- }
2621
2606
//# sourceMappingURL=proxy.js.map
2622
2607
2623
2608
/***/ } ) ,
@@ -2657,17 +2642,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
2657
2642
} ;
2658
2643
var _a ;
2659
2644
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
2660
- exports . getCmdPath = exports . tryGetExecutablePath = exports . isRooted = exports . isDirectory = exports . exists = exports . READONLY = exports . UV_FS_O_EXLOCK = exports . IS_WINDOWS = exports . unlink = exports . symlink = exports . stat = exports . rmdir = exports . rm = exports . rename = exports . readlink = exports . readdir = exports . open = exports . mkdir = exports . lstat = exports . copyFile = exports . chmod = void 0 ;
2645
+ exports . getCmdPath = exports . tryGetExecutablePath = exports . isRooted = exports . isDirectory = exports . exists = exports . IS_WINDOWS = exports . unlink = exports . symlink = exports . stat = exports . rmdir = exports . rename = exports . readlink = exports . readdir = exports . mkdir = exports . lstat = exports . copyFile = exports . chmod = void 0 ;
2661
2646
const fs = __importStar ( __nccwpck_require__ ( 147 ) ) ;
2662
2647
const path = __importStar ( __nccwpck_require__ ( 17 ) ) ;
2663
- _a = fs . promises
2664
- // export const {open} = 'fs'
2665
- , exports . chmod = _a . chmod , exports . copyFile = _a . copyFile , exports . lstat = _a . lstat , exports . mkdir = _a . mkdir , exports . open = _a . open , exports . readdir = _a . readdir , exports . readlink = _a . readlink , exports . rename = _a . rename , exports . rm = _a . rm , exports . rmdir = _a . rmdir , exports . stat = _a . stat , exports . symlink = _a . symlink , exports . unlink = _a . unlink ;
2666
- // export const {open} = 'fs'
2648
+ _a = fs . promises , exports . chmod = _a . chmod , exports . copyFile = _a . copyFile , exports . lstat = _a . lstat , exports . mkdir = _a . mkdir , exports . readdir = _a . readdir , exports . readlink = _a . readlink , exports . rename = _a . rename , exports . rmdir = _a . rmdir , exports . stat = _a . stat , exports . symlink = _a . symlink , exports . unlink = _a . unlink ;
2667
2649
exports . IS_WINDOWS = process . platform === 'win32' ;
2668
- // See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
2669
- exports . UV_FS_O_EXLOCK = 0x10000000 ;
2670
- exports . READONLY = fs . constants . O_RDONLY ;
2671
2650
function exists ( fsPath ) {
2672
2651
return __awaiter ( this , void 0 , void 0 , function * ( ) {
2673
2652
try {
@@ -2848,8 +2827,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
2848
2827
Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
2849
2828
exports . findInPath = exports . which = exports . mkdirP = exports . rmRF = exports . mv = exports . cp = void 0 ;
2850
2829
const assert_1 = __nccwpck_require__ ( 491 ) ;
2830
+ const childProcess = __importStar ( __nccwpck_require__ ( 81 ) ) ;
2851
2831
const path = __importStar ( __nccwpck_require__ ( 17 ) ) ;
2832
+ const util_1 = __nccwpck_require__ ( 837 ) ;
2852
2833
const ioUtil = __importStar ( __nccwpck_require__ ( 962 ) ) ;
2834
+ const exec = util_1 . promisify ( childProcess . exec ) ;
2835
+ const execFile = util_1 . promisify ( childProcess . execFile ) ;
2853
2836
/**
2854
2837
* Copies a file or folder.
2855
2838
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -2930,23 +2913,61 @@ exports.mv = mv;
2930
2913
function rmRF ( inputPath ) {
2931
2914
return __awaiter ( this , void 0 , void 0 , function * ( ) {
2932
2915
if ( ioUtil . IS_WINDOWS ) {
2916
+ // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
2917
+ // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
2933
2918
// Check for invalid characters
2934
2919
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
2935
2920
if ( / [ * " < > | ] / . test ( inputPath ) ) {
2936
2921
throw new Error ( 'File path must not contain `*`, `"`, `<`, `>` or `|` on Windows' ) ;
2937
2922
}
2923
+ try {
2924
+ const cmdPath = ioUtil . getCmdPath ( ) ;
2925
+ if ( yield ioUtil . isDirectory ( inputPath , true ) ) {
2926
+ yield exec ( `${ cmdPath } /s /c "rd /s /q "%inputPath%""` , {
2927
+ env : { inputPath }
2928
+ } ) ;
2929
+ }
2930
+ else {
2931
+ yield exec ( `${ cmdPath } /s /c "del /f /a "%inputPath%""` , {
2932
+ env : { inputPath }
2933
+ } ) ;
2934
+ }
2935
+ }
2936
+ catch ( err ) {
2937
+ // if you try to delete a file that doesn't exist, desired result is achieved
2938
+ // other errors are valid
2939
+ if ( err . code !== 'ENOENT' )
2940
+ throw err ;
2941
+ }
2942
+ // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
2943
+ try {
2944
+ yield ioUtil . unlink ( inputPath ) ;
2945
+ }
2946
+ catch ( err ) {
2947
+ // if you try to delete a file that doesn't exist, desired result is achieved
2948
+ // other errors are valid
2949
+ if ( err . code !== 'ENOENT' )
2950
+ throw err ;
2951
+ }
2938
2952
}
2939
- try {
2940
- // note if path does not exist, error is silent
2941
- yield ioUtil . rm ( inputPath , {
2942
- force : true ,
2943
- maxRetries : 3 ,
2944
- recursive : true ,
2945
- retryDelay : 300
2946
- } ) ;
2947
- }
2948
- catch ( err ) {
2949
- throw new Error ( `File was unable to be removed ${ err } ` ) ;
2953
+ else {
2954
+ let isDir = false ;
2955
+ try {
2956
+ isDir = yield ioUtil . isDirectory ( inputPath ) ;
2957
+ }
2958
+ catch ( err ) {
2959
+ // if you try to delete a file that doesn't exist, desired result is achieved
2960
+ // other errors are valid
2961
+ if ( err . code !== 'ENOENT' )
2962
+ throw err ;
2963
+ return ;
2964
+ }
2965
+ if ( isDir ) {
2966
+ yield execFile ( `rm` , [ `-rf` , `${ inputPath } ` ] ) ;
2967
+ }
2968
+ else {
2969
+ yield ioUtil . unlink ( inputPath ) ;
2970
+ }
2950
2971
}
2951
2972
} ) ;
2952
2973
}
0 commit comments