@sveltejs/kit 2.43.6 → 2.43.7

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": "2.43.6",
3
+ "version": "2.43.7",
4
4
  "description": "SvelteKit is the fastest way to build Svelte apps",
5
5
  "keywords": [
6
6
  "framework",
@@ -618,10 +618,27 @@ async function kit({ svelte_config }) {
618
618
  /** @type {Array<{ hash: string, file: string }>} */
619
619
  const remotes = [];
620
620
 
621
+ /**
622
+ * A set of modules that imported by `.remote.ts` modules. By forcing these modules
623
+ * into their own chunks, we ensure that each chunk created for a `.remote.ts`
624
+ * module _only_ contains that module, hopefully avoiding any circular
625
+ * dependency woes that arise from treating chunks as entries
626
+ */
627
+ const imported_by_remotes = new Set();
628
+ let uid = 1;
629
+
621
630
  /** @type {import('vite').Plugin} */
622
631
  const plugin_remote = {
623
632
  name: 'vite-plugin-sveltekit-remote',
624
633
 
634
+ moduleParsed(info) {
635
+ if (svelte_config.kit.moduleExtensions.some((ext) => info.id.endsWith(`.remote${ext}`))) {
636
+ for (const id of info.importedIds) {
637
+ imported_by_remotes.add(id);
638
+ }
639
+ }
640
+ },
641
+
625
642
  config(config) {
626
643
  if (!config.build?.ssr) {
627
644
  // only set manualChunks for the SSR build
@@ -644,14 +661,6 @@ async function kit({ svelte_config }) {
644
661
  config.build.rollupOptions.output = {
645
662
  ...config.build.rollupOptions.output,
646
663
  manualChunks(id, meta) {
647
- // Prevent core runtime and env from ending up in a remote chunk, which could break because of initialization order
648
- if (id === `${runtime_directory}/app/server/index.js`) {
649
- return 'app-server';
650
- }
651
- if (id === `${runtime_directory}/shared-server.js`) {
652
- return 'app-shared-server';
653
- }
654
-
655
664
  // Check if this is a *.remote.ts file
656
665
  if (svelte_config.kit.moduleExtensions.some((ext) => id.endsWith(`.remote${ext}`))) {
657
666
  const relative = posixify(path.relative(cwd, id));
@@ -659,6 +668,10 @@ async function kit({ svelte_config }) {
659
668
  return `remote-${hash(relative)}`;
660
669
  }
661
670
 
671
+ if (imported_by_remotes.has(id)) {
672
+ return `chunk-${uid++}`;
673
+ }
674
+
662
675
  // If there was an existing manualChunks function, call it
663
676
  if (typeof manualChunks === 'function') {
664
677
  return manualChunks(id, meta);
@@ -13,7 +13,7 @@ import { convert_formdata, flatten_issues } from '../../../utils.js';
13
13
  *
14
14
  * @template Output
15
15
  * @overload
16
- * @param {() => Output} fn
16
+ * @param {() => MaybePromise<Output>} fn
17
17
  * @returns {RemoteForm<void, Output>}
18
18
  * @since 2.27
19
19
  */
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '2.43.6';
4
+ export const VERSION = '2.43.7';
package/types/index.d.ts CHANGED
@@ -3061,7 +3061,7 @@ declare module '$app/server' {
3061
3061
  *
3062
3062
  * @since 2.27
3063
3063
  */
3064
- export function form<Output>(fn: () => Output): RemoteForm<void, Output>;
3064
+ export function form<Output>(fn: () => MaybePromise<Output>): RemoteForm<void, Output>;
3065
3065
  /**
3066
3066
  * Creates a form object that can be spread onto a `<form>` element.
3067
3067
  *