@ui5/task-adaptation 1.6.6 → 1.6.7

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/adapters/abapAdapter.d.ts +2 -1
  3. package/dist/adapters/abapAdapter.js +3 -0
  4. package/dist/adapters/adapter.d.ts +2 -1
  5. package/dist/adapters/cfAdapter.d.ts +2 -1
  6. package/dist/adapters/cfAdapter.js +14 -0
  7. package/dist/adapters/commands/command.d.ts +7 -7
  8. package/dist/adapters/commands/command.js +3 -2
  9. package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +1 -1
  10. package/dist/adapters/commands/downloadAnnotationsCommand.js +4 -3
  11. package/dist/adapters/commands/fetchPreviewResourcesCommand.js +4 -2
  12. package/dist/adapters/commands/filterFilesCommand.d.ts +1 -1
  13. package/dist/adapters/commands/filterFilesCommand.js +2 -1
  14. package/dist/adapters/commands/i18nPropertiesMergeCommand.d.ts +1 -1
  15. package/dist/adapters/commands/i18nPropertiesMergeCommand.js +9 -6
  16. package/dist/adapters/commands/omitDeletedResourcesCommand.d.ts +1 -1
  17. package/dist/adapters/commands/omitDeletedResourcesCommand.js +1 -1
  18. package/dist/adapters/commands/processPreviewResourcesCommand.d.ts +1 -1
  19. package/dist/adapters/commands/processPreviewResourcesCommand.js +14 -7
  20. package/dist/adapters/commands/renameFilesCommand.d.ts +10 -2
  21. package/dist/adapters/commands/renameFilesCommand.js +45 -17
  22. package/dist/adapters/commands/renameManifestCommand.d.ts +14 -0
  23. package/dist/adapters/commands/renameManifestCommand.js +32 -0
  24. package/dist/adapters/commands/writeResourcesCommand.d.ts +1 -1
  25. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.d.ts +1 -1
  26. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +4 -3
  27. package/dist/adapters/commands/xsAppJsonMergeCommand.d.ts +1 -1
  28. package/dist/adapters/commands/xsAppJsonMergeCommand.js +4 -3
  29. package/dist/adapters/previewAdapter.d.ts +2 -1
  30. package/dist/adapters/previewAdapter.js +3 -0
  31. package/dist/annotations/abapAnnotationManager.js +1 -1
  32. package/dist/annotations/dataSource/dataSourceManager.d.ts +2 -1
  33. package/dist/annotations/dataSource/dataSourceManager.js +16 -8
  34. package/dist/appVariant.d.ts +4 -3
  35. package/dist/appVariant.js +14 -7
  36. package/dist/baseApp.d.ts +3 -3
  37. package/dist/baseApp.js +4 -4
  38. package/dist/bundle.js +24 -8
  39. package/dist/cache/cacheHolder.d.ts +11 -2
  40. package/dist/cache/cacheHolder.js +23 -1
  41. package/dist/index.d.ts +10 -1
  42. package/dist/index.js +24 -4
  43. package/dist/landscapeConfiguration.d.ts +3 -3
  44. package/dist/landscapeConfiguration.js +38 -28
  45. package/dist/model/types.d.ts +4 -1
  46. package/dist/repositories/abapProvider.js +2 -2
  47. package/dist/repositories/abapRepository.d.ts +1 -1
  48. package/dist/repositories/cacheRepository.d.ts +10 -0
  49. package/dist/repositories/cacheRepository.js +29 -0
  50. package/dist/repositories/html5Repository.d.ts +1 -1
  51. package/dist/repositories/localRepository.d.ts +1 -1
  52. package/dist/repositories/repository.d.ts +1 -1
  53. package/dist/util/commonUtil.d.ts +6 -1
  54. package/dist/util/commonUtil.js +16 -1
  55. package/dist/util/fsUtil.d.ts +2 -2
  56. package/dist/util/fsUtil.js +4 -4
  57. package/dist/util/manifestUtil.d.ts +6 -0
  58. package/dist/util/manifestUtil.js +15 -0
  59. package/dist/util/movingHandler/changeFileMoveHandler.d.ts +3 -3
  60. package/dist/util/movingHandler/changeFileMoveHandler.js +5 -4
  61. package/dist/util/renamingHandlers/jsonRenamingHandler.d.ts +6 -5
  62. package/dist/util/renamingHandlers/jsonRenamingHandler.js +15 -15
  63. package/dist/util/renamingUtil.d.ts +17 -0
  64. package/dist/util/renamingUtil.js +102 -81
  65. package/dist/util/resourceUtil.d.ts +15 -6
  66. package/dist/util/resourceUtil.js +45 -13
  67. package/dist/util/validator/abapConnectionValidator.d.ts +5 -0
  68. package/dist/util/validator/abapConnectionValidator.js +22 -0
  69. package/dist/util/validator/abapValidator.d.ts +2 -4
  70. package/dist/util/validator/abapValidator.js +4 -16
  71. package/dist/util/zipUtil.d.ts +1 -1
  72. package/dist/util/zipUtil.js +1 -1
  73. package/package.json +7 -7
  74. package/types/ui5.d.ts +2 -0
  75. package/dist/util/renamingHandlers/renamingHandler.d.ts +0 -4
  76. package/dist/util/renamingHandlers/renamingHandler.js +0 -2
