bare-url 2.1.1 → 2.1.3

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,9 @@
1
+ import * as url from '.'
2
+
3
+ type URLConstructor = typeof url.URL
4
+
5
+ declare global {
6
+ type URL = url.URL
7
+
8
+ const URL: URLConstructor
9
+ }
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- declare class URL {
2
- constructor(input: string, base?: string | URL)
1
+ import URLError from './lib/errors'
3
2
 
3
+ interface URL {
4
4
  href: string
5
5
  protocol: string
6
6
  username: string
@@ -16,6 +16,10 @@ declare class URL {
16
16
  toJSON(): string
17
17
  }
18
18
 
19
+ declare class URL {
20
+ constructor(input: string, base?: string | URL)
21
+ }
22
+
19
23
  declare namespace URL {
20
24
  export function isURL(value: unknown): value is URL
21
25
 
@@ -27,7 +31,7 @@ declare namespace URL {
27
31
 
28
32
  export function pathToFileURL(pathname: string): URL
29
33
 
30
- export { URL }
34
+ export { URL, type URLError, URLError as errors }
31
35
  }
32
36
 
33
37
  export = URL
package/index.js CHANGED
@@ -1,4 +1,3 @@
1
- /* global Bare */
2
1
  const path = require('bare-path')
3
2
  const binding = require('./binding')
4
3
  const errors = require('./lib/errors')
@@ -275,6 +274,8 @@ const URL = exports
275
274
 
276
275
  exports.URL = URL // For Node.js compatibility
277
276
 
277
+ exports.errors = errors
278
+
278
279
  exports.isURL = function isURL(value) {
279
280
  if (typeof value !== 'object' || value === null) return false
280
281
 
@@ -0,0 +1,8 @@
1
+ declare class URLError extends Error {
2
+ static INVALID_URL(msg?: string): URLError
3
+ static INVALID_URL_SCHEME(msg?: string): URLError
4
+ static INVALID_FILE_URL_HOST(msg?: string): URLError
5
+ static INVALID_FILE_URL_PATH(msg?: string): URLError
6
+ }
7
+
8
+ export = URLError
package/package.json CHANGED
@@ -1,19 +1,23 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "exports": {
6
+ "./package": "./package.json",
6
7
  ".": {
7
8
  "types": "./index.d.ts",
8
9
  "default": "./index.js"
9
10
  },
10
- "./package": "./package.json",
11
- "./global": "./global.js"
11
+ "./global": {
12
+ "types": "./global.d.ts",
13
+ "default": "./global.js"
14
+ }
12
15
  },
13
16
  "files": [
14
17
  "index.js",
15
18
  "index.d.ts",
16
19
  "global.js",
20
+ "global.d.ts",
17
21
  "binding.c",
18
22
  "binding.js",
19
23
  "CMakeLists.txt",