@sap-ux/adp-tooling 0.18.110 → 0.18.112

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.
@@ -16,19 +16,6 @@ export declare function getAppHostIds(serviceKeys: ServiceKeys[]): string[];
16
16
  * @returns {string[]} Array of backend URLs (including full paths) or empty array if none found.
17
17
  */
18
18
  export declare function getBackendUrlsFromServiceKeys(serviceKeys: ServiceKeys[]): string[];
19
- /**
20
- * Maps backend URLs to their corresponding OAuth paths based on destination matching
21
- * between xs-app.json routes and credentials.json endpoints.
22
- *
23
- * @param {ServiceKeys[]} serviceKeys - The service keys containing endpoints with destinations.
24
- * @param {string} basePath - Path to the .adp/reuse folder containing xs-app.json files.
25
- * @returns {Array<{ url: string; paths: string[]; pathRewrite?: string }>} Array of URL-to-paths mappings with optional pathRewrite.
26
- */
27
- export declare function getBackendUrlsWithPaths(serviceKeys: ServiceKeys[], basePath: string): Array<{
28
- url: string;
29
- paths: string[];
30
- pathRewrite?: string;
31
- }>;
32
19
  /**
33
20
  * Extract endpoint destinations from service keys.
34
21
  *
@@ -2,12 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAppHostIds = getAppHostIds;
4
4
  exports.getBackendUrlsFromServiceKeys = getBackendUrlsFromServiceKeys;
5
- exports.getBackendUrlsWithPaths = getBackendUrlsWithPaths;
6
5
  exports.getServiceKeyDestinations = getServiceKeyDestinations;
7
6
  exports.getOAuthPathsFromXsApp = getOAuthPathsFromXsApp;
8
7
  exports.getCfApps = getCfApps;
9
- const node_fs_1 = require("node:fs");
10
- const node_path_1 = require("node:path");
11
8
  const i18n_1 = require("../../i18n");
12
9
  const utils_1 = require("../utils");
13
10
  const api_1 = require("../services/api");
@@ -52,25 +49,6 @@ function getBackendUrlsFromServiceKeys(serviceKeys) {
52
49
  }
53
50
  return urls;
54
51
  }
55
- /**
56
- * Extract destination to URL mapping from service key endpoints.
57
- *
58
- * @param {ServiceKeys[]} serviceKeys - The service keys containing endpoints.
59
- * @returns {Map<string, string>} Map of destination names to URLs.
60
- */
61
- function extractDestinationToUrlMap(serviceKeys) {
62
- const destinationToUrl = new Map();
63
- const endpoints = serviceKeys[0]?.credentials?.endpoints;
64
- if (endpoints && typeof endpoints === 'object') {
65
- for (const key in endpoints) {
66
- const endpoint = endpoints[key];
67
- if (endpoint?.url && endpoint.destination) {
68
- destinationToUrl.set(endpoint.destination, endpoint.url);
69
- }
70
- }
71
- }
72
- return destinationToUrl;
73
- }
74
52
  /**
75
53
  * Clean regex pattern from route source.
76
54
  *
@@ -95,95 +73,6 @@ function cleanRoutePath(source) {
95
73
  path = path.replace(/\/$/, '');
96
74
  return path;
97
75
  }
98
- /**
99
- * Process a route and extract path and pathRewrite from source and target.
100
- *
101
- * @param {XsAppRoute} route - The route object from xs-app.json.
102
- * @param {Map<string, { paths: Set<string>; pathRewrite?: string }>} destinationToPaths - Map to store destination info.
103
- */
104
- function processRouteForDestination(route, destinationToPaths) {
105
- const destination = route.destination;
106
- const service = route.service;
107
- if (!destination || service === 'html5-apps-repo-rt' || !route.source) {
108
- return;
109
- }
110
- const path = cleanRoutePath(route.source);
111
- if (path) {
112
- if (!destinationToPaths.has(destination)) {
113
- destinationToPaths.set(destination, { paths: new Set() });
114
- }
115
- const destInfo = destinationToPaths.get(destination);
116
- destInfo.paths.add(path);
117
- // Extract pathRewrite from target if available
118
- if (route.target && typeof route.target === 'string') {
119
- const pathRewrite = cleanRoutePath(route.target);
120
- if (pathRewrite && !destInfo.pathRewrite) {
121
- destInfo.pathRewrite = pathRewrite;
122
- }
123
- }
124
- }
125
- }
126
- /**
127
- * Extract destination to paths mapping from xs-app.json routes with pathRewrite info.
128
- *
129
- * @param {string} xsAppPath - Path to xs-app.json file.
130
- * @returns {Map<string, { paths: Set<string>; pathRewrite?: string }>} Map of destination names to path info.
131
- */
132
- function extractDestinationToPathsMap(xsAppPath) {
133
- const destinationToPaths = new Map();
134
- try {
135
- const xsAppContent = (0, node_fs_1.readFileSync)(xsAppPath, 'utf8');
136
- const xsApp = JSON.parse(xsAppContent);
137
- if (xsApp?.routes) {
138
- for (const route of xsApp.routes) {
139
- processRouteForDestination(route, destinationToPaths);
140
- }
141
- }
142
- }
143
- catch (e) {
144
- throw new Error((0, i18n_1.t)('error.invalidXsAppJson', { error: e.message }));
145
- }
146
- return destinationToPaths;
147
- }
148
- /**
149
- * Maps backend URLs to their corresponding OAuth paths based on destination matching
150
- * between xs-app.json routes and credentials.json endpoints.
151
- *
152
- * @param {ServiceKeys[]} serviceKeys - The service keys containing endpoints with destinations.
153
- * @param {string} basePath - Path to the .adp/reuse folder containing xs-app.json files.
154
- * @returns {Array<{ url: string; paths: string[]; pathRewrite?: string }>} Array of URL-to-paths mappings with optional pathRewrite.
155
- */
156
- function getBackendUrlsWithPaths(serviceKeys, basePath) {
157
- const destinationToUrl = extractDestinationToUrlMap(serviceKeys);
158
- const reuseXsAppPath = (0, node_path_1.join)(basePath, '.adp', 'reuse', 'xs-app.json');
159
- const distXsAppPath = (0, node_path_1.join)(basePath, 'dist', 'xs-app.json');
160
- let xsAppPath;
161
- if ((0, node_fs_1.existsSync)(reuseXsAppPath)) {
162
- xsAppPath = reuseXsAppPath;
163
- }
164
- else if ((0, node_fs_1.existsSync)(distXsAppPath)) {
165
- xsAppPath = distXsAppPath;
166
- }
167
- else {
168
- throw new Error((0, i18n_1.t)('error.xsAppJsonNotFound', { paths: `${reuseXsAppPath}, ${distXsAppPath}` }));
169
- }
170
- const destinationToPaths = extractDestinationToPathsMap(xsAppPath);
171
- const result = [];
172
- for (const [destination, pathInfo] of destinationToPaths.entries()) {
173
- const url = destinationToUrl.get(destination);
174
- if (url) {
175
- const entry = {
176
- url,
177
- paths: Array.from(pathInfo.paths)
178
- };
179
- if (pathInfo.pathRewrite) {
180
- entry.pathRewrite = pathInfo.pathRewrite;
181
- }
182
- result.push(entry);
183
- }
184
- }
185
- return result;
186
- }
187
76
  /**
188
77
  * Extract endpoint destinations from service keys.
189
78
  *
@@ -1,6 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { ToolsLogger } from '@sap-ux/logger';
3
- import type { UI5Config } from '@sap-ux/ui5-config';
4
3
  import type { AppParamsExtended, MtaYaml, ServiceKeys } from '../../types';
5
4
  import { AppRouterType } from '../../types';
6
5
  interface AdjustMtaYamlParams {
@@ -51,22 +50,5 @@ export declare function getAppParamsFromUI5Yaml(projectPath: string): AppParamsE
51
50
  * @returns {Promise<void>} The promise.
52
51
  */
