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

Browser support #514

Merged
merged 31 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cfb84a4
Hack a browser web worker build.
microbit-matt-hillsdon Aug 3, 2021
e1cdc7f
Remove irrelevant bin section.
microbit-matt-hillsdon Aug 4, 2021
2ef4566
Custom notification to bootstrap stubs/typeshed.
microbit-matt-hillsdon Aug 5, 2021
62306ec
Simplify.
microbit-matt-hillsdon Aug 5, 2021
e04bc72
Renames.
microbit-matt-hillsdon Aug 5, 2021
3258a4b
Temporarily use a hash in the filename.
microbit-matt-hillsdon Aug 6, 2021
7be2119
Remove another hack.
microbit-matt-hillsdon Aug 6, 2021
a7d08c4
Reinstate log level.
microbit-matt-hillsdon Aug 6, 2021
fc58dc7
Be consistent with other custom events.
microbit-matt-hillsdon Aug 6, 2021
adf57b1
Avoid negative look behind for Safari.
microbit-matt-hillsdon Aug 7, 2021
71d6da5
Add support for background workers in the browser. (#1)
microbit-matt-hillsdon Sep 22, 2021
74cd581
Merge branch 'main' into browser
microbit-matt-hillsdon Sep 22, 2021
d061ab4
Merge branch 'main' into browser-update
microbit-matt-hillsdon Feb 28, 2022
be907c0
Merge pull request #7 from microbit-foundation/browser-update
microbit-matt-hillsdon Feb 28, 2022
4c6baa2
Stub out process API we don't have. (#25)
microbit-matt-hillsdon Oct 19, 2022
c7b3b1c
Merge remote-tracking branch 'refs/remotes/microbit-foundation/browse…
DetachHead Jul 21, 2024
adf285e
attempt to merge microbit-foundation's browser version of pyright
DetachHead Jul 22, 2024
26a3f85
fix browser build
DetachHead Jul 24, 2024
decf2ac
publish browser build to npm
DetachHead Jul 29, 2024
1a414f2
suppress type error in test for now because im too lazy to figure it …
DetachHead Jul 29, 2024
b1372d5
fix versions of dependencies in browser-pyright package that didn't m…
DetachHead Jul 30, 2024
047da5d
fix crashes when instantiating background threads
DetachHead Jul 30, 2024
7a8e32a
bundle typeshed with the browser build
DetachHead Aug 1, 2024
3f03f13
fix readme on browser package
DetachHead Aug 1, 2024
9327da8
delete useless override
DetachHead Aug 3, 2024
187c8be
fix typeshed not being loaded
DetachHead Aug 3, 2024
d2eef15
fix type error from new version of @types/nodejs
DetachHead Aug 4, 2024
c67a4eb
update browser docs
DetachHead Aug 5, 2024
0829419
Merge remote-tracking branch 'refs/remotes/origin/main' into browser
DetachHead Aug 5, 2024
d50976b
delete unused test file
DetachHead Aug 6, 2024
4fd1e27
fix typos in browser-basedpyright readme
DetachHead Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
VSIX_NAME: vscode-pyright.vsix
VSIX_DIR: packages/vscode-pyright
NPM_PACKAGE_DIR: packages/pyright
BROWSER_NPM_PACKAGE_DIR: packages/browser-pyright

on: push

Expand Down Expand Up @@ -141,6 +142,18 @@ jobs:
access: public
tag: canary
package: ${{ env.NPM_PACKAGE_DIR }}/package.json
- name: set version for npm canary (browser)
if: github.ref != 'refs/heads/main'
run: pdm run npm version ${{ steps.current-version.outputs.CURRENT_VERSION }}-$GITHUB_SHA --git-tag-version false
working-directory: ${{ env.BROWSER_NPM_PACKAGE_DIR }}
- name: publish package - npm canary (browser)
if: github.ref != 'refs/heads/main'
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
tag: canary
package: ${{ env.BROWSER_NPM_PACKAGE_DIR }}/package.json

- name: publish package - npm
# publish npm & pypi packages, vscode extension and github release if the version in lerna.json was changed:
Expand All @@ -150,6 +163,14 @@ jobs:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: ${{ env.NPM_PACKAGE_DIR }}/package.json
- name: publish package - npm (browser)
# publish npm & pypi packages, vscode extension and github release if the version in lerna.json was changed:
if: github.ref == 'refs/heads/main' && steps.version-was-changed.outputs.VERSION_INFO == ''
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: ${{ env.BROWSER_NPM_PACKAGE_DIR }}/package.json

# this isn't ideal, but it's required becayse pdm publish re-builds the npm packages even tho they were already built earlier.
# i think to fix that i need to rewrite pdm_build.py to use the build hooks so we can control it more easily, but i can't get that to work soooo
Expand Down
31 changes: 26 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@detachhead/ts-helpers": "^16.2.0",
"@types/glob": "^7.2.0",
"@types/node": "^17.0.45",
"@types/node": "^20",
"@types/yargs": "^16.0.9",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/browser-pyright/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copied from the root directory during publish.
LICENSE.txt
11 changes: 11 additions & 0 deletions packages/browser-pyright/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1><img src="https://github.com/DetachHead/basedpyright/assets/57028336/c7342c31-bf23-413c-af6d-bc430898b3dd"> basedpyright (browser edition)</h1>

a version of [basedpyright](https://docs.basedpyright.com) that can be run in a browser.

unless you have a specific reason to use the browser build, it's recommended to install basedpyright from [pypi](https://pypi.org/project/basedpyright/) instead. see [the installation instructions](https://docs.basedpyright.com/#/installation?id=command-line-amp-language-server) for more information.

this build was adapted from the abandoned [microbit-foundation pyright fork](https://github.com/microbit-foundation). more information on how to use it is available in [their documentation](https://github.com/microbit-foundation/pyright/blob/microbit/THIS_FORK.md).

## disclaimer

this version of pyright was in an unfinished state when i found it. i've done my best to merge the last 2 years of pyright updates into it, but i can't promise it will work anywhere outside of [the basedpyright playground](https://basedpyright.com). if you have a use case for running basedpyright in the browser and run into issues with this package, please [raise an issue](https://github.com/DetachHead/basedpyright/issues/new)
Loading
Loading