@sap-ux/preview-middleware 0.11.18 → 0.11.20
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/base/flp.d.ts +7 -0
- package/dist/base/flp.js +55 -6
- package/dist/client/flp/init.js +5 -1
- package/dist/client/flp/init.ts +7 -3
- package/package.json +4 -4
package/dist/base/flp.d.ts
CHANGED
|
@@ -119,6 +119,13 @@ export declare class FlpSandbox {
|
|
|
119
119
|
* @param app configuration for the preview
|
|
120
120
|
*/
|
|
121
121
|
addApp(manifest: Manifest, app: App): void;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the UI5 libs dependencies from manifest.json.
|
|
124
|
+
*
|
|
125
|
+
* @param manifest application manifest
|
|
126
|
+
* @returns UI5 libs that should preloaded
|
|
127
|
+
*/
|
|
128
|
+
private getUI5Libs;
|
|
122
129
|
}
|
|
123
130
|
/**
|
|
124
131
|
* Initialize the preview for an adaptation project.
|
package/dist/base/flp.js
CHANGED
|
@@ -25,6 +25,33 @@ const DEVELOPER_MODE_CONFIG = new Map([
|
|
|
25
25
|
// Make sure that XML preprocessing results are correctly invalidated
|
|
26
26
|
['xx-viewCache', 'false']
|
|
27
27
|
]);
|
|
28
|
+
/**
|
|
29
|
+
* SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
|
|
30
|
+
*/
|
|
31
|
+
const UI5_LIBS = [
|
|
32
|
+
'sap.apf',
|
|
33
|
+
'sap.base',
|
|
34
|
+
'sap.chart',
|
|
35
|
+
'sap.collaboration',
|
|
36
|
+
'sap.f',
|
|
37
|
+
'sap.fe',
|
|
38
|
+
'sap.fileviewer',
|
|
39
|
+
'sap.gantt',
|
|
40
|
+
'sap.landvisz',
|
|
41
|
+
'sap.m',
|
|
42
|
+
'sap.ndc',
|
|
43
|
+
'sap.ovp',
|
|
44
|
+
'sap.rules',
|
|
45
|
+
'sap.suite',
|
|
46
|
+
'sap.tnt',
|
|
47
|
+
'sap.ui',
|
|
48
|
+
'sap.uiext',
|
|
49
|
+
'sap.ushell',
|
|
50
|
+
'sap.uxap',
|
|
51
|
+
'sap.viz',
|
|
52
|
+
'sap.webanalytics',
|
|
53
|
+
'sap.zen'
|
|
54
|
+
];
|
|
28
55
|
/**
|
|
29
56
|
* Default theme
|
|
30
57
|
*/
|
|
@@ -90,8 +117,8 @@ class FlpSandbox {
|
|
|
90
117
|
* @param resources optional additional resource mappings
|
|
91
118
|
*/
|
|
92
119
|
init(manifest, componentId, resources = {}) {
|
|
93
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
94
|
-
var
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
121
|
+
var _h;
|
|
95
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
123
|
const flex = this.createFlexHandler();
|
|
97
124
|
const supportedThemes = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.supportedThemes) !== null && _b !== void 0 ? _b : [DEFAULT_THEME];
|
|
@@ -100,23 +127,23 @@ class FlpSandbox {
|
|
|
100
127
|
basePath: (_d = (0, path_1.relative)((0, path_1.dirname)(this.config.path), '/')) !== null && _d !== void 0 ? _d : '.',
|
|
101
128
|
apps: {},
|
|
102
129
|
ui5: {
|
|
103
|
-
libs:
|
|
130
|
+
libs: this.getUI5Libs(manifest),
|
|
104
131
|
theme: ui5Theme,
|
|
105
132
|
flex,
|
|
106
133
|
resources: Object.assign(Object.assign({}, resources), { [PREVIEW_URL.client.ns]: PREVIEW_URL.client.url }),
|
|
107
134
|
bootstrapOptions: ''
|
|
108
135
|
},
|
|
109
|
-
locateReuseLibsScript: (
|
|
136
|
+
locateReuseLibsScript: (_e = this.config.libs) !== null && _e !== void 0 ? _e : (yield this.hasLocateReuseLibsScript())
|
|
110
137
|
};
|
|
111
138
|
this.addApp(manifest, {
|
|
112
139
|
componentId,
|
|
113
|
-
target: (
|
|
140
|
+
target: (_f = resources[componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id]) !== null && _f !== void 0 ? _f : this.templateConfig.basePath,
|
|
114
141
|
local: '.',
|
|
115
142
|
intent: this.config.intent
|
|
116
143
|
});
|
|
117
144
|
this.addStandardRoutes();
|
|
118
145
|
if (this.rta) {
|
|
119
|
-
(
|
|
146
|
+
(_g = (_h = this.rta).options) !== null && _g !== void 0 ? _g : (_h.options = {});
|
|
120
147
|
this.rta.options.baseId = componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id;
|
|
121
148
|
this.addEditorRoutes(this.rta);
|
|
122
149
|
}
|
|
@@ -317,6 +344,28 @@ class FlpSandbox {
|
|
|
317
344
|
}
|
|
318
345
|
};
|
|
319
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Gets the UI5 libs dependencies from manifest.json.
|
|
349
|
+
*
|
|
350
|
+
* @param manifest application manifest
|
|
351
|
+
* @returns UI5 libs that should preloaded
|
|
352
|
+
*/
|
|
353
|
+
getUI5Libs(manifest) {
|
|
354
|
+
var _a, _b;
|
|
355
|
+
if ((_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.libs) {
|
|
356
|
+
const libNames = Object.keys(manifest['sap.ui5'].dependencies.libs);
|
|
357
|
+
return libNames
|
|
358
|
+
.filter((key) => {
|
|
359
|
+
return UI5_LIBS.some((substring) => {
|
|
360
|
+
return key === substring || key.startsWith(substring + '.');
|
|
361
|
+
});
|
|
362
|
+
})
|
|
363
|
+
.join(',');
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
return 'sap.m,sap.ui.core,sap.ushell';
|
|
367
|
+
}
|
|
368
|
+
}
|
|
320
369
|
}
|
|
321
370
|
exports.FlpSandbox = FlpSandbox;
|
|
322
371
|
/**
|
package/dist/client/flp/init.js
CHANGED
|
@@ -94,7 +94,11 @@ sap.ui.define(["sap/base/Log", "sap/ui/core/IconPool", "sap/base/i18n/ResourceBu
|
|
|
94
94
|
url = url + '&sap-client=' + sapClient;
|
|
95
95
|
}
|
|
96
96
|
const response = await fetch(url);
|
|
97
|
-
|
|
97
|
+
try {
|
|
98
|
+
registerModules(await response.json());
|
|
99
|
+
} catch (error) {
|
|
100
|
+
Log.error(`Registering of reuse libs failed. Error:${error}`);
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -134,7 +134,11 @@ export async function registerComponentDependencyPaths(appUrls: string[]): Promi
|
|
|
134
134
|
url = url + '&sap-client=' + sapClient;
|
|
135
135
|
}
|
|
136
136
|
const response = await fetch(url);
|
|
137
|
-
|
|
137
|
+
try {
|
|
138
|
+
registerModules(await response.json());
|
|
139
|
+
} catch (error) {
|
|
140
|
+
Log.error(`Registering of reuse libs failed. Error:${error}`);
|
|
141
|
+
}
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
|
|
@@ -187,7 +191,7 @@ export async function init({ appUrls, flex }: { appUrls?: string | null; flex?:
|
|
|
187
191
|
if (flex) {
|
|
188
192
|
sap.ushell.Container.attachRendererCreatedEvent(async function () {
|
|
189
193
|
const lifecycleService = await sap.ushell.Container.getServiceAsync<AppLifeCycle>('AppLifeCycle');
|
|
190
|
-
lifecycleService.attachAppLoaded(event => {
|
|
194
|
+
lifecycleService.attachAppLoaded((event) => {
|
|
191
195
|
const view = event.getParameter('componentInstance');
|
|
192
196
|
const libs = ['sap/ui/rta/api/startAdaptation'];
|
|
193
197
|
const flexSettings = JSON.parse(flex);
|
|
@@ -197,7 +201,7 @@ export async function init({ appUrls, flex }: { appUrls?: string | null; flex?:
|
|
|
197
201
|
}
|
|
198
202
|
sap.ui.require(libs, function (startAdaptation: StartAdaptation, pluginScript?: RTAPlugin) {
|
|
199
203
|
const options = {
|
|
200
|
-
rootControl:view,
|
|
204
|
+
rootControl: view,
|
|
201
205
|
validateAppVersion: false,
|
|
202
206
|
flexSettings
|
|
203
207
|
};
|
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.11.
|
|
12
|
+
"version": "0.11.20",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"ejs": "3.1.9",
|
|
26
26
|
"@sap-ux/logger": "0.4.0",
|
|
27
|
-
"@sap-ux/
|
|
28
|
-
"@sap-ux/
|
|
27
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.6",
|
|
28
|
+
"@sap-ux/adp-tooling": "0.7.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/ejs": "3.1.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"supertest": "6.3.3",
|
|
39
39
|
"@sap-ux-private/playwright": "0.0.1",
|
|
40
40
|
"dotenv": "16.3.1",
|
|
41
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.8.
|
|
41
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.8.11",
|
|
42
42
|
"@sap-ux/project-access": "1.16.1",
|
|
43
43
|
"@sap-ux/store": "0.4.0"
|
|
44
44
|
},
|