Skip to content
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

[wasm] deprecate legacy JS API and propose new #73068

Merged
merged 20 commits into from
Aug 4, 2022

Conversation

pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Jul 29, 2022

  • Added new API methods to top level next to MONO and BINDING namespaces
    • runMain, runMainAndExit, setEnvironmentVariable, getAssemblyExports are just renamed existing API
    • getConfig will return mono-config.json type MonoConfig
    • setHeapI64Big, setHeapI32 , getHeapI32, ... memory functions
  • marked MONO and BINDING namespaces obsolete
  • separated legacy API into dotnet-legacy.d.ts
  • renamed snake_case to camelCase names
    • the idea is that these types were mostly added to Net7 and we have still chance to fix it without backward compatibility shim.
    • The shim could be done, if really necessary.

Details

  • in the mono-config.json/MonoConfigtype
    • assembly_root -> assemblyRootFolder
    • debug_level -> debugLevel
    • enable_debugging - removed in favor of debugLevel
    • isError - removed, we throw exceptions as necessary
    • globalization_mode -> globalizationMode
    • diagnostic_tracing -> diagnosticTracing
    • remote_sources -> remoteSources
    • environment_variables -> environmentVariables
    • runtime_options -> runtimeOptions
    • aot_profiler_options -> aotProfilerOptions with writeAt & sendTo
    • coverage_profiler_options -> coverageProfilerOptions with writeAt & sendTo
    • diagnostic_options -> diagnosticOptions
    • ignore_pdb_load_errors -> ignorePdbLoadErrors
    • wait_for_debugger -> waitForDebugger
  • in AssetEntry
    • virtual_path -> virtualPath
    • load_remote -> loadRemote
    • is_optional -> isOptional
    • we are producing it in src\tasks\WasmAppBuilder\WasmAppBuilder.cs
  • in DiagnosticServerOptions
    • connect_url -> connectUrl
  • in UnnamedProviderConfiguration
    • keyword_mask -> keywordMask
  • in Diagnostics
    • EventLevel -> eventLevel
  • updated samples and templates
  • renamed runtime arg --diagnostic_tracing -> --diagnostic-tracing
  • replaced IMPORTS with setModuleImports
  • renamed runtimeBuildInfo & productVersion & buildConfiguration to first lowercase

@pavelsavara pavelsavara added this to the 7.0.0 milestone Jul 29, 2022
@pavelsavara pavelsavara self-assigned this Jul 29, 2022
@ghost
Copy link

ghost commented Jul 29, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details
  • separated legacy API into dotnet-legacy.d.ts
  • renamed snake_case to camelCase names in the mono-config.json type MonoConfig
    • the idea is that this type/file was added to Net7 and we have still chance to fix it without backward compatibility shim. The shim could be done, if truly necessary.
    • assembly_root -> assemblyRootFolder
    • debug_level -> debugLevel
    • enable_debugging - removed in favor of debugLevel
    • isError - removed, we throw exceptions as necessary
    • globalization_mode -> globalizationMode
    • diagnostic_tracing -> diagnosticTracing
    • remote_sources -> remoteSources
    • environment_variables -> environmentVariables
    • runtime_options -> runtimeOptions
    • aot_profiler_options -> aotProfilerOptions with writeAt & sendTo
    • coverage_profiler_options -> coverageProfilerOptions with writeAt & sendTo
    • diagnostic_options -> diagnosticOptions
    • ignore_pdb_load_errors -> ignorePdbLoadErrors
    • wait_for_debugger -> waitForDebugger
  • renamed snake_case to camelCase names in DiagnosticServerOptions
    • virtual_path -> virtualPath
    • load_remote -> loadRemote
    • is_optional -> isOptional
    • we are producing it in src\tasks\WasmAppBuilder\WasmAppBuilder.cs
  • renamed snake_case to camelCase names in AssetEntry
    • connect_url -> connectUrl
  • renamed snake_case to camelCase names in UnnamedProviderConfiguration
    • keyword_mask -> keywordMask
  • renamed names in Diagnostics
    • EventLevel -> eventLevel
  • Added new API next to MONO and BINDING namespaces
    • runMain, runMainAndExit, setEnvironmentVariable, getAssemblyExports are just renamed existing API
    • getConfig will return mono-config.json type MonoConfig
    • applyConfig, or merge-in MonoConfig via shalow merge
  • marked MONO and BINDING namespaces obsolete
  • updated samples and templates
Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript

Milestone: 7.0.0

@pavelsavara pavelsavara requested review from lambdageek, maraf and kg July 29, 2022 15:53
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara marked this pull request as ready for review August 1, 2022 19:06
# Conflicts:
#	src/mono/wasm/runtime/dotnet.d.ts
#	src/mono/wasm/runtime/startup.ts
#	src/mono/wasm/runtime/types.ts
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara requested a review from maraf August 2, 2022 13:11
@maraf maraf self-requested a review August 2, 2022 18:10
Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could remove EXPORTS and IMPORTS. I like the API for getting assembly exports (getAssemblyExports) and as imports are similar feature, we could provide a similar API for it, eg. setAssemblyImports(assembly: string, imports: any).
With this API we can remove EXPORTS and IMPORTS.

I'm still not sure if flatten API object is the right choice. I know than by now we have only few functions, but it seems to me that adding more structure is good for future enhancements.

@ghost ghost added the needs-author-action An issue or pull request that requires more info or actions from the author. label Aug 2, 2022
# Conflicts:
#	src/mono/wasm/runtime/cwraps.ts
#	src/mono/wasm/runtime/exports.ts
#	src/mono/wasm/runtime/startup.ts
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@maraf
Copy link
Member

maraf commented Aug 3, 2022

After a discussion we have chosen a 100% flat API in root object returned from the createDotnetRuntime.

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

System.NotSupportedException : The deserialization constructor for type 'System.Tuple1[System.Int32]' contains parameters with null names.` is #73347

Debugger failures are #73342

@pavelsavara pavelsavara changed the title [wip][wasm] deprecate legacy JS API and propose new [wasm] deprecate legacy JS API and propose new Aug 4, 2022
@pavelsavara pavelsavara merged commit 0d80733 into dotnet:main Aug 4, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 3, 2022
@pavelsavara pavelsavara deleted the wasm_js_api branch November 29, 2022 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants