app-builder-lib 26.0.0-alpha.2 → 26.0.0-alpha.3

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.
Files changed (45) hide show
  1. package/out/appInfo.js +1 -1
  2. package/out/appInfo.js.map +1 -1
  3. package/out/asar/asarUtil.js +1 -1
  4. package/out/asar/asarUtil.js.map +1 -1
  5. package/out/codeSign/windowsSignAzureManager.js +1 -1
  6. package/out/codeSign/windowsSignAzureManager.js.map +1 -1
  7. package/out/index.d.ts +1 -1
  8. package/out/index.js.map +1 -1
  9. package/out/linuxPackager.js +1 -1
  10. package/out/linuxPackager.js.map +1 -1
  11. package/out/options/CommonWindowsInstallerConfiguration.js +1 -1
  12. package/out/options/CommonWindowsInstallerConfiguration.js.map +1 -1
  13. package/out/options/PlatformSpecificBuildOptions.d.ts +3 -0
  14. package/out/options/PlatformSpecificBuildOptions.js.map +1 -1
  15. package/out/publish/PublishManager.d.ts +1 -1
  16. package/out/publish/PublishManager.js +10 -16
  17. package/out/publish/PublishManager.js.map +1 -1
  18. package/out/version.d.ts +1 -1
  19. package/out/version.js +1 -1
  20. package/out/version.js.map +1 -1
  21. package/out/winPackager.js +1 -1
  22. package/out/winPackager.js.map +1 -1
  23. package/package.json +7 -9
  24. package/scheme.json +10 -5
  25. package/out/publish/BitbucketPublisher.d.ts +0 -16
  26. package/out/publish/BitbucketPublisher.js +0 -60
  27. package/out/publish/BitbucketPublisher.js.map +0 -1
  28. package/out/publish/KeygenPublisher.d.ts +0 -101
  29. package/out/publish/KeygenPublisher.js +0 -165
  30. package/out/publish/KeygenPublisher.js.map +0 -1
  31. package/out/publish/SnapStorePublisher.d.ts +0 -9
  32. package/out/publish/SnapStorePublisher.js +0 -35
  33. package/out/publish/SnapStorePublisher.js.map +0 -1
  34. package/out/publish/s3/BaseS3Publisher.d.ts +0 -10
  35. package/out/publish/s3/BaseS3Publisher.js +0 -64
  36. package/out/publish/s3/BaseS3Publisher.js.map +0 -1
  37. package/out/publish/s3/s3Publisher.d.ts +0 -12
  38. package/out/publish/s3/s3Publisher.js +0 -66
  39. package/out/publish/s3/s3Publisher.js.map +0 -1
  40. package/out/publish/s3/spacesPublisher.d.ts +0 -11
  41. package/out/publish/s3/spacesPublisher.js +0 -44
  42. package/out/publish/s3/spacesPublisher.js.map +0 -1
  43. package/out/util/filename.d.ts +0 -2
  44. package/out/util/filename.js +0 -39
  45. package/out/util/filename.js.map +0 -1
