@ui5/builder 3.0.0-beta.4 → 3.0.0-beta.6
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,19 @@
|
|
|
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.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.6...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-beta.6"></a>
|
|
8
|
+
## [v3.0.0-beta.6] - 2022-12-13
|
|
9
|
+
|
|
10
|
+
<a name="v3.0.0-beta.5"></a>
|
|
11
|
+
## [v3.0.0-beta.5] - 2022-12-12
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
- **generateJsDoc:** Remove internal 'buildContext' parameter [`4ec80c8`](https://github.com/SAP/ui5-builder/commit/4ec80c874e177b658b1cd819431b6cb0660ded87)
|
|
14
|
+
|
|
15
|
+
### Dependency Updates
|
|
16
|
+
- Bump less-openui5 from 0.11.4 to 0.11.5 [`bf46354`](https://github.com/SAP/ui5-builder/commit/bf463541b7651db1dee167057eddc94181f5c1da)
|
|
17
|
+
|
|
6
18
|
|
|
7
19
|
<a name="v3.0.0-beta.4"></a>
|
|
8
20
|
## [v3.0.0-beta.4] - 2022-12-01
|
|
@@ -816,6 +828,8 @@ to load the custom bundle file instead.
|
|
|
816
828
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
817
829
|
|
|
818
830
|
|
|
831
|
+
[v3.0.0-beta.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.5...v3.0.0-beta.6
|
|
832
|
+
[v3.0.0-beta.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.4...v3.0.0-beta.5
|
|
819
833
|
[v3.0.0-beta.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.3...v3.0.0-beta.4
|
|
820
834
|
[v3.0.0-beta.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.2...v3.0.0-beta.3
|
|
821
835
|
[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
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
-
|
|
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
|
|
108
|
+
await mkdir(sourcePath, {recursive: true});
|
|
115
109
|
const targetPath = path.join(tmpDirPath, "target"); // dir will be created by jsdoc itself
|
|
116
|
-
await
|
|
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
|
|
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
|
|
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}-`));
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
import {createRequire} from "node:module";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Repository providing access to all UI5 Builder tasks and various metadata required by the build process.
|
|
5
|
+
* This module is designed to be imported by @ui5/project or to be passed as a private parameter
|
|
6
|
+
* to the <code>build</code> function of a [@ui5/project/graph/ProjectGraph]{@link @ui5/project/graph/ProjectGraph}.
|
|
7
|
+
*
|
|
8
|
+
* For other use cases, it is recommended to import the required tasks directly.
|
|
9
|
+
*
|
|
10
|
+
* Therefore, all API of this module is private.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
* @module @ui5/builder/tasks/taskRepository
|
|
14
|
+
*/
|
|
15
|
+
|
|
1
16
|
const taskInfos = {
|
|
2
17
|
replaceCopyright: {path: "./replaceCopyright.js"},
|
|
3
18
|
replaceVersion: {path: "./replaceVersion.js"},
|
|
@@ -21,11 +36,29 @@ const taskInfos = {
|
|
|
21
36
|
generateCachebusterInfo: {path: "./generateCachebusterInfo.js"}
|
|
22
37
|
};
|
|
23
38
|
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* TaskInfo object returned by the getTask function
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
* @typedef {object} @ui5/builder/tasks/taskRepository~TaskInfo
|
|
45
|
+
* @property {Function} task Task function
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns the module for a given task name
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
* @static
|
|
53
|
+
* @param {string} taskName Name of the task to retrieve
|
|
54
|
+
* @throws {Error} In case the specified task does not exist
|
|
55
|
+
* @returns {Promise<@ui5/builder/tasks/taskRepository~TaskInfo>} Object containing the task module
|
|
56
|
+
*/
|
|
24
57
|
export async function getTask(taskName) {
|
|
25
58
|
const taskInfo = taskInfos[taskName];
|
|
26
59
|
|
|
27
60
|
if (!taskInfo) {
|
|
28
|
-
if (
|
|
61
|
+
if (getRemovedTaskNames().includes(taskName)) {
|
|
29
62
|
throw new Error(
|
|
30
63
|
`Standard task ${taskName} has been removed in UI5 Tooling 3.0. ` +
|
|
31
64
|
`Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
|
|
@@ -42,6 +75,54 @@ export async function getTask(taskName) {
|
|
|
42
75
|
}
|
|
43
76
|
}
|
|
44
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Returns a list of the names of all available tasks
|
|
80
|
+
*
|
|
81
|
+
* @private
|
|
82
|
+
* @static
|
|
83
|
+
* @returns {string[]} Array containing the names of all available tasks
|
|
84
|
+
*/
|
|
45
85
|
export function getAllTaskNames() {
|
|
46
86
|
return Object.keys(taskInfos);
|
|
47
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns a list of the names of all tasks that have been removed
|
|
91
|
+
* in this or previous versions of ui5-builder.
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
* @static
|
|
95
|
+
* @returns {string[]} Array containing the names of all removed tasks
|
|
96
|
+
*/
|
|
97
|
+
export function getRemovedTaskNames() {
|
|
98
|
+
return ["createDebugFiles", "uglify", "generateManifestBundle"];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Using CommonsJS require as importing json files causes an ExperimentalWarning
|
|
102
|
+
const require = createRequire(import.meta.url);
|
|
103
|
+
function getVersion(pkg) {
|
|
104
|
+
return require(`${pkg}/package.json`).version;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Object containing the versions of the ui5-builder module and relevant dependencies
|
|
109
|
+
*
|
|
110
|
+
* @private
|
|
111
|
+
* @typedef {object} @ui5/builder/tasks/taskRepository~Versions
|
|
112
|
+
* @property {string} builderVersion Version of the ui5-builder module
|
|
113
|
+
* @property {string} fsVersion Version of the ui5-fs module in use
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Provides version information on all relevant modules, used by ui5-builder
|
|
118
|
+
*
|
|
119
|
+
* @private
|
|
120
|
+
* @static
|
|
121
|
+
* @returns {@ui5/builder/tasks/taskRepository~Versions} Object containing version information
|
|
122
|
+
*/
|
|
123
|
+
export async function getVersions() {
|
|
124
|
+
return {
|
|
125
|
+
builderVersion: getVersion("@ui5/builder"),
|
|
126
|
+
fsVersion: getVersion("@ui5/fs"),
|
|
127
|
+
};
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/builder",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.6",
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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": "^
|
|
156
|
+
"sinon": "^15.0.0",
|
|
158
157
|
"tap-nyan": "^1.1.0",
|
|
159
158
|
"tap-xunit": "^2.4.1"
|
|
160
159
|
}
|