Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/edge-bundler

Package Overview
Dependencies
Maintainers
20
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/edge-bundler - npm Package Compare versions

Comparing version 8.14.1 to 8.14.2

6

dist/node/bridge.test.js

@@ -56,3 +56,3 @@ import { Buffer } from 'buffer';

expect(output).toBe('LULU=LALA');
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -82,3 +82,3 @@ test('Does inherit environment variables if `extendEnv` is true', async () => {

expect(environmentVariables).toEqual(['LULU=LALA', 'TADA=TUDU']);
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -108,3 +108,3 @@ test('Does inherit environment variables if `extendEnv` is not set', async () => {

expect(environmentVariables).toEqual(['LULU=LALA', 'TADA=TUDU']);
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -1,6 +0,5 @@

import { promises as fs } from 'fs';
import { access, readdir, readFile, rm, writeFile } from 'fs/promises';
import { join, resolve } from 'path';
import process from 'process';
import { pathToFileURL } from 'url';
import { deleteAsync } from 'del';
import tmp from 'tmp-promise';

@@ -29,6 +28,6 @@ import { test, expect, vi } from 'vitest';

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(3);
expect(generatedFiles.length).toBe(2);
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);

@@ -61,6 +60,6 @@ expect(() => validateManifest(manifest)).not.toThrowError();

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(1);
expect(generatedFiles.length).toBe(2);
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);

@@ -169,6 +168,6 @@ const { bundles } = manifest;

const result = await bundle([sourceDirectory], distPath, declarations, options);
const outFiles = await fs.readdir(distPath);
const outFiles = await readdir(distPath);
expect(result.functions.length).toBe(1);
expect(outFiles.length).toBe(2);
const denoDir = await fs.readdir(join(cacheDir.path, 'deno_dir'));
const denoDir = await readdir(join(cacheDir.path, 'deno_dir'));
expect(denoDir.includes('gen')).toBe(true);

@@ -190,6 +189,6 @@ await cleanup();

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(1);
expect(generatedFiles.length).toBe(2);
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);

@@ -219,3 +218,3 @@ const { bundles } = manifest;

};
await fs.writeFile(importMapFile.path, JSON.stringify(importMap));
await writeFile(importMapFile.path, JSON.stringify(importMap));
// Deno configuration files need to be in the current working directory.

@@ -230,3 +229,3 @@ // There's not a great way for us to set the working directory of the `deno`

try {
await fs.access(denoConfigPath);
await access(denoConfigPath);
throw new Error(`The file at '${denoConfigPath} would be overwritten by this test. Please move the file to a different location and try again.'`);

@@ -239,3 +238,3 @@ }

}
await fs.writeFile(denoConfigPath, JSON.stringify(denoConfig));
await writeFile(denoConfigPath, JSON.stringify(denoConfig));
expect(() => bundle([sourceDirectory], distPath, declarations, {

@@ -246,3 +245,4 @@ basePath,

await cleanup();
await deleteAsync([denoConfigPath, importMapFile.path], { force: true });
await rm(denoConfigPath, { force: true, recursive: true, maxRetries: 10 });
await rm(importMapFile.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -263,6 +263,6 @@ test('Processes a function that imports a custom layer', async () => {

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(1);
expect(generatedFiles.length).toBe(2);
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);

@@ -290,6 +290,6 @@ const { bundles, layers } = manifest;

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(3);
expect(generatedFiles.length).toBe(2);
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);

@@ -330,3 +330,3 @@ const { bundles, function_config: functionConfig } = manifest;

};
await fs.writeFile(importMap.path, JSON.stringify(importMapContents));
await writeFile(importMap.path, JSON.stringify(importMapContents));
const nonExistingImportMapPath = join(distPath, 'some-file-that-does-not-exist.json');

@@ -343,3 +343,3 @@ const result = await bundle([sourceDirectory], distPath, [

});
const generatedFiles = await fs.readdir(distPath);
const generatedFiles = await readdir(distPath);
expect(result.functions.length).toBe(2);

@@ -346,0 +346,0 @@ expect(generatedFiles.length).toBe(2);

import { promises as fs } from 'fs';
import { rm } from 'fs/promises';
import { join, resolve } from 'path';
import { pathToFileURL } from 'url';
import { deleteAsync } from 'del';
import tmp from 'tmp-promise';

@@ -132,3 +132,3 @@ import { test, expect, vi, describe } from 'vitest';

}
await deleteAsync(tmpDir, { force: true });
await rm(tmpDir, { force: true, recursive: true, maxRetries: 10 });
});

@@ -200,3 +200,3 @@ });

}, new ImportMap([importMapFile]), deno, logger)).resolves.not.toThrow();
await deleteAsync(tmpDir, { force: true });
await rm(tmpDir, { force: true, recursive: true, maxRetries: 10 });
});

