mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-17 21:24:59 +00:00
default to generating app in src/node_modules/@sapper - fixes #551
This commit is contained in:
@@ -26,7 +26,7 @@ export async function build({
|
|||||||
cwd,
|
cwd,
|
||||||
src = 'src',
|
src = 'src',
|
||||||
routes = 'src/routes',
|
routes = 'src/routes',
|
||||||
output = '__sapper__',
|
output = 'src/node_modules/@sapper',
|
||||||
static: static_files = 'static',
|
static: static_files = 'static',
|
||||||
dest = '__sapper__/build',
|
dest = '__sapper__/build',
|
||||||
|
|
||||||
@@ -48,6 +48,9 @@ export async function build({
|
|||||||
throw new Error(`Legacy builds are not supported for projects using webpack`);
|
throw new Error(`Legacy builds are not supported for projects using webpack`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rimraf.sync(path.join(output, '**/*'));
|
||||||
|
mkdirp.sync(output);
|
||||||
|
|
||||||
rimraf.sync(path.join(dest, '**/*'));
|
rimraf.sync(path.join(dest, '**/*'));
|
||||||
mkdirp.sync(`${dest}/client`);
|
mkdirp.sync(`${dest}/client`);
|
||||||
copy_shimport(dest);
|
copy_shimport(dest);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ prog.command('dev')
|
|||||||
.option('--src', 'Source directory', 'src')
|
.option('--src', 'Source directory', 'src')
|
||||||
.option('--routes', 'Routes directory', 'src/routes')
|
.option('--routes', 'Routes directory', 'src/routes')
|
||||||
.option('--static', 'Static files directory', 'static')
|
.option('--static', 'Static files directory', 'static')
|
||||||
.option('--output', 'Sapper output directory', '__sapper__')
|
.option('--output', 'Sapper output directory', 'src/node_modules/@sapper')
|
||||||
.option('--build-dir', 'Development build directory', '__sapper__/dev')
|
.option('--build-dir', 'Development build directory', '__sapper__/dev')
|
||||||
.action(async (opts: {
|
.action(async (opts: {
|
||||||
port: number,
|
port: number,
|
||||||
@@ -142,7 +142,7 @@ prog.command('build [dest]')
|
|||||||
.option('--cwd', 'Current working directory', '.')
|
.option('--cwd', 'Current working directory', '.')
|
||||||
.option('--src', 'Source directory', 'src')
|
.option('--src', 'Source directory', 'src')
|
||||||
.option('--routes', 'Routes directory', 'src/routes')
|
.option('--routes', 'Routes directory', 'src/routes')
|
||||||
.option('--output', 'Sapper output directory', '__sapper__')
|
.option('--output', 'Sapper output directory', 'src/node_modules/@sapper')
|
||||||
.example(`build custom-dir -p 4567`)
|
.example(`build custom-dir -p 4567`)
|
||||||
.action(async (dest = '__sapper__/build', opts: {
|
.action(async (dest = '__sapper__/build', opts: {
|
||||||
port: string,
|
port: string,
|
||||||
@@ -188,7 +188,7 @@ prog.command('export [dest]')
|
|||||||
.option('--src', 'Source directory', 'src')
|
.option('--src', 'Source directory', 'src')
|
||||||
.option('--routes', 'Routes directory', 'src/routes')
|
.option('--routes', 'Routes directory', 'src/routes')
|
||||||
.option('--static', 'Static files directory', 'static')
|
.option('--static', 'Static files directory', 'static')
|
||||||
.option('--output', 'Sapper output directory', '__sapper__')
|
.option('--output', 'Sapper output directory', 'src/node_modules/@sapper')
|
||||||
.option('--build-dir', 'Intermediate build directory', '__sapper__/build')
|
.option('--build-dir', 'Intermediate build directory', '__sapper__/build')
|
||||||
.action(async (dest = '__sapper__/export', opts: {
|
.action(async (dest = '__sapper__/export', opts: {
|
||||||
build: boolean,
|
build: boolean,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `app.shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `app.files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -52,7 +52,6 @@ self.addEventListener('fetch', event => {
|
|||||||
// which Sapper has generated for you. It's not right for every
|
// which Sapper has generated for you. It's not right for every
|
||||||
// app, but if it's right for yours then uncomment this section
|
// app, but if it's right for yours then uncomment this section
|
||||||
/*
|
/*
|
||||||
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
|
|
||||||
event.respondWith(caches.match('/index.html'));
|
event.respondWith(caches.match('/index.html'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -65,7 +64,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sirv from 'sirv';
|
import sirv from 'sirv';
|
||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT, NODE_ENV } = process.env;
|
const { PORT, NODE_ENV } = process.env;
|
||||||
const dev = NODE_ENV === 'development';
|
const dev = NODE_ENV === 'development';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Store } from 'svelte/store.js';
|
import { Store } from 'svelte/store.js';
|
||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper'),
|
target: document.querySelector('#sapper'),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import { Store } from 'svelte/store.js';
|
import { Store } from 'svelte/store.js';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT } = process.env;
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as sapper from '../__sapper__/client.js';
|
import * as sapper from '@sapper/client';
|
||||||
|
|
||||||
window.start = () => sapper.start({
|
window.start = () => sapper.start({
|
||||||
target: document.querySelector('#sapper')
|
target: document.querySelector('#sapper')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sirv from 'sirv';
|
import sirv from 'sirv';
|
||||||
import polka from 'polka';
|
import polka from 'polka';
|
||||||
import * as sapper from '../__sapper__/server.js';
|
import * as sapper from '@sapper/server';
|
||||||
|
|
||||||
const { PORT, NODE_ENV } = process.env;
|
const { PORT, NODE_ENV } = process.env;
|
||||||
const dev = NODE_ENV === 'development';
|
const dev = NODE_ENV === 'development';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
import * as sapper from '@sapper/service-worker';
|
||||||
|
|
||||||
const ASSETS = `cache${timestamp}`;
|
const ASSETS = `cache${sapper.timestamp}`;
|
||||||
|
|
||||||
// `shell` is an array of all the files generated by webpack,
|
// `shell` is an array of all the files generated by webpack,
|
||||||
// `files` is an array of everything in the `static` directory
|
// `files` is an array of everything in the `static` directory
|
||||||
const to_cache = shell.concat(ASSETS);
|
const to_cache = sapper.shell.concat(sapper.files);
|
||||||
const cached = new Set(to_cache);
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
self.addEventListener('install', event => {
|
self.addEventListener('install', event => {
|
||||||
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
|
|||||||
// might prefer a cache-first approach to a network-first one.)
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
event.respondWith(
|
event.respondWith(
|
||||||
caches
|
caches
|
||||||
.open(`offline${timestamp}`)
|
.open(`offline${sapper.timestamp}`)
|
||||||
.then(async cache => {
|
.then(async cache => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(event.request);
|
const response = await fetch(event.request);
|
||||||
|
|||||||
Reference in New Issue
Block a user