Skip to content

Commit

Permalink
use new URL instead of url.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Jan 3, 2023
1 parent 9eeed58 commit 44f3d3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/node-file-trace.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NodeFileTraceOptions, NodeFileTraceResult, NodeFileTraceReasons, Stats, NodeFileTraceReasonType } from './types';
import { basename, dirname, extname, relative, resolve, sep, join } from 'path';
import * as url from 'url';
import fs from 'graceful-fs';
import analyze, { AnalyzeResult } from './analyze';
import resolveDependency, { NotFoundError } from './resolve-dependency';
Expand All @@ -24,7 +23,7 @@ export function splitQueryStringFromSpecifier(specifier: string, cjsResolve: boo
let queryString = null;

if (!cjsResolve) {
const specifierUrl = url.parse(specifier);
const specifierUrl = new URL(specifier, "placeholder-protocol://");
queryString = specifierUrl.search;

if (specifierUrl.search) {
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"lib": ["esnext"],
"lib": [
"esnext",
"DOM" // needed for "new URL()"
],
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
Expand All @@ -21,4 +24,4 @@
},
"include": ["src/**/*"],
"exclude": ["node_modules", "test/**/*"]
}
}

0 comments on commit 44f3d3f

Please sign in to comment.