app-builder-lib 27.0.0-alpha.3 → 27.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +3 -6
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +11 -3
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +31 -21
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +37 -44
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.js +2 -2
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/fileMatcher.d.ts +27 -2
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +204 -16
- package/dist/fileMatcher.js.map +1 -1
- package/dist/indexInternal.d.ts +6 -5
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +6 -5
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts +5 -0
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +35 -0
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +3 -1
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +9 -1
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +13 -23
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +52 -122
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +5 -5
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +2 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +0 -6
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +15 -13
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +0 -10
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +164 -34
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +2 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +20 -22
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +3 -0
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +11 -6
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +1 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +7 -2
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +4 -1
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +6 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +28 -6
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +14 -0
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +38 -59
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts +1 -0
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +12 -14
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +4 -0
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +11 -4
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +5 -11
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/launcherScript.d.ts +32 -0
- package/dist/targets/linux/launcherScript.d.ts.map +1 -0
- package/dist/targets/linux/launcherScript.js +24 -0
- package/dist/targets/linux/launcherScript.js.map +1 -0
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +1 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +3 -2
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +8 -7
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapCommand.d.ts +2 -2
- package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapCommand.js +4 -10
- package/dist/targets/linux/snap/snapCommand.js.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +17 -9
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +8 -11
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +3 -2
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +26 -49
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +3 -2
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +5 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +46 -22
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +3 -1
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +9 -6
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +1 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +4 -133
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +13 -2
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +4 -1
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +6 -3
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +11 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +45 -27
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +15 -13
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +3 -3
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +39 -0
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +71 -20
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/archCompatibility.d.ts +42 -0
- package/dist/util/archCompatibility.d.ts.map +1 -0
- package/dist/util/archCompatibility.js +202 -0
- package/dist/util/archCompatibility.js.map +1 -0
- package/dist/util/config/config.d.ts +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +4 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.js +1 -1
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +6 -3
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +23 -9
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +0 -1
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +0 -3
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +38 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -0
- package/dist/util/{yarn.js → installOrRebuild.js} +65 -14
- package/dist/util/installOrRebuild.js.map +1 -0
- package/dist/util/langs.d.ts.map +1 -1
- package/dist/util/langs.js +1 -0
- package/dist/util/langs.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts +2 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +40 -58
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +47 -0
- package/dist/util/streamSpawnToFile.d.ts.map +1 -0
- package/dist/util/streamSpawnToFile.js +110 -0
- package/dist/util/streamSpawnToFile.js.map +1 -0
- package/dist/util/toolsetLock.d.ts +2 -0
- package/dist/util/toolsetLock.d.ts.map +1 -1
- package/dist/util/toolsetLock.js +31 -5
- package/dist/util/toolsetLock.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +94 -130
- package/templates/appx/appxmanifest.xml +1 -2
- package/templates/nsis/assistedMessages.yml +17 -0
- package/templates/nsis/messages.yml +5 -0
- package/dist/util/yarn.d.ts +0 -23
- package/dist/util/yarn.d.ts.map +0 -1
- package/dist/util/yarn.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { asArray, log, retry, spawn, stripSensitiveEnvVars } from "builder-util";
|
|
1
|
+
import { asArray, log, retry, spawn, stripSensitiveEnvVars, TmpDir } from "builder-util";
|
|
2
2
|
import { isNpmNoBinLinks } from "./flags.js";
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { PM, getPackageManagerCommand } from "../node-module-collector/index.js";
|
|
6
6
|
import { detectPackageManager } from "../node-module-collector/packageManager.js";
|
|
7
|
+
import { streamSpawnToFile } from "./streamSpawnToFile.js";
|
|
7
8
|
import { rebuild as remoteRebuild } from "./rebuild.js";
|
|
8
9
|
import which from "which";
|
|
9
10
|
import _fsExtra from "fs-extra";
|
|
10
|
-
const { pathExists } = _fsExtra;
|
|
11
|
+
const { pathExists, readFile } = _fsExtra;
|
|
11
12
|
export async function installOrRebuild(config, { appDir, projectDir, workspaceRoot }, options, forceInstall = false, env) {
|
|
12
13
|
const effectiveOptions = {
|
|
13
14
|
buildFromSource: config.nativeModules?.buildDependenciesFromSource === true,
|
|
@@ -63,6 +64,29 @@ export function getGypEnv(frameworkInfo, platform, arch, buildFromSource) {
|
|
|
63
64
|
npm_config_devdir: getElectronGypCacheDir(),
|
|
64
65
|
};
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —
|
|
69
|
+
* a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff
|
|
70
|
+
* retries. Two transient classes are retriable:
|
|
71
|
+
* - Network blips while fetching from the registry.
|
|
72
|
+
* - A Windows-only cmd.exe race: cross-spawn invokes the package manager's `.cmd`/`.CMD` shim via
|
|
73
|
+
* `cmd.exe /d /s /c`, and cmd.exe re-opens the batch file between commands. Under CI load (Defender
|
|
74
|
+
* scan locks, an 8.3/temp cwd, heavy parallel I/O) that re-open intermittently fails with
|
|
75
|
+
* "The batch file cannot be found." *after* the package manager has already finished — a spurious
|
|
76
|
+
* exit code, not a missing file. The install is idempotent (a no-op once node_modules is up to
|
|
77
|
+
* date), so re-running is safe. Guarded to win32 so the narrow message match can't affect other
|
|
78
|
+
* platforms. (Durable fix: stop routing install through cmd.exe, mirroring the collector's
|
|
79
|
+
* powershell.exe -EncodedCommand spawn — tracked separately.)
|
|
80
|
+
*/
|
|
81
|
+
export function isRetriableInstallError(message) {
|
|
82
|
+
if (/ENOTFOUND|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ECONNREFUSED/.test(message)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (process.platform === "win32" && /The batch file cannot be found/i.test(message)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
66
90
|
export async function installDependencies(config, { appDir, projectDir, workspaceRoot }, options, env) {
|
|
67
91
|
const platform = options.platform || process.platform;
|
|
68
92
|
const arch = options.arch || process.arch;
|
|
@@ -86,19 +110,46 @@ export async function installDependencies(config, { appDir, projectDir, workspac
|
|
|
86
110
|
const spawnEnv = {
|
|
87
111
|
...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),
|
|
88
112
|
...env,
|
|
113
|
+
// Silence corepack's activation/download chatter so a `pnpm install` doesn't flood the build log;
|
|
114
|
+
// strict=0 so the app's `packageManager` pin can't abort the install, download prompt/notice off.
|
|
115
|
+
COREPACK_ENABLE_STRICT: "0",
|
|
116
|
+
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0",
|
|
89
117
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
const tmpDir = new TmpDir("install-dependencies");
|
|
119
|
+
try {
|
|
120
|
+
await retry(async () => {
|
|
121
|
+
// Stream install output to a file instead of inheriting/buffering it: corepack and the package
|
|
122
|
+
// managers are extremely chatty, so the common (success) path stays quiet and only surfaces the
|
|
123
|
+
// log on failure. On Windows streamSpawnToFile routes through powershell.exe -EncodedCommand
|
|
124
|
+
// rather than cmd.exe, which also sidesteps the spurious ".cmd" shim "batch file cannot be
|
|
125
|
+
// found." re-open race that previously forced the win32 retry guard below.
|
|
126
|
+
const outputFile = await tmpDir.getTempFile({ prefix: "install-", suffix: ".log" });
|
|
127
|
+
const { code, stderr } = await streamSpawnToFile(execPath, execArgs, appDir, outputFile, spawnEnv);
|
|
128
|
+
if (code !== 0) {
|
|
129
|
+
const stdout = await readFile(outputFile, "utf8").catch(() => "");
|
|
130
|
+
throw new Error(`Package install (${execPath} ${execArgs.join(" ")}) exited with code ${code}:\n${stdout}\n${stderr}`);
|
|
98
131
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
132
|
+
if (log.isDebugEnabled) {
|
|
133
|
+
const stdout = await readFile(outputFile, "utf8").catch(() => "");
|
|
134
|
+
log.debug({ stdout, stderr }, "installed dependencies");
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
retries: 3,
|
|
138
|
+
interval: 1000,
|
|
139
|
+
backoff: 2000,
|
|
140
|
+
shouldRetry: (e) => {
|
|
141
|
+
const message = e?.message ?? "";
|
|
142
|
+
const retriable = isRetriableInstallError(message);
|
|
143
|
+
if (retriable) {
|
|
144
|
+
log.warn({ error: String(message).split("\n")[0] }, "transient error during package install, retrying");
|
|
145
|
+
}
|
|
146
|
+
return retriable;
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
await tmpDir.cleanup();
|
|
152
|
+
}
|
|
102
153
|
// Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)
|
|
103
154
|
// https://github.com/electron-userland/electron-builder/issues/8024
|
|
104
155
|
return rebuild(config, { appDir, projectDir, workspaceRoot }, options);
|
|
@@ -150,4 +201,4 @@ export async function rebuild(config, { appDir, projectDir, workspaceRoot }, opt
|
|
|
150
201
|
};
|
|
151
202
|
return remoteRebuild(rebuildOptions);
|
|
152
203
|
}
|
|
153
|
-
//# sourceMappingURL=
|
|
204
|
+
//# sourceMappingURL=installOrRebuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installOrRebuild.js","sourceRoot":"","sources":["../../src/util/installOrRebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,EAAE,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAA;AAEzC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,EAAE,MAAM,EAAE,UAAU,EAAE,a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Ae;QACf,aAAa;QACb,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,EAAE,WAAW,IAAI,YAAY,CAAA;IAC9D,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe;QACf,IAAI;QACJ,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,aAAa,CAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, retry, spawn, stripSensitiveEnvVars, TmpDir } from \"builder-util\"\nimport { isNpmNoBinLinks } from \"./flags.js\"\n\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration.js\"\nimport { PM, getPackageManagerCommand } from \"../node-module-collector/index.js\"\nimport { detectPackageManager } from \"../node-module-collector/packageManager.js\"\nimport { streamSpawnToFile } from \"./streamSpawnToFile.js\"\nimport { rebuild as remoteRebuild } from \"./rebuild.js\"\nimport which from \"which\"\nimport type { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\nimport { Nullish } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nconst { pathExists, readFile } = _fsExtra\n\nexport async function installOrRebuild(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n forceInstall = false,\n env: NodeJS.ProcessEnv\n) {\n const effectiveOptions: RebuildOptions = {\n buildFromSource: config.nativeModules?.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n const dirsToCheck = [...new Set([projectDir, appDir, workspaceRoot].filter((d): d is string => !!d))]\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if ((await Promise.all(dirsToCheck.map(d => pathExists(path.join(d, fileOrDir))))).some(Boolean)) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(config, { appDir, projectDir, workspaceRoot }, effectiveOptions, env)\n } else {\n await rebuild(config, { appDir, projectDir, workspaceRoot }, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...stripSensitiveEnvVars(process.env),\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: common.npm_config_electron_mirror || \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\n/**\n * Whether a failed dependency-install spawn should be retried. Everything not matched here fails fast —\n * a genuine install error (E404, ERESOLVE, EACCES, …) must surface immediately, not after 3 backoff\n * retries. Two transient classes are retriable:\n * - Network blips while fetching from the registry.\n * - A Windows-only cmd.exe race: cross-spawn invokes the package manager's `.cmd`/`.CMD` shim via\n * `cmd.exe /d /s /c`, and cmd.exe re-opens the batch file between commands. Under CI load (Defender\n * scan locks, an 8.3/temp cwd, heavy parallel I/O) that re-open intermittently fails with\n * \"The batch file cannot be found.\" *after* the package manager has already finished — a spurious\n * exit code, not a missing file. The install is idempotent (a no-op once node_modules is up to\n * date), so re-running is safe. Guarded to win32 so the narrow message match can't affect other\n * platforms. (Durable fix: stop routing install through cmd.exe, mirroring the collector's\n * powershell.exe -EncodedCommand spawn — tracked separately.)\n */\nexport function isRetriableInstallError(message: string): boolean {\n if (/ENOTFOUND|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ECONNREFUSED/.test(message)) {\n return true\n }\n if (process.platform === \"win32\" && /The batch file cannot be found/i.test(message)) {\n return true\n }\n return false\n}\n\nexport async function installDependencies(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n env: NodeJS.ProcessEnv\n): Promise<any> {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n const searchPaths = [projectDir, appDir].concat(workspaceRoot ? [workspaceRoot] : [])\n const { pm, resolvedDirectory: _resolvedWorkspaceDir } = await detectPackageManager(searchPaths)\n\n log.info({ pm, platform, arch, projectDir, appDir, workspaceRoot: _resolvedWorkspaceDir }, \"installing dependencies\")\n\n const execArgs = [\"install\"]\n if (pm === PM.YARN) {\n execArgs.push(\"--prefer-offline\")\n } else if (pm === PM.YARN_BERRY) {\n if (isNpmNoBinLinks()) {\n execArgs.push(\"--no-bin-links\")\n }\n }\n\n const execPath = getPackageManagerCommand(pm)\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n\n const spawnEnv = {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...env,\n // Silence corepack's activation/download chatter so a `pnpm install` doesn't flood the build log;\n // strict=0 so the app's `packageManager` pin can't abort the install, download prompt/notice off.\n COREPACK_ENABLE_STRICT: \"0\",\n COREPACK_ENABLE_DOWNLOAD_PROMPT: \"0\",\n }\n\n const tmpDir = new TmpDir(\"install-dependencies\")\n try {\n await retry(\n async () => {\n // Stream install output to a file instead of inheriting/buffering it: corepack and the package\n // managers are extremely chatty, so the common (success) path stays quiet and only surfaces the\n // log on failure. On Windows streamSpawnToFile routes through powershell.exe -EncodedCommand\n // rather than cmd.exe, which also sidesteps the spurious \".cmd\" shim \"batch file cannot be\n // found.\" re-open race that previously forced the win32 retry guard below.\n const outputFile = await tmpDir.getTempFile({ prefix: \"install-\", suffix: \".log\" })\n const { code, stderr } = await streamSpawnToFile(execPath, execArgs, appDir, outputFile, spawnEnv)\n if (code !== 0) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n throw new Error(`Package install (${execPath} ${execArgs.join(\" \")}) exited with code ${code}:\\n${stdout}\\n${stderr}`)\n }\n if (log.isDebugEnabled) {\n const stdout = await readFile(outputFile, \"utf8\").catch(() => \"\")\n log.debug({ stdout, stderr }, \"installed dependencies\")\n }\n },\n {\n retries: 3,\n interval: 1000,\n backoff: 2000,\n shouldRetry: (e: any) => {\n const message = e?.message ?? \"\"\n const retriable = isRetriableInstallError(message)\n if (retriable) {\n log.warn({ error: String(message).split(\"\\n\")[0] }, \"transient error during package install, retrying\")\n }\n return retriable\n },\n }\n )\n } finally {\n await tmpDir.cleanup()\n }\n\n // Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)\n // https://github.com/electron-userland/electron-builder/issues/8024\n return rebuild(config, { appDir, projectDir, workspaceRoot }, options)\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = process.platform === \"win32\" ? which.sync(\"node-gyp\") : \"node-gyp\"\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array<string> | null\n}\n\nexport interface DirectoryPaths {\n appDir: string\n projectDir: string\n workspaceRoot: string | Nullish\n}\n\n/** @internal */\nexport async function rebuild(config: Configuration, { appDir, projectDir, workspaceRoot }: DirectoryPaths, options: RebuildOptions) {\n const buildFromSource = options.buildFromSource === true\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n\n const {\n frameworkInfo: { version: electronVersion },\n } = options\n const projectRootPath = workspaceRoot || projectDir || appDir\n const logInfo = {\n electronVersion,\n arch,\n buildFromSource,\n workspaceRoot,\n projectDir: log.filePath(projectDir) || \"./\",\n appDir: log.filePath(appDir) || \"./\",\n }\n log.info(logInfo, \"executing @electron/rebuild\")\n\n const mode = config.nativeModules?.rebuildMode ?? \"sequential\"\n const rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath,\n mode,\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
|
package/dist/util/langs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langs.d.ts","sourceRoot":"","sources":["../../src/util/langs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"langs.d.ts","sourceRoot":"","sources":["../../src/util/langs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UA4B5B,CAAA;AASD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASrD;AAED,eAAO,MAAM,IAAI,EAAE,GA0MlB,CAAA;AAGD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyLxB,CAAA"}
|
package/dist/util/langs.js
CHANGED
package/dist/util/langs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langs.js","sourceRoot":"","sources":["../../src/util/langs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAA;AAED,uCAAuC;AAEvC,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAA;AACtD,KAAK,MAAM,EAAE,IAAI,gBAAgB,EAAE,CAAC;IAClC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,GAAG,IAAI,C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AE,EAAE,QAAQ;IACZ,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,iBAAiB;IACrB,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,MAAM;CACX,CAAA","sourcesContent":["export const bundledLanguages = [\n \"en_US\",\n \"de_DE\",\n \"fr_FR\",\n \"es_ES\",\n \"zh_CN\",\n \"zh_TW\",\n \"ja_JP\",\n \"ko_KR\",\n \"it_IT\",\n \"nl_NL\",\n \"da_DK\",\n \"sv_SE\",\n \"nb_NO\",\n \"fi_FI\",\n \"ru_RU\",\n \"pt_PT\",\n \"pt_BR\",\n \"pl_PL\",\n \"uk_UA\",\n \"cs_CZ\",\n \"sk_SK\",\n \"hu_HU\",\n \"ar_SA\",\n \"tr_TR\",\n \"th_TH\",\n \"vi_VN\",\n]\n\n// todo \"ro_RO\" \"el_GR\" \"et_EE\" \"ka_GE\"\n\nconst langToLangWithRegion = new Map<string, string>()\nfor (const id of bundledLanguages) {\n langToLangWithRegion.set(id.substring(0, id.indexOf(\"_\")), id)\n}\n\nexport function toLangWithRegion(lang: string): string {\n if (lang.includes(\"_\")) {\n return lang\n }\n\n lang = lang.toLowerCase()\n\n const result = langToLangWithRegion.get(lang)\n return result == null ? `${lang}_${lang.toUpperCase()}` : result\n}\n\nexport const lcid: any = {\n af_ZA: 1078,\n am_ET: 1118,\n ar_AE: 14337,\n ar_BH: 15361,\n ar_DZ: 5121,\n ar_EG: 3073,\n ar_IQ: 2049,\n ar_JO: 11265,\n ar_KW: 13313,\n ar_LB: 12289,\n ar_LY: 4097,\n ar_MA: 6145,\n ar_OM: 8193,\n ar_QA: 16385,\n ar_SA: 1025,\n ar_SY: 10241,\n ar_TN: 7169,\n ar_YE: 9217,\n arn_CL: 1146,\n as_IN: 1101,\n az_AZ: 2092,\n ba_RU: 1133,\n be_BY: 1059,\n bg_BG: 1026,\n bn_IN: 1093,\n bo_BT: 2129,\n bo_CN: 1105,\n br_FR: 1150,\n bs_BA: 8218,\n ca_ES: 1027,\n co_FR: 1155,\n cs_CZ: 1029,\n cy_GB: 1106,\n da_DK: 1030,\n de_AT: 3079,\n de_CH: 2055,\n de_DE: 1031,\n de_LI: 5127,\n de_LU: 4103,\n div_MV: 1125,\n dsb_DE: 2094,\n el_GR: 1032,\n en_AU: 3081,\n en_BZ: 10249,\n en_CA: 4105,\n en_CB: 9225,\n en_GB: 2057,\n en_IE: 6153,\n en_IN: 18441,\n en_JA: 8201,\n en_MY: 17417,\n en_NZ: 5129,\n en_PH: 13321,\n en_TT: 11273,\n en_US: 1033,\n en_ZA: 7177,\n en_ZW: 12297,\n es_AR: 11274,\n es_BO: 16394,\n es_CL: 13322,\n es_CO: 9226,\n es_CR: 5130,\n es_DO: 7178,\n es_EC: 12298,\n es_ES: 3082,\n es_GT: 4106,\n es_HN: 18442,\n es_MX: 2058,\n es_NI: 19466,\n es_PA: 6154,\n es_PE: 10250,\n es_PR: 20490,\n es_PY: 15370,\n es_SV: 17418,\n es_UR: 14346,\n es_US: 21514,\n es_VE: 8202,\n et_EE: 1061,\n eu_ES: 1069,\n fa_IR: 1065,\n fi_FI: 1035,\n fil_PH: 1124,\n fo_FO: 1080,\n fr_BE: 2060,\n fr_CA: 3084,\n fr_CH: 4108,\n fr_FR: 1036,\n fr_LU: 5132,\n fr_MC: 6156,\n fy_NL: 1122,\n ga_IE: 2108,\n gbz_AF: 1164,\n gl_ES: 1110,\n gsw_FR: 1156,\n gu_IN: 1095,\n ha_NG: 1128,\n he_IL: 1037,\n hi_IN: 1081,\n hr_BA: 4122,\n hr_HR: 1050,\n hu_HU: 1038,\n hy_AM: 1067,\n id_ID: 1057,\n ii_CN: 1144,\n is_IS: 1039,\n it_CH: 2064,\n it_IT: 1040,\n iu_CA: 2141,\n ja_JP: 1041,\n ka_GE: 1079,\n kh_KH: 1107,\n kk_KZ: 1087,\n kl_GL: 1135,\n kn_IN: 1099,\n ko_KR: 1042,\n kok_IN: 1111,\n ky_KG: 1088,\n lb_LU: 1134,\n lo_LA: 1108,\n lt_LT: 1063,\n lv_LV: 1062,\n mi_NZ: 1153,\n mk_MK: 1071,\n ml_IN: 1100,\n mn_CN: 2128,\n mn_MN: 1104,\n moh_CA: 1148,\n mr_IN: 1102,\n ms_BN: 2110,\n ms_MY: 1086,\n mt_MT: 1082,\n my_MM: 1109,\n nb_NO: 1044,\n ne_NP: 1121,\n nl_BE: 2067,\n nl_NL: 1043,\n nn_NO: 2068,\n ns_ZA: 1132,\n oc_FR: 1154,\n or_IN: 1096,\n pa_IN: 1094,\n pl_PL: 1045,\n ps_AF: 1123,\n pt_BR: 1046,\n pt_PT: 2070,\n qut_GT: 1158,\n quz_BO: 1131,\n quz_EC: 2155,\n quz_PE: 3179,\n rm_CH: 1047,\n ro_RO: 1048,\n ru_RU: 1049,\n rw_RW: 1159,\n sa_IN: 1103,\n sah_RU: 1157,\n se_FI: 3131,\n se_NO: 1083,\n se_SE: 2107,\n si_LK: 1115,\n sk_SK: 1051,\n sl_SI: 1060,\n sma_NO: 6203,\n sma_SE: 7227,\n smj_NO: 4155,\n smj_SE: 5179,\n smn_FI: 9275,\n sms_FI: 8251,\n sq_AL: 1052,\n sr_BA: 7194,\n sr_SP: 3098,\n sv_FI: 2077,\n sv_SE: 1053,\n sw_KE: 1089,\n syr_SY: 1114,\n ta_IN: 1097,\n te_IN: 1098,\n tg_TJ: 1064,\n th_TH: 1054,\n tk_TM: 1090,\n tmz_DZ: 2143,\n tn_ZA: 1074,\n tr_TR: 1055,\n tt_RU: 1092,\n ug_CN: 1152,\n uk_UA: 1058,\n ur_IN: 2080,\n ur_PK: 1056,\n uz_UZ: 2115,\n vi_VN: 1066,\n wen_DE: 1070,\n wo_SN: 1160,\n xh_ZA: 1076,\n yo_NG: 1130,\n zh_CHS: 4,\n zh_CHT: 31748,\n zh_CN: 2052,\n zh_HK: 3076,\n zh_MO: 5124,\n zh_SG: 4100,\n zh_TW: 1028,\n zu_ZA: 1077,\n}\n\n// noinspection SpellCheckingInspection\nexport const langIdToName = {\n ab: \"Abkhaz\",\n aa: \"Afar\",\n af: \"Afrikaans\",\n ak: \"Akan\",\n sq: \"Albanian\",\n am: \"Amharic\",\n ar: \"Arabic\",\n an: \"Aragonese\",\n hy: \"Armenian\",\n as: \"Assamese\",\n av: \"Avaric\",\n ae: \"Avestan\",\n ay: \"Aymara\",\n az: \"Azerbaijani\",\n bm: \"Bambara\",\n ba: \"Bashkir\",\n eu: \"Basque\",\n be: \"Belarusian\",\n bn: \"Bengali\",\n bh: \"Bihari\",\n bi: \"Bislama\",\n bs: \"Bosnian\",\n br: \"Breton\",\n bg: \"Bulgarian\",\n my: \"Burmese\",\n ca: \"Catalan\",\n ch: \"Chamorro\",\n ce: \"Chechen\",\n ny: \"Chichewa\",\n zh: \"Chinese\",\n cv: \"Chuvash\",\n kw: \"Cornish\",\n co: \"Corsican\",\n cr: \"Cree\",\n hr: \"Croatian\",\n cs: \"Czech\",\n da: \"Danish\",\n dv: \"Divehi\",\n nl: \"Dutch\",\n dz: \"Dzongkha\",\n en: \"English\",\n eo: \"Esperanto\",\n et: \"Estonian\",\n ee: \"Ewe\",\n fo: \"Faroese\",\n fj: \"Fijian\",\n fi: \"Finnish\",\n fr: \"French\",\n ff: \"Fula\",\n gl: \"Galician\",\n ka: \"Georgian\",\n de: \"German\",\n el: \"Greek\",\n gn: \"Guaraní\",\n gu: \"Gujarati\",\n ht: \"Haitian\",\n ha: \"Hausa\",\n he: \"Hebrew\",\n hz: \"Herero\",\n hi: \"Hindi\",\n ho: \"Hiri Motu\",\n hu: \"Hungarian\",\n ia: \"Interlingua\",\n id: \"Indonesian\",\n ie: \"Interlingue\",\n ga: \"Irish\",\n ig: \"Igbo\",\n ik: \"Inupiaq\",\n io: \"Ido\",\n is: \"Icelandic\",\n it: \"Italian\",\n iu: \"Inuktitut\",\n ja: \"Japanese\",\n jv: \"Javanese\",\n kl: \"Kalaallisut\",\n kn: \"Kannada\",\n kr: \"Kanuri\",\n ks: \"Kashmiri\",\n kk: \"Kazakh\",\n km: \"Khmer\",\n ki: \"Kikuyu\",\n rw: \"Kinyarwanda\",\n ky: \"Kyrgyz\",\n kv: \"Komi\",\n kg: \"Kongo\",\n ko: \"Korean\",\n ku: \"Kurdish\",\n kj: \"Kwanyama\",\n la: \"Latin\",\n lb: \"Luxembourgish\",\n lg: \"Ganda\",\n li: \"Limburgish\",\n ln: \"Lingala\",\n lo: \"Lao\",\n lt: \"Lithuanian\",\n lu: \"Luba-Katanga\",\n lv: \"Latvian\",\n gv: \"Manx\",\n mk: \"Macedonian\",\n mg: \"Malagasy\",\n ms: \"Malay\",\n ml: \"Malayalam\",\n mt: \"Maltese\",\n mi: \"Māori\",\n mr: \"Marathi\",\n mh: \"Marshallese\",\n mn: \"Mongolian\",\n na: \"Nauru\",\n nv: \"Navajo\",\n nd: \"Northern Ndebele\",\n ne: \"Nepali\",\n ng: \"Ndonga\",\n nb: \"Norwegian Bokmål\",\n nn: \"Norwegian Nynorsk\",\n no: \"Norwegian\",\n ii: \"Nuosu\",\n nr: \"Southern Ndebele\",\n oc: \"Occitan\",\n oj: \"Ojibwe\",\n cu: \"Old Church Slavonic\",\n om: \"Oromo\",\n or: \"Oriya\",\n os: \"Ossetian\",\n pa: \"Panjabi\",\n pi: \"Pāli\",\n fa: \"Persian\",\n pl: \"Polish\",\n ps: \"Pashto\",\n pt: \"Portuguese\",\n qu: \"Quechua\",\n rm: \"Romansh\",\n rn: \"Kirundi\",\n ro: \"Romanian\",\n ru: \"Russian\",\n sa: \"Sanskrit\",\n sc: \"Sardinian\",\n sd: \"Sindhi\",\n se: \"Northern Sami\",\n sm: \"Samoan\",\n sg: \"Sango\",\n sr: \"Serbian\",\n gd: \"Gaelic\",\n sn: \"Shona\",\n si: \"Sinhala\",\n sk: \"Slovak\",\n sl: \"Slovene\",\n so: \"Somali\",\n st: \"Southern Sotho\",\n es: \"Spanish\",\n su: \"Sundanese\",\n sw: \"Swahili\",\n ss: \"Swati\",\n sv: \"Swedish\",\n ta: \"Tamil\",\n te: \"Telugu\",\n tg: \"Tajik\",\n th: \"Thai\",\n ti: \"Tigrinya\",\n bo: \"Tibetan Standard\",\n tk: \"Turkmen\",\n tl: \"Tagalog\",\n tn: \"Tswana\",\n to: \"Tonga\",\n tr: \"Turkish\",\n ts: \"Tsonga\",\n tt: \"Tatar\",\n tw: \"Twi\",\n ty: \"Tahitian\",\n ug: \"Uyghur\",\n uk: \"Ukrainian\",\n ur: \"Urdu\",\n uz: \"Uzbek\",\n ve: \"Venda\",\n vi: \"Vietnamese\",\n vo: \"Volapük\",\n wa: \"Walloon\",\n cy: \"Welsh\",\n wo: \"Wolof\",\n fy: \"Western Frisian\",\n xh: \"Xhosa\",\n yi: \"Yiddish\",\n yo: \"Yoruba\",\n za: \"Zhuang\",\n zu: \"Zulu\",\n}\n"]}
|
|
1
|
+
{"version":3,"file":"langs.js","sourceRoot":"","sources":["../../src/util/langs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;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OAAO;IACX,EAAE,EAAE,iBAAiB;IACrB,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,MAAM;CACX,CAAA","sourcesContent":["export const bundledLanguages = [\n \"en_US\",\n \"de_DE\",\n \"fr_FR\",\n \"es_ES\",\n \"zh_CN\",\n \"zh_TW\",\n \"ja_JP\",\n \"ko_KR\",\n \"it_IT\",\n \"nl_NL\",\n \"da_DK\",\n \"sv_SE\",\n \"nb_NO\",\n \"fi_FI\",\n \"ru_RU\",\n \"pt_PT\",\n \"pt_BR\",\n \"pl_PL\",\n \"uk_UA\",\n \"cs_CZ\",\n \"sk_SK\",\n \"hu_HU\",\n \"ar_SA\",\n \"he_IL\",\n \"tr_TR\",\n \"th_TH\",\n \"vi_VN\",\n]\n\n// todo \"ro_RO\" \"el_GR\" \"et_EE\" \"ka_GE\"\n\nconst langToLangWithRegion = new Map<string, string>()\nfor (const id of bundledLanguages) {\n langToLangWithRegion.set(id.substring(0, id.indexOf(\"_\")), id)\n}\n\nexport function toLangWithRegion(lang: string): string {\n if (lang.includes(\"_\")) {\n return lang\n }\n\n lang = lang.toLowerCase()\n\n const result = langToLangWithRegion.get(lang)\n return result == null ? `${lang}_${lang.toUpperCase()}` : result\n}\n\nexport const lcid: any = {\n af_ZA: 1078,\n am_ET: 1118,\n ar_AE: 14337,\n ar_BH: 15361,\n ar_DZ: 5121,\n ar_EG: 3073,\n ar_IQ: 2049,\n ar_JO: 11265,\n ar_KW: 13313,\n ar_LB: 12289,\n ar_LY: 4097,\n ar_MA: 6145,\n ar_OM: 8193,\n ar_QA: 16385,\n ar_SA: 1025,\n ar_SY: 10241,\n ar_TN: 7169,\n ar_YE: 9217,\n arn_CL: 1146,\n as_IN: 1101,\n az_AZ: 2092,\n ba_RU: 1133,\n be_BY: 1059,\n bg_BG: 1026,\n bn_IN: 1093,\n bo_BT: 2129,\n bo_CN: 1105,\n br_FR: 1150,\n bs_BA: 8218,\n ca_ES: 1027,\n co_FR: 1155,\n cs_CZ: 1029,\n cy_GB: 1106,\n da_DK: 1030,\n de_AT: 3079,\n de_CH: 2055,\n de_DE: 1031,\n de_LI: 5127,\n de_LU: 4103,\n div_MV: 1125,\n dsb_DE: 2094,\n el_GR: 1032,\n en_AU: 3081,\n en_BZ: 10249,\n en_CA: 4105,\n en_CB: 9225,\n en_GB: 2057,\n en_IE: 6153,\n en_IN: 18441,\n en_JA: 8201,\n en_MY: 17417,\n en_NZ: 5129,\n en_PH: 13321,\n en_TT: 11273,\n en_US: 1033,\n en_ZA: 7177,\n en_ZW: 12297,\n es_AR: 11274,\n es_BO: 16394,\n es_CL: 13322,\n es_CO: 9226,\n es_CR: 5130,\n es_DO: 7178,\n es_EC: 12298,\n es_ES: 3082,\n es_GT: 4106,\n es_HN: 18442,\n es_MX: 2058,\n es_NI: 19466,\n es_PA: 6154,\n es_PE: 10250,\n es_PR: 20490,\n es_PY: 15370,\n es_SV: 17418,\n es_UR: 14346,\n es_US: 21514,\n es_VE: 8202,\n et_EE: 1061,\n eu_ES: 1069,\n fa_IR: 1065,\n fi_FI: 1035,\n fil_PH: 1124,\n fo_FO: 1080,\n fr_BE: 2060,\n fr_CA: 3084,\n fr_CH: 4108,\n fr_FR: 1036,\n fr_LU: 5132,\n fr_MC: 6156,\n fy_NL: 1122,\n ga_IE: 2108,\n gbz_AF: 1164,\n gl_ES: 1110,\n gsw_FR: 1156,\n gu_IN: 1095,\n ha_NG: 1128,\n he_IL: 1037,\n hi_IN: 1081,\n hr_BA: 4122,\n hr_HR: 1050,\n hu_HU: 1038,\n hy_AM: 1067,\n id_ID: 1057,\n ii_CN: 1144,\n is_IS: 1039,\n it_CH: 2064,\n it_IT: 1040,\n iu_CA: 2141,\n ja_JP: 1041,\n ka_GE: 1079,\n kh_KH: 1107,\n kk_KZ: 1087,\n kl_GL: 1135,\n kn_IN: 1099,\n ko_KR: 1042,\n kok_IN: 1111,\n ky_KG: 1088,\n lb_LU: 1134,\n lo_LA: 1108,\n lt_LT: 1063,\n lv_LV: 1062,\n mi_NZ: 1153,\n mk_MK: 1071,\n ml_IN: 1100,\n mn_CN: 2128,\n mn_MN: 1104,\n moh_CA: 1148,\n mr_IN: 1102,\n ms_BN: 2110,\n ms_MY: 1086,\n mt_MT: 1082,\n my_MM: 1109,\n nb_NO: 1044,\n ne_NP: 1121,\n nl_BE: 2067,\n nl_NL: 1043,\n nn_NO: 2068,\n ns_ZA: 1132,\n oc_FR: 1154,\n or_IN: 1096,\n pa_IN: 1094,\n pl_PL: 1045,\n ps_AF: 1123,\n pt_BR: 1046,\n pt_PT: 2070,\n qut_GT: 1158,\n quz_BO: 1131,\n quz_EC: 2155,\n quz_PE: 3179,\n rm_CH: 1047,\n ro_RO: 1048,\n ru_RU: 1049,\n rw_RW: 1159,\n sa_IN: 1103,\n sah_RU: 1157,\n se_FI: 3131,\n se_NO: 1083,\n se_SE: 2107,\n si_LK: 1115,\n sk_SK: 1051,\n sl_SI: 1060,\n sma_NO: 6203,\n sma_SE: 7227,\n smj_NO: 4155,\n smj_SE: 5179,\n smn_FI: 9275,\n sms_FI: 8251,\n sq_AL: 1052,\n sr_BA: 7194,\n sr_SP: 3098,\n sv_FI: 2077,\n sv_SE: 1053,\n sw_KE: 1089,\n syr_SY: 1114,\n ta_IN: 1097,\n te_IN: 1098,\n tg_TJ: 1064,\n th_TH: 1054,\n tk_TM: 1090,\n tmz_DZ: 2143,\n tn_ZA: 1074,\n tr_TR: 1055,\n tt_RU: 1092,\n ug_CN: 1152,\n uk_UA: 1058,\n ur_IN: 2080,\n ur_PK: 1056,\n uz_UZ: 2115,\n vi_VN: 1066,\n wen_DE: 1070,\n wo_SN: 1160,\n xh_ZA: 1076,\n yo_NG: 1130,\n zh_CHS: 4,\n zh_CHT: 31748,\n zh_CN: 2052,\n zh_HK: 3076,\n zh_MO: 5124,\n zh_SG: 4100,\n zh_TW: 1028,\n zu_ZA: 1077,\n}\n\n// noinspection SpellCheckingInspection\nexport const langIdToName = {\n ab: \"Abkhaz\",\n aa: \"Afar\",\n af: \"Afrikaans\",\n ak: \"Akan\",\n sq: \"Albanian\",\n am: \"Amharic\",\n ar: \"Arabic\",\n an: \"Aragonese\",\n hy: \"Armenian\",\n as: \"Assamese\",\n av: \"Avaric\",\n ae: \"Avestan\",\n ay: \"Aymara\",\n az: \"Azerbaijani\",\n bm: \"Bambara\",\n ba: \"Bashkir\",\n eu: \"Basque\",\n be: \"Belarusian\",\n bn: \"Bengali\",\n bh: \"Bihari\",\n bi: \"Bislama\",\n bs: \"Bosnian\",\n br: \"Breton\",\n bg: \"Bulgarian\",\n my: \"Burmese\",\n ca: \"Catalan\",\n ch: \"Chamorro\",\n ce: \"Chechen\",\n ny: \"Chichewa\",\n zh: \"Chinese\",\n cv: \"Chuvash\",\n kw: \"Cornish\",\n co: \"Corsican\",\n cr: \"Cree\",\n hr: \"Croatian\",\n cs: \"Czech\",\n da: \"Danish\",\n dv: \"Divehi\",\n nl: \"Dutch\",\n dz: \"Dzongkha\",\n en: \"English\",\n eo: \"Esperanto\",\n et: \"Estonian\",\n ee: \"Ewe\",\n fo: \"Faroese\",\n fj: \"Fijian\",\n fi: \"Finnish\",\n fr: \"French\",\n ff: \"Fula\",\n gl: \"Galician\",\n ka: \"Georgian\",\n de: \"German\",\n el: \"Greek\",\n gn: \"Guaraní\",\n gu: \"Gujarati\",\n ht: \"Haitian\",\n ha: \"Hausa\",\n he: \"Hebrew\",\n hz: \"Herero\",\n hi: \"Hindi\",\n ho: \"Hiri Motu\",\n hu: \"Hungarian\",\n ia: \"Interlingua\",\n id: \"Indonesian\",\n ie: \"Interlingue\",\n ga: \"Irish\",\n ig: \"Igbo\",\n ik: \"Inupiaq\",\n io: \"Ido\",\n is: \"Icelandic\",\n it: \"Italian\",\n iu: \"Inuktitut\",\n ja: \"Japanese\",\n jv: \"Javanese\",\n kl: \"Kalaallisut\",\n kn: \"Kannada\",\n kr: \"Kanuri\",\n ks: \"Kashmiri\",\n kk: \"Kazakh\",\n km: \"Khmer\",\n ki: \"Kikuyu\",\n rw: \"Kinyarwanda\",\n ky: \"Kyrgyz\",\n kv: \"Komi\",\n kg: \"Kongo\",\n ko: \"Korean\",\n ku: \"Kurdish\",\n kj: \"Kwanyama\",\n la: \"Latin\",\n lb: \"Luxembourgish\",\n lg: \"Ganda\",\n li: \"Limburgish\",\n ln: \"Lingala\",\n lo: \"Lao\",\n lt: \"Lithuanian\",\n lu: \"Luba-Katanga\",\n lv: \"Latvian\",\n gv: \"Manx\",\n mk: \"Macedonian\",\n mg: \"Malagasy\",\n ms: \"Malay\",\n ml: \"Malayalam\",\n mt: \"Maltese\",\n mi: \"Māori\",\n mr: \"Marathi\",\n mh: \"Marshallese\",\n mn: \"Mongolian\",\n na: \"Nauru\",\n nv: \"Navajo\",\n nd: \"Northern Ndebele\",\n ne: \"Nepali\",\n ng: \"Ndonga\",\n nb: \"Norwegian Bokmål\",\n nn: \"Norwegian Nynorsk\",\n no: \"Norwegian\",\n ii: \"Nuosu\",\n nr: \"Southern Ndebele\",\n oc: \"Occitan\",\n oj: \"Ojibwe\",\n cu: \"Old Church Slavonic\",\n om: \"Oromo\",\n or: \"Oriya\",\n os: \"Ossetian\",\n pa: \"Panjabi\",\n pi: \"Pāli\",\n fa: \"Persian\",\n pl: \"Polish\",\n ps: \"Pashto\",\n pt: \"Portuguese\",\n qu: \"Quechua\",\n rm: \"Romansh\",\n rn: \"Kirundi\",\n ro: \"Romanian\",\n ru: \"Russian\",\n sa: \"Sanskrit\",\n sc: \"Sardinian\",\n sd: \"Sindhi\",\n se: \"Northern Sami\",\n sm: \"Samoan\",\n sg: \"Sango\",\n sr: \"Serbian\",\n gd: \"Gaelic\",\n sn: \"Shona\",\n si: \"Sinhala\",\n sk: \"Slovak\",\n sl: \"Slovene\",\n so: \"Somali\",\n st: \"Southern Sotho\",\n es: \"Spanish\",\n su: \"Sundanese\",\n sw: \"Swahili\",\n ss: \"Swati\",\n sv: \"Swedish\",\n ta: \"Tamil\",\n te: \"Telugu\",\n tg: \"Tajik\",\n th: \"Thai\",\n ti: \"Tigrinya\",\n bo: \"Tibetan Standard\",\n tk: \"Turkmen\",\n tl: \"Tagalog\",\n tn: \"Tswana\",\n to: \"Tonga\",\n tr: \"Turkish\",\n ts: \"Tsonga\",\n tt: \"Tatar\",\n tw: \"Twi\",\n ty: \"Tahitian\",\n ug: \"Uyghur\",\n uk: \"Ukrainian\",\n ur: \"Urdu\",\n uz: \"Uzbek\",\n ve: \"Venda\",\n vi: \"Vietnamese\",\n vo: \"Volapük\",\n wa: \"Walloon\",\n cy: \"Welsh\",\n wo: \"Wolof\",\n fy: \"Western Frisian\",\n xh: \"Xhosa\",\n yi: \"Yiddish\",\n yo: \"Yoruba\",\n za: \"Zhuang\",\n zu: \"Zulu\",\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TmpDir } from "builder-util";
|
|
1
2
|
export interface AssetCatalogResult {
|
|
2
3
|
assetCatalog: Buffer;
|
|
3
4
|
icnsFile: Buffer;
|
|
@@ -7,5 +8,5 @@ export interface AssetCatalogResult {
|
|
|
7
8
|
* @param inputPath The path to the `.icon` file
|
|
8
9
|
* @returns The asset catalog and extra assets
|
|
9
10
|
*/
|
|
10
|
-
export declare function generateAssetCatalogForIcon(inputPath: string): Promise<AssetCatalogResult>;
|
|
11
|
+
export declare function generateAssetCatalogForIcon(tmpDir: TmpDir, inputPath: string): Promise<AssetCatalogResult>;
|
|
11
12
|
//# sourceMappingURL=macosIconComposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macosIconComposer.d.ts","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"macosIconComposer.d.ts","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,MAAM,EAAE,MAAM,cAAc,CAAA;AAM5C,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAoCD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA+ChH"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Adapted from https://github.com/electron/packager/pull/1806
|
|
2
2
|
import { spawn } from "builder-util";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
import * as os from "node:os";
|
|
5
4
|
import * as path from "node:path";
|
|
6
5
|
import plist from "plist";
|
|
7
6
|
import * as semver from "semver";
|
|
@@ -38,62 +37,45 @@ async function checkActoolVersion(tmpDir) {
|
|
|
38
37
|
* @param inputPath The path to the `.icon` file
|
|
39
38
|
* @returns The asset catalog and extra assets
|
|
40
39
|
*/
|
|
41
|
-
export async function generateAssetCatalogForIcon(inputPath) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"NO",
|
|
82
|
-
"--development-region",
|
|
83
|
-
"en",
|
|
84
|
-
"--target-device",
|
|
85
|
-
"mac",
|
|
86
|
-
"--minimum-deployment-target",
|
|
87
|
-
"26.0",
|
|
88
|
-
"--platform",
|
|
89
|
-
"macosx",
|
|
90
|
-
]);
|
|
91
|
-
const assetCatalog = await fs.readFile(path.resolve(outputPath, "Assets.car"));
|
|
92
|
-
const icnsFile = await fs.readFile(path.resolve(outputPath, "Icon.icns"));
|
|
93
|
-
return { assetCatalog, icnsFile };
|
|
94
|
-
}
|
|
95
|
-
finally {
|
|
96
|
-
await cleanup();
|
|
97
|
-
}
|
|
40
|
+
export async function generateAssetCatalogForIcon(tmpDir, inputPath) {
|
|
41
|
+
const tmpDirPath = await tmpDir.createTempDir({ prefix: "macos-icon-composer" });
|
|
42
|
+
await checkActoolVersion(tmpDirPath);
|
|
43
|
+
const iconPath = path.resolve(tmpDirPath, "Icon.icon");
|
|
44
|
+
const outputPath = path.resolve(tmpDirPath, "out");
|
|
45
|
+
await fs.cp(inputPath, iconPath, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
});
|
|
48
|
+
await fs.mkdir(outputPath, {
|
|
49
|
+
recursive: true,
|
|
50
|
+
});
|
|
51
|
+
await spawn("actool", [
|
|
52
|
+
iconPath,
|
|
53
|
+
"--compile",
|
|
54
|
+
outputPath,
|
|
55
|
+
"--output-format",
|
|
56
|
+
"human-readable-text",
|
|
57
|
+
"--notices",
|
|
58
|
+
"--warnings",
|
|
59
|
+
"--output-partial-info-plist",
|
|
60
|
+
path.resolve(outputPath, "assetcatalog_generated_info.plist"),
|
|
61
|
+
"--app-icon",
|
|
62
|
+
"Icon",
|
|
63
|
+
"--include-all-app-icons",
|
|
64
|
+
"--accent-color",
|
|
65
|
+
"AccentColor",
|
|
66
|
+
"--enable-on-demand-resources",
|
|
67
|
+
"NO",
|
|
68
|
+
"--development-region",
|
|
69
|
+
"en",
|
|
70
|
+
"--target-device",
|
|
71
|
+
"mac",
|
|
72
|
+
"--minimum-deployment-target",
|
|
73
|
+
"26.0",
|
|
74
|
+
"--platform",
|
|
75
|
+
"macosx",
|
|
76
|
+
]);
|
|
77
|
+
const assetCatalog = await fs.readFile(path.resolve(outputPath, "Assets.car"));
|
|
78
|
+
const icnsFile = await fs.readFile(path.resolve(outputPath, "Icon.icns"));
|
|
79
|
+
return { assetCatalog, icnsFile };
|
|
98
80
|
}
|
|
99
81
|
//# sourceMappingURL=macosIconComposer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macosIconComposer.js","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"macosIconComposer.js","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,KAAK,EAAU,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAOhC,MAAM,4BAA4B,GAAG,IAAI,KAAK,CAC5C,qIAAqI,CACtI,CAAA;AAED,KAAK,UAAU,kBAAkB,CAAC,MAAc;IAC9C,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAE/D,IAAI,WAAW,GAAuD,SAAS,CAAA;IAE/E,IAAI,gBAAgB,GAAyB,IAAI,CAAA;IACjD,IAAI,WAAW,GAAiB,IAAI,CAAA;IACpC,IAAI,CAAC;QACH,gBAAgB,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAA;QAC3D,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACr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,QAAQ,EAAE;QAC/B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;IAEF,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE;QACzB,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;IAEF,MAAM,KAAK,CAAC,QAAQ,EAAE;QACpB,QAAQ;QACR,WAAW;QACX,UAAU;QACV,iBAAiB;QACjB,qBAAqB;QACrB,WAAW;QACX,YAAY;QACZ,6BAA6B;QAC7B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,mCAAmC,CAAC;QAC7D,YAAY;QACZ,MAAM;QACN,yBAAyB;QACzB,gBAAgB;QAChB,aAAa;QACb,8BAA8B;QAC9B,IAAI;QACJ,sBAAsB;QACtB,IAAI;QACJ,iBAAiB;QACjB,KAAK;QACL,6BAA6B;QAC7B,MAAM;QACN,YAAY;QACZ,QAAQ;KACT,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;IAC9E,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;IAEzE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA;AACnC,CAAC","sourcesContent":["// Adapted from https://github.com/electron/packager/pull/1806\n\nimport { spawn, TmpDir } from \"builder-util\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"node:path\"\nimport plist from \"plist\"\nimport * as semver from \"semver\"\n\nexport interface AssetCatalogResult {\n assetCatalog: Buffer\n icnsFile: Buffer\n}\n\nconst INVALID_ACTOOL_VERSION_ERROR = new Error(\n \"Failed to check actool version. Is Xcode 26 or higher installed? See output of the `actool --version` CLI command for more details.\"\n)\n\nasync function checkActoolVersion(tmpDir: string) {\n const acToolOutputFileName = path.resolve(tmpDir, \"actool.log\")\n\n let versionInfo: Record<string, Record<string, string>> | undefined = undefined\n\n let acToolOutputFile: fs.FileHandle | null = null\n let errorQueued: Error | null = null\n try {\n acToolOutputFile = await fs.open(acToolOutputFileName, \"w\")\n await spawn(\"actool\", [\"--version\"], { stdio: [\"ignore\", acToolOutputFile.fd, acToolOutputFile.fd] })\n const acToolVersionOutput = await fs.readFile(acToolOutputFileName, \"utf8\")\n versionInfo = plist.parse(acToolVersionOutput) as Record<string, Record<string, string>>\n } catch (e: any) {\n errorQueued = e\n } finally {\n if (acToolOutputFile) {\n await acToolOutputFile.close()\n }\n }\n\n if (errorQueued || !versionInfo || !versionInfo[\"com.apple.actool.version\"] || !versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]) {\n throw INVALID_ACTOOL_VERSION_ERROR\n }\n\n const acToolVersion = versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]\n if (!semver.gte(semver.coerce(acToolVersion)!, \"26.0.0\")) {\n throw new Error(`Unsupported actool version. Must be on actool 26.0.0 or higher but found ${acToolVersion}. Install Xcode 26 or higher to get a supported version of actool.`)\n }\n}\n\n/**\n * Generates an asset catalog and extra assets that are useful for packaging the app.\n * @param inputPath The path to the `.icon` file\n * @returns The asset catalog and extra assets\n */\nexport async function generateAssetCatalogForIcon(tmpDir: TmpDir, inputPath: string): Promise<AssetCatalogResult> {\n const tmpDirPath = await tmpDir.createTempDir({ prefix: \"macos-icon-composer\" })\n\n await checkActoolVersion(tmpDirPath)\n\n const iconPath = path.resolve(tmpDirPath, \"Icon.icon\")\n const outputPath = path.resolve(tmpDirPath, \"out\")\n\n await fs.cp(inputPath, iconPath, {\n recursive: true,\n })\n\n await fs.mkdir(outputPath, {\n recursive: true,\n })\n\n await spawn(\"actool\", [\n iconPath,\n \"--compile\",\n outputPath,\n \"--output-format\",\n \"human-readable-text\",\n \"--notices\",\n \"--warnings\",\n \"--output-partial-info-plist\",\n path.resolve(outputPath, \"assetcatalog_generated_info.plist\"),\n \"--app-icon\",\n \"Icon\",\n \"--include-all-app-icons\",\n \"--accent-color\",\n \"AccentColor\",\n \"--enable-on-demand-resources\",\n \"NO\",\n \"--development-region\",\n \"en\",\n \"--target-device\",\n \"mac\",\n \"--minimum-deployment-target\",\n \"26.0\",\n \"--platform\",\n \"macosx\",\n ])\n\n const assetCatalog = await fs.readFile(path.resolve(outputPath, \"Assets.car\"))\n const icnsFile = await fs.readFile(path.resolve(outputPath, \"Icon.icns\"))\n\n return { assetCatalog, icnsFile }\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface StreamSpawnResult {
|
|
2
|
+
/** The child's exit code (null if it was killed by a signal). */
|
|
3
|
+
code: number | null;
|
|
4
|
+
/** Everything the child wrote to stderr, accumulated. */
|
|
5
|
+
stderr: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Spawns a command and streams its stdout to a file, returning the exit code and captured stderr.
|
|
9
|
+
*
|
|
10
|
+
* stdout is piped straight to `outputFile` (never buffered in memory), so arbitrarily large output —
|
|
11
|
+
* a full dependency tree, a verbose `install` log — costs no heap. stderr is small by comparison and
|
|
12
|
+
* is accumulated so the caller can surface it on failure.
|
|
13
|
+
*
|
|
14
|
+
* On Windows the package-manager command is typically a `.cmd` shim (npm.cmd/pnpm.cmd/yarn.cmd),
|
|
15
|
+
* which Node can no longer spawn directly (CVE-2024-27980). Rather than spawn with `shell: true` —
|
|
16
|
+
* which emits the DEP0190 "args with shell" deprecation warning and forces manual metacharacter
|
|
17
|
+
* escaping — wrap the invocation in a single PowerShell `-EncodedCommand`. The base64 (UTF-16LE)
|
|
18
|
+
* payload sidesteps every shell-quoting layer, and `powershell.exe` is a real executable we spawn
|
|
19
|
+
* directly with no shell. See buildPowerShellEncodedArgs for the UTF-8 / exit-code handling. This
|
|
20
|
+
* also avoids the cmd.exe "The batch file cannot be found." re-open race that plagues `.cmd` shims.
|
|
21
|
+
*
|
|
22
|
+
* Resolves with `{ code, stderr }` for ANY exit code — interpreting a non-zero code is the caller's
|
|
23
|
+
* job (e.g. `npm list` returns 1 in expected scenarios). Only genuine infrastructure failures —
|
|
24
|
+
* spawn errors and write-stream errors — reject.
|
|
25
|
+
*
|
|
26
|
+
* @param command - The command to execute
|
|
27
|
+
* @param args - Array of command-line arguments
|
|
28
|
+
* @param cwd - The working directory to execute the command in
|
|
29
|
+
* @param outputFile - The path to the file where stdout will be streamed
|
|
30
|
+
* @param env - The environment for the child process (callers are responsible for stripping secrets)
|
|
31
|
+
*/
|
|
32
|
+
export declare function streamSpawnToFile(command: string, args: string[], cwd: string, outputFile: string, env: NodeJS.ProcessEnv): Promise<StreamSpawnResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Build the argv for invoking a Windows command through `powershell.exe -EncodedCommand`.
|
|
35
|
+
*
|
|
36
|
+
* Each token is wrapped in a PowerShell single-quoted string (with embedded single quotes doubled),
|
|
37
|
+
* so no character is interpreted by a shell. The script:
|
|
38
|
+
* - pins `[Console]::OutputEncoding` to UTF-8 *without* a BOM so the JSON dependency tree is not
|
|
39
|
+
* corrupted by the console's OEM code page (and no BOM is prepended to break `JSON.parse`),
|
|
40
|
+
* - invokes the command via the call operator `&`,
|
|
41
|
+
* - re-emits the command's own exit code via `exit $LASTEXITCODE` (e.g. `npm list` returns 1 in
|
|
42
|
+
* expected scenarios, which the caller's shouldIgnore logic relies on).
|
|
43
|
+
*
|
|
44
|
+
* The whole script is base64-encoded as UTF-16LE per PowerShell's `-EncodedCommand` contract.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildPowerShellEncodedArgs(command: string, args: string[]): string[];
|
|
47
|
+
//# sourceMappingURL=streamSpawnToFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamSpawnToFile.d.ts","sourceRoot":"","sources":["../../src/util/streamSpawnToFile.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAkEtJ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAMpF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as childProcess from "child_process";
|
|
2
|
+
import { createWriteStream } from "node:fs";
|
|
3
|
+
/**
|
|
4
|
+
* Spawns a command and streams its stdout to a file, returning the exit code and captured stderr.
|
|
5
|
+
*
|
|
6
|
+
* stdout is piped straight to `outputFile` (never buffered in memory), so arbitrarily large output —
|
|
7
|
+
* a full dependency tree, a verbose `install` log — costs no heap. stderr is small by comparison and
|
|
8
|
+
* is accumulated so the caller can surface it on failure.
|
|
9
|
+
*
|
|
10
|
+
* On Windows the package-manager command is typically a `.cmd` shim (npm.cmd/pnpm.cmd/yarn.cmd),
|
|
11
|
+
* which Node can no longer spawn directly (CVE-2024-27980). Rather than spawn with `shell: true` —
|
|
12
|
+
* which emits the DEP0190 "args with shell" deprecation warning and forces manual metacharacter
|
|
13
|
+
* escaping — wrap the invocation in a single PowerShell `-EncodedCommand`. The base64 (UTF-16LE)
|
|
14
|
+
* payload sidesteps every shell-quoting layer, and `powershell.exe` is a real executable we spawn
|
|
15
|
+
* directly with no shell. See buildPowerShellEncodedArgs for the UTF-8 / exit-code handling. This
|
|
16
|
+
* also avoids the cmd.exe "The batch file cannot be found." re-open race that plagues `.cmd` shims.
|
|
17
|
+
*
|
|
18
|
+
* Resolves with `{ code, stderr }` for ANY exit code — interpreting a non-zero code is the caller's
|
|
19
|
+
* job (e.g. `npm list` returns 1 in expected scenarios). Only genuine infrastructure failures —
|
|
20
|
+
* spawn errors and write-stream errors — reject.
|
|
21
|
+
*
|
|
22
|
+
* @param command - The command to execute
|
|
23
|
+
* @param args - Array of command-line arguments
|
|
24
|
+
* @param cwd - The working directory to execute the command in
|
|
25
|
+
* @param outputFile - The path to the file where stdout will be streamed
|
|
26
|
+
* @param env - The environment for the child process (callers are responsible for stripping secrets)
|
|
27
|
+
*/
|
|
28
|
+
export function streamSpawnToFile(command, args, cwd, outputFile, env) {
|
|
29
|
+
const [spawnCommand, spawnArgs] = process.platform === "win32" ? ["powershell.exe", buildPowerShellEncodedArgs(command, args)] : [command, args];
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const outStream = createWriteStream(outputFile);
|
|
32
|
+
const child = childProcess.spawn(spawnCommand, spawnArgs, { cwd, env });
|
|
33
|
+
let stderr = "";
|
|
34
|
+
// The process can close before all piped stdout has been flushed to disk. Resolving on the
|
|
35
|
+
// child's "close" alone races the write stream and lets the caller read a TRUNCATED file
|
|
36
|
+
// (manifesting as "No JSON content found in output"). Gate the settle on BOTH the child exit
|
|
37
|
+
// (for the code/stderr) and the write stream's "finish" (all bytes flushed).
|
|
38
|
+
let exitCode = null;
|
|
39
|
+
let childClosed = false;
|
|
40
|
+
let streamFinished = false;
|
|
41
|
+
let settled = false;
|
|
42
|
+
// `pipe` ends `outStream` when stdout EOFs, which triggers its "finish" once flushed.
|
|
43
|
+
child.stdout.pipe(outStream);
|
|
44
|
+
child.stderr.on("data", chunk => {
|
|
45
|
+
stderr += chunk.toString();
|
|
46
|
+
});
|
|
47
|
+
const fail = (err) => {
|
|
48
|
+
if (settled) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
settled = true;
|
|
52
|
+
// Best-effort cleanup: stop the child and close the stream so we don't
|
|
53
|
+
// waste CPU writing to a broken fd after rejection.
|
|
54
|
+
try {
|
|
55
|
+
child.kill();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// ignore
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
outStream.destroy();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// ignore
|
|
65
|
+
}
|
|
66
|
+
reject(err);
|
|
67
|
+
};
|
|
68
|
+
const settle = () => {
|
|
69
|
+
if (settled || !childClosed || !streamFinished) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
settled = true;
|
|
73
|
+
resolve({ code: exitCode, stderr });
|
|
74
|
+
};
|
|
75
|
+
outStream.on("error", err => fail(new Error(`Failed writing process output (${command}): ${err.message}`)));
|
|
76
|
+
outStream.on("finish", () => {
|
|
77
|
+
streamFinished = true;
|
|
78
|
+
settle();
|
|
79
|
+
});
|
|
80
|
+
child.on("error", err => {
|
|
81
|
+
fail(new Error(`Process spawn (${command} ${JSON.stringify(args)}) failed: ${err.message}`));
|
|
82
|
+
});
|
|
83
|
+
child.on("close", code => {
|
|
84
|
+
exitCode = code;
|
|
85
|
+
childClosed = true;
|
|
86
|
+
settle();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Build the argv for invoking a Windows command through `powershell.exe -EncodedCommand`.
|
|
92
|
+
*
|
|
93
|
+
* Each token is wrapped in a PowerShell single-quoted string (with embedded single quotes doubled),
|
|
94
|
+
* so no character is interpreted by a shell. The script:
|
|
95
|
+
* - pins `[Console]::OutputEncoding` to UTF-8 *without* a BOM so the JSON dependency tree is not
|
|
96
|
+
* corrupted by the console's OEM code page (and no BOM is prepended to break `JSON.parse`),
|
|
97
|
+
* - invokes the command via the call operator `&`,
|
|
98
|
+
* - re-emits the command's own exit code via `exit $LASTEXITCODE` (e.g. `npm list` returns 1 in
|
|
99
|
+
* expected scenarios, which the caller's shouldIgnore logic relies on).
|
|
100
|
+
*
|
|
101
|
+
* The whole script is base64-encoded as UTF-16LE per PowerShell's `-EncodedCommand` contract.
|
|
102
|
+
*/
|
|
103
|
+
export function buildPowerShellEncodedArgs(command, args) {
|
|
104
|
+
const psQuote = (value) => `'${value.replace(/'/g, "''")}'`;
|
|
105
|
+
const invocation = ["&", psQuote(command), ...args.map(psQuote)].join(" ");
|
|
106
|
+
const script = `[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new($false); ${invocation}; exit $LASTEXITCODE`;
|
|
107
|
+
const encoded = Buffer.from(script, "utf16le").toString("base64");
|
|
108
|
+
return ["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=streamSpawnToFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamSpawnToFile.js","sourceRoot":"","sources":["../../src/util/streamSpawnToFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAS3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,IAAc,EAAE,GAAW,EAAE,UAAkB,EAAE,GAAsB;IACxH,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAE,CAAC,gBAAgB,EAAE,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAW,CAAC,CAAC,CAAE,CAAC,OAAO,EAAE,IAAI,CAAW,CAAA;IAEtK,OAAO,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxD,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAA;QAE/C,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAA;QAEvE,IAAI,MAAM,GAAG,EAAE,CAAA;QACf,2F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ream } from \"node:fs\"\n\nexport interface StreamSpawnResult {\n /** The child's exit code (null if it was killed by a signal). */\n code: number | null\n /** Everything the child wrote to stderr, accumulated. */\n stderr: string\n}\n\n/**\n * Spawns a command and streams its stdout to a file, returning the exit code and captured stderr.\n *\n * stdout is piped straight to `outputFile` (never buffered in memory), so arbitrarily large output —\n * a full dependency tree, a verbose `install` log — costs no heap. stderr is small by comparison and\n * is accumulated so the caller can surface it on failure.\n *\n * On Windows the package-manager command is typically a `.cmd` shim (npm.cmd/pnpm.cmd/yarn.cmd),\n * which Node can no longer spawn directly (CVE-2024-27980). Rather than spawn with `shell: true` —\n * which emits the DEP0190 \"args with shell\" deprecation warning and forces manual metacharacter\n * escaping — wrap the invocation in a single PowerShell `-EncodedCommand`. The base64 (UTF-16LE)\n * payload sidesteps every shell-quoting layer, and `powershell.exe` is a real executable we spawn\n * directly with no shell. See buildPowerShellEncodedArgs for the UTF-8 / exit-code handling. This\n * also avoids the cmd.exe \"The batch file cannot be found.\" re-open race that plagues `.cmd` shims.\n *\n * Resolves with `{ code, stderr }` for ANY exit code — interpreting a non-zero code is the caller's\n * job (e.g. `npm list` returns 1 in expected scenarios). Only genuine infrastructure failures —\n * spawn errors and write-stream errors — reject.\n *\n * @param command - The command to execute\n * @param args - Array of command-line arguments\n * @param cwd - The working directory to execute the command in\n * @param outputFile - The path to the file where stdout will be streamed\n * @param env - The environment for the child process (callers are responsible for stripping secrets)\n */\nexport function streamSpawnToFile(command: string, args: string[], cwd: string, outputFile: string, env: NodeJS.ProcessEnv): Promise<StreamSpawnResult> {\n const [spawnCommand, spawnArgs] = process.platform === \"win32\" ? ([\"powershell.exe\", buildPowerShellEncodedArgs(command, args)] as const) : ([command, args] as const)\n\n return new Promise<StreamSpawnResult>((resolve, reject) => {\n const outStream = createWriteStream(outputFile)\n\n const child = childProcess.spawn(spawnCommand, spawnArgs, { cwd, env })\n\n let stderr = \"\"\n // The process can close before all piped stdout has been flushed to disk. Resolving on the\n // child's \"close\" alone races the write stream and lets the caller read a TRUNCATED file\n // (manifesting as \"No JSON content found in output\"). Gate the settle on BOTH the child exit\n // (for the code/stderr) and the write stream's \"finish\" (all bytes flushed).\n let exitCode: number | null = null\n let childClosed = false\n let streamFinished = false\n let settled = false\n\n // `pipe` ends `outStream` when stdout EOFs, which triggers its \"finish\" once flushed.\n child.stdout.pipe(outStream)\n child.stderr.on(\"data\", chunk => {\n stderr += chunk.toString()\n })\n\n const fail = (err: Error) => {\n if (settled) {\n return\n }\n settled = true\n // Best-effort cleanup: stop the child and close the stream so we don't\n // waste CPU writing to a broken fd after rejection.\n try {\n child.kill()\n } catch {\n // ignore\n }\n try {\n outStream.destroy()\n } catch {\n // ignore\n }\n reject(err)\n }\n\n const settle = () => {\n if (settled || !childClosed || !streamFinished) {\n return\n }\n settled = true\n resolve({ code: exitCode, stderr })\n }\n\n outStream.on(\"error\", err => fail(new Error(`Failed writing process output (${command}): ${err.message}`)))\n outStream.on(\"finish\", () => {\n streamFinished = true\n settle()\n })\n child.on(\"error\", err => {\n fail(new Error(`Process spawn (${command} ${JSON.stringify(args)}) failed: ${err.message}`))\n })\n child.on(\"close\", code => {\n exitCode = code\n childClosed = true\n settle()\n })\n })\n}\n\n/**\n * Build the argv for invoking a Windows command through `powershell.exe -EncodedCommand`.\n *\n * Each token is wrapped in a PowerShell single-quoted string (with embedded single quotes doubled),\n * so no character is interpreted by a shell. The script:\n * - pins `[Console]::OutputEncoding` to UTF-8 *without* a BOM so the JSON dependency tree is not\n * corrupted by the console's OEM code page (and no BOM is prepended to break `JSON.parse`),\n * - invokes the command via the call operator `&`,\n * - re-emits the command's own exit code via `exit $LASTEXITCODE` (e.g. `npm list` returns 1 in\n * expected scenarios, which the caller's shouldIgnore logic relies on).\n *\n * The whole script is base64-encoded as UTF-16LE per PowerShell's `-EncodedCommand` contract.\n */\nexport function buildPowerShellEncodedArgs(command: string, args: string[]): string[] {\n const psQuote = (value: string) => `'${value.replace(/'/g, \"''\")}'`\n const invocation = [\"&\", psQuote(command), ...args.map(psQuote)].join(\" \")\n const script = `[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new($false); ${invocation}; exit $LASTEXITCODE`\n const encoded = Buffer.from(script, \"utf16le\").toString(\"base64\")\n return [\"-NoProfile\", \"-NonInteractive\", \"-EncodedCommand\", encoded]\n}\n"]}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare function withToolsetLock<T>(task: () => Promise<T>): Promise<T>;
|
|
2
|
+
export declare function withSigntoolLock<T>(task: () => Promise<T>): Promise<T>;
|
|
3
|
+
export declare function withIconsLock<T>(task: () => Promise<T>): Promise<T>;
|
|
2
4
|
//# sourceMappingURL=toolsetLock.d.ts.map
|