@netlify/edge-bundler 8.15.0 → 8.16.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/lib/stage2.ts +1 -1
- package/dist/node/bridge.d.ts +1 -1
- package/dist/node/bridge.js +1 -1
- package/dist/node/bundler.test.js +26 -0
- package/package.json +1 -1
package/deno/lib/stage2.ts
CHANGED
|
@@ -75,7 +75,7 @@ const stage2Loader = (basePath: string, functions: InputFunction[], externals: S
|
|
|
75
75
|
return inlineModule(specifier, importMapData)
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
if (specifier === PUBLIC_SPECIFIER || externals.has(specifier)) {
|
|
78
|
+
if (specifier === PUBLIC_SPECIFIER || externals.has(specifier) || specifier.startsWith('node:')) {
|
|
79
79
|
return {
|
|
80
80
|
kind: 'external',
|
|
81
81
|
specifier,
|
package/dist/node/bridge.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { ExecaChildProcess } from 'execa';
|
|
3
3
|
import { Logger } from './logger.js';
|
|
4
|
-
declare const DENO_VERSION_RANGE = "^1.
|
|
4
|
+
declare const DENO_VERSION_RANGE = "^1.30.0";
|
|
5
5
|
type OnBeforeDownloadHook = () => void | Promise<void>;
|
|
6
6
|
type OnAfterDownloadHook = (error?: Error) => void | Promise<void>;
|
|
7
7
|
interface DenoOptions {
|
package/dist/node/bridge.js
CHANGED
|
@@ -9,7 +9,7 @@ import { getPathInHome } from './home_path.js';
|
|
|
9
9
|
import { getLogger } from './logger.js';
|
|
10
10
|
import { getBinaryExtension } from './platform.js';
|
|
11
11
|
const DENO_VERSION_FILE = 'version.txt';
|
|
12
|
-
const DENO_VERSION_RANGE = '^1.
|
|
12
|
+
const DENO_VERSION_RANGE = '^1.30.0';
|
|
13
13
|
class DenoBridge {
|
|
14
14
|
constructor(options) {
|
|
15
15
|
var _a, _b, _c, _d, _e;
|
|
@@ -336,3 +336,29 @@ test("Ignores entries in `importMapPaths` that don't point to an existing import
|
|
|
336
336
|
await cleanup();
|
|
337
337
|
await importMap.cleanup();
|
|
338
338
|
});
|
|
339
|
+
test('Handles imports with the `node:` prefix', async () => {
|
|
340
|
+
const { basePath, cleanup, distPath } = await useFixture('imports_node_specifier');
|
|
341
|
+
const userDirectory = join(basePath, 'netlify', 'edge-functions');
|
|
342
|
+
const result = await bundle([userDirectory], distPath, [], {
|
|
343
|
+
basePath,
|
|
344
|
+
importMapPaths: [join(userDirectory, 'import_map.json')],
|
|
345
|
+
});
|
|
346
|
+
const generatedFiles = await readdir(distPath);
|
|
347
|
+
expect(result.functions.length).toBe(1);
|
|
348
|
+
expect(generatedFiles.length).toBe(2);
|
|
349
|
+
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
|
|
350
|
+
const manifest = JSON.parse(manifestFile);
|
|
351
|
+
expect(() => validateManifest(manifest)).not.toThrowError();
|
|
352
|
+
const { bundles, import_map: importMapURL, routes } = manifest;
|
|
353
|
+
expect(bundles.length).toBe(1);
|
|
354
|
+
expect(bundles[0].format).toBe('eszip2');
|
|
355
|
+
expect(generatedFiles.includes(bundles[0].asset)).toBe(true);
|
|
356
|
+
expect(importMapURL).toBe(importMapSpecifier);
|
|
357
|
+
expect(routes.length).toBe(1);
|
|
358
|
+
expect(routes[0].function).toBe('func1');
|
|
359
|
+
expect(routes[0].pattern).toBe('^/func1/?$');
|
|
360
|
+
const bundlePath = join(distPath, bundles[0].asset);
|
|
361
|
+
const { func1 } = await runESZIP(bundlePath);
|
|
362
|
+
expect(func1).toBe('ok');
|
|
363
|
+
await cleanup();
|
|
364
|
+
});
|