53
52
  export declare function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, businessSolutionName, businessService, serviceKeys, spaceGuid }: AdjustMtaYamlParams, memFs: Editor, timestamp: string, templatePathOverwrite?: string, logger?: ToolsLogger): Promise<MtaYaml>;
54
- /**
55
- * Add fiori-tools-servestatic configuration to ui5.yaml and removes previously added configuration.
56
- *
57
- * @param basePath - path to application root
58
- * @param ui5Config - UI5 configuration object
59
- * @param logger - logger instance
60
- */
61
- export declare function addServeStaticMiddleware(basePath: string, ui5Config: UI5Config, logger?: ToolsLogger): Promise<void>;
62
- /**
63
- * Add backend-proxy-middleware-cf configuration to ui5.yaml.
64
- *
65
- * @param basePath - path to application root
66
- * @param ui5Config - UI5 configuration object
67
- * @param serviceKeys - service keys from Cloud Foundry
68
- * @param logger - logger instance
69
- */
70
- export declare function addBackendProxyMiddleware(basePath: string, ui5Config: UI5Config, serviceKeys: ServiceKeys[], logger?: ToolsLogger): void;
71
53
  export {};
72
54
  //# sourceMappingURL=yaml.d.ts.map
@@ -41,8 +41,6 @@ exports.getSAPCloudService = getSAPCloudService;
41
41
  exports.getRouterType = getRouterType;
