@sveltejs/kit 1.0.0-next.411 → 1.0.0-next.412
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.
|
|
3
|
+
"version": "1.0.0-next.412",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"undici": "^5.8.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@playwright/test": "^1.
|
|
28
|
+
"@playwright/test": "^1.25.0",
|
|
29
29
|
"@types/connect": "^3.4.35",
|
|
30
30
|
"@types/cookie": "^0.5.1",
|
|
31
31
|
"@types/marked": "^4.0.3",
|
|
@@ -79,20 +79,6 @@ export async function render_response({
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (resolve_opts.ssr) {
|
|
82
|
-
for (const { node } of branch) {
|
|
83
|
-
if (node.imports) {
|
|
84
|
-
node.imports.forEach((url) => modulepreloads.add(url));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (node.stylesheets) {
|
|
88
|
-
node.stylesheets.forEach((url) => stylesheets.add(url));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (node.inline_styles) {
|
|
92
|
-
Object.entries(await node.inline_styles()).forEach(([k, v]) => inline_styles.set(k, v));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
82
|
const session = writable($session);
|
|
97
83
|
|
|
98
84
|
/** @type {Record<string, any>} */
|
|
@@ -112,7 +98,7 @@ export async function render_response({
|
|
|
112
98
|
url: state.prerendering ? new PrerenderingURL(event.url) : event.url,
|
|
113
99
|
data: branch.reduce((acc, { data }) => (Object.assign(acc, data), acc), {})
|
|
114
100
|
},
|
|
115
|
-
components: branch.map(({ node }) => node.component)
|
|
101
|
+
components: await Promise.all(branch.map(({ node }) => node.component()))
|
|
116
102
|
};
|
|
117
103
|
|
|
118
104
|
// TODO remove this for 1.0
|
|
@@ -143,6 +129,20 @@ export async function render_response({
|
|
|
143
129
|
}
|
|
144
130
|
|
|
145
131
|
rendered = options.root.render(props);
|
|
132
|
+
|
|
133
|
+
for (const { node } of branch) {
|
|
134
|
+
if (node.imports) {
|
|
135
|
+
node.imports.forEach((url) => modulepreloads.add(url));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (node.stylesheets) {
|
|
139
|
+
node.stylesheets.forEach((url) => stylesheets.add(url));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (node.inline_styles) {
|
|
143
|
+
Object.entries(await node.inline_styles()).forEach(([k, v]) => inline_styles.set(k, v));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
146
|
} else {
|
|
147
147
|
rendered = { head: '', html: '', css: { code: '', map: null } };
|
|
148
148
|
}
|
|
@@ -239,6 +239,8 @@ export async function build_server(options, client) {
|
|
|
239
239
|
/** @type {string[]} */
|
|
240
240
|
const imports = [];
|
|
241
241
|
|
|
242
|
+
// String representation of
|
|
243
|
+
/** @type {import('types').SSRNode} */
|
|
242
244
|
/** @type {string[]} */
|
|
243
245
|
const exports = [`export const index = ${i};`];
|
|
244
246
|
|
|
@@ -255,7 +257,9 @@ export async function build_server(options, client) {
|
|
|
255
257
|
stylesheets.push(...entry.stylesheets);
|
|
256
258
|
|
|
257
259
|
exports.push(
|
|
258
|
-
`export
|
|
260
|
+
`export const component = async () => (await import('../${
|
|
261
|
+
vite_manifest[node.component].file
|
|
262
|
+
}')).default;`,
|
|
259
263
|
`export const file = '${entry.file}';` // TODO what is this?
|
|
260
264
|
);
|
|
261
265
|
}
|
package/src/vite/dev/index.js
CHANGED
|
@@ -82,19 +82,23 @@ export async function dev(vite, vite_config, svelte_config, illegal_imports) {
|
|
|
82
82
|
result.stylesheets = [];
|
|
83
83
|
|
|
84
84
|
if (node.component) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
result.component = async () => {
|
|
86
|
+
const { module_node, module, url } = await resolve(
|
|
87
|
+
/** @type {string} */ (node.component)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
module_nodes.push(module_node);
|
|
91
|
+
result.file = url.endsWith('.svelte') ? url : url + '?import'; // TODO what is this for?
|
|
92
|
+
|
|
93
|
+
prevent_illegal_vite_imports(
|
|
94
|
+
module_node,
|
|
95
|
+
illegal_imports,
|
|
96
|
+
extensions,
|
|
97
|
+
svelte_config.kit.outDir
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
return module.default;
|
|
101
|
+
};
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
if (node.shared) {
|
package/types/internal.d.ts
CHANGED
|
@@ -196,7 +196,7 @@ export interface SSREndpoint {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export interface SSRNode {
|
|
199
|
-
component:
|
|
199
|
+
component: SSRComponentLoader;
|
|
200
200
|
/** index into the `components` array in client-manifest.js */
|
|
201
201
|
index: number;
|
|
202
202
|
/** client-side module URL for this component */
|
|
@@ -281,11 +281,6 @@ export interface SSRErrorPage {
|
|
|
281
281
|
id: '__error';
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
export interface SSRPagePart {
|
|
285
|
-
id: string;
|
|
286
|
-
load: SSRComponentLoader;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
284
|
export type SSRRoute = SSREndpoint | SSRPage;
|
|
290
285
|
|
|
291
286
|
export interface SSRState {
|