diff --git a/GraphQLUpload.test.mjs b/GraphQLUpload.test.mjs index e738bc2..257921d 100644 --- a/GraphQLUpload.test.mjs +++ b/GraphQLUpload.test.mjs @@ -1,7 +1,7 @@ // @ts-check -import { doesNotThrow, throws } from "assert"; import { parseValue } from "graphql"; +import { doesNotThrow, throws } from "node:assert"; import GraphQLUpload from "./GraphQLUpload.mjs"; import Upload from "./Upload.mjs"; diff --git a/Upload.test.mjs b/Upload.test.mjs index 083f684..26e6bc6 100644 --- a/Upload.test.mjs +++ b/Upload.test.mjs @@ -1,6 +1,6 @@ // @ts-check -import { ok, rejects, strictEqual } from "assert"; +import { ok, rejects, strictEqual } from "node:assert"; import Upload from "./Upload.mjs"; diff --git a/changelog.md b/changelog.md index dfaeb37..317b46a 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ ### Patch - Updated dev dependencies. +- Use the `node:` URL scheme for Node.js builtin module imports. - Improved JSDoc in the module `GraphQLUpload.mjs`. - Revamped the readme: - Removed the badges. diff --git a/graphqlUploadExpress.test.mjs b/graphqlUploadExpress.test.mjs index 544cdd2..b829bad 100644 --- a/graphqlUploadExpress.test.mjs +++ b/graphqlUploadExpress.test.mjs @@ -1,9 +1,9 @@ // @ts-check -import { deepStrictEqual, ok, strictEqual } from "assert"; import express from "express"; -import { createServer } from "http"; import createError from "http-errors"; +import { deepStrictEqual, ok, strictEqual } from "node:assert"; +import { createServer } from "node:http"; import fetch, { File, FormData } from "node-fetch"; import graphqlUploadExpress from "./graphqlUploadExpress.mjs"; diff --git a/graphqlUploadKoa.test.mjs b/graphqlUploadKoa.test.mjs index 1bd9f51..e3d62fc 100644 --- a/graphqlUploadKoa.test.mjs +++ b/graphqlUploadKoa.test.mjs @@ -1,8 +1,8 @@ // @ts-check -import { deepStrictEqual, ok, strictEqual } from "assert"; -import { createServer } from "http"; import Koa from "koa"; +import { deepStrictEqual, ok, strictEqual } from "node:assert"; +import { createServer } from "node:http"; import fetch, { File, FormData } from "node-fetch"; import graphqlUploadKoa from "./graphqlUploadKoa.mjs"; diff --git a/ignoreStream.mjs b/ignoreStream.mjs index 81604d0..45066d4 100644 --- a/ignoreStream.mjs +++ b/ignoreStream.mjs @@ -2,7 +2,7 @@ /** * Safely ignores a Node.js readable stream. - * @param {import("stream").Readable} stream Node.js readable stream. + * @param {import("node:stream").Readable} stream Node.js readable stream. */ export default function ignoreStream(stream) { // Prevent an unhandled error from crashing the process. diff --git a/ignoreStream.test.mjs b/ignoreStream.test.mjs index 2321ed4..2d3eba8 100644 --- a/ignoreStream.test.mjs +++ b/ignoreStream.test.mjs @@ -1,6 +1,6 @@ // @ts-check -import { doesNotThrow, strictEqual } from "assert"; +import { doesNotThrow, strictEqual } from "node:assert"; import ignoreStream from "./ignoreStream.mjs"; import CountReadableStream from "./test/CountReadableStream.mjs"; diff --git a/processRequest.mjs b/processRequest.mjs index f4c11f0..deed730 100644 --- a/processRequest.mjs +++ b/processRequest.mjs @@ -370,7 +370,7 @@ export default function processRequest( * all resolvers have resolved, or after an error has interrupted the request. * @callback FileUploadCreateReadStream * @param {FileUploadCreateReadStreamOptions} [options] Options. - * @returns {import("stream").Readable} + * @returns {import("node:stream").Readable} * [Node.js readable stream](https://nodejs.org/api/stream.html#readable-streams) * of the file’s contents. * @see [Node.js `Readable` stream constructor docs](https://nodejs.org/api/stream.html#new-streamreadableoptions). @@ -399,9 +399,9 @@ export default function processRequest( * Processes an incoming * [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). * @callback ProcessRequestFunction - * @param {import("http").IncomingMessage} request + * @param {import("node:http").IncomingMessage} request * [Node.js HTTP server request instance](https://nodejs.org/api/http.html#http_class_http_incomingmessage). - * @param {import("http").ServerResponse} response + * @param {import("node:http").ServerResponse} response * [Node.js HTTP server response instance](https://nodejs.org/api/http.html#http_class_http_serverresponse). * @param {ProcessRequestOptions} [options] Options. * @returns {Promise< diff --git a/processRequest.test.mjs b/processRequest.test.mjs index d253181..ce7f694 100644 --- a/processRequest.test.mjs +++ b/processRequest.test.mjs @@ -1,5 +1,6 @@ // @ts-check +import { ReadStream } from "fs-capacitor"; import { deepStrictEqual, notStrictEqual, @@ -7,9 +8,8 @@ import { rejects, strictEqual, throws, -} from "assert"; -import { ReadStream } from "fs-capacitor"; -import { createServer } from "http"; +} from "node:assert"; +import { createServer } from "node:http"; import fetch, { File, FormData } from "node-fetch"; import processRequest from "./processRequest.mjs"; diff --git a/test/CountReadableStream.mjs b/test/CountReadableStream.mjs index eb8da51..6f20f25 100644 --- a/test/CountReadableStream.mjs +++ b/test/CountReadableStream.mjs @@ -1,13 +1,13 @@ // @ts-check -import { Readable } from "stream"; +import { Readable } from "node:stream"; /** * A count readable stream, for testing purposes. * @see [Example counting stream in the Node.js docs](https://nodejs.org/api/stream.html#an-example-counting-stream). */ export default class CountReadableStream extends Readable { - /** @param {import("stream").ReadableOptions} [options] */ + /** @param {import("node:stream").ReadableOptions} [options] */ constructor(options) { super(options); this._max = 1000000; diff --git a/test/abortingMultipartRequest.mjs b/test/abortingMultipartRequest.mjs index 55189d7..077ebfc 100644 --- a/test/abortingMultipartRequest.mjs +++ b/test/abortingMultipartRequest.mjs @@ -1,9 +1,9 @@ // @ts-check import { FormDataEncoder } from "form-data-encoder"; +import { Readable } from "node:stream"; import nodeAbortController from "node-abort-controller"; import fetch, { AbortError } from "node-fetch"; -import { Readable } from "stream"; const AbortController = globalThis.AbortController || nodeAbortController.AbortController; diff --git a/test/listen.mjs b/test/listen.mjs index 6da9e4d..b3efa1e 100644 --- a/test/listen.mjs +++ b/test/listen.mjs @@ -2,7 +2,7 @@ /** * Starts a Node.js HTTP server. - * @param {import("http").Server} server Node.js HTTP server. + * @param {import("node:http").Server} server Node.js HTTP server. * @returns Resolves the port the server is listening on, and a server close * function. */ @@ -12,7 +12,7 @@ export default async function listen(server) { }); return { - port: /** @type {import("net").AddressInfo} */ (server.address()).port, + port: /** @type {import("node:net").AddressInfo} */ (server.address()).port, close: () => server.close(), }; } diff --git a/test/streamToString.mjs b/test/streamToString.mjs index ac37762..ca01a41 100644 --- a/test/streamToString.mjs +++ b/test/streamToString.mjs @@ -2,7 +2,7 @@ /** * Converts a Node.js readable stream to a string. - * @param {import("stream").Readable} stream Node.js readable stream. + * @param {import("node:stream").Readable} stream Node.js readable stream. * @returns {Promise} Resolves the final string. */ export default function streamToString(stream) {