@inertiajs/svelte 2.2.18 → 2.2.20
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/dist/createInertiaApp.js +7 -5
- package/package.json +4 -4
package/dist/createInertiaApp.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { router, setupProgress, } from '@inertiajs/core';
|
|
1
|
+
import { getInitialPageFromDOM, router, setupProgress, } from '@inertiajs/core';
|
|
2
2
|
import { escape } from 'lodash-es';
|
|
3
3
|
import App, {} from './components/App.svelte';
|
|
4
4
|
import { config } from './index';
|
|
5
5
|
export default async function createInertiaApp({ id = 'app', resolve, setup, progress = {}, page, defaults = {}, }) {
|
|
6
6
|
config.replace(defaults);
|
|
7
7
|
const isServer = typeof window === 'undefined';
|
|
8
|
-
const
|
|
9
|
-
const initialPage = page ||
|
|
8
|
+
const useScriptElementForInitialPage = config.get('future.useScriptElementForInitialPage');
|
|
9
|
+
const initialPage = page || getInitialPageFromDOM(id, useScriptElementForInitialPage);
|
|
10
10
|
const resolveComponent = (name) => Promise.resolve(resolve(name));
|
|
11
11
|
const svelteApp = await Promise.all([
|
|
12
12
|
resolveComponent(initialPage.component),
|
|
13
13
|
router.decryptHistory().catch(() => { }),
|
|
14
14
|
]).then(([initialComponent]) => {
|
|
15
15
|
return setup({
|
|
16
|
-
el,
|
|
16
|
+
el: isServer ? null : document.getElementById(id),
|
|
17
17
|
App,
|
|
18
18
|
props: { initialPage, initialComponent, resolveComponent },
|
|
19
19
|
});
|
|
@@ -21,7 +21,9 @@ export default async function createInertiaApp({ id = 'app', resolve, setup, pro
|
|
|
21
21
|
if (isServer && svelteApp) {
|
|
22
22
|
const { html, head, css } = svelteApp;
|
|
23
23
|
return {
|
|
24
|
-
body:
|
|
24
|
+
body: useScriptElementForInitialPage
|
|
25
|
+
? `<script data-page="${id}" type="application/json">${JSON.stringify(initialPage)}</script><div data-server-rendered="true" id="${id}">${html}</div>`
|
|
26
|
+
: `<div data-server-rendered="true" id="${id}" data-page="${escape(JSON.stringify(initialPage))}">${html}</div>`,
|
|
25
27
|
head: [head, css ? `<style data-vite-css>${css.code}</style>` : ''],
|
|
26
28
|
};
|
|
27
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inertiajs/svelte",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Svelte adapter for Inertia.js",
|
|
6
6
|
"contributors": [
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@sveltejs/adapter-auto": "^3.3.1",
|
|
39
|
-
"@sveltejs/kit": "^2.48.
|
|
39
|
+
"@sveltejs/kit": "^2.48.5",
|
|
40
40
|
"@sveltejs/package": "^2.5.4",
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
42
42
|
"axios": "^1.13.2",
|
|
43
|
-
"es-check": "^9.4.
|
|
43
|
+
"es-check": "^9.4.5",
|
|
44
44
|
"publint": "^0.2.12",
|
|
45
45
|
"svelte": "^4.2.20",
|
|
46
46
|
"svelte-check": "^4.3.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@types/lodash-es": "^4.17.12",
|
|
56
56
|
"lodash-es": "^4.17.21",
|
|
57
|
-
"@inertiajs/core": "2.2.
|
|
57
|
+
"@inertiajs/core": "2.2.20"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "pnpm package && svelte-check --tsconfig ./tsconfig.json && publint",
|