Socket
Socket
Sign inDemoInstall

@sveltejs/kit

Package Overview
Dependencies
Maintainers
3
Versions
782
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/kit - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

client/app.d.ts

992

assets/client.js

@@ -1,122 +0,42 @@

import { getContext } from 'svelte';
import { writable } from 'svelte/store';
import { routes, components, ErrorComponent } from './manifest.js';
import root from './root.svelte';
import { routes, Layout, components } from './manifest.js';
function goto(
href,
opts = {
noscroll: false,
replaceState: false
}
) {
const target = select_target(new URL(href, document.baseURI));
if (target) {
_history[opts.replaceState ? 'replaceState' : 'pushState'](
{ id: cid },
'',
href
);
return navigate(target, null, opts.noscroll).then(() => {});
}
location.href = href;
return new Promise((f) => {}); // never resolves
let current_component;
function get_current_component() {
throw new Error(`Function called outside component initialization`);
}
/** Callback to inform of a value updates. */
function page_store(value) {
const store = writable(value);
let ready = true;
function notify() {
ready = true;
store.update(val => val);
}
function set(new_value) {
ready = false;
store.set(new_value);
}
function subscribe(run) {
let old_value;
return store.subscribe((new_value) => {
if (old_value === undefined || (ready && new_value !== old_value)) {
run(old_value = new_value);
}
});
}
return { notify, set, subscribe };
function getContext(key) {
return get_current_component().$$.context.get(key);
}
const initial_data = typeof __SVELTE__ !== 'undefined' && __SVELTE__;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
let ready = false;
let root_component;
let current_token;
let layout_preloaded;
let current_branch = [];
let current_query = '{}';
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
const stores = {
page: page_store({}),
preloading: writable(null),
session: writable(initial_data && initial_data.session)
};
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
let $session;
let session_dirty;
stores.session.subscribe(async value => {
$session = value;
if (!ready) return;
session_dirty = true;
const dest = select_target(new URL(location.href));
const token = current_token = {};
const { redirect, props, branch } = await hydrate_target(dest);
if (token !== current_token) return; // a secondary navigation happened while we were loading
if (redirect) {
await goto(redirect.location, { replaceState: true });
} else {
await render(branch, props, dest.page);
}
});
let prefetching
= null;
function set_prefetching(href, promise) {
prefetching = { href, promise };
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
let target;
function set_target(element) {
target = element;
function find_anchor(node) {
while (node && node.nodeName.toUpperCase() !== 'A')
node = node.parentNode; // SVG <a> elements have a lowercase name
return node;
}

@@ -126,427 +46,497 @@

function set_uid(n) {
uid = n;
uid = n;
}
let cid;
function set_cid(n) {
cid = n;
cid = n;
}
const _history = typeof history !== 'undefined' ? history : {
pushState: (state, title, href) => {},
replaceState: (state, title, href) => {},
scrollRestoration: ''
pushState: () => { },
replaceState: () => { },
scrollRestoration: 'auto'
};
const scroll_history = {};
function load_current_page() {
return Promise.resolve().then(() => {
const { hash, href } = location;
_history.replaceState({ id: uid }, '', href);
const target = select_target(new URL(location.href));
if (target)
return navigate(target, uid, true, hash);
});
}
let base_url;
let handle_target;
function init(base, handler) {
base_url = base;
handle_target = handler;
if ('scrollRestoration' in _history) {
_history.scrollRestoration = 'manual';
}
// Adopted from Nuxt.js
// Reset scrollRestoration to auto when leaving page, allowing page reload
// and back-navigation from other pages to use the browser to restore the
// scrolling position.
addEventListener('beforeunload', () => {
_history.scrollRestoration = 'auto';
});
// Setting scrollRestoration to manual again when returning to this page.
addEventListener('load', () => {
_history.scrollRestoration = 'manual';
});
addEventListener('click', handle_click);
addEventListener('popstate', handle_popstate);
}
function extract_query(search) {
const query = Object.create(null);
if (search.length > 0) {
search.slice(1).split('&').forEach(searchParam => {
const [, key, value = ''] = /([^=]*)(?:=(.*))?/.exec(decodeURIComponent(searchParam.replace(/\+/g, ' ')));
if (typeof query[key] === 'string') query[key] = [query[key]];
if (typeof query[key] === 'object') (query[key] ).push(value);
else query[key] = value;
});
}
return query;
const query = Object.create(null);
if (search.length > 0) {
search.slice(1).split('&').forEach(searchParam => {
const [, key, value = ''] = /([^=]*)(?:=(.*))?/.exec(decodeURIComponent(searchParam.replace(/\+/g, ' ')));
if (typeof query[key] === 'string')
query[key] = [query[key]];
if (typeof query[key] === 'object')
query[key].push(value);
else
query[key] = value;
});
}
return query;
}
function select_target(url) {
if (url.origin !== location.origin) return null;
if (!url.pathname.startsWith(initial_data.baseUrl)) return null;
let path = url.pathname.slice(initial_data.baseUrl.length);
if (path === '') {
path = '/';
}
for (let i = 0; i < routes.length; i += 1) {
const route = routes[i];
const match = route.pattern.exec(path);
if (match) {
const query = extract_query(url.search);
const part = route.parts[route.parts.length - 1];
const params = part.params ? part.params(match) : {};
const page = { host: location.host, path, query, params };
return { href: url.href, route, match, page };
}
}
if (url.origin !== location.origin)
return null;
if (!url.pathname.startsWith(base_url))
return null;
let path = url.pathname.slice(base_url.length);
if (path === '') {
path = '/';
}
// avoid accidental clashes between server routes and page routes
// if (ignore.some(pattern => pattern.test(path))) return;
for (let i = 0; i < routes.length; i += 1) {
const route = routes[i];
const match = route.pattern.exec(path);
if (match) {
const query = extract_query(url.search);
const part = route.parts[route.parts.length - 1];
const params = part.params ? part.params(match) : {};
const page = { host: location.host, path, query, params };
return { href: url.href, route, match, page };
}
}
}
function handle_error(url) {
const { host, pathname, search } = location;
const { session, preloaded, status, error } = initial_data;
if (!layout_preloaded) {
layout_preloaded = preloaded && preloaded[0];
}
const props = {
error,
status,
session,
segments: preloaded
};
const query = extract_query(search);
render([], props, { host, path: pathname, query, params: {} });
function handle_click(event) {
// Adapted from https://github.com/visionmedia/page.js
// MIT license https://github.com/visionmedia/page.js#license
if (which(event) !== 1)
return;
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
return;
if (event.defaultPrevented)
return;
const a = find_anchor(event.target);
if (!a)
return;
if (!a.href)
return;
// check if link is inside an svg
// in this case, both href and target are always inside an object
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
const href = String(svg ? a.href.baseVal : a.href);
if (href === location.href) {
if (!location.hash)
event.preventDefault();
return;
}
// Ignore if tag has
// 1. 'download' attribute
// 2. rel='external' attribute
if (a.hasAttribute('download') || a.getAttribute('rel') === 'external')
return;
// Ignore if <a> has a target
if (svg ? a.target.baseVal : a.target)
return;
const url = new URL(href);
// Don't handle hash changes
if (url.pathname === location.pathname && url.search === location.search)
return;
const target = select_target(url);
if (target) {
const noscroll = a.hasAttribute('sapper:noscroll');
navigate(target, null, noscroll, url.hash);
event.preventDefault();
_history.pushState({ id: cid }, '', url.href);
}
}
function which(event) {
return event.which === null ? event.button : event.which;
}
function scroll_state() {
return {
x: pageXOffset,
y: pageYOffset
};
return {
x: pageXOffset,
y: pageYOffset
};
}
async function navigate(dest, id, noscroll, hash) {
if (id) {
// popstate or initial navigation
cid = id;
} else {
const current_scroll = scroll_state();
// clicked on a link. preserve scroll state
scroll_history[cid] = current_scroll;
id = cid = ++uid;
scroll_history[cid] = noscroll ? current_scroll : { x: 0, y: 0 };
}
cid = id;
if (root_component) stores.preloading.set(true);
const loaded = prefetching && prefetching.href === dest.href ?
prefetching.promise :
hydrate_target(dest);
prefetching = null;
const token = current_token = {};
const loaded_result = await loaded;
const { redirect } = loaded_result;
if (token !== current_token) return; // a secondary navigation happened while we were loading
if (redirect) {
await goto(redirect.location, { replaceState: true });
} else {
const { props, branch } = loaded_result;
await render(branch, props, dest.page);
}
if (document.activeElement && (document.activeElement instanceof HTMLElement)) document.activeElement.blur();
if (!noscroll) {
let scroll = scroll_history[id];
if (hash) {
// scroll is an element id (from a hash), we need to compute y.
const deep_linked = document.getElementById(hash.slice(1));
if (deep_linked) {
scroll = {
x: 0,
y: deep_linked.getBoundingClientRect().top + scrollY
};
}
}
scroll_history[cid] = scroll;
if (scroll) {
redirect ? scrollTo(0, 0) : scrollTo(scroll.x, scroll.y);
}
}
function handle_popstate(event) {
scroll_history[cid] = scroll_state();
if (event.state) {
const url = new URL(location.href);
const target = select_target(url);
if (target) {
navigate(target, event.state.id);
}
else {
// eslint-disable-next-line
location.href = location.href; // nosonar
}
}
else {
// hashchange
set_uid(uid + 1);
set_cid(uid);
_history.replaceState({ id: cid }, '', location.href);
}
}
async function render(branch, props, page) {
stores.page.set(page);
stores.preloading.set(false);
if (root_component) {
root_component.$set(props);
} else {
props.stores = {
page: { subscribe: stores.page.subscribe },
preloading: { subscribe: stores.preloading.subscribe },
session: stores.session
};
props.level0 = {
props: await layout_preloaded
};
props.notify = stores.page.notify;
root_component = new root({
target,
props,
hydrate: true
});
}
current_branch = branch;
current_query = JSON.stringify(page.query);
ready = true;
session_dirty = false;
function navigate(dest, id, noscroll, hash) {
return __awaiter(this, void 0, void 0, function* () {
const popstate = !!id;
if (popstate) {
cid = id;
}
else {
const current_scroll = scroll_state();
// clicked on a link. preserve scroll state
scroll_history[cid] = current_scroll;
cid = id = ++uid;
scroll_history[cid] = noscroll ? current_scroll : { x: 0, y: 0 };
}
yield handle_target(dest);
if (document.activeElement && (document.activeElement instanceof HTMLElement))
document.activeElement.blur();
if (!noscroll) {
let scroll = scroll_history[id];
let deep_linked;
if (hash) {
// scroll is an element id (from a hash), we need to compute y.
deep_linked = document.getElementById(hash.slice(1));
if (deep_linked) {
scroll = {
x: 0,
y: deep_linked.getBoundingClientRect().top + scrollY
};
}
}
scroll_history[cid] = scroll;
if (popstate || deep_linked) {
scrollTo(scroll.x, scroll.y);
}
else {
scrollTo(0, 0);
}
}
});
}
function part_changed(i, segment, match, stringified_query) {
// TODO only check query string changes for preload functions
// that do in fact depend on it (using static analysis or
// runtime instrumentation)
if (stringified_query !== current_query) return true;
const previous = current_branch[i];
if (!previous) return false;
if (segment !== previous.segment) return true;
if (previous.match) {
if (JSON.stringify(previous.match.slice(1, i + 2)) !== JSON.stringify(match.slice(1, i + 2))) {
return true;
}
}
function get_base_uri(window_document) {
let baseURI = window_document.baseURI;
if (!baseURI) {
const baseTags = window_document.getElementsByTagName('base');
baseURI = baseTags.length ? baseTags[0].href : window_document.URL;
}
return baseURI;
}
async function hydrate_target(dest) {
const { route, page } = dest;
const segments = page.path.split('/').filter(Boolean);
let redirect = null;
const props = { error: null, status: 200, segments: [segments[0]] };
const preload_context = {
fetch: (url, opts) => fetch(url, opts),
redirect: (status, location) => {
if (redirect && (redirect.status !== status || redirect.location !== location)) {
throw new Error(`Conflicting redirects`);
}
redirect = { status, location };
},
error: (status, error) => {
props.error = typeof error === 'string' ? new Error(error) : error;
props.status = status;
}
};
if (!layout_preloaded) {
const layout_preload = Layout.preload || (() => {});
layout_preloaded = initial_data.preloaded[0] || layout_preload.call(preload_context, {
host: page.host,
path: page.path,
query: page.query,
params: {}
}, $session);
}
let branch;
let l = 1;
try {
const stringified_query = JSON.stringify(page.query);
const match = route.pattern.exec(page.path);
let segment_dirty = false;
branch = await Promise.all(route.parts.map(async (part, i) => {
const segment = segments[i];
if (part_changed(i, segment, match, stringified_query)) segment_dirty = true;
props.segments[l] = segments[i + 1]; // TODO make this less confusing
if (!part) return { segment };
const j = l++;
if (!session_dirty && !segment_dirty && current_branch[i] && current_branch[i].part === part.i) {
return current_branch[i];
}
segment_dirty = false;
const { default: component, preload } = await components[part.i]();
let preloaded;
if (ready || !initial_data.preloaded[i + 1]) {
preloaded = preload
? await preload.call(preload_context, {
host: page.host,
path: page.path,
query: page.query,
params: part.params ? part.params(dest.match) : {}
}, $session)
: {};
} else {
preloaded = initial_data.preloaded[i + 1];
}
return (props[`level${j}`] = { component, props: preloaded, segment, match, part: part.i });
}));
} catch (error) {
props.error = error;
props.status = 500;
branch = [];
}
return { redirect, props, branch };
let prefetching = null;
let mousemove_timeout;
function start() {
addEventListener('touchstart', trigger_prefetch);
addEventListener('mousemove', handle_mousemove);
}
function prefetch(href) {
const target = select_target(new URL(href, document.baseURI));
if (target) {
if (!prefetching || href !== prefetching.href) {
set_prefetching(href, hydrate_target(target));
}
return prefetching.promise;
}
const target = select_target(new URL(href, get_base_uri(document)));
if (target) {
if (!prefetching || href !== prefetching.href) {
prefetching = { href, promise: hydrate_target(target) };
}
return prefetching.promise;
}
}
function start(opts
) {
if ('scrollRestoration' in _history) {
_history.scrollRestoration = 'manual';
}
// Adopted from Nuxt.js
// Reset scrollRestoration to auto when leaving page, allowing page reload
// and back-navigation from other pages to use the browser to restore the
// scrolling position.
addEventListener('beforeunload', () => {
_history.scrollRestoration = 'auto';
});
// Setting scrollRestoration to manual again when returning to this page.
addEventListener('load', () => {
_history.scrollRestoration = 'manual';
});
set_target(opts.target);
addEventListener('click', handle_click);
addEventListener('popstate', handle_popstate);
// prefetch
addEventListener('touchstart', trigger_prefetch);
addEventListener('mousemove', handle_mousemove);
return Promise.resolve().then(() => {
const { hash, href } = location;
_history.replaceState({ id: uid }, '', href);
const url = new URL(location.href);
if (initial_data.error) return handle_error();
const target = select_target(url);
if (target) return navigate(target, uid, true, hash);
});
function get_prefetched(target) {
if (prefetching && prefetching.href === target.href) {
return prefetching.promise;
}
else {
return hydrate_target(target);
}
}
let mousemove_timeout;
function trigger_prefetch(event) {
const a = find_anchor(event.target);
if (a && a.rel === 'prefetch') {
prefetch(a.href);
}
}
function handle_mousemove(event) {
clearTimeout(mousemove_timeout);
mousemove_timeout = setTimeout(() => {
trigger_prefetch(event);
}, 20);
clearTimeout(mousemove_timeout);
mousemove_timeout = setTimeout(() => {
trigger_prefetch(event);
}, 20);
}
function trigger_prefetch(event) {
const a = find_anchor(event.target);
if (!a || a.rel !== 'prefetch') return;
prefetch(a.href);
function goto(href, opts = { noscroll: false, replaceState: false }) {
const target = select_target(new URL(href, get_base_uri(document)));
if (target) {
_history[opts.replaceState ? 'replaceState' : 'pushState']({ id: cid }, '', href);
return navigate(target, null, opts.noscroll);
}
location.href = href;
return new Promise(() => {
/* never resolves */
});
}
function handle_click(event) {
// Adapted from https://github.com/visionmedia/page.js
// MIT license https://github.com/visionmedia/page.js#license
if (which(event) !== 1) return;
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
if (event.defaultPrevented) return;
const a = find_anchor(event.target);
if (!a) return;
if (!a.href) return;
// check if link is inside an svg
// in this case, both href and target are always inside an object
const svg = typeof a.href === 'object' && a.href.constructor.name === 'SVGAnimatedString';
const href = String(svg ? (a).href.baseVal : a.href);
if (href === location.href) {
if (!location.hash) event.preventDefault();
return;
}
// Ignore if tag has
// 1. 'download' attribute
// 2. rel='external' attribute
if (a.hasAttribute('download') || a.getAttribute('rel') === 'external') return;
// Ignore if <a> has a target
if (svg ? (a).target.baseVal : a.target) return;
const url = new URL(href);
// Don't handle hash changes
if (url.pathname === location.pathname && url.search === location.search) return;
const target = select_target(url);
if (target) {
const noscroll = a.hasAttribute('svelte:noscroll');
navigate(target, null, noscroll, url.hash);
event.preventDefault();
_history.pushState({ id: cid }, '', url.href);
}
function page_store(value) {
const store = writable(value);
let ready = true;
function notify() {
ready = true;
store.update(val => val);
}
function set(new_value) {
ready = false;
store.set(new_value);
}
function subscribe(run) {
let old_value;
return store.subscribe((new_value) => {
if (old_value === undefined || (ready && new_value !== old_value)) {
run(old_value = new_value);
}
});
}
return { notify, set, subscribe };
}
function which(event) {
return event.which === null ? event.button : event.which;
const initial_data = typeof __SVELTE__ !== 'undefined' && __SVELTE__;
let ready = false;
let root_component;
let current_token;
let root_preloaded;
let current_branch = [];
let current_query = '{}';
const stores = {
page: page_store({}),
preloading: writable(null),
session: writable(initial_data && initial_data.session)
};
let $session;
let session_dirty;
stores.session.subscribe((value) => __awaiter(void 0, void 0, void 0, function* () {
$session = value;
if (!ready)
return;
session_dirty = true;
const dest = select_target(new URL(location.href));
const token = current_token = {};
const { redirect, props, branch } = yield hydrate_target(dest);
if (token !== current_token)
return; // a secondary navigation happened while we were loading
if (redirect) {
yield goto(redirect.location, { replaceState: true });
}
else {
yield render(branch, props, buildPageContext(props, dest.page));
}
}));
let target;
function set_target(node) {
target = node;
}
function find_anchor(node) {
while (node && node.nodeName.toUpperCase() !== 'A') node = node.parentNode; // SVG <a> elements have a lowercase name
return node;
function start$1(opts) {
set_target(opts.target);
init(initial_data.baseUrl, handle_target$1);
start();
if (initial_data.error) {
return Promise.resolve().then(() => {
return handle_error();
});
}
return load_current_page();
}
function handle_popstate(event) {
scroll_history[cid] = scroll_state();
if (event.state) {
const url = new URL(location.href);
const target = select_target(url);
if (target) {
navigate(target, event.state.id);
} else {
// eslint-disable-next-line
location.href = location.href; // nosonar
}
} else {
// hashchange
set_uid(uid + 1);
set_cid(uid);
_history.replaceState({ id: cid }, '', location.href);
}
function handle_error() {
const { host, pathname, search } = location;
const { session, preloaded, status, error } = initial_data;
if (!root_preloaded) {
root_preloaded = preloaded && preloaded[0];
}
const props = {
error,
status,
session,
level0: {
props: root_preloaded
},
level1: {
props: {
status,
error
},
component: ErrorComponent
},
segments: preloaded
};
const query = extract_query(search);
render([], props, { host, path: pathname, query, params: {}, error });
}
function buildPageContext(props, page) {
const { error } = props;
return Object.assign({ error }, page);
}
function handle_target$1(dest) {
return __awaiter(this, void 0, void 0, function* () {
if (root_component)
stores.preloading.set(true);
const hydrating = get_prefetched(dest);
const token = current_token = {};
const hydrated_target = yield hydrating;
const { redirect } = hydrated_target;
if (token !== current_token)
return; // a secondary navigation happened while we were loading
if (redirect) {
yield goto(redirect.location, { replaceState: true });
}
else {
const { props, branch } = hydrated_target;
yield render(branch, props, buildPageContext(props, dest.page));
}
});
}
function render(branch, props, page) {
return __awaiter(this, void 0, void 0, function* () {
stores.page.set(page);
stores.preloading.set(false);
if (root_component) {
root_component.$set(props);
}
else {
props.stores = {
page: { subscribe: stores.page.subscribe },
preloading: { subscribe: stores.preloading.subscribe },
session: stores.session
};
props.level0 = {
props: yield root_preloaded
};
props.notify = stores.page.notify;
root_component = new root({
target,
props,
hydrate: true
});
}
current_branch = branch;
current_query = JSON.stringify(page.query);
ready = true;
session_dirty = false;
});
}
function part_changed(i, segment, match, stringified_query) {
// TODO only check query string changes for preload functions
// that do in fact depend on it (using static analysis or
// runtime instrumentation)
if (stringified_query !== current_query)
return true;
const previous = current_branch[i];
if (!previous)
return false;
if (segment !== previous.segment)
return true;
if (previous.match) {
if (JSON.stringify(previous.match.slice(1, i + 2)) !== JSON.stringify(match.slice(1, i + 2))) {
return true;
}
}
}
function hydrate_target(dest) {
return __awaiter(this, void 0, void 0, function* () {
const { route, page } = dest;
const segments = page.path.split('/').filter(Boolean);
let redirect = null;
const props = { error: null, status: 200, segments: [segments[0]] };
const preload_context = {
fetch: (url, opts) => fetch(url, opts),
redirect: (statusCode, location) => {
if (redirect && (redirect.statusCode !== statusCode || redirect.location !== location)) {
throw new Error('Conflicting redirects');
}
redirect = { statusCode, location };
},
error: (status, error) => {
props.error = typeof error === 'string' ? new Error(error) : error;
props.status = status;
}
};
if (!root_preloaded) {
// TODO this is wrong! `root` is the auto-generated component, it has no preload
// const root_preload = root.preload || (() => ({}));
// root_preloaded = initial_data.preloaded[0] || root_preload.call(preload_context, {
// host: page.host,
// path: page.path,
// query: page.query,
// params: {}
// }, $session);
root_preloaded = {};
}
let branch;
let l = 1;
try {
const stringified_query = JSON.stringify(page.query);
const match = route.pattern.exec(page.path);
let segment_dirty = false;
branch = yield Promise.all(route.parts.map((part, i) => __awaiter(this, void 0, void 0, function* () {
const segment = segments[i];
if (part_changed(i, segment, match, stringified_query))
segment_dirty = true;
props.segments[l] = segments[i + 1]; // TODO make this less confusing
if (!part)
return { segment };
const j = l++;
if (!session_dirty && !segment_dirty && current_branch[i] && current_branch[i].part === part.i) {
return current_branch[i];
}
segment_dirty = false;
const { default: component, preload } = yield components[part.i]();
let preloaded;
if (ready || !initial_data.preloaded[i + 1]) {
preloaded = preload
? yield preload.call(preload_context, {
host: page.host,
path: page.path,
query: page.query,
params: part.params ? part.params(dest.match) : {}
}, $session)
: {};
}
else {
preloaded = initial_data.preloaded[i + 1];
}
return (props[`level${j}`] = { component, props: preloaded, segment, match, part: part.i });
})));
}
catch (error) {
props.error = error;
props.status = 500;
branch = [];
}
return { redirect, props, branch };
});
}
function prefetchRoutes(pathnames) {
return routes
.filter(pathnames
? route => pathnames.some(pathname => route.pattern.test(pathname))
: () => true
)
.reduce((promise, route) => promise.then(() => {
return Promise.all(route.parts.map(part => part && components[part.i]));
}), Promise.resolve());
return routes
.filter(pathnames
? route => pathnames.some(pathname => route.pattern.test(pathname))
: () => true)
.reduce((promise, route) => promise.then(() => {
return Promise.all(route.parts.map(part => part && components[part.i]()));
}), Promise.resolve());
}

@@ -556,3 +546,3 @@

export { goto, prefetch, prefetchRoutes, start, stores$1 as stores };
export { goto, prefetch, prefetchRoutes, start$1 as start, stores$1 as stores };
//# sourceMappingURL=client.js.map
# @sveltejs/kit
## 0.0.23
### Patch Changes
- a163000: Parse body on incoming requests
- a346eab: Copy over latest Sapper router code
- Updated dependencies [a163000]
- @sveltejs/app-utils@0.0.15
## 0.0.22

@@ -4,0 +13,0 @@

@@ -12,19 +12,19 @@ 'use strict';

function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
}
});
}
});
}
n['default'] = e;
return Object.freeze(n);
}
n['default'] = e;
return Object.freeze(n);
}

@@ -36,2 +36,27 @@

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
var modules = {};

@@ -172,5 +197,5 @@

var name = "@sveltejs/kit";
var version = "0.0.22";
var version = "0.0.23";
var dependencies = {
"@sveltejs/app-utils": "0.0.14",
"@sveltejs/app-utils": "0.0.15",
"cheap-watch": "^1.0.2",

@@ -206,3 +231,4 @@ "http-proxy": "^1.18.1",

"assets",
"dist"
"dist",
"client"
];

@@ -212,3 +238,3 @@ var scripts = {

build: "rollup -c",
prepare: "npm run build",
prepare: "npm run build && cd client && tsc",
prepublishOnly: "npm run build"

@@ -227,78 +253,67 @@ };

let config;
try {
config = requireRelative_1('./svelte.config.js', process.cwd());
} catch (err) {
const adjective = err.code === 'ENOENT'
? 'Missing'
: 'Malformed';
console.error($.bold().red(`${adjective} svelte.config.js`));
console.error($.grey(err.stack));
process.exit(1);
config = requireRelative_1('./svelte.config.js', process.cwd());
}
catch (err) {
const adjective = err.code === 'ENOENT'
? 'Missing'
: 'Malformed';
console.error($.bold().red(`${adjective} svelte.config.js`));
console.error($.grey(err.stack));
process.exit(1);
}
const prog = sade__default['default']('svelte').version(version);
prog.command('dev')
.describe('Start a development server')
.option('-p, --port', 'Dev server port', 3000)
.option('-o, --open', 'Open a browser tab', false)
.action(async (opts
) => {
const { dev } = await Promise.resolve().then(function () { return require('./index.js'); });
try {
const watcher = dev({
port: opts.port
});
let first = true;
watcher.on('stdout', data => {
process.stdout.write(data);
});
watcher.on('stderr', data => {
process.stderr.write(data);
});
watcher.on('ready', async (event) => {
if (first) {
console.log($.bold().cyan(`> Listening on http://localhost:${event.port}`));
if (opts.open) {
const { exec } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('child_process')); });
exec(`open http://localhost:${event.port}`);
}
first = false;
}
});
} catch (err) {
console.log($.bold().red(`> ${err.message}`));
console.log($.gray(err.stack));
process.exit(1);
}
});
.describe('Start a development server')
.option('-p, --port', 'Dev server port', 3000)
.option('-o, --open', 'Open a browser tab', false)
.action((opts) => __awaiter(void 0, void 0, void 0, function* () {
const { dev } = yield Promise.resolve().then(function () { return require('./index.js'); });
try {
const watcher = dev({
port: opts.port
});
let first = true;
watcher.on('stdout', data => {
process.stdout.write(data);
});
watcher.on('stderr', data => {
process.stderr.write(data);
});
watcher.on('ready', (event) => __awaiter(void 0, void 0, void 0, function* () {
if (first) {
console.log($.bold().cyan(`> Listening on http://localhost:${event.port}`));
if (opts.open) {
const { exec } = yield Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('child_process')); });
exec(`open http://localhost:${event.port}`);
}
first = false;
}
}));
}
catch (err) {
console.log($.bold().red(`> ${err.message}`));
console.log($.gray(err.stack));
process.exit(1);
}
}));
prog.command('build [dest]')
.describe('Create a deployment-ready version of your app')
.action(async () => {
const { build } = await Promise.resolve().then(function () { return require('./index2.js'); });
try {
await build(config);
} catch (err) {
console.log($.bold().red(`> ${err.message}`));
console.log($.gray(err.stack));
process.exit(1);
}
});
.describe('Create a deployment-ready version of your app')
.action(() => __awaiter(void 0, void 0, void 0, function* () {
const { build } = yield Promise.resolve().then(function () { return require('./index2.js'); });
try {
yield build(config);
}
catch (err) {
console.log($.bold().red(`> ${err.message}`));
console.log($.gray(err.stack));
process.exit(1);
}
}));
prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
exports.$ = $;
exports.__awaiter = __awaiter;
exports.pkg = pkg;
exports.requireRelative_1 = requireRelative_1;
//# sourceMappingURL=cli.js.map
'use strict';
var cli = require('./cli.js');
var path = require('path');
require('module');
var cli = require('./cli.js');
require('sade');
require('url');
var fs = require('fs');
var child_process = require('child_process');
var appUtils = require('@sveltejs/app-utils');
var utils = require('./utils.js');
var appUtils = require('@sveltejs/app-utils');
require('crypto');
require('stream');
require('http');
require('https');
require('zlib');
var util = require('util');

