valaxy 0.26.2 → 0.26.3

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.
@@ -1,4 +1,4 @@
1
- import type { CollectionConfig } from '../define'
1
+ import type { CollectionConfig } from '../types'
2
2
  import collections from '#valaxy/blog/collections'
3
3
 
4
4
  import { computed } from 'vue'
@@ -4,7 +4,7 @@ import { useSiteConfig } from 'valaxy'
4
4
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/SubtleCrypto/deriveKey#pbkdf2_2
5
5
  * @param password
6
6
  */
7
- export function getKeyMaterial(password: string) {
7
+ function getKeyMaterial(password: string) {
8
8
  const enc = new TextEncoder()
9
9
  return window.crypto.subtle.importKey(
10
10
  'raw',
@@ -15,7 +15,10 @@ export function getKeyMaterial(password: string) {
15
15
  )
16
16
  }
17
17
 
18
- export function getKey(keyMaterial: CryptoKey, salt: BufferSource) {
18
+ /**
19
+ * crypto
20
+ */
21
+ function getCryptoDeriveKey(keyMaterial: CryptoKey, salt: BufferSource) {
19
22
  return window.crypto.subtle.deriveKey(
20
23
  {
21
24
  name: 'PBKDF2',
@@ -46,7 +49,7 @@ export function useDecrypt() {
46
49
  return
47
50
 
48
51
  const keyMaterial = await getKeyMaterial(password)
49
- const key = await getKey(keyMaterial, salt)
52
+ const key = await getCryptoDeriveKey(keyMaterial, salt)
50
53
 
51
54
  const ciphertextData = Uint8Array.from(ciphertext, c => c.charCodeAt(0))
52
55
 
@@ -1,38 +1,4 @@
1
- export interface CollectionConfig {
2
- title?: string
3
- key?: string
4
- /**
5
- * if key is not provided, path is required
6
- *
7
- * if key is provided, path = `/collections/${key}`
8
- */
9
- path?: string
10
- /**
11
- * @en
12
- * The name of the collection.
13
- *
14
- * @zh
15
- * 合集名称
16
- */
17
- name?: string
18
- cover?: string
19
- description?: string
20
- categories?: string[]
21
- tags?: string[]
22
-
23
- /**
24
- * items
25
- */
26
- items?: {
27
- title?: string
28
- /**
29
- * 合集文章的唯一索引
30
- *
31
- * 对应路径为 `/collections/${key}/${item.key}`
32
- */
33
- key?: string
34
- }[]
35
- }
1
+ import type { CollectionConfig } from '../types'
36
2
 
37
3
  /**
38
4
  * @experimental
@@ -0,0 +1,48 @@
1
+ import type { Header } from '@valaxyjs/utils'
2
+ import type { Ref } from 'vue'
3
+ import type { Post } from '../types'
4
+
5
+ import './shims.d'
6
+
7
+ export * from '../dist/types/index.mjs'
8
+
9
+ declare module '@docsearch/js' {
10
+ function docsearch<T = any>(props: T): void
11
+ export default docsearch
12
+ }
13
+
14
+ declare module 'vue-router' {
15
+ interface RouteMeta {
16
+ headers: Header[]
17
+ frontmatter: Post
18
+ }
19
+ }
20
+
21
+ declare interface Window {
22
+ // for devtools
23
+ __VUE_DEVTOOLS_ROUTER__: import('vue-router').Router
24
+ $frontmatter: any
25
+ $pageData: any
26
+ $valaxy: {
27
+ postList: Ref<Post[]>
28
+ }
29
+
30
+ // algolia
31
+ instantsearch: any
32
+ algoliasearch: any
33
+ }
34
+
35
+ // markdowns can be treat as Vue components
36
+ declare module '*.md' {
37
+ import type { DefineComponent } from 'vue'
38
+
39
+ const component: DefineComponent<object, object, any>
40
+ export default component
41
+ }
42
+
43
+ declare module '*.vue' {
44
+ import type { DefineComponent } from 'vue'
45
+
46
+ const component: DefineComponent<object, object, any>
47
+ export default component
48
+ }
package/client/shims.d.ts CHANGED
@@ -1,18 +1,46 @@
1
+ // vite hmr data
2
+ declare module '/@valaxyjs/config' {
3
+ const config: string
4
+ export default config
5
+ }
6
+
7
+ declare module '/@valaxyjs/context' {
8
+ const ctx: string
9
+ export default ctx
10
+ }
11
+ declare module '/@valaxyjs/addons' {
12
+ import type { DefineComponent } from 'vue'
13
+
14
+ const components: { props: any, component: DefineComponent<object, object, any> }[]
15
+ export default components
16
+ }
17
+
18
+ declare module '/@valaxyjs/locales' {
19
+ const messages: object
20
+ export default messages
21
+ }
22
+
1
23
  // Types for virtual modules
2
24
  // `#valaxy/*` is an alias for `/@valaxyjs/*`, because TS will consider `/@valaxyjs/*` as an absolute path that we can't override
3
25
 
4
- declare module 'virtual:valaxy-theme' {
5
- export default any
26
+ declare module '/@valaxyjs/redirects' {
27
+ import type { RouteRecordRaw } from 'vue-router'
28
+
29
+ export const redirectRoutes: RouteRecordRaw[]
30
+
31
+ export const useVueRouter: boolean
6
32
  }
7
33
 
8
34
  declare module '#valaxy/styles' {
9
35
  // side-effects only
10
- export default string
36
+ const styles: string
37
+ export default styles
11
38
  }
12
39
 
13
40
  // valaxy features
14
41
  declare module '#valaxy/blog/collections' {
42
+ import type { CollectionConfig } from './types'
15
43
 
16
- const collections: Collection[]
44
+ const collections: CollectionConfig[]
17
45
  export default collections
18
46
  }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "paths": {
6
+ "valaxy": ["./index.d.ts"]
7
+ },
8
+ "types": [
9
+ "unplugin-vue-router/client",
10
+ "vite/client",
11
+ "vite-plugin-vue-layouts/client",
12
+ "@intlify/unplugin-vue-i18n/messages"
13
+ ]
14
+ },
15
+ "include": ["."]
16
+ }
@@ -0,0 +1,35 @@
1
+ export interface CollectionConfig {
2
+ title?: string
3
+ key?: string
4
+ /**
5
+ * if key is not provided, path is required
6
+ *
7
+ * if key is provided, path = `/collections/${key}`
8
+ */
9
+ path?: string
10
+ /**
11
+ * @en
12
+ * The name of the collection.
13
+ *
14
+ * @zh
15
+ * 合集名称
16
+ */
17
+ name?: string
18
+ cover?: string
19
+ description?: string
20
+ categories?: string[]
21
+ tags?: string[]
22
+
23
+ /**
24
+ * items
25
+ */
26
+ items?: {
27
+ title?: string
28
+ /**
29
+ * 合集文章的唯一索引
30
+ *
31
+ * 对应路径为 `/collections/${key}/${item.key}`
32
+ */
33
+ key?: string
34
+ }[]
35
+ }
@@ -7,3 +7,5 @@ export type UserModule = (ctx: ViteSSGContext) => void
7
7
  * @see https://mermaid.js.org/config/schema-docs/config.html#mermaid-config-schema
8
8
  */
9
9
  export type MermaidOptions = (typeof mermaid.initialize) extends (a: infer A) => any ? A : never
10
+
11
+ export * from './collection'
@@ -1,7 +1,7 @@
1
1
  import 'node:process';
2
2
  import 'yargs';
3
3
  import 'yargs/helpers';
4
- export { c as cli, d as registerDevCommand, r as run, a as startValaxyDev } from '../../shared/valaxy.hxuiyMv0.mjs';
4
+ export { c as cli, d as registerDevCommand, r as run, a as startValaxyDev } from '../../shared/valaxy.D7OlaIFc.mjs';
5
5
  import 'node:path';
6
6
  import 'consola';
7
7
  import 'consola/utils';
@@ -20,8 +20,8 @@ import 'ora';
20
20
  import 'cross-spawn';
21
21
  import 'mlly';
22
22
  import 'resolve-global';
23
- import 'node:fs/promises';
24
23
  import 'js-yaml';
24
+ import 'node:fs/promises';
25
25
  import 'dayjs';
26
26
  import 'feed';
27
27
  import 'markdown-it';