@netlify/edge-bundler 9.4.1 → 9.5.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/lib/common.ts +2 -2
- package/deno/lib/stage2.ts +1 -1
- package/deno/vendor/deno.land/x/dir@1.5.1/data_local_dir/mod.ts +34 -0
- package/deno/vendor/deno.land/x/{eszip@v0.40.0 → eszip@v0.55.2}/eszip_wasm.generated.js +136 -179
- package/deno/vendor/deno.land/x/eszip@v0.55.2/eszip_wasm_bg.wasm +0 -0
- package/deno/vendor/deno.land/x/wasmbuild@0.15.1/cache.ts +157 -0
- package/deno/vendor/deno.land/x/wasmbuild@0.15.1/loader.ts +126 -0
- package/dist/node/bridge.d.ts +1 -1
- package/dist/node/bridge.js +1 -1
- package/dist/node/bundler.js +1 -4
- package/dist/node/bundler.test.js +23 -48
- package/dist/node/feature_flags.d.ts +2 -8
- package/dist/node/feature_flags.js +1 -4
- package/dist/node/formats/eszip.d.ts +1 -1
- package/dist/node/formats/eszip.js +2 -2
- package/dist/node/formats/javascript.js +1 -2
- package/dist/node/manifest.d.ts +1 -1
- package/dist/node/manifest.js +7 -16
- package/dist/node/manifest.test.js +2 -19
- package/dist/node/npm_dependencies.d.ts +1 -0
- package/dist/node/npm_dependencies.js +2 -0
- package/dist/node/npm_import_error.d.ts +2 -2
- package/dist/node/npm_import_error.js +5 -9
- package/dist/node/server/server.js +29 -15
- package/dist/node/server/server.test.js +0 -3
- package/dist/test/util.js +1 -1
- package/package.json +1 -1
- package/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm +0 -0
- /package/deno/vendor/deno.land/x/{eszip@v0.40.0 → eszip@v0.55.2}/loader.ts +0 -0
- /package/deno/vendor/deno.land/x/{eszip@v0.40.0 → eszip@v0.55.2}/mod.ts +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { readdir, unlink } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
1
3
|
import { DenoBridge } from '../bridge.js';
|
|
2
4
|
import { getFunctionConfig } from '../config.js';
|
|
3
5
|
import { generateStage2 } from '../formats/javascript.js';
|
|
@@ -6,7 +8,17 @@ import { getLogger } from '../logger.js';
|
|
|
6
8
|
import { vendorNPMSpecifiers } from '../npm_dependencies.js';
|
|
7
9
|
import { ensureLatestTypes } from '../types.js';
|
|
8
10
|
import { killProcess, waitForServer } from './util.js';
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Cleans up a directory, except for the files specified in the `except` array.
|
|
13
|
+
* Both should be given as absolute paths.
|
|
14
|
+
* Assumes the directory doesn't contain any nested directories.
|
|
15
|
+
*/
|
|
16
|
+
const cleanDirectory = async (directory, except) => {
|
|
17
|
+
const files = await readdir(directory);
|
|
18
|
+
const toBeDeleted = files.filter((file) => !except.includes(join(directory, file)));
|
|
19
|
+
await Promise.all(toBeDeleted.map((file) => unlink(join(directory, file))));
|
|
20
|
+
};
|
|
21
|
+
const prepareServer = ({ basePath, bootstrapURL, deno, distDirectory, distImportMapPath, flags: denoFlags, formatExportTypeError, formatImportError, importMap: baseImportMap, logger, port, }) => {
|
|
10
22
|
const processRef = {};
|
|
11
23
|
const startServer = async (functions, env = {}, options = {}) => {
|
|
12
24
|
if ((processRef === null || processRef === void 0 ? void 0 : processRef.ps) !== undefined) {
|
|
@@ -24,21 +36,23 @@ const prepareServer = ({ basePath, bootstrapURL, deno, distDirectory, distImport
|
|
|
24
36
|
const features = {};
|
|
25
37
|
const importMap = baseImportMap.clone();
|
|
26
38
|
const npmSpecifiersWithExtraneousFiles = [];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// we keep track of the files that are relevant to the user's code, so we can clean up leftovers from past executions later
|
|
40
|
+
const relevantFiles = [stage2Path];
|
|
41
|
+
const vendor = await vendorNPMSpecifiers({
|
|
42
|
+
basePath,
|
|
43
|
+
directory: distDirectory,
|
|
44
|
+
functions: functions.map(({ path }) => path),
|
|
45
|
+
importMap,
|
|
46
|
+
logger,
|
|
47
|
+
referenceTypes: true,
|
|
48
|
+
});
|
|
49
|
+
if (vendor) {
|
|
50
|
+
features.npmModules = true;
|
|
51
|
+
importMap.add(vendor.importMap);
|
|
52
|
+
npmSpecifiersWithExtraneousFiles.push(...vendor.npmSpecifiersWithExtraneousFiles);
|
|
53
|
+
relevantFiles.push(...vendor.outputFiles);
|
|
41
54
|
}
|
|
55
|
+
await cleanDirectory(distDirectory, relevantFiles);
|
|
42
56
|
try {
|
|
43
57
|
// This command will print a JSON object with all the modules found in
|
|
44
58
|
// the `stage2Path` file as well as all of their dependencies.
|
package/dist/test/util.js
CHANGED
|
@@ -55,7 +55,7 @@ const runESZIP = async (eszipPath, vendorDirectory) => {
|
|
|
55
55
|
const extractCommand = execa('deno', [
|
|
56
56
|
'run',
|
|
57
57
|
'--allow-all',
|
|
58
|
-
'https://deno.land/x/eszip@v0.
|
|
58
|
+
'https://deno.land/x/eszip@v0.55.2/eszip.ts',
|
|
59
59
|
'x',
|
|
60
60
|
eszipPath,
|
|
61
61
|
tmpDir.path,
|
package/package.json
CHANGED
|
Binary file
|
|
File without changes
|
|
File without changes
|