42
42
  exports.getAppParamsFromUI5Yaml = getAppParamsFromUI5Yaml;
43
43
  exports.adjustMtaYaml = adjustMtaYaml;
44
- exports.addServeStaticMiddleware = addServeStaticMiddleware;
45
- exports.addBackendProxyMiddleware = addBackendProxyMiddleware;
46
44
  const node_fs_1 = __importDefault(require("node:fs"));
47
45
  const path = __importStar(require("node:path"));
48
46
  const js_yaml_1 = __importDefault(require("js-yaml"));
@@ -50,8 +48,6 @@ const types_1 = require("../../types");
50
48
  const api_1 = require("../services/api");
51
49
  const yaml_loader_1 = require("./yaml-loader");
52
50
  const discovery_1 = require("../app/discovery");
53
- const helper_1 = require("../../base/helper");
54
- const ui5_app_info_1 = require("./ui5-app-info");
55
51
  const CF_MANAGED_SERVICE = 'org.cloudfoundry.managed-service';
56
52
  const HTML5_APPS_REPO = 'html5-apps-repo';
57
53
  const SAP_APPLICATION_CONTENT = 'com.sap.application.content';
@@ -454,77 +450,4 @@ async function adjustMtaYaml({ projectPath, adpProjectName, appRouterType, busin
454
450
  logger?.debug(`Adjusted MTA YAML for project ${projectPath}`);
455
451
  return yamlContent;
456
452
  }
457
- /**
458
- * Add fiori-tools-servestatic configuration to ui5.yaml and removes previously added configuration.
459
- *
460
- * @param basePath - path to application root
461
- * @param ui5Config - UI5 configuration object
462
- * @param logger - logger instance
463
- */
464
- async function addServeStaticMiddleware(basePath, ui5Config, logger) {
465
- try {
466
- if (ui5Config.findCustomMiddleware('fiori-tools-servestatic')) {
467
- ui5Config.removeCustomMiddleware('fiori-tools-servestatic');
468
- }
469
- const paths = [];
470
- // Add reusable library paths from ui5AppInfo.json if it exists
471
- paths.push(...(0, ui5_app_info_1.getReusableLibraryPaths)(basePath, logger));
472
- const variant = await (0, helper_1.getVariant)(basePath);
473
- const builtVariantId = variant.id.replaceAll('.', '_');
474
- paths.push({
475
- path: `/changes/${builtVariantId}`,
476
- src: './webapp/changes',
477
- fallthrough: true
478
- }, {
479
- path: `/${builtVariantId}/i18n`,
480
- src: './webapp/i18n',
481
- fallthrough: true
482
- });
483
- ui5Config.addCustomMiddleware([
484
- {
485
- name: 'fiori-tools-servestatic',
486
- beforeMiddleware: 'compression',
487
- configuration: {
488
- paths
489
- }
490
- }
491
- ]);
492
- }
493
- catch (error) {
494
- logger?.warn(`Could not add fiori-tools-servestatic configuration: ${error.message}`);
495
- throw error;
496
- }
497
- }
498
- /**
499
- * Add backend-proxy-middleware-cf configuration to ui5.yaml.
500
- *
501
- * @param basePath - path to application root
502
- * @param ui5Config - UI5 configuration object
503
- * @param serviceKeys - service keys from Cloud Foundry
504
- * @param logger - logger instance
505
- */
506
- function addBackendProxyMiddleware(basePath, ui5Config, serviceKeys, logger) {
507
- try {
508
- if (ui5Config.findCustomMiddleware('backend-proxy-middleware-cf')) {
509
- ui5Config.removeCustomMiddleware('backend-proxy-middleware-cf');
510
- }
511
- const urlsWithPaths = (0, discovery_1.getBackendUrlsWithPaths)(serviceKeys, basePath);
512
- if (urlsWithPaths.length === 0) {
513
- logger?.info('No backend URLs with paths found. Skipping backend-proxy-middleware-cf configuration.');
514
- return;
515
- }
516
- ui5Config.addCustomMiddleware([
517
- {
518
- name: 'backend-proxy-middleware-cf',
519
- afterMiddleware: 'compression',
520
- configuration: {
521
- backends: urlsWithPaths
522
- }
523
- }
524
- ]);
525
- }
526
- catch (error) {
527
- logger?.warn(`Could not add backend-proxy-middleware-cf configuration: ${error.message}`);
528
- }
529
- }
530
453
  //# sourceMappingURL=yaml.js.map
@@ -20,14 +20,13 @@ export declare function generateCf(basePath: string, config: CfAdpWriterConfig,
20
20
  */
21
21
  export declare function writeUi5AppInfo(basePath: string, ui5AppInfo: CfUi5AppInfo, logger?: ToolsLogger): Promise<void>;
22
22
  /**
23
- * Generate CF configuration for an adaptation project.
23
+ * Setup CF adaptation project for local preview.
24
+ * Fetches ui5AppInfo.json and builds the project.
24
25
  *
25
26
  * @param basePath - path to project root
26
27
  * @param yamlPath - path to the project configuration file in YAML format
27
28
  * @param cfConfig - CF configuration
28
29
  * @param logger - logger instance
29
- * @param fs - mem-fs editor instance
30
- * @returns updated mem-fs editor instance
31
30
  */
32
- export declare function generateCfConfig(basePath: string, yamlPath: string, cfConfig: CfConfig, logger?: ToolsLogger, fs?: Editor): Promise<Editor>;
31
+ export declare function setupCfPreview(basePath: string, yamlPath: string, cfConfig: CfConfig, logger?: ToolsLogger): Promise<void>;
33
32
  //# sourceMappingURL=cf.d.ts.map
package/dist/writer/cf.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.generateCf = generateCf;
7
7
  exports.writeUi5AppInfo = writeUi5AppInfo;
8
- exports.generateCfConfig = generateCfConfig;
8
+ exports.setupCfPreview = setupCfPreview;
9
9
  const node_fs_1 = __importDefault(require("node:fs"));
10
10
  const node_path_1 = require("node:path");
11
11
  const mem_fs_1 = require("mem-fs");
@@ -95,17 +95,15 @@ async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
95
95
  }
96
96
  }
97
97
  /**
98
- * Generate CF configuration for an adaptation project.
98
+ * Setup CF adaptation project for local preview.
99
+ * Fetches ui5AppInfo.json and builds the project.
99
100
  *
100
101
  * @param basePath - path to project root
101
102
  * @param yamlPath - path to the project configuration file in YAML format
102
103
  * @param cfConfig - CF configuration
103
104
  * @param logger - logger instance
104
- * @param fs - mem-fs editor instance
105
- * @returns updated mem-fs editor instance
106
105
  */
107
- async function generateCfConfig(basePath, yamlPath, cfConfig, logger, fs) {
108
- fs ??= (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
106
+ async function setupCfPreview(basePath, yamlPath, cfConfig, logger) {
109
107
  const ui5Config = await (0, project_access_1.readUi5Yaml)(basePath, yamlPath);
110
108
  const bundlerTask = ui5Config.findCustomTask('app-variant-bundler-build');
111
109
  const serviceInstanceName = bundlerTask?.configuration?.serviceInstanceName;
@@ -126,10 +124,6 @@ async function generateCfConfig(basePath, yamlPath, cfConfig, logger, fs) {
126
124
  throw new Error('No app host IDs found in service keys.');
127
125
  }
128
126
  await writeUi5AppInfo(basePath, ui5AppInfo, logger);
129
- await (0, cf_1.addServeStaticMiddleware)(basePath, ui5Config, logger);
130
127
  await (0, project_builder_1.runBuild)(basePath, { ADP_BUILDER_MODE: 'preview' });
131
- (0, cf_1.addBackendProxyMiddleware)(basePath, ui5Config, serviceInfo.serviceKeys, logger);
132
- fs.write((0, node_path_1.join)(basePath, yamlPath), ui5Config.toString());
133
- return fs;
134
128
  }
135
129
  //# sourceMappingURL=cf.js.map
@@ -69,13 +69,7 @@ export declare function enhanceManifestChangeContentWithFlpConfig(flpConfigurati
69
69
  */
70
70
  export declare function enhanceUI5YamlWithCfCustomTask(ui5Config: UI5Config, config: CfAdpWriterConfig): void;
71
71
  /**
72
- * Generate custom configuration required for the ui5.yaml.
73
- *
74
- * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
75
- * @param {CfAdpWriterConfig} config - Full project configuration.
76
- */
77
- /**
78
- * Generate custom middleware configuration (fiori-tools-proxy and fiori-tools-preview only).
72
+ * Generate custom middleware configuration for CF adaptation projects.
79
73
  *
80
74
  * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
81
75
  */
@@ -332,13 +332,7 @@ function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
332
332
  ]);
333
333
  }
334
334
  /**
335
- * Generate custom configuration required for the ui5.yaml.
336
- *
337
- * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
338
- * @param {CfAdpWriterConfig} config - Full project configuration.
339
- */
340
- /**
341
- * Generate custom middleware configuration (fiori-tools-proxy and fiori-tools-preview only).
335
+ * Generate custom middleware configuration for CF adaptation projects.
342
336
  *
343
337
  * @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
344
338
  */
@@ -346,8 +340,34 @@ function enhanceUI5YamlWithFioriToolsMiddleware(ui5Config) {
346
340
  const ui5ConfigOptions = {
347
341
  url: constants_1.UI5_CDN_URL
348
342
  };
349
- // Add fiori-tools-appreload for live reload during development
350
- ui5Config.addFioriToolsAppReloadMiddleware();
343
+ // Add backend-proxy-middleware-cf as the first middleware (after compression)
344
+ ui5Config.addCustomMiddleware([
345
+ {
346
+ name: 'backend-proxy-middleware-cf',
347
+ afterMiddleware: 'compression',
348
+ configuration: {
349
+ authenticationMethod: 'route',
350
+ allowServices: true,
351
+ appendAuthRoute: true,
352
+ debug: true,
353
+ xsappJsonPath: '.adp/reuse/xs-app.json',
354
+ allowLocalDir: true,
355
+ rewriteContent: false
356
+ }
357
+ }
358
+ ]);
359
+ // Add fiori-tools-appreload for live reload during development (after backend-proxy-middleware-cf)
360
+ ui5Config.addCustomMiddleware([
361
+ {
362
+ name: 'fiori-tools-appreload',
363
+ afterMiddleware: 'backend-proxy-middleware-cf',
364
+ configuration: {
365
+ port: 35729,
366
+ path: 'webapp',
367
+ delay: 300
368
+ }
369
+ }
370
+ ]);
351
371
  // Add fiori-tools-preview (for local preview)
352
372
  ui5Config.addCustomMiddleware([
353
373
  {
@@ -157,7 +157,6 @@ async function writeCfUI5Yaml(projectPath, data, fs) {
157
157
  /** Builder task */
158
158
  (0, options_1.enhanceUI5YamlWithCfCustomTask)(ui5Config, data);
159
159
  /** Middlewares */
160
- // Add fiori-tools-proxy and fiori-tools-preview for local development
161
160
  (0, options_1.enhanceUI5YamlWithFioriToolsMiddleware)(ui5Config);
162
161
  fs.write(ui5ConfigPath, ui5Config.toString());
163
162
  }
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%3Aadp-tooling"
11
11
  },
12
- "version": "0.18.110",
12
+ "version": "0.18.112",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -36,19 +36,19 @@
36
36
  "prompts": "2.4.2",
37
37
  "sanitize-filename": "1.6.4",
38
38
  "uuid": "11.1.0",
39
- "@sap-ux/axios-extension": "1.25.28",
39
+ "@sap-ux/axios-extension": "1.25.29",
40
40
  "@sap-ux/btp-utils": "1.1.12",
41
41
  "@sap-ux/i18n": "0.3.10",
42
- "@sap-ux/inquirer-common": "0.11.33",
43
- "@sap-ux/logger": "0.8.4",
42
+ "@sap-ux/inquirer-common": "0.11.34",
43
+ "@sap-ux/logger": "0.8.5",
44
44
  "@sap-ux/nodejs-utils": "0.2.19",
45
- "@sap-ux/odata-service-writer": "0.31.5",
46
- "@sap-ux/project-access": "1.35.18",
47
- "@sap-ux/project-input-validator": "0.6.74",
48
- "@sap-ux/store": "1.5.12",
49
- "@sap-ux/system-access": "0.7.4",
50
- "@sap-ux/ui5-config": "0.30.1",
51
- "@sap-ux/ui5-info": "0.13.17"
45
+ "@sap-ux/odata-service-writer": "0.31.6",
46
+ "@sap-ux/project-access": "1.35.19",
47
+ "@sap-ux/project-input-validator": "0.6.75",
48
+ "@sap-ux/store": "1.5.13",
49
+ "@sap-ux/system-access": "0.7.5",
50
+ "@sap-ux/ui5-config": "0.30.2",
51
+ "@sap-ux/ui5-info": "0.13.18"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/adm-zip": "0.5.8",
@@ -68,7 +68,7 @@
68
68
  "nock": "14.0.11",
69
69
  "rimraf": "6.1.3",
70
70
  "supertest": "7.2.2",
71
- "@sap-ux/store": "1.5.12"
71
+ "@sap-ux/store": "1.5.13"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=20.x"
@@ -23,11 +23,11 @@
23
23
  "devDependencies": {
24
24
  "@sap-ux/create": "^0.15.9",
25
25
  "@sap/ui5-builder-webide-extension": "^1.1.9",
26
- "@sap-ux/backend-proxy-middleware-cf": "~0.0.0",
26
+ "@sap-ux/backend-proxy-middleware-cf": "^0.1.0",
27
27
  "@sapui5/ts-types": "^1.141.2",
28
28
  "@sap/ux-ui5-tooling": "1",
29
29
  "@ui5/cli": "^4.0.33",
30
- "@ui5/task-adaptation": "1.6.0-rc.4",
30
+ "@ui5/task-adaptation": "^1.6.3",
31
31
  "bestzip": "^2.2.1",
32
32
  "rimraf": "^6.1.2",
33
33
  "mbt": "^1.2.34"
@@ -1,14 +0,0 @@
1
- import type { ToolsLogger } from '@sap-ux/logger';
2
- /**
3
- * Extracts reusable library paths from ui5AppInfo.json if it exists.
4
- *
5
- * @param basePath - path to application root
6
- * @param logger - logger instance
7
- * @returns Array of path configurations for reusable libraries
8
- */
9
- export declare function getReusableLibraryPaths(basePath: string, logger?: ToolsLogger): Array<{
10
- path: string;
11
- src: string;
12
- fallthrough: boolean;
13
- }>;
14
- //# sourceMappingURL=ui5-app-info.d.ts.map
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getReusableLibraryPaths = getReusableLibraryPaths;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_path_1 = __importDefault(require("node:path"));
9
- /**
10
- * Extracts reusable library paths from ui5AppInfo.json if it exists.
11
- *
12
- * @param basePath - path to application root
13
- * @param logger - logger instance
14
- * @returns Array of path configurations for reusable libraries
15
- */
16
- function getReusableLibraryPaths(basePath, logger) {
17
- const ui5AppInfoPath = node_path_1.default.join(basePath, 'ui5AppInfo.json');
18
- if (!node_fs_1.default.existsSync(ui5AppInfoPath)) {
19
- logger?.warn('ui5AppInfo.json not found in project root');
20
- return [];
21
- }
22
- const ui5AppInfoData = JSON.parse(node_fs_1.default.readFileSync(ui5AppInfoPath, 'utf-8'));
23
- const ui5AppInfo = ui5AppInfoData[Object.keys(ui5AppInfoData)[0]];
24
- const reusableLibs = ui5AppInfo.asyncHints?.libs?.filter((lib) => lib.html5AppName && lib.url && typeof lib.url === 'object' && lib.url.url !== undefined) ?? [];
25
- return reusableLibs.map((lib) => {
26
- const libName = String(lib.name);
27
- const html5AppName = String(lib.html5AppName);
28
- const resourcePath = '/resources/' + libName.replaceAll('.', '/');
29
- return {
30
- path: resourcePath,
31
- src: `./.adp/reuse/${html5AppName}`,
32
- fallthrough: true
33
- };
34
- });
35
- }
36
- //# sourceMappingURL=ui5-app-info.js.map