@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
|
@@ -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);
|
package/src/version.js
CHANGED
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
|
*
|