@netlify/edge-bundler 1.1.0 → 1.3.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 +1 -1
- package/dist/bundler.js +10 -8
- package/dist/formats/javascript.js +1 -1
- package/dist/server/server.d.ts +7 -1
- package/dist/server/server.js +16 -2
- package/dist/server/util.d.ts +1 -1
- package/package.json +4 -4
package/deno/bundle.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeStage2 } from 'https://
|
|
1
|
+
import { writeStage2 } from 'https://62ac9c589c16c50008b6ef55--edge-bootstrap.netlify.app/bundler/mod.ts'
|
|
2
2
|
|
|
3
3
|
const [payload] = Deno.args
|
|
4
4
|
const { basePath, destPath, functions } = JSON.parse(payload)
|
package/dist/bundler.js
CHANGED
|
@@ -9,6 +9,7 @@ import { bundle as bundleESZIP } from './formats/eszip.js';
|
|
|
9
9
|
import { bundle as bundleJS } from './formats/javascript.js';
|
|
10
10
|
import { ImportMap } from './import_map.js';
|
|
11
11
|
import { writeManifest } from './manifest.js';
|
|
12
|
+
// eslint-disable-next-line max-statements
|
|
12
13
|
const bundle = async (sourceDirectories, distDirectory, declarations = [], { cacheDirectory, debug, distImportMapPath, featureFlags: inputFeatureFlags, importMaps, onAfterDownload, onBeforeDownload, } = {}) => {
|
|
13
14
|
const featureFlags = getFlags(inputFeatureFlags);
|
|
14
15
|
const deno = new DenoBridge({
|
|
@@ -26,24 +27,25 @@ const bundle = async (sourceDirectories, distDirectory, declarations = [], { cac
|
|
|
26
27
|
// if any.
|
|
27
28
|
const importMap = new ImportMap(importMaps);
|
|
28
29
|
const functions = await findFunctions(sourceDirectories);
|
|
29
|
-
const bundleOps = [
|
|
30
|
-
|
|
30
|
+
const bundleOps = [];
|
|
31
|
+
if (featureFlags.edge_functions_produce_eszip) {
|
|
32
|
+
bundleOps.push(bundleESZIP({
|
|
33
|
+
basePath,
|
|
31
34
|
buildID,
|
|
32
35
|
debug,
|
|
33
36
|
deno,
|
|
34
37
|
distDirectory,
|
|
35
38
|
functions,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
bundleOps.push(bundleESZIP({
|
|
41
|
-
basePath,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
bundleOps.push(bundleJS({
|
|
42
43
|
buildID,
|
|
43
44
|
debug,
|
|
44
45
|
deno,
|
|
45
46
|
distDirectory,
|
|
46
47
|
functions,
|
|
48
|
+
importMap,
|
|
47
49
|
}));
|
|
48
50
|
}
|
|
49
51
|
const bundles = await Promise.all(bundleOps);
|
|
@@ -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://62ac9c589c16c50008b6ef55--edge-bootstrap.netlify.app/bootstrap/index-combined.ts';
|
|
9
9
|
const bundle = async (options) => {
|
|
10
10
|
try {
|
|
11
11
|
return await bundleJS(options);
|
package/dist/server/server.d.ts
CHANGED
|
@@ -2,10 +2,16 @@ import { LifecycleHook } from '../bridge.js';
|
|
|
2
2
|
import type { EdgeFunction } from '../edge_function.js';
|
|
3
3
|
import { ImportMapFile } from '../import_map.js';
|
|
4
4
|
declare type FormatFunction = (name: string) => string;
|
|
5
|
+
interface InspectSettings {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
pause: boolean;
|
|
8
|
+
address?: string;
|
|
9
|
+
}
|
|
5
10
|
interface ServeOptions {
|
|
6
11
|
certificatePath?: string;
|
|
7
12
|
debug?: boolean;
|
|
8
13
|
distImportMapPath?: string;
|
|
14
|
+
inspectSettings?: InspectSettings;
|
|
9
15
|
importMaps?: ImportMapFile[];
|
|
10
16
|
onAfterDownload?: LifecycleHook;
|
|
11
17
|
onBeforeDownload?: LifecycleHook;
|
|
@@ -13,7 +19,7 @@ interface ServeOptions {
|
|
|
13
19
|
formatImportError?: FormatFunction;
|
|
14
20
|
port: number;
|
|
15
21
|
}
|
|
16
|
-
declare const serve: ({ certificatePath, debug, distImportMapPath, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[]) => Promise<{
|
|
22
|
+
declare const serve: ({ certificatePath, debug, distImportMapPath, inspectSettings, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[]) => Promise<{
|
|
17
23
|
graph: any;
|
|
18
24
|
success: boolean;
|
|
19
25
|
}>>;
|
package/dist/server/server.js
CHANGED
|
@@ -39,7 +39,8 @@ const prepareServer = ({ deno, distDirectory, flags: denoFlags, formatExportType
|
|
|
39
39
|
};
|
|
40
40
|
return startIsolate;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
// eslint-disable-next-line complexity, max-statements
|
|
43
|
+
const serve = async ({ certificatePath, debug, distImportMapPath, inspectSettings, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }) => {
|
|
43
44
|
const deno = new DenoBridge({
|
|
44
45
|
debug,
|
|
45
46
|
onAfterDownload,
|
|
@@ -53,7 +54,12 @@ const serve = async ({ certificatePath, debug, distImportMapPath, formatExportTy
|
|
|
53
54
|
// Creating an ImportMap instance with any import maps supplied by the user,
|
|
54
55
|
// if any.
|
|
55
56
|
const importMap = new ImportMap(importMaps);
|
|
56
|
-
const flags = [
|
|
57
|
+
const flags = [
|
|
58
|
+
'--allow-all',
|
|
59
|
+
'--unstable',
|
|
60
|
+
`--import-map=${importMap.toDataURL()}`,
|
|
61
|
+
'--v8-flags=--disallow-code-generation-from-strings',
|
|
62
|
+
];
|
|
57
63
|
if (certificatePath) {
|
|
58
64
|
flags.push(`--cert=${certificatePath}`);
|
|
59
65
|
}
|
|
@@ -63,6 +69,14 @@ const serve = async ({ certificatePath, debug, distImportMapPath, formatExportTy
|
|
|
63
69
|
else {
|
|
64
70
|
flags.push('--quiet');
|
|
65
71
|
}
|
|
72
|
+
if (inspectSettings && inspectSettings.enabled) {
|
|
73
|
+
if (inspectSettings.pause) {
|
|
74
|
+
flags.push(inspectSettings.address ? `--inspect-brk=${inspectSettings.address}` : '--inspect-brk');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
flags.push(inspectSettings.address ? `--inspect=${inspectSettings.address}` : '--inspect');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
66
80
|
const server = await prepareServer({
|
|
67
81
|
deno,
|
|
68
82
|
distDirectory,
|
package/dist/server/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ExecaChildProcess } from 'execa';
|
|
2
2
|
declare const killProcess: (ps: ExecaChildProcess<string>) => Promise<unknown> | undefined;
|
|
3
|
-
declare const waitForServer: (port: number, ps?: ExecaChildProcess<string>
|
|
3
|
+
declare const waitForServer: (port: number, ps?: ExecaChildProcess<string>) => Promise<boolean>;
|
|
4
4
|
export { killProcess, waitForServer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Intelligently prepare Netlify Edge Functions for deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"keywords": [],
|
|
50
50
|
"license": "MIT",
|
|
51
|
-
"repository": "netlify
|
|
51
|
+
"repository": "netlify/edge-bundler",
|
|
52
52
|
"bugs": {
|
|
53
|
-
"url": "https://github.com/netlify
|
|
53
|
+
"url": "https://github.com/netlify/edge-bundler/issues"
|
|
54
54
|
},
|
|
55
55
|
"author": "Netlify Inc.",
|
|
56
56
|
"directories": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"husky": "^7.0.4",
|
|
72
72
|
"nock": "^13.2.4",
|
|
73
73
|
"nyc": "^15.0.0",
|
|
74
|
-
"sinon": "^
|
|
74
|
+
"sinon": "^13.0.0",
|
|
75
75
|
"ts-node": "^10.4.0",
|
|
76
76
|
"typescript": "^4.5.4"
|
|
77
77
|
},
|