Skip to content

Commit 7cdb7a6

Browse files
braeboRich-Harris
andauthoredFeb 2, 2023
fix: add optional chaining back to finalise hook (#8846)
* fix: add optional chaining back to `finalise` hook * add a test * remove check task * Update .changeset/grumpy-islands-collect.md --------- Co-authored-by: Rich Harris <hello@rich-harris.dev>
1 parent 089c405 commit 7cdb7a6

File tree

14 files changed

+120
-1
lines changed

14 files changed

+120
-1
lines changed
 

‎.changeset/grumpy-islands-collect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: preserve build error messages

‎packages/kit/src/exports/vite/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ function kit({ svelte_config }) {
725725
sequential: true,
726726
async handler() {
727727
if (!vite_config.build.ssr) return;
728-
await finalise();
728+
await finalise?.();
729729
}
730730
}
731731
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env.*
7+
!.env.example
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "syntax-error",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {
6+
"dev": "vite dev",
7+
"build": "vite build",
8+
"preview": "vite preview"
9+
},
10+
"devDependencies": {
11+
"@sveltejs/kit": "workspace:^",
12+
"svelte": "^3.55.1",
13+
"svelte-check": "^3.0.2",
14+
"typescript": "^4.9.4",
15+
"vite": "^4.0.4"
16+
},
17+
"type": "module"
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
6+
<meta name="viewport" content="width=device-width" />
7+
%sveltekit.head%
8+
</head>
9+
<body>
10+
<div>%sveltekit.body%</div>
11+
</body>
12+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const should_explode = 'boom';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** @type {import('@sveltejs/kit').Config} */
2+
const config = {};
3+
4+
export default config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "./.svelte-kit/tsconfig.json",
3+
"compilerOptions": {
4+
"allowJs": true,
5+
"checkJs": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"resolveJsonModule": true,
9+
"skipLibCheck": true,
10+
"sourceMap": true,
11+
"strict": true,
12+
"noEmit": true,
13+
"paths": {
14+
"types": ["../../../../types/internal"],
15+
"$lib": ["./src/lib"],
16+
"$lib/*": ["./src/lib/*"]
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { sveltekit } from '@sveltejs/kit/vite';
2+
import path from 'path';
3+
4+
/** @type {import('vite').UserConfig} */
5+
const config = {
6+
plugins: [sveltekit()],
7+
server: {
8+
fs: {
9+
allow: [path.resolve('../../../../src')]
10+
}
11+
}
12+
};
13+
14+
export default config;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import { execSync } from 'node:child_process';
4+
import path from 'node:path';
5+
6+
test('$lib/*.server.* is not statically importable from the client', () => {
7+
try {
8+
execSync('pnpm build', {
9+
cwd: path.join(process.cwd(), 'apps/syntax-error'),
10+
stdio: 'pipe',
11+
timeout: 60000
12+
});
13+
} catch (err) {
14+
assert.ok(
15+
err.message.includes('Unexpected end of input'),
16+
`received unexpected exception message ${err.message}`
17+
);
18+
return;
19+
}
20+
assert.unreachable();
21+
});
22+
23+
test.run();

‎pnpm-lock.yaml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.