Skip to content

Commit

Permalink
various cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Oct 15, 2021
1 parent a862f9e commit 19414ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/adapter-node/src/env.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const path = process.env['PATH'] || false;
export const path = process.env['SOCKET_PATH'] || false;
export const host = process.env['HOST'] || '0.0.0.0';
export const port = process.env['PORT'] || (!path && 3000);
1 change: 1 addition & 0 deletions packages/adapter-node/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './shims';
import { path, host, port } from './env';
import { assetsMiddleware, kitMiddleware, prerenderedMiddleware } from './middlewares';
import compression from 'compression';
Expand Down
16 changes: 8 additions & 8 deletions packages/adapter-node/src/shims.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createRequire } from 'module';
export { fetch, Response, Request, Headers } from '@sveltejs/kit/install-fetch';
import { fetch, Response, Request, Headers } from '@sveltejs/kit/install-fetch';

// esbuild automatically renames "require"
// So we still have to use Object.defineProperty here
Object.defineProperty(globalThis, 'require', {
enumerable: true,
value: createRequire(import.meta.url)
});
// @ts-expect-error
globalThis.fetch = fetch;
// @ts-expect-error
globalThis.Response = Response;
// @ts-expect-error
globalThis.Request = Request;
globalThis.Headers = Headers;
8 changes: 3 additions & 5 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ export default function (options) {
lambda: join(dir, 'functions/node/render')
};

// TODO ideally we'd have something like utils.tmpdir('vercel')
// rather than hardcoding '.svelte-kit/vercel/entry.js', and the
// relative import from that file to output/server/app.js
// would be controlled. at the moment we're exposing
// implementation details that could change
// TODO ideally we'd have something like utils.tmpdir('vercel') rather
// than hardcoding '.svelte-kit/vercel/entry.js'. At the moment we're
// exposing implementation details that could change
utils.log.minor('Generating serverless function...');
utils.copy(join(files, 'entry.js'), '.svelte-kit/vercel/entry.js');

Expand Down

0 comments on commit 19414ce

Please sign in to comment.