@sveltejs/kit
Advanced tools
Comparing version 1.0.0-next.36 to 1.0.0-next.37
# @sveltejs/kit | ||
## 1.0.0-next.37 | ||
### Patch Changes | ||
- 230c6d9: Indicate which request failed, if fetch fails inside load function | ||
- f1bc218: Run adapt via svelte-kit build | ||
- 6850ddc: Fix svelte-kit start for Windows | ||
## 1.0.0-next.36 | ||
@@ -4,0 +12,0 @@ |
@@ -7,3 +7,3 @@ import { existsSync } from 'fs'; | ||
var version = "1.0.0-next.36"; | ||
var version = "1.0.0-next.37"; | ||
@@ -100,3 +100,4 @@ async function get_config() { | ||
.describe('Create a production build of your app') | ||
.action(async () => { | ||
.option('--verbose', 'Log more stuff', false) | ||
.action(async ({ verbose }) => { | ||
process.env.NODE_ENV = 'production'; | ||
@@ -106,5 +107,20 @@ const config = await get_config(); | ||
const { build } = await import('./index3.js'); | ||
const { adapt } = await import('./index6.js'); | ||
try { | ||
await build(config); | ||
const cwd = '.svelte/output'; | ||
await build(config, { cwd }); | ||
console.log(`\nRun ${$.bold().cyan('npm start')} to try your app locally.`); | ||
if (config.adapter[0]) { | ||
await adapt(config, { cwd, verbose }); | ||
} else { | ||
console.log($.bold().yellow('\nNo adapter specified')); | ||
// prettier-ignore | ||
console.log( | ||
`See ${$.bold().cyan('https://kit.svelte.dev/docs#adapters')} to learn how to configure your app to run on the platform of your choosing` | ||
); | ||
} | ||
} catch (error) { | ||
@@ -136,2 +152,3 @@ handle_error(error); | ||
// For the benefit of early-adopters. Can later be removed | ||
prog | ||
@@ -142,12 +159,3 @@ .command('adapt') | ||
.action(async ({ verbose }) => { | ||
process.env.NODE_ENV = 'production'; | ||
const config = await get_config(); | ||
const { adapt } = await import('./index6.js'); | ||
try { | ||
await adapt(config, { verbose }); | ||
} catch (error) { | ||
handle_error(error); | ||
} | ||
console.log('"svelte-kit build" will now run the adapter'); | ||
}); | ||
@@ -154,0 +162,0 @@ |
@@ -14,5 +14,4 @@ import fs, { writeFileSync, readFileSync } from 'fs'; | ||
const build_dir = '.svelte/build'; | ||
const output_dir = '.svelte/output'; | ||
async function build(config) { | ||
async function build(config, { cwd }) { | ||
const manifest = create_manifest_data({ | ||
@@ -40,3 +39,3 @@ config, | ||
const client_entry_file = `${build_dir}/runtime/internal/start.js`; | ||
const client_out_dir = `${output_dir}/client/${config.appDir}`; | ||
const client_out_dir = `${cwd}/client/${config.appDir}`; | ||
const client_manifest_file = `${client_out_dir}/manifest.json`; | ||
@@ -257,3 +256,3 @@ | ||
}, | ||
outDir: `${output_dir}/server` | ||
outDir: `${cwd}/server` | ||
}, | ||
@@ -260,0 +259,0 @@ resolve: { |
import { readdirSync, statSync, existsSync, createReadStream, readFileSync } from 'fs'; | ||
import { createServer } from 'http'; | ||
import { parse as parse$1, URLSearchParams } from 'url'; | ||
import { pathToFileURL, parse as parse$1, URLSearchParams } from 'url'; | ||
import { resolve, join, normalize } from 'path'; | ||
@@ -256,3 +256,3 @@ import { M as Mime_1, s as standard } from './standard.js'; | ||
const app_file = resolve('.svelte/output/server/app.js'); | ||
const app = await import(app_file); | ||
const app = await import(pathToFileURL(app_file)); | ||
@@ -259,0 +259,0 @@ const static_handler = existsSync(config.files.assets) |
@@ -493,2 +493,3 @@ import { $ } from './index.js'; | ||
const seen = new Set(); | ||
const seen_files = new Set(); | ||
@@ -614,15 +615,20 @@ const server_root = resolve$1(dir); | ||
const resolved = resolve$2(path, href); | ||
if (resolved[0] !== '/') continue; | ||
if (seen_files.has(resolved)) continue; | ||
const parsed = parse(resolved); | ||
const file = parsed.pathname.replace(config.paths.assets, ''); | ||
const file = parsed.pathname.replace(config.paths.assets, '').slice(1); | ||
const file_exists = | ||
(file.startsWith(`/${config.appDir}/`) && fs.existsSync(`${dir}/client/${file}`)) || | ||
(file.startsWith(`${config.appDir}/`) && fs.existsSync(`${dir}/client/${file}`)) || | ||
fs.existsSync(`${out}/${file}`) || | ||
fs.existsSync(`${config.files.static}/${file}`) || | ||
fs.existsSync(`${config.files.static}/${file}/index.html`); | ||
fs.existsSync(`${config.files.assets}/${file}`) || | ||
fs.existsSync(`${config.files.assets}/${file}/index.html`); | ||
if (file_exists) continue; | ||
if (file_exists) { | ||
seen_files.add(resolved); | ||
continue; | ||
} | ||
@@ -671,7 +677,7 @@ if (parsed.query) ; | ||
class Builder { | ||
#generated_files; | ||
#cwd; | ||
#config; | ||
constructor({ generated_files, config, log }) { | ||
this.#generated_files = generated_files; | ||
constructor({ cwd, config, log }) { | ||
this.#cwd = cwd; | ||
this.#config = config; | ||
@@ -683,7 +689,7 @@ | ||
copy_client_files(dest) { | ||
copy(`${this.#generated_files}/client`, dest, (file) => file[0] !== '.'); | ||
copy(`${this.#cwd}/client`, dest, (file) => file[0] !== '.'); | ||
} | ||
copy_server_files(dest) { | ||
copy(`${this.#generated_files}/server`, dest, (file) => file[0] !== '.'); | ||
copy(`${this.#cwd}/server`, dest, (file) => file[0] !== '.'); | ||
} | ||
@@ -700,3 +706,3 @@ | ||
force, | ||
dir: this.#generated_files, | ||
dir: this.#cwd, | ||
config: this.#config, | ||
@@ -709,3 +715,3 @@ log: this.log | ||
async function adapt(config, { verbose }) { | ||
async function adapt(config, { cwd, verbose }) { | ||
if (!config.adapter) { | ||
@@ -721,7 +727,3 @@ throw new Error('No adapter specified'); | ||
const builder = new Builder({ | ||
generated_files: '.svelte/build/optimized', | ||
config, | ||
log | ||
}); | ||
const builder = new Builder({ cwd, config, log }); | ||
@@ -728,0 +730,0 @@ const require = createRequire(import.meta.url); |
{ | ||
"name": "@sveltejs/kit", | ||
"version": "1.0.0-next.36", | ||
"version": "1.0.0-next.37", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
969066
8198
20
21