@joystick.js/node-canary 0.0.0-canary.452 → 0.0.0-canary.453

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.
@@ -1 +1 @@
1
- import p from"fs";import _ from"./dynamic_import.js";import f from"./get_platform_safe_path.js";import h from"../app/settings/load.js";import d from"./path_exists.js";import m from"./types.js";const c=h(),$=async(t="",n="",a="")=>{const r=await _(f(`${n}/i18n/${t}?v=${new Date().getTime()}`));if(r&&m.is_object(r)){const e=r[a];return e||r}return{}},w=(t="",n=[],a="")=>{let r=[];t&&r.push(t);const i=n?.filter(e=>!e?.includes("*"));return r.push(...i),(c?.config?.i18n?.defaultLanguage||c?.config?.i18n?.default_language)&&r.push(c?.config?.i18n?.defaultLanguage||c?.config?.i18n?.default_language),r?.flatMap(e=>{const s=[e];return e?.length===2&&s.push(`${e.substring(0,2)}-`),e?.length>2&&(s.push(`${e?.split("-")[0]}`),s.push(`${e?.split("-")[0]}-`)),s})?.map(e=>e[e.length-1]==="-"?new RegExp(a?`^${a}_${e}[A-Z]+.js`:`^${e}[A-Z]+.js`,"g"):new RegExp(a?`^${a}_${e}.js`:`^${e}.js`,"g"))},b=(t="")=>t.split(",")?.map(a=>a.split(";")[0]),j=async(t={})=>{const n=t?.is_email?f(`${t?.joystick_build_path}i18n/email`):f(`${t?.joystick_build_path}i18n`),a=await d(n)&&p.readdirSync(n)||[],r=t?.is_email?[]:b(t?.req?.headers["accept-language"]),i=w(t?.req?.context?.user?.language,r,t?.email_template_name);let e=null;for(let l=0;l<i.length;l+=1){const o=i[l],u=a.find(g=>!!g.match(o));if(u){e=u;break}}return(e?await $(e,t?.joystick_build_path,t?.render_component_path):null)||{}};var E=j;export{E as default};
1
+ import p from"fs";import _ from"./dynamic_import.js";import f from"./get_platform_safe_path.js";import h from"../app/settings/load.js";import d from"./path_exists.js";import m from"./types.js";const c=h(),$=async(t="",n="",a="")=>{const r=await _(f(`${n}/i18n/${t}?v=${new Date().getTime()}`));if(console.log({language_file:r}),r&&m.is_object(r)){const e=r[a];return e||r}return{}},w=(t="",n=[],a="")=>{let r=[];t&&r.push(t);const i=n?.filter(e=>!e?.includes("*"));return r.push(...i),(c?.config?.i18n?.defaultLanguage||c?.config?.i18n?.default_language)&&r.push(c?.config?.i18n?.defaultLanguage||c?.config?.i18n?.default_language),r?.flatMap(e=>{const s=[e];return e?.length===2&&s.push(`${e.substring(0,2)}-`),e?.length>2&&(s.push(`${e?.split("-")[0]}`),s.push(`${e?.split("-")[0]}-`)),s})?.map(e=>e[e.length-1]==="-"?new RegExp(a?`^${a}_${e}[A-Z]+.js`:`^${e}[A-Z]+.js`,"g"):new RegExp(a?`^${a}_${e}.js`:`^${e}.js`,"g"))},b=(t="")=>t.split(",")?.map(a=>a.split(";")[0]),j=async(t={})=>{const n=t?.is_email?f(`${t?.joystick_build_path}i18n/email`):f(`${t?.joystick_build_path}i18n`),a=await d(n)&&p.readdirSync(n)||[],r=t?.is_email?[]:b(t?.req?.headers["accept-language"]),i=w(t?.req?.context?.user?.language,r,t?.email_template_name);let e=null;for(let l=0;l<i.length;l+=1){const o=i[l],u=a.find(g=>!!g.match(o));if(u){e=u;break}}return(e?await $(e,t?.joystick_build_path,t?.render_component_path):null)||{}};var E=j;export{E as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/node-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.452",
4
+ "version": "0.0.0-canary.453",
5
5
  "description": "The Node.js framework for Joystick.",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {
@@ -11,6 +11,9 @@ const get_translations_file = async (language_file_path = '', joystick_build_pat
11
11
  const language_file = await dynamic_import(
12
12
  get_platform_safe_path(`${joystick_build_path}/i18n/${language_file_path}?v=${new Date().getTime()}`)
13
13
  );
14
+
15
+ console.log({ language_file });
16
+
14
17
  const is_valid_language_file = language_file && types.is_object(language_file);
15
18
 
16
19
  if (is_valid_language_file) {