@sveltejs/adapter-vercel 1.0.0-next.5 → 1.0.0-next.50

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
@@ -1,18 +1,41 @@
1
1
  # adapter-vercel
2
2
 
3
- Adapter for Svelte apps that creates a Vercel app, using a function for dynamic server rendering.
3
+ A SvelteKit adapter that creates a Vercel app.
4
+
5
+ If you're using [adapter-auto](../adapter-auto), you don't need to install this unless you need to specify Vercel-specific options, since it's already included.
4
6
 
5
7
  ## Usage
6
8
 
7
- ```sh
8
- npm install --save-dev @sveltejs/adapter-vercel
9
- ```
9
+ > The `edge` and `split` options depend on the Vercel Build Output API which is currently in beta. For now, you must opt in by visiting `https://vercel.com/svelte/[YOUR_PROJECT]/settings/environment-variables` and adding `ENABLE_VC_BUILD` with the value `1`.
10
+
11
+ Add `"@sveltejs/adapter-vercel": "next"` to the `devDependencies` in your `package.json` and run `npm install`.
10
12
 
11
13
  Then in your `svelte.config.js`:
12
14
 
13
15
  ```js
14
- module.exports = {
15
- ...
16
- adapter: '@sveltejs/adapter-vercel'
16
+ import vercel from '@sveltejs/adapter-vercel';
17
+
18
+ export default {
19
+ kit: {
20
+ // default options are shown
21
+ adapter: vercel({
22
+ // if true, will deploy the app using edge functions
23
+ // (https://vercel.com/docs/concepts/functions/edge-functions)
24
+ // rather than serverless functions
25
+ edge: false,
26
+
27
+ // an array of dependencies that esbuild should treat
28
+ // as external when bundling functions
29
+ external: [],
30
+
31
+ // if true, will split your app into multiple functions
32
+ // instead of creating a single one for the entire app
33
+ split: false
34
+ })
35
+ }
17
36
  };
18
37
  ```
38
+
39
+ ## Changelog
40
+
41
+ [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-vercel/CHANGELOG.md).
package/files/edge.js ADDED
@@ -0,0 +1,15 @@
1
+ import { Server } from 'SERVER';
2
+ import { manifest } from 'MANIFEST';
3
+
4
+ const server = new Server(manifest);
5
+
6
+ /**
7
+ * @param {Request} request
8
+ */
9
+ export default (request) => {
10
+ return server.respond(request, {
11
+ getClientAddress() {
12
+ return request.headers.get('x-forwarded-for');
13
+ }
14
+ });
15
+ };
@@ -0,0 +1,33 @@
1
+ import { installFetch } from '@sveltejs/kit/install-fetch';
2
+ import { getRequest, setResponse } from '@sveltejs/kit/node';
3
+ import { Server } from 'SERVER';
4
+ import { manifest } from 'MANIFEST';
5
+
6
+ installFetch();
7
+
8
+ const server = new Server(manifest);
9
+
10
+ /**
11
+ * @param {import('http').IncomingMessage} req
12
+ * @param {import('http').ServerResponse} res
13
+ */
14
+ export default async (req, res) => {
15
+ /** @type {Request} */
16
+ let request;
17
+
18
+ try {
19
+ request = await getRequest(`https://${req.headers.host}`, req);
20
+ } catch (err) {
21
+ res.statusCode = err.status || 400;
22
+ return res.end(err.reason || 'Invalid request body');
23
+ }
24
+
25
+ setResponse(
26
+ res,
27
+ await server.respond(request, {
28
+ getClientAddress() {
29
+ return request.headers.get('x-forwarded-for');
30
+ }
31
+ })
32
+ );
33
+ };
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Adapter } from '@sveltejs/kit';
2
+
3
+ type Options = {
4
+ edge?: boolean;
5
+ external?: string[];
6
+ split?: boolean;
7
+ };
8
+
9
+ declare function plugin(options?: Options): Adapter;
10
+ export = plugin;
package/index.js CHANGED
@@ -1,52 +1,387 @@
1
- import { writeFileSync, mkdirSync, renameSync } from 'fs';
2
- import { dirname, resolve, join } from 'path';
1
+ import { mkdirSync, writeFileSync } from 'fs';
2
+ import { dirname, posix } from 'path';
3
3
  import { fileURLToPath } from 'url';
4
- import { copy } from '@sveltejs/app-utils/files';
4
+ import esbuild from 'esbuild';
5
5
 