@@ -1,165 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeygenPublisher = void 0;
4
- const builder_util_1 = require("builder-util");
5
- const builder_util_2 = require("builder-util");
6
- const electron_publish_1 = require("electron-publish");
7
- const builder_util_runtime_1 = require("builder-util-runtime");
8
- const filename_1 = require("../util/filename");
9
- class KeygenPublisher extends electron_publish_1.HttpPublisher {
10
- constructor(context, info, version) {
11
- super(context);
12
- this.providerName = "keygen";
13
- this.hostname = "api.keygen.sh";
14
- const token = process.env.KEYGEN_TOKEN;
15
- if ((0, builder_util_1.isEmptyOrSpaces)(token)) {
16
- throw new builder_util_1.InvalidConfigurationError(`Keygen token is not set using env "KEYGEN_TOKEN" (see https://www.electron.build/publish#KeygenOptions)`);
17
- }
18
- this.info = info;
19
- this.auth = `Bearer ${token.trim()}`;
20
- this.version = version;
21
- this.basePath = `/v1/accounts/${this.info.account}`;
22
- }
23
- doUpload(fileName, _arch, dataLength, requestProcessor, _file) {
24
- return builder_util_runtime_1.HttpExecutor.retryOnServerError(async () => {
25
- const { data, errors } = await this.getOrCreateRelease();
26
- if (errors) {
27
- throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`);
28
- }
29
- await this.uploadArtifact(data.id, fileName, dataLength, requestProcessor);
30
- return data.id;
31
- });
32
- }
33
- async uploadArtifact(releaseId, fileName, dataLength, requestProcessor) {
34
- const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength);
35
- if (errors) {
36
- throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`);
37
- }
38
- // Follow the redirect and upload directly to S3-equivalent storage provider
39
- const url = new URL(data.links.redirect);
40
- const upload = {
41
- hostname: url.hostname,
42
- path: url.pathname + url.search,
43
- headers: {
44
- "Content-Length": dataLength,
45
- },
46
- timeout: this.info.timeout || undefined,
47
- };
48
- await builder_util_2.httpExecutor.doApiRequest((0, builder_util_runtime_1.configureRequestOptions)(upload, null, "PUT"), this.context.cancellationToken, requestProcessor);
49
- }
50
- async createArtifact(releaseId, fileName, dataLength) {
51
- const upload = {
52
- hostname: this.hostname,
53
- path: `${this.basePath}/artifacts`,
54
- headers: {
55
- "Content-Type": "application/vnd.api+json",
56
- Accept: "application/vnd.api+json",
57
- "Keygen-Version": "1.1",
58
- Prefer: "no-redirect",
59
- },
60
- timeout: this.info.timeout || undefined,
61
- };
62
- const data = {
63
- type: "artifacts",
64
- attributes: {
65
- filename: fileName,
66
- filetype: (0, filename_1.getCompleteExtname)(fileName),
67
- filesize: dataLength,
68
- platform: this.info.platform,
69
- },
70
- relationships: {
71
- release: {
72
- data: {
73
- type: "releases",
74
- id: releaseId,
75
- },
76
- },
77
- },
78
- };
79
- builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create artifact");
80
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(upload, this.auth, "POST"), this.context.cancellationToken, { data }));
81
- }
82
- async getOrCreateRelease() {
83
- try {
84
- // First, we'll attempt to fetch the release.
85
- return await this.getRelease();
86
- }
87
- catch (e) {
88
- if (e.statusCode !== 404) {
89
- throw e;
90
- }
91
- try {
92
- // Next, if the release doesn't exist, we'll attempt to create it.
93
- return await this.createRelease();
94
- }
95
- catch (e) {
96
- if (e.statusCode !== 409 && e.statusCode !== 422) {
97
- throw e;
98
- }
99
- // Lastly, when a conflict occurs (in the case of parallel uploads),
100
- // we'll try to fetch it one last time.
101
- return this.getRelease();
102
- }
103
- }
104
- }
105
- async getRelease() {
106
- const req = {
107
- hostname: this.hostname,
108
- path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`,
109
- headers: {
110
- Accept: "application/vnd.api+json",
111
- "Keygen-Version": "1.1",
112
- },
113
- timeout: this.info.timeout || undefined,
114
- };
115
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "GET"), this.context.cancellationToken, null));
116
- }
117
- async createRelease() {
118
- const req = {
119
- hostname: this.hostname,
120
- path: `${this.basePath}/releases`,
121
- headers: {
122
- "Content-Type": "application/vnd.api+json",
123
- Accept: "application/vnd.api+json",
124
- "Keygen-Version": "1.1",
125
- },
126
- timeout: this.info.timeout || undefined,
127
- };
128
- const data = {
129
- type: "releases",
130
- attributes: {
131
- version: this.version,
132
- channel: this.info.channel || "stable",
133
- status: "PUBLISHED",
134
- },
135
- relationships: {
136
- product: {
137
- data: {
138
- type: "products",
139
- id: this.info.product,
140
- },
141
- },
142
- },
143
- };
144
- builder_util_1.log.debug({ data: JSON.stringify(data) }, "Keygen create release");
145
- return (0, builder_util_runtime_1.parseJson)(builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "POST"), this.context.cancellationToken, { data }));
146
- }
147
- async deleteRelease(releaseId) {
148
- const req = {
149
- hostname: this.hostname,
150
- path: `${this.basePath}/releases/${releaseId}`,
151
- headers: {
152
- Accept: "application/vnd.api+json",
153
- "Keygen-Version": "1.1",
154
- },
155
- timeout: this.info.timeout || undefined,
156
- };
157
- await builder_util_2.httpExecutor.request((0, builder_util_runtime_1.configureRequestOptions)(req, this.auth, "DELETE"), this.context.cancellationToken);
158
- }
159
- toString() {
160
- const { account, product, platform } = this.info;
161
- return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`;
162
- }
163
- }
164
- exports.KeygenPublisher = KeygenPublisher;
165
- //# sourceMappingURL=KeygenPublisher.js.map
@@ -1 +0,0 @@
1
- {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ecutor } from \"builder-util\"\nimport { ClientRequest, RequestOptions } from \"http\"\nimport { HttpPublisher, PublishContext } from \"electron-publish\"\nimport { KeygenOptions } from \"builder-util-runtime/out/publishOptions\"\nimport { configureRequestOptions, HttpExecutor, parseJson } from \"builder-util-runtime\"\nimport { getCompleteExtname } from \"../util/filename\"\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>\n}\n\nexport interface KeygenError {\n title: string\n detail: string\n code: string\n}\n\nexport interface KeygenRelease {\n id: string\n type: \"releases\"\n attributes: {\n name: string | null\n description: string | null\n channel: \"stable\" | \"rc\" | \"beta\" | \"alpha\" | \"dev\"\n status: \"DRAFT\" | \"PUBLISHED\" | \"YANKED\"\n tag: string\n version: string\n semver: {\n major: number\n minor: number\n patch: number\n prerelease: string | null\n build: string | null\n }\n metadata: { [s: string]: any }\n created: string\n updated: string\n yanked: string | null\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n product: {\n data: { type: \"products\"; id: string }\n }\n }\n}\n\nexport interface KeygenArtifact {\n id: string\n type: \"artifacts\"\n attributes: {\n filename: string\n filetype: string | null\n filesize: number | null\n platform: string | null\n arch: string | null\n signature: string | null\n checksum: string | null\n status: \"WAITING\" | \"UPLOADED\" | \"FAILED\" | \"YANKED\"\n metadata: { [s: string]: any }\n created: string\n updated: string\n }\n relationships: {\n account: {\n data: { type: \"accounts\"; id: string }\n }\n release: {\n data: { type: \"releases\"; id: string }\n }\n }\n links: {\n redirect: string\n }\n}\n\nexport class KeygenPublisher extends HttpPublisher {\n readonly providerName = \"keygen\"\n readonly hostname = \"api.keygen.sh\"\n\n private readonly info: KeygenOptions\n private readonly auth: string\n private readonly version: string\n private readonly basePath: string\n\n constructor(context: PublishContext, info: KeygenOptions, version: string) {\n super(context)\n\n const token = process.env.KEYGEN_TOKEN\n if (isEmptyOrSpaces(token)) {\n throw new InvalidConfigurationError(`Keygen token is not set using env \"KEYGEN_TOKEN\" (see https://www.electron.build/publish#KeygenOptions)`)\n }\n\n this.info = info\n this.auth = `Bearer ${token.trim()}`\n this.version = version\n this.basePath = `/v1/accounts/${this.info.account}`\n }\n\n protected doUpload(\n fileName: string,\n _arch: Arch,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,\n _file: string\n ): Promise<string> {\n return HttpExecutor.retryOnServerError(async () => {\n const { data, errors } = await this.getOrCreateRelease()\n if (errors) {\n throw new Error(`Keygen - Creating release returned errors: ${JSON.stringify(errors)}`)\n }\n\n await this.uploadArtifact(data!.id, fileName, dataLength, requestProcessor)\n\n return data!.id\n })\n }\n\n private async uploadArtifact(\n releaseId: any,\n fileName: string,\n dataLength: number,\n requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void\n ): Promise<void> {\n const { data, errors } = await this.createArtifact(releaseId, fileName, dataLength)\n if (errors) {\n throw new Error(`Keygen - Creating artifact returned errors: ${JSON.stringify(errors)}`)\n }\n\n // Follow the redirect and upload directly to S3-equivalent storage provider\n const url = new URL(data!.links.redirect)\n const upload: RequestOptions = {\n hostname: url.hostname,\n path: url.pathname + url.search,\n headers: {\n \"Content-Length\": dataLength,\n },\n timeout: this.info.timeout || undefined,\n }\n\n await httpExecutor.doApiRequest(configureRequestOptions(upload, null, \"PUT\"), this.context.cancellationToken, requestProcessor)\n }\n\n private async createArtifact(releaseId: any, fileName: string, dataLength: number): Promise<{ data?: KeygenArtifact; errors?: KeygenError[] }> {\n const upload: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/artifacts`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n Prefer: \"no-redirect\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial<KeygenArtifact> = {\n type: \"artifacts\",\n attributes: {\n filename: fileName,\n filetype: getCompleteExtname(fileName),\n filesize: dataLength,\n platform: this.info.platform,\n },\n relationships: {\n release: {\n data: {\n type: \"releases\",\n id: releaseId,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create artifact\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(upload, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n private async getOrCreateRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n try {\n // First, we'll attempt to fetch the release.\n return await this.getRelease()\n } catch (e: any) {\n if (e.statusCode !== 404) {\n throw e\n }\n\n try {\n // Next, if the release doesn't exist, we'll attempt to create it.\n return await this.createRelease()\n } catch (e: any) {\n if (e.statusCode !== 409 && e.statusCode !== 422) {\n throw e\n }\n\n // Lastly, when a conflict occurs (in the case of parallel uploads),\n // we'll try to fetch it one last time.\n return this.getRelease()\n }\n }\n }\n\n private async getRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${this.version}?product=${this.info.product}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"GET\"), this.context.cancellationToken, null))\n }\n\n private async createRelease(): Promise<{ data?: KeygenRelease; errors?: KeygenError[] }> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases`,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\",\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n\n const data: RecursivePartial<KeygenRelease> = {\n type: \"releases\",\n attributes: {\n version: this.version,\n channel: this.info.channel || \"stable\",\n status: \"PUBLISHED\",\n },\n relationships: {\n product: {\n data: {\n type: \"products\",\n id: this.info.product,\n },\n },\n },\n }\n\n log.debug({ data: JSON.stringify(data) }, \"Keygen create release\")\n\n return parseJson(httpExecutor.request(configureRequestOptions(req, this.auth, \"POST\"), this.context.cancellationToken, { data }))\n }\n\n async deleteRelease(releaseId: string): Promise<void> {\n const req: RequestOptions = {\n hostname: this.hostname,\n path: `${this.basePath}/releases/${releaseId}`,\n headers: {\n Accept: \"application/vnd.api+json\",\n \"Keygen-Version\": \"1.1\",\n },\n timeout: this.info.timeout || undefined,\n }\n await httpExecutor.request(configureRequestOptions(req, this.auth, \"DELETE\"), this.context.cancellationToken)\n }\n\n toString() {\n const { account, product, platform } = this.info\n return `Keygen (account: ${account}, product: ${product}, platform: ${platform}, version: ${this.version})`\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { Publisher, UploadTask, PublishContext } from "electron-publish";
2
- import { SnapStoreOptions } from "builder-util-runtime/out/publishOptions";
3
- export declare class SnapStorePublisher extends Publisher {
4
- private options;
5
- readonly providerName = "snapStore";
6
- constructor(context: PublishContext, options: SnapStoreOptions);
7
- upload(task: UploadTask): Promise<any>;
8
- toString(): string;
9
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnapStorePublisher = void 0;
4
- const electron_publish_1 = require("electron-publish");
5
- const builder_util_1 = require("builder-util");
6
- const path = require("path");
7
- class SnapStorePublisher extends electron_publish_1.Publisher {
8
- constructor(context, options) {
9
- super(context);
10
- this.options = options;
11
- this.providerName = "snapStore";
12
- }
13
- upload(task) {
14
- this.createProgressBar(path.basename(task.file), -1);
15
- const args = ["publish-snap", "-f", task.file];
16
- let channels = this.options.channels;
17
- if (channels == null) {
18
- channels = ["edge"];
19
- }
20
- else {
21
- if (typeof channels === "string") {
22
- channels = channels.split(",");
23
- }
24
- }
25
- for (const channel of channels) {
26
- args.push("-c", channel);
27
- }
28
- return (0, builder_util_1.executeAppBuilder)(args);
29
- }
30
- toString() {
31
- return "Snap Store";
32
- }
33
- }
34
- exports.SnapStorePublisher = SnapStorePublisher;
35
- //# sourceMappingURL=SnapStorePublisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SnapStorePublisher.js","sourceRoot":"","sources":["../../src/publish/SnapStorePublisher.ts"],"names":[],"mappings":";;;AAAA,uDAAwE;AACxE,+CAAgD;AAChD,6BAA4B;AAG5B,MAAa,kBAAmB,SAAQ,4BAAS;IAG/C,YACE,OAAuB,EACf,OAAyB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAA;QAFN,YAAO,GAAP,OAAO,CAAkB;QAJ1B,iBAAY,GAAG,WAAW,CAAA;IAOnC,CAAC;IAED,MAAM,CAAC,IAAgB;QACrB,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEpD,MAAM,IAAI,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QAE9C,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;QACpC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,QAAQ,GAAG,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAChC,CAAC;QACH,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC1B,CAAC;QAED,OAAO,IAAA,gCAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ;QACN,OAAO,YAAY,CAAA;IACrB,CAAC;CACF;AAlCD,gDAkCC","sourcesContent":["import { Publisher, UploadTask, PublishContext } from \"electron-publish\"\nimport { executeAppBuilder } from \"builder-util\"\nimport * as path from \"path\"\nimport { SnapStoreOptions } from \"builder-util-runtime/out/publishOptions\"\n\nexport class SnapStorePublisher extends Publisher {\n readonly providerName = \"snapStore\"\n\n constructor(\n context: PublishContext,\n private options: SnapStoreOptions\n ) {\n super(context)\n }\n\n upload(task: UploadTask): Promise<any> {\n this.createProgressBar(path.basename(task.file), -1)\n\n const args = [\"publish-snap\", \"-f\", task.file]\n\n let channels = this.options.channels\n if (channels == null) {\n channels = [\"edge\"]\n } else {\n if (typeof channels === \"string\") {\n channels = channels.split(\",\")\n }\n }\n\n for (const channel of channels) {\n args.push(\"-c\", channel)\n }\n\n return executeAppBuilder(args)\n }\n\n toString(): string {\n return \"Snap Store\"\n }\n}\n"]}
@@ -1,10 +0,0 @@
1
- import { BaseS3Options } from "builder-util-runtime";
2
- import { PublishContext, Publisher, UploadTask } from "electron-publish";
3
- export declare abstract class BaseS3Publisher extends Publisher {
4
- private options;
5
- protected constructor(context: PublishContext, options: BaseS3Options);
6
- protected abstract getBucketName(): string;
7
- protected configureS3Options(args: Array<string>): void;
8
- upload(task: UploadTask): Promise<any>;
9
- toString(): string;
10
- }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseS3Publisher = void 0;
4
- const builder_util_1 = require("builder-util");
5
- const electron_publish_1 = require("electron-publish");
6
- const promises_1 = require("fs/promises");
7
- const path = require("path");
8
- class BaseS3Publisher extends electron_publish_1.Publisher {
9
- constructor(context, options) {
10
- super(context);
11
- this.options = options;
12
- }
13
- configureS3Options(args) {
14
- // if explicitly set to null, do not add
15
- if (this.options.acl !== null) {
16
- args.push("--acl", this.options.acl || "public-read");
17
- }
18
- }
19
- // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html
20
- async upload(task) {
21
- const fileName = path.basename(task.file);
22
- const cancellationToken = this.context.cancellationToken;
23
- const target = (this.options.path == null ? "" : `${this.options.path}/`) + fileName;
24
- const args = ["publish-s3", "--bucket", this.getBucketName(), "--key", target, "--file", task.file];
25
- this.configureS3Options(args);
26
- if (process.env.__TEST_S3_PUBLISHER__ != null) {
27
- const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target);
28
- await (0, promises_1.mkdir)(path.dirname(testFile), { recursive: true });
29
- await (0, promises_1.symlink)(task.file, testFile);
30
- return;
31
- }
32
- // https://github.com/aws/aws-sdk-go/issues/279
33
- this.createProgressBar(fileName, -1);
34
- // if (progressBar != null) {
35
- // const callback = new ProgressCallback(progressBar)
36
- // uploader.on("progress", () => {
37
- // if (!cancellationToken.cancelled) {
38
- // callback.update(uploader.loaded, uploader.contentLength)
39
- // }
40
- // })
41
- // }
42
- return await cancellationToken.createPromise((resolve, reject, onCancel) => {
43
- (0, builder_util_1.executeAppBuilder)(args, process => {
44
- onCancel(() => {
45
- process.kill("SIGINT");
46
- });
47
- })
48
- .then(() => {
49
- try {
50
- builder_util_1.log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, "uploaded");
51
- }
52
- finally {
53
- resolve(undefined);
54
- }
55
- })
56
- .catch(reject);
57
- });
58
- }
59
- toString() {
60
- return `${this.providerName} (bucket: ${this.getBucketName()})`;
61
- }
62
- }
63
- exports.BaseS3Publisher = BaseS3Publisher;
64
- //# sourceMappingURL=BaseS3Publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseS3Publisher.js","sourceRoot":"","sources":["../../../src/publish/s3/BaseS3Publisher.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,uDAAwE;AACxE,0CAA4C;AAC5C,6BAA4B;AAE5B,MAAsB,eAAgB,SAAQ,4BAAS;IACrD,YACE,OAAuB,EACf,OAAsB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAA;QAFN,YAAO,GAAP,OAAO,CAAe;IAGhC,CAAC;IAIS,kBAAkB,CAAC,IAAmB;QAC9C,wCAAwC;QACxC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,aAAa,CAAC,CAAA;QACvD,C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C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;YACzE,IAAA,gCAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE;gBAChC,QAAQ,CAAC,GAAG,EAAE;oBACZ,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC;iBACC,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC;oBACH,kBAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,UAAU,CAAC,CAAA;gBACtG,CAAC;wBAAS,CAAC;oBACT,OAAO,CAAC,SAAS,CAAC,CAAA;gBACpB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,MAAM,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,aAAa,EAAE,GAAG,CAAA;IACjE,CAAC;CACF;AAjED,0CAiEC","sourcesContent":["import { log, executeAppBuilder } from \"builder-util\"\nimport { BaseS3Options } from \"builder-util-runtime\"\nimport { PublishContext, Publisher, UploadTask } from \"electron-publish\"\nimport { mkdir, symlink } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport abstract class BaseS3Publisher extends Publisher {\n protected constructor(\n context: PublishContext,\n private options: BaseS3Options\n ) {\n super(context)\n }\n\n protected abstract getBucketName(): string\n\n protected configureS3Options(args: Array<string>) {\n // if explicitly set to null, do not add\n if (this.options.acl !== null) {\n args.push(\"--acl\", this.options.acl || \"public-read\")\n }\n }\n\n // http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html\n async upload(task: UploadTask): Promise<any> {\n const fileName = path.basename(task.file)\n const cancellationToken = this.context.cancellationToken\n\n const target = (this.options.path == null ? \"\" : `${this.options.path}/`) + fileName\n\n const args = [\"publish-s3\", \"--bucket\", this.getBucketName(), \"--key\", target, \"--file\", task.file]\n this.configureS3Options(args)\n\n if (process.env.__TEST_S3_PUBLISHER__ != null) {\n const testFile = path.join(process.env.__TEST_S3_PUBLISHER__, target)\n await mkdir(path.dirname(testFile), { recursive: true })\n await symlink(task.file, testFile)\n return\n }\n\n // https://github.com/aws/aws-sdk-go/issues/279\n this.createProgressBar(fileName, -1)\n // if (progressBar != null) {\n // const callback = new ProgressCallback(progressBar)\n // uploader.on(\"progress\", () => {\n // if (!cancellationToken.cancelled) {\n // callback.update(uploader.loaded, uploader.contentLength)\n // }\n // })\n // }\n\n return await cancellationToken.createPromise((resolve, reject, onCancel) => {\n executeAppBuilder(args, process => {\n onCancel(() => {\n process.kill(\"SIGINT\")\n })\n })\n .then(() => {\n try {\n log.debug({ provider: this.providerName, file: fileName, bucket: this.getBucketName() }, \"uploaded\")\n } finally {\n resolve(undefined)\n }\n })\n .catch(reject)\n })\n }\n\n toString() {\n return `${this.providerName} (bucket: ${this.getBucketName()})`\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import { S3Options } from "builder-util-runtime";
2
- import { PublishContext } from "electron-publish";
3
- import { BaseS3Publisher } from "./BaseS3Publisher";
4
- export default class S3Publisher extends BaseS3Publisher {
5
- private readonly info;
6
- readonly providerName = "s3";
7
- constructor(context: PublishContext, info: S3Options);
8
- static checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise<void>;
9
- protected getBucketName(): string;
10
- protected configureS3Options(args: Array<string>): void;
11
- toString(): string;
12
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_util_1 = require("builder-util");
4
- const BaseS3Publisher_1 = require("./BaseS3Publisher");
5
- class S3Publisher extends BaseS3Publisher_1.BaseS3Publisher {
6
- constructor(context, info) {
7
- super(context, info);
8
- this.info = info;
9
- this.providerName = "s3";
10
- }
11
- static async checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) {
12
- const bucket = options.bucket;
13
- if (bucket == null) {
14
- throw new builder_util_1.InvalidConfigurationError(`Please specify "bucket" for "s3" publish provider`);
15
- }
16
- if (options.endpoint == null && bucket.includes(".") && options.region == null) {
17
- // on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region.
18
- try {
19
- options.region = await (0, builder_util_1.executeAppBuilder)(["get-bucket-location", "--bucket", bucket]);
20
- }
21
- catch (e) {
22
- if (errorIfCannot) {
23
- throw e;
24
- }
25
- else {
26
- builder_util_1.log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`);
27
- }
28
- }
29
- }
30
- if (options.channel == null && channelFromAppVersion != null) {
31
- options.channel = channelFromAppVersion;
32
- }
33
- if (options.endpoint != null && options.endpoint.endsWith("/")) {
34
- ;
35
- options.endpoint = options.endpoint.slice(0, -1);
36
- }
37
- }
38
- getBucketName() {
39
- return this.info.bucket;
40
- }
41
- configureS3Options(args) {
42
- super.configureS3Options(args);
43
- if (this.info.endpoint != null) {
44
- args.push("--endpoint", this.info.endpoint);
45
- }
46
- if (this.info.region != null) {
47
- args.push("--region", this.info.region);
48
- }
49
- if (this.info.storageClass != null) {
50
- args.push("--storageClass", this.info.storageClass);
51
- }
52
- if (this.info.encryption != null) {
53
- args.push("--encryption", this.info.encryption);
54
- }
55
- }
56
- toString() {
57
- const result = super.toString();
58
- const endpoint = this.info.endpoint;
59
- if (endpoint != null) {
60
- return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`;
61
- }
62
- return result;
63
- }
64
- }
65
- exports.default = S3Publisher;
66
- //# sourceMappingURL=s3Publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"s3Publisher.js","sourceRoot":"","sources":["../../../src/publish/s3/s3Publisher.ts"],"names":[],"mappings":";;AAAA,+CAAgF;AAGhF,uDAAmD;AAEnD,MAAqB,WAAY,SAAQ,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cesContent":["import { executeAppBuilder, InvalidConfigurationError, log } from \"builder-util\"\nimport { S3Options } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class S3Publisher extends BaseS3Publisher {\n readonly providerName = \"s3\"\n\n constructor(\n context: PublishContext,\n private readonly info: S3Options\n ) {\n super(context, info)\n }\n\n static async checkAndResolveOptions(options: S3Options, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n const bucket = options.bucket\n if (bucket == null) {\n throw new InvalidConfigurationError(`Please specify \"bucket\" for \"s3\" publish provider`)\n }\n\n if (options.endpoint == null && bucket.includes(\".\") && options.region == null) {\n // on dotted bucket names, we need to use a path-based endpoint URL. Path-based endpoint URLs need to include the region.\n try {\n options.region = await executeAppBuilder([\"get-bucket-location\", \"--bucket\", bucket])\n } catch (e: any) {\n if (errorIfCannot) {\n throw e\n } else {\n log.warn(`cannot compute region for bucket (required because on dotted bucket names, we need to use a path-based endpoint URL): ${e}`)\n }\n }\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n\n if (options.endpoint != null && options.endpoint.endsWith(\"/\")) {\n ;(options as any).endpoint = options.endpoint.slice(0, -1)\n }\n }\n\n protected getBucketName(): string {\n return this.info.bucket\n }\n\n protected configureS3Options(args: Array<string>): void {\n super.configureS3Options(args)\n\n if (this.info.endpoint != null) {\n args.push(\"--endpoint\", this.info.endpoint)\n }\n if (this.info.region != null) {\n args.push(\"--region\", this.info.region)\n }\n\n if (this.info.storageClass != null) {\n args.push(\"--storageClass\", this.info.storageClass)\n }\n if (this.info.encryption != null) {\n args.push(\"--encryption\", this.info.encryption)\n }\n }\n\n toString() {\n const result = super.toString()\n const endpoint = this.info.endpoint\n if (endpoint != null) {\n return result.substring(0, result.length - 1) + `, endpoint: ${endpoint})`\n }\n return result\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import { SpacesOptions } from "builder-util-runtime";
2
- import { PublishContext } from "electron-publish";
3
- import { BaseS3Publisher } from "./BaseS3Publisher";
4
- export default class SpacesPublisher extends BaseS3Publisher {
5
- private readonly info;
6
- readonly providerName = "spaces";
7
- constructor(context: PublishContext, info: SpacesOptions);
8
- static checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean): Promise<void>;
9
- protected getBucketName(): string;
10
- protected configureS3Options(args: Array<string>): void;
11
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_util_1 = require("builder-util");
4
- const BaseS3Publisher_1 = require("./BaseS3Publisher");
5
- class SpacesPublisher extends BaseS3Publisher_1.BaseS3Publisher {
6
- constructor(context, info) {
7
- super(context, info);
8
- this.info = info;
9
- this.providerName = "spaces";
10
- }
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
- static checkAndResolveOptions(options, channelFromAppVersion, errorIfCannot) {
13
- if (options.name == null) {
14
- throw new builder_util_1.InvalidConfigurationError(`Please specify "name" for "spaces" publish provider (see https://www.electron.build/publish#spacesoptions)`);
15
- }
16
- if (options.region == null) {
17
- throw new builder_util_1.InvalidConfigurationError(`Please specify "region" for "spaces" publish provider (see https://www.electron.build/publish#spacesoptions)`);
18
- }
19
- if (options.channel == null && channelFromAppVersion != null) {
20
- options.channel = channelFromAppVersion;
21
- }
22
- return Promise.resolve();
23
- }
24
- getBucketName() {
25
- return this.info.name;
26
- }
27
- configureS3Options(args) {
28
- super.configureS3Options(args);
29
- args.push("--endpoint", `${this.info.region}.digitaloceanspaces.com`);
30
- args.push("--region", this.info.region);
31
- const accessKey = process.env.DO_KEY_ID;
32
- const secretKey = process.env.DO_SECRET_KEY;
33
- if ((0, builder_util_1.isEmptyOrSpaces)(accessKey)) {
34
- throw new builder_util_1.InvalidConfigurationError("Please set env DO_KEY_ID (see https://www.electron.build/publish#spacesoptions)");
35
- }
36
- if ((0, builder_util_1.isEmptyOrSpaces)(secretKey)) {
37
- throw new builder_util_1.InvalidConfigurationError("Please set env DO_SECRET_KEY (see https://www.electron.build/publish#spacesoptions)");
38
- }
39
- args.push("--accessKey", accessKey);
40
- args.push("--secretKey", secretKey);
41
- }
42
- }
43
- exports.default = SpacesPublisher;
44
- //# sourceMappingURL=spacesPublisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spacesPublisher.js","sourceRoot":"","sources":["../../../src/publish/s3/spacesPublisher.ts"],"names":[],"mappings":";;AAAA,+CAAyE;AAGzE,uDAAmD;AAEnD,MAAqB,eAAgB,SAAQ,iCAAe;IAG1D,YACE,OAAuB,EACN,IAAmB;QAEpC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAFH,SAAI,GAAJ,IAAI,CAAe;QAJ7B,iBAAY,GAAG,QAAQ,CAAA;IAOhC,CAAC;IAED,6DAA6D;IAC7D,MAAM,CAAC,sBAAsB,CAAC,OAAsB,EAAE,qBAAoC,EAAE,aAAsB;QAChH,IAAI,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,wCAAyB,CAAC,4GAA4G,CAAC,CAAA;QACnJ,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YAC3B,MAAM,IAAI,wCAAyB,CAAC,8GAA8G,CAAC,CAAA;QACrJ,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,IAAI,qBAAqB,IAAI,IAAI,EAAE,CAAC;YAC7D,OAAO,CAAC,OAAO,GAAG,qBAAqB,CAAA;QACzC,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAES,aAAa;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACvB,CAAC;IAES,kBAAkB,CAAC,IAAmB;QAC9C,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,yBAAyB,CAAC,CAAA;QACrE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAA;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAA;QAC3C,IAAI,IAAA,8BAAe,EAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,wCAAyB,CAAC,iFAAiF,CAAC,CAAA;QACxH,CAAC;QACD,IAAI,IAAA,8BAAe,EAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,wCAAyB,CAAC,qFAAqF,CAAC,CAAA;QAC5H,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;IACrC,CAAC;CACF;AA9CD,kCA8CC","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces } from \"builder-util\"\nimport { SpacesOptions } from \"builder-util-runtime\"\nimport { PublishContext } from \"electron-publish\"\nimport { BaseS3Publisher } from \"./BaseS3Publisher\"\n\nexport default class SpacesPublisher extends BaseS3Publisher {\n readonly providerName = \"spaces\"\n\n constructor(\n context: PublishContext,\n private readonly info: SpacesOptions\n ) {\n super(context, info)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static checkAndResolveOptions(options: SpacesOptions, channelFromAppVersion: string | null, errorIfCannot: boolean) {\n if (options.name == null) {\n throw new InvalidConfigurationError(`Please specify \"name\" for \"spaces\" publish provider (see https://www.electron.build/publish#spacesoptions)`)\n }\n if (options.region == null) {\n throw new InvalidConfigurationError(`Please specify \"region\" for \"spaces\" publish provider (see https://www.electron.build/publish#spacesoptions)`)\n }\n\n if (options.channel == null && channelFromAppVersion != null) {\n options.channel = channelFromAppVersion\n }\n return Promise.resolve()\n }\n\n protected getBucketName(): string {\n return this.info.name\n }\n\n protected configureS3Options(args: Array<string>): void {\n super.configureS3Options(args)\n\n args.push(\"--endpoint\", `${this.info.region}.digitaloceanspaces.com`)\n args.push(\"--region\", this.info.region)\n\n const accessKey = process.env.DO_KEY_ID\n const secretKey = process.env.DO_SECRET_KEY\n if (isEmptyOrSpaces(accessKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_KEY_ID (see https://www.electron.build/publish#spacesoptions)\")\n }\n if (isEmptyOrSpaces(secretKey)) {\n throw new InvalidConfigurationError(\"Please set env DO_SECRET_KEY (see https://www.electron.build/publish#spacesoptions)\")\n }\n args.push(\"--accessKey\", accessKey)\n args.push(\"--secretKey\", secretKey)\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare function sanitizeFileName(s: string, normalizeNfd?: boolean): string;
2
- export declare function getCompleteExtname(filename: string): string;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sanitizeFileName = sanitizeFileName;
4
- exports.getCompleteExtname = getCompleteExtname;
5
- // @ts-ignore
6
- const _sanitizeFileName = require("sanitize-filename");
7
- const path = require("path");
8
- function sanitizeFileName(s, normalizeNfd = false) {
9
- const sanitized = _sanitizeFileName(s);
10
- return normalizeNfd ? sanitized.normalize("NFD") : sanitized;
11
- }
12
- // Get the filetype from a filename. Returns a string of one or more file extensions,
13
- // e.g. .zip, .dmg, .tar.gz, .tar.bz2, .exe.blockmap. We'd normally use `path.extname()`,
14
- // but it doesn't support multiple extensions, e.g. Foo-1.0.0.dmg.blockmap should be
15
- // .dmg.blockmap, not .blockmap.
16
- function getCompleteExtname(filename) {
17
- let extname = path.extname(filename);
18
- switch (extname) {
19
- // Append leading extension for blockmap filetype
20
- case ".blockmap": {
21
- extname = path.extname(filename.replace(extname, "")) + extname;
22
- break;
23
- }
24
- // Append leading extension for known compressed tar formats
25
- case ".bz2":
26
- case ".gz":
27
- case ".lz":
28
- case ".xz":
29
- case ".7z": {
30
- const ext = path.extname(filename.replace(extname, ""));
31
- if (ext === ".tar") {
32
- extname = ext + extname;
33
- }
34
- break;
35
- }
36
- }
37
- return extname;
38
- }
39
- //# sourceMappingURL=filename.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filename.js","sourceRoot":"","sources":["../../src/util/filename.ts"],"names":[],"mappings":";;AAIA,4CAGC;AAMD,gDA0BC;AAvCD,aAAa;AACb,uDAAsD;AACtD,6BAA4B;AAE5B,SAAgB,gBAAgB,CAAC,CAAS,EAAE,YAAY,GAAG,KAAK;IAC9D,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAA;IACtC,OAAO,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC9D,CAAC;AAED,qFAAqF;AACrF,yFAAyF;AACzF,oFAAoF;AACpF,gCAAgC;AAChC,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEpC,QAAQ,OAAO,EAAE,CAAC;QAChB,iDAAiD;QACjD,KAAK,WAAW,CAAC,CAAC,CAAC;YACjB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAA;YAE/D,MAAK;QACP,CAAC;QACD,4DAA4D;QAC5D,KAAK,MAAM,CAAC;QACZ,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC,CAAC,CAAC;YACX,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;YACvD,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,OAAO,GAAG,GAAG,GAAG,OAAO,CAAA;YACzB,CAAC;YAED,MAAK;QACP,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["// @ts-ignore\nimport * as _sanitizeFileName from \"sanitize-filename\"\nimport * as path from \"path\"\n\nexport function sanitizeFileName(s: string, normalizeNfd = false): string {\n const sanitized = _sanitizeFileName(s)\n return normalizeNfd ? sanitized.normalize(\"NFD\") : sanitized\n}\n\n// Get the filetype from a filename. Returns a string of one or more file extensions,\n// e.g. .zip, .dmg, .tar.gz, .tar.bz2, .exe.blockmap. We'd normally use `path.extname()`,\n// but it doesn't support multiple extensions, e.g. Foo-1.0.0.dmg.blockmap should be\n// .dmg.blockmap, not .blockmap.\nexport function getCompleteExtname(filename: string): string {\n let extname = path.extname(filename)\n\n switch (extname) {\n // Append leading extension for blockmap filetype\n case \".blockmap\": {\n extname = path.extname(filename.replace(extname, \"\")) + extname\n\n break\n }\n // Append leading extension for known compressed tar formats\n case \".bz2\":\n case \".gz\":\n case \".lz\":\n case \".xz\":\n case \".7z\": {\n const ext = path.extname(filename.replace(extname, \"\"))\n if (ext === \".tar\") {\n extname = ext + extname\n }\n\n break\n }\n }\n\n return extname\n}\n"]}