Qualify CJS-only module imports

This commit is contained in:
Fedor Indutny
2025-09-19 13:05:51 -07:00
committed by GitHub
parent 140241b83f
commit 40eaf078cc
401 changed files with 1278 additions and 593 deletions

View File

@@ -2,12 +2,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import PQueue from 'p-queue';
import { isNumber, omit, orderBy } from 'lodash';
import lodash from 'lodash';
import { PublicKey, type KyberPreKeyRecord } from '@signalapp/libsignal-client';
import {
AccountEntropyPool,
BackupKey,
} from '@signalapp/libsignal-client/dist/AccountKeys';
} from '@signalapp/libsignal-client/dist/AccountKeys.js';
import { Readable } from 'node:stream';
import EventTarget from './EventTarget.js';
@@ -73,6 +73,8 @@ import { isLinkAndSyncEnabled } from '../util/isLinkAndSyncEnabled.js';
import { getMessageQueueTime } from '../util/getMessageQueueTime.js';
import { canAttemptRemoteBackupDownload } from '../util/isBackupEnabled.js';
const { isNumber, omit, orderBy } = lodash;
const log = createLogger('AccountManager');
type StorageKeyByServiceIdKind = {

View File

@@ -3,7 +3,7 @@
/* eslint-disable no-bitwise */
import { isBoolean, isNumber, isString, noop, omit } from 'lodash';
import lodash from 'lodash';
import PQueue from 'p-queue';
import { v7 as getGuid } from 'uuid';
@@ -170,6 +170,8 @@ import {
MessageRequestResponseSource,
} from '../types/MessageRequestResponseEvent.js';
const { isBoolean, isNumber, isString, noop, omit } = lodash;
const log = createLogger('MessageReceiver');
const GROUPV2_ID_LENGTH = 32;

View File

@@ -5,7 +5,7 @@
/* eslint-disable more/no-then */
/* eslint-disable no-param-reassign */
import { reject } from 'lodash';
import lodash from 'lodash';
import { z } from 'zod';
import type {
@@ -46,6 +46,8 @@ import type { GroupSendToken } from '../types/GroupSendEndorsements.js';
import { isSignalServiceId } from '../util/isSignalConversation.js';
import * as Bytes from '../Bytes.js';
const { reject } = lodash;
const log = createLogger('OutgoingMessage');
export const enum SenderCertificateMode {

View File

@@ -30,7 +30,7 @@ export {
SignedPreKeyIdType,
SignedPreKeyType,
UnprocessedType,
} from '../sql/Interface.js';
} from '../sql/Interface.ts';
export type StorageServiceCallOptionsType = {
credentials?: StorageServiceCredentials;

View File

@@ -9,7 +9,7 @@
import type { RequestInit, Response } from 'node-fetch';
import fetch from 'node-fetch';
import type { Agent } from 'node:https';
import { escapeRegExp, isNumber, isString, isObject, throttle } from 'lodash';
import lodash from 'lodash';
import PQueue from 'p-queue';
import { v4 as getGuid } from 'uuid';
import { z } from 'zod';
@@ -21,7 +21,7 @@ import type {
Aci,
Pni,
} from '@signalapp/libsignal-client';
import { AccountAttributes } from '@signalapp/libsignal-client/dist/net';
import { AccountAttributes } from '@signalapp/libsignal-client/dist/net.js';
import { assertDev, strictAssert } from '../util/assert.js';
import * as durations from '../util/durations/index.js';
@@ -101,6 +101,8 @@ import type { StripeDonationAmount, CardDetail } from '../types/Donations.js';
import { badgeFromServerSchema } from '../badges/parseBadgesFromServer.js';
import { ZERO_DECIMAL_CURRENCIES } from '../util/currency.js';
const { escapeRegExp, isNumber, isString, isObject, throttle } = lodash;
const log = createLogger('WebAPI');
// Note: this will break some code that expects to be able to use err.response when a

View File

@@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { client as WebSocketClient } from 'websocket';
import ws from 'websocket';
import type { connection as WebSocket } from 'websocket';
import type { IncomingMessage } from 'node:http';
@@ -17,6 +17,8 @@ import * as Timers from '../Timers.js';
import { ConnectTimeoutError, HTTPError } from './Errors.js';
import { handleStatusCode, translateError } from './Utils.js';
const { client: WebSocketClient } = ws;
const log = createLogger('WebSocket');
const TEN_SECONDS = 10 * durations.SECOND;

View File

@@ -40,7 +40,7 @@ import type {
ChatServerMessageAck,
ChatServiceListener,
ConnectionEventsListener,
} from '@signalapp/libsignal-client/dist/net/Chat';
} from '@signalapp/libsignal-client/dist/net/Chat.js';
import type { EventHandler } from './EventTarget.js';
import EventTarget from './EventTarget.js';

View File

@@ -3,7 +3,7 @@
import { EventEmitter } from 'node:events';
import { Readable } from 'node:stream';
import { noop } from 'lodash';
import lodash from 'lodash';
import type { connection as WebSocket } from 'websocket';
import Long from 'long';
@@ -22,6 +22,8 @@ import type {
} from './Types.d.ts';
import { RateLimitedError } from './RateLimitedError.js';
const { noop } = lodash;
export type CDSSocketBaseOptionsType = Readonly<{
logger: LoggerType;
socket: WebSocket;

View File

@@ -3,11 +3,11 @@
import { createWriteStream } from 'node:fs';
import { stat } from 'node:fs/promises';
import { isNumber } from 'lodash';
import lodash from 'lodash';
import type { Readable, Writable } from 'node:stream';
import { Transform } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { ensureFile } from 'fs-extra';
import fsExtra from 'fs-extra';
import { createLogger } from '../logging/log.js';
import * as Errors from '../types/errors.js';
@@ -53,6 +53,10 @@ import { getValue } from '../RemoteConfig.js';
import { parseIntOrThrow } from '../util/parseIntOrThrow.js';
import { HTTPError } from './Errors.js';
const { ensureFile } = fsExtra;
const { isNumber } = lodash;
const log = createLogger('downloadAttachment');
export function getCdnKey(attachment: ProcessedAttachment): string {

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import Long from 'long';
import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup';
import { isNumber } from 'lodash';
import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup.js';
import lodash from 'lodash';
import { assertDev, strictAssert } from '../util/assert.js';
import { dropNull, shallowDropNull } from '../util/dropNull.js';
@@ -40,6 +40,8 @@ import { createName } from '../util/attachmentPath.js';
import { partitionBodyAndNormalAttachments } from '../types/Attachment.js';
import { isNotNil } from '../util/isNotNil.js';
const { isNumber } = lodash;
const FLAGS = Proto.DataMessage.Flags;
export const ATTACHMENT_MAX = 32;

View File

@@ -1,7 +1,7 @@
// Copyright 2016 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { without } from 'lodash';
import lodash from 'lodash';
import { createLogger } from '../../logging/log.js';
import * as Bytes from '../../Bytes.js';
@@ -9,6 +9,8 @@ import { isAciString } from '../../util/isAciString.js';
import type { StorageInterface } from '../../types/Storage.d.ts';
import type { AciString, ServiceIdString } from '../../types/ServiceId.js';
const { without } = lodash;
const log = createLogger('Blocked');
export const BLOCKED_NUMBERS_ID = 'blocked';