bare-url 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/global.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import * as url from '.'
2
+
3
+ declare global {
4
+ interface URL extends url.URL {}
5
+
6
+ class URL extends url.URL {}
7
+ }
package/index.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ interface URL {
2
+ href: string
3
+ protocol: string
4
+ username: string
5
+ password: string
6
+ host: string
7
+ hostname: string
8
+ port: string
9
+ pathname: string
10
+ search: string
11
+ hash: string
12
+
13
+ toString(): string
14
+ toJSON(): string
15
+ }
16
+
17
+ declare class URL {
18
+ constructor(input: string, base?: string | URL)
19
+ }
20
+
21
+ declare namespace URL {
22
+ export function isURL(value: unknown): value is URL
23
+
24
+ export function parse(input: string, base?: string | URL): URL | null
25
+
26
+ export function canParse(input: string, base?: string | URL): boolean
27
+
28
+ export function fileURLToPath(url: URL | string): string
29
+
30
+ export function pathToFileURL(pathname: string): URL
31
+
32
+ export { URL }
33
+ }
34
+
35
+ export = URL
package/index.js CHANGED
@@ -353,7 +353,7 @@ exports.pathToFileURL = function pathToFileURL(pathname) {
353
353
 
354
354
  if (pathname[pathname.length - 1] === '/') {
355
355
  resolved += '/'
356
- } else if (isWindows && pathname[pathname.length - 1 === '\\']) {
356
+ } else if (isWindows && pathname[pathname.length - 1] === '\\') {
357
357
  resolved += '\\'
358
358
  }
359
359
 
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "exports": {
6
- ".": "./index.js",
6
+ ".": {
7
+ "types": "./index.d.ts",
8
+ "default": "./index.js"
9
+ },
7
10
  "./package": "./package.json",
8
- "./global": "./global.js"
11
+ "./global": {
12
+ "types": "./global.d.ts",
13
+ "default": "./global.js"
14
+ }
9
15
  },
10
16
  "files": [
11
17
  "index.js",
18
+ "index.d.ts",
12
19
  "global.js",
20
+ "global.d.ts",
13
21
  "binding.c",
14
22
  "binding.js",
15
23
  "CMakeLists.txt",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file