@sveltejs/kit 1.0.0-next.217 → 1.0.0-next.218

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.
package/assets/kit.js CHANGED
@@ -744,10 +744,18 @@ async function render_response({
744
744
  headers['permissions-policy'] = 'interest-cohort=()';
745
745
  }
746
746
 
747
+ const segments = url.pathname.slice(options.paths.base.length).split('/').slice(2);
748
+ const assets =
749
+ options.paths.assets || (segments.length > 0 ? segments.map(() => '..').join('/') : '.');
750
+
747
751
  return {
748
752
  status,
749
753
  headers,
750
- body: options.template({ head, body })
754
+ body: options.template({
755
+ head,
756
+ body,
757
+ assets
758
+ })
751
759
  };
752
760
  }
753
761
 
@@ -4406,10 +4406,11 @@ function create_plugin(config, output, cwd, amp) {
4406
4406
  router: config.kit.router,
4407
4407
  ssr: config.kit.ssr,
4408
4408
  target: config.kit.target,
4409
- template: ({ head, body }) => {
4409
+ template: ({ head, body, assets }) => {
4410
4410
  let rendered = load_template(cwd, config)
4411
4411
  .replace('%svelte.head%', () => head)
4412
- .replace('%svelte.body%', () => body);
4412
+ .replace('%svelte.body%', () => body)
4413
+ .replace(/%svelte\.assets%/g, assets);
4413
4414
 
4414
4415
  if (amp) {
4415
4416
  const result = amp.validateString(rendered);
@@ -262,9 +262,10 @@ import { set_paths, assets, base } from './runtime/paths.js';
262
262
  import { set_prerendering } from './runtime/env.js';
263
263
  import * as user_hooks from ${s(hooks)};
264
264
 
265
- const template = ({ head, body }) => ${s(load_template(cwd, config))
265
+ const template = ({ head, body, assets }) => ${s(load_template(cwd, config))
266
266
  .replace('%svelte.head%', '" + head + "')
267
- .replace('%svelte.body%', '" + body + "')};
267
+ .replace('%svelte.body%', '" + body + "')
268
+ .replace(/%svelte\.assets%/g, '" + assets + "')};
268
269
 
269
270
  let read = null;
270
271
 
@@ -470,6 +470,8 @@ function create_builder({ cwd, config, build_data, log }) {
470
470
  mkdirp,
471
471
  copy,
472
472
 
473
+ appDir: config.kit.appDir,
474
+
473
475
  createEntries(fn) {
474
476
  generated_manifest = true;
475
477
 
package/dist/cli.js CHANGED
@@ -846,7 +846,7 @@ async function launch(port, https) {
846
846
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
847
847
  }
848
848
 
849
- const prog = sade('svelte-kit').version('1.0.0-next.217');
849
+ const prog = sade('svelte-kit').version('1.0.0-next.218');
850
850
 
851
851
  prog
852
852
  .command('dev')
@@ -998,7 +998,7 @@ async function check_port(port) {
998
998
  function welcome({ port, host, https, open, loose, allow, cwd }) {
999
999
  if (open) launch(port, https);
1000
1000
 
1001
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.217'}\n`));
1001
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.218'}\n`));
1002
1002
 
1003
1003
  const protocol = https ? 'https:' : 'http:';
1004
1004
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/dist/ssr.js CHANGED
@@ -713,10 +713,18 @@ async function render_response({
713
713
  headers['permissions-policy'] = 'interest-cohort=()';
714
714
  }
715
715
 
716
+ const segments = url.pathname.slice(options.paths.base.length).split('/').slice(2);
717
+ const assets =
718
+ options.paths.assets || (segments.length > 0 ? segments.map(() => '..').join('/') : '.');
719
+
716
720
  return {
717
721
  status,
718
722
  headers,
719
- body: options.template({ head, body })
723
+ body: options.template({
724
+ head,
725
+ body,
726
+ assets
727
+ })
720
728
  };
721
729
  }
722
730
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.217",
3
+ "version": "1.0.0-next.218",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
package/types/config.d.ts CHANGED
@@ -38,6 +38,8 @@ export interface Builder {
38
38
  rimraf(dir: string): void;
39
39
  mkdirp(dir: string): void;
40
40
 
41
+ appDir: string;
42
+
41
43
  /**
42
44
  * Create entry points that map to individual functions
43
45
  * @param fn A function that groups a set of routes into an entry point
@@ -144,7 +144,7 @@ export interface SSRRenderOptions {
144
144
  service_worker?: string;
145
145
  ssr: boolean;
146
146
  target: string;
147
- template({ head, body }: { head: string; body: string }): string;
147
+ template({ head, body, assets }: { head: string; body: string; assets: string }): string;
148
148
  trailing_slash: TrailingSlash;
149
149
  }
150
150