Skip to content

Commit

Permalink
Merge branch 'master' into virtual-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Feb 2, 2023
2 parents 333326b + a96c966 commit 64913c8
Show file tree
Hide file tree
Showing 22 changed files with 146 additions and 4 deletions.
2 changes: 2 additions & 0 deletions documentation/docs/20-core-concepts/20-load.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ export async function load({ parent }) {
```

```svelte
/// file: src/routes/abc/+page.svelte
<script>
/** @type {import('./$types').PageData} */
export let data;
Expand Down Expand Up @@ -438,6 +439,7 @@ export function load() {
```

```svelte
/// file: src/routes/+page.svelte
<script>
/** @type {import('./$types').PageData} */
export let data;
Expand Down
1 change: 1 addition & 0 deletions documentation/docs/20-core-concepts/30-form-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ You can use these functions to show and hide loading UI, and so on.
If you provide your own callbacks, you may need to reproduce part of the default `use:enhance` behaviour, such as showing the nearest `+error` boundary. Most of the time, calling `update` passed to the callback is enough. If you need more customization you can do so with `applyAction`:

```diff
/// file: src/routes/login/+page.svelte
<script>
+ import { enhance, applyAction } from '$app/forms';

Expand Down
9 changes: 9 additions & 0 deletions packages/adapter-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @sveltejs/adapter-node

## 1.1.5

### Patch Changes

- docs: fix link in README ([#8854](https://github.com/sveltejs/kit/pull/8854))

- Updated dependencies [[`7cdb7a65`](https://github.com/sveltejs/kit/commit/7cdb7a65819342c6d334c79defc697d531d5cbf4)]:
- @sveltejs/kit@1.3.10

## 1.1.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-node",
"version": "1.1.4",
"version": "1.1.5",
"repository": {
"type": "git",
"url": "https://github.com/sveltejs/kit",
Expand Down
9 changes: 9 additions & 0 deletions packages/adapter-static/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @sveltejs/adapter-static

## 1.0.6

### Patch Changes

- docs: fix link in README ([#8854](https://github.com/sveltejs/kit/pull/8854))

- Updated dependencies [[`7cdb7a65`](https://github.com/sveltejs/kit/commit/7cdb7a65819342c6d334c79defc697d531d5cbf4)]:
- @sveltejs/kit@1.3.10

## 1.0.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-static",
"version": "1.0.5",
"version": "1.0.6",
"repository": {
"type": "git",
"url": "https://github.com/sveltejs/kit",
Expand Down
6 changes: 6 additions & 0 deletions packages/kit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sveltejs/kit

## 1.3.10

### Patch Changes

- fix: preserve build error messages ([#8846](https://github.com/sveltejs/kit/pull/8846))

## 1.3.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/kit",
"version": "1.3.9",
"version": "1.3.10",
"repository": {
"type": "git",
"url": "https://github.com/sveltejs/kit",
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ export function set_assets(path) {
sequential: true,
async handler() {
if (!vite_config.build.ssr) return;
await finalise();
await finalise?.();
}
}
};
Expand Down
7 changes: 7 additions & 0 deletions packages/kit/test/build-errors/apps/syntax-error/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env.*
!.env.example
1 change: 1 addition & 0 deletions packages/kit/test/build-errors/apps/syntax-error/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
18 changes: 18 additions & 0 deletions packages/kit/test/build-errors/apps/syntax-error/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "syntax-error",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/kit": "workspace:^",
"svelte": "^3.55.1",
"svelte-check": "^3.0.2",
"typescript": "^4.9.4",
"vite": "^4.0.4"
},
"type": "module"
}
12 changes: 12 additions & 0 deletions packages/kit/test/build-errors/apps/syntax-error/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const should_explode = 'boom';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('@sveltejs/kit').Config} */
const config = {};

export default config;
19 changes: 19 additions & 0 deletions packages/kit/test/build-errors/apps/syntax-error/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"paths": {
"types": ["../../../../types/internal"],
"$lib": ["./src/lib"],
"$lib/*": ["./src/lib/*"]
}
}
}
14 changes: 14 additions & 0 deletions packages/kit/test/build-errors/apps/syntax-error/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { sveltekit } from '@sveltejs/kit/vite';
import path from 'path';

/** @type {import('vite').UserConfig} */
const config = {
plugins: [sveltekit()],
server: {
fs: {
allow: [path.resolve('../../../../src')]
}
}
};

export default config;
23 changes: 23 additions & 0 deletions packages/kit/test/build-errors/syntax-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test } from 'uvu';
import * as assert from 'uvu/assert';
import { execSync } from 'node:child_process';
import path from 'node:path';

test('$lib/*.server.* is not statically importable from the client', () => {
try {
execSync('pnpm build', {
cwd: path.join(process.cwd(), 'apps/syntax-error'),
stdio: 'pipe',
timeout: 60000
});
} catch (err) {
assert.ok(
err.message.includes('Unexpected end of input'),
`received unexpected exception message ${err.message}`
);
return;
}
assert.unreachable();
});

test.run();
1 change: 1 addition & 0 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ export interface KitConfig {
* - `(details) => void` — a custom error handler that takes a `details` object with `status`, `path`, `referrer`, `referenceType` and `message` properties. If you `throw` from this function, the build will fail
*
* ```js
* /// file: svelte.config.js
* /// type: import('@sveltejs/kit').Config
* const config = {
* kit: {
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 64913c8

Please sign in to comment.