electron-builder-squirrel-windows 26.15.3 → 27.0.0-alpha.1
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/{out → dist}/SquirrelWindowsTarget.d.ts +1 -0
- package/dist/SquirrelWindowsTarget.d.ts.map +1 -0
- package/{out → dist}/SquirrelWindowsTarget.js +56 -60
- package/dist/SquirrelWindowsTarget.js.map +1 -0
- package/dist/indexInternal.d.ts +1 -0
- package/dist/indexInternal.d.ts.map +1 -0
- package/dist/indexInternal.js +3 -0
- package/dist/indexInternal.js.map +1 -0
- package/package.json +26 -6
- package/out/SquirrelWindowsTarget.js.map +0 -1
|
@@ -17,3 +17,4 @@ export default class SquirrelWindowsTarget extends Target {
|
|
|
17
17
|
private createNuspecTemplateWithProjectUrl;
|
|
18
18
|
computeEffectiveDistOptions(appDirectory: string, outputDirectory: string, setupFile: string): Promise<SquirrelOptions>;
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=SquirrelWindowsTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SquirrelWindowsTarget.d.ts","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAiB,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAIlG,OAAO,EAAE,OAAO,IAAI,eAAe,EAA0C,MAAM,qBAAqB,CAAA;AAGxG,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,MAAM;IAMrD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM;IANzB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAA;IAExC,gBAAgB,UAAQ;gBAGL,QAAQ,EAAE,WAAW,EAC7B,MAAM,EAAE,MAAM;YAMX,4BAA4B;IAoC1C,OAAO,CAAC,mBAAmB;YAMb,gBAAgB;YA2ChB,yBAAyB;IAwBjC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;IAwEzC,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,KAAK,OAAO,GAGlB;IAED,OAAO,CAAC,cAAc;YASR,kCAAkC;IAc1C,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAuE9H"}
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { InvalidConfigurationError, log, isEmptyOrSpaces, exists } from "builder-util";
|
|
3
|
+
const _requireResolve = createRequire(import.meta.url).resolve;
|
|
4
|
+
import { downloadBuilderToolset, withToolsetLock } from "app-builder-lib/internal";
|
|
5
|
+
import { sanitizeFileName } from "builder-util/internal";
|
|
6
|
+
import { getArchSuffix, Target } from "app-builder-lib";
|
|
7
|
+
import * as path from "path";
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import * as os from "os";
|
|
10
|
+
import { createWindowsInstaller, convertVersion } from "electron-winstaller";
|
|
11
|
+
import { WineVmManager } from "app-builder-lib/internal";
|
|
12
|
+
export default class SquirrelWindowsTarget extends Target {
|
|
14
13
|
constructor(packager, outDir) {
|
|
15
14
|
super("squirrel");
|
|
16
15
|
this.packager = packager;
|
|
17
16
|
this.outDir = outDir;
|
|
18
|
-
//tslint:disable-next-line:no-object-literal-type-assertion
|
|
19
|
-
this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows };
|
|
20
17
|
this.isAsyncSupported = false;
|
|
18
|
+
this.options = packager.getOptionsForTarget("squirrelWindows");
|
|
21
19
|
}
|
|
22
20
|
async prepareSignedVendorDirectory() {
|
|
23
21
|
const customSquirrelVendorDirectory = this.options.customSquirrelVendorDir;
|
|
24
|
-
const tmpVendorDirectory = await this.packager.
|
|
25
|
-
if (customSquirrelVendorDirectory && (await
|
|
22
|
+
const tmpVendorDirectory = await this.packager.tempDirManager.createTempDir({ prefix: "squirrel-windows-vendor" });
|
|
23
|
+
if (customSquirrelVendorDirectory && (await exists(customSquirrelVendorDirectory))) {
|
|
26
24
|
await fs.promises.cp(customSquirrelVendorDirectory, tmpVendorDirectory, { recursive: true });
|
|
27
25
|
}
|
|
28
26
|
else {
|
|
29
|
-
if (!
|
|
30
|
-
|
|
27
|
+
if (!isEmptyOrSpaces(customSquirrelVendorDirectory)) {
|
|
28
|
+
log.warn({ customSquirrelVendorDirectory }, "unable to access custom Squirrel.Windows vendor directory, falling back to default vendor");
|
|
31
29
|
}
|
|
32
|
-
const windowInstallerPackage =
|
|
30
|
+
const windowInstallerPackage = _requireResolve("electron-winstaller/package.json");
|
|
33
31
|
const [squirrelBin] = await Promise.all([
|
|
34
|
-
(
|
|
32
|
+
downloadBuilderToolset({
|
|
33
|
+
releaseName: "squirrel.windows@1.0.0",
|
|
34
|
+
filenameWithExt: "squirrel.windows-2.0.1-patched.7z",
|
|
35
|
+
checksums: { "squirrel.windows-2.0.1-patched.7z": "76851f0c192eaf9bc6f8f3eecdfe325857ebe70d7833ec62ed846a1acd50c846" },
|
|
36
|
+
}),
|
|
35
37
|
fs.promises.cp(path.join(path.dirname(windowInstallerPackage), "vendor"), tmpVendorDirectory, { recursive: true }),
|
|
36
38
|
]);
|
|
37
39
|
await fs.promises.cp(path.join(squirrelBin, "electron-winstaller", "vendor"), tmpVendorDirectory, { recursive: true });
|
|
@@ -40,17 +42,17 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
40
42
|
const squirrelExe = files.find(f => f === "Squirrel.exe");
|
|
41
43
|
if (squirrelExe) {
|
|
42
44
|
const filePath = path.join(tmpVendorDirectory, squirrelExe);
|
|
43
|
-
|
|
45
|
+
log.debug({ file: filePath }, "signing vendor executable");
|
|
44
46
|
await this.packager.signIf(filePath);
|
|
45
47
|
}
|
|
46
48
|
else {
|
|
47
|
-
|
|
49
|
+
log.warn("Squirrel.exe not found in vendor directory, skipping signing");
|
|
48
50
|
}
|
|
49
51
|
return tmpVendorDirectory;
|
|
50
52
|
}
|
|
51
53
|
assertShellSafePath(filePath, description) {
|
|
52
54
|
if (/[\r\n`$;&|<>]/.test(filePath)) {
|
|
53
|
-
throw new
|
|
55
|
+
throw new InvalidConfigurationError(`${description} contains unsafe shell characters: ${filePath}`);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
async ensurePathInside(baseDir, targetPath, description) {
|
|
@@ -73,11 +75,11 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
73
75
|
const resolvedTargetParent = path.dirname(resolvedTargetPath);
|
|
74
76
|
const canonicalTargetParent = await fs.promises.realpath(resolvedTargetParent);
|
|
75
77
|
const relativeFromResolvedParent = path.relative(resolvedTargetParent, resolvedTargetPath);
|
|
76
|
-
if (
|
|
78
|
+
if (isEmptyOrSpaces(relativeFromResolvedParent) ||
|
|
77
79
|
path.isAbsolute(relativeFromResolvedParent) ||
|
|
78
80
|
relativeFromResolvedParent.split(path.sep).includes("..") ||
|
|
79
81
|
/[\0\r\n]/.test(relativeFromResolvedParent)) {
|
|
80
|
-
throw new
|
|
82
|
+
throw new InvalidConfigurationError(`${description} contains invalid path segments`);
|
|
81
83
|
}
|
|
82
84
|
canonicalTargetPath = path.resolve(canonicalTargetParent, relativeFromResolvedParent);
|
|
83
85
|
}
|
|
@@ -87,15 +89,14 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
87
89
|
}
|
|
88
90
|
const relativePath = path.relative(canonicalBaseDir, canonicalTargetPath);
|
|
89
91
|
if (relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
|
|
90
|
-
throw new
|
|
92
|
+
throw new InvalidConfigurationError(`${description} must be inside ${canonicalBaseDir}`);
|
|
91
93
|
}
|
|
92
94
|
this.assertShellSafePath(canonicalTargetPath, description);
|
|
93
95
|
return canonicalTargetPath;
|
|
94
96
|
}
|
|
95
97
|
async generateStubExecutableExe(appOutDir, vendorDir) {
|
|
96
|
-
var _a;
|
|
97
98
|
if (!path.isAbsolute(appOutDir) || !path.isAbsolute(vendorDir)) {
|
|
98
|
-
throw new
|
|
99
|
+
throw new InvalidConfigurationError("appOutDir and vendorDir must be absolute paths");
|
|
99
100
|
}
|
|
100
101
|
const files = await fs.promises.readdir(appOutDir, { withFileTypes: true });
|
|
101
102
|
const appExe = files.find(f => f.name === `${this.exeName}.exe`);
|
|
@@ -107,35 +108,35 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
107
108
|
const stubExecutableSource = await this.ensurePathInside(vendorDir, path.join(vendorDir, "StubExecutable.exe"), "Stub executable source");
|
|
108
109
|
const writeZipToSetupExe = await this.ensurePathInside(vendorDir, path.join(vendorDir, "WriteZipToSetup.exe"), "WriteZipToSetup executable");
|
|
109
110
|
await fs.promises.copyFile(stubExecutableSource, stubExePath);
|
|
110
|
-
const wineVm = new
|
|
111
|
+
const wineVm = new WineVmManager(this.packager.config.toolsets?.wine, this.packager.buildResourcesDir);
|
|
111
112
|
await wineVm.exec(writeZipToSetupExe, ["--copy-stub-resources", filePath, stubExePath]);
|
|
112
113
|
await this.packager.signIf(stubExePath);
|
|
113
|
-
|
|
114
|
+
log.debug({ file: filePath }, "signing app executable");
|
|
114
115
|
await this.packager.signIf(filePath);
|
|
115
116
|
}
|
|
116
117
|
async build(appOutDir, arch) {
|
|
117
118
|
const packager = this.packager;
|
|
118
119
|
const version = packager.appInfo.version;
|
|
119
|
-
const sanitizedName =
|
|
120
|
+
const sanitizedName = sanitizeFileName(this.appName);
|
|
120
121
|
const setupFile = packager.expandArtifactNamePattern(this.options, "exe", arch, "${productName} Setup ${version}.${ext}");
|
|
121
|
-
const installerOutDir = path.join(this.outDir, `squirrel-windows${
|
|
122
|
+
const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`);
|
|
122
123
|
const artifactPath = path.join(installerOutDir, setupFile);
|
|
123
124
|
const msiArtifactPath = path.join(installerOutDir, packager.expandArtifactNamePattern(this.options, "msi", arch, "${productName} Setup ${version}.${ext}"));
|
|
124
125
|
this.buildQueueManager.add(async () => {
|
|
125
|
-
await packager.
|
|
126
|
+
await packager.emitArtifactBuildStarted({
|
|
126
127
|
targetPresentableName: "Squirrel.Windows",
|
|
127
128
|
file: artifactPath,
|
|
128
129
|
arch,
|
|
129
130
|
});
|
|
130
131
|
const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile);
|
|
131
132
|
await this.generateStubExecutableExe(appOutDir, distOptions.vendorDirectory);
|
|
132
|
-
await
|
|
133
|
+
await withToolsetLock(() => createWindowsInstaller(distOptions));
|
|
133
134
|
await packager.signAndEditResources(artifactPath, arch, installerOutDir);
|
|
134
135
|
if (this.options.msi) {
|
|
135
136
|
await packager.signIf(msiArtifactPath);
|
|
136
137
|
}
|
|
137
|
-
const safeArtifactName = (ext) => `${sanitizedName}-Setup-${version}${
|
|
138
|
-
await packager.
|
|
138
|
+
const safeArtifactName = (ext) => `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.${ext}`;
|
|
139
|
+
await packager.emitArtifactBuildCompleted({
|
|
139
140
|
file: artifactPath,
|
|
140
141
|
target: this,
|
|
141
142
|
arch,
|
|
@@ -143,7 +144,7 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
143
144
|
packager: this.packager,
|
|
144
145
|
});
|
|
145
146
|
if (this.options.msi) {
|
|
146
|
-
await packager.
|
|
147
|
+
await packager.emitArtifactCreated({
|
|
147
148
|
file: msiArtifactPath,
|
|
148
149
|
target: this,
|
|
149
150
|
arch,
|
|
@@ -151,22 +152,22 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
151
152
|
packager: this.packager,
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
|
-
const packagePrefix = `${this.appName}-${
|
|
155
|
-
await packager.
|
|
155
|
+
const packagePrefix = `${this.appName}-${convertVersion(version)}-`;
|
|
156
|
+
await packager.emitArtifactCreated({
|
|
156
157
|
file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),
|
|
157
158
|
target: this,
|
|
158
159
|
arch,
|
|
159
160
|
packager,
|
|
160
161
|
});
|
|
161
162
|
if (distOptions.remoteReleases != null) {
|
|
162
|
-
await packager.
|
|
163
|
+
await packager.emitArtifactCreated({
|
|
163
164
|
file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),
|
|
164
165
|
target: this,
|
|
165
166
|
arch,
|
|
166
167
|
packager,
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
|
-
await packager.
|
|
170
|
+
await packager.emitArtifactCreated({
|
|
170
171
|
file: path.join(installerOutDir, "RELEASES"),
|
|
171
172
|
target: this,
|
|
172
173
|
arch,
|
|
@@ -180,7 +181,7 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
180
181
|
}
|
|
181
182
|
get exeName() {
|
|
182
183
|
const name = this.packager.appInfo.productFilename || this.options.name || this.packager.appInfo.productName;
|
|
183
|
-
return
|
|
184
|
+
return sanitizeFileName(name);
|
|
184
185
|
}
|
|
185
186
|
select7zipArch(vendorDirectory) {
|
|
186
187
|
// https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js
|
|
@@ -191,10 +192,10 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
191
192
|
fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, "7z.dll"));
|
|
192
193
|
}
|
|
193
194
|
async createNuspecTemplateWithProjectUrl() {
|
|
194
|
-
const templatePath = path.resolve(
|
|
195
|
+
const templatePath = path.resolve(import.meta.dirname, "..", "template.nuspectemplate");
|
|
195
196
|
const projectUrl = await this.packager.appInfo.computePackageUrl();
|
|
196
197
|
if (projectUrl != null) {
|
|
197
|
-
const nuspecTemplate = await this.packager.
|
|
198
|
+
const nuspecTemplate = await this.packager.tempDirManager.getTempFile({ prefix: "template", suffix: ".nuspectemplate" });
|
|
198
199
|
let templateContent = await fs.promises.readFile(templatePath, "utf8");
|
|
199
200
|
const searchString = "<copyright><%- copyright %></copyright>";
|
|
200
201
|
templateContent = templateContent.replace(searchString, `${searchString}\n <projectUrl>${projectUrl}</projectUrl>`);
|
|
@@ -207,12 +208,12 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
207
208
|
const packager = this.packager;
|
|
208
209
|
let iconUrl = this.options.iconUrl;
|
|
209
210
|
if (iconUrl == null) {
|
|
210
|
-
const info = await packager.
|
|
211
|
+
const info = await packager.repositoryInfo;
|
|
211
212
|
if (info != null) {
|
|
212
|
-
iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.
|
|
213
|
+
iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.relativeBuildResourcesDirname}/icon.ico?raw=true`;
|
|
213
214
|
}
|
|
214
215
|
if (iconUrl == null) {
|
|
215
|
-
throw new
|
|
216
|
+
throw new InvalidConfigurationError("squirrelWindows.iconUrl is not specified, please see https://www.electron.build/squirrel-windows#SquirrelWindowsOptions-iconUrl");
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
checkConflictingOptions(this.options);
|
|
@@ -239,23 +240,23 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
239
240
|
if (this.options.msi) {
|
|
240
241
|
options.setupMsi = setupFile.replace(".exe", ".msi");
|
|
241
242
|
}
|
|
242
|
-
if (
|
|
243
|
+
if (isEmptyOrSpaces(options.description)) {
|
|
243
244
|
options.description = this.options.name || appInfo.productName;
|
|
244
245
|
}
|
|
245
246
|
if (options.remoteToken == null) {
|
|
246
247
|
options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
|
|
247
248
|
}
|
|
248
249
|
if (this.options.remoteReleases === true) {
|
|
249
|
-
const info = await packager.
|
|
250
|
+
const info = await packager.repositoryInfo;
|
|
250
251
|
if (info == null) {
|
|
251
|
-
|
|
252
|
+
log.warn("remoteReleases set to true, but cannot get repository info");
|
|
252
253
|
}
|
|
253
254
|
else {
|
|
254
255
|
options.remoteReleases = `https://github.com/${info.user}/${info.project}`;
|
|
255
|
-
|
|
256
|
+
log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`);
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
|
-
else if (typeof this.options.remoteReleases === "string" && !
|
|
259
|
+
else if (typeof this.options.remoteReleases === "string" && !isEmptyOrSpaces(this.options.remoteReleases)) {
|
|
259
260
|
options.remoteReleases = this.options.remoteReleases;
|
|
260
261
|
}
|
|
261
262
|
if (this.options.loadingGif) {
|
|
@@ -270,20 +271,15 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
270
271
|
return options;
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
|
-
exports.default = SquirrelWindowsTarget;
|
|
274
274
|
function checkConflictingOptions(options) {
|
|
275
275
|
for (const name of ["outputDirectory", "appDirectory", "exe", "fixUpPaths", "usePackageJson", "extraFileSpecs", "extraMetadataSpecs", "skipUpdateIcon", "setupExe"]) {
|
|
276
276
|
if (name in options) {
|
|
277
|
-
throw new
|
|
277
|
+
throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
if ("noMsi" in options) {
|
|
281
|
-
builder_util_1.log.warn(`noMsi is deprecated, please specify as "msi": true if you want to create an MSI installer`);
|
|
282
|
-
options.msi = !options.noMsi;
|
|
283
|
-
}
|
|
284
280
|
const msi = options.msi;
|
|
285
281
|
if (msi != null && typeof msi !== "boolean") {
|
|
286
|
-
throw new
|
|
282
|
+
throw new InvalidConfigurationError(`msi expected to be boolean value, but string '"${msi}"' was specified`);
|
|
287
283
|
}
|
|
288
284
|
}
|
|
289
285
|
//# sourceMappingURL=SquirrelWindowsTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SquirrelWindowsTarget.js","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEtF,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAA;AAC9D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAQ,aAAa,EAA0B,MAAM,EAAe,MAAM,iBAAiB,CAAA;AAClG,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAA8B,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,MAAM;IAKvD,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAHA,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QAJzB,qBAAgB,GAAG,KAAK,CAAA;QAOtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,mBAAmB,CAAyB,iBAAiB,CAAC,CAAA;IACxF,CAAC;IAEO,KAAK,CAAC,4BAA4B;QACxC,MAAM,6BAA6B,GA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CAAC,kDAAkD,GAAG,kBAAkB,CAAC,CAAA;IAC9G,CAAC;AACH,CAAC","sourcesContent":["import { createRequire } from \"node:module\"\nimport { InvalidConfigurationError, log, isEmptyOrSpaces, exists } from \"builder-util\"\n\nconst _requireResolve = createRequire(import.meta.url).resolve\nimport { downloadBuilderToolset, withToolsetLock } from \"app-builder-lib/internal\"\nimport { sanitizeFileName } from \"builder-util/internal\"\nimport { Arch, getArchSuffix, SquirrelWindowsOptions, Target, WinPackager } from \"app-builder-lib\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport * as os from \"os\"\nimport { Options as SquirrelOptions, createWindowsInstaller, convertVersion } from \"electron-winstaller\"\nimport { WineVmManager } from \"app-builder-lib/internal\"\n\nexport default class SquirrelWindowsTarget extends Target {\n readonly options: SquirrelWindowsOptions\n\n isAsyncSupported = false\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"squirrel\")\n this.options = packager.getOptionsForTarget<SquirrelWindowsOptions>(\"squirrelWindows\")\n }\n\n private async prepareSignedVendorDirectory(): Promise<string> {\n const customSquirrelVendorDirectory = this.options.customSquirrelVendorDir\n const tmpVendorDirectory = await this.packager.tempDirManager.createTempDir({ prefix: \"squirrel-windows-vendor\" })\n\n if (customSquirrelVendorDirectory && (await exists(customSquirrelVendorDirectory))) {\n await fs.promises.cp(customSquirrelVendorDirectory, tmpVendorDirectory, { recursive: true })\n } else {\n if (!isEmptyOrSpaces(customSquirrelVendorDirectory)) {\n log.warn({ customSquirrelVendorDirectory }, \"unable to access custom Squirrel.Windows vendor directory, falling back to default vendor\")\n }\n\n const windowInstallerPackage = _requireResolve(\"electron-winstaller/package.json\")\n const [squirrelBin] = await Promise.all([\n downloadBuilderToolset({\n releaseName: \"squirrel.windows@1.0.0\",\n filenameWithExt: \"squirrel.windows-2.0.1-patched.7z\",\n checksums: { \"squirrel.windows-2.0.1-patched.7z\": \"76851f0c192eaf9bc6f8f3eecdfe325857ebe70d7833ec62ed846a1acd50c846\" },\n }),\n fs.promises.cp(path.join(path.dirname(windowInstallerPackage), \"vendor\"), tmpVendorDirectory, { recursive: true }),\n ])\n\n await fs.promises.cp(path.join(squirrelBin, \"electron-winstaller\", \"vendor\"), tmpVendorDirectory, { recursive: true })\n }\n\n const files = await fs.promises.readdir(tmpVendorDirectory)\n const squirrelExe = files.find(f => f === \"Squirrel.exe\")\n if (squirrelExe) {\n const filePath = path.join(tmpVendorDirectory, squirrelExe)\n log.debug({ file: filePath }, \"signing vendor executable\")\n await this.packager.signIf(filePath)\n } else {\n log.warn(\"Squirrel.exe not found in vendor directory, skipping signing\")\n }\n return tmpVendorDirectory\n }\n\n private assertShellSafePath(filePath: string, description: string): void {\n if (/[\\r\\n`$;&|<>]/.test(filePath)) {\n throw new InvalidConfigurationError(`${description} contains unsafe shell characters: ${filePath}`)\n }\n }\n\n private async ensurePathInside(baseDir: string, targetPath: string, description: string): Promise<string> {\n const resolvedBaseDir = path.resolve(baseDir)\n const resolvedTargetPath = path.resolve(targetPath)\n\n let canonicalBaseDir = resolvedBaseDir\n let canonicalTargetPath = resolvedTargetPath\n\n try {\n canonicalBaseDir = await fs.promises.realpath(resolvedBaseDir)\n } catch {\n canonicalBaseDir = resolvedBaseDir\n }\n\n try {\n canonicalTargetPath = await fs.promises.realpath(resolvedTargetPath)\n } catch {\n // Target may not exist yet; resolve the parent to handle symlinks/junctions consistently\n try {\n const resolvedTargetParent = path.dirname(resolvedTargetPath)\n const canonicalTargetParent = await fs.promises.realpath(resolvedTargetParent)\n const relativeFromResolvedParent = path.relative(resolvedTargetParent, resolvedTargetPath)\n if (\n isEmptyOrSpaces(relativeFromResolvedParent) ||\n path.isAbsolute(relativeFromResolvedParent) ||\n relativeFromResolvedParent.split(path.sep).includes(\"..\") ||\n /[\\0\\r\\n]/.test(relativeFromResolvedParent)\n ) {\n throw new InvalidConfigurationError(`${description} contains invalid path segments`)\n }\n canonicalTargetPath = path.resolve(canonicalTargetParent, relativeFromResolvedParent)\n } catch {\n canonicalTargetPath = resolvedTargetPath\n }\n }\n\n const relativePath = path.relative(canonicalBaseDir, canonicalTargetPath)\n if (relativePath.startsWith(\"..\") || path.isAbsolute(relativePath)) {\n throw new InvalidConfigurationError(`${description} must be inside ${canonicalBaseDir}`)\n }\n this.assertShellSafePath(canonicalTargetPath, description)\n return canonicalTargetPath\n }\n\n private async generateStubExecutableExe(appOutDir: string, vendorDir: string) {\n if (!path.isAbsolute(appOutDir) || !path.isAbsolute(vendorDir)) {\n throw new InvalidConfigurationError(\"appOutDir and vendorDir must be absolute paths\")\n }\n\n const files = await fs.promises.readdir(appOutDir, { withFileTypes: true })\n const appExe = files.find(f => f.name === `${this.exeName}.exe`)\n if (!appExe) {\n throw new Error(`App executable not found in app directory: ${appOutDir}`)\n }\n\n const filePath = await this.ensurePathInside(appOutDir, path.join(appOutDir, appExe.name), \"App executable path\")\n const stubExePath = await this.ensurePathInside(appOutDir, path.join(appOutDir, `${this.exeName}_ExecutionStub.exe`), \"Stub executable path\")\n const stubExecutableSource = await this.ensurePathInside(vendorDir, path.join(vendorDir, \"StubExecutable.exe\"), \"Stub executable source\")\n const writeZipToSetupExe = await this.ensurePathInside(vendorDir, path.join(vendorDir, \"WriteZipToSetup.exe\"), \"WriteZipToSetup executable\")\n\n await fs.promises.copyFile(stubExecutableSource, stubExePath)\n const wineVm = new WineVmManager(this.packager.config.toolsets?.wine, this.packager.buildResourcesDir)\n await wineVm.exec(writeZipToSetupExe, [\"--copy-stub-resources\", filePath, stubExePath])\n await this.packager.signIf(stubExePath)\n log.debug({ file: filePath }, \"signing app executable\")\n await this.packager.signIf(filePath)\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const version = packager.appInfo.version\n const sanitizedName = sanitizeFileName(this.appName)\n\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)\n const artifactPath = path.join(installerOutDir, setupFile)\n const msiArtifactPath = path.join(installerOutDir, packager.expandArtifactNamePattern(this.options, \"msi\", arch, \"${productName} Setup ${version}.${ext}\"))\n\n this.buildQueueManager.add(async () => {\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"Squirrel.Windows\",\n file: artifactPath,\n arch,\n })\n const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile)\n await this.generateStubExecutableExe(appOutDir, distOptions.vendorDirectory!)\n await withToolsetLock(() => createWindowsInstaller(distOptions))\n\n await packager.signAndEditResources(artifactPath, arch, installerOutDir)\n\n if (this.options.msi) {\n await packager.signIf(msiArtifactPath)\n }\n\n const safeArtifactName = (ext: string) => `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.${ext}`\n\n await packager.emitArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"exe\"),\n packager: this.packager,\n })\n\n if (this.options.msi) {\n await packager.emitArtifactCreated({\n file: msiArtifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"msi\"),\n packager: this.packager,\n })\n }\n\n const packagePrefix = `${this.appName}-${convertVersion(version)}-`\n await packager.emitArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),\n target: this,\n arch,\n packager,\n })\n if (distOptions.remoteReleases != null) {\n await packager.emitArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),\n target: this,\n arch,\n packager,\n })\n }\n\n await packager.emitArtifactCreated({\n file: path.join(installerOutDir, \"RELEASES\"),\n target: this,\n arch,\n packager,\n })\n })\n return Promise.resolve()\n }\n\n private get appName() {\n return this.options.name || this.packager.appInfo.name\n }\n\n private get exeName() {\n const name = this.packager.appInfo.productFilename || this.options.name || this.packager.appInfo.productName\n return sanitizeFileName(name)\n }\n\n private select7zipArch(vendorDirectory: string) {\n // https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js\n // Even if we're cross-compiling for a different arch like arm64,\n // we still need to use the 7-Zip executable for the host arch\n const resolvedArch = os.arch\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, \"7z.exe\"))\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, \"7z.dll\"))\n }\n\n private async createNuspecTemplateWithProjectUrl() {\n const templatePath = path.resolve(import.meta.dirname, \"..\", \"template.nuspectemplate\")\n const projectUrl = await this.packager.appInfo.computePackageUrl()\n if (projectUrl != null) {\n const nuspecTemplate = await this.packager.tempDirManager.getTempFile({ prefix: \"template\", suffix: \".nuspectemplate\" })\n let templateContent = await fs.promises.readFile(templatePath, \"utf8\")\n const searchString = \"<copyright><%- copyright %></copyright>\"\n templateContent = templateContent.replace(searchString, `${searchString}\\n <projectUrl>${projectUrl}</projectUrl>`)\n await fs.promises.writeFile(nuspecTemplate, templateContent)\n return nuspecTemplate\n }\n return templatePath\n }\n\n async computeEffectiveDistOptions(appDirectory: string, outputDirectory: string, setupFile: string): Promise<SquirrelOptions> {\n const packager = this.packager\n let iconUrl = this.options.iconUrl\n if (iconUrl == null) {\n const info = await packager.repositoryInfo\n if (info != null) {\n iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.relativeBuildResourcesDirname}/icon.ico?raw=true`\n }\n\n if (iconUrl == null) {\n throw new InvalidConfigurationError(\"squirrelWindows.iconUrl is not specified, please see https://www.electron.build/squirrel-windows#SquirrelWindowsOptions-iconUrl\")\n }\n }\n\n checkConflictingOptions(this.options)\n const appInfo = packager.appInfo\n const options: SquirrelOptions = {\n appDirectory: appDirectory,\n outputDirectory: outputDirectory,\n name: this.options.useAppIdAsId ? appInfo.id : this.appName,\n title: appInfo.productName || appInfo.name,\n version: appInfo.version,\n description: appInfo.description,\n exe: `${this.exeName}.exe`,\n authors: appInfo.companyName || \"\",\n nuspecTemplate: await this.createNuspecTemplateWithProjectUrl(),\n iconUrl,\n copyright: appInfo.copyright,\n noMsi: !this.options.msi,\n usePackageJson: false,\n }\n\n options.vendorDirectory = await this.prepareSignedVendorDirectory()\n this.select7zipArch(options.vendorDirectory)\n options.fixUpPaths = true\n options.setupExe = setupFile\n if (this.options.msi) {\n options.setupMsi = setupFile.replace(\".exe\", \".msi\")\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = this.options.name || appInfo.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n }\n\n if (this.options.remoteReleases === true) {\n const info = await packager.repositoryInfo\n if (info == null) {\n log.warn(\"remoteReleases set to true, but cannot get repository info\")\n } else {\n options.remoteReleases = `https://github.com/${info.user}/${info.project}`\n log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`)\n }\n } else if (typeof this.options.remoteReleases === \"string\" && !isEmptyOrSpaces(this.options.remoteReleases)) {\n options.remoteReleases = this.options.remoteReleases\n }\n\n if (this.options.loadingGif) {\n options.loadingGif = path.resolve(packager.projectDir, this.options.loadingGif)\n } else {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"install-spinner.gif\")) {\n options.loadingGif = path.join(packager.buildResourcesDir, \"install-spinner.gif\")\n }\n }\n\n return options\n }\n}\n\nfunction checkConflictingOptions(options: any) {\n for (const name of [\"outputDirectory\", \"appDirectory\", \"exe\", \"fixUpPaths\", \"usePackageJson\", \"extraFileSpecs\", \"extraMetadataSpecs\", \"skipUpdateIcon\", \"setupExe\"]) {\n if (name in options) {\n throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`)\n }\n }\n\n const msi = options.msi\n if (msi != null && typeof msi !== \"boolean\") {\n throw new InvalidConfigurationError(`msi expected to be boolean value, but string '\"${msi}\"' was specified`)\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=indexInternal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexInternal.d.ts","sourceRoot":"","sources":["../src/indexInternal.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexInternal.js","sourceRoot":"","sources":["../src/indexInternal.ts"],"names":[],"mappings":";AAAA,6CAA6C","sourcesContent":["// No production cross-package internals yet.\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-builder-squirrel-windows",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "27.0.0-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/SquirrelWindowsTarget.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/SquirrelWindowsTarget.d.ts",
|
|
9
|
+
"import": "./dist/SquirrelWindowsTarget.js",
|
|
10
|
+
"require": "./dist/SquirrelWindowsTarget.js"
|
|
11
|
+
},
|
|
12
|
+
"./internal": {
|
|
13
|
+
"types": "./dist/indexInternal.d.ts",
|
|
14
|
+
"import": "./dist/indexInternal.js",
|
|
15
|
+
"require": "./dist/indexInternal.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
5
18
|
"author": "Vladimir Krivosheev",
|
|
6
19
|
"license": "MIT",
|
|
7
20
|
"repository": {
|
|
@@ -12,17 +25,24 @@
|
|
|
12
25
|
"bugs": "https://github.com/electron-userland/electron-builder/issues",
|
|
13
26
|
"homepage": "https://github.com/electron-userland/electron-builder",
|
|
14
27
|
"files": [
|
|
15
|
-
"
|
|
28
|
+
"dist",
|
|
16
29
|
"template.nuspectemplate"
|
|
17
30
|
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.12.0"
|
|
33
|
+
},
|
|
18
34
|
"dependencies": {
|
|
19
35
|
"electron-winstaller": "5.4.0",
|
|
20
|
-
"app-builder-lib": "
|
|
21
|
-
"builder-util": "
|
|
36
|
+
"app-builder-lib": "27.0.0-alpha.1",
|
|
37
|
+
"builder-util": "27.0.0-alpha.0"
|
|
22
38
|
},
|
|
23
39
|
"devDependencies": {
|
|
24
40
|
"@types/archiver": "5.3.1",
|
|
25
41
|
"@types/fs-extra": "9.0.13"
|
|
26
42
|
},
|
|
27
|
-
"types": "./
|
|
43
|
+
"types": "./dist/SquirrelWindowsTarget.d.ts",
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc --build tsconfig.build.json --force",
|
|
46
|
+
"watch": "tsc --build tsconfig.build.json --watch"
|
|
47
|
+
}
|
|
28
48
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SquirrelWindowsTarget.js","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":";;AAAA,+CAAsF;AACtF,iEAA+D;AAC/D,wDAA4D;AAC5D,qDAAkG;AAClG,sEAAsE;AACtE,6BAA4B;AAC5B,yBAAwB;AACxB,yBAAwB;AACxB,6DAAwG;AACxG,0DAA6D;AAE7D,MAAqB,qBAAsB,SAAQ,wBAAM;IAMvD,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAHA,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QAPzB,2DAA2D;QAClD,YAAO,GAA2B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,EAA4B,CAAA;QAE/J,qBAAgB,GAAG,KAAK,CAAA;IAOxB,CAAC;IAEO,KAAK,CAAC,4BAA4B;QACxC,MAAM,6BAA6B,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAA;QAC1E,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAA;QAEvH,IAAI,6BAA6B,IAAI,CAAC,MAAM,IAAA,qBAAM,EAAC,6BAA6B,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,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,wCAAyB,CAAC,kDAAkD,GAAG,kBAAkB,CAAC,CAAA;IAC9G,CAAC;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, log, isEmptyOrSpaces, exists } from \"builder-util\"\nimport { getBinFromUrl } from \"app-builder-lib/out/binDownload\"\nimport { sanitizeFileName } from \"builder-util/out/filename\"\nimport { Arch, getArchSuffix, SquirrelWindowsOptions, Target, WinPackager } from \"app-builder-lib\"\nimport { withToolsetLock } from \"app-builder-lib/out/util/toolsetLock\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport * as os from \"os\"\nimport { Options as SquirrelOptions, createWindowsInstaller, convertVersion } from \"electron-winstaller\"\nimport { WineVmManager } from \"app-builder-lib/out/vm/WineVm\"\n\nexport default class SquirrelWindowsTarget extends Target {\n //tslint:disable-next-line:no-object-literal-type-assertion\n readonly options: SquirrelWindowsOptions = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows } as SquirrelWindowsOptions\n\n isAsyncSupported = false\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"squirrel\")\n }\n\n private async prepareSignedVendorDirectory(): Promise<string> {\n const customSquirrelVendorDirectory = this.options.customSquirrelVendorDir\n const tmpVendorDirectory = await this.packager.info.tempDirManager.createTempDir({ prefix: \"squirrel-windows-vendor\" })\n\n if (customSquirrelVendorDirectory && (await exists(customSquirrelVendorDirectory))) {\n await fs.promises.cp(customSquirrelVendorDirectory, tmpVendorDirectory, { recursive: true })\n } else {\n if (!isEmptyOrSpaces(customSquirrelVendorDirectory)) {\n log.warn({ customSquirrelVendorDirectory }, \"unable to access custom Squirrel.Windows vendor directory, falling back to default vendor\")\n }\n\n const windowInstallerPackage = require.resolve(\"electron-winstaller/package.json\")\n const [squirrelBin] = await Promise.all([\n getBinFromUrl(\"squirrel.windows@1.0.0\", \"squirrel.windows-2.0.1-patched.7z\", \"76851f0c192eaf9bc6f8f3eecdfe325857ebe70d7833ec62ed846a1acd50c846\"),\n fs.promises.cp(path.join(path.dirname(windowInstallerPackage), \"vendor\"), tmpVendorDirectory, { recursive: true }),\n ])\n\n await fs.promises.cp(path.join(squirrelBin, \"electron-winstaller\", \"vendor\"), tmpVendorDirectory, { recursive: true })\n }\n\n const files = await fs.promises.readdir(tmpVendorDirectory)\n const squirrelExe = files.find(f => f === \"Squirrel.exe\")\n if (squirrelExe) {\n const filePath = path.join(tmpVendorDirectory, squirrelExe)\n log.debug({ file: filePath }, \"signing vendor executable\")\n await this.packager.signIf(filePath)\n } else {\n log.warn(\"Squirrel.exe not found in vendor directory, skipping signing\")\n }\n return tmpVendorDirectory\n }\n\n private assertShellSafePath(filePath: string, description: string): void {\n if (/[\\r\\n`$;&|<>]/.test(filePath)) {\n throw new InvalidConfigurationError(`${description} contains unsafe shell characters: ${filePath}`)\n }\n }\n\n private async ensurePathInside(baseDir: string, targetPath: string, description: string): Promise<string> {\n const resolvedBaseDir = path.resolve(baseDir)\n const resolvedTargetPath = path.resolve(targetPath)\n\n let canonicalBaseDir = resolvedBaseDir\n let canonicalTargetPath = resolvedTargetPath\n\n try {\n canonicalBaseDir = await fs.promises.realpath(resolvedBaseDir)\n } catch {\n canonicalBaseDir = resolvedBaseDir\n }\n\n try {\n canonicalTargetPath = await fs.promises.realpath(resolvedTargetPath)\n } catch {\n // Target may not exist yet; resolve the parent to handle symlinks/junctions consistently\n try {\n const resolvedTargetParent = path.dirname(resolvedTargetPath)\n const canonicalTargetParent = await fs.promises.realpath(resolvedTargetParent)\n const relativeFromResolvedParent = path.relative(resolvedTargetParent, resolvedTargetPath)\n if (\n isEmptyOrSpaces(relativeFromResolvedParent) ||\n path.isAbsolute(relativeFromResolvedParent) ||\n relativeFromResolvedParent.split(path.sep).includes(\"..\") ||\n /[\\0\\r\\n]/.test(relativeFromResolvedParent)\n ) {\n throw new InvalidConfigurationError(`${description} contains invalid path segments`)\n }\n canonicalTargetPath = path.resolve(canonicalTargetParent, relativeFromResolvedParent)\n } catch {\n canonicalTargetPath = resolvedTargetPath\n }\n }\n\n const relativePath = path.relative(canonicalBaseDir, canonicalTargetPath)\n if (relativePath.startsWith(\"..\") || path.isAbsolute(relativePath)) {\n throw new InvalidConfigurationError(`${description} must be inside ${canonicalBaseDir}`)\n }\n this.assertShellSafePath(canonicalTargetPath, description)\n return canonicalTargetPath\n }\n\n private async generateStubExecutableExe(appOutDir: string, vendorDir: string) {\n if (!path.isAbsolute(appOutDir) || !path.isAbsolute(vendorDir)) {\n throw new InvalidConfigurationError(\"appOutDir and vendorDir must be absolute paths\")\n }\n\n const files = await fs.promises.readdir(appOutDir, { withFileTypes: true })\n const appExe = files.find(f => f.name === `${this.exeName}.exe`)\n if (!appExe) {\n throw new Error(`App executable not found in app directory: ${appOutDir}`)\n }\n\n const filePath = await this.ensurePathInside(appOutDir, path.join(appOutDir, appExe.name), \"App executable path\")\n const stubExePath = await this.ensurePathInside(appOutDir, path.join(appOutDir, `${this.exeName}_ExecutionStub.exe`), \"Stub executable path\")\n const stubExecutableSource = await this.ensurePathInside(vendorDir, path.join(vendorDir, \"StubExecutable.exe\"), \"Stub executable source\")\n const writeZipToSetupExe = await this.ensurePathInside(vendorDir, path.join(vendorDir, \"WriteZipToSetup.exe\"), \"WriteZipToSetup executable\")\n\n await fs.promises.copyFile(stubExecutableSource, stubExePath)\n const wineVm = new WineVmManager(this.packager.config.toolsets?.wine)\n await wineVm.exec(writeZipToSetupExe, [\"--copy-stub-resources\", filePath, stubExePath])\n await this.packager.signIf(stubExePath)\n log.debug({ file: filePath }, \"signing app executable\")\n await this.packager.signIf(filePath)\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const version = packager.appInfo.version\n const sanitizedName = sanitizeFileName(this.appName)\n\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)\n const artifactPath = path.join(installerOutDir, setupFile)\n const msiArtifactPath = path.join(installerOutDir, packager.expandArtifactNamePattern(this.options, \"msi\", arch, \"${productName} Setup ${version}.${ext}\"))\n\n this.buildQueueManager.add(async () => {\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"Squirrel.Windows\",\n file: artifactPath,\n arch,\n })\n const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile)\n await this.generateStubExecutableExe(appOutDir, distOptions.vendorDirectory!)\n await withToolsetLock(() => createWindowsInstaller(distOptions))\n\n await packager.signAndEditResources(artifactPath, arch, installerOutDir)\n\n if (this.options.msi) {\n await packager.signIf(msiArtifactPath)\n }\n\n const safeArtifactName = (ext: string) => `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.${ext}`\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"exe\"),\n packager: this.packager,\n })\n\n if (this.options.msi) {\n await packager.info.emitArtifactCreated({\n file: msiArtifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"msi\"),\n packager: this.packager,\n })\n }\n\n const packagePrefix = `${this.appName}-${convertVersion(version)}-`\n await packager.info.emitArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),\n target: this,\n arch,\n packager,\n })\n if (distOptions.remoteReleases != null) {\n await packager.info.emitArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),\n target: this,\n arch,\n packager,\n })\n }\n\n await packager.info.emitArtifactCreated({\n file: path.join(installerOutDir, \"RELEASES\"),\n target: this,\n arch,\n packager,\n })\n })\n return Promise.resolve()\n }\n\n private get appName() {\n return this.options.name || this.packager.appInfo.name\n }\n\n private get exeName() {\n const name = this.packager.appInfo.productFilename || this.options.name || this.packager.appInfo.productName\n return sanitizeFileName(name)\n }\n\n private select7zipArch(vendorDirectory: string) {\n // https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js\n // Even if we're cross-compiling for a different arch like arm64,\n // we still need to use the 7-Zip executable for the host arch\n const resolvedArch = os.arch\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, \"7z.exe\"))\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, \"7z.dll\"))\n }\n\n private async createNuspecTemplateWithProjectUrl() {\n const templatePath = path.resolve(__dirname, \"..\", \"template.nuspectemplate\")\n const projectUrl = await this.packager.appInfo.computePackageUrl()\n if (projectUrl != null) {\n const nuspecTemplate = await this.packager.info.tempDirManager.getTempFile({ prefix: \"template\", suffix: \".nuspectemplate\" })\n let templateContent = await fs.promises.readFile(templatePath, \"utf8\")\n const searchString = \"<copyright><%- copyright %></copyright>\"\n templateContent = templateContent.replace(searchString, `${searchString}\\n <projectUrl>${projectUrl}</projectUrl>`)\n await fs.promises.writeFile(nuspecTemplate, templateContent)\n return nuspecTemplate\n }\n return templatePath\n }\n\n async computeEffectiveDistOptions(appDirectory: string, outputDirectory: string, setupFile: string): Promise<SquirrelOptions> {\n const packager = this.packager\n let iconUrl = this.options.iconUrl\n if (iconUrl == null) {\n const info = await packager.info.repositoryInfo\n if (info != null) {\n iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.info.relativeBuildResourcesDirname}/icon.ico?raw=true`\n }\n\n if (iconUrl == null) {\n throw new InvalidConfigurationError(\"squirrelWindows.iconUrl is not specified, please see https://www.electron.build/squirrel-windows#SquirrelWindowsOptions-iconUrl\")\n }\n }\n\n checkConflictingOptions(this.options)\n const appInfo = packager.appInfo\n const options: SquirrelOptions = {\n appDirectory: appDirectory,\n outputDirectory: outputDirectory,\n name: this.options.useAppIdAsId ? appInfo.id : this.appName,\n title: appInfo.productName || appInfo.name,\n version: appInfo.version,\n description: appInfo.description,\n exe: `${this.exeName}.exe`,\n authors: appInfo.companyName || \"\",\n nuspecTemplate: await this.createNuspecTemplateWithProjectUrl(),\n iconUrl,\n copyright: appInfo.copyright,\n noMsi: !this.options.msi,\n usePackageJson: false,\n }\n\n options.vendorDirectory = await this.prepareSignedVendorDirectory()\n this.select7zipArch(options.vendorDirectory)\n options.fixUpPaths = true\n options.setupExe = setupFile\n if (this.options.msi) {\n options.setupMsi = setupFile.replace(\".exe\", \".msi\")\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = this.options.name || appInfo.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n }\n\n if (this.options.remoteReleases === true) {\n const info = await packager.info.repositoryInfo\n if (info == null) {\n log.warn(\"remoteReleases set to true, but cannot get repository info\")\n } else {\n options.remoteReleases = `https://github.com/${info.user}/${info.project}`\n log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`)\n }\n } else if (typeof this.options.remoteReleases === \"string\" && !isEmptyOrSpaces(this.options.remoteReleases)) {\n options.remoteReleases = this.options.remoteReleases\n }\n\n if (this.options.loadingGif) {\n options.loadingGif = path.resolve(packager.projectDir, this.options.loadingGif)\n } else {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"install-spinner.gif\")) {\n options.loadingGif = path.join(packager.buildResourcesDir, \"install-spinner.gif\")\n }\n }\n\n return options\n }\n}\n\nfunction checkConflictingOptions(options: any) {\n for (const name of [\"outputDirectory\", \"appDirectory\", \"exe\", \"fixUpPaths\", \"usePackageJson\", \"extraFileSpecs\", \"extraMetadataSpecs\", \"skipUpdateIcon\", \"setupExe\"]) {\n if (name in options) {\n throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`)\n }\n }\n\n if (\"noMsi\" in options) {\n log.warn(`noMsi is deprecated, please specify as \"msi\": true if you want to create an MSI installer`)\n options.msi = !options.noMsi\n }\n\n const msi = options.msi\n if (msi != null && typeof msi !== \"boolean\") {\n throw new InvalidConfigurationError(`msi expected to be boolean value, but string '\"${msi}\"' was specified`)\n }\n}\n"]}
|