@sap-ux/adp-tooling
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,3 @@ import type { ToolsLogger } from '@sap-ux/logger'; | ||
import type { MergedAppDescriptor } from '@sap-ux/axios-extension'; | ||
import type { Resource } from '@ui5/fs'; | ||
import type { ReaderCollection } from '@ui5/fs'; | ||
import type { UI5FlexLayer } from '@sap-ux/project-access'; | ||
@@ -13,2 +13,3 @@ /** | ||
private readonly config; | ||
private readonly project; | ||
private readonly logger; | ||
@@ -33,5 +34,6 @@ /** | ||
* @param config adp config | ||
* @param project reference to the root of the project | ||
* @param logger logger instance | ||
*/ | ||
constructor(config: AdpPreviewConfig, logger: ToolsLogger); | ||
constructor(config: AdpPreviewConfig, project: ReaderCollection, logger: ToolsLogger); | ||
/** | ||
@@ -41,6 +43,5 @@ * Fetch all required configurations from the backend and initialize all configurations. | ||
* @param descriptorVariant descriptor variant from the project | ||
* @param files all relevant project files (e.g. webapp content) | ||
* @returns the UI5 flex layer for which editing is enabled | ||
*/ | ||
init(descriptorVariant: DescriptorVariant, files: Resource[]): Promise<UI5FlexLayer>; | ||
init(descriptorVariant: DescriptorVariant): Promise<UI5FlexLayer>; | ||
/** | ||
@@ -53,4 +54,4 @@ * Proxy for the merged application manifest.json and blocking of preload files. | ||
*/ | ||
proxy(req: Request, res: Response, next: NextFunction): void; | ||
proxy(req: Request, res: Response, next: NextFunction): Promise<void>; | ||
} | ||
//# sourceMappingURL=adp-preview.d.ts.map |
@@ -36,4 +36,3 @@ "use strict"; | ||
const resources = { | ||
[this.mergedDescriptor.name]: this.mergedDescriptor.url, | ||
[this.mergedDescriptor.manifest['sap.app'].id]: this.mergedDescriptor.url | ||
[this.mergedDescriptor.name]: this.mergedDescriptor.url | ||
}; | ||
@@ -56,6 +55,8 @@ this.mergedDescriptor.asyncHints.libs.forEach((lib) => { | ||
* @param config adp config | ||
* @param project reference to the root of the project | ||
* @param logger logger instance | ||
*/ | ||
constructor(config, logger) { | ||
constructor(config, project, logger) { | ||
this.config = config; | ||
this.project = project; | ||
this.logger = logger; | ||
@@ -67,6 +68,5 @@ } | ||
* @param descriptorVariant descriptor variant from the project | ||
* @param files all relevant project files (e.g. webapp content) | ||
* @returns the UI5 flex layer for which editing is enabled | ||
*/ | ||
init(descriptorVariant, files) { | ||
init(descriptorVariant) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -76,2 +76,3 @@ const provider = yield (0, service_1.createProvider)(this.config, this.logger); | ||
const zip = new yazl_1.ZipFile(); | ||
const files = yield this.project.byGlob('**/*.*'); | ||
for (const file of files) { | ||
@@ -95,12 +96,20 @@ zip.addBuffer(yield file.getBuffer(), file.getPath().substring(1)); | ||
proxy(req, res, next) { | ||
if (req.path.endsWith('manifest.json')) { | ||
res.status(200); | ||
res.send(JSON.stringify(this.descriptor.manifest, undefined, 2)); | ||
} | ||
else if (req.path.endsWith('Component-preload.js')) { | ||
res.status(404).send(); | ||
} | ||
else { | ||
next(); | ||
} | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (req.path === '/manifest.json') { | ||
res.status(200); | ||
res.send(JSON.stringify(this.descriptor.manifest, undefined, 2)); | ||
} | ||
else if (req.path === '/Component-preload.js') { | ||
res.status(404).send(); | ||
} | ||
else { | ||
const files = yield this.project.byGlob(req.path); | ||
if (files.length === 1) { | ||
res.status(200).send(yield files[0].getString()); | ||
} | ||
else { | ||
next(); | ||
} | ||
} | ||
}); | ||
} | ||
@@ -107,0 +116,0 @@ } |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
@@ -50,3 +50,3 @@ "author": "@SAP/ux-tools-team", | ||
"supertest": "6.3.2", | ||
"@sap-ux/project-access": "1.10.1" | ||
"@sap-ux/project-access": "1.11.0" | ||
}, | ||
@@ -53,0 +53,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44709
742