create-slidev 0.49.0-beta.1 → 0.49.0-beta.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "create-slidev",
3
3
  "type": "module",
4
- "version": "0.49.0-beta.1",
4
+ "version": "0.49.0-beta.2",
5
5
  "description": "Create starter template for Slidev",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  "export": "slidev export"
9
9
  },
10
10
  "dependencies": {
11
- "@slidev/cli": "^0.49.0-beta.1",
11
+ "@slidev/cli": "^0.49.0-beta.2",
12
12
  "@slidev/theme-default": "latest",
13
13
  "@slidev/theme-seriph": "latest",
14
14
  "vue": "^3.4.21"
@@ -611,23 +611,20 @@ Add `{monaco}` to the code block to turn it into an editor:
611
611
 
612
612
  ```ts {monaco}
613
613
  import { ref } from 'vue'
614
- import hello from './external'
614
+ import { emptyArray } from './external'
615
615
 
616
- const code = ref(hello())
616
+ const arr = ref(emptyArray(10))
617
617
  ```
618
618
 
619
619
  Use `{monaco-run}` to create an editor that can execute the code directly in the slide:
620
620
 
621
621
  ```ts {monaco-run}
622
622
  import { version } from 'vue'
623
+ import { emptyArray, sayHello } from './external'
623
624
 
624
- function fibonacci(n: number): number {
625
- return n <= 1
626
- ? n
627
- : fibonacci(n - 1) + fibonacci(n - 2) // you know, this is NOT the best way to do it :P
628
- }
629
-
630
- console.log(version, Array.from({ length: 10 }, (_, i) => fibonacci(i + 1)))
625
+ sayHello()
626
+ console.log(`vue ${version}`)
627
+ console.log(emptyArray<number>(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1]))
631
628
  ```
632
629
 
633
630
  ---
@@ -1,9 +1,12 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
3
  // #region snippet
4
- function hello() {
5
- console.log('Hello from snippets/external.ts')
4
+ // Inside ./snippets/external.ts
5
+ export function emptyArray<T>(length: number) {
6
+ return Array.from<T>({ length })
6
7
  }
7
8
  // #endregion snippet
8
9
 
9
- export default hello
10
+ export function sayHello() {
11
+ console.log('Hello from snippets/external.ts')
12
+ }