@netlify/edge-bundler 3.0.0 → 3.0.1
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.
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
|
|
|
2
2
|
import { join, resolve } from 'path';
|
|
3
3
|
import process from 'process';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import
|
|
5
|
+
import { deleteAsync } from 'del';
|
|
6
6
|
import tmp from 'tmp-promise';
|
|
7
7
|
import { test, expect } from 'vitest';
|
|
8
8
|
import { fixturesDir } from '../test/util.js';
|
|
@@ -277,5 +277,5 @@ test('Ignores any user-defined `deno.json` files', async () => {
|
|
|
277
277
|
},
|
|
278
278
|
],
|
|
279
279
|
})).not.toThrow();
|
|
280
|
-
await
|
|
280
|
+
await deleteAsync([tmpDir.path, denoConfigPath, importMapFile.path], { force: true });
|
|
281
281
|
});
|
package/dist/node/config.js
CHANGED
|
@@ -34,6 +34,7 @@ export const getFunctionConfig = async (func, importMap, deno, log) => {
|
|
|
34
34
|
// the exit code to know exactly what happened and guide people accordingly.
|
|
35
35
|
const { exitCode, stderr, stdout } = await deno.run([
|
|
36
36
|
'run',
|
|
37
|
+
'--allow-env',
|
|
37
38
|
'--allow-net',
|
|
38
39
|
'--allow-read',
|
|
39
40
|
`--allow-write=${collector.path}`,
|
package/dist/node/config.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
import { join, resolve } from 'path';
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
|
-
import
|
|
4
|
+
import { deleteAsync } from 'del';
|
|
5
5
|
import { stub } from 'sinon';
|
|
6
6
|
import tmp from 'tmp-promise';
|
|
7
7
|
import { test, expect } from 'vitest';
|
|
@@ -66,7 +66,7 @@ test('`getFunctionConfig` extracts configuration properties from function file',
|
|
|
66
66
|
name: 'func5',
|
|
67
67
|
source: `
|
|
68
68
|
export default async () => new Response("Hello from function two")
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
export const config = () => {
|
|
71
71
|
throw new Error('uh-oh')
|
|
72
72
|
}
|
|
@@ -118,7 +118,7 @@ test('`getFunctionConfig` extracts configuration properties from function file',
|
|
|
118
118
|
expect(logger.user.callCount).toBe(0);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
await
|
|
121
|
+
await deleteAsync(tmpDir, { force: true });
|
|
122
122
|
});
|
|
123
123
|
test('Ignores function paths from the in-source `config` function if the feature flag is off', async () => {
|
|
124
124
|
const userDirectory = resolve(fixturesDir, 'with_config', 'netlify', 'edge-functions');
|
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { env } from 'process';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import
|
|
5
|
+
import { deleteAsync } from 'del';
|
|
6
6
|
import { wrapBundleError } from '../bundle_error.js';
|
|
7
7
|
import { getFileHash } from '../utils/sha256.js';
|
|
8
8
|
const BOOTSTRAP_LATEST = 'https://633ac6453c579c0008ede8d8--edge.netlify.com/bootstrap/index-combined.ts';
|
|
@@ -27,7 +27,7 @@ const bundleJS = async ({ buildID, debug, deno, distDirectory, functions, import
|
|
|
27
27
|
const defaultFormatExportTypeError = (name) => `The Edge Function "${name}" has failed to load. Does it have a function as the default export?`;
|
|
28
28
|
const defaultFormatImpoortError = (name) => `There was an error with Edge Function "${name}".`;
|
|
29
29
|
const generateStage2 = async ({ distDirectory, fileName, formatExportTypeError, formatImportError, functions, type = 'production', }) => {
|
|
30
|
-
await
|
|
30
|
+
await deleteAsync(distDirectory, { force: true });
|
|
31
31
|
await fs.mkdir(distDirectory, { recursive: true });
|
|
32
32
|
const entryPoint = type === 'local'
|
|
33
33
|
? getLocalEntryPoint(functions, { formatExportTypeError, formatImportError })
|
|
@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import process from 'process';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import
|
|
5
|
+
import { deleteAsync } from 'del';
|
|
6
6
|
import { execa } from 'execa';
|
|
7
7
|
import tmp from 'tmp-promise';
|
|
8
8
|
import { test, expect } from 'vitest';
|
|
@@ -43,6 +43,6 @@ test('`getLocalEntryPoint` returns a valid stage 2 file for local development',
|
|
|
43
43
|
expect(responses[func.name]).toBe(func.response);
|
|
44
44
|
expect(metadata.functions[func.name].url).toBe(pathToFileURL(func.path).toString());
|
|
45
45
|
}
|
|
46
|
-
await
|
|
46
|
+
await deleteAsync(tmpDir, { force: true });
|
|
47
47
|
delete process.env.NETLIFY_EDGE_BOOTSTRAP;
|
|
48
48
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Intelligently prepare Netlify Edge Functions for deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"test": "test/node"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@commitlint/cli": "^
|
|
53
|
-
"@commitlint/config-conventional": "^
|
|
52
|
+
"@commitlint/cli": "^17.0.0",
|
|
53
|
+
"@commitlint/config-conventional": "^17.0.0",
|
|
54
54
|
"@netlify/eslint-config-node": "^4.1.7",
|
|
55
55
|
"@types/glob-to-regexp": "^0.4.1",
|
|
56
56
|
"@types/node": "^14.18.32",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@import-maps/resolve": "^1.0.1",
|
|
75
75
|
"common-path-prefix": "^3.0.0",
|
|
76
|
-
"del": "^
|
|
76
|
+
"del": "^7.0.0",
|
|
77
77
|
"env-paths": "^3.0.0",
|
|
78
78
|
"execa": "^6.0.0",
|
|
79
79
|
"find-up": "^6.3.0",
|