builder-util-runtime
Advanced tools
+25
-20
@@ -6,7 +6,6 @@ "use strict"; | ||
| }); | ||
| exports.readEmbeddedBlockMapData = readEmbeddedBlockMapData; | ||
| exports.BLOCK_MAP_FILE_NAME = void 0; | ||
| exports.readEmbeddedBlockMapData = exports.BLOCK_MAP_FILE_NAME = void 0; | ||
| function _bluebirdLst() { | ||
| const data = _interopRequireDefault(require("bluebird-lst")); | ||
| const data = _interopRequireWildcard(require("bluebird-lst")); | ||
@@ -30,3 +29,3 @@ _bluebirdLst = function () { | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
@@ -36,21 +35,27 @@ const BLOCK_MAP_FILE_NAME = "_blockMap.blockmap"; | ||
| async function readEmbeddedBlockMapData(file) { | ||
| const fd = await (0, _fsExtraP().open)(file, "r"); | ||
| let readEmbeddedBlockMapData = (() => { | ||
| var _ref = (0, _bluebirdLst().coroutine)(function* (file) { | ||
| const fd = yield (0, _fsExtraP().open)(file, "r"); | ||
| try { | ||
| const fileSize = (await (0, _fsExtraP().fstat)(fd)).size; | ||
| const sizeBuffer = Buffer.allocUnsafe(4); | ||
| await (0, _fsExtraP().read)(fd, sizeBuffer, 0, sizeBuffer.length, fileSize - sizeBuffer.length); | ||
| const dataBuffer = Buffer.allocUnsafe(sizeBuffer.readUInt32BE(0)); | ||
| await (0, _fsExtraP().read)(fd, dataBuffer, 0, dataBuffer.length, fileSize - sizeBuffer.length - dataBuffer.length); | ||
| await (0, _fsExtraP().close)(fd); | ||
| try { | ||
| const fileSize = (yield (0, _fsExtraP().fstat)(fd)).size; | ||
| const sizeBuffer = Buffer.allocUnsafe(4); | ||
| yield (0, _fsExtraP().read)(fd, sizeBuffer, 0, sizeBuffer.length, fileSize - sizeBuffer.length); | ||
| const dataBuffer = Buffer.allocUnsafe(sizeBuffer.readUInt32BE(0)); | ||
| yield (0, _fsExtraP().read)(fd, dataBuffer, 0, dataBuffer.length, fileSize - sizeBuffer.length - dataBuffer.length); | ||
| yield (0, _fsExtraP().close)(fd); | ||
| const inflateRaw = _bluebirdLst().default.promisify(require("zlib").inflateRaw); | ||
| const inflateRaw = _bluebirdLst().default.promisify(require("zlib").inflateRaw); | ||
| return (await inflateRaw(dataBuffer)).toString(); | ||
| } catch (e) { | ||
| await (0, _fsExtraP().close)(fd); | ||
| throw e; | ||
| } | ||
| } | ||
| return (yield inflateRaw(dataBuffer)).toString(); | ||
| } catch (e) { | ||
| yield (0, _fsExtraP().close)(fd); | ||
| throw e; | ||
| } | ||
| }); | ||
| return function readEmbeddedBlockMapData(_x) { | ||
| return _ref.apply(this, arguments); | ||
| }; | ||
| })(); exports.readEmbeddedBlockMapData = readEmbeddedBlockMapData; | ||
| //# sourceMappingURL=blockMapApi.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"blockMapApi.js","sourceRoot":"","sources":["../src/blockMapApi.ts"],"names":[],"mappings":";;;;;;;;AAAA,AAAO,AAAe,AAAM,AAAc;;;;;;;;;;AAC1C,AAAO,AAAE,AAAK,AAAE,AAAK,AAAE,AAAI,AAAE,AAAI,AAAE,AAAM,AAAY,AAErD,AAAM;;;;;;;;;;;;AAAC,MAAM,AAAmB,sBAAG,AAAoB,AAiBvD,AAAM;;;AAAC,AAAK,wCAAmC,AAAY;AACzD,QAAM,AAAE,KAAG,MAAM,AAAI,sBAAC,AAAI,MAAE,AAAG,AAAC;;AAChC,MAAI;AACF,UAAM,AAAQ,WAAG,CAAC,MAAM,AAAK,uBAAC,AAAE,AAAC,AAAC,KAAC,AAAI;AACvC,UAAM,AAAU,aAAG,AAAM,OAAC,AAAW,YAAC,AAAC,AAAC;AACxC,UAAM,AAAI,sBAAC,AAAE,IAAE,AAAU,YAAE,AAAC,GAAE,AAAU,WAAC,AAAM,QAAE,AAAQ,WAAG,AAAU,WAAC,AAAM,AAAC;AAE9E,UAAM,AAAU,aAAG,AAAM,OAAC,AAAW,YAAC,AAAU,WAAC,AAAY,aAAC,AAAC,AAAC,AAAC;AACjE,UAAM,AAAI,sBAAC,AAAE,IAAE,AAAU,YAAE,AAAC,GAAE,AAAU,WAAC,AAAM,QAAE,AAAQ,WAAG,AAAU,WAAC,AAAM,SAAG,AAAU,WAAC,AAAM,AAAC;AAClG,UAAM,AAAK,uBAAC,AAAE,AAAC;;AAEf,UAAM,AAAU,aAAQ,AAAe,uBAAC,AAAS,UAAC,AAAO,QAAC,AAAM,AAAC,QAAC,AAAU,AAAC;;AAC7E,WAAO,CAAC,MAAM,AAAU,WAAC,AAAU,AAAC,AAAC,aAAC,AAAQ,AAAE;AACjD,IACD,OAAO,AAAC,GAAE;AACR,UAAM,AAAK,uBAAC,AAAE,AAAC;AACf,UAAM,AAAC;AACR,AACH;AAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { close, fstat, open, read } from \"fs-extra-p\"\n\nexport const BLOCK_MAP_FILE_NAME = \"_blockMap.blockmap\"\n\nexport interface FileChunks {\n checksums: Array<string>\n sizes: Array<number>\n}\n\nexport interface BlockMap {\n version: \"1\" | \"2\"\n files: Array<BlockMapFile>\n}\n\nexport interface BlockMapFile extends FileChunks {\n name: string\n offset: number\n}\n\nexport async function readEmbeddedBlockMapData(file: string) {\n const fd = await open(file, \"r\")\n try {\n const fileSize = (await fstat(fd)).size\n const sizeBuffer = Buffer.allocUnsafe(4)\n await read(fd, sizeBuffer, 0, sizeBuffer.length, fileSize - sizeBuffer.length)\n\n const dataBuffer = Buffer.allocUnsafe(sizeBuffer.readUInt32BE(0))\n await read(fd, dataBuffer, 0, dataBuffer.length, fileSize - sizeBuffer.length - dataBuffer.length)\n await close(fd)\n\n const inflateRaw: any = BluebirdPromise.promisify(require(\"zlib\").inflateRaw)\n return (await inflateRaw(dataBuffer)).toString()\n }\n catch (e) {\n await close(fd)\n throw e\n }\n}"]} | ||
| {"version":3,"file":"blockMapApi.js","sourceRoot":"","sources":["../src/blockMapApi.ts"],"names":[],"mappings":";;;;;;;AAAA,AAAO,AAAe,AAAM,AAAc;;;;;;;;;;AAC1C,AAAO,AAAE,AAAK,AAAE,AAAK,AAAE,AAAI,AAAE,AAAI,AAAE,AAAM,AAAY,AAErD,AAAM;;;;;;;;;;;;AAAC,MAAM,AAAmB,sBAAG,AAAoB,AAiBvD,AAAM;;;;2CAAC,AAAK,WAAmC,AAAY;AACzD,UAAM,AAAE,KAAG,MAAM,AAAI,sBAAC,AAAI,MAAE,AAAG,AAAC;;AAChC,QAAI;AACF,YAAM,AAAQ,WAAG,CAAC,MAAM,AAAK,uBAAC,AAAE,AAAC,AAAC,KAAC,AAAI;AACvC,YAAM,AAAU,aAAG,AAAM,OAAC,AAAW,YAAC,AAAC,AAAC;AACxC,YAAM,AAAI,sBAAC,AAAE,IAAE,AAAU,YAAE,AAAC,GAAE,AAAU,WAAC,AAAM,QAAE,AAAQ,WAAG,AAAU,WAAC,AAAM,AAAC;AAE9E,YAAM,AAAU,aAAG,AAAM,OAAC,AAAW,YAAC,AAAU,WAAC,AAAY,aAAC,AAAC,AAAC,AAAC;AACjE,YAAM,AAAI,sBAAC,AAAE,IAAE,AAAU,YAAE,AAAC,GAAE,AAAU,WAAC,AAAM,QAAE,AAAQ,WAAG,AAAU,WAAC,AAAM,SAAG,AAAU,WAAC,AAAM,AAAC;AAClG,YAAM,AAAK,uBAAC,AAAE,AAAC;;AAEf,YAAM,AAAU,aAAQ,AAAe,uBAAC,AAAS,UAAC,AAAO,QAAC,AAAM,AAAC,QAAC,AAAU,AAAC;;AAC7E,aAAO,CAAC,MAAM,AAAU,WAAC,AAAU,AAAC,AAAC,aAAC,AAAQ,AAAE;AACjD,MACD,OAAO,AAAC,GAAE;AACR,YAAM,AAAK,uBAAC,AAAE,AAAC;AACf,YAAM,AAAC;AACR,AACH;AAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { close, fstat, open, read } from \"fs-extra-p\"\n\nexport const BLOCK_MAP_FILE_NAME = \"_blockMap.blockmap\"\n\nexport interface FileChunks {\n checksums: Array<string>\n sizes: Array<number>\n}\n\nexport interface BlockMap {\n version: \"1\" | \"2\"\n files: Array<BlockMapFile>\n}\n\nexport interface BlockMapFile extends FileChunks {\n name: string\n offset: number\n}\n\nexport async function readEmbeddedBlockMapData(file: string) {\n const fd = await open(file, \"r\")\n try {\n const fileSize = (await fstat(fd)).size\n const sizeBuffer = Buffer.allocUnsafe(4)\n await read(fd, sizeBuffer, 0, sizeBuffer.length, fileSize - sizeBuffer.length)\n\n const dataBuffer = Buffer.allocUnsafe(sizeBuffer.readUInt32BE(0))\n await read(fd, dataBuffer, 0, dataBuffer.length, fileSize - sizeBuffer.length - dataBuffer.length)\n await close(fd)\n\n const inflateRaw: any = BluebirdPromise.promisify(require(\"zlib\").inflateRaw)\n return (await inflateRaw(dataBuffer)).toString()\n }\n catch (e) {\n await close(fd)\n throw e\n }\n}"]} |
@@ -77,2 +77,3 @@ export declare type PublishProvider = "github" | "bintray" | "s3" | "spaces" | "generic"; | ||
| * Generic (any HTTP(S) server) options. | ||
| * In all publish options [File Macros](/file-patterns.md#file-macros) are supported. | ||
| */ | ||
@@ -85,3 +86,3 @@ export interface GenericServerOptions extends PublishConfiguration { | ||
| /** | ||
| * The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros. | ||
| * The base url. e.g. `https://bucket_name.s3.amazonaws.com`. | ||
| */ | ||
@@ -88,0 +89,0 @@ readonly url: string; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"publishOptions.js","sourceRoot":"","sources":["../src/publishOptions.ts"],"names":[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AAO,QAAC,AAAM,MAAE;AACnE;AACF;;AAED,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,AAAG,AAAI,eAAI,AAAO,QAAC,AAAI,IAAE;AAC1B;;AACD,SAAO,AAAG,AACZ;AAAC;;AAED,mBAAmB,AAAsB;AACvC,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,UAAM,IAAI,AAAK,AAAC,MAAiB,AAAC;AACnC;;AACD,MAAI,AAAO,QAAC,AAAM,UAAI,AAAI,MAAE;AAC1B,UAAM,IAAI,AAAK,AAAC,MAAmB,AAAC;AACrC;;AAED,MAAI,AAAG,AAAG,iBAAW,AAAO,QAAC,AAAI,QAAI,AAAO,QAAC,AAAM,MAAyB;;AAC5E,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,AAAG,AAAI,eAAI,AAAO,QAAC,AAAI,IAAE;AAC1B;;AACD,SAAO,AAAG,AACZ;AAAC","sourcesContent":["export type PublishProvider = \"github\" | \"bintray\" | \"s3\" | \"spaces\" | \"generic\"\n\n// typescript-json-schema generates only PublishConfiguration if it is specified in the list, so, it is not added here\nexport type AllPublishOptions = string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | BintrayOptions\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport interface PublishConfiguration {\n /**\n * The provider.\n */\n readonly provider: PublishProvider\n\n /**\n * @private\n */\n readonly publisherName?: Array<string> | null\n\n /**\n * Whether to publish auto update info files.\n *\n * Auto update relies only on the first provider in the list (you can specify several publishers).\n * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.\n *\n * @default true\n */\n readonly publishAutoUpdate?: boolean\n}\n\n/**\n * [GitHub](https://help.github.com/articles/about-releases/) options.\n *\n * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.\n * Define `GH_TOKEN` environment variable.\n */\nexport interface GithubOptions extends PublishConfiguration {\n /**\n * The provider. Must be `github`.\n */\n readonly provider: \"github\"\n\n /**\n * The repository name. [Detected automatically](#github-repository-and-bintray-package).\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * Whether to use `v`-prefixed tag name.\n * @default true\n */\n readonly vPrefixedTagName?: boolean\n\n /**\n * The host (including the port if need).\n * @default github.com\n */\n readonly host?: string | null\n\n /**\n * The protocol. GitHub Publisher supports only `https`.\n * @default https\n */\n readonly protocol?: \"https\" | \"http\" | null\n\n /**\n * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update.md#appupdatersetfeedurloptions).\n */\n readonly token?: string | null\n\n /**\n * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update.md#private-github-update-repo).\n */\n readonly private?: boolean | null\n\n /**\n * The type of release. By default `draft` release will be created.\n *\n * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRELEASE`is set to `true` — `prerelease`.\n * @default draft\n */\n releaseType?: \"draft\" | \"prerelease\" | \"release\" | null\n}\n\n/** @private */\nexport function githubUrl(options: GithubOptions, defaultHost: string = \"github.com\") {\n return `${options.protocol || \"https\"}://${options.host || defaultHost}`\n}\n\n/**\n * Generic (any HTTP(S) server) options.\n */\nexport interface GenericServerOptions extends PublishConfiguration {\n /**\n * The provider. Must be `generic`.\n */\n readonly provider: \"generic\"\n\n /**\n * The base url. e.g. `https://bucket_name.s3.amazonaws.com`. You can use `${os}` (expanded to `mac`, `linux` or `win` according to target platform) and `${arch}` macros.\n */\n readonly url: string\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n\n /**\n * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.\n */\n readonly useMultipleRangeRequest?: boolean\n}\n\nexport interface BaseS3Options extends PublishConfiguration {\n /**\n * The update channel.\n * @default latest\n */\n channel?: string | null\n\n /**\n * The directory path.\n * @default /\n */\n readonly path?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n}\n\nexport interface S3Options extends BaseS3Options {\n /**\n * The provider. Must be `s3`.\n */\n readonly provider: \"s3\"\n\n /**\n * The bucket name.\n */\n readonly bucket: string\n\n /**\n * The region. Is determined and set automatically when publishing.\n */\n region?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n\n /**\n * The type of storage to use for the object.\n * @default STANDARD\n */\n readonly storageClass?: \"STANDARD\" | \"REDUCED_REDUNDANCY\" | \"STANDARD_IA\" | null\n\n /**\n * Server-side encryption algorithm to use for the object.\n */\n readonly encryption?: \"AES256\" | \"aws:kms\" | null\n\n /**\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.\n */\n readonly endpoint?: string | null\n}\n\n/**\n * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.\n * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.\n */\nexport interface SpacesOptions extends BaseS3Options {\n /**\n * The provider. Must be `spaces`.\n */\n readonly provider: \"spaces\"\n\n /**\n * The space name.\n */\n readonly name: string\n\n /**\n * The region (e.g. `nyc3`).\n */\n readonly region: string\n}\n\nexport function getS3LikeProviderBaseUrl(configuration: PublishConfiguration) {\n const provider = configuration.provider\n if (provider === \"s3\") {\n return s3Url((configuration as S3Options))\n }\n if (provider === \"spaces\") {\n return spacesUrl((configuration as SpacesOptions))\n }\n throw new Error(`Not supported provider: ${provider}`)\n}\n\nfunction s3Url(options: S3Options) {\n let url: string\n if (options.endpoint != null) {\n url = `${options.endpoint}/${options.bucket}`\n }\n else {\n if (!options.bucket.includes(\".\")) {\n if (options.region === \"cn-north-1\") {\n url = `https://${options.bucket}.s3.${options.region}.amazonaws.com.cn`\n }\n else {\n url = `https://${options.bucket}.s3.amazonaws.com`\n }\n }\n else {\n if (options.region == null) {\n throw new Error(`Bucket name \"${options.bucket}\" includes a dot, but S3 region is missing`)\n }\n\n // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro\n url = options.region === \"us-east-1\"\n ? `https://s3.amazonaws.com/${options.bucket}`\n : `https://s3-${options.region}.amazonaws.com/${options.bucket}`\n }\n }\n\n if (options.path != null) {\n url += `/${options.path}`\n }\n return url\n}\n\nfunction spacesUrl(options: SpacesOptions) {\n if (options.name == null) {\n throw new Error(`name is missing`)\n }\n if (options.region == null) {\n throw new Error(`region is missing`)\n }\n\n let url = `https://${options.name}.${options.region}.digitaloceanspaces.com`\n if (options.path != null) {\n url += `/${options.path}`\n }\n return url\n}\n\n/**\n * [Bintray](https://bintray.com/) options. Requires an API key. An API key can be obtained from the user [profile](https://bintray.com/profile/edit) page (\"Edit Your Profile\" -> API Key).\n * Define `BT_TOKEN` environment variable.\n */\nexport interface BintrayOptions extends PublishConfiguration {\n /**\n * The provider. Must be `bintray`.\n */\n readonly provider: \"bintray\"\n\n /**\n * The Bintray package name.\n */\n readonly package?: string | null\n\n /**\n * The Bintray repository name.\n * @default generic\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * The Bintray component (Debian only).\n */\n readonly component?: string | null\n\n /**\n * The Bintray distribution (Debian only).\n * @default stable\n */\n readonly distribution?: string | null\n\n /**\n * The Bintray user account. Used in cases where the owner is an organization.\n */\n readonly user?: string | null\n\n readonly token?: string | null\n}\n"]} | ||
| {"version":3,"file":"publishOptions.js","sourceRo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c,AAAO,QAAC,AAAM,wBAAkB,AAAO,QAAC,AAAM,MAAE;AACnE;AACF;;AAED,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,AAAG,AAAI,eAAI,AAAO,QAAC,AAAI,IAAE;AAC1B;;AACD,SAAO,AAAG,AACZ;AAAC;;AAED,mBAAmB,AAAsB;AACvC,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,UAAM,IAAI,AAAK,AAAC,MAAiB,AAAC;AACnC;;AACD,MAAI,AAAO,QAAC,AAAM,UAAI,AAAI,MAAE;AAC1B,UAAM,IAAI,AAAK,AAAC,MAAmB,AAAC;AACrC;;AAED,MAAI,AAAG,AAAG,iBAAW,AAAO,QAAC,AAAI,QAAI,AAAO,QAAC,AAAM,MAAyB;;AAC5E,MAAI,AAAO,QAAC,AAAI,QAAI,AAAI,MAAE;AACxB,AAAG,AAAI,eAAI,AAAO,QAAC,AAAI,IAAE;AAC1B;;AACD,SAAO,AAAG,AACZ;AAAC","sourcesContent":["export type PublishProvider = \"github\" | \"bintray\" | \"s3\" | \"spaces\" | \"generic\"\n\n// typescript-json-schema generates only PublishConfiguration if it is specified in the list, so, it is not added here\nexport type AllPublishOptions = string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | BintrayOptions\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport interface PublishConfiguration {\n /**\n * The provider.\n */\n readonly provider: PublishProvider\n\n /**\n * @private\n */\n readonly publisherName?: Array<string> | null\n\n /**\n * Whether to publish auto update info files.\n *\n * Auto update relies only on the first provider in the list (you can specify several publishers).\n * Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.\n *\n * @default true\n */\n readonly publishAutoUpdate?: boolean\n}\n\n/**\n * [GitHub](https://help.github.com/articles/about-releases/) options.\n *\n * GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission.\n * Define `GH_TOKEN` environment variable.\n */\nexport interface GithubOptions extends PublishConfiguration {\n /**\n * The provider. Must be `github`.\n */\n readonly provider: \"github\"\n\n /**\n * The repository name. [Detected automatically](#github-repository-and-bintray-package).\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * Whether to use `v`-prefixed tag name.\n * @default true\n */\n readonly vPrefixedTagName?: boolean\n\n /**\n * The host (including the port if need).\n * @default github.com\n */\n readonly host?: string | null\n\n /**\n * The protocol. GitHub Publisher supports only `https`.\n * @default https\n */\n readonly protocol?: \"https\" | \"http\" | null\n\n /**\n * The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update.md#appupdatersetfeedurloptions).\n */\n readonly token?: string | null\n\n /**\n * Whether to use private github auto-update provider if `GH_TOKEN` environment variable is defined. See [Private GitHub Update Repo](/auto-update.md#private-github-update-repo).\n */\n readonly private?: boolean | null\n\n /**\n * The type of release. By default `draft` release will be created.\n *\n * Also you can set release type using environment variable. If `EP_DRAFT`is set to `true` — `draft`, if `EP_PRELEASE`is set to `true` — `prerelease`.\n * @default draft\n */\n releaseType?: \"draft\" | \"prerelease\" | \"release\" | null\n}\n\n/** @private */\nexport function githubUrl(options: GithubOptions, defaultHost: string = \"github.com\") {\n return `${options.protocol || \"https\"}://${options.host || defaultHost}`\n}\n\n/**\n * Generic (any HTTP(S) server) options.\n * In all publish options [File Macros](/file-patterns.md#file-macros) are supported.\n */\nexport interface GenericServerOptions extends PublishConfiguration {\n /**\n * The provider. Must be `generic`.\n */\n readonly provider: \"generic\"\n\n /**\n * The base url. e.g. `https://bucket_name.s3.amazonaws.com`.\n */\n readonly url: string\n\n /**\n * The channel.\n * @default latest\n */\n readonly channel?: string | null\n\n /**\n * Whether to use multiple range requests for differential update. Defaults to `true` if `url` doesn't contain `s3.amazonaws.com`.\n */\n readonly useMultipleRangeRequest?: boolean\n}\n\nexport interface BaseS3Options extends PublishConfiguration {\n /**\n * The update channel.\n * @default latest\n */\n channel?: string | null\n\n /**\n * The directory path.\n * @default /\n */\n readonly path?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n}\n\nexport interface S3Options extends BaseS3Options {\n /**\n * The provider. Must be `s3`.\n */\n readonly provider: \"s3\"\n\n /**\n * The bucket name.\n */\n readonly bucket: string\n\n /**\n * The region. Is determined and set automatically when publishing.\n */\n region?: string | null\n\n /**\n * The ACL. Set to `null` to not [add](https://github.com/electron-userland/electron-builder/issues/1822).\n *\n * Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).\n *\n * @default public-read\n */\n readonly acl?: \"private\" | \"public-read\" | null\n\n /**\n * The type of storage to use for the object.\n * @default STANDARD\n */\n readonly storageClass?: \"STANDARD\" | \"REDUCED_REDUNDANCY\" | \"STANDARD_IA\" | null\n\n /**\n * Server-side encryption algorithm to use for the object.\n */\n readonly encryption?: \"AES256\" | \"aws:kms\" | null\n\n /**\n * The endpoint URI to send requests to. The default endpoint is built from the configured region.\n * The endpoint should be a string like `https://{service}.{region}.amazonaws.com`.\n */\n readonly endpoint?: string | null\n}\n\n/**\n * [DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options.\n * Access key is required, define `DO_KEY_ID` and `DO_SECRET_KEY` environment variables.\n */\nexport interface SpacesOptions extends BaseS3Options {\n /**\n * The provider. Must be `spaces`.\n */\n readonly provider: \"spaces\"\n\n /**\n * The space name.\n */\n readonly name: string\n\n /**\n * The region (e.g. `nyc3`).\n */\n readonly region: string\n}\n\nexport function getS3LikeProviderBaseUrl(configuration: PublishConfiguration) {\n const provider = configuration.provider\n if (provider === \"s3\") {\n return s3Url((configuration as S3Options))\n }\n if (provider === \"spaces\") {\n return spacesUrl((configuration as SpacesOptions))\n }\n throw new Error(`Not supported provider: ${provider}`)\n}\n\nfunction s3Url(options: S3Options) {\n let url: string\n if (options.endpoint != null) {\n url = `${options.endpoint}/${options.bucket}`\n }\n else {\n if (!options.bucket.includes(\".\")) {\n if (options.region === \"cn-north-1\") {\n url = `https://${options.bucket}.s3.${options.region}.amazonaws.com.cn`\n }\n else {\n url = `https://${options.bucket}.s3.amazonaws.com`\n }\n }\n else {\n if (options.region == null) {\n throw new Error(`Bucket name \"${options.bucket}\" includes a dot, but S3 region is missing`)\n }\n\n // special case, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro\n url = options.region === \"us-east-1\"\n ? `https://s3.amazonaws.com/${options.bucket}`\n : `https://s3-${options.region}.amazonaws.com/${options.bucket}`\n }\n }\n\n if (options.path != null) {\n url += `/${options.path}`\n }\n return url\n}\n\nfunction spacesUrl(options: SpacesOptions) {\n if (options.name == null) {\n throw new Error(`name is missing`)\n }\n if (options.region == null) {\n throw new Error(`region is missing`)\n }\n\n let url = `https://${options.name}.${options.region}.digitaloceanspaces.com`\n if (options.path != null) {\n url += `/${options.path}`\n }\n return url\n}\n\n/**\n * [Bintray](https://bintray.com/) options. Requires an API key. An API key can be obtained from the user [profile](https://bintray.com/profile/edit) page (\"Edit Your Profile\" -> API Key).\n * Define `BT_TOKEN` environment variable.\n */\nexport interface BintrayOptions extends PublishConfiguration {\n /**\n * The provider. Must be `bintray`.\n */\n readonly provider: \"bintray\"\n\n /**\n * The Bintray package name.\n */\n readonly package?: string | null\n\n /**\n * The Bintray repository name.\n * @default generic\n */\n readonly repo?: string | null\n\n /**\n * The owner.\n */\n readonly owner?: string | null\n\n /**\n * The Bintray component (Debian only).\n */\n readonly component?: string | null\n\n /**\n * The Bintray distribution (Debian only).\n * @default stable\n */\n readonly distribution?: string | null\n\n /**\n * The Bintray user account. Used in cases where the owner is an organization.\n */\n readonly user?: string | null\n\n readonly token?: string | null\n}\n"]} |
+2
-2
| { | ||
| "name": "builder-util-runtime", | ||
| "version": "4.2.0", | ||
| "version": "4.2.1", | ||
| "main": "out/index.js", | ||
@@ -18,3 +18,3 @@ "author": "Vladimir Krivosheev", | ||
| "debug": "^3.1.0", | ||
| "fs-extra-p": "^4.5.2", | ||
| "fs-extra-p": "^4.6.0", | ||
| "bluebird-lst": "^1.0.5", | ||
@@ -21,0 +21,0 @@ "sax": "^1.2.4" |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
146696
0.38%1770
0.34%Updated