Brighterscript
A superset of Roku's BrightScript language
Install / Use
/learn @rokucommunity/BrighterscriptREADME
BrighterScript
A superset of Roku's BrightScript language. Compiles to standard BrightScript.
Overview
The BrighterScript language provides new features and syntax enhancements to Roku's BrightScript language. Because the language is a superset of BrightScript, the parser and associated tools (VSCode integration, cli, etc...) work with standard BrightScript (.brs) files. This means you will get benefits (as described in the following section) from using the BrighterScript compiler, whether your project contains BrighterScript (.bs) files or not. The BrighterScript language transpiles to standard BrightScript, so your code is fully compatible with all roku devices.
Help!
[!IMPORTANT] We are currently seeking testers for two major rewrites:
-
Language Server Protocol (LSP) Rewrite: We’ve been hard at work revamping our LSP to improve stability, performance, and add new features. We would love your feedback as you put it through its paces. (Join the LSP discussion)
-
Version 1 (v1) Rewrite: This is a complete overhaul of the core of our project. Your input is crucial in helping us identify bugs and further refine the release. (Join the v1 discussion)
If you're interested in helping, please visit the GitHub discussion links above for more information and instructions on how to get involved.
Features
BrighterScript adds several new features to the BrightScript language such as namespaces, classes, import statements, and more. Take a look at the language specification docs for more information.
BrighterScript Language Specification
Why use the BrighterScript compiler/CLI?
- Check the entire project for syntax and program errors without needing to run on an actual Roku device.
- Catch syntax and program errors at compile time which would not otherwise appear until runtime.
- The compiler can be used as part of your tool-chains, such as continuous integration or a custom build pipeline.
- Get real-time syntax validation by using the cli in
--watchmode.
Why use the BrighterScript language?
-
Brighterscript is in good hands:
- The project is open source.
- Brighterscript is designed by Roku developers, for Roku developers.
- The project is owned by RokuCommunity and the syntax and features are thoroughly thought out, discussed, and planned.
- Actively developed.
-
Reduce boilerplate code and time debugging with language features like these:
- Import statements
- Declare import statements in scripts instead of xml script tags.
- Automatically add script tags to XML components for all script import statements and their cascading dependencies
- Missing imports are flagged at compile time.
- Classes
- Support for class inheritance and method overrides
- Class fields and can be marked as
public,protected, andprivateand incorrect access will be enforced by compile-time checks. - Class methods are automatically scoped to the class
- Namespaces:
- Automatically add a name prefix to all methods inside a namespace block.
- Prevents method naming collisions and improves code readability and maintainability.
- Missing method invocations, and other namespace related syntax errors are reported at compile time.
- Ternary operator
username = m.user <> invalid ? m.user.name : "not logged in"
- Template strings
print `Hello ${firstNameVar}`.
- null-coalescing operator
user = m.user ?? getDefaultUser()
- Additional Language features coming soon
- null-conditional operator:
userSettings = m.user?.account?.profile?.settings
- null-conditional operator:
- and more...
- Import statements
-
Full BrighterScript support for syntax checking, validation, and intellisense is available within the Brightscript Language VSCode extension.
-
Configure the language server behavior using language server settings.
-
And if it's not enough, the plugin API allows extending the compiler to provide extra diagnostics or transformations.
Who uses Brighterscript?
<br/> <p align="center"> <a href="https://www.fubo.tv/"> <img height="38" src="https://user-images.githubusercontent.com/2544493/192530108-eb470b85-e687-4575-af69-254aab13428c.png"> </a> <a href="mailto:chris@inverted-solutions.com"> <img height="38" src="https://user-images.githubusercontent.com/2544493/197794500-2bac4903-ed00-463a-b243-24c68fba7962.png"> </a> <a href="https://www.applicaster.com/"> <img height="38" src="https://user-images.githubusercontent.com/2544493/192591901-20441fc8-3c6c-45ea-8851-b22430e6fb8e.png"> </a> <a href="https://www.redspace.com/"> <img height="38" src="https://user-images.githubusercontent.com/2544493/195908446-8d9652f8-9877-426f-b3c6-09119d788fd8.png"> </a> <br/><br/> <a href="https://tantawowa.com/"> <img height="38" src="https://user-images.githubusercontent.com/2544493/197795138-2ec870db-71fe-49e3-a014-692a3f31e6aa.png"> </a> <a href="https://www.miraclechannel.ca/corcoplus"> <img height="38" src="https://user-images.githubusercontent.com/2544493/192593254-f2a32cd4-0482-40de-830d-c1d09690c46b.png"> </a> <a href="https://digitalpictureframe.tv"> <img height="38" src="https://s3.us-east-1.wasabisys.com/tv.digitalpictureframe.assets/logo-wide.png"> </a> <a href="https://www.haystack.tv/"> <img height="38" src="https://user-images.githubusercontent.com/2544493/192610056-d1b5a382-edf4-47b9-a6a5-d2d3ee9094cb.png"> </a> <a href="https://www.tksssoftware.com/"> <img height="38" alt="TKSS Software Inc" src="https://github.com/user-attachments/assets/332d692f-7386-495d-b29d-c2ed7d3d2e2f" /> </a> </p> <br/>The BrighterScript project is used to power the popular Brightscript Language VSCode extension, the maestro framework, and more.
Contact us if you use BrighterScript in your project and would like your logo listed above. More projects are adopting BrighterScript all the time, from using the new BrighterScript language features to simply using the compiler in their build pipeline.
What's with the name?
The name BrighterScript is a compliment to everything that is great about Roku's awesome BrightScript language. Naming things is hard, and discoverability and recognizability are both very important. Here are the reasons we chose this name:
- the
erin BrighterScript represents the additional features we have added on top of BrightScript - It looks so similar to BrightScript, which is fitting because this language is 95% BrightScript, 5% extra stuff (the
erbits). - The config file and extension look very similar between BrightScript and BrighterScript. Take
bsconfig.jsonfor example. Whilebrsconfig.jsonmight be more fitting for a pure BrightScript project,bsconfig.jsonis so very close that you probably wouldn't think twice about it. Same with the fact that.bs(BrighterScript) and.brsare very similar.
We want to honor BrightScript, the language that BrighterScript is based off of, and could think of no better way than to use most of its name in our name.
Installation
npm
npm install brighterscript -g
Usage
Basic Usage
If your project structure exactly matches Roku's, and you run the command from the root of your project, then you can do the following:
bsc
That's it! It will find all files in your BrightScript project, check for syntax and static analysis errors, and if there were no errors, it will produce a zip at ./out/project.zip
Advanced Usage
If you need to confi
Related Skills
node-connect
337.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.2kCommit, push, and open a PR
