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

@@ -6,7 +6,7 @@ import {
DigestingPassThrough,
ValidatingPassThrough,
inferChunkSize,
} from '@signalapp/libsignal-client/dist/incremental_mac';
} from '@signalapp/libsignal-client/dist/incremental_mac.js';
import { ipcMain, protocol } from 'electron';
import { LRUCache } from 'lru-cache';
import { randomBytes } from 'node:crypto';
@@ -17,7 +17,7 @@ import { PassThrough, type Writable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import z from 'zod';
import GrowingFile from 'growing-file';
import { isNumber } from 'lodash';
import lodash from 'lodash';
import {
type DecryptAttachmentToSinkOptionsType,
@@ -65,6 +65,8 @@ import {
getTempPath,
} from './attachments.js';
const { isNumber } = lodash;
const log = createLogger('attachment_channel');
let initialized = false;

View File

@@ -7,7 +7,7 @@ import { join, relative, normalize } from 'node:path';
import pMap from 'p-map';
import fastGlob from 'fast-glob';
import fse from 'fs-extra';
import { map, isString } from 'lodash';
import lodash from 'lodash';
import normalizePath from 'normalize-path';
import { isPathInside } from '../ts/util/isPathInside.js';
import { DAY } from '../ts/util/durations/index.js';
@@ -22,6 +22,8 @@ import type { LocalAttachmentV2Type } from '../ts/types/Attachment.js';
import * as Errors from '../ts/types/errors.js';
import { createLogger } from '../ts/logging/log.js';
const { map, isString } = lodash;
const log = createLogger('attachments');
const PATH = 'attachments.noindex';

View File

@@ -4,11 +4,15 @@
import { readFileSync, unlinkSync } from 'node:fs';
import { sync as writeFileSync } from 'write-file-atomic';
import { get } from 'lodash';
import { set } from 'lodash/fp';
import lodash from 'lodash';
import lodashFp from 'lodash/fp.js';
import { strictAssert } from '../ts/util/assert.js';
import { createLogger } from '../ts/logging/log.js';
const { set } = lodashFp;
const { get } = lodash;
const log = createLogger('base_config');
const ENCODING = 'utf8';

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { app, crashReporter, ipcMain as ipc } from 'electron';
import { realpath, readdir, readFile, unlink, stat } from 'fs-extra';
import fsExtra from 'fs-extra';
import { basename, join } from 'node:path';
import { toJSONString as dumpToJSONString } from '@signalapp/libsignal-client/dist/Minidump';
import { toJSONString as dumpToJSONString } from '@signalapp/libsignal-client/dist/Minidump.js';
import z from 'zod';
import type { LoggerType } from '../ts/types/Logging.js';
@@ -14,6 +14,8 @@ import { isNotNil } from '../ts/util/isNotNil.js';
import OS from '../ts/util/os/osMain.js';
import { parseUnknown } from '../ts/util/schemas.js';
const { realpath, readdir, readFile, unlink, stat } = fsExtra;
// See https://github.com/rust-minidump/rust-minidump/blob/main/minidump-processor/json-schema.md
const dumpString = z.string().or(z.null()).optional();
const dumpNumber = z.number().or(z.null()).optional();

View File

@@ -4,7 +4,7 @@
import { join } from 'node:path';
import { readFileSync } from 'node:fs';
import { app } from 'electron';
import { merge } from 'lodash';
import lodash from 'lodash';
import * as LocaleMatcher from '@formatjs/intl-localematcher';
import { z } from 'zod';
import { setupI18n } from '../ts/util/setupI18nMain.js';
@@ -19,6 +19,8 @@ import type { LocalizerType } from '../ts/types/Util.js';
import * as Errors from '../ts/types/errors.js';
import { parseUnknown } from '../ts/util/schemas.js';
const { merge } = lodash;
type CompactLocaleMessagesType = ReadonlyArray<string | null>;
type CompactLocaleKeysType = ReadonlyArray<string>;

View File

@@ -4,13 +4,13 @@
import { join, normalize, extname, dirname, basename } from 'node:path';
import { pathToFileURL } from 'node:url';
import * as os from 'node:os';
import { chmod, realpath, writeFile } from 'fs-extra';
import fsExtra from 'fs-extra';
import { randomBytes } from 'node:crypto';
import { createParser } from 'dashdash';
import fastGlob from 'fast-glob';
import PQueue from 'p-queue';
import { get, pick, isNumber, isBoolean, some, debounce, noop } from 'lodash';
import lodash from 'lodash';
import {
app,
BrowserWindow,
@@ -32,7 +32,10 @@ import {
import type { MenuItemConstructorOptions, Settings } from 'electron';
import { z } from 'zod';
import packageJson from '../package.json';
import {
version as packageVersion,
productName,
} from '../ts/util/packageJson.js';
import * as GlobalErrors from './global_errors.js';
import { setup as setupCrashReports } from './crashReports.js';
import { setup as setupSpellChecker } from './spell_check.js';
@@ -126,6 +129,9 @@ import { safeParseLoose, safeParseUnknown } from '../ts/util/schemas.js';
import { getAppErrorIcon } from '../ts/util/getAppErrorIcon.js';
import { promptOSAuth } from '../ts/util/os/promptOSAuthMain.js';
const { chmod, realpath, writeFile } = fsExtra;
const { get, pick, isNumber, isBoolean, some, debounce, noop } = lodash;
const log = createLogger('app/main');
const updaterLog = log.child('updater');
@@ -2119,7 +2125,7 @@ app.on('ready', async () => {
}
log.info('app ready');
log.info(`starting version ${packageJson.version}`);
log.info(`starting version ${packageVersion}`);
// This logging helps us debug user reports about broken devices.
{
@@ -2695,7 +2701,7 @@ ipc.on('get-config', async event => {
}
const parsed = safeParseLoose(rendererConfigSchema, {
name: packageJson.productName,
name: productName,
availableLocales: getResolvedMessagesLocale().availableLocales,
resolvedTranslationsLocale: getResolvedMessagesLocale().name,
resolvedTranslationsLocaleDirection: getResolvedMessagesLocale().direction,

View File

@@ -1,7 +1,7 @@
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { isString } from 'lodash';
import lodash from 'lodash';
import type { LocalizerType } from '../ts/types/I18N.js';
import type {
@@ -10,6 +10,8 @@ import type {
MenuActionsType,
} from '../ts/types/menu.js';
const { isString } = lodash;
export type CreateTemplateOptionsType = MenuOptionsType & MenuActionsType;
export const createTemplate = (

View File

@@ -3,7 +3,7 @@
import { app } from 'electron';
import packageJson from '../package.json';
import { name } from '../ts/util/packageJson.js';
import { createLogger } from '../ts/logging/log.js';
import * as GlobalErrors from './global_errors.js';
@@ -15,7 +15,7 @@ GlobalErrors.addHandler();
// set such that only we have read access to our files
process.umask(0o077);
export const AUMID = `org.whispersystems.${packageJson.name}`;
export const AUMID = `org.whispersystems.${name}`;
log.info('Set Windows Application User Model ID (AUMID)', {
AUMID,
});