@netlify/edge-bundler 1.6.0 → 1.7.0

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.
package/dist/bundler.d.ts CHANGED
@@ -4,6 +4,7 @@ import { EdgeFunction } from './edge_function.js';
4
4
  import { FeatureFlags } from './feature_flags.js';
5
5
  import { ImportMapFile } from './import_map.js';
6
6
  interface BundleOptions {
7
+ basePath?: string;
7
8
  cacheDirectory?: string;
8
9
  debug?: boolean;
9
10
  distImportMapPath?: string;
@@ -12,7 +13,7 @@ interface BundleOptions {
12
13
  onAfterDownload?: OnAfterDownloadHook;
13
14
  onBeforeDownload?: OnBeforeDownloadHook;
14
15
  }
15
- declare const bundle: (sourceDirectories: string[], distDirectory: string, declarations?: Declaration[], { cacheDirectory, debug, distImportMapPath, featureFlags: inputFeatureFlags, importMaps, onAfterDownload, onBeforeDownload, }?: BundleOptions) => Promise<{
16
+ declare const bundle: (sourceDirectories: string[], distDirectory: string, declarations?: Declaration[], { basePath: inputBasePath, cacheDirectory, debug, distImportMapPath, featureFlags: inputFeatureFlags, importMaps, onAfterDownload, onBeforeDownload, }?: BundleOptions) => Promise<{
16
17
  functions: EdgeFunction[];
17
18
  manifest: import("./manifest.js").Manifest;
18
19
  }>;
package/dist/bundler.js CHANGED
@@ -35,7 +35,7 @@ const createBundleOps = ({ basePath, buildID, debug, deno, distDirectory, functi
35
35
  }
36
36
  return bundleOps;
37
37
  };
38
- const bundle = async (sourceDirectories, distDirectory, declarations = [], { cacheDirectory, debug, distImportMapPath, featureFlags: inputFeatureFlags, importMaps, onAfterDownload, onBeforeDownload, } = {}) => {
38
+ const bundle = async (sourceDirectories, distDirectory, declarations = [], { basePath: inputBasePath, cacheDirectory, debug, distImportMapPath, featureFlags: inputFeatureFlags, importMaps, onAfterDownload, onBeforeDownload, } = {}) => {
39
39
  const featureFlags = getFlags(inputFeatureFlags);
40
40
  const deno = new DenoBridge({
41
41
  debug,
@@ -43,7 +43,7 @@ const bundle = async (sourceDirectories, distDirectory, declarations = [], { cac
43
43
  onAfterDownload,
44
44
  onBeforeDownload,
45
45
  });
46
- const basePath = getBasePath(sourceDirectories);
46
+ const basePath = getBasePath(sourceDirectories, inputBasePath);
47
47
  await ensureLatestTypes(deno);
48
48
  // The name of the bundle will be the hash of its contents, which we can't
49
49
  // compute until we run the bundle process. For now, we'll use a random ID
@@ -87,7 +87,11 @@ const createFinalBundles = async (bundles, distDirectory, buildID) => {
87
87
  });
88
88
  await Promise.all(renamingOps);
89
89
  };
90
- const getBasePath = (sourceDirectories) => {
90
+ const getBasePath = (sourceDirectories, inputBasePath) => {
91
+ // If there's a specific base path supplied, that takes precedence.
92
+ if (inputBasePath !== undefined) {
93
+ return inputBasePath;
94
+ }
91
95
  // `common-path-prefix` returns an empty string when called with a single
92
96
  // path, so we check for that case and return the path itself instead.
93
97
  if (sourceDirectories.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",