IP Library Granted Patent US 11,995,458
Granted Patent B1
US 11,995,458 · App. 17/338,116 · Granted May 28, 2024

Compiling user code as an extension of a host application in a browser environment

Inventor: Stefan Retief (Vista, CA)
Assignee: Bentley Systems, Incorporated
G06F9/45529G06F8/41G06F16/11
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,995,458
App. No.
17/338,116
Granted
May 28, 2024
Kind
B1
Abstract

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.

Claims (50)

1. A method for compiling user code, comprising:

receiving, in a browser executing on a local computing device, a request to compile the user code;

retrieving, by a bundler executing in the browser, contents of the user code and dependencies of the user code on one or more host packages of a host application;

appending a magic string to the host package name to produce an appended host package name;

transforming, compiling and bundling the user code by the bundler to produce a compiled bundle, the transforming to import each host package by creating a property of a global window object of the browser that has a property name set to the appended host package name and a property value that is set to an entry point into the host package, wherein the global window object is an object that represents an open browser window of the browser, and the compiling to compile the user code as an extension of the host application in order to utilize the host packages in an already compiled form; and

providing the compiled bundle as an output.

2. The method of claim 1 , wherein the user code includes Typescript and the compiling compiles the Typescript to Javascript.

3. The method of claim 1 , wherein the transforming comprises:

prefixing the magic string to the host package name.

4. The method of claim 1 , wherein the method further comprises:

normalizing the host package name.

5. The method of claim 1 , wherein the compiled bundle uses an application configuration of the host application.

6. The method of claim 1 , further comprising:

creating a pseudo file system for retrieving files of the user code.

7. The method of claim 1 , further comprising:

receiving the user code in an editor executing in the browser,

wherein the bundler compiles the user code by calling a worker of the editor.

8. The method of claim 1 , wherein the user code comprises user styles, and the compiling comprises compiling the user styles separately from styles of the host application, and the bundling bundles the user styles and imports them as new style elements.

9. The method of claim 8 , wherein the user styles are Syntactically Awesome Style Sheets (SASS) and the compiling the user styles creates Cascading Style Sheets (CSS).

10. A computing device comprising:

a processor; and

a memory coupled to the processor and configured to store a browser that is executable on the processor, the browser when executed operable to:

receive a request to compile user code,

retrieve contents of the user code and dependencies of the user code on one or more host packages of a host application,

append a magic string to the host package name to produce an appended host package name,

import each host package by creating a property of a global window object of the browser that has a property name set to the appended host package name and a property value that is set to an entry point into the host package, wherein the global window object is an object that represents an open browser window of the browser,

compile the user code as an extension of the host application to produce a compiled bundle, and

provide the compiled bundle as an output.

11. The computing device of claim 10 , wherein the user code includes Typescript and the compiled bundle includes Javascript.

12. The computing device of claim 10 , wherein the browser when executed is further operable to:

prefix the magic string to the host package name.

13. The computing device of claim 10 , wherein the browser when executed is further operable to:

normalize the host package name.

14. The computing device of claim 10 , wherein the compiled bundle uses an application configuration of the host application.

15. A non-transitory electronic device readable medium having instructions that when executed on one or more processors of one or more electronic devices are operable to:

receive a request to compile user code;

retrieve contents of the user code and dependencies of the user code on one or more host packages of a host application;

append a magic string to the host package name to produce an appended host package name;

transform, compile and bundle the user code by a bundler to produce a compiled bundle, the transforming to import each host package by creating a property of a global window object of the browser that has a property name set to the appended host package name and a property value that is set to an entry point into the host package, wherein the global window object is an object that represents an open browser window of the browser, and the compiling to compile the user code as an extension of the host application in order to utilize the host packages in an already compiled form; and

provide the compiled bundle as an output.

16. The non-transitory electronic device readable medium of claim 15 , wherein the user code includes Typescript and the compiled bundle includes Javascript.

17. The non-transitory electronic device readable medium of claim 15 , wherein the instructions when executed are further operable to:

normalize the host package name; and

prefix the magic string to the host package name.

18. The non-transitory electronic device readable medium of claim 15 , wherein the compiled bundle uses an application configuration of the host application.

19. The non-transitory electronic device readable medium of claim 15 , wherein the instructions when executed are further operable to:

create a pseudo file system for retrieving files of the user code.

20. The method of claim 1 , wherein the user code comprises user styles, and the instructions when executed are further operable to:

compile the user styles separately from styles of the host application; and

bundle the user styles and import them as new style elements.

Assignments (2)
SECURITY INTEREST Recorded Oct 25, 2024
From: BENTLEY SYSTEMS, INCORPORATED
To: PNC BANK, NATIONAL ASSOCIATION
Reel/Frame 069268/0042 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 23, 2021
From: RETIEF, STEFAN
To: BENTLEY SYSTEMS, INCORPORATED
Reel/Frame 056958/0305 →