@netlify/edge-bundler
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -1,2 +0,2 @@ | ||
import { writeStage2 } from 'https://62ea8d05a6858300091547ed--edge.netlify.com/bundler/mod.ts' | ||
import { writeStage2 } from 'https://62f5f45fbc76ed0009624267--edge.netlify.com/bundler/mod.ts' | ||
@@ -3,0 +3,0 @@ const [payload] = Deno.args |
@@ -30,3 +30,3 @@ import { promises as fs } from 'fs'; | ||
this.logger.system(`Downloading Deno CLI to ${this.cacheDirectory}`); | ||
const binaryPath = await download(this.cacheDirectory, this.versionRange); | ||
const binaryPath = await download(this.cacheDirectory, this.versionRange, this.logger); | ||
const downloadedVersion = await this.getBinaryVersion(binaryPath); | ||
@@ -39,2 +39,3 @@ // We should never get here, because it means that `DENO_VERSION_RANGE` is | ||
await ((_b = this.onAfterDownload) === null || _b === void 0 ? void 0 : _b.call(this, error)); | ||
this.logger.system('Could not run downloaded Deno CLI', error); | ||
throw error; | ||
@@ -51,2 +52,3 @@ } | ||
if (!version) { | ||
this.logger.system(`getBinaryVersion no version found. binaryPath ${binaryPath}`); | ||
return; | ||
@@ -56,5 +58,3 @@ } | ||
} | ||
catch (error) { | ||
this.logger.system('Error checking Deno binary version', error); | ||
} | ||
catch { } | ||
} | ||
@@ -67,6 +67,8 @@ async getCachedBinary() { | ||
} | ||
catch { | ||
catch (error) { | ||
this.logger.system('Error getting cached binary', error); | ||
return; | ||
} | ||
if (!semver.satisfies(cachedVersion, this.versionRange)) { | ||
this.logger.system(`semver not satisfied. cachedVersion: ${cachedVersion}, versionRange: ${this.versionRange}`); | ||
return; | ||
@@ -84,2 +86,3 @@ } | ||
if (globalVersion === undefined || !semver.satisfies(globalVersion, this.versionRange)) { | ||
this.logger.system(`No globalVersion or semver not satisfied. globalVersion: ${globalVersion}, versionRange: ${this.versionRange}`); | ||
return; | ||
@@ -86,0 +89,0 @@ } |
@@ -1,2 +0,3 @@ | ||
declare const download: (targetDirectory: string, versionRange: string) => Promise<string>; | ||
import { Logger } from './logger.js'; | ||
declare const download: (targetDirectory: string, versionRange: string, logger: Logger) => Promise<string>; | ||
export { download }; |
@@ -5,7 +5,8 @@ import fs from 'fs'; | ||
import StreamZip from 'node-stream-zip'; | ||
import pRetry from 'p-retry'; | ||
import semver from 'semver'; | ||
import { getBinaryExtension, getPlatformTarget } from './platform.js'; | ||
const download = async (targetDirectory, versionRange) => { | ||
const download = async (targetDirectory, versionRange, logger) => { | ||
const zipPath = path.join(targetDirectory, 'deno-cli-latest.zip'); | ||
const data = await downloadVersion(versionRange); | ||
const data = await downloadVersionWithRetry(versionRange, logger); | ||
const binaryName = `deno${getBinaryExtension()}`; | ||
@@ -37,2 +38,8 @@ const binaryPath = path.join(targetDirectory, binaryName); | ||
}; | ||
const downloadVersionWithRetry = async (versionRange, logger) => await pRetry(async () => await downloadVersion(versionRange), { | ||
retries: 3, | ||
onFailedAttempt: (error) => { | ||
logger.system('Deno CLI download retry attempt error', error); | ||
}, | ||
}); | ||
const extractBinaryFromZip = async (zipPath, binaryPath, binaryName) => { | ||
@@ -39,0 +46,0 @@ const { async: StreamZipAsync } = StreamZip; |
@@ -8,3 +8,3 @@ import { promises as fs } from 'fs'; | ||
import { getFileHash } from '../utils/sha256.js'; | ||
const BOOTSTRAP_LATEST = 'https://62ea8d05a6858300091547ed--edge.netlify.com/bootstrap/index-combined.ts'; | ||
const BOOTSTRAP_LATEST = 'https://62f5f45fbc76ed0009624267--edge.netlify.com/bootstrap/index-combined.ts'; | ||
const bundleJS = async ({ buildID, debug, deno, distDirectory, functions, importMap, }) => { | ||
@@ -11,0 +11,0 @@ const stage2Path = await generateStage2({ distDirectory, functions, fileName: `${buildID}-pre.js` }); |
{ | ||
"name": "@netlify/edge-bundler", | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"description": "Intelligently prepare Netlify Edge Functions for deployment", | ||
@@ -89,2 +89,3 @@ "type": "module", | ||
"node-stream-zip": "^1.15.0", | ||
"p-retry": "^5.1.1", | ||
"p-wait-for": "^4.1.0", | ||
@@ -91,0 +92,0 @@ "path-key": "^4.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51429
1176
13
+ Addedp-retry@^5.1.1
+ Added@types/retry@0.12.1(transitive)
+ Addedp-retry@5.1.2(transitive)
+ Addedretry@0.13.1(transitive)