@@ -226,3 +226,3 @@ test('Fails validation if default export is not function', async () => {

await expect(config).rejects.toThrowError(invalidDefaultExportErr(path));
await deleteAsync(tmpDir, { force: true });
await rm(tmpDir, { force: true, recursive: true, maxRetries: 10 });
});

@@ -251,3 +251,3 @@ test('Fails validation if default export is not present', async () => {

await expect(config).rejects.toThrowError(invalidDefaultExportErr(path));
await deleteAsync(tmpDir, { force: true });
await rm(tmpDir, { force: true, recursive: true, maxRetries: 10 });
});

@@ -45,3 +45,2 @@ import { createWriteStream, promises as fs } from 'fs';

const res = await fetch(url);
// eslint-disable-next-line no-magic-numbers
if (res.body === null || res.status < 200 || res.status > 299) {

@@ -48,0 +47,0 @@ throw new Error(`Download failed with status code ${res.status}`);

@@ -33,3 +33,3 @@ import { rm } from 'fs/promises';

afterEach(async (ctx) => {
await rm(ctx.tmpDir, { force: true, recursive: true });
await rm(ctx.tmpDir, { force: true, recursive: true, maxRetries: 10 });
});

@@ -36,0 +36,0 @@ test('tries downloading binary up to 4 times', async (ctx) => {

@@ -1,13 +0,12 @@

import { promises as fs } from 'fs';
import { mkdir, rm, writeFile } from 'fs/promises';
import { join } from 'path';
import { pathToFileURL } from 'url';
import { deleteAsync } from 'del';
const defaultFormatExportTypeError = (name) => `The Edge Function "${name}" has failed to load. Does it have a function as the default export?`;
const defaultFormatImportError = (name) => `There was an error with Edge Function "${name}".`;
const generateStage2 = async ({ bootstrapURL, distDirectory, fileName, formatExportTypeError, formatImportError, functions, }) => {
await deleteAsync(distDirectory, { force: true });
await fs.mkdir(distDirectory, { recursive: true });
await rm(distDirectory, { force: true, recursive: true, maxRetries: 3 });
await mkdir(distDirectory, { recursive: true });
const entryPoint = getLocalEntryPoint(functions, { bootstrapURL, formatExportTypeError, formatImportError });
const stage2Path = join(distDirectory, fileName);
await fs.writeFile(stage2Path, entryPoint);
await writeFile(stage2Path, entryPoint);
return stage2Path;

@@ -14,0 +13,0 @@ };

@@ -46,3 +46,3 @@ import { Buffer } from 'buffer';

expect(afterDownload).toHaveBeenCalledTimes(1);
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -1,5 +0,4 @@

import { promises as fs } from 'fs';
import { rm, writeFile } from 'fs/promises';
import { join } from 'path';
import { pathToFileURL } from 'url';
import { deleteAsync } from 'del';
import { execa } from 'execa';

@@ -26,3 +25,3 @@ import tmp from 'tmp-promise';

const bootstrapURL = pathToFileURL(printerPath).toString();
await fs.writeFile(printerPath, printer);
await writeFile(printerPath, printer);
const functions = [

@@ -34,7 +33,7 @@ { name: 'func1', path: join(tmpDir, 'func1.mjs'), response: 'Hello from function 1' },

const contents = `export default () => ${JSON.stringify(func.response)}`;
await fs.writeFile(func.path, contents);
await writeFile(func.path, contents);
}
const stage2 = getLocalEntryPoint(functions.map(({ name, path }) => ({ name, path })), { bootstrapURL });
const stage2Path = join(tmpDir, 'stage2.mjs');
await fs.writeFile(stage2Path, stage2);
await writeFile(stage2Path, stage2);
const { stdout, stderr } = await execa('deno', ['run', '--allow-all', stage2Path]);

@@ -47,3 +46,3 @@ expect(stderr).toBe('');

}
await deleteAsync(tmpDir, { force: true });
await rm(tmpDir, { force: true, recursive: true });
});

@@ -27,3 +27,3 @@ import { readFile, rm, writeFile } from 'fs/promises';

mock.mockRestore();
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -47,3 +47,3 @@ test('`ensureLatestTypes` does not update the Deno CLI cache if the local version of types is up-to-date', async () => {

mock.mockRestore();
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});

@@ -64,3 +64,3 @@ test('`ensureLatestTypes` does not throw if the types URL is not available', async () => {

mock.mockRestore();
await rm(tmpDir.path, { force: true, recursive: true });
await rm(tmpDir.path, { force: true, recursive: true, maxRetries: 10 });
});
{
"name": "@netlify/edge-bundler",
"version": "8.14.1",
"version": "8.14.2",
"description": "Intelligently prepare Netlify Edge Functions for deployment",

@@ -81,3 +81,2 @@ "type": "module",

"common-path-prefix": "^3.0.0",
"del": "^7.0.0",
"env-paths": "^3.0.0",

@@ -84,0 +83,0 @@ "execa": "^6.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc