Skip to content

Commit

Permalink
[chore] remove cwd as a method parameter (#5040)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored May 23, 2022
1 parent b6c88df commit 7ee26ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 1 addition & 5 deletions packages/kit/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ prog
async function start(config) {
const { dev } = await import('./core/dev/index.js');

const cwd = process.cwd();

const { address_info, server_config, close } = await dev({
cwd,
port,
host,
https,
Expand All @@ -82,8 +79,7 @@ prog
open: first && (open || !!server_config.open),
base: config.kit.paths.base,
loose: server_config.fs.strict === false,
allow: server_config.fs.allow,
cwd
allow: server_config.fs.allow
});

first = false;
Expand Down
7 changes: 4 additions & 3 deletions packages/kit/src/core/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { get_aliases, get_runtime_path } from '../utils.js';
import { create_plugin } from './plugin.js';
import * as sync from '../sync/sync.js';

const cwd = process.cwd();

/**
* @typedef {{
* cwd: string,
* port: number,
* host?: string,
* https: boolean,
Expand All @@ -19,7 +20,7 @@ import * as sync from '../sync/sync.js';
*/

/** @param {Options} opts */
export async function dev({ cwd, port, host, https, config }) {
export async function dev({ port, host, https, config }) {
sync.init(config);

const [vite_config] = deep_merge(
Expand Down Expand Up @@ -71,7 +72,7 @@ export async function dev({ cwd, port, host, https, config }) {
},
configFile: false
}),
await create_plugin(config, cwd)
await create_plugin(config)
],
base: '/'
});
Expand Down
5 changes: 3 additions & 2 deletions packages/kit/src/core/dev/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import { parse_route_id } from '../../utils/routing.js';
// https://github.com/vitejs/vite/blob/3edd1af56e980aef56641a5a51cf2932bb580d41/packages/vite/src/node/plugins/css.ts#L96
const style_pattern = /\.(css|less|sass|scss|styl|stylus|pcss|postcss)$/;

const cwd = process.cwd();

/**
* @param {import('types').ValidatedConfig} config
* @param {string} cwd
* @returns {Promise<import('vite').Plugin>}
*/
export async function create_plugin(config, cwd) {
export async function create_plugin(config) {
const runtime = get_runtime_path(config);

process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';
Expand Down

0 comments on commit 7ee26ad

Please sign in to comment.