@sap-ux/preview-middleware 0.23.45 → 0.23.47
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/README.md +3 -1
- package/dist/base/flp.js +26 -8
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://github.com/SAP/open-ux-tools/blob/main/packages/preview-middleware/CHANGELOG.md) [](https://github.com/SAP/open-ux-tools/tree/main/packages/preview-middleware)
|
|
2
|
+
|
|
3
|
+
# [`@sap-ux/preview-middleware`](https://github.com/SAP/open-ux-tools/tree/main/packages/preview-middleware)
|
|
2
4
|
|
|
3
5
|
The `@sap-ux/preview-middleware` is a [Custom UI5 Server Middleware](https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware) for previewing an application in a local SAP Fiori launchpad. It can be used either with the `ui5 serve` or the `fiori run` commands.
|
|
4
6
|
It hosts a local SAP Fiori launchpad based on your configuration as well as offers an API to modify flex changes in your project. The API is available at `/preview/api` and additional client code required for the preview is available at `/preview/client`.
|
package/dist/base/flp.js
CHANGED
|
@@ -840,14 +840,32 @@ class FlpSandbox {
|
|
|
840
840
|
try {
|
|
841
841
|
this.fs = this.fs ?? (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
842
842
|
const webappPath = await (0, project_access_1.getWebappPath)(node_path_1.default.resolve(), this.fs);
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
843
|
+
const i18nConfig = this.manifest['sap.app'].i18n;
|
|
844
|
+
let i18nPath = 'i18n/i18n.properties';
|
|
845
|
+
let fallbackLocale;
|
|
846
|
+
let supportedLocales = [];
|
|
847
|
+
if (typeof i18nConfig === 'string') {
|
|
848
|
+
i18nPath = i18nConfig;
|
|
849
|
+
}
|
|
850
|
+
else if (typeof i18nConfig === 'object' && i18nConfig !== null && 'bundleUrl' in i18nConfig) {
|
|
851
|
+
const { bundleUrl: i18nPathFromConfig, supportedLocales: locales = [], fallbackLocale: fallback } = i18nConfig;
|
|
852
|
+
i18nPath = i18nPathFromConfig;
|
|
853
|
+
supportedLocales = locales;
|
|
854
|
+
fallbackLocale = fallback;
|
|
855
|
+
}
|
|
856
|
+
const requestedLocale = req.query.locale || fallbackLocale || '';
|
|
857
|
+
const baseFilePath = (0, node_path_1.join)(webappPath, i18nPath);
|
|
858
|
+
const filePath = requestedLocale
|
|
859
|
+
? baseFilePath.replace('.properties', `_${requestedLocale}.properties`)
|
|
860
|
+
: baseFilePath;
|
|
861
|
+
if (requestedLocale && supportedLocales.length > 0 && !supportedLocales.includes(requestedLocale)) {
|
|
862
|
+
this.sendResponse(res, 'text/plain', 400, `Locale "${requestedLocale}" is not supported. Supported: ${supportedLocales.join(', ')}`);
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
const entries = (req.body || []).map((entry) => ({
|
|
866
|
+
...entry,
|
|
867
|
+
annotation: entry.comment ?? entry.annotation
|
|
868
|
+
}));
|
|
851
869
|
await (0, i18n_1.createPropertiesI18nEntries)(filePath, entries);
|
|
852
870
|
this.fs.commit(() => this.sendResponse(res, 'text/plain', 201, `i18n file updated.`));
|
|
853
871
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.23.
|
|
12
|
+
"version": "0.23.47",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"qrcode": "1.5.4",
|
|
29
29
|
"@sap/bas-sdk": "3.12.0",
|
|
30
|
-
"@sap-ux/adp-tooling": "0.17.
|
|
31
|
-
"@sap-ux/btp-utils": "1.1.
|
|
32
|
-
"@sap-ux/
|
|
33
|
-
"@sap-ux/
|
|
34
|
-
"@sap-ux/
|
|
35
|
-
"@sap-ux/
|
|
36
|
-
"@sap-ux/
|
|
37
|
-
"@sap-ux/i18n": "0.3.
|
|
30
|
+
"@sap-ux/adp-tooling": "0.17.6",
|
|
31
|
+
"@sap-ux/btp-utils": "1.1.5",
|
|
32
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.2",
|
|
33
|
+
"@sap-ux/feature-toggle": "0.3.4",
|
|
34
|
+
"@sap-ux/logger": "0.7.1",
|
|
35
|
+
"@sap-ux/project-access": "1.32.8",
|
|
36
|
+
"@sap-ux/system-access": "0.6.28",
|
|
37
|
+
"@sap-ux/i18n": "0.3.5"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@sap-ux-private/playwright": "0.2.
|
|
40
|
+
"@sap-ux-private/playwright": "0.2.2",
|
|
41
41
|
"@types/connect": "^3.4.38",
|
|
42
42
|
"@types/qrcode": "1.5.5",
|
|
43
43
|
"@types/ejs": "3.1.2",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"nock": "13.4.0",
|
|
54
54
|
"npm-run-all2": "6.2.0",
|
|
55
55
|
"supertest": "7.1.4",
|
|
56
|
-
"@sap-ux/store": "1.3.2",
|
|
57
56
|
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.17.3",
|
|
58
|
-
"@sap-ux/
|
|
59
|
-
"@sap-ux/
|
|
57
|
+
"@sap-ux/axios-extension": "1.24.2",
|
|
58
|
+
"@sap-ux/store": "1.3.3",
|
|
59
|
+
"@sap-ux/ui5-info": "0.13.1"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"express": "4"
|