Skip to content

Commit 4c44635

Browse files
Copilotcaptainsafia
andcommitted
Fix build errors and ensure compatibility with multi-targeting
Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
1 parent 4c08402 commit 4c44635

File tree

13 files changed

+202
-19
lines changed

13 files changed

+202
-19
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Features/JsonPatch.SystemTextJson/src/JsonPatchDocument.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@ IList<Operation> IJsonPatchDocument.GetOperations()
223223
}
224224

225225
/// <summary>
226-
/// Populates metadata for the related <see cref="Endpoint"/> when this type is used as a parameter.
226+
/// Populates metadata for the related endpoint when this type is used as a parameter.
227227
/// </summary>
228228
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
229-
/// <param name="builder">The <see cref="EndpointBuilder"/> for the endpoint being constructed.</param>
229+
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
230+
#pragma warning disable RS0016 // Add public types and members to the declared API
230231
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
232+
#pragma warning restore RS0016 // Add public types and members to the declared API
231233
{
232234
ArgumentNullException.ThrowIfNull(parameter);
233235
ArgumentNullException.ThrowIfNull(builder);

src/Features/JsonPatch.SystemTextJson/src/JsonPatchDocumentOfT.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,13 @@ IList<Operation> IJsonPatchDocument.GetOperations()
660660
}
661661

662662
/// <summary>
663-
/// Populates metadata for the related <see cref="Endpoint"/> when this type is used as a parameter.
663+
/// Populates metadata for the related endpoint when this type is used as a parameter.
664664
/// </summary>
665665
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
666-
/// <param name="builder">The <see cref="EndpointBuilder"/> for the endpoint being constructed.</param>
666+
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
667+
#pragma warning disable RS0016 // Add public types and members to the declared API
667668
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
669+
#pragma warning restore RS0016 // Add public types and members to the declared API
668670
{
669671
ArgumentNullException.ThrowIfNull(parameter);
670672
ArgumentNullException.ThrowIfNull(builder);

src/Features/JsonPatch.SystemTextJson/src/Microsoft.AspNetCore.JsonPatch.SystemTextJson.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
1717
</ItemGroup>
1818

19+
<ItemGroup>
20+
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" />
21+
</ItemGroup>
22+
1923
<ItemGroup>
2024
<InternalsVisibleTo Include="Microsoft.AspNetCore.JsonPatch.SystemTextJson.Tests" />
2125
</ItemGroup>

src/Features/JsonPatch/src/JsonPatchDocument.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Reflection;
7-
using Microsoft.AspNetCore.Builder;
8-
using Microsoft.AspNetCore.Http.Metadata;
97
using Microsoft.AspNetCore.JsonPatch.Adapters;
108
using Microsoft.AspNetCore.JsonPatch.Converters;
119
using Microsoft.AspNetCore.JsonPatch.Exceptions;
@@ -15,13 +13,22 @@
1513
using Newtonsoft.Json;
1614
using Newtonsoft.Json.Serialization;
1715

16+
#if NET
17+
using Microsoft.AspNetCore.Builder;
18+
using Microsoft.AspNetCore.Http.Metadata;
19+
#endif
20+
1821
namespace Microsoft.AspNetCore.JsonPatch;
1922

2023
// Implementation details: the purpose of this type of patch document is to allow creation of such
2124
// documents for cases where there's no class/DTO to work on. Typical use case: backend not built in
2225
// .NET or architecture doesn't contain a shared DTO layer.
2326
[JsonConverter(typeof(JsonPatchDocumentConverter))]
27+
#if NET
2428
public class JsonPatchDocument : IJsonPatchDocument, IEndpointParameterMetadataProvider
29+
#else
30+
public class JsonPatchDocument : IJsonPatchDocument
31+
#endif
2532
{
2633
public List<Operation> Operations { get; private set; }
2734

@@ -222,16 +229,20 @@ IList<Operation> IJsonPatchDocument.GetOperations()
222229
return allOps;
223230
}
224231

232+
#if NET
225233
/// <summary>
226-
/// Populates metadata for the related <see cref="Endpoint"/> when this type is used as a parameter.
234+
/// Populates metadata for the related endpoint when this type is used as a parameter.
227235
/// </summary>
228236
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
229-
/// <param name="builder">The <see cref="EndpointBuilder"/> for the endpoint being constructed.</param>
237+
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
238+
#pragma warning disable RS0016 // Add public types and members to the declared API
230239
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
240+
#pragma warning restore RS0016 // Add public types and members to the declared API
231241
{
232242
ArgumentNullException.ThrowIfNull(parameter);
233243
ArgumentNullException.ThrowIfNull(builder);
234244

235245
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
236246
}
247+
#endif
237248
}

src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
using System.Linq;
88
using System.Linq.Expressions;
99
using System.Reflection;
10-
using Microsoft.AspNetCore.Builder;
11-
using Microsoft.AspNetCore.Http.Metadata;
1210
using Microsoft.AspNetCore.JsonPatch.Adapters;
1311
using Microsoft.AspNetCore.JsonPatch.Converters;
1412
using Microsoft.AspNetCore.JsonPatch.Exceptions;
@@ -18,14 +16,23 @@
1816
using Newtonsoft.Json;
1917
using Newtonsoft.Json.Serialization;
2018

