@netlify/edge-bundler
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -7,2 +7,3 @@ import { ExecaChildProcess } from 'execa'; | ||
debug?: boolean; | ||
denoDir?: string; | ||
onAfterDownload?: OnAfterDownloadHook; | ||
@@ -23,2 +24,3 @@ onBeforeDownload?: OnBeforeDownloadHook; | ||
debug: boolean; | ||
denoDir?: string; | ||
onAfterDownload?: OnAfterDownloadHook; | ||
@@ -41,2 +43,3 @@ onBeforeDownload?: OnBeforeDownloadHook; | ||
}>; | ||
getEnvironmentVariables(): Record<string, string>; | ||
log(...data: unknown[]): void; | ||
@@ -47,2 +50,2 @@ run(args: string[], { pipeOutput }?: RunOptions): Promise<import("execa").ExecaReturnValue<string>>; | ||
export { DenoBridge }; | ||
export type { OnAfterDownloadHook, OnBeforeDownloadHook, ProcessRef }; | ||
export type { DenoOptions, OnAfterDownloadHook, OnBeforeDownloadHook, ProcessRef }; |
@@ -16,2 +16,3 @@ import { promises as fs } from 'fs'; | ||
this.debug = (_b = options.debug) !== null && _b !== void 0 ? _b : false; | ||
this.denoDir = options.denoDir; | ||
this.onAfterDownload = options.onAfterDownload; | ||
@@ -86,5 +87,5 @@ this.onBeforeDownload = options.onBeforeDownload; | ||
} | ||
static runWithBinary(binaryPath, args, pipeOutput) { | ||
static runWithBinary(binaryPath, args, options, pipeOutput) { | ||
var _a, _b; | ||
const runDeno = execa(binaryPath, args); | ||
const runDeno = execa(binaryPath, args, options); | ||
if (pipeOutput) { | ||
@@ -118,2 +119,9 @@ (_a = runDeno.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout); | ||
} | ||
getEnvironmentVariables() { | ||
const env = {}; | ||
if (this.denoDir !== undefined) { | ||
env.DENO_DIR = this.denoDir; | ||
} | ||
return env; | ||
} | ||
log(...data) { | ||
@@ -129,3 +137,5 @@ if (!this.debug) { | ||
const { path: binaryPath } = await this.getBinaryPath(); | ||
return DenoBridge.runWithBinary(binaryPath, args, pipeOutput); | ||
const env = this.getEnvironmentVariables(); | ||
const options = { env }; | ||
return DenoBridge.runWithBinary(binaryPath, args, options, pipeOutput); | ||
} | ||
@@ -136,3 +146,5 @@ // Runs the Deno CLI in the background, assigning a reference of the child | ||
const { path: binaryPath } = await this.getBinaryPath(); | ||
const ps = DenoBridge.runWithBinary(binaryPath, args, pipeOutput); | ||
const env = this.getEnvironmentVariables(); | ||
const options = { env }; | ||
const ps = DenoBridge.runWithBinary(binaryPath, args, options, pipeOutput); | ||
if (ref !== undefined) { | ||
@@ -139,0 +151,0 @@ // eslint-disable-next-line no-param-reassign |
@@ -21,1 +21,2 @@ import { OnAfterDownloadHook, OnBeforeDownloadHook } from './bridge.js'; | ||
export { bundle }; | ||
export type { BundleOptions }; |
@@ -40,3 +40,3 @@ import { promises as fs } from 'fs'; | ||
const featureFlags = getFlags(inputFeatureFlags); | ||
const deno = new DenoBridge({ | ||
const options = { | ||
debug, | ||
@@ -46,3 +46,7 @@ cacheDirectory, | ||
onBeforeDownload, | ||
}); | ||
}; | ||
if (cacheDirectory !== undefined && featureFlags.edge_functions_cache_deno_dir) { | ||
options.denoDir = join(cacheDirectory, 'deno_dir'); | ||
} | ||
const deno = new DenoBridge(options); | ||
const basePath = getBasePath(sourceDirectories, inputBasePath); | ||
@@ -49,0 +53,0 @@ await ensureLatestTypes(deno); |
const defaultFlags = { | ||
edge_functions_cache_deno_dir: false, | ||
edge_functions_produce_eszip: false, | ||
@@ -3,0 +4,0 @@ }; |
{ | ||
"name": "@netlify/edge-bundler", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Intelligently prepare Netlify Edge Functions for deployment", | ||
@@ -5,0 +5,0 @@ "type": "module", |
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
48205
1116