@ui5/builder 3.0.0-alpha.1 → 3.0.0-alpha.11

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 (66) hide show
  1. package/CHANGELOG.md +867 -0
  2. package/index.js +0 -43
  3. package/lib/lbt/analyzer/FioriElementsAnalyzer.js +23 -12
  4. package/lib/lbt/analyzer/JSModuleAnalyzer.js +115 -61
  5. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +23 -12
  6. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +29 -19
  7. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  8. package/lib/lbt/analyzer/analyzeLibraryJS.js +15 -0
  9. package/lib/lbt/bundle/Builder.js +365 -138
  10. package/lib/lbt/bundle/BundleWriter.js +17 -0
  11. package/lib/lbt/bundle/Resolver.js +2 -2
  12. package/lib/lbt/calls/SapUiDefine.js +13 -7
  13. package/lib/lbt/resources/LocatorResource.js +7 -7
  14. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  15. package/lib/lbt/resources/ResourceCollector.js +22 -15
  16. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  17. package/lib/lbt/resources/ResourcePool.js +7 -6
  18. package/lib/lbt/utils/ASTUtils.js +45 -18
  19. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  20. package/lib/lbt/utils/parseUtils.js +1 -1
  21. package/lib/processors/bundlers/moduleBundler.js +31 -10
  22. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  23. package/lib/processors/jsdoc/lib/transformApiJson.js +78 -22
  24. package/lib/processors/jsdoc/lib/ui5/plugin.js +414 -122
  25. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  26. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  27. package/lib/processors/manifestCreator.js +8 -45
  28. package/lib/processors/minifier.js +11 -5
  29. package/lib/tasks/buildThemes.js +1 -1
  30. package/lib/tasks/bundlers/generateBundle.js +70 -30
  31. package/lib/tasks/bundlers/generateComponentPreload.js +26 -19
  32. package/lib/tasks/bundlers/generateFlexChangesBundle.js +10 -5
  33. package/lib/tasks/bundlers/generateLibraryPreload.js +113 -94
  34. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  35. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +42 -10
  36. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  37. package/lib/tasks/generateCachebusterInfo.js +7 -3
  38. package/lib/tasks/generateLibraryManifest.js +6 -8
  39. package/lib/tasks/generateResourcesJson.js +3 -3
  40. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  41. package/lib/tasks/generateVersionInfo.js +5 -5
  42. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  43. package/lib/tasks/minify.js +14 -4
  44. package/lib/tasks/taskRepository.js +1 -13
  45. package/lib/tasks/transformBootstrapHtml.js +6 -1
  46. package/package.json +13 -11
  47. package/lib/builder/BuildContext.js +0 -56
  48. package/lib/builder/ProjectBuildContext.js +0 -57
  49. package/lib/builder/builder.js +0 -419
  50. package/lib/tasks/TaskUtil.js +0 -160
  51. package/lib/types/AbstractBuilder.js +0 -270
  52. package/lib/types/AbstractFormatter.js +0 -66
  53. package/lib/types/AbstractUi5Formatter.js +0 -95
  54. package/lib/types/application/ApplicationBuilder.js +0 -211
  55. package/lib/types/application/ApplicationFormatter.js +0 -227
  56. package/lib/types/application/applicationType.js +0 -15
  57. package/lib/types/library/LibraryBuilder.js +0 -231
  58. package/lib/types/library/LibraryFormatter.js +0 -519
  59. package/lib/types/library/libraryType.js +0 -15
  60. package/lib/types/module/ModuleBuilder.js +0 -7
  61. package/lib/types/module/ModuleFormatter.js +0 -54
  62. package/lib/types/module/moduleType.js +0 -15
  63. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -63
  64. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  65. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  66. package/lib/types/typeRepository.js +0 -46
