@netlify/edge-bundler 14.6.0 → 14.7.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/vendor/deno.land/x/eszip@v0.55.2/eszip.ts +5 -2
- package/dist/node/bridge.d.ts +1 -1
- package/dist/node/bridge.js +4 -2
- package/dist/node/bundler.js +3 -2
- package/dist/node/bundler.test.js +3 -0
- package/dist/node/feature_flags.d.ts +2 -0
- package/dist/node/feature_flags.js +1 -0
- package/package.json +2 -2
|
@@ -107,8 +107,11 @@ export async function loadESZIP(filename: string): Promise<ESZIP> {
|
|
|
107
107
|
return await V1.load(bytes);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function url2path(
|
|
111
|
-
|
|
110
|
+
function url2path(urlString: string) {
|
|
111
|
+
const url = new URL(urlString);
|
|
112
|
+
const tail = url.pathname.split("/").filter(Boolean);
|
|
113
|
+
const relativePath = tail.length === 0 ? [".root"] : tail;
|
|
114
|
+
return join(url.hostname, ...relativePath);
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
async function write(path: string, content: string) {
|
package/dist/node/bridge.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type WriteStream } from 'fs';
|
|
|
2
2
|
import { type ExecaChildProcess } from 'execa';
|
|
3
3
|
import { FeatureFlags } from './feature_flags.js';
|
|
4
4
|
import { Logger } from './logger.js';
|
|
5
|
-
export declare const DENO_VERSION_RANGE = "
|
|
5
|
+
export declare const DENO_VERSION_RANGE = "1.39.0 - 2.2.4";
|
|
6
6
|
export type OnBeforeDownloadHook = () => void | Promise<void>;
|
|
7
7
|
export type OnAfterDownloadHook = (error?: Error) => void | Promise<void>;
|
|
8
8
|
export interface DenoOptions {
|
package/dist/node/bridge.js
CHANGED
|
@@ -12,7 +12,8 @@ const DENO_VERSION_FILE = 'version.txt';
|
|
|
12
12
|
// When updating DENO_VERSION_RANGE, ensure that the deno version
|
|
13
13
|
// on the netlify/buildbot build image satisfies this range!
|
|
14
14
|
// https://github.com/netlify/buildbot/blob/f9c03c9dcb091d6570e9d0778381560d469e78ad/build-image/noble/Dockerfile#L410
|
|
15
|
-
export const DENO_VERSION_RANGE = '
|
|
15
|
+
export const DENO_VERSION_RANGE = '1.39.0 - 2.2.4';
|
|
16
|
+
const NEXT_DENO_VERSION_RANGE = '^2.4.2';
|
|
16
17
|
export class DenoBridge {
|
|
17
18
|
cacheDirectory;
|
|
18
19
|
currentDownload;
|
|
@@ -31,7 +32,8 @@ export class DenoBridge {
|
|
|
31
32
|
this.onAfterDownload = options.onAfterDownload;
|
|
32
33
|
this.onBeforeDownload = options.onBeforeDownload;
|
|
33
34
|
this.useGlobal = options.useGlobal ?? true;
|
|
34
|
-
|
|
35
|
+
const useNextDeno = options.featureFlags?.edge_bundler_generate_tarball || options.featureFlags?.edge_bundler_deno_v2;
|
|
36
|
+
this.versionRange = options.versionRange ?? (useNextDeno ? NEXT_DENO_VERSION_RANGE : DENO_VERSION_RANGE);
|
|
35
37
|
}
|
|
36
38
|
async downloadBinary() {
|
|
37
39
|
await this.onBeforeDownload?.();
|
package/dist/node/bundler.js
CHANGED
|
@@ -98,6 +98,7 @@ export const bundle = async (sourceDirectories, distDirectory, tomlDeclarations
|
|
|
98
98
|
basePath,
|
|
99
99
|
deno,
|
|
100
100
|
eszipPath,
|
|
101
|
+
featureFlags,
|
|
101
102
|
importMap,
|
|
102
103
|
internalFunctions,
|
|
103
104
|
log: logger,
|
|
@@ -127,7 +128,7 @@ export const bundle = async (sourceDirectories, distDirectory, tomlDeclarations
|
|
|
127
128
|
}
|
|
128
129
|
return { functions, manifest };
|
|
129
130
|
};
|
|
130
|
-
const getFunctionConfigs = async ({ basePath, deno, eszipPath, importMap, log, internalFunctions, userFunctions, }) => {
|
|
131
|
+
const getFunctionConfigs = async ({ basePath, deno, eszipPath, featureFlags, importMap, log, internalFunctions, userFunctions, }) => {
|
|
131
132
|
try {
|
|
132
133
|
const internalConfigPromises = internalFunctions.map(async (func) => [func.name, await getFunctionConfig({ functionPath: func.path, importMap, deno, log })]);
|
|
133
134
|
const userConfigPromises = userFunctions.map(async (func) => [func.name, await getFunctionConfig({ functionPath: func.path, importMap, deno, log })]);
|
|
@@ -140,7 +141,7 @@ const getFunctionConfigs = async ({ basePath, deno, eszipPath, importMap, log, i
|
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
143
|
catch (err) {
|
|
143
|
-
if (!(err instanceof Error && err.cause === 'IMPORT_ASSERT') || !eszipPath) {
|
|
144
|
+
if (!(err instanceof Error && err.cause === 'IMPORT_ASSERT') || !eszipPath || !featureFlags?.edge_bundler_deno_v2) {
|
|
144
145
|
throw err;
|
|
145
146
|
}
|
|
146
147
|
// We failed to extract the configuration because there is an import assert
|
|
@@ -505,6 +505,9 @@ test('Emits a system log when import assertions are used', async () => {
|
|
|
505
505
|
const systemLogger = vi.fn();
|
|
506
506
|
await bundle([sourceDirectory], distPath, [], {
|
|
507
507
|
basePath,
|
|
508
|
+
featureFlags: {
|
|
509
|
+
edge_bundler_deno_v2: true,
|
|
510
|
+
},
|
|
508
511
|
systemLogger,
|
|
509
512
|
vendorDirectory: vendorDirectory.path,
|
|
510
513
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
declare const defaultFlags: {
|
|
2
2
|
edge_bundler_generate_tarball: boolean;
|
|
3
|
+
edge_bundler_deno_v2: boolean;
|
|
3
4
|
};
|
|
4
5
|
type FeatureFlag = keyof typeof defaultFlags;
|
|
5
6
|
type FeatureFlags = Partial<Record<FeatureFlag, boolean>>;
|
|
6
7
|
declare const getFlags: (input?: Record<string, boolean>, flags?: {
|
|
7
8
|
edge_bundler_generate_tarball: boolean;
|
|
9
|
+
edge_bundler_deno_v2: boolean;
|
|
8
10
|
}) => FeatureFlags;
|
|
9
11
|
export { defaultFlags, getFlags };
|
|
10
12
|
export type { FeatureFlag, FeatureFlags };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.7.0",
|
|
4
4
|
"description": "Intelligently prepare Netlify Edge Functions for deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.js",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"urlpattern-polyfill": "8.0.2",
|
|
81
81
|
"uuid": "^11.0.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "ff114da3f2bcb5bea83bb4a3747201192aecfec0"
|
|
84
84
|
}
|