@netlify/edge-bundler
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
import { ExecaChildProcess } from 'execa'; | ||
@@ -20,2 +21,4 @@ import { Logger } from './logger.js'; | ||
pipeOutput?: boolean; | ||
env?: NodeJS.ProcessEnv; | ||
extendEnv?: boolean; | ||
} | ||
@@ -45,7 +48,7 @@ declare class DenoBridge { | ||
}>; | ||
getEnvironmentVariables(): Record<string, string>; | ||
run(args: string[], { pipeOutput }?: RunOptions): Promise<import("execa").ExecaReturnValue<string>>; | ||
runInBackground(args: string[], pipeOutput?: boolean, ref?: ProcessRef): Promise<void>; | ||
getEnvironmentVariables(inputEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv; | ||
run(args: string[], { pipeOutput, env: inputEnv, extendEnv }?: RunOptions): Promise<import("execa").ExecaReturnValue<string>>; | ||
runInBackground(args: string[], ref?: ProcessRef, { pipeOutput, env: inputEnv, extendEnv }?: RunOptions): Promise<void>; | ||
} | ||
export { DenoBridge }; | ||
export type { DenoOptions, OnAfterDownloadHook, OnBeforeDownloadHook, ProcessRef }; |
@@ -119,4 +119,4 @@ import { promises as fs } from 'fs'; | ||
} | ||
getEnvironmentVariables() { | ||
const env = {}; | ||
getEnvironmentVariables(inputEnv = {}) { | ||
const env = { ...inputEnv }; | ||
if (this.denoDir !== undefined) { | ||
@@ -129,6 +129,6 @@ env.DENO_DIR = this.denoDir; | ||
// process, awaiting its execution. | ||
async run(args, { pipeOutput } = {}) { | ||
async run(args, { pipeOutput, env: inputEnv, extendEnv = true } = {}) { | ||
const { path: binaryPath } = await this.getBinaryPath(); | ||
const env = this.getEnvironmentVariables(); | ||
const options = { env }; | ||
const env = this.getEnvironmentVariables(inputEnv); | ||
const options = { env, extendEnv }; | ||
return DenoBridge.runWithBinary(binaryPath, args, options, pipeOutput); | ||
@@ -138,6 +138,6 @@ } | ||
// process to a `ps` property in the `ref` argument, if one is supplied. | ||
async runInBackground(args, pipeOutput, ref) { | ||
async runInBackground(args, ref, { pipeOutput, env: inputEnv, extendEnv = true } = {}) { | ||
const { path: binaryPath } = await this.getBinaryPath(); | ||
const env = this.getEnvironmentVariables(); | ||
const options = { env }; | ||
const env = this.getEnvironmentVariables(inputEnv); | ||
const options = { env, extendEnv }; | ||
const ps = DenoBridge.runWithBinary(binaryPath, args, options, pipeOutput); | ||
@@ -144,0 +144,0 @@ if (ref !== undefined) { |
@@ -0,1 +1,5 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { OnAfterDownloadHook, OnBeforeDownloadHook } from '../bridge.js'; | ||
@@ -24,3 +28,3 @@ import type { EdgeFunction } from '../edge_function.js'; | ||
} | ||
declare const serve: ({ certificatePath, debug, distImportMapPath, inspectSettings, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, systemLogger, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[]) => Promise<{ | ||
declare const serve: ({ certificatePath, debug, distImportMapPath, inspectSettings, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, systemLogger, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[], env?: NodeJS.ProcessEnv) => Promise<{ | ||
graph: any; | ||
@@ -27,0 +31,0 @@ success: boolean; |
@@ -10,3 +10,3 @@ import { tmpName } from 'tmp-promise'; | ||
const processRef = {}; | ||
const startIsolate = async (newFunctions) => { | ||
const startIsolate = async (newFunctions, env = {}) => { | ||
if ((processRef === null || processRef === void 0 ? void 0 : processRef.ps) !== undefined) { | ||
@@ -36,3 +36,10 @@ await killProcess(processRef.ps); | ||
const bootstrapFlags = ['--port', port.toString()]; | ||
await deno.runInBackground(['run', ...denoFlags, stage2Path, ...bootstrapFlags], true, processRef); | ||
// We set `extendEnv: false` to avoid polluting the edge function context | ||
// with variables from the user's system, since those will not be available | ||
// in the production environment. | ||
await deno.runInBackground(['run', ...denoFlags, stage2Path, ...bootstrapFlags], processRef, { | ||
pipeOutput: true, | ||
env, | ||
extendEnv: false, | ||
}); | ||
const success = await waitForServer(port, processRef.ps); | ||
@@ -39,0 +46,0 @@ return { |
{ | ||
"name": "@netlify/edge-bundler", | ||
"version": "1.10.0", | ||
"version": "1.11.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
50347
1162