@sveltejs/kit 1.0.0-next.248 → 1.0.0-next.249

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.
@@ -455,17 +455,16 @@ function create_manifest_data({
455
455
  }
456
456
  });
457
457
 
458
- if (name[0] === '_') {
459
- if (name[1] === '_' && !specials.has(name)) {
460
- throw new Error(`Files and directories prefixed with __ are reserved (saw ${file})`);
461
- }
462
-
463
- return;
458
+ if (basename.startsWith('__') && !specials.has(name)) {
459
+ throw new Error(`Files and directories prefixed with __ are reserved (saw ${file})`);
464
460
  }
465
461
 
466
- if (basename[0] === '.' && basename !== '.well-known') return null;
467
462
  if (!is_dir && !/^(\.[a-z0-9]+)+$/i.test(ext)) return null; // filter out tmp files etc
468
463
 
464
+ if (!config.kit.routes(file)) {
465
+ return;
466
+ }
467
+
469
468
  const segment = is_dir ? basename : name;
470
469
 
471
470
  if (/\]\[/.test(segment)) {
@@ -626,6 +626,7 @@ async function build(config) {
626
626
  const build_data = {
627
627
  app_dir: config.kit.appDir,
628
628
  manifest_data: options.manifest_data,
629
+ service_worker: options.service_worker_entry_file ? 'service_worker.js' : null, // TODO make file configurable?
629
630
  client,
630
631
  server,
631
632
  static: options.manifest_data.assets.map((asset) => posixify(asset.file)),
@@ -47,10 +47,15 @@ function generate_manifest(
47
47
  ? (path) => `() => import('${path}')`
48
48
  : (path) => `() => Promise.resolve().then(() => require('${path}'))`;
49
49
 
50
+ const assets = build_data.manifest_data.assets.map((asset) => asset.file);
51
+ if (build_data.service_worker) {
52
+ assets.push(build_data.service_worker);
53
+ }
54
+
50
55
  // prettier-ignore
51
56
  return `{
52
57
  appDir: ${s(build_data.app_dir)},
53
- assets: new Set(${s(build_data.manifest_data.assets.map(asset => asset.file))}),
58
+ assets: new Set(${s(assets)}),
54
59
  _: {
55
60
  mime: ${s(get_mime_lookup(build_data.manifest_data))},
56
61
  entry: ${s(build_data.client.entry)},
package/dist/cli.js CHANGED
@@ -676,6 +676,8 @@ const options = object(
676
676
 
677
677
  router: boolean(true),
678
678
 
679
+ routes: fun((filepath) => !/(?:(?:^_|\/_)|(?:^\.|\/\.)(?!well-known))/.test(filepath)),
680
+
679
681
  serviceWorker: object({
680
682
  register: boolean(true),
681
683
  files: fun((filename) => !/\.DS_STORE/.test(filename))
@@ -986,7 +988,7 @@ async function launch(port, https) {
986
988
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
987
989
  }
988
990
 
989
- const prog = sade('svelte-kit').version('1.0.0-next.248');
991
+ const prog = sade('svelte-kit').version('1.0.0-next.249');
990
992
 
991
993
  prog
992
994
  .command('dev')
@@ -1144,7 +1146,7 @@ async function check_port(port) {
1144
1146
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1145
1147
  if (open) launch(port, https);
1146
1148
 
1147
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.248'}\n`));
1149
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.249'}\n`));
1148
1150
 
1149
1151
  const protocol = https ? 'https:' : 'http:';
1150
1152
  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.248",
3
+ "version": "1.0.0-next.249",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
package/types/config.d.ts CHANGED
@@ -155,6 +155,7 @@ export interface Config {
155
155
  onError?: PrerenderOnErrorValue;
156
156
  };
157
157
  router?: boolean;
158
+ routes?: (filepath: string) => boolean;
158
159
  serviceWorker?: {
159
160
  register?: boolean;
160
161
  files?: (filepath: string) => boolean;
@@ -209,6 +209,7 @@ export interface ManifestData {
209
209
  export interface BuildData {
210
210
  app_dir: string;
211
211
  manifest_data: ManifestData;
212
+ service_worker: string | null;
212
213
  client: {
213
214
  assets: OutputAsset[];
214
215
  chunks: OutputChunk[];