6
- const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ // rules for clean URLs and trailing slash handling,
7
+ // generated with @vercel/routing-utils
8
+ const redirects = {
9
+ always: [
10
+ {
11
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
12
+ headers: {
13
+ Location: '/$1/'
14
+ },
15
+ status: 308
16
+ },
17
+ {
18
+ src: '^/(.*)\\.html/?$',
19
+ headers: {
20
+ Location: '/$1/'
21
+ },
22
+ status: 308
23
+ },
24
+ {
25
+ src: '^/\\.well-known(?:/.*)?$'
26
+ },
27
+ {
28
+ src: '^/((?:[^/]+/)*[^/\\.]+)$',
29
+ headers: {
30
+ Location: '/$1/'
31
+ },
32
+ status: 308
33
+ },
34
+ {
35
+ src: '^/((?:[^/]+/)*[^/]+\\.\\w+)/$',
36
+ headers: {
37
+ Location: '/$1'
38
+ },
39
+ status: 308
40
+ }
41
+ ],
42
+ never: [
43
+ {
44
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
45
+ headers: {
46
+ Location: '/$1'
47
+ },
48
+ status: 308
49
+ },
50
+ {
51
+ src: '^/(.*)\\.html/?$',
52
+ headers: {
53
+ Location: '/$1'
54
+ },
55
+ status: 308
56
+ },
57
+ {
58
+ src: '^/(.*)/$',
59
+ headers: {
60
+ Location: '/$1'
61
+ },
62
+ status: 308
63
+ }
64
+ ],
65
+ ignore: [
66
+ {
67
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
68
+ headers: {
69
+ Location: '/$1'
70
+ },
71
+ status: 308
72
+ },
73
+ {
74
+ src: '^/(.*)\\.html/?$',
75
+ headers: {
76
+ Location: '/$1'
77
+ },
78
+ status: 308
79
+ }
80
+ ]
81
+ };
7
82
 
