chore: Update node style imports (#11277)

- crypto → node:crypto
  - fs → node:fs
  - fs/promises → node:fs/promises
  - path → node:path
  - http → node:http
  - https → node:https
  - stream → node:stream
  - buffer → node:buffer
  - url → node:url
  - os → node:os
  - net → node:net
  - dns → node:dns
  - events → node:events
  - readline → node:readline
  - querystring → node:querystring
  - util → node:util
This commit is contained in:
Tom Moor
2026-01-26 20:51:50 -05:00
committed by GitHub
parent 838a1e7428
commit 00fb4d1af7
85 changed files with 118 additions and 118 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import {
import { isoBase64URL } from "@simplewebauthn/server/helpers";
import type { AuthenticatorTransportFuture } from "@simplewebauthn/server";
import Router from "koa-router";
import { randomBytes } from "crypto";
import { randomBytes } from "node:crypto";
import { User, UserPasskey, Team } from "@server/models";
import auth from "@server/middlewares/authentication";
import validate from "@server/middlewares/validate";
+1 -1
View File
@@ -1,4 +1,4 @@
import querystring from "querystring";
import querystring from "node:querystring";
import { InvalidRequestError } from "@server/errors";
import fetch from "@server/utils/fetch";
import { SlackUtils } from "../shared/SlackUtils";
+4 -4
View File
@@ -1,6 +1,6 @@
import { existsSync, copyFileSync } from "fs";
import { readFile } from "fs/promises";
import path from "path";
import { existsSync, copyFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import path from "node:path";
import FormData from "form-data";
import { ensureDirSync } from "fs-extra";
import { FileOperationState, FileOperationType } from "@shared/types";
@@ -15,7 +15,7 @@ import {
buildUser,
} from "@server/test/factories";
import { getTestServer } from "@server/test/support";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
const server = getTestServer();
+1 -1
View File
@@ -1,4 +1,4 @@
import { existsSync, mkdirSync } from "fs";
import { existsSync, mkdirSync } from "node:fs";
import env from "@server/env";
import Logger from "@server/logging/Logger";
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { faker } from "@faker-js/faker";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import WelcomeEmail from "@server/emails/templates/WelcomeEmail";
import { TeamDomain } from "@server/models";
import Collection from "@server/models/Collection";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import { readFile } from "fs-extra";
import invariant from "invariant";
import { CollectionPermission, UserRole } from "@shared/types";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import type { AttachmentPreset } from "@shared/types";
import type { User } from "@server/models";
import { Attachment } from "@server/models";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import {
FileOperationFormat,
FileOperationType,
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import { createContext } from "@server/context";
import Attachment from "@server/models/Attachment";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import * as Y from "yjs";
import { TextEditMode } from "@shared/types";
import { APIUpdateExtension } from "@server/collaboration/APIUpdateExtension";
+1 -1
View File
@@ -1,5 +1,5 @@
import { faker } from "@faker-js/faker";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { UserRole } from "@shared/types";
import { AuthenticationProvider, TeamDomain } from "@server/models";
import { randomString } from "@shared/random";
+1 -1
View File
@@ -1,7 +1,7 @@
/* oxlint-disable no-console */
// oxlint-disable-next-line import/order
import environment from "./utils/environment";
import os from "os";
import os from "node:os";
import wellKnownServices from "nodemailer/lib/well-known/services.json";
import {
validate,
+3 -3
View File
@@ -4,14 +4,14 @@ import env from "./env";
import "./logging/tracer"; // must come before importing any instrumented module
import http from "http";
import https from "https";
import http from "node:http";
import https from "node:https";
import type { Context } from "koa";
import Koa from "koa";
import helmet from "koa-helmet";
import logger from "koa-logger";
import Router from "koa-router";
import type { AddressInfo } from "net";
import type { AddressInfo } from "node:net";
import stoppable from "stoppable";
import throng from "throng";
import escape from "lodash/escape";
+1 -1
View File
@@ -1,5 +1,5 @@
/* oxlint-disable no-console */
import type { IncomingMessage } from "http";
import type { IncomingMessage } from "node:http";
import { styleText } from "node:util";
import isArray from "lodash/isArray";
import isEmpty from "lodash/isEmpty";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import type { Context, Next } from "koa";
import { contentSecurityPolicy } from "koa-helmet";
import uniq from "lodash/uniq";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import type { Next } from "koa";
import type { APIContext } from "@server/types";
import { safeEqual } from "@server/utils/crypto";
+2 -2
View File
@@ -1,5 +1,5 @@
import { createReadStream } from "fs";
import path from "path";
import { createReadStream } from "node:fs";
import path from "node:path";
import type { File } from "formidable";
import type {
InferAttributes,
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { randomString } from "@shared/random";
import slugify from "@shared/utils/slugify";
import {
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import type {
InferAttributes,
InferCreationAttributes,
+2 -2
View File
@@ -1,5 +1,5 @@
import crypto from "crypto";
import { URL } from "url";
import crypto from "node:crypto";
import { URL } from "node:url";
import { subMinutes } from "date-fns";
import type { InferAttributes, InferCreationAttributes } from "sequelize";
import { type SaveOptions } from "sequelize";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { addHours, addMinutes, subMinutes } from "date-fns";
import JWT from "jsonwebtoken";
import type { Context } from "koa";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import isNil from "lodash/isNil";
import type {
InferAttributes,
+1 -1
View File
@@ -1,5 +1,5 @@
import { faker } from "@faker-js/faker";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { TeamPreference } from "@shared/types";
import { buildDocument, buildTeam } from "@server/test/factories";
import User from "../User";
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import type { NotificationEventType } from "@shared/types";
import { NotificationEventDefaults } from "@shared/types";
import env from "@server/env";
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import env from "@server/env";
import SubscriptionHelper from "./SubscriptionHelper";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import queryString from "query-string";
import env from "@server/env";
+3 -3
View File
@@ -1,6 +1,6 @@
import fs from "fs";
import http from "http";
import path from "path";
import fs from "node:fs";
import http from "node:http";
import path from "node:path";
import formidable from "formidable";
import type Koa from "koa";
import escape from "lodash/escape";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import type { FileOperation } from "@server/models";
import { presentUser } from ".";
+1 -1
View File
@@ -5,7 +5,7 @@ import truncate from "lodash/truncate";
import { Fragment, Node } from "prosemirror-model";
import type { CreateOptions, CreationAttributes, Transaction } from "sequelize";
import { UniqueConstraintError } from "sequelize";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { randomElement } from "@shared/random";
import type { ImportInput, ImportTaskInput } from "@shared/schema";
import type {
+1 -1
View File
@@ -5,7 +5,7 @@ import uniqBy from "lodash/uniqBy";
import { Fragment, Node } from "prosemirror-model";
import type { WhereOptions } from "sequelize";
import { Transaction } from "sequelize";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import type { ImportTaskInput, ImportTaskOutput } from "@shared/schema";
import type {
ImportableIntegrationService,
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import type JSZip from "jszip";
import escapeRegExp from "lodash/escapeRegExp";
import type { NavigationNode } from "@shared/types";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import { FileOperation } from "@server/models";
import { buildFileOperation } from "@server/test/factories";
import ImportJSONTask from "./ImportJSONTask";
+2 -2
View File
@@ -1,9 +1,9 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import find from "lodash/find";
import mime from "mime-types";
import { Fragment, Node } from "prosemirror-model";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import type { ProsemirrorData } from "@shared/types";
import { schema, serializer } from "@server/editor";
import Logger from "@server/logging/Logger";
@@ -1,5 +1,5 @@
/* oxlint-disable @typescript-eslint/no-empty-function */
import path from "path";
import path from "node:path";
import { FileOperation } from "@server/models";
import { buildFileOperation } from "@server/test/factories";
import ImportMarkdownZipTask from "./ImportMarkdownZipTask";
+2 -2
View File
@@ -1,8 +1,8 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import escapeRegExp from "lodash/escapeRegExp";
import mime from "mime-types";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import documentImporter from "@server/commands/documentImporter";
import { createContext } from "@server/context";
import Logger from "@server/logging/Logger";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import chunk from "lodash/chunk";
import truncate from "lodash/truncate";
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { subWeeks } from "date-fns";
import { QueryTypes } from "sequelize";
import { Minute } from "@shared/utils/time";
+1 -1
View File
@@ -1,4 +1,4 @@
import { createHash } from "crypto";
import { createHash } from "node:crypto";
import { AttachmentPreset } from "@shared/types";
import attachmentCreator from "@server/commands/attachmentCreator";
import { createContext } from "@server/context";
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { AttachmentPreset, CollectionPermission } from "@shared/types";
import { UserMembership } from "@server/models";
import Attachment from "@server/models/Attachment";
+1 -1
View File
@@ -1,6 +1,6 @@
import Router from "koa-router";
import type { WhereOptions } from "sequelize";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { AttachmentPreset } from "@shared/types";
import { bytesToHumanReadable, getFileNameFromUrl } from "@shared/utils/files";
import { AttachmentValidation } from "@shared/validations";
+1 -1
View File
@@ -1,5 +1,5 @@
import { faker } from "@faker-js/faker";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { buildUser, buildTeam } from "@server/test/factories";
import { getTestServer, setSelfHosted } from "@server/test/support";
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { buildUser, buildAdmin, buildTeam } from "@server/test/factories";
import { getTestServer, setSelfHosted } from "@server/test/support";
+2 -2
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fractionalIndex from "fractional-index";
import fs from "fs-extra";
import invariant from "invariant";
@@ -12,7 +12,7 @@ import uniq from "lodash/uniq";
import mime from "mime-types";
import type { Order, ScopeOptions, WhereOptions } from "sequelize";
import { Op, Sequelize } from "sequelize";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import type { NavigationNode } from "@shared/types";
import {
FileOperationFormat,
+1 -1
View File
@@ -1,4 +1,4 @@
import stream from "stream";
import stream from "node:stream";
import type { Context, Next } from "koa";
import { Readable } from "readable-stream";
+1 -1
View File
@@ -1,4 +1,4 @@
import querystring from "querystring";
import querystring from "node:querystring";
import type { Next } from "koa";
import { Pagination } from "@shared/constants";
import { InvalidRequestError } from "@server/errors";
@@ -1,5 +1,5 @@
import queryString from "query-string";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { randomElement } from "@shared/random";
import { NotificationEventType } from "@shared/types";
import NotificationSettingsHelper from "@server/models/helpers/NotificationSettingsHelper";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import Router from "koa-router";
import contentDisposition from "content-disposition";
import JSZip from "jszip";
+1 -1
View File
@@ -1,4 +1,4 @@
import dns from "dns";
import dns from "node:dns";
import Router from "koa-router";
import { traceFunction } from "@server/logging/tracing";
import { MentionType, UnfurlResourceType } from "@shared/types";
+3 -3
View File
@@ -1,6 +1,6 @@
import fs from "fs";
import path from "path";
import util from "util";
import fs from "node:fs";
import path from "node:path";
import util from "node:util";
import type { Context, Next } from "koa";
import escape from "lodash/escape";
import { Sequelize } from "sequelize";
+2 -2
View File
@@ -1,5 +1,5 @@
import crypto from "crypto";
import path from "path";
import crypto from "node:crypto";
import path from "node:path";
import { formatRFC7231 } from "date-fns";
import Koa from "koa";
import Router from "koa-router";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { Scope } from "@shared/types";
import { OAuthAuthentication, OAuthAuthorizationCode } from "@server/models";
import {
+1 -1
View File
@@ -1,5 +1,5 @@
import "./bootstrap";
import * as readline from "readline";
import * as readline from "node:readline";
import { Transaction } from "sequelize";
import {
+4 -4
View File
@@ -1,7 +1,7 @@
import type { IncomingMessage } from "http";
import type http from "http";
import type { Duplex } from "stream";
import url from "url";
import type { IncomingMessage } from "node:http";
import type http from "node:http";
import type { Duplex } from "node:stream";
import url from "node:url";
import { Redis } from "@hocuspocus/extension-redis";
import { Throttle } from "@hocuspocus/extension-throttle";
import { Server } from "@hocuspocus/server";
+1 -1
View File
@@ -1,5 +1,5 @@
/* oxlint-disable @typescript-eslint/no-var-requires */
import type { Server } from "https";
import type { Server } from "node:https";
import type { BaseContext } from "koa";
import Koa from "koa";
import compress from "koa-compress";
+3 -3
View File
@@ -1,6 +1,6 @@
import type { IncomingMessage } from "http";
import type http from "http";
import type { Duplex } from "stream";
import type { IncomingMessage } from "node:http";
import type http from "node:http";
import type { Duplex } from "node:stream";
import cookie from "cookie";
import type Koa from "koa";
import IO from "socket.io";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import type { InferAttributes, InferCreationAttributes } from "sequelize";
import sequelizeStrictAttributes from "sequelize-strict-attributes";
import type { SequelizeOptions } from "sequelize-typescript";
+2 -2
View File
@@ -1,5 +1,5 @@
import type { Blob } from "buffer";
import type { Readable } from "stream";
import type { Blob } from "node:buffer";
import type { Readable } from "node:stream";
import type { PresignedPost } from "@aws-sdk/s3-presigned-post";
import omit from "lodash/omit";
import FileHelper from "@shared/editor/lib/FileHelper";
+4 -4
View File
@@ -1,7 +1,7 @@
import { Blob } from "buffer";
import { mkdir, unlink, rmdir } from "fs/promises";
import path from "path";
import { Readable } from "stream";
import { Blob } from "node:buffer";
import { mkdir, unlink, rmdir } from "node:fs/promises";
import path from "node:path";
import { Readable } from "node:stream";
import type { PresignedPost } from "@aws-sdk/s3-presigned-post";
import fs from "fs-extra";
import invariant from "invariant";
+2 -2
View File
@@ -1,5 +1,5 @@
import path from "path";
import type { Readable } from "stream";
import path from "node:path";
import type { Readable } from "node:stream";
import type { ObjectCannedACL } from "@aws-sdk/client-s3";
import {
S3Client,
+2 -2
View File
@@ -1,5 +1,5 @@
import http from "http";
import type { AddressInfo } from "net";
import http from "node:http";
import type { AddressInfo } from "node:net";
import type Koa from "koa";
// oxlint-disable-next-line no-restricted-imports
import nodeFetch from "node-fetch";
+1 -1
View File
@@ -4,7 +4,7 @@ import isNull from "lodash/isNull";
import { Node } from "prosemirror-model";
import type { InferCreationAttributes } from "sequelize";
import type { DeepPartial } from "utility-types";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { randomString } from "@shared/random";
import type { ProsemirrorData, ReactionSummary } from "@shared/types";
import {
+1 -1
View File
@@ -1,7 +1,7 @@
import "reflect-metadata";
import sharedEnv from "@shared/env";
import env from "@server/env";
import { EventEmitter } from "events";
import { EventEmitter } from "node:events";
// Increase the default max listeners for EventEmitter to prevent warnings in tests
// This needs to be done before any modules that use EventEmitter are loaded
+1 -1
View File
@@ -11,7 +11,7 @@ declare module "@outlinewiki/koa-passport" {
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { IncomingMessage } from "http";
import { IncomingMessage } from "node:http";
// oxlint-disable-next-line
import Express from "express";
import { Request } from "koa";
+2 -2
View File
@@ -1,6 +1,6 @@
declare module "tunnel-agent" {
import { Agent as HttpAgent } from "http";
import { Agent as HttpsAgent } from "https";
import { Agent as HttpAgent } from "node:http";
import { Agent as HttpsAgent } from "node:https";
interface TunnelOptions {
proxy: {
+2 -2
View File
@@ -1,6 +1,6 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import { tmpdir } from "os";
import { tmpdir } from "node:os";
import ImportHelper from "./ImportHelper";
describe("ImportHelper", () => {
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import { deserializeFilename } from "./fs";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import { glob } from "glob";
import type Router from "koa-router";
import isArray from "lodash/isArray";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomInt } from "crypto";
import { randomInt } from "node:crypto";
import { Minute } from "@shared/utils/time";
import Redis from "@server/storage/redis";
import { safeEqual } from "./crypto";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
import type JSZip from "jszip";
import tmp from "tmp";
+1 -1
View File
@@ -1,4 +1,4 @@
import querystring from "querystring";
import querystring from "node:querystring";
import { addMonths } from "date-fns";
import type { Context } from "koa";
import pick from "lodash/pick";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
/**
* Compare two strings in constant time to prevent timing attacks.
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomBytes, createHmac } from "crypto";
import { randomBytes, createHmac } from "node:crypto";
import { safeEqual } from "./crypto";
/**
+2 -2
View File
@@ -1,5 +1,5 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import dotenv from "@dotenvx/dotenvx";
let environment: Record<string, string> = {};
+2 -2
View File
@@ -1,6 +1,6 @@
/* oxlint-disable no-restricted-imports, react/rules-of-hooks */
import type http from "http";
import type https from "https";
import type http from "node:http";
import type https from "node:https";
import nodeFetch, { type RequestInit, type Response } from "node-fetch";
import { getProxyForUrl } from "proxy-from-env";
import tunnelAgent, { type TunnelAgent } from "tunnel-agent";
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import fs from "fs-extra";
/**
+1 -1
View File
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";
import i18n from "i18next";
import backend from "i18next-fs-backend";
import { languages } from "@shared/i18n";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { Scope } from "@shared/types";
import { OAuthInterface } from "./OAuthInterface";
import {
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import type {
RefreshTokenModel,
AuthorizationCodeModel,
+1 -1
View File
@@ -1,5 +1,5 @@
import { expect } from "@jest/globals";
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import env from "@server/env";
import parseAttachmentIds from "./parseAttachmentIds";
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import { addMinutes, subMinutes } from "date-fns";
import type { Context } from "koa";
import type {
+2 -2
View File
@@ -1,5 +1,5 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import Logger from "@server/logging/Logger";
export type Chunk = {
+2 -2
View File
@@ -1,5 +1,5 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import env from "../env";
/**
+1 -1
View File
@@ -1,4 +1,4 @@
import crypto from "crypto";
import crypto from "node:crypto";
import env from "@server/env";
import Collection from "@server/models/Collection";
import Document from "@server/models/Document";
+1 -1
View File
@@ -1,4 +1,4 @@
import { randomUUID } from "crypto";
import { randomUUID } from "node:crypto";
import { Buckets } from "./models/helpers/AttachmentHelper";
import { ValidateKey } from "./validation";
+2 -2
View File
@@ -1,5 +1,5 @@
import fs from "fs";
import path from "path";
import fs from "node:fs";
import path from "node:path";
import react from "@vitejs/plugin-react-oxc";
import browserslistToEsbuild from "browserslist-to-esbuild";
import webpackStats from "rollup-plugin-webpack-stats";