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

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.
@@ -15,22 +15,26 @@ const GLOBAL_TAGS = Object.freeze({
15
15
  * @memberof module:@ui5/builder.builder
16
16
  */
17
17
  class BuildContext {
18
- constructor({rootProject}) {
18
+ constructor({rootProject, options = {}}) {
19
19
  if (!rootProject) {
20
20
  throw new Error(`Missing parameter 'rootProject'`);
21
21
  }
22
22
  this.rootProject = rootProject;
23
23
  this.projectBuildContexts = [];
24
-
25
24
  this._resourceTagCollection = new ResourceTagCollection({
26
25
  allowedTags: Object.values(GLOBAL_TAGS)
27
26
  });
27
+ this.options = options;
28
28
  }
29
29
 
30
30
  getRootProject() {
31
31
  return this.rootProject;
32
32
  }
33
33
 
34
+ getOption(key) {
35
+ return this.options[key];
36
+ }
37
+
34
38
  createProjectContext({project, resources}) {
35
39
  const projectBuildContext = new ProjectBuildContext({
36
40
  buildContext: this,
@@ -39,6 +39,10 @@ class ProjectBuildContext {
39
39
  return this._project === this._buildContext.getRootProject();
40
40
  }
41
41
 
42
+ getOption(key) {
43
+ return this._buildContext.getOption(key);
44
+ }
45
+
42
46
  registerCleanupTask(callback) {
43
47
  this.queues.cleanup.push(callback);
44
48
  }
@@ -224,6 +224,7 @@ module.exports = {
224
224
  * @param {boolean} [parameters.dev=false]
225
225
  * Decides whether a development build should be activated (skips non-essential and time-intensive tasks)
226
226
  * @param {boolean} [parameters.selfContained=false] Flag to activate self contained build
227
+ * @param {boolean} [parameters.cssVariables=false] Flag to activate CSS variables generation
227
228
  * @param {boolean} [parameters.jsdoc=false] Flag to activate JSDoc build
228
229
  * @param {Array.<string>} [parameters.includedTasks=[]] List of tasks to be included
229
230
  * @param {Array.<string>} [parameters.excludedTasks=[]] List of tasks to be excluded.
@@ -234,7 +235,7 @@ module.exports = {
234
235
  async build({
235
236
  tree, destPath, cleanDest = false,
236
237
  buildDependencies = false, includedDependencies = [], excludedDependencies = [],
237
- dev = false, selfContained = false, jsdoc = false,
238
+ dev = false, selfContained = false, cssVariables = false, jsdoc = false,
238
239
  includedTasks = [], excludedTasks = [], devExcludeProject = []
239
240
  }) {
240
241
  const startTime = process.hrtime();
@@ -249,7 +250,12 @@ module.exports = {
249
250
  virBasePath: "/"
250
251
  });
251
252
 
252
- const buildContext = new BuildContext({rootProject: tree});
253
+ const buildContext = new BuildContext({
254
+ rootProject: tree,
255
+ options: {
256
+ cssVariables: cssVariables
257
+ }
258
+ });
253
259
  const cleanupSigHooks = registerCleanupSigHooks(buildContext);
254
260
 
255
261
  const projects = {}; // Unique project index to prevent building the same project multiple times
@@ -175,12 +175,11 @@ const EnrichedVisitorKeys = (function() {
175
175
 
176
176
  // merge with 'official' visitor keys
177
177
  Object.keys(VisitorKeys).forEach( (type) => {
178
- // Check if the visitor-key exists in the available Syntax because
179
- // the list of visitor-keys does not match the available Syntax.
180
- if (!Syntax[type]) {
181
- // Deprecated / removed:
182
- // ExperimentalRestProperty
183
- // ExperimentalSpreadProperty
178
+ // Ignore deprecated keys:
179
+ // - ExperimentalSpreadProperty => SpreadElement
180
+ // - ExperimentalRestProperty => RestElement
181
+ // They are about to be removed, see: https://github.com/eslint/eslint-visitor-keys/pull/36
182
+ if (type === "ExperimentalSpreadProperty" || type === "ExperimentalRestProperty") {
184
183
  return;
185
184
  }
186
185
  // Ignore JSX visitor-keys because they aren't used.
@@ -188,6 +187,15 @@ const EnrichedVisitorKeys = (function() {
188
187
  return;
189
188
  }
190
189
 
190
+ // Ignore new ES2022 syntax as we currently use ES2021 (see parseUtils.js)
191
+ if (
192
+ type === "PrivateIdentifier" ||
193
+ type === "PropertyDefinition" ||
194
+ type === "StaticBlock"
195
+ ) {
196
+ return;
197
+ }
198
+
191
199
  const visitorKeys = VisitorKeys[type];
192
200
  const condKeys = TempKeys[type];
193
201
  if ( condKeys === undefined ) {
@@ -231,9 +231,10 @@ class XMLTemplateAnalyzer {
231
231
  // looks like a UI5 library or package name
232
232
  const moduleName = ModuleName.fromUI5LegacyName( (namespace ? namespace + "." : "") + localName );
233
233
 
234
+ this._analyzeCoreRequire(node);
235
+
234
236
  // ignore FragmentDefinition (also skipped by runtime XMLTemplateProcessor)
235
237
  if ( FRAGMENTDEFINITION_MODULE !== moduleName ) {
236
- this._analyzeCoreRequire(node);
237
238
  this.promises.push(this._analyzeModuleDependency(node, moduleName, this.conditional));
238
239
  }
239
240
  }