default to generating app in src/node_modules/@sapper - fixes #551

This commit is contained in:
Rich Harris
2019-01-31 10:35:14 -05:00
parent 76ce7f227f
commit 90f3393ebf
41 changed files with 87 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(ASSETS);
// `app.shell` is an array of all the files generated by webpack,
// `app.files` is an array of everything in the `static` directory
const to_cache = sapper.shell.concat(sapper.files);
const cached = new Set(to_cache);
self.addEventListener('install', event => {
@@ -52,7 +52,6 @@ self.addEventListener('fetch', event => {
// which Sapper has generated for you. It's not right for every
// 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'));
return;
}
@@ -65,7 +64,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,6 +1,6 @@
import sirv from 'sirv';
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,5 +1,5 @@
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,5 +1,5 @@
import { Store } from 'svelte/store.js';
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper'),

View File

@@ -1,6 +1,6 @@
import polka from 'polka';
import { Store } from 'svelte/store.js';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT } = process.env;

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);

View File

@@ -1,4 +1,4 @@
import * as sapper from '../__sapper__/client.js';
import * as sapper from '@sapper/client';
window.start = () => sapper.start({
target: document.querySelector('#sapper')

View File

@@ -1,6 +1,6 @@
import sirv from 'sirv';
import polka from 'polka';
import * as sapper from '../__sapper__/server.js';
import * as sapper from '@sapper/server';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';

View File

@@ -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,
// `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);
self.addEventListener('install', event => {
@@ -65,7 +65,7 @@ self.addEventListener('fetch', event => {
// might prefer a cache-first approach to a network-first one.)
event.respondWith(
caches
.open(`offline${timestamp}`)
.open(`offline${sapper.timestamp}`)
.then(async cache => {
try {
const response = await fetch(event.request);