@netlify/plugin-nextjs 4.40.0 → 4.40.2
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/lib/helpers/edge.js +4 -2
- package/lib/templates/getHandler.js +1 -2
- package/lib/templates/handlerUtils.js +14 -1
- package/lib/templates/server.js +9 -8
- package/lib/templates/vendor.js +20 -0
- package/package.json +7 -4
- package/src/templates/edge/next-dev.js +3 -3
- package/src/templates/edge/shims.js +6 -6
- package/src/templates/edge-shared/next-utils.ts +3 -3
- package/src/templates/edge-shared/utils.ts +1 -1
- package/src/templates/vendor/deno.land/std@0.134.0/fmt/colors.ts +536 -0
- package/src/templates/vendor/deno.land/std@0.134.0/testing/_diff.ts +360 -0
- package/src/templates/vendor/deno.land/std@0.134.0/testing/asserts.ts +866 -0
- package/src/templates/vendor/deno.land/std@0.175.0/_util/asserts.ts +25 -0
- package/src/templates/vendor/deno.land/std@0.175.0/_util/os.ts +23 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/abortable.ts +149 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/deadline.ts +30 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/debounce.ts +79 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/deferred.ts +48 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/delay.ts +67 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/mod.ts +18 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/mux_async_iterator.ts +97 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/pool.ts +95 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/retry.ts +81 -0
- package/src/templates/vendor/deno.land/std@0.175.0/async/tee.ts +100 -0
- package/src/templates/vendor/deno.land/std@0.175.0/bytes/index_of_needle.ts +49 -0
- package/src/templates/vendor/deno.land/std@0.175.0/crypto/timing_safe_equal.ts +29 -0
- package/src/templates/vendor/deno.land/std@0.175.0/datetime/to_imf.ts +45 -0
- package/src/templates/vendor/deno.land/std@0.175.0/encoding/base64.ts +144 -0
- package/src/templates/vendor/deno.land/std@0.175.0/encoding/base64url.ts +70 -0
- package/src/templates/vendor/deno.land/std@0.175.0/flags/mod.ts +785 -0
- package/src/templates/vendor/deno.land/std@0.175.0/fmt/colors.ts +569 -0
- package/src/templates/vendor/deno.land/std@0.175.0/fmt/printf.ts +939 -0
- package/src/templates/vendor/deno.land/std@0.175.0/http/cookie.ts +403 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_core.ts +77 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_events.d.ts +848 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_events.mjs +1033 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_global.d.ts +66 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_next_tick.ts +173 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_process/exiting.ts +4 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_process/process.ts +131 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_process/stdio.mjs +7 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_process/streams.mjs +146 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_stream.d.ts +1488 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_stream.mjs +746 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_util/_util_callbackify.ts +129 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/_utils.ts +206 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/assert.ts +940 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/assertion_error.ts +579 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/async_hooks.ts +331 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/buffer.ts +13 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/events.ts +14 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/buffer.d.ts +2074 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/buffer.mjs +2607 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/crypto/_keys.ts +16 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/crypto/constants.ts +5 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/error_codes.ts +7 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/errors.ts +2867 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/fixed_queue.ts +123 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/hide_stack_frames.ts +16 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/net.ts +95 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/normalize_encoding.mjs +72 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/options.ts +45 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/primordials.mjs +30 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/process/per_thread.mjs +272 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/readline/callbacks.mjs +137 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/readline/utils.mjs +580 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/destroy.mjs +320 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/end-of-stream.mjs +229 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/streams/utils.mjs +242 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/comparisons.ts +669 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/debuglog.ts +118 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/inspect.mjs +2237 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util/types.ts +113 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/util.mjs +143 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal/validators.mjs +317 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_libuv_winerror.ts +229 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_listen.ts +16 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_node.ts +18 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_timingSafeEqual.ts +12 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_utils.ts +86 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/_winerror.ts +16873 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/ares.ts +66 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/async_wrap.ts +152 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/buffer.ts +130 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/cares_wrap.ts +541 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/config.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/connection_wrap.ts +80 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/constants.ts +900 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/contextify.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/credentials.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/crypto.ts +14 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/errors.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs_dir.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/fs_event_wrap.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/handle_wrap.ts +50 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/heap_utils.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/http_parser.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/icu.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/inspector.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/js_stream.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/messaging.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/mod.ts +108 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/module_wrap.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/native_module.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/natives.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/node_file.ts +84 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/node_options.ts +39 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/options.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/os.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/performance.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/pipe_wrap.ts +392 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/process_methods.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/report.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/serdes.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/signal_wrap.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/spawn_sync.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/stream_wrap.ts +354 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/string_decoder.ts +15 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/symbols.ts +27 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/task_queue.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tcp_wrap.ts +488 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/timers.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tls_wrap.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/trace_events.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/tty_wrap.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/types.ts +186 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/udp_wrap.ts +496 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/url.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/util.ts +126 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/uv.ts +437 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/v8.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/worker.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/internal_binding/zlib.ts +3 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/process.ts +705 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/stream.ts +37 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/string_decoder.ts +337 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/util/types.ts +4 -0
- package/src/templates/vendor/deno.land/std@0.175.0/node/util.ts +289 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/_constants.ts +49 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/_interface.ts +30 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/_util.ts +194 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/common.ts +40 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/glob.ts +418 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/mod.ts +53 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/posix.ts +487 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/separator.ts +7 -0
- package/src/templates/vendor/deno.land/std@0.175.0/path/win32.ts +962 -0
- package/src/templates/vendor/deno.land/std@0.175.0/streams/write_all.ts +64 -0
- package/src/templates/vendor/deno.land/std@0.175.0/testing/_diff.ts +440 -0
- package/src/templates/vendor/deno.land/std@0.175.0/testing/_format.ts +23 -0
- package/src/templates/vendor/deno.land/std@0.175.0/testing/asserts.ts +906 -0
- package/src/templates/vendor/deno.land/std@0.175.0/types.d.ts +89 -0
- package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts +133 -0
- package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/asyncify.js +112 -0
- package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.d.ts +88 -0
- package/src/templates/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.js +974 -0
- package/src/templates/vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts +621 -0
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js +13 -0
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js +12 -0
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js +5 -0
- package/src/templates/vendor/import_map.json +13 -0
- package/src/templates/vendor/raw.githubusercontent.com/worker-tools/resolvable-promise/master/index.ts +50 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
import { EventEmitter } from "./_events.d.ts";
|
|
3
|
+
import { Buffer } from "./buffer.ts";
|
|
4
|
+
|
|
5
|
+
/** One of:
|
|
6
|
+
* | "ascii"
|
|
7
|
+
* | "utf8"
|
|
8
|
+
* | "utf-8"
|
|
9
|
+
* | "utf16le"
|
|
10
|
+
* | "ucs2"
|
|
11
|
+
* | "ucs-2"
|
|
12
|
+
* | "base64"
|
|
13
|
+
* | "base64url"
|
|
14
|
+
* | "latin1"
|
|
15
|
+
* | "binary"
|
|
16
|
+
* | "hex";
|
|
17
|
+
*/
|
|
18
|
+
export type BufferEncoding = string;
|
|
19
|
+
|
|
20
|
+
export interface Buffered {
|
|
21
|
+
chunk: Buffer;
|
|
22
|
+
encoding: string;
|
|
23
|
+
callback: (err?: Error | null) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ErrnoException extends Error {
|
|
27
|
+
errno?: number | undefined;
|
|
28
|
+
code?: string | undefined;
|
|
29
|
+
path?: string | undefined;
|
|
30
|
+
syscall?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ReadableStream extends EventEmitter {
|
|
34
|
+
readable: boolean;
|
|
35
|
+
read(size?: number): string | Buffer;
|
|
36
|
+
setEncoding(encoding: BufferEncoding): this;
|
|
37
|
+
pause(): this;
|
|
38
|
+
resume(): this;
|
|
39
|
+
isPaused(): boolean;
|
|
40
|
+
pipe<T extends WritableStream>(
|
|
41
|
+
destination: T,
|
|
42
|
+
options?: { end?: boolean | undefined },
|
|
43
|
+
): T;
|
|
44
|
+
unpipe(destination?: WritableStream): this;
|
|
45
|
+
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
46
|
+
wrap(oldStream: ReadableStream): this;
|
|
47
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface WritableStream extends EventEmitter {
|
|
51
|
+
writable: boolean;
|
|
52
|
+
write(
|
|
53
|
+
buffer: Uint8Array | string,
|
|
54
|
+
cb?: (err?: Error | null) => void,
|
|
55
|
+
): boolean;
|
|
56
|
+
write(
|
|
57
|
+
str: string,
|
|
58
|
+
encoding?: BufferEncoding,
|
|
59
|
+
cb?: (err?: Error | null) => void,
|
|
60
|
+
): boolean;
|
|
61
|
+
end(cb?: () => void): void;
|
|
62
|
+
end(data: string | Uint8Array, cb?: () => void): void;
|
|
63
|
+
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ReadWriteStream extends ReadableStream, WritableStream {}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
3
|
+
|
|
4
|
+
// deno-lint-ignore-file no-inner-declarations
|
|
5
|
+
|
|
6
|
+
import { core } from "./_core.ts";
|
|
7
|
+
import { validateFunction } from "./internal/validators.mjs";
|
|
8
|
+
import { _exiting } from "./_process/exiting.ts";
|
|
9
|
+
import { FixedQueue } from "./internal/fixed_queue.ts";
|
|
10
|
+
|
|
11
|
+
interface Tock {
|
|
12
|
+
callback: (...args: Array<unknown>) => void;
|
|
13
|
+
args: Array<unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const queue = new FixedQueue();
|
|
17
|
+
|
|
18
|
+
// deno-lint-ignore no-explicit-any
|
|
19
|
+
let _nextTick: any;
|
|
20
|
+
|
|
21
|
+
export function processTicksAndRejections() {
|
|
22
|
+
let tock;
|
|
23
|
+
do {
|
|
24
|
+
// deno-lint-ignore no-cond-assign
|
|
25
|
+
while (tock = queue.shift()) {
|
|
26
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
27
|
+
// const asyncId = tock[async_id_symbol];
|
|
28
|
+
// emitBefore(asyncId, tock[trigger_async_id_symbol], tock);
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const callback = (tock as Tock).callback;
|
|
32
|
+
if ((tock as Tock).args === undefined) {
|
|
33
|
+
callback();
|
|
34
|
+
} else {
|
|
35
|
+
const args = (tock as Tock).args;
|
|
36
|
+
switch (args.length) {
|
|
37
|
+
case 1:
|
|
38
|
+
callback(args[0]);
|
|
39
|
+
break;
|
|
40
|
+
case 2:
|
|
41
|
+
callback(args[0], args[1]);
|
|
42
|
+
break;
|
|
43
|
+
case 3:
|
|
44
|
+
callback(args[0], args[1], args[2]);
|
|
45
|
+
break;
|
|
46
|
+
case 4:
|
|
47
|
+
callback(args[0], args[1], args[2], args[3]);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
callback(...args);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} finally {
|
|
54
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
55
|
+
// if (destroyHooksExist())
|
|
56
|
+
// emitDestroy(asyncId);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
60
|
+
// emitAfter(asyncId);
|
|
61
|
+
}
|
|
62
|
+
core.runMicrotasks();
|
|
63
|
+
// FIXME(bartlomieju): Deno currently doesn't unhandled rejections
|
|
64
|
+
// } while (!queue.isEmpty() || processPromiseRejections());
|
|
65
|
+
} while (!queue.isEmpty());
|
|
66
|
+
core.setHasTickScheduled(false);
|
|
67
|
+
// FIXME(bartlomieju): Deno currently doesn't unhandled rejections
|
|
68
|
+
// setHasRejectionToWarn(false);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (typeof core.setNextTickCallback !== "undefined") {
|
|
72
|
+
function runNextTicks() {
|
|
73
|
+
// FIXME(bartlomieju): Deno currently doesn't unhandled rejections
|
|
74
|
+
// if (!hasTickScheduled() && !hasRejectionToWarn())
|
|
75
|
+
// runMicrotasks();
|
|
76
|
+
// if (!hasTickScheduled() && !hasRejectionToWarn())
|
|
77
|
+
// return;
|
|
78
|
+
if (!core.hasTickScheduled()) {
|
|
79
|
+
core.runMicrotasks();
|
|
80
|
+
}
|
|
81
|
+
if (!core.hasTickScheduled()) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
processTicksAndRejections();
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
core.setNextTickCallback(processTicksAndRejections);
|
|
90
|
+
core.setMacrotaskCallback(runNextTicks);
|
|
91
|
+
|
|
92
|
+
function __nextTickNative<T extends Array<unknown>>(
|
|
93
|
+
this: unknown,
|
|
94
|
+
callback: (...args: T) => void,
|
|
95
|
+
...args: T
|
|
96
|
+
) {
|
|
97
|
+
validateFunction(callback, "callback");
|
|
98
|
+
|
|
99
|
+
if (_exiting) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// TODO(bartlomieju): seems superfluous if we don't depend on `arguments`
|
|
104
|
+
let args_;
|
|
105
|
+
switch (args.length) {
|
|
106
|
+
case 0:
|
|
107
|
+
break;
|
|
108
|
+
case 1:
|
|
109
|
+
args_ = [args[0]];
|
|
110
|
+
break;
|
|
111
|
+
case 2:
|
|
112
|
+
args_ = [args[0], args[1]];
|
|
113
|
+
break;
|
|
114
|
+
case 3:
|
|
115
|
+
args_ = [args[0], args[1], args[2]];
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
args_ = new Array(args.length);
|
|
119
|
+
for (let i = 0; i < args.length; i++) {
|
|
120
|
+
args_[i] = args[i];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (queue.isEmpty()) {
|
|
125
|
+
core.setHasTickScheduled(true);
|
|
126
|
+
}
|
|
127
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
128
|
+
// const asyncId = newAsyncId();
|
|
129
|
+
// const triggerAsyncId = getDefaultTriggerAsyncId();
|
|
130
|
+
const tickObject = {
|
|
131
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
132
|
+
// [async_id_symbol]: asyncId,
|
|
133
|
+
// [trigger_async_id_symbol]: triggerAsyncId,
|
|
134
|
+
callback,
|
|
135
|
+
args: args_,
|
|
136
|
+
};
|
|
137
|
+
// FIXME(bartlomieju): Deno currently doesn't support async hooks
|
|
138
|
+
// if (initHooksExist())
|
|
139
|
+
// emitInit(asyncId, 'TickObject', triggerAsyncId, tickObject);
|
|
140
|
+
queue.push(tickObject);
|
|
141
|
+
}
|
|
142
|
+
_nextTick = __nextTickNative;
|
|
143
|
+
} else {
|
|
144
|
+
function __nextTickQueueMicrotask<T extends Array<unknown>>(
|
|
145
|
+
this: unknown,
|
|
146
|
+
callback: (...args: T) => void,
|
|
147
|
+
...args: T
|
|
148
|
+
) {
|
|
149
|
+
if (args) {
|
|
150
|
+
queueMicrotask(() => callback.call(this, ...args));
|
|
151
|
+
} else {
|
|
152
|
+
queueMicrotask(callback);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
_nextTick = __nextTickQueueMicrotask;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// `nextTick()` will not enqueue any callback when the process is about to
|
|
160
|
+
// exit since the callback would not have a chance to be executed.
|
|
161
|
+
export function nextTick(this: unknown, callback: () => void): void;
|
|
162
|
+
export function nextTick<T extends Array<unknown>>(
|
|
163
|
+
this: unknown,
|
|
164
|
+
callback: (...args: T) => void,
|
|
165
|
+
...args: T
|
|
166
|
+
): void;
|
|
167
|
+
export function nextTick<T extends Array<unknown>>(
|
|
168
|
+
this: unknown,
|
|
169
|
+
callback: (...args: T) => void,
|
|
170
|
+
...args: T
|
|
171
|
+
) {
|
|
172
|
+
_nextTick(callback, ...args);
|
|
173
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
|
3
|
+
|
|
4
|
+
// The following are all the process APIs that don't depend on the stream module
|
|
5
|
+
// They have to be split this way to prevent a circular dependency
|
|
6
|
+
|
|
7
|
+
import { isWindows } from "../../_util/os.ts";
|
|
8
|
+
import { nextTick as _nextTick } from "../_next_tick.ts";
|
|
9
|
+
import { _exiting } from "./exiting.ts";
|
|
10
|
+
|
|
11
|
+
/** Returns the operating system CPU architecture for which the Deno binary was compiled */
|
|
12
|
+
function _arch(): string {
|
|
13
|
+
if (Deno.build.arch == "x86_64") {
|
|
14
|
+
return "x64";
|
|
15
|
+
} else if (Deno.build.arch == "aarch64") {
|
|
16
|
+
return "arm64";
|
|
17
|
+
} else {
|
|
18
|
+
throw Error("unreachable");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** https://nodejs.org/api/process.html#process_process_arch */
|
|
23
|
+
export const arch = _arch();
|
|
24
|
+
|
|
25
|
+
/** https://nodejs.org/api/process.html#process_process_chdir_directory */
|
|
26
|
+
export const chdir = Deno.chdir;
|
|
27
|
+
|
|
28
|
+
/** https://nodejs.org/api/process.html#process_process_cwd */
|
|
29
|
+
export const cwd = Deno.cwd;
|
|
30
|
+
|
|
31
|
+
/** https://nodejs.org/api/process.html#process_process_nexttick_callback_args */
|
|
32
|
+
export const nextTick = _nextTick;
|
|
33
|
+
|
|
34
|
+
/** Wrapper of Deno.env.get, which doesn't throw type error when
|
|
35
|
+
* the env name has "=" or "\0" in it. */
|
|
36
|
+
function denoEnvGet(name: string) {
|
|
37
|
+
try {
|
|
38
|
+
return Deno.env.get(name);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
if (e instanceof TypeError) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const OBJECT_PROTO_PROP_NAMES = Object.getOwnPropertyNames(Object.prototype);
|
|
48
|
+
/**
|
|
49
|
+
* https://nodejs.org/api/process.html#process_process_env
|
|
50
|
+
* Requires env permissions
|
|
51
|
+
*/
|
|
52
|
+
export const env: InstanceType<ObjectConstructor> & Record<string, string> =
|
|
53
|
+
new Proxy(Object(), {
|
|
54
|
+
get: (target, prop) => {
|
|
55
|
+
if (typeof prop === "symbol") {
|
|
56
|
+
return target[prop];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const envValue = denoEnvGet(prop);
|
|
60
|
+
|
|
61
|
+
if (envValue) {
|
|
62
|
+
return envValue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (OBJECT_PROTO_PROP_NAMES.includes(prop)) {
|
|
66
|
+
return target[prop];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return envValue;
|
|
70
|
+
},
|
|
71
|
+
ownKeys: () => Reflect.ownKeys(Deno.env.toObject()),
|
|
72
|
+
getOwnPropertyDescriptor: (_target, name) => {
|
|
73
|
+
const value = denoEnvGet(String(name));
|
|
74
|
+
if (value) {
|
|
75
|
+
return {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
configurable: true,
|
|
78
|
+
value,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
set(_target, prop, value) {
|
|
83
|
+
Deno.env.set(String(prop), String(value));
|
|
84
|
+
return true; // success
|
|
85
|
+
},
|
|
86
|
+
has: (_target, prop) => typeof denoEnvGet(String(prop)) === "string",
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** https://nodejs.org/api/process.html#process_process_pid */
|
|
90
|
+
export const pid = Deno.pid;
|
|
91
|
+
|
|
92
|
+
/** https://nodejs.org/api/process.html#process_process_platform */
|
|
93
|
+
export const platform = isWindows ? "win32" : Deno.build.os;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* https://nodejs.org/api/process.html#process_process_version
|
|
97
|
+
*
|
|
98
|
+
* This value is hard coded to latest stable release of Node, as
|
|
99
|
+
* some packages are checking it for compatibility. Previously
|
|
100
|
+
* it pointed to Deno version, but that led to incompability
|
|
101
|
+
* with some packages.
|
|
102
|
+
*/
|
|
103
|
+
export const version = "v18.12.1";
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* https://nodejs.org/api/process.html#process_process_versions
|
|
107
|
+
*
|
|
108
|
+
* This value is hard coded to latest stable release of Node, as
|
|
109
|
+
* some packages are checking it for compatibility. Previously
|
|
110
|
+
* it contained only output of `Deno.version`, but that led to incompability
|
|
111
|
+
* with some packages. Value of `v8` field is still taken from `Deno.version`.
|
|
112
|
+
*/
|
|
113
|
+
export const versions = {
|
|
114
|
+
node: "18.12.1",
|
|
115
|
+
uv: "1.43.0",
|
|
116
|
+
zlib: "1.2.11",
|
|
117
|
+
brotli: "1.0.9",
|
|
118
|
+
ares: "1.18.1",
|
|
119
|
+
modules: "108",
|
|
120
|
+
nghttp2: "1.47.0",
|
|
121
|
+
napi: "8",
|
|
122
|
+
llhttp: "6.0.10",
|
|
123
|
+
openssl: "3.0.7+quic",
|
|
124
|
+
cldr: "41.0",
|
|
125
|
+
icu: "71.1",
|
|
126
|
+
tz: "2022b",
|
|
127
|
+
unicode: "14.0",
|
|
128
|
+
ngtcp2: "0.8.1",
|
|
129
|
+
nghttp3: "0.7.0",
|
|
130
|
+
...Deno.version,
|
|
131
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
|
3
|
+
|
|
4
|
+
// Lazily initializes the actual stdio objects.
|
|
5
|
+
// This trick is necessary for avoiding circular dependencies between
|
|
6
|
+
// stream and process modules.
|
|
7
|
+
export const stdio = {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
|
|
3
|
+
|
|
4
|
+
import { Buffer } from "../buffer.ts";
|
|
5
|
+
import {
|
|
6
|
+
clearLine,
|
|
7
|
+
clearScreenDown,
|
|
8
|
+
cursorTo,
|
|
9
|
+
moveCursor,
|
|
10
|
+
} from "../internal/readline/callbacks.mjs";
|
|
11
|
+
import { Readable, Writable } from "../stream.ts";
|
|
12
|
+
import { stdio } from "./stdio.mjs";
|
|
13
|
+
|
|
14
|
+
// https://github.com/nodejs/node/blob/00738314828074243c9a52a228ab4c68b04259ef/lib/internal/bootstrap/switches/is_main_thread.js#L41
|
|
15
|
+
function createWritableStdioStream(writer, name) {
|
|
16
|
+
const stream = new Writable({
|
|
17
|
+
write(buf, enc, cb) {
|
|
18
|
+
if (!writer) {
|
|
19
|
+
this.destroy(
|
|
20
|
+
new Error(`Deno.${name} is not available in this environment`),
|
|
21
|
+
);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
writer.writeSync(buf instanceof Uint8Array ? buf : Buffer.from(buf, enc));
|
|
25
|
+
cb();
|
|
26
|
+
},
|
|
27
|
+
destroy(err, cb) {
|
|
28
|
+
cb(err);
|
|
29
|
+
this._undestroy();
|
|
30
|
+
if (!this._writableState.emitClose) {
|
|
31
|
+
nextTick(() => this.emit("close"));
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
stream.fd = writer?.rid ?? -1;
|
|
36
|
+
stream.destroySoon = stream.destroy;
|
|
37
|
+
stream._isStdio = true;
|
|
38
|
+
stream.once("close", () => writer?.close());
|
|
39
|
+
Object.defineProperties(stream, {
|
|
40
|
+
columns: {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
get: () =>
|
|
44
|
+
Deno.isatty?.(writer?.rid) ? Deno.consoleSize?.().columns : undefined,
|
|
45
|
+
},
|
|
46
|
+
rows: {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
get: () =>
|
|
50
|
+
Deno.isatty?.(writer?.rid) ? Deno.consoleSize?.().rows : undefined,
|
|
51
|
+
},
|
|
52
|
+
isTTY: {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
get: () => Deno.isatty?.(writer?.rid),
|
|
56
|
+
},
|
|
57
|
+
getWindowSize: {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
value: () =>
|
|
61
|
+
Deno.isatty?.(writer?.rid)
|
|
62
|
+
? Object.values(Deno.consoleSize?.())
|
|
63
|
+
: undefined,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (Deno.isatty?.(writer?.rid)) {
|
|
68
|
+
// These belong on tty.WriteStream(), but the TTY streams currently have
|
|
69
|
+
// following problems:
|
|
70
|
+
// 1. Using them here introduces a circular dependency.
|
|
71
|
+
// 2. Creating a net.Socket() from a fd is not currently supported.
|
|
72
|
+
stream.cursorTo = function (x, y, callback) {
|
|
73
|
+
return cursorTo(this, x, y, callback);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
stream.moveCursor = function (dx, dy, callback) {
|
|
77
|
+
return moveCursor(this, dx, dy, callback);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
stream.clearLine = function (dir, callback) {
|
|
81
|
+
return clearLine(this, dir, callback);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
stream.clearScreenDown = function (callback) {
|
|
85
|
+
return clearScreenDown(this, callback);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return stream;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** https://nodejs.org/api/process.html#process_process_stderr */
|
|
93
|
+
export const stderr = stdio.stderr = createWritableStdioStream(
|
|
94
|
+
Deno.stderr,
|
|
95
|
+
"stderr",
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
/** https://nodejs.org/api/process.html#process_process_stdout */
|
|
99
|
+
export const stdout = stdio.stdout = createWritableStdioStream(
|
|
100
|
+
Deno.stdout,
|
|
101
|
+
"stdout",
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
/** https://nodejs.org/api/process.html#process_process_stdin */
|
|
105
|
+
export const stdin = stdio.stdin = new Readable({
|
|
106
|
+
highWaterMark: 0,
|
|
107
|
+
emitClose: false,
|
|
108
|
+
read(size) {
|
|
109
|
+
const p = Buffer.alloc(size || 16 * 1024);
|
|
110
|
+
|
|
111
|
+
if (!Deno.stdin) {
|
|
112
|
+
this.destroy(
|
|
113
|
+
new Error("Deno.stdin is not available in this environment"),
|
|
114
|
+
);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Deno.stdin.read(p).then((length) => {
|
|
119
|
+
this.push(length === null ? null : p.slice(0, length));
|
|
120
|
+
}, (error) => {
|
|
121
|
+
this.destroy(error);
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
stdin.on("close", () => Deno.stdin?.close());
|
|
126
|
+
stdin.fd = Deno.stdin?.rid ?? -1;
|
|
127
|
+
Object.defineProperty(stdin, "isTTY", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true,
|
|
130
|
+
get() {
|
|
131
|
+
return Deno.isatty?.(Deno.stdin.rid);
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
stdin._isRawMode = false;
|
|
135
|
+
stdin.setRawMode = (enable) => {
|
|
136
|
+
Deno.stdin?.setRaw?.(enable);
|
|
137
|
+
stdin._isRawMode = enable;
|
|
138
|
+
return stdin;
|
|
139
|
+
};
|
|
140
|
+
Object.defineProperty(stdin, "isRaw", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
get() {
|
|
144
|
+
return stdin._isRawMode;
|
|
145
|
+
},
|
|
146
|
+
});
|