cf-workers-native 0.1.4 → 0.1.5
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/dist/browser/documents/page-source.js +1 -1
- package/dist/browser/fetch/host-call.js +6 -1
- package/dist/browser/fetch/native-network.d.ts +1 -1
- package/dist/browser/fetch/relay.js +2 -0
- package/dist/browser/isolated/transport.js +3 -2
- package/dist/browser/request/index.js +3 -2
- package/dist/cloudflare/workers/worker-runtime.js +2 -1
- package/dist/compat/console/index.d.ts +35 -0
- package/dist/compat/console/index.js +92 -0
- package/dist/compat/crypto/LICENSE-3RD-PARTY.md +19 -0
- package/dist/compat/crypto/LICENSE-APACHE +177 -0
- package/dist/compat/crypto/LICENSE.emscripten +102 -0
- package/dist/compat/crypto/LICENSE.musl +193 -0
- package/dist/compat/crypto/LICENSE.openssl +177 -0
- package/dist/compat/crypto/asymmetric.d.ts +13 -0
- package/dist/compat/crypto/asymmetric.js +239 -0
- package/dist/compat/crypto/brorand.cjs +74 -0
- package/dist/compat/crypto/brorand.d.cts +6 -0
- package/dist/compat/crypto/certificate.d.ts +14 -0
- package/dist/compat/crypto/certificate.js +66 -0
- package/dist/compat/crypto/ecdh.d.ts +15 -0
- package/dist/compat/crypto/ecdh.js +109 -0
- package/dist/compat/crypto/hkdf.d.ts +2 -0
- package/dist/compat/crypto/hkdf.js +52 -0
- package/dist/compat/crypto/index.cjs +2 -0
- package/dist/compat/crypto/index.d.cts +2 -0
- package/dist/compat/crypto/index.d.ts +30 -0
- package/dist/compat/crypto/index.js +83 -0
- package/dist/compat/crypto/key-formats.d.ts +6 -0
- package/dist/compat/crypto/key-formats.js +120 -0
- package/dist/compat/crypto/key-state.d.ts +9 -0
- package/dist/compat/crypto/key-state.js +4 -0
- package/dist/compat/crypto/keys.d.ts +50 -0
- package/dist/compat/crypto/keys.js +209 -0
- package/dist/compat/crypto/metadata.d.ts +4 -0
- package/dist/compat/crypto/metadata.js +22 -0
- package/dist/compat/crypto/native-crypto.d.ts +68 -0
- package/dist/compat/crypto/native-crypto.js +569 -0
- package/dist/compat/crypto/prime.d.ts +19 -0
- package/dist/compat/crypto/prime.js +146 -0
- package/dist/compat/crypto/random.d.ts +7 -0
- package/dist/compat/crypto/random.js +123 -0
- package/dist/compat/crypto/rsa.d.ts +5 -0
- package/dist/compat/crypto/rsa.js +173 -0
- package/dist/compat/crypto/scrypt.d.ts +25 -0
- package/dist/compat/crypto/scrypt.js +150 -0
- package/dist/compat/crypto/sign-errors.d.ts +8 -0
- package/dist/compat/crypto/sign-errors.js +13 -0
- package/dist/compat/crypto/sign-handle.d.ts +22 -0
- package/dist/compat/crypto/sign-handle.js +105 -0
- package/dist/compat/crypto/signatures.d.ts +28 -0
- package/dist/compat/crypto/signatures.js +252 -0
- package/dist/compat/crypto/symmetric.d.ts +29 -0
- package/dist/compat/crypto/symmetric.js +104 -0
- package/dist/compat/crypto/validation.d.ts +3 -0
- package/dist/compat/crypto/validation.js +19 -0
- package/dist/compat/crypto/x509.d.ts +30 -0
- package/dist/compat/crypto/x509.js +406 -0
- package/dist/compat/events/errors.d.ts +8 -0
- package/dist/compat/events/errors.js +39 -0
- package/dist/compat/events/index.cjs +2 -0
- package/dist/compat/events/index.d.cts +2 -0
- package/dist/compat/events/index.d.ts +64 -0
- package/dist/compat/events/index.js +792 -0
- package/dist/compat/events/intrinsics.d.ts +1 -0
- package/dist/compat/events/intrinsics.js +2 -0
- package/dist/compat/fs/embedded.d.ts +85 -0
- package/dist/compat/fs/embedded.js +255 -0
- package/dist/compat/fs/index.d.ts +7 -84
- package/dist/compat/fs/index.js +218 -252
- package/dist/compat/fs/mode.d.ts +1 -0
- package/dist/compat/fs/mode.js +13 -0
- package/dist/compat/fs/promises/index.d.ts +1 -1
- package/dist/compat/fs/promises/index.js +1 -1
- package/dist/compat/fs/writable.d.ts +6 -0
- package/dist/compat/fs/writable.js +142 -0
- package/dist/compat/http/symbols.d.ts +5 -0
- package/dist/compat/http/symbols.js +9 -0
- package/dist/compat/http-common/index.d.ts +37 -0
- package/dist/compat/http-common/index.js +43 -0
- package/dist/compat/http-outgoing/index.d.ts +13 -0
- package/dist/compat/http-outgoing/index.js +32 -0
- package/dist/compat/http-server/index.d.ts +18 -0
- package/dist/compat/http-server/index.js +107 -0
- package/dist/compat/module/builtins.d.ts +1 -0
- package/dist/compat/module/builtins.js +101 -0
- package/dist/compat/module/index.d.ts +4 -2
- package/dist/compat/module/index.js +22 -17
- package/dist/compat/module/metadata.d.ts +44 -0
- package/dist/compat/module/metadata.js +127 -0
- package/dist/compat/net/internal-net.js +4 -0
- package/dist/compat/net/sockets.d.ts +5 -0
- package/dist/compat/net/sockets.js +74 -13
- package/dist/compat/process/index.cjs +2 -0
- package/dist/compat/process/index.d.cts +4 -0
- package/dist/compat/process/index.d.ts +18 -0
- package/dist/compat/process/index.js +140 -0
- package/dist/compat/process/metadata.d.ts +135 -0
- package/dist/compat/process/metadata.js +251 -0
- package/dist/compat/process/state.d.ts +4 -0
- package/dist/compat/process/state.js +4 -0
- package/dist/compat/stream-web/LICENSE +22 -0
- package/dist/compat/stream-web/ponyfill.d.ts +1 -1
- package/dist/compat/stream-web/ponyfill.js +2369 -1775
- package/dist/compat/stream-web/runtime.d.ts +1 -1
- package/dist/compat/stream-web/runtime.js +3 -2
- package/dist/compat/stream-wrap/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/stream-wrap/LICENSE-APACHE +177 -0
- package/dist/compat/stream-wrap/index.d.ts +1 -0
- package/dist/compat/stream-wrap/index.js +1 -0
- package/dist/compat/tls/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls/LICENSE-APACHE +177 -0
- package/dist/compat/tls/constants.d.ts +7 -0
- package/dist/compat/tls/constants.js +14 -0
- package/dist/compat/tls/errors.d.ts +35 -0
- package/dist/compat/tls/errors.js +68 -0
- package/dist/compat/tls/helpers.d.ts +9 -0
- package/dist/compat/tls/helpers.js +207 -0
- package/dist/compat/tls/index.d.ts +26 -0
- package/dist/compat/tls/index.js +50 -0
- package/dist/compat/tls/jsstream.d.ts +19 -0
- package/dist/compat/tls/jsstream.js +186 -0
- package/dist/compat/tls/native-session.d.ts +3 -0
- package/dist/compat/tls/native-session.js +187 -0
- package/dist/compat/tls/wrap.d.ts +65 -0
- package/dist/compat/tls/wrap.js +544 -0
- package/dist/compat/tls-wrap/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls-wrap/LICENSE-APACHE +177 -0
- package/dist/compat/tls-wrap/index.d.ts +7 -0
- package/dist/compat/tls-wrap/index.js +3 -0
- package/dist/compat/util/index.js +43 -1
- package/dist/compat/util/types/index.d.ts +3 -0
- package/dist/compat/util/types/index.js +5 -0
- package/dist/compat/zlib/LICENSE.brotli +19 -0
- package/dist/compat/zlib/LICENSE.emscripten +102 -0
- package/dist/compat/zlib/LICENSE.musl +193 -0
- package/dist/compat/zlib/LICENSE.zstd +30 -0
- package/dist/compat/zlib/compression.d.ts +55 -0
- package/dist/compat/zlib/compression.js +259 -0
- package/dist/compat/zlib/constants.d.ts +172 -0
- package/dist/compat/zlib/constants.js +173 -0
- package/dist/compat/zlib/index.d.ts +180 -0
- package/dist/compat/zlib/index.js +177 -0
- package/dist/compat/zlib/native-codecs.d.ts +17 -0
- package/dist/compat/zlib/native-codecs.js +168 -0
- package/dist/shared/globals/inject.d.ts +2 -1
- package/dist/shared/globals/inject.js +2 -1
- package/dist/shared/globals/runtime.d.ts +1 -2
- package/dist/shared/globals/runtime.js +1 -2
- package/dist/shared/request-scope.d.ts +4 -0
- package/dist/shared/request-scope.js +11 -0
- package/dist/tooling/async.js +36 -14
- package/dist/tooling/shared.d.ts +1 -0
- package/dist/tooling/shared.js +20 -1
- package/dist/tooling/vite.js +4 -3
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkerSockets.java +56 -8
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersCapacitorPlugin.java +4 -2
- package/native/ios/NetworkBridge.swift +11 -1
- package/native/ios/SocketBridge.swift +37 -2
- package/native/ios/WorkersCapacitorPlugin.swift +4 -0
- package/package.json +3 -1
|
@@ -37,11 +37,16 @@ export function getHostCall() {
|
|
|
37
37
|
case "cookiesSet":
|
|
38
38
|
host.cookiesSet(id, String(args.url), JSON.stringify(args.cookies));
|
|
39
39
|
break;
|
|
40
|
+
case "socketStartTls":
|
|
41
|
+
host.socketStartTls(id, handle, String(args.servername ?? ""));
|
|
42
|
+
break;
|
|
40
43
|
case "socketWatch":
|
|
41
44
|
host.socketWatch(id, handle);
|
|
42
45
|
break;
|
|
43
46
|
case "socketOpen":
|
|
44
|
-
host.socketOpen(id, handle, String(args.host), Number(args.port), args.tls === true
|
|
47
|
+
host.socketOpen(id, handle, String(args.host), Number(args.port), args.tls === true, typeof args.servername === "string"
|
|
48
|
+
? args.servername
|
|
49
|
+
: String(args.host));
|
|
45
50
|
break;
|
|
46
51
|
case "socketWrite":
|
|
47
52
|
host.socketWrite(id, handle, String(args.chunk));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NativeNetwork } from "./transport.js";
|
|
2
|
-
export type NativeNetworkMethod = "cookiesGet" | "cookiesSet" | "socketWatch" | "socketOpen" | "socketWrite" | "socketEnd" | "socketRead" | "socketClose";
|
|
2
|
+
export type NativeNetworkMethod = "cookiesGet" | "cookiesSet" | "socketWatch" | "socketOpen" | "socketStartTls" | "socketVerifyTls" | "socketWrite" | "socketEnd" | "socketRead" | "socketClose";
|
|
3
3
|
/**
|
|
4
4
|
* Narrowly typed bridge call. The same shape can be relayed through a Capacitor
|
|
5
5
|
* bridge, a Dedicated Worker MessagePort, or the Android document-host
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runWithRequestScope } from "../../shared/request-scope.js";
|
|
1
2
|
import { setWorkerEnv } from "../../cloudflare/apis/cloudflare-workers/index.js";
|
|
2
3
|
import { isResponse } from "../fetch/interop.js";
|
|
3
4
|
import { Request as WorkerRequest } from "../request/index.js";
|
|
@@ -117,7 +118,7 @@ export function serve(worker) {
|
|
|
117
118
|
body,
|
|
118
119
|
signal: controller.signal,
|
|
119
120
|
});
|
|
120
|
-
const response = await worker.fetch(request, env, {
|
|
121
|
+
const response = await runWithRequestScope(() => worker.fetch(request, env, {
|
|
121
122
|
props: {},
|
|
122
123
|
passThroughOnException() {
|
|
123
124
|
throw new Error("passThroughOnException is unsupported for local execution.");
|
|
@@ -127,7 +128,7 @@ export function serve(worker) {
|
|
|
127
128
|
errors.push(String(cause));
|
|
128
129
|
}));
|
|
129
130
|
},
|
|
130
|
-
});
|
|
131
|
+
}));
|
|
131
132
|
if (!isResponse(response) || response.status === 0)
|
|
132
133
|
throw new TypeError("worker.fetch must return a non-error Response.");
|
|
133
134
|
if (response.bodyUsed || response.body?.locked)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readable } from "../../compat/stream-web/interop.js";
|
|
2
|
+
import { nativeStreams, platform } from "../../shared/globals/platform.js";
|
|
2
3
|
import { hasBody, inheritBodySource } from "../body/index.js";
|
|
3
4
|
import { Body, dictionary, webString, cloneValue, cloneBody, moveBody, } from "../body/index.js";
|
|
4
5
|
import { Headers } from "../headers/index.js";
|
|
@@ -104,7 +105,7 @@ export class Request extends Body {
|
|
|
104
105
|
throw new TypeError("Request with a GET or HEAD method cannot have a body.");
|
|
105
106
|
// Transfer only after all initializer validation succeeds.
|
|
106
107
|
if (nativeSource?.body)
|
|
107
|
-
body = new
|
|
108
|
+
body = readable(nativeSource.body.pipeThrough(new nativeStreams.TransformStream()));
|
|
108
109
|
else if (original && init.body === undefined)
|
|
109
110
|
body = moveBody(original);
|
|
110
111
|
super(body, headers);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runWithRequestScope } from "../../shared/request-scope.js";
|
|
1
2
|
import { installWebGlobals } from "../../shared/globals/web.js";
|
|
2
3
|
import { createOutboundFetch } from "../../browser/fetch/outbound.js";
|
|
3
4
|
import { browserFetch, isRequest } from "../../browser/fetch/interop.js";
|
|
@@ -39,7 +40,7 @@ export class DirectFetchRuntime extends FetchRuntime {
|
|
|
39
40
|
this.restoreWeb();
|
|
40
41
|
}
|
|
41
42
|
dispatch(request, env, ctx) {
|
|
42
|
-
return this.worker.fetch(request, env, ctx);
|
|
43
|
+
return runWithRequestScope(() => this.worker.fetch(request, env, ctx));
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
export class IsolatedFetchRuntime extends FetchRuntime {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ConsoleOptions } from "node:console";
|
|
2
|
+
declare const globalConsole: typeof globalThis.console & {
|
|
3
|
+
_times: Map<string, number>;
|
|
4
|
+
_ignoreErrors: boolean;
|
|
5
|
+
_stderrErrorHandler: () => void;
|
|
6
|
+
_stdoutErrorHandler: () => void;
|
|
7
|
+
_stderr: NodeJS.WritableStream;
|
|
8
|
+
_stdout: NodeJS.WritableStream;
|
|
9
|
+
};
|
|
10
|
+
export declare function Console(_options: ConsoleOptions): never;
|
|
11
|
+
export declare const log: (...data: any[]) => void;
|
|
12
|
+
export declare const info: (...data: any[]) => void;
|
|
13
|
+
export declare const debug: (...data: any[]) => void;
|
|
14
|
+
export declare const warn: (...data: any[]) => void;
|
|
15
|
+
export declare const error: (...data: any[]) => void;
|
|
16
|
+
export declare const dir: (item?: any, options?: any) => void;
|
|
17
|
+
export declare const time: (label?: string) => void;
|
|
18
|
+
export declare const timeEnd: (label?: string) => void;
|
|
19
|
+
export declare const timeLog: (label?: string, ...data: any[]) => void;
|
|
20
|
+
export declare const trace: (...data: any[]) => void;
|
|
21
|
+
export declare const assert: (condition?: boolean, ...data: any[]) => void;
|
|
22
|
+
export declare const clear: () => void;
|
|
23
|
+
export declare const count: (label?: string) => void;
|
|
24
|
+
export declare const countReset: (label?: string) => void;
|
|
25
|
+
export declare const group: (...data: any[]) => void;
|
|
26
|
+
export declare const groupEnd: () => void;
|
|
27
|
+
export declare const table: (tabularData?: any, properties?: string[]) => void;
|
|
28
|
+
export declare const dirxml: (...data: any[]) => void;
|
|
29
|
+
export declare const groupCollapsed: (...data: any[]) => void;
|
|
30
|
+
export declare const profile: (label?: string) => void;
|
|
31
|
+
export declare const profileEnd: (label?: string) => void;
|
|
32
|
+
export declare const timeStamp: (label?: string) => void;
|
|
33
|
+
export declare function context(): void;
|
|
34
|
+
export declare function createTask(): void;
|
|
35
|
+
export default globalConsole;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
2
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4
|
+
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
6
|
+
class ERR_METHOD_NOT_IMPLEMENTED extends Error {
|
|
7
|
+
code = "ERR_METHOD_NOT_IMPLEMENTED";
|
|
8
|
+
constructor(method) {
|
|
9
|
+
super(`The ${method} method is not implemented`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
import processImpl from "node:process";
|
|
13
|
+
const noop = () => { };
|
|
14
|
+
// TODO(soon): This class is Node.js compatible but globalThis.console is not.
|
|
15
|
+
// This is because globalThis.console is provided by the v8 runtime.
|
|
16
|
+
// We need to find a way to patch and add createTask and context methods whenever
|
|
17
|
+
// `enable_nodejs_console_module` flag is enabled.
|
|
18
|
+
const globalConsole = globalThis.console;
|
|
19
|
+
globalConsole._times = new Map();
|
|
20
|
+
globalConsole._ignoreErrors = true;
|
|
21
|
+
globalConsole._stderrErrorHandler = noop;
|
|
22
|
+
globalConsole._stdoutErrorHandler = noop;
|
|
23
|
+
// We have this assertion because node-internal:public_process has undefined as the type
|
|
24
|
+
globalConsole._stderr = processImpl.stderr;
|
|
25
|
+
globalConsole._stdout = processImpl.stdout;
|
|
26
|
+
export function Console(_options) {
|
|
27
|
+
throw new ERR_METHOD_NOT_IMPLEMENTED("Console");
|
|
28
|
+
}
|
|
29
|
+
// We want to make sure the following works:
|
|
30
|
+
// ```js
|
|
31
|
+
// import mod from 'node:console`;
|
|
32
|
+
// new mod.Console(...)
|
|
33
|
+
// ```
|
|
34
|
+
// @ts-expect-error TS2322 This is intentional.
|
|
35
|
+
globalConsole.Console = Console;
|
|
36
|
+
export const log = console.log.bind(console);
|
|
37
|
+
Console.prototype.log = log;
|
|
38
|
+
export const info = console.info.bind(console);
|
|
39
|
+
Console.prototype.info = info;
|
|
40
|
+
export const debug = console.debug.bind(console);
|
|
41
|
+
Console.prototype.debug = debug;
|
|
42
|
+
export const warn = console.warn.bind(console);
|
|
43
|
+
Console.prototype.warn = warn;
|
|
44
|
+
export const error = console.error.bind(console);
|
|
45
|
+
Console.prototype.error = error;
|
|
46
|
+
export const dir = console.dir.bind(console);
|
|
47
|
+
Console.prototype.dir = dir;
|
|
48
|
+
export const time = console.time.bind(console);
|
|
49
|
+
Console.prototype.time = time;
|
|
50
|
+
export const timeEnd = console.timeEnd.bind(console);
|
|
51
|
+
Console.prototype.timeEnd = timeEnd;
|
|
52
|
+
export const timeLog = console.timeLog.bind(console);
|
|
53
|
+
Console.prototype.timeLog = timeLog;
|
|
54
|
+
export const trace = console.trace.bind(console);
|
|
55
|
+
Console.prototype.trace = trace;
|
|
56
|
+
export const assert = console.assert.bind(console);
|
|
57
|
+
Console.prototype.assert = assert;
|
|
58
|
+
export const clear = console.clear.bind(console);
|
|
59
|
+
Console.prototype.clear = clear;
|
|
60
|
+
export const count = console.count.bind(console);
|
|
61
|
+
Console.prototype.count = count;
|
|
62
|
+
export const countReset = console.countReset.bind(console);
|
|
63
|
+
Console.prototype.countReset = countReset;
|
|
64
|
+
export const group = console.group.bind(console);
|
|
65
|
+
Console.prototype.group = group;
|
|
66
|
+
export const groupEnd = console.groupEnd.bind(console);
|
|
67
|
+
Console.prototype.groupEnd = groupEnd;
|
|
68
|
+
export const table = console.table.bind(console);
|
|
69
|
+
Console.prototype.table = table;
|
|
70
|
+
export const dirxml = console.dirxml.bind(console);
|
|
71
|
+
Console.prototype.dirxml = dirxml;
|
|
72
|
+
export const groupCollapsed = console.groupCollapsed.bind(console);
|
|
73
|
+
Console.prototype.groupCollapsed = groupCollapsed;
|
|
74
|
+
export const profile = console.profile.bind(console);
|
|
75
|
+
Console.prototype.profile = profile;
|
|
76
|
+
export const profileEnd = console.profileEnd.bind(console);
|
|
77
|
+
Console.prototype.profileEnd = profileEnd;
|
|
78
|
+
export const timeStamp = console.timeStamp.bind(console);
|
|
79
|
+
Console.prototype.timeStamp = timeStamp;
|
|
80
|
+
export function context() {
|
|
81
|
+
throw new ERR_METHOD_NOT_IMPLEMENTED("Console.context");
|
|
82
|
+
}
|
|
83
|
+
// @ts-expect-error TS2339 This is intentional.
|
|
84
|
+
globalConsole.context = context;
|
|
85
|
+
Console.prototype.context = context;
|
|
86
|
+
export function createTask() {
|
|
87
|
+
throw new ERR_METHOD_NOT_IMPLEMENTED("Console.createTask");
|
|
88
|
+
}
|
|
89
|
+
// @ts-expect-error TS2339 This is intentional.
|
|
90
|
+
globalConsole.createTask = createTask;
|
|
91
|
+
Console.prototype.createTask = createTask;
|
|
92
|
+
export default globalConsole;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Upstream notices
|
|
2
|
+
|
|
3
|
+
The net facade, internal implementation, logical port table, error classes and
|
|
4
|
+
validators are adapted from Cloudflare workerd tag `v1.20261012.1`:
|
|
5
|
+
|
|
6
|
+
- `src/node/net.ts`
|
|
7
|
+
- `src/node/internal/internal_net.ts`
|
|
8
|
+
- `src/node/internal/internal_errors.ts` (required declarations only)
|
|
9
|
+
- `src/node/internal/validators.ts` (required declarations only)
|
|
10
|
+
- `src/cloudflare/internal/http.ts`
|
|
11
|
+
|
|
12
|
+
Copyright Cloudflare, Inc.; Apache License 2.0. Node.js/Joyent and Deno MIT
|
|
13
|
+
notices are retained in the corresponding source files. Host transport and
|
|
14
|
+
module imports are adapted for Capacitor. Public exports remain those of the
|
|
15
|
+
pinned workerd module; internal helpers are not added to the public facade.
|
|
16
|
+
|
|
17
|
+
X509 certificate wrappers and safe name rendering are adapted from
|
|
18
|
+
`src/node/internal/crypto_x509.ts` and `src/workerd/api/crypto/x509.c++` at
|
|
19
|
+
workerd commit `5358e3d337336eaf696a48bc1563d808b10feba5` (Apache-2.0).
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Emscripten is available under 2 licenses, the MIT license and the
|
|
2
|
+
University of Illinois/NCSA Open Source License.
|
|
3
|
+
|
|
4
|
+
Both are permissive open source licenses, with little if any
|
|
5
|
+
practical difference between them.
|
|
6
|
+
|
|
7
|
+
The reason for offering both is that (1) the MIT license is
|
|
8
|
+
well-known, while (2) the University of Illinois/NCSA Open Source
|
|
9
|
+
License allows Emscripten's code to be integrated upstream into
|
|
10
|
+
LLVM, which uses that license, should the opportunity arise.
|
|
11
|
+
|
|
12
|
+
The full text of both licenses follows.
|
|
13
|
+
|
|
14
|
+
==============================================================================
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in
|
|
26
|
+
all copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
34
|
+
THE SOFTWARE.
|
|
35
|
+
|
|
36
|
+
==============================================================================
|
|
37
|
+
|
|
38
|
+
Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
|
|
39
|
+
All rights reserved.
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
42
|
+
copy of this software and associated documentation files (the
|
|
43
|
+
"Software"), to deal with the Software without restriction, including
|
|
44
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
45
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
46
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
47
|
+
the following conditions:
|
|
48
|
+
|
|
49
|
+
Redistributions of source code must retain the above copyright
|
|
50
|
+
notice, this list of conditions and the following disclaimers.
|
|
51
|
+
|
|
52
|
+
Redistributions in binary form must reproduce the above
|
|
53
|
+
copyright notice, this list of conditions and the following disclaimers
|
|
54
|
+
in the documentation and/or other materials provided with the
|
|
55
|
+
distribution.
|
|
56
|
+
|
|
57
|
+
Neither the names of Mozilla,
|
|
58
|
+
nor the names of its contributors may be used to endorse
|
|
59
|
+
or promote products derived from this Software without specific prior
|
|
60
|
+
written permission.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
63
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
64
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
65
|
+
IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
66
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
67
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
68
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
|
|
69
|
+
|
|
70
|
+
==============================================================================
|
|
71
|
+
|
|
72
|
+
This program uses portions of Node.js source code located in src/library_path.js,
|
|
73
|
+
in accordance with the terms of the MIT license. Node's license follows:
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
77
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
78
|
+
of this software and associated documentation files (the "Software"), to
|
|
79
|
+
deal in the Software without restriction, including without limitation the
|
|
80
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
81
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
82
|
+
furnished to do so, subject to the following conditions:
|
|
83
|
+
|
|
84
|
+
The above copyright notice and this permission notice shall be included in
|
|
85
|
+
all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
88
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
89
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
90
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
91
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
93
|
+
IN THE SOFTWARE.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
The musl libc project is bundled in this repo, and it has the MIT license, see
|
|
97
|
+
system/lib/libc/musl/COPYRIGHT
|
|
98
|
+
|
|
99
|
+
The third_party/ subdirectory contains code with other licenses. None of it is
|
|
100
|
+
used by default, but certain options use it (e.g., the optional closure compiler
|
|
101
|
+
flag will run closure compiler from third_party/).
|
|
102
|
+
|