@sveltejs/kit 1.0.0-next.212 → 1.0.0-next.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -249,11 +249,12 @@ async function build_client({
249
249
  * @param {{
250
250
  * runtime: string,
251
251
  * hooks: string,
252
- * config: import('types/config').ValidatedConfig
252
+ * config: import('types/config').ValidatedConfig,
253
+ * has_service_worker: boolean
253
254
  * }} opts
254
255
  * @returns
255
256
  */
256
- const template = ({ config, hooks, runtime }) => `
257
+ const template = ({ config, hooks, runtime, has_service_worker }) => `
257
258
  import { respond } from '${runtime}';
258
259
  import root from './generated/root.svelte';
259
260
  import { set_paths, assets, base } from './runtime/paths.js';
@@ -309,11 +310,7 @@ export class App {
309
310
  prerender: ${config.kit.prerender.enabled},
310
311
  read,
311
312
  root,
312
- service_worker: ${
313
- config.kit.files.serviceWorker && config.kit.serviceWorker.register
314
- ? "'/service-worker.js'"
315
- : 'null'
316
- },
313
+ service_worker: ${has_service_worker ? "'/service-worker.js'" : 'null'},
317
314
  router: ${s(config.kit.router)},
318
315
  ssr: ${s(config.kit.ssr)},
319
316
  target: ${s(config.kit.target)},
@@ -356,12 +353,23 @@ export class App {
356
353
  * manifest_data: import('types/internal').ManifestData
357
354
  * build_dir: string;
358
355
  * output_dir: string;
356
+ * service_worker_entry_file: string | null;
357
+ * service_worker_register: boolean;
359
358
  * }} options
360
359
  * @param {string} runtime
361
360
  * @param {{ vite_manifest: import('vite').Manifest, assets: import('rollup').OutputAsset[] }} client
362
361
  */
363
362
  async function build_server(
364
- { cwd, assets_base, config, manifest_data, build_dir, output_dir },
363
+ {
364
+ cwd,
365
+ assets_base,
366
+ config,
367
+ manifest_data,
368
+ build_dir,
369
+ output_dir,
370
+ service_worker_entry_file,
371
+ service_worker_register
372
+ },
365
373
  runtime,
366
374
  client
367
375
  ) {
@@ -409,7 +417,8 @@ async function build_server(
409
417
  template({
410
418
  config,
411
419
  hooks: app_relative(hooks_file),
412
- runtime
420
+ runtime,
421
+ has_service_worker: service_worker_register && !!service_worker_entry_file
413
422
  })
414
423
  );
415
424
 
@@ -270,7 +270,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
270
270
 
271
271
  const rendered = await app.render(
272
272
  {
273
- url: `${config.kit.protocol || 'sveltekit'}://${config.kit.host || 'prerender'}${path}`,
273
+ url: `${config.kit.protocol || 'http'}://${config.kit.host || 'prerender'}${path}`,
274
274
  method: 'GET',
275
275
  headers: {},
276
276
  rawBody: null
@@ -417,7 +417,7 @@ async function prerender({ cwd, out, log, config, build_data, fallback, all }) {
417
417
  if (fallback) {
418
418
  const rendered = await app.render(
419
419
  {
420
- url: `${config.kit.host || 'sveltekit'}://${config.kit.host || 'prerender'}/[fallback]`,
420
+ url: `${config.kit.protocol || 'http'}://${config.kit.host || 'prerender'}/[fallback]`,
421
421
  method: 'GET',
422
422
  headers: {},
423
423
  rawBody: null
package/dist/cli.js CHANGED
@@ -887,7 +887,7 @@ async function launch(port, https) {
887
887
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
888
888
  }
889
889
 
890
- const prog = sade('svelte-kit').version('1.0.0-next.212');
890
+ const prog = sade('svelte-kit').version('1.0.0-next.213');
891
891
 
892
892
  prog
893
893
  .command('dev')
@@ -1039,7 +1039,7 @@ async function check_port(port) {
1039
1039
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1040
1040
  if (open) launch(port, https);
1041
1041
 
1042
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.212'}\n`));
1042
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.213'}\n`));
1043
1043
 
1044
1044
  const protocol = https ? 'https:' : 'http:';
1045
1045
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.212",
3
+ "version": "1.0.0-next.213",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",