cabloy 5.1.21 → 5.1.27
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/lerna.json +24 -0
- package/package.json +3 -2
- package/scripts/init.ts +4 -2
- package/scripts/upgrade.ts +0 -1
- package/vona/package.original.json +0 -2
- package/vona/packages-cli/cabloy-cli/src/lib/local.template.ts +2 -2
- package/vona/packages-cli/cabloy-cli/src/types/argv.ts +0 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/2-meta.index.ts +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/2-meta.version.ts +0 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudBasic/snippets/3-en-us.ts +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/2-meta.index.ts +1 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/2-meta.version.ts +0 -1
- package/vona/packages-cli/cli-set-api/cli/templates/tools/crudStart/snippets/3-en-us.ts +1 -1
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.bean.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.module.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.suite.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.create.test.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.appMonkey.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.asset.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.config.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.constant.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.error.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.lib.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.locale.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.main.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.monkey.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.static.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.init.types.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crud.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudBasic.ts +0 -2
- package/vona/packages-cli/cli-set-api/src/lib/bean/cli.tools.crudStart.ts +0 -2
- package/{zova/packages-utils/quasar-app-extension-zova → vona/packages-utils/lint}/LICENSE +1 -1
- package/vona/packages-utils/lint/package.json +2 -3
- package/vona/packages-utils/lint/src/oxc/lint.ts +0 -22
- package/vona/packages-utils/lint/src/oxc/lintVue.ts +0 -22
- package/vona/pnpm-lock.yaml +12 -12
- package/zova/env/{.env.ssr.cabloyBasicAdmin.production → .env.cabloyBasicAdmin} +11 -1
- package/zova/env/.env.cabloyBasicWeb +18 -0
- package/zova/env/.env.ssr.admin +0 -1
- package/zova/package.original.json +1 -4
- package/zova/packages-cli/cli/package.json +2 -2
- package/zova/packages-cli/cli-set-front/package.json +1 -1
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.module.ts +0 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.create.suite.ts +0 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.init.asset.ts +0 -2
- package/zova/packages-cli/cli-set-front/src/lib/bean/cli.tools.metadata.ts +0 -2
- package/zova/packages-utils/logger/package.json +2 -2
- package/zova/packages-utils/zova-jsx/package.json +3 -3
- package/zova/packages-zova/zova/package.json +4 -4
- package/zova/packages-zova/zova-core/package.json +3 -3
- package/zova/pnpm-lock.yaml +1 -1
- package/zova/src/suite-vendor/a-zova/modules/a-logger/package.json +3 -3
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +3 -3
- package/zova/src/suite-vendor/a-zova/package.json +4 -4
- package/vona/src/suite/.gitkeep +0 -0
- package/vona/src/suite-vendor/.gitkeep +0 -0
- package/zova/env/.env.production.githubpages +0 -8
- package/zova/env/.env.ssr.cabloyBasicAdmin +0 -5
- package/zova/packages-utils/quasar-app-extension-zova/dist/index.d.ts +0 -3
- package/zova/packages-utils/quasar-app-extension-zova/dist/index.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/index.js +0 -3
- package/zova/packages-utils/quasar-app-extension-zova/dist/index.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/install.d.ts +0 -7
- package/zova/packages-utils/quasar-app-extension-zova/dist/install.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/install.js +0 -9
- package/zova/packages-utils/quasar-app-extension-zova/dist/install.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/prompts.d.ts +0 -42
- package/zova/packages-utils/quasar-app-extension-zova/dist/prompts.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/prompts.js +0 -44
- package/zova/packages-utils/quasar-app-extension-zova/dist/prompts.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendAfterBuild.d.ts +0 -4
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendAfterBuild.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendAfterBuild.js +0 -32
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendAfterBuild.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendFiles.d.ts +0 -6
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendFiles.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendFiles.js +0 -161
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendFiles.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendQuasarConf.d.ts +0 -5
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendQuasarConf.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendQuasarConf.js +0 -71
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendQuasarConf.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendSSRWebserverConf.d.ts +0 -5
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendSSRWebserverConf.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendSSRWebserverConf.js +0 -41
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendSSRWebserverConf.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendViteConf.d.ts +0 -3
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendViteConf.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendViteConf.js +0 -133
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/extendViteConf.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/index.d.ts +0 -9
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/index.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/index.js +0 -44
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/index.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/printBanner.d.ts +0 -4
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/printBanner.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/printBanner.js +0 -29
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/printBanner.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/types.d.ts +0 -10
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/types.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/types.js +0 -2
- package/zova/packages-utils/quasar-app-extension-zova/dist/quasar/types.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/uninstall.d.ts +0 -7
- package/zova/packages-utils/quasar-app-extension-zova/dist/uninstall.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/uninstall.js +0 -9
- package/zova/packages-utils/quasar-app-extension-zova/dist/uninstall.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/utils.d.ts +0 -4
- package/zova/packages-utils/quasar-app-extension-zova/dist/utils.d.ts.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/dist/utils.js +0 -13
- package/zova/packages-utils/quasar-app-extension-zova/dist/utils.js.map +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/package.json +0 -55
- package/zova/packages-utils/quasar-app-extension-zova/src/index.ts +0 -3
- package/zova/packages-utils/quasar-app-extension-zova/src/install.ts +0 -9
- package/zova/packages-utils/quasar-app-extension-zova/src/prompts.ts +0 -44
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/extendAfterBuild.ts +0 -41
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/extendFiles.ts +0 -190
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/extendQuasarConf.ts +0 -79
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/extendSSRWebserverConf.ts +0 -45
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/extendViteConf.ts +0 -143
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/index.ts +0 -50
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/printBanner.ts +0 -33
- package/zova/packages-utils/quasar-app-extension-zova/src/quasar/types.ts +0 -11
- package/zova/packages-utils/quasar-app-extension-zova/src/uninstall.ts +0 -9
- package/zova/packages-utils/quasar-app-extension-zova/src/utils.ts +0 -15
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/-app.js_ +0 -81
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/-client-entry.js_ +0 -215
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/-server-entry.js_ +0 -84
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/-ssr-devserver.js_ +0 -456
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/ssr-prod-handler.js_ +0 -5
- package/zova/packages-utils/quasar-app-extension-zova/templates/entry/ssr-prod-webserver.js_ +0 -123
- package/zova/packages-utils/quasar-app-extension-zova/templates/env/.env.ssr.admin +0 -4
- package/zova/packages-utils/quasar-app-extension-zova/templates/env/.env.ssr.production +0 -1
- package/zova/packages-utils/quasar-app-extension-zova/templates/env/.env.ssr.web +0 -6
- package/zova/packages-utils/quasar-app-extension-zova/templates/modes/ssr/middlewares/.gitkeep +0 -0
- package/zova/packages-utils/quasar-app-extension-zova/templates/vuetify/composables/hydration.js +0 -26
- package/zova/packages-utils/quasar-app-extension-zova/templates/vuetify/composables/ssrBoot.js +0 -36
- package/zova/packages-utils/quasar-app-extension-zova/tsconfig.json +0 -10
- package/zova/src/front/config/config/config.admin.ts +0 -10
- package/zova/src/front/config/config/config.web.ts +0 -10
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs'
|
|
2
|
-
import { join, isAbsolute } from 'node:path'
|
|
3
|
-
import { pathToFileURL } from 'node:url'
|
|
4
|
-
import { createServer, createServerModuleRunner } from 'vite'
|
|
5
|
-
import chokidar from 'chokidar'
|
|
6
|
-
import debounce from 'lodash/debounce.js'
|
|
7
|
-
import serialize from 'serialize-javascript'
|
|
8
|
-
import { green } from 'kolorist'
|
|
9
|
-
import { collectCss, renderTeleports } from 'zova-vite'
|
|
10
|
-
import * as path from 'node:path'
|
|
11
|
-
|
|
12
|
-
import { AppDevserver } from '../../app-devserver.js'
|
|
13
|
-
import { getPackage } from '../../utils/get-package.js'
|
|
14
|
-
import { openBrowser } from '../../utils/open-browser.js'
|
|
15
|
-
import { log, warn, info, dot, progress } from '../../utils/logger.js'
|
|
16
|
-
import { entryPointMarkup, getDevSsrTemplateFn } from '../../utils/html-template.js'
|
|
17
|
-
|
|
18
|
-
import { quasarSsrConfig } from './ssr-config.js'
|
|
19
|
-
import { injectPwaManifest, buildPwaServiceWorker } from '../pwa/utils.js'
|
|
20
|
-
|
|
21
|
-
const doubleSlashRE = /\/\//g
|
|
22
|
-
const autoRemove = 'document.currentScript.remove()'
|
|
23
|
-
|
|
24
|
-
function logServerMessage (title, msg, additional) {
|
|
25
|
-
log()
|
|
26
|
-
info(`${ msg }${ additional !== void 0 ? ` ${ green(dot) } ${ additional }` : '' }`, title)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let renderSSRError = null
|
|
30
|
-
let vueRenderToString = null
|
|
31
|
-
|
|
32
|
-
function renderError ({ err, req, res }) {
|
|
33
|
-
log()
|
|
34
|
-
warn(req.url, 'Render failed')
|
|
35
|
-
|
|
36
|
-
renderSSRError({ err, req, res })
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function renderStoreState (ssrContext) {
|
|
40
|
-
const nonce = ssrContext.nonce !== void 0
|
|
41
|
-
? ` nonce="${ ssrContext.nonce }"`
|
|
42
|
-
: ''
|
|
43
|
-
|
|
44
|
-
const state = serialize(ssrContext.state, { isJSON: true })
|
|
45
|
-
return `<script${ nonce }>window.__INITIAL_STATE__=${ state };${ autoRemove }</script>`
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export class QuasarModeDevserver extends AppDevserver {
|
|
49
|
-
#webserver = null
|
|
50
|
-
#viteClient = null
|
|
51
|
-
#viteWatcherList = []
|
|
52
|
-
#webserverWatcher = null
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @type {{
|
|
56
|
-
* port: number;
|
|
57
|
-
* publicPath: string;
|
|
58
|
-
* resolveUrlPath: import('../../../types').SsrMiddlewareResolve['urlPath'];
|
|
59
|
-
* render: (ssrContext: import('../../../types').QSsrContext) => Promise<string>;
|
|
60
|
-
* }}
|
|
61
|
-
*/
|
|
62
|
-
#appOptions = {}
|
|
63
|
-
|
|
64
|
-
// also update pwa-devserver.js when changing here
|
|
65
|
-
#pwaManifestWatcher
|
|
66
|
-
#pwaServiceWorkerWatcher
|
|
67
|
-
|
|
68
|
-
#pathMap = {}
|
|
69
|
-
|
|
70
|
-
constructor (opts) {
|
|
71
|
-
super(opts)
|
|
72
|
-
|
|
73
|
-
const { appPaths } = this.ctx
|
|
74
|
-
|
|
75
|
-
const publicFolder = appPaths.resolve.app('public')
|
|
76
|
-
this.#pathMap = {
|
|
77
|
-
rootFolder: appPaths.appDir,
|
|
78
|
-
publicFolder,
|
|
79
|
-
templatePath: appPaths.resolve.app('index.html'),
|
|
80
|
-
serverFile: appPaths.resolve.entry('compiled-dev-webserver.js'),
|
|
81
|
-
serverEntryFile: appPaths.resolve.entry('server-entry.js'),
|
|
82
|
-
resolvePublicFolder () {
|
|
83
|
-
const dir = join(...arguments)
|
|
84
|
-
return isAbsolute(dir) === true
|
|
85
|
-
? dir
|
|
86
|
-
: join(publicFolder, dir)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
this.registerDiff('webserver', (quasarConf, diffMap) => [
|
|
91
|
-
quasarConf.ssr.extendSSRWebserverConf,
|
|
92
|
-
|
|
93
|
-
// extends 'esbuild' diff
|
|
94
|
-
...diffMap.esbuild(quasarConf)
|
|
95
|
-
])
|
|
96
|
-
|
|
97
|
-
this.registerDiff('viteSSR', (quasarConf, diffMap) => [
|
|
98
|
-
quasarConf.ssr.pwa,
|
|
99
|
-
quasarConf.ssr.pwa === true ? quasarConf.pwa.swFilename : '',
|
|
100
|
-
|
|
101
|
-
// extends 'vite' diff
|
|
102
|
-
...diffMap.vite(quasarConf)
|
|
103
|
-
])
|
|
104
|
-
|
|
105
|
-
// also update pwa-devserver.js when changing here
|
|
106
|
-
this.registerDiff('pwaManifest', quasarConf => [
|
|
107
|
-
quasarConf.pwa.injectPwaMetaTags,
|
|
108
|
-
quasarConf.pwa.manifestFilename,
|
|
109
|
-
quasarConf.pwa.extendManifestJson,
|
|
110
|
-
quasarConf.pwa.useCredentialsForManifestTag
|
|
111
|
-
])
|
|
112
|
-
|
|
113
|
-
// also update pwa-devserver.js when changing here
|
|
114
|
-
this.registerDiff('pwaServiceWorker', quasarConf => [
|
|
115
|
-
quasarConf.pwa.workboxMode,
|
|
116
|
-
quasarConf.pwa.swFilename,
|
|
117
|
-
quasarConf.build,
|
|
118
|
-
quasarConf.pwa.workboxMode === 'GenerateSW'
|
|
119
|
-
? quasarConf.pwa.extendGenerateSWOptions
|
|
120
|
-
: [
|
|
121
|
-
quasarConf.pwa.extendInjectManifestOptions,
|
|
122
|
-
quasarConf.pwa.extendPWACustomSWConf,
|
|
123
|
-
quasarConf.sourceFiles.pwaServiceWorker,
|
|
124
|
-
quasarConf.ssr.pwaOfflineHtmlFilename
|
|
125
|
-
]
|
|
126
|
-
])
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
run (quasarConf, __isRetry) {
|
|
130
|
-
const { diff, queue } = super.run(quasarConf, __isRetry)
|
|
131
|
-
|
|
132
|
-
if (quasarConf.ssr.pwa === true) {
|
|
133
|
-
// also update pwa-devserver.js when changing here
|
|
134
|
-
if (diff('pwaManifest', quasarConf) === true) {
|
|
135
|
-
return queue(() => this.#compilePwaManifest(quasarConf))
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// also update pwa-devserver.js when changing here
|
|
139
|
-
if (diff('pwaServiceWorker', quasarConf) === true) {
|
|
140
|
-
return queue(() => this.#compilePwaServiceWorker(quasarConf, queue))
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// also update pwa-devserver.js when changing here
|
|
145
|
-
if (diff('webserver', quasarConf) === true) {
|
|
146
|
-
return queue(() => this.#compileWebserver(quasarConf, queue))
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// also update pwa-devserver.js when changing here
|
|
150
|
-
if (diff('viteSSR', quasarConf) === true) {
|
|
151
|
-
return queue(() => this.#runVite(quasarConf, diff('viteUrl', quasarConf)))
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async #compileWebserver (quasarConf, queue) {
|
|
156
|
-
if (this.#webserverWatcher !== null) {
|
|
157
|
-
await this.#webserverWatcher.close()
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const esbuildConfig = await quasarSsrConfig.webserver(quasarConf)
|
|
161
|
-
await this.watchWithEsbuild('SSR Webserver', esbuildConfig, () => {
|
|
162
|
-
queue(() => this.#bootWebserver(quasarConf))
|
|
163
|
-
}).then(esbuildCtx => {
|
|
164
|
-
this.#webserverWatcher = {
|
|
165
|
-
close: () => {
|
|
166
|
-
this.#webserverWatcher = null
|
|
167
|
-
return esbuildCtx.dispose()
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
async #runVite (quasarConf, urlDiffers) {
|
|
174
|
-
await this.clearWatcherList(this.#viteWatcherList, () => { this.#viteWatcherList = [] })
|
|
175
|
-
|
|
176
|
-
if (renderSSRError === null) {
|
|
177
|
-
const { default: render } = await import('@quasar/render-ssr-error')
|
|
178
|
-
renderSSRError = render
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (vueRenderToString === null) {
|
|
182
|
-
const { renderToString } = await getPackage('@cabloy/vue-server-renderer', quasarConf.ctx.appPaths.appDir)
|
|
183
|
-
vueRenderToString = renderToString
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
this.#appOptions.port = quasarConf.devServer.port
|
|
187
|
-
|
|
188
|
-
const publicPath = this.#appOptions.publicPath = quasarConf.build.publicPath
|
|
189
|
-
this.#appOptions.resolveUrlPath = publicPath === '/'
|
|
190
|
-
? url => url || '/'
|
|
191
|
-
: url => (url ? (publicPath + url).replace(doubleSlashRE, '/') : publicPath)
|
|
192
|
-
|
|
193
|
-
const viteClient = this.#viteClient = await createServer(await quasarSsrConfig.viteClient(quasarConf))
|
|
194
|
-
this.#viteWatcherList.push({
|
|
195
|
-
close: () => {
|
|
196
|
-
this.#viteClient = null
|
|
197
|
-
return viteClient.close()
|
|
198
|
-
}
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
const viteServer = await createServer(await quasarSsrConfig.viteServer(quasarConf))
|
|
202
|
-
this.#viteWatcherList.push(viteServer)
|
|
203
|
-
|
|
204
|
-
if (quasarConf.ssr.pwa === true) {
|
|
205
|
-
injectPwaManifest(quasarConf, true)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
let renderTemplate
|
|
209
|
-
|
|
210
|
-
const updateTemplate = () => {
|
|
211
|
-
renderTemplate = getDevSsrTemplateFn(
|
|
212
|
-
readFileSync(this.#pathMap.templatePath, 'utf-8'),
|
|
213
|
-
quasarConf
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
updateTemplate()
|
|
218
|
-
|
|
219
|
-
this.#viteWatcherList.push(
|
|
220
|
-
chokidar.watch(this.#pathMap.templatePath)
|
|
221
|
-
.on('change', updateTemplate)
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
const viteModuleRunner = createServerModuleRunner(viteServer.environments.ssr)
|
|
225
|
-
this.#viteWatcherList.push(viteModuleRunner)
|
|
226
|
-
|
|
227
|
-
this.#appOptions.render = async ssrContext => {
|
|
228
|
-
const startTime = Date.now()
|
|
229
|
-
const onRenderedList = []
|
|
230
|
-
|
|
231
|
-
Object.assign(ssrContext, {
|
|
232
|
-
_meta: {},
|
|
233
|
-
onRendered: fn => { onRenderedList.push(fn) }
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
try {
|
|
237
|
-
const renderApp = await viteModuleRunner.import(this.#pathMap.serverEntryFile)
|
|
238
|
-
|
|
239
|
-
await renderApp.initialize()
|
|
240
|
-
|
|
241
|
-
const app = await renderApp.default(ssrContext)
|
|
242
|
-
|
|
243
|
-
let runtimePageContent;
|
|
244
|
-
let err2;
|
|
245
|
-
try {
|
|
246
|
-
runtimePageContent = await vueRenderToString(app, ssrContext);
|
|
247
|
-
} catch (err) {
|
|
248
|
-
err2 = err;
|
|
249
|
-
}
|
|
250
|
-
const error = ssrContext._meta.renderError ?? err2;
|
|
251
|
-
onRenderedList.forEach(fn => { fn(error) })
|
|
252
|
-
ssrContext.rendered(error);
|
|
253
|
-
if (error) {
|
|
254
|
-
if (error instanceof Error) throw error;
|
|
255
|
-
return error;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (ssrContext.state !== void 0 && quasarConf.ssr.manualStoreSerialization !== true) {
|
|
259
|
-
ssrContext._meta.headTags = renderStoreState(ssrContext) + ssrContext._meta.headTags
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
ssrContext._meta.endingHeadTags += collectCss(
|
|
263
|
-
[viteServer.moduleGraph.getModuleById(this.#pathMap.serverEntryFile.replaceAll('\\\\','/'))].concat(
|
|
264
|
-
[...(ssrContext.modules||[])]
|
|
265
|
-
.map((componentPath) => viteServer.moduleGraph.getModuleById(
|
|
266
|
-
path.resolve(componentPath).replaceAll('\\\\','/'),
|
|
267
|
-
)))
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
let html = renderTemplate(ssrContext)
|
|
271
|
-
|
|
272
|
-
html = await viteClient.transformIndexHtml(ssrContext.req.url, html, ssrContext.req.url)
|
|
273
|
-
html = html.replace(
|
|
274
|
-
entryPointMarkup,
|
|
275
|
-
`<div id="q-app">${ runtimePageContent }</div>${ renderTeleports(ssrContext.teleports) }`
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
logServerMessage('Rendered', ssrContext.req.url, `${ Date.now() - startTime }ms`)
|
|
279
|
-
|
|
280
|
-
return html
|
|
281
|
-
}
|
|
282
|
-
catch (err) {
|
|
283
|
-
console.error(err)
|
|
284
|
-
// viteServer.ssrFixStacktrace(err)
|
|
285
|
-
throw err
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
await this.#bootWebserver(quasarConf)
|
|
290
|
-
|
|
291
|
-
if (urlDiffers === true && quasarConf.metaConf.openBrowser) {
|
|
292
|
-
const { metaConf } = quasarConf
|
|
293
|
-
openBrowser({
|
|
294
|
-
url: metaConf.APP_URL,
|
|
295
|
-
opts: metaConf.openBrowser !== true ? metaConf.openBrowser : false
|
|
296
|
-
})
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
async #bootWebserver (quasarConf) {
|
|
301
|
-
const done = progress('Booting Webserver...')
|
|
302
|
-
|
|
303
|
-
if (this.#webserver !== null) {
|
|
304
|
-
await this.#webserver.close()
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const { create, listen, close, injectMiddlewares, serveStaticContent } = await import(
|
|
308
|
-
pathToFileURL(this.#pathMap.serverFile) + '?t=' + Date.now()
|
|
309
|
-
)
|
|
310
|
-
const { publicPath } = this.#appOptions
|
|
311
|
-
const { resolvePublicFolder } = this.#pathMap
|
|
312
|
-
|
|
313
|
-
const middlewareParams = {
|
|
314
|
-
port: this.#appOptions.port,
|
|
315
|
-
resolve: {
|
|
316
|
-
urlPath: this.#appOptions.resolveUrlPath,
|
|
317
|
-
root: (...args) => join(this.#pathMap.rootFolder, ...args),
|
|
318
|
-
public: resolvePublicFolder
|
|
319
|
-
},
|
|
320
|
-
publicPath,
|
|
321
|
-
folders: {
|
|
322
|
-
root: this.#pathMap.rootFolder,
|
|
323
|
-
public: this.#pathMap.publicFolder
|
|
324
|
-
},
|
|
325
|
-
render: this.#appOptions.render
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const app = middlewareParams.app = await create(middlewareParams)
|
|
329
|
-
|
|
330
|
-
const serveStatic = await serveStaticContent(middlewareParams)
|
|
331
|
-
middlewareParams.serve = {
|
|
332
|
-
static: serveStatic,
|
|
333
|
-
error: renderError
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// vite devmiddleware modifies req.url to account for publicPath
|
|
337
|
-
// but we'll break usage in the webserver if we do so
|
|
338
|
-
app.use((req, res, next) => {
|
|
339
|
-
if (this.#viteClient === null) {
|
|
340
|
-
next()
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const { url } = req
|
|
345
|
-
this.#viteClient.middlewares.handle(req, res, err => {
|
|
346
|
-
req.url = url
|
|
347
|
-
next(err)
|
|
348
|
-
})
|
|
349
|
-
})
|
|
350
|
-
|
|
351
|
-
await injectMiddlewares(middlewareParams)
|
|
352
|
-
|
|
353
|
-
publicPath !== '/' && app.use((req, res, next) => {
|
|
354
|
-
const pathname = new URL(req.url, `http://${ req.headers.host }`).pathname || '/'
|
|
355
|
-
|
|
356
|
-
if (pathname.startsWith(publicPath) === true) {
|
|
357
|
-
next()
|
|
358
|
-
return
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (req.url === '/' || req.url === '/index.html') {
|
|
362
|
-
res.writeHead(302, { Location: publicPath })
|
|
363
|
-
res.end()
|
|
364
|
-
return
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
if (req.headers.accept && req.headers.accept.includes('text/html')) {
|
|
368
|
-
const parsedPath = pathname.slice(1)
|
|
369
|
-
const redirectPaths = [ publicPath + parsedPath ]
|
|
370
|
-
const splitted = parsedPath.split('/')
|
|
371
|
-
|
|
372
|
-
if (splitted.length > 1) {
|
|
373
|
-
redirectPaths.push(publicPath + splitted.slice(1).join('/'))
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (redirectPaths[ redirectPaths.length - 1 ] !== publicPath) {
|
|
377
|
-
redirectPaths.push(publicPath)
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
const linkList = redirectPaths
|
|
381
|
-
.map(link => `<a href="${ link }">${ link }</a>`)
|
|
382
|
-
.join(' or ')
|
|
383
|
-
|
|
384
|
-
res.writeHead(404, { 'Content-Type': 'text/html' })
|
|
385
|
-
res.end(
|
|
386
|
-
`<div>The Quasar CLI devserver is configured with a publicPath of "${ publicPath }"</div>`
|
|
387
|
-
+ `<div> - Did you mean to visit ${ linkList } instead?</div>`
|
|
388
|
-
)
|
|
389
|
-
return
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
next()
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
if (quasarConf.devServer.https) {
|
|
396
|
-
const https = await import('node:https')
|
|
397
|
-
middlewareParams.devHttpsApp = https.createServer(quasarConf.devServer.https, app)
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
middlewareParams.listenResult = await listen(middlewareParams)
|
|
401
|
-
|
|
402
|
-
this.#webserver = {
|
|
403
|
-
close: () => {
|
|
404
|
-
this.#webserver = null
|
|
405
|
-
return close(middlewareParams)
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
done('Webserver is ready')
|
|
410
|
-
|
|
411
|
-
this.printBanner(quasarConf)
|
|
412
|
-
this.#viteClient?.ws.send({ type: 'full-reload' })
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// also update pwa-devserver.js when changing here
|
|
416
|
-
#compilePwaManifest (quasarConf) {
|
|
417
|
-
if (this.#pwaManifestWatcher !== void 0) {
|
|
418
|
-
this.#pwaManifestWatcher.close()
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function inject () {
|
|
422
|
-
injectPwaManifest(quasarConf)
|
|
423
|
-
log(`Generated the PWA manifest file (${ quasarConf.pwa.manifestFilename })`)
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
this.#pwaManifestWatcher = chokidar.watch(
|
|
427
|
-
quasarConf.metaConf.pwaManifestFile,
|
|
428
|
-
{ ignoreInitial: true }
|
|
429
|
-
).on('change', debounce(() => {
|
|
430
|
-
inject()
|
|
431
|
-
this.#viteClient?.ws.send({ type: 'full-reload' })
|
|
432
|
-
}, 550))
|
|
433
|
-
|
|
434
|
-
inject()
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// also update pwa-devserver.js when changing here
|
|
438
|
-
async #compilePwaServiceWorker (quasarConf, queue) {
|
|
439
|
-
if (this.#pwaServiceWorkerWatcher) {
|
|
440
|
-
await this.#pwaServiceWorkerWatcher.close()
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
const workboxConfig = await quasarSsrConfig.workbox(quasarConf)
|
|
444
|
-
|
|
445
|
-
if (quasarConf.pwa.workboxMode === 'InjectManifest') {
|
|
446
|
-
const esbuildConfig = await quasarSsrConfig.customSw(quasarConf)
|
|
447
|
-
await this.watchWithEsbuild('InjectManifest Custom SW', esbuildConfig, () => {
|
|
448
|
-
queue(() => buildPwaServiceWorker(quasarConf, workboxConfig))
|
|
449
|
-
}).then(esbuildCtx => {
|
|
450
|
-
this.#pwaServiceWorkerWatcher = { close: esbuildCtx.dispose }
|
|
451
|
-
})
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
await buildPwaServiceWorker(quasarConf, workboxConfig)
|
|
455
|
-
}
|
|
456
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { renderToString } from '@cabloy/vue-server-renderer';
|
|
2
|
-
import serverEntry, { initialize } from 'app/<%=__outDir__%>/server/server-entry.js';
|
|
3
|
-
import renderTemplate from './render-template.js';
|
|
4
|
-
|
|
5
|
-
export { initialize, renderTemplate, renderToString, serverEntry };
|
package/zova/packages-utils/quasar-app-extension-zova/templates/entry/ssr-prod-webserver.js_
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* THIS FILE IS GENERATED AUTOMATICALLY.
|
|
4
|
-
* DO NOT EDIT.
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
import { join, isAbsolute } from 'node:path'
|
|
8
|
-
import { pathToFileURL } from 'node:url';
|
|
9
|
-
import { fileURLToPath } from 'node:url'
|
|
10
|
-
<% if (metaConf.hasStore && ssr.manualStoreSerialization !== true) { %>
|
|
11
|
-
import serialize from 'serialize-javascript'
|
|
12
|
-
<% } %>
|
|
13
|
-
|
|
14
|
-
import { create, listen, serveStaticContent } from 'app/src-ssr/server'
|
|
15
|
-
import injectMiddlewares from './ssr-middlewares'
|
|
16
|
-
|
|
17
|
-
const port = process.env.SSR_PROD_PORT || <%= ssr.prodPort %>
|
|
18
|
-
|
|
19
|
-
const doubleSlashRE = /\/\//g
|
|
20
|
-
const publicPath = `<%= build.publicPath %>`
|
|
21
|
-
const resolveUrlPath = publicPath === '/'
|
|
22
|
-
? url => url || '/'
|
|
23
|
-
: url => url ? (publicPath + url).replace(doubleSlashRE, '/') : publicPath
|
|
24
|
-
|
|
25
|
-
const rootFolder = fileURLToPath(new URL('.', import.meta.url))
|
|
26
|
-
const publicFolder = join(rootFolder, 'client')
|
|
27
|
-
|
|
28
|
-
function resolvePublicFolder () {
|
|
29
|
-
const dir = join(...arguments)
|
|
30
|
-
return isAbsolute(dir) === true
|
|
31
|
-
? dir
|
|
32
|
-
: join(publicFolder, dir)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
<% if (metaConf.hasStore && ssr.manualStoreSerialization !== true) { %>
|
|
36
|
-
const autoRemove = 'document.currentScript.remove()'
|
|
37
|
-
|
|
38
|
-
function renderStoreState (ssrContext) {
|
|
39
|
-
const nonce = ssrContext.nonce !== void 0
|
|
40
|
-
? ' nonce="' + ssrContext.nonce + '"'
|
|
41
|
-
: ''
|
|
42
|
-
|
|
43
|
-
const state = serialize(ssrContext.state, { isJSON: true })
|
|
44
|
-
return '<script' + nonce + '>window.__INITIAL_STATE__=' + state + ';' + autoRemove + '</script>'
|
|
45
|
-
}
|
|
46
|
-
<% } %>
|
|
47
|
-
|
|
48
|
-
let _handlerPromise;
|
|
49
|
-
let _ssrHandler;
|
|
50
|
-
async function ensureReady() {
|
|
51
|
-
if (!_ssrHandler) {
|
|
52
|
-
if (!_handlerPromise) {
|
|
53
|
-
_handlerPromise = _prepareHandler();
|
|
54
|
-
}
|
|
55
|
-
_ssrHandler = await _handlerPromise;
|
|
56
|
-
}
|
|
57
|
-
return _ssrHandler;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function _prepareHandler() {
|
|
61
|
-
// handler
|
|
62
|
-
const fileHandler = join(rootFolder, 'handler.js');
|
|
63
|
-
const handlerInstance = await import(pathToHref(fileHandler));
|
|
64
|
-
// initialize
|
|
65
|
-
const zovaSys = await handlerInstance.initialize(process.env);
|
|
66
|
-
// ssr handler
|
|
67
|
-
const ssrHandler = await zovaSys.meta.$getSsrHandler(rootFolder);
|
|
68
|
-
await ssrHandler.ensureReady();
|
|
69
|
-
// ok
|
|
70
|
-
return ssrHandler;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function pathToHref(fileName) {
|
|
74
|
-
return pathToFileURL(fileName).href;
|
|
75
|
-
// return Path.sep === '\\' ? pathToFileURL(fileName).href : fileName;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function render ({req, res}) {
|
|
79
|
-
const ssrHandler = await ensureReady();
|
|
80
|
-
const html = await ssrHandler.render({req, res});
|
|
81
|
-
if(!html) {
|
|
82
|
-
const err = new Error('not found');
|
|
83
|
-
err.code = err.status = 404;
|
|
84
|
-
throw err;
|
|
85
|
-
}
|
|
86
|
-
return html;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const middlewareParams = {
|
|
90
|
-
port,
|
|
91
|
-
resolve: {
|
|
92
|
-
urlPath: resolveUrlPath,
|
|
93
|
-
root () { return join(rootFolder, ...arguments) },
|
|
94
|
-
public: resolvePublicFolder
|
|
95
|
-
},
|
|
96
|
-
publicPath,
|
|
97
|
-
folders: {
|
|
98
|
-
root: rootFolder,
|
|
99
|
-
public: publicFolder
|
|
100
|
-
},
|
|
101
|
-
render
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const app = await create(middlewareParams)
|
|
105
|
-
|
|
106
|
-
// fill in "app" for next calls
|
|
107
|
-
middlewareParams.app = app
|
|
108
|
-
|
|
109
|
-
const serveStatic = await serveStaticContent(middlewareParams)
|
|
110
|
-
middlewareParams.serve = { static: serveStatic }
|
|
111
|
-
|
|
112
|
-
<% if (ssr.pwa) { %>
|
|
113
|
-
// serve the service worker with no cache
|
|
114
|
-
await serveStatic({ urlPath: '/<%= pwa.swFilename %>', pathToServe: '<%= pwa.swFilename %>', opts: { maxAge: 0 } })
|
|
115
|
-
<% } %>
|
|
116
|
-
|
|
117
|
-
// serve "client" folder (includes the "public" folder)
|
|
118
|
-
await serveStatic({ urlPath: '/', pathToServe: '.' })
|
|
119
|
-
|
|
120
|
-
await injectMiddlewares(middlewareParams)
|
|
121
|
-
|
|
122
|
-
export const listenResult = await listen(middlewareParams)
|
|
123
|
-
export const handler = listenResult?.handler
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
MOCK_BUILD = true
|
package/zova/packages-utils/quasar-app-extension-zova/templates/modes/ssr/middlewares/.gitkeep
DELETED
|
File without changes
|
package/zova/packages-utils/quasar-app-extension-zova/templates/vuetify/composables/hydration.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { getCurrentInstance, shallowRef } from 'vue';
|
|
2
|
-
|
|
3
|
-
import { IN_BROWSER } from '../util/index.js';
|
|
4
|
-
// Composables
|
|
5
|
-
import { useDisplay } from './display.js';
|
|
6
|
-
// Utilities
|
|
7
|
-
export function useHydration() {
|
|
8
|
-
if (!IN_BROWSER) return shallowRef(false);
|
|
9
|
-
const { ssr } = useDisplay();
|
|
10
|
-
if (ssr) {
|
|
11
|
-
const isMounted = shallowRef(false);
|
|
12
|
-
const instance = getCurrentInstance();
|
|
13
|
-
const zova = instance.appContext.app.zova;
|
|
14
|
-
if (!zova.ctx.meta.$ssr.isRuntimeSsrPreHydration) {
|
|
15
|
-
isMounted.value = true;
|
|
16
|
-
} else {
|
|
17
|
-
zova.ctx.meta.$ssr.onHydrated(() => {
|
|
18
|
-
isMounted.value = true;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return isMounted;
|
|
22
|
-
} else {
|
|
23
|
-
return shallowRef(true);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// # sourceMappingURL=hydration.js.map
|
package/zova/packages-utils/quasar-app-extension-zova/templates/vuetify/composables/ssrBoot.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Utilities
|
|
2
|
-
import { getCurrentInstance, onMounted, readonly, shallowRef, toRef } from 'vue';
|
|
3
|
-
|
|
4
|
-
// Composables
|
|
5
|
-
export function useSsrBoot() {
|
|
6
|
-
const isBooted = shallowRef(false);
|
|
7
|
-
const instance = getCurrentInstance();
|
|
8
|
-
const zova = instance.appContext.app.zova;
|
|
9
|
-
if (zova.sys.env.SSR) {
|
|
10
|
-
if (!zova.ctx.meta.$ssr.isRuntimeSsrPreHydration) {
|
|
11
|
-
isBooted.value = true;
|
|
12
|
-
} else {
|
|
13
|
-
zova.ctx.meta.$ssr.onHydrated(() => {
|
|
14
|
-
isBooted.value = true;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
onMounted(() => {
|
|
19
|
-
window.requestAnimationFrame(() => {
|
|
20
|
-
isBooted.value = true;
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const ssrBootStyles = toRef(() =>
|
|
25
|
-
!isBooted.value
|
|
26
|
-
? {
|
|
27
|
-
transition: 'none !important',
|
|
28
|
-
}
|
|
29
|
-
: undefined,
|
|
30
|
-
);
|
|
31
|
-
return {
|
|
32
|
-
ssrBootStyles,
|
|
33
|
-
isBooted: readonly(isBooted),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// # sourceMappingURL=ssrBoot.js.map
|