Bundle everything with rolldown

This commit is contained in:
Fedor Indutny
2026-03-30 11:54:59 -07:00
committed by GitHub
parent e158261fea
commit bb111a3107
2317 changed files with 22723 additions and 63514 deletions

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { BuildResult } from 'electron-builder';
import { afterAllArtifactBuild as notarizeUniversalDMG } from './notarize-universal-dmg.node.js';
import { afterAllArtifactBuild as notarizeUniversalDMG } from './notarize-universal-dmg.node.ts';
export async function afterAllArtifactBuild(
result: BuildResult

View File

@@ -2,10 +2,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { AfterPackContext } from 'electron-builder';
import { afterPack as fuseElectron } from './fuse-electron.node.js';
import { afterPack as copyPacks } from './copy-language-packs.node.js';
import { afterPack as pruneMacOSRelease } from './prune-macos-release.node.js';
import { afterPack as ensureLinuxFilePermissions } from './ensure-linux-file-permissions.node.js';
import { afterPack as fuseElectron } from './fuse-electron.node.ts';
import { afterPack as copyPacks } from './copy-language-packs.node.ts';
import { afterPack as pruneMacOSRelease } from './prune-macos-release.node.ts';
import { afterPack as ensureLinuxFilePermissions } from './ensure-linux-file-permissions.node.ts';
export async function afterPack(context: AfterPackContext): Promise<void> {
await pruneMacOSRelease(context);

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { AfterPackContext } from 'electron-builder';
import { afterSign as notarize } from './notarize.node.js';
import { afterSign as notarize } from './notarize.node.ts';
// NOTE: It is AfterPackContext here even though it is afterSign.
// See: https://www.electron.build/configuration/configuration.html#aftersign

View File

@@ -5,8 +5,8 @@ import { parse } from 'csv-parse';
import fs from 'node:fs/promises';
import { join } from 'node:path';
import { z } from 'zod';
import { _getAvailableLocales } from '../../app/locale.node.js';
import { parseUnknown } from '../util/schemas.std.js';
import { _getAvailableLocales } from '../../app/locale.node.ts';
import { parseUnknown } from '../util/schemas.std.ts';
const type = process.argv[2];
if (type !== 'countries' && type !== 'locales') {

View File

@@ -13,8 +13,8 @@ import { Format, NtExecutable } from 'pe-library';
// Note: because we don't run under electron - this is a path to binary
import ELECTRON_BINARY from 'electron';
import { drop } from '../util/drop.std.js';
import { packageJson } from '../util/packageJson.node.js';
import { drop } from '../util/drop.std.ts';
import { packageJson } from '../util/packageJson.node.ts';
const { ImageDosHeader, ImageNtHeaders, ImageDirectoryEntry } = Format;

View File

@@ -5,7 +5,7 @@ import { readFile, writeFile, readdir, readlink } from 'node:fs/promises';
import { join, basename } from 'node:path';
import pMap from 'p-map';
import { drop } from '../util/drop.std.js';
import { drop } from '../util/drop.std.ts';
async function main(): Promise<void> {
const source = process.argv[2];

View File

@@ -1,29 +0,0 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'node:path';
import { copyFileSync } from 'node:fs';
const BASE_BOWER = join(__dirname, '../../components');
// Copy
console.log();
console.log('Copying...');
const BASE_JS = join(__dirname, '../../js');
const COPY_SOURCES = [
{
src: join(BASE_BOWER, 'mp3lameencoder/lib/Mp3LameEncoder.js'),
dest: join(BASE_JS, 'Mp3LameEncoder.min.js'),
},
{
src: join(BASE_BOWER, 'webaudiorecorder/lib/WebAudioRecorderMp3.js'),
dest: join(BASE_JS, 'WebAudioRecorderMp3.js'),
},
];
for (const { src, dest } of COPY_SOURCES) {
console.log(`Copying ${src} to ${dest}`);
copyFileSync(src, dest);
}

View File

@@ -11,7 +11,7 @@ import fs from 'node:fs';
//
// Make sure to sync up the values in `util/nsis` with upstream
// `app-builder-lib`.
import { REQUIRED_LANGUAGES, LCID } from '../util/nsis.std.js';
import { REQUIRED_LANGUAGES, LCID } from '../util/nsis.std.ts';
const STRING_VARS = new Map([
[

View File

@@ -5,7 +5,7 @@ import fs from 'node:fs/promises';
import path from 'node:path';
import fastGlob from 'fast-glob';
import { strictAssert } from '../util/assert.std.js';
import { strictAssert } from '../util/assert.std.ts';
const ROOT_DIR = path.join(__dirname, '..', '..');

View File

@@ -4,7 +4,7 @@
import { readdir, mkdir, readFile, writeFile } from 'node:fs/promises';
import { join, dirname } from 'node:path';
import pMap from 'p-map';
import { isLocaleMessageType } from '../util/setupI18nMain.std.js';
import { isLocaleMessageType } from '../util/setupI18nMain.std.ts';
async function compact({
sourceDir,

View File

@@ -6,7 +6,7 @@ import { writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { promisify } from 'node:util';
import { isNotNil } from '../util/isNotNil.std.js';
import { isNotNil } from '../util/isNotNil.std.ts';
const resolve4 = promisify(resolve4Cb);
const resolve6 = promisify(resolve6Cb);

View File

@@ -7,12 +7,12 @@ import path from 'node:path';
import ts from 'typescript';
import prettier from 'prettier';
import { getICUMessageParams } from '../util/getICUMessageParams.std.js';
import type { ICUMessageParamType } from '../util/getICUMessageParams.std.js';
import { missingCaseError } from '../util/missingCaseError.std.js';
import { getICUMessageParams } from '../util/getICUMessageParams.std.ts';
import type { ICUMessageParamType } from '../util/getICUMessageParams.std.ts';
import { missingCaseError } from '../util/missingCaseError.std.ts';
import globalMessages from '../../_locales/en/messages.json';
import { DELETED_REGEXP } from './constants.std.js';
import { DELETED_REGEXP } from './constants.std.ts';
function translateParamType(
param: ICUMessageParamType,

View File

@@ -8,8 +8,8 @@ import { mkdir, mkdtemp, rm, rename } from 'node:fs/promises';
import pTimeout from 'p-timeout';
import ELECTRON_BIN from 'electron';
import { MINUTE } from '../util/durations/index.std.js';
import { explodePromise } from '../util/explodePromise.std.js';
import { MINUTE } from '../util/durations/index.std.ts';
import { explodePromise } from '../util/explodePromise.std.ts';
const ROOT_DIR = join(__dirname, '..', '..');

View File

@@ -4,7 +4,7 @@
import { createCanvas, GlobalFonts, loadImage } from '@napi-rs/canvas';
import { join } from 'node:path';
import { mkdir, rm, writeFile } from 'node:fs/promises';
import { strictAssert } from '../util/assert.std.js';
import { strictAssert } from '../util/assert.std.ts';
const cwd = __dirname;
const fontsDir = join(cwd, '..', '..', 'fonts');

View File

@@ -7,9 +7,9 @@ import { join } from 'node:path';
import z from 'zod';
import prettier from 'prettier';
import type { OptionalResourceType } from '../types/OptionalResource.std.js';
import { OptionalResourcesDictSchema } from '../types/OptionalResource.std.js';
import { parseUnknown } from '../util/schemas.std.js';
import type { OptionalResourceType } from '../types/OptionalResource.std.ts';
import { OptionalResourcesDictSchema } from '../types/OptionalResource.std.ts';
import { parseUnknown } from '../util/schemas.std.ts';
const MANIFEST_URL =
'https://updates.signal.org/dynamic/android/emoji/search/manifest.json';

View File

@@ -5,9 +5,9 @@ import { join } from 'node:path';
import { execSync } from 'node:child_process';
import { writeFileSync } from 'node:fs';
import { DAY } from '../util/durations/index.std.js';
import { packageJson } from '../util/packageJson.node.js';
import { isNotUpdatable } from '../util/version.std.js';
import { DAY } from '../util/durations/index.std.ts';
import { packageJson } from '../util/packageJson.node.ts';
import { isNotUpdatable } from '../util/version.std.ts';
const unixTimestamp = parseInt(
process.env.SOURCE_DATE_EPOCH ||

View File

@@ -8,10 +8,10 @@ import { Buffer } from 'node:buffer';
import z from 'zod';
import prettier from 'prettier';
import type { OptionalResourceType } from '../types/OptionalResource.std.js';
import { OptionalResourcesDictSchema } from '../types/OptionalResource.std.js';
import { parseUnknown } from '../util/schemas.std.js';
import { utf16ToEmoji } from '../util/utf16ToEmoji.node.js';
import type { OptionalResourceType } from '../types/OptionalResource.std.ts';
import { OptionalResourcesDictSchema } from '../types/OptionalResource.std.ts';
import { parseUnknown } from '../util/schemas.std.ts';
import { utf16ToEmoji } from '../util/utf16ToEmoji.node.ts';
const VERSION = 12;

View File

@@ -8,7 +8,7 @@ import prettier from 'prettier';
import pMap from 'p-map';
import z from 'zod';
import { authenticate, API_BASE, PROJECT_ID } from '../util/smartling.node.js';
import { authenticate, API_BASE, PROJECT_ID } from '../util/smartling.node.ts';
const { SMARTLING_USER, SMARTLING_SECRET } = process.env;

View File

@@ -3,7 +3,7 @@
import { spawnSync } from 'node:child_process';
import path from 'node:path';
import { readFileSync, writeFileSync } from 'node:fs';
import { DELETED_REGEXP } from './constants.std.js';
import { DELETED_REGEXP } from './constants.std.ts';
const rootDir = path.resolve(__dirname, '..', '..');
const messagesPath = path.join(rootDir, '_locales/en/messages.json');

View File

@@ -5,7 +5,7 @@ import type { BuildResult } from 'electron-builder';
import { notarize } from '@electron/notarize';
import { packageJson } from '../util/packageJson.node.js';
import { packageJson } from '../util/packageJson.node.ts';
export async function afterAllArtifactBuild({
platformToTargets,

View File

@@ -6,7 +6,7 @@ import type { AfterPackContext } from 'electron-builder';
import { notarize } from '@electron/notarize';
import { packageJson } from '../util/packageJson.node.js';
import { packageJson } from '../util/packageJson.node.ts';
export async function afterSign({
appOutDir,

View File

@@ -4,7 +4,7 @@
import { stat } from 'node:fs/promises';
import { join } from 'node:path';
import { packageJson } from '../util/packageJson.node.js';
import { packageJson } from '../util/packageJson.node.ts';
const NAME = packageJson.name;
const VERSION = packageJson.version;

View File

@@ -4,7 +4,7 @@
import { randomBytes } from 'node:crypto';
import { readFile } from 'node:fs/promises';
import { API_BASE, PROJECT_ID, authenticate } from '../util/smartling.node.js';
import { API_BASE, PROJECT_ID, authenticate } from '../util/smartling.node.ts';
const { SMARTLING_USER, SMARTLING_SECRET } = process.env;

View File

@@ -7,9 +7,9 @@ import fs from 'node:fs/promises';
import pLimit from 'p-limit';
import path from 'node:path';
import { MONTH } from '../util/durations/index.std.js';
import { isOlderThan } from '../util/timestamp.std.js';
import { DELETED_REGEXP, type DeletedMatch } from './constants.std.js';
import { MONTH } from '../util/durations/index.std.ts';
import { isOlderThan } from '../util/timestamp.std.ts';
import { DELETED_REGEXP, type DeletedMatch } from './constants.std.ts';
const ROOT_DIR = path.join(__dirname, '..', '..');
const MESSAGES_FILE = path.join(ROOT_DIR, '_locales', 'en', 'messages.json');

View File

@@ -11,10 +11,10 @@ import z from 'zod';
import split2 from 'split2';
import logSymbols from 'log-symbols';
import { explodePromise } from '../util/explodePromise.std.js';
import { missingCaseError } from '../util/missingCaseError.std.js';
import { SECOND } from '../util/durations/index.std.js';
import { parseUnknown } from '../util/schemas.std.js';
import { explodePromise } from '../util/explodePromise.std.ts';
import { missingCaseError } from '../util/missingCaseError.std.ts';
import { SECOND } from '../util/durations/index.std.ts';
import { parseUnknown } from '../util/schemas.std.ts';
const ROOT_DIR = join(__dirname, '..', '..');
@@ -100,6 +100,8 @@ async function launchElectron(
SIGNAL_CI_CONFIG: JSON.stringify({
storagePath,
}),
// Necessary for `tsx` to work in preload (there are no worker_threads)
ESBUILD_WORKER_THREADS: '0',
},
// Since we run `.cmd` file on Windows - use shell
shell: process.platform === 'win32',

View File

@@ -9,9 +9,9 @@ import { mkdtemp, cp } from 'node:fs/promises';
import { constants as fsConstants } from 'node:fs';
import { _electron as electron } from 'playwright';
import { packageJson } from '../util/packageJson.node.js';
import { gracefulRmRecursive } from '../util/gracefulFs.node.js';
import { consoleLogger } from '../util/consoleLogger.std.js';
import { packageJson } from '../util/packageJson.node.ts';
import { gracefulRmRecursive } from '../util/gracefulFs.node.ts';
import { consoleLogger } from '../util/consoleLogger.std.ts';
const ENVIRONMENT = 'production';
const RELEASE_DIR = join(__dirname, '..', '..', 'release');

View File

@@ -6,8 +6,8 @@ import { readFile, readdir, writeFile } from 'node:fs/promises';
import z from 'zod';
import semver from 'semver';
import { drop } from '../util/drop.std.js';
import { strictAssert } from '../util/assert.std.js';
import { drop } from '../util/drop.std.ts';
import { strictAssert } from '../util/assert.std.ts';
const { GITHUB_TOKEN } = process.env;