[FEATURE] XMLTemplateAnalyzer: Support core:require#304
Conversation
Starting with UI5 1.69, a core:require attribute can be used in XML views/fragments to require modules/controls to be used within the XML context. UI5/openui5@2dab48e This change supports detecting those modules to be included in bundles.
lib/lbt/utils/JSTokenizer.js
Outdated
| this.next(); | ||
| }; | ||
|
|
||
| // /** |
There was a problem hiding this comment.
Wouldn't it be possible to exclude the file from the JSDoc build of the tooling? At least this would simplify regular updates...
Well, the modification of the module definition remains necessary anyhow.
There was a problem hiding this comment.
Yes, that's right.
I mainly wanted to get npm test working and discuss the re-use/integration of JSTokenizer beforehand.
| log.error("Require attribute can't be parsed on Node: ", node.$ns.local); | ||
| throw e; | ||
| } | ||
| if (requireContext) { |
There was a problem hiding this comment.
in the runtime code, we have added some validation for the object literal (keys must be simple identifiers, values must be string literals). At least for the requireJsName, a check for string literal might make sense...
There was a problem hiding this comment.
Good point 👍
Tests for those cases should also be added.
codeworrior
left a comment
There was a problem hiding this comment.
Core change is fine with me, just some wording complaints in the test.
| const sinon = require("sinon"); | ||
|
|
||
| test("integration: Analysis of an xml view", async (t) => { | ||
| test("integration: Analysis of a xml view", async (t) => { |
There was a problem hiding this comment.
AFAIK, "an" has to be used whenever the next following word starts with a vocal when spoken, not when written. And "XML" is spoken "EX M L". Much like "SAP" is spoken "ESS AY PEE". That's why we also write "an sap.m.Button".
There was a problem hiding this comment.
Actually didn't know that, thanks 👍
| }); | ||
|
|
||
| test("integration: Analysis of an xml view with data binding in properties", async (t) => { | ||
| test("integration: Analysis of a xml view with data binding in properties", async (t) => { |
| }); | ||
|
|
||
| test("integration: Analysis of an xml fragment", async (t) => { | ||
| test("integration: Analysis of a xml view with core:require", async (t) => { |
| "Implicit dependency should be added since an XMLView is analyzed"); | ||
| }); | ||
|
|
||
| test("integration: Analysis of a xml view with core:require (parsing error)", async (t) => { |
| "Implicit dependency should be added since an XMLView is analyzed"); | ||
| }); | ||
|
|
||
| test("integration: Analysis of a xml view with core:require (invalid module name)", async (t) => { |
| "Implicit dependency should be added since an XMLView is analyzed"); | ||
| }); | ||
|
|
||
| test("integration: Analysis of a xml fragment", async (t) => { |
|
|
||
| oTokenizer2.init("{='other foo'}"); | ||
| t.true(oTokenizer2.getIndex() !== oTokenizer.getIndex(), "different instances"); | ||
| }); |
There was a problem hiding this comment.
Nice that you test it in NodeJS again - makes sense.
…-builder#304) Starting with UI5 1.69, a core:require attribute can be used in XML views/fragments to require modules/controls to be used within the XML context. UI5/openui5@2dab48e This change supports detecting those modules to be included in bundles.
Starting with UI5 1.69, a core:require attribute can be used in XML
views/fragments to require modules/controls to be used within the XML
context.
UI5/openui5@2dab48e
This change supports detecting those modules to be included in bundles.
Open Issues