@netlify/edge-bundler 0.12.0 → 1.0.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/formats/javascript.js +1 -1
- package/dist/server/server.d.ts +2 -1
- package/dist/server/server.js +15 -4
- package/package.json +1 -1
package/deno/bundle.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeStage2 } from 'https://
|
|
1
|
+
import { writeStage2 } from 'https://6270f39aacac8b000a2f84f4--edge-bootstrap.netlify.app/bundler/mod.ts'
|
|
2
2
|
|
|
3
3
|
const [payload] = Deno.args
|
|
4
4
|
const { basePath, destPath, functions } = JSON.parse(payload)
|
|
@@ -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://6270f39aacac8b000a2f84f4--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
|
@@ -3,6 +3,7 @@ import type { EdgeFunction } from '../edge_function.js';
|
|
|
3
3
|
import { ImportMapFile } from '../import_map.js';
|
|
4
4
|
declare type FormatFunction = (name: string) => string;
|
|
5
5
|
interface ServeOptions {
|
|
6
|
+
certificatePath?: string;
|
|
6
7
|
debug?: boolean;
|
|
7
8
|
distImportMapPath?: string;
|
|
8
9
|
importMaps?: ImportMapFile[];
|
|
@@ -12,7 +13,7 @@ interface ServeOptions {
|
|
|
12
13
|
formatImportError?: FormatFunction;
|
|
13
14
|
port: number;
|
|
14
15
|
}
|
|
15
|
-
declare const serve: ({ debug, distImportMapPath, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[]) => Promise<{
|
|
16
|
+
declare const serve: ({ certificatePath, debug, distImportMapPath, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }: ServeOptions) => Promise<(newFunctions: EdgeFunction[]) => Promise<{
|
|
16
17
|
graph: any;
|
|
17
18
|
success: boolean;
|
|
18
19
|
}>>;
|
package/dist/server/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DenoBridge } from '../bridge.js';
|
|
|
3
3
|
import { generateStage2 } from '../formats/javascript.js';
|
|
4
4
|
import { ImportMap } from '../import_map.js';
|
|
5
5
|
import { killProcess, waitForServer } from './util.js';
|
|
6
|
-
const prepareServer = ({ deno, distDirectory, flags, formatExportTypeError, formatImportError, port, }) => {
|
|
6
|
+
const prepareServer = ({ deno, distDirectory, flags: denoFlags, formatExportTypeError, formatImportError, port, }) => {
|
|
7
7
|
const processRef = {};
|
|
8
8
|
const startIsolate = async (newFunctions) => {
|
|
9
9
|
if ((processRef === null || processRef === void 0 ? void 0 : processRef.ps) !== undefined) {
|
|
@@ -29,7 +29,8 @@ const prepareServer = ({ deno, distDirectory, flags, formatExportTypeError, form
|
|
|
29
29
|
catch {
|
|
30
30
|
// no-op
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
const bootstrapFlags = ['--port', port.toString()];
|
|
33
|
+
await deno.runInBackground(['run', ...denoFlags, stage2Path, ...bootstrapFlags], true, processRef);
|
|
33
34
|
const success = await waitForServer(port, processRef.ps);
|
|
34
35
|
return {
|
|
35
36
|
graph,
|
|
@@ -38,7 +39,7 @@ const prepareServer = ({ deno, distDirectory, flags, formatExportTypeError, form
|
|
|
38
39
|
};
|
|
39
40
|
return startIsolate;
|
|
40
41
|
};
|
|
41
|
-
const serve = async ({ debug, distImportMapPath, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }) => {
|
|
42
|
+
const serve = async ({ certificatePath, debug, distImportMapPath, formatExportTypeError, formatImportError, importMaps, onAfterDownload, onBeforeDownload, port, }) => {
|
|
42
43
|
const deno = new DenoBridge({
|
|
43
44
|
debug,
|
|
44
45
|
onAfterDownload,
|
|
@@ -53,13 +54,23 @@ const serve = async ({ debug, distImportMapPath, formatExportTypeError, formatIm
|
|
|
53
54
|
// if any.
|
|
54
55
|
const importMap = new ImportMap(importMaps);
|
|
55
56
|
const flags = ['--allow-all', '--unstable', `--import-map=${importMap.toDataURL()}`];
|
|
57
|
+
if (certificatePath) {
|
|
58
|
+
flags.push(`--cert=${certificatePath}`);
|
|
59
|
+
}
|
|
56
60
|
if (debug) {
|
|
57
61
|
flags.push('--log-level=debug');
|
|
58
62
|
}
|
|
59
63
|
else {
|
|
60
64
|
flags.push('--quiet');
|
|
61
65
|
}
|
|
62
|
-
const server = await prepareServer({
|
|
66
|
+
const server = await prepareServer({
|
|
67
|
+
deno,
|
|
68
|
+
distDirectory,
|
|
69
|
+
flags,
|
|
70
|
+
formatExportTypeError,
|
|
71
|
+
formatImportError,
|
|
72
|
+
port,
|
|
73
|
+
});
|
|
63
74
|
if (distImportMapPath) {
|
|
64
75
|
await importMap.writeToFile(distImportMapPath);
|
|
65
76
|
}
|