diff --git a/src/api/build.ts b/src/api/build.ts index ac563de..201e355 100644 --- a/src/api/build.ts +++ b/src/api/build.ts @@ -26,7 +26,7 @@ export async function build({ cwd, src = 'src', routes = 'src/routes', - output = '__sapper__', + output = 'src/node_modules/@sapper', static: static_files = 'static', dest = '__sapper__/build', @@ -48,6 +48,9 @@ export async function build({ 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, '**/*')); mkdirp.sync(`${dest}/client`); copy_shimport(dest); diff --git a/src/cli.ts b/src/cli.ts index 085c981..161ab80 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -29,7 +29,7 @@ prog.command('dev') .option('--src', 'Source directory', 'src') .option('--routes', 'Routes directory', 'src/routes') .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') .action(async (opts: { port: number, @@ -142,7 +142,7 @@ prog.command('build [dest]') .option('--cwd', 'Current working directory', '.') .option('--src', 'Source directory', 'src') .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`) .action(async (dest = '__sapper__/build', opts: { port: string, @@ -188,7 +188,7 @@ prog.command('export [dest]') .option('--src', 'Source directory', 'src') .option('--routes', 'Routes directory', 'src/routes') .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') .action(async (dest = '__sapper__/export', opts: { build: boolean, diff --git a/test/apps/basics/src/client.js b/test/apps/basics/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/basics/src/client.js +++ b/test/apps/basics/src/client.js @@ -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') diff --git a/test/apps/basics/src/server.js b/test/apps/basics/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/basics/src/server.js +++ b/test/apps/basics/src/server.js @@ -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; diff --git a/test/apps/basics/src/service-worker.js b/test/apps/basics/src/service-worker.js index 9d2ac9d..c80a8f4 100644 --- a/test/apps/basics/src/service-worker.js +++ b/test/apps/basics/src/service-worker.js @@ -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); diff --git a/test/apps/credentials/src/client.js b/test/apps/credentials/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/credentials/src/client.js +++ b/test/apps/credentials/src/client.js @@ -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') diff --git a/test/apps/credentials/src/server.js b/test/apps/credentials/src/server.js index 2761f50..951243e 100644 --- a/test/apps/credentials/src/server.js +++ b/test/apps/credentials/src/server.js @@ -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; diff --git a/test/apps/credentials/src/service-worker.js b/test/apps/credentials/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/credentials/src/service-worker.js +++ b/test/apps/credentials/src/service-worker.js @@ -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); diff --git a/test/apps/css/src/client.js b/test/apps/css/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/css/src/client.js +++ b/test/apps/css/src/client.js @@ -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') diff --git a/test/apps/css/src/server.js b/test/apps/css/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/css/src/server.js +++ b/test/apps/css/src/server.js @@ -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; diff --git a/test/apps/css/src/service-worker.js b/test/apps/css/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/css/src/service-worker.js +++ b/test/apps/css/src/service-worker.js @@ -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); diff --git a/test/apps/encoding/src/client.js b/test/apps/encoding/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/encoding/src/client.js +++ b/test/apps/encoding/src/client.js @@ -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') diff --git a/test/apps/encoding/src/server.js b/test/apps/encoding/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/encoding/src/server.js +++ b/test/apps/encoding/src/server.js @@ -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; diff --git a/test/apps/encoding/src/service-worker.js b/test/apps/encoding/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/encoding/src/service-worker.js +++ b/test/apps/encoding/src/service-worker.js @@ -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); diff --git a/test/apps/errors/src/client.js b/test/apps/errors/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/errors/src/client.js +++ b/test/apps/errors/src/client.js @@ -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') diff --git a/test/apps/errors/src/server.js b/test/apps/errors/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/errors/src/server.js +++ b/test/apps/errors/src/server.js @@ -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; diff --git a/test/apps/errors/src/service-worker.js b/test/apps/errors/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/errors/src/service-worker.js +++ b/test/apps/errors/src/service-worker.js @@ -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); diff --git a/test/apps/export/src/client.js b/test/apps/export/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/export/src/client.js +++ b/test/apps/export/src/client.js @@ -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') diff --git a/test/apps/export/src/server.js b/test/apps/export/src/server.js index d5a668b..2c6932d 100644 --- a/test/apps/export/src/server.js +++ b/test/apps/export/src/server.js @@ -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'; diff --git a/test/apps/export/src/service-worker.js b/test/apps/export/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/export/src/service-worker.js +++ b/test/apps/export/src/service-worker.js @@ -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); diff --git a/test/apps/ignore/src/client.js b/test/apps/ignore/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/ignore/src/client.js +++ b/test/apps/ignore/src/client.js @@ -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') diff --git a/test/apps/ignore/src/server.js b/test/apps/ignore/src/server.js index f987e4a..4a66815 100644 --- a/test/apps/ignore/src/server.js +++ b/test/apps/ignore/src/server.js @@ -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; diff --git a/test/apps/ignore/src/service-worker.js b/test/apps/ignore/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/ignore/src/service-worker.js +++ b/test/apps/ignore/src/service-worker.js @@ -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); diff --git a/test/apps/layout/src/client.js b/test/apps/layout/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/layout/src/client.js +++ b/test/apps/layout/src/client.js @@ -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') diff --git a/test/apps/layout/src/server.js b/test/apps/layout/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/layout/src/server.js +++ b/test/apps/layout/src/server.js @@ -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; diff --git a/test/apps/layout/src/service-worker.js b/test/apps/layout/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/layout/src/service-worker.js +++ b/test/apps/layout/src/service-worker.js @@ -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); diff --git a/test/apps/preloading/src/client.js b/test/apps/preloading/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/preloading/src/client.js +++ b/test/apps/preloading/src/client.js @@ -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') diff --git a/test/apps/preloading/src/server.js b/test/apps/preloading/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/preloading/src/server.js +++ b/test/apps/preloading/src/server.js @@ -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; diff --git a/test/apps/preloading/src/service-worker.js b/test/apps/preloading/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/preloading/src/service-worker.js +++ b/test/apps/preloading/src/service-worker.js @@ -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); diff --git a/test/apps/redirects/src/client.js b/test/apps/redirects/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/redirects/src/client.js +++ b/test/apps/redirects/src/client.js @@ -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') diff --git a/test/apps/redirects/src/server.js b/test/apps/redirects/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/redirects/src/server.js +++ b/test/apps/redirects/src/server.js @@ -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; diff --git a/test/apps/redirects/src/service-worker.js b/test/apps/redirects/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/redirects/src/service-worker.js +++ b/test/apps/redirects/src/service-worker.js @@ -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); diff --git a/test/apps/scroll/src/client.js b/test/apps/scroll/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/scroll/src/client.js +++ b/test/apps/scroll/src/client.js @@ -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') diff --git a/test/apps/scroll/src/server.js b/test/apps/scroll/src/server.js index 0e7741c..7f090b8 100644 --- a/test/apps/scroll/src/server.js +++ b/test/apps/scroll/src/server.js @@ -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; diff --git a/test/apps/scroll/src/service-worker.js b/test/apps/scroll/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/scroll/src/service-worker.js +++ b/test/apps/scroll/src/service-worker.js @@ -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); diff --git a/test/apps/store/src/client.js b/test/apps/store/src/client.js index df66471..eb6262c 100644 --- a/test/apps/store/src/client.js +++ b/test/apps/store/src/client.js @@ -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'), diff --git a/test/apps/store/src/server.js b/test/apps/store/src/server.js index c40e690..843b06d 100644 --- a/test/apps/store/src/server.js +++ b/test/apps/store/src/server.js @@ -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; diff --git a/test/apps/store/src/service-worker.js b/test/apps/store/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/store/src/service-worker.js +++ b/test/apps/store/src/service-worker.js @@ -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); diff --git a/test/apps/with-basepath/src/client.js b/test/apps/with-basepath/src/client.js index 0865a4a..5fd4ce8 100644 --- a/test/apps/with-basepath/src/client.js +++ b/test/apps/with-basepath/src/client.js @@ -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') diff --git a/test/apps/with-basepath/src/server.js b/test/apps/with-basepath/src/server.js index b187dad..22da3e9 100644 --- a/test/apps/with-basepath/src/server.js +++ b/test/apps/with-basepath/src/server.js @@ -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'; diff --git a/test/apps/with-basepath/src/service-worker.js b/test/apps/with-basepath/src/service-worker.js index 9d2ac9d..8adb97a 100644 --- a/test/apps/with-basepath/src/service-worker.js +++ b/test/apps/with-basepath/src/service-worker.js @@ -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);