@sveltejs/adapter-vercel 1.0.0-next.6 → 1.0.0-next.60

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,53 @@
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/[YOUR_USERNAME]/[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
+ ## Notes
40
+
41
+ ### Vercel functions
42
+
43
+ Vercel functions contained in the `/api` directory at the project's root will _not_ be included in the deployment — these should be implemented as [endpoints](https://kit.svelte.dev/docs/routing#endpoints) in your SvelteKit app.
44
+
45
+ ### Node version
46
+
47
+ Projects created before a certain date will default to using Node 14, while SvelteKit requires Node 16 or later. You can change that in your project settings:
48
+
49
+ ![Vercel project settings](settings.png)
50
+
51
+ ## Changelog
52
+
53
+ [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 { installPolyfills } from '@sveltejs/kit/node/polyfills';
2
+ import { getRequest, setResponse } from '@sveltejs/kit/node';
3
+ import { Server } from 'SERVER';
4
+ import { manifest } from 'MANIFEST';
5
+
6
+ installPolyfills();
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,9 @@
1
+ import { Adapter } from '@sveltejs/kit';
2
+
3
+ type Options = {
4
+ edge?: boolean;
5
+ external?: string[];
6
+ split?: boolean;
7
+ };
8
+
9
+ export default function plugin(options?: Options): Adapter;
package/index.js CHANGED
@@ -1,54 +1,473 @@
1
- import { writeFileSync, mkdirSync, renameSync } from 'fs';
2
- import { resolve, join } from 'path';
3
- import { copy } from '@sveltejs/app-utils/files';
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { nodeFileTrace } from '@vercel/nft';
5
+ import esbuild from 'esbuild';
4
6
 
5
- module.exports = function () {
6
- /** @type {import('@sveltejs/kit').Adapter} */
7
- const adapter = {
7
+ // rules for clean URLs and trailing slash handling,
8
+ // generated with @vercel/routing-utils
9
+ const redirects = {
10
+ always: [
11
+ {
12
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
13
+ headers: {
14
+ Location: '/$1/'
15
+ },
16
+ status: 308
17
+ },
18
+ {
19
+ src: '^/(.*)\\.html/?$',
20
+ headers: {
21
+ Location: '/$1/'
22
+ },
23
+ status: 308
24
+ },
25
+ {
26
+ src: '^/\\.well-known(?:/.*)?$'
27
+ },
28
+ {
29
+ src: '^/((?:[^/]+/)*[^/\\.]+)$',
30
+ headers: {
31
+ Location: '/$1/'
32
+ },
33
+ status: 308
34
+ },
35
+ {
36
+ src: '^/((?:[^/]+/)*[^/]+\\.\\w+)/$',
37
+ headers: {
38
+ Location: '/$1'
39
+ },
40
+ status: 308
41
+ }
42
+ ],
43
+ never: [
44
+ {
45
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
46
+ headers: {
47
+ Location: '/$1'
48
+ },
49
+ status: 308
50
+ },
51
+ {
52
+ src: '^/(.*)\\.html/?$',
53
+ headers: {
54
+ Location: '/$1'
55
+ },
56
+ status: 308
57
+ },
58
+ {
59
+ src: '^/(.*)/$',
60
+ headers: {
61
+ Location: '/$1'
62
+ },
63
+ status: 308
64
+ }
65
+ ],
66
+ ignore: [
67
+ {
68
+ src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
69
+ headers: {
70
+ Location: '/$1'
71
+ },
72
+ status: 308
73
+ },
74
+ {
75
+ src: '^/(.*)\\.html/?$',
76
+ headers: {
77
+ Location: '/$1'
78
+ },
79
+ status: 308
80
+ }
81
+ ]
82
+ };
83
+
84
+ const files = fileURLToPath(new URL('./files', import.meta.url).href);
85
+
86
+ /** @type {import('.').default} **/
87
+ export default function ({ external = [], edge, split } = {}) {
88
+ return {
8
89
  name: '@sveltejs/adapter-vercel',
9
90
 
10
91
  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
92
+ if (process.env.ENABLE_VC_BUILD) {
93
+ await v3(builder, external, edge, split);
94
+ } else {
95
+ if (edge || split) {
96
+ throw new Error('`edge` and `split` options can only be used with ENABLE_VC_BUILD');
97
+ }
98
+
99
+ await v1(builder, external);
37
100
  }
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
101
  }
51
102
  };
103
+ }
52
104
 
53
- return adapter;
54
- };
105
+ /**
106
+ * @param {import('@sveltejs/kit').Builder} builder
107
+ * @param {string[]} external
108
+ */
109
+ async function v1(builder, external) {
110
+ const node_version = get_node_version();
111
+
112
+ const dir = '.vercel_build_output';
113
+
114
+ const tmp = builder.getBuildDirectory('vercel-tmp');
115
+
116
+ builder.rimraf(dir);
117
+ builder.rimraf(tmp);
118
+
119
+ const dirs = {
120
+ static: `${dir}/static`,
121
+ lambda: `${dir}/functions/node/render`
122
+ };
123
+
124
+ builder.log.minor('Generating serverless function...');
125
+
126
+ const relativePath = path.posix.relative(tmp, builder.getServerDirectory());
127
+
128
+ builder.copy(`${files}/serverless.js`, `${tmp}/serverless.js`, {
129
+ replace: {
130
+ SERVER: `${relativePath}/index.js`,
131
+ MANIFEST: './manifest.js'
132
+ }
133
+ });
134
+
135
+ fs.writeFileSync(
136
+ `${tmp}/manifest.js`,
137
+ `export const manifest = ${builder.generateManifest({
138
+ relativePath
139
+ })};\n`
140
+ );
141
+
142
+ await esbuild.build({
143
+ entryPoints: [`${tmp}/serverless.js`],
144
+ outfile: `${dirs.lambda}/index.js`,
145
+ target: `node${node_version.full}`,
146
+ bundle: true,
147
+ platform: 'node',
148
+ external,
149
+ format: 'cjs',
150
+ sourcemap: 'linked'
151
+ });
152
+
153
+ fs.writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'commonjs' }));
154
+
155
+ builder.log.minor('Copying assets...');
156
+
157
+ builder.writeStatic(dirs.static);
158
+ builder.writeClient(dirs.static);
159
+ builder.writePrerendered(dirs.static);
160
+
161
+ builder.log.minor('Writing routes...');
162
+
163
+ builder.mkdirp(`${dir}/config`);
164
+
165
+ const prerendered_pages = Array.from(builder.prerendered.pages, ([src, page]) => ({
166
+ src,
167
+ dest: page.file
168
+ }));
169
+
170
+ const prerendered_redirects = Array.from(builder.prerendered.redirects, ([src, redirect]) => ({
171
+ src,
172
+ headers: {
173
+ Location: redirect.location
174
+ },
175
+ status: redirect.status
176
+ }));
177
+
178
+ fs.writeFileSync(
179
+ `${dir}/config/routes.json`,
180
+ JSON.stringify([
181
+ ...redirects[builder.config.kit.trailingSlash],
182
+ ...prerendered_pages,
183
+ ...prerendered_redirects,
184
+ {
185
+ src: `/${builder.config.kit.appDir}/immutable/.+`,
186
+ headers: {
187
+ 'cache-control': 'public, immutable, max-age=31536000'
188
+ }
189
+ },
190
+ {
191
+ handle: 'filesystem'
192
+ },
193
+ {
194
+ src: '/.*',
195
+ dest: '.vercel/functions/render'
196
+ }
197
+ ])
198
+ );
199
+ }
200
+
201
+ /**
202
+ * @param {import('@sveltejs/kit').Builder} builder
203
+ * @param {string[]} external
204
+ * @param {boolean} edge
205
+ * @param {boolean} split
206
+ */
207
+ async function v3(builder, external, edge, split) {
208
+ const node_version = get_node_version();
209
+
210
+ const dir = '.vercel/output';
211
+
212
+ const tmp = builder.getBuildDirectory('vercel-tmp');
213
+
214
+ builder.rimraf(dir);
215
+ builder.rimraf(tmp);
216
+
217
+ const files = fileURLToPath(new URL('./files', import.meta.url).href);
218
+
219
+ const dirs = {
220
+ static: `${dir}/static`,
221
+ functions: `${dir}/functions`
222
+ };
223
+
224
+ const prerendered_redirects = Array.from(builder.prerendered.redirects, ([src, redirect]) => ({
225
+ src,
226
+ headers: {
227
+ Location: redirect.location
228
+ },
229
+ status: redirect.status
230
+ }));
231
+
232
+ /** @type {any[]} */
233
+ const routes = [
234
+ ...redirects[builder.config.kit.trailingSlash],
235
+ ...prerendered_redirects,
236
+ {
237
+ src: `/${builder.config.kit.appDir}/.+`,
238
+ headers: {
239
+ 'cache-control': 'public, immutable, max-age=31536000'
240
+ }
241
+ },
242
+ {
243
+ handle: 'filesystem'
244
+ }
245
+ ];
246
+
247
+ builder.log.minor('Generating serverless function...');
248
+
249
+ /**
250
+ * @param {string} name
251
+ * @param {string} pattern
252
+ * @param {(options: { relativePath: string }) => string} generate_manifest
253
+ */
254
+ async function generate_serverless_function(name, pattern, generate_manifest) {
255
+ const relativePath = path.posix.relative(tmp, builder.getServerDirectory());
256
+
257
+ builder.copy(`${files}/serverless.js`, `${tmp}/index.js`, {
258
+ replace: {
259
+ SERVER: `${relativePath}/index.js`,
260
+ MANIFEST: './manifest.js'
261
+ }
262
+ });
263
+
264
+ write(
265
+ `${tmp}/manifest.js`,
266
+ `export const manifest = ${generate_manifest({ relativePath })};\n`
267
+ );
268
+
269
+ await create_function_bundle(
270
+ `${tmp}/index.js`,
271
+ `${dirs.functions}/${name}.func`,
272
+ `nodejs${node_version.major}.x`
273
+ );
274
+
275
+ routes.push({ src: pattern, dest: `/${name}` });
276
+ }
277
+
278
+ /**
279
+ * @param {string} name
280
+ * @param {string} pattern
281
+ * @param {(options: { relativePath: string }) => string} generate_manifest
282
+ */
283
+ async function generate_edge_function(name, pattern, generate_manifest) {
284
+ const tmp = builder.getBuildDirectory(`vercel-tmp/${name}`);
285
+ const relativePath = path.posix.relative(tmp, builder.getServerDirectory());
286
+
287
+ builder.copy(`${files}/edge.js`, `${tmp}/edge.js`, {
288
+ replace: {
289
+ SERVER: `${relativePath}/index.js`,
290
+ MANIFEST: './manifest.js'
291
+ }
292
+ });
293
+
294
+ write(
295
+ `${tmp}/manifest.js`,
296
+ `export const manifest = ${generate_manifest({ relativePath })};\n`
297
+ );
298
+
299
+ await esbuild.build({
300
+ entryPoints: [`${tmp}/edge.js`],
301
+ outfile: `${dirs.functions}/${name}.func/index.js`,
302
+ target: 'es2020', // TODO verify what the edge runtime supports
303
+ bundle: true,
304
+ platform: 'node',
305
+ format: 'esm',
306
+ external,
307
+ sourcemap: 'linked'
308
+ });
309
+
310
+ write(
311
+ `${dirs.functions}/${name}.func/.vc-config.json`,
312
+ JSON.stringify({
313
+ runtime: 'edge',
314
+ entrypoint: 'index.js'
315
+ // TODO expose envVarsInUse
316
+ })
317
+ );
318
+
319
+ routes.push({ src: pattern, dest: `/${name}` });
320
+ }
321
+
322
+ const generate_function = edge ? generate_edge_function : generate_serverless_function;
323
+
324
+ if (split) {
325
+ await builder.createEntries((route) => {
326
+ return {
327
+ id: route.pattern.toString(), // TODO is `id` necessary?
328
+ filter: (other) => route.pattern.toString() === other.pattern.toString(),
329
+ complete: async (entry) => {
330
+ let sliced_pattern = route.pattern
331
+ .toString()
332
+ // remove leading / and trailing $/
333
+ .slice(1, -2)
334
+ // replace escaped \/ with /
335
+ .replace(/\\\//g, '/');
336
+
337
+ // replace the root route "^/" with "^/?"
338
+ if (sliced_pattern === '^/') {
339
+ sliced_pattern = '^/?';
340
+ }
341
+
342
+ const src = `${sliced_pattern}(?:/__data.json)?$`; // TODO adding /__data.json is a temporary workaround — those endpoints should be treated as distinct routes
343
+
344
+ await generate_function(route.id || 'index', src, entry.generateManifest);
345
+ }
346
+ };
347
+ });
348
+ } else {
349
+ await generate_function('render', '/.*', builder.generateManifest);
350
+ }
351
+
352
+ builder.log.minor('Copying assets...');
353
+
354
+ builder.writeStatic(dirs.static);
355
+ builder.writeClient(dirs.static);
356
+ builder.writePrerendered(dirs.static);
357
+
358
+ builder.log.minor('Writing routes...');
359
+
360
+ /** @type {Record<string, { path: string }>} */
361
+ const overrides = {};
362
+ builder.prerendered.pages.forEach((page, src) => {
363
+ overrides[page.file] = { path: src.slice(1) };
364
+ });
365
+
366
+ write(
367
+ `${dir}/config.json`,
368
+ JSON.stringify({
369
+ version: 3,
370
+ routes,
371
+ overrides
372
+ })
373
+ );
374
+ }
375
+
376
+ /**
377
+ * @param {string} file
378
+ * @param {string} data
379
+ */
380
+ function write(file, data) {
381
+ try {
382
+ fs.mkdirSync(path.dirname(file), { recursive: true });
383
+ } catch {
384
+ // do nothing
385
+ }
386
+
387
+ fs.writeFileSync(file, data);
388
+ }
389
+
390
+ function get_node_version() {
391
+ const full = process.version.slice(1); // 'v16.5.0' --> '16.5.0'
392
+ const major = parseInt(full.split('.')[0]); // '16.5.0' --> 16
393
+
394
+ if (major < 16) {
395
+ throw new Error(
396
+ `SvelteKit only supports Node.js version 16 or greater (currently using v${full}). Consult the documentation: https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version`
397
+ );
398
+ }
399
+
400
+ return { major, full };
401
+ }
402
+
403
+ /**
404
+ * @param {string} entry
405
+ * @param {string} dir
406
+ * @param {string} runtime
407
+ */
408
+ async function create_function_bundle(entry, dir, runtime) {
409
+ let base = entry;
410
+ while (base !== (base = path.dirname(base)));
411
+
412
+ const traced = await nodeFileTrace([entry], { base });
413
+
414
+ traced.warnings.forEach((error) => {
415
+ // pending https://github.com/vercel/nft/issues/284
416
+ if (error.message.startsWith('Failed to resolve dependency node:')) return;
417
+ console.error(error);
418
+ });
419
+
420
+ // find common ancestor directory
421
+ let common_parts;
422
+
423
+ for (const file of traced.fileList) {
424
+ if (common_parts) {
425
+ const parts = file.split(path.sep);
426
+
427
+ for (let i = 0; i < common_parts.length; i += 1) {
428
+ if (parts[i] !== common_parts[i]) {
429
+ common_parts = common_parts.slice(0, i);
430
+ break;
431
+ }
432
+ }
433
+ } else {
434
+ common_parts = path.dirname(file).split(path.sep);
435
+ }
436
+ }
437
+
438
+ const ancestor = base + common_parts.join(path.sep);
439
+
440
+ for (const file of traced.fileList) {
441
+ const source = base + file;
442
+ const dest = path.join(dir, path.relative(ancestor, source));
443
+
444
+ const stats = fs.statSync(source);
445
+ const is_dir = stats.isDirectory();
446
+
447
+ const realpath = fs.realpathSync(source);
448
+
449
+ try {
450
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
451
+ } catch {
452
+ // do nothing
453
+ }
454
+
455
+ if (source !== realpath) {
456
+ const realdest = path.join(dir, path.relative(ancestor, realpath));
457
+ fs.symlinkSync(path.relative(path.dirname(dest), realdest), dest, is_dir ? 'dir' : 'file');
458
+ } else if (!is_dir) {
459
+ fs.copyFileSync(source, dest);
460
+ }
461
+ }
462
+
463
+ write(
464
+ `${dir}/.vc-config.json`,
465
+ JSON.stringify({
466
+ runtime,
467
+ handler: path.relative(base + ancestor, entry),
468
+ launcherType: 'Nodejs'
469
+ })
470
+ );
471
+
472
+ write(`${dir}/package.json`, JSON.stringify({ type: 'module' }));
473
+ }
package/package.json CHANGED
@@ -1,26 +1,40 @@
1
1
  {
2
- "name": "@sveltejs/adapter-vercel",
3
- "version": "1.0.0-next.6",
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
- "@sveltejs/kit": "1.0.0-next.54",
22
- "rollup": "^2.41.1",
23
- "sirv": "^1.0.11",
24
- "typescript": "^4.2.3"
25
- }
26
- }
2
+ "name": "@sveltejs/adapter-vercel",
3
+ "version": "1.0.0-next.60",
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
+ "types": "./index.d.ts",
15
+ "import": "./index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "main": "index.js",
20
+ "types": "index.d.ts",
21
+ "files": [
22
+ "files",
23
+ "index.d.ts"
24
+ ],
25
+ "dependencies": {
26
+ "@vercel/nft": "^0.20.0",
27
+ "esbuild": "^0.14.42"
28
+ },
29
+ "devDependencies": {
30
+ "@sveltejs/kit": "1.0.0-next.363",
31
+ "@types/node": "^16.11.36",
32
+ "typescript": "^4.7.4"
33
+ },
34
+ "scripts": {
35
+ "lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
36
+ "format": "npm run check-format -- --write",
37
+ "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
38
+ "check": "tsc"
39
+ }
40
+ }
package/CHANGELOG.md DELETED
@@ -1,62 +0,0 @@
1
- # @sveltejs/adapter-vercel
2
-
3
- ## 1.0.0-next.6
4
-
5
- ### Patch Changes
6
-
7
- - 8805c6d: Pass adapters directly to svelte.config.cjs
8
-
9
- ## 1.0.0-next.5
10
-
11
- ### Patch Changes
12
-
13
- - f35a5cd: Change adapter signature
14
-
15
- ## 1.0.0-next.4
16
-
17
- ### Patch Changes
18
-
19
- - c3cf3f3: Bump deps
20
- - d742029: Fix mixed usage of CJS and ESM
21
- - Updated dependencies [c3cf3f3]
22
- - @sveltejs/app-utils@1.0.0-next.3
23
-
24
- ## 1.0.0-next.3
25
-
26
- ### Patch Changes
27
-
28
- - 8123929: Fix adapter-vercel using the wrong directory
29
- - Updated dependencies [73dd998]
30
- - Updated dependencies [b800049]
31
- - @sveltejs/app-utils@1.0.0-next.2
32
-
33
- ## 1.0.0-next.2
34
-
35
- ### Patch Changes
36
-
37
- - Fix adapters and convert to ES modules
38
-
39
- ## 1.0.0-next.1
40
-
41
- ### Patch Changes
42
-
43
- - Update to new adapter API
44
-
45
- ## 0.0.3
46
-
47
- ### Patch Changes
48
-
49
- - 67eaeea: Move app-utils stuff into subpackages
50
-
51
- ## 0.0.2
52
-
53
- ### Patch Changes
54
-
55
- - Use setup
56
-
57
- ## 0.0.1
58
-
59
- ### Patch Changes
60
-
61
- - 0320208: Rename 'server route' to 'endpoint'
62
- - 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,GAAG;AACH;AACA,EAAE,IAAI,EAAE,IAAI,gBAAgB,CAAC,GAAG,CAAC;AACjC,EAAE,CAAC;AACH,CAAC;AACD;AACA,MAAM,gBAAgB,CAAC;AACvB;AACA,CAAC,IAAI;AACL;AACA;AACA,CAAC,WAAW,CAAC,GAAG,EAAE;AAClB,EAAE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;AAClB,EAAE;AACF;AACA;AACA,CAAC,GAAG,CAAC,GAAG,EAAE;AACV,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnC,EAAE,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3B,EAAE;AACF;AACA;AACA,CAAC,MAAM,CAAC,GAAG,EAAE;AACb,EA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AC;AACJ;;ACvKA,YAAe,OAAO,GAAG,EAAE,GAAG,KAAK;AACnC,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/D;AACA,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,kBAAkB,CAAC,CAAC;AACrD;AACA,CAAC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC;AAC/B,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM;AACpB,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO;AACtB,EAAE,IAAI,EAAE,QAAQ;AAChB,EAAE,KAAK,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC;AACnC,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC;AAC3B,EAAE,CAAC,CAAC;AACJ;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
- };