@ui5/builder 2.11.5 → 3.0.0-alpha.10

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 (70) hide show
  1. package/CHANGELOG.md +125 -12
  2. package/index.js +4 -59
  3. package/jsdoc.json +0 -1
  4. package/lib/lbt/analyzer/JSModuleAnalyzer.js +31 -5
  5. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  6. package/lib/lbt/bundle/AutoSplitter.js +10 -24
  7. package/lib/lbt/bundle/Builder.js +367 -168
  8. package/lib/lbt/bundle/BundleWriter.js +17 -0
  9. package/lib/lbt/bundle/Resolver.js +3 -3
  10. package/lib/lbt/resources/LocatorResource.js +7 -9
  11. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  12. package/lib/lbt/resources/Resource.js +7 -0
  13. package/lib/lbt/resources/ResourceCollector.js +43 -18
  14. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  15. package/lib/lbt/resources/ResourcePool.js +7 -6
  16. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  17. package/lib/lbt/utils/parseUtils.js +1 -1
  18. package/lib/processors/bundlers/moduleBundler.js +42 -17
  19. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  20. package/lib/processors/jsdoc/lib/transformApiJson.js +7 -16
  21. package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
  22. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  23. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  24. package/lib/processors/manifestCreator.js +8 -45
  25. package/lib/processors/minifier.js +90 -0
  26. package/lib/processors/resourceListCreator.js +2 -16
  27. package/lib/tasks/buildThemes.js +1 -1
  28. package/lib/tasks/bundlers/generateBundle.js +82 -14
  29. package/lib/tasks/bundlers/generateComponentPreload.js +31 -17
  30. package/lib/tasks/bundlers/generateFlexChangesBundle.js +7 -3
  31. package/lib/tasks/bundlers/generateLibraryPreload.js +127 -79
  32. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  33. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +54 -15
  34. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  35. package/lib/tasks/generateCachebusterInfo.js +7 -3
  36. package/lib/tasks/generateLibraryManifest.js +6 -8
  37. package/lib/tasks/generateResourcesJson.js +15 -9
  38. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  39. package/lib/tasks/generateVersionInfo.js +5 -5
  40. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  41. package/lib/tasks/minify.js +41 -0
  42. package/lib/tasks/replaceVersion.js +1 -1
  43. package/lib/tasks/taskRepository.js +7 -15
  44. package/lib/tasks/transformBootstrapHtml.js +6 -1
  45. package/package.json +20 -19
  46. package/lib/builder/BuildContext.js +0 -39
  47. package/lib/builder/ProjectBuildContext.js +0 -55
  48. package/lib/builder/builder.js +0 -420
  49. package/lib/processors/debugFileCreator.js +0 -52
  50. package/lib/processors/resourceCopier.js +0 -24
  51. package/lib/processors/uglifier.js +0 -45
  52. package/lib/tasks/TaskUtil.js +0 -160
  53. package/lib/tasks/createDebugFiles.js +0 -30
  54. package/lib/tasks/uglify.js +0 -33
  55. package/lib/types/AbstractBuilder.js +0 -270
  56. package/lib/types/AbstractFormatter.js +0 -66
  57. package/lib/types/AbstractUi5Formatter.js +0 -95
  58. package/lib/types/application/ApplicationBuilder.js +0 -220
  59. package/lib/types/application/ApplicationFormatter.js +0 -227
  60. package/lib/types/application/applicationType.js +0 -15
  61. package/lib/types/library/LibraryBuilder.js +0 -237
  62. package/lib/types/library/LibraryFormatter.js +0 -519
  63. package/lib/types/library/libraryType.js +0 -15
  64. package/lib/types/module/ModuleBuilder.js +0 -7
  65. package/lib/types/module/ModuleFormatter.js +0 -54
  66. package/lib/types/module/moduleType.js +0 -15
  67. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -62
  68. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  69. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  70. package/lib/types/typeRepository.js +0 -46
@@ -3,6 +3,37 @@ const log = require("@ui5/logger").getLogger("builder:tasks:generateThemeDesigne
3
3
  const libraryLessGenerator = require("../processors/libraryLessGenerator");
4
4
  const {ReaderCollectionPrioritized, Resource, fsInterface} = require("@ui5/fs");
5
5
 
6
+ /**
7
+ * Returns a relative path from the given themeFolder to the root namespace.
8
+ *
9
+ * When combining the given themeFolder with the returned relative path it
10
+ * resolves to "/resources/". However the "/resources/" part is not important
11
+ * here as it doesn't exist within the theming engine environment where the
12
+ * UI5 resources are part of a "UI5" folder (e.g. "UI5/sap/ui/core/") that
13
+ * is next to a "Base" folder.
14
+ *
15
+ * @example
16
+ * getPathToRoot("/resources/sap/ui/foo/themes/base")
17
+ * > "../../../../../"
18
+ *
19
+ * @param {string} themeFolder Virtual path including /resources/
20
+ * @returns {string} Relative path to root namespace
21
+ */
22
+ function getPathToRoot(themeFolder) {
23
+ // -2 for initial "/"" and "resources/"
24
+ return "../".repeat(themeFolder.split("/").length - 2);
25
+ }
26
+
27
+ /**
28
+ * Generates an less import statement for the given <code>filePath</code>
29
+ *
30
+ * @param {string} filePath The path to the desired file
31
+ * @returns {string} The less import statement
32
+ */
33
+ function lessImport(filePath) {
34
+ return `@import "${filePath}";\n`;
35
+ }
36
+
6
37
  function generateLibraryDotTheming({namespace, version, hasThemes}) {
7
38
  const dotTheming = {
8
39
  sEntity: "Library",
@@ -80,6 +111,83 @@ async function generateThemeDotTheming({workspace, combo, themeFolder}) {
80
111
  return newDotThemingResource;
81
112
  }
82
113
 
114
+ async function createCssVariablesLessResource({workspace, combo, themeFolder}) {
115
+ const pathToRoot = getPathToRoot(themeFolder);
116
+ const cssVariablesSourceLessFile = "css_variables.source.less";
117
+ const cssVariablesLessFile = "css_variables.less";
118
+
119
+ // posix as it is a virtual path (separated with /)
120
+ const themeName = posixPath.basename(themeFolder);
121
+ // The "base" theme of the baseLib is called "baseTheme"
122
+ const baseLibThemeName = themeName === "base" ? "baseTheme" : themeName;
123
+
124
+ // Some themes do not have a base.less file (e.g. sap_hcb)
125
+ const hasBaseLess = !!(await combo.byPath(`/resources/sap/ui/core/themes/${themeName}/base.less`));
126
+
127
+ let cssVariablesLess =
128
+ `/* NOTE: This file was generated as an optimized version of "${cssVariablesSourceLessFile}" \
129
+ for the Theme Designer. */\n\n`;
130
+
131
+ if (themeName !== "base") {
132
+ const cssVariablesSourceLessResource = await workspace.byPath(
133
+ posixPath.join(themeFolder, cssVariablesSourceLessFile)
134
+ );
135
+
136
+ if (!cssVariablesSourceLessResource) {
137
+ throw new Error(`Could not find file "${cssVariablesSourceLessFile}" in theme "${themeFolder}"`);
138
+ }
139
+
140
+ const cssVariablesSourceLess = await cssVariablesSourceLessResource.getString();
141
+
142
+ cssVariablesLess += lessImport(`../base/${cssVariablesLessFile}`);
143
+ cssVariablesLess += `
144
+ /* START "${cssVariablesSourceLessFile}" */
145
+ ${cssVariablesSourceLess}
146
+ /* END "${cssVariablesSourceLessFile}" */
147
+
148
+ `;
149
+ }
150
+
151
+ if (hasBaseLess) {
152
+ cssVariablesLess += lessImport(`${pathToRoot}../Base/baseLib/${baseLibThemeName}/base.less`);
153
+ }
154
+ cssVariablesLess += lessImport(`${pathToRoot}sap/ui/core/themes/${themeName}/global.less`);
155
+
156
+ return new Resource({
157
+ path: posixPath.join(themeFolder, cssVariablesLessFile),
158
+ string: cssVariablesLess
159
+ });
160
+ }
161
+
162
+ async function generateCssVariablesLess({workspace, combo, namespace}) {
163
+ let cssVariablesSourceLessResourcePattern;
164
+ if (namespace) {
165
+ // In case of a library only check for themes directly below the namespace
166
+ cssVariablesSourceLessResourcePattern = `/resources/${namespace}/themes/*/css_variables.source.less`;
167
+ } else {
168
+ // In case of a theme-library check for all "themes"
169
+ cssVariablesSourceLessResourcePattern = `/resources/**/themes/*/css_variables.source.less`;
170
+ }
171
+
172
+ const cssVariablesSourceLessResource = await workspace.byGlob(cssVariablesSourceLessResourcePattern);
173
+
174
+ const hasCssVariables = cssVariablesSourceLessResource.length > 0;
175
+
176
+ if (hasCssVariables) {
177
+ await Promise.all(
178
+ cssVariablesSourceLessResource.map(async (cssVariableSourceLess) => {
179
+ const themeFolder = posixPath.dirname(cssVariableSourceLess.getPath());
180
+ log.verbose(`Generating css_variables.less for theme ${themeFolder}`);
181
+ const r = await createCssVariablesLessResource({
182
+ workspace, combo, themeFolder
183
+ });
184
+ return await workspace.write(r);
185
+ })
186
+ );
187
+ }
188
+ }
189
+
190
+ /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
83
191
  /**
84
192
  * Generates resources required for integration with the SAP Theme Designer.
85
193
  *
@@ -91,11 +199,16 @@ async function generateThemeDotTheming({workspace, combo, themeFolder}) {
91
199
  * @param {object} parameters.options Options
92
200
  * @param {string} parameters.options.projectName Project name
93
201
  * @param {string} parameters.options.version Project version
94
- * @param {string} [parameters.options.namespace] If the project is of type <code>library</code>, provide its namespace.
202
+ * @param {string} [parameters.options.projectNamespace] If the project is of type <code>library</code>,
203
+ * provide its namespace.
95
204
  * Omit for type <code>theme-library</code>
96
205
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
97
206
  */
98
- module.exports = async function({workspace, dependencies, options: {projectName, version, namespace}}) {
207
+ module.exports = async function({workspace, dependencies, options}) {
208
+ const {projectName, version} = options;
209
+ // Backward compatibility: "namespace" option got renamed to "projectNamespace"
210
+ const namespace = options.projectNamespace || options.namespace;
211
+
99
212
  // Skip sap.ui.documentation since it is not intended to be available in SAP Theme Designer to create custom themes
100
213
  if (namespace === "sap/ui/documentation") {
101
214
  return;
@@ -163,4 +276,7 @@ module.exports = async function({workspace, dependencies, options: {projectName,
163
276
  await Promise.all(
164
277
  libraryLessResources.map((resource) => workspace.write(resource))
165
278
  );
279
+
280
+ // css_variables.less
281
+ await generateCssVariablesLess({workspace, combo, namespace});
166
282
  };
@@ -19,7 +19,7 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
19
19
  const resources = await dependencies.byGlob(pattern);
20
20
 
21
21
  const libraryInfosPromises = resources.map((dotLibResource) => {
22
- const namespace = dotLibResource._project.metadata.namespace;
22
+ const namespace = dotLibResource.getProject().getNamespace();
23
23
  // pass all required resources to the processor
24
24
  // the processor will then filter
25
25
  return dependencies.byGlob(`/resources/${namespace}/**/${MANIFEST_JSON}`).then((manifestResources) => {
@@ -31,8 +31,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
31
31
  return {
32
32
  libraryManifest,
33
33
  embeddedManifests,
34
- name: dotLibResource._project.metadata.name,
35
- version: dotLibResource._project.version
34
+ name: dotLibResource.getProject().getName(),
35
+ version: dotLibResource.getProject().getVersion()
36
36
  };
37
37
  });
38
38
  });
@@ -40,8 +40,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
40
40
 
41
41
  const [versionInfoResource] = await versionInfoGenerator({
42
42
  options: {
43
- rootProjectName: rootProject.metadata.name,
44
- rootProjectVersion: rootProject.version,
43
+ rootProjectName: rootProject.getName(),
44
+ rootProjectVersion: rootProject.getVersion(),
45
45
  libraryInfos
46
46
  }
47
47
  });
@@ -28,7 +28,7 @@ const {resourceFactory} = require("@ui5/fs");
28
28
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
29
29
  * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
30
30
  * @param {GenerateJsdocOptions} parameters.options Options
31
- * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
31
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
32
32
  * @param {object} [parameters.buildContext] Internal, deprecated parameter
33
33
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
34
34
  */
@@ -0,0 +1,41 @@
1
+ const minifier = require("../processors/minifier");
2
+
3
+ /**
4
+ * Task to minify resources.
5
+ *
6
+ * @public
7
+ * @alias module:@ui5/builder.tasks.minify
8
+ * @param {object} parameters Parameters
9
+ * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
10
+ * @param {module:@ui5/project.build.helpers.TaskUtil|object} [parameters.taskUtil] TaskUtil
11
+ * @param {object} parameters.options Options
12
+ * @param {string} parameters.options.pattern Pattern to locate the files to be processed
13
+ * @param {boolean} [parameters.options.omitSourceMapResources=false] Whether source map resources shall
14
+ * be tagged as "OmitFromBuildResult" and no sourceMappingURL shall be added to the minified resource
15
+ * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
16
+ */
17
+ module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = false}}) {
18
+ const resources = await workspace.byGlob(pattern);
19
+ const processedResources = await minifier({
20
+ resources,
21
+ options: {
22
+ addSourceMappingUrl: !omitSourceMapResources
23
+ }
24
+ });
25
+
26
+ return Promise.all(processedResources.map(async ({resource, dbgResource, sourceMapResource}) => {
27
+ if (taskUtil) {
28
+ taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
29
+ taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
30
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.HasDebugVariant);
31
+ if (omitSourceMapResources) {
32
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
33
+ }
34
+ }
35
+ return Promise.all([
36
+ workspace.write(resource),
37
+ workspace.write(dbgResource),
38
+ workspace.write(sourceMapResource)
39
+ ]);
40
+ }));
41
+ };
@@ -18,7 +18,7 @@ module.exports = function({workspace, options: {pattern, version}}) {
18
18
  return stringReplacer({
19
19
  resources: allResources,
20
20
  options: {
21
- pattern: "${version}",
21
+ pattern: /\$\{(?:project\.)?version\}/g,
22
22
  replacement: version
23
23
  }
24
24
  });
@@ -2,12 +2,11 @@ const taskInfos = {
2
2
  replaceCopyright: {path: "./replaceCopyright"},
3
3
  replaceVersion: {path: "./replaceVersion"},
4
4
  replaceBuildtime: {path: "./replaceBuildtime"},
5
- createDebugFiles: {path: "./createDebugFiles"},
6
5
  escapeNonAsciiCharacters: {path: "./escapeNonAsciiCharacters"},
7
6
  executeJsdocSdkTransformation: {path: "./jsdoc/executeJsdocSdkTransformation"},
8
7
  generateApiIndex: {path: "./jsdoc/generateApiIndex"},
9
8
  generateJsdoc: {path: "./jsdoc/generateJsdoc"},
10
- uglify: {path: "./uglify"},
9
+ minify: {path: "./minify"},
11
10
  buildThemes: {path: "./buildThemes"},
12
11
  transformBootstrapHtml: {path: "./transformBootstrapHtml"},
13
12
  generateLibraryManifest: {path: "./generateLibraryManifest"},
@@ -27,35 +26,28 @@ function getTask(taskName) {
27
26
  const taskInfo = taskInfos[taskName];
28
27
 
29
28
  if (!taskInfo) {
29
+ if (["createDebugFiles", "uglify"].includes(taskName)) {
30
+ throw new Error(
31
+ `Standard task ${taskName} has been removed in UI5 Tooling 3.0. ` +
32
+ `Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
33
+ }
30
34
  throw new Error(`taskRepository: Unknown Task ${taskName}`);
31
35
  }
32
36
  try {
33
37
  const task = require(taskInfo.path);
34
38
  return {
35
- task,
36
- specVersion: taskInfo.specVersion
39
+ task
37
40
  };
38
41
  } catch (err) {
39
42
  throw new Error(`taskRepository: Failed to require task module for ${taskName}: ${err.message}`);
40
43
  }
41
44
  }
42
45
 
43
- function addTask({name, specVersion, taskPath}) {
44
- if (taskInfos[name]) {
45
- throw new Error(`taskRepository: A task with the name ${name} has already been registered`);
46
- }
47
- taskInfos[name] = {
48
- path: taskPath,
49
- specVersion
50
- };
51
- }
52
-
53
46
  function getAllTaskNames() {
54
47
  return Object.keys(taskInfos);
55
48
  }
56
49
 
57
50
  module.exports = {
58
51
  getTask,
59
- addTask,
60
52
  getAllTaskNames
61
53
  };
@@ -1,6 +1,7 @@
1
1
  const log = require("@ui5/logger").getLogger("builder:tasks:transformBootstrapHtml");
2
2
  const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer");
3
3
 
4
+ /* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
4
5
  /**
5
6
  * Task for transforming the application bootstrap HTML file.
6
7
  *
@@ -12,7 +13,11 @@ const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer
12
13
  * @param {string} [parameters.options.namespace] Project namespace
13
14
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
14
15
  */
15
- module.exports = async function({workspace, options: {projectName, namespace}}) {
16
+ module.exports = async function({workspace, options}) {
17
+ const {projectName} = options;
18
+ // Backward compatibility: "namespace" option got renamed to "projectNamespace"
19
+ const namespace = options.projectNamespace || options.namespace;
20
+
16
21
  let indexPath;
17
22
  if (namespace) {
18
23
  indexPath = `/resources/${namespace}/index.html`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "2.11.5",
3
+ "version": "3.0.0-alpha.10",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -18,8 +18,8 @@
18
18
  ],
19
19
  "main": "index.js",
20
20
  "engines": {
21
- "node": ">= 10",
22
- "npm": ">= 5"
21
+ "node": ">= 16.13.2",
22
+ "npm": ">= 8"
23
23
  },
24
24
  "scripts": {
25
25
  "test": "npm run lint && npm run jsdoc-generate && npm run coverage && npm run depcheck",
@@ -34,16 +34,17 @@
34
34
  "coverage": "nyc npm run unit",
35
35
  "coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
36
36
  "jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
37
- "jsdoc-generate": "node_modules/.bin/jsdoc -c ./jsdoc.json ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
37
+ "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
38
38
  "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
39
39
  "preversion": "npm test",
40
- "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
40
+ "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
41
41
  "postversion": "git push --follow-tags",
42
- "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
43
- "depcheck": "depcheck --ignores docdash"
42
+ "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
43
+ "depcheck": "depcheck --ignores docdash --ignore-patterns lib/processors/jsdoc/lib/ui5"
44
44
  },
45
45
  "files": [
46
46
  "index.js",
47
+ "CHANGELOG.md",
47
48
  "CONTRIBUTING.md",
48
49
  "jsdoc.json",
49
50
  "lib/**",
@@ -104,37 +105,37 @@
104
105
  "url": "git@github.com:SAP/ui5-builder.git"
105
106
  },
106
107
  "dependencies": {
107
- "@ui5/fs": "^2.0.6",
108
- "@ui5/logger": "^2.0.1",
108
+ "@jridgewell/sourcemap-codec": "^1.4.14",
109
+ "@ui5/fs": "^3.0.0-alpha.6",
110
+ "@ui5/logger": "^3.0.1-alpha.2",
109
111
  "cheerio": "1.0.0-rc.9",
110
112
  "escape-unicode": "^0.2.0",
111
113
  "escope": "^3.6.0",
112
- "espree": "^6.2.1",
113
- "globby": "^11.1.0",
114
- "graceful-fs": "^4.2.10",
115
- "jsdoc": "^3.6.10",
114
+ "espree": "^9.3.1",
115
+ "graceful-fs": "^4.2.9",
116
+ "jsdoc": "^3.6.7",
116
117
  "less-openui5": "^0.11.2",
117
118
  "make-dir": "^3.1.0",
118
119
  "pretty-data": "^0.40.0",
119
- "pretty-hrtime": "^1.0.3",
120
120
  "replacestream": "^4.0.3",
121
121
  "rimraf": "^3.0.2",
122
- "semver": "^7.3.7",
123
- "terser": "^5.13.1",
122
+ "semver": "^7.3.5",
123
+ "terser": "^5.14.2",
124
124
  "xml2js": "^0.4.23",
125
125
  "yazl": "^2.5.1"
126
126
  },
127
127
  "devDependencies": {
128
+ "@ui5/project": "^3.0.0-alpha.7",
128
129
  "ava": "^3.15.0",
129
- "chai": "^4.3.6",
130
+ "chai": "^4.3.4",
130
131
  "chai-fs": "^2.0.0",
131
132
  "chokidar-cli": "^3.0.0",
132
133
  "cross-env": "^7.0.3",
133
134
  "depcheck": "^1.4.3",
134
135
  "docdash": "^1.2.0",
135
- "eslint": "^7.32.0",
136
+ "eslint": "^8.7.0",
136
137
  "eslint-config-google": "^0.14.0",
137
- "eslint-plugin-jsdoc": "^37.9.7",
138
+ "eslint-plugin-jsdoc": "^37.6.3",
138
139
  "extract-zip": "^2.0.1",
139
140
  "mock-require": "^3.0.3",
140
141
  "nyc": "^15.1.0",
@@ -1,39 +0,0 @@
1
- const ProjectBuildContext = require("./ProjectBuildContext");
2
-
3
- /**
4
- * Context of a build process
5
- *
6
- * @private
7
- * @memberof module:@ui5/builder.builder
8
- */
9
- class BuildContext {
10
- constructor({rootProject}) {
11
- if (!rootProject) {
12
- throw new Error(`Missing parameter 'rootProject'`);
13
- }
14
- this.rootProject = rootProject;
15
- this.projectBuildContexts = [];
16
- }
17
-
18
- getRootProject() {
19
- return this.rootProject;
20
- }
21
-
22
- createProjectContext({project, resources}) {
23
- const projectBuildContext = new ProjectBuildContext({
24
- buildContext: this,
25
- project,
26
- resources
27
- });
28
- this.projectBuildContexts.push(projectBuildContext);
29
- return projectBuildContext;
30
- }
31
-
32
- async executeCleanupTasks() {
33
- await Promise.all(this.projectBuildContexts.map((ctx) => {
34
- return ctx.executeCleanupTasks();
35
- }));
36
- }
37
- }
38
-
39
- module.exports = BuildContext;
@@ -1,55 +0,0 @@
1
- const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
2
-
3
- // Note: When adding standard tags, always update the public documentation in TaskUtil
4
- // (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
5
- const STANDARD_TAGS = Object.freeze({
6
- OmitFromBuildResult: "ui5:OmitFromBuildResult",
7
- IsBundle: "ui5:IsBundle"
8
- });
9
-
10
- /**
11
- * Build context of a single project. Always part of an overall
12
- * [Build Context]{@link module:@ui5/builder.builder.BuildContext}
13
- *
14
- * @private
15
- * @memberof module:@ui5/builder.builder
16
- */
17
- class ProjectBuildContext {
18
- constructor({buildContext, project, resources}) {
19
- if (!buildContext || !project || !resources) {
20
- throw new Error(`One or more mandatory parameters are missing`);
21
- }
22
- this._buildContext = buildContext;
23
- this._project = project;
24
- // this.resources = resources;
25
- this.queues = {
26
- cleanup: []
27
- };
28
-
29
- this.STANDARD_TAGS = STANDARD_TAGS;
30
-
31
- this._resourceTagCollection = new ResourceTagCollection({
32
- allowedTags: Object.values(this.STANDARD_TAGS)
33
- });
34
- }
35
-
36
- isRootProject() {
37
- return this._project === this._buildContext.getRootProject();
38
- }
39
-
40
- registerCleanupTask(callback) {
41
- this.queues.cleanup.push(callback);
42
- }
43
-
44
- async executeCleanupTasks() {
45
- await Promise.all(this.queues.cleanup.map((callback) => {
46
- return callback();
47
- }));
48
- }
49
-
50
- getResourceTagCollection() {
51
- return this._resourceTagCollection;
52
- }
53
- }
54
-
55
- module.exports = ProjectBuildContext;