@paroicms/public-server-lib 0.20.0 → 0.22.0
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/simple-i18n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScSchemaLocales, ScTranslations } from "@paroicms/public-anywhere-lib";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AppLogger } from "../types/backend-plugin-types";
|
|
3
3
|
export interface SimpleTranslator {
|
|
4
4
|
translate: (options: SimpleTranslateOptions) => string;
|
|
5
5
|
}
|
|
@@ -12,11 +12,11 @@ export interface SimpleTranslateOptions {
|
|
|
12
12
|
export declare function loadSimpleTranslatorFromDirectory(options: {
|
|
13
13
|
l10nDir: string;
|
|
14
14
|
languages: string[];
|
|
15
|
-
|
|
15
|
+
logger: Pick<AppLogger, "warn">;
|
|
16
16
|
}): Promise<SimpleTranslator>;
|
|
17
17
|
export declare function createSimpleTranslator(options: {
|
|
18
18
|
labels: {
|
|
19
19
|
[language: string]: ScTranslations;
|
|
20
20
|
} | ScSchemaLocales;
|
|
21
|
-
|
|
21
|
+
logger: Pick<AppLogger, "warn">;
|
|
22
22
|
}): Promise<SimpleTranslator>;
|
package/dist/simple-i18n.js
CHANGED
|
@@ -52,7 +52,7 @@ function findVariablesInString(str, max) {
|
|
|
52
52
|
}
|
|
53
53
|
return matches;
|
|
54
54
|
}
|
|
55
|
-
async function loadLabels({ l10nDir, languages,
|
|
55
|
+
async function loadLabels({ l10nDir, languages, logger, }) {
|
|
56
56
|
const labels = new Map();
|
|
57
57
|
for (const language of languages) {
|
|
58
58
|
let content;
|
|
@@ -66,7 +66,7 @@ async function loadLabels({ l10nDir, languages, appLog, }) {
|
|
|
66
66
|
labels.set(language, flattenLocales(JSON.parse(content)));
|
|
67
67
|
}
|
|
68
68
|
catch {
|
|
69
|
-
|
|
69
|
+
logger.warn(`invalid locale file '${(0, node_path_1.join)(l10nDir, `${language}.json`)}'`);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
return labels;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/public-server-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Common utilitaries for paroicms plugins (backend side).",
|
|
5
5
|
"author": "Paroi Team",
|
|
6
6
|
"repository": {
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@paroi/data-formatters-lib": "~0.4.0",
|
|
24
|
-
"@paroicms/internal-anywhere-lib": "1.
|
|
25
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
24
|
+
"@paroicms/internal-anywhere-lib": "1.21.0",
|
|
25
|
+
"@paroicms/public-anywhere-lib": "0.14.0",
|
|
26
26
|
"@types/express": "~4.17.21"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/node": "~
|
|
29
|
+
"@types/node": "~22.10.7",
|
|
30
30
|
"rimraf": "~6.0.1",
|
|
31
|
-
"typescript": "~5.7.
|
|
32
|
-
"vitest": "~
|
|
31
|
+
"typescript": "~5.7.3",
|
|
32
|
+
"vitest": "~3.0.2"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
|
@@ -19,7 +19,7 @@ export interface ParoiCmsPlugin {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface BackendPluginInitService {
|
|
22
|
-
logger:
|
|
22
|
+
logger: AppLogger;
|
|
23
23
|
setPublicAssetsDirectory(directory: string): void;
|
|
24
24
|
setBoAssetsDirectory(directory: string): void;
|
|
25
25
|
registerSiteSchemaLibrary(directory: string): void;
|
|
@@ -69,7 +69,7 @@ export interface BackendPluginService {
|
|
|
69
69
|
siteUrl: string;
|
|
70
70
|
siteSchema: ScSiteSchema;
|
|
71
71
|
themeConf: ThemeConf;
|
|
72
|
-
logger:
|
|
72
|
+
logger: AppLogger;
|
|
73
73
|
validateRecaptchaResponse: (gRecaptchaResponse: string | undefined) => Promise<boolean>;
|
|
74
74
|
sendMail: ({ subject, html, replyTo, to }: MailData) => Promise<void>;
|
|
75
75
|
executeHook<T = unknown>(hookName: string, params?: any): T[];
|
|
@@ -132,7 +132,7 @@ export interface PluginConfs {
|
|
|
132
132
|
|
|
133
133
|
export interface PluginConf {
|
|
134
134
|
[key: string]: unknown;
|
|
135
|
-
|
|
135
|
+
backOffice?: Obj;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export interface MailData {
|
|
@@ -147,7 +147,7 @@ export interface ReplyTo {
|
|
|
147
147
|
name: string;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
export interface
|
|
150
|
+
export interface AppLogger {
|
|
151
151
|
error(...messages: any[]): void;
|
|
152
152
|
warn(...messages: any[]): void;
|
|
153
153
|
info(...messages: any[]): void;
|