File tree Expand file tree Collapse file tree 3 files changed +65
-2
lines changed Expand file tree Collapse file tree 3 files changed +65
-2
lines changed Original file line number Diff line number Diff line change 3030 "sort-keys": 0,
3131 },
3232 "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+ },
3345 {
3446 "files": "test/resolver/nested_symlinks/mylib/*.js",
3547 "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 66 "type" : " git" ,
77 "url" : " git://github.com/browserify/resolve.git"
88 },
9+ "bin" : {
10+ "resolve" : " ./bin/resolve"
11+ },
912 "main" : " index.js" ,
1013 "keywords" : [
1114 " resolve" ,
1720 "prepublishOnly" : " safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:" ,
1821 "prepublish" : " not-in-publish || npm run prepublishOnly" ,
1922 "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/**' " ,
2124 "pretests-only" : " cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async" ,
2225 "tests-only" : " tape test/*.js" ,
2326 "pretest" : " npm run lint" ,
4851 },
4952 "dependencies" : {
5053 "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"
5256 }
5357}
You can’t perform that action at this time.
0 commit comments