@microvac/adapter-utils 0.1.0-rc.23 → 0.1.0-rc.24

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.
@@ -4,6 +4,11 @@ import URLSearchParams from './lib/url-search-params'
4
4
  interface URL {
5
5
  /** The full serialized URL string. Setting this property reparses the URL. */
6
6
  href: string
7
+ /**
8
+ * The serialized origin, for example `'https://example.com:8080'`, or `'null'` if the URL has an
9
+ * opaque origin.
10
+ */
11
+ readonly origin: string
7
12
  /** The URL scheme followed by `':'`, for example `'https:'`. */
8
13
  protocol: string
9
14
  /** The username portion of the URL, or an empty string. */
@@ -111,6 +111,24 @@ class URL {
111
111
  if (this._params) this._params._parse(this.search)
112
112
  }
113
113
 
114
+ // https://url.spec.whatwg.org/#dom-url-origin
115
+
116
+ get origin() {
117
+ const protocol = this._slice(0, this._schemeEnd)
118
+
119
+ if (protocol === 'blob') {
120
+ const url = URL.parse(this.pathname)
121
+
122
+ if (url === null || (url.protocol !== 'http:' && url.protocol !== 'https:')) return 'null'
123
+
124
+ return url.origin
125
+ }
126
+
127
+ if (protocol === 'file' || !special.has(protocol)) return 'null'
128
+
129
+ return protocol + '://' + this.host
130
+ }
131
+
114
132
  // https://url.spec.whatwg.org/#dom-url-protocol
115
133
 
116
134
  get protocol() {
@@ -352,6 +370,7 @@ class URL {
352
370
  __proto__: { constructor: URL },
353
371
 
354
372
  href: this.href,
373
+ origin: this.origin,
355
374
  protocol: this.protocol,
356
375
  username: this.username,
357
376
  password: this.password,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microvac/adapter-utils",
3
- "version": "0.1.0-rc.23",
3
+ "version": "0.1.0-rc.24",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/microvac-ai/microvac",
6
6
  "bugs": {
@@ -34,7 +34,7 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@paperclipai/shared": "npm:@microvac/shared@0.1.0-rc.23",
37
+ "@paperclipai/shared": "npm:@microvac/shared@0.1.0-rc.24",
38
38
  "acpx": "0.22.0",
39
39
  "picocolors": "^1.1.1",
40
40
  "smol-toml": "^1.9.1"