Skip to content

Commit

Permalink
[wasm] bump devDependencies to rollup 3 and TypeScript 4.9 (#78726)
Browse files Browse the repository at this point in the history
* Bump dev dependencies

Typescript 4.9

rollup 2.79.1  (can't bump to rollup 3 until rollup-plugin-consts
1.1.1 is published to raise it's upper bound rollup dependency)

* bump to rollup 3

replace untmainained rollup-plugin-terser with @rollup/plugin-terser

replace rollup-plugin-consts with a shim @rollup/plugin-virtual.
They do the same thing, but consts is more opinionated about how it
names its modules

* Commit new package-lock.json

* Create package-lock.json using npm v6 (from Emscripten)

And use the dnceng npm registry

* update README with more details about upgrading NPM packages

* Make markdownlint happy
  • Loading branch information
lambdageek committed Nov 24, 2022
1 parent f463fe7 commit 89cfbfd
Show file tree
Hide file tree
Showing 5 changed files with 352 additions and 259 deletions.
64 changes: 49 additions & 15 deletions src/mono/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Add `~/.jsvu` to your `PATH`:

* Install node/npm from https://nodejs.org/en/ and add its npm and nodejs directories to the `PATH` environment variable

* * Install jsvu with npm:
* Install jsvu with npm:

`npm install jsvu -g`

Expand Down Expand Up @@ -135,7 +135,7 @@ Exceptions thrown after the runtime starts get symbolicating from js itself. Exc

If you need to symbolicate some traces manually, then you need the corresponding `dotnet.js.symbols` file. Then:

```
```console
src/mono/wasm/symbolicator$ dotnet run /path/to/dotnet.js.symbols /path/to/file/with/traces
```

Expand All @@ -155,7 +155,7 @@ To run a test with `FooBar` in the name:

Additional arguments for `dotnet test` can be passed via `MSBUILD_ARGS` or `TEST_ARGS`. For example `MSBUILD_ARGS="/p:WasmDebugLevel=5"`. Though only one of `TEST_ARGS`, or `TEST_FILTER` can be used at a time.

- Chrome can be installed for testing by setting `InstallChromeForDebuggerTests=true` when building the tests.
Chrome can be installed for testing by setting `InstallChromeForDebuggerTests=true` when building the tests.

## Run samples

Expand Down Expand Up @@ -189,13 +189,15 @@ To test changes in the templates, use `dotnet new install --force src/mono/wasm/

Example use of the `wasmconsole` template:

> dotnet new wasmconsole
> dotnet publish
> cd bin/Debug/net7.0/browser-wasm/AppBundle
> node main.mjs
mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
Hello World!
Args:
```console
> dotnet new wasmconsole
> dotnet publish
> cd bin/Debug/net7.0/browser-wasm/AppBundle
> node main.mjs
mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
Hello World!
Args:
```

## Upgrading Emscripten

Expand All @@ -210,23 +212,56 @@ Bumping Emscripten version involves these steps:
* update packages in the workload manifest https://github.com/dotnet/runtime/blob/main/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/WorkloadManifest.json.in

## Upgrading NPM packages

Two things to keep in mind:

1. We use the Azure DevOps NPM registry (configured in `src/mono/wasm/runtime/.npmrc`). When
updating `package.json`, you will need to be logged in (see instructions for Windows and
mac/Linux, below) in order for the registry to populate with the correct package versions.
Otherwise, CI builds will fail.

2. Currently the Emscripten SDK uses NPM version 6 which creates `package-lock.json` files in the
"v1" format. When updating NPM packages, it is important to use this older version of NPM (for
example by using the `emsdk_env.sh` script to set the right environment variables) or by using the
`--lockfile-format=1` option with more recent versions of NPM.

### Windows

The steps below will download the `vsts-npm-auth` tool from https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-public-npm/connect/npm

In folder `src\mono\wasm\runtime\`

```sh
rm -rf node_modules
rm package-lock.json
npm install -g vsts-npm-aut`
npm install -g vsts-npm-auth`
vsts-npm-auth -config .npmrc
npm npm cache clean --force
npm cache clean --force
npm outdated
npm update
npm update --lockfile-version=1
```

### mac/Linux

Go to https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-public-npm/connect/npm and log in and click on the "Other" tab.
Follow the instructions to set up your `~/.npmrc` with a personal authentication token.

In folder `src/mono/wasm/runtime/`

```sh
rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm outdated
npm update --lockfile-version=1
```

## Code style

* Is enforced via [eslint](https://eslint.org/) and rules are in `./.eslintrc.js`
* You could check the style by running `npm run lint` in `src/mono/wasm/runtime` directory
* You can install [plugin into your VS Code](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) to show you the errors as you type


## Builds on CI

* For PRs, tests are generally triggered based on path changes. But if you have a change which would not trigger the relevant builds, then you can run `runtime-wasm` pipeline manually to run all of them. Comment `/azp run runtime-wasm` on the PR.
Expand All @@ -251,7 +286,6 @@ npm update
| Debugger tests | linux+windows: only-pc |
| Runtime tests | linux+windows: only-pc |


### Run manually with `/azp run ..`

* `runtime-wasm*` pipelines are triggered manually, and they only run the jobs that would not run on any default pipelines based on path changes.
Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasm/runtime/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ export async function http_wasm_get_streamed_response_bytes(res: ResponseExtensi
interface ResponseExtension extends Response {
__buffer?: ArrayBuffer
__reader?: ReadableStreamDefaultReader<Uint8Array>
__chunk?: ReadableStreamDefaultReadResult<Uint8Array>
__chunk?: ReadableStreamReadResult<Uint8Array>
__source_offset: number
__abort_controller: AbortController
__headerNames: string[];
__headerValues: string[];
}
}
Loading

0 comments on commit 89cfbfd

Please sign in to comment.