Remove deprecated scripts for adding head-matter to wt_config.xml, including Python and Bash implementations, to streamline configuration management.
This commit is contained in:
27
node_modules/bare-url/CMakeLists.txt
generated
vendored
Normal file
27
node_modules/bare-url/CMakeLists.txt
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
|
||||
find_package(cmake-bare REQUIRED PATHS node_modules/cmake-bare)
|
||||
find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
|
||||
|
||||
project(bare_url C)
|
||||
|
||||
fetch_package("github:holepunchto/libutf#6b1a36f")
|
||||
fetch_package("github:holepunchto/liburl#03f1488")
|
||||
|
||||
add_bare_module(bare_url)
|
||||
|
||||
target_sources(
|
||||
${bare_url}
|
||||
PRIVATE
|
||||
binding.c
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${bare_url}
|
||||
PRIVATE
|
||||
$<TARGET_OBJECTS:utf>
|
||||
$<TARGET_OBJECTS:url>
|
||||
PUBLIC
|
||||
utf
|
||||
url
|
||||
)
|
||||
201
node_modules/bare-url/LICENSE
generated
vendored
Normal file
201
node_modules/bare-url/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
19
node_modules/bare-url/README.md
generated
vendored
Normal file
19
node_modules/bare-url/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# bare-url
|
||||
|
||||
WHATWG URL implementation for JavaScript.
|
||||
|
||||
```
|
||||
npm i bare-url
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const url = require('bare-url')
|
||||
|
||||
const p = url.fileURLToPath('file:///foo') // --> /foo
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
188
node_modules/bare-url/binding.c
generated
vendored
Normal file
188
node_modules/bare-url/binding.c
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
#include <assert.h>
|
||||
#include <bare.h>
|
||||
#include <js.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <url.h>
|
||||
#include <utf.h>
|
||||
#include <utf/string.h>
|
||||
|
||||
static js_type_tag_t bare_url__tag = {0x6f1fd92f476698b0, 0x93b59c349143ee50};
|
||||
|
||||
static js_value_t *
|
||||
bare_url_parse (js_env_t *env, js_callback_info_t *info) {
|
||||
int err;
|
||||
|
||||
size_t argc = 4;
|
||||
js_value_t *argv[4];
|
||||
|
||||
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
assert(argc == 4);
|
||||
|
||||
bool should_throw;
|
||||
err = js_get_value_bool(env, argv[3], &should_throw);
|
||||
assert(err == 0);
|
||||
|
||||
bool has_base;
|
||||
err = js_is_string(env, argv[1], &has_base);
|
||||
assert(err == 0);
|
||||
|
||||
url_t base;
|
||||
url_init(&base);
|
||||
|
||||
if (has_base) {
|
||||
size_t len;
|
||||
err = js_get_value_string_utf8(env, argv[1], NULL, 0, &len);
|
||||
assert(err == 0);
|
||||
|
||||
utf8_t *input = malloc(len);
|
||||
err = js_get_value_string_utf8(env, argv[1], input, len, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
err = url_parse(&base, input, len, NULL);
|
||||
|
||||
free(input);
|
||||
|
||||
if (err < 0) {
|
||||
url_destroy(&base);
|
||||
|
||||
if (should_throw) js_throw_error(env, NULL, "Invalid base URL");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t len;
|
||||
err = js_get_value_string_utf8(env, argv[0], NULL, 0, &len);
|
||||
assert(err == 0);
|
||||
|
||||
utf8_t *input = malloc(len);
|
||||
err = js_get_value_string_utf8(env, argv[0], input, len, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
js_value_t *handle;
|
||||
|
||||
url_t url;
|
||||
url_init(&url);
|
||||
|
||||
err = url_parse(&url, input, len, has_base ? &base : NULL);
|
||||
|
||||
free(input);
|
||||
|
||||
if (err < 0) {
|
||||
url_destroy(&base);
|
||||
url_destroy(&url);
|
||||
|
||||
if (should_throw) js_throw_error(env, NULL, "Invalid URL");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
js_value_t *href;
|
||||
err = js_create_string_utf8(env, url.href.data, url.href.len, &href);
|
||||
assert(err == 0);
|
||||
|
||||
uint32_t *components;
|
||||
err = js_get_typedarray_info(env, argv[2], NULL, (void **) &components, NULL, NULL, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
memcpy(components, &url.components, sizeof(url.components));
|
||||
|
||||
url_destroy(&base);
|
||||
url_destroy(&url);
|
||||
|
||||
return href;
|
||||
}
|
||||
|
||||
static js_value_t *
|
||||
bare_url_can_parse (js_env_t *env, js_callback_info_t *info) {
|
||||
int err;
|
||||
|
||||
size_t argc = 2;
|
||||
js_value_t *argv[2];
|
||||
|
||||
err = js_get_callback_info(env, info, &argc, argv, NULL, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
assert(argc == 2);
|
||||
|
||||
bool has_base;
|
||||
err = js_is_string(env, argv[1], &has_base);
|
||||
assert(err == 0);
|
||||
|
||||
url_t base;
|
||||
url_init(&base);
|
||||
|
||||
if (has_base) {
|
||||
size_t len;
|
||||
err = js_get_value_string_utf8(env, argv[1], NULL, 0, &len);
|
||||
assert(err == 0);
|
||||
|
||||
utf8_t *input = malloc(len);
|
||||
err = js_get_value_string_utf8(env, argv[1], input, len, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
err = url_parse(&base, input, len, NULL);
|
||||
|
||||
free(input);
|
||||
|
||||
if (err < 0) {
|
||||
url_destroy(&base);
|
||||
|
||||
js_value_t *result;
|
||||
err = js_get_boolean(env, false, &result);
|
||||
assert(err == 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
size_t len;
|
||||
err = js_get_value_string_utf8(env, argv[0], NULL, 0, &len);
|
||||
assert(err == 0);
|
||||
|
||||
utf8_t *input = malloc(len);
|
||||
err = js_get_value_string_utf8(env, argv[0], input, len, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
url_t url;
|
||||
url_init(&url);
|
||||
|
||||
err = url_parse(&url, input, len, has_base ? &base : NULL);
|
||||
|
||||
free(input);
|
||||
|
||||
url_destroy(&base);
|
||||
url_destroy(&url);
|
||||
|
||||
js_value_t *result;
|
||||
err = js_get_boolean(env, err == 0, &result);
|
||||
assert(err == 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static js_value_t *
|
||||
bare_url_exports (js_env_t *env, js_value_t *exports) {
|
||||
int err;
|
||||
|
||||
#define V(name, fn) \
|
||||
{ \
|
||||
js_value_t *val; \
|
||||
err = js_create_function(env, name, -1, fn, NULL, &val); \
|
||||
assert(err == 0); \
|
||||
err = js_set_named_property(env, exports, name, val); \
|
||||
assert(err == 0); \
|
||||
}
|
||||
|
||||
V("parse", bare_url_parse)
|
||||
V("canParse", bare_url_can_parse)
|
||||
#undef V
|
||||
|
||||
return exports;
|
||||
}
|
||||
|
||||
BARE_MODULE(bare_url, bare_url_exports)
|
||||
1
node_modules/bare-url/binding.js
generated
vendored
Normal file
1
node_modules/bare-url/binding.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require.addon()
|
||||
12
node_modules/bare-url/global.d.ts
generated
vendored
Normal file
12
node_modules/bare-url/global.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as url from '.'
|
||||
|
||||
type URLConstructor = typeof url.URL
|
||||
type URLSearchParamsConstructor = typeof url.URLSearchParams
|
||||
|
||||
declare global {
|
||||
type URL = url.URL
|
||||
type URLSearchParams = url.URLSearchParams
|
||||
|
||||
const URL: URLConstructor
|
||||
const URLSearchParams: URLSearchParamsConstructor
|
||||
}
|
||||
2
node_modules/bare-url/global.js
generated
vendored
Normal file
2
node_modules/bare-url/global.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
global.URL = require('.')
|
||||
global.URLSearchParams = require('./lib/url-search-params')
|
||||
39
node_modules/bare-url/index.d.ts
generated
vendored
Normal file
39
node_modules/bare-url/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import URLError from './lib/errors'
|
||||
import URLSearchParams from './lib/url-search-params'
|
||||
|
||||
interface URL {
|
||||
href: string
|
||||
protocol: string
|
||||
username: string
|
||||
password: string
|
||||
host: string
|
||||
hostname: string
|
||||
port: string
|
||||
pathname: string
|
||||
search: string
|
||||
searchParams: URLSearchParams
|
||||
hash: string
|
||||
|
||||
toString(): string
|
||||
toJSON(): string
|
||||
}
|
||||
|
||||
declare class URL {
|
||||
constructor(input: string, base?: string | URL)
|
||||
}
|
||||
|
||||
declare namespace URL {
|
||||
export function isURL(value: unknown): value is URL
|
||||
|
||||
export function parse(input: string, base?: string | URL): URL | null
|
||||
|
||||
export function canParse(input: string, base?: string | URL): boolean
|
||||
|
||||
export function fileURLToPath(url: URL | string): string
|
||||
|
||||
export function pathToFileURL(pathname: string): URL
|
||||
|
||||
export { URL, type URLError, URLError as errors, URLSearchParams }
|
||||
}
|
||||
|
||||
export = URL
|
||||
405
node_modules/bare-url/index.js
generated
vendored
Normal file
405
node_modules/bare-url/index.js
generated
vendored
Normal file
@@ -0,0 +1,405 @@
|
||||
const path = require('bare-path')
|
||||
const binding = require('./binding')
|
||||
const errors = require('./lib/errors')
|
||||
const URLSearchParams = require('./lib/url-search-params')
|
||||
|
||||
const kind = Symbol.for('bare.url.kind')
|
||||
|
||||
const isWindows = Bare.platform === 'win32'
|
||||
|
||||
module.exports = exports = class URL {
|
||||
static get [kind]() {
|
||||
return 0 // Compatibility version
|
||||
}
|
||||
|
||||
constructor(input, base, opts = {}) {
|
||||
if (arguments.length === 0) throw errors.INVALID_URL()
|
||||
|
||||
input = String(input)
|
||||
|
||||
if (base !== undefined) base = String(base)
|
||||
|
||||
this._components = new Uint32Array(8)
|
||||
|
||||
this._parse(input, base, opts.throw !== false)
|
||||
|
||||
if (this._href) this._params = new URLSearchParams(this.search, this)
|
||||
}
|
||||
|
||||
get [kind]() {
|
||||
return URL[kind]
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-href
|
||||
|
||||
get href() {
|
||||
return this._href
|
||||
}
|
||||
|
||||
set href(value) {
|
||||
this._update(value)
|
||||
|
||||
this._params._parse(this.search)
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-protocol
|
||||
|
||||
get protocol() {
|
||||
return this._slice(0, this._components[0]) + ':'
|
||||
}
|
||||
|
||||
set protocol(value) {
|
||||
this._update(this._replace(value.replace(/:+$/, ''), 0, this._components[0]))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-username
|
||||
|
||||
get username() {
|
||||
return this._slice(this._components[0] + 3 /* :// */, this._components[1])
|
||||
}
|
||||
|
||||
set username(value) {
|
||||
if (cannotHaveCredentialsOrPort(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.username === '') value += '@'
|
||||
|
||||
this._update(this._replace(value, this._components[0] + 3 /* :// */, this._components[1]))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-password
|
||||
|
||||
get password() {
|
||||
return this._href.slice(this._components[1] + 1 /* : */, this._components[2] - 1 /* @ */)
|
||||
}
|
||||
|
||||
set password(value) {
|
||||
if (cannotHaveCredentialsOrPort(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
let start = this._components[1] + 1 /* : */
|
||||
let end = this._components[2] - 1 /* @ */
|
||||
|
||||
if (this.password === '') {
|
||||
value = ':' + value
|
||||
start--
|
||||
}
|
||||
|
||||
if (this.username === '') {
|
||||
value += '@'
|
||||
end++
|
||||
}
|
||||
|
||||
this._update(this._replace(value, start, end))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-host
|
||||
|
||||
get host() {
|
||||
return this._slice(this._components[2], this._components[5])
|
||||
}
|
||||
|
||||
set host(value) {
|
||||
if (hasOpaquePath(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
this._update(
|
||||
this._replace(value, this._components[2], this._components[value.includes(':') ? 5 : 3])
|
||||
)
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-hostname
|
||||
|
||||
get hostname() {
|
||||
return this._slice(this._components[2], this._components[3])
|
||||
}
|
||||
|
||||
set hostname(value) {
|
||||
if (hasOpaquePath(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
this._update(this._replace(value, this._components[2], this._components[3]))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-port
|
||||
|
||||
get port() {
|
||||
return this._slice(this._components[3] + 1 /* : */, this._components[5])
|
||||
}
|
||||
|
||||
set port(value) {
|
||||
if (cannotHaveCredentialsOrPort(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
let start = this._components[3] + 1 /* : */
|
||||
|
||||
if (this.port === '') {
|
||||
value = ':' + value
|
||||
start--
|
||||
}
|
||||
|
||||
this._update(this._replace(value, start, this._components[5]))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-pathname
|
||||
|
||||
get pathname() {
|
||||
return this._slice(this._components[5], this._components[6] - 1 /* ? */)
|
||||
}
|
||||
|
||||
set pathname(value) {
|
||||
if (hasOpaquePath(this)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (value[0] !== '/' && value[0] !== '\\') {
|
||||
value = '/' + value
|
||||
}
|
||||
|
||||
this._update(this._replace(value, this._components[5], this._components[6] - 1 /* ? */))
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-search
|
||||
|
||||
get search() {
|
||||
return this._slice(this._components[6] - 1 /* ? */, this._components[7] - 1 /* # */)
|
||||
}
|
||||
|
||||
set search(value) {
|
||||
if (value && value[0] !== '?') value = '?' + value
|
||||
|
||||
this._update(
|
||||
this._replace(value, this._components[6] - 1 /* ? */, this._components[7] - 1 /* # */)
|
||||
)
|
||||
|
||||
this._params._parse(this.search)
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-searchparams
|
||||
|
||||
get searchParams() {
|
||||
return this._params
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-hash
|
||||
|
||||
get hash() {
|
||||
return this._slice(this._components[7] - 1 /* # */)
|
||||
}
|
||||
|
||||
set hash(value) {
|
||||
if (value && value[0] !== '#') value = '#' + value
|
||||
|
||||
this._update(this._replace(value, this._components[7] - 1 /* # */))
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this._href
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this._href
|
||||
}
|
||||
|
||||
[Symbol.for('bare.inspect')]() {
|
||||
return {
|
||||
__proto__: { constructor: URL },
|
||||
|
||||
href: this.href,
|
||||
protocol: this.protocol,
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
host: this.host,
|
||||
hostname: this.hostname,
|
||||
port: this.port,
|
||||
pathname: this.pathname,
|
||||
search: this.search,
|
||||
searchParams: this.searchParams,
|
||||
hash: this.hash
|
||||
}
|
||||
}
|
||||
|
||||
_slice(start, end = this._href.length) {
|
||||
return this._href.slice(start, end)
|
||||
}
|
||||
|
||||
_replace(replacement, start, end = this._href.length) {
|
||||
return this._slice(0, start) + replacement + this._slice(end)
|
||||
}
|
||||
|
||||
_parse(input, base, shouldThrow) {
|
||||
try {
|
||||
this._href = binding.parse(
|
||||
String(input),
|
||||
base ? String(base) : null,
|
||||
this._components,
|
||||
shouldThrow
|
||||
)
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError) throw err
|
||||
|
||||
throw errors.INVALID_URL(`Invalid URL '${input}'`, input)
|
||||
}
|
||||
}
|
||||
|
||||
_update(input) {
|
||||
try {
|
||||
this._parse(input, null, true)
|
||||
} catch (err) {
|
||||
if (err instanceof TypeError) throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#url-opaque-path
|
||||
function hasOpaquePath(url) {
|
||||
return url.pathname[0] !== '/'
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#cannot-have-a-username-password-port
|
||||
function cannotHaveCredentialsOrPort(url) {
|
||||
return url.hostname === '' || url.protocol === 'file:'
|
||||
}
|
||||
|
||||
const URL = exports
|
||||
|
||||
exports.URL = URL
|
||||
exports.URLSearchParams = URLSearchParams
|
||||
|
||||
exports.errors = errors
|
||||
|
||||
exports.isURL = function isURL(value) {
|
||||
if (value instanceof URL) return true
|
||||
|
||||
return typeof value === 'object' && value !== null && value[kind] === URL[kind]
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-parse
|
||||
exports.parse = function parse(input, base) {
|
||||
const url = new URL(input, base, { throw: false })
|
||||
return url._href ? url : null
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-url-canparse
|
||||
exports.canParse = function canParse(input, base) {
|
||||
return binding.canParse(String(input), base ? String(base) : null)
|
||||
}
|
||||
|
||||
exports.fileURLToPath = function fileURLToPath(url) {
|
||||
if (typeof url === 'string') {
|
||||
url = new URL(url)
|
||||
}
|
||||
|
||||
if (url.protocol !== 'file:') {
|
||||
throw errors.INVALID_URL_SCHEME('The URL must use the file: protocol')
|
||||
}
|
||||
|
||||
if (isWindows) {
|
||||
if (/%2f|%5c/i.test(url.pathname)) {
|
||||
throw errors.INVALID_FILE_URL_PATH(
|
||||
'The file: URL path must not include encoded \\ or / characters'
|
||||
)
|
||||
}
|
||||
} else {
|
||||
if (url.hostname) {
|
||||
throw errors.INVALID_FILE_URL_HOST("The file: URL host must be 'localhost' or empty")
|
||||
}
|
||||
|
||||
if (/%2f/i.test(url.pathname)) {
|
||||
throw errors.INVALID_FILE_URL_PATH('The file: URL path must not include encoded / characters')
|
||||
}
|
||||
}
|
||||
|
||||
const pathname = path.normalize(decodeURIComponent(url.pathname))
|
||||
|
||||
if (isWindows) {
|
||||
if (url.hostname) return '\\\\' + url.hostname + pathname
|
||||
|
||||
const letter = pathname.charCodeAt(1) | 0x20
|
||||
|
||||
if (letter < 0x61 /* a */ || letter > 0x7a /* z */ || pathname.charCodeAt(2) !== 0x3a /* : */) {
|
||||
throw errors.INVALID_FILE_URL_PATH('The file: URL path must be absolute')
|
||||
}
|
||||
|
||||
return pathname.slice(1)
|
||||
}
|
||||
|
||||
return pathname
|
||||
}
|
||||
|
||||
exports.pathToFileURL = function pathToFileURL(pathname) {
|
||||
let resolved = path.resolve(pathname)
|
||||
|
||||
if (pathname[pathname.length - 1] === '/') {
|
||||
resolved += '/'
|
||||
} else if (isWindows && pathname[pathname.length - 1] === '\\') {
|
||||
resolved += '\\'
|
||||
}
|
||||
|
||||
resolved = resolved
|
||||
.replaceAll('%', '%25') // Must be first
|
||||
.replaceAll('#', '%23')
|
||||
.replaceAll('?', '%3f')
|
||||
.replaceAll('\n', '%0a')
|
||||
.replaceAll('\r', '%0d')
|
||||
.replaceAll('\t', '%09')
|
||||
|
||||
if (!isWindows) {
|
||||
resolved = resolved.replaceAll('\\', '%5c')
|
||||
}
|
||||
|
||||
return new URL('file:' + resolved)
|
||||
}
|
||||
|
||||
exports.format = function format(parts) {
|
||||
const { protocol, auth, host, hostname, port, pathname, search, query, hash, slashes } = parts
|
||||
|
||||
let result = ''
|
||||
|
||||
if (typeof protocol === 'string') {
|
||||
result += protocol
|
||||
|
||||
if (protocol[protocol.length - 1] !== ':') {
|
||||
result += ':'
|
||||
}
|
||||
|
||||
if (slashes === true || /https?|ftp|gopher|file/.test(protocol)) {
|
||||
result += '//'
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof auth === 'string') {
|
||||
if (host || hostname) result += auth + '@'
|
||||
}
|
||||
|
||||
if (typeof host === 'string') result += host
|
||||
else {
|
||||
result += hostname
|
||||
|
||||
if (port) result += ':' + port
|
||||
}
|
||||
|
||||
if (typeof pathname === 'string' && pathname !== '') {
|
||||
if (pathname[0] !== '/') result += '/'
|
||||
result += pathname
|
||||
}
|
||||
|
||||
if (typeof search === 'string') {
|
||||
if (search[0] !== '?') result += '?'
|
||||
result += search
|
||||
} else if (typeof query === 'object' && query !== null) {
|
||||
result += '?' + new URLSearchParams(query)
|
||||
}
|
||||
|
||||
if (typeof hash === 'string') {
|
||||
if (hash[0] !== '#') result += '#'
|
||||
result += hash
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
10
node_modules/bare-url/lib/errors.d.ts
generated
vendored
Normal file
10
node_modules/bare-url/lib/errors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
interface URLError extends Error {
|
||||
readonly code: string
|
||||
readonly input?: string
|
||||
}
|
||||
|
||||
declare class URLError extends Error {
|
||||
private constructor()
|
||||
}
|
||||
|
||||
export = URLError
|
||||
33
node_modules/bare-url/lib/errors.js
generated
vendored
Normal file
33
node_modules/bare-url/lib/errors.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
module.exports = class URLError extends Error {
|
||||
constructor(msg, fn = URLError, code = fn.name) {
|
||||
super(`${code}: ${msg}`)
|
||||
|
||||
this.code = code
|
||||
|
||||
if (Error.captureStackTrace) Error.captureStackTrace(this, fn)
|
||||
}
|
||||
|
||||
get name() {
|
||||
return 'URLError'
|
||||
}
|
||||
|
||||
static INVALID_URL(msg, input) {
|
||||
const err = new URLError(msg, URLError.INVALID_URL)
|
||||
|
||||
err.input = input
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
static INVALID_URL_SCHEME(msg = 'Invalid URL') {
|
||||
return new URLError(msg, URLError.INVALID_URL_SCHEME)
|
||||
}
|
||||
|
||||
static INVALID_FILE_URL_HOST(msg = 'Invalid file: URL host') {
|
||||
return new URLError(msg, URLError.INVALID_FILE_URL_HOST)
|
||||
}
|
||||
|
||||
static INVALID_FILE_URL_PATH(msg = 'Invalid file: URL path') {
|
||||
return new URLError(msg, URLError.INVALID_FILE_URL_PATH)
|
||||
}
|
||||
}
|
||||
19
node_modules/bare-url/lib/url-search-params.d.ts
generated
vendored
Normal file
19
node_modules/bare-url/lib/url-search-params.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
interface URLSearchParams extends Iterable<[name: string, value: string]> {
|
||||
readonly size: number
|
||||
|
||||
append(name: string, value: string): void
|
||||
delete(name: string, value?: string): void
|
||||
get(name: string): string | undefined
|
||||
getAll(name: string): string[]
|
||||
has(name: string, value?: string): boolean
|
||||
set(name: string, value: string): void
|
||||
|
||||
toString(): string
|
||||
toJSON(): string
|
||||
}
|
||||
|
||||
declare class URLSearchParams {
|
||||
constructor(init: string | Record<string, string> | Iterable<[string, string]>)
|
||||
}
|
||||
|
||||
export = URLSearchParams
|
||||
174
node_modules/bare-url/lib/url-search-params.js
generated
vendored
Normal file
174
node_modules/bare-url/lib/url-search-params.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
module.exports = class URLSearchParams {
|
||||
static _urls = new WeakMap()
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams
|
||||
constructor(init, url = null) {
|
||||
this._params = new Map()
|
||||
|
||||
if (url) URLSearchParams._urls.set(this, url)
|
||||
|
||||
if (typeof init === 'string') {
|
||||
this._parse(init)
|
||||
} else if (init) {
|
||||
for (const [name, value] of typeof init[Symbol.iterator] === 'function'
|
||||
? init
|
||||
: Object.entries(init)) {
|
||||
this.append(name, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-size
|
||||
get size() {
|
||||
return this._params.length
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
|
||||
append(name, value = null) {
|
||||
if (value === null) return
|
||||
|
||||
let list = this._params.get(name)
|
||||
|
||||
if (list === undefined) {
|
||||
list = []
|
||||
this._params.set(name, list)
|
||||
}
|
||||
|
||||
list.push(value)
|
||||
|
||||
this._update()
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-delete
|
||||
delete(name, value = null) {
|
||||
if (value === null) this._params.delete(name)
|
||||
else {
|
||||
let list = this._params.get(name)
|
||||
|
||||
if (list === undefined) return
|
||||
|
||||
list = list.filter((found) => found !== value)
|
||||
|
||||
if (list.length === 0) this._params.delete(name)
|
||||
else this._params.set(name, list)
|
||||
}
|
||||
|
||||
this._update()
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
|
||||
get(name) {
|
||||
const list = this._params.get(name)
|
||||
|
||||
if (list === undefined) return null
|
||||
|
||||
return list[0]
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
||||
getAll(name) {
|
||||
const list = this._params.get(name)
|
||||
|
||||
if (list === undefined) return []
|
||||
|
||||
return Array.from(list)
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-has
|
||||
has(name, value = null) {
|
||||
const list = this._params.get(name)
|
||||
|
||||
if (list === undefined) return false
|
||||
|
||||
if (value === null) return true
|
||||
|
||||
return list.includes(value)
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
|
||||
set(name, value = null) {
|
||||
if (value === null) this._params.delete(name)
|
||||
else this._params.set(name, [value])
|
||||
|
||||
this._update()
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this._serialize()
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return [...this]
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
for (const [name, values] of this._params) {
|
||||
for (const value of values) yield [name, value]
|
||||
}
|
||||
}
|
||||
|
||||
[Symbol.for('bare.inspect')]() {
|
||||
const object = {
|
||||
__proto__: { constructor: URLSearchParams }
|
||||
}
|
||||
|
||||
for (const [name, values] of this._params) {
|
||||
if (values.length === 1) object[name] = values[0]
|
||||
else object[name] = values
|
||||
}
|
||||
|
||||
return object
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlsearchparams-update
|
||||
_update() {
|
||||
const url = URLSearchParams._urls.get(this)
|
||||
|
||||
if (url === undefined) return
|
||||
|
||||
url.search = this._serialize()
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlencoded-parser
|
||||
_parse(input) {
|
||||
if (input[0] === '?') input = input.substring(1)
|
||||
|
||||
this._params = new Map()
|
||||
|
||||
for (const sequence of input.split('&')) {
|
||||
if (sequence.length === 0) continue
|
||||
|
||||
let i = sequence.indexOf('=')
|
||||
if (i === -1) i = sequence.length
|
||||
|
||||
const name = decodeURIComponent(sequence.substring(0, i))
|
||||
const value = decodeURIComponent(sequence.substring(i + 1, sequence.length))
|
||||
|
||||
let list = this._params.get(name)
|
||||
|
||||
if (list === undefined) {
|
||||
list = []
|
||||
this._params.set(name, list)
|
||||
}
|
||||
|
||||
list.push(value)
|
||||
}
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#concept-urlencoded-serializer
|
||||
_serialize() {
|
||||
let output = ''
|
||||
|
||||
for (let [name, values] of this._params) {
|
||||
name = encodeURIComponent(name)
|
||||
|
||||
for (const value of values) {
|
||||
if (output) output += '&'
|
||||
|
||||
output += name + '=' + encodeURIComponent(value)
|
||||
}
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
}
|
||||
51
node_modules/bare-url/package.json
generated
vendored
Normal file
51
node_modules/bare-url/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "bare-url",
|
||||
"version": "2.3.2",
|
||||
"description": "WHATWG URL implementation for JavaScript",
|
||||
"exports": {
|
||||
"./package": "./package.json",
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./global": {
|
||||
"types": "./global.d.ts",
|
||||
"default": "./global.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"global.js",
|
||||
"global.d.ts",
|
||||
"binding.c",
|
||||
"binding.js",
|
||||
"CMakeLists.txt",
|
||||
"lib",
|
||||
"prebuilds"
|
||||
],
|
||||
"addon": true,
|
||||
"scripts": {
|
||||
"test": "prettier . --check && bare test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/holepunchto/bare-url.git"
|
||||
},
|
||||
"author": "Holepunch",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/holepunchto/bare-url/issues"
|
||||
},
|
||||
"homepage": "https://github.com/holepunchto/bare-url",
|
||||
"dependencies": {
|
||||
"bare-path": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"brittle": "^3.3.2",
|
||||
"cmake-bare": "^1.1.6",
|
||||
"cmake-fetch": "^1.0.0",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier-config-holepunch": "^2.0.0"
|
||||
}
|
||||
}
|
||||
BIN
node_modules/bare-url/prebuilds/android-arm/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/android-arm/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/android-arm64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/android-arm64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/android-ia32/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/android-ia32/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/android-x64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/android-x64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/linux-x64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/linux-x64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/bare-url/prebuilds/win32-x64/bare-url.bare
generated
vendored
Normal file
BIN
node_modules/bare-url/prebuilds/win32-x64/bare-url.bare
generated
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user