@netlify/edge-bundler 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,5 +9,5 @@ interface BundleESZIPOptions {
9
9
  distDirectory: string;
10
10
  functions: EdgeFunction[];
11
11
  }
12
- declare const bundle: (options: BundleESZIPOptions) => Promise<Bundle>;
13
- export { bundle };
12
+ declare const bundleESZIP: ({ basePath, buildID, debug, deno, distDirectory, functions, }: BundleESZIPOptions) => Promise<Bundle>;
13
+ export { bundleESZIP as bundle };
@@ -2,14 +2,6 @@ import { join, resolve } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  import { wrapBundleError } from '../bundle_error.js';
4
4
  import { getFileHash } from '../utils/sha256.js';
5
- const bundle = async (options) => {
6
- try {
7
- return await bundleESZIP(options);
8
- }
9
- catch (error) {
10
- throw wrapBundleError(error, { format: 'eszip' });
11
- }
12
- };
13
5
  const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, functions, }) => {
14
6
  const extension = '.eszip';
15
7
  const destPath = join(distDirectory, `${buildID}${extension}`);
@@ -23,7 +15,12 @@ const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, func
23
15
  if (!debug) {
24
16
  flags.push('--quiet');
25
17
  }
26
- await deno.run(['run', ...flags, bundler, JSON.stringify(payload)], { pipeOutput: true });
18
+ try {
19
+ await deno.run(['run', ...flags, bundler, JSON.stringify(payload)], { pipeOutput: true });
20
+ }
21
+ catch (error) {
22
+ throw wrapBundleError(error, { format: 'eszip' });
23
+ }
27
24
  const hash = await getFileHash(destPath);
28
25
  return { extension, format: 'eszip2', hash };
29
26
  };
@@ -33,4 +30,4 @@ const getESZIPBundler = () => {
33
30
  const bundlerPath = resolve(pathname, '../../../deno/bundle.ts');
34
31
  return bundlerPath;
35
32
  };
36
- export { bundle };
33
+ export { bundleESZIP as bundle };
@@ -11,7 +11,7 @@ interface BundleJSOptions {
11
11
  functions: EdgeFunction[];
12
12
  importMap: ImportMap;
13
13
  }
14
- declare const bundle: (options: BundleJSOptions) => Promise<Bundle>;
14
+ declare const bundleJS: ({ buildID, debug, deno, distDirectory, functions, importMap, }: BundleJSOptions) => Promise<Bundle>;
15
15
  interface GenerateStage2Options {
16
16
  distDirectory: string;
17
17
  fileName: string;
@@ -22,4 +22,4 @@ interface GenerateStage2Options {
22
22
  }
23
23
  declare const generateStage2: ({ distDirectory, fileName, formatExportTypeError, formatImportError, functions, type, }: GenerateStage2Options) => Promise<string>;
24
24
  declare const getBootstrapURL: () => string;
25
- export { bundle, generateStage2, getBootstrapURL };
25
+ export { bundleJS as bundle, generateStage2, getBootstrapURL };
@@ -6,14 +6,6 @@ import del from 'del';
6
6
  import { wrapBundleError } from '../bundle_error.js';
7
7
  import { getFileHash } from '../utils/sha256.js';
8
8
  const BOOTSTRAP_LATEST = 'https://62bae4994570970008142f1e--edge-bootstrap.netlify.app/bootstrap/index-combined.ts';
9
- const bundle = async (options) => {
10
- try {
11
- return await bundleJS(options);
12
- }
13
- catch (error) {
14
- throw wrapBundleError(error, { format: 'javascript' });
15
- }
16
- };
17
9
  const bundleJS = async ({ buildID, debug, deno, distDirectory, functions, importMap, }) => {
18
10
  const stage2Path = await generateStage2({ distDirectory, functions, fileName: `${buildID}-pre.js` });
19
11
  const extension = '.js';
@@ -22,7 +14,12 @@ const bundleJS = async ({ buildID, debug, deno, distDirectory, functions, import
22
14
  if (!debug) {
23
15
  flags.push('--quiet');
24
16
  }
25
- await deno.run(['bundle', ...flags, stage2Path, jsBundlePath], { pipeOutput: true });
17
+ try {
18
+ await deno.run(['bundle', ...flags, stage2Path, jsBundlePath], { pipeOutput: true });
19
+ }
20
+ catch (error) {
21
+ throw wrapBundleError(error, { format: 'javascript' });
22
+ }
26
23
  await fs.unlink(stage2Path);
27
24
  const hash = await getFileHash(jsBundlePath);
28
25
  return { extension, format: 'js', hash };
@@ -80,4 +77,4 @@ const getProductionEntryPoint = (functions) => {
80
77
  const defaultExport = 'boot(functions);';
81
78
  return [bootImport, importLines, exportDeclaration, defaultExport].join('\n\n');
82
79
  };
83
- export { bundle, generateStage2, getBootstrapURL };
80
+ export { bundleJS as bundle, generateStage2, getBootstrapURL };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",