-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Expand file tree
/
Copy pathBootJsonData.cs
More file actions
420 lines (341 loc) · 13 KB
/
BootJsonData.cs
File metadata and controls
420 lines (341 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Runtime.Serialization;
using ResourceHashesByNameDictionary = System.Collections.Generic.Dictionary<string, string>;
namespace Microsoft.NET.Sdk.WebAssembly;
#nullable disable
/// <summary>
/// Defines the structure of a Blazor boot JSON file
/// </summary>
public class BootJsonData
{
/// <summary>
/// Gets the name of the assembly with the application entry point
/// </summary>
/// <remarks>
/// Deprecated in .NET 8. Use <see cref="mainAssemblyName"/>
/// </remarks>
public string entryAssembly { get; set; }
public string mainAssemblyName { get; set; }
[DataMember(EmitDefaultValue = false)]
public string applicationEnvironment { get; set; }
/// <summary>
/// For .NET < 10, this contains <see cref="ResourcesData"/>.
/// For .NET >= 10, this contains <see cref="AssetsData"/>.
/// ---
/// Gets the set of resources needed to boot the application. This includes the transitive
/// closure of .NET assemblies (including the entrypoint assembly), the dotnet.wasm file,
/// and any PDBs to be loaded.
///
/// Within <see cref="ResourceHashesByNameDictionary"/>, dictionary keys are resource names,
/// and values are SHA-256 hashes formatted in prefixed base-64 style (e.g., 'sha256-abcdefg...')
/// as used for subresource integrity checking.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public object resources { get; set; } = new ResourcesData();
/// <summary>
/// Gets a value that determines whether to enable caching of the <see cref="resources"/>
/// inside a CacheStorage instance within the browser.
/// </summary>
public bool? cacheBootResources { get; set; }
/// <summary>
/// Gets a value that determines if this is a debug build.
/// </summary>
public bool? debugBuild { get; set; }
/// <summary>
/// Gets a value that determines what level of debugging is configured.
/// </summary>
public int debugLevel { get; set; }
/// <summary>
/// Gets a value that determines if the linker is enabled.
/// </summary>
public bool? linkerEnabled { get; set; }
/// <summary>
/// Config files for the application
/// </summary>
/// <remarks>
/// Deprecated in .NET 8, use <see cref="appsettings"/>
/// </remarks>
public List<string> config { get; set; }
/// <summary>
/// Config files for the application
/// </summary>
public List<string> appsettings { get; set; }
/// <summary>
/// Gets or sets the <see cref="ICUDataMode"/> that determines how icu files are loaded.
/// </summary>
/// <remarks>
/// Deprecated since .NET 8. Use <see cref="globalizationMode"/> instead.
/// </remarks>
public GlobalizationMode? icuDataMode { get; set; }
/// <summary>
/// Gets or sets the <see cref="GlobalizationMode"/> that determines how icu files are loaded.
/// </summary>
public string globalizationMode { get; set; }
/// <summary>
/// Gets a value for mono runtime options.
/// </summary>
public string[] runtimeOptions { get; set; }
/// <summary>
/// Gets or sets configuration extensions.
/// </summary>
public Dictionary<string, Dictionary<string, object>> extensions { get; set; }
/// <summary>
/// Gets or sets environment variables.
/// </summary>
public System.Collections.Generic.Dictionary<string, string> environmentVariables { get; set; }
/// <summary>
/// Subset of runtimeconfig.json
/// </summary>
public RuntimeConfigData runtimeConfig { get; set; }
/// <summary>
/// Gets or sets diagnostic tracing.
/// </summary>
public object diagnosticTracing { get; set; }
/// <summary>
/// Gets or sets pthread pool initial size.
/// </summary>
public int? pthreadPoolInitialSize { get; set; }
/// <summary>
/// Gets or sets pthread pool unused size.
/// </summary>
public int? pthreadPoolUnusedSize { get; set; }
}
/// <summary>
/// Subset of runtimeconfig.json
/// </summary>
public class RuntimeConfigData
{
/// <summary>
/// Runtime options
/// </summary>
public RuntimeOptionsData runtimeOptions { get; set; }
}
public class RuntimeOptionsData
{
/// <summary>
/// Config properties for the runtime
/// </summary>
public Dictionary<string, object> configProperties { get; set; }
}
public class ResourcesData
{
/// <summary>
/// Gets a hash of all resources
/// </summary>
public string hash { get; set; }
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, string> fingerprinting { get; set; }
/// <summary>
/// .NET Wasm runtime resources (dotnet.wasm, dotnet.js) etc.
/// </summary>
/// <remarks>
/// Deprecated in .NET 8, use <see cref="jsModuleWorker"/>, <see cref="jsModuleNative"/>, <see cref="jsModuleRuntime"/>, <see cref="wasmNative"/>, <see cref="wasmSymbols"/>, <see cref="icu"/>.
/// </remarks>
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary runtime { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary jsModuleWorker { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary jsModuleDiagnostics { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary jsModuleNative { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary jsModuleRuntime { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary wasmNative { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary wasmSymbols { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary icu { get; set; }
/// <summary>
/// "assembly" (.dll) resources needed to start MonoVM
/// </summary>
public ResourceHashesByNameDictionary coreAssembly { get; set; } = new ResourceHashesByNameDictionary();
/// <summary>
/// "assembly" (.dll) resources
/// </summary>
public ResourceHashesByNameDictionary assembly { get; set; } = new ResourceHashesByNameDictionary();
/// <summary>
/// "debug" (.pdb) resources needed to start MonoVM
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary corePdb { get; set; }
/// <summary>
/// "debug" (.pdb) resources
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary pdb { get; set; }
/// <summary>
/// localization (.satellite resx) resources
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, ResourceHashesByNameDictionary> satelliteResources { get; set; }
/// <summary>
/// Assembly (.dll) resources that are loaded lazily during runtime
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary lazyAssembly { get; set; }
/// <summary>
/// JavaScript module initializers that Blazor will be in charge of loading.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary libraryInitializers { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary modulesAfterConfigLoaded { get; set; }
[DataMember(EmitDefaultValue = false)]
public ResourceHashesByNameDictionary modulesAfterRuntimeReady { get; set; }
/// <summary>
/// Extensions created by users customizing the initialization process. The format of the file(s)
/// is up to the user.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, ResourceHashesByNameDictionary> extensions { get; set; }
/// <summary>
/// Additional assets that the runtime consumes as part of the boot process.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, AdditionalAsset> runtimeAssets { get; set; }
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, ResourceHashesByNameDictionary> coreVfs { get; set; }
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, ResourceHashesByNameDictionary> vfs { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<string> remoteSources { get; set; }
}
public class AssetsData
{
/// <summary>
/// Gets a hash of all resources
/// </summary>
public string hash { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> jsModuleWorker { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> jsModuleDiagnostics { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> jsModuleNative { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> jsModuleRuntime { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<WasmAsset> wasmNative { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<SymbolsAsset> wasmSymbols { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<GeneralAsset> icu { get; set; }
/// <summary>
/// "assembly" (.dll) resources needed to start MonoVM
/// </summary>
public List<GeneralAsset> coreAssembly { get; set; } = new();
/// <summary>
/// "assembly" (.dll) resources
/// </summary>
public List<GeneralAsset> assembly { get; set; } = new();
/// <summary>
/// "debug" (.pdb) resources needed to start MonoVM
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<GeneralAsset> corePdb { get; set; }
/// <summary>
/// "debug" (.pdb) resources
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<GeneralAsset> pdb { get; set; }
/// <summary>
/// localization (.satellite resx) resources
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, List<GeneralAsset>> satelliteResources { get; set; }
/// <summary>
/// Assembly (.dll) resources that are loaded lazily during runtime
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<GeneralAsset> lazyAssembly { get; set; }
/// <summary>
/// JavaScript module initializers that Blazor will be in charge of loading.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> libraryInitializers { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> modulesAfterConfigLoaded { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<JsAsset> modulesAfterRuntimeReady { get; set; }
/// <summary>
/// Extensions created by users customizing the initialization process. The format of the file(s)
/// is up to the user.
/// </summary>
[DataMember(EmitDefaultValue = false)]
public Dictionary<string, ResourceHashesByNameDictionary> extensions { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<VfsAsset> coreVfs { get; set; }
[DataMember(EmitDefaultValue = false)]
public List<VfsAsset> vfs { get; set; }
}
[DataContract]
public class JsAsset
{
public string name { get; set; }
public string moduleExports { get; set; }
}
[DataContract]
public class SymbolsAsset
{
public string name { get; set; }
public string cache { get; set; }
}
[DataContract]
public class WasmAsset
{
public string name { get; set; }
public string hash { get; set; }
public string resolvedUrl { get; set; }
public string cache { get; set; }
}
[DataContract]
public class GeneralAsset
{
public string virtualPath { get; set; }
public string name { get; set; }
public string hash { get; set; }
public string resolvedUrl { get; set; }
public string cache { get; set; }
}
[DataContract]
public class VfsAsset
{
public string virtualPath { get; set; }
public string name { get; set; }
public string hash { get; set; }
public string resolvedUrl { get; set; }
public string cache { get; set; }
}
public enum GlobalizationMode : int
{
// Note that the numeric values are serialized and used in JS code, so don't change them without also updating the JS code
// Note that names are serialized as string and used in JS code
/// <summary>
/// Load optimized icu data file based on the user's locale
/// </summary>
Sharded = 0,
/// <summary>
/// Use the combined icudt.dat file
/// </summary>
All = 1,
/// <summary>
/// Do not load any icu data files.
/// </summary>
Invariant = 2,
/// <summary>
/// Load custom icu file provided by the developer.
/// </summary>
Custom = 3,
}
[DataContract]
public class AdditionalAsset
{
[DataMember(Name = "hash")]
public string hash { get; set; }
[DataMember(Name = "behavior")]
public string behavior { get; set; }
}