@netlify/edge-bundler 9.4.1 → 10.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/lib/common.ts +2 -2
- package/deno/lib/stage2.test.ts +58 -0
- 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/bootstrap.test.d.ts +1 -0
- package/dist/node/bootstrap.test.js +26 -0
- package/dist/node/bridge.d.ts +1 -1
- package/dist/node/bridge.js +1 -1
- package/dist/node/bundler.d.ts +2 -1
- package/dist/node/bundler.js +4 -5
- package/dist/node/bundler.test.js +51 -48
- package/dist/node/deno_config.d.ts +5 -0
- package/dist/node/deno_config.js +40 -0
- package/dist/node/deno_config.test.d.ts +1 -0
- package/dist/node/deno_config.test.js +37 -0
- 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/index.d.ts +1 -0
- package/dist/node/manifest.d.ts +6 -2
- package/dist/node/manifest.js +24 -20
- package/dist/node/manifest.test.js +46 -35
- package/dist/node/npm_dependencies.d.ts +3 -1
- package/dist/node/npm_dependencies.js +15 -10
- package/dist/node/npm_import_error.d.ts +2 -2
- package/dist/node/npm_import_error.js +5 -9
- package/dist/node/server/server.d.ts +2 -6
- package/dist/node/server/server.js +110 -16
- package/dist/node/server/server.test.js +50 -3
- package/dist/node/serving.test.d.ts +1 -0
- package/dist/node/serving.test.js +31 -0
- package/dist/node/utils/fs.d.ts +5 -0
- package/dist/node/utils/fs.js +12 -0
- package/dist/test/util.js +1 -1
- package/package.json +2 -2
- 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
package/deno/lib/common.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { load } from "https://deno.land/x/eszip@v0.
|
|
2
|
-
import { LoadResponse } from "https://deno.land/x/eszip@v0.
|
|
1
|
+
import { load } from "https://deno.land/x/eszip@v0.55.2/loader.ts";
|
|
2
|
+
import { LoadResponse } from "https://deno.land/x/eszip@v0.55.2/mod.ts";
|
|
3
3
|
import * as path from "https://deno.land/std@0.177.0/path/mod.ts";
|
|
4
4
|
import { retryAsync } from "https://deno.land/x/retry@v2.0.0/mod.ts";
|
|
5
5
|
import { isTooManyTries } from "https://deno.land/x/retry@v2.0.0/retry/tooManyTries.ts";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { assertEquals, assertStringIncludes } from 'https://deno.land/std@0.177.0/testing/asserts.ts'
|
|
2
|
+
|
|
3
|
+
import { join } from 'https://deno.land/std@0.177.0/path/mod.ts'
|
|
4
|
+
import { pathToFileURL } from 'https://deno.land/std@0.177.0/node/url.ts'
|
|
5
|
+
|
|
6
|
+
import { getStage2Entry } from './stage2.ts'
|
|
7
|
+
import { virtualRoot } from './consts.ts'
|
|
8
|
+
|
|
9
|
+
Deno.test('`getStage2Entry` returns a valid stage 2 file', async () => {
|
|
10
|
+
const directory = await Deno.makeTempDir()
|
|
11
|
+
const functions = [
|
|
12
|
+
{
|
|
13
|
+
name: 'func1',
|
|
14
|
+
path: join(directory, 'func1.ts'),
|
|
15
|
+
response: 'Hello from function 1',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'func2',
|
|
19
|
+
path: join(directory, 'func2.ts'),
|
|
20
|
+
response: 'Hello from function 2',
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
for (const func of functions) {
|
|
25
|
+
const contents = `export default async () => new Response(${JSON.stringify(func.response)})`
|
|
26
|
+
|
|
27
|
+
await Deno.writeTextFile(func.path, contents)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const baseURL = pathToFileURL(directory)
|
|
31
|
+
const stage2 = getStage2Entry(
|
|
32
|
+
directory,
|
|
33
|
+
functions.map(({ name, path }) => ({ name, path })),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
// Ensuring that the stage 2 paths have the virtual root before we strip it.
|
|
37
|
+
assertStringIncludes(stage2, virtualRoot)
|
|
38
|
+
|
|
39
|
+
// Replacing the virtual root with the URL of the temporary directory so that
|
|
40
|
+
// we can actually import the module.
|
|
41
|
+
const normalizedStage2 = stage2.replaceAll(virtualRoot, `${baseURL.href}/`)
|
|
42
|
+
|
|
43
|
+
const stage2Path = join(directory, 'stage2.ts')
|
|
44
|
+
const stage2URL = pathToFileURL(stage2Path)
|
|
45
|
+
|
|
46
|
+
await Deno.writeTextFile(stage2Path, normalizedStage2)
|
|
47
|
+
|
|
48
|
+
const mod = await import(stage2URL.href)
|
|
49
|
+
|
|
50
|
+
await Deno.remove(directory, { recursive: true })
|
|
51
|
+
|
|
52
|
+
for (const func of functions) {
|
|
53
|
+
const result = await mod.functions[func.name]()
|
|
54
|
+
|
|
55
|
+
assertEquals(await result.text(), func.response)
|
|
56
|
+
assertEquals(mod.metadata.functions[func.name].url, pathToFileURL(func.path).toString())
|
|
57
|
+
}
|
|
58
|
+
})
|
package/deno/lib/stage2.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Returns the path to the user's local data directory.
|
|
2
|
+
*
|
|
3
|
+
* The returned value depends on the operating system and is either a string,
|
|
4
|
+
* containing a value from the following table, or `null`.
|
|
5
|
+
*
|
|
6
|
+
* | Platform | Value | Example |
|
|
7
|
+
* | -------- | ---------------------------------------- | -------------------------------------------- |
|
|
8
|
+
* | Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/justjavac/.local/share |
|
|
9
|
+
* | macOS | `$HOME`/Library/Application Support | /Users/justjavac/Library/Application Support |
|
|
10
|
+
* | Windows | `$LOCALAPPDATA` | C:\Users\justjavac\AppData\Local |
|
|
11
|
+
*/
|
|
12
|
+
export default function dataDir(): string | null {
|
|
13
|
+
switch (Deno.build.os) {
|
|
14
|
+
case "linux": {
|
|
15
|
+
const xdg = Deno.env.get("XDG_DATA_HOME");
|
|
16
|
+
if (xdg) return xdg;
|
|
17
|
+
|
|
18
|
+
const home = Deno.env.get("HOME");
|
|
19
|
+
if (home) return `${home}/.local/share`;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
case "darwin": {
|
|
24
|
+
const home = Deno.env.get("HOME");
|
|
25
|
+
if (home) return `${home}/Library/Application Support`;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
case "windows":
|
|
30
|
+
return Deno.env.get("LOCALAPPDATA") ?? null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
}
|