update folder structure (#432)
@@ -39,9 +39,9 @@ async function execute(emitter: EventEmitter, opts: Opts, dirs: Dirs) {
|
|||||||
mkdirp.sync(`${dirs.dest}/client`);
|
mkdirp.sync(`${dirs.dest}/client`);
|
||||||
copy_shimport(dirs.dest);
|
copy_shimport(dirs.dest);
|
||||||
|
|
||||||
// minify app/template.html
|
// minify src/template.html
|
||||||
// TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...)
|
// TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...)
|
||||||
const template = fs.readFileSync(`${dirs.app}/template.html`, 'utf-8');
|
const template = fs.readFileSync(`${dirs.src}/template.html`, 'utf-8');
|
||||||
|
|
||||||
// remove this in a future version
|
// remove this in a future version
|
||||||
if (template.indexOf('%sapper.base%') === -1) {
|
if (template.indexOf('%sapper.base%') === -1) {
|
||||||
@@ -54,7 +54,7 @@ async function execute(emitter: EventEmitter, opts: Opts, dirs: Dirs) {
|
|||||||
|
|
||||||
const manifest_data = create_manifest_data();
|
const manifest_data = create_manifest_data();
|
||||||
|
|
||||||
// create app/manifest/client.js and app/manifest/server.js
|
// create src/manifest/client.js and src/manifest/server.js
|
||||||
create_main_manifests({ bundler: opts.bundler, manifest_data });
|
create_main_manifests({ bundler: opts.bundler, manifest_data });
|
||||||
|
|
||||||
const { client, server, serviceworker } = create_compilers(opts.bundler, dirs);
|
const { client, server, serviceworker } = create_compilers(opts.bundler, dirs);
|
||||||
@@ -79,7 +79,7 @@ async function execute(emitter: EventEmitter, opts: Opts, dirs: Dirs) {
|
|||||||
// TODO duration/warnings
|
// TODO duration/warnings
|
||||||
result: client_result
|
result: client_result
|
||||||
});
|
});
|
||||||
|
|
||||||
client_result.to_json(manifest_data, dirs);
|
client_result.to_json(manifest_data, dirs);
|
||||||
build_info.legacy_assets = client_result.assets;
|
build_info.legacy_assets = client_result.assets;
|
||||||
delete process.env.SAPPER_LEGACY_BUILD;
|
delete process.env.SAPPER_LEGACY_BUILD;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function dev(opts) {
|
|||||||
class Watcher extends EventEmitter {
|
class Watcher extends EventEmitter {
|
||||||
bundler: string;
|
bundler: string;
|
||||||
dirs: {
|
dirs: {
|
||||||
app: string;
|
src: string;
|
||||||
dest: string;
|
dest: string;
|
||||||
routes: string;
|
routes: string;
|
||||||
rollup: string;
|
rollup: string;
|
||||||
@@ -53,7 +53,7 @@ class Watcher extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
app = locations.app(),
|
src = locations.src(),
|
||||||
dest = locations.dest(),
|
dest = locations.dest(),
|
||||||
routes = locations.routes(),
|
routes = locations.routes(),
|
||||||
'dev-port': dev_port,
|
'dev-port': dev_port,
|
||||||
@@ -65,7 +65,7 @@ class Watcher extends EventEmitter {
|
|||||||
rollup = 'rollup',
|
rollup = 'rollup',
|
||||||
port = +process.env.PORT
|
port = +process.env.PORT
|
||||||
}: {
|
}: {
|
||||||
app: string,
|
src: string,
|
||||||
dest: string,
|
dest: string,
|
||||||
routes: string,
|
routes: string,
|
||||||
'dev-port': number,
|
'dev-port': number,
|
||||||
@@ -80,7 +80,7 @@ class Watcher extends EventEmitter {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
this.bundler = validate_bundler(bundler);
|
this.bundler = validate_bundler(bundler);
|
||||||
this.dirs = { app, dest, routes, webpack, rollup };
|
this.dirs = { src, dest, routes, webpack, rollup };
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.closed = false;
|
this.closed = false;
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ class Watcher extends EventEmitter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// remove this in a future version
|
// remove this in a future version
|
||||||
const template = fs.readFileSync(path.join(app, 'template.html'), 'utf-8');
|
const template = fs.readFileSync(path.join(src, 'template.html'), 'utf-8');
|
||||||
if (template.indexOf('%sapper.base%') === -1) {
|
if (template.indexOf('%sapper.base%') === -1) {
|
||||||
const error = new Error(`As of Sapper v0.10, your template.html file must include %sapper.base% in the <head>`);
|
const error = new Error(`As of Sapper v0.10, your template.html file must include %sapper.base% in the <head>`);
|
||||||
error.code = `missing-sapper-base`;
|
error.code = `missing-sapper-base`;
|
||||||
@@ -175,7 +175,7 @@ class Watcher extends EventEmitter {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
fs.watch(`${locations.app()}/template.html`, () => {
|
fs.watch(`${locations.src()}/template.html`, () => {
|
||||||
this.dev_server.send({
|
this.dev_server.send({
|
||||||
action: 'reload'
|
action: 'reload'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import * as events from './interfaces';
|
|||||||
type Opts = {
|
type Opts = {
|
||||||
build: string,
|
build: string,
|
||||||
dest: string,
|
dest: string,
|
||||||
|
static: string,
|
||||||
basepath?: string,
|
basepath?: string,
|
||||||
timeout: number | false
|
timeout: number | false
|
||||||
};
|
};
|
||||||
@@ -46,7 +47,7 @@ async function execute(emitter: EventEmitter, opts: Opts) {
|
|||||||
// Prep output directory
|
// Prep output directory
|
||||||
sander.rimrafSync(export_dir);
|
sander.rimrafSync(export_dir);
|
||||||
|
|
||||||
sander.copydirSync('assets').to(export_dir);
|
sander.copydirSync(opts.static).to(export_dir);
|
||||||
sander.copydirSync(opts.build, 'client').to(export_dir, 'client');
|
sander.copydirSync(opts.build, 'client').to(export_dir, 'client');
|
||||||
|
|
||||||
if (sander.existsSync(opts.build, 'service-worker.js')) {
|
if (sander.existsSync(opts.build, 'service-worker.js')) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function build(opts: { bundler?: string, legacy?: boolean }) {
|
|||||||
bundler
|
bundler
|
||||||
}, {
|
}, {
|
||||||
dest: locations.dest(),
|
dest: locations.dest(),
|
||||||
app: locations.app(),
|
src: locations.src(),
|
||||||
routes: locations.routes(),
|
routes: locations.routes(),
|
||||||
webpack: 'webpack',
|
webpack: 'webpack',
|
||||||
rollup: 'rollup'
|
rollup: 'rollup'
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export function exporter(export_dir: string, {
|
|||||||
try {
|
try {
|
||||||
const emitter = _exporter({
|
const emitter = _exporter({
|
||||||
build: locations.dest(),
|
build: locations.dest(),
|
||||||
|
static: locations.static(),
|
||||||
dest: export_dir,
|
dest: export_dir,
|
||||||
basepath,
|
basepath,
|
||||||
timeout
|
timeout
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ export const dev = () => process.env.NODE_ENV !== 'production';
|
|||||||
|
|
||||||
export const locations = {
|
export const locations = {
|
||||||
base: () => path.resolve(process.env.SAPPER_BASE || ''),
|
base: () => path.resolve(process.env.SAPPER_BASE || ''),
|
||||||
app: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_APP || 'app'),
|
src: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_SRC || 'src'),
|
||||||
routes: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_ROUTES || 'routes'),
|
static: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_STATIC || 'static'),
|
||||||
|
routes: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_ROUTES || 'src/routes'),
|
||||||
dest: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_DEST || `.sapper/${dev() ? 'dev' : 'prod'}`)
|
dest: () => path.resolve(process.env.SAPPER_BASE || '', process.env.SAPPER_DEST || `.sapper/${dev() ? 'dev' : 'prod'}`)
|
||||||
};
|
};
|
||||||
@@ -10,7 +10,7 @@ export function create_main_manifests({ bundler, manifest_data, dev_port }: {
|
|||||||
manifest_data: ManifestData;
|
manifest_data: ManifestData;
|
||||||
dev_port?: number;
|
dev_port?: number;
|
||||||
}) {
|
}) {
|
||||||
const manifest_dir = path.join(locations.app(), 'manifest');
|
const manifest_dir = path.join(locations.src(), 'manifest');
|
||||||
if (!fs.existsSync(manifest_dir)) fs.mkdirSync(manifest_dir);
|
if (!fs.existsSync(manifest_dir)) fs.mkdirSync(manifest_dir);
|
||||||
|
|
||||||
const path_to_routes = path.relative(manifest_dir, locations.routes());
|
const path_to_routes = path.relative(manifest_dir, locations.routes());
|
||||||
@@ -30,20 +30,21 @@ export function create_serviceworker_manifest({ manifest_data, client_files }: {
|
|||||||
manifest_data: ManifestData;
|
manifest_data: ManifestData;
|
||||||
client_files: string[];
|
client_files: string[];
|
||||||
}) {
|
}) {
|
||||||
const assets = glob('**', { cwd: 'assets', filesOnly: true });
|
const files = glob('**', { cwd: locations.static(), filesOnly: true });
|
||||||
|
|
||||||
let code = `
|
let code = `
|
||||||
// This file is generated by Sapper — do not edit it!
|
// This file is generated by Sapper — do not edit it!
|
||||||
export const timestamp = ${Date.now()};
|
export const timestamp = ${Date.now()};
|
||||||
|
|
||||||
export const assets = [\n\t${assets.map((x: string) => `"${x}"`).join(',\n\t')}\n];
|
export const files = [\n\t${files.map((x: string) => `"${x}"`).join(',\n\t')}\n];
|
||||||
|
export { files as assets }; // legacy
|
||||||
|
|
||||||
export const shell = [\n\t${client_files.map((x: string) => `"${x}"`).join(',\n\t')}\n];
|
export const shell = [\n\t${client_files.map((x: string) => `"${x}"`).join(',\n\t')}\n];
|
||||||
|
|
||||||
export const routes = [\n\t${manifest_data.pages.map((r: Page) => `{ pattern: ${r.pattern} }`).join(',\n\t')}\n];
|
export const routes = [\n\t${manifest_data.pages.map((r: Page) => `{ pattern: ${r.pattern} }`).join(',\n\t')}\n];
|
||||||
`.replace(/^\t\t/gm, '').trim();
|
`.replace(/^\t\t/gm, '').trim();
|
||||||
|
|
||||||
write_if_changed(`${locations.app()}/manifest/service-worker.js`, code);
|
write_if_changed(`${locations.src()}/manifest/service-worker.js`, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_client(
|
function generate_client(
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export type ServerRoute = {
|
|||||||
|
|
||||||
export type Dirs = {
|
export type Dirs = {
|
||||||
dest: string,
|
dest: string,
|
||||||
app: string,
|
src: string,
|
||||||
routes: string,
|
routes: string,
|
||||||
webpack: string,
|
webpack: string,
|
||||||
rollup: string
|
rollup: string
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ function get_page_handler(
|
|||||||
: (assets => () => assets)(JSON.parse(fs.readFileSync(path.join(output, 'build.json'), 'utf-8')));
|
: (assets => () => assets)(JSON.parse(fs.readFileSync(path.join(output, 'build.json'), 'utf-8')));
|
||||||
|
|
||||||
const template = dev()
|
const template = dev()
|
||||||
? () => fs.readFileSync(`${locations.app()}/template.html`, 'utf-8')
|
? () => fs.readFileSync(`${locations.src()}/template.html`, 'utf-8')
|
||||||
: (str => () => str)(fs.readFileSync(`${locations.dest()}/template.html`, 'utf-8'));
|
: (str => () => str)(fs.readFileSync(`${locations.dest()}/template.html`, 'utf-8'));
|
||||||
|
|
||||||
const { server_routes, pages } = manifest;
|
const { server_routes, pages } = manifest;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default {
|
|||||||
|
|
||||||
client: {
|
client: {
|
||||||
input: () => {
|
input: () => {
|
||||||
return `${locations.app()}/client.js`
|
return `${locations.src()}/client.js`
|
||||||
},
|
},
|
||||||
|
|
||||||
output: () => {
|
output: () => {
|
||||||
@@ -24,7 +24,7 @@ export default {
|
|||||||
|
|
||||||
server: {
|
server: {
|
||||||
input: () => {
|
input: () => {
|
||||||
return `${locations.app()}/server.js`
|
return `${locations.src()}/server.js`
|
||||||
},
|
},
|
||||||
|
|
||||||
output: () => {
|
output: () => {
|
||||||
@@ -38,7 +38,7 @@ export default {
|
|||||||
|
|
||||||
serviceworker: {
|
serviceworker: {
|
||||||
input: () => {
|
input: () => {
|
||||||
return `${locations.app()}/service-worker.js`;
|
return `${locations.src()}/service-worker.js`;
|
||||||
},
|
},
|
||||||
|
|
||||||
output: () => {
|
output: () => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default {
|
|||||||
client: {
|
client: {
|
||||||
entry: () => {
|
entry: () => {
|
||||||
return {
|
return {
|
||||||
main: `${locations.app()}/client`
|
main: `${locations.src()}/client`
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
server: {
|
server: {
|
||||||
entry: () => {
|
entry: () => {
|
||||||
return {
|
return {
|
||||||
server: `${locations.app()}/server`
|
server: `${locations.src()}/server`
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ export default {
|
|||||||
serviceworker: {
|
serviceworker: {
|
||||||
entry: () => {
|
entry: () => {
|
||||||
return {
|
return {
|
||||||
'service-worker': `${locations.app()}/service-worker`
|
'service-worker': `${locations.src()}/service-worker`
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
299
test/app/src/manifest/client.js
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
// This file is generated by Sapper — do not edit it!
|
||||||
|
import root from '../routes/_layout.html';
|
||||||
|
import error from '../routes/_error.html';
|
||||||
|
|
||||||
|
const d = decodeURIComponent;
|
||||||
|
|
||||||
|
const index = {
|
||||||
|
js: () => import(/* webpackChunkName: "index" */ '../routes/index.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:index.html__"
|
||||||
|
};
|
||||||
|
const non$45sapper$45redirect$45to = {
|
||||||
|
js: () => import(/* webpackChunkName: "non$45sapper$45redirect$45to" */ '../routes/non-sapper-redirect-to.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:non-sapper-redirect-to.html__"
|
||||||
|
};
|
||||||
|
const unsafe$45replacement = {
|
||||||
|
js: () => import(/* webpackChunkName: "unsafe$45replacement" */ '../routes/unsafe-replacement.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:unsafe-replacement.html__"
|
||||||
|
};
|
||||||
|
const preload$45values = {
|
||||||
|
js: () => import(/* webpackChunkName: "preload$45values" */ '../routes/preload-values/index.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:preload-values/index.html__"
|
||||||
|
};
|
||||||
|
const preload$45values_custom$45class = {
|
||||||
|
js: () => import(/* webpackChunkName: "preload$45values_custom$45class" */ '../routes/preload-values/custom-class.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:preload-values/custom-class.html__"
|
||||||
|
};
|
||||||
|
const preload$45values_set = {
|
||||||
|
js: () => import(/* webpackChunkName: "preload$45values_set" */ '../routes/preload-values/set.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:preload-values/set.html__"
|
||||||
|
};
|
||||||
|
const missing$45index_ok = {
|
||||||
|
js: () => import(/* webpackChunkName: "missing$45index_ok" */ '../routes/missing-index/ok.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:missing-index/ok.html__"
|
||||||
|
};
|
||||||
|
const redirect$45from = {
|
||||||
|
js: () => import(/* webpackChunkName: "redirect$45from" */ '../routes/redirect-from.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:redirect-from.html__"
|
||||||
|
};
|
||||||
|
const redirect$45root = {
|
||||||
|
js: () => import(/* webpackChunkName: "redirect$45root" */ '../routes/redirect-root.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:redirect-root.html__"
|
||||||
|
};
|
||||||
|
const preload$45root = {
|
||||||
|
js: () => import(/* webpackChunkName: "preload$45root" */ '../routes/preload-root/index.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:preload-root/index.html__"
|
||||||
|
};
|
||||||
|
const slow$45preload = {
|
||||||
|
js: () => import(/* webpackChunkName: "slow$45preload" */ '../routes/slow-preload.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:slow-preload.html__"
|
||||||
|
};
|
||||||
|
const credentials = {
|
||||||
|
js: () => import(/* webpackChunkName: "credentials" */ '../routes/credentials/index.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:credentials/index.html__"
|
||||||
|
};
|
||||||
|
const delete$45test = {
|
||||||
|
js: () => import(/* webpackChunkName: "delete$45test" */ '../routes/delete-test.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:delete-test.html__"
|
||||||
|
};
|
||||||
|
const redirect$45to = {
|
||||||
|
js: () => import(/* webpackChunkName: "redirect$45to" */ '../routes/redirect-to.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:redirect-to.html__"
|
||||||
|
};
|
||||||
|
const about = {
|
||||||
|
js: () => import(/* webpackChunkName: "about" */ '../routes/about.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:about.html__"
|
||||||
|
};
|
||||||
|
const const_ = {
|
||||||
|
js: () => import(/* webpackChunkName: "const_" */ '../routes/const.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:const.html__"
|
||||||
|
};
|
||||||
|
const f$252nke = {
|
||||||
|
js: () => import(/* webpackChunkName: "f$252nke" */ '../routes/fünke.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:fünke.html__"
|
||||||
|
};
|
||||||
|
const store = {
|
||||||
|
js: () => import(/* webpackChunkName: "store" */ '../routes/store.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:store.html__"
|
||||||
|
};
|
||||||
|
const blog = {
|
||||||
|
js: () => import(/* webpackChunkName: "blog" */ '../routes/blog/index.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:blog/index.html__"
|
||||||
|
};
|
||||||
|
const blog_$slug = {
|
||||||
|
js: () => import(/* webpackChunkName: "blog_$slug" */ '../routes/blog/[slug].html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:blog/[slug].html__"
|
||||||
|
};
|
||||||
|
const echo_page_$slug = {
|
||||||
|
js: () => import(/* webpackChunkName: "echo_page_$slug" */ '../routes/echo/page/[slug].html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:echo/page/[slug].html__"
|
||||||
|
};
|
||||||
|
const $x$93_$91y__layout = {
|
||||||
|
js: () => import(/* webpackChunkName: "$x$93_$91y__layout" */ '../routes/[x]/[y]/_layout.html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:[x]/[y]/_layout.html__"
|
||||||
|
};
|
||||||
|
const $x$93_$91y$93_$91z = {
|
||||||
|
js: () => import(/* webpackChunkName: "$x$93_$91y$93_$91z" */ '../routes/[x]/[y]/[z].html'),
|
||||||
|
css: "__SAPPER_CSS_PLACEHOLDER:[x]/[y]/[z].html__"
|
||||||
|
};
|
||||||
|
|
||||||
|
export const manifest = {
|
||||||
|
ignore: [/^\/throw-an-error$/, /^\/credentials\/test.json$/, /^\/f%C3%BCnke.json$/, /^\/blog.json$/, /^\/blog\/([^\/]+?).json$/, /^\/echo\/server-route\/([^\/]+?)$/, /^\/api\/delete\/([^\/]+?)$/],
|
||||||
|
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
// index.html
|
||||||
|
pattern: /^\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: index }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// non-sapper-redirect-to.html
|
||||||
|
pattern: /^\/non-sapper-redirect-to\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: non$45sapper$45redirect$45to }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// unsafe-replacement.html
|
||||||
|
pattern: /^\/unsafe-replacement\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: unsafe$45replacement }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/index.html
|
||||||
|
pattern: /^\/preload-values\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: preload$45values }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/custom-class.html
|
||||||
|
pattern: /^\/preload-values\/custom-class\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: preload$45values_custom$45class }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/set.html
|
||||||
|
pattern: /^\/preload-values\/set\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: preload$45values_set }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// missing-index/ok.html
|
||||||
|
pattern: /^\/missing-index\/ok\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: missing$45index_ok }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-from.html
|
||||||
|
pattern: /^\/redirect-from\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: redirect$45from }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-root.html
|
||||||
|
pattern: /^\/redirect-root\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: redirect$45root }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-root/index.html
|
||||||
|
pattern: /^\/preload-root\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: preload$45root }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// slow-preload.html
|
||||||
|
pattern: /^\/slow-preload\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: slow$45preload }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// credentials/index.html
|
||||||
|
pattern: /^\/credentials\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: credentials }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// delete-test.html
|
||||||
|
pattern: /^\/delete-test\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: delete$45test }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-to.html
|
||||||
|
pattern: /^\/redirect-to\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: redirect$45to }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// about.html
|
||||||
|
pattern: /^\/about\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: about }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// const.html
|
||||||
|
pattern: /^\/const\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: const_ }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// fünke.html
|
||||||
|
pattern: /^\/f%C3%BCnke\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: f$252nke }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// store.html
|
||||||
|
pattern: /^\/store\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ component: store }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/index.html
|
||||||
|
pattern: /^\/blog\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: blog }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/[slug].html
|
||||||
|
pattern: /^\/blog\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: blog_$slug, params: match => ({ slug: d(match[1]) }) }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// echo/page/[slug].html
|
||||||
|
pattern: /^\/echo\/page\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ component: echo_page_$slug, params: match => ({ slug: d(match[1]) }) }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// [x]/[y]/[z].html
|
||||||
|
pattern: /^\/([^\/]+?)\/([^\/]+?)\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ component: $x$93_$91y__layout, params: match => ({ x: d(match[1]), y: d(match[2]) }) },
|
||||||
|
{ component: $x$93_$91y$93_$91z, params: match => ({ x: d(match[1]), y: d(match[2]), z: d(match[3]) }) }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
root,
|
||||||
|
|
||||||
|
error
|
||||||
|
};
|
||||||
|
|
||||||
|
// this is included for legacy reasons
|
||||||
|
export const routes = {};
|
||||||
285
test/app/src/manifest/server.js
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
// This file is generated by Sapper — do not edit it!
|
||||||
|
import * as route_throw$45an$45error from '../routes/throw-an-error.js';
|
||||||
|
import * as route_credentials_test_json from '../routes/credentials/test.json.js';
|
||||||
|
import * as route_f$252nke_json from '../routes/fünke.json.js';
|
||||||
|
import * as route_blog_json from '../routes/blog/index.json.js';
|
||||||
|
import * as route_blog_$slug_json from '../routes/blog/[slug].json.js';
|
||||||
|
import * as route_echo_server$45route_$slug from '../routes/echo/server-route/[slug].js';
|
||||||
|
import * as route_api_delete_$id from '../routes/api/delete/[id].js';
|
||||||
|
import index from '../routes/index.html';
|
||||||
|
import non$45sapper$45redirect$45to from '../routes/non-sapper-redirect-to.html';
|
||||||
|
import unsafe$45replacement from '../routes/unsafe-replacement.html';
|
||||||
|
import preload$45values from '../routes/preload-values/index.html';
|
||||||
|
import preload$45values_custom$45class from '../routes/preload-values/custom-class.html';
|
||||||
|
import preload$45values_set from '../routes/preload-values/set.html';
|
||||||
|
import missing$45index_ok from '../routes/missing-index/ok.html';
|
||||||
|
import redirect$45from from '../routes/redirect-from.html';
|
||||||
|
import redirect$45root from '../routes/redirect-root.html';
|
||||||
|
import preload$45root from '../routes/preload-root/index.html';
|
||||||
|
import slow$45preload from '../routes/slow-preload.html';
|
||||||
|
import credentials from '../routes/credentials/index.html';
|
||||||
|
import delete$45test from '../routes/delete-test.html';
|
||||||
|
import redirect$45to from '../routes/redirect-to.html';
|
||||||
|
import about from '../routes/about.html';
|
||||||
|
import const_ from '../routes/const.html';
|
||||||
|
import f$252nke from '../routes/fünke.html';
|
||||||
|
import store from '../routes/store.html';
|
||||||
|
import blog from '../routes/blog/index.html';
|
||||||
|
import blog_$slug from '../routes/blog/[slug].html';
|
||||||
|
import echo_page_$slug from '../routes/echo/page/[slug].html';
|
||||||
|
import $x$93_$91y__layout from '../routes/[x]/[y]/_layout.html';
|
||||||
|
import $x$93_$91y$93_$91z from '../routes/[x]/[y]/[z].html';
|
||||||
|
import root from '../routes/_layout.html';
|
||||||
|
import error from '../routes/_error.html';
|
||||||
|
|
||||||
|
const d = decodeURIComponent;
|
||||||
|
|
||||||
|
export const manifest = {
|
||||||
|
server_routes: [
|
||||||
|
{
|
||||||
|
// throw-an-error.js
|
||||||
|
pattern: /^\/throw-an-error$/,
|
||||||
|
handlers: route_throw$45an$45error,
|
||||||
|
params: () => ({})
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// credentials/test.json.js
|
||||||
|
pattern: /^\/credentials\/test.json$/,
|
||||||
|
handlers: route_credentials_test_json,
|
||||||
|
params: () => ({})
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// fünke.json.js
|
||||||
|
pattern: /^\/f%C3%BCnke.json$/,
|
||||||
|
handlers: route_f$252nke_json,
|
||||||
|
params: () => ({})
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/index.json.js
|
||||||
|
pattern: /^\/blog.json$/,
|
||||||
|
handlers: route_blog_json,
|
||||||
|
params: () => ({})
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/[slug].json.js
|
||||||
|
pattern: /^\/blog\/([^\/]+?).json$/,
|
||||||
|
handlers: route_blog_$slug_json,
|
||||||
|
params: match => ({ slug: d(match[1]) })
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// echo/server-route/[slug].js
|
||||||
|
pattern: /^\/echo\/server-route\/([^\/]+?)$/,
|
||||||
|
handlers: route_echo_server$45route_$slug,
|
||||||
|
params: match => ({ slug: d(match[1]) })
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// api/delete/[id].js
|
||||||
|
pattern: /^\/api\/delete\/([^\/]+?)$/,
|
||||||
|
handlers: route_api_delete_$id,
|
||||||
|
params: match => ({ id: d(match[1]) })
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
pages: [
|
||||||
|
{
|
||||||
|
// index.html
|
||||||
|
pattern: /^\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "index", file: "index.html", component: index }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// non-sapper-redirect-to.html
|
||||||
|
pattern: /^\/non-sapper-redirect-to\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "non$45sapper$45redirect$45to", file: "non-sapper-redirect-to.html", component: non$45sapper$45redirect$45to }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// unsafe-replacement.html
|
||||||
|
pattern: /^\/unsafe-replacement\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "unsafe$45replacement", file: "unsafe-replacement.html", component: unsafe$45replacement }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/index.html
|
||||||
|
pattern: /^\/preload-values\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "preload$45values", file: "preload-values/index.html", component: preload$45values }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/custom-class.html
|
||||||
|
pattern: /^\/preload-values\/custom-class\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "preload$45values_custom$45class", file: "preload-values/custom-class.html", component: preload$45values_custom$45class }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-values/set.html
|
||||||
|
pattern: /^\/preload-values\/set\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "preload$45values_set", file: "preload-values/set.html", component: preload$45values_set }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// missing-index/ok.html
|
||||||
|
pattern: /^\/missing-index\/ok\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "missing$45index_ok", file: "missing-index/ok.html", component: missing$45index_ok }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-from.html
|
||||||
|
pattern: /^\/redirect-from\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "redirect$45from", file: "redirect-from.html", component: redirect$45from }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-root.html
|
||||||
|
pattern: /^\/redirect-root\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "redirect$45root", file: "redirect-root.html", component: redirect$45root }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// preload-root/index.html
|
||||||
|
pattern: /^\/preload-root\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "preload$45root", file: "preload-root/index.html", component: preload$45root }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// slow-preload.html
|
||||||
|
pattern: /^\/slow-preload\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "slow$45preload", file: "slow-preload.html", component: slow$45preload }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// credentials/index.html
|
||||||
|
pattern: /^\/credentials\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "credentials", file: "credentials/index.html", component: credentials }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// delete-test.html
|
||||||
|
pattern: /^\/delete-test\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "delete$45test", file: "delete-test.html", component: delete$45test }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// redirect-to.html
|
||||||
|
pattern: /^\/redirect-to\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "redirect$45to", file: "redirect-to.html", component: redirect$45to }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// about.html
|
||||||
|
pattern: /^\/about\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "about", file: "about.html", component: about }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// const.html
|
||||||
|
pattern: /^\/const\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "const_", file: "const.html", component: const_ }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// fünke.html
|
||||||
|
pattern: /^\/f%C3%BCnke\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "f$252nke", file: "fünke.html", component: f$252nke }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// store.html
|
||||||
|
pattern: /^\/store\/?$/,
|
||||||
|
parts: [
|
||||||
|
{ name: "store", file: "store.html", component: store }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/index.html
|
||||||
|
pattern: /^\/blog\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "blog", file: "blog/index.html", component: blog }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// blog/[slug].html
|
||||||
|
pattern: /^\/blog\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "blog_$slug", file: "blog/[slug].html", component: blog_$slug, params: match => ({ slug: d(match[1]) }) }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// echo/page/[slug].html
|
||||||
|
pattern: /^\/echo\/page\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ name: "echo_page_$slug", file: "echo/page/[slug].html", component: echo_page_$slug, params: match => ({ slug: d(match[1]) }) }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
// [x]/[y]/[z].html
|
||||||
|
pattern: /^\/([^\/]+?)\/([^\/]+?)\/([^\/]+?)\/?$/,
|
||||||
|
parts: [
|
||||||
|
null,
|
||||||
|
{ name: "$x$93_$91y__layout", file: "[x]/[y]/_layout.html", component: $x$93_$91y__layout, params: match => ({ x: d(match[1]), y: d(match[2]) }) },
|
||||||
|
{ name: "$x$93_$91y$93_$91z", file: "[x]/[y]/[z].html", component: $x$93_$91y$93_$91z, params: match => ({ x: d(match[1]), y: d(match[2]), z: d(match[3]) }) }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
root,
|
||||||
|
|
||||||
|
error
|
||||||
|
};
|
||||||
|
|
||||||
|
// this is included for legacy reasons
|
||||||
|
export const routes = {};
|
||||||
64
test/app/src/manifest/service-worker.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// This file is generated by Sapper — do not edit it!
|
||||||
|
export const timestamp = 1537372892007;
|
||||||
|
|
||||||
|
export const files = [
|
||||||
|
"favicon.png",
|
||||||
|
"global.css",
|
||||||
|
"great-success.png",
|
||||||
|
"manifest.json",
|
||||||
|
"svelte-logo-192.png",
|
||||||
|
"svelte-logo-512.png"
|
||||||
|
];
|
||||||
|
export { files as assets }; // legacy
|
||||||
|
|
||||||
|
export const shell = [
|
||||||
|
"client/1b495d0233ee9a023603/credentials.12.js",
|
||||||
|
"client/1b495d0233ee9a023603/main.js",
|
||||||
|
"client/1b495d0233ee9a023603/non$45sapper$45redirect$45to.2.js",
|
||||||
|
"client/1b495d0233ee9a023603/unsafe$45replacement.3.js",
|
||||||
|
"client/1b495d0233ee9a023603/preload$45values.4.js",
|
||||||
|
"client/1b495d0233ee9a023603/preload$45values_custom$45class.5.js",
|
||||||
|
"client/1b495d0233ee9a023603/preload$45values_set.6.js",
|
||||||
|
"client/1b495d0233ee9a023603/missing$45index_ok.7.js",
|
||||||
|
"client/1b495d0233ee9a023603/redirect$45from.8.js",
|
||||||
|
"client/1b495d0233ee9a023603/redirect$45root.9.js",
|
||||||
|
"client/1b495d0233ee9a023603/preload$45root.10.js",
|
||||||
|
"client/1b495d0233ee9a023603/slow$45preload.11.js",
|
||||||
|
"client/1b495d0233ee9a023603/index.1.js",
|
||||||
|
"client/1b495d0233ee9a023603/delete$45test.13.js",
|
||||||
|
"client/1b495d0233ee9a023603/redirect$45to.14.js",
|
||||||
|
"client/1b495d0233ee9a023603/about.15.js",
|
||||||
|
"client/1b495d0233ee9a023603/const_.16.js",
|
||||||
|
"client/1b495d0233ee9a023603/f$252nke.17.js",
|
||||||
|
"client/1b495d0233ee9a023603/store.18.js",
|
||||||
|
"client/1b495d0233ee9a023603/blog.19.js",
|
||||||
|
"client/1b495d0233ee9a023603/blog_$slug.20.js",
|
||||||
|
"client/1b495d0233ee9a023603/echo_page_$slug.21.js",
|
||||||
|
"client/1b495d0233ee9a023603/$x$93_$91y__layout.22.js",
|
||||||
|
"client/1b495d0233ee9a023603/$x$93_$91y$93_$91z.23.js"
|
||||||
|
];
|
||||||
|
|
||||||
|
export const routes = [
|
||||||
|
{ pattern: /^\/?$/ },
|
||||||
|
{ pattern: /^\/non-sapper-redirect-to\/?$/ },
|
||||||
|
{ pattern: /^\/unsafe-replacement\/?$/ },
|
||||||
|
{ pattern: /^\/preload-values\/?$/ },
|
||||||
|
{ pattern: /^\/preload-values\/custom-class\/?$/ },
|
||||||
|
{ pattern: /^\/preload-values\/set\/?$/ },
|
||||||
|
{ pattern: /^\/missing-index\/ok\/?$/ },
|
||||||
|
{ pattern: /^\/redirect-from\/?$/ },
|
||||||
|
{ pattern: /^\/redirect-root\/?$/ },
|
||||||
|
{ pattern: /^\/preload-root\/?$/ },
|
||||||
|
{ pattern: /^\/slow-preload\/?$/ },
|
||||||
|
{ pattern: /^\/credentials\/?$/ },
|
||||||
|
{ pattern: /^\/delete-test\/?$/ },
|
||||||
|
{ pattern: /^\/redirect-to\/?$/ },
|
||||||
|
{ pattern: /^\/about\/?$/ },
|
||||||
|
{ pattern: /^\/const\/?$/ },
|
||||||
|
{ pattern: /^\/f%C3%BCnke\/?$/ },
|
||||||
|
{ pattern: /^\/store\/?$/ },
|
||||||
|
{ pattern: /^\/blog\/?$/ },
|
||||||
|
{ pattern: /^\/blog\/([^\/]+?)\/?$/ },
|
||||||
|
{ pattern: /^\/echo\/page\/([^\/]+?)\/?$/ },
|
||||||
|
{ pattern: /^\/([^\/]+?)\/([^\/]+?)\/([^\/]+?)\/?$/ }
|
||||||
|
];
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<button class='prefetch' on:click='prefetch("blog/why-the-name")'>Why the name?</button>
|
<button class='prefetch' on:click='prefetch("blog/why-the-name")'>Why the name?</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { goto, prefetch } from '../../../runtime.js';
|
import { goto, prefetch } from '../../../../runtime.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
oncreate() {
|
oncreate() {
|
||||||
1
test/app/src/routes/preload-values/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svelte:component this={child.component} {...child.props}/>
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |