bare-url 2.1.4 → 2.1.6

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/CMakeLists.txt CHANGED
@@ -5,8 +5,8 @@ find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
5
5
 
6
6
  project(bare_url C)
7
7
 
8
- fetch_package("github:holepunchto/libutf#65b6ba0")
9
- fetch_package("github:holepunchto/liburl#54406f0")
8
+ fetch_package("github:holepunchto/libutf#9c5d642")
9
+ fetch_package("github:holepunchto/liburl#03f1488")
10
10
 
11
11
  add_bare_module(bare_url)
12
12
 
package/binding.c CHANGED
@@ -165,47 +165,6 @@ bare_url_can_parse (js_env_t *env, js_callback_info_t *info) {
165
165
  return result;
166
166
  }
167
167
 
168
- static js_value_t *
169
- bare_url_tag (js_env_t *env, js_callback_info_t *info) {
170
- int err;
171
-
172
- size_t argc = 1;
173
- js_value_t *argv[1];
174
-
175
- err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
176
- assert(err == 0);
177
-
178
- assert(argc == 1);
179
-
180
- err = js_add_type_tag(env, argv[0], &bare_url__tag);
181
- assert(err == 0);
182
-
183
- return NULL;
184
- }
185
-
186
- static js_value_t *
187
- bare_url_is_tagged (js_env_t *env, js_callback_info_t *info) {
188
- int err;
189
-
190
- size_t argc = 1;
191
- js_value_t *argv[1];
192
-
193
- err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
194
- assert(err == 0);
195
-
196
- assert(argc == 1);
197
-
198
- bool is_url;
199
- err = js_check_type_tag(env, argv[0], &bare_url__tag, &is_url);
200
- assert(err == 0);
201
-
202
- js_value_t *result;
203
- err = js_get_boolean(env, is_url, &result);
204
- assert(err == 0);
205
-
206
- return result;
207
- }
208
-
209
168
  static js_value_t *
210
169
  bare_url_exports (js_env_t *env, js_value_t *exports) {
211
170
  int err;
@@ -221,8 +180,6 @@ bare_url_exports (js_env_t *env, js_value_t *exports) {
221
180
 
222
181
  V("parse", bare_url_parse)
223
182
  V("canParse", bare_url_can_parse)
224
- V("tag", bare_url_tag)
225
- V("isTagged", bare_url_is_tagged)
226
183
  #undef V
227
184
 
228
185
  return exports;
package/index.js CHANGED
@@ -2,11 +2,13 @@ const path = require('bare-path')
2
2
  const binding = require('./binding')
3
3
  const errors = require('./lib/errors')
4
4
 
5
+ const kind = Symbol.for('bare.url.kind')
6
+
5
7
  const isWindows = Bare.platform === 'win32'
6
8
 
7
9
  module.exports = exports = class URL {
8
- static {
9
- binding.tag(this)
10
+ static get [kind]() {
11
+ return 0 // Compatibility version
10
12
  }
11
13
 
12
14
  constructor(input, base, opts = {}) {
@@ -21,6 +23,10 @@ module.exports = exports = class URL {
21
23
  this._parse(input, base, opts.throw !== false)
22
24
  }
23
25
 
26
+ get [kind]() {
27
+ return URL[kind]
28
+ }
29
+
24
30
  // https://url.spec.whatwg.org/#dom-url-href
25
31
 
26
32
  get href() {
@@ -277,17 +283,11 @@ exports.URL = URL // For Node.js compatibility
277
283
  exports.errors = errors
278
284
 
279
285
  exports.isURL = function isURL(value) {
280
- if (typeof value !== 'object' || value === null) return false
281
-
282
- let constructor = value.constructor
283
-
284
- while (typeof constructor === 'function') {
285
- if (binding.isTagged(constructor)) return true
286
-
287
- constructor = Reflect.getPrototypeOf(constructor)
288
- }
286
+ if (value instanceof URL) return true
289
287
 
290
- return false
288
+ return (
289
+ typeof value === 'object' && value !== null && value[kind] === URL[kind]
290
+ )
291
291
  }
292
292
 
293
293
  exports.parse = function parse(input, base) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file