Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAKING] Discontinue bundling of JavaScript modules as string #1036

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

flovogt
Copy link
Member

@flovogt flovogt commented Jun 24, 2024

The UI5 bundler packages JavaScript files that are identified as "requiresTopLevelScope" as a string, to be evaluated via "eval" at runtime. This behavior ensures that the script works as expected, e.g. with regards to implicit globals.
This "eval" runtime feature with be discontinued in UI5 2.0 because of security best practices (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) and to comply with stricter CSP settings (unsafe-eval).
By using specVersion 4.0 an error is thrown when bundling a module as string and the module is not included in the bundle at all.

JIRA: CPOUI5FOUNDATION-794

@flovogt flovogt force-pushed the disable-string-bundling branch 3 times, most recently from fc7d29e to b9217ff Compare June 25, 2024 09:23
@coveralls
Copy link

Coverage Status

coverage: 94.681% (+0.01%) from 94.668%
when pulling f617f0b on disable-string-bundling
into 51e2b08 on main.

@coveralls
Copy link

Coverage Status

coverage: 94.681% (+0.01%) from 94.668%
when pulling f617f0b on disable-string-bundling
into 51e2b08 on main.

@coveralls
Copy link

Coverage Status

coverage: 94.681% (+0.01%) from 94.668%
when pulling 136b40d on disable-string-bundling
into 51e2b08 on main.

@coveralls
Copy link

Coverage Status

coverage: 94.681% (+0.01%) from 94.668%
when pulling 2b4a4dc on disable-string-bundling
into 51e2b08 on main.

@coveralls
Copy link

Coverage Status

coverage: 94.645% (-0.02%) from 94.668%
when pulling 8791491 on disable-string-bundling
into 934956a on main.

@flovogt flovogt force-pushed the disable-string-bundling branch 6 times, most recently from 09b6663 to 88bcad2 Compare July 4, 2024 12:02
@coveralls
Copy link

Coverage Status

coverage: 94.668%. remained the same
when pulling 88bcad2 on disable-string-bundling
into 934956a on main.

@flovogt flovogt requested a review from codeworrior July 4, 2024 12:13
@flovogt flovogt marked this pull request as ready for review July 4, 2024 12:13
@flovogt flovogt requested a review from RandomByte July 4, 2024 12:14
@coveralls
Copy link

Coverage Status

coverage: 94.677%. remained the same
when pulling f8e4b88 on disable-string-bundling
into dfa67fe on main.

Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing some tests for the case of specVersion 4 project with resources that require bundling as string

lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
@coveralls
Copy link

Coverage Status

coverage: 94.677%. remained the same
when pulling 2781bfe on disable-string-bundling
into dfa67fe on main.

@flovogt flovogt force-pushed the disable-string-bundling branch 4 times, most recently from 6faad79 to fc4fe78 Compare July 8, 2024 11:54
@flovogt flovogt requested a review from RandomByte July 8, 2024 11:55
@flovogt
Copy link
Member Author

flovogt commented Jul 8, 2024

ui5 tooling integration tests are triggered: 534

RandomByte
RandomByte previously approved these changes Jul 8, 2024
Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flovogt flovogt force-pushed the disable-string-bundling branch 2 times, most recently from 0402336 to f94939d Compare July 9, 2024 12:45
lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
Copy link
Contributor

@KlattG KlattG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flovogt I think I've seen 'higher' more often than 'newer'.

Copy link
Contributor

@KlattG KlattG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
Copy link
Contributor

@KlattG KlattG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor point, otherwise LGTM

lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
lib/lbt/bundle/Builder.js Outdated Show resolved Hide resolved
The UI5 bundler packages JavaScript files that are identified as "requiresTopLevelScope" as a string, to be evaluated via "eval" at runtime. This behavior ensures that the script works as expected, e.g. with regards to implicit globals.
This "eval" runtime feature with be discontinued in UI5 2.0 because of security best practices (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) and to comply with stricter CSP settings (unsafe-eval).
By using specVersion 4.0 an error is thrown when bundling a module as string and the module is not included in the bundle at all.

JIRA: CPOUI5FOUNDATION-794
@flovogt flovogt requested a review from matz3 July 12, 2024 12:49
@flovogt flovogt merged commit 7691b08 into main Jul 12, 2024
6 of 16 checks passed
@flovogt flovogt deleted the disable-string-bundling branch July 12, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants