File tree 3 files changed +59
-2
lines changed
3 files changed +59
-2
lines changed Original file line number Diff line number Diff line change 25
25
"sort-keys": 0,
26
26
},
27
27
"overrides": [
28
+ {
29
+ "files": "bin/**",
30
+ "rules": {
31
+ "no-process-exit": "off",
32
+ },
33
+ },
28
34
{
29
35
"files": "example/**",
30
36
"rules": {
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict' ;
4
+
5
+ var path = require ( 'path' ) ;
6
+ var fs = require ( 'fs' ) ;
7
+
8
+ if (
9
+ ! process . argv
10
+ || process . argv . length < 2
11
+ || ( process . argv [ 1 ] !== __filename && fs . statSync ( process . argv [ 1 ] ) . ino !== fs . statSync ( __filename ) . ino )
12
+ || ( process . env . _ && path . resolve ( process . env . _ ) !== __filename )
13
+ ) {
14
+ console . error ( 'Error: `resolve` must be run directly as an executable' ) ;
15
+ process . exit ( 1 ) ;
16
+ }
17
+
18
+ var supportsPreserveSymlinkFlag = require ( 'supports-preserve-symlinks-flag' ) ;
19
+
20
+ var preserveSymlinks = false ;
21
+ for ( var i = 2 ; i < process . argv . length ; i += 1 ) {
22
+ if ( process . argv [ i ] . slice ( 0 , 2 ) === '--' ) {
23
+ if ( supportsPreserveSymlinkFlag && process . argv [ i ] === '--preserve-symlinks' ) {
24
+ preserveSymlinks = true ;
25
+ } else if ( process . argv [ i ] . length > 2 ) {
26
+ console . error ( 'Unknown argument ' + process . argv [ i ] . replace ( / [ = ] .* $ / , '' ) ) ;
27
+ process . exit ( 2 ) ;
28
+ }
29
+ process . argv . splice ( i , 1 ) ;
30
+ i -= 1 ;
31
+ if ( process . argv [ i ] === '--' ) { break ; } // eslint-disable-line no-restricted-syntax
32
+ }
33
+ }
34
+
35
+ if ( process . argv . length < 3 ) {
36
+ console . error ( 'Error: `resolve` expects a specifier' ) ;
37
+ process . exit ( 2 ) ;
38
+ }
39
+
40
+ var resolve = require ( '../' ) ;
41
+
42
+ var result = resolve . sync ( process . argv [ 2 ] , {
43
+ basedir : process . cwd ( ) ,
44
+ preserveSymlinks : preserveSymlinks
45
+ } ) ;
46
+
47
+ console . log ( result ) ;
Original file line number Diff line number Diff line change 6
6
"type" : " git" ,
7
7
"url" : " git://github.com/browserify/resolve.git"
8
8
},
9
+ "bin" : {
10
+ "resolve" : " ./bin/resolve"
11
+ },
9
12
"main" : " index.js" ,
10
13
"exports" : {
11
14
"." : [
38
41
"prepublishOnly" : " safe-publish-latest" ,
39
42
"prepublish" : " not-in-publish || npm run prepublishOnly" ,
40
43
"prelint" : " eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\ .git')" ,
41
- "lint" : " eslint --ext=js,mjs --no-eslintrc -c .eslintrc ." ,
44
+ "lint" : " eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**' " ,
42
45
"pretests-only" : " cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async" ,
43
46
"tests-only" : " tape test/*.js" ,
44
47
"pretest" : " npm run lint" ,
69
72
},
70
73
"dependencies" : {
71
74
"is-core-module" : " ^2.8.0" ,
72
- "path-parse" : " ^1.0.7"
75
+ "path-parse" : " ^1.0.7" ,
76
+ "supports-preserve-symlinks-flag" : " ^1.0.0"
73
77
}
74
78
}
You can’t perform that action at this time.
0 commit comments