8
- export default function () {
83
+ /** @type {import('.')} **/
84
+ export default function ({ external = [], edge, split } = {}) {
9
85
  return {
86
+ name: '@sveltejs/adapter-vercel',
87
+
10
88
  async adapt(builder) {
11
- const vercel_output_directory = resolve('.vercel_build_output');
12
- const config_directory = join(vercel_output_directory, 'config');
13
- const static_directory = join(vercel_output_directory, 'static');
14
- const lambda_directory = join(vercel_output_directory, 'functions', 'node', 'render');
15
- const server_directory = join(lambda_directory, 'server');
16
-
17
- builder.log.minor('Writing client application...');
18
- builder.copy_static_files(static_directory);
19
- builder.copy_client_files(static_directory);
20
-
21
- builder.log.minor('Building lambda...');
22
- builder.copy_server_files(server_directory);
23
- renameSync(join(server_directory, 'app.js'), join(server_directory, 'app.mjs'));
24
-
25
- copy(join(__dirname, 'files'), lambda_directory);
26
-
27
- builder.log.minor('Prerendering static pages...');
28
- await builder.prerender({
29
- dest: static_directory
30
- });
31
-
32
- builder.log.minor('Writing routes...');
33
- try {
34
- mkdirSync(config_directory);
35
- } catch {
36
- // directory already exists
89
+ if (process.env.ENABLE_VC_BUILD) {
90
+ await v3(builder, external, edge, split);
91
+ } else {
92
+ if (edge || split) {
93
+ throw new Error('edge and split options can only be used with ENABLE_VC_BUILD');
94
+ }
95
+
96
+ await v1(builder, external);
37
97
  }
38
- writeFileSync(
39
- join(config_directory, 'routes.json'),
40
- JSON.stringify([
41
- {
42
- handle: 'filesystem'
43
- },
44
- {
45
- src: '/.*',
46
- dest: '.vercel/functions/render'
47
- }
48
- ])
49
- );
50
98
  }
51
99
  };
52
100
  }
101
+
102
+ /**
103
+ * @param {import('@sveltejs/kit').Builder} builder
104
+ * @param {string[]} external
105
+ */
106
+ async function v1(builder, external) {
107
+ const dir = '.vercel_build_output';
108
+
109
+ const tmp = builder.getBuildDirectory('vercel-tmp');
110
+
111
+ builder.rimraf(dir);
112
+ builder.rimraf(tmp);
113
+
114
+ const files = fileURLToPath(new URL('./files', import.meta.url).href);
115
+
116
+ const dirs = {
117
+ static: `${dir}/static`,
118
+ lambda: `${dir}/functions/node/render`
119
+ };
120
+
121
+ builder.log.minor('Generating serverless function...');
122
+
123
+ const relativePath = posix.relative(tmp, builder.getServerDirectory());
124
+
125
+ builder.copy(`${files}/serverless.js`, `${tmp}/serverless.js`, {
126
+ replace: {
127
+ SERVER: `${relativePath}/index.js`,
128
+ MANIFEST: './manifest.js'
129
+ }
130
+ });
131
+
132
+ writeFileSync(
133
+ `${tmp}/manifest.js`,
134
+ `export const manifest = ${builder.generateManifest({
135
+ relativePath
136
+ })};\n`
137
+ );
138
+
139
+ await esbuild.build({
140
+ entryPoints: [`${tmp}/serverless.js`],
141
+ outfile: `${dirs.lambda}/index.js`,
142
+ target: 'node14',
143
+ bundle: true,
144
+ platform: 'node',
145
+ external
146
+ });
147
+
148
+ writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'commonjs' }));
149
+
150
+ builder.log.minor('Copying assets...');
151
+
152
+ builder.writeStatic(dirs.static);
153
+ builder.writeClient(dirs.static);
154
+ builder.writePrerendered(dirs.static);
155
+
156
+ builder.log.minor('Writing routes...');
157
+
158
+ builder.mkdirp(`${dir}/config`);
159
+
160
+ const prerendered_pages = Array.from(builder.prerendered.pages, ([src, page]) => ({
161
+ src,
162
+ dest: page.file
163
+ }));
164
+
165
+ const prerendered_redirects = Array.from(builder.prerendered.redirects, ([src, redirect]) => ({
166
+ src,
167
+ headers: {
168
+ Location: redirect.location
169
+ },
170
+ status: redirect.status
171
+ }));
172
+
173
+ writeFileSync(
174
+ `${dir}/config/routes.json`,
175
+ JSON.stringify([
176
+ ...redirects[builder.config.kit.trailingSlash],
177
+ ...prerendered_pages,
178
+ ...prerendered_redirects,
179
+ {
180
+ src: `/${builder.config.kit.appDir}/.+`,
181
+ headers: {
182
+ 'cache-control': 'public, immutable, max-age=31536000'
183
+ }
184
+ },
185
+ {
186
+ handle: 'filesystem'
187
+ },
188
+ {
189
+ src: '/.*',
190
+ dest: '.vercel/functions/render'
191
+ }
192
+ ])
193
+ );
194
+ }
195
+
196
+ /**
197
+ * @param {import('@sveltejs/kit').Builder} builder
198
+ * @param {string[]} external
199
+ * @param {boolean} edge
200
+ * @param {boolean} split
201
+ */
202
+ async function v3(builder, external, edge, split) {
203
+ const dir = '.vercel/output';
204
+
205
+ const tmp = builder.getBuildDirectory('vercel-tmp');
206
+
207
+ builder.rimraf(dir);
208
+ builder.rimraf(tmp);
209
+
210
+ const files = fileURLToPath(new URL('./files', import.meta.url).href);
211
+
212
+ const dirs = {
213
+ static: `${dir}/static`,
214
+ functions: `${dir}/functions`
215
+ };
216
+
217
+ const prerendered_redirects = Array.from(builder.prerendered.redirects, ([src, redirect]) => ({
218
+ src,
219
+ headers: {
220
+ Location: redirect.location
221
+ },
222
+ status: redirect.status
223
+ }));
224
+
225
+ /** @type {any[]} */
226
+ const routes = [
227
+ ...redirects[builder.config.kit.trailingSlash],
228
+ ...prerendered_redirects,
229
+ {
230
+ src: `/${builder.config.kit.appDir}/.+`,
231
+ headers: {
232
+ 'cache-control': 'public, immutable, max-age=31536000'
233
+ }
234
+ },
235
+ {
236
+ handle: 'filesystem'
237
+ }
238
+ ];
239
+
240
+ builder.log.minor('Generating serverless function...');
241
+
242
+ /**
243
+ * @param {string} name
244
+ * @param {string} pattern
245
+ * @param {(options: { relativePath: string }) => string} generate_manifest
246
+ */
247
+ async function generate_serverless_function(name, pattern, generate_manifest) {
248
+ const tmp = builder.getBuildDirectory(`vercel-tmp/${name}`);
249
+ const relativePath = posix.relative(tmp, builder.getServerDirectory());
250
+
251
+ builder.copy(`${files}/serverless.js`, `${tmp}/serverless.js`, {
252
+ replace: {
253
+ SERVER: `${relativePath}/index.js`,
254
+ MANIFEST: './manifest.js'
255
+ }
256
+ });
257
+
258
+ write(
259
+ `${tmp}/manifest.js`,
260
+ `export const manifest = ${generate_manifest({ relativePath })};\n`
261
+ );
262
+
263
+ await esbuild.build({
264
+ entryPoints: [`${tmp}/serverless.js`],
265
+ outfile: `${dirs.functions}/${name}.func/index.js`,
266
+ target: 'node14',
267
+ bundle: true,
268
+ platform: 'node',
269
+ format: 'cjs',
270
+ external
271
+ });
272
+
273
+ write(
274
+ `${dirs.functions}/${name}.func/.vc-config.json`,
275
+ JSON.stringify({
276
+ runtime: 'nodejs14.x',
277
+ handler: 'index.js',
278
+ launcherType: 'Nodejs'
279
+ })
280
+ );
281
+
282
+ write(`${dirs.functions}/${name}.func/package.json`, JSON.stringify({ type: 'commonjs' }));
283
+
284
+ routes.push({ src: pattern, dest: `/${name}` });
285
+ }
286
+
287
+ /**
288
+ * @param {string} name
289
+ * @param {string} pattern
290
+ * @param {(options: { relativePath: string }) => string} generate_manifest
291
+ */
292
+ async function generate_edge_function(name, pattern, generate_manifest) {
293
+ const tmp = builder.getBuildDirectory(`vercel-tmp/${name}`);
294
+ const relativePath = posix.relative(tmp, builder.getServerDirectory());
295
+
296
+ builder.copy(`${files}/edge.js`, `${tmp}/edge.js`, {
297
+ replace: {
298
+ SERVER: `${relativePath}/index.js`,
299
+ MANIFEST: './manifest.js'
300
+ }
301
+ });
302
+
303
+ write(
304
+ `${tmp}/manifest.js`,
305
+ `export const manifest = ${generate_manifest({ relativePath })};\n`
306
+ );
307
+
308
+ await esbuild.build({
309
+ entryPoints: [`${tmp}/edge.js`],
310
+ outfile: `${dirs.functions}/${name}.func/index.js`,
311
+ target: 'node14',
312
+ bundle: true,
313
+ platform: 'node',
314
+ format: 'esm',
315
+ external
316
+ });
317
+
318
+ write(
319
+ `${dirs.functions}/${name}.func/.vc-config.json`,
320
+ JSON.stringify({
321
+ runtime: 'edge',
322
+ entrypoint: 'index.js'
323
+ // TODO expose envVarsInUse
324
+ })
325
+ );
326
+
327
+ routes.push({ src: pattern, middlewarePath: name });
328
+ }
329
+
330
+ const generate_function = edge ? generate_edge_function : generate_serverless_function;
331
+
332
+ if (split) {
333
+ await builder.createEntries((route) => {
334
+ return {
335
+ id: route.pattern.toString(), // TODO is `id` necessary?
336
+ filter: (other) => route.pattern.toString() === other.pattern.toString(),
337
+ complete: async (entry) => {
338
+ const src = `${route.pattern
339
+ .toString()
340
+ .slice(1, -2) // remove leading / and trailing $/
341
+ .replace(/\\\//g, '/')}(?:/__data.json)?$`; // TODO adding /__data.json is a temporary workaround — those endpoints should be treated as distinct routes
342
+
343
+ await generate_function(route.id || 'index', src, entry.generateManifest);
344
+ }
345
+ };
346
+ });
347
+ } else {
348
+ await generate_function('render', '/.*', builder.generateManifest);
349
+ }
350
+
351
+ builder.log.minor('Copying assets...');
352
+
353
+ builder.writeStatic(dirs.static);
354
+ builder.writeClient(dirs.static);
355
+ builder.writePrerendered(dirs.static);
356
+
357
+ builder.log.minor('Writing routes...');
358
+
359
+ /** @type {Record<string, { path: string }>} */
360
+ const overrides = {};
361
+ builder.prerendered.pages.forEach((page, src) => {
362
+ overrides[page.file] = { path: src.slice(1) };
363
+ });
364
+
365
+ write(
366
+ `${dir}/config.json`,
367
+ JSON.stringify({
368
+ version: 3,
369
+ routes,
370
+ overrides
371
+ })
372
+ );
373
+ }
374
+
375
+ /**
376
+ * @param {string} file
377
+ * @param {string} data
378
+ */
379
+ function write(file, data) {
380
+ try {
381
+ mkdirSync(dirname(file), { recursive: true });
382
+ } catch {
383
+ // do nothing
384
+ }
385
+
386
+ writeFileSync(file, data);
387
+ }
package/package.json CHANGED
@@ -1,24 +1,37 @@
1
1
  {
2
- "name": "@sveltejs/adapter-vercel",
3
- "version": "1.0.0-next.5",
4
- "main": "index.js",
5
- "type": "module",
6
- "files": [
7
- "files"
8
- ],
9
- "scripts": {
10
- "dev": "rollup -cw",
11
- "build": "rollup -c",
12
- "lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
13
- "format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore",
14
- "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
15
- "prepublishOnly": "npm run build"
16
- },
17
- "dependencies": {
18
- "@sveltejs/app-utils": "1.0.0-next.3"
19
- },
20
- "devDependencies": {
21
- "rollup": "^2.41.1",
22
- "sirv": "^1.0.11"
23
- }
24
- }
2
+ "name": "@sveltejs/adapter-vercel",
3
+ "version": "1.0.0-next.50",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/sveltejs/kit",
7
+ "directory": "packages/adapter-vercel"
8
+ },
9
+ "license": "MIT",
10
+ "homepage": "https://kit.svelte.dev",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "main": "index.js",
19
+ "types": "index.d.ts",
20
+ "files": [
21
+ "files",
22
+ "index.d.ts"
23
+ ],
24
+ "dependencies": {
25
+ "esbuild": "^0.14.21"
26
+ },
27
+ "devDependencies": {
28
+ "@sveltejs/kit": "1.0.0-next.321",
29
+ "typescript": "^4.6.2"
30
+ },
31
+ "scripts": {
32
+ "lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
33
+ "format": "npm run check-format -- --write",
34
+ "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
35
+ "check": "tsc"
36
+ }
37
+ }
package/CHANGELOG.md DELETED
@@ -1,56 +0,0 @@
1
- # @sveltejs/adapter-vercel
2
-
3
- ## 1.0.0-next.5
4
-
5
- ### Patch Changes
6
-
7
- - f35a5cd: Change adapter signature
8
-
9
- ## 1.0.0-next.4
10
-
11
- ### Patch Changes
12
-
13
- - c3cf3f3: Bump deps
14
- - d742029: Fix mixed usage of CJS and ESM
15
- - Updated dependencies [c3cf3f3]
16
- - @sveltejs/app-utils@1.0.0-next.3
17
-
18
- ## 1.0.0-next.3
19
-
20
- ### Patch Changes
21
-
22
- - 8123929: Fix adapter-vercel using the wrong directory
23
- - Updated dependencies [73dd998]
24
- - Updated dependencies [b800049]
25
- - @sveltejs/app-utils@1.0.0-next.2
26
-
27
- ## 1.0.0-next.2
28
-
29
- ### Patch Changes
30
-
31
- - Fix adapters and convert to ES modules
32
-
33
- ## 1.0.0-next.1
34
-
35
- ### Patch Changes
36
-
37
- - Update to new adapter API
38
-
39
- ## 0.0.3
40
-
41
- ### Patch Changes
42
-
43
- - 67eaeea: Move app-utils stuff into subpackages
44
-
45
- ## 0.0.2
46
-
47
- ### Patch Changes
48
-
49
- - Use setup
50
-
51
- ## 0.0.1
52
-
53
- ### Patch Changes
54
-
55
- - 0320208: Rename 'server route' to 'endpoint'
56
- - 5ca907c: Use shared mkdirp helper
package/files/entry.mjs DELETED
@@ -1,271 +0,0 @@
1
- import { URL, URLSearchParams } from 'url';
2
-
3
- function read_only_form_data() {
4
- /** @type {Map<string, string[]>} */
5
- const map = new Map();
6
-
7
- return {
8
- /**
9
- * @param {string} key
10
- * @param {string} value
11
- */
12
- append(key, value) {
13
- if (map.has(key)) {
14
- map.get(key).push(value);
15
- } else {
16
- map.set(key, [value]);
17
- }
18
- },
19
-
20
- data: new ReadOnlyFormData(map)
21
- };
22
- }
23
-
24
- class ReadOnlyFormData {
25
- /** @type {Map<string, string[]>} */
26
- #map;
27
-
28
- /** @param {Map<string, string[]>} map */
29
- constructor(map) {
30
- this.#map = map;
31
- }
32
-
33
- /** @param {string} key */
34
- get(key) {
35
- const value = this.#map.get(key);
36
- return value && value[0];
37
- }
38
-
39
- /** @param {string} key */
40
- getAll(key) {
41
- return this.#map.get(key);
42
- }
43
-
44
- /** @param {string} key */
45
- has(key) {
46
- return this.#map.has(key);
47
- }
48
-
49
- *[Symbol.iterator]() {
50
- for (const [key, value] of this.#map) {
51
- for (let i = 0; i < value.length; i += 1) {
52
- yield [key, value[i]];
53
- }
54
- }
55
- }
56
-
57
- *entries() {
58
- for (const [key, value] of this.#map) {
59
- for (let i = 0; i < value.length; i += 1) {
60
- yield [key, value[i]];
61
- }
62
- }
63
- }
64
-
65
- *keys() {
66
- for (const [key, value] of this.#map) {
67
- for (let i = 0; i < value.length; i += 1) {
68
- yield key;
69
- }
70
- }
71
- }
72
-
73
- *values() {
74
- for (const [, value] of this.#map) {
75
- for (let i = 0; i < value.length; i += 1) {
76
- yield value;
77
- }
78
- }
79
- }
80
- }
81
-
82
- /** @param {import('http').IncomingMessage} req */
83
- function get_body(req) {
84
- const headers = req.headers;
85
- const has_body =
86
- headers['content-type'] !== undefined &&
87
- // https://github.com/jshttp/type-is/blob/c1f4388c71c8a01f79934e68f630ca4a15fffcd6/index.js#L81-L95
88
- (headers['transfer-encoding'] !== undefined || !isNaN(Number(headers['content-length'])));
89
-
90
- if (!has_body) return Promise.resolve(undefined);
91
-
92
- const [type, ...directives] = headers['content-type'].split(/;\s*/);
93
-
94
- switch (type) {
95
- case 'application/octet-stream':
96
- return get_buffer(req);
97
-
98
- case 'text/plain':
99
- return get_text(req);
100
-
101
- case 'application/json':
102
- return get_json(req);
103
-
104
- case 'application/x-www-form-urlencoded':
105
- return get_urlencoded(req);
106
-
107
- case 'multipart/form-data': {
108
- const boundary = directives.find((directive) => directive.startsWith('boundary='));
109
- if (!boundary) throw new Error('Missing boundary');
110
- return get_multipart(req, boundary.slice('boundary='.length));
111
- }
112
- default:
113
- throw new Error(`Invalid Content-Type ${type}`);
114
- }
115
- }
116
-
117
- /** @param {import('http').IncomingMessage} req */
118
- async function get_json(req) {
119
- return JSON.parse(await get_text(req));
120
- }
121
-
122
- /** @param {import('http').IncomingMessage} req */
123
- async function get_urlencoded(req) {
124
- const text = await get_text(req);
125
-
126
- const { data, append } = read_only_form_data();
127
-
128
- text
129
- .replace(/\+/g, ' ')
130
- .split('&')
131
- .forEach((str) => {
132
- const [key, value] = str.split('=');
133
- append(decodeURIComponent(key), decodeURIComponent(value));
134
- });
135
-
136
- return data;
137
- }
138
-
139
- /**
140
- * @param {import('http').IncomingMessage} req
141
- * @param {string} boundary
142
- */
143
- async function get_multipart(req, boundary) {
144
- const text = await get_text(req);
145
- const parts = text.split(`--${boundary}`);
146
-
147
- const nope = () => {
148
- throw new Error('Malformed form data');
149
- };
150
-
151
- if (parts[0] !== '' || parts[parts.length - 1].trim() !== '--') {
152
- nope();
153
- }
154
-
155
- const { data, append } = read_only_form_data();
156
-
157
- parts.slice(1, -1).forEach((part) => {
158
- const match = /\s*([\s\S]+?)\r\n\r\n([\s\S]*)\s*/.exec(part);
159
- const raw_headers = match[1];
160
- const body = match[2].trim();
161
-
162
- let key;
163
- raw_headers.split('\r\n').forEach((str) => {
164
- const [raw_header, ...raw_directives] = str.split('; ');
165
- let [name, value] = raw_header.split(': ');
166
-
167
- name = name.toLowerCase();
168
-
169
- /** @type {Record<string, string>} */
170
- const directives = {};
171
- raw_directives.forEach((raw_directive) => {
172
- const [name, value] = raw_directive.split('=');
173
- directives[name] = JSON.parse(value); // TODO is this right?
174
- });
175
-
176
- if (name === 'content-disposition') {
177
- if (value !== 'form-data') nope();
178
-
179
- if (directives.filename) {
180
- // TODO we probably don't want to do this automatically
181
- throw new Error('File upload is not yet implemented');
182
- }
183
-
184
- if (directives.name) {
185
- key = directives.name;
186
- }
187
- }
188
- });
189
-
190
- if (!key) nope();
191
-
192
- append(key, body);
193
- });
194
-
195
- return data;
196
- }
197
-
198
- /**
199
- * @param {import('http').IncomingMessage} req
200
- * @returns {Promise<string>}
201
- */
202
- function get_text(req) {
203
- return new Promise((fulfil, reject) => {
204
- let data = '';
205
-
206
- req.on('error', reject);
207
-
208
- req.on('data', (chunk) => {
209
- data += chunk;
210
- });
211
-
212
- req.on('end', () => {
213
- fulfil(data);
214
- });
215
- });
216
- }
217
-
218
- /**
219
- * @param {import('http').IncomingMessage} req
220
- * @returns {Promise<ArrayBuffer>}
221
- */
222
- function get_buffer(req) {
223
- return new Promise((fulfil, reject) => {
224
- let data = new Uint8Array(0);
225
-
226
- req.on('error', reject);
227
-
228
- req.on('data', (chunk) => {
229
- const new_data = new Uint8Array(data.length + chunk.length);
230
-
231
- for (let i = 0; i < data.length; i += 1) {
232
- new_data[i] = data[i];
233
- }
234
-
235
- for (let i = 0; i < chunk.length; i += 1) {
236
- new_data[i + data.length] = chunk[i];
237
- }
238
-
239
- data = new_data;
240
- });
241
-
242
- req.on('end', () => {
243
- fulfil(data.buffer);
244
- });
245
- });
246
- }
247
-
248
- var entry = async (req, res) => {
249
- const host = `${req.headers['x-forwarded-proto']}://${req.headers.host}`;
250
- const { pathname, query = '' } = new URL(req.url || '', host);
251
-
252
- const { render } = await import('./server/app.mjs');
253
-
254
- const rendered = await render({
255
- method: req.method,
256
- headers: req.headers,
257
- path: pathname,
258
- query: new URLSearchParams(query),
259
- body: await get_body(req)
260
- });
261
-
262
- if (rendered) {
263
- const { status, headers, body } = rendered;
264
- return res.writeHead(status, headers).end(body);
265
- }
266
-
267
- return res.writeHead(404).end();
268
- };
269
-
270
- export default entry;
271
- //# sourceMappingURL=entry.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entry.mjs","sources":["../../app-utils/http/get_body/read_only_form_data.js","../../app-utils/http/get_body/index.js","../src/entry.js"],"sourcesContent":["export function read_only_form_data() {\n\t/** @type {Map<string, string[]>} */\n\tconst map = new Map();\n\n\treturn {\n\t\t/**\n\t\t * @param {string} key\n\t\t * @param {string} value\n\t\t */\n\t\tappend(key, value) {\n\t\t\tif (map.has(key)) {\n\t\t\t\tmap.get(key).push(value);\n\t\t\t} else {\n\t\t\t\tmap.set(key, [value]);\n\t\t\t}\n\t\t},\n\n\t\tdata: new ReadOnlyFormData(map)\n\t};\n}\n\nclass ReadOnlyFormData {\n\t/** @type {Map<string, string[]>} */\n\t#map;\n\n\t/** @param {Map<string, string[]>} map */\n\tconstructor(map) {\n\t\tthis.#map = map;\n\t}\n\n\t/** @param {string} key */\n\tget(key) {\n\t\tconst value = this.#map.get(key);\n\t\treturn value && value[0];\n\t}\n\n\t/** @param {string} key */\n\tgetAll(key) {\n\t\treturn this.#map.get(key);\n\t}\n\n\t/** @param {string} key */\n\thas(key) {\n\t\treturn this.#map.has(key);\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tfor (const [key, value] of this.#map) {\n\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\tyield [key, value[i]];\n\t\t\t}\n\t\t}\n\t}\n\n\t*entries() {\n\t\tfor (const [key, value] of this.#map) {\n\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\tyield [key, value[i]];\n\t\t\t}\n\t\t}\n\t}\n\n\t*keys() {\n\t\tfor (const [key, value] of this.#map) {\n\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\tyield key;\n\t\t\t}\n\t\t}\n\t}\n\n\t*values() {\n\t\tfor (const [, value] of this.#map) {\n\t\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\t\tyield value;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { read_only_form_data } from './read_only_form_data.js';\n\n/** @param {import('http').IncomingMessage} req */\nexport function get_body(req) {\n\tconst headers = req.headers;\n\tconst has_body =\n\t\theaders['content-type'] !== undefined &&\n\t\t// https://github.com/jshttp/type-is/blob/c1f4388c71c8a01f79934e68f630ca4a15fffcd6/index.js#L81-L95\n\t\t(headers['transfer-encoding'] !== undefined || !isNaN(Number(headers['content-length'])));\n\n\tif (!has_body) return Promise.resolve(undefined);\n\n\tconst [type, ...directives] = headers['content-type'].split(/;\\s*/);\n\n\tswitch (type) {\n\t\tcase 'application/octet-stream':\n\t\t\treturn get_buffer(req);\n\n\t\tcase 'text/plain':\n\t\t\treturn get_text(req);\n\n\t\tcase 'application/json':\n\t\t\treturn get_json(req);\n\n\t\tcase 'application/x-www-form-urlencoded':\n\t\t\treturn get_urlencoded(req);\n\n\t\tcase 'multipart/form-data': {\n\t\t\tconst boundary = directives.find((directive) => directive.startsWith('boundary='));\n\t\t\tif (!boundary) throw new Error('Missing boundary');\n\t\t\treturn get_multipart(req, boundary.slice('boundary='.length));\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Invalid Content-Type ${type}`);\n\t}\n}\n\n/** @param {import('http').IncomingMessage} req */\nasync function get_json(req) {\n\treturn JSON.parse(await get_text(req));\n}\n\n/** @param {import('http').IncomingMessage} req */\nasync function get_urlencoded(req) {\n\tconst text = await get_text(req);\n\n\tconst { data, append } = read_only_form_data();\n\n\ttext\n\t\t.replace(/\\+/g, ' ')\n\t\t.split('&')\n\t\t.forEach((str) => {\n\t\t\tconst [key, value] = str.split('=');\n\t\t\tappend(decodeURIComponent(key), decodeURIComponent(value));\n\t\t});\n\n\treturn data;\n}\n\n/**\n * @param {import('http').IncomingMessage} req\n * @param {string} boundary\n */\nasync function get_multipart(req, boundary) {\n\tconst text = await get_text(req);\n\tconst parts = text.split(`--${boundary}`);\n\n\tconst nope = () => {\n\t\tthrow new Error('Malformed form data');\n\t};\n\n\tif (parts[0] !== '' || parts[parts.length - 1].trim() !== '--') {\n\t\tnope();\n\t}\n\n\tconst { data, append } = read_only_form_data();\n\n\tparts.slice(1, -1).forEach((part) => {\n\t\tconst match = /\\s*([\\s\\S]+?)\\r\\n\\r\\n([\\s\\S]*)\\s*/.exec(part);\n\t\tconst raw_headers = match[1];\n\t\tconst body = match[2].trim();\n\n\t\tlet key;\n\n\t\t/** @type {Record<string, string>} */\n\t\tconst headers = {};\n\t\traw_headers.split('\\r\\n').forEach((str) => {\n\t\t\tconst [raw_header, ...raw_directives] = str.split('; ');\n\t\t\tlet [name, value] = raw_header.split(': ');\n\n\t\t\tname = name.toLowerCase();\n\t\t\theaders[name] = value;\n\n\t\t\t/** @type {Record<string, string>} */\n\t\t\tconst directives = {};\n\t\t\traw_directives.forEach((raw_directive) => {\n\t\t\t\tconst [name, value] = raw_directive.split('=');\n\t\t\t\tdirectives[name] = JSON.parse(value); // TODO is this right?\n\t\t\t});\n\n\t\t\tif (name === 'content-disposition') {\n\t\t\t\tif (value !== 'form-data') nope();\n\n\t\t\t\tif (directives.filename) {\n\t\t\t\t\t// TODO we probably don't want to do this automatically\n\t\t\t\t\tthrow new Error('File upload is not yet implemented');\n\t\t\t\t}\n\n\t\t\t\tif (directives.name) {\n\t\t\t\t\tkey = directives.name;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tif (!key) nope();\n\n\t\tappend(key, body);\n\t});\n\n\treturn data;\n}\n\n/**\n * @param {import('http').IncomingMessage} req\n * @returns {Promise<string>}\n */\nfunction get_text(req) {\n\treturn new Promise((fulfil, reject) => {\n\t\tlet data = '';\n\n\t\treq.on('error', reject);\n\n\t\treq.on('data', (chunk) => {\n\t\t\tdata += chunk;\n\t\t});\n\n\t\treq.on('end', () => {\n\t\t\tfulfil(data);\n\t\t});\n\t});\n}\n\n/**\n * @param {import('http').IncomingMessage} req\n * @returns {Promise<ArrayBuffer>}\n */\nfunction get_buffer(req) {\n\treturn new Promise((fulfil, reject) => {\n\t\tlet data = new Uint8Array(0);\n\n\t\treq.on('error', reject);\n\n\t\treq.on('data', (chunk) => {\n\t\t\tconst new_data = new Uint8Array(data.length + chunk.length);\n\n\t\t\tfor (let i = 0; i < data.length; i += 1) {\n\t\t\t\tnew_data[i] = data[i];\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < chunk.length; i += 1) {\n\t\t\t\tnew_data[i + data.length] = chunk[i];\n\t\t\t}\n\n\t\t\tdata = new_data;\n\t\t});\n\n\t\treq.on('end', () => {\n\t\t\tfulfil(data.buffer);\n\t\t});\n\t});\n}\n","import { URL, URLSearchParams } from 'url';\nimport { get_body } from '@sveltejs/app-utils/http';\n\nexport default async (req, res) => {\n\tconst host = `${req.headers['x-forwarded-proto']}://${req.headers.host}`;\n\tconst { pathname, query = '' } = new URL(req.url || '', host);\n\n\tconst { render } = await import('./server/app.mjs');\n\n\tconst rendered = await render({\n\t\tmethod: req.method,\n\t\theaders: req.headers,\n\t\tpath: pathname,\n\t\tquery: new URLSearchParams(query),\n\t\tbody: await get_body(req)\n\t});\n\n\tif (rendered) {\n\t\tconst { status, headers, body } = rendered;\n\t\treturn res.writeHead(status, headers).end(body);\n\t}\n\n\treturn res.writeHead(404).end();\n};\n"],"names":[],"mappings":";;AAAO,SAAS,mBAAmB,GAAG;AACtC;AACA,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;AACvB;AACA,CAAC,OAAO;AACR;AACA;AACA;AACA;AACA,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE;AACrB,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AACrB,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,IAAI,MAAM;AACV,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,IAAI;AACJ,GA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ACJ;AACA,CAAC,IAAI,QAAQ,EAAE;AACf,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;AAC7C,EAAE,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAClD,EAAE;AACF;AACA,CAAC,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACjC,CAAC;;;;"}
package/files/index.js DELETED
@@ -1,4 +0,0 @@
1
- module.exports = async (res, req) => {
2
- const { default: app } = await import('./entry.mjs');
3
- await app(res, req);
4
- };