@netlify/edge-bundler 5.3.0 → 5.3.2
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.
|
@@ -8,6 +8,7 @@ import { useFixture } from '../test/util.js';
|
|
|
8
8
|
import { BundleError } from './bundle_error.js';
|
|
9
9
|
import { bundle } from './bundler.js';
|
|
10
10
|
import { isNodeError } from './utils/error.js';
|
|
11
|
+
import { validateManifest } from './validation/manifest/index.js';
|
|
11
12
|
test('Produces an ESZIP bundle', async () => {
|
|
12
13
|
const { basePath, cleanup, distPath } = await useFixture('with_import_maps');
|
|
13
14
|
const declarations = [
|
|
@@ -27,6 +28,7 @@ test('Produces an ESZIP bundle', async () => {
|
|
|
27
28
|
expect(generatedFiles.length).toBe(3);
|
|
28
29
|
const manifestFile = await fs.readFile(resolve(distPath, 'manifest.json'), 'utf8');
|
|
29
30
|
const manifest = JSON.parse(manifestFile);
|
|
31
|
+
expect(() => validateManifest(manifest)).not.toThrowError();
|
|
30
32
|
const { bundles, import_map: importMapURL } = manifest;
|
|
31
33
|
expect(bundles.length).toBe(1);
|
|
32
34
|
expect(bundles[0].format).toBe('eszip2');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-nested-callbacks */
|
|
2
1
|
import { test, expect, describe } from 'vitest';
|
|
3
2
|
import { validateManifest, ManifestValidationError } from './index.js';
|
|
4
3
|
// Factory so we have a new object per test
|
|
@@ -113,4 +112,15 @@ describe('layers', () => {
|
|
|
113
112
|
expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
|
-
|
|
115
|
+
describe('import map URL', () => {
|
|
116
|
+
test('should accept string value', () => {
|
|
117
|
+
const manifest = getBaseManifest();
|
|
118
|
+
manifest.import_map = 'file:///root/.netlify/edge-functions-dist/import_map.json';
|
|
119
|
+
expect(() => validateManifest(manifest)).not.toThrowError();
|
|
120
|
+
});
|
|
121
|
+
test('should throw on wrong type', () => {
|
|
122
|
+
const manifest = getBaseManifest();
|
|
123
|
+
manifest.import_map = ['file:///root/.netlify/edge-functions-dist/import_map.json'];
|
|
124
|
+
expect(() => validateManifest(manifest)).toThrowErrorMatchingSnapshot();
|
|
125
|
+
});
|
|
126
|
+
});
|