@netlify/edge-bundler 14.0.4 → 14.0.6
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/node/downloader.js +2 -2
- package/dist/node/downloader.test.js +2 -2
- package/dist/node/npm_dependencies.js +1 -1
- package/dist/node/server/server.test.js +0 -1
- package/dist/node/server/util.js +0 -1
- package/dist/node/types.js +0 -1
- package/package.json +10 -10
- package/deno/lib/stage2.test.ts +0 -58
package/dist/node/downloader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createWriteStream, promises as fs } from 'fs';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import { promisify } from 'util';
|
|
4
|
-
import fetch from 'node-fetch';
|
|
5
5
|
import StreamZip from 'node-stream-zip';
|
|
6
6
|
import pRetry from 'p-retry';
|
|
7
7
|
import semver from 'semver';
|
|
@@ -45,7 +45,7 @@ const downloadVersion = async (versionRange) => {
|
|
|
45
45
|
if (res.body === null || res.status < 200 || res.status > 299) {
|
|
46
46
|
throw new Error(`Download failed with status code ${res.status}`);
|
|
47
47
|
}
|
|
48
|
-
return res.body;
|
|
48
|
+
return Readable.from(res.body);
|
|
49
49
|
};
|
|
50
50
|
const extractBinaryFromZip = async (zipPath, binaryPath, binaryName) => {
|
|
51
51
|
const { async: StreamZipAsync } = StreamZip;
|
|
@@ -88,7 +88,7 @@ test('fails downloading binary after 4th time', async (ctx) => {
|
|
|
88
88
|
await download(ctx.tmpDir, `^${version}`, testLogger);
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
|
-
expect(error).toMatch(/Download failed with status code 500/);
|
|
91
|
+
expect(error.message).toMatch(/Download failed with status code 500/);
|
|
92
92
|
}
|
|
93
93
|
expect(latestVersionMock.isDone()).toBe(true);
|
|
94
94
|
});
|
|
@@ -118,7 +118,7 @@ test('fails downloading if response stream throws error', async (ctx) => {
|
|
|
118
118
|
await download(ctx.tmpDir, `^${version}`, testLogger);
|
|
119
119
|
}
|
|
120
120
|
catch (error) {
|
|
121
|
-
expect(error).toMatch(/stream error/);
|
|
121
|
+
expect(error.message).toMatch(/stream error/);
|
|
122
122
|
}
|
|
123
123
|
expect(latestVersionMock.isDone()).toBe(true);
|
|
124
124
|
});
|
|
@@ -152,7 +152,7 @@ const getNPMSpecifiers = async ({ basePath, functions, importMap, environment, r
|
|
|
152
152
|
}
|
|
153
153
|
const { matched, resolvedImport } = resolve(specifier, importMap, baseURL);
|
|
154
154
|
if (matched) {
|
|
155
|
-
if (resolvedImport.protocol === 'file:') {
|
|
155
|
+
if ((resolvedImport === null || resolvedImport === void 0 ? void 0 : resolvedImport.protocol) === 'file:') {
|
|
156
156
|
const newSpecifier = fileURLToPath(resolvedImport).replace(/\\/g, '/');
|
|
157
157
|
if (alreadySeenPaths.has(newSpecifier)) {
|
|
158
158
|
break;
|
|
@@ -3,7 +3,6 @@ import { readFile } from 'fs/promises';
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import process from 'process';
|
|
5
5
|
import getPort from 'get-port';
|
|
6
|
-
import fetch from 'node-fetch';
|
|
7
6
|
import tmp from 'tmp-promise';
|
|
8
7
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
8
|
import { test, expect } from 'vitest';
|
package/dist/node/server/util.js
CHANGED
package/dist/node/types.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import fetch from 'node-fetch';
|
|
4
3
|
const TYPES_URL = 'https://edge.netlify.com';
|
|
5
4
|
const ensureLatestTypes = async (deno, logger, customTypesURL) => {
|
|
6
5
|
const typesURL = customTypesURL !== null && customTypesURL !== void 0 ? customTypesURL : TYPES_URL;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.6",
|
|
4
4
|
"description": "Intelligently prepare Netlify Edge Functions for deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.js",
|
|
@@ -42,34 +42,34 @@
|
|
|
42
42
|
"test": "test/node"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^
|
|
45
|
+
"@types/node": "^18.0.0",
|
|
46
46
|
"@types/semver": "^7.3.9",
|
|
47
47
|
"@types/uuid": "^10.0.0",
|
|
48
|
-
"@vitest/coverage-v8": "^0.
|
|
48
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
49
49
|
"archiver": "^7.0.0",
|
|
50
50
|
"chalk": "^5.4.0",
|
|
51
|
-
"nock": "^
|
|
52
|
-
"
|
|
51
|
+
"nock": "^14.0.0",
|
|
52
|
+
"npm-run-all2": "^6.0.0",
|
|
53
|
+
"tar": "^7.0.0",
|
|
53
54
|
"typescript": "^5.0.0",
|
|
54
|
-
"vitest": "^0.
|
|
55
|
+
"vitest": "^3.0.0"
|
|
55
56
|
},
|
|
56
57
|
"engines": {
|
|
57
58
|
"node": ">=18.14.0"
|
|
58
59
|
},
|
|
59
60
|
"dependencies": {
|
|
60
|
-
"@import-maps/resolve": "^
|
|
61
|
+
"@import-maps/resolve": "^2.0.0",
|
|
61
62
|
"ajv": "^8.11.2",
|
|
62
63
|
"ajv-errors": "^3.0.0",
|
|
63
64
|
"better-ajv-errors": "^1.2.0",
|
|
64
65
|
"common-path-prefix": "^3.0.0",
|
|
65
66
|
"env-paths": "^3.0.0",
|
|
66
|
-
"esbuild": "0.25.
|
|
67
|
+
"esbuild": "0.25.5",
|
|
67
68
|
"execa": "^8.0.0",
|
|
68
69
|
"find-up": "^7.0.0",
|
|
69
70
|
"get-package-name": "^2.2.0",
|
|
70
71
|
"get-port": "^7.0.0",
|
|
71
72
|
"is-path-inside": "^4.0.0",
|
|
72
|
-
"node-fetch": "^3.1.1",
|
|
73
73
|
"node-stream-zip": "^1.15.0",
|
|
74
74
|
"p-retry": "^6.0.0",
|
|
75
75
|
"p-wait-for": "^5.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"urlpattern-polyfill": "8.0.2",
|
|
81
81
|
"uuid": "^11.0.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "4a0f587ae4efe1c2e62c25c11374e3fbaa9aebce"
|
|
84
84
|
}
|
package/deno/lib/stage2.test.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { assertEquals, assertStringIncludes } from 'https://deno.land/std@0.177.0/testing/asserts.ts'
|
|
2
|
-
|
|
3
|
-
import { join } from 'https://deno.land/std@0.177.0/path/mod.ts'
|
|
4
|
-
import { pathToFileURL } from 'https://deno.land/std@0.177.0/node/url.ts'
|
|
5
|
-
|
|
6
|
-
import { getStage2Entry } from './stage2.ts'
|
|
7
|
-
import { virtualRoot } from './consts.ts'
|
|
8
|
-
|
|
9
|
-
Deno.test('`getStage2Entry` returns a valid stage 2 file', async () => {
|
|
10
|
-
const directory = await Deno.makeTempDir()
|
|
11
|
-
const functions = [
|
|
12
|
-
{
|
|
13
|
-
name: 'func1',
|
|
14
|
-
path: join(directory, 'func1.ts'),
|
|
15
|
-
response: 'Hello from function 1',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: 'func2',
|
|
19
|
-
path: join(directory, 'func2.ts'),
|
|
20
|
-
response: 'Hello from function 2',
|
|
21
|
-
},
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
for (const func of functions) {
|
|
25
|
-
const contents = `export default async () => new Response(${JSON.stringify(func.response)})`
|
|
26
|
-
|
|
27
|
-
await Deno.writeTextFile(func.path, contents)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const baseURL = pathToFileURL(directory)
|
|
31
|
-
const stage2 = getStage2Entry(
|
|
32
|
-
directory,
|
|
33
|
-
functions.map(({ name, path }) => ({ name, path })),
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
// Ensuring that the stage 2 paths have the virtual root before we strip it.
|
|
37
|
-
assertStringIncludes(stage2, virtualRoot)
|
|
38
|
-
|
|
39
|
-
// Replacing the virtual root with the URL of the temporary directory so that
|
|
40
|
-
// we can actually import the module.
|
|
41
|
-
const normalizedStage2 = stage2.replaceAll(virtualRoot, `${baseURL.href}/`)
|
|
42
|
-
|
|
43
|
-
const stage2Path = join(directory, 'stage2.ts')
|
|
44
|
-
const stage2URL = pathToFileURL(stage2Path)
|
|
45
|
-
|
|
46
|
-
await Deno.writeTextFile(stage2Path, normalizedStage2)
|
|
47
|
-
|
|
48
|
-
const mod = await import(stage2URL.href)
|
|
49
|
-
|
|
50
|
-
await Deno.remove(directory, { recursive: true })
|
|
51
|
-
|
|
52
|
-
for (const func of functions) {
|
|
53
|
-
const result = await mod.functions[func.name]()
|
|
54
|
-
|
|
55
|
-
assertEquals(await result.text(), func.response)
|
|
56
|
-
assertEquals(mod.metadata.functions[func.name].url, pathToFileURL(func.path).toString())
|
|
57
|
-
}
|
|
58
|
-
})
|