Skip to content

Commit 97d0e18

Browse files
authored
Merge pull request #49 from tomoam/update-up-to-20240426
2024/04/26 迄の更新に追従
2 parents 0826fa9 + 64ad556 commit 97d0e18

File tree

5 files changed

+47
-6
lines changed

5 files changed

+47
-6
lines changed

content/tutorial/01-svelte/07-lifecycle/01-onmount/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ title: onMount
4141
```js
4242
/// file: App.svelte
4343
onMount(() => {
44-
const canvas = document.querySelector('canvas')
44+
const canvas = document.querySelector('canvas');
4545
const context = canvas.getContext('2d');
4646

4747
+++let frame =+++ requestAnimationFrame(function loop(t) {

content/tutorial/03-sveltekit/08-stores/02-navigating-store/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: navigating
33
---
44

5-
`navigating` store は現在のナビゲーションを表しています。ナビゲーションを開始するとき — 例えばリンクをクリックしたり、ブラウザの '戻る/進む'、またはプログラムで `goto` を呼んだとき — `navigation` の値は以下のプロパティを持つオブジェクトになります:
5+
`navigating` store は現在のナビゲーションを表しています。ナビゲーションを開始するとき — 例えばリンクをクリックしたり、ブラウザの '戻る/進む'、またはプログラムで `goto` を呼んだとき — `navigating` の値は以下のプロパティを持つオブジェクトになります:
66

77
- `from``to``params``route``url` プロパティを持つオブジェクト
88
- `type` — ナビゲーションのタイプ。例えば `link``popstate``goto`
@@ -32,4 +32,4 @@ title: navigating
3232
</nav>
3333
3434
<slot />
35-
```
35+
```

src/lib/client/adapters/webcontainer/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export async function create(base, error, progress, logs, warnings) {
131131
await run_dev();
132132

133133
async function run_dev() {
134-
const process = await vm.spawn('turbo', ['run', 'dev']);
134+
const process = await vm.spawn('npm', ['run', 'dev']);
135135

136136
// TODO differentiate between stdout and stderr (sets `vite_error` to `true`)
137137
// https://github.com/stackblitz/webcontainer-core/issues/971

src/routes/tutorial/[slug]/Loading.svelte

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script>
2-
import { afterNavigate } from '$app/navigation';
32
import { page } from '$app/stores';
43
import { Icon } from '@sveltejs/site-kit/components';
4+
import { load_webcontainer, reset } from './adapter';
5+
import { files } from './state';
56
67
/** @type {boolean} */
78
export let initial;
@@ -62,6 +63,23 @@
6263
<code>chrome://settings/cookies</code> and add <code>learn.svelte.jp</code> to 'Sites that
6364
can always use cookies'.
6465
</p>
66+
<!-- TODO: remove this when webcontainers are properly supported on iOS
67+
see https://github.com/stackblitz/webcontainer-core/issues/1120 -->
68+
{:else if /iphone/i.test(navigator.userAgent)}
69+
<p>
70+
We couldn't start the app. It seems that you're using iOS, which does not support
71+
WebContainers.
72+
</p>
73+
<p>
74+
If this is not the case, you can try loading it by <button
75+
type="button"
76+
on:click={async () => {
77+
error = null;
78+
load_webcontainer();
79+
await reset($files);
80+
}}>clicking here</button
81+
>.
82+
</p>
6583
{:else}
6684
<p>
6785
We couldn't start the app. Please ensure third party cookies are enabled for this site.
@@ -70,7 +88,7 @@
7088

7189
{#if is_svelte}
7290
<a href="https://svelte.dev/tutorial/{$page.data.exercise.slug}">
73-
Go to the legacy svelte tutorial instead <Icon name="arrow-right" />
91+
Or go to the legacy svelte tutorial instead <Icon name="arrow-right" />
7492
</a>
7593
{/if}
7694
</div>
@@ -148,6 +166,16 @@
148166
margin: 0 0 1em 0;
149167
}
150168
169+
button {
170+
color: var(--sk-theme-1);
171+
padding: 0 0 1px;
172+
position: relative;
173+
}
174+
175+
button:hover {
176+
text-decoration: underline;
177+
}
178+
151179
small {
152180
font-size: var(--sk-text-xs);
153181
color: var(--sk-text-3);

src/routes/tutorial/[slug]/adapter.js

+13
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,22 @@ export const warnings = writable({});
2121
/** @type {Promise<import('$lib/types').Adapter>} */
2222
let ready = new Promise(() => {});
2323

24+
let initial_load = true;
25+
2426
if (browser) {
27+
load_webcontainer();
28+
initial_load = false;
29+
}
30+
31+
export function load_webcontainer() {
2532
ready = new Promise(async (fulfil, reject) => {
2633
try {
34+
// TODO: remove this when webcontainers are properly supported on iOS
35+
// see https://github.com/stackblitz/webcontainer-core/issues/1120
36+
if (initial_load && /iphone/i.test(navigator.userAgent)) {
37+
throw new Error('iOS does not support WebContainers');
38+
}
39+
2740
const module = await import('$lib/client/adapters/webcontainer/index.js');
2841
const adapter = await module.create(base, error, progress, logs, warnings);
2942

0 commit comments

Comments
 (0)