@netlify/edge-bundler 15.0.3 → 15.1.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/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Edge Bundler
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Prepare Netlify Edge Functions for deployment
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -46,5 +46,5 @@ This will go away soon as we move away from the ESZIP format.
|
|
|
46
46
|
|
|
47
47
|
## Contributors
|
|
48
48
|
|
|
49
|
-
Please see [CONTRIBUTING.md](
|
|
50
|
-
|
|
49
|
+
Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for instructions on how to set up and work on this repository. Thanks for
|
|
50
|
+
contributing!
|
|
@@ -187,6 +187,7 @@ async function getRequiredSourceFiles(deno, entryPoints, importMap) {
|
|
|
187
187
|
if (!module.specifier.startsWith('file://')) {
|
|
188
188
|
continue;
|
|
189
189
|
}
|
|
190
|
+
const filePath = fileURLToPath(module.specifier);
|
|
190
191
|
if (module.error) {
|
|
191
192
|
// A module reachable only through type-only edges (e.g. a directory specifier
|
|
192
193
|
// behind `import type`) can fail to resolve as an ES module. That's safe to
|
|
@@ -200,12 +201,32 @@ async function getRequiredSourceFiles(deno, entryPoints, importMap) {
|
|
|
200
201
|
// require in try/catch).
|
|
201
202
|
continue;
|
|
202
203
|
}
|
|
204
|
+
// Importing a directory is unsupported in Deno (ERR_UNSUPPORTED_DIR_IMPORT), yet
|
|
205
|
+
// the directory still surfaces here as an errored module. It's not a bundleable
|
|
206
|
+
// file: including it would pollute the common path prefix and, once copied, throw
|
|
207
|
+
// EISDIR. Skip it.
|
|
208
|
+
if (await isDirectory(filePath)) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
203
211
|
}
|
|
204
|
-
localFiles.add(
|
|
212
|
+
localFiles.add(filePath);
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
return localFiles;
|
|
208
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Returns whether the given path exists and is a directory. Used to filter out
|
|
219
|
+
* directory specifiers that Deno surfaces as errored modules (directory imports
|
|
220
|
+
* are unsupported) so they're never treated as bundleable source files.
|
|
221
|
+
*/
|
|
222
|
+
async function isDirectory(entryPath) {
|
|
223
|
+
try {
|
|
224
|
+
return (await fs.stat(entryPath)).isDirectory();
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
209
230
|
// WebAssembly binary magic bytes: `\0asm` (0x00 0x61 0x73 0x6d).
|
|
210
231
|
const WASM_MAGIC = Buffer.from([0x00, 0x61, 0x73, 0x6d]);
|
|
211
232
|
/**
|
|
@@ -245,6 +266,12 @@ async function shouldRewrite(sourceFile) {
|
|
|
245
266
|
* Defaults to copying the file in its current form
|
|
246
267
|
*/
|
|
247
268
|
export async function rewriteImportAssertions(sourceFile, destPath) {
|
|
269
|
+
// Defensive guard: a directory has nothing to bundle, and copying/reading one
|
|
270
|
+
// throws EISDIR. `getRequiredSourceFiles` already filters directory specifiers
|
|
271
|
+
// out of the source set, so this only matters if one slips through.
|
|
272
|
+
if (await isDirectory(sourceFile)) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
248
275
|
if (!(await shouldRewrite(sourceFile))) {
|
|
249
276
|
if (sourceFile !== destPath) {
|
|
250
277
|
await fs.copyFile(sourceFile, destPath);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "15.0
|
|
3
|
+
"version": "15.1.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
|
"tmp-promise": "^3.0.3",
|
|
81
81
|
"urlpattern-polyfill": "8.0.2"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "0a4aa4be3f9abbb49ebe00e82c64898148986715"
|
|
84
84
|
}
|