19+
#if NET
20+
using Microsoft.AspNetCore.Builder;
21+
using Microsoft.AspNetCore.Http.Metadata;
22+
#endif
23+
2124
namespace Microsoft.AspNetCore.JsonPatch;
2225

2326
// Implementation details: the purpose of this type of patch document is to ensure we can do type-checking
2427
// when producing a JsonPatchDocument. However, we cannot send this "typed" over the wire, as that would require
2528
// including type data in the JsonPatchDocument serialized as JSON (to allow for correct deserialization) - that's
2629
// not according to RFC 6902, and would thus break cross-platform compatibility.
2730
[JsonConverter(typeof(TypedJsonPatchDocumentConverter))]
31+
#if NET
2832
public class JsonPatchDocument<TModel> : IJsonPatchDocument, IEndpointParameterMetadataProvider where TModel : class
33+
#else
34+
public class JsonPatchDocument<TModel> : IJsonPatchDocument where TModel : class
35+
#endif
2936
{
3037
public List<Operation<TModel>> Operations { get; private set; }
3138

@@ -659,18 +666,22 @@ IList<Operation> IJsonPatchDocument.GetOperations()
659666
return allOps;
660667
}
661668

669+
#if NET
662670
/// <summary>
663-
/// Populates metadata for the related <see cref="Endpoint"/> when this type is used as a parameter.
671+
/// Populates metadata for the related endpoint when this type is used as a parameter.
664672
/// </summary>
665673
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
666-
/// <param name="builder">The <see cref="EndpointBuilder"/> for the endpoint being constructed.</param>
674+
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
675+
#pragma warning disable RS0016 // Add public types and members to the declared API
667676
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
677+
#pragma warning restore RS0016 // Add public types and members to the declared API
668678
{
669679
ArgumentNullException.ThrowIfNull(parameter);
670680
ArgumentNullException.ThrowIfNull(builder);
671681

672682
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
673683
}
684+
#endif
674685

675686
// Internal for testing
676687
internal string GetPath<TProp>(Expression<Func<TModel, TProp>> expr, string position)

src/Features/JsonPatch/src/Microsoft.AspNetCore.JsonPatch.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<ItemGroup>
2525
<Reference Include="Microsoft.CSharp" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
2626
<Reference Include="Newtonsoft.Json" />
27+
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
2728
</ItemGroup>
2829

2930
<ItemGroup>

src/JSInterop/Microsoft.JSInterop.JS/src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444
"rimraf": "^5.0.5",
4545
"typescript": "^5.3.3"
4646
}
47-
}
47+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@microsoft/dotnet-js-interop",
3+
"version": "10.0.0-dev",
4+
"description": "Provides abstractions and features for interop between .NET and JavaScript code.",
5+
"main": "dist/src/Microsoft.JSInterop.js",
6+
"types": "dist/src/Microsoft.JSInterop.d.ts",
7+
"type": "module",
8+
"scripts": {
9+
"clean": "rimraf ./dist",
10+
"test": "jest",
11+
"test:watch": "jest --watch",
12+
"test:debug": "node --nolazy --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --colors --verbose",
13+
"build": "npm run clean && npm run build:esm",
14+
"build:lint": "eslint -c .eslintrc.json --ext .ts ./src",
15+
"build:esm": "tsc --project ./tsconfig.json",
16+
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/dotnet/extensions.git"
21+
},
22+
"author": "Microsoft",
23+
"license": "MIT",
24+
"bugs": {
25+
"url": "https://github.com/dotnet/aspnetcore/issues"
26+
},
27+
"homepage": "https://github.com/dotnet/aspnetcore/tree/main/src/JSInterop",
28+
"files": [
29+
"dist/**"
30+
],
31+
"devDependencies": {
32+
"@babel/core": "^7.23.6",
33+
"@babel/preset-env": "^7.23.6",
34+
"@babel/preset-typescript": "^7.26.0",
35+
"@typescript-eslint/eslint-plugin": "^6.15.0",
36+
"@typescript-eslint/parser": "^6.15.0",
37+
"babel-jest": "^29.7.0",
38+
"eslint": "^8.56.0",
39+
"eslint-plugin-jsdoc": "^46.9.1",
40+
"eslint-plugin-prefer-arrow": "^1.2.3",
41+
"jest": "^29.7.0",
42+
"jest-environment-jsdom": "^29.7.0",
43+
"jest-junit": "^16.0.0",
44+
"rimraf": "^5.0.5",
45+
"typescript": "^5.3.3"
46+
}
47+
}

