@ui5/builder 3.0.0-beta.4 → 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,7 +2,16 @@
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.4...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
+
6
15
 
7
16
  <a name="v3.0.0-beta.4"></a>
8
17
  ## [v3.0.0-beta.4] - 2022-12-01
@@ -816,6 +825,7 @@ to load the custom bundle file instead.
816
825
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
817
826
 
818
827
 
828
+ [v3.0.0-beta.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.4...v3.0.0-beta.5
819
829
  [v3.0.0-beta.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.3...v3.0.0-beta.4
820
830
  [v3.0.0-beta.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.2...v3.0.0-beta.3
821
831
  [v3.0.0-beta.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.1...v3.0.0-beta.2
@@ -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
  };
@@ -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.4",
3
+ "version": "3.0.0-beta.5",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -127,13 +127,12 @@
127
127
  "espree": "^9.4.1",
128
128
  "graceful-fs": "^4.2.10",
129
129
  "jsdoc": "^3.6.11",
130
- "less-openui5": "^0.11.4",
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": {
@@ -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
  }