@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 +3 -3
- package/dist/bridge.d.ts +1 -0
- package/dist/bridge.js +5 -1
- package/dist/bundler.js +1 -0
- package/dist/formats/eszip.d.ts +3 -1
- package/dist/formats/eszip.js +2 -1
- package/dist/formats/javascript.js +1 -1
- package/dist/import_map.js +1 -1
- package/dist/types.js +1 -0
- package/package.json +1 -1
package/deno/bundle.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { writeStage2 } from 'https://
|
|
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,
|
|
6
|
+
await writeStage2({ basePath, destPath, functions, imports })
|
package/dist/bridge.d.ts
CHANGED
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
|
|
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
package/dist/formats/eszip.d.ts
CHANGED
|
@@ -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 };
|
package/dist/formats/eszip.js
CHANGED
|
@@ -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://
|
|
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';
|
package/dist/import_map.js
CHANGED
|
@@ -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
|
|
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
|
};
|