In-Browser Bundler for User Code Extension

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing techniques for compiling user code in custom digital twin web applications face issues such as compatibility with complex inputs, excessive compile time, and the burden of application configuration, particularly in browser environments, leading to failed compilations and user discouragement.

Innovation Solution

Compiling user code as an extension of a host application, where host packages are pre-compiled and exposed for in-browser use, eliminating the need for users to provide application configuration and reducing reliance on remote backends, utilizing a bundler and plugins like external globals, file resolver, code compiler, and styles plugins to transform and bundle code efficiently.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If user code is compiled in-browser using lightweight compilation, then compilation can be performed locally without remote backend, but compilation fails for complex inputs such as all Typescript inputs

Engineering Contradiction:
Improvein-browser compilation capabilityVSAvoidcompilation success rate
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The host application is pre-compiled before being loaded into the browser. This preliminary compilation action ensures that all host packages are ready in a compiled state, allowing user code to extend them without encountering compilation failures during browser-based compilation. The pre-compilation of host packages resolves the contradiction by ensuring reliability for complex inputs while maintaining in-browser operation.

Inventive Principle:
Principle #10Preliminary action

2Ease of operation

If all remote packages are downloaded and compiled in-browser, then compilation can be performed locally, but compilation time becomes excessive

Engineering Contradiction:
Improvelocal compilation capabilityVSAvoidcompilation time
Core Design Contradiction:
Ease of operationVSLoss of time

Solution Approach 1:

Remote packages are pre-compiled and cached before being needed by user code. This preliminary action eliminates the need to re-compile large remote packages during each user code compilation, dramatically reducing compilation time while maintaining local compilation capability.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

Compiled versions of remote packages are cached and reused during user code compilation. Instead of re-compiling everything from source, the system uses pre-compiled copies of remote packages, significantly reducing the time required for in-browser compilation.

Inventive Principle:
Principle #26Copying

3Adaptability or versatility

If users provide application configuration information manually, then configuration can be customized, but the process is time consuming and discourages new users

Engineering Contradiction:
Improveconfiguration customizationVSAvoidconfiguration time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The host application automatically provides its own configuration information to user code extensions. Instead of requiring users to manually configure everything, the system enables self-service where the host application's configuration is automatically inherited and made available to user code, eliminating configuration time while maintaining customization capability.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The host application serves multiple functions: it provides both the base application functionality and the configuration information that extensions need. This multi-functionality eliminates the need for separate configuration provision, reducing setup time while maintaining adaptability for different use cases.

Inventive Principle:
Principle #6Universality (Multi-functionality)

4Ease of manufacture

If user code is compiled as a separate new application, then compilation can be performed independently, but additional remote requests are needed and compilation is less efficient

Engineering Contradiction:
Improveindependent compilationVSAvoidcompilation efficiency
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

User code compilation is merged with the host application's compiled state. Instead of compiling user code as a completely separate new application, the system combines user code with the pre-compiled host application packages, creating an extended application. This merging approach maintains independent compilation capability while significantly improving efficiency by reusing pre-compiled host packages.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS11995458B1Compiling user code as an extension of a host application in a browser environment
Publication Date: 2024.05.28 BENTLEY SYSTEMS INC
  • US11995458B1 patent drawing
  • US11995458B1 patent drawing
  • US11995458B1 patent drawing

AI summary

In an example embodiment, a technique is provided for compiling user code. A browser, executing on a local computing device, receives a request to compile the user code. A bundler, executing in the browser, retrieves contents of the user code and dependencies of the user code on one or more host packages of a host application. The bundler transforms, compiles and bundles the user code to produce a compiled bundle. The transforming imports each host package as a property of a global window object of the browser, wherein the property has a name that includes the host package name appended with a predetermined string, and a value that indicates an entry point into the host package. The compiles the user code as an extension of the host application in order to utilize the host packages in an already compiled form. The compiled bundle is then provided as an output.