app-builder-lib 27.0.0-alpha.12 → 27.0.0-alpha.13
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/asar/asarUtil.js +1 -1
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +4 -1
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +5 -3
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/forceCodeSigning.d.ts +22 -0
- package/dist/codeSign/forceCodeSigning.d.ts.map +1 -0
- package/dist/codeSign/forceCodeSigning.js +18 -0
- package/dist/codeSign/forceCodeSigning.js.map +1 -0
- package/dist/codeSign/mac/macCodeSign.d.ts +13 -1
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +29 -2
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/mac/macSignatureVerifier.d.ts +23 -0
- package/dist/codeSign/mac/macSignatureVerifier.d.ts.map +1 -0
- package/dist/codeSign/mac/macSignatureVerifier.js +96 -0
- package/dist/codeSign/mac/macSignatureVerifier.js.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts +14 -2
- package/dist/codeSign/win/authenticodeSignature.d.ts.map +1 -1
- package/dist/codeSign/win/authenticodeSignature.js +78 -30
- package/dist/codeSign/win/authenticodeSignature.js.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.js +4 -3
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
- package/dist/codeSign/win/publisherName.d.ts +31 -0
- package/dist/codeSign/win/publisherName.d.ts.map +1 -0
- package/dist/codeSign/win/publisherName.js +78 -0
- package/dist/codeSign/win/publisherName.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +16 -9
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +46 -35
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts.map +1 -1
- package/dist/codeSign/win/verifyUpdatePublisher.js +7 -4
- package/dist/codeSign/win/verifyUpdatePublisher.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +24 -6
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +46 -3
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/mac/asarIntegrityDigest.js +2 -2
- package/dist/electron/mac/asarIntegrityDigest.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +3 -2
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -1
- package/dist/electron/mac/electronMacUtils.js +3 -2
- package/dist/electron/mac/electronMacUtils.js.map +1 -1
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +4 -2
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +7 -2
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +6 -2
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.js +1 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +26 -0
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +168 -12
- package/dist/macPackager.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +15 -12
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +3 -0
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +7 -2
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +61 -15
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +20 -0
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +1 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +7 -2
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +14 -5
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +44 -13
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +3 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +50 -16
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/manifestUploadCheck.d.ts +10 -0
- package/dist/publish/manifestUploadCheck.d.ts.map +1 -0
- package/dist/publish/manifestUploadCheck.js +75 -0
- package/dist/publish/manifestUploadCheck.js.map +1 -0
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +51 -17
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/publish/updateManifestVerifier.d.ts +22 -0
- package/dist/publish/updateManifestVerifier.d.ts.map +1 -0
- package/dist/publish/updateManifestVerifier.js +65 -0
- package/dist/publish/updateManifestVerifier.js.map +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +6 -2
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +3 -3
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +5 -5
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +10 -7
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +6 -1
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +9 -9
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -1
- package/dist/targets/linux/flatpakBundle.js +25 -20
- package/dist/targets/linux/flatpakBundle.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +22 -6
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.d.ts +2 -2
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.js +1 -1
- package/dist/targets/linux/snap/snapPlugs.js.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +19 -17
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +15 -3
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +96 -13
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +7 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +8 -2
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/toolsets/nsis.js +1 -1
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/wine.d.ts +3 -0
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +14 -5
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +9 -3
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/buildOutputVerifier.d.ts +40 -0
- package/dist/util/buildOutputVerifier.d.ts.map +1 -0
- package/dist/util/buildOutputVerifier.js +420 -0
- package/dist/util/buildOutputVerifier.js.map +1 -0
- package/dist/util/config/fileOptions.js +2 -2
- package/dist/util/config/fileOptions.js.map +1 -1
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -1
- package/dist/util/config/legacyConfigGuard.js +2 -2
- package/dist/util/config/legacyConfigGuard.js.map +1 -1
- package/dist/util/config/legacyOptions.d.ts +9 -2
- package/dist/util/config/legacyOptions.d.ts.map +1 -1
- package/dist/util/config/legacyOptions.js +8 -2
- package/dist/util/config/legacyOptions.js.map +1 -1
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +3 -1
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +3 -9
- package/dist/util/flags.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +6 -5
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/macroExpander.js +1 -1
- package/dist/util/macroExpander.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -1
- package/dist/util/nativeBinaryVerifier.js +3 -1
- package/dist/util/nativeBinaryVerifier.js.map +1 -1
- package/dist/util/packageMetadata.js +1 -1
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/removedEnvVars.d.ts +2 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -1
- package/dist/util/removedEnvVars.js +15 -1
- package/dist/util/removedEnvVars.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +3 -1
- package/dist/util/streamSpawnToFile.d.ts.map +1 -1
- package/dist/util/streamSpawnToFile.js +6 -2
- package/dist/util/streamSpawnToFile.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/dist/vm/ParallelsVm.d.ts +10 -0
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +22 -8
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/PwshVm.d.ts +0 -1
- package/dist/vm/PwshVm.d.ts.map +1 -1
- package/dist/vm/PwshVm.js +10 -15
- package/dist/vm/PwshVm.js.map +1 -1
- package/dist/vm/WineVm.d.ts.map +1 -1
- package/dist/vm/WineVm.js +4 -4
- package/dist/vm/WineVm.js.map +1 -1
- package/dist/vm/vm.d.ts +9 -3
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +40 -32
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +16 -1
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +77 -19
- package/dist/winPackager.js.map +1 -1
- package/package.json +9 -9
- package/scheme.json +497 -23
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +14 -9
- package/dist/vm/MonoVm.d.ts +0 -9
- package/dist/vm/MonoVm.d.ts.map +0 -1
- package/dist/vm/MonoVm.js +0 -16
- package/dist/vm/MonoVm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeBinaryVerifier.d.ts","sourceRoot":"","sources":["../../src/util/nativeBinaryVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAO,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"nativeBinaryVerifier.d.ts","sourceRoot":"","sources":["../../src/util/nativ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,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C7H"}
|
|
@@ -3,6 +3,7 @@ import { open, readdir, readFile } from "fs/promises";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import { readAsar } from "../asar/asar.js";
|
|
5
5
|
import { archToNodeCpu, isPackageCompatible } from "./archCompatibility.js";
|
|
6
|
+
import { BUILD_CHANGES_URL } from "./config/legacyOptions.js";
|
|
6
7
|
/** Enough to cover the ELF/Mach-O headers, every `fat_arch` entry and the PE header of any real-world binary. */
|
|
7
8
|
const HEAD_READ_LENGTH = 4096;
|
|
8
9
|
// ELF: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
|
|
@@ -375,7 +376,8 @@ export async function verifyNativeBinaries({ resourcesDir, platform, arch, mode
|
|
|
375
376
|
fatal.map(it => ` ${formatMismatch(it, platform, cpu)}`).join("\n") +
|
|
376
377
|
"\nThe app would fail to load them at runtime. This usually means a binary built for another target (often the build host) was left in node_modules " +
|
|
377
378
|
"because the native rebuild was skipped or reused a cached result. Rebuild native dependencies for the target, " +
|
|
378
|
-
'or set `nativeModules.verifyNativeBinaries` to "warn" (or false) to package anyway.'
|
|
379
|
+
'or set `nativeModules.verifyNativeBinaries` to "warn" (or false) to package anyway. ' +
|
|
380
|
+
`See ${BUILD_CHANGES_URL}#native-binaries-are-verified-against-the-target`);
|
|
379
381
|
}
|
|
380
382
|
}
|
|
381
383
|
//# sourceMappingURL=nativeBinaryVerifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeBinaryVerifier.js","sourceRoot":"","sources":["../../src/util/nativeBinaryVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,GAAG,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,IAAI,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rB,MAAM,IAAI,KAAK,CACb,sGAAsG,MAAM,MAAM;YAChH,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,qJAAqJ;YACrJ,gHAAgH;YAChH,qFAAqF,CACxF,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { open, readdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { AsarFilesystem, Node, readAsar } from \"../asar/asar.js\"\nimport { archToNodeCpu, isPackageCompatible, PackagePlatformFields } from \"./archCompatibility.js\"\n\n/** Container format of a native binary, as identified by its magic bytes. */\nexport type NativeBinaryFormat = \"elf\" | \"macho\" | \"pe\"\n\n/** What a native binary's header says it was built for. `arches` holds Node.js `process.arch` names (`x64`, `arm64`, `ia32`, `arm`) or `unknown(0x…)`. */\nexport interface NativeBinaryInfo {\n readonly format: NativeBinaryFormat\n /** Every architecture the file contains — more than one only for a Mach-O fat/universal binary. */\n readonly arches: ReadonlyArray<string>\n}\n\n/** Enough to cover the ELF/Mach-O headers, every `fat_arch` entry and the PE header of any real-world binary. */\nconst HEAD_READ_LENGTH = 4096\n\n// ELF: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html\nconst ELF_EI_DATA = 5\nconst ELF_E_MACHINE = 18\nconst ELF_MACHINES: Record<number, string> = { 3: \"ia32\", 40: \"arm\", 62: \"x64\", 183: \"arm64\" }\n\n// Mach-O: <mach-o/loader.h>, <mach-o/fat.h>, <mach/machine.h>\nconst MACHO_THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf])\nconst MACHO_THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe])\nconst MACHO_FAT_MAGIC = 0xcafebabe\nconst MACHO_FAT_MAGIC_64 = 0xcafebabf\n/** A fat header has fewer than 30 slices, whereas a Java class file (same `0xcafebabe` magic) has a `major_version` of at least 45 there. */\nconst MACHO_FAT_MAX_ARCH_COUNT = 30\nconst MACHO_CPU_TYPES: Record<number, string> = { 7: \"ia32\", 0x01000007: \"x64\", 12: \"arm\", 0x0100000c: \"arm64\" }\n\n// PE: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format\nconst PE_E_LFANEW = 0x3c\nconst PE_SIGNATURE = 0x00004550 // \"PE\\0\\0\" read little-endian\nconst PE_MACHINES: Record<number, string> = { 0x14c: \"ia32\", 0x8664: \"x64\", 0x1c4: \"arm\", 0xaa64: \"arm64\" }\n\nfunction machineName(table: Record<number, string>, value: number): string {\n return table[value] ?? `unknown(0x${value.toString(16)})`\n}\n\n/**\n * Identifies an ELF, Mach-O (thin or fat) or PE binary from the first bytes of a file and reports the\n * architecture(s) it was built for. Returns `null` for anything else — including a truncated header — so\n * callers treat unrecognized files as \"not a native binary\".\n */\nexport function parseNativeBinaryHeader(head: Buffer): NativeBinaryInfo | null {\n if (head.length < 4) {\n return null\n }\n\n if (head[0] === 0x7f && head[1] === 0x45 && head[2] === 0x4c && head[3] === 0x46) {\n if (head.length < ELF_E_MACHINE + 2) {\n return null\n }\n const littleEndian = head[ELF_EI_DATA] !== 2\n const machine = littleEndian ? head.readUInt16LE(ELF_E_MACHINE) : head.readUInt16BE(ELF_E_MACHINE)\n return { format: \"elf\", arches: [machineName(ELF_MACHINES, machine)] }\n }\n\n const magic = head.readUInt32BE(0)\n if (MACHO_THIN_MAGIC_BE.has(magic) || MACHO_THIN_MAGIC_LE.has(magic)) {\n if (head.length < 8) {\n return null\n }\n const cpuType = MACHO_THIN_MAGIC_BE.has(magic) ? head.readUInt32BE(4) : head.readUInt32LE(4)\n return { format: \"macho\", arches: [machineName(MACHO_CPU_TYPES, cpuType)] }\n }\n if (magic === MACHO_FAT_MAGIC || magic === MACHO_FAT_MAGIC_64) {\n if (head.length < 8) {\n return null\n }\n const count = head.readUInt32BE(4)\n const entrySize = magic === MACHO_FAT_MAGIC_64 ? 32 : 20\n if (count === 0 || count >= MACHO_FAT_MAX_ARCH_COUNT || head.length < 8 + count * entrySize) {\n return null\n }\n const arches: string[] = []\n for (let i = 0; i < count; i++) {\n arches.push(machineName(MACHO_CPU_TYPES, head.readUInt32BE(8 + i * entrySize)))\n }\n return { format: \"macho\", arches }\n }\n\n if (head[0] === 0x4d && head[1] === 0x5a) {\n if (head.length < PE_E_LFANEW + 4) {\n return null\n }\n const peOffset = head.readUInt32LE(PE_E_LFANEW)\n if (peOffset + 6 > head.length || head.readUInt32LE(peOffset) !== PE_SIGNATURE) {\n return null\n }\n return { format: \"pe\", arches: [machineName(PE_MACHINES, head.readUInt16LE(peOffset + 4))] }\n }\n\n return null\n}\n\nconst PLATFORM_FORMAT: Partial<Record<NodeJS.Platform, NativeBinaryFormat>> = { darwin: \"macho\", linux: \"elf\", win32: \"pe\" }\nconst FORMAT_LABEL: Record<NativeBinaryFormat, string> = { elf: \"ELF\", macho: \"Mach-O\", pe: \"PE\" }\n\n/** Whether the binary can be loaded by an app for the given platform (`process.platform`) and cpu (`process.arch`). */\nexport function isNativeBinaryCompatible(info: NativeBinaryInfo, platform: NodeJS.Platform, cpu: string): boolean {\n return PLATFORM_FORMAT[platform] === info.format && info.arches.includes(cpu)\n}\n\nexport function describeNativeBinary(info: NativeBinaryInfo): string {\n return `${FORMAT_LABEL[info.format]} ${info.arches.join(\"+\")}`\n}\n\n// Path segments that say which platform/arch a file is for: prebuildify `prebuilds/linux-arm64/`, node-pre-gyp\n// `napi-v6-linux-glibc-x64/`, platform packages such as `@img/sharp-darwin-arm64`, or `win/x64/` tool layouts.\nconst PLATFORM_TOKENS: Record<string, string> = {\n darwin: \"darwin\",\n mac: \"darwin\",\n macos: \"darwin\",\n osx: \"darwin\",\n linux: \"linux\",\n win32: \"win32\",\n win: \"win32\",\n windows: \"win32\",\n freebsd: \"freebsd\",\n openbsd: \"openbsd\",\n android: \"android\",\n sunos: \"sunos\",\n aix: \"aix\",\n}\nconst ARCH_TOKENS: Record<string, string> = {\n x64: \"x64\",\n amd64: \"x64\",\n arm64: \"arm64\",\n aarch64: \"arm64\",\n ia32: \"ia32\",\n x86: \"ia32\",\n i386: \"ia32\",\n i686: \"ia32\",\n arm: \"arm\",\n armv6: \"arm\",\n armv6l: \"arm\",\n armv7: \"arm\",\n armv7l: \"arm\",\n armhf: \"arm\",\n universal: \"universal\",\n}\n\n/**\n * The platform/arch a relative path declares through its directory or package names, if any. A segment only\n * counts when it pairs a platform with an arch (`linux-x64`, `sharp-darwin-arm64`) or is exactly one token\n * (`win`, `x64`), so package names such as `node-mac-permissions` are not mistaken for a platform variant.\n *\n * @internal Exported for tests only.\n */\nexport function platformDeclaredByPath(relativePath: string): { platform?: string; cpu?: string } {\n const result: { platform?: string; cpu?: string } = {}\n const segments = relativePath.split(/[\\\\/]/)\n segments.pop() // the file name itself (e.g. `node.napi.armv7.node`) is not a directory layout\n for (const segment of segments) {\n const tokens = segment\n .toLowerCase()\n .replace(/x86[-_]64/g, \"x64\")\n .replace(/x64\\+arm64|arm64\\+x64/g, \"universal\") // prebuildify's name for a fat macOS prebuild\n .split(/[-_.]/)\n const platform = tokens.map(t => PLATFORM_TOKENS[t]).find(it => it != null)\n const cpu = tokens.map(t => ARCH_TOKENS[t]).find(it => it != null)\n if (tokens.length === 1 || (platform != null && cpu != null)) {\n result.platform = platform ?? result.platform\n result.cpu = cpu ?? result.cpu\n }\n }\n return result\n}\n\n/**\n * The package directory (relative, `node_modules/<name>` or `node_modules/@scope/<name>`) owning a file, or `null`\n * when the file is not inside `node_modules`.\n */\nfunction packageRootOf(relativePath: string): string | null {\n const segments = relativePath.split(/[\\\\/]/)\n const index = segments.lastIndexOf(\"node_modules\")\n if (index < 0 || index + 2 >= segments.length) {\n return null\n }\n const nameLength = segments[index + 1].startsWith(\"@\") ? 2 : 1\n if (index + 1 + nameLength >= segments.length) {\n return null\n }\n return segments.slice(0, index + 1 + nameLength).join(\"/\")\n}\n\n/** Where a candidate file lives, and how to read its header and its package's `package.json`. */\ninterface NativeBinarySource {\n readonly label: string\n list(): Promise<Array<string>>\n readHead(relativePath: string): Promise<Buffer | null>\n readPackageJson(packageRoot: string): Promise<PackagePlatformFields | null>\n}\n\nexport type NativeBinaryKind = \"addon\" | \"library\"\n\nexport interface NativeBinaryMismatch {\n /** Path inside the packaged app, e.g. `app.asar.unpacked/node_modules/foo/build/Release/foo.node`. */\n readonly file: string\n readonly kind: NativeBinaryKind\n readonly detected: NativeBinaryInfo\n}\n\nconst LIBRARY_EXTENSIONS = new Set([\".dll\", \".exe\", \".dylib\", \".so\"])\n\n/** `.node` addons are what `require()` loads; other native files are classified as libraries/executables, or skipped. */\nfunction classify(file: string, allowExtensionless: boolean): NativeBinaryKind | null {\n const base = path.basename(file)\n const ext = path.extname(base).toLowerCase()\n if (ext === \".node\") {\n return \"addon\"\n }\n if (LIBRARY_EXTENSIONS.has(ext) || /\\.so(\\.\\d+)+$/.test(base)) {\n return \"library\"\n }\n // extensionless files are checked by magic bytes (bundled CLI tools such as esbuild's binary); only on disk,\n // where reading the head of a file is cheap — smart unpack moves such executables out of the asar anyway\n return allowExtensionless && ext === \"\" && !base.startsWith(\".\") ? \"library\" : null\n}\n\nasync function readFileHead(file: string): Promise<Buffer | null> {\n let handle\n try {\n handle = await open(file, \"r\")\n const head = Buffer.alloc(HEAD_READ_LENGTH)\n const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0)\n return head.subarray(0, bytesRead)\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nasync function readJsonOrNull(file: string): Promise<any> {\n try {\n return JSON.parse(await readFile(file, \"utf8\"))\n } catch {\n return null\n }\n}\n\nasync function listFiles(dir: string, prefix = \"\"): Promise<Array<string>> {\n let entries\n try {\n entries = await readdir(path.join(dir, prefix), { withFileTypes: true })\n } catch {\n return []\n }\n const result: string[] = []\n for (const entry of entries) {\n const rel = prefix === \"\" ? entry.name : `${prefix}/${entry.name}`\n if (entry.isDirectory()) {\n result.push(...(await listFiles(dir, rel)))\n } else if (entry.isFile()) {\n result.push(rel)\n }\n }\n return result\n}\n\n/** @internal Exported for tests only. */\nexport function directorySource(dir: string, label: string): NativeBinarySource {\n return {\n label,\n list: () => listFiles(dir),\n readHead: rel => readFileHead(path.join(dir, rel)),\n readPackageJson: root => readJsonOrNull(path.join(dir, root, \"package.json\")),\n }\n}\n\nfunction collectAsarFiles(node: Node, prefix: string, out: Array<string>) {\n for (const [name, child] of Object.entries(node.files ?? {})) {\n const rel = prefix === \"\" ? name : `${prefix}/${name}`\n if (child.files != null) {\n collectAsarFiles(child, rel, out)\n } else if (child.link == null && !child.unpacked) {\n out.push(rel) // unpacked files are covered by the `app.asar.unpacked` directory source\n }\n }\n}\n\nasync function readAsarFileHead(archive: AsarFilesystem, rel: string): Promise<Buffer | null> {\n const node = archive.getNode(rel.split(\"/\").join(path.sep))\n if (node == null || node.offset == null || !node.size) {\n return null\n }\n let handle\n try {\n handle = await open(archive.src, \"r\")\n const head = Buffer.alloc(Math.min(HEAD_READ_LENGTH, node.size))\n const { bytesRead } = await handle.read(head, 0, head.length, 8 + archive.headerSize + parseInt(node.offset, 10))\n return head.subarray(0, bytesRead)\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nasync function asarSource(archivePath: string, label: string): Promise<NativeBinarySource | null> {\n let archive: AsarFilesystem\n try {\n archive = await readAsar(archivePath)\n } catch {\n return null\n }\n return {\n label,\n list: () => {\n const files: string[] = []\n collectAsarFiles(archive.header, \"\", files)\n return Promise.resolve(files)\n },\n readHead: rel => readAsarFileHead(archive, rel),\n readPackageJson: async root => {\n const onDisk = await readJsonOrNull(path.join(`${archivePath}.unpacked`, root, \"package.json\"))\n if (onDisk != null) {\n return onDisk\n }\n try {\n return await archive.readJson(path.join(...root.split(\"/\"), \"package.json\"))\n } catch {\n return null\n }\n },\n }\n}\n\n/**\n * Scans the given sources for native binaries that were not built for `platform`/`cpu`. Files whose package declares\n * another platform (`package.json` `os`/`cpu`) or whose path names another platform/arch are skipped: they are\n * shipped on purpose (multi-platform prebuilds, a universal build's single-arch packages) and never loaded here.\n *\n * @internal Exported for tests only.\n */\nexport async function findNativeBinaryMismatches(\n sources: ReadonlyArray<NativeBinarySource>,\n platform: NodeJS.Platform,\n cpu: string,\n options: { extensionless: boolean[] } = { extensionless: sources.map(() => true) }\n): Promise<Array<NativeBinaryMismatch>> {\n const mismatches: NativeBinaryMismatch[] = []\n for (let i = 0; i < sources.length; i++) {\n const source = sources[i]\n const packageCompatibility = new Map<string, Promise<boolean>>()\n for (const rel of await source.list()) {\n const kind = classify(rel, options.extensionless[i] ?? true)\n if (kind == null) {\n continue\n }\n const head = await source.readHead(rel)\n const info = head == null ? null : parseNativeBinaryHeader(head)\n if (info == null || isNativeBinaryCompatible(info, platform, cpu)) {\n continue\n }\n\n const declared = platformDeclaredByPath(rel)\n if ((declared.platform != null && declared.platform !== platform) || (declared.cpu != null && declared.cpu !== cpu && declared.cpu !== \"universal\")) {\n log.debug({ file: rel, detected: describeNativeBinary(info), reason: \"path names another platform/arch\" }, \"skipped native binary check\")\n continue\n }\n const root = packageRootOf(rel)\n if (root != null) {\n if (!packageCompatibility.has(root)) {\n packageCompatibility.set(\n root,\n source.readPackageJson(root).then(pkg => pkg == null || isPackageCompatible(pkg, cpu, platform))\n )\n }\n if (!(await packageCompatibility.get(root))) {\n log.debug({ file: rel, detected: describeNativeBinary(info), reason: \"package.json os/cpu names another platform/arch\" }, \"skipped native binary check\")\n continue\n }\n }\n\n mismatches.push({ file: `${source.label}/${rel}`, kind, detected: info })\n }\n }\n return mismatches\n}\n\n/** @internal Exported for tests only. */\nexport function formatMismatch(mismatch: NativeBinaryMismatch, platform: NodeJS.Platform, cpu: string): string {\n const expectedFormat = PLATFORM_FORMAT[platform]\n const expected = expectedFormat == null ? `${platform} ${cpu}` : `${FORMAT_LABEL[expectedFormat]} ${cpu}`\n return `${mismatch.file}: ${describeNativeBinary(mismatch.detected)}, expected ${expected}`\n}\n\nexport interface VerifyNativeBinariesOptions {\n /** `Contents/Resources` (macOS) or `resources` directory of the packed app. */\n readonly resourcesDir: string\n readonly platform: NodeJS.Platform\n readonly arch: Arch\n /** `nativeModules.verifyNativeBinaries` */\n readonly mode: boolean | \"warn\" | null | undefined\n}\n\n/**\n * Checks that the native binaries shipped in the packed app (`app.asar`, `app.asar.unpacked`, or the `app` directory)\n * match the target platform and arch. A mismatched `.node` addon fails the build (unless `mode` is `\"warn\"`); any other\n * mismatched native file is a warning, since packages legitimately bundle helper binaries for several platforms.\n */\nexport async function verifyNativeBinaries({ resourcesDir, platform, arch, mode }: VerifyNativeBinariesOptions): Promise<void> {\n if (mode === false) {\n log.debug({ reason: \"nativeModules.verifyNativeBinaries is set to false\" }, \"skipped native binary check\")\n return\n }\n const cpu = archToNodeCpu(arch)\n if (cpu == null || PLATFORM_FORMAT[platform] == null) {\n return // e.g. `universal`: each slice is checked before the merge\n }\n\n const sources: NativeBinarySource[] = []\n const extensionless: boolean[] = []\n const archive = await asarSource(path.join(resourcesDir, \"app.asar\"), \"app.asar\")\n if (archive != null) {\n sources.push(archive)\n extensionless.push(false)\n }\n sources.push(directorySource(path.join(resourcesDir, \"app.asar.unpacked\"), \"app.asar.unpacked\"), directorySource(path.join(resourcesDir, \"app\"), \"app\"))\n extensionless.push(true, true)\n\n const mismatches = await findNativeBinaryMismatches(sources, platform, cpu, { extensionless })\n if (mismatches.length === 0) {\n return\n }\n\n const target = `${platform} ${cpu}`\n const fatal = mode === \"warn\" ? [] : mismatches.filter(it => it.kind === \"addon\")\n for (const mismatch of mismatches) {\n if (!fatal.includes(mismatch)) {\n log.warn({ file: mismatch.file, detected: describeNativeBinary(mismatch.detected), target }, \"native binary does not match the target platform/arch\")\n }\n }\n if (fatal.length > 0) {\n throw new Error(\n `Native module(s) built for the wrong platform/architecture were found in the packaged app (target: ${target}):\\n` +\n fatal.map(it => ` ${formatMismatch(it, platform, cpu)}`).join(\"\\n\") +\n \"\\nThe app would fail to load them at runtime. This usually means a binary built for another target (often the build host) was left in node_modules \" +\n \"because the native rebuild was skipped or reused a cached result. Rebuild native dependencies for the target, \" +\n 'or set `nativeModules.verifyNativeBinaries` to \"warn\" (or false) to package anyway.'\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nativeBinaryVerifier.js","sourceRoot":"","sources":["../../src/util/nativeBinaryVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,GAAG,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAwB,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAyB,MAAM,wBAAwB,CAAA;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAY7D,iHAAiH;AACjH,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAE7B,wEAAwE;AACxE,MAAM,WAAW,GAAG,CAAC,CAAA;AACrB,MAAM,aAAa,GAAG,EAAE,CAAA;AACxB,MAAM,YAAY,GAA2B,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA;AAE9F,8DAA8D;AAC9D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;AAC7D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;AAC7D,MAAM,eAAe,GAAG,UAAU,CAAA;AAClC,MAAM,kBAAkB,GAAG,UAAU,CAAA;AACrC,6IAA6I;AAC7I,MAAM,wBAAwB,GAAG,EAAE,CAAA;AACnC,MAAM,eAAe,GAA2B,EAAE,CAAC,EAAE,MA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C,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAA;IACjF,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,uDAAuD,CAAC,CAAA;QACvJ,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,sGAAsG,MAAM,MAAM;YAChH,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,qJAAqJ;YACrJ,gHAAgH;YAChH,sFAAsF;YACtF,OAAO,iBAAiB,kDAAkD,CAC7E,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { open, readdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { AsarFilesystem, Node, readAsar } from \"../asar/asar.js\"\nimport { archToNodeCpu, isPackageCompatible, PackagePlatformFields } from \"./archCompatibility.js\"\nimport { BUILD_CHANGES_URL } from \"./config/legacyOptions.js\"\n\n/** Container format of a native binary, as identified by its magic bytes. */\nexport type NativeBinaryFormat = \"elf\" | \"macho\" | \"pe\"\n\n/** What a native binary's header says it was built for. `arches` holds Node.js `process.arch` names (`x64`, `arm64`, `ia32`, `arm`) or `unknown(0x…)`. */\nexport interface NativeBinaryInfo {\n readonly format: NativeBinaryFormat\n /** Every architecture the file contains — more than one only for a Mach-O fat/universal binary. */\n readonly arches: ReadonlyArray<string>\n}\n\n/** Enough to cover the ELF/Mach-O headers, every `fat_arch` entry and the PE header of any real-world binary. */\nconst HEAD_READ_LENGTH = 4096\n\n// ELF: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html\nconst ELF_EI_DATA = 5\nconst ELF_E_MACHINE = 18\nconst ELF_MACHINES: Record<number, string> = { 3: \"ia32\", 40: \"arm\", 62: \"x64\", 183: \"arm64\" }\n\n// Mach-O: <mach-o/loader.h>, <mach-o/fat.h>, <mach/machine.h>\nconst MACHO_THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf])\nconst MACHO_THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe])\nconst MACHO_FAT_MAGIC = 0xcafebabe\nconst MACHO_FAT_MAGIC_64 = 0xcafebabf\n/** A fat header has fewer than 30 slices, whereas a Java class file (same `0xcafebabe` magic) has a `major_version` of at least 45 there. */\nconst MACHO_FAT_MAX_ARCH_COUNT = 30\nconst MACHO_CPU_TYPES: Record<number, string> = { 7: \"ia32\", 0x01000007: \"x64\", 12: \"arm\", 0x0100000c: \"arm64\" }\n\n// PE: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format\nconst PE_E_LFANEW = 0x3c\nconst PE_SIGNATURE = 0x00004550 // \"PE\\0\\0\" read little-endian\nconst PE_MACHINES: Record<number, string> = { 0x14c: \"ia32\", 0x8664: \"x64\", 0x1c4: \"arm\", 0xaa64: \"arm64\" }\n\nfunction machineName(table: Record<number, string>, value: number): string {\n return table[value] ?? `unknown(0x${value.toString(16)})`\n}\n\n/**\n * Identifies an ELF, Mach-O (thin or fat) or PE binary from the first bytes of a file and reports the\n * architecture(s) it was built for. Returns `null` for anything else — including a truncated header — so\n * callers treat unrecognized files as \"not a native binary\".\n */\nexport function parseNativeBinaryHeader(head: Buffer): NativeBinaryInfo | null {\n if (head.length < 4) {\n return null\n }\n\n if (head[0] === 0x7f && head[1] === 0x45 && head[2] === 0x4c && head[3] === 0x46) {\n if (head.length < ELF_E_MACHINE + 2) {\n return null\n }\n const littleEndian = head[ELF_EI_DATA] !== 2\n const machine = littleEndian ? head.readUInt16LE(ELF_E_MACHINE) : head.readUInt16BE(ELF_E_MACHINE)\n return { format: \"elf\", arches: [machineName(ELF_MACHINES, machine)] }\n }\n\n const magic = head.readUInt32BE(0)\n if (MACHO_THIN_MAGIC_BE.has(magic) || MACHO_THIN_MAGIC_LE.has(magic)) {\n if (head.length < 8) {\n return null\n }\n const cpuType = MACHO_THIN_MAGIC_BE.has(magic) ? head.readUInt32BE(4) : head.readUInt32LE(4)\n return { format: \"macho\", arches: [machineName(MACHO_CPU_TYPES, cpuType)] }\n }\n if (magic === MACHO_FAT_MAGIC || magic === MACHO_FAT_MAGIC_64) {\n if (head.length < 8) {\n return null\n }\n const count = head.readUInt32BE(4)\n const entrySize = magic === MACHO_FAT_MAGIC_64 ? 32 : 20\n if (count === 0 || count >= MACHO_FAT_MAX_ARCH_COUNT || head.length < 8 + count * entrySize) {\n return null\n }\n const arches: string[] = []\n for (let i = 0; i < count; i++) {\n arches.push(machineName(MACHO_CPU_TYPES, head.readUInt32BE(8 + i * entrySize)))\n }\n return { format: \"macho\", arches }\n }\n\n if (head[0] === 0x4d && head[1] === 0x5a) {\n if (head.length < PE_E_LFANEW + 4) {\n return null\n }\n const peOffset = head.readUInt32LE(PE_E_LFANEW)\n if (peOffset + 6 > head.length || head.readUInt32LE(peOffset) !== PE_SIGNATURE) {\n return null\n }\n return { format: \"pe\", arches: [machineName(PE_MACHINES, head.readUInt16LE(peOffset + 4))] }\n }\n\n return null\n}\n\nconst PLATFORM_FORMAT: Partial<Record<NodeJS.Platform, NativeBinaryFormat>> = { darwin: \"macho\", linux: \"elf\", win32: \"pe\" }\nconst FORMAT_LABEL: Record<NativeBinaryFormat, string> = { elf: \"ELF\", macho: \"Mach-O\", pe: \"PE\" }\n\n/** Whether the binary can be loaded by an app for the given platform (`process.platform`) and cpu (`process.arch`). */\nexport function isNativeBinaryCompatible(info: NativeBinaryInfo, platform: NodeJS.Platform, cpu: string): boolean {\n return PLATFORM_FORMAT[platform] === info.format && info.arches.includes(cpu)\n}\n\nexport function describeNativeBinary(info: NativeBinaryInfo): string {\n return `${FORMAT_LABEL[info.format]} ${info.arches.join(\"+\")}`\n}\n\n// Path segments that say which platform/arch a file is for: prebuildify `prebuilds/linux-arm64/`, node-pre-gyp\n// `napi-v6-linux-glibc-x64/`, platform packages such as `@img/sharp-darwin-arm64`, or `win/x64/` tool layouts.\nconst PLATFORM_TOKENS: Record<string, string> = {\n darwin: \"darwin\",\n mac: \"darwin\",\n macos: \"darwin\",\n osx: \"darwin\",\n linux: \"linux\",\n win32: \"win32\",\n win: \"win32\",\n windows: \"win32\",\n freebsd: \"freebsd\",\n openbsd: \"openbsd\",\n android: \"android\",\n sunos: \"sunos\",\n aix: \"aix\",\n}\nconst ARCH_TOKENS: Record<string, string> = {\n x64: \"x64\",\n amd64: \"x64\",\n arm64: \"arm64\",\n aarch64: \"arm64\",\n ia32: \"ia32\",\n x86: \"ia32\",\n i386: \"ia32\",\n i686: \"ia32\",\n arm: \"arm\",\n armv6: \"arm\",\n armv6l: \"arm\",\n armv7: \"arm\",\n armv7l: \"arm\",\n armhf: \"arm\",\n universal: \"universal\",\n}\n\n/**\n * The platform/arch a relative path declares through its directory or package names, if any. A segment only\n * counts when it pairs a platform with an arch (`linux-x64`, `sharp-darwin-arm64`) or is exactly one token\n * (`win`, `x64`), so package names such as `node-mac-permissions` are not mistaken for a platform variant.\n *\n * @internal Exported for tests only.\n */\nexport function platformDeclaredByPath(relativePath: string): { platform?: string; cpu?: string } {\n const result: { platform?: string; cpu?: string } = {}\n const segments = relativePath.split(/[\\\\/]/)\n segments.pop() // the file name itself (e.g. `node.napi.armv7.node`) is not a directory layout\n for (const segment of segments) {\n const tokens = segment\n .toLowerCase()\n .replace(/x86[-_]64/g, \"x64\")\n .replace(/x64\\+arm64|arm64\\+x64/g, \"universal\") // prebuildify's name for a fat macOS prebuild\n .split(/[-_.]/)\n const platform = tokens.map(t => PLATFORM_TOKENS[t]).find(it => it != null)\n const cpu = tokens.map(t => ARCH_TOKENS[t]).find(it => it != null)\n if (tokens.length === 1 || (platform != null && cpu != null)) {\n result.platform = platform ?? result.platform\n result.cpu = cpu ?? result.cpu\n }\n }\n return result\n}\n\n/**\n * The package directory (relative, `node_modules/<name>` or `node_modules/@scope/<name>`) owning a file, or `null`\n * when the file is not inside `node_modules`.\n */\nfunction packageRootOf(relativePath: string): string | null {\n const segments = relativePath.split(/[\\\\/]/)\n const index = segments.lastIndexOf(\"node_modules\")\n if (index < 0 || index + 2 >= segments.length) {\n return null\n }\n const nameLength = segments[index + 1].startsWith(\"@\") ? 2 : 1\n if (index + 1 + nameLength >= segments.length) {\n return null\n }\n return segments.slice(0, index + 1 + nameLength).join(\"/\")\n}\n\n/** Where a candidate file lives, and how to read its header and its package's `package.json`. */\ninterface NativeBinarySource {\n readonly label: string\n list(): Promise<Array<string>>\n readHead(relativePath: string): Promise<Buffer | null>\n readPackageJson(packageRoot: string): Promise<PackagePlatformFields | null>\n}\n\nexport type NativeBinaryKind = \"addon\" | \"library\"\n\nexport interface NativeBinaryMismatch {\n /** Path inside the packaged app, e.g. `app.asar.unpacked/node_modules/foo/build/Release/foo.node`. */\n readonly file: string\n readonly kind: NativeBinaryKind\n readonly detected: NativeBinaryInfo\n}\n\nconst LIBRARY_EXTENSIONS = new Set([\".dll\", \".exe\", \".dylib\", \".so\"])\n\n/** `.node` addons are what `require()` loads; other native files are classified as libraries/executables, or skipped. */\nfunction classify(file: string, allowExtensionless: boolean): NativeBinaryKind | null {\n const base = path.basename(file)\n const ext = path.extname(base).toLowerCase()\n if (ext === \".node\") {\n return \"addon\"\n }\n if (LIBRARY_EXTENSIONS.has(ext) || /\\.so(\\.\\d+)+$/.test(base)) {\n return \"library\"\n }\n // extensionless files are checked by magic bytes (bundled CLI tools such as esbuild's binary); only on disk,\n // where reading the head of a file is cheap — smart unpack moves such executables out of the asar anyway\n return allowExtensionless && ext === \"\" && !base.startsWith(\".\") ? \"library\" : null\n}\n\nasync function readFileHead(file: string): Promise<Buffer | null> {\n let handle\n try {\n handle = await open(file, \"r\")\n const head = Buffer.alloc(HEAD_READ_LENGTH)\n const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0)\n return head.subarray(0, bytesRead)\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nasync function readJsonOrNull(file: string): Promise<any> {\n try {\n return JSON.parse(await readFile(file, \"utf8\"))\n } catch {\n return null\n }\n}\n\nasync function listFiles(dir: string, prefix = \"\"): Promise<Array<string>> {\n let entries\n try {\n entries = await readdir(path.join(dir, prefix), { withFileTypes: true })\n } catch {\n return []\n }\n const result: string[] = []\n for (const entry of entries) {\n const rel = prefix === \"\" ? entry.name : `${prefix}/${entry.name}`\n if (entry.isDirectory()) {\n result.push(...(await listFiles(dir, rel)))\n } else if (entry.isFile()) {\n result.push(rel)\n }\n }\n return result\n}\n\n/** @internal Exported for tests only. */\nexport function directorySource(dir: string, label: string): NativeBinarySource {\n return {\n label,\n list: () => listFiles(dir),\n readHead: rel => readFileHead(path.join(dir, rel)),\n readPackageJson: root => readJsonOrNull(path.join(dir, root, \"package.json\")),\n }\n}\n\nfunction collectAsarFiles(node: Node, prefix: string, out: Array<string>) {\n for (const [name, child] of Object.entries(node.files ?? {})) {\n const rel = prefix === \"\" ? name : `${prefix}/${name}`\n if (child.files != null) {\n collectAsarFiles(child, rel, out)\n } else if (child.link == null && !child.unpacked) {\n out.push(rel) // unpacked files are covered by the `app.asar.unpacked` directory source\n }\n }\n}\n\nasync function readAsarFileHead(archive: AsarFilesystem, rel: string): Promise<Buffer | null> {\n const node = archive.getNode(rel.split(\"/\").join(path.sep))\n if (node == null || node.offset == null || !node.size) {\n return null\n }\n let handle\n try {\n handle = await open(archive.src, \"r\")\n const head = Buffer.alloc(Math.min(HEAD_READ_LENGTH, node.size))\n const { bytesRead } = await handle.read(head, 0, head.length, 8 + archive.headerSize + parseInt(node.offset, 10))\n return head.subarray(0, bytesRead)\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nasync function asarSource(archivePath: string, label: string): Promise<NativeBinarySource | null> {\n let archive: AsarFilesystem\n try {\n archive = await readAsar(archivePath)\n } catch {\n return null\n }\n return {\n label,\n list: () => {\n const files: string[] = []\n collectAsarFiles(archive.header, \"\", files)\n return Promise.resolve(files)\n },\n readHead: rel => readAsarFileHead(archive, rel),\n readPackageJson: async root => {\n const onDisk = await readJsonOrNull(path.join(`${archivePath}.unpacked`, root, \"package.json\"))\n if (onDisk != null) {\n return onDisk\n }\n try {\n return await archive.readJson(path.join(...root.split(\"/\"), \"package.json\"))\n } catch {\n return null\n }\n },\n }\n}\n\n/**\n * Scans the given sources for native binaries that were not built for `platform`/`cpu`. Files whose package declares\n * another platform (`package.json` `os`/`cpu`) or whose path names another platform/arch are skipped: they are\n * shipped on purpose (multi-platform prebuilds, a universal build's single-arch packages) and never loaded here.\n *\n * @internal Exported for tests only.\n */\nexport async function findNativeBinaryMismatches(\n sources: ReadonlyArray<NativeBinarySource>,\n platform: NodeJS.Platform,\n cpu: string,\n options: { extensionless: boolean[] } = { extensionless: sources.map(() => true) }\n): Promise<Array<NativeBinaryMismatch>> {\n const mismatches: NativeBinaryMismatch[] = []\n for (let i = 0; i < sources.length; i++) {\n const source = sources[i]\n const packageCompatibility = new Map<string, Promise<boolean>>()\n for (const rel of await source.list()) {\n const kind = classify(rel, options.extensionless[i] ?? true)\n if (kind == null) {\n continue\n }\n const head = await source.readHead(rel)\n const info = head == null ? null : parseNativeBinaryHeader(head)\n if (info == null || isNativeBinaryCompatible(info, platform, cpu)) {\n continue\n }\n\n const declared = platformDeclaredByPath(rel)\n if ((declared.platform != null && declared.platform !== platform) || (declared.cpu != null && declared.cpu !== cpu && declared.cpu !== \"universal\")) {\n log.debug({ file: rel, detected: describeNativeBinary(info), reason: \"path names another platform/arch\" }, \"skipped native binary check\")\n continue\n }\n const root = packageRootOf(rel)\n if (root != null) {\n if (!packageCompatibility.has(root)) {\n packageCompatibility.set(\n root,\n source.readPackageJson(root).then(pkg => pkg == null || isPackageCompatible(pkg, cpu, platform))\n )\n }\n if (!(await packageCompatibility.get(root))) {\n log.debug({ file: rel, detected: describeNativeBinary(info), reason: \"package.json os/cpu names another platform/arch\" }, \"skipped native binary check\")\n continue\n }\n }\n\n mismatches.push({ file: `${source.label}/${rel}`, kind, detected: info })\n }\n }\n return mismatches\n}\n\n/** @internal Exported for tests only. */\nexport function formatMismatch(mismatch: NativeBinaryMismatch, platform: NodeJS.Platform, cpu: string): string {\n const expectedFormat = PLATFORM_FORMAT[platform]\n const expected = expectedFormat == null ? `${platform} ${cpu}` : `${FORMAT_LABEL[expectedFormat]} ${cpu}`\n return `${mismatch.file}: ${describeNativeBinary(mismatch.detected)}, expected ${expected}`\n}\n\nexport interface VerifyNativeBinariesOptions {\n /** `Contents/Resources` (macOS) or `resources` directory of the packed app. */\n readonly resourcesDir: string\n readonly platform: NodeJS.Platform\n readonly arch: Arch\n /** `nativeModules.verifyNativeBinaries` */\n readonly mode: boolean | \"warn\" | null | undefined\n}\n\n/**\n * Checks that the native binaries shipped in the packed app (`app.asar`, `app.asar.unpacked`, or the `app` directory)\n * match the target platform and arch. A mismatched `.node` addon fails the build (unless `mode` is `\"warn\"`); any other\n * mismatched native file is a warning, since packages legitimately bundle helper binaries for several platforms.\n */\nexport async function verifyNativeBinaries({ resourcesDir, platform, arch, mode }: VerifyNativeBinariesOptions): Promise<void> {\n if (mode === false) {\n log.debug({ reason: \"nativeModules.verifyNativeBinaries is set to false\" }, \"skipped native binary check\")\n return\n }\n const cpu = archToNodeCpu(arch)\n if (cpu == null || PLATFORM_FORMAT[platform] == null) {\n return // e.g. `universal`: each slice is checked before the merge\n }\n\n const sources: NativeBinarySource[] = []\n const extensionless: boolean[] = []\n const archive = await asarSource(path.join(resourcesDir, \"app.asar\"), \"app.asar\")\n if (archive != null) {\n sources.push(archive)\n extensionless.push(false)\n }\n sources.push(directorySource(path.join(resourcesDir, \"app.asar.unpacked\"), \"app.asar.unpacked\"), directorySource(path.join(resourcesDir, \"app\"), \"app\"))\n extensionless.push(true, true)\n\n const mismatches = await findNativeBinaryMismatches(sources, platform, cpu, { extensionless })\n if (mismatches.length === 0) {\n return\n }\n\n const target = `${platform} ${cpu}`\n const fatal = mode === \"warn\" ? [] : mismatches.filter(it => it.kind === \"addon\")\n for (const mismatch of mismatches) {\n if (!fatal.includes(mismatch)) {\n log.warn({ file: mismatch.file, detected: describeNativeBinary(mismatch.detected), target }, \"native binary does not match the target platform/arch\")\n }\n }\n if (fatal.length > 0) {\n throw new Error(\n `Native module(s) built for the wrong platform/architecture were found in the packaged app (target: ${target}):\\n` +\n fatal.map(it => ` ${formatMismatch(it, platform, cpu)}`).join(\"\\n\") +\n \"\\nThe app would fail to load them at runtime. This usually means a binary built for another target (often the build host) was left in node_modules \" +\n \"because the native rebuild was skipped or reused a cached result. Rebuild native dependencies for the target, \" +\n 'or set `nativeModules.verifyNativeBinaries` to \"warn\" (or false) to package anyway. ' +\n `See ${BUILD_CHANGES_URL}#native-binaries-are-verified-against-the-target`\n )\n }\n}\n"]}
|
|
@@ -62,7 +62,7 @@ export function checkMetadata(metadata, devMetadata, appPackageFile, devAppPacka
|
|
|
62
62
|
` { "build": { "directories": ${JSON.stringify(rootDirectories)} } }\n` +
|
|
63
63
|
" Left where it is, it is ignored and your build output goes to the default 'dist' directory.\n" +
|
|
64
64
|
" Run `electron-builder migrate-schema` to move it automatically.\n" +
|
|
65
|
-
" https://www.electron.build/docs/migration/v27-
|
|
65
|
+
" https://www.electron.build/docs/migration/v27-config-changes#root-level-directories-in-packagejson");
|
|
66
66
|
}
|
|
67
67
|
const devDependencies = metadata.devDependencies;
|
|
68
68
|
if (devDependencies != null && ("electron-rebuild" in devDependencies || "@electron/rebuild" in devDependencies)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageMetadata.js","sourceRoot":"","sources":["../../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C;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport fsExtra from \"fs-extra\"\nimport { createRequire } from \"node:module\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Metadata } from \"../options/metadata.js\"\nimport { normalizePackageData } from \"./normalizePackageData.js\"\n\nconst require = createRequire(import.meta.url)\n\n/** @internal */\nexport async function readPackageJson(file: string): Promise<any> {\n const data = await fsExtra.readJson(file)\n await authors(file, data)\n // remove not required fields because can be used for remote build\n delete data.scripts\n delete data.readme\n normalizePackageData(data)\n return data\n}\n\nasync function authors(file: string, data: any) {\n if (data.contributors != null) {\n return\n }\n\n let authorData\n try {\n authorData = await fsExtra.readFile(path.resolve(path.dirname(file), \"AUTHORS\"), \"utf8\")\n } catch (_ignored) {\n return\n }\n\n data.contributors = authorData.split(/\\r?\\n/g).map(it => it.replace(/^\\s*#.*$/, \"\").trim())\n}\n\n/** @internal */\nexport function checkMetadata(metadata: Metadata, devMetadata: any | null, appPackageFile: string, devAppPackageFile: string, projectDir: string): void {\n const errors: Array<string> = []\n const reportError = (missedFieldName: string) => {\n errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`)\n }\n\n const checkNotEmpty = (name: string, value: string | Nullish) => {\n if (isEmptyOrSpaces(value)) {\n reportError(name)\n }\n }\n\n checkNotEmpty(\"name\", metadata.name)\n\n if (isEmptyOrSpaces(metadata.description)) {\n log.warn({ appPackageFile }, `description is missed in the package.json`)\n }\n if (metadata.author == null) {\n log.warn({ appPackageFile }, `author is missed in the package.json`)\n }\n checkNotEmpty(\"version\", metadata.version)\n\n checkDependencies(metadata.dependencies, errors, projectDir)\n if (metadata !== devMetadata) {\n if (metadata.build != null) {\n errors.push(\n `'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`\n )\n }\n }\n\n // Root-level `directories` was read by v26 and is ignored by v27. It lives outside the validated\n // Configuration object, so nothing else catches it: the build silently writes to the default `dist`\n // instead of the configured output directory, and a release pipeline copies from an empty path.\n const rootDirectories = (devMetadata ?? metadata)?.directories\n if (rootDirectories != null) {\n errors.push(\n `'directories' at the root of the package.json (${devAppPackageFile}) is no longer read by electron-builder v27 — move it under the 'build' key:\\n` +\n ` { \"build\": { \"directories\": ${JSON.stringify(rootDirectories)} } }\\n` +\n \" Left where it is, it is ignored and your build output goes to the default 'dist' directory.\\n\" +\n \" Run `electron-builder migrate-schema` to move it automatically.\\n\" +\n \" https://www.electron.build/docs/migration/v27-breaking-changes#root-level-directories-in-packagejson\"\n )\n }\n\n const devDependencies = (metadata as any).devDependencies\n if (devDependencies != null && (\"electron-rebuild\" in devDependencies || \"@electron/rebuild\" in devDependencies)) {\n log.info(\n '@electron/rebuild already used by electron-builder, please consider to remove excess dependency from devDependencies\\n\\nTo ensure your native dependencies are always matched electron version, simply add script `\"postinstall\": \"electron-builder install-app-deps\" to your `package.json`'\n )\n }\n\n if (errors.length > 0) {\n throw new InvalidConfigurationError(errors.join(\"\\n\"))\n }\n}\n\nfunction versionSatisfies(version: string | semver.SemVer | null, range: string | semver.Range, loose?: boolean): boolean {\n if (version == null) {\n return false\n }\n\n const coerced = semver.coerce(version)\n if (coerced == null) {\n return false\n }\n\n return semver.satisfies(coerced, range, loose)\n}\n\nfunction checkDependencies(dependencies: Record<string, string> | Nullish, errors: Array<string>, projectDir: string) {\n if (dependencies == null) {\n return\n }\n\n let updaterVersion = dependencies[\"electron-updater\"]\n if (updaterVersion != null) {\n let skipValidation = false\n\n // prefer the version of the actually-installed electron-updater over the declared specifier,\n // so that specifiers like pnpm `catalog:`/`workspace:` are validated against the real version\n let resolvedPackageJson: string | null = null\n try {\n resolvedPackageJson = require.resolve(\"electron-updater/package.json\", { paths: [projectDir] })\n } catch (_ignored) {\n // electron-updater is not installed (MODULE_NOT_FOUND), or the installed version's `exports` map\n // does not expose \"./package.json\" (ERR_PACKAGE_PATH_NOT_EXPORTED) — fall back to the declared specifier below\n }\n\n if (resolvedPackageJson != null) {\n updaterVersion = fsExtra.readJsonSync(resolvedPackageJson).version\n } else {\n // Pick the version out of yarn berry patch syntax\n // \"patch:electron-updater@npm%3A6.4.1#~/.yarn/patches/electron-updater-npm-6.4.1-ef33e6cc39.patch\"\n if (updaterVersion.startsWith(\"patch:\")) {\n const npmMarker = \"@npm%3A\"\n const markerIndex = updaterVersion.indexOf(npmMarker)\n if (markerIndex !== -1) {\n const versionStart = markerIndex + npmMarker.length\n const hashIndex = updaterVersion.indexOf(\"#\", versionStart)\n if (hashIndex > versionStart) {\n updaterVersion = updaterVersion.slice(versionStart, hashIndex)\n }\n }\n }\n\n // for testing auto-update using workspace electron-updater\n const prefixes = [\"link:\", \"file:\"]\n for (const prefix of prefixes) {\n if (updaterVersion.startsWith(prefix)) {\n const normalized = path.normalize(updaterVersion.substring(prefix.length))\n const packageJsonPath = path.isAbsolute(normalized) ? normalized : path.resolve(process.cwd(), normalized)\n const json = fsExtra.readJsonSync(path.join(packageJsonPath, \"package.json\"))\n updaterVersion = json.version\n break\n }\n }\n\n // pnpm `catalog:` and `workspace:` specifiers cannot be resolved to a concrete version from the package.json alone, so skip validation\n const unresolvableProtocols = [\"catalog:\", \"workspace:\"]\n skipValidation = unresolvableProtocols.some(protocol => updaterVersion.startsWith(protocol))\n }\n\n const requiredElectronUpdaterVersion = \"4.0.0\"\n if (!skipValidation && !versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) {\n errors.push(\n `At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to \"^${requiredElectronUpdaterVersion}\". Received \"${updaterVersion}\"`\n )\n }\n }\n\n const swVersion = dependencies[\"electron-builder-squirrel-windows\"]\n if (swVersion != null && !versionSatisfies(swVersion, \">=20.32.0\")) {\n errors.push(`At least electron-builder-squirrel-windows 20.32.0 is required by current electron-builder version. Please set electron-builder-squirrel-windows to \"^20.32.0\"`)\n }\n}\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E,MAAM,CAAC,IAAI,CAAC,gKAAgK,CAAC,CAAA;IAC/K,CAAC;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport fsExtra from \"fs-extra\"\nimport { createRequire } from \"node:module\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Metadata } from \"../options/metadata.js\"\nimport { normalizePackageData } from \"./normalizePackageData.js\"\n\nconst require = createRequire(import.meta.url)\n\n/** @internal */\nexport async function readPackageJson(file: string): Promise<any> {\n const data = await fsExtra.readJson(file)\n await authors(file, data)\n // remove not required fields because can be used for remote build\n delete data.scripts\n delete data.readme\n normalizePackageData(data)\n return data\n}\n\nasync function authors(file: string, data: any) {\n if (data.contributors != null) {\n return\n }\n\n let authorData\n try {\n authorData = await fsExtra.readFile(path.resolve(path.dirname(file), \"AUTHORS\"), \"utf8\")\n } catch (_ignored) {\n return\n }\n\n data.contributors = authorData.split(/\\r?\\n/g).map(it => it.replace(/^\\s*#.*$/, \"\").trim())\n}\n\n/** @internal */\nexport function checkMetadata(metadata: Metadata, devMetadata: any | null, appPackageFile: string, devAppPackageFile: string, projectDir: string): void {\n const errors: Array<string> = []\n const reportError = (missedFieldName: string) => {\n errors.push(`Please specify '${missedFieldName}' in the package.json (${appPackageFile})`)\n }\n\n const checkNotEmpty = (name: string, value: string | Nullish) => {\n if (isEmptyOrSpaces(value)) {\n reportError(name)\n }\n }\n\n checkNotEmpty(\"name\", metadata.name)\n\n if (isEmptyOrSpaces(metadata.description)) {\n log.warn({ appPackageFile }, `description is missed in the package.json`)\n }\n if (metadata.author == null) {\n log.warn({ appPackageFile }, `author is missed in the package.json`)\n }\n checkNotEmpty(\"version\", metadata.version)\n\n checkDependencies(metadata.dependencies, errors, projectDir)\n if (metadata !== devMetadata) {\n if (metadata.build != null) {\n errors.push(\n `'build' in the application package.json (${appPackageFile}) is not supported since 3.0 anymore. Please move 'build' into the development package.json (${devAppPackageFile})`\n )\n }\n }\n\n // Root-level `directories` was read by v26 and is ignored by v27. It lives outside the validated\n // Configuration object, so nothing else catches it: the build silently writes to the default `dist`\n // instead of the configured output directory, and a release pipeline copies from an empty path.\n const rootDirectories = (devMetadata ?? metadata)?.directories\n if (rootDirectories != null) {\n errors.push(\n `'directories' at the root of the package.json (${devAppPackageFile}) is no longer read by electron-builder v27 — move it under the 'build' key:\\n` +\n ` { \"build\": { \"directories\": ${JSON.stringify(rootDirectories)} } }\\n` +\n \" Left where it is, it is ignored and your build output goes to the default 'dist' directory.\\n\" +\n \" Run `electron-builder migrate-schema` to move it automatically.\\n\" +\n \" https://www.electron.build/docs/migration/v27-config-changes#root-level-directories-in-packagejson\"\n )\n }\n\n const devDependencies = (metadata as any).devDependencies\n if (devDependencies != null && (\"electron-rebuild\" in devDependencies || \"@electron/rebuild\" in devDependencies)) {\n log.info(\n '@electron/rebuild already used by electron-builder, please consider to remove excess dependency from devDependencies\\n\\nTo ensure your native dependencies are always matched electron version, simply add script `\"postinstall\": \"electron-builder install-app-deps\" to your `package.json`'\n )\n }\n\n if (errors.length > 0) {\n throw new InvalidConfigurationError(errors.join(\"\\n\"))\n }\n}\n\nfunction versionSatisfies(version: string | semver.SemVer | null, range: string | semver.Range, loose?: boolean): boolean {\n if (version == null) {\n return false\n }\n\n const coerced = semver.coerce(version)\n if (coerced == null) {\n return false\n }\n\n return semver.satisfies(coerced, range, loose)\n}\n\nfunction checkDependencies(dependencies: Record<string, string> | Nullish, errors: Array<string>, projectDir: string) {\n if (dependencies == null) {\n return\n }\n\n let updaterVersion = dependencies[\"electron-updater\"]\n if (updaterVersion != null) {\n let skipValidation = false\n\n // prefer the version of the actually-installed electron-updater over the declared specifier,\n // so that specifiers like pnpm `catalog:`/`workspace:` are validated against the real version\n let resolvedPackageJson: string | null = null\n try {\n resolvedPackageJson = require.resolve(\"electron-updater/package.json\", { paths: [projectDir] })\n } catch (_ignored) {\n // electron-updater is not installed (MODULE_NOT_FOUND), or the installed version's `exports` map\n // does not expose \"./package.json\" (ERR_PACKAGE_PATH_NOT_EXPORTED) — fall back to the declared specifier below\n }\n\n if (resolvedPackageJson != null) {\n updaterVersion = fsExtra.readJsonSync(resolvedPackageJson).version\n } else {\n // Pick the version out of yarn berry patch syntax\n // \"patch:electron-updater@npm%3A6.4.1#~/.yarn/patches/electron-updater-npm-6.4.1-ef33e6cc39.patch\"\n if (updaterVersion.startsWith(\"patch:\")) {\n const npmMarker = \"@npm%3A\"\n const markerIndex = updaterVersion.indexOf(npmMarker)\n if (markerIndex !== -1) {\n const versionStart = markerIndex + npmMarker.length\n const hashIndex = updaterVersion.indexOf(\"#\", versionStart)\n if (hashIndex > versionStart) {\n updaterVersion = updaterVersion.slice(versionStart, hashIndex)\n }\n }\n }\n\n // for testing auto-update using workspace electron-updater\n const prefixes = [\"link:\", \"file:\"]\n for (const prefix of prefixes) {\n if (updaterVersion.startsWith(prefix)) {\n const normalized = path.normalize(updaterVersion.substring(prefix.length))\n const packageJsonPath = path.isAbsolute(normalized) ? normalized : path.resolve(process.cwd(), normalized)\n const json = fsExtra.readJsonSync(path.join(packageJsonPath, \"package.json\"))\n updaterVersion = json.version\n break\n }\n }\n\n // pnpm `catalog:` and `workspace:` specifiers cannot be resolved to a concrete version from the package.json alone, so skip validation\n const unresolvableProtocols = [\"catalog:\", \"workspace:\"]\n skipValidation = unresolvableProtocols.some(protocol => updaterVersion.startsWith(protocol))\n }\n\n const requiredElectronUpdaterVersion = \"4.0.0\"\n if (!skipValidation && !versionSatisfies(updaterVersion, `>=${requiredElectronUpdaterVersion}`)) {\n errors.push(\n `At least electron-updater ${requiredElectronUpdaterVersion} is recommended by current electron-builder version. Please set electron-updater version to \"^${requiredElectronUpdaterVersion}\". Received \"${updaterVersion}\"`\n )\n }\n }\n\n const swVersion = dependencies[\"electron-builder-squirrel-windows\"]\n if (swVersion != null && !versionSatisfies(swVersion, \">=20.32.0\")) {\n errors.push(`At least electron-builder-squirrel-windows 20.32.0 is required by current electron-builder version. Please set electron-builder-squirrel-windows to \"^20.32.0\"`)\n }\n}\n"]}
|
|
@@ -15,6 +15,8 @@ interface RemovedEnvVar {
|
|
|
15
15
|
* not a signal — the removed `"release"` auto-publish behavior is covered in the migration docs).
|
|
16
16
|
*/
|
|
17
17
|
export declare const REMOVED_ENV_VARS: ReadonlyArray<RemovedEnvVar>;
|
|
18
|
+
/** The section of the v27 build-changes page that documents a removed environment variable. */
|
|
19
|
+
export declare function removedEnvVarDocsUrl(name: string): string;
|
|
18
20
|
/**
|
|
19
21
|
* Logs a one-time deprecation warning for every {@link REMOVED_ENV_VARS} entry still present in the
|
|
20
22
|
* environment. Called once per build (from the {@link Packager} constructor) so both the CLI and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removedEnvVars.d.ts","sourceRoot":"","sources":["../../src/util/removedEnvVars.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"removedEnvVars.d.ts","sourceRoot":"","sources":["../../src/util/removedEnvVars.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,aAAa,CAgCzD,CAAA;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAM/E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { log } from "builder-util";
|
|
2
|
+
import { BUILD_CHANGES_URL } from "./config/legacyOptions.js";
|
|
2
3
|
/**
|
|
3
4
|
* Environment variables that were honored in electron-builder v26 but were removed in v27. When a
|
|
4
5
|
* project upgrades from v26 and still has one of these set, the build silently ignores it — the
|
|
@@ -39,6 +40,19 @@ export const REMOVED_ENV_VARS = [
|
|
|
39
40
|
remediation: `electron-builder in \`dependencies\` no longer errors and is excluded from the packaged app by default — remove this variable, and use the \`ignoredProductionDependencies\` option to customize exclusions.`,
|
|
40
41
|
},
|
|
41
42
|
];
|
|
43
|
+
/** The section of the v27 build-changes page that documents a removed environment variable. */
|
|
44
|
+
export function removedEnvVarDocsUrl(name) {
|
|
45
|
+
switch (name) {
|
|
46
|
+
case "CI_BUILD_TAG":
|
|
47
|
+
return `${BUILD_CHANGES_URL}#ci_build_tag-environment-variable`;
|
|
48
|
+
case "ELECTRON_BUILDER_BINARIES_ALLOW_HTTP":
|
|
49
|
+
return `${BUILD_CHANGES_URL}#electron_builder_binaries_allow_http-renamed`;
|
|
50
|
+
case "ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY":
|
|
51
|
+
return `${BUILD_CHANGES_URL}#allow_electron_builder_as_production_dependency-is-removed-and-the-default-flipped`;
|
|
52
|
+
default:
|
|
53
|
+
return `${BUILD_CHANGES_URL}#toolset-env-var-overrides-removed`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
42
56
|
/**
|
|
43
57
|
* Logs a one-time deprecation warning for every {@link REMOVED_ENV_VARS} entry still present in the
|
|
44
58
|
* environment. Called once per build (from the {@link Packager} constructor) so both the CLI and the
|
|
@@ -47,7 +61,7 @@ export const REMOVED_ENV_VARS = [
|
|
|
47
61
|
export function warnOnRemovedEnvVars(env = process.env) {
|
|
48
62
|
for (const { name, remediation } of REMOVED_ENV_VARS) {
|
|
49
63
|
if (env[name] != null) {
|
|
50
|
-
log.warn({ envVar: name }, `environment variable was removed in electron-builder v27 and no longer has any effect — ${remediation}`);
|
|
64
|
+
log.warn({ envVar: name, docs: removedEnvVarDocsUrl(name) }, `environment variable was removed in electron-builder v27 and no longer has any effect — ${remediation}`);
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removedEnvVars.js","sourceRoot":"","sources":["../../src/util/removedEnvVars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"removedEnvVars.js","sourceRoot":"","sources":["../../src/util/removedEnvVars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAS7D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAiC;IAC5D,yHAAyH;IACzH,EAAE,IAAI,EAAE,qBAAqB,EAAE,WAAW,EAAE,oEAAoE,EAAE;IAClH,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,uIAAuI,EAAE;IACjL,EAAE,IAAI,EAAE,sBAAsB,EAAE,WAAW,EAAE,yEAAyE,EAAE;IACxH,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,+DAA+D,EAAE;IACzG,EAAE,IAAI,EAAE,2BAA2B,EAAE,WAAW,EAAE,gEAAgE,EAAE;IACpH,EAAE,IAAI,EAAE,qCAAqC,EAAE,WAAW,EAAE,gEAAgE,EAAE;IAC9H,EAAE,IAAI,EAAE,uBAAuB,EAAE,WAAW,EAAE,gEAAgE,EAAE;IAChH,EAAE,IAAI,EAAE,mCAAmC,EAAE,WAAW,EAAE,gEAAgE,EAAE;IAC5H,EAAE,IAAI,EAAE,4BAA4B,EAAE,WAAW,EAAE,oEAAoE,EAAE;IACzH,EAAE,IAAI,EAAE,oCAAoC,EAAE,WAAW,EAAE,iEAAiE,EAAE;IAC9H,EAAE,IAAI,EAAE,qCAAqC,EAAE,WAAW,EAAE,uEAAuE,EAAE;IACrI,EAAE,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,uEAAuE,EAAE;IAC9H,EAAE,IAAI,EAAE,oCAAoC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B,CAAC,IAAI,CAAC,EAAE,EAAE,2FAA2F,WAAW,EAAE,CAAC,CAAA;QACxK,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport { BUILD_CHANGES_URL } from \"./config/legacyOptions.js\"\n\ninterface RemovedEnvVar {\n /** The environment variable that was read in v26 but is no longer read in v27. */\n readonly name: string\n /** What to use instead, appended to the deprecation warning. */\n readonly remediation: string\n}\n\n/**\n * Environment variables that were honored in electron-builder v26 but were removed in v27. When a\n * project upgrades from v26 and still has one of these set, the build silently ignores it — the\n * `process.env` read was deleted, so there is no other signal. {@link warnOnRemovedEnvVars} scans\n * the environment once per build and logs a deprecation warning with the remediation.\n *\n * Deliberately excluded: internal/test-only variables that end users never set (`JEST_WORKER_ID`,\n * `TEST_SET_BABEL_PRESET`), and `npm_lifecycle_event` (npm sets it for every script, so presence is\n * not a signal — the removed `\"release\"` auto-publish behavior is covered in the migration docs).\n */\nexport const REMOVED_ENV_VARS: ReadonlyArray<RemovedEnvVar> = [\n // Toolset path/dir overrides — the `resolveEnvToolsetPath` mechanism was removed; supply a ToolsetCustom object instead.\n { name: \"APPIMAGE_TOOLS_PATH\", remediation: `set \\`toolsets.appimage: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"MKSQUASHFS_PATH\", remediation: `the mksquashfs binary now ships with the appimage toolset — set \\`toolsets.appimage: { url: \"file:///path/to/dir\" }\\` to override it.` },\n { name: \"LINUX_TOOLS_MAC_PATH\", remediation: `set \\`toolsets.linuxToolsMac: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"CUSTOM_FPM_PATH\", remediation: `set \\`toolsets.fpm: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_NSIS_DIR\", remediation: `set \\`toolsets.nsis: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_NSIS_RESOURCES_DIR\", remediation: `set \\`toolsets.nsis: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"CUSTOM_NSIS_RESOURCES\", remediation: `set \\`toolsets.nsis: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_WINE_TOOLSET_DIR\", remediation: `set \\`toolsets.wine: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_7ZIP_PATH\", remediation: `set \\`toolsets.sevenZip: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", remediation: `set \\`toolsets.icons: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_OSSL_SIGNCODE_PATH\", remediation: `set \\`toolsets.winCodeSign: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_RCEDIT_PATH\", remediation: `set \\`toolsets.winCodeSign: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"ELECTRON_BUILDER_WINDOWS_KITS_PATH\", remediation: `set \\`toolsets.winCodeSign: { url: \"file:///path/to/dir\" }\\` instead.` },\n { name: \"SIGNTOOL_PATH\", remediation: `configure signing via \\`win.sign\\` and the \\`winCodeSign\\` toolset instead.` },\n\n // `USE_SYSTEM_*` toggles — removed with no env-var replacement; configure via the toolset/signing config.\n { name: \"USE_SYSTEM_WINE\", remediation: `Linux uses the host \\`wine\\` by default; to use a custom Wine build set \\`toolsets.wine: { url: \"file:///path/to/dir\" }\\`.` },\n { name: \"USE_SYSTEM_SIGNCODE\", remediation: `configure signing via \\`win.sign\\` and the \\`winCodeSign\\` toolset instead.` },\n { name: \"USE_SYSTEM_OSSLSIGNCODE\", remediation: `configure signing via \\`win.sign\\` and the \\`winCodeSign\\` toolset instead.` },\n { name: \"USE_SYSTEM_FPM\", remediation: `set \\`toolsets.fpm: { url: \"file:///path/to/dir\" }\\` instead (required on Windows for FPM-based targets).` },\n\n // Renamed / replaced by another environment variable.\n { name: \"ELECTRON_BUILDER_BINARIES_ALLOW_HTTP\", remediation: `use \\`ELECTRON_BUILDER_DANGEROUSLY_ALLOW_HTTP=true\\` instead.` },\n { name: \"CI_BUILD_TAG\", remediation: `use \\`CI_COMMIT_TAG\\` (the standard GitLab CI variable) instead.` },\n\n // Replaced by a configuration option (with a behavior change).\n {\n name: \"ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY\",\n remediation: `electron-builder in \\`dependencies\\` no longer errors and is excluded from the packaged app by default — remove this variable, and use the \\`ignoredProductionDependencies\\` option to customize exclusions.`,\n },\n]\n\n/** The section of the v27 build-changes page that documents a removed environment variable. */\nexport function removedEnvVarDocsUrl(name: string): string {\n switch (name) {\n case \"CI_BUILD_TAG\":\n return `${BUILD_CHANGES_URL}#ci_build_tag-environment-variable`\n case \"ELECTRON_BUILDER_BINARIES_ALLOW_HTTP\":\n return `${BUILD_CHANGES_URL}#electron_builder_binaries_allow_http-renamed`\n case \"ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY\":\n return `${BUILD_CHANGES_URL}#allow_electron_builder_as_production_dependency-is-removed-and-the-default-flipped`\n default:\n return `${BUILD_CHANGES_URL}#toolset-env-var-overrides-removed`\n }\n}\n\n/**\n * Logs a one-time deprecation warning for every {@link REMOVED_ENV_VARS} entry still present in the\n * environment. Called once per build (from the {@link Packager} constructor) so both the CLI and the\n * programmatic `build()` API surface the same guidance.\n */\nexport function warnOnRemovedEnvVars(env: NodeJS.ProcessEnv = process.env): void {\n for (const { name, remediation } of REMOVED_ENV_VARS) {\n if (env[name] != null) {\n log.warn({ envVar: name, docs: removedEnvVarDocsUrl(name) }, `environment variable was removed in electron-builder v27 and no longer has any effect — ${remediation}`)\n }\n }\n}\n"]}
|
|
@@ -16,7 +16,9 @@ export interface StreamSpawnResult {
|
|
|
16
16
|
* which emits the DEP0190 "args with shell" deprecation warning and forces manual metacharacter
|
|
17
17
|
* escaping — wrap the invocation in a single PowerShell `-EncodedCommand`. The base64 (UTF-16LE)
|
|
18
18
|
* payload sidesteps every shell-quoting layer, and `powershell.exe` is a real executable we spawn
|
|
19
|
-
* directly with no shell
|
|
19
|
+
* directly with no shell, by its absolute path (`toolsets.executables.powershell` or its default location;
|
|
20
|
+
* never looked up in the current directory or on PATH).
|
|
21
|
+
* See buildPowerShellEncodedArgs for the UTF-8 / exit-code handling. This
|
|
20
22
|
* also avoids the cmd.exe "The batch file cannot be found." re-open race that plagues `.cmd` shims.
|
|
21
23
|
*
|
|
22
24
|
* Resolves with `{ code, stderr }` for ANY exit code — interpreting a non-zero code is the caller's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamSpawnToFile.d.ts","sourceRoot":"","sources":["../../src/util/streamSpawnToFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"streamSpawnToFile.d.ts","sourceRoot":"","sources":["../../src/util/streamSpawnToFile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;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,CAmEtJ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAMpF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as childProcess from "child_process";
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
|
+
import { Executables } from "builder-util";
|
|
3
4
|
/**
|
|
4
5
|
* Spawns a command and streams its stdout to a file, returning the exit code and captured stderr.
|
|
5
6
|
*
|
|
@@ -12,7 +13,9 @@ import { createWriteStream } from "node:fs";
|
|
|
12
13
|
* which emits the DEP0190 "args with shell" deprecation warning and forces manual metacharacter
|
|
13
14
|
* escaping — wrap the invocation in a single PowerShell `-EncodedCommand`. The base64 (UTF-16LE)
|
|
14
15
|
* payload sidesteps every shell-quoting layer, and `powershell.exe` is a real executable we spawn
|
|
15
|
-
* directly with no shell
|
|
16
|
+
* directly with no shell, by its absolute path (`toolsets.executables.powershell` or its default location;
|
|
17
|
+
* never looked up in the current directory or on PATH).
|
|
18
|
+
* See buildPowerShellEncodedArgs for the UTF-8 / exit-code handling. This
|
|
16
19
|
* also avoids the cmd.exe "The batch file cannot be found." re-open race that plagues `.cmd` shims.
|
|
17
20
|
*
|
|
18
21
|
* Resolves with `{ code, stderr }` for ANY exit code — interpreting a non-zero code is the caller's
|
|
@@ -26,8 +29,9 @@ import { createWriteStream } from "node:fs";
|
|
|
26
29
|
* @param env - The environment for the child process (callers are responsible for stripping secrets)
|
|
27
30
|
*/
|
|
28
31
|
export function streamSpawnToFile(command, args, cwd, outputFile, env) {
|
|
29
|
-
const [spawnCommand, spawnArgs] = process.platform === "win32" ? ["powershell.exe", buildPowerShellEncodedArgs(command, args)] : [command, args];
|
|
30
32
|
return new Promise((resolve, reject) => {
|
|
33
|
+
// inside the executor, so a SystemRoot that cannot locate PowerShell rejects like any other spawn failure
|
|
34
|
+
const [spawnCommand, spawnArgs] = process.platform === "win32" ? [Executables.resolve("powershell"), buildPowerShellEncodedArgs(command, args)] : [command, args];
|
|
31
35
|
const outStream = createWriteStream(outputFile);
|
|
32
36
|
const child = childProcess.spawn(spawnCommand, spawnArgs, { cwd, env });
|
|
33
37
|
let stderr = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamSpawnToFile.js","sourceRoot":"","sources":["../../src/util/streamSpawnToFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AA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O,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QAC9F,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;YACvB,QAAQ,GAAG,IAAI,CAAA;YACf,WAAW,GAAG,IAAI,CAAA;YAClB,MAAM,EAAE,CAAA;QACV,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAe,EAAE,IAAc;IACxE,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAA;IACnE,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1E,MAAM,MAAM,GAAG,sEAAsE,UAAU,sBAAsB,CAAA;IACrH,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACjE,OAAO,CAAC,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import * as childProcess from \"child_process\"\nimport { createWriteStream } from \"node:fs\"\nimport { Executables } from \"builder-util\"\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, by its absolute path (`toolsets.executables.powershell` or its default location;\n * never looked up in the current directory or on PATH).\n * 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 return new Promise<StreamSpawnResult>((resolve, reject) => {\n // inside the executor, so a SystemRoot that cannot locate PowerShell rejects like any other spawn failure\n const [spawnCommand, spawnArgs] =\n process.platform === \"win32\" ? ([Executables.resolve(\"powershell\"), buildPowerShellEncodedArgs(command, args)] as const) : ([command, args] as const)\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"]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "27.0.0-alpha.
|
|
1
|
+
export declare const PACKAGE_VERSION = "27.0.0-alpha.13";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = "27.0.0-alpha.
|
|
1
|
+
export const PACKAGE_VERSION = "27.0.0-alpha.13";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"27.0.0-alpha.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"27.0.0-alpha.13\"\n"]}
|
package/dist/vm/ParallelsVm.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { ExtraSpawnOptions } from "builder-util";
|
|
2
2
|
import { ExecFileOptions, SpawnOptions } from "child_process";
|
|
3
3
|
import { VmManager } from "./vm.js";
|
|
4
|
+
/** The same executables inside a Parallels Windows guest, at the locations of a default Windows installation. */
|
|
5
|
+
export declare const PARALLELS_GUEST_WINDOWS_POWERSHELL = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
|
|
6
|
+
export declare const PARALLELS_GUEST_PWSH = "C:\\Program Files\\PowerShell\\7\\pwsh.exe";
|
|
4
7
|
export declare class ParallelsVmManager extends VmManager {
|
|
5
8
|
private readonly vm;
|
|
6
9
|
private startPromise;
|
|
7
10
|
private isExitHookAdded;
|
|
11
|
+
private readonly prlctl;
|
|
8
12
|
constructor(vm: ParallelsVm);
|
|
9
13
|
get pathSep(): string;
|
|
10
14
|
private handleExecuteError;
|
|
@@ -12,6 +16,12 @@ export declare class ParallelsVmManager extends VmManager {
|
|
|
12
16
|
spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any>;
|
|
13
17
|
private doStartVm;
|
|
14
18
|
private ensureThatVmStarted;
|
|
19
|
+
protected windowsPowerShellPaths(): {
|
|
20
|
+
powershell: string;
|
|
21
|
+
pwsh: {
|
|
22
|
+
unavailable: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
15
25
|
toVmFile(file: string): string;
|
|
16
26
|
}
|
|
17
27
|
export declare function macPathToParallelsWindows(file: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParallelsVm.d.ts","sourceRoot":"","sources":["../../src/vm/ParallelsVm.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ParallelsVm.d.ts","sourceRoot":"","sources":["../../src/vm/ParallelsVm.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,iBAAiB,EAA4D,MAAM,cAAc,CAAA;AACpI,OAAO,EAAE,eAAe,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAA;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,iHAAiH;AACjH,eAAO,MAAM,kCAAkC,mEAAmE,CAAA;AAClH,eAAO,MAAM,oBAAoB,+CAA+C,CAAA;AAmChF,qBAAa,kBAAmB,SAAQ,SAAS;IAOnC,OAAO,CAAC,QAAQ,CAAC,EAAE;IAN/B,OAAO,CAAC,YAAY,CAAc;IAElC,OAAO,CAAC,eAAe,CAAQ;IAE/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEF,EAAE,EAAE,WAAW;IAO5C,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,OAAO,CAAC,kBAAkB;IASpB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAUnF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC;YAKxG,SAAS;IAgCvB,OAAO,CAAC,mBAAmB;IAW3B,SAAS,CAAC,sBAAsB;;;;;;IAOhC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAI/B;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,UA4BrD;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAA;IACjD,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;CAC3C"}
|
package/dist/vm/ParallelsVm.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { exec, log, sanitizeDirPath, spawn, stripSensitiveEnvVars } from "builder-util";
|
|
1
|
+
import { Executables, exec, log, sanitizeDirPath, spawn, stripSensitiveEnvVars } from "builder-util";
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import { VmManager } from "./vm.js";
|
|
5
|
+
/** The same executables inside a Parallels Windows guest, at the locations of a default Windows installation. */
|
|
6
|
+
export const PARALLELS_GUEST_WINDOWS_POWERSHELL = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
|
|
7
|
+
export const PARALLELS_GUEST_PWSH = "C:\\Program Files\\PowerShell\\7\\pwsh.exe";
|
|
5
8
|
/** @internal */
|
|
6
9
|
export async function parseVmList(debugLogger) {
|
|
10
|
+
// prlctl by absolute path; when Parallels Desktop is not installed this throws, which callers treat as "no Parallels VM"
|
|
11
|
+
const prlctl = Executables.resolve("prlctl");
|
|
7
12
|
// do not log output if debug - it is huge, logged using debugLogger
|
|
8
|
-
let rawList = await exec(
|
|
13
|
+
let rawList = await exec(prlctl, ["list", "-i", "-s", "name"], undefined, false);
|
|
9
14
|
debugLogger.add("parallels.list", rawList);
|
|
10
15
|
rawList = rawList.substring(rawList.indexOf("ID:"));
|
|
11
16
|
// let match: Array<string> | null
|
|
@@ -34,6 +39,7 @@ export class ParallelsVmManager extends VmManager {
|
|
|
34
39
|
super();
|
|
35
40
|
this.vm = vm;
|
|
36
41
|
this.isExitHookAdded = false;
|
|
42
|
+
this.prlctl = Executables.resolve("prlctl");
|
|
37
43
|
this.startPromise = this.doStartVm();
|
|
38
44
|
}
|
|
39
45
|
get pathSep() {
|
|
@@ -48,14 +54,14 @@ export class ParallelsVmManager extends VmManager {
|
|
|
48
54
|
}
|
|
49
55
|
async exec(file, args, options) {
|
|
50
56
|
await this.ensureThatVmStarted();
|
|
51
|
-
// Merge caller-supplied env onto the base environment, so extra vars don't strip
|
|
57
|
+
// Merge caller-supplied env onto the base environment, so extra vars don't strip the variables `prlctl` relies on (HOME, etc.).
|
|
52
58
|
const mergedOptions = options?.env != null ? { ...options, env: { ...stripSensitiveEnvVars(process.env), ...options.env } } : options;
|
|
53
59
|
// it is important to use "--current-user" to execute command under logged in user - to access certs.
|
|
54
|
-
return await exec(
|
|
60
|
+
return await exec(this.prlctl, ["exec", this.vm.id, "--current-user", file.startsWith("/") ? macPathToParallelsWindows(file) : file].concat(args), mergedOptions).catch(error => this.handleExecuteError(error));
|
|
55
61
|
}
|
|
56
62
|
async spawn(file, args, options, extraOptions) {
|
|
57
63
|
await this.ensureThatVmStarted();
|
|
58
|
-
return await spawn(
|
|
64
|
+
return await spawn(this.prlctl, ["exec", this.vm.id, file].concat(args), options, extraOptions).catch(error => this.handleExecuteError(error));
|
|
59
65
|
}
|
|
60
66
|
async doStartVm() {
|
|
61
67
|
const vmId = this.vm.id;
|
|
@@ -69,10 +75,10 @@ export class ParallelsVmManager extends VmManager {
|
|
|
69
75
|
// Suspend the VM on normal exit and on termination signals.
|
|
70
76
|
// SIGTERM/SIGINT use async exec(); the synchronous 'exit' fallback fires
|
|
71
77
|
// after all async callbacks have already resolved, so execFileSync is safe.
|
|
72
|
-
const suspendAsync = () => exec(
|
|
78
|
+
const suspendAsync = () => exec(this.prlctl, stopArgs).catch(() => { });
|
|
73
79
|
const suspendSync = () => {
|
|
74
80
|
try {
|
|
75
|
-
execFileSync(
|
|
81
|
+
execFileSync(this.prlctl, stopArgs);
|
|
76
82
|
}
|
|
77
83
|
catch {
|
|
78
84
|
/* best-effort */
|
|
@@ -86,7 +92,7 @@ export class ParallelsVmManager extends VmManager {
|
|
|
86
92
|
});
|
|
87
93
|
process.once("exit", suspendSync);
|
|
88
94
|
}
|
|
89
|
-
await exec(
|
|
95
|
+
await exec(this.prlctl, ["start", vmId]);
|
|
90
96
|
}
|
|
91
97
|
ensureThatVmStarted() {
|
|
92
98
|
let startPromise = this.startPromise;
|
|
@@ -96,6 +102,14 @@ export class ParallelsVmManager extends VmManager {
|
|
|
96
102
|
}
|
|
97
103
|
return startPromise;
|
|
98
104
|
}
|
|
105
|
+
// The guest's environment is not visible from the host, so the location of a default Windows installation is used. PowerShell 7
|
|
106
|
+
// is not: `prlctl exec` passes its arguments to the guest without quoting, so a path containing a space cannot be started.
|
|
107
|
+
windowsPowerShellPaths() {
|
|
108
|
+
return {
|
|
109
|
+
powershell: PARALLELS_GUEST_WINDOWS_POWERSHELL,
|
|
110
|
+
pwsh: { unavailable: `PowerShell 7 (${PARALLELS_GUEST_PWSH}) is not used in a Parallels VM, because prlctl exec cannot start a path that contains a space` },
|
|
111
|
+
};
|
|
112
|
+
}
|
|
99
113
|
toVmFile(file) {
|
|
100
114
|
// https://stackoverflow.com/questions/4742992/cannot-access-network-drive-in-powershell-running-as-administrator
|
|
101
115
|
return macPathToParallelsWindows(file);
|