@joystick.js/node-canary 0.0.0-canary.371 → 0.0.0-canary.372
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/dist/app/ssr/index.js +2 -2
- package/package.json +1 -1
- package/src/app/ssr/index.js +2 -2
package/dist/app/ssr/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import u from"fs";import p from"../api/get_api_for_data_functions.js";import y from"../../lib/get_browser_safe_request.js";import $ from"../settings/load.js";import h from"./set_base_attributes_in_html.js";import b from"./set_head_tags_in_html.js";import i from"../../lib/path_exists.js";import w from"../accounts/get_browser_safe_user.js";const{readFile:a}=u.promises,r=$(),s=process.env.NODE_ENV==="development",f=(e={})=>e?.base_html.replace(
|
|
1
|
+
import u from"fs";import p from"../api/get_api_for_data_functions.js";import y from"../../lib/get_browser_safe_request.js";import $ from"../settings/load.js";import h from"./set_base_attributes_in_html.js";import b from"./set_head_tags_in_html.js";import i from"../../lib/path_exists.js";import w from"../accounts/get_browser_safe_user.js";const{readFile:a}=u.promises,r=$(),s=process.env.NODE_ENV==="development",f=(e={})=>e?.base_html.replace('<div id="app"></div>',`
|
|
2
2
|
<div id="app">${e?.html}</div>
|
|
3
3
|
<script>
|
|
4
4
|
window.joystick = {
|
|
@@ -26,7 +26,7 @@ import u from"fs";import p from"../api/get_api_for_data_functions.js";import y f
|
|
|
26
26
|
${e?.render_component_path?`<script type="module" src="/_joystick/${e?.render_component_path}"></script>`:""}
|
|
27
27
|
${e?.render_layout_path?`<script type="module" src="/_joystick/${e?.render_layout_path}"></script>`:""}
|
|
28
28
|
${s?'<script type="module" src="/_joystick/hmr/client.js"></script>':""}
|
|
29
|
-
`),g=(e={})=>e?.base_html.replace("${css}",`<style type="text/css">${e?.css}</style>`).replace("${subject}",e?.email_options?.subject).replace("${preheader}",e?.email_options?.preheader||"").replace('<div id="email"></div>',`<div id="email">${e?.html}</div>`),j=(e={})=>e?.is_email?g(e):f(e),k=async(e="")=>await i(`email/${e?`base_${e}`:"base"}.html`)?a(`email/${e?`base_${e}`:"base"}.html`,"utf-8"):(console.warn(`Could not find email/${e?`base_${e}`:"base"}.html`),""),v=async(e="")=>await i(`email/${e?`base_${e}`:"base"}.css`)?a(`email/${e?`base_${e}`:"base"}.css`,"utf-8"):(console.warn(`Could not find email/${e?`base_${e}`:"base"}.css`),""),N=(e=null,t={})=>e(t),O=async(e={})=>{const t=N(e?.component_to_render,e?.component_options),l=p(e?.req,e?.api_schema),c=[],_=await t.render_for_ssr(l,e?.req,c,{is_email:e?.is_email}),n=e?.is_email?await v(e?.email_options?.base_html_name):null,o=e?.is_email?await k(e?.email_options?.base_html_name):null,m=j({is_email:e?.is_email,attributes:e?.attributes,base_html:e?.is_email?o:e?.base_html,component_instance:t,css:e?.is_email?`
|
|
29
|
+
`).replace("${css}",`<style type="text/css" js-css>${e?.css}</style>`),g=(e={})=>e?.base_html.replace("${css}",`<style type="text/css">${e?.css}</style>`).replace("${subject}",e?.email_options?.subject).replace("${preheader}",e?.email_options?.preheader||"").replace('<div id="email"></div>',`<div id="email">${e?.html}</div>`),j=(e={})=>e?.is_email?g(e):f(e),k=async(e="")=>await i(`email/${e?`base_${e}`:"base"}.html`)?a(`email/${e?`base_${e}`:"base"}.html`,"utf-8"):(console.warn(`Could not find email/${e?`base_${e}`:"base"}.html`),""),v=async(e="")=>await i(`email/${e?`base_${e}`:"base"}.css`)?a(`email/${e?`base_${e}`:"base"}.css`,"utf-8"):(console.warn(`Could not find email/${e?`base_${e}`:"base"}.css`),""),N=(e=null,t={})=>e(t),O=async(e={})=>{const t=N(e?.component_to_render,e?.component_options),l=p(e?.req,e?.api_schema),c=[],_=await t.render_for_ssr(l,e?.req,c,{is_email:e?.is_email}),n=e?.is_email?await v(e?.email_options?.base_html_name):null,o=e?.is_email?await k(e?.email_options?.base_html_name):null,m=j({is_email:e?.is_email,attributes:e?.attributes,base_html:e?.is_email?o:e?.base_html,component_instance:t,css:e?.is_email?`
|
|
30
30
|
${n}
|
|
31
31
|
${_?.css}
|
|
32
32
|
`:_?.css,data:_?.data,email_options:e?.email_options,head:e?.head,html:_?.html,props:e?.component_options?.props,render_component_path:e?.render_component_path,render_layout_path:e?.render_layout_path,req:e?.req,translations:e?.component_options?.translations,url:e?.component_options?.url}),d=b(m,e?.head,e?.req);return h(d,e?.attributes)};var P=O;export{P as default};
|
package/package.json
CHANGED
package/src/app/ssr/index.js
CHANGED
|
@@ -13,7 +13,6 @@ const is_development = process.env.NODE_ENV === 'development';
|
|
|
13
13
|
|
|
14
14
|
const build_html_response_for_browser = (options = {}) => {
|
|
15
15
|
return options?.base_html
|
|
16
|
-
.replace('${css}', `<style type="text/css" js-css>${options?.css}</style>`)
|
|
17
16
|
.replace(`<div id="app"></div>`, `
|
|
18
17
|
<div id="app">${options?.html}</div>
|
|
19
18
|
<script>
|
|
@@ -45,7 +44,8 @@ const build_html_response_for_browser = (options = {}) => {
|
|
|
45
44
|
${options?.render_component_path ? `<script type="module" src="/_joystick/${options?.render_component_path}"></script>` : ''}
|
|
46
45
|
${options?.render_layout_path ? `<script type="module" src="/_joystick/${options?.render_layout_path}"></script>` : ''}
|
|
47
46
|
${is_development ? `<script type="module" src="/_joystick/hmr/client.js"></script>` : ''}
|
|
48
|
-
`)
|
|
47
|
+
`)
|
|
48
|
+
.replace('${css}', `<style type="text/css" js-css>${options?.css}</style>`);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const build_html_response_for_email = (options = {}) => {
|