@netlify/edge-bundler 1.5.0 → 1.6.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/deno/bundle.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { writeStage2 } from 'https://62bae4994570970008142f1e--edge-bootstrap.netlify.app/bundler/mod.ts'
1
+ import { writeStage2 } from 'https://62d144a15553b50009af7ac6--edge.netlify.com/bundler/mod.ts'
2
2
 
3
3
  const [payload] = Deno.args
4
- const { basePath, destPath, functions } = JSON.parse(payload)
4
+ const { basePath, destPath, functions, imports } = JSON.parse(payload)
5
5
 
6
- await writeStage2({ basePath, functions, destPath })
6
+ await writeStage2({ basePath, destPath, functions, imports })
package/dist/bridge.d.ts CHANGED
@@ -31,6 +31,7 @@ declare class DenoBridge {
31
31
  private getRemoteBinary;
32
32
  private static runWithBinary;
33
33
  private writeVersionFile;
34
+ ensureCacheDirectory(): Promise<void>;
34
35
  getBinaryPath(): Promise<{
35
36
  global: boolean;
36
37
  path: string;
package/dist/bridge.js CHANGED
@@ -21,7 +21,7 @@ class DenoBridge {
21
21
  async downloadBinary() {
22
22
  var _a, _b, _c;
23
23
  await ((_a = this.onBeforeDownload) === null || _a === void 0 ? void 0 : _a.call(this));
24
- await fs.mkdir(this.cacheDirectory, { recursive: true });
24
+ await this.ensureCacheDirectory();
25
25
  this.log(`Downloading Deno CLI to ${this.cacheDirectory}...`);
26
26
  const binaryPath = await download(this.cacheDirectory, this.versionRange);
27
27
  const downloadedVersion = await DenoBridge.getBinaryVersion(binaryPath);
@@ -92,9 +92,13 @@ class DenoBridge {
92
92
  return runDeno;
93
93
  }
94
94
  async writeVersionFile(version) {
95
+ await this.ensureCacheDirectory();
95
96
  const versionFilePath = path.join(this.cacheDirectory, DENO_VERSION_FILE);
96
97
  await fs.writeFile(versionFilePath, version);
97
98
  }
99
+ async ensureCacheDirectory() {
100
+ await fs.mkdir(this.cacheDirectory, { recursive: true });
101
+ }
98
102
  async getBinaryPath() {
99
103
  const globalPath = await this.getGlobalBinary();
100
104
  if (globalPath !== undefined) {
package/dist/bundler.js CHANGED
@@ -20,6 +20,7 @@ const createBundleOps = ({ basePath, buildID, debug, deno, distDirectory, functi
20
20
  deno,
21
21
  distDirectory,
22
22
  functions,
23
+ importMap,
23
24
  }));
24
25
  }
25
26
  else {
@@ -1,6 +1,7 @@
1
1
  import { DenoBridge } from '../bridge.js';
2
2
  import type { Bundle } from '../bundle.js';
3
3
  import { EdgeFunction } from '../edge_function.js';
4
+ import { ImportMap } from '../import_map.js';
4
5
  interface BundleESZIPOptions {
5
6
  basePath: string;
6
7
  buildID: string;
@@ -8,6 +9,7 @@ interface BundleESZIPOptions {
8
9
  deno: DenoBridge;
9
10
  distDirectory: string;
10
11
  functions: EdgeFunction[];
12
+ importMap: ImportMap;
11
13
  }
12
- declare const bundleESZIP: ({ basePath, buildID, debug, deno, distDirectory, functions, }: BundleESZIPOptions) => Promise<Bundle>;
14
+ declare const bundleESZIP: ({ basePath, buildID, debug, deno, distDirectory, functions, importMap, }: BundleESZIPOptions) => Promise<Bundle>;
13
15
  export { bundleESZIP as bundle };
@@ -2,7 +2,7 @@ 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 bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, functions, }) => {
5
+ const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, functions, importMap, }) => {
6
6
  const extension = '.eszip';
7
7
  const destPath = join(distDirectory, `${buildID}${extension}`);
8
8
  const bundler = getESZIPBundler();
@@ -10,6 +10,7 @@ const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, func
10
10
  basePath,
11
11
  destPath,
12
12
  functions,
13
+ imports: importMap.imports,
13
14
  };
14
15
  const flags = ['--allow-all'];
15
16
  if (!debug) {
@@ -5,7 +5,7 @@ import { pathToFileURL } from 'url';
5
5
  import del from 'del';
6
6
  import { wrapBundleError } from '../bundle_error.js';
7
7
  import { getFileHash } from '../utils/sha256.js';
8
- const BOOTSTRAP_LATEST = 'https://62bae4994570970008142f1e--edge-bootstrap.netlify.app/bootstrap/index-combined.ts';
8
+ const BOOTSTRAP_LATEST = 'https://62d144a15553b50009af7ac6--edge.netlify.com/bootstrap/index-combined.ts';
9
9
  const bundleJS = async ({ buildID, debug, deno, distDirectory, functions, importMap, }) => {
10
10
  const stage2Path = await generateStage2({ distDirectory, functions, fileName: `${buildID}-pre.js` });
11
11
  const extension = '.js';
@@ -2,7 +2,7 @@ import { Buffer } from 'buffer';
2
2
  import { promises as fs } from 'fs';
3
3
  import { dirname } from 'path';
4
4
  const INTERNAL_IMPORTS = {
5
- 'netlify:edge': 'https://edge-bootstrap.netlify.app/v1/index.ts',
5
+ 'netlify:edge': 'https://edge.netlify.com/v1/index.ts',
6
6
  };
7
7
  class ImportMap {
8
8
  constructor(input = []) {
package/dist/types.js CHANGED
@@ -51,6 +51,7 @@ const getRemoteVersion = async (typesURL) => {
51
51
  return version;
52
52
  };
53
53
  const writeVersionFile = async (deno, version) => {
54
+ await deno.ensureCacheDirectory();
54
55
  const versionFilePath = join(deno.cacheDirectory, 'types-version.txt');
55
56
  await fs.writeFile(versionFilePath, version);
56
57
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",