@@ -1,90 +0,0 @@
1
- const log = require("@ui5/logger").getLogger("types:themeLibrary:ThemeLibraryFormatter");
2
- const path = require("path");
3
- const AbstractUi5Formatter = require("../AbstractUi5Formatter");
4
-
5
-
6
- class ThemeLibraryFormatter extends AbstractUi5Formatter {
7
- /**
8
- * Formats and validates the project
9
- *
10
- * @returns {Promise}
11
- */
12
- async format() {
13
- const project = this._project;
14
- await this.validate();
15
-
16
- log.verbose("Formatting theme-library project %s...", project.metadata.name);
17
- project.resources.pathMappings = {
18
- "/resources/": project.resources.configuration.paths.src
19
- };
20
-
21
- if (project.resources.configuration.paths.test) {
22
- // Directory 'test' is somewhat optional for theme-libraries
23
- project.resources.pathMappings["/test-resources/"] = project.resources.configuration.paths.test;
24
- } else {
25
- log.verbose(`Ignoring 'test' directory for project ${project.metadata.name}. ` +
26
- "Either no setting was provided or the path not found.");
27
- }
28
- }
29
-
30
- /**
31
- * Validates the project
32
- *
33
- * @returns {Promise} resolves if successfully validated
34
- * @throws {Error} if validation fails
35
- */
36
- validate() {
37
- const project = this._project;
38
- return Promise.resolve().then(() => {
39
- if (!project) {
40
- throw new Error("Project is undefined");
41
- } else if (project.specVersion === "0.1" || project.specVersion === "1.0") {
42
- throw new Error(
43
- `theme-library type requires "specVersion" 1.1 or higher. ` +
44
- `Project "specVersion" is: ${project.specVersion}`);
45
- } else if (!project.metadata || !project.metadata.name) {
46
- throw new Error(`"metadata.name" configuration is missing for project ${project.id}`);
47
- } else if (!project.type) {
48
- throw new Error(`"type" configuration is missing for project ${project.id}`);
49
- } else if (project.version === undefined) {
50
- throw new Error(`"version" is missing for project ${project.id}`);
51
- }
52
- if (!project.resources) {
53
- project.resources = {};
54
- }
55
- if (!project.resources.configuration) {
56
- project.resources.configuration = {};
57
- }
58
- if (!project.resources.configuration.paths) {
59
- project.resources.configuration.paths = {};
60
- }
61
- if (!project.resources.configuration.paths.src) {
62
- project.resources.configuration.paths.src = "src";
63
- }
64
- if (!project.resources.configuration.paths.test) {
65
- project.resources.configuration.paths.test = "test";
66
- }
67
-
68
- const absoluteSrcPath = path.join(project.path, project.resources.configuration.paths.src);
69
- const absoluteTestPath = path.join(project.path, project.resources.configuration.paths.test);
70
- return Promise.all([
71
- this.dirExists(absoluteSrcPath).then(function(bExists) {
72
- if (!bExists) {
73
- throw new Error(`Could not find source directory of project ${project.id}: ` +
74
- `${absoluteSrcPath}`);
75
- }
76
- }),
77
- this.dirExists(absoluteTestPath).then(function(bExists) {
78
- if (!bExists) {
79
- log.verbose(`Could not find (optional) test directory of project ${project.id}: ` +
80
- `${absoluteTestPath}`);
81
- // Current signal to following consumers that "test" is not available is null
82
- project.resources.configuration.paths.test = null;
83
- }
84
- })
85
- ]);
86
- });
87
- }
88
- }
89
-
90
- module.exports = ThemeLibraryFormatter;
@@ -1,15 +0,0 @@
1
- const ThemeLibraryFormatter = require("./ThemeLibraryFormatter");
2
- const ThemeLibraryBuilder = require("./ThemeLibraryBuilder");
3
-
4
- module.exports = {
5
- format: function(project) {
6
- return new ThemeLibraryFormatter({project}).format();
7
- },
8
- build: function({resourceCollections, tasks, project, parentLogger, taskUtil}) {
9
- return new ThemeLibraryBuilder({resourceCollections, project, parentLogger, taskUtil}).build(tasks);
10
- },
11
-
12
- // Export type classes for extensibility
13
- Builder: ThemeLibraryBuilder,
14
- Formatter: ThemeLibraryFormatter
15
- };
@@ -1,46 +0,0 @@
1
- const applicationType = require("./application/applicationType");
2
- const libraryType = require("./library/libraryType");
3
- const themeLibraryType = require("./themeLibrary/themeLibraryType");
4
- const moduleType = require("./module/moduleType");
5
-
6
- const types = {
7
- "application": applicationType,
8
- "library": libraryType,
9
- "theme-library": themeLibraryType,
10
- "module": moduleType
11
- };
12
-
13
- /**
14
- * Gets a type
15
- *
16
- * @param {string} typeName unique identifier for the type
17
- * @returns {object} type identified by name
18
- * @throws {Error} if not found
19
- */
20
- function getType(typeName) {
21
- const type = types[typeName];
22
-
23
- if (!type) {
24
- throw new Error("Unknown type '" + typeName + "'");
25
- }
26
- return type;
27
- }
28
-
29
- /**
30
- * Adds a type
31
- *
32
- * @param {string} typeName unique identifier for the type
33
- * @param {object} type
34
- * @throws {Error} if duplicate with same name was found
35
- */
36
- function addType(typeName, type) {
37
- if (types[typeName]) {
38
- throw new Error("Type already registered '" + typeName + "'");
39
- }
40
- types[typeName] = type;
41
- }
42
-
43
- module.exports = {
44
- getType: getType,
45
- addType: addType
46
- };