@@ -55,104 +49,94 @@ var rollup = require('rollup');

};`.trim();
const INJECT_STYLES_NAME = 'inject_styles';
const INJECT_STYLES_ID = 'inject_styles.js';
const find_css = (chunk, bundle) => {
const css_files = new Set();
const visited = new Set();
const recurse = (c) => {
if (visited.has(c)) return;
visited.add(c);
if (c.imports) {
c.imports.forEach(file => {
if (file.endsWith('.css')) {
css_files.add(file);
} else {
const imported_chunk = bundle[file];
if (imported_chunk) {
recurse(imported_chunk);
}
}
});
}
};
recurse(chunk);
return Array.from(css_files);
const css_files = new Set();
const visited = new Set();
const recurse = (c) => {
if (visited.has(c))
return;
visited.add(c);
if (c.imports) {
c.imports.forEach(file => {
if (file.endsWith('.css')) {
css_files.add(file);
}
else {
const imported_chunk = bundle[file];
if (imported_chunk) {
recurse(imported_chunk);
}
}
});
}
};
recurse(chunk);
return Array.from(css_files);
};
const css_injection = {
name: 'svelte-css-injection',
buildStart() {
this.emitFile({
type: 'chunk',
id: INJECT_STYLES_ID,
name: INJECT_STYLES_NAME,
preserveSignature: 'allow-extension'
});
},
load(id) {
return id === INJECT_STYLES_ID ? inject_styles : null;
},
resolveId(importee) {
return importee === INJECT_STYLES_ID ? INJECT_STYLES_ID : null;
},
renderDynamicImport({ targetModuleId }) {
if (targetModuleId) {
return {
left: 'Promise.all([import(',
right: `), ___SVELTE_CSS_INJECTION___${Buffer.from(targetModuleId).toString('hex')}___]).then(function(x) { return x[0]; })`
};
} else {
return {
left: 'import(',
right: ')'
};
}
},
async generateBundle( options, bundle) {
const inject_styles_file = Object.keys(bundle).find(f => f.startsWith('inject_styles'));
let has_css = false;
for (const name in bundle) {
const chunk = bundle[name];
let chunk_has_css = false;
if (chunk.code) {
chunk.code = chunk.code.replace(/___SVELTE_CSS_INJECTION___([0-9a-f]+)___/g, (m, id) => {
id = Buffer.from(id, 'hex').toString();
const target = Object.values(bundle)
.find(c => (c).modules && (c).modules[id]);
if (target) {
const css_files = find_css(target, bundle);
if (css_files.length > 0) {
chunk_has_css = true;
return `__inject_styles(${JSON.stringify(css_files)})`;
}
}
return '';
});
if (chunk_has_css) {
has_css = true;
chunk.code += `\nimport __inject_styles from './${inject_styles_file}';`;
}
}
}
if (!has_css) {
delete bundle[inject_styles_file];
}
// console.log(bundle);
}
name: 'svelte-css-injection',
buildStart() {
this.emitFile({
type: 'chunk',
id: INJECT_STYLES_ID,
name: INJECT_STYLES_NAME,
preserveSignature: 'allow-extension'
});
},
load(id) {
return id === INJECT_STYLES_ID ? inject_styles : null;
},
resolveId(importee) {
return importee === INJECT_STYLES_ID ? INJECT_STYLES_ID : null;
},
renderDynamicImport({ targetModuleId }) {
if (targetModuleId) {
return {
left: 'Promise.all([import(',
right: `), ___SVELTE_CSS_INJECTION___${Buffer.from(targetModuleId).toString('hex')}___]).then(function(x) { return x[0]; })`
};
}
else {
return {
left: 'import(',
right: ')'
};
}
},
generateBundle(_options, bundle) {
return cli.__awaiter(this, void 0, void 0, function* () {
const inject_styles_file = Object.keys(bundle).find(f => f.startsWith('inject_styles'));
let has_css = false;
for (const name in bundle) {
const chunk = bundle[name];
let chunk_has_css = false;
if (chunk.code) {
chunk.code = chunk.code.replace(/___SVELTE_CSS_INJECTION___([0-9a-f]+)___/g, (_m, id) => {
id = Buffer.from(id, 'hex').toString();
const target = Object.values(bundle)
.find(c => c.modules && c.modules[id]);
if (target) {
const css_files = find_css(target, bundle);
if (css_files.length > 0) {
chunk_has_css = true;
return `__inject_styles(${JSON.stringify(css_files)})`;
}
}
return '';
});
if (chunk_has_css) {
has_css = true;
chunk.code += `\nimport __inject_styles from './${inject_styles_file}';`;
}
}
}
if (!has_css) {
delete bundle[inject_styles_file];
}
// console.log(bundle);
});
}
};
const exec = util.promisify(child_process__default['default'].exec);
const snowpack_main = require.resolve('snowpack');

@@ -162,250 +146,202 @@ const snowpack_pkg_file = path__default['default'].join(snowpack_main, '../../package.json');

const snowpack_bin = path__default['default'].resolve(path__default['default'].dirname(snowpack_pkg_file), snowpack_pkg.bin.snowpack);
const ignorable_warnings = new Set(['EMPTY_BUNDLE', 'CIRCULAR_DEPENDENCY']);
const onwarn = (warning, handler) => {
// TODO would be nice to just eliminate the circular dependencies instead of
// squelching these warnings (it happens when e.g. the root layout imports
// from /_app/main/client)
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
handler(warning);
// TODO would be nice to just eliminate the circular dependencies instead of
// squelching these warnings (it happens when e.g. the root layout imports
// from /_app/main/client)
if (ignorable_warnings.has(warning.code))
return;
handler(warning);
};
async function build(config) {
if (!config.adapter) {
throw new Error('No adapter specified');
}
const manifest = utils.create_manifest_data('src/routes'); // TODO make configurable, without breaking Snowpack config
appUtils.mkdirp('.svelte/main');
utils.create_app({
manifest_data: manifest,
routes: '/_app/routes',
output: '.svelte/main'
});
const header = msg => console.log(cli.$.bold().cyan(`\n> ${msg}`));
const log = msg => console.log(msg.replace(/^/gm, ' '));
log.success = msg => log(cli.$.green(`✔ ${msg}`));
log.error = msg => log(cli.$.bold().red(msg));
log.warn = msg => log(cli.$.bold().yellow(msg));
log.minor = msg => log(cli.$.grey(msg));
log.info = log;
const unoptimized = `.svelte/build/unoptimized`;
{
// phase one — build with Snowpack
header('Creating unoptimized build...');
await exec(`rm -rf .svelte/build/unoptimized`);
utils.copy_assets();
await exec(`${snowpack_bin} build --out=${unoptimized}/server --ssr`);
log.success('server');
await exec(`${snowpack_bin} build --out=${unoptimized}/client`);
log.success('client');
}
{
// phase two — optimise
header('Optimizing...');
await exec(`rm -rf .svelte/build/optimized`);
const server_input = {
root: `${unoptimized}/server/_app/main/root.js`,
setup: fs__default['default'].existsSync(`${unoptimized}/server/_app/setup/index.js`)
? `${unoptimized}/server/_app/setup/index.js`
: path__default['default'].join(__dirname, '../assets/setup.js'),
// TODO session middleware etc
};
[
manifest.layout, // TODO is this necessary? if so why isn't manifest.error?
...manifest.components,
...manifest.endpoints
].forEach(item => {
server_input[`routes/${item.name}`] = `${unoptimized}/server${item.url.replace(/\.\w+$/, '.js')}`;
});
const server_chunks = await rollup.rollup({
input: server_input,
plugins: [
{
name: 'remove-css',
load(id) {
if (/\.css\.proxy\.js$/.test(id)) return '';
}
},
{
name: 'generate-server-manifest',
generateBundle(options, bundle) {
// console.log(bundle);
}
},
rollupPluginTerser.terser()
],
onwarn,
// TODO ensure this works with external node modules (on server)
external: id => id[0] !== '.' && !path__default['default'].isAbsolute(id)
});
await server_chunks.write({
dir: '.svelte/build/optimized/server',
format: 'cjs', // TODO some adapters might want ESM?
exports: 'named',
entryFileNames: '[name].js',
chunkFileNames: 'chunks/[name].js',
assetFileNames: 'assets/[name].js',
sourcemap: true
});
log.success(`server`);
const entry = path__default['default'].resolve(`${unoptimized}/client/_app/main/client.js`);
const client_chunks = await rollup.rollup({
input: {
entry
},
plugins: [
{
name: 'deproxy-css',
async resolveId(importee, importer) {
if (/\.css\.proxy\.js$/.test(importee)) {
const deproxied = importee.replace(/\.css\.proxy\.js$/, '.css');
const resolved = await this.resolve(deproxied, importer);
return resolved.id;
}
}
},
css_chunks__default['default']({
injectImports: true,
sourcemap: true
}),
css_injection,
{
name: 'generate-client-manifest',
generateBundle(options, bundle) {
const reverse_lookup = new Map();
const routes = path__default['default'].resolve(`${unoptimized}/client/_app/routes`);
const client
= {
entry: null,
deps: {}
};
let inject_styles;
for (const key in bundle) {
const chunk = bundle[key];
if ((chunk ).facadeModuleId === entry) {
client.entry = key;
}
else if ((chunk ).facadeModuleId === 'inject_styles.js') {
inject_styles = key;
}
else if ((chunk ).modules) {
for (const id in (chunk ).modules) {
if (id.startsWith(routes) && id.endsWith('.js')) {
const file = id.slice(routes.length + 1);
reverse_lookup.set(file, key);
}
}
}
}
const find_deps = (key, js, css) => {
if (js.has(key)) return;
js.add(key);
const chunk = bundle[key];
if (!(chunk ).imports) {
console.log(chunk);
}
(chunk ).imports.forEach(key => {
if (key.endsWith('.css')) {
js.add(inject_styles);
css.add(key);
} else {
find_deps(key, js, css);
}
});
return { js, css };
};
const get_deps = key => {
const js = new Set();
const css = new Set();
find_deps(key, js, css);
return {
js: Array.from(js),
css: Array.from(css)
};
};
client.deps.__entry__ = get_deps(client.entry);
manifest.components.forEach(component => {
const file = component.file.replace(/\.svelte$/, '.js');
const key = reverse_lookup.get(file);
client.deps[component.name] = get_deps(key);
});
// not using this.emitFile because the manifest doesn't belong with client code
fs__default['default'].writeFileSync('.svelte/build/optimized/client.json', JSON.stringify(client, null, ' '));
}
},
rollupPluginTerser.terser()
],
onwarn,
// TODO ensure this works with external node modules (on server)
external: id => id[0] !== '.' && !path__default['default'].isAbsolute(id)
});
await client_chunks.write({
dir: '.svelte/build/optimized/client',
entryFileNames: '[name]-[hash].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name]-[hash].js', // TODO CSS filenames aren't hashed?
format: 'esm',
sourcemap: true
});
log.success(`client`);
}
{
// phase three — adapter
header(`Generating app...`);
log.minor(`Using ${config.adapter}`);
await exec(`rm -rf build`); // TODO customize
const adapter = cli.requireRelative_1(config.adapter);
await adapter({
dir: '.svelte/build/optimized',
manifest,
log
});
}
log.success('done');
function build(config) {
return cli.__awaiter(this, void 0, void 0, function* () {
if (!config.adapter) {
throw new Error('No adapter specified');
}
const manifest = utils.create_manifest_data('src/routes'); // TODO make configurable, without breaking Snowpack config
appUtils.mkdirp('.svelte/main');
utils.create_app({
manifest_data: manifest,
output: '.svelte/main'
});
const header = msg => console.log(cli.$.bold().cyan(`\n> ${msg}`));
const log = msg => console.log(msg.replace(/^/gm, ' '));
log.success = msg => log(cli.$.green(`✔ ${msg}`));
log.error = msg => log(cli.$.bold().red(msg));
log.warn = msg => log(cli.$.bold().yellow(msg));
log.minor = msg => log(cli.$.grey(msg));
log.info = log;
const unoptimized = `.svelte/build/unoptimized`;
{
// phase one — build with Snowpack
header('Creating unoptimized build...');
yield exec(`rm -rf .svelte/build/unoptimized`);
utils.copy_assets();
yield exec(`${snowpack_bin} build --out=${unoptimized}/server --ssr`);
log.success('server');
yield exec(`${snowpack_bin} build --out=${unoptimized}/client`);
log.success('client');
}
{
// phase two — optimise
header('Optimizing...');
yield exec(`rm -rf .svelte/build/optimized`);
const server_input = {
root: `${unoptimized}/server/_app/main/root.js`,
setup: fs__default['default'].existsSync(`${unoptimized}/server/_app/setup/index.js`)
? `${unoptimized}/server/_app/setup/index.js`
: path__default['default'].join(__dirname, '../assets/setup.js'),
};
[
manifest.layout,
...manifest.components,
...manifest.endpoints
].forEach(item => {
server_input[`routes/${item.name}`] = `${unoptimized}/server${item.url.replace(/\.\w+$/, '.js')}`;
});
const server_chunks = yield rollup.rollup({
input: server_input,
plugins: [
{
name: 'remove-css',
load(id) {
if (/\.css\.proxy\.js$/.test(id))
return '';
}
},
// TODO add server manifest generation so we can prune
// imports before zipping for cloud functions
rollupPluginTerser.terser()
],
onwarn,
// TODO ensure this works with external node modules (on server)
external: id => id[0] !== '.' && !path__default['default'].isAbsolute(id)
});
yield server_chunks.write({
dir: '.svelte/build/optimized/server',
format: 'cjs',
exports: 'named',
entryFileNames: '[name].js',
chunkFileNames: 'chunks/[name].js',
assetFileNames: 'assets/[name].js',
sourcemap: true
});
log.success(`server`);
const entry = path__default['default'].resolve(`${unoptimized}/client/_app/main/client.js`);
const client_chunks = yield rollup.rollup({
input: {
entry
},
plugins: [
{
name: 'deproxy-css',
resolveId(importee, importer) {
return cli.__awaiter(this, void 0, void 0, function* () {
if (/\.css\.proxy\.js$/.test(importee)) {
const deproxied = importee.replace(/\.css\.proxy\.js$/, '.css');
const resolved = yield this.resolve(deproxied, importer);
return resolved.id;
}
});
}
},
css_chunks__default['default']({
injectImports: true,
sourcemap: true
}),
css_injection,
{
name: 'generate-client-manifest',
generateBundle(_options, bundle) {
const reverse_lookup = new Map();
const routes = path__default['default'].resolve(`${unoptimized}/client/_app/routes`);
const client = {
entry: null,
deps: {}
};
let inject_styles;
for (const key in bundle) {
const chunk = bundle[key];
if (chunk.facadeModuleId === entry) {
client.entry = key;
}
else if (chunk.facadeModuleId === 'inject_styles.js') {
inject_styles = key;
}
else if (chunk.modules) {
for (const id in chunk.modules) {
if (id.startsWith(routes) && id.endsWith('.js')) {
const file = id.slice(routes.length + 1);
reverse_lookup.set(file, key);
}
}
}
}
const find_deps = (key, js, css) => {
if (js.has(key))
return;
js.add(key);
const chunk = bundle[key];
if (!chunk.imports) {
console.log(chunk);
}
chunk.imports.forEach(key => {
if (key.endsWith('.css')) {
js.add(inject_styles);
css.add(key);
}
else {
find_deps(key, js, css);
}
});
return { js, css };
};
const get_deps = key => {
const js = new Set();
const css = new Set();
find_deps(key, js, css);
return {
js: Array.from(js),
css: Array.from(css)
};
};
client.deps.__entry__ = get_deps(client.entry);
manifest.components.forEach(component => {
const file = component.file.replace(/\.svelte$/, '.js');
const key = reverse_lookup.get(file);
client.deps[component.name] = get_deps(key);
});
// not using this.emitFile because the manifest doesn't belong with client code
fs__default['default'].writeFileSync('.svelte/build/optimized/client.json', JSON.stringify(client, null, ' '));
}
},
rollupPluginTerser.terser()
],
onwarn,
// TODO ensure this works with external node modules (on server)
external: id => id[0] !== '.' && !path__default['default'].isAbsolute(id)
});
yield client_chunks.write({
dir: '.svelte/build/optimized/client',
entryFileNames: '[name]-[hash].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name]-[hash].js',
format: 'esm',
sourcemap: true
});
log.success(`client`);
}
{
// phase three — adapter
header(`Generating app (${config.adapter})...`);
yield exec(`rm -rf build`); // TODO customize
const adapter = cli.requireRelative_1(config.adapter);
yield adapter({
dir: '.svelte/build/optimized',
manifest,
log
});
}
log.success('done');
});
}

@@ -412,0 +348,0 @@

{
"name": "@sveltejs/kit",
"version": "0.0.22",
"version": "0.0.23",
"dependencies": {
"@sveltejs/app-utils": "0.0.14",
"@sveltejs/app-utils": "0.0.15",
"cheap-watch": "^1.0.2",

@@ -36,3 +36,4 @@ "http-proxy": "^1.18.1",

"assets",
"dist"
"dist",
"client"
],

@@ -42,5 +43,5 @@ "scripts": {

"build": "rollup -c",
"prepare": "npm run build",
"prepare": "npm run build && cd client && tsc",
"prepublishOnly": "npm run build"
}
}

@@ -5,3 +5,3 @@ # @sveltejs/kit

This is a more fleshed-out version of https://github.com/Rich-Harris/snowpack-svelte-ssr that aims to replicate Sapper's functionality in its entirety, minus building for deployment (which can be handled by 'adapters' that do various opinionated things with the output of `snowpack build`).
This project aims to replicate Sapper's functionality in its entirety, minus building for deployment (which can be handled by 'adapters' that do various opinionated things with the output of `snowpack build`).

@@ -8,0 +8,0 @@ It's currently missing a ton of stuff but I figured I'd throw it up on GitHub anyway partly for the sake of 'working in the open' but mostly because I need an issue tracker to organise my thoughts.

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc