diff --git a/src/env.ts b/src/env.ts index 0fe7f56d..b3457c47 100644 --- a/src/env.ts +++ b/src/env.ts @@ -1,6 +1,6 @@ import { resolvePathSync, type ResolveOptions } from "mlly"; import type { Preset, Environment, CreateEnvOptions } from "../lib/index.d.mts"; -import nodeCompatPreset from "./presets/nodeless"; +import nodeCompatPreset from "./presets/nodeless.ts"; /** * Configure a target environment. diff --git a/src/index.ts b/src/index.ts index 556642c8..997bc0ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export { defineEnv } from "./env"; +export { defineEnv } from "./env.ts"; diff --git a/src/presets/node.ts b/src/presets/node.ts index 73fa1ed7..ed7f2d42 100644 --- a/src/presets/node.ts +++ b/src/presets/node.ts @@ -1,4 +1,4 @@ -import { builtinModules } from "../runtime/node/module"; +import { builtinModules } from "../runtime/node/module.ts"; import type { Preset } from "../../lib/index.d.mts"; import { version } from "../../package.json"; diff --git a/src/presets/nodeless.ts b/src/presets/nodeless.ts index 467dece0..20c22fb7 100644 --- a/src/presets/nodeless.ts +++ b/src/presets/nodeless.ts @@ -1,5 +1,5 @@ -import { mapArrToVal } from "./utils"; -import { builtinModules } from "../runtime/node/module"; +import { mapArrToVal } from "./utils.ts"; +import { builtinModules } from "../runtime/node/module.ts"; import type { Preset } from "../../lib/index.d.mts"; import { version } from "../../package.json"; diff --git a/src/runtime/_internal/utils.ts b/src/runtime/_internal/utils.ts index a2db7e0b..15f2850e 100644 --- a/src/runtime/_internal/utils.ts +++ b/src/runtime/_internal/utils.ts @@ -1,4 +1,4 @@ -import type { HeadersObject } from "./types"; +import type { HeadersObject } from "./types.ts"; /*@__NO_SIDE_EFFECTS__*/ export function rawHeaders(headers: HeadersObject) { diff --git a/src/runtime/node/assert.ts b/src/runtime/node/assert.ts index be6d32cb..e91c8836 100644 --- a/src/runtime/node/assert.ts +++ b/src/runtime/node/assert.ts @@ -25,7 +25,7 @@ import type nodeAssert from "node:assert"; import { isEqual as _ohashIsEqual } from "ohash"; -import { notImplementedClass } from "../_internal/utils"; +import { notImplementedClass } from "../_internal/utils.ts"; // TODO: Implement Error classes const ERR_AMBIGUOUS_ARGUMENT = Error; diff --git a/src/runtime/node/assert/strict.ts b/src/runtime/node/assert/strict.ts index 9ac99a21..f310fa84 100644 --- a/src/runtime/node/assert/strict.ts +++ b/src/runtime/node/assert/strict.ts @@ -21,7 +21,7 @@ import { notStrictEqual as notEqual, deepStrictEqual, deepStrictEqual as deepEqual, -} from "../assert"; +} from "../assert.ts"; export { AssertionError, @@ -44,7 +44,7 @@ export { notStrictEqual as notEqual, deepStrictEqual, deepStrictEqual as deepEqual, -} from "../assert"; +} from "../assert.ts"; export default Object.assign(ok, { AssertionError, diff --git a/src/runtime/node/async_hooks.ts b/src/runtime/node/async_hooks.ts index f3901ede..ea2d00cd 100644 --- a/src/runtime/node/async_hooks.ts +++ b/src/runtime/node/async_hooks.ts @@ -1,15 +1,15 @@ // https://nodejs.org/api/events.html import type asyncHooks from "node:async_hooks"; -import { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage"; -import { AsyncResource } from "./internal/async_hooks/async-resource"; +import { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage.ts"; +import { AsyncResource } from "./internal/async_hooks/async-resource.ts"; -import * as asyncHook from "./internal/async_hooks/async-hook"; +import * as asyncHook from "./internal/async_hooks/async-hook.ts"; -export { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage"; -export { AsyncResource } from "./internal/async_hooks/async-resource"; +export { AsyncLocalStorage } from "./internal/async_hooks/async-local-storage.ts"; +export { AsyncResource } from "./internal/async_hooks/async-resource.ts"; -export * from "./internal/async_hooks/async-hook"; +export * from "./internal/async_hooks/async-hook.ts"; export default { AsyncLocalStorage, diff --git a/src/runtime/node/buffer.ts b/src/runtime/node/buffer.ts index 4f0867ea..cc3aad87 100644 --- a/src/runtime/node/buffer.ts +++ b/src/runtime/node/buffer.ts @@ -1,23 +1,23 @@ // https://nodejs.org/api/buffer.html import type buffer from "node:buffer"; -import { notImplemented } from "../_internal/utils"; +import { notImplemented } from "../_internal/utils.ts"; import { Buffer as _Buffer, kMaxLength, INSPECT_MAX_BYTES, SlowBuffer, -} from "./internal/buffer/buffer"; -import { File } from "./internal/buffer/file"; +} from "./internal/buffer/buffer.ts"; +import { File } from "./internal/buffer/file.ts"; export { kMaxLength, INSPECT_MAX_BYTES, SlowBuffer, -} from "./internal/buffer/buffer"; +} from "./internal/buffer/buffer.ts"; export const Buffer = globalThis.Buffer || _Buffer; -export { File } from "./internal/buffer/file"; +export { File } from "./internal/buffer/file.ts"; // @ts-expect-eerror https://github.com/unjs/unenv/issues/64 export const Blob = globalThis.Blob as unknown as typeof buffer.Blob; diff --git a/src/runtime/node/child_process.ts b/src/runtime/node/child_process.ts index f69073ae..e95c9cac 100644 --- a/src/runtime/node/child_process.ts +++ b/src/runtime/node/child_process.ts @@ -1,4 +1,4 @@ -import { notImplemented, notImplementedClass } from "../_internal/utils"; +import { notImplemented, notImplementedClass } from "../_internal/utils.ts"; import type child_process from "node:child_process"; export const ChildProcess: typeof child_process.ChildProcess = diff --git a/src/runtime/node/cluster.ts b/src/runtime/node/cluster.ts index e557035a..24d507fb 100644 --- a/src/runtime/node/cluster.ts +++ b/src/runtime/node/cluster.ts @@ -1,6 +1,6 @@ // Reference: https://github.com/nodejs/node/blob/main/lib/internal/cluster/primary.js -import mock from "../mock/proxy"; -import { notImplemented } from "../_internal/utils"; +import mock from "../mock/proxy.ts"; +import { notImplemented } from "../_internal/utils.ts"; import type nodeCluster from "node:cluster"; import type { Cluster as NodeCluster, diff --git a/src/runtime/node/console.ts b/src/runtime/node/console.ts index d7c8bde6..f715755e 100644 --- a/src/runtime/node/console.ts +++ b/src/runtime/node/console.ts @@ -1,8 +1,8 @@ import type console from "node:console"; import { Writable } from "node:stream"; -import mock from "../mock/proxy"; -import noop from "../mock/noop"; -import { notImplemented } from "../_internal/utils"; +import mock from "../mock/proxy.ts"; +import noop from "../mock/noop.ts"; +import { notImplemented } from "../_internal/utils.ts"; const _console = globalThis.console; @@ -49,7 +49,7 @@ export const timeStamp: typeof console.timeStamp = _console?.timeStamp ?? noop; export const Console: typeof console.Console = _console?.Console ?? mock.__createMock__("console.Console"); -export { default as _times } from "../mock/proxy"; +export { default as _times } from "../mock/proxy.ts"; export function context() { // TODO: Should be Console with all the methods @@ -59,7 +59,7 @@ export function context() { export { default as _stdoutErrorHandler, default as _stderrErrorHandler, -} from "../mock/noop"; +} from "../mock/noop.ts"; export default { assert, diff --git a/src/runtime/node/constants.ts b/src/runtime/node/constants.ts index 4eec7b28..9b989b81 100644 --- a/src/runtime/node/constants.ts +++ b/src/runtime/node/constants.ts @@ -1,13 +1,13 @@ // Mostly taken from: https://github.com/nodejs/node/blob/main/typings/internalBinding/constants.d.ts import type constants from "node:constants"; -import * as os from "./internal/constants/os"; -import * as fs from "./internal/constants/fs"; -import * as crypto from "./internal/constants/crypto"; +import * as os from "./internal/constants/os.ts"; +import * as fs from "./internal/constants/fs.ts"; +import * as crypto from "./internal/constants/crypto.ts"; -export * from "./internal/constants/os"; -export * from "./internal/constants/fs"; -export * from "./internal/constants/crypto"; +export * from "./internal/constants/os.ts"; +export * from "./internal/constants/fs.ts"; +export * from "./internal/constants/crypto.ts"; export default { ...crypto, diff --git a/src/runtime/node/crypto.ts b/src/runtime/node/crypto.ts index 53aa0175..dd6b3d14 100644 --- a/src/runtime/node/crypto.ts +++ b/src/runtime/node/crypto.ts @@ -1,12 +1,12 @@ import type nodeCrypto from "node:crypto"; -import * as web from "./internal/crypto/web"; -import * as node from "./internal/crypto/node"; -import constants from "./internal/crypto/constants"; +import * as web from "./internal/crypto/web.ts"; +import * as node from "./internal/crypto/node.ts"; +import constants from "./internal/crypto/constants.ts"; -export * from "./internal/crypto/web"; -export * from "./internal/crypto/node"; -export { default as constants } from "./internal/crypto/constants"; +export * from "./internal/crypto/web.ts"; +export * from "./internal/crypto/node.ts"; +export { default as constants } from "./internal/crypto/constants.ts"; export default { ...web, diff --git a/src/runtime/node/dgram.ts b/src/runtime/node/dgram.ts index c3457a93..daacc097 100644 --- a/src/runtime/node/dgram.ts +++ b/src/runtime/node/dgram.ts @@ -1,8 +1,8 @@ -import noop from "../mock/noop"; +import noop from "../mock/noop.ts"; import type dgram from "node:dgram"; -import { Socket } from "./internal/dgram/socket"; +import { Socket } from "./internal/dgram/socket.ts"; -export { Socket } from "./internal/dgram/socket"; +export { Socket } from "./internal/dgram/socket.ts"; export const _createSocketHandle = noop; diff --git a/src/runtime/node/diagnostics_channel.ts b/src/runtime/node/diagnostics_channel.ts index 1cec8d0d..7f28cce6 100644 --- a/src/runtime/node/diagnostics_channel.ts +++ b/src/runtime/node/diagnostics_channel.ts @@ -1,8 +1,11 @@ import type diagnostics_channel from "node:diagnostics_channel"; -import { Channel, getChannels } from "./internal/diagnostics_channel/channel"; -import { TracingChannel } from "./internal/diagnostics_channel/tracing-channel"; +import { + Channel, + getChannels, +} from "./internal/diagnostics_channel/channel.ts"; +import { TracingChannel } from "./internal/diagnostics_channel/tracing-channel.ts"; -export { Channel } from "./internal/diagnostics_channel/channel"; +export { Channel } from "./internal/diagnostics_channel/channel.ts"; export const channel: typeof diagnostics_channel.channel = function (name) { const channels = getChannels(); diff --git a/src/runtime/node/dns.ts b/src/runtime/node/dns.ts index 1a06f5f8..4dd0ac9f 100644 --- a/src/runtime/node/dns.ts +++ b/src/runtime/node/dns.ts @@ -1,12 +1,12 @@ -import noop from "../mock/noop"; -import mock from "../mock/proxy"; -import { notImplemented, notImplementedAsync } from "../_internal/utils"; +import noop from "../mock/noop.ts"; +import mock from "../mock/proxy.ts"; +import { notImplemented, notImplementedAsync } from "../_internal/utils.ts"; import type dns from "node:dns"; -import promises from "./dns/promises"; -import * as constants from "./internal/dns/constants"; +import promises from "./dns/promises.ts"; +import * as constants from "./internal/dns/constants.ts"; -export * from "./internal/dns/constants"; -export * as promises from "./dns/promises"; +export * from "./internal/dns/constants.ts"; +export * as promises from "./dns/promises.ts"; export const Resolver: typeof dns.Resolver = mock.__createMock__("dns.Resolver"); diff --git a/src/runtime/node/dns/promises.ts b/src/runtime/node/dns/promises.ts index 4e5fb6f0..af7cd82e 100644 --- a/src/runtime/node/dns/promises.ts +++ b/src/runtime/node/dns/promises.ts @@ -1,9 +1,9 @@ -import noop from "../../mock/noop"; -import mock from "../../mock/proxy"; -import { notImplemented, notImplementedAsync } from "../../_internal/utils"; +import noop from "../../mock/noop.ts"; +import mock from "../../mock/proxy.ts"; +import { notImplemented, notImplementedAsync } from "../../_internal/utils.ts"; import type dns from "node:dns/promises"; -import * as constants from "../internal/dns/constants"; -export * from "../internal/dns/constants"; +import * as constants from "../internal/dns/constants.ts"; +export * from "../internal/dns/constants.ts"; export const Resolver: typeof dns.Resolver = mock.__createMock__("dns.Resolver"); diff --git a/src/runtime/node/domain.ts b/src/runtime/node/domain.ts index efc677d9..2c86e1ff 100644 --- a/src/runtime/node/domain.ts +++ b/src/runtime/node/domain.ts @@ -1,7 +1,7 @@ import type domain from "node:domain"; -import { Domain } from "./internal/domain/domain"; +import { Domain } from "./internal/domain/domain.ts"; -export { Domain } from "./internal/domain/domain"; +export { Domain } from "./internal/domain/domain.ts"; export const create: typeof domain.create = function () { return new Domain(); diff --git a/src/runtime/node/events.ts b/src/runtime/node/events.ts index 32abf20f..bfe864ef 100644 --- a/src/runtime/node/events.ts +++ b/src/runtime/node/events.ts @@ -1,7 +1,7 @@ // https://nodejs.org/api/events.html import type nodeEvents from "node:events"; -import { _EventEmitter } from "./internal/events/events"; +import { _EventEmitter } from "./internal/events/events.ts"; export { _EventEmitter as EventEmitter, @@ -11,7 +11,7 @@ export { getMaxListeners, on, once, -} from "./internal/events/events"; +} from "./internal/events/events.ts"; export const usingDomains = _EventEmitter.usingDomains; export const captureRejectionSymbol = _EventEmitter.captureRejectionSymbol; diff --git a/src/runtime/node/fs.ts b/src/runtime/node/fs.ts index 4d1a5ee4..ff499216 100644 --- a/src/runtime/node/fs.ts +++ b/src/runtime/node/fs.ts @@ -1,15 +1,15 @@ // https://nodejs.org/api/fs.html import type nodeFS from "node:fs"; -import * as _classes from "./internal/fs/classes"; -import * as _constants from "./internal/fs/constants"; -import * as _fs from "./internal/fs/fs"; +import * as _classes from "./internal/fs/classes.ts"; +import * as _constants from "./internal/fs/constants.ts"; +import * as _fs from "./internal/fs/fs.ts"; -import * as _promises from "./internal/fs/promises"; +import * as _promises from "./internal/fs/promises.ts"; -export * from "./internal/fs/classes"; -export * from "./internal/fs/constants"; -export * from "./internal/fs/fs"; +export * from "./internal/fs/classes.ts"; +export * from "./internal/fs/constants.ts"; +export * from "./internal/fs/fs.ts"; export const promises = _promises; diff --git a/src/runtime/node/fs/promises.ts b/src/runtime/node/fs/promises.ts index 04d53447..d546ebf2 100644 --- a/src/runtime/node/fs/promises.ts +++ b/src/runtime/node/fs/promises.ts @@ -1,8 +1,8 @@ import type fsp from "node:fs/promises"; -import * as _promises from "../internal/fs/promises"; +import * as _promises from "../internal/fs/promises.ts"; -export * from "../internal/fs/promises"; +export * from "../internal/fs/promises.ts"; export default { ..._promises, diff --git a/src/runtime/node/http.ts b/src/runtime/node/http.ts index a9582a3e..9a86464a 100644 --- a/src/runtime/node/http.ts +++ b/src/runtime/node/http.ts @@ -1,14 +1,14 @@ // https://nodejs.org/api/http.html import type http from "node:http"; -import { notImplemented, notImplementedClass } from "../_internal/utils"; -import mock from "../mock/proxy"; -import * as consts from "./internal/http/consts"; -import { IncomingMessage } from "./internal/http/request"; -import { ServerResponse } from "./internal/http/response"; +import { notImplemented, notImplementedClass } from "../_internal/utils.ts"; +import mock from "../mock/proxy.ts"; +import * as consts from "./internal/http/consts.ts"; +import { IncomingMessage } from "./internal/http/request.ts"; +import { ServerResponse } from "./internal/http/response.ts"; -export * from "./internal/http/consts"; -export * from "./internal/http/request"; -export * from "./internal/http/response"; +export * from "./internal/http/consts.ts"; +export * from "./internal/http/request.ts"; +export * from "./internal/http/response.ts"; export const createServer = /*@__PURE__*/ notImplemented("http.createServer"); diff --git a/src/runtime/node/http2.ts b/src/runtime/node/http2.ts index 53a9ca34..0d721c88 100644 --- a/src/runtime/node/http2.ts +++ b/src/runtime/node/http2.ts @@ -1,9 +1,9 @@ -import mock from "../mock/proxy"; +import mock from "../mock/proxy.ts"; import type http2 from "node:http2"; -import { notImplemented } from "../_internal/utils"; -import { constants } from "./internal/http2/constants"; +import { notImplemented } from "../_internal/utils.ts"; +import { constants } from "./internal/http2/constants.ts"; -export { constants } from "./internal/http2/constants"; +export { constants } from "./internal/http2/constants.ts"; export const createSecureServer = /*@__PURE__*/ notImplemented< typeof http2.createSecureServer diff --git a/src/runtime/node/https.ts b/src/runtime/node/https.ts index 9b202ad5..84dafa96 100644 --- a/src/runtime/node/https.ts +++ b/src/runtime/node/https.ts @@ -1,7 +1,7 @@ // https://nodejs.org/api/https.html import type nodeHttps from "node:https"; -import { notImplemented, notImplementedClass } from "../_internal/utils"; -import mock from "../mock/proxy"; +import { notImplemented, notImplementedClass } from "../_internal/utils.ts"; +import mock from "../mock/proxy.ts"; export const Server: typeof nodeHttps.Server = /*@__PURE__*/ notImplementedClass("https.Server"); diff --git a/src/runtime/node/inspector.ts b/src/runtime/node/inspector.ts index 5c234d2e..e33a7d59 100644 --- a/src/runtime/node/inspector.ts +++ b/src/runtime/node/inspector.ts @@ -1,6 +1,6 @@ // https://nodejs.org/api/inspector.html -import noop from "../mock/noop"; -import mock from "../mock/proxy"; +import noop from "../mock/noop.ts"; +import mock from "../mock/proxy.ts"; import type inspector from "node:inspector"; export const close: typeof inspector.close = noop; diff --git a/src/runtime/node/internal/async_hooks/async-resource.ts b/src/runtime/node/internal/async_hooks/async-resource.ts index f421e9d9..0770d11d 100644 --- a/src/runtime/node/internal/async_hooks/async-resource.ts +++ b/src/runtime/node/internal/async_hooks/async-resource.ts @@ -1,5 +1,5 @@ import type asyncHooks from "node:async_hooks"; -import { executionAsyncId } from "./async-hook"; +import { executionAsyncId } from "./async-hook.ts"; // https://nodejs.org/api/async_context.html#class-asyncresource diff --git a/src/runtime/node/internal/buffer/buffer.ts b/src/runtime/node/internal/buffer/buffer.ts index ed163087..0a8d2bad 100644 --- a/src/runtime/node/internal/buffer/buffer.ts +++ b/src/runtime/node/internal/buffer/buffer.ts @@ -8,8 +8,8 @@ * @license MIT */ -import * as base64 from "./base64"; -import * as ieee754 from "./ieee754"; +import * as base64 from "./base64.ts"; +import * as ieee754 from "./ieee754.ts"; const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" diff --git a/src/runtime/node/internal/crypto/node.ts b/src/runtime/node/internal/crypto/node.ts index 7850979c..8d6a2616 100644 --- a/src/runtime/node/internal/crypto/node.ts +++ b/src/runtime/node/internal/crypto/node.ts @@ -1,7 +1,10 @@ import type nodeCrypto from "node:crypto"; -import { notImplemented, notImplementedClass } from "../../../_internal/utils"; -import { getRandomValues } from "./web"; +import { + notImplemented, + notImplementedClass, +} from "../../../_internal/utils.ts"; +import { getRandomValues } from "./web.ts"; // limit of Crypto.getRandomValues() // https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues diff --git a/src/runtime/node/internal/diagnostics_channel/channel.ts b/src/runtime/node/internal/diagnostics_channel/channel.ts index 4b974241..2f273ba5 100644 --- a/src/runtime/node/internal/diagnostics_channel/channel.ts +++ b/src/runtime/node/internal/diagnostics_channel/channel.ts @@ -1,4 +1,4 @@ -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import type diagnostics_channel from "node:diagnostics_channel"; const channels: Record = {}; diff --git a/src/runtime/node/internal/diagnostics_channel/tracing-channel.ts b/src/runtime/node/internal/diagnostics_channel/tracing-channel.ts index b3adb210..839aadea 100644 --- a/src/runtime/node/internal/diagnostics_channel/tracing-channel.ts +++ b/src/runtime/node/internal/diagnostics_channel/tracing-channel.ts @@ -1,6 +1,6 @@ -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import type diagnostics_channel from "node:diagnostics_channel"; -import { Channel } from "./channel"; +import { Channel } from "./channel.ts"; export class TracingChannel< StoreType = unknown, diff --git a/src/runtime/node/internal/domain/domain.ts b/src/runtime/node/internal/domain/domain.ts index 32ec2a7d..04fff3d4 100644 --- a/src/runtime/node/internal/domain/domain.ts +++ b/src/runtime/node/internal/domain/domain.ts @@ -1,4 +1,4 @@ -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import { EventEmitter } from "node:events"; import type domain from "node:domain"; diff --git a/src/runtime/node/internal/fs/classes.ts b/src/runtime/node/internal/fs/classes.ts index 172b1bf6..0fa6d8ba 100644 --- a/src/runtime/node/internal/fs/classes.ts +++ b/src/runtime/node/internal/fs/classes.ts @@ -1,5 +1,5 @@ import type fs from "node:fs"; -import mock from "../../../mock/proxy"; +import mock from "../../../mock/proxy.ts"; export const Dir: typeof fs.Dir = mock.__createMock__("fs.Dir"); diff --git a/src/runtime/node/internal/fs/fs.ts b/src/runtime/node/internal/fs/fs.ts index d08300fd..195d37f5 100644 --- a/src/runtime/node/internal/fs/fs.ts +++ b/src/runtime/node/internal/fs/fs.ts @@ -1,6 +1,9 @@ import type fs from "node:fs"; -import { notImplemented, notImplementedAsync } from "../../../_internal/utils"; -import * as fsp from "./promises"; +import { + notImplemented, + notImplementedAsync, +} from "../../../_internal/utils.ts"; +import * as fsp from "./promises.ts"; function callbackify(fn: (...args: any[]) => Promise) { const fnc = function (...args: any[]) { diff --git a/src/runtime/node/internal/fs/promises.ts b/src/runtime/node/internal/fs/promises.ts index 41a42a98..2238b9c4 100644 --- a/src/runtime/node/internal/fs/promises.ts +++ b/src/runtime/node/internal/fs/promises.ts @@ -1,7 +1,7 @@ import type fsp from "node:fs/promises"; -import { notImplemented } from "../../../_internal/utils"; +import { notImplemented } from "../../../_internal/utils.ts"; -export { constants } from "./constants"; +export { constants } from "./constants.ts"; export const access = /*@__PURE__*/ notImplemented("fs.access"); diff --git a/src/runtime/node/internal/http/request.ts b/src/runtime/node/internal/http/request.ts index 92d84474..c5081fe5 100644 --- a/src/runtime/node/internal/http/request.ts +++ b/src/runtime/node/internal/http/request.ts @@ -1,7 +1,6 @@ import type http from "node:http"; import { Socket } from "node:net"; -// TODO: https://github.com/unjs/unenv/issues/365 -import { Readable } from "unenv/node/stream"; +import { Readable } from "node:stream"; import { rawHeaders } from "../../../_internal/utils"; // Docs: https://nodejs.org/api/http.html#http_class_http_incomingmessage diff --git a/src/runtime/node/internal/http/response.ts b/src/runtime/node/internal/http/response.ts index 47b141ab..b7c4601a 100644 --- a/src/runtime/node/internal/http/response.ts +++ b/src/runtime/node/internal/http/response.ts @@ -1,8 +1,7 @@ import type http from "node:http"; import type { Socket } from "node:net"; -import { Callback } from "../../../_internal/types"; -// TODO: https://github.com/unjs/unenv/issues/365 -import { Writable } from "unenv/node/stream"; +import { Callback } from "../../../_internal/types.ts"; +import { Writable } from "node:stream"; // Docs: https://nodejs.org/api/http.html#http_class_http_serverresponse // Implementation: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js diff --git a/src/runtime/node/internal/net/server.ts b/src/runtime/node/internal/net/server.ts index 79af7b80..7b655c4e 100644 --- a/src/runtime/node/internal/net/server.ts +++ b/src/runtime/node/internal/net/server.ts @@ -1,5 +1,5 @@ import type * as net from "node:net"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import { EventEmitter } from "node:events"; // Docs: https://nodejs.org/api/net.html#net_class_net_server diff --git a/src/runtime/node/internal/net/socket.ts b/src/runtime/node/internal/net/socket.ts index 614b9bcd..94db45e4 100644 --- a/src/runtime/node/internal/net/socket.ts +++ b/src/runtime/node/internal/net/socket.ts @@ -1,7 +1,7 @@ import type * as net from "node:net"; -import { Callback, BufferEncoding } from "../../../_internal/types"; +import { Callback, BufferEncoding } from "../../../_internal/types.ts"; // Relative stream import required, see https://github.com/unjs/unenv/issues/353 -import { Duplex } from "../stream/duplex"; +import { Duplex } from "../stream/duplex.ts"; // Docs: https://nodejs.org/api/net.html#net_class_net_socket export class Socket extends Duplex implements net.Socket { diff --git a/src/runtime/node/internal/os/constants.ts b/src/runtime/node/internal/os/constants.ts index 8b95f62a..cf587154 100644 --- a/src/runtime/node/internal/os/constants.ts +++ b/src/runtime/node/internal/os/constants.ts @@ -1,5 +1,5 @@ import type os from "node:os"; -import osConstants from "../constants/os"; +import osConstants from "../constants/os.ts"; export const constants: typeof os.constants = { ...osConstants, diff --git a/src/runtime/node/internal/perf_hooks/histogram.ts b/src/runtime/node/internal/perf_hooks/histogram.ts index fc1ff76f..366eac1d 100644 --- a/src/runtime/node/internal/perf_hooks/histogram.ts +++ b/src/runtime/node/internal/perf_hooks/histogram.ts @@ -1,5 +1,5 @@ import type perf_hooks from "node:perf_hooks"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; class Histogram implements perf_hooks.Histogram { min = 9_223_372_036_854_776_000; diff --git a/src/runtime/node/internal/perf_hooks/performance.ts b/src/runtime/node/internal/perf_hooks/performance.ts index 0557015f..e8802b70 100644 --- a/src/runtime/node/internal/perf_hooks/performance.ts +++ b/src/runtime/node/internal/perf_hooks/performance.ts @@ -1,5 +1,5 @@ import type perf_hooks from "node:perf_hooks"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import { _Performance, _PerformanceMark, @@ -7,7 +7,7 @@ import { _PerformanceObserver, _PerformanceObserverEntryList, _PerformanceResourceTiming, -} from "../../../web/performance/index"; +} from "../../../web/performance/index.ts"; // Non modified APIs export { @@ -15,7 +15,7 @@ export { PerformanceObserverEntryList, PerformanceEntry, PerformanceMeasure, -} from "../../../web/performance/index"; +} from "../../../web/performance/index.ts"; const nodeTiming = { name: "node", diff --git a/src/runtime/node/internal/process/process.ts b/src/runtime/node/internal/process/process.ts index 488eae43..1fd3b371 100644 --- a/src/runtime/node/internal/process/process.ts +++ b/src/runtime/node/internal/process/process.ts @@ -1,14 +1,14 @@ // Source: https://github.com/defunctzombie/node-process/blob/77caa43cdaee4ea710aa14d11cea1705293c0ef3/browser.js import type nodeProcess from "node:process"; import { ReadStream, WriteStream } from "node:tty"; -import empty from "../../../mock/empty"; -import { notImplemented } from "../../../_internal/utils"; -import { env } from "./env"; -import { hrtime, nextTick } from "./time"; +import empty from "../../../mock/empty.ts"; +import { notImplemented } from "../../../_internal/utils.ts"; +import { env } from "./env.ts"; +import { hrtime, nextTick } from "./time.ts"; -export { hrtime, nextTick } from "./time"; +export { hrtime, nextTick } from "./time.ts"; -export { env } from "./env"; +export { env } from "./env.ts"; type Process = NodeJS.Process; diff --git a/src/runtime/node/internal/readline/promises/interface.ts b/src/runtime/node/internal/readline/promises/interface.ts index 85cbb6ff..d03cdc2a 100644 --- a/src/runtime/node/internal/readline/promises/interface.ts +++ b/src/runtime/node/internal/readline/promises/interface.ts @@ -1,6 +1,6 @@ import type readline from "node:readline/promises"; import type { Abortable } from "node:events"; -import { Interface as _Interface } from "../interface"; +import { Interface as _Interface } from "../interface.ts"; export class Interface extends _Interface implements readline.Interface { question(query: string): Promise; diff --git a/src/runtime/node/internal/stream/duplex.ts b/src/runtime/node/internal/stream/duplex.ts index 87ad0647..decfa981 100644 --- a/src/runtime/node/internal/stream/duplex.ts +++ b/src/runtime/node/internal/stream/duplex.ts @@ -1,7 +1,7 @@ import type * as stream from "node:stream"; -import { mergeFns } from "../../../_internal/utils"; -import { Readable } from "./readable"; -import { Writable } from "./writable"; +import { mergeFns } from "../../../_internal/utils.ts"; +import { Readable } from "./readable.ts"; +import { Writable } from "./writable.ts"; // Docs: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams // Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/duplex.js diff --git a/src/runtime/node/internal/stream/readable.ts b/src/runtime/node/internal/stream/readable.ts index b06216f1..48aba4ea 100644 --- a/src/runtime/node/internal/stream/readable.ts +++ b/src/runtime/node/internal/stream/readable.ts @@ -1,6 +1,6 @@ import type * as stream from "node:stream"; -import type { BufferEncoding, Callback } from "../../../_internal/types"; -import { createNotImplementedError } from "../../../_internal/utils"; +import type { BufferEncoding, Callback } from "../../../_internal/types.ts"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import { EventEmitter } from "node:events"; // Docs: https://nodejs.org/api/stream.html#stream_readable_streams diff --git a/src/runtime/node/internal/stream/transform.ts b/src/runtime/node/internal/stream/transform.ts index b6fecb15..c74ecb29 100644 --- a/src/runtime/node/internal/stream/transform.ts +++ b/src/runtime/node/internal/stream/transform.ts @@ -1,5 +1,5 @@ import type * as stream from "node:stream"; -import { Duplex } from "./duplex"; +import { Duplex } from "./duplex.ts"; // Docs: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams // Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/transform.js diff --git a/src/runtime/node/internal/stream/writable.ts b/src/runtime/node/internal/stream/writable.ts index bb48e6a8..7e382173 100644 --- a/src/runtime/node/internal/stream/writable.ts +++ b/src/runtime/node/internal/stream/writable.ts @@ -1,5 +1,5 @@ import type * as stream from "node:stream"; -import type { BufferEncoding, Callback } from "../../../_internal/types"; +import type { BufferEncoding, Callback } from "../../../_internal/types.ts"; import { EventEmitter } from "node:events"; diff --git a/src/runtime/node/internal/timers/set-immediate.ts b/src/runtime/node/internal/timers/set-immediate.ts index 7db2eb1c..a255f1b5 100644 --- a/src/runtime/node/internal/timers/set-immediate.ts +++ b/src/runtime/node/internal/timers/set-immediate.ts @@ -1,4 +1,4 @@ -import { Immediate } from "./immediate"; +import { Immediate } from "./immediate.ts"; export function setImmediateFallbackPromises(value?: T): Promise { return new Promise((res) => { diff --git a/src/runtime/node/internal/timers/set-interval.ts b/src/runtime/node/internal/timers/set-interval.ts index 1cf4ef24..ddfbe35d 100644 --- a/src/runtime/node/internal/timers/set-interval.ts +++ b/src/runtime/node/internal/timers/set-interval.ts @@ -1,4 +1,4 @@ -import { Timeout } from "./timeout"; +import { Timeout } from "./timeout.ts"; export async function* setIntervalFallbackPromises( delay?: number, diff --git a/src/runtime/node/internal/timers/set-timeout.ts b/src/runtime/node/internal/timers/set-timeout.ts index 3f146375..d0aadae1 100644 --- a/src/runtime/node/internal/timers/set-timeout.ts +++ b/src/runtime/node/internal/timers/set-timeout.ts @@ -1,5 +1,5 @@ import type nodeTimers from "node:timers"; -import { Timeout } from "./timeout"; +import { Timeout } from "./timeout.ts"; export function setTimeoutFallbackPromises( delay?: number, diff --git a/src/runtime/node/internal/tls/server.ts b/src/runtime/node/internal/tls/server.ts index 273fe279..68f81d99 100644 --- a/src/runtime/node/internal/tls/server.ts +++ b/src/runtime/node/internal/tls/server.ts @@ -1,5 +1,5 @@ import type tls from "node:tls"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; import { Server as _Server } from "node:net"; export class Server extends _Server implements tls.Server { diff --git a/src/runtime/node/internal/tls/tls-socket.ts b/src/runtime/node/internal/tls/tls-socket.ts index 751e65b0..4373edaf 100644 --- a/src/runtime/node/internal/tls/tls-socket.ts +++ b/src/runtime/node/internal/tls/tls-socket.ts @@ -1,6 +1,6 @@ import type tls from "node:tls"; import { Socket } from "node:net"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; export class TLSSocket extends Socket implements tls.TLSSocket { authorized = false; diff --git a/src/runtime/node/internal/url/url.ts b/src/runtime/node/internal/url/url.ts index c6ee2c65..6fd4ef61 100644 --- a/src/runtime/node/internal/url/url.ts +++ b/src/runtime/node/internal/url/url.ts @@ -2,14 +2,14 @@ import path from "node:path"; -import * as punnycode from "../../punycode"; +import * as punnycode from "../../punycode.ts"; import { CHAR_FORWARD_SLASH, CHAR_BACKWARD_SLASH, CHAR_LOWERCASE_A, CHAR_LOWERCASE_Z, -} from "./constants"; +} from "./constants.ts"; import { ERR_INVALID_ARG_TYPE, @@ -17,7 +17,7 @@ import { ERR_INVALID_URL_SCHEME, ERR_INVALID_FILE_URL_PATH, ERR_INVALID_FILE_URL_HOST, -} from "./errors"; +} from "./errors.ts"; // Protocols that can allow "unsafe" and "unwise" chars. export const unsafeProtocol = new Set(["javascript", "javascript:"]); diff --git a/src/runtime/node/internal/util/types.ts b/src/runtime/node/internal/util/types.ts index f923a319..a5dad552 100644 --- a/src/runtime/node/internal/util/types.ts +++ b/src/runtime/node/internal/util/types.ts @@ -1,5 +1,5 @@ import type utilTypes from "node:util/types"; -import { notImplemented } from "../../../_internal/utils"; +import { notImplemented } from "../../../_internal/utils.ts"; export const isExternal: typeof utilTypes.isExternal = (_obj) => false; diff --git a/src/runtime/node/internal/vm/script.ts b/src/runtime/node/internal/vm/script.ts index c50f5496..3dcb9d7c 100644 --- a/src/runtime/node/internal/vm/script.ts +++ b/src/runtime/node/internal/vm/script.ts @@ -1,5 +1,5 @@ import type vm from "node:vm"; -import { createNotImplementedError } from "../../../_internal/utils"; +import { createNotImplementedError } from "../../../_internal/utils.ts"; export class Script implements vm.Script { runInContext( diff --git a/src/runtime/node/internal/worker_threads/message-channel.ts b/src/runtime/node/internal/worker_threads/message-channel.ts index 4d3d9eb6..67686812 100644 --- a/src/runtime/node/internal/worker_threads/message-channel.ts +++ b/src/runtime/node/internal/worker_threads/message-channel.ts @@ -1,4 +1,4 @@ -import { MessagePort } from "./message-port"; +import { MessagePort } from "./message-port.ts"; import type worker_threads from "node:worker_threads"; export class MessageChannel implements worker_threads.MessageChannel { diff --git a/src/runtime/node/internal/zlib/formats/_shared.ts b/src/runtime/node/internal/zlib/formats/_shared.ts index 826e126a..440dcb70 100644 --- a/src/runtime/node/internal/zlib/formats/_shared.ts +++ b/src/runtime/node/internal/zlib/formats/_shared.ts @@ -1,6 +1,6 @@ import type zlib from "node:zlib"; import { Transform, type TransformOptions } from "node:stream"; -import { createNotImplementedError } from "../../../../_internal/utils"; +import { createNotImplementedError } from "../../../../_internal/utils.ts"; // Compression diff --git a/src/runtime/node/internal/zlib/formats/brotli.ts b/src/runtime/node/internal/zlib/formats/brotli.ts index 0a6aa789..37ab5542 100644 --- a/src/runtime/node/internal/zlib/formats/brotli.ts +++ b/src/runtime/node/internal/zlib/formats/brotli.ts @@ -1,10 +1,10 @@ import type zlib from "node:zlib"; -import { notImplemented } from "../../../../_internal/utils"; +import { notImplemented } from "../../../../_internal/utils.ts"; import { ZlibCompress, ZLibDecompress, notImplementedCompress, -} from "./_shared"; +} from "./_shared.ts"; // Brotli Compression diff --git a/src/runtime/node/internal/zlib/formats/deflate.ts b/src/runtime/node/internal/zlib/formats/deflate.ts index 5e238cdb..96fb2a57 100644 --- a/src/runtime/node/internal/zlib/formats/deflate.ts +++ b/src/runtime/node/internal/zlib/formats/deflate.ts @@ -1,11 +1,11 @@ import type zlib from "node:zlib"; -import { createNotImplementedError } from "../../../../_internal/utils"; -import { notImplemented } from "../../../../_internal/utils"; +import { createNotImplementedError } from "../../../../_internal/utils.ts"; +import { notImplemented } from "../../../../_internal/utils.ts"; import { ZlibCompress, ZLibDecompress, notImplementedCompress, -} from "./_shared"; +} from "./_shared.ts"; // Deflate Compression diff --git a/src/runtime/node/internal/zlib/formats/gzip.ts b/src/runtime/node/internal/zlib/formats/gzip.ts index 2cb6b689..91b146de 100644 --- a/src/runtime/node/internal/zlib/formats/gzip.ts +++ b/src/runtime/node/internal/zlib/formats/gzip.ts @@ -1,10 +1,10 @@ import type zlib from "node:zlib"; -import { notImplemented } from "../../../../_internal/utils"; +import { notImplemented } from "../../../../_internal/utils.ts"; import { ZlibCompress, ZLibDecompress, notImplementedCompress, -} from "./_shared"; +} from "./_shared.ts"; // Gzip Compression diff --git a/src/runtime/node/internal/zlib/formats/zip.ts b/src/runtime/node/internal/zlib/formats/zip.ts index faf92451..b091ed2f 100644 --- a/src/runtime/node/internal/zlib/formats/zip.ts +++ b/src/runtime/node/internal/zlib/formats/zip.ts @@ -1,6 +1,6 @@ import type zlib from "node:zlib"; -import { notImplemented } from "../../../../_internal/utils"; -import { ZlibCompress } from "./_shared"; +import { notImplemented } from "../../../../_internal/utils.ts"; +import { ZlibCompress } from "./_shared.ts"; // Zip Decompression diff --git a/src/runtime/node/module.ts b/src/runtime/node/module.ts index a74fb55b..d814d858 100644 --- a/src/runtime/node/module.ts +++ b/src/runtime/node/module.ts @@ -1,6 +1,6 @@ // https://nodejs.org/api/module.html import type nodeModule from "node:module"; -import { notImplemented, notImplementedClass } from "../_internal/utils"; +import { notImplemented, notImplementedClass } from "../_internal/utils.ts"; export const _cache = Object.create(null); diff --git a/src/runtime/node/net.ts b/src/runtime/node/net.ts index 77e72597..f1bc5629 100644 --- a/src/runtime/node/net.ts +++ b/src/runtime/node/net.ts @@ -1,15 +1,19 @@ // https://nodejs.org/api/net.html import type net from "node:net"; -import { notImplemented, notImplementedClass } from "../_internal/utils"; +import { notImplemented, notImplementedClass } from "../_internal/utils.ts"; -import { Socket, SocketAddress } from "./internal/net/socket"; -import { Server } from "./internal/net/server"; +import { Socket, SocketAddress } from "./internal/net/socket.ts"; +import { Server } from "./internal/net/server.ts"; -export { Server } from "./internal/net/server"; +export { Server } from "./internal/net/server.ts"; // require('node:net').Socket === require('node:net').Stream -export { Socket, SocketAddress, Socket as Stream } from "./internal/net/socket"; +export { + Socket, + SocketAddress, + Socket as Stream, +} from "./internal/net/socket.ts"; export const createServer = /*@__PURE__*/ notImplemented( "net.createServer", diff --git a/src/runtime/node/os.ts b/src/runtime/node/os.ts index b4986dac..db07a226 100644 --- a/src/runtime/node/os.ts +++ b/src/runtime/node/os.ts @@ -1,8 +1,8 @@ import type os from "node:os"; -import { notImplemented } from "../_internal/utils"; -import { constants } from "./internal/os/constants"; +import { notImplemented } from "../_internal/utils.ts"; +import { constants } from "./internal/os/constants.ts"; -export { constants } from "./internal/os/constants"; +export { constants } from "./internal/os/constants.ts"; const NUM_CPUS = 8; diff --git a/src/runtime/node/path.ts b/src/runtime/node/path.ts index e0fc12bf..1af11862 100644 --- a/src/runtime/node/path.ts +++ b/src/runtime/node/path.ts @@ -2,7 +2,7 @@ // https://github.com/unjs/pathe import type nodePath from "node:path"; -import { notImplemented } from "../_internal/utils"; +import { notImplemented } from "../_internal/utils.ts"; import * as _path from "pathe"; export * from "pathe"; diff --git a/src/runtime/node/path/posix.ts b/src/runtime/node/path/posix.ts index ebc8053e..f6e24a2c 100644 --- a/src/runtime/node/path/posix.ts +++ b/src/runtime/node/path/posix.ts @@ -1,2 +1,2 @@ -export * from "../path"; -export { default } from "../path"; +export * from "../path.ts"; +export { default } from "../path.ts"; diff --git a/src/runtime/node/path/win32.ts b/src/runtime/node/path/win32.ts index ebc8053e..f6e24a2c 100644 --- a/src/runtime/node/path/win32.ts +++ b/src/runtime/node/path/win32.ts @@ -1,2 +1,2 @@ -export * from "../path"; -export { default } from "../path"; +export * from "../path.ts"; +export { default } from "../path.ts"; diff --git a/src/runtime/node/perf_hooks.ts b/src/runtime/node/perf_hooks.ts index 1acb1188..08b002a5 100644 --- a/src/runtime/node/perf_hooks.ts +++ b/src/runtime/node/perf_hooks.ts @@ -2,8 +2,8 @@ import type perf_hooks from "node:perf_hooks"; import { IntervalHistogram, RecordableHistogram, -} from "./internal/perf_hooks/histogram"; -import { constants } from "./internal/perf_hooks/constants"; +} from "./internal/perf_hooks/histogram.ts"; +import { constants } from "./internal/perf_hooks/constants.ts"; import { performance, Performance, @@ -13,10 +13,10 @@ import { PerformanceObserverEntryList, PerformanceObserver, PerformanceResourceTiming, -} from "./internal/perf_hooks/performance"; -export { constants } from "./internal/perf_hooks/constants"; +} from "./internal/perf_hooks/performance.ts"; +export { constants } from "./internal/perf_hooks/constants.ts"; -export * from "./internal/perf_hooks/performance"; +export * from "./internal/perf_hooks/performance.ts"; export const monitorEventLoopDelay: typeof perf_hooks.monitorEventLoopDelay = function (_options) { diff --git a/src/runtime/node/process.ts b/src/runtime/node/process.ts index 700cc62f..6c1d1521 100644 --- a/src/runtime/node/process.ts +++ b/src/runtime/node/process.ts @@ -1,8 +1,8 @@ // https://nodejs.org/api/process.html import type nodeProcess from "node:process"; -import { process as unenvProcess } from "./internal/process/process"; +import { process as unenvProcess } from "./internal/process/process.ts"; -export * from "./internal/process/process"; +export * from "./internal/process/process.ts"; export default unenvProcess as unknown as typeof nodeProcess; diff --git a/src/runtime/node/punycode.ts b/src/runtime/node/punycode.ts index 094e7d93..ece73c21 100644 --- a/src/runtime/node/punycode.ts +++ b/src/runtime/node/punycode.ts @@ -1,7 +1,7 @@ import type punycode from "node:punycode"; -import _punycode from "./internal/punycode/punycode"; +import _punycode from "./internal/punycode/punycode.ts"; -export * from "./internal/punycode/punycode"; +export * from "./internal/punycode/punycode.ts"; export default _punycode satisfies typeof punycode; diff --git a/src/runtime/node/querystring.ts b/src/runtime/node/querystring.ts index cf75bb83..f9026ad7 100644 --- a/src/runtime/node/querystring.ts +++ b/src/runtime/node/querystring.ts @@ -25,7 +25,7 @@ import { encodeStr, hexTable, isHexTable, -} from "./internal/querystring/querystring"; +} from "./internal/querystring/querystring.ts"; // prettier-ignore const unhexTable = new Int8Array([ diff --git a/src/runtime/node/readline.ts b/src/runtime/node/readline.ts index ce6765b3..2f006097 100644 --- a/src/runtime/node/readline.ts +++ b/src/runtime/node/readline.ts @@ -1,11 +1,11 @@ // https://nodejs.org/api/readline.html#readlineclearlinestream-dir-callback import type readline from "node:readline"; -import noop from "../mock/noop"; -import promises from "./readline/promises"; -import { Interface } from "./internal/readline/interface"; +import noop from "../mock/noop.ts"; +import promises from "./readline/promises.ts"; +import { Interface } from "./internal/readline/interface.ts"; -export * as promises from "./readline/promises"; -export { Interface } from "./internal/readline/interface"; +export * as promises from "./readline/promises.ts"; +export { Interface } from "./internal/readline/interface.ts"; export const clearLine: typeof readline.clearLine = () => false; export const clearScreenDown: typeof readline.clearScreenDown = () => false; diff --git a/src/runtime/node/readline/promises.ts b/src/runtime/node/readline/promises.ts index d8ec5cda..3dead716 100644 --- a/src/runtime/node/readline/promises.ts +++ b/src/runtime/node/readline/promises.ts @@ -1,9 +1,9 @@ import type readline from "node:readline/promises"; -import { Interface } from "../internal/readline/promises/interface"; -import { Readline } from "../internal/readline/promises/readline"; +import { Interface } from "../internal/readline/promises/interface.ts"; +import { Readline } from "../internal/readline/promises/readline.ts"; -export { Interface } from "../internal/readline/promises/interface"; -export { Readline } from "../internal/readline/promises/readline"; +export { Interface } from "../internal/readline/promises/interface.ts"; +export { Readline } from "../internal/readline/promises/readline.ts"; export const createInterface: typeof readline.createInterface = () => new Interface(); diff --git a/src/runtime/node/stream.ts b/src/runtime/node/stream.ts index a36252bc..255cbd7e 100644 --- a/src/runtime/node/stream.ts +++ b/src/runtime/node/stream.ts @@ -1,18 +1,18 @@ // https://nodejs.org/api/stream.html import type stream from "node:stream"; -import mock from "../mock/proxy"; -import { notImplemented } from "../_internal/utils"; -import { Readable } from "./internal/stream/readable"; -import { Writable } from "./internal/stream/writable"; -import { Duplex } from "./internal/stream/duplex"; -import { Transform } from "./internal/stream/transform"; +import mock from "../mock/proxy.ts"; +import { notImplemented } from "../_internal/utils.ts"; +import { Readable } from "./internal/stream/readable.ts"; +import { Writable } from "./internal/stream/writable.ts"; +import { Duplex } from "./internal/stream/duplex.ts"; +import { Transform } from "./internal/stream/transform.ts"; -import promises from "./stream/promises"; +import promises from "./stream/promises.ts"; -export { Readable } from "./internal/stream/readable"; -export { Writable } from "./internal/stream/writable"; -export { Duplex } from "./internal/stream/duplex"; -export { Transform } from "./internal/stream/transform"; +export { Readable } from "./internal/stream/readable.ts"; +export { Writable } from "./internal/stream/writable.ts"; +export { Duplex } from "./internal/stream/duplex.ts"; +export { Transform } from "./internal/stream/transform.ts"; export const Stream: stream.Stream = mock.__createMock__("Stream"); export const PassThrough: stream.PassThrough = diff --git a/src/runtime/node/stream/consumers.ts b/src/runtime/node/stream/consumers.ts index 1c920b17..d247504a 100644 --- a/src/runtime/node/stream/consumers.ts +++ b/src/runtime/node/stream/consumers.ts @@ -1,5 +1,5 @@ import type * as streamConsumers from "node:stream/consumers"; -import { notImplemented } from "../../_internal/utils"; +import { notImplemented } from "../../_internal/utils.ts"; export const arrayBuffer = /*@__PURE__*/ notImplemented( "stream.consumers.arrayBuffer", diff --git a/src/runtime/node/stream/promises.ts b/src/runtime/node/stream/promises.ts index 8c226e89..394f58a4 100644 --- a/src/runtime/node/stream/promises.ts +++ b/src/runtime/node/stream/promises.ts @@ -1,5 +1,5 @@ import type * as streamPromises from "node:stream/promises"; -import { notImplemented } from "../../_internal/utils"; +import { notImplemented } from "../../_internal/utils.ts"; export const finished = /*@__PURE__*/ notImplemented( "stream.promises.finished", diff --git a/src/runtime/node/stream/web.ts b/src/runtime/node/stream/web.ts index f6972472..41f5f93a 100644 --- a/src/runtime/node/stream/web.ts +++ b/src/runtime/node/stream/web.ts @@ -1,5 +1,5 @@ import type * as streamWeb from "node:stream/web"; -import { notImplemented } from "../../_internal/utils"; +import { notImplemented } from "../../_internal/utils.ts"; export const ReadableStream = globalThis.ReadableStream || diff --git a/src/runtime/node/string_decoder.ts b/src/runtime/node/string_decoder.ts index 62c4ea1a..7c2ce632 100644 --- a/src/runtime/node/string_decoder.ts +++ b/src/runtime/node/string_decoder.ts @@ -1,6 +1,6 @@ // https://nodejs.org/api/string_decoder.html import type stringDecoder from "node:string_decoder"; -import { notImplementedClass } from "../_internal/utils"; +import { notImplementedClass } from "../_internal/utils.ts"; export const StringDecoder: typeof stringDecoder.StringDecoder = (globalThis as any).StringDecoder || diff --git a/src/runtime/node/sys.ts b/src/runtime/node/sys.ts index dcc0d503..f2c80296 100644 --- a/src/runtime/node/sys.ts +++ b/src/runtime/node/sys.ts @@ -1,2 +1,2 @@ -export * from "./util"; -export { default } from "./util"; +export * from "./util.ts"; +export { default } from "./util.ts"; diff --git a/src/runtime/node/timers.ts b/src/runtime/node/timers.ts index d22a9882..518506a6 100644 --- a/src/runtime/node/timers.ts +++ b/src/runtime/node/timers.ts @@ -1,15 +1,15 @@ -import { notImplemented } from "../_internal/utils"; -import noop from "../mock/noop"; +import { notImplemented } from "../_internal/utils.ts"; +import noop from "../mock/noop.ts"; import type timers from "node:timers"; -import promises from "./timers/promises"; -import { setTimeoutFallback } from "./internal/timers/set-timeout"; +import promises from "./timers/promises.ts"; +import { setTimeoutFallback } from "./internal/timers/set-timeout.ts"; import { setImmediateFallback, clearImmediateFallback, -} from "./internal/timers/set-immediate"; -import { setIntervalFallback } from "./internal/timers/set-interval"; +} from "./internal/timers/set-immediate.ts"; +import { setIntervalFallback } from "./internal/timers/set-interval.ts"; -export * as promises from "./timers/promises"; +export * as promises from "./timers/promises.ts"; export const clearImmediate: typeof timers.clearImmediate = globalThis.clearImmediate?.bind(globalThis) || clearImmediateFallback; diff --git a/src/runtime/node/timers/promises.ts b/src/runtime/node/timers/promises.ts index b8537530..41e1c912 100644 --- a/src/runtime/node/timers/promises.ts +++ b/src/runtime/node/timers/promises.ts @@ -1,12 +1,12 @@ import type timers from "node:timers/promises"; -import { Scheduler } from "../internal/timers/scheduler"; -import { setTimeoutFallbackPromises } from "../internal/timers/set-timeout"; -import { setIntervalFallbackPromises } from "../internal/timers/set-interval"; -import { setImmediateFallbackPromises } from "../internal/timers/set-immediate"; +import { Scheduler } from "../internal/timers/scheduler.ts"; +import { setTimeoutFallbackPromises } from "../internal/timers/set-timeout.ts"; +import { setIntervalFallbackPromises } from "../internal/timers/set-interval.ts"; +import { setImmediateFallbackPromises } from "../internal/timers/set-immediate.ts"; -export { setTimeoutFallbackPromises as setTimeout } from "../internal/timers/set-timeout"; -export { setIntervalFallbackPromises as setInterval } from "../internal/timers/set-interval"; -export { setImmediateFallbackPromises as setImmediate } from "../internal/timers/set-immediate"; +export { setTimeoutFallbackPromises as setTimeout } from "../internal/timers/set-timeout.ts"; +export { setIntervalFallbackPromises as setInterval } from "../internal/timers/set-interval.ts"; +export { setImmediateFallbackPromises as setImmediate } from "../internal/timers/set-immediate.ts"; export const scheduler = new Scheduler(); diff --git a/src/runtime/node/tls.ts b/src/runtime/node/tls.ts index f9587b76..56375321 100644 --- a/src/runtime/node/tls.ts +++ b/src/runtime/node/tls.ts @@ -1,14 +1,14 @@ import type tls from "node:tls"; -import { notImplemented } from "../_internal/utils"; -import { TLSSocket } from "./internal/tls/tls-socket"; -import { Server } from "./internal/tls/server"; -import { SecureContext } from "./internal/tls/secure-context"; -import * as constants from "./internal/tls/constants"; +import { notImplemented } from "../_internal/utils.ts"; +import { TLSSocket } from "./internal/tls/tls-socket.ts"; +import { Server } from "./internal/tls/server.ts"; +import { SecureContext } from "./internal/tls/secure-context.ts"; +import * as constants from "./internal/tls/constants.ts"; -export * from "./internal/tls/constants"; -export { TLSSocket } from "./internal/tls/tls-socket"; -export { Server } from "./internal/tls/server"; -export { SecureContext } from "./internal/tls/secure-context"; +export * from "./internal/tls/constants.ts"; +export { TLSSocket } from "./internal/tls/tls-socket.ts"; +export { Server } from "./internal/tls/server.ts"; +export { SecureContext } from "./internal/tls/secure-context.ts"; export const connect: typeof tls.connect = function connect() { return new TLSSocket(); diff --git a/src/runtime/node/trace_events.ts b/src/runtime/node/trace_events.ts index 82fc3b34..b0b62c68 100644 --- a/src/runtime/node/trace_events.ts +++ b/src/runtime/node/trace_events.ts @@ -1,5 +1,5 @@ import type trace_events from "node:trace_events"; -import { Tracing } from "./internal/trace_events/tracing"; +import { Tracing } from "./internal/trace_events/tracing.ts"; export const createTracing: typeof trace_events.createTracing = function () { return new Tracing(); diff --git a/src/runtime/node/tty.ts b/src/runtime/node/tty.ts index 9362fbc9..005e9b6c 100644 --- a/src/runtime/node/tty.ts +++ b/src/runtime/node/tty.ts @@ -1,9 +1,9 @@ import type tty from "node:tty"; -import { ReadStream } from "./internal/tty/read-stream"; -import { WriteStream } from "./internal/tty/write-stream"; +import { ReadStream } from "./internal/tty/read-stream.ts"; +import { WriteStream } from "./internal/tty/write-stream.ts"; -export { ReadStream } from "./internal/tty/read-stream"; -export { WriteStream } from "./internal/tty/write-stream"; +export { ReadStream } from "./internal/tty/read-stream.ts"; +export { WriteStream } from "./internal/tty/write-stream.ts"; export const isatty: typeof tty.isatty = function () { return false; diff --git a/src/runtime/node/url.ts b/src/runtime/node/url.ts index be57b0ec..c3038851 100644 --- a/src/runtime/node/url.ts +++ b/src/runtime/node/url.ts @@ -25,13 +25,16 @@ import type nodeUrl from "node:url"; import * as querystring from "node:querystring"; -import * as punnycode from "./punycode"; +import * as punnycode from "./punycode.ts"; -import { encodeStr, hexTable } from "./internal/querystring/querystring"; +import { encodeStr, hexTable } from "./internal/querystring/querystring.ts"; -import { spliceOne } from "./internal/url/util"; +import { spliceOne } from "./internal/url/util.ts"; -import { ERR_INVALID_ARG_TYPE, ERR_INVALID_URL } from "./internal/url/errors"; +import { + ERR_INVALID_ARG_TYPE, + ERR_INVALID_URL, +} from "./internal/url/errors.ts"; import { pathToFileURL as _pathToFileURL, @@ -40,7 +43,7 @@ import { hostlessProtocol, slashedProtocol, urlToHttpOptions, -} from "./internal/url/url"; +} from "./internal/url/url.ts"; import { CHAR_SPACE, @@ -68,7 +71,7 @@ import { CHAR_VERTICAL_LINE, CHAR_AT, CHAR_COLON, -} from "./internal/url/constants"; +} from "./internal/url/constants.ts"; class Url implements nodeUrl.Url { auth: string | null = null; diff --git a/src/runtime/node/util.ts b/src/runtime/node/util.ts index f2644cae..10b87683 100644 --- a/src/runtime/node/util.ts +++ b/src/runtime/node/util.ts @@ -1,20 +1,20 @@ // https://nodejs.org/api/util.html import type util from "node:util"; -import { notImplemented } from "../_internal/utils"; -import inherits from "../npm/inherits"; -import * as legacyTypes from "./internal/util/legacy-types"; -import * as logUtils from "./internal/util/log"; -import types from "./util/types"; -import { promisify } from "./internal/util/promisify"; -import * as mime from "./internal/util/mime"; +import { notImplemented } from "../_internal/utils.ts"; +import inherits from "../npm/inherits.ts"; +import * as legacyTypes from "./internal/util/legacy-types.ts"; +import * as logUtils from "./internal/util/log.ts"; +import types from "./util/types.ts"; +import { promisify } from "./internal/util/promisify.ts"; +import * as mime from "./internal/util/mime.ts"; -export * from "./internal/util/mime"; -export * from "./internal/util/legacy-types"; -export * from "./internal/util/log"; +export * from "./internal/util/mime.ts"; +export * from "./internal/util/legacy-types.ts"; +export * from "./internal/util/log.ts"; -export { default as inherits } from "../npm/inherits"; -export { promisify } from "./internal/util/promisify"; -export { default as types } from "./util/types"; +export { default as inherits } from "../npm/inherits.ts"; +export { promisify } from "./internal/util/promisify.ts"; +export { default as types } from "./util/types.ts"; // @ts-ignore export const TextDecoder: typeof util.TextDecoder = globalThis.TextDecoder; diff --git a/src/runtime/node/util/types.ts b/src/runtime/node/util/types.ts index 36ec8f27..d57175eb 100644 --- a/src/runtime/node/util/types.ts +++ b/src/runtime/node/util/types.ts @@ -1,7 +1,7 @@ import type utilTypes from "node:util/types"; -import * as types from "../internal/util/types"; +import * as types from "../internal/util/types.ts"; -export * from "../internal/util/types"; +export * from "../internal/util/types.ts"; export default types; diff --git a/src/runtime/node/v8.ts b/src/runtime/node/v8.ts index 37dafe95..7756e828 100644 --- a/src/runtime/node/v8.ts +++ b/src/runtime/node/v8.ts @@ -1,13 +1,19 @@ -import noop from "../mock/noop"; +import noop from "../mock/noop.ts"; import type v8 from "node:v8"; import { Readable } from "node:stream"; -import { Deserializer, DefaultDeserializer } from "./internal/v8/deserializer"; -import { Serializer, DefaultSerializer } from "./internal/v8/serializer"; -import { GCProfiler } from "./internal/v8/profiler"; +import { + Deserializer, + DefaultDeserializer, +} from "./internal/v8/deserializer.ts"; +import { Serializer, DefaultSerializer } from "./internal/v8/serializer.ts"; +import { GCProfiler } from "./internal/v8/profiler.ts"; -export { Deserializer, DefaultDeserializer } from "./internal/v8/deserializer"; -export { Serializer, DefaultSerializer } from "./internal/v8/serializer"; -export { GCProfiler } from "./internal/v8/profiler"; +export { + Deserializer, + DefaultDeserializer, +} from "./internal/v8/deserializer.ts"; +export { Serializer, DefaultSerializer } from "./internal/v8/serializer.ts"; +export { GCProfiler } from "./internal/v8/profiler.ts"; const getMockHeapSpaceStats = (name: string) => ({ space_name: name, diff --git a/src/runtime/node/vm.ts b/src/runtime/node/vm.ts index 13b25323..3d84cdb6 100644 --- a/src/runtime/node/vm.ts +++ b/src/runtime/node/vm.ts @@ -1,10 +1,10 @@ import type vm from "node:vm"; -import { notImplemented } from "../_internal/utils"; -import { Script } from "./internal/vm/script"; -import * as constants from "./internal/vm/constants"; +import { notImplemented } from "../_internal/utils.ts"; +import { Script } from "./internal/vm/script.ts"; +import * as constants from "./internal/vm/constants.ts"; -export { Script } from "./internal/vm/script"; -export * as constants from "./internal/vm/constants"; +export { Script } from "./internal/vm/script.ts"; +export * as constants from "./internal/vm/constants.ts"; export const compileFunction: typeof vm.compileFunction = /*@__PURE__*/ notImplemented("vm.compileFunction"); diff --git a/src/runtime/node/wasi.ts b/src/runtime/node/wasi.ts index 6bd88c53..03e5ade3 100644 --- a/src/runtime/node/wasi.ts +++ b/src/runtime/node/wasi.ts @@ -1,5 +1,5 @@ import type wasi from "node:wasi"; -import { notImplementedClass } from "../_internal/utils"; +import { notImplementedClass } from "../_internal/utils.ts"; export const WASI: typeof wasi.WASI = /*@__PURE__*/ notImplementedClass("wasi.WASI"); diff --git a/src/runtime/node/worker_threads.ts b/src/runtime/node/worker_threads.ts index 8d758eeb..d42c3cdf 100644 --- a/src/runtime/node/worker_threads.ts +++ b/src/runtime/node/worker_threads.ts @@ -1,15 +1,15 @@ import type worker_threads from "node:worker_threads"; -import { BroadcastChannel } from "./internal/worker_threads/broadcast-channel"; -import { MessageChannel } from "./internal/worker_threads/message-channel"; -import { MessagePort } from "./internal/worker_threads/message-port"; -import { Worker } from "./internal/worker_threads/worker"; +import { BroadcastChannel } from "./internal/worker_threads/broadcast-channel.ts"; +import { MessageChannel } from "./internal/worker_threads/message-channel.ts"; +import { MessagePort } from "./internal/worker_threads/message-port.ts"; +import { Worker } from "./internal/worker_threads/worker.ts"; import { Serializable } from "node:worker_threads"; -import { notImplemented } from "../_internal/utils"; +import { notImplemented } from "../_internal/utils.ts"; -export { BroadcastChannel } from "./internal/worker_threads/broadcast-channel"; -export { MessageChannel } from "./internal/worker_threads/message-channel"; -export { MessagePort } from "./internal/worker_threads/message-port"; -export { Worker } from "./internal/worker_threads/worker"; +export { BroadcastChannel } from "./internal/worker_threads/broadcast-channel.ts"; +export { MessageChannel } from "./internal/worker_threads/message-channel.ts"; +export { MessagePort } from "./internal/worker_threads/message-port.ts"; +export { Worker } from "./internal/worker_threads/worker.ts"; const _environmentData = new Map(); export const getEnvironmentData: typeof worker_threads.getEnvironmentData = diff --git a/src/runtime/node/zlib.ts b/src/runtime/node/zlib.ts index 3ea9a2be..c6cd0891 100644 --- a/src/runtime/node/zlib.ts +++ b/src/runtime/node/zlib.ts @@ -1,20 +1,20 @@ import type zlib from "node:zlib"; -import { constants } from "./internal/zlib/constants"; -import { codes } from "./internal/zlib/codes"; +import { constants } from "./internal/zlib/constants.ts"; +import { codes } from "./internal/zlib/codes.ts"; -import * as _brotli from "./internal/zlib/formats/brotli"; -import * as _deflate from "./internal/zlib/formats/deflate"; -import * as _gzip from "./internal/zlib/formats/gzip"; -import * as _zip from "./internal/zlib/formats/zip"; +import * as _brotli from "./internal/zlib/formats/brotli.ts"; +import * as _deflate from "./internal/zlib/formats/deflate.ts"; +import * as _gzip from "./internal/zlib/formats/gzip.ts"; +import * as _zip from "./internal/zlib/formats/zip.ts"; -export { constants } from "./internal/zlib/constants"; -export { codes } from "./internal/zlib/codes"; +export { constants } from "./internal/zlib/constants.ts"; +export { codes } from "./internal/zlib/codes.ts"; -export * from "./internal/zlib/formats/brotli"; -export * from "./internal/zlib/formats/deflate"; -export * from "./internal/zlib/formats/gzip"; -export * from "./internal/zlib/formats/zip"; +export * from "./internal/zlib/formats/brotli.ts"; +export * from "./internal/zlib/formats/deflate.ts"; +export * from "./internal/zlib/formats/gzip.ts"; +export * from "./internal/zlib/formats/zip.ts"; // Deprecated constants const Z_BINARY: typeof zlib.Z_BINARY = 0; diff --git a/src/runtime/npm/whatwg-url.ts b/src/runtime/npm/whatwg-url.ts index 3488f7d8..79b0f695 100644 --- a/src/runtime/npm/whatwg-url.ts +++ b/src/runtime/npm/whatwg-url.ts @@ -1,5 +1,5 @@ // https://www.npmjs.com/package/whatwg-url -import { notImplemented } from "../_internal/utils"; +import { notImplemented } from "../_internal/utils.ts"; export const URL = globalThis.URL; export const URLSearchParams = globalThis.URLSearchParams; diff --git a/src/runtime/polyfill/global.ts b/src/runtime/polyfill/global.ts index 86139f54..2274b826 100644 --- a/src/runtime/polyfill/global.ts +++ b/src/runtime/polyfill/global.ts @@ -1,4 +1,4 @@ -import _global from "./global-this"; +import _global from "./global-this.ts"; try { const _defineOpts: PropertyDescriptor = { enumerable: false, value: _global }; diff --git a/src/runtime/polyfill/performance.ts b/src/runtime/polyfill/performance.ts index b3b3b0db..9d6304ab 100644 --- a/src/runtime/polyfill/performance.ts +++ b/src/runtime/polyfill/performance.ts @@ -7,8 +7,8 @@ import { PerformanceObserver, PerformanceObserverEntryList, PerformanceResourceTiming, -} from "../web/performance"; -import _global from "./global-this"; +} from "../web/performance/index.ts"; +import _global from "./global-this.ts"; _global.performance = _global.performance || performance; _global.Performance = _global.Performance || Performance; diff --git a/src/runtime/polyfill/process.ts b/src/runtime/polyfill/process.ts index 3950d8a0..77853702 100644 --- a/src/runtime/polyfill/process.ts +++ b/src/runtime/polyfill/process.ts @@ -1,5 +1,5 @@ import type nodeProcess from "node:process"; -import unenvProcess from "../node/process"; +import unenvProcess from "../node/process.ts"; // use Object.assign to preserve the identity of globalThis.process Object.assign(globalThis.process, { diff --git a/src/runtime/web/performance/_observer.ts b/src/runtime/web/performance/_observer.ts index 73693f46..af7e9b3c 100644 --- a/src/runtime/web/performance/_observer.ts +++ b/src/runtime/web/performance/_observer.ts @@ -1,5 +1,5 @@ -import { createNotImplementedError } from "../../_internal/utils"; -import { _supportedEntryTypes } from "./_entry"; +import { createNotImplementedError } from "../../_internal/utils.ts"; +import { _supportedEntryTypes } from "./_entry.ts"; // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver export class _PerformanceObserver implements globalThis.PerformanceObserver { diff --git a/src/runtime/web/performance/_performance.ts b/src/runtime/web/performance/_performance.ts index a1cd2491..0f496816 100644 --- a/src/runtime/web/performance/_performance.ts +++ b/src/runtime/web/performance/_performance.ts @@ -1,6 +1,6 @@ -import { createNotImplementedError } from "../../_internal/utils"; -import mock from "../../mock/proxy"; -import { _PerformanceMark, _PerformanceMeasure } from "./_entry"; +import { createNotImplementedError } from "../../_internal/utils.ts"; +import mock from "../../mock/proxy.ts"; +import { _PerformanceMark, _PerformanceMeasure } from "./_entry.ts"; const _timeOrigin = Date.now(); diff --git a/src/runtime/web/performance/index.ts b/src/runtime/web/performance/index.ts index 6ec45e1e..cebe12f5 100644 --- a/src/runtime/web/performance/index.ts +++ b/src/runtime/web/performance/index.ts @@ -1,13 +1,13 @@ // https://developer.mozilla.org/en-US/docs/Web/API/Performance_API -export { Performance, _Performance, performance } from "./_performance"; +export { Performance, _Performance, performance } from "./_performance.ts"; export { PerformanceObserver, _PerformanceObserver, PerformanceObserverEntryList, _PerformanceObserverEntryList, -} from "./_observer"; +} from "./_observer.ts"; export { PerformanceEntry, @@ -18,7 +18,7 @@ export { _PerformanceMeasure, PerformanceResourceTiming, _PerformanceResourceTiming, -} from "./_entry"; +} from "./_entry.ts"; // Not implemented: // EventCounts diff --git a/tsconfig.json b/tsconfig.json index 21595ec8..ae78a47e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "strict": true, "declaration": true, "resolveJsonModule": true, + "allowImportingTsExtensions": true, "isolatedDeclarations": false, "types": [ "node"