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

@netlify/edge-bundler

Package Overview
Dependencies
Maintainers
18
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 10.1.0 to 10.1.1

2

dist/node/bundler.js

@@ -159,3 +159,3 @@ import { promises as fs } from 'fs';

logger,
referenceTypes: false,
environment: 'production',
rootPath,

@@ -162,0 +162,0 @@ });

@@ -0,1 +1,2 @@

import { Buffer } from 'buffer';
import { access, readdir, readFile, rm, writeFile } from 'fs/promises';

@@ -433,1 +434,25 @@ import { join, resolve } from 'path';

});
test('Supports TSX and process.env', async () => {
const { basePath, cleanup, distPath } = await useFixture('tsx');
const sourceDirectory = join(basePath, 'functions');
const declarations = [
{
function: 'func1',
path: '/func1',
},
];
const vendorDirectory = await tmp.dir();
await bundle([sourceDirectory], distPath, declarations, {
basePath,
vendorDirectory: vendorDirectory.path,
});
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
const manifest = JSON.parse(manifestFile);
const bundlePath = join(distPath, manifest.bundles[0].asset);
process.env.FOO = 'bar';
const { func1 } = await runESZIP(bundlePath, vendorDirectory.path);
expect(Buffer.from(func1, 'base64').toString()).toBe(`hippedy hoppedy, createElement is now a production property. Here, take this env var: FOO=bar`);
await cleanup();
await rm(vendorDirectory.path, { force: true, recursive: true });
delete process.env.FOO;
});

@@ -10,6 +10,6 @@ /// <reference types="node" />

logger: Logger;
referenceTypes: boolean;
environment: 'production' | 'development';
rootPath?: string;
}
export declare const vendorNPMSpecifiers: ({ basePath, directory, functions, importMap, referenceTypes, rootPath, }: VendorNPMSpecifiersOptions) => Promise<{
export declare const vendorNPMSpecifiers: ({ basePath, directory, functions, importMap, environment, rootPath, }: VendorNPMSpecifiersOptions) => Promise<{
cleanup: () => Promise<void>;

@@ -16,0 +16,0 @@ directory: string;

@@ -12,3 +12,3 @@ import { promises as fs } from 'fs';

import { pathsBetween } from './utils/fs.js';
const TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.cts', '.mts']);
const TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.cts', '.ctsx', '.mts', '.mtsx']);
const slugifyPackageName = (specifier) => {

@@ -70,2 +70,6 @@ if (!specifier.startsWith('@'))

js: `
import process from "node:process";
import {setImmediate, clearImmediate} from "node:timers";
import {Buffer} from "node:buffer";
import {createRequire as ___nfyCreateRequire} from "node:module";

@@ -83,3 +87,3 @@ import {fileURLToPath as ___nfyFileURLToPath} from "node:url";

*/
const getNPMSpecifiers = async ({ basePath, functions, importMap, referenceTypes, rootPath, }) => {
const getNPMSpecifiers = async ({ basePath, functions, importMap, environment, rootPath }) => {
const baseURL = pathToFileURL(basePath);

@@ -159,3 +163,3 @@ const { reasons } = await nodeFileTrace(functions, {

specifier: packageName,
types: referenceTypes ? await safelyDetectTypes(path.join(basePath, filePath)) : undefined,
types: environment === 'development' ? await safelyDetectTypes(path.join(basePath, filePath)) : undefined,
});

@@ -169,3 +173,3 @@ }

};
export const vendorNPMSpecifiers = async ({ basePath, directory, functions, importMap, referenceTypes, rootPath = basePath, }) => {
export const vendorNPMSpecifiers = async ({ basePath, directory, functions, importMap, environment, rootPath = basePath, }) => {
// The directories that esbuild will use when resolving Node modules. We must

@@ -184,3 +188,3 @@ // set these manually because esbuild will be operating from a temporary

importMap: importMap.getContentsWithURLObjects(),
referenceTypes,
environment,
rootPath,

@@ -219,2 +223,7 @@ });

write: false,
define: environment === 'production'
? {
'process.env.NODE_ENV': '"production"',
}
: undefined,
});

@@ -221,0 +230,0 @@ await Promise.all(outputFiles.map(async (file) => {

@@ -51,3 +51,3 @@ import { readdir, unlink } from 'fs/promises';

logger,
referenceTypes: true,
environment: 'development',
rootPath,

@@ -54,0 +54,0 @@ });

{
"name": "@netlify/edge-bundler",
"version": "10.1.0",
"version": "10.1.1",
"description": "Intelligently prepare Netlify Edge Functions for deployment",

@@ -5,0 +5,0 @@ "type": "module",

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