@@ -1,6 +1,31 @@
1
1
  import * as resourceFactory from "@ui5/fs/resourceFactory";
2
2
  import { posix as path } from "path";
3
3
  const UTF8 = "utf8";
4
+ /**
5
+ * Extensions of files whose contents are processed by the adaptation
6
+ * pipeline as text. Anything outside this whitelist is treated as binary
7
+ * (e.g. images, fonts) and is saved to the workspace verbatim by WorkspaceManager.
8
+ *
9
+ * Kept in sync with EXTENSIONS_TO_PROCESS in appVariant.ts.
10
+ */
11
+ export const TEXT_EXTENSIONS = new Set([
12
+ "js",
13
+ "json",
14
+ "xml",
15
+ "html",
16
+ "properties",
17
+ "change",
18
+ "appdescr_variant",
19
+ "ctrl_variant",
20
+ "ctrl_variant_change",
21
+ "ctrl_variant_management_change",
22
+ "annotation_change",
23
+ "variant",
24
+ "fioriversion",
25
+ "codeChange",
26
+ "xmlViewChange",
27
+ "context",
28
+ ]);
4
29
  export default class ResourceUtil {
5
30
  static getRootFolder(projectNamespace) {
6
31
  const newPath = ["/resources"];
@@ -21,7 +46,7 @@ export default class ResourceUtil {
21
46
  * NOTE: to write in project folder (folder where 'webapp',
22
47
  * 'package.json', 'ui5.yaml' located), use writeInProject method.
23
48
  * @param dir The directory to write files to.
24
- * @param files A Map of file paths and their contents.
49
+ * @param files A Map of file paths and their contents as Buffer.
25
50
  * @returns A promise that resolves when all files have been written.
26
51
  */
27
52
  static write(dir, files) {
@@ -30,8 +55,8 @@ export default class ResourceUtil {
30
55
  virBasePath: "/"
31
56
  });
32
57
  const promises = [];
33
- files.forEach((string, filename) => {
34
- const resource = resourceFactory.createResource({ path: "/" + filename, string });
58
+ files.forEach((content, filename) => {
59
+ const resource = ResourceUtil.createResourceFromContent("/" + filename, content);
35
60
  promises.push(fsTarget.write(resource));
36
61
  });
37
62
  return Promise.all(promises);
@@ -40,7 +65,7 @@ export default class ResourceUtil {
40
65
  * Write files to the project folder (folder where 'webapp',
41
66
  * 'package.json', 'ui5.yaml' located), use writeInProject method.
42
67
  * @param dir The directory to write files to.
43
- * @param files A Map of file paths and their contents.
68
+ * @param files A Map of file paths and their contents as Buffer.
44
69
  * @returns A promise that resolves when all files have been written.
45
70
  */
46
71
  static writeInProject(dir, files) {
@@ -53,22 +78,27 @@ export default class ResourceUtil {
53
78
  * @param dir The directory to search in.
54
79
  * @param pattern The glob pattern to match files, e.g., "/ui5AppInfo.json".
55
80
  * @param excludes An array of glob patterns to exclude from the search.
56
- * @returns A promise that resolves to a Map of file paths and their contents.
81
+ * @returns A promise that resolves to a Map of file paths and their contents as Buffer.
57
82
  */
58
- static byGlob(dir, pattern, excludes = []) {
83
+ static async byGlob(dir, pattern, excludes = []) {
59
84
  const adapter = resourceFactory.createAdapter({
60
85
  fsBasePath: dir,
61
86
  virBasePath: "/",
62
87
  excludes
63
88
  });
64
- return adapter.byGlob(pattern).then((resources) => this.toFileMap(resources));
89
+ const resources = await adapter.byGlob(pattern);
90
+ const files = new Map();
91
+ for (const resource of resources) {
92
+ files.set(resource.getPath().substring(1), await resource.getBuffer());
93
+ }
94
+ return files;
65
95
  }
66
96
  /*
67
97
  * Search files in the adaptation project (folder where 'webapp',
68
98
  * 'package.json', 'ui5.yaml' located), excluding specified glob patterns.
69
99
  * @param pattern The glob pattern to match files, e.g., "/ui5AppInfo.json".
70
100
  * @param excludes An array of glob patterns to exclude from the search.
71
- * @returns A promise that resolves to a Map of file paths and their contents.
101
+ * @returns A promise that resolves to a Map of file paths and their contents as Buffer.
72
102
  */
73
103
  static byGlobInProject(pattern, excludes = []) {
74
104
  return ResourceUtil.byGlob("./", pattern, [
@@ -87,16 +117,18 @@ export default class ResourceUtil {
87
117
  resource.setBuffer(Buffer.from(str, UTF8));
88
118
  }
89
119
  static createResource(filename, projectNamespace, content) {
90
- return resourceFactory.createResource({
91
- path: this.getResourcePath(projectNamespace, filename),
92
- string: content
93
- });
120
+ return ResourceUtil.createResourceFromContent(this.getResourcePath(projectNamespace, filename), content);
121
+ }
122
+ static createResourceFromContent(resourcePath, content) {
123
+ return resourceFactory.createResource(Buffer.isBuffer(content)
124
+ ? { path: resourcePath, buffer: content }
125
+ : { path: resourcePath, string: content });
94
126
  }
95
127
  static async toFileMap(resources, projectNamespace) {
96
128
  const files = new Map();
97
129
  const rootFolderLength = projectNamespace ? ResourceUtil.getRootFolder(projectNamespace).length : 0;
98
130
  for (const resource of resources) {
99
- files.set(resource.getPath().substring(rootFolderLength + 1), await ResourceUtil.getString(resource));
131
+ files.set(resource.getPath().substring(rootFolderLength + 1), await resource.getBuffer());
100
132
  }
101
133
  return files;
102
134
  }
@@ -0,0 +1,5 @@
1
+ import { AbapTarget } from "@sap-ux/system-access";
2
+ import { IAbapTargetMeta } from "../../model/configuration.js";
3
+ export default class AbapConnectionValidator {
4
+ validateAndGetAbapTarget(target: AbapTarget & IAbapTargetMeta | undefined, destination: string | undefined): AbapTarget & IAbapTargetMeta;
5
+ }
@@ -0,0 +1,22 @@
1
+ import { validateObject } from "../commonUtil.js";
2
+ import { isAppStudio } from "@sap-ux/btp-utils";
3
+ import { getLogger } from "@ui5/logger";
4
+ const log = getLogger("@ui5/task-adaptation::AbapConnectionValidator");
5
+ export default class AbapConnectionValidator {
6
+ validateAndGetAbapTarget(target, destination) {
7
+ if (target) {
8
+ // if target configuration appears, we validate that it should be
9
+ // either target/destination for BAS or target/url for IDE we're
10
+ // trying to detect is it destination for BAS or url for IDE
11
+ const abapTargetProperties = isAppStudio() ? ["destination"] : ["url"];
12
+ validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
13
+ return target;
14
+ }
15
+ else if (destination) {
16
+ log.warn("Destination is deprecated, use target/destination configuration instead");
17
+ return { destination };
18
+ }
19
+ throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
20
+ }
21
+ }
22
+ //# sourceMappingURL=abapConnectionValidator.js.map
@@ -1,8 +1,6 @@
1
- import { AbapTarget } from "@sap-ux/system-access";
2
- import { IAbapTargetMeta, IConfiguration, LandscapeType } from "../../model/configuration.js";
1
+ import { IConfiguration, LandscapeType } from "../../model/configuration.js";
3
2
  import IValidator from "./validator.js";
4
3
  export default class AbapValidator implements IValidator {
5
4
  type: LandscapeType;
6
- validateAndGetAbapTarget(target: AbapTarget & IAbapTargetMeta | undefined, destination: string | undefined): AbapTarget & IAbapTargetMeta;
7
- validateConfiguration({ target, destination }: IConfiguration): void;
5
+ validateConfiguration({ destination, target }: IConfiguration): void;
8
6
  }
@@ -1,26 +1,14 @@
1
- import { validateObject } from "../commonUtil.js";
2
- import { isAppStudio } from "@sap-ux/btp-utils";
3
1
  import { getLogger } from "@ui5/logger";
4
2
  const log = getLogger("@ui5/task-adaptation::AbapValidator");
5
3
  export default class AbapValidator {
6
4
  type = "abap";
7
- validateAndGetAbapTarget(target, destination) {
8
- if (target) {
9
- // if target configuration appears, we validate that it should be
10
- // either target/destination for BAS or target/url for IDE we're
11
- // trying to detect is it destination for BAS or url for IDE
12
- const abapTargetProperties = isAppStudio() ? ["destination"] : ["url"];
13
- validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
14
- return target;
5
+ validateConfiguration({ destination, target }) {
6
+ if (!destination && !target) {
7
+ throw new Error("'target' should be specified in ui5.yaml configuration");
15
8
  }
16
- else if (destination) {
9
+ else if (destination && !target) {
17
10
  log.warn("Destination is deprecated, use target/destination configuration instead");
18
- return { destination };
19
11
  }
20
- throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
21
- }
22
- validateConfiguration({ target, destination }) {
23
- this.validateAndGetAbapTarget(target, destination);
24
12
  }
25
13
  }
26
14
  //# sourceMappingURL=abapValidator.js.map
@@ -1 +1 @@
1
- export declare function unzipZipEntries(zip: Buffer): Promise<Map<string, string>>;
1
+ export declare function unzipZipEntries(zip: Buffer): Promise<Map<string, Buffer>>;
@@ -11,6 +11,6 @@ export async function unzipZipEntries(zip) {
11
11
  }
12
12
  }
13
13
  function mapEntries(entries) {
14
- return new Map(entries.filter(entry => !entry.isDirectory).map(entry => [entry.entryName, entry.getData().toString("utf8")]));
14
+ return new Map(entries.filter(entry => !entry.isDirectory).map(entry => [entry.entryName, entry.getData()]));
15
15
  }
16
16
  //# sourceMappingURL=zipUtil.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,15 +32,15 @@
32
32
  "author": "SAP SE",
33
33
  "license": "Apache-2.0",
34
34
  "dependencies": {
35
- "@sap-ux/axios-extension": "^2.0.1",
36
- "@sap-ux/btp-utils": "^2.0.1",
37
- "@sap-ux/store": "^2.0.1",
38
- "@sap-ux/system-access": "^1.0.1",
35
+ "@sap-ux/axios-extension": "^2.0.8",
36
+ "@sap-ux/btp-utils": "^2.0.6",
37
+ "@sap-ux/store": "^2.0.6",
38
+ "@sap-ux/system-access": "^1.0.10",
39
39
  "@sap/cf-tools": "^3.2.2",
40
40
  "@ui5/fs": "^4.0.1",
41
41
  "@ui5/logger": "^4.0.1",
42
- "adm-zip": "^0.5.5",
43
- "axios": "^1.8.3",
42
+ "adm-zip": "^0.6.0",
43
+ "axios": "^1.18.1",
44
44
  "crc": "^4.3.2",
45
45
  "dotenv": "^16.0.3",
46
46
  "filenamify": "^6.0.0",
package/types/ui5.d.ts CHANGED
@@ -16,6 +16,8 @@ declare class Resource {
16
16
  setPath(path: string): void;
17
17
  getString(): Promise<string>;
18
18
  setString(string: string): void;
19
+ getBuffer(): Promise<Buffer>;
20
+ setBuffer(buffer: Buffer): void;
19
21
  }
20
22
 
21
23
  declare interface IWorkspace {
@@ -1,4 +0,0 @@
1
- export interface IRenamingHandler {
2
- before(files: ReadonlyMap<string, string>): void;
3
- after(files: Map<string, string>): void;
4
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=renamingHandler.js.map