Support minFirmwareVersion in bsconfig.json#1678
Conversation
…e validation Agent-Logs-Url: https://github.com/rokucommunity/brighterscript/sessions/7c24c48c-8e2e-4615-9fbd-3e2231b68d4a Co-authored-by: TwitchBronBron <2544493+TwitchBronBron@users.noreply.github.com>
TwitchBronBron
left a comment
There was a problem hiding this comment.
So actually, we don't currently transpile optional chaining even in .bs files. So that feature needs to be locked behind a firmware flag for both brs and bs files. Fix that and the tests. And comments everywhere.
…s since it is not transpiled Agent-Logs-Url: https://github.com/rokucommunity/brighterscript/sessions/a5d96ac2-4cc8-40c7-a742-775cad61c763 Co-authored-by: TwitchBronBron <2544493+TwitchBronBron@users.noreply.github.com>
Fixed in 63f975f. Since optional chaining is emitted as-is (not transpiled to equivalent non-optional code), the firmware version check now applies to both |
Fixed in 63f975f. Removed the |
The CI run you linked (25012570834) is for PR #1676 ( My PR #1678's CI (commit |
Adds a
minFirmwareVersionbsconfig option that restricts which BrightScript features are permitted based on the target Roku OS version. This applies to both.brsand.bsfiles — features such as optional chaining are not transpiled by BrighterScript and are emitted as-is, so the target device must natively support them.Changes
BsConfig.ts— New optionalminFirmwareVersion?: stringproperty (semver-compatible string, e.g."11.0.0")DiagnosticMessages.ts— New diagnosticfeatureRequiresMinFirmwareVersion(code 1146)BrsFileValidator.ts— Validates optional chaining operators (?.,?[,?() in both.brsand.bsfiles against the configured version usingsemver.coerce+semver.lt; no-ops whenminFirmwareVersionis unsetbsconfig.schema.json/docs/bsconfig.md— Schema and docs updatedpackage.json—semverpromoted to explicit runtime dep;@types/semveradded as dev depExample
Optional chaining was introduced in Roku OS 11. With
minFirmwareVersion: "10.0.0":Features gated by firmware version (initial pass):
?.,?[,?()