@wix/origami-site 1.3.1 → 1.3.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/origami-site",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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.
|
|
51
|
+
"@wix/origami-transforms": "^0.1.73",
|
|
52
52
|
"@babel/parser": "^7.25.0",
|
|
53
|
-
"@wix/origami-services": "^1.5.
|
|
53
|
+
"@wix/origami-services": "^1.5.4",
|
|
54
54
|
"@wix/services-manager-react": "^1.0.8",
|
|
55
|
-
"@wix/origami-bi": "^0.24.
|
|
55
|
+
"@wix/origami-bi": "^0.24.7"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
58
58
|
"./server": {
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"optional": true
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
-
"falconPackageHash": "
|
|
96
|
+
"falconPackageHash": "a5c3bf91697e9e46228855a841a08226c5cdf8e88087736307053761"
|
|
97
97
|
}
|
package/src/build/browserEnv.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
/** The interactions service (v2) reads `process.env.browser` to tell the browser build from the SSR one
|
|
1
|
+
/** The interactions service (v2) reads `process.env.browser` to tell the browser build from the SSR one, and
|
|
2
|
+
* `process.env.PACKAGE_NAME` to render its CSS with the page and run the Interact it bundles, since Origami renders pages
|
|
3
|
+
* only in the browser.
|
|
2
4
|
* @returns {import('vite').Plugin} */
|
|
3
5
|
export function browserEnv() {
|
|
4
6
|
return {
|
|
5
7
|
name: 'origami:browser-env',
|
|
6
|
-
configEnvironment: name => name === 'client'
|
|
8
|
+
configEnvironment: name => name === 'client'
|
|
9
|
+
? { define: { 'process.env.browser': 'true', 'process.env.PACKAGE_NAME': JSON.stringify('origami') } }
|
|
10
|
+
: undefined,
|
|
7
11
|
}
|
|
8
12
|
}
|
package/src/build/transforms.js
CHANGED
|
@@ -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
|
},
|
package/src/server/index.d.ts
CHANGED
|
@@ -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. */
|
package/src/server/index.js
CHANGED
|
@@ -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
|
-
|
|
14
|
-
|
|
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
|
+
}
|