@stacksjs/docs 0.58.48 → 0.58.50
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 +5 -4
- package/src/index.ts +67 -0
- package/src/meta.ts +32 -0
- package/src/plugins.ts +4 -0
- package/src/scripts/pwa.ts +116 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.50",
|
|
5
5
|
"description": "The Stacks way to document.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
],
|
|
39
39
|
"files": [
|
|
40
40
|
"README.md",
|
|
41
|
-
"dist"
|
|
41
|
+
"dist",
|
|
42
|
+
"src"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "bun --bun build.ts",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"@stacksjs/path": "latest",
|
|
52
53
|
"@stacksjs/server": "latest",
|
|
53
54
|
"@stacksjs/vite": "latest",
|
|
54
|
-
"vitepress": "1.0.0-rc.
|
|
55
|
+
"vitepress": "1.0.0-rc.41"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
58
|
"@stacksjs/alias": "latest",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"@stacksjs/path": "latest",
|
|
60
61
|
"@stacksjs/server": "latest",
|
|
61
62
|
"@stacksjs/vite": "latest",
|
|
62
|
-
"vitepress": "1.0.0-rc.
|
|
63
|
+
"vitepress": "1.0.0-rc.41",
|
|
63
64
|
"vitepress-plugin-twoslash": "^0.10.2"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineConfig } from 'vitepress'
|
|
2
|
+
import type { UserConfig } from 'vitepress'
|
|
3
|
+
import { alias } from '@stacksjs/alias'
|
|
4
|
+
import { path as p } from '@stacksjs/path'
|
|
5
|
+
import { docs } from '@stacksjs/config'
|
|
6
|
+
import { server } from '@stacksjs/server'
|
|
7
|
+
import { kolorist as c } from '@stacksjs/cli'
|
|
8
|
+
import { withPwa } from '@vite-pwa/vitepress'
|
|
9
|
+
import { version } from '../../../../../package.json'
|
|
10
|
+
import { pwaDocs as pwa } from './scripts/pwa'
|
|
11
|
+
|
|
12
|
+
export const frameworkDefaults = {
|
|
13
|
+
base: '/docs/',
|
|
14
|
+
cleanUrls: true,
|
|
15
|
+
srcDir: p.projectPath('docs'),
|
|
16
|
+
outDir: p.projectStoragePath('framework/docs'),
|
|
17
|
+
cacheDir: p.projectStoragePath('framework/cache/docs'),
|
|
18
|
+
assetsDir: p.assetsPath(),
|
|
19
|
+
// sitemap: {
|
|
20
|
+
// hostname: 'stacks.localhost',
|
|
21
|
+
// },
|
|
22
|
+
|
|
23
|
+
vite: {
|
|
24
|
+
envDir: p.projectPath(),
|
|
25
|
+
envPrefix: 'FRONTEND_',
|
|
26
|
+
|
|
27
|
+
server: server({
|
|
28
|
+
type: 'docs',
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
resolve: {
|
|
32
|
+
alias,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
plugins: [
|
|
36
|
+
{
|
|
37
|
+
name: 'stacks-plugin',
|
|
38
|
+
configureServer(server) {
|
|
39
|
+
// const base = server.config.base || '/'
|
|
40
|
+
// const _print = server.printUrls
|
|
41
|
+
server.printUrls = () => { // eslint-disable-next-line no-console
|
|
42
|
+
console.log(` ${c.blue(c.bold('STACKS'))} ${c.blue(version)}`)
|
|
43
|
+
|
|
44
|
+
// console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green('http://stacks.localhost:3333/docs')}`)
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green('https://stacks.localhost/docs')}`)
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.log(` ${c.green('➜')} ${c.bold('Temp URL')}: ${c.green('http://stacksjs.test:3333')}`)
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
pwa,
|
|
56
|
+
} satisfies UserConfig
|
|
57
|
+
|
|
58
|
+
const config: UserConfig = {
|
|
59
|
+
...frameworkDefaults,
|
|
60
|
+
...docs,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default withPwa(defineConfig(config))
|
|
64
|
+
|
|
65
|
+
export * from './plugins'
|
|
66
|
+
export * from './scripts/pwa'
|
|
67
|
+
export * from './meta'
|
package/src/meta.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// noinspection ES6PreferShortImport: IntelliJ IDE hint to avoid warning to use `~/contributors`, will fail on build if changed
|
|
2
|
+
|
|
3
|
+
/* Texts */
|
|
4
|
+
// export const stacksName = 'Stacks'
|
|
5
|
+
// export const stacksShortName = 'Stacks'
|
|
6
|
+
// export const stacksDescription = 'Rapid application, cloud & library development framework'
|
|
7
|
+
|
|
8
|
+
/* CDN fonts and styles */
|
|
9
|
+
export const googleapis = 'https://fonts.googleapis.com'
|
|
10
|
+
export const gstatic = 'https://fonts.gstatic.com'
|
|
11
|
+
export const font = `${googleapis}/css2?family=Readex+Pro:wght@200;400;600&display=swap`
|
|
12
|
+
|
|
13
|
+
/* vitepress head */
|
|
14
|
+
export const ogUrl = 'https://stacksjs.org/'
|
|
15
|
+
export const ogImage = `${ogUrl}og.png`
|
|
16
|
+
|
|
17
|
+
/* GitHub and social links */
|
|
18
|
+
export const github = 'https://github.com/stacksjs/stacks'
|
|
19
|
+
export const releases = 'https://github.com/stacksjs/stacks/releases'
|
|
20
|
+
export const contributing = 'https://github.com/stacksjs/stacks/blob/main/CONTRIBUTING.md'
|
|
21
|
+
export const discord = 'https://chat.stacksjs.org'
|
|
22
|
+
export const twitter = 'https://twitter.com/stacksjs'
|
|
23
|
+
|
|
24
|
+
/* Avatar/Image/Sponsors servers */
|
|
25
|
+
export const preconnectLinks = [googleapis, gstatic]
|
|
26
|
+
export const preconnectHomeLinks = [googleapis, gstatic]
|
|
27
|
+
|
|
28
|
+
/* PWA runtime caching urlPattern regular expressions */
|
|
29
|
+
export const pwaFontsRegex = new RegExp(`^${googleapis}/.*`, 'i')
|
|
30
|
+
export const pwaFontStylesRegex = new RegExp(`^${gstatic}/.*`, 'i')
|
|
31
|
+
// eslint-disable-next-line prefer-regex-literals
|
|
32
|
+
export const githubusercontentRegex = new RegExp('^https://((i.ibb.co)|((raw|user-images).githubusercontent.com))/.*', 'i')
|
package/src/plugins.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { frameworkPath } from '@stacksjs/path'
|
|
2
|
+
import type { PwaOptions } from '@vite-pwa/vitepress'
|
|
3
|
+
import { docs } from '@stacksjs/config'
|
|
4
|
+
import { githubusercontentRegex, pwaFontStylesRegex, pwaFontsRegex } from '../meta'
|
|
5
|
+
|
|
6
|
+
export const pwaDocs: PwaOptions = {
|
|
7
|
+
outDir: frameworkPath('docs/dist'),
|
|
8
|
+
registerType: 'autoUpdate',
|
|
9
|
+
// include all static assets under public/
|
|
10
|
+
manifest: {
|
|
11
|
+
id: '/',
|
|
12
|
+
name: docs.title,
|
|
13
|
+
short_name: docs.title,
|
|
14
|
+
description: docs.description,
|
|
15
|
+
theme_color: '#ffffff',
|
|
16
|
+
start_url: '/',
|
|
17
|
+
lang: 'en-US',
|
|
18
|
+
dir: 'ltr',
|
|
19
|
+
orientation: 'natural',
|
|
20
|
+
display: 'standalone',
|
|
21
|
+
display_override: ['window-controls-overlay'],
|
|
22
|
+
categories: ['development', 'developer tools'],
|
|
23
|
+
icons: [
|
|
24
|
+
{
|
|
25
|
+
src: 'pwa-64x64.png',
|
|
26
|
+
sizes: '64x64',
|
|
27
|
+
type: 'image/png',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
src: 'pwa-192x192.png',
|
|
31
|
+
sizes: '192x192',
|
|
32
|
+
type: 'image/png',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
src: 'pwa-512x512.png',
|
|
36
|
+
sizes: '512x512',
|
|
37
|
+
type: 'image/png',
|
|
38
|
+
purpose: 'any',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
src: 'maskable-icon.png',
|
|
42
|
+
sizes: '512x512',
|
|
43
|
+
type: 'image/png',
|
|
44
|
+
purpose: 'maskable',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
screenshots: [{
|
|
48
|
+
src: 'og.png',
|
|
49
|
+
sizes: '2258x1185',
|
|
50
|
+
type: 'image/png',
|
|
51
|
+
label: `Screenshot of ${docs.title}`,
|
|
52
|
+
}],
|
|
53
|
+
handle_links: 'preferred',
|
|
54
|
+
launch_handler: {
|
|
55
|
+
client_mode: ['navigate-existing', 'auto'],
|
|
56
|
+
},
|
|
57
|
+
edge_side_panel: {
|
|
58
|
+
preferred_width: 480,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
workbox: {
|
|
62
|
+
navigateFallbackDenylist: [/^\/new$/],
|
|
63
|
+
// warning: sponsors/antfu.svg is 2.51 MB, and won't be precached
|
|
64
|
+
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024, // <== 3MB
|
|
65
|
+
globPatterns: ['**/*.{css,js,html,png,svg,ico,txt,woff2,json}'],
|
|
66
|
+
// Rollup 4 change the layout: don't calculate revision (hash)
|
|
67
|
+
dontCacheBustURLsMatching: /^assets\//,
|
|
68
|
+
runtimeCaching: [
|
|
69
|
+
{
|
|
70
|
+
urlPattern: pwaFontsRegex,
|
|
71
|
+
handler: 'CacheFirst',
|
|
72
|
+
options: {
|
|
73
|
+
cacheName: 'google-fonts-cache',
|
|
74
|
+
expiration: {
|
|
75
|
+
maxEntries: 10,
|
|
76
|
+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
|
77
|
+
},
|
|
78
|
+
cacheableResponse: {
|
|
79
|
+
statuses: [0, 200],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
urlPattern: pwaFontStylesRegex,
|
|
85
|
+
handler: 'CacheFirst',
|
|
86
|
+
options: {
|
|
87
|
+
cacheName: 'gstatic-fonts-cache',
|
|
88
|
+
expiration: {
|
|
89
|
+
maxEntries: 10,
|
|
90
|
+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
|
91
|
+
},
|
|
92
|
+
cacheableResponse: {
|
|
93
|
+
statuses: [0, 200],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
urlPattern: githubusercontentRegex,
|
|
99
|
+
handler: 'CacheFirst',
|
|
100
|
+
options: {
|
|
101
|
+
cacheName: 'githubusercontent-images-cache',
|
|
102
|
+
expiration: {
|
|
103
|
+
maxEntries: 10,
|
|
104
|
+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
|
105
|
+
},
|
|
106
|
+
cacheableResponse: {
|
|
107
|
+
statuses: [0, 200],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
experimental: {
|
|
114
|
+
includeAllowlist: true,
|
|
115
|
+
},
|
|
116
|
+
}
|