diff --git a/eslint.config.js b/eslint.config.js index 3e9d9eead..35ca84007 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -166,7 +166,6 @@ const configs = antfu( 'jsdoc/no-multi-asterisks': [ 'error', { allowWhitespace: true }], - // Might want to enable these 'node/prefer-global/buffer': 'off', 'node/prefer-global/process': 'off', @@ -273,7 +272,6 @@ const configs = antfu( 'unicorn/no-await-expression-member': 'off', 'unicorn/no-negated-condition': 'off', 'unicorn/no-object-as-default-parameter': 'off', - 'unicorn/prefer-node-protocol': 'off', 'unused-imports/no-unused-vars': [ 'error', diff --git a/jest.config.js b/jest.config.js index 6b380ec5d..8aa7e84f2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ -const os = require('os'); -const v8 = require('v8'); +const os = require('node:os'); +const v8 = require('node:v8'); // Several parts inspired by https://github.com/renovatebot/renovate/blob/main/package.json diff --git a/scripts/finalizeRelease.ts b/scripts/finalizeRelease.ts index 953fc0d06..d3584b3ab 100644 --- a/scripts/finalizeRelease.ts +++ b/scripts/finalizeRelease.ts @@ -1,6 +1,6 @@ #!/usr/bin/env ts-node /* eslint-disable import/extensions, no-console */ -import * as readline from 'readline'; +import * as readline from 'node:readline'; import simpleGit from 'simple-git'; import { version } from '../package.json'; diff --git a/src/authorization/AcpReader.ts b/src/authorization/AcpReader.ts index 1c74329a7..bc7ca9dcf 100644 --- a/src/authorization/AcpReader.ts +++ b/src/authorization/AcpReader.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import type { IAccessControlledResource, IContext, IPolicy } from '@solid/access-control-policy'; import { allowAccessModes } from '@solid/access-control-policy'; import type { Store } from 'n3'; diff --git a/src/http/UnsecureWebSocketsProtocol.ts b/src/http/UnsecureWebSocketsProtocol.ts index fe45aee88..9413cd4d9 100644 --- a/src/http/UnsecureWebSocketsProtocol.ts +++ b/src/http/UnsecureWebSocketsProtocol.ts @@ -1,5 +1,5 @@ -import type { IncomingMessage } from 'http'; -import type { TLSSocket } from 'tls'; +import type { IncomingMessage } from 'node:http'; +import type { TLSSocket } from 'node:tls'; import type { WebSocket } from 'ws'; import type { SingleThreaded } from '../init/cluster/SingleThreaded'; import { getLoggerFor } from '../logging/LogUtil'; diff --git a/src/http/input/identifier/OriginalUrlExtractor.ts b/src/http/input/identifier/OriginalUrlExtractor.ts index 63cf23493..2271c6b29 100644 --- a/src/http/input/identifier/OriginalUrlExtractor.ts +++ b/src/http/input/identifier/OriginalUrlExtractor.ts @@ -1,4 +1,4 @@ -import type { TLSSocket } from 'tls'; +import type { TLSSocket } from 'node:tls'; import type { HttpRequest } from '../../../server/HttpRequest'; import { BadRequestHttpError } from '../../../util/errors/BadRequestHttpError'; import { errorTermsToMetadata } from '../../../util/errors/HttpErrorUtil'; diff --git a/src/http/output/response/OkResponseDescription.ts b/src/http/output/response/OkResponseDescription.ts index b8ae1d9e4..e82783947 100644 --- a/src/http/output/response/OkResponseDescription.ts +++ b/src/http/output/response/OkResponseDescription.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Guarded } from '../../../util/GuardedStream'; import { SOLID_HTTP } from '../../../util/Vocabularies'; import type { RepresentationMetadata } from '../../representation/RepresentationMetadata'; diff --git a/src/http/output/response/ResponseDescription.ts b/src/http/output/response/ResponseDescription.ts index 900b90e40..d483364fc 100644 --- a/src/http/output/response/ResponseDescription.ts +++ b/src/http/output/response/ResponseDescription.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Guarded } from '../../../util/GuardedStream'; import type { RepresentationMetadata } from '../../representation/RepresentationMetadata'; diff --git a/src/http/representation/BasicRepresentation.ts b/src/http/representation/BasicRepresentation.ts index a68145bc9..9c961805b 100644 --- a/src/http/representation/BasicRepresentation.ts +++ b/src/http/representation/BasicRepresentation.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { INTERNAL_QUADS } from '../../util/ContentTypes'; import type { Guarded } from '../../util/GuardedStream'; import { guardStream } from '../../util/GuardedStream'; diff --git a/src/http/representation/Representation.ts b/src/http/representation/Representation.ts index b2d9ba429..1c52f2083 100644 --- a/src/http/representation/Representation.ts +++ b/src/http/representation/Representation.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Guarded } from '../../util/GuardedStream'; import type { RepresentationMetadata } from './RepresentationMetadata'; diff --git a/src/identity/configuration/CachedJwkGenerator.ts b/src/identity/configuration/CachedJwkGenerator.ts index 210a306ad..f6c6d1b72 100644 --- a/src/identity/configuration/CachedJwkGenerator.ts +++ b/src/identity/configuration/CachedJwkGenerator.ts @@ -1,5 +1,5 @@ -import { createPublicKey } from 'crypto'; -import type { KeyObject } from 'crypto'; +import { createPublicKey } from 'node:crypto'; +import type { KeyObject } from 'node:crypto'; import { exportJWK, generateKeyPair, importJWK } from 'jose'; import type { AsymmetricSigningAlgorithm, JWKS } from '../../../templates/types/oidc-provider'; import type { KeyValueStorage } from '../../storage/keyvalue/KeyValueStorage'; diff --git a/src/identity/configuration/IdentityProviderFactory.ts b/src/identity/configuration/IdentityProviderFactory.ts index 5a3897ed9..026ce76aa 100644 --- a/src/identity/configuration/IdentityProviderFactory.ts +++ b/src/identity/configuration/IdentityProviderFactory.ts @@ -1,5 +1,5 @@ /* eslint-disable ts/naming-convention */ -import { randomBytes } from 'crypto'; +import { randomBytes } from 'node:crypto'; import type { Account, Adapter, diff --git a/src/identity/interaction/client-credentials/util/BaseClientCredentialsStore.ts b/src/identity/interaction/client-credentials/util/BaseClientCredentialsStore.ts index 8e955a774..51e043d28 100644 --- a/src/identity/interaction/client-credentials/util/BaseClientCredentialsStore.ts +++ b/src/identity/interaction/client-credentials/util/BaseClientCredentialsStore.ts @@ -1,4 +1,4 @@ -import { randomBytes } from 'crypto'; +import { randomBytes } from 'node:crypto'; import { Initializer } from '../../../../init/Initializer'; import { getLoggerFor } from '../../../../logging/LogUtil'; import { createErrorMessage } from '../../../../util/errors/ErrorUtil'; diff --git a/src/init/AppRunner.ts b/src/init/AppRunner.ts index 281c33495..a91d08c81 100644 --- a/src/init/AppRunner.ts +++ b/src/init/AppRunner.ts @@ -1,6 +1,6 @@ /* eslint-disable unicorn/no-process-exit */ -import { existsSync } from 'fs'; -import type { WriteStream } from 'tty'; +import { existsSync } from 'node:fs'; +import type { WriteStream } from 'node:tty'; import type { IComponentsManagerBuilderOptions } from 'componentsjs'; import { ComponentsManager } from 'componentsjs'; import { readJSON } from 'fs-extra'; diff --git a/src/init/ServerInitializer.ts b/src/init/ServerInitializer.ts index ffa92c6df..b379f1d6d 100644 --- a/src/init/ServerInitializer.ts +++ b/src/init/ServerInitializer.ts @@ -1,6 +1,6 @@ -import type { Server } from 'http'; -import { URL } from 'url'; -import { promisify } from 'util'; +import type { Server } from 'node:http'; +import { URL } from 'node:url'; +import { promisify } from 'node:util'; import { getLoggerFor } from '../logging/LogUtil'; import { isHttpsServer } from '../server/HttpServerFactory'; import type { HttpServerFactory } from '../server/HttpServerFactory'; diff --git a/src/init/cluster/ClusterManager.ts b/src/init/cluster/ClusterManager.ts index 9d3c71846..caf38828b 100644 --- a/src/init/cluster/ClusterManager.ts +++ b/src/init/cluster/ClusterManager.ts @@ -1,6 +1,6 @@ -import type { Worker } from 'cluster'; -import cluster from 'cluster'; -import { cpus } from 'os'; +import type { Worker } from 'node:cluster'; +import cluster from 'node:cluster'; +import { cpus } from 'node:os'; import { getLoggerFor } from '../../logging/LogUtil'; import { InternalServerError } from '../../util/errors/InternalServerError'; diff --git a/src/init/migration/V6MigrationInitializer.ts b/src/init/migration/V6MigrationInitializer.ts index be656887f..2a9afe274 100644 --- a/src/init/migration/V6MigrationInitializer.ts +++ b/src/init/migration/V6MigrationInitializer.ts @@ -1,4 +1,4 @@ -import { createInterface } from 'readline'; +import { createInterface } from 'node:readline'; import { ACCOUNT_STORAGE_DESCRIPTION } from '../../identity/interaction/account/util/BaseAccountStore'; import type { AccountLoginStorage } from '../../identity/interaction/account/util/LoginStorage'; import { ACCOUNT_TYPE } from '../../identity/interaction/account/util/LoginStorage'; diff --git a/src/logging/LazyLoggerFactory.ts b/src/logging/LazyLoggerFactory.ts index 7dcfd99a2..e6f3a9a2f 100644 --- a/src/logging/LazyLoggerFactory.ts +++ b/src/logging/LazyLoggerFactory.ts @@ -1,4 +1,4 @@ -import cluster from 'cluster'; +import cluster from 'node:cluster'; import { WrappingLogger } from './Logger'; import type { Logger } from './Logger'; import type { LoggerFactory } from './LoggerFactory'; diff --git a/src/logging/Logger.ts b/src/logging/Logger.ts index 9eabe948f..e97b1ba72 100644 --- a/src/logging/Logger.ts +++ b/src/logging/Logger.ts @@ -1,5 +1,5 @@ -import cluster from 'cluster'; -import process from 'process'; +import cluster from 'node:cluster'; +import process from 'node:process'; import type { LogLevel } from './LogLevel'; export interface LogMetadata { diff --git a/src/pods/generate/BaseResourcesGenerator.ts b/src/pods/generate/BaseResourcesGenerator.ts index e4d50e049..4d46b00c8 100644 --- a/src/pods/generate/BaseResourcesGenerator.ts +++ b/src/pods/generate/BaseResourcesGenerator.ts @@ -1,5 +1,5 @@ -import { createReadStream, promises as fsPromises } from 'fs'; -import type { Readable } from 'stream'; +import { createReadStream, promises as fsPromises } from 'node:fs'; +import type { Readable } from 'node:stream'; import { pathExists } from 'fs-extra'; import { Parser } from 'n3'; import type { AuxiliaryStrategy } from '../../http/auxiliary/AuxiliaryStrategy'; diff --git a/src/pods/generate/variables/RootFilePathHandler.ts b/src/pods/generate/variables/RootFilePathHandler.ts index 942cff64e..1898c3f51 100644 --- a/src/pods/generate/variables/RootFilePathHandler.ts +++ b/src/pods/generate/variables/RootFilePathHandler.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import type { ResourceIdentifier } from '../../../http/representation/ResourceIdentifier'; import type { FileIdentifierMapper } from '../../../storage/mapping/FileIdentifierMapper'; import { ConflictHttpError } from '../../../util/errors/ConflictHttpError'; diff --git a/src/server/BaseServerFactory.ts b/src/server/BaseServerFactory.ts index 83db53bb5..da8c9c776 100644 --- a/src/server/BaseServerFactory.ts +++ b/src/server/BaseServerFactory.ts @@ -1,8 +1,8 @@ -import { readFileSync } from 'fs'; -import type { Server } from 'http'; -import { createServer as createHttpServer } from 'http'; -import type { ServerOptions } from 'https'; -import { createServer as createHttpsServer } from 'https'; +import { readFileSync } from 'node:fs'; +import type { Server } from 'node:http'; +import { createServer as createHttpServer } from 'node:http'; +import type { ServerOptions } from 'node:https'; +import { createServer as createHttpsServer } from 'node:https'; import { getLoggerFor } from '../logging/LogUtil'; import type { HttpServerFactory } from './HttpServerFactory'; import type { ServerConfigurator } from './ServerConfigurator'; diff --git a/src/server/HandlerServerConfigurator.ts b/src/server/HandlerServerConfigurator.ts index c30acbceb..08c67f983 100644 --- a/src/server/HandlerServerConfigurator.ts +++ b/src/server/HandlerServerConfigurator.ts @@ -1,4 +1,4 @@ -import type { IncomingMessage, Server, ServerResponse } from 'http'; +import type { IncomingMessage, Server, ServerResponse } from 'node:http'; import { getLoggerFor } from '../logging/LogUtil'; import { isError } from '../util/errors/ErrorUtil'; import { guardStream } from '../util/GuardedStream'; diff --git a/src/server/HttpRequest.ts b/src/server/HttpRequest.ts index 647e42d6e..d606e6908 100644 --- a/src/server/HttpRequest.ts +++ b/src/server/HttpRequest.ts @@ -1,4 +1,4 @@ -import type { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'node:http'; import type { Guarded } from '../util/GuardedStream'; /** diff --git a/src/server/HttpResponse.ts b/src/server/HttpResponse.ts index 476485d0e..247128f6c 100644 --- a/src/server/HttpResponse.ts +++ b/src/server/HttpResponse.ts @@ -1,4 +1,4 @@ -import type { ServerResponse } from 'http'; +import type { ServerResponse } from 'node:http'; /** * An outgoing HTTP response; diff --git a/src/server/HttpServerFactory.ts b/src/server/HttpServerFactory.ts index cd39c2198..c4df93b66 100644 --- a/src/server/HttpServerFactory.ts +++ b/src/server/HttpServerFactory.ts @@ -1,5 +1,5 @@ -import type { Server } from 'http'; -import { Server as HttpsServer } from 'https'; +import type { Server } from 'node:http'; +import { Server as HttpsServer } from 'node:https'; /** * Returns `true` if the server is an HTTPS server. diff --git a/src/server/ServerConfigurator.ts b/src/server/ServerConfigurator.ts index 8a65cb14c..60907f9d3 100644 --- a/src/server/ServerConfigurator.ts +++ b/src/server/ServerConfigurator.ts @@ -1,4 +1,4 @@ -import type { Server } from 'http'; +import type { Server } from 'node:http'; import { AsyncHandler } from '../util/handlers/AsyncHandler'; /** diff --git a/src/server/WebSocketServerConfigurator.ts b/src/server/WebSocketServerConfigurator.ts index 1b850d4b9..b7ccbc664 100644 --- a/src/server/WebSocketServerConfigurator.ts +++ b/src/server/WebSocketServerConfigurator.ts @@ -1,5 +1,5 @@ -import type { IncomingMessage, Server } from 'http'; -import type { Socket } from 'net'; +import type { IncomingMessage, Server } from 'node:http'; +import type { Socket } from 'node:net'; import type { WebSocket } from 'ws'; import { WebSocketServer } from 'ws'; import { getLoggerFor } from '../logging/LogUtil'; diff --git a/src/server/middleware/StaticAssetHandler.ts b/src/server/middleware/StaticAssetHandler.ts index 4f1df2e17..77632c3b1 100644 --- a/src/server/middleware/StaticAssetHandler.ts +++ b/src/server/middleware/StaticAssetHandler.ts @@ -1,4 +1,4 @@ -import { createReadStream } from 'fs'; +import { createReadStream } from 'node:fs'; import escapeStringRegexp from 'escape-string-regexp'; import * as mime from 'mime-types'; import { getLoggerFor } from '../../logging/LogUtil'; diff --git a/src/server/notifications/BaseChannelType.ts b/src/server/notifications/BaseChannelType.ts index 7e5c93c0a..bf07f119a 100644 --- a/src/server/notifications/BaseChannelType.ts +++ b/src/server/notifications/BaseChannelType.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import { KeysRdfParseJsonLd } from '@comunica/context-entries'; import { parse, toSeconds } from 'iso8601-duration'; import { DataFactory } from 'n3'; diff --git a/src/server/notifications/WebSocketChannel2023/WebSocket2023Util.ts b/src/server/notifications/WebSocketChannel2023/WebSocket2023Util.ts index 731884c2d..dd39b802e 100644 --- a/src/server/notifications/WebSocketChannel2023/WebSocket2023Util.ts +++ b/src/server/notifications/WebSocketChannel2023/WebSocket2023Util.ts @@ -1,4 +1,4 @@ -import type { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'node:http'; import { BadRequestHttpError } from '../../../util/errors/BadRequestHttpError'; /** diff --git a/src/storage/IndexRepresentationStore.ts b/src/storage/IndexRepresentationStore.ts index 7053fa009..91eedcc79 100644 --- a/src/storage/IndexRepresentationStore.ts +++ b/src/storage/IndexRepresentationStore.ts @@ -1,4 +1,4 @@ -import assert from 'assert'; +import assert from 'node:assert'; import type { Representation } from '../http/representation/Representation'; import type { RepresentationPreferences } from '../http/representation/RepresentationPreferences'; import type { ResourceIdentifier } from '../http/representation/ResourceIdentifier'; diff --git a/src/storage/LockingResourceStore.ts b/src/storage/LockingResourceStore.ts index 699953806..e7ceb8079 100644 --- a/src/storage/LockingResourceStore.ts +++ b/src/storage/LockingResourceStore.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { AuxiliaryIdentifierStrategy } from '../http/auxiliary/AuxiliaryIdentifierStrategy'; import { BasicRepresentation } from '../http/representation/BasicRepresentation'; import type { Patch } from '../http/representation/Patch'; diff --git a/src/storage/accessors/AtomicFileDataAccessor.ts b/src/storage/accessors/AtomicFileDataAccessor.ts index 93ca70a41..00effdd46 100644 --- a/src/storage/accessors/AtomicFileDataAccessor.ts +++ b/src/storage/accessors/AtomicFileDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { ensureDirSync, rename, unlink } from 'fs-extra'; import { v4 } from 'uuid'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; diff --git a/src/storage/accessors/DataAccessor.ts b/src/storage/accessors/DataAccessor.ts index f15560ee1..59e3636fb 100644 --- a/src/storage/accessors/DataAccessor.ts +++ b/src/storage/accessors/DataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Representation } from '../../http/representation/Representation'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; diff --git a/src/storage/accessors/FileDataAccessor.ts b/src/storage/accessors/FileDataAccessor.ts index b683ec46e..f5baeed63 100644 --- a/src/storage/accessors/FileDataAccessor.ts +++ b/src/storage/accessors/FileDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Stats } from 'fs-extra'; import { createReadStream, createWriteStream, ensureDir, lstat, opendir, remove, stat } from 'fs-extra'; import type { Quad } from 'rdf-js'; diff --git a/src/storage/accessors/FilterMetadataDataAccessor.ts b/src/storage/accessors/FilterMetadataDataAccessor.ts index 06d2ab111..a7ea737a2 100644 --- a/src/storage/accessors/FilterMetadataDataAccessor.ts +++ b/src/storage/accessors/FilterMetadataDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import type { Guarded } from '../../util/GuardedStream'; diff --git a/src/storage/accessors/InMemoryDataAccessor.ts b/src/storage/accessors/InMemoryDataAccessor.ts index 7c4551bda..6b0434203 100644 --- a/src/storage/accessors/InMemoryDataAccessor.ts +++ b/src/storage/accessors/InMemoryDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; diff --git a/src/storage/accessors/PassthroughDataAccessor.ts b/src/storage/accessors/PassthroughDataAccessor.ts index daf7fa6cb..f22be89d6 100644 --- a/src/storage/accessors/PassthroughDataAccessor.ts +++ b/src/storage/accessors/PassthroughDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Representation } from '../../http/representation/Representation'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; diff --git a/src/storage/accessors/SparqlDataAccessor.ts b/src/storage/accessors/SparqlDataAccessor.ts index b42f01247..117a9bc61 100644 --- a/src/storage/accessors/SparqlDataAccessor.ts +++ b/src/storage/accessors/SparqlDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { SparqlEndpointFetcher } from 'fetch-sparql-endpoint'; import { DataFactory } from 'n3'; diff --git a/src/storage/accessors/ValidatingDataAccessor.ts b/src/storage/accessors/ValidatingDataAccessor.ts index 3e808e0eb..0c01d932f 100644 --- a/src/storage/accessors/ValidatingDataAccessor.ts +++ b/src/storage/accessors/ValidatingDataAccessor.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Validator } from '../../http/auxiliary/Validator'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; diff --git a/src/storage/conversion/ConstantConverter.ts b/src/storage/conversion/ConstantConverter.ts index 5eca9e4c6..c09e71d31 100644 --- a/src/storage/conversion/ConstantConverter.ts +++ b/src/storage/conversion/ConstantConverter.ts @@ -1,4 +1,4 @@ -import { createReadStream } from 'fs'; +import { createReadStream } from 'node:fs'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; import type { Representation } from '../../http/representation/Representation'; import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError'; diff --git a/src/storage/conversion/ContainerToTemplateConverter.ts b/src/storage/conversion/ContainerToTemplateConverter.ts index 42a2d9d67..db251038e 100644 --- a/src/storage/conversion/ContainerToTemplateConverter.ts +++ b/src/storage/conversion/ContainerToTemplateConverter.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import orderBy from 'lodash.orderby'; import type { Quad } from 'rdf-js'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; diff --git a/src/storage/conversion/ErrorToTemplateConverter.ts b/src/storage/conversion/ErrorToTemplateConverter.ts index af96f3d18..287d81dd8 100644 --- a/src/storage/conversion/ErrorToTemplateConverter.ts +++ b/src/storage/conversion/ErrorToTemplateConverter.ts @@ -1,4 +1,4 @@ -import assert from 'assert'; +import assert from 'node:assert'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; import type { Representation } from '../../http/representation/Representation'; import { INTERNAL_ERROR } from '../../util/ContentTypes'; diff --git a/src/storage/conversion/FormToJsonConverter.ts b/src/storage/conversion/FormToJsonConverter.ts index 48e8c8f4b..cb61eadc7 100644 --- a/src/storage/conversion/FormToJsonConverter.ts +++ b/src/storage/conversion/FormToJsonConverter.ts @@ -1,4 +1,4 @@ -import { parse } from 'querystring'; +import { parse } from 'node:querystring'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; import type { Representation } from '../../http/representation/Representation'; import { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; diff --git a/src/storage/conversion/QuadToRdfConverter.ts b/src/storage/conversion/QuadToRdfConverter.ts index e05614170..1ed20f4dd 100644 --- a/src/storage/conversion/QuadToRdfConverter.ts +++ b/src/storage/conversion/QuadToRdfConverter.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { DataFactory, StreamWriter } from 'n3'; import type { Quad } from 'rdf-js'; import rdfSerializer from 'rdf-serialize'; diff --git a/src/storage/conversion/RdfToQuadConverter.ts b/src/storage/conversion/RdfToQuadConverter.ts index 2df0298e8..3cecdc0ee 100644 --- a/src/storage/conversion/RdfToQuadConverter.ts +++ b/src/storage/conversion/RdfToQuadConverter.ts @@ -1,4 +1,4 @@ -import { PassThrough } from 'stream'; +import { PassThrough } from 'node:stream'; import { KeysRdfParseJsonLd } from '@comunica/context-entries'; import type { NamedNode } from '@rdfjs/types'; import rdfParser from 'rdf-parse'; diff --git a/src/storage/keyvalue/HashEncodingStorage.ts b/src/storage/keyvalue/HashEncodingStorage.ts index 55f50c1aa..016e1edb5 100644 --- a/src/storage/keyvalue/HashEncodingStorage.ts +++ b/src/storage/keyvalue/HashEncodingStorage.ts @@ -1,4 +1,4 @@ -import { createHash } from 'crypto'; +import { createHash } from 'node:crypto'; import { getLoggerFor } from '../../logging/LogUtil'; import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError'; import type { KeyValueStorage } from './KeyValueStorage'; diff --git a/src/storage/keyvalue/MaxKeyLengthStorage.ts b/src/storage/keyvalue/MaxKeyLengthStorage.ts index ff8314958..e30c44092 100644 --- a/src/storage/keyvalue/MaxKeyLengthStorage.ts +++ b/src/storage/keyvalue/MaxKeyLengthStorage.ts @@ -1,4 +1,4 @@ -import { createHash } from 'crypto'; +import { createHash } from 'node:crypto'; import { getLoggerFor } from '../../logging/LogUtil'; import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError'; import type { KeyValueStorage } from './KeyValueStorage'; diff --git a/src/storage/mapping/ExtensionBasedMapper.ts b/src/storage/mapping/ExtensionBasedMapper.ts index 5d62dfce6..4b59e77c2 100644 --- a/src/storage/mapping/ExtensionBasedMapper.ts +++ b/src/storage/mapping/ExtensionBasedMapper.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import * as mime from 'mime-types'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import { DEFAULT_CUSTOM_TYPES } from '../../util/ContentTypes'; diff --git a/src/storage/patch/RdfPatcher.ts b/src/storage/patch/RdfPatcher.ts index 16f51d4b8..c933c19e5 100644 --- a/src/storage/patch/RdfPatcher.ts +++ b/src/storage/patch/RdfPatcher.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { Store } from 'n3'; import { BasicRepresentation } from '../../http/representation/BasicRepresentation'; import type { RdfDatasetRepresentation } from '../../http/representation/RdfDatasetRepresentation'; diff --git a/src/storage/quota/QuotaStrategy.ts b/src/storage/quota/QuotaStrategy.ts index 48c8216ca..a09c95a6a 100644 --- a/src/storage/quota/QuotaStrategy.ts +++ b/src/storage/quota/QuotaStrategy.ts @@ -1,7 +1,7 @@ // These two eslint lines are needed to store 'this' in a variable so it can be used // in the PassThrough of createQuotaGuard /* eslint-disable ts/no-this-alias */ -import { PassThrough } from 'stream'; +import { PassThrough } from 'node:stream'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import { PayloadHttpError } from '../../util/errors/PayloadHttpError'; diff --git a/src/storage/size-reporter/FileSizeReporter.ts b/src/storage/size-reporter/FileSizeReporter.ts index 153168677..3137a980d 100644 --- a/src/storage/size-reporter/FileSizeReporter.ts +++ b/src/storage/size-reporter/FileSizeReporter.ts @@ -1,5 +1,5 @@ -import type { Stats } from 'fs'; -import { promises as fsPromises } from 'fs'; +import type { Stats } from 'node:fs'; +import { promises as fsPromises } from 'node:fs'; import type { RepresentationMetadata } from '../../http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import { joinFilePath, normalizeFilePath, trimTrailingSlashes } from '../../util/PathUtil'; diff --git a/src/storage/validators/QuotaValidator.ts b/src/storage/validators/QuotaValidator.ts index b1c68db41..29578c0b1 100644 --- a/src/storage/validators/QuotaValidator.ts +++ b/src/storage/validators/QuotaValidator.ts @@ -1,4 +1,4 @@ -import { PassThrough, Readable } from 'stream'; +import { PassThrough, Readable } from 'node:stream'; import { Validator } from '../../http/auxiliary/Validator'; import type { ValidatorInput } from '../../http/auxiliary/Validator'; import type { Representation } from '../../http/representation/Representation'; diff --git a/src/util/GenericEventEmitter.ts b/src/util/GenericEventEmitter.ts index 3183a18b2..d10155f3e 100644 --- a/src/util/GenericEventEmitter.ts +++ b/src/util/GenericEventEmitter.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; /** * A typed interface of {@link EventEmitter}. diff --git a/src/util/HeaderUtil.ts b/src/util/HeaderUtil.ts index ab9cf5394..567c67be6 100644 --- a/src/util/HeaderUtil.ts +++ b/src/util/HeaderUtil.ts @@ -1,4 +1,4 @@ -import type { IncomingHttpHeaders } from 'http'; +import type { IncomingHttpHeaders } from 'node:http'; import escapeStringRegexp from 'escape-string-regexp'; import { getLoggerFor } from '../logging/LogUtil'; import type { HttpResponse } from '../server/HttpResponse'; diff --git a/src/util/PathUtil.ts b/src/util/PathUtil.ts index 7039007de..e145b4125 100644 --- a/src/util/PathUtil.ts +++ b/src/util/PathUtil.ts @@ -1,4 +1,4 @@ -import { posix, win32 } from 'path'; +import { posix, win32 } from 'node:path'; import { readJson } from 'fs-extra'; import urljoin from 'url-join'; import type { TargetExtractor } from '../http/input/identifier/TargetExtractor'; diff --git a/src/util/PromiseUtil.ts b/src/util/PromiseUtil.ts index e6713abe3..690123cc6 100644 --- a/src/util/PromiseUtil.ts +++ b/src/util/PromiseUtil.ts @@ -1,4 +1,4 @@ -import { types } from 'util'; +import { types } from 'node:util'; import { createAggregateError } from './errors/HttpErrorUtil'; export type PromiseOrValue = T | Promise; diff --git a/src/util/QuadUtil.ts b/src/util/QuadUtil.ts index 45f7c7026..26ef3d636 100644 --- a/src/util/QuadUtil.ts +++ b/src/util/QuadUtil.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { NamedNode } from '@rdfjs/types'; import arrayifyStream from 'arrayify-stream'; import type { ParserOptions } from 'n3'; diff --git a/src/util/SliceStream.ts b/src/util/SliceStream.ts index 1d13333cb..f5d08a336 100644 --- a/src/util/SliceStream.ts +++ b/src/util/SliceStream.ts @@ -1,5 +1,5 @@ -import type { Readable, TransformCallback, TransformOptions } from 'stream'; -import { Transform } from 'stream'; +import type { Readable, TransformCallback, TransformOptions } from 'node:stream'; +import { Transform } from 'node:stream'; import { RangeNotSatisfiedHttpError } from './errors/RangeNotSatisfiedHttpError'; import { pipeSafely } from './StreamUtil'; diff --git a/src/util/StreamUtil.ts b/src/util/StreamUtil.ts index be86566c8..b28fb81fe 100644 --- a/src/util/StreamUtil.ts +++ b/src/util/StreamUtil.ts @@ -1,6 +1,6 @@ -import type { DuplexOptions, ReadableOptions, Writable } from 'stream'; -import { Readable, Transform } from 'stream'; -import { promisify } from 'util'; +import type { DuplexOptions, ReadableOptions, Writable } from 'node:stream'; +import { Readable, Transform } from 'node:stream'; +import { promisify } from 'node:util'; import arrayifyStream from 'arrayify-stream'; import eos from 'end-of-stream'; import { Store } from 'n3'; diff --git a/src/util/errors/ErrorUtil.ts b/src/util/errors/ErrorUtil.ts index a80059c82..adcca72b4 100644 --- a/src/util/errors/ErrorUtil.ts +++ b/src/util/errors/ErrorUtil.ts @@ -1,4 +1,4 @@ -import { types } from 'util'; +import { types } from 'node:util'; /** * Checks if the input is an {@link Error}. diff --git a/src/util/identifiers/BaseIdentifierStrategy.ts b/src/util/identifiers/BaseIdentifierStrategy.ts index f3a76ecca..48260028f 100644 --- a/src/util/identifiers/BaseIdentifierStrategy.ts +++ b/src/util/identifiers/BaseIdentifierStrategy.ts @@ -1,4 +1,4 @@ -import { URL } from 'url'; +import { URL } from 'node:url'; import type { ResourceIdentifier } from '../../http/representation/ResourceIdentifier'; import { errorTermsToMetadata } from '../errors/HttpErrorUtil'; import { InternalServerError } from '../errors/InternalServerError'; diff --git a/src/util/locking/FileSystemResourceLocker.ts b/src/util/locking/FileSystemResourceLocker.ts index 5988fd9cb..2a738f41b 100644 --- a/src/util/locking/FileSystemResourceLocker.ts +++ b/src/util/locking/FileSystemResourceLocker.ts @@ -1,4 +1,4 @@ -import { createHash } from 'crypto'; +import { createHash } from 'node:crypto'; import { ensureDir, remove } from 'fs-extra'; import type { LockOptions, UnlockOptions } from 'proper-lockfile'; import { lock, unlock } from 'proper-lockfile'; diff --git a/src/util/templates/TemplateUtil.ts b/src/util/templates/TemplateUtil.ts index e6110cdd4..f68b2c5f1 100644 --- a/src/util/templates/TemplateUtil.ts +++ b/src/util/templates/TemplateUtil.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import { joinFilePath, resolveAssetPath } from '../PathUtil'; import type { Template } from './TemplateEngine'; diff --git a/test/integration/ContentNegotiation.test.ts b/test/integration/ContentNegotiation.test.ts index 7ade49995..d1fcc019c 100644 --- a/test/integration/ContentNegotiation.test.ts +++ b/test/integration/ContentNegotiation.test.ts @@ -1,4 +1,4 @@ -import assert from 'assert'; +import assert from 'node:assert'; import fetch from 'cross-fetch'; import type { App } from '../../src/init/App'; import { getPort } from '../util/Util'; diff --git a/test/integration/DynamicPods.test.ts b/test/integration/DynamicPods.test.ts index 4ddb3e20f..ab66bcd3e 100644 --- a/test/integration/DynamicPods.test.ts +++ b/test/integration/DynamicPods.test.ts @@ -1,4 +1,4 @@ -import { mkdirSync } from 'fs'; +import { mkdirSync } from 'node:fs'; import fetch from 'cross-fetch'; import type { App } from '../../src/init/App'; import { joinFilePath } from '../../src/util/PathUtil'; diff --git a/test/integration/LdpHandlerWithAuth.test.ts b/test/integration/LdpHandlerWithAuth.test.ts index 1c9a64345..eeda87db7 100644 --- a/test/integration/LdpHandlerWithAuth.test.ts +++ b/test/integration/LdpHandlerWithAuth.test.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import fetch from 'cross-fetch'; import type { App, ResourceStore } from '../../src/'; import { BasicRepresentation, isSystemError, joinFilePath, joinUrl } from '../../src/'; diff --git a/test/integration/LdpHandlerWithoutAuth.test.ts b/test/integration/LdpHandlerWithoutAuth.test.ts index 630302730..b47492030 100644 --- a/test/integration/LdpHandlerWithoutAuth.test.ts +++ b/test/integration/LdpHandlerWithoutAuth.test.ts @@ -1,4 +1,4 @@ -import { createReadStream } from 'fs'; +import { createReadStream } from 'node:fs'; import fetch from 'cross-fetch'; import type { Quad } from 'n3'; import { DataFactory, Parser, Store } from 'n3'; diff --git a/test/integration/Middleware.test.ts b/test/integration/Middleware.test.ts index 856182ea1..a7800e0f8 100644 --- a/test/integration/Middleware.test.ts +++ b/test/integration/Middleware.test.ts @@ -1,4 +1,4 @@ -import type { Server } from 'http'; +import type { Server } from 'node:http'; import request from 'supertest'; import type { App } from '../../src/init/App'; import type { HttpServerFactory } from '../../src/server/HttpServerFactory'; diff --git a/test/integration/Quota.test.ts b/test/integration/Quota.test.ts index 0edbe1467..43e500d04 100644 --- a/test/integration/Quota.test.ts +++ b/test/integration/Quota.test.ts @@ -1,4 +1,4 @@ -import type { Stats } from 'fs'; +import type { Stats } from 'node:fs'; import fetch from 'cross-fetch'; import type { Response } from 'cross-fetch'; import { ensureDir, pathExists, stat } from 'fs-extra'; diff --git a/test/integration/RedisLocker.test.ts b/test/integration/RedisLocker.test.ts index baa4db5f3..d25ebad27 100644 --- a/test/integration/RedisLocker.test.ts +++ b/test/integration/RedisLocker.test.ts @@ -1,4 +1,4 @@ -import EventEmitter from 'events'; +import EventEmitter from 'node:events'; import fetch from 'cross-fetch'; import Redis, { ReplyError } from 'ioredis'; import type { App } from '../../src'; diff --git a/test/integration/RequestParser.test.ts b/test/integration/RequestParser.test.ts index a9923c25d..121ba7f8b 100644 --- a/test/integration/RequestParser.test.ts +++ b/test/integration/RequestParser.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { BasicETagHandler, SingleRootIdentifierStrategy } from '../../src'; import { BasicRequestParser } from '../../src/http/input/BasicRequestParser'; diff --git a/test/integration/SparqlStorage.test.ts b/test/integration/SparqlStorage.test.ts index 92cf9c4c1..6dd55bc57 100644 --- a/test/integration/SparqlStorage.test.ts +++ b/test/integration/SparqlStorage.test.ts @@ -1,4 +1,4 @@ -import { promises as fs } from 'fs'; +import { promises as fs } from 'node:fs'; import { joinFilePath } from '../../src/'; import type { App } from '../../src/'; import { putResource } from '../util/FetchUtil'; diff --git a/test/integration/WebhookChannel2023.test.ts b/test/integration/WebhookChannel2023.test.ts index 2ed314b49..a61a36d70 100644 --- a/test/integration/WebhookChannel2023.test.ts +++ b/test/integration/WebhookChannel2023.test.ts @@ -1,5 +1,5 @@ -import { createServer } from 'http'; -import type { IncomingMessage, Server, ServerResponse } from 'http'; +import { createServer } from 'node:http'; +import type { IncomingMessage, Server, ServerResponse } from 'node:http'; import { fetch } from 'cross-fetch'; import { createRemoteJWKSet, jwtVerify } from 'jose'; import type { NamedNode } from 'n3'; diff --git a/test/unit/http/UnsecureWebSocketsProtocol.test.ts b/test/unit/http/UnsecureWebSocketsProtocol.test.ts index 1abfd1ed2..65268caea 100644 --- a/test/unit/http/UnsecureWebSocketsProtocol.test.ts +++ b/test/unit/http/UnsecureWebSocketsProtocol.test.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; import type { WebSocket } from 'ws'; import { RepresentationMetadata } from '../../../src/http/representation/RepresentationMetadata'; import { UnsecureWebSocketsProtocol } from '../../../src/http/UnsecureWebSocketsProtocol'; diff --git a/test/unit/http/ldp/GetOperationHandler.test.ts b/test/unit/http/ldp/GetOperationHandler.test.ts index f171a7b0d..7191d58fb 100644 --- a/test/unit/http/ldp/GetOperationHandler.test.ts +++ b/test/unit/http/ldp/GetOperationHandler.test.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { GetOperationHandler } from '../../../../src/http/ldp/GetOperationHandler'; import type { Operation } from '../../../../src/http/Operation'; import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation'; diff --git a/test/unit/http/ldp/HeadOperationHandler.test.ts b/test/unit/http/ldp/HeadOperationHandler.test.ts index 9396ff2bd..388d5a4f6 100644 --- a/test/unit/http/ldp/HeadOperationHandler.test.ts +++ b/test/unit/http/ldp/HeadOperationHandler.test.ts @@ -1,4 +1,4 @@ -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { HeadOperationHandler } from '../../../../src/http/ldp/HeadOperationHandler'; import type { Operation } from '../../../../src/http/Operation'; import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation'; diff --git a/test/unit/http/output/BasicResponseWriter.test.ts b/test/unit/http/output/BasicResponseWriter.test.ts index ed2acb579..8368c617e 100644 --- a/test/unit/http/output/BasicResponseWriter.test.ts +++ b/test/unit/http/output/BasicResponseWriter.test.ts @@ -1,5 +1,5 @@ -import { EventEmitter } from 'events'; -import { PassThrough } from 'stream'; +import { EventEmitter } from 'node:events'; +import { PassThrough } from 'node:stream'; import type { MockResponse } from 'node-mocks-http'; import { createResponse } from 'node-mocks-http'; import { BasicResponseWriter } from '../../../../src/http/output/BasicResponseWriter'; diff --git a/test/unit/http/representation/BasicRepresentation.test.ts b/test/unit/http/representation/BasicRepresentation.test.ts index 80f3ab6db..4085ae47e 100644 --- a/test/unit/http/representation/BasicRepresentation.test.ts +++ b/test/unit/http/representation/BasicRepresentation.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { DataFactory } from 'n3'; import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation'; diff --git a/test/unit/identity/configuration/IdentityProviderFactory.test.ts b/test/unit/identity/configuration/IdentityProviderFactory.test.ts index 59aa20440..78b74fd13 100644 --- a/test/unit/identity/configuration/IdentityProviderFactory.test.ts +++ b/test/unit/identity/configuration/IdentityProviderFactory.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import { exportJWK, generateKeyPair } from 'jose'; import type * as Koa from 'koa'; import type { ErrorHandler } from '../../../../src/http/output/error/ErrorHandler'; diff --git a/test/unit/identity/interaction/client-credentials/util/BaseClientCredentialsStore.test.ts b/test/unit/identity/interaction/client-credentials/util/BaseClientCredentialsStore.test.ts index beea7a2e4..6f3352076 100644 --- a/test/unit/identity/interaction/client-credentials/util/BaseClientCredentialsStore.test.ts +++ b/test/unit/identity/interaction/client-credentials/util/BaseClientCredentialsStore.test.ts @@ -14,7 +14,7 @@ import { InternalServerError } from '../../../../../../src/util/errors/InternalS const STORAGE_TYPE = 'clientCredentials'; const secret = 'verylongstringof64bytes'; -jest.mock('crypto', (): any => ({ randomBytes: (): string => secret })); +jest.mock('node:crypto', (): any => ({ randomBytes: (): string => secret })); describe('A BaseClientCredentialsStore', (): void => { const webId = 'http://example.com/card#me'; diff --git a/test/unit/identity/interaction/pod/util/OwnerMetadataWriter.test.ts b/test/unit/identity/interaction/pod/util/OwnerMetadataWriter.test.ts index 350912e9c..c845b0861 100644 --- a/test/unit/identity/interaction/pod/util/OwnerMetadataWriter.test.ts +++ b/test/unit/identity/interaction/pod/util/OwnerMetadataWriter.test.ts @@ -1,4 +1,4 @@ -import type { ServerResponse } from 'http'; +import type { ServerResponse } from 'node:http'; import { createResponse } from 'node-mocks-http'; import { RepresentationMetadata } from '../../../../../../src/http/representation/RepresentationMetadata'; import { OwnerMetadataWriter } from '../../../../../../src/identity/interaction/pod/util/OwnerMetadataWriter'; diff --git a/test/unit/identity/ownership/TokenOwnershipValidator.test.ts b/test/unit/identity/ownership/TokenOwnershipValidator.test.ts index e45efebf8..8016f201d 100644 --- a/test/unit/identity/ownership/TokenOwnershipValidator.test.ts +++ b/test/unit/identity/ownership/TokenOwnershipValidator.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import { DataFactory } from 'n3'; import type { Quad } from 'n3'; import rdfDereferencer from 'rdf-dereference'; diff --git a/test/unit/init/AppRunner.test.ts b/test/unit/init/AppRunner.test.ts index 479003e7f..c99b0eea0 100644 --- a/test/unit/init/AppRunner.test.ts +++ b/test/unit/init/AppRunner.test.ts @@ -115,7 +115,7 @@ const packageJSON = { }, }; -jest.mock('fs', (): Partial> => ({ +jest.mock('node:fs', (): Partial> => ({ cwd: jest.fn((): string => __dirname), existsSync: jest.fn((pth: string): boolean => typeof pth === 'string' && pth in files), })); diff --git a/test/unit/init/SeededAccountInitializer.test.ts b/test/unit/init/SeededAccountInitializer.test.ts index ee51dbc5f..4b9755919 100644 --- a/test/unit/init/SeededAccountInitializer.test.ts +++ b/test/unit/init/SeededAccountInitializer.test.ts @@ -5,7 +5,7 @@ import type { PodCreator } from '../../../src/identity/interaction/pod/util/PodC import { SeededAccountInitializer } from '../../../src/init/SeededAccountInitializer'; import { mockFileSystem } from '../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('fs-extra'); describe('A SeededAccountInitializer', (): void => { diff --git a/test/unit/init/ServerInitializer.test.ts b/test/unit/init/ServerInitializer.test.ts index f2d6de547..5c16704b3 100644 --- a/test/unit/init/ServerInitializer.test.ts +++ b/test/unit/init/ServerInitializer.test.ts @@ -1,12 +1,12 @@ -import type { Server } from 'http'; -import { Server as HttpsServer } from 'https'; +import type { Server } from 'node:http'; +import { Server as HttpsServer } from 'node:https'; import { ServerInitializer } from '../../../src/init/ServerInitializer'; import type { Logger } from '../../../src/logging/Logger'; import { getLoggerFor } from '../../../src/logging/LogUtil'; import type { HttpServerFactory } from '../../../src/server/HttpServerFactory'; // Mock so we don't create an actual HTTPS server in the test below -jest.mock('https'); +jest.mock('node:https'); jest.mock('../../../src/logging/LogUtil'); describe('ServerInitializer', (): void => { diff --git a/test/unit/init/cluster/ClusterManager.test.ts b/test/unit/init/cluster/ClusterManager.test.ts index a9538a0f6..4ee733cdb 100644 --- a/test/unit/init/cluster/ClusterManager.test.ts +++ b/test/unit/init/cluster/ClusterManager.test.ts @@ -1,12 +1,12 @@ -import cluster from 'cluster'; -import EventEmitter from 'events'; -import { cpus } from 'os'; +import cluster from 'node:cluster'; +import EventEmitter from 'node:events'; +import { cpus } from 'node:os'; import { ClusterManager } from '../../../../src'; import * as LogUtil from '../../../../src/logging/LogUtil'; -jest.mock('cluster'); -jest.mock('os', (): any => ({ - ...jest.requireActual('os'), +jest.mock('node:cluster'); +jest.mock('node:os', (): any => ({ + ...jest.requireActual('node:os'), cpus: jest.fn().mockImplementation((): any => [{}, {}, {}, {}, {}, {}]), })); @@ -15,7 +15,7 @@ mockWorker.process = { pid: 666 }; describe('A ClusterManager', (): void => { const emitter = new EventEmitter(); - const mockCluster = jest.requireMock('cluster'); + const mockCluster = jest.requireMock('node:cluster'); const mockLogger = { info: jest.fn(), warn: jest.fn() }; jest.spyOn(LogUtil, 'getLoggerFor').mockImplementation((): any => mockLogger); diff --git a/test/unit/init/migration/V6MigrationInitializer.test.ts b/test/unit/init/migration/V6MigrationInitializer.test.ts index 0e5b12235..cf0210fd2 100644 --- a/test/unit/init/migration/V6MigrationInitializer.test.ts +++ b/test/unit/init/migration/V6MigrationInitializer.test.ts @@ -29,7 +29,7 @@ type ClientCredentials = { const questionMock = jest.fn().mockImplementation((input, callback): void => callback('y')); const closeMock = jest.fn(); -jest.mock('readline', (): any => ({ +jest.mock('node:readline', (): any => ({ createInterface: jest.fn().mockImplementation((): any => ({ question: questionMock, close: closeMock, diff --git a/test/unit/logging/Logger.test.ts b/test/unit/logging/Logger.test.ts index e81073e33..88aeda11b 100644 --- a/test/unit/logging/Logger.test.ts +++ b/test/unit/logging/Logger.test.ts @@ -1,4 +1,4 @@ -import process from 'process'; +import process from 'node:process'; import { BaseLogger, WrappingLogger } from '../../../src/logging/Logger'; import type { LogMetadata, SimpleLogger } from '../../../src/logging/Logger'; diff --git a/test/unit/logging/WinstonLoggerFactory.test.ts b/test/unit/logging/WinstonLoggerFactory.test.ts index a843e96d6..d39fc22f2 100644 --- a/test/unit/logging/WinstonLoggerFactory.test.ts +++ b/test/unit/logging/WinstonLoggerFactory.test.ts @@ -1,4 +1,4 @@ -import { PassThrough } from 'stream'; +import { PassThrough } from 'node:stream'; import type { Logger } from 'winston'; import type * as Transport from 'winston-transport'; import { WinstonLogger } from '../../../src/logging/WinstonLogger'; diff --git a/test/unit/pods/generate/BaseResourcesGenerator.test.ts b/test/unit/pods/generate/BaseResourcesGenerator.test.ts index 2025392f4..9f97f5a4f 100644 --- a/test/unit/pods/generate/BaseResourcesGenerator.test.ts +++ b/test/unit/pods/generate/BaseResourcesGenerator.test.ts @@ -13,7 +13,7 @@ import { HandlebarsTemplateEngine } from '../../../../src/util/templates/Handleb import { SimpleSuffixStrategy } from '../../../util/SimpleSuffixStrategy'; import { mockFileSystem } from '../../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('fs-extra'); class DummyFactory implements FileIdentifierMapperFactory { diff --git a/test/unit/pods/generate/variables/RootFilePathHandler.test.ts b/test/unit/pods/generate/variables/RootFilePathHandler.test.ts index 67c2bee51..b76e7555f 100644 --- a/test/unit/pods/generate/variables/RootFilePathHandler.test.ts +++ b/test/unit/pods/generate/variables/RootFilePathHandler.test.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import fs from 'node:fs'; import { RootFilePathHandler } from '../../../../../src/pods/generate/variables/RootFilePathHandler'; import { TEMPLATE_VARIABLE } from '../../../../../src/pods/generate/variables/Variables'; import type { PodSettings } from '../../../../../src/pods/settings/PodSettings'; @@ -6,7 +6,7 @@ import type { ResourceLink } from '../../../../../src/storage/mapping/FileIdenti import { ConflictHttpError } from '../../../../../src/util/errors/ConflictHttpError'; import { joinFilePath } from '../../../../../src/util/PathUtil'; -jest.mock('fs'); +jest.mock('node:fs'); describe('A RootFilePathHandler', (): void => { const rootFilePath = 'files/'; diff --git a/test/unit/quota/PodQuotaStrategy.test.ts b/test/unit/quota/PodQuotaStrategy.test.ts index d8688786b..d74de91b8 100644 --- a/test/unit/quota/PodQuotaStrategy.test.ts +++ b/test/unit/quota/PodQuotaStrategy.test.ts @@ -11,7 +11,7 @@ import { SingleRootIdentifierStrategy } from '../../../src/util/identifiers/Sing import { PIM, RDF } from '../../../src/util/Vocabularies'; import { mockFileSystem } from '../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); describe('PodQuotaStrategy', (): void => { let strategy: PodQuotaStrategy; diff --git a/test/unit/quota/QuotaStrategy.test.ts b/test/unit/quota/QuotaStrategy.test.ts index 091cd0b7e..663f03012 100644 --- a/test/unit/quota/QuotaStrategy.test.ts +++ b/test/unit/quota/QuotaStrategy.test.ts @@ -6,7 +6,7 @@ import type { SizeReporter } from '../../../src/storage/size-reporter/SizeReport import { guardedStreamFrom, pipeSafely } from '../../../src/util/StreamUtil'; import { mockFileSystem } from '../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); class QuotaStrategyWrapper extends QuotaStrategy { public constructor(reporter: SizeReporter, limit: Size) { diff --git a/test/unit/server/BaseServerFactory.test.ts b/test/unit/server/BaseServerFactory.test.ts index 3f35a537e..456333d9a 100644 --- a/test/unit/server/BaseServerFactory.test.ts +++ b/test/unit/server/BaseServerFactory.test.ts @@ -1,4 +1,4 @@ -import type { RequestListener, Server } from 'http'; +import type { RequestListener, Server } from 'node:http'; import request from 'supertest'; import type { BaseServerFactoryOptions } from '../../../src/server/BaseServerFactory'; import { BaseServerFactory } from '../../../src/server/BaseServerFactory'; diff --git a/test/unit/server/HandlerServerConfigurator.test.ts b/test/unit/server/HandlerServerConfigurator.test.ts index 8a271f997..0c2ee20c1 100644 --- a/test/unit/server/HandlerServerConfigurator.test.ts +++ b/test/unit/server/HandlerServerConfigurator.test.ts @@ -1,6 +1,6 @@ -import { EventEmitter } from 'events'; -import type { IncomingMessage, Server, ServerResponse } from 'http'; -import { Readable } from 'stream'; +import { EventEmitter } from 'node:events'; +import type { IncomingMessage, Server, ServerResponse } from 'node:http'; +import { Readable } from 'node:stream'; import type { Logger } from '../../../src/logging/Logger'; import { getLoggerFor } from '../../../src/logging/LogUtil'; import { HandlerServerConfigurator } from '../../../src/server/HandlerServerConfigurator'; diff --git a/test/unit/server/WebSocketServerConfigurator.test.ts b/test/unit/server/WebSocketServerConfigurator.test.ts index 851e5b2ec..106e9e006 100644 --- a/test/unit/server/WebSocketServerConfigurator.test.ts +++ b/test/unit/server/WebSocketServerConfigurator.test.ts @@ -1,5 +1,5 @@ -import { EventEmitter } from 'events'; -import type { Server } from 'http'; +import { EventEmitter } from 'node:events'; +import type { Server } from 'node:http'; import type { WebSocket } from 'ws'; import type { Logger } from '../../../src/logging/Logger'; import { getLoggerFor } from '../../../src/logging/LogUtil'; diff --git a/test/unit/server/middleware/StaticAssetHandler.test.ts b/test/unit/server/middleware/StaticAssetHandler.test.ts index f75bf70a4..8c21bc66a 100644 --- a/test/unit/server/middleware/StaticAssetHandler.test.ts +++ b/test/unit/server/middleware/StaticAssetHandler.test.ts @@ -1,6 +1,6 @@ -import { EventEmitter } from 'events'; -import fs from 'fs'; -import { PassThrough, Readable } from 'stream'; +import { EventEmitter } from 'node:events'; +import fs from 'node:fs'; +import { PassThrough, Readable } from 'node:stream'; import { createResponse } from 'node-mocks-http'; import { StaticAssetEntry, StaticAssetHandler } from '../../../../src/server/middleware/StaticAssetHandler'; import { InternalServerError } from '../../../../src/util/errors/InternalServerError'; diff --git a/test/unit/server/notifications/ListeningActivityHandler.test.ts b/test/unit/server/notifications/ListeningActivityHandler.test.ts index ac55330ef..a5226810a 100644 --- a/test/unit/server/notifications/ListeningActivityHandler.test.ts +++ b/test/unit/server/notifications/ListeningActivityHandler.test.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../../../src/http/representation/ResourceIdentifier'; import type { Logger } from '../../../../src/logging/Logger'; diff --git a/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Storer.test.ts b/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Storer.test.ts index 6e4589593..f59625f08 100644 --- a/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Storer.test.ts +++ b/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Storer.test.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; import type { WebSocket } from 'ws'; import type { NotificationChannel } from '../../../../../src/server/notifications/NotificationChannel'; import type { diff --git a/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Util.test.ts b/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Util.test.ts index 2292c07c7..fda7bd4b8 100644 --- a/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Util.test.ts +++ b/test/unit/server/notifications/WebSocketChannel2023/WebSocket2023Util.test.ts @@ -1,4 +1,4 @@ -import type { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'node:http'; import { generateWebSocketUrl, parseWebSocketRequest, diff --git a/test/unit/storage/DataAccessorBasedStore.test.ts b/test/unit/storage/DataAccessorBasedStore.test.ts index 8299dda15..8b182cf90 100644 --- a/test/unit/storage/DataAccessorBasedStore.test.ts +++ b/test/unit/storage/DataAccessorBasedStore.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { DataFactory, Store } from 'n3'; import type { Conditions } from '../../../src'; diff --git a/test/unit/storage/LockingResourceStore.test.ts b/test/unit/storage/LockingResourceStore.test.ts index 8b96e6310..e661afb5a 100644 --- a/test/unit/storage/LockingResourceStore.test.ts +++ b/test/unit/storage/LockingResourceStore.test.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; import type { AuxiliaryIdentifierStrategy } from '../../../src/http/auxiliary/AuxiliaryIdentifierStrategy'; import type { Patch } from '../../../src/http/representation/Patch'; import type { Representation } from '../../../src/http/representation/Representation'; diff --git a/test/unit/storage/accessors/AtomicFileDataAccessor.test.ts b/test/unit/storage/accessors/AtomicFileDataAccessor.test.ts index 7cd1c0800..2da641dc1 100644 --- a/test/unit/storage/accessors/AtomicFileDataAccessor.test.ts +++ b/test/unit/storage/accessors/AtomicFileDataAccessor.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; import { AtomicFileDataAccessor } from '../../../../src/storage/accessors/AtomicFileDataAccessor'; import { ExtensionBasedMapper } from '../../../../src/storage/mapping/ExtensionBasedMapper'; @@ -9,7 +9,7 @@ import { guardedStreamFrom } from '../../../../src/util/StreamUtil'; import { CONTENT_TYPE } from '../../../../src/util/Vocabularies'; import { mockFileSystem } from '../../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('fs-extra'); describe('AtomicFileDataAccessor', (): void => { diff --git a/test/unit/storage/accessors/FileDataAccessor.test.ts b/test/unit/storage/accessors/FileDataAccessor.test.ts index a69d7c763..5440dbd6d 100644 --- a/test/unit/storage/accessors/FileDataAccessor.test.ts +++ b/test/unit/storage/accessors/FileDataAccessor.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { DataFactory } from 'n3'; import type { Representation } from '../../../../src/http/representation/Representation'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; @@ -19,7 +19,7 @@ import { mockFileSystem } from '../../../util/Util'; const { namedNode, quad } = DataFactory; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('fs-extra'); const rootFilePath = 'uploads'; diff --git a/test/unit/storage/accessors/InMemoryDataAccessor.test.ts b/test/unit/storage/accessors/InMemoryDataAccessor.test.ts index 573c16434..f00f96be8 100644 --- a/test/unit/storage/accessors/InMemoryDataAccessor.test.ts +++ b/test/unit/storage/accessors/InMemoryDataAccessor.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import { DataFactory } from 'n3'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../../../src/http/representation/ResourceIdentifier'; diff --git a/test/unit/storage/accessors/SparqlDataAccessor.test.ts b/test/unit/storage/accessors/SparqlDataAccessor.test.ts index 1524b54c8..a35a14967 100644 --- a/test/unit/storage/accessors/SparqlDataAccessor.test.ts +++ b/test/unit/storage/accessors/SparqlDataAccessor.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { SparqlEndpointFetcher } from 'fetch-sparql-endpoint'; import { DataFactory } from 'n3'; diff --git a/test/unit/storage/conversion/ConstantConverter.test.ts b/test/unit/storage/conversion/ConstantConverter.test.ts index a7d935dfe..054f49737 100644 --- a/test/unit/storage/conversion/ConstantConverter.test.ts +++ b/test/unit/storage/conversion/ConstantConverter.test.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import fs from 'node:fs'; import arrayifyStream from 'arrayify-stream'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; import type { ConstantConverterOptions } from '../../../../src/storage/conversion/ConstantConverter'; diff --git a/test/unit/storage/conversion/FormToJsonConverter.test.ts b/test/unit/storage/conversion/FormToJsonConverter.test.ts index 4f7d89d35..afa3702c6 100644 --- a/test/unit/storage/conversion/FormToJsonConverter.test.ts +++ b/test/unit/storage/conversion/FormToJsonConverter.test.ts @@ -1,4 +1,4 @@ -import { stringify } from 'querystring'; +import { stringify } from 'node:querystring'; import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation'; import { FormToJsonConverter } from '../../../../src/storage/conversion/FormToJsonConverter'; import { readableToString } from '../../../../src/util/StreamUtil'; diff --git a/test/unit/storage/conversion/RdfToQuadConverter.test.ts b/test/unit/storage/conversion/RdfToQuadConverter.test.ts index 335d74e54..b1ca6caad 100644 --- a/test/unit/storage/conversion/RdfToQuadConverter.test.ts +++ b/test/unit/storage/conversion/RdfToQuadConverter.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import fetch, { Headers } from 'cross-fetch'; import { DataFactory } from 'n3'; diff --git a/test/unit/storage/keyvalue/JsonFileStorage.test.ts b/test/unit/storage/keyvalue/JsonFileStorage.test.ts index 6aa648647..ae93b5118 100644 --- a/test/unit/storage/keyvalue/JsonFileStorage.test.ts +++ b/test/unit/storage/keyvalue/JsonFileStorage.test.ts @@ -3,7 +3,7 @@ import { JsonFileStorage } from '../../../../src/storage/keyvalue/JsonFileStorag import type { ReadWriteLocker } from '../../../../src/util/locking/ReadWriteLocker'; import { mockFileSystem } from '../../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); jest.mock('fs-extra'); describe('A JsonFileStorage', (): void => { diff --git a/test/unit/storage/mapping/BaseFileIdentifierMapper.test.ts b/test/unit/storage/mapping/BaseFileIdentifierMapper.test.ts index b08dca2f4..e8fb2ba98 100644 --- a/test/unit/storage/mapping/BaseFileIdentifierMapper.test.ts +++ b/test/unit/storage/mapping/BaseFileIdentifierMapper.test.ts @@ -3,7 +3,7 @@ import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpE import { NotFoundHttpError } from '../../../../src/util/errors/NotFoundHttpError'; import { trimTrailingSlashes } from '../../../../src/util/PathUtil'; -jest.mock('fs'); +jest.mock('node:fs'); describe('An BaseFileIdentifierMapper', (): void => { const base = 'http://test.com/'; diff --git a/test/unit/storage/mapping/ExtensionBasedMapper.test.ts b/test/unit/storage/mapping/ExtensionBasedMapper.test.ts index d1392c196..541739855 100644 --- a/test/unit/storage/mapping/ExtensionBasedMapper.test.ts +++ b/test/unit/storage/mapping/ExtensionBasedMapper.test.ts @@ -1,4 +1,4 @@ -import fs from 'fs'; +import fs from 'node:fs'; import { ExtensionBasedMapper, ExtensionBasedMapperFactory, @@ -8,7 +8,7 @@ import { NotFoundHttpError } from '../../../../src/util/errors/NotFoundHttpError import { NotImplementedHttpError } from '../../../../src/util/errors/NotImplementedHttpError'; import { trimTrailingSlashes } from '../../../../src/util/PathUtil'; -jest.mock('fs'); +jest.mock('node:fs'); describe('An ExtensionBasedMapper', (): void => { const base = 'http://test.com/'; diff --git a/test/unit/storage/mapping/FixedContentTypeMapper.test.ts b/test/unit/storage/mapping/FixedContentTypeMapper.test.ts index 575da27c2..c5ee7a364 100644 --- a/test/unit/storage/mapping/FixedContentTypeMapper.test.ts +++ b/test/unit/storage/mapping/FixedContentTypeMapper.test.ts @@ -3,7 +3,7 @@ import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpE import { NotFoundHttpError } from '../../../../src/util/errors/NotFoundHttpError'; import { trimTrailingSlashes } from '../../../../src/util/PathUtil'; -jest.mock('fs'); +jest.mock('node:fs'); describe('An FixedContentTypeMapper', (): void => { const base = 'http://test.com/'; diff --git a/test/unit/storage/size-reporter/FileSizeReporter.test.ts b/test/unit/storage/size-reporter/FileSizeReporter.test.ts index fd911a230..4f8ce379e 100644 --- a/test/unit/storage/size-reporter/FileSizeReporter.test.ts +++ b/test/unit/storage/size-reporter/FileSizeReporter.test.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; import type { ResourceIdentifier } from '../../../../src/http/representation/ResourceIdentifier'; import type { FileIdentifierMapper, ResourceLink } from '../../../../src/storage/mapping/FileIdentifierMapper'; @@ -7,7 +7,7 @@ import { UNIT_BYTES } from '../../../../src/storage/size-reporter/Size'; import { joinFilePath } from '../../../../src/util/PathUtil'; import { mockFileSystem } from '../../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); describe('A FileSizeReporter', (): void => { // Folder size is fixed to 4 in the mock diff --git a/test/unit/storage/validators/QuotaValidator.test.ts b/test/unit/storage/validators/QuotaValidator.test.ts index e496f5842..a6a17789e 100644 --- a/test/unit/storage/validators/QuotaValidator.test.ts +++ b/test/unit/storage/validators/QuotaValidator.test.ts @@ -1,5 +1,5 @@ -import type { Readable } from 'stream'; -import { PassThrough } from 'stream'; +import type { Readable } from 'node:stream'; +import { PassThrough } from 'node:stream'; import type { ValidatorInput } from '../../../../src/http/auxiliary/Validator'; import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation'; import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata'; diff --git a/test/unit/util/FetchUtil.test.ts b/test/unit/util/FetchUtil.test.ts index 7f1121e93..7229d3921 100644 --- a/test/unit/util/FetchUtil.test.ts +++ b/test/unit/util/FetchUtil.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import type { Quad } from '@rdfjs/types'; import arrayifyStream from 'arrayify-stream'; import type { Response } from 'cross-fetch'; diff --git a/test/unit/util/GuardedStream.test.ts b/test/unit/util/GuardedStream.test.ts index 6b4c556e8..b1226247e 100644 --- a/test/unit/util/GuardedStream.test.ts +++ b/test/unit/util/GuardedStream.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import type { Logger } from '../../../src/logging/Logger'; import { getLoggerFor } from '../../../src/logging/LogUtil'; import { guardStream, isGuarded } from '../../../src/util/GuardedStream'; diff --git a/test/unit/util/PathUtil.test.ts b/test/unit/util/PathUtil.test.ts index 340a02c8e..b2938d989 100644 --- a/test/unit/util/PathUtil.test.ts +++ b/test/unit/util/PathUtil.test.ts @@ -1,4 +1,4 @@ -import { promises as fsPromises } from 'fs'; +import { promises as fsPromises } from 'node:fs'; import type { TargetExtractor } from '../../../src/http/input/identifier/TargetExtractor'; import type { ResourceIdentifier } from '../../../src/http/representation/ResourceIdentifier'; import type { HttpRequest } from '../../../src/server/HttpRequest'; diff --git a/test/unit/util/ResourceUtil.test.ts b/test/unit/util/ResourceUtil.test.ts index b6bc25c12..98a778a99 100644 --- a/test/unit/util/ResourceUtil.test.ts +++ b/test/unit/util/ResourceUtil.test.ts @@ -1,5 +1,5 @@ import 'jest-rdf'; -import type { Readable } from 'stream'; +import type { Readable } from 'node:stream'; import type { Literal, NamedNode } from 'n3'; import { BasicRepresentation } from '../../../src/http/representation/BasicRepresentation'; import type { Representation } from '../../../src/http/representation/Representation'; diff --git a/test/unit/util/SliceStream.test.ts b/test/unit/util/SliceStream.test.ts index 271eac2ce..2a9d12e19 100644 --- a/test/unit/util/SliceStream.test.ts +++ b/test/unit/util/SliceStream.test.ts @@ -1,4 +1,4 @@ -import { Readable } from 'stream'; +import { Readable } from 'node:stream'; import { RangeNotSatisfiedHttpError } from '../../../src/util/errors/RangeNotSatisfiedHttpError'; import { SliceStream } from '../../../src/util/SliceStream'; import { readableToString } from '../../../src/util/StreamUtil'; diff --git a/test/unit/util/StreamUtil.test.ts b/test/unit/util/StreamUtil.test.ts index 2027282ed..743ef4e2b 100644 --- a/test/unit/util/StreamUtil.test.ts +++ b/test/unit/util/StreamUtil.test.ts @@ -1,4 +1,4 @@ -import { PassThrough, Readable } from 'stream'; +import { PassThrough, Readable } from 'node:stream'; import arrayifyStream from 'arrayify-stream'; import { BlankNode, Literal, NamedNode, Quad, Store } from 'n3'; import type { Logger } from '../../../src/logging/Logger'; diff --git a/test/unit/util/locking/BaseReadWriteLocker.test.ts b/test/unit/util/locking/BaseReadWriteLocker.test.ts index 7e2235f3e..cd00f5c31 100644 --- a/test/unit/util/locking/BaseReadWriteLocker.test.ts +++ b/test/unit/util/locking/BaseReadWriteLocker.test.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from 'events'; +import { EventEmitter } from 'node:events'; import type { ResourceIdentifier } from '../../../../src/http/representation/ResourceIdentifier'; import { BaseReadWriteLocker } from '../../../../src/util/locking/BaseReadWriteLocker'; import type { ResourceLocker } from '../../../../src/util/locking/ResourceLocker'; diff --git a/test/unit/util/locking/RedisLocker.test.ts b/test/unit/util/locking/RedisLocker.test.ts index 68734d70d..1ba0b799a 100644 --- a/test/unit/util/locking/RedisLocker.test.ts +++ b/test/unit/util/locking/RedisLocker.test.ts @@ -1,4 +1,4 @@ -import EventEmitter from 'events'; +import EventEmitter from 'node:events'; import type { Redis } from 'ioredis'; import type { ReadWriteLocker, ResourceLocker } from '../../../../src'; import { InternalServerError } from '../../../../src'; diff --git a/test/unit/util/templates/TemplateUtil.test.ts b/test/unit/util/templates/TemplateUtil.test.ts index 20268a933..3b8a14ef9 100644 --- a/test/unit/util/templates/TemplateUtil.test.ts +++ b/test/unit/util/templates/TemplateUtil.test.ts @@ -2,7 +2,7 @@ import { resolveAssetPath } from '../../../../src/util/PathUtil'; import { getTemplateFilePath, readTemplate } from '../../../../src/util/templates/TemplateUtil'; import { mockFileSystem } from '../../../util/Util'; -jest.mock('fs'); +jest.mock('node:fs'); describe('TemplateUtil', (): void => { describe('#getTemplateFilePath', (): void => { diff --git a/test/util/Util.ts b/test/util/Util.ts index f551fd8bf..61782e02f 100644 --- a/test/util/Util.ts +++ b/test/util/Util.ts @@ -1,5 +1,5 @@ -import type { Dirent, Stats } from 'fs'; -import { PassThrough, Readable } from 'stream'; +import type { Dirent, Stats } from 'node:fs'; +import { PassThrough, Readable } from 'node:stream'; import type { SystemError } from '../../src/util/errors/SystemError'; import Describe = jest.Describe; @@ -106,7 +106,7 @@ export function compareMaps(map1: Map, map2: Map