@live-change/frontend-base 0.9.188 → 0.9.190

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.
Files changed (3) hide show
  1. package/main.js +19 -1
  2. package/package.json +18 -18
  3. package/server-entry.js +49 -32
package/main.js CHANGED
@@ -32,6 +32,24 @@ export async function createApp(config, api, App, createRouter, host, headers, r
32
32
 
33
33
  app.config.devtools = !isSSR//true
34
34
 
35
+ const errorLog = []
36
+
37
+ // Add error handler for SSR to capture setup function errors with full stack trace
38
+ if (isSSR) {
39
+ app.config.errorHandler = (err, instance, info) => {
40
+ console.error('Vue SSR Error:', err.message, err.stack,
41
+ "IN", instance?.$?.type?.__name || instance?.$?.type?.name || 'Unknown',
42
+ "AT", info, "URL", url)
43
+ errorLog.push({ message: err.message, stack: err.stack, component: instance?.$?.type?.__name || instance?.$?.type?.name || 'Unknown', info: info, url: url })
44
+ throw err
45
+ }
46
+
47
+ app.config.warnHandler = (msg, instance, trace) => {
48
+ console.warn('Vue SSR Warning:', msg, "IN", instance?.$?.type?.__name || instance?.$?.type?.name || 'Unknown', "AT", trace, "URL", url)
49
+ errorLog.push({ message: msg, component: instance?.$?.type?.__name || instance?.$?.type?.name || 'Unknown', trace: trace, url: url })
50
+ }
51
+ }
52
+
35
53
  app.config.globalProperties.$response = response
36
54
  app.config.globalProperties.$host = host
37
55
 
@@ -119,5 +137,5 @@ export async function createApp(config, api, App, createRouter, host, headers, r
119
137
 
120
138
  if(config.configure) await config.configure({ app, api, router, locale, i18n })
121
139
 
122
- return { app, router, head }
140
+ return { app, router, head, errorLog }
123
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/frontend-base",
3
- "version": "0.9.188",
3
+ "version": "0.9.190",
4
4
  "scripts": {
5
5
  "memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --templatePath ../../base-frontend/index.html",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
@@ -35,21 +35,21 @@
35
35
  "@lezer/rust": "=1.0.1",
36
36
  "@lezer/sass": "=1.0.3",
37
37
  "@lezer/xml": "=1.0.2",
38
- "@live-change/cli": "^0.9.188",
39
- "@live-change/dao": "^0.9.188",
40
- "@live-change/dao-message": "^0.9.188",
41
- "@live-change/dao-sockjs": "^0.9.188",
42
- "@live-change/dao-vue3": "^0.9.188",
43
- "@live-change/dao-websocket": "^0.9.188",
44
- "@live-change/email-service": "^0.9.188",
45
- "@live-change/password-authentication-service": "^0.9.188",
46
- "@live-change/secret-code-service": "^0.9.188",
47
- "@live-change/secret-link-service": "^0.9.188",
48
- "@live-change/security-frontend": "^0.9.188",
49
- "@live-change/session-service": "^0.9.188",
50
- "@live-change/user-service": "^0.9.188",
51
- "@live-change/vue3-components": "^0.9.188",
52
- "@live-change/vue3-ssr": "^0.9.188",
38
+ "@live-change/cli": "^0.9.190",
39
+ "@live-change/dao": "^0.9.190",
40
+ "@live-change/dao-message": "^0.9.190",
41
+ "@live-change/dao-sockjs": "^0.9.190",
42
+ "@live-change/dao-vue3": "^0.9.190",
43
+ "@live-change/dao-websocket": "^0.9.190",
44
+ "@live-change/email-service": "^0.9.190",
45
+ "@live-change/password-authentication-service": "^0.9.190",
46
+ "@live-change/secret-code-service": "^0.9.190",
47
+ "@live-change/secret-link-service": "^0.9.190",
48
+ "@live-change/security-frontend": "^0.9.190",
49
+ "@live-change/session-service": "^0.9.190",
50
+ "@live-change/user-service": "^0.9.190",
51
+ "@live-change/vue3-components": "^0.9.190",
52
+ "@live-change/vue3-ssr": "^0.9.190",
53
53
  "@primevue/themes": "^4.3.3",
54
54
  "@tailwindcss/node": "4.1.0",
55
55
  "@tailwindcss/oxide": "4.1.0",
@@ -107,7 +107,7 @@
107
107
  "vue3-scroll-border": "0.1.7"
108
108
  },
109
109
  "devDependencies": {
110
- "@live-change/codeceptjs-helper": "^0.9.188",
110
+ "@live-change/codeceptjs-helper": "^0.9.190",
111
111
  "codeceptjs": "^3.6.10",
112
112
  "generate-password": "1.7.1",
113
113
  "playwright": "1.49.1",
@@ -122,5 +122,5 @@
122
122
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
123
123
  "license": "BSD-3-Clause",
124
124
  "description": "",
125
- "gitHead": "2e18710adb7974de611fd47d298f832f0528d020"
125
+ "gitHead": "2cefa4ae3628fb78722e176549d22daeee7abed4"
126
126
  }
package/server-entry.js CHANGED
@@ -37,7 +37,7 @@ export function serverEntry(App, createRouter, config = {}) {
37
37
  windowId
38
38
  })
39
39
 
40
- const { app, router, head } = await createApp(
40
+ const { app, router, head, errorLog } = await createApp(
41
41
  config, api, App, createRouter, host, headers, response, url
42
42
  )
43
43
 
@@ -59,36 +59,45 @@ export function serverEntry(App, createRouter, config = {}) {
59
59
  let usedStyles = new Set()
60
60
  Base.setLoadedStyleName = async (name) => usedStyles.add(name)
61
61
 
62
- const html = await renderToString(app, ctx)
63
- // get the prerender cache data
64
- const data = api.prerenderCache.cacheData()
65
-
66
- const renderedHead = await renderHeadToString(head)
67
-
68
-
69
- const styleSheets = []
70
- styleSheets.push(`<style type="text/css" data-primevue-style-id="layer-order">${
71
- BaseStyle.getLayerOrderThemeCSS()}</style>`)
72
- BaseStyle.getLayerOrderThemeCSS()
73
-
74
- styleSheets.push(Theme.getCommonStyleSheet())
75
- for(const name of usedStyles) {
76
- styleSheets.push(Theme.getStyleSheet(name))
77
- try {
78
- //const styleObject = await import(/* @vite-ignore */`primevue/${name}/style`)
79
- const component = components[name]
80
- if(!component) continue;
81
- //console.log("COMPONENT", component)
82
- styleSheets.push(component.getThemeStyleSheet())
83
- } catch (e) {
84
- console.error('Error loading '+name+' style', e)
62
+ try {
63
+ const html = await renderToString(app, ctx)
64
+
65
+ // get the prerender cache data
66
+ const data = api.prerenderCache.cacheData()
67
+
68
+ const renderedHead = await renderHeadToString(head)
69
+
70
+
71
+ const styleSheets = []
72
+ styleSheets.push(`<style type="text/css" data-primevue-style-id="layer-order">${
73
+ BaseStyle.getLayerOrderThemeCSS()}</style>`)
74
+ BaseStyle.getLayerOrderThemeCSS()
75
+
76
+ styleSheets.push(Theme.getCommonStyleSheet())
77
+ for(const name of usedStyles) {
78
+ styleSheets.push(Theme.getStyleSheet(name))
79
+ try {
80
+ //const styleObject = await import(/* @vite-ignore */`primevue/${name}/style`)
81
+ const component = components[name]
82
+ if(!component) continue;
83
+ //console.log("COMPONENT", component)
84
+ styleSheets.push(component.getThemeStyleSheet())
85
+ } catch (e) {
86
+ console.error('Error loading '+name+' style', e)
87
+ }
85
88
  }
86
- }
87
- styleSheets.push(BaseStyle.getThemeStyleSheet())
89
+ styleSheets.push(BaseStyle.getThemeStyleSheet())
88
90
 
89
- renderedHead.headTags += styleSheets.join('\n')
91
+ renderedHead.headTags += styleSheets.join('\n')
90
92
 
91
- return { html, data, meta: renderedHead, modules: ctx.modules, response }
93
+ return { html, data, meta: renderedHead, modules: ctx.modules, response }
94
+ } catch (error) {
95
+ console.error('SSR renderToString error:', error.message, error.stack, "URL", url)
96
+ errorLog.push({ message: error.message, stack: error.stack, url: url })
97
+ /// concatente the error log to string, and throw it all
98
+ const errorString = errorLog.map(e => e.message + '\n' + e.stack + '\n' + e.url).join('\n')
99
+ throw new Error(errorString)
100
+ }
92
101
  }
93
102
  }
94
103
 
@@ -113,7 +122,7 @@ export function sitemapEntry(App, createRouter, routerSitemap, config = {}) {
113
122
  }
114
123
  }
115
124
 
116
- const { app, router, head } = await createApp(
125
+ const { app, router, head, errorLog } = await createApp(
117
126
  config, api, App, createRouter, host, headers, response, url
118
127
  )
119
128
 
@@ -121,9 +130,17 @@ export function sitemapEntry(App, createRouter, routerSitemap, config = {}) {
121
130
 
122
131
  const sitemapPrefix = `https://${domain}`
123
132
 
124
- return routerSitemap((location, opts) => {
125
- write({ url: sitemapPrefix + router.resolve(location).href, changefreq: 'daily', priority: 0.5, ...opts })
126
- }, api)
133
+ try {
134
+ return routerSitemap((location, opts) => {
135
+ write({ url: sitemapPrefix + router.resolve(location).href, changefreq: 'daily', priority: 0.5, ...opts })
136
+ }, api)
137
+ } catch (error) {
138
+ console.error('SSR sitemap error:', error.message, error.stack, "URL", url)
139
+ errorLog.push({ message: error.message, stack: error.stack, url: url })
140
+ /// concatente the error log to string, and throw it all
141
+ const errorString = errorLog.map(e => e.message + '\n' + e.stack + '\n' + e.url).join('\n')
142
+ throw new Error(errorString)
143
+ }
127
144
 
128
145
  }
129
146
  }