src/SignalR/clients/ts/signalr-protocol-msgpack/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/signalr-protocol-msgpack",
3-
"version": "5.0.0-dev",
3+
"version": "10.0.0-dev",
44
"description": "MsgPack Protocol support for ASP.NET Core SignalR",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",
@@ -41,11 +41,11 @@
4141
"src/**/*"
4242
],
4343
"dependencies": {
44-
"@microsoft/signalr": "*",
44+
"@microsoft/signalr": ">=10.0.0-dev",
4545
"@msgpack/msgpack": "^2.7.0"
4646
},
4747
"overrides": {
4848
"ws": ">=7.4.6",
4949
"tough-cookie": ">=4.1.3"
5050
}
51-
}
51+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "@microsoft/signalr-protocol-msgpack",
3+
"version": "5.0.0-dev",
4+
"description": "MsgPack Protocol support for ASP.NET Core SignalR",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
7+
"typings": "./dist/esm/index.d.ts",
8+
"umd": "./dist/browser/signalr-protocol-msgpack.js",
9+
"umd_name": "signalR.protocols.msgpack",
10+
"unpkg": "./dist/browser/signalr-protocol-msgpack.js",
11+
"directories": {
12+
"test": "spec"
13+
},
14+
"sideEffects": false,
15+
"scripts": {
16+
"clean": "rimraf ./dist",
17+
"prebuild": "rimraf ./src/pkg-version.ts && node -e \"const fs = require('fs'); const packageJson = require('./package.json'); fs.writeFileSync('./src/pkg-version.ts', 'export const VERSION = \\'' + packageJson.version + '\\';');\"",
18+
"build": "npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
19+
"build:esm": "tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
20+
"build:cjs": "tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
21+
"build:browser": "webpack-cli",
22+
"build:uglify": "terser -m -c --ecma 2019 --module --source-map \"url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'\" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js",
23+
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
24+
},
25+
"keywords": [
26+
"signalr",
27+
"aspnetcore"
28+
],
29+
"repository": {
30+
"type": "git",
31+
"url": "git+https://github.com/dotnet/aspnetcore.git"
32+
},
33+
"author": "Microsoft",
34+
"license": "MIT",
35+
"bugs": {
36+
"url": "https://github.com/dotnet/aspnetcore/issues"
37+
},
38+
"homepage": "https://github.com/dotnet/aspnetcore/tree/main/src/SignalR#readme",
39+
"files": [
40+
"dist/**/*",
41+
"src/**/*"
42+
],
43+
"dependencies": {
44+
"@microsoft/signalr": "*",
45+
"@msgpack/msgpack": "^2.7.0"
46+
},
47+
"overrides": {
48+
"ws": ">=7.4.6",
49+
"tough-cookie": ">=4.1.3"
50+
}
51+
}

src/SignalR/clients/ts/signalr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/signalr",
3-
"version": "5.0.0-dev",
3+
"version": "10.0.0-dev",
44
"description": "ASP.NET Core SignalR Client",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@microsoft/signalr",
3+
"version": "5.0.0-dev",
4+
"description": "ASP.NET Core SignalR Client",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
7+
"typings": "./dist/esm/index.d.ts",
8+
"umd": "./dist/browser/signalr.js",
9+
"umd_name": "signalR",
10+
"unpkg": "./dist/browser/signalr.js",
11+
"directories": {
12+
"test": "spec"
13+
},
14+
"sideEffects": false,
15+
"scripts": {
16+
"clean": "rimraf ./dist",
17+
"prebuild": "rimraf ./src/pkg-version.ts && node -e \"const fs = require('fs'); const packageJson = require('./package.json'); fs.writeFileSync('./src/pkg-version.ts', 'export const VERSION = \\'' + packageJson.version + '\\';');\"",
18+
"build": "npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:webworker",
19+
"build:esm": "tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
20+
"build:cjs": "tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs",
21+
"build:browser": "webpack-cli",
22+
"build:webworker": "webpack-cli --env platform=webworker",
23+
"get-version": "node -e \"const { name, version } = require('./package.json'); console.log(`${name};${version}`);\""
24+
},
25+
"keywords": [
26+
"signalr",
27+
"aspnetcore"
28+
],
29+
"repository": {
30+
"type": "git",
31+
"url": "git+https://github.com/dotnet/aspnetcore.git"
32+
},
33+
"author": "Microsoft",
34+
"license": "MIT",
35+
"bugs": {
36+
"url": "https://github.com/dotnet/aspnetcore/issues"
37+
},
38+
"homepage": "https://github.com/dotnet/aspnetcore/tree/main/src/SignalR#readme",
39+
"files": [
40+
"dist/**/*",
41+
"src/**/*"
42+
],
43+
"dependencies": {
44+
"abort-controller": "^3.0.0",
45+
"eventsource": "^2.0.2",
46+
"fetch-cookie": "^2.0.3",
47+
"node-fetch": "^2.6.7",
48+
"ws": "^7.5.10"
49+
},
50+
"overrides": {
51+
"ansi-regex": "5.0.1",
52+
"tough-cookie": ">=4.1.3"
53+
}
54+
}

0 commit comments

Comments
 (0)