@ui5/builder 3.0.0-beta.3 → 3.0.0-beta.5

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.
package/CHANGELOG.md CHANGED
@@ -2,10 +2,26 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.5...HEAD).
6
+
7
+ <a name="v3.0.0-beta.5"></a>
8
+ ## [v3.0.0-beta.5] - 2022-12-12
9
+ ### Breaking Changes
10
+ - **generateJsDoc:** Remove internal 'buildContext' parameter [`4ec80c8`](https://github.com/SAP/ui5-builder/commit/4ec80c874e177b658b1cd819431b6cb0660ded87)
11
+
12
+ ### Dependency Updates
13
+ - Bump less-openui5 from 0.11.4 to 0.11.5 [`bf46354`](https://github.com/SAP/ui5-builder/commit/bf463541b7651db1dee167057eddc94181f5c1da)
14
+
15
+
16
+ <a name="v3.0.0-beta.4"></a>
17
+ ## [v3.0.0-beta.4] - 2022-12-01
18
+ ### Dependency Updates
19
+ - Bump less-openui5 from 0.11.3 to 0.11.4 [`b7a507f`](https://github.com/SAP/ui5-builder/commit/b7a507fbc34076f5bf95f92f058fd2c58d79a455)
20
+ - Bump less-openui5 from 0.11.2 to 0.11.3 [`28e684b`](https://github.com/SAP/ui5-builder/commit/28e684b85e7eb621f210041702e2a316d1d0eb62)
21
+
6
22
 
7
23
  <a name="v3.0.0-beta.3"></a>
8
- ## [v3.0.0-beta.3] - 2022-11-29
24
+ ## [v3.0.0-beta.3] - 2022-11-30
9
25
  ### Features
10
26
  - **jsdoc:** Support destructuring of enums for defaultValue ([#775](https://github.com/SAP/ui5-builder/issues/775)) [`523f365`](https://github.com/SAP/ui5-builder/commit/523f365cb917997c5031d245309c21e9e4b3e311)
11
27
 
@@ -809,6 +825,8 @@ to load the custom bundle file instead.
809
825
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
810
826
 
811
827
 
828
+ [v3.0.0-beta.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.4...v3.0.0-beta.5
829
+ [v3.0.0-beta.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.3...v3.0.0-beta.4
812
830
  [v3.0.0-beta.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.2...v3.0.0-beta.3
813
831
  [v3.0.0-beta.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.1...v3.0.0-beta.2
814
832
  [v3.0.0-beta.1]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.12...v3.0.0-beta.1
@@ -19,7 +19,7 @@ const log = logger.getLogger("lbt:analyzer:JSModuleAnalyzer");
19
19
 
20
20
  // ------------------------------------------------------------------------------------------------------------------
21
21
 
22
- const EnrichedVisitorKeys = (function() {
22
+ export const EnrichedVisitorKeys = (function() {
23
23
  function toBeDone() {
24
24
  return null;
25
25
  }
@@ -184,36 +184,23 @@ const EnrichedVisitorKeys = (function() {
184
184
 
185
185
  // merge with 'official' visitor keys
186
186
  Object.keys(VisitorKeys).forEach( (type) => {
187
- // Ignore deprecated keys:
188
- // - ExperimentalSpreadProperty => SpreadElement
189
- // - ExperimentalRestProperty => RestElement
190
- // They are about to be removed, see: https://github.com/eslint/eslint-visitor-keys/pull/36
191
- if (type === "ExperimentalSpreadProperty" || type === "ExperimentalRestProperty") {
192
- return;
193
- }
194
- // Ignore JSX visitor-keys because they aren't used.
195
- if (type.startsWith("JSX")) {
196
- return;
197
- }
198
-
199
187
  const visitorKeys = VisitorKeys[type];
200
188
  const condKeys = TempKeys[type];
201
- if ( condKeys === undefined ) {
202
- // configuration missing in ConditionalKeys, maybe a new syntax ?
203
- throw new Error(`unknown estree node type '${type}', new syntax?`);
204
- } else if ( Array.isArray(condKeys) ) {
189
+ if ( Array.isArray(condKeys) ) {
205
190
  // check configured keys against visitor keys
206
191
  condKeys.forEach( (key) => {
207
- if ( visitorKeys.indexOf(key) < 0 ) {
192
+ if ( !visitorKeys.includes(key) ) {
208
193
  throw new Error(`configuration for type '${type}' contains unknown key '${key}'`);
209
194
  }
210
195
  });
211
196
  TempKeys[type] = visitorKeys.map( (key) => ({
212
197
  key: key,
213
- conditional: condKeys.indexOf(key) >= 0
198
+ conditional: condKeys.includes(key)
214
199
  }) );
215
- } else {
200
+ } else if (condKeys === null) {
216
201
  // this is a 'toBeDone' node type, keep null and complain at runtime when such a node occurs
202
+ } else {
203
+ // undefined => ignored node type (see JSModuleAnalyzer consistency test)
217
204
  }
218
205
  });
219
206
 
@@ -749,7 +736,7 @@ class JSModuleAnalyzer {
749
736
  const value = getStringValue(item);
750
737
  if ( value !== undefined ) {
751
738
  // ignore special AMD dependencies (require, exports, module)
752
- if ( SPECIAL_AMD_DEPENDENCIES.indexOf(value) >= 0 ) {
739
+ if ( SPECIAL_AMD_DEPENDENCIES.includes(value) ) {
753
740
  return;
754
741
  }
755
742
  let requiredModule;
@@ -3,11 +3,19 @@ import {parse} from "espree";
3
3
 
4
4
  const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
5
5
 
6
+ /*
7
+ * NOTE: After updating the ecmaVersion:
8
+ * - Adopt JSModuleAnalyzer to handle new Syntax / VisitorKeys.
9
+ * - Adjust the JSModuleAnalyzer test "Check for consistency between VisitorKeys and EnrichedVisitorKeys"
10
+ * (See comments in test for details)
11
+ */
12
+ export const ecmaVersion = 2022;
13
+
6
14
  export function parseJS(code, userOptions = {}) {
7
15
  // allowed options and their defaults
8
16
  const options = {
9
17
  comment: false,
10
- ecmaVersion: 2022, // NOTE: Adopt JSModuleAnalyzer.js to allow new Syntax when upgrading to newer ECMA versions
18
+ ecmaVersion,
11
19
  range: false,
12
20
  sourceType: "script",
13
21
  };
@@ -91,18 +91,22 @@ export default async function({workspace, dependencies, taskUtil, options}) {
91
91
  `unable to generate complete bundles for such projects.`);
92
92
  }
93
93
 
94
- let combo = new ReaderCollectionPrioritized({
94
+ const combo = new ReaderCollectionPrioritized({
95
95
  name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
96
96
  readers: [workspace, dependencies]
97
97
  });
98
98
 
99
+ let resourceReader = combo;
99
100
  if (taskUtil) {
100
101
  // Omit -dbg files
101
- combo = await combo.filter(function(resource) {
102
- return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
102
+ resourceReader = await taskUtil.resourceFactory.createFilterReader({
103
+ reader: combo,
104
+ callback: function(resource) {
105
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
106
+ }
103
107
  });
104
108
  }
105
- const resources = await combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
109
+ const resources = await resourceReader.byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
106
110
 
107
111
  const isEvo = resources.find((resource) => {
108
112
  return resource.getPath() === "/resources/ui5loader.js";
@@ -117,13 +121,16 @@ export default async function({workspace, dependencies, taskUtil, options}) {
117
121
  let unoptimizedModuleNameMapping;
118
122
  let unoptimizedResources = resources;
119
123
  if (taskUtil) {
120
- unoptimizedResources = await (await new ReaderCollectionPrioritized({
121
- name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
122
- readers: [workspace, dependencies]
123
- }).filter(function(resource) {
124
- // Remove any non-debug variants
125
- return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
126
- })).byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
124
+ const unoptimizedResourceReader = await taskUtil.resourceFactory.createFilterReader({
125
+ reader: combo,
126
+ callback: function(resource) {
127
+ // Remove any non-debug variants
128
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
129
+ }
130
+ });
131
+
132
+ unoptimizedResources = await unoptimizedResourceReader
133
+ .byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
127
134
 
128
135
  unoptimizedModuleNameMapping = createModuleNameMapping({
129
136
  resources: unoptimizedResources,
@@ -1,12 +1,12 @@
1
1
  import logger from "@ui5/logger";
2
2
  const log = logger.getLogger("builder:tasks:jsdoc:generateJsdoc");
3
3
  import path from "node:path";
4
- import makeDir from "make-dir";
5
4
  import os from "node:os";
6
5
  import fs from "graceful-fs";
7
6
  import _rimraf from "rimraf";
8
7
  import {promisify} from "node:util";
9
8
  const mkdtemp = promisify(fs.mkdtemp);
9
+ const mkdir = promisify(fs.mkdir);
10
10
  const rimraf = promisify(_rimraf);
11
11
  import jsdocGenerator from "../../processors/jsdoc/jsdocGenerator.js";
12
12
  import {createAdapter} from "@ui5/fs/resourceFactory";
@@ -38,12 +38,10 @@ import {createAdapter} from "@ui5/fs/resourceFactory";
38
38
  * @param {@ui5/fs/AbstractReader} parameters.dependencies Reader or Collection to read dependency files
39
39
  * @param {module:@ui5/builder/tasks/jsdoc/generateJsdoc~GenerateJsdocOptions} parameters.options Options
40
40
  * @param {@ui5/project/build/helpers/TaskUtil|object} [parameters.taskUtil] TaskUtil
41
- * @param {object} [parameters.buildContext] Internal, deprecated parameter
42
41
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
43
42
  */
44
43
  export default async function generateJsdoc({
45
44
  taskUtil,
46
- buildContext,
47
45
  workspace,
48
46
  dependencies,
49
47
  options = {}
@@ -58,11 +56,7 @@ export default async function generateJsdoc({
58
56
  const {sourcePath: resourcePath, targetPath, tmpPath, cleanup} =
59
57
  await utils.createTmpDirs(projectName);
60
58
 
61
- // TODO 3.0: remove buildContext
62
- const _taskUtil = taskUtil || buildContext;
63
- if (_taskUtil) {
64
- _taskUtil.registerCleanupTask(cleanup);
65
- }
59
+ taskUtil?.registerCleanupTask(cleanup);
66
60
 
67
61
  const [writtenResourcesCount] = await Promise.all([
68
62
  utils.writeResourcesToDir({
@@ -111,12 +105,12 @@ const utils = {
111
105
  const tmpDirPath = await utils.createTmpDir(projectName);
112
106
 
113
107
  const sourcePath = path.join(tmpDirPath, "src"); // dir will be created by writing project resources below
114
- await makeDir(sourcePath, {fs});
108
+ await mkdir(sourcePath, {recursive: true});
115
109
  const targetPath = path.join(tmpDirPath, "target"); // dir will be created by jsdoc itself
116
- await makeDir(targetPath, {fs});
110
+ await mkdir(targetPath, {recursive: true});
117
111
 
118
112
  const tmpPath = path.join(tmpDirPath, "tmp"); // dir needs to be created by us
119
- await makeDir(tmpPath, {fs});
113
+ await mkdir(tmpPath, {recursive: true});
120
114
 
121
115
  return {
122
116
  sourcePath,
@@ -139,7 +133,7 @@ const utils = {
139
133
  const sanitizedProjectName = projectName.replace(/[^A-Za-z0-9]/g, "");
140
134
 
141
135
  const tmpRootPath = path.join(os.tmpdir(), "ui5-tooling");
142
- await makeDir(tmpRootPath, {fs});
136
+ await mkdir(tmpRootPath, {recursive: true});
143
137
 
144
138
  // Appending minus sign also because node docs advise to "avoid trailing X characters in prefix"
145
139
  return mkdtemp(path.join(tmpRootPath, `jsdoc-${sanitizedProjectName}-`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.5",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -119,7 +119,7 @@
119
119
  },
120
120
  "dependencies": {
121
121
  "@jridgewell/sourcemap-codec": "^1.4.14",
122
- "@ui5/fs": "^3.0.0-beta.3",
122
+ "@ui5/fs": "^3.0.0-beta.4",
123
123
  "@ui5/logger": "^3.0.1-beta.1",
124
124
  "cheerio": "1.0.0-rc.12",
125
125
  "escape-unicode": "^0.2.0",
@@ -127,18 +127,17 @@
127
127
  "espree": "^9.4.1",
128
128
  "graceful-fs": "^4.2.10",
129
129
  "jsdoc": "^3.6.11",
130
- "less-openui5": "^0.11.2",
131
- "make-dir": "^3.1.0",
130
+ "less-openui5": "^0.11.5",
132
131
  "pretty-data": "^0.40.0",
133
132
  "replacestream": "^4.0.3",
134
133
  "rimraf": "^3.0.2",
135
134
  "semver": "^7.3.8",
136
- "terser": "^5.16.0",
135
+ "terser": "^5.16.1",
137
136
  "xml2js": "^0.4.23"
138
137
  },
139
138
  "devDependencies": {
140
139
  "@istanbuljs/esm-loader-hook": "^0.2.0",
141
- "@ui5/project": "^3.0.0-beta.3",
140
+ "@ui5/project": "^3.0.0-beta.4",
142
141
  "ava": "^5.1.0",
143
142
  "chai": "^4.3.7",
144
143
  "chai-fs": "^2.0.0",
@@ -146,15 +145,15 @@
146
145
  "cross-env": "^7.0.3",
147
146
  "depcheck": "^1.4.3",
148
147
  "docdash": "^2.0.0",
149
- "eslint": "^8.28.0",
148
+ "eslint": "^8.29.0",
150
149
  "eslint-config-google": "^0.14.0",
151
150
  "eslint-plugin-ava": "^13.2.0",
152
151
  "eslint-plugin-jsdoc": "^39.6.4",
153
- "esmock": "^2.0.9",
152
+ "esmock": "^2.1.0",
154
153
  "nyc": "^15.1.0",
155
154
  "open-cli": "^7.1.0",
156
155
  "recursive-readdir": "^2.2.3",
157
- "sinon": "^14.0.2",
156
+ "sinon": "^15.0.0",
158
157
  "tap-nyan": "^1.1.0",
159
158
  "tap-xunit": "^2.4.1"
160
159
  }