@sveltejs/kit 1.0.0-next.423 → 1.0.0-next.424

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.423",
3
+ "version": "1.0.0-next.424",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -162,10 +162,11 @@ function get_groups(manifest_data, routes_dir) {
162
162
  /** @type {Node} */
163
163
  const node = { ...nodes[i] }; // shallow copy so we don't mutate the original when setting parent
164
164
 
165
+ const file_path = /** @type {string} */ (node.component ?? node.shared ?? node.server);
165
166
  // skip default layout/error
166
- if (!node?.component?.startsWith(routes_dir)) continue;
167
+ if (!file_path.startsWith(routes_dir)) continue;
167
168
 
168
- const parts = /** @type {string} */ (node.component ?? node.shared ?? node.server).split('/');
169
+ const parts = file_path.split('/');
169
170
 
170
171
  const file = /** @type {string} */ (parts.pop());
171
172
  const dir = parts.join('/').slice(routes_dir.length + 1);
@@ -284,7 +285,7 @@ function write_types_for_dir(config, manifest_data, routes_dir, dir, groups, ts)
284
285
  manifest_data.routes.forEach((route) => {
285
286
  if (route.type === 'page' && route.id.startsWith(dir + '/')) {
286
287
  // TODO this is O(n^2), see if we need to speed it up
287
- for (const name of parse_route_id(route.id).names) {
288
+ for (const name of parse_route_id(route.id.slice(dir.length + 1)).names) {
288
289
  layout_params.add(name);
289
290
  }
290
291
  }
@@ -268,7 +268,22 @@ export function create_client({ target, base, trailing_slash }) {
268
268
  navigation_result.props.page.url = url;
269
269
  }
270
270
 
271
- root.$set(navigation_result.props);
271
+ if (import.meta.env.DEV) {
272
+ // Nasty hack to silence harmless warnings the user can do nothing about
273
+ const warn = console.warn;
274
+ console.warn = (...args) => {
275
+ if (
276
+ args.length !== 1 ||
277
+ !/<(Layout|Page)> was created with unknown prop '(data|errors)'/.test(args[0])
278
+ ) {
279
+ warn(...args);
280
+ }
281
+ };
282
+ root.$set(navigation_result.props);
283
+ tick().then(() => (console.warn = warn));
284
+ } else {
285
+ root.$set(navigation_result.props);
286
+ }
272
287
  } else {
273
288
  initialize(navigation_result);
274
289
  }
@@ -347,11 +362,30 @@ export function create_client({ target, base, trailing_slash }) {
347
362
 
348
363
  page = result.props.page;
349
364
 
350
- root = new Root({
351
- target,
352
- props: { ...result.props, stores },
353
- hydrate: true
354
- });
365
+ if (import.meta.env.DEV) {
366
+ // Nasty hack to silence harmless warnings the user can do nothing about
367
+ const warn = console.warn;
368
+ console.warn = (...args) => {
369
+ if (
370
+ args.length !== 1 ||
371
+ !/<(Layout|Page)> was created with unknown prop '(data|errors)'/.test(args[0])
372
+ ) {
373
+ warn(...args);
374
+ }
375
+ };
376
+ root = new Root({
377
+ target,
378
+ props: { ...result.props, stores },
379
+ hydrate: true
380
+ });
381
+ console.warn = warn;
382
+ } else {
383
+ root = new Root({
384
+ target,
385
+ props: { ...result.props, stores },
386
+ hydrate: true
387
+ });
388
+ }
355
389
 
356
390
  if (router_enabled) {
357
391
  const navigation = { from: null, to: new URL(location.href) };
@@ -123,6 +123,9 @@ export function get_default_build_config({ config, input, ssr, outDir }) {
123
123
  resolve: {
124
124
  alias: get_aliases(config.kit)
125
125
  },
126
+ optimizeDeps: {
127
+ exclude: ['@sveltejs/kit']
128
+ },
126
129
  ssr: {
127
130
  noExternal: ['@sveltejs/kit']
128
131
  },
package/src/vite/index.js CHANGED
@@ -273,6 +273,9 @@ function kit() {
273
273
  // under different IDs, which breaks a bunch of stuff
274
274
  // https://github.com/vitejs/vite/pull/9296
275
275
  external: ['@sveltejs/kit']
276
+ },
277
+ optimizeDeps: {
278
+ exclude: ['@sveltejs/kit']
276
279
  }
277
280
  };
278
281