Skip to content

Commit 63b5384

Browse files
Merge branch 'master' of https://github.com/rokucommunity/brighterscript into codeAction-xml-import
2 parents b753479 + fc18a22 commit 63b5384

File tree

149 files changed

+29517
-2755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+29517
-2755
lines changed

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,14 @@ module.exports = {
209209
'@typescript-eslint/no-require-imports': 'off',
210210
'@typescript-eslint/no-var-requires': 'off'
211211
}
212+
}, {
213+
files: ['src/roku-types/data.json'],
214+
rules: {
215+
'@typescript-eslint/no-unused-expressions': 'off',
216+
'@typescript-eslint/quotes': 'off',
217+
'no-template-curly-in-string': 'off',
218+
'eol-last': 'off',
219+
'@typescript-eslint/semi': 'off'
220+
}
212221
}]
213222
};

.github/workflows/create-vsix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
issue_number: context.issue.number,
3939
owner: context.repo.owner,
4040
repo: context.repo.repo,
41-
body: 'Hey there! I just built a new version of the vscode extension based on ${{ github.event.pull_request.head.sha }}. You can downloaded the .vsix [here](${{steps.create-vsix.outputs.workflow-url}}) and then follow [these installation instructions](https://github.com/rokucommunity/vscode-brightscript-language#pre-release-versions).'
41+
body: 'Hey there! I just built a new version of the vscode extension based on ${{ github.event.pull_request.head.sha }}. You can download the .vsix [here](${{steps.create-vsix.outputs.workflow-url}}) and then follow [these installation instructions](https://github.com/rokucommunity/vscode-brightscript-language#pre-release-versions).'
4242
})

.vscode/launch.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,32 @@
4141
"resolveSourceMapLocations": [
4242
"${workspaceFolder}/**",
4343
"!**/node_modules/typescript/**",
44-
"!**/node_modules/vscode-languageserver/**"
44+
"!**/node_modules/vscode-languageserver*/**"
4545
]
4646
},
4747
{
4848
"name": "Debug Doc Generator",
49+
"type": "pwa-node",
50+
"request": "launch",
51+
"args": [
52+
"scripts/compile-doc-examples.ts"
53+
],
54+
"runtimeArgs": [
55+
"--nolazy",
56+
"-r",
57+
"ts-node/register"
58+
],
59+
"sourceMaps": true,
60+
"cwd": "${workspaceRoot}",
61+
"protocol": "inspector",
62+
"resolveSourceMapLocations": [
63+
"${workspaceFolder}/**",
64+
"!**/node_modules/typescript/**",
65+
"!**/node_modules/vscode-languageserver/**"
66+
]
67+
},
68+
{
69+
"name": "Debug Roku Docs Scraper",
4970
"type": "node",
5071
"request": "launch",
5172
"runtimeExecutable": "node",
@@ -55,7 +76,7 @@
5576
"ts-node/register/transpile-only"
5677
],
5778
"args": [
58-
"scripts/compile-doc-examples.ts"
79+
"scripts/scrape-roku-docs.ts"
5980
],
6081
"cwd": "${workspaceRoot}",
6182
"internalConsoleOptions": "openOnSessionStart",
@@ -65,4 +86,4 @@
6586
]
6687
}
6788
]
68-
}
89+
}

.vscode/tasks.json

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
"presentation": {
2424
"group": "watch"
2525
},
26-
"problemMatcher": []
26+
"isBackground": true,
27+
"problemMatcher": [
28+
"$tsc-watch"
29+
]
2730
},
2831
{
2932
"type": "npm",
@@ -41,10 +44,28 @@
4144
"test:nocover",
4245
"--silent"
4346
],
47+
"presentation": {
48+
"echo": true,
49+
"reveal": "always",
50+
"focus": true,
51+
"panel": "shared",
52+
"showReuseMessage": true,
53+
"clear": true
54+
},
4455
"group": {
4556
"kind": "test",
4657
"isDefault": true
4758
},
59+
"problemMatcher": []
60+
},
61+
{
62+
"label": "scrape-roku-docs",
63+
"type": "shell",
64+
"command": "npm",
65+
"args": [
66+
"run",
67+
"scrape-roku-docs"
68+
],
4869
"presentation": {
4970
"echo": true,
5071
"reveal": "always",
@@ -56,4 +77,4 @@
5677
"problemMatcher": []
5778
}
5879
]
59-
}
80+
}

CHANGELOG.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,133 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77

88

9+
## [0.47.3](https://github.com/rokucommunity/brighterscript/compare/v0.47.2...v0.47.3) - 2022-04-08
10+
### Fixed
11+
- accuracy issues when parsing the manifest ([#565](https://github.com/rokucommunity/brighterscript/pull/565))
12+
13+
14+
15+
## [0.47.2](https://github.com/rokucommunity/brighterscript/compare/v0.47.1...v0.47.2) - 2022-04-07
16+
### Fixed
17+
- enum transpile bug for binary expressions ([#559](https://github.com/rokucommunity/brighterscript/pull/559))
18+
- add missing `require` entry to `bsconfig.schema.json` ([#560](https://github.com/rokucommunity/brighterscript/pull/560))
19+
20+
21+
22+
## [0.47.1](https://github.com/rokucommunity/brighterscript/compare/v0.47.0...v0.47.1) - 2022-04-05
23+
### Changed
24+
- disable strict cli args to empower plugins ([#557](https://github.com/rokucommunity/brighterscript/pull/557))
25+
- don't add trailing commas in transpiled output for array and aa literals ([#556](https://github.com/rokucommunity/brighterscript/pull/556))
26+
- retain quote char when transpiling xml attributes ([#552](https://github.com/rokucommunity/brighterscript/pull/552))
27+
28+
29+
30+
## [0.47.0](https://github.com/rokucommunity/brighterscript/compare/v0.46.0...v0.47.0) - 2022-03-30
31+
### Added
32+
- `require` flag to allow loading external node modules as part of the build process (useful for things like `ts-node/register`). ([#550](https://github.com/rokucommunity/brighterscript/pull/550), [#551](https://github.com/rokucommunity/brighterscript/pull/551))
33+
34+
35+
36+
## [0.46.0](https://github.com/rokucommunity/brighterscript/compare/v0.45.6...v0.46.0) - 2022-03-24
37+
### Changed
38+
- refactored try-catch statement to make the expressions and bodies easier to access via plugins. [#514](https://github.com/rokucommunity/brighterscript/pull/514)
39+
40+
41+
42+
## [0.45.6](https://github.com/rokucommunity/brighterscript/compare/v0.45.5...v0.45.6) - 2022-03-17
43+
### Changed
44+
- upgrade to [roku-deploy@3.5.4](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#354---2022-03-17) which fixed significant performance issues during globbing. ([roku-deploy#86](https://github.com/rokucommunity/roku-deploy/pull/86))
45+
### Fixed
46+
- crash when checking for enums to transpile [#539](https://github.com/rokucommunity/brighterscript/pull/539)
47+
- Transpile if statements as written [#537](https://github.com/rokucommunity/brighterscript/pull/537)
48+
- Keep the original type case when transpiling. [#536](https://github.com/rokucommunity/brighterscript/pull/536)
49+
- Show cli usage in plugins documentation
50+
51+
52+
53+
## [0.45.5](https://github.com/rokucommunity/brighterscript/compare/v0.45.4...v0.45.5) - 2022-03-10
54+
### Fixed
55+
- bug with typedefs and auto-generated class constructor functions [#535](https://github.com/rokucommunity/brighterscript/pull/535)
56+
57+
58+
59+
## [0.45.4](https://github.com/rokucommunity/brighterscript/compare/v0.45.3...v0.45.4) - 2022-03-08
60+
### Fixed
61+
- bug that wasn't computing ownScriptImports after calling `invalidateReferences()` [#529](https://github.com/rokucommunity/brighterscript/pull/529)
62+
- bug with logger.time() not having accurate timings when run asynchronously [#532](https://github.com/rokucommunity/brighterscript/pull/532)
63+
64+
65+
66+
## [0.45.3](https://github.com/rokucommunity/brighterscript/compare/v0.45.2...v0.45.3) - 2022-02-25
67+
### Fixed
68+
- source map bug with plugins that used the AST node creation functions depending on `interpolatedRange`. [#528](https://github.com/rokucommunity/brighterscript/pull/528)
69+
70+
71+
72+
## [0.45.2](https://github.com/rokucommunity/brighterscript/compare/v0.45.1...v0.45.2) - 2022-02-24
73+
### Changed
74+
- add default token values in creators. [#520](https://github.com/rokucommunity/brighterscript/pull/520)
75+
### Fixed
76+
- significant memory leak [#527](https://github.com/rokucommunity/brighterscript/pull/527)
77+
- bug with transpiling empty for loop [#519](https://github.com/rokucommunity/brighterscript/pull/519)
78+
79+
80+
81+
## [0.45.1](https://github.com/rokucommunity/brighterscript/compare/v0.45.0...v0.45.1) - 2022-02-16
82+
### Changed
83+
- upgrade to [roku-deploy@3.5.3](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#353---2022-02-16) which fixed a missing typescript definition issue.
84+
85+
86+
87+
## [0.45.0](https://github.com/rokucommunity/brighterscript/compare/v0.44.0...v0.45.0) - 2022-02-11
88+
### Added
89+
- `enum` language feature ([#484](https://github.com/rokucommunity/brighterscript/pull/484))
90+
- transpile override for plugins when providing AST edits. ([#511](https://github.com/rokucommunity/brighterscript/pull/511))
91+
- `setFile` method to align with v1. ([#510](https://github.com/rokucommunity/brighterscript/pull/510))
92+
### Changed
93+
- deprecated `addOrReplaceFile` method to align with v1. ([#510](https://github.com/rokucommunity/brighterscript/pull/510))
94+
- internal `Cache` method now extends `Map` instead of keeping an internal map. ([#509](https://github.com/rokucommunity/brighterscript/pull/509))
95+
96+
97+
98+
## [0.44.0](https://github.com/rokucommunity/brighterscript/compare/v0.43.1...v0.44.0) - 2022-02-08
99+
### Added
100+
- `onScopeValidate` plugin event useful when plugins want to contribute scope validations ([#505](https://github.com/rokucommunity/brighterscript/pull/505))
101+
### Changed
102+
- show plugin transpile modifications in the `getTranspiledFile` callback (used for "show preview" functionality in vscode) ([#502](https://github.com/rokucommunity/brighterscript/pull/502))
103+
- make `Program.getFile` more flexible, and deprecate `Program.getFileByPkgPath`, `Program.getFileByPathAbsolute` ([#506](https://github.com/rokucommunity/brighterscript/pull/506))
104+
- add `Program.getFiles` and deprecate `Program.getFilesByPkgPath` ([#506](https://github.com/rokucommunity/brighterscript/pull/506))
105+
- move file validation plugin event emitting into `Program.validate()` which means you can't trigger those events by calling `File.validate()` anymore. ([#504](https://github.com/rokucommunity/brighterscript/pull/504))
106+
- support generics for `Cache` class ([#503](https://github.com/rokucommunity/brighterscript/pull/503))
107+
### Fixed
108+
- bug in hover showing required params as optional and optional params as required ([#501](https://github.com/rokucommunity/brighterscript/pull/501))
109+
110+
111+
112+
## [0.43.1](https://github.com/rokucommunity/brighterscript/compare/v0.43.0...v0.43.1) - 2022-01-28
113+
### Fixed
114+
- crash when hovering over global functions ([#497](https://github.com/rokucommunity/brighterscript/pull/497))
115+
116+
117+
118+
## [0.43.0](https://github.com/rokucommunity/brighterscript/compare/v0.42.0...v0.43.0) - 2022-01-28
119+
### Added
120+
- show function documentation when hovering over functions. ([#495](https://github.com/rokucommunity/brighterscript/pull/495))
121+
- for plugin authors:
122+
- added `beforeFileValidate` and `onFileValidate` plugin hooks ([#490](https://github.com/rokucommunity/brighterscript/pull/490))
123+
- added `expressions` collection to `BrsFile.parser.references` which includes all the full expressions, which can be used instead of AST walking in many cases. ([#487](https://github.com/rokucommunity/brighterscript/pull/487))
124+
### Changed
125+
- For plugin authors:
126+
- move parse and validate events to `Program` class and out of `XmlFile` and `BrsFile`. This only impacts plugins that depend on the `afterFileParse`, `onFileValidate` and `afterFileValidate` events while also constructing those files with their constructors directly. ([#494](https://github.com/rokucommunity/brighterscript/pull/494))
127+
- removed internal [barrels](https://github.com/basarat/typescript-book/blob/master/docs/tips/barrel.md). This means plugins can no longer do things like: `import { something} from 'brighterscript/some-path'`. All necessary exports can be done from the top-level brighterscript package directly. ([#492](https://github.com/rokucommunity/brighterscript/pull/492))
128+
- use `Map` for `ClassValidator` class lookup instead of an object. ([#481](https://github.com/rokucommunity/brighterscript/pull/481))
129+
130+
131+
132+
### Fixed
133+
- bug preventing code to come after an interface statement. ([#493](https://github.com/rokucommunity/brighterscript/pull/493))
134+
- don't crash on null options in `printDiagnostics`. ([3147202](https://github.com/rokucommunity/brighterscript/commit/3147202b948d08be198255c068f082857c9de1f0))
135+
9136
## [0.42.0](https://github.com/rokucommunity/brighterscript/compare/v0.41.6...v0.42.0) - 2022-01-10
10137
### Added
11138
- AST editing utility for transformations during between the begin and end transpile lifecycle events. See [the documentation](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md#modifying-code) for more info. ([#478](https://github.com/rokucommunity/brighterscript/pull/478))

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
A superset of Roku's BrightScript language. Compiles to standard BrightScript.
44

5-
[![build](https://img.shields.io/github/workflow/status/rokucommunity/brighterscript/build.svg?logo=github)](https://github.com/rokucommunity/brighterscript/actions?query=workflow%3Abuild)
6-
[![Coverage Status](https://coveralls.io/repos/github/rokucommunity/brighterscript/badge.svg?branch=master)](https://coveralls.io/github/rokucommunity/brighterscript?branch=master)
7-
[![NPM Version](https://badge.fury.io/js/brighterscript.svg?style=flat)](https://npmjs.org/package/brighterscript)
8-
5+
[![build status](https://img.shields.io/github/workflow/status/rokucommunity/brighterscript/build.svg?logo=github)](https://github.com/rokucommunity/brighterscript/actions?query=workflow%3Abuild)
6+
[![coverage status](https://img.shields.io/coveralls/github/rokucommunity/brighterscript?logo=coveralls)](https://coveralls.io/github/rokucommunity/brighterscript?branch=master)
7+
[![monthly downloads](https://img.shields.io/npm/dm/brighterscript.svg?sanitize=true&logo=npm&logoColor=)](https://npmcharts.com/compare/brighterscript?minimal=true)
8+
[![npm version](https://img.shields.io/npm/v/brighterscript.svg?logo=npm)](https://www.npmjs.com/package/brighterscript)
9+
[![license](https://img.shields.io/npm/l/brighterscript.svg)](LICENSE)
10+
[![Slack](https://img.shields.io/badge/Slack-RokuCommunity-4A154B?logo=slack)](https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA)
911

1012
## Overview
1113

@@ -59,12 +61,27 @@ BrighterScript adds several new features to the BrightScript language such as Na
5961
- And if it's not enough, the [plugin API](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md) allows extending the compiler to provide extra diagnostics or transformations.
6062

6163
## Who uses Brighterscript?
62-
63-
Brighterscript is used by [applicaster](https://www.applicaster.com/), [The miracle channel](https://miraclechannel.ca/corco/), and in open source projects such as [rooibos](https://github.com/georgejecook/rooibos/blob/master/docs/index.md), the [maestro framework](https://github.com/georgejecook/maestro/blob/master/docs/index.md), and more.
64-
65-
The BrighterScript project is used to power the popular [Brightscript Language](https://marketplace.visualstudio.com/items?itemName=rokucommunity.brightscript) VSCode extension, and other tools.
66-
67-
More projects are adopting BrighterScript all the time, from using the new BrighterScript language features to simply using the compiler as part of their build pipeline. Be sure to watch this space!
64+
<br/>
65+
<p align="center">
66+
<a href="https://www.applicaster.com/">
67+
<img src="https://user-images.githubusercontent.com/2544493/96571912-377af280-129a-11eb-8295-49eb12e54aeb.png">
68+
</a>&nbsp;&nbsp;&nbsp;
69+
<a href="https://www.miraclechannel.ca/corcoplus">
70+
<img src="https://user-images.githubusercontent.com/2544493/157429644-ba0d574a-d3c3-425f-8e68-98103fb8f707.png">
71+
</a>&nbsp;&nbsp;&nbsp;
72+
<a href="https://www.nba.com/">
73+
<img src="https://user-images.githubusercontent.com/2544493/157430017-a27b62d0-63de-4e87-a6df-8448007bd24d.png">
74+
</a>&nbsp;&nbsp;&nbsp;
75+
<a href="https://github.com/georgejecook/rooibos/blob/master/docs/index.md">
76+
<img src="https://user-images.githubusercontent.com/2544493/157430331-20913e84-f3f4-447a-b093-8780cd1241e6.png">
77+
</a>
78+
</p>
79+
<br/>
80+
81+
82+
The BrighterScript project is used to power the popular [Brightscript Language](https://marketplace.visualstudio.com/items?itemName=rokucommunity.brightscript) VSCode extension, the [maestro framework](https://github.com/georgejecook/maestro/blob/master/docs/index.md), and more.
83+
84+
[Contact us](https://github.com/rokucommunity/brighterscript/issues/new) if you use BrighterScript on 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.
6885

6986
## What's with the name?
7087
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:
@@ -226,6 +243,8 @@ These are the options available in the `bsconfig.json` file.
226243
227244
- **plugins**: `Array<string>` - List of node scripts or npm modules to load as plugins to the BrighterScript compiler.
228245
246+
- **require**: `Array<string>` - List of node scripts or npm modules to load during the startup sequence. Useful for running things like `ts-node/require`
247+
229248
## Ignore errors and warnings on a per-line basis
230249
In addition to disabling an entire class of errors in `bsconfig.json` by using `ignoreErrorCodes`, you may also disable errors for a subset of the complier rules within a file with the following comment flags:
231250
- `bs:disable-next-line`

0 commit comments

Comments
 (0)