Skip to content

[Blazor] Update npm dependencies #36088

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 29 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
55c4ff9
Update packages
javiercn Aug 30, 2021
080ef8c
Update codebase for new typescript errors
javiercn Aug 30, 2021
1c6717e
Update dependencies
javiercn Aug 30, 2021
332a13d
update WebAssembly.Authentication npm packages
javiercn Aug 30, 2021
c3a56b4
Update webassembly
javiercn Aug 30, 2021
5151c51
Integrate with the build
javiercn Aug 30, 2021
e5ce381
Update build process for MSAL
javiercn Aug 30, 2021
37f3432
Update msal-browser version
javiercn Aug 30, 2021
2bba23f
Partially fix errors
javiercn Aug 30, 2021
3263a84
Update and fix test project
javiercn Aug 30, 2021
b6c067d
Update npm dependencies
javiercn Sep 2, 2021
473a40d
Remove unnecessary dependency
javiercn Sep 2, 2021
8070022
Update JS files
javiercn Sep 2, 2021
9e245a2
Add license header
javiercn Sep 2, 2021
5524af7
Regenerated the migrations for the sample
javiercn Sep 2, 2021
8f1070d
Add missing header
javiercn Sep 2, 2021
ade52ea
Update node version
javiercn Sep 3, 2021
1005c7a
Update nodejs install to a supported version on CI
javiercn Sep 3, 2021
3556d30
Fix yarn commands
javiercn Sep 3, 2021
16b7f35
Update package.json
javiercn Sep 3, 2021
3e49fb4
Remove unnecessary dependencies, fix tests
javiercn Sep 3, 2021
c2dc7ee
Removes problematic Tests
javiercn Sep 3, 2021
281976a
Fix tests
javiercn Sep 3, 2021
003967a
Apply suggestions from code review
javiercn Sep 7, 2021
b38d008
Address more feedback
javiercn Sep 7, 2021
be93cbe
Update src/Components/WebAssembly/Authentication.Msal/src/Interop/web…
javiercn Sep 7, 2021
7fc89ec
Update src/Components/WebAssembly/Authentication.Msal/src/Interop/web…
javiercn Sep 7, 2021
d9dbe84
Fix invalid PR comment
javiercn Sep 7, 2021
93a3b43
Fix tests
javiercn Sep 7, 2021
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
6 changes: 3 additions & 3 deletions .azure/pipelines/jobs/default-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# skipComponentGovernanceDetection: boolean
# Determines if component governance detection can be skipped
# continueOnBuildError: boolean
# Specifies whether continueOnError is set for the build step
# Specifies whether continueOnError is set for the build step
#
# See https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema for details
#
Expand Down Expand Up @@ -173,9 +173,9 @@ jobs:
displayName: Start background dump collection
- ${{ if eq(parameters.installNodeJs, 'true') }}:
- task: NodeTool@0
displayName: Install Node 10.x
displayName: Install Node 14.x
inputs:
versionSpec: 10.x
versionSpec: 14.x
- ${{ if eq(parameters.agentOs, 'Windows') }}:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
Expand Down
2 changes: 1 addition & 1 deletion eng/targets/Helix.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<IsMacHelixQueue Condition="$(HelixTargetQueue.Contains('OSX')) or $(HelixTargetQueue.Contains('macOs'))">true</IsMacHelixQueue>
<HelixTestName>$(MSBuildProjectName)--$(TargetFramework)</HelixTestName>
<LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging>
<NodeVersion>10.15.3</NodeVersion>
<NodeVersion>14.17.6</NodeVersion>
<TestDependsOnAspNetPackages>false</TestDependsOnAspNetPackages>
<TestDependsOnAspNetRuntime>false</TestDependsOnAspNetRuntime>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Web.JS/dist/Release/blazor.server.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Components/Web.JS/dist/Release/blazor.webview.js

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions src/Components/Web.JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@microsoft/dotnet-js-interop": "link:../../JSInterop/Microsoft.JSInterop.JS/src",
"@microsoft/signalr": "link:../../SignalR/clients/ts/signalr",
"@microsoft/signalr-protocol-msgpack": "link:../../SignalR/clients/ts/signalr-protocol-msgpack",
"@types/emscripten": "^1.39.4",
"@types/jest": "^26.0.20",
"@types/jsdom": "^16.2.7",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"babel-jest": "^26.6.3",
"eslint": "^7.21.0",
"inspectpack": "^4.6.1",
"jest": "^26.6.3",
"@types/emscripten": "^1.39.5",
"@types/jest": "^27.0.1",
"@types/jsdom": "^16.2.13",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"babel-jest": "^27.1.0",
"eslint": "^7.32.0",
"inspectpack": "^4.7.1",
"jest": "^27.1.0",
"rimraf": "^3.0.2",
"terser": "^5.6.0",
"ts-jest": "^26.5.3",
"ts-loader": "^8.0.17",
"typescript": "^4.2.3",
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0"
"terser": "^5.7.2",
"ts-jest": "^27.0.5",
"ts-loader": "^9.2.5",
"typescript": "^4.4.2",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0"
},
"resolutions": {
"**/set-value": "^3.0.2"
Expand Down
14 changes: 10 additions & 4 deletions src/Components/Web.JS/src/Boot.Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ async function initializeConnection(options: CircuitStartOptions, logger: Logger
try {
await connection.start();
} catch (ex) {
unhandledError(connection, ex, logger);
unhandledError(connection, ex as Error, logger);

if (ex.innerErrors && ex.innerErrors.some(e => e.errorType === 'UnsupportedTransportError' && e.transport === HttpTransportType.WebSockets)) {
if (!isNestedError(ex)) {
showErrorNotification();
} else if (ex.innerErrors && ex.innerErrors.some(e => e.errorType === 'UnsupportedTransportError' && e.transport === HttpTransportType.WebSockets)) {
showErrorNotification('Unable to connect, please ensure you are using an updated browser that supports WebSockets.');
} else if (ex.innerErrors && ex.innerErrors.some(e => e.errorType === 'FailedToStartTransportError' && e.transport === HttpTransportType.WebSockets)) {
showErrorNotification('Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection.');
} else if (ex.innerErrors && ex.innerErrors.some(e => e.errorType === 'DisabledTransportError' && e.transport === HttpTransportType.LongPolling)) {
logger.log(LogLevel.Error, 'Unable to initiate a SignalR connection to the server. This might be because the server is not configured to support WebSockets. To troubleshoot this, visit https://aka.ms/blazor-server-websockets-error.');
showErrorNotification();
} else {
showErrorNotification();
}
}

Expand All @@ -166,8 +166,14 @@ async function initializeConnection(options: CircuitStartOptions, logger: Logger
});

return connection;

function isNestedError(error: any): error is AggregateError {
return error && ('innerErrors' in error);
}
}

type AggregateError = Error & { innerErrors: { errorType: string, transport: HttpTransportType }[] };

function unhandledError(connection: HubConnection, err: Error, logger: Logger): void {
logger.log(LogLevel.Error, err);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function sendJSDataStream(connection: HubConnection, data: ArrayBufferVie
chunkId++;
}
} catch (error) {
await connection.send('ReceiveJSDataChunk', streamId, -1, null, error.toString());
await connection.send('ReceiveJSDataChunk', streamId, -1, null, (error as Error).toString());
}
}, 0);
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay {
this.button = this.modal.querySelector('button')!;
this.reloadParagraph = this.modal.querySelector('p')!;
this.loader = this.getLoader();

this.message.after(this.loader);

this.button.addEventListener('click', async () => {
Expand All @@ -59,7 +59,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay {
}
} catch (err) {
// We got an exception, server is currently unavailable
this.logger.log(LogLevel.Error, err);
this.logger.log(LogLevel.Error, err as Error);
this.failed();
}
});
Expand Down Expand Up @@ -126,7 +126,7 @@ export class DefaultReconnectDisplay implements ReconnectDisplay {
loader.animate([
{ transform: 'rotate(0deg)' },
{ transform: 'rotate(360deg)' }
], {
], {
duration: 2000,
iterations: Infinity
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ReconnectionProcess {
return;
} catch (err) {
// We got an exception so will try again momentarily
this.logger.log(LogLevel.Error, err);
this.logger.log(LogLevel.Error, err as Error);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Components/Web.JS/src/Platform/Circuits/RenderQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export class RenderQueue {
renderBatch(this.browserRendererId, new OutOfProcessRenderBatch(batchData));
await this.completeBatch(connection, receivedBatchId);
} catch (error) {
this.fatalError = error.toString();
this.fatalError = (error as Error).toString();
this.logger.log(LogLevel.Error, `There was an error applying batch ${receivedBatchId}.`);

// If there's a rendering exception, notify server *and* throw on client
connection.send('OnRenderCompleted', receivedBatchId, error.toString());
connection.send('OnRenderCompleted', receivedBatchId, (error as Error).toString());
throw error;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function createEmscriptenModuleInstance(resourceLoader: WebAssemblyResourceLoade
const dotnetWasmResource = await wasmBeingLoaded;
compiledInstance = await compileWasmModule(dotnetWasmResource, imports);
} catch (ex) {
module.printErr(ex);
module.printErr((ex as Error).toString());
throw ex;
}
successCallback(compiledInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function startIpcReceiver() {
renderBatch(0, new OutOfProcessRenderBatch(batchData));
sendRenderCompleted(batchId, null);
} catch (ex) {
sendRenderCompleted(batchId, ex.toString());
sendRenderCompleted(batchId, (ex as Error).toString());
}
},

Expand Down
14 changes: 10 additions & 4 deletions src/Components/Web.JS/src/Rendering/BrowserRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,26 @@ export class BrowserRenderer {
private trySetSelectValueFromOptionElement(optionElement: HTMLOptionElement) {
const selectElem = this.findClosestAncestorSelectElement(optionElement);

if (!selectElem || !(deferredValuePropname in selectElem)) {
if (!isBlazorSelectElement(selectElem)) {
return false;
}

if (isMultipleSelectElement(selectElem)) {
optionElement.selected = selectElem[deferredValuePropname].indexOf(optionElement.value) !== -1;
optionElement.selected = selectElem._blazorDeferredValue!.indexOf(optionElement.value) !== -1;
} else {
if (selectElem[deferredValuePropname] !== optionElement.value) {
if (selectElem._blazorDeferredValue !== optionElement.value) {
return false;
}

setSingleSelectElementValue(selectElem, optionElement.value);
delete selectElem[deferredValuePropname];
delete selectElem._blazorDeferredValue;
}

return true;

function isBlazorSelectElement(selectElem: HTMLSelectElement | null) : selectElem is BlazorHtmlSelectElement {
return !!selectElem && (deferredValuePropname in selectElem);
}
}

private insertComponent(batch: RenderBatch, parent: LogicalElement, childIndex: number, frame: RenderTreeFrame) {
Expand Down Expand Up @@ -560,6 +564,8 @@ function stripOnPrefix(attributeName: string) {
throw new Error(`Attribute should be an event name, but doesn't start with 'on'. Value: '${attributeName}'`);
}

type BlazorHtmlSelectElement = HTMLSelectElement & { _blazorDeferredValue?: string };

function isMultipleSelectElement(element: HTMLSelectElement) {
return element.type === 'select-multiple';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Web.JS/src/Rendering/LogicalElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function getLogicalChild(parent: LogicalElement, childIndex: number): Log
export function isSvgElement(element: LogicalElement) {
// Note: This check is intentionally case-sensitive since we expect this element
// to appear as a child of an SVG element and SVGs are case-sensitive.
var closestElement = getClosestDomElement(element);
var closestElement = getClosestDomElement(element) as any;
return closestElement.namespaceURI === 'http://www.w3.org/2000/svg' && closestElement['tagName'] !== 'foreignObject';
}

Expand Down
Loading