File tree 3 files changed +65
-2
lines changed
3 files changed +65
-2
lines changed Original file line number Diff line number Diff line change 30
30
"sort-keys": 0,
31
31
},
32
32
"overrides": [
33
+ {
34
+ "files": "bin/**",
35
+ "rules": {
36
+ "no-process-exit": "off",
37
+ },
38
+ },
39
+ {
40
+ "files": "example/**",
41
+ "rules": {
42
+ "no-console": 0,
43
+ },
44
+ },
33
45
{
34
46
"files": "test/resolver/nested_symlinks/mylib/*.js",
35
47
"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
"keywords" : [
11
14
" resolve" ,
17
20
"prepublishOnly" : " safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:" ,
18
21
"prepublish" : " not-in-publish || npm run prepublishOnly" ,
19
22
"prelint" : " eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\ .git')" ,
20
- "lint" : " eslint --ext=js,mjs --no-eslintrc -c .eslintrc ." ,
23
+ "lint" : " eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**' " ,
21
24
"pretests-only" : " cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async" ,
22
25
"tests-only" : " tape test/*.js" ,
23
26
"pretest" : " npm run lint" ,
48
51
},
49
52
"dependencies" : {
50
53
"is-core-module" : " ^2.8.0" ,
51
- "path-parse" : " ^1.0.7"
54
+ "path-parse" : " ^1.0.7" ,
55
+ "supports-preserve-symlinks-flag" : " ^1.0.0"
52
56
}
53
57
}
You can’t perform that action at this time.
0 commit comments