Skip to content

[wasm] bump npm packages, fix lint errors #72600

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

Merged
merged 3 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions src/mono/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ Bumping Emscripten version involves these steps:
* update `Microsoft.NET.Runtime.Emscripten.<emscripten version>.Node.win-x64` package name, version and sha hash in https://github.com/dotnet/runtime/blob/main/eng/Version.Details.xml and in https://github.com/dotnet/runtime/blob/main/eng/Versions.props. the sha is the commit hash in https://github.com/dotnet/emsdk and the package version can be found at https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet6
* 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
In folder `src\mono\wasm\runtime\`
```sh
rm -rf node_modules
rm package-lock.json
npm install -g vsts-npm-aut`
vsts-npm-auth -config .npmrc
npm npm cache clean --force
npm outdated
npm update
```

## 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
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/runtime/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-loss-of-precision": "off",
"indent": [
"error",
4,
Expand Down
12 changes: 6 additions & 6 deletions src/mono/wasm/runtime/cuint64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
/// and 'import type { CUInt64 } from './cuint64';
export type CUInt64 = readonly [number, number];

export function toBigInt (x: CUInt64): bigint {
export function toBigInt(x: CUInt64): bigint {
return BigInt(x[0]) | BigInt(x[1]) << BigInt(32);
}

export function fromBigInt (x: bigint): CUInt64 {
export function fromBigInt(x: bigint): CUInt64 {
if (x < BigInt(0))
throw new Error(`${x} is not a valid 64 bit integer`);
if (x > BigInt(0xFFFFFFFFFFFFFFFF))
Expand All @@ -20,11 +20,11 @@ export function fromBigInt (x: bigint): CUInt64 {
return [low, high];
}

export function dangerousToNumber (x: CUInt64): number {
export function dangerousToNumber(x: CUInt64): number {
return x[0] | x[1] << 32;
}

export function fromNumber (x: number): CUInt64 {
export function fromNumber(x: number): CUInt64 {
if (x < 0)
throw new Error(`${x} is not a valid 64 bit integer`);
if ((x >> 32) > 0xFFFFFFFF)
Expand All @@ -34,11 +34,11 @@ export function fromNumber (x: number): CUInt64 {
return [x & 0xFFFFFFFF, x >> 32];
}

export function pack32 (lo: number, hi: number): CUInt64 {
export function pack32(lo: number, hi: number): CUInt64 {
return [lo, hi];
}

export function unpack32 (x: CUInt64): [number, number] {
export function unpack32(x: CUInt64): [number, number] {
return [x[0], x[1]];
}

Expand Down
6 changes: 3 additions & 3 deletions src/mono/wasm/runtime/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class EventPipeFileSession implements EventPipeSession {
this._state = State.Started;
start_streaming(this._sessionID);
console.debug(`EventPipe session ${this.sessionID} started`);
}
};

stop = () => {
if (this._state !== State.Started) {
Expand All @@ -71,15 +71,15 @@ class EventPipeFileSession implements EventPipeSession {
this._state = State.Done;
stop_streaming(this._sessionID);
console.debug(`EventPipe session ${this.sessionID} stopped`);
}
};

getTraceBlob = () => {
if (this._state !== State.Done) {
throw new Error(`session is in state ${this._state}, not 'Done'`);
}
const data = Module.FS_readFile(this._tracePath, { encoding: "binary" }) as Uint8Array;
return new Blob([data], { type: "application/octet-stream" });
}
};
}

const eventLevel = {
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/runtime/marshal-to-cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function _marshal_function_to_cs(arg: JSMarshalerArgument, value: Function, _?:
}

export class TaskCallbackHolder implements IDisposable {
public promise: Promise<any>
public promise: Promise<any>;

public constructor(promise: Promise<any>) {
this.promise = promise;
Expand Down
Loading