bare-url 2.0.7 → 2.0.9

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.
Files changed (60) hide show
  1. package/CMakeLists.txt +3 -7
  2. package/package.json +3 -6
  3. package/prebuilds/android-arm/bare-url.bare +0 -0
  4. package/prebuilds/android-arm64/bare-url.bare +0 -0
  5. package/prebuilds/android-ia32/bare-url.bare +0 -0
  6. package/prebuilds/android-x64/bare-url.bare +0 -0
  7. package/prebuilds/darwin-arm64/bare-url.bare +0 -0
  8. package/prebuilds/darwin-x64/bare-url.bare +0 -0
  9. package/prebuilds/ios-arm64/bare-url.bare +0 -0
  10. package/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  11. package/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  12. package/prebuilds/linux-arm64/bare-url.bare +0 -0
  13. package/prebuilds/linux-x64/bare-url.bare +0 -0
  14. package/prebuilds/win32-arm64/bare-url.bare +0 -0
  15. package/prebuilds/win32-x64/bare-url.bare +0 -0
  16. package/vendor/liburl/CMakeLists.txt +0 -79
  17. package/vendor/liburl/include/url.h +0 -107
  18. package/vendor/liburl/src/character-set.h +0 -41
  19. package/vendor/liburl/src/idna.h +0 -14
  20. package/vendor/liburl/src/infra.h +0 -141
  21. package/vendor/liburl/src/parse.h +0 -1406
  22. package/vendor/liburl/src/percent-encode.h +0 -567
  23. package/vendor/liburl/src/punycode.h +0 -21
  24. package/vendor/liburl/src/serialize.h +0 -91
  25. package/vendor/liburl/src/type.h +0 -61
  26. package/vendor/liburl/src/url.c +0 -81
  27. package/vendor/libutf/CMakeLists.txt +0 -93
  28. package/vendor/libutf/include/utf/string.h +0 -786
  29. package/vendor/libutf/include/utf.h +0 -132
  30. package/vendor/libutf/src/ascii/validate.c +0 -47
  31. package/vendor/libutf/src/endianness.c +0 -19
  32. package/vendor/libutf/src/endianness.h +0 -54
  33. package/vendor/libutf/src/latin1/convert-to-utf16.c +0 -37
  34. package/vendor/libutf/src/latin1/convert-to-utf32.c +0 -34
  35. package/vendor/libutf/src/latin1/convert-to-utf8.c +0 -58
  36. package/vendor/libutf/src/latin1/length-from-utf16.c +0 -26
  37. package/vendor/libutf/src/latin1/length-from-utf32.c +0 -26
  38. package/vendor/libutf/src/latin1/length-from-utf8.c +0 -34
  39. package/vendor/libutf/src/utf16/convert-to-latin1.c +0 -41
  40. package/vendor/libutf/src/utf16/convert-to-utf32.c +0 -56
  41. package/vendor/libutf/src/utf16/convert-to-utf8.c +0 -75
  42. package/vendor/libutf/src/utf16/length-from-latin1.c +0 -26
  43. package/vendor/libutf/src/utf16/length-from-utf32.c +0 -33
  44. package/vendor/libutf/src/utf16/length-from-utf8.c +0 -38
  45. package/vendor/libutf/src/utf16/validate.c +0 -53
  46. package/vendor/libutf/src/utf32/convert-to-latin1.c +0 -40
  47. package/vendor/libutf/src/utf32/convert-to-utf16.c +0 -56
  48. package/vendor/libutf/src/utf32/convert-to-utf8.c +0 -71
  49. package/vendor/libutf/src/utf32/length-from-latin1.c +0 -26
  50. package/vendor/libutf/src/utf32/length-from-utf16.c +0 -35
  51. package/vendor/libutf/src/utf32/length-from-utf8.c +0 -35
  52. package/vendor/libutf/src/utf32/validate.c +0 -39
  53. package/vendor/libutf/src/utf8/convert-to-latin1.c +0 -70
  54. package/vendor/libutf/src/utf8/convert-to-utf16.c +0 -95
  55. package/vendor/libutf/src/utf8/convert-to-utf32.c +0 -110
  56. package/vendor/libutf/src/utf8/length-from-latin1.c +0 -32
  57. package/vendor/libutf/src/utf8/length-from-utf16.c +0 -44
  58. package/vendor/libutf/src/utf8/length-from-utf32.c +0 -35
  59. package/vendor/libutf/src/utf8/string.c +0 -149
  60. package/vendor/libutf/src/utf8/validate.c +0 -107
package/CMakeLists.txt CHANGED
@@ -1,16 +1,12 @@
1
1
  cmake_minimum_required(VERSION 3.25)
2
2
 
3
3
  find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
4
+ find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
4
5
 
5
6
  project(bare_url C)
6
7
 
7
- if(NOT TARGET utf)
8
- add_subdirectory(vendor/libutf EXCLUDE_FROM_ALL)
9
- endif()
10
-
11
- if(NOT TARGET url)
12
- add_subdirectory(vendor/liburl EXCLUDE_FROM_ALL)
13
- endif()
8
+ fetch_package("github:holepunchto/libutf#65b6ba0")
9
+ fetch_package("github:holepunchto/liburl#54406f0")
14
10
 
15
11
  add_bare_module(bare_url)
16
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "WHATWG URL implementation for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -9,11 +9,7 @@
9
9
  "binding.js",
10
10
  "CMakeLists.txt",
11
11
  "lib",
12
- "prebuilds",
13
- "vendor/liburl/include",
14
- "vendor/liburl/src",
15
- "vendor/libutf/include",
16
- "vendor/libutf/src"
12
+ "prebuilds"
17
13
  ],
18
14
  "addon": true,
19
15
  "scripts": {
@@ -35,6 +31,7 @@
35
31
  "devDependencies": {
36
32
  "brittle": "^3.3.2",
37
33
  "cmake-bare": "^1.1.6",
34
+ "cmake-fetch": "^1.0.0",
38
35
  "standard": "^17.1.0"
39
36
  }
40
37
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,79 +0,0 @@
1
- cmake_minimum_required(VERSION 3.25)
2
-
3
- project(url C)
4
-
5
- if(NOT TARGET utf)
6
- add_subdirectory(vendor/libutf EXCLUDE_FROM_ALL)
7
- endif()
8
-
9
- add_library(url OBJECT)
10
-
11
- set_target_properties(
12
- url
13
- PROPERTIES
14
- C_STANDARD 11
15
- POSITION_INDEPENDENT_CODE ON
16
- )
17
-
18
- target_sources(
19
- url
20
- INTERFACE
21
- include/url.h
22
- PRIVATE
23
- src/character-set.h
24
- src/infra.h
25
- src/parse.h
26
- src/percent-encode.h
27
- src/serialize.h
28
- src/type.h
29
- src/url.c
30
- )
31
-
32
- target_include_directories(
33
- url
34
- PUBLIC
35
- include
36
- $<TARGET_PROPERTY:utf,INTERFACE_INCLUDE_DIRECTORIES>
37
- )
38
-
39
- add_library(url_shared SHARED)
40
-
41
- set_target_properties(
42
- url_shared
43
- PROPERTIES
44
- OUTPUT_NAME url
45
- WINDOWS_EXPORT_ALL_SYMBOLS ON
46
- )
47
-
48
- target_link_libraries(
49
- url_shared
50
- PUBLIC
51
- url
52
- utf_shared
53
- )
54
-
55
- add_library(url_static STATIC)
56
-
57
- set_target_properties(
58
- url_static
59
- PROPERTIES
60
- OUTPUT_NAME url
61
- PREFIX lib
62
- )
63
-
64
- target_link_libraries(
65
- url_static
66
- PUBLIC
67
- url
68
- utf_static
69
- )
70
-
71
- install(TARGETS url_shared url_static)
72
-
73
- install(FILES include/url.h DESTINATION include)
74
-
75
- if(PROJECT_IS_TOP_LEVEL)
76
- enable_testing()
77
- add_subdirectory(bench)
78
- add_subdirectory(test)
79
- endif()
@@ -1,107 +0,0 @@
1
- #ifndef URL_H
2
- #define URL_H
3
-
4
- #ifdef __cplusplus
5
- extern "C" {
6
- #endif
7
-
8
- #include <stddef.h>
9
- #include <utf.h>
10
- #include <utf/string.h>
11
-
12
- typedef struct url_s url_t;
13
- typedef uint32_t url_component_t;
14
-
15
- static const url_component_t url_component_unset = (url_component_t) -1;
16
-
17
- enum {
18
- url_has_opaque_path = 0x1,
19
- };
20
-
21
- typedef enum {
22
- url_type_opaque,
23
- url_type_http,
24
- url_type_https,
25
- url_type_ws,
26
- url_type_wss,
27
- url_type_ftp,
28
- url_type_file,
29
- } url_type_t;
30
-
31
- struct url_s {
32
- uint8_t flags;
33
-
34
- url_type_t type;
35
-
36
- /**
37
- * The normalized serialization of the URL. This is used as the canonical
38
- * representation to both minimize memory allocation and also provide fast,
39
- * immutable views over the various URL components.
40
- */
41
- utf8_string_t href;
42
-
43
- /**
44
- * https://user:pass@example.com:1234/foo/bar?baz#quux
45
- * | | | |^^^^| | |
46
- * | | | || | | `---- fragment_start
47
- * | | | || | `-------- query_start
48
- * | | | || `----------------- path_start
49
- * | | | |`--------------------- port
50
- * | | | `---------------------- host_end
51
- * | | `--------------------------------- host_start
52
- * | `--------------------------------------- username_end
53
- * `---------------------------------------------- scheme_end
54
- */
55
- struct {
56
- url_component_t scheme_end;
57
- url_component_t username_end;
58
- url_component_t host_start;
59
- url_component_t host_end;
60
- url_component_t port;
61
- url_component_t path_start;
62
- url_component_t query_start;
63
- url_component_t fragment_start;
64
- } components;
65
- };
66
-
67
- void
68
- url_init (url_t *url);
69
-
70
- void
71
- url_destroy (url_t *url);
72
-
73
- int
74
- url_parse (url_t *url, const utf8_t *input, size_t len, const url_t *base);
75
-
76
- utf8_string_view_t
77
- url_get_href (const url_t *url);
78
-
79
- utf8_string_view_t
80
- url_get_scheme (const url_t *url);
81
-
82
- utf8_string_view_t
83
- url_get_username (const url_t *url);
84
-
85
- utf8_string_view_t
86
- url_get_password (const url_t *url);
87
-
88
- utf8_string_view_t
89
- url_get_host (const url_t *url);
90
-
91
- utf8_string_view_t
92
- url_get_port (const url_t *url);
93
-
94
- utf8_string_view_t
95
- url_get_path (const url_t *url);
96
-
97
- utf8_string_view_t
98
- url_get_query (const url_t *url);
99
-
100
- utf8_string_view_t
101
- url_get_fragment (const url_t *url);
102
-
103
- #ifdef __cplusplus
104
- }
105
- #endif
106
-
107
- #endif // URL_H
@@ -1,41 +0,0 @@
1
- #ifndef URL_CHARACTER_SET
2
- #define URL_CHARACTER_SET
3
-
4
- #include <stdbool.h>
5
- #include <stdint.h>
6
- #include <utf.h>
7
- #include <utf/string.h>
8
-
9
- /**
10
- * A character set is stored as a 32 x 8 bit list with each bit
11
- * representing an ASCII byte. A given ASCII byte is in the character set
12
- * if its corresponding bit is set.
13
- */
14
- typedef const uint8_t url_character_set_t[32];
15
-
16
- static inline bool
17
- url__is_in_character_set (url_character_set_t character_set, utf8_t character) {
18
- return (character_set[character >> 3] & (1 << (character & 7))) != 0;
19
- }
20
-
21
- static inline bool
22
- url__contains_from_character_set (url_character_set_t character_set, utf8_string_view_t input) {
23
- size_t i = 0, n = input.len;
24
-
25
- uint8_t accumulator = 0;
26
-
27
- for (; i + 4 <= n; i += 4) {
28
- accumulator |= url__is_in_character_set(character_set, input.data[i]);
29
- accumulator |= url__is_in_character_set(character_set, input.data[i + 1]);
30
- accumulator |= url__is_in_character_set(character_set, input.data[i + 2]);
31
- accumulator |= url__is_in_character_set(character_set, input.data[i + 3]);
32
- }
33
-
34
- for (; i < n; i++) {
35
- accumulator |= url__is_in_character_set(character_set, input.data[i]);
36
- }
37
-
38
- return accumulator;
39
- }
40
-
41
- #endif // URL_CHARACTER_SET
@@ -1,14 +0,0 @@
1
- #ifndef URL_IDNA_H
2
- #define URL_IDNA_H
3
-
4
- #include <utf.h>
5
- #include <utf/string.h>
6
-
7
- static inline int
8
- url__idna_to_ascii (utf8_string_view_t input, utf8_string_t *result) {
9
- // TODO
10
-
11
- return -1;
12
- }
13
-
14
- #endif // URL_IDNA_H
@@ -1,141 +0,0 @@
1
- #ifndef URL_INFRA_H
2
- #define URL_INFRA_H
3
-
4
- #include <stdbool.h>
5
- #include <utf.h>
6
-
7
- #include "character-set.h"
8
-
9
- // https://infra.spec.whatwg.org/#ascii-alpha
10
- static url_character_set_t url__ascii_alpha_character_set = {
11
- // 00 01 02 03 04 05 06 07
12
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
13
- // 08 09 0a 0b 0c 0d 0e 0f
14
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
15
- // 10 11 12 13 14 15 16 17
16
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
17
- // 18 19 1a 1b 1c 1d 1e 1f
18
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
19
- // 20 21 22 23 24 25 26 27
20
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
21
- // 28 29 2a 2b 2c 2d 2e 2f
22
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
23
- // 30 31 32 33 34 35 36 37
24
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
25
- // 38 39 3a 3b 3c 3d 3e 3f
26
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
27
- // 40 41 42 43 44 45 46 47
28
- 0x00 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
29
- // 48 49 4a 4b 4c 4d 4e 4f
30
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
31
- // 50 51 52 53 54 55 56 57
32
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
33
- // 58 59 5a 5b 5c 5d 5e 5f
34
- 0x01 | 0x02 | 0x04 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
35
- // 60 61 62 63 64 65 66 67
36
- 0x00 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
37
- // 68 69 6a 6b 6c 6d 6e 6f
38
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
39
- // 70 71 72 73 74 75 76 77
40
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
41
- // 78 79 7a
42
- 0x01 | 0x02 | 0x04,
43
- };
44
-
45
- // https://infra.spec.whatwg.org/#ascii-alphanumeric
46
- static url_character_set_t url__ascii_alphanumeric_character_set = {
47
- // 00 01 02 03 04 05 06 07
48
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
49
- // 08 09 0a 0b 0c 0d 0e 0f
50
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
51
- // 10 11 12 13 14 15 16 17
52
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
53
- // 18 19 1a 1b 1c 1d 1e 1f
54
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
55
- // 20 21 22 23 24 25 26 27
56
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
57
- // 28 29 2a 2b 2c 2d 2e 2f
58
- 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
59
- // 30 31 32 33 34 35 36 37
60
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
61
- // 38 39 3a 3b 3c 3d 3e 3f
62
- 0x01 | 0x02 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
63
- // 40 41 42 43 44 45 46 47
64
- 0x00 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
65
- // 48 49 4a 4b 4c 4d 4e 4f
66
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
67
- // 50 51 52 53 54 55 56 57
68
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
69
- // 58 59 5a 5b 5c 5d 5e 5f
70
- 0x01 | 0x02 | 0x04 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00,
71
- // 60 61 62 63 64 65 66 67
72
- 0x00 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
73
- // 68 69 6a 6b 6c 6d 6e 6f
74
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
75
- // 70 71 72 73 74 75 76 77
76
- 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80,
77
- // 78 79 7a
78
- 0x01 | 0x02 | 0x04,
79
- };
80
-
81
- // https://infra.spec.whatwg.org/#ascii-digit
82
- static inline bool
83
- url__is_ascii_digit (utf8_t c) {
84
- return c >= 0x30 && c <= 0x39;
85
- }
86
-
87
- // https://infra.spec.whatwg.org/#ascii-upper-hex-digit
88
- static inline bool
89
- url__is_ascii_upper_hex_digit (utf8_t c) {
90
- return url__is_ascii_digit(c) || (c >= 0x41 && c <= 0x46);
91
- }
92
-
93
- // https://infra.spec.whatwg.org/#ascii-lower-hex-digit
94
- static inline bool
95
- url__is_ascii_lower_hex_digit (utf8_t c) {
96
- return url__is_ascii_digit(c) || (c >= 0x61 && c <= 0x66);
97
- }
98
-
99
- // https://infra.spec.whatwg.org/#ascii-hex-digit
100
- static inline bool
101
- url__is_ascii_hex_digit (utf8_t c) {
102
- return url__is_ascii_digit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
103
- }
104
-
105
- // https://infra.spec.whatwg.org/#ascii-upper-alpha
106
- static inline bool
107
- url__is_ascii_upper_alpha (utf8_t c) {
108
- return c >= 0x41 && c <= 0x5a;
109
- }
110
-
111
- // https://infra.spec.whatwg.org/#ascii-lower-alpha
112
- static inline bool
113
- url__is_ascii_lower_alpha (utf8_t c) {
114
- return c >= 0x61 && c <= 0x7a;
115
- }
116
-
117
- // https://infra.spec.whatwg.org/#ascii-alpha
118
- static inline bool
119
- url__is_ascii_alpha (utf8_t c) {
120
- return url__is_in_character_set(url__ascii_alpha_character_set, c);
121
- }
122
-
123
- // https://infra.spec.whatwg.org/#ascii-alphanumeric
124
- static inline bool
125
- url__is_ascii_alphanumeric (utf8_t c) {
126
- return url__is_in_character_set(url__ascii_alphanumeric_character_set, c);
127
- }
128
-
129
- // https://infra.spec.whatwg.org/#ascii-lowercase
130
- static inline utf8_t
131
- url__to_ascii_lowercase (utf8_t c) {
132
- return c | 0x20;
133
- }
134
-
135
- // https://infra.spec.whatwg.org/#ascii-uppercase
136
- static inline utf8_t
137
- url__to_ascii_uppercase (utf8_t c) {
138
- return c & ~0x20;
139
- }
140
-
141
- #endif // URL_INFRA_H