@sveltejs/kit 1.0.0-next.406 → 1.0.0-next.407
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
package/src/index/private.js
CHANGED
package/src/packaging/utils.js
CHANGED
|
@@ -103,7 +103,12 @@ export function analyze(config, file) {
|
|
|
103
103
|
export function generate_pkg(cwd, files) {
|
|
104
104
|
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
|
|
105
105
|
|
|
106
|
+
// Remove fields that are specific to the original package.json
|
|
107
|
+
// See: https://pnpm.io/package_json#publishconfigdirectory
|
|
108
|
+
delete pkg.publishConfig?.directory;
|
|
109
|
+
delete pkg.linkDirectory?.directory;
|
|
106
110
|
delete pkg.scripts;
|
|
111
|
+
|
|
107
112
|
pkg.type = 'module';
|
|
108
113
|
|
|
109
114
|
pkg.exports = {
|
|
@@ -364,21 +364,16 @@ export async function handle_json_request(event, options, mod) {
|
|
|
364
364
|
return json(result);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
if (
|
|
367
|
+
if (result?.errors) {
|
|
368
368
|
// @ts-ignore
|
|
369
|
-
|
|
370
|
-
// @ts-ignore
|
|
371
|
-
return json({ errors: result.errors }, { status: result.status || 400 });
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return new Response(undefined, {
|
|
375
|
-
status: 201,
|
|
376
|
-
// @ts-ignore
|
|
377
|
-
headers: result.location ? { location: result.location } : undefined
|
|
378
|
-
});
|
|
369
|
+
return json({ errors: result.errors }, { status: result.status || 400 });
|
|
379
370
|
}
|
|
380
371
|
|
|
381
|
-
return new Response(undefined, {
|
|
372
|
+
return new Response(undefined, {
|
|
373
|
+
status: 204,
|
|
374
|
+
// @ts-ignore
|
|
375
|
+
headers: result?.location ? { location: result.location } : undefined
|
|
376
|
+
});
|
|
382
377
|
} catch (e) {
|
|
383
378
|
const error = normalize_error(e);
|
|
384
379
|
|
|
@@ -214,7 +214,9 @@ export async function build_server(options, client) {
|
|
|
214
214
|
const { chunks } = await create_build(merged_config);
|
|
215
215
|
|
|
216
216
|
/** @type {import('vite').Manifest} */
|
|
217
|
-
const vite_manifest = JSON.parse(
|
|
217
|
+
const vite_manifest = JSON.parse(
|
|
218
|
+
fs.readFileSync(`${output_dir}/server/${vite_config.build.manifest}`, 'utf-8')
|
|
219
|
+
);
|
|
218
220
|
|
|
219
221
|
mkdirp(`${output_dir}/server/nodes`);
|
|
220
222
|
mkdirp(`${output_dir}/server/stylesheets`);
|
package/src/vite/build/utils.js
CHANGED
|
@@ -93,7 +93,8 @@ export const get_default_config = function ({ config, input, ssr, outDir }) {
|
|
|
93
93
|
base: assets_base(config.kit),
|
|
94
94
|
build: {
|
|
95
95
|
cssCodeSplit: true,
|
|
96
|
-
manifest
|
|
96
|
+
// don't use the default name to avoid collisions with 'static/manifest.json'
|
|
97
|
+
manifest: 'vite-manifest.json',
|
|
97
98
|
outDir,
|
|
98
99
|
polyfillModulePreload: false,
|
|
99
100
|
rollupOptions: {
|
package/src/vite/index.js
CHANGED
|
@@ -167,7 +167,7 @@ function kit() {
|
|
|
167
167
|
function client_build_info(assets, chunks) {
|
|
168
168
|
/** @type {import('vite').Manifest} */
|
|
169
169
|
const vite_manifest = JSON.parse(
|
|
170
|
-
fs.readFileSync(`${paths.client_out_dir}
|
|
170
|
+
fs.readFileSync(`${paths.client_out_dir}/${vite_config.build.manifest}`, 'utf-8')
|
|
171
171
|
);
|
|
172
172
|
|
|
173
173
|
const entry_id = posixify(path.relative(cwd, `${runtime_directory}/client/start.js`));
|
|
@@ -437,6 +437,10 @@ function kit() {
|
|
|
437
437
|
`See ${colors.bold().cyan('https://kit.svelte.dev/docs/adapters')} to learn how to configure your app to run on the platform of your choosing`
|
|
438
438
|
);
|
|
439
439
|
}
|
|
440
|
+
|
|
441
|
+
// avoid making the manifest available to users
|
|
442
|
+
fs.unlinkSync(`${paths.output_dir}/client/${vite_config.build.manifest}`);
|
|
443
|
+
fs.unlinkSync(`${paths.output_dir}/server/${vite_config.build.manifest}`);
|
|
440
444
|
},
|
|
441
445
|
|
|
442
446
|
/**
|