@aligent/cdk-prerender-proxy 0.2.4-beta1 → 0.2.5-beta

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.
Files changed (155) hide show
  1. package/index.d.ts +1 -2
  2. package/index.js +2 -4
  3. package/lib/handlers/cache-control.ts +7 -20
  4. package/lib/handlers/error-response.ts +8 -51
  5. package/lib/handlers/node_modules/.package-lock.json +32 -3
  6. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.d.ts +6 -0
  7. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.js +14 -0
  8. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.d.ts +3 -0
  9. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.js +24 -0
  10. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.d.ts +3 -0
  11. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.js +50 -0
  12. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.d.ts +3 -0
  13. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.js +28 -0
  14. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.d.ts +3 -0
  15. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.js +49 -0
  16. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.d.ts +3 -0
  17. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.js +33 -0
  18. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/package.json +27 -0
  19. package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/tsconfig.json +3 -0
  20. package/lib/handlers/node_modules/@middy/core/LICENSE +21 -0
  21. package/lib/handlers/node_modules/@middy/core/README.md +65 -0
  22. package/lib/handlers/node_modules/@middy/core/index.cjs +207 -0
  23. package/lib/handlers/node_modules/@middy/core/index.d.ts +91 -0
  24. package/lib/handlers/node_modules/@middy/core/index.js +199 -0
  25. package/lib/handlers/node_modules/@middy/core/package.json +65 -0
  26. package/lib/handlers/node_modules/@types/node/README.md +4 -4
  27. package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +5 -1
  28. package/lib/handlers/node_modules/@types/node/assert.d.ts +904 -67
  29. package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +371 -96
  30. package/lib/handlers/node_modules/@types/node/buffer.d.ts +2199 -25
  31. package/lib/handlers/node_modules/@types/node/child_process.d.ts +1151 -308
  32. package/lib/handlers/node_modules/@types/node/cluster.d.ts +356 -208
  33. package/lib/handlers/node_modules/@types/node/console.d.ts +324 -45
  34. package/lib/handlers/node_modules/@types/node/constants.d.ts +8 -3
  35. package/lib/handlers/node_modules/@types/node/crypto.d.ts +3230 -846
  36. package/lib/handlers/node_modules/@types/node/dgram.d.ts +478 -74
  37. package/lib/handlers/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
  38. package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +308 -35
  39. package/lib/handlers/node_modules/@types/node/dns.d.ts +444 -107
  40. package/lib/handlers/node_modules/@types/node/dom-events.d.ts +126 -0
  41. package/lib/handlers/node_modules/@types/node/domain.d.ts +162 -16
  42. package/lib/handlers/node_modules/@types/node/events.d.ts +624 -39
  43. package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +911 -365
  44. package/lib/handlers/node_modules/@types/node/fs.d.ts +2611 -978
  45. package/lib/handlers/node_modules/@types/node/globals.d.ts +66 -421
  46. package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -1
  47. package/lib/handlers/node_modules/@types/node/http.d.ts +1416 -199
  48. package/lib/handlers/node_modules/@types/node/http2.d.ts +1688 -530
  49. package/lib/handlers/node_modules/@types/node/https.d.ts +532 -26
  50. package/lib/handlers/node_modules/@types/node/index.d.ts +92 -16
  51. package/lib/handlers/node_modules/@types/node/inspector.d.ts +511 -811
  52. package/lib/handlers/node_modules/@types/node/module.d.ts +75 -13
  53. package/lib/handlers/node_modules/@types/node/net.d.ts +710 -167
  54. package/lib/handlers/node_modules/@types/node/os.d.ts +252 -25
  55. package/lib/handlers/node_modules/@types/node/package.json +30 -25
  56. package/lib/handlers/node_modules/@types/node/path.d.ts +59 -31
  57. package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +420 -105
  58. package/lib/handlers/node_modules/@types/node/process.d.ts +1249 -228
  59. package/lib/handlers/node_modules/@types/node/punycode.d.ts +67 -25
  60. package/lib/handlers/node_modules/@types/node/querystring.d.ts +113 -10
  61. package/lib/handlers/node_modules/@types/node/readline/promises.d.ts +143 -0
  62. package/lib/handlers/node_modules/@types/node/readline.d.ts +570 -109
  63. package/lib/handlers/node_modules/@types/node/repl.d.ts +154 -125
  64. package/lib/handlers/node_modules/@types/node/stream/consumers.d.ts +12 -0
  65. package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +18 -43
  66. package/lib/handlers/node_modules/@types/node/stream/web.d.ts +330 -0
  67. package/lib/handlers/node_modules/@types/node/stream.d.ts +1117 -248
  68. package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +60 -0
  69. package/lib/handlers/node_modules/@types/node/test.d.ts +446 -0
  70. package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +81 -9
  71. package/lib/handlers/node_modules/@types/node/timers.d.ts +84 -17
  72. package/lib/handlers/node_modules/@types/node/tls.d.ts +510 -275
  73. package/lib/handlers/node_modules/@types/node/trace_events.d.ts +120 -10
  74. package/lib/handlers/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  75. package/lib/handlers/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
  76. package/lib/handlers/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
  77. package/lib/handlers/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
  78. package/lib/handlers/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
  79. package/lib/handlers/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
  80. package/lib/handlers/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  81. package/lib/handlers/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  82. package/lib/handlers/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
  83. package/lib/handlers/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  84. package/lib/handlers/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
  85. package/lib/handlers/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
  86. package/lib/handlers/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
  87. package/lib/handlers/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  88. package/lib/handlers/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  89. package/lib/handlers/node_modules/@types/node/ts4.8/events.d.ts +678 -0
  90. package/lib/handlers/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
  91. package/lib/handlers/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
  92. package/lib/handlers/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
  93. package/lib/handlers/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  94. package/lib/handlers/node_modules/@types/node/ts4.8/http.d.ts +1651 -0
  95. package/lib/handlers/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
  96. package/lib/handlers/node_modules/@types/node/ts4.8/https.d.ts +542 -0
  97. package/lib/handlers/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  98. package/lib/handlers/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
  99. package/lib/handlers/node_modules/@types/node/ts4.8/module.d.ts +114 -0
  100. package/lib/handlers/node_modules/@types/node/ts4.8/net.d.ts +869 -0
  101. package/lib/handlers/node_modules/@types/node/ts4.8/os.d.ts +466 -0
  102. package/lib/handlers/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  103. package/lib/handlers/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
  104. package/lib/handlers/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
  105. package/lib/handlers/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  106. package/lib/handlers/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  107. package/lib/handlers/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  108. package/lib/handlers/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
  109. package/lib/handlers/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  110. package/lib/handlers/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  111. package/lib/handlers/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  112. package/lib/handlers/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  113. package/lib/handlers/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
  114. package/lib/handlers/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  115. package/lib/handlers/node_modules/@types/node/ts4.8/test.d.ts +446 -0
  116. package/lib/handlers/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  117. package/lib/handlers/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
  118. package/lib/handlers/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
  119. package/lib/handlers/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  120. package/lib/handlers/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  121. package/lib/handlers/node_modules/@types/node/ts4.8/url.d.ts +897 -0
  122. package/lib/handlers/node_modules/@types/node/ts4.8/util.d.ts +1926 -0
  123. package/lib/handlers/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
  124. package/lib/handlers/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
  125. package/lib/handlers/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  126. package/lib/handlers/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
  127. package/lib/handlers/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  128. package/lib/handlers/node_modules/@types/node/tty.d.ts +163 -23
  129. package/lib/handlers/node_modules/@types/node/url.d.ts +825 -44
  130. package/lib/handlers/node_modules/@types/node/util.d.ts +1842 -72
  131. package/lib/handlers/node_modules/@types/node/v8.d.ts +276 -78
  132. package/lib/handlers/node_modules/@types/node/vm.d.ts +410 -53
  133. package/lib/handlers/node_modules/@types/node/wasi.d.ts +102 -30
  134. package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +559 -152
  135. package/lib/handlers/node_modules/@types/node/zlib.d.ts +234 -78
  136. package/lib/handlers/node_modules/esbuild/README.md +3 -0
  137. package/lib/handlers/node_modules/esbuild/bin/esbuild +0 -0
  138. package/lib/handlers/node_modules/esbuild/install.js +256 -0
  139. package/lib/handlers/node_modules/esbuild/lib/main.d.ts +397 -0
  140. package/lib/handlers/node_modules/esbuild/lib/main.js +1939 -0
  141. package/lib/handlers/node_modules/esbuild/package.json +15 -0
  142. package/lib/handlers/package-lock.json +62 -6
  143. package/lib/handlers/package.json +6 -1
  144. package/lib/handlers/prerender-check.ts +8 -27
  145. package/lib/handlers/prerender.ts +8 -43
  146. package/package.json +1 -1
  147. package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
  148. package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
  149. package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
  150. package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
  151. package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
  152. package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
  153. package/lib/handlers/prerender-handler.ts +0 -13
  154. package/lib/sendToPrerender.d.ts +0 -2
  155. package/lib/sendToPrerender.js +0 -42
@@ -1,3 +1,75 @@
1
+ /**
2
+ * The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
3
+ * underlying operating system via a collection of POSIX-like functions.
4
+ *
5
+ * ```js
6
+ * import { readFile } from 'fs/promises';
7
+ * import { WASI } from 'wasi';
8
+ * import { argv, env } from 'process';
9
+ *
10
+ * const wasi = new WASI({
11
+ * args: argv,
12
+ * env,
13
+ * preopens: {
14
+ * '/sandbox': '/some/real/path/that/wasm/can/access'
15
+ * }
16
+ * });
17
+ *
18
+ * // Some WASI binaries require:
19
+ * // const importObject = { wasi_unstable: wasi.wasiImport };
20
+ * const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
21
+ *
22
+ * const wasm = await WebAssembly.compile(
23
+ * await readFile(new URL('./demo.wasm', import.meta.url))
24
+ * );
25
+ * const instance = await WebAssembly.instantiate(wasm, importObject);
26
+ *
27
+ * wasi.start(instance);
28
+ * ```
29
+ *
30
+ * To run the above example, create a new WebAssembly text format file named`demo.wat`:
31
+ *
32
+ * ```text
33
+ * (module
34
+ * ;; Import the required fd_write WASI function which will write the given io vectors to stdout
35
+ * ;; The function signature for fd_write is:
36
+ * ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
37
+ * (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
38
+ *
39
+ * (memory 1)
40
+ * (export "memory" (memory 0))
41
+ *
42
+ * ;; Write 'hello world\n' to memory at an offset of 8 bytes
43
+ * ;; Note the trailing newline which is required for the text to appear
44
+ * (data (i32.const 8) "hello world\n")
45
+ *
46
+ * (func $main (export "_start")
47
+ * ;; Creating a new io vector within linear memory
48
+ * (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
49
+ * (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
50
+ *
51
+ * (call $fd_write
52
+ * (i32.const 1) ;; file_descriptor - 1 for stdout
53
+ * (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
54
+ * (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
55
+ * (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
56
+ * )
57
+ * drop ;; Discard the number of bytes written from the top of the stack
58
+ * )
59
+ * )
60
+ * ```
61
+ *
62
+ * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
63
+ *
64
+ * ```console
65
+ * $ wat2wasm demo.wat
66
+ * ```
67
+ *
68
+ * The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
69
+ * example to run.
70
+ * @experimental
71
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/wasi.js)
72
+ */
1
73
  declare module 'wasi' {
2
74
  interface WASIOptions {
3
75
  /**
@@ -5,22 +77,19 @@ declare module 'wasi' {
5
77
  * see as command line arguments. The first argument is the virtual path to the
6
78
  * WASI command itself.
7
79
  */
8
- args?: string[];
9
-
80
+ args?: string[] | undefined;
10
81
  /**
11
82
  * An object similar to `process.env` that the WebAssembly
12
83
  * application will see as its environment.
13
84
  */
14
- env?: object;
15
-
85
+ env?: object | undefined;
16
86
  /**
17
87
  * This object represents the WebAssembly application's
18
88
  * sandbox directory structure. The string keys of `preopens` are treated as
19
89
  * directories within the sandbox. The corresponding values in `preopens` are
20
90
  * the real paths to those directories on the host machine.
21
91
  */
22
- preopens?: NodeJS.Dict<string>;
23
-
92
+ preopens?: NodeJS.Dict<string> | undefined;
24
93
  /**
25
94
  * By default, WASI applications terminate the Node.js
26
95
  * process via the `__wasi_proc_exit()` function. Setting this option to `true`
@@ -28,59 +97,62 @@ declare module 'wasi' {
28
97
  * process.
29
98
  * @default false
30
99
  */
31
- returnOnExit?: boolean;
32
-
100
+ returnOnExit?: boolean | undefined;
33
101
  /**
34
102
  * The file descriptor used as standard input in the WebAssembly application.
35
103
  * @default 0
36
104
  */
37
- stdin?: number;
38
-
105
+ stdin?: number | undefined;
39
106
  /**
40
107
  * The file descriptor used as standard output in the WebAssembly application.
41
108
  * @default 1
42
109
  */
43
- stdout?: number;
44
-
110
+ stdout?: number | undefined;
45
111
  /**
46
112
  * The file descriptor used as standard error in the WebAssembly application.
47
113
  * @default 2
48
114
  */
49
- stderr?: number;
115
+ stderr?: number | undefined;
50
116
  }
51
-
117
+ /**
118
+ * The `WASI` class provides the WASI system call API and additional convenience
119
+ * methods for working with WASI-based applications. Each `WASI` instance
120
+ * represents a distinct sandbox environment. For security purposes, each `WASI`instance must have its command-line arguments, environment variables, and
121
+ * sandbox directory structure configured explicitly.
122
+ * @since v13.3.0, v12.16.0
123
+ */
52
124
  class WASI {
53
125
  constructor(options?: WASIOptions);
54
126
  /**
127
+ * Attempt to begin execution of `instance` as a WASI command by invoking its`_start()` export. If `instance` does not contain a `_start()` export, or if`instance` contains an `_initialize()`
128
+ * export, then an exception is thrown.
55
129
  *
56
- * Attempt to begin execution of `instance` by invoking its `_start()` export.
57
- * If `instance` does not contain a `_start()` export, then `start()` attempts to
58
- * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
59
- * is present on `instance`, then `start()` does nothing.
60
- *
61
- * `start()` requires that `instance` exports a `WebAssembly.Memory` named
62
- * `memory`. If `instance` does not have a `memory` export an exception is thrown.
130
+ * `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`. If
131
+ * `instance` does not have a `memory` export an exception is thrown.
63
132
  *
64
133
  * If `start()` is called more than once, an exception is thrown.
134
+ * @since v13.3.0, v12.16.0
65
135
  */
66
136
  start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
67
-
68
137
  /**
69
- * Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present.
70
- * If `instance` contains a `_start()` export, then an exception is thrown.
138
+ * Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.
71
139
  *
72
- * `start()` requires that `instance` exports a `WebAssembly.Memory` named
73
- * `memory`. If `instance` does not have a `memory` export an exception is thrown.
140
+ * `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`.
141
+ * If `instance` does not have a `memory` export an exception is thrown.
74
142
  *
75
143
  * If `initialize()` is called more than once, an exception is thrown.
144
+ * @since v14.6.0, v12.19.0
76
145
  */
77
146
  initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
78
-
79
147
  /**
80
- * Is an object that implements the WASI system call API. This object
81
- * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
82
- * `WebAssembly.Instance`.
148
+ * `wasiImport` is an object that implements the WASI system call API. This object
149
+ * should be passed as the `wasi_snapshot_preview1` import during the instantiation
150
+ * of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
151
+ * @since v13.3.0, v12.16.0
83
152
  */
84
153
  readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
85
154
  }
86
155
  }
156
+ declare module 'node:wasi' {
157
+ export * from 'wasi';
158
+ }