@wix/origami-site 1.3.1 → 1.3.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/origami-site",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Runs an exported Wix origami site: file-based routing, Wix dynamic pages, popups and build checks. Use with @wix/origami-site-astro or @wix/origami-site-express.",
5
5
  "type": "module",
6
6
  "files": [
@@ -48,11 +48,11 @@
48
48
  "dependencies": {
49
49
  "@wix/origami-types": "^2.0.0",
50
50
  "@wix/builder-error-pages": "^1.1.6",
51
- "@wix/origami-transforms": "^0.1.71",
51
+ "@wix/origami-transforms": "^0.1.72",
52
52
  "@babel/parser": "^7.25.0",
53
- "@wix/origami-services": "^1.5.2",
53
+ "@wix/origami-services": "^1.5.3",
54
54
  "@wix/services-manager-react": "^1.0.8",
55
- "@wix/origami-bi": "^0.24.5"
55
+ "@wix/origami-bi": "^0.24.6"
56
56
  },
57
57
  "exports": {
58
58
  "./server": {
@@ -93,5 +93,5 @@
93
93
  "optional": true
94
94
  }
95
95
  },
96
- "falconPackageHash": "a57028ec6abbc814695c28a1fbc23be9d145f49c32358f8f0fef93b0"
96
+ "falconPackageHash": "b7bfddab9deb0ef74eaaf634291a867440c9d33354f863a8869de676"
97
97
  }
@@ -17,7 +17,8 @@ export function transforms({ root }) {
17
17
  },
18
18
  {
19
19
  name: 'origami:css-transforms',
20
- config: () => ({ css: { postcss: { plugins: [pipeline.postcssPlugin] } } }),
20
+ config: () => ({ css: { postcss: { plugins: [pipeline.postcssPlugin], parser: pipeline.postcssParser } } }),
21
+ buildEnd(error) { if (error) pipeline.nameBuildError?.(error) },
21
22
  handleHotUpdate({ file, server }) {
22
23
  pipeline.handleHotUpdate(resolve(file), () => server.ws.send({ type: 'full-reload', path: '*' }))
23
24
  },
@@ -86,6 +86,8 @@ export function getAccessToken(): Promise<string>
86
86
  export function serializePageData(data: PageData): string
87
87
  /** The core's plain HTML error page: logs the stack, shows the message in dev only, `cache-control: no-store`. */
88
88
  export function errorResponse(error: unknown, options: { status?: 500 | 503; mode: 'dev' | 'prod'; logger?: Logger }): Response
89
+ /** For BI only: counts a 500 the host's bridge sends (a page it couldn't render, a site it couldn't load) as `ssr_500`. */
90
+ export function countServerError(): void
89
91
  /** `yarn build`: writes `<serverOutDir>/origami-routes.json`, atomically. */
90
92
  export function writeBuiltTable(serverOutDir: string, table: SiteRouteTable): Promise<void>
91
93
  /** `yarn start`: reads it back; throws on a missing file, an unknown format or another core major. */
@@ -6,3 +6,4 @@ export { createSite, noAccessRules } from './requests/createSite.js'
6
6
  export { runInRequestContext, getRequestContext, getAccessToken } from './requests/context.js'
7
7
  export { serializePageData } from './requests/pageData.js'
8
8
  export { errorResponse } from './requests/errorPage.js'
9
+ export { countServerError } from './requests/bi.js'
@@ -10,15 +10,32 @@ export function requestCounts() {
10
10
  if (!counts) {
11
11
  counts = { requests: {}, router_errors: {}, embed_fetch_failures: 0 }
12
12
  summaries.set(run, counts)
13
- const timer = setInterval(() => {
14
- if (!run.commandRow.isOpen) { clearInterval(timer); summaries.delete(run); return }
13
+ let serverErrors = 0
14
+ const emit = () => {
15
15
  if (!Object.keys(counts.requests).length && !Object.keys(counts.router_errors).length && !counts.embed_fetch_failures) return
16
+ for (const [request, count] of Object.entries(counts.requests)) if (request.endsWith('_500')) serverErrors += count
16
17
  run.commandRow.runInContext(() => run.openRow('step', 'request', { step_details: {
17
18
  requests: { ...counts.requests }, router_errors: { ...counts.router_errors }, embed_fetch_failures: counts.embed_fetch_failures,
18
19
  } }).end())
19
20
  counts.requests = {}; counts.router_errors = {}; counts.embed_fetch_failures = 0
21
+ }
22
+ const timer = setInterval(() => {
23
+ if (!run.commandRow.isOpen) { clearInterval(timer); summaries.delete(run); return }
24
+ emit()
20
25
  }, 60_000)
21
26
  timer.unref()
27
+ // The last minute, or a session shorter than one. An older runtime has no hook.
28
+ run.onFinish?.(() => {
29
+ clearInterval(timer)
30
+ emit()
31
+ run.commandRow.update({ step_details: { server_errors: serverErrors } })
32
+ })
22
33
  }
23
34
  return counts
24
35
  }
36
+
37
+ /** A page the server couldn't render (SSR) or a site it couldn't load: the 500 the bridge sends. */
38
+ export function countServerError() {
39
+ const counts = requestCounts()
40
+ if (counts) counts.requests.ssr_500 = (counts.requests.ssr_500 ?? 0) + 1
41
+ }