File tree Expand file tree Collapse file tree 3 files changed +4
-26
lines changed Expand file tree Collapse file tree 3 files changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import { promises as fs } from 'fs';
6
6
7
7
import { dirname , join } from 'path' ;
8
8
9
+ import { fileURLToPath } from 'url' ;
10
+
9
11
import { globby } from 'globby' ;
10
12
11
13
import updateNotifier from 'update-notifier' ;
@@ -19,8 +21,7 @@ import doxdox, {
19
21
getRootDirPath ,
20
22
loadPlugin ,
21
23
parseConfigFromCLI ,
22
- parseIgnoreConfig ,
23
- sanitizePath
24
+ parseIgnoreConfig
24
25
} from 'doxdox-core' ;
25
26
26
27
import { Doc , File } from 'doxdox-core' ;
@@ -113,7 +114,7 @@ const overridePackage = String(
113
114
const cliConfig = parseConfigFromCLI ( args . raw ) ;
114
115
115
116
const nodeModulesDir = await findParentNodeModules (
116
- dirname ( sanitizePath ( import . meta. url ) )
117
+ dirname ( fileURLToPath ( import . meta. url ) )
117
118
) ;
118
119
119
120
if ( ! nodeModulesDir ) {
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import {
11
11
isFile ,
12
12
parseConfigFromCLI ,
13
13
parseIgnoreConfig ,
14
- sanitizePath ,
15
14
slugify
16
15
} from './utils' ;
17
16
@@ -169,18 +168,6 @@ describe('utils', () => {
169
168
} ) ;
170
169
} ) ;
171
170
172
- describe ( 'sanitizePath' , ( ) => {
173
- it ( 'sanitize path' , ( ) => {
174
- expect (
175
- sanitizePath (
176
- 'file:///Users/scottdoxey/git/github/doxdox/packages/doxdox-cli/dist/src/index.js'
177
- )
178
- ) . toEqual (
179
- '/Users/scottdoxey/git/github/doxdox/packages/doxdox-cli/dist/src/index.js'
180
- ) ;
181
- } ) ;
182
- } ) ;
183
-
184
171
describe ( 'slugify' , ( ) => {
185
172
it ( 'slugify path' , ( ) => {
186
173
expect ( slugify ( './src/utils.ts' ) ) . toEqual ( 'src-utils-ts' ) ;
Original file line number Diff line number Diff line change @@ -189,16 +189,6 @@ export const parseIgnoreConfig = (contents: string): string[] =>
189
189
. filter ( line => line . trim ( ) )
190
190
. map ( line => `!${ line . trim ( ) . replace ( / ^ ! / , '' ) } ` ) ;
191
191
192
- /**
193
- * Sanitizes given path or url.
194
- *
195
- * @param {string } [url] Path or url.
196
- * @return {Promise<string> } Sanitized path.
197
- * @public
198
- */
199
-
200
- export const sanitizePath = ( path : string ) : string => new URL ( path ) . pathname ;
201
-
202
192
/**
203
193
* Slugify a value for use as an anchor.
204
194
*
You can’t perform that action at this time.
0 commit comments