Front-end construction method and device, equipment and storage medium

By reusing built third-party code files in front-end development and only building third-party code files called by business source code, the problem of the growth of front-end construction time is solved, development efficiency and release speed is improved, code size and useless code number are reduced, and code reusability and maintainability are enhanced.

CN120540649APending Publication Date: 2025-08-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410216313.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-26
Publication Date
2025-08-26

AI Technical Summary

Technical Problem

In the prior art, it takes longer to convert source code to executable code using front-end construction tools during front-end development, resulting in reduced development efficiency and release speed, especially when the number of source code increases.

Method used

By obtaining the business source code and third-party code files in the front-end source code, we judge the existence of the built general code. If it exists, it will be reused. Otherwise, it will be built and uploaded to the decentralized management platform. Only the third-party code files called by the business source code are constructed, and the built general code is generated, and executable code is generated based on the built business code.

Benefits of technology

It effectively reduces the complexity of front-end construction time, improves development efficiency and release speed, reduces the executable code volume and useless code, and improves the reusability and maintainability of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120540649A_ABST
    Figure CN120540649A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a front-end construction method and device, equipment and a storage medium, which can be applied to various scenes such as cloud technology, artificial intelligence, intelligent traffic and auxiliary driving, and the method comprises the following steps: when a plurality of third-party code files called by a business source code are obtained, aiming at each third-party code file, establishing a third-party code file for each third-party code file; judging whether the corresponding constructed function codes are stored in an associated manner or not; and if yes, skipping a construction process of the third-party code file, directly obtaining a constructed function code of the third-party code file, and obtaining an executable code in combination with a constructed service code corresponding to the service source code. According to the method, the built function codes of the third-party code file generated in the past are reused for front-end building, so that the time for building the third-party code file is saved, the duration for converting the front-end source code into the executable code is shortened, the front-end development time is correspondingly shortened, the development efficiency of front-end development is improved, and the development cost is reduced. And reusability and maintainability of front-end codes are also improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a front-end construction method, apparatus, device, and storage medium. Background Art

[0002] With the rapid development of the Internet, the scale of applications has continued to expand, and the performance requirements for application front-ends have become increasingly higher. Therefore, front-end development has gradually become an important part of application development.

[0003] During the development of front-end development, many front-end programming languages ​​have emerged. However, source code written in these languages ​​cannot be directly executed in a browser or Node.js. In related technologies, after writing source code in a front-end programming language, a front-end build tool is used to build this source code into executable code suitable for a browser or Node.js. This executable code is then loaded into the browser or Node.js for execution.

[0004] However, as the amount of source code increases, the time required to convert the source code into executable code using front-end build tools becomes longer; accordingly, the front-end development time from writing the source code in the front-end programming language to running the executable code in the browser or Node.js also becomes longer, thereby affecting the development efficiency and release speed of the front-end development. Summary of the Invention

[0005] The embodiments of the present application provide a front-end construction method, apparatus, device and storage medium for improving the development efficiency and release speed of front-end development.

[0006] On the one hand, an embodiment of the present application provides a front-end construction method, including:

[0007] Obtaining front-end source code, the front-end source code including: business source code and multiple third-party code files called by the business source code;

[0008] Constructing the business source code to obtain corresponding constructed business code;

[0009] For the plurality of third-party code files, performing the following operations respectively: if a corresponding constructed universal code has been associated and saved with a file identifier corresponding to one of the third-party code files, obtaining the constructed universal code; if a corresponding constructed universal code has not been associated and saved with the file identifier of the third-party code file, constructing the third-party code file to obtain the corresponding constructed universal code;

[0010] An executable code is obtained based on the obtained plurality of constructed common codes and the constructed business code.

[0011] In one aspect, an embodiment of the present application provides a front-end construction device, comprising:

[0012] An acquisition module is used to acquire front-end source code, wherein the front-end source code includes: business source code and multiple third-party code files called by the business source code;

[0013] A construction module, used to construct the business source code to obtain the corresponding constructed business code;

[0014] The construction module is further configured to perform the following operations on the plurality of third-party code files: if a corresponding constructed universal code has been stored in association with a file identifier of a third-party code file, then the constructed universal code is obtained; if a corresponding constructed universal code has not been stored in association with the file identifier of the third-party code file, then the third-party code file is constructed to obtain the corresponding constructed universal code;

[0015] The processing module is used to obtain executable code based on the obtained multiple constructed common codes and the constructed business code.

[0016] Optionally, the building block is further configured to:

[0017] If the file identifier of a third-party code file is associated with the corresponding constructed universal code, the file identifier of the third-party code file is generated based on the file path information of the third-party code file before obtaining the constructed universal code.

[0018] Optionally, the file path information includes: the name of the third-party code library where the third-party code file is located, and the file name of the third-party code file;

[0019] The building blocks are specifically used for:

[0020] Obtaining version information of the third-party code library;

[0021] The name of the third-party code library, the version information of the third-party code library, and the file name of the third-party code file are concatenated to obtain a file identifier of the third-party code file.

[0022] Optionally, the building block is specifically used to:

[0023] If the local storage contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is obtained from the local storage.

[0024] Optionally, the building block is further configured to:

[0025] If the local storage does not contain the constructed universal code associated with the file identifier, querying a decentralized management platform based on the file identifier, the management platform being used to store the file identifiers and corresponding constructed universal codes reported by multiple front-end development nodes;

[0026] If the management platform includes the constructed universal code associated with the file identifier, the constructed universal code is downloaded from the management platform.

[0027] Optionally, the building block is specifically used to:

[0028] If the decentralized management platform contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is downloaded from the management platform, and the management platform is used to save the file identifiers reported by multiple front-end development nodes and the corresponding constructed universal code.

[0029] Optionally, the building block is further configured to:

[0030] If there is no associated built universal code stored for the file identifier of the third-party code file, building the third-party code file, obtaining the corresponding built universal code, and then saving the file identifier and the corresponding built universal code in local storage;

[0031] The file identifier and the corresponding constructed universal code are uploaded to a decentralized management platform so that the management platform can store the file identifier and the corresponding constructed universal code in association with each other. The management platform is used to store the file identifiers and the corresponding constructed universal code reported by multiple front-end development nodes.

[0032] Optionally, the building block is further configured to:

[0033] The constructed universal codes not included in the local storage are downloaded from the management platform on a regular basis.

[0034] Optionally, the building block is further configured to:

[0035] For the multiple built common codes in the local storage, perform the following steps respectively:

[0036] Periodically obtaining a first version number of a constructed universal code and a second version number of the latest version corresponding to the constructed universal code in the management platform;

[0037] If the version number difference between the second version number and the first version number is greater than or equal to a preset threshold, the constructed universal code is deleted.

[0038] On the one hand, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned front-end construction method when executing the program.

[0039] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by a computer device. When the program is run on the computer device, the computer device executes the steps of the above-mentioned front-end construction method.

[0040] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer device, the computer device executes the steps of the above-mentioned front-end construction method.

[0041] In an embodiment of the present application, when obtaining multiple third-party code files called by the business source code, for each third-party code file, it is determined whether the corresponding constructed function code has been associated and saved. If it is included, the construction process of the third-party code file is skipped, and the constructed function code of the third-party code file is directly obtained, and the executable code is obtained in conjunction with the constructed business code corresponding to the business source code. By reusing the constructed function code of the third-party code file generated in the past for front-end construction, the time spent on building the third-party code file is saved, which shortens the time it takes to convert the front-end source code into executable code. Accordingly, the front-end development time from writing the source code in the front-end programming language to running the executable code in the browser or Node.js is also shortened, thereby improving the development efficiency and release speed of the front-end development.

[0042] Secondly, by reusing the built functional code of the third-party code files generated in the past for front-end construction, the time complexity of the front-end construction process is reduced to a constant level, effectively solving the problem of the corresponding increase in front-end construction time in scenarios with an increasing amount of code, while improving the reusability and maintainability of the front-end code.

[0043] In addition, this application only builds multiple third-party code files called by the business source code, rather than building and packaging all third-party code files in the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the time for front-end construction, thereby improving the development efficiency of front-end development. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0045] Figure 1 A schematic diagram of the structure of a system architecture provided in an embodiment of the present application;

[0046] Figure 2A A schematic diagram of an application scenario provided in an embodiment of the present application;

[0047] Figure 2B A schematic diagram of an application scenario provided in an embodiment of the present application;

[0048] Figure 2C A schematic diagram of an application scenario provided in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of a front-end construction method provided in an embodiment of the present application;

[0050] Figure 4 A flowchart of a method for saving constructed universal code provided in an embodiment of the present application;

[0051] Figure 5 A flowchart of a method for cleaning constructed general code provided in an embodiment of the present application;

[0052] Figure 6 A flowchart of a method for downloading constructed universal code provided in an embodiment of the present application;

[0053] Figure 7 A flowchart of a method for downloading constructed universal code provided in an embodiment of the present application;

[0054] Figure 8 A flowchart of a method for downloading constructed universal code provided in an embodiment of the present application;

[0055] Figure 9 A schematic diagram of a front-end construction method provided in an embodiment of the present application;

[0056] Figure 10 A schematic diagram of the structure of a front-end construction device provided in an embodiment of the present application;

[0057] Figure 11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and beneficial effects of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0059] For ease of understanding, the terms involved in the embodiments of the present invention are explained below.

[0060] Front-end development: The process of creating front-end interfaces such as web pages or apps to present to users, using HTML, CSS, JavaScript, and various derived technologies, frameworks, and solutions to implement user interface interactions for Internet products.

[0061] HTML: A markup language that creates web pages and displays them in browsers. It eliminates barriers to information exchange between computers. As a result, it is the most widely used language on the Internet and the primary language for web documents. HTML5, the latest version of HTML, introduces several new technologies that significantly enhance its application support, extending web technology beyond simply presenting web content.

[0062] CSS (Cascading Style Sheets) is a computer language used to express the styles of documents such as HTML and XML. CSS can not only statically modify web pages, but can also be used with various scripting languages ​​to dynamically format web page elements. CSS enables pixel-perfect control over the placement and layout of web page elements, supports a variety of font sizes, and allows for editing the styles of web page objects and models.

[0063] JavaScript, abbreviated as JS, is a lightweight, interpreted or just-in-time compiled programming language with a function-first architecture. JavaScript is an interpreted scripting language, meaning it is interpreted line by line as the program runs. JavaScript is also an object-based scripting language, allowing you to create objects and manipulate existing ones. JavaScript is operating system-independent and only requires browser support. Therefore, once written, a JavaScript script can be used on any machine, provided the browser supports JavaScript.

[0064] JavaScript's main functions include: 1. Embedding dynamic text in HTML pages. 2. Responding to browser events. 3. Reading and writing HTML elements. 4. Validating data before submitting it to the server. 5. Detecting visitor browser information. Controlling cookies, including creating and modifying them. 6. Server-side programming based on Node.js technology.

[0065] Front-end build: Converting front-end source code (i.e., source code written in a front-end programming language) into a format that can be understood and executed by a browser or Node.js server. This code, adapted for use in a browser or Node.js, is executable code that displays and runs correctly within the browser or Node.js server. Node.js is an open-source, cross-platform JavaScript runtime environment. Front-end build typically includes code compilation, code compression, code bundling, resource optimization, and unit testing. Front-end build can be implemented using front-end build tools, such as webpack and vite, which can improve the performance and maintainability of front-end code.

[0066] Decentralization: This refers to a system or network where there is no single centralized control body or node, but rather multiple nodes that jointly maintain and manage the system. The goal of decentralization is to improve system reliability, security, and scalability, avoid single points of failure and attack, and achieve a better-performing network environment.

[0067] Content Delivery Network (CDN) is an intelligent virtual network built on top of the internet, consisting of node servers placed throughout the network. The CDN system can redirect network requests to the node server closest to the client in real time based on comprehensive information such as network traffic, node server connectivity, load status, distance to the client, and response time. Its purpose is to enable clients to obtain the required content locally, alleviate network congestion, and improve website response speeds.

[0068] The following is an introduction to the design concept of the embodiments of the present application.

[0069] During the front-end development process, the front-end source code written in a front-end programming language cannot be directly executed in a browser or Node.js. In related technologies, after the source code is written in a front-end programming language, a front-end build tool is used to build the source code into executable code suitable for a browser or Node.js. The executable code is then loaded into the browser or Node.js to run.

[0070] However, as the amount of source code increases, the time required to convert the source code into executable code using front-end build tools becomes longer; the front-end development time from writing the source code in a front-end programming language to running the executable code in a browser or Node.js also becomes longer, thereby affecting the development efficiency and release speed of front-end development.

[0071] In actual front-end development, front-end source code typically consists of two types of source code: business source code related to the actual business logic, and third-party code libraries that are unrelated to the actual business logic. The number of third-party code files in third-party code libraries far exceeds the number of business source code files. Consequently, building each third-party code file in the third-party code library takes significantly longer than building the business source code.

[0072] In fact, third-party code files tend not to change frequently. For example, the function files in the third-party tool library are updated less frequently. Secondly, since the third-party code files are not related to the actual business logic, but serve as auxiliary codes for front-end development, the third-party code files can be called as general function files by various business source codes, that is, the probability of reuse is high. In view of this, the embodiment of the present application proposes to reuse the construction results of the third-party code files.

[0073] On the other hand, considering that different front-end development functions require different corresponding business source code, even for the same business function, different front-end development nodes may use different development logic, resulting in significant differences in the business source code. In other words, business source code tends to change frequently, meaning the probability of reuse is low. Furthermore, the number of business source code files is typically small. Therefore, this application directly constructs the business source code to obtain the construction result.

[0074] Furthermore, considering that third-party code repositories typically contain many third-party code files, a business source code often only requires a few of these third-party code files. If all third-party code files in the third-party code repositories are built and packaged during the front-end build, this will undoubtedly increase the size of the final executable code and the amount of useless code, while also increasing the length of the front-end build. Therefore, this application only builds the multiple third-party code files called by the business source code.

[0075] In view of the above, the present invention provides a front-end construction method, the execution process of which is as follows:

[0076] Obtain the front-end source code, which includes: business source code and multiple third-party code files called by the business source code; build the business source code to obtain the corresponding built business code.

[0077] For multiple third-party code files, the following operations are performed respectively: if the file identifier of a third-party code file is associated with the corresponding constructed function code, the constructed function code is obtained; if the file identifier of the third-party code file is not associated with the corresponding constructed function code, the third-party code file is constructed to obtain the corresponding constructed function code.

[0078] Based on the obtained multiple constructed function codes and constructed business codes, executable codes are obtained.

[0079] In an embodiment of the present application, when obtaining multiple third-party code files called by the business source code, for each third-party code file, it is determined whether the corresponding constructed function code has been associated and saved. If it is included, the construction process of the third-party code file is skipped, and the constructed function code of the third-party code file is directly obtained, and the executable code is obtained in conjunction with the constructed business code corresponding to the business source code. By reusing the constructed function code of the third-party code file generated in the past for front-end construction, the time spent on building the third-party code file is saved, which shortens the time it takes to convert the front-end source code into executable code. Accordingly, the front-end development time from writing the source code in the front-end programming language to running the executable code in the browser or Node.js is also shortened, thereby improving the development efficiency and release speed of the front-end development.

[0080] Secondly, by reusing the built functional code of the third-party code files generated in the past for front-end construction, the time complexity of the front-end construction process is reduced to a constant level, effectively solving the problem of the corresponding increase in front-end construction time in scenarios with an increasing amount of code, while improving the reusability and maintainability of the front-end code.

[0081] In addition, this application only builds multiple third-party code files called by the business source code, rather than building and packaging all third-party code files in the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the time for front-end construction, thereby improving the development efficiency of front-end development.

[0082] The following is a brief introduction to the system architecture diagram to which the technical solution of the embodiment of the present application can be applied. It should be noted that the system architecture diagram introduced below is only used to illustrate the embodiment of the present application and is not limiting.

[0083] refer to Figure 1, which is a system architecture diagram applicable to an embodiment of the present application. The system architecture includes at least a front-end development node 101 and a decentralized management platform 102. The number of front-end development nodes 101 can be one or more. This application does not specifically limit the number of front-end development nodes 101.

[0084] The front-end development node 101 is a device that executes the front-end development process, wherein the front-end development process includes the process of performing front-end construction on the front-end source code to obtain executable code.

[0085] In actual applications, the front-end development node 101 may include terminal devices, including but not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc.

[0086] The front-end development node 101 can also be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0087] The decentralized management platform 102 is used to manage the constructed functional codes corresponding to third-party code files. Each front-end development node 101 can build the third-party code files and upload the obtained constructed functional codes to the decentralized management platform 102. Of course, each front-end development node 101 can also synchronize the constructed functional codes in the decentralized management platform 102 and reuse the constructed functional codes to build the front-end source code locally.

[0088] The decentralized management platform 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0089] The front-end development node 101 and the decentralized management platform 102 can be directly or indirectly connected to each other through one or more networks. The network can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a wireless fidelity (Wireless-Fidelity, WIFI) network. Of course, it can also be other possible networks, and the embodiments of the present application do not limit this. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.

[0090] The following is a brief introduction to the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limiting.

[0091] Application scenario 1: Multiple front-end development nodes 101 jointly complete the development of an application, and each front-end development node 101 is responsible for developing one or more functional modules in the application.

[0092] For example, see Figure 2A The application includes: functional module 1, functional module 2 and functional module 3. The front-end development node 101-1 is responsible for developing functional module 1, the front-end development node 101-2 is responsible for developing functional module 2, and the front-end development node 101-3 is responsible for developing functional module 3.

[0093] The decentralized management platform 102 is used to store the constructed functional codes of third-party code files reported by multiple front-end development nodes.

[0094] When each front-end development node 101 develops a corresponding functional module, it can download the constructed functional code from the decentralized management platform 102 to build the front-end.

[0095] Application scenario 2: Among multiple front-end development nodes 101, each front-end development node 101 is used for one application, and there is no association between different applications.

[0096] For example, see Figure 2B Front-end development nodes 101-1 are used to develop a first application, which includes functional modules 1, 2, and 3. Front-end development nodes 101-2 are used to develop a second application, which includes functional modules 4 and 5. Front-end development nodes 101-3 are used to develop a third application, which includes functional modules 6 and 7.

[0097] The decentralized management platform 102 is used to store the constructed functional codes of third-party code files reported by multiple front-end development nodes.

[0098] When each front-end development node 101 develops a corresponding application, it can download the constructed functional code from the decentralized management platform 102 to build the front-end.

[0099] Application scenario three: Among multiple front-end development nodes 101, some front-end development nodes 101 develop an application independently, and some front-end development nodes 101 jointly complete the development of an application. There is no connection between different applications.

[0100] For example, see Figure 2C Front-end development node 101-1 is used to develop a first application, which includes functional module 1, functional module 2, and functional module 3. Front-end development node 101-2 and front-end development node 101-3 jointly develop a second application, wherein front-end development node 101-2 is used to develop functional module 4 in the second application, and front-end development node 101-3 is used to develop functional module 5 in the second application.

[0101] The decentralized management platform 102 is used to store the constructed functional codes of third-party code files reported by multiple front-end development nodes.

[0102] When each front-end development node 101 develops a corresponding application or module, it can download the constructed functional code from the decentralized management platform 102 to build the front-end.

[0103] It should be noted that the application scenarios applicable to the embodiments of the present application are not limited to the above-mentioned ones. During the specific implementation process, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.

[0104] Below, in combination with the system architecture and application scenarios described above, the method provided by the exemplary embodiment of the present application is described with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation of the present application is not limited in this respect.

[0105] See also Figure 3 , provides a process of a front-end construction method for the embodiment of the present application, the process of the method is executed by a computer device, the computer device can be Figure 1 The front-end development node shown in the figure, the specific implementation process of this method is as follows:

[0106] Step 301: Obtain front-end source code, which includes: business source code and multiple third-party code files called by the business source code.

[0107] The business source code is a source code written in a front-end programming language, wherein the front-end programming language includes but is not limited to: HTML, JavaScript, Java language, PHP language, and Python language.

[0108] JavaScript is a web-based scripting language widely used in web application development. As a dynamic programming language, it's primarily used to enhance website interactivity. As an interpreted programming language that runs in a browser, its advantages are obvious, such as the ability to easily drive web pages and interact with users across platforms and browsers. JavaScript can also be used to develop many web frameworks, such as Angular.js, Ember.js, and JavaScript MVC.

[0109] HTML is a markup language that enables web pages to be displayed in browsers. It eliminates barriers to information exchange between different computers and is the primary language for web documents. HTML5 is the latest version of HTML.

[0110] In this application, business source code refers to source code related to the actual business logic. The third-party code files called by the business source code can come from one or more third-party code libraries. The code files in the third-party code library are often more general and have nothing to do with the actual business logic.

[0111] A third-party code library can be a third-party tool library. For example, consider lodash, a consistent, modular, and high-performance JavaScript utility library that includes many functional file tools required for business development. Suppose the business source code calls the clone.js file in lodash but not other files in lodash (such as findIndex.js). In this case, only the clone.js file in lodash needs to be built, not the findIndex.js file.

[0112] A third-party code library can also be an open source library. For example, the third-party code library is Mono Icon, which is an open source icon that can be embedded in HTML pages during front-end development.

[0113] The third-party code library can also be a common component library within the team, or a common component library of other teams, etc. This application does not make specific limitations on this.

[0114] In this application, we build at the granularity of third-party code files rather than the entire third-party code library. However, in actual applications, third-party code libraries contain many third-party code files, and the third-party code called by the front-end source code may come from multiple third-party code libraries. Therefore, it is possible that third-party code files have the same file name.

[0115] In order to avoid repeatedly building the same third-party code file during the construction process, this application generates a file identifier of the third-party code file based on the file path information of the third-party code file for each third-party code file called by the business source code.

[0116] Specifically, the business source code embeds the file path information of each of the multiple third-party code files called, so the file path information of the third-party code files can be directly obtained from the business source code. The file identifier of the third-party code file can be a unique file number of the third-party code file, which is used to uniquely identify the third-party code file.

[0117] In some embodiments, the file path information of the third-party code file may be an absolute path of the third-party code file. The file path information includes: the name of the third-party code library where the third-party code file is located, and the file name of the third-party code file.

[0118] First, obtain the version information of the third-party code library. Then, concatenate the name of the third-party code library, the version information of the third-party code library, and the file name of the third-party code file to obtain the file identifier of the third-party code file. During the concatenation process, the name of the third-party code library, the version information of the third-party code library, and the file name of the third-party code file are separated by a concatenation symbol, where the concatenation symbol can be a symbol such as @ or ||.

[0119] For example, the business source code needs to call the clone.js file in the third-party tool library lodash. The absolute path of the clone.js file is: / usr / lodash / clone.js. From the absolute path of the clone.js file, you can obtain the name of the third-party code library: lodash, and the file name of the third-party code file: clone.js.

[0120] Then get the version information of the third-party code library lodash: 1.0.0. Concatenate the name of the third-party code library: lodash, the version information of the third-party code library: 1.0.0, and the file name of the third-party code file: lodash to obtain the file identifier of the third-party code file as shown below:

[0121] lodash@1.0.0@clone.js

[0122] In the embodiments of the present application, the third-party code files called by the business source code are obtained at the granularity of files in the third-party code library, and then only the called third-party code files are built, rather than building the entire third-party code library at the granularity of the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the length of the front-end build and improves the efficiency of front-end development. Secondly, by generating a unique identifier for each third-party code file, build conflicts are prevented, avoiding duplication of code files in the final packaging process, thereby improving the effectiveness of the front-end build.

[0123] Step 302: construct the service source code to obtain the corresponding constructed service code.

[0124] Specifically, the front-end construction tool is used to compile the business source code to obtain the corresponding constructed business code. In the actual compilation process, in order to increase the compilation efficiency, the directories or files that do not need to be compiled can be excluded.

[0125] In some embodiments, the business source code is compiled, and then the compiled file is compressed to obtain the constructed business code. The compressed code file will remove line breaks and spaces, modify variable names, delete comments or print statements, etc.

[0126] Step 303 , for multiple third-party code files, perform the following operations respectively: if the file identifier of a third-party code file does not have associated corresponding constructed universal code, then construct the third-party code file to obtain the corresponding constructed universal code.

[0127] In the present application, after obtaining the file identifier of the third-party code file, it is first determined whether the file identifier corresponding to the third-party code file has been associated and saved with the corresponding constructed universal code.

[0128] If the third-party code file is being built for the first time, the corresponding built common code is not saved. Therefore, a front-end build tool is used to build the third-party code file to obtain the corresponding built common code. The front-end build tool can be webpack, vite, etc.

[0129] For example, because build tools like Vite handle file granularity more clearly, a corresponding plugin can be written using Vite. The plugin then generates a file number for the third-party code file based on its absolute path. Furthermore, the plugin builds the third-party code file to obtain the corresponding built common code. Finally, the plugin writes the built common code to the file corresponding to the file number and stores it.

[0130] In actual applications, building third-party code files to obtain the corresponding built universal code includes at least the following implementation methods:

[0131] Implementation method 1: Compile the third-party code file to obtain the corresponding constructed functional code. In the actual compilation process, in order to increase the compilation efficiency, the directories or files that do not need to be compiled can be excluded.

[0132] Implementation method 2: compile the third-party code file to obtain a compiled code file, and then compress the compiled code file, that is, remove line breaks and spaces, modify variable names, delete comments or print statements, etc. in the compiled code file to obtain the constructed functional code.

[0133] Implementation method three: Compile the third-party code file to obtain a compiled code file. Then compress the compiled code file by removing line breaks and spaces, modifying variable names, and deleting comments or print statements to obtain a compressed code file. Then, optimize the compressed code file to remove unused code and obtain the constructed functional code.

[0134] In some embodiments, see Figure 4 ,After obtaining the build result of the third-party code file (ie, the ,built universal code), the file identifier of the third-party ,code file and the corresponding built universal code are saved in the ,local storage.

[0135] Specifically, local storage can be flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read only memory (PROM), read only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, disk, optical disk, etc.

[0136] If only the file identifiers of third-party code files and the corresponding built common code are saved in local storage, the following problems may occur:

[0137] As more and more code files are added, the storage space occupied in local storage will also increase. When the local storage space is cleared, code data will be lost. Secondly, because only the built common code of third-party code files is saved in local storage, each front-end development node can only reuse the built functional code in local storage. At the same time, each front-end development node cannot share the built functional code obtained locally with other front-end development nodes for reuse. This leads to the duplication of some third-party code files, which affects the efficiency of front-end development.

[0138] In view of this, in this application, in addition to saving the file identification of the third-party code file and the corresponding constructed universal code in the local storage, the file identification of the third-party code file and the corresponding constructed universal code are also uploaded to the decentralized management platform, and the management platform associates and saves the file identification and the corresponding constructed universal code.

[0139] The management platform is used to store file identifiers and corresponding built common codes reported by multiple front-end development nodes. In actual applications, file identifiers and corresponding built common codes are stored on the file storage service of the management platform.

[0140] Among them, the file storage service can be a data storage service based on cloud computing technology, that is, the code files are stored in a distributed storage system in a dispersed manner.

[0141] Specifically, code files are stored in multiple copies. When a failure occurs, the backup copy is automatically switched to ensure that data is not lost, thereby ensuring high data storage reliability. Secondly, the distributed architecture and support for horizontal expansion allow storage capacity to be increased at any time as needed, thus ensuring high scalability of data storage. In addition, the distributed read-write architecture supports concurrent access and provides high-performance file read and write services, thus ensuring high data storage performance. Furthermore, a visual management interface and API interface are provided to facilitate user management of storage space and code files.

[0142] Of course, file storage services can also refer to: flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read only memory (PROM), read only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memory, disk, optical disk, etc.

[0143] In an embodiment of the present application, a decentralized management node is used to centrally store and manage the build products of multiple front-end development nodes, making it easier for front-end development nodes to reuse the build products generated by other front-end development nodes, thereby improving the reusability and maintainability of the front-end code.

[0144] In this application, the front-end development node can upload the built universal code of the third-party code file to the management platform, and then download the built universal code that is not included in the local storage from the management platform. The front-end development node can also periodically download the built universal code that is not included in the local storage from the management platform. The front-end development node can also download the built universal code that is not included in the local storage from the management platform when receiving a data update message issued by the management platform.

[0145] Since the build artifacts (i.e., built common code) obtained by each front-end development node are limited, and the management platform contains build artifacts uploaded by multiple front-end development nodes, the front-end development node can skip the build process of some third-party code files by synchronizing the build artifacts stored on the management platform to local storage, avoiding repeated construction of third-party code files. This not only improves the reusability and maintainability of the front-end code, but also saves computing resources. Secondly, regularly synchronizing build artifacts from the management platform to local storage avoids frequent remote downloads of build artifacts, thereby saving communication resources.

[0146] In some embodiments, the local storage space of the front-end development node is limited. As the front-end development node stores more and more constructed universal code, the remaining local storage space decreases. When the remaining local storage space reaches a preset threshold, it becomes unable to store any further newly acquired constructed universal code.

[0147] In view of this, in the embodiment of the present application, by setting a timer task, the built universal code in the local storage is regularly cleaned up. Specifically, for multiple built universal codes in the local storage, the following steps are performed respectively:

[0148] Periodically obtain a first version number of a built universal code and a second version number of the latest version corresponding to the built universal code in the management platform. If the version number difference between the second version number and the first version number is greater than or equal to a preset threshold, delete the built universal code.

[0149] If the difference between the second version number and the first version number is less than a preset threshold, the constructed universal code is retained. The preset threshold can be a positive integer such as 2, 3, or 4. The preset threshold represents the number of versions of the constructed universal code stored locally for business use.

[0150] For example, see Figure 5 , setting the preset threshold to 3. For third-party code file X, the local storage contains four versions of built general code: built general code V1, built general code V2, built general code V3, and built general code V4. For third-party code file X, the latest version of built general code contained in the management platform is built general code V4.

[0151] When the scheduled task is triggered, based on the file number of the third-party code file X, the version number of the latest version of the built common code (V4) is obtained from the management platform.

[0152] For the constructed universal code V1 in the local storage, since the version number (V1) of the constructed universal code V1 differs by 3 versions from the version number (V4) of the latest version of the constructed universal code, that is, the number of versions that differ is equal to the preset threshold, the constructed universal code V1 is deleted from the local storage.

[0153] For the constructed general code V2 in the local storage, since the version number (V2) of the constructed general code V2 differs from the version number (V4) of the latest version of the constructed general code by 2 versions, that is, the number of versions that differ is less than the preset threshold, the local storage retains the constructed general code V2.

[0154] Similarly, the local storage retains the built universal code V3 and the built universal code V4.

[0155] In an embodiment of the present application, older versions of constructed common codes in local storage are regularly cleared, and the latest multiple versions of constructed common codes are retained for business use. This ensures that the constructed common codes are reused during front-end construction, thereby improving front-end construction efficiency. At the same time, regular cleaning of local storage ensures the availability of local storage.

[0156] Step 304: If the file identifier corresponding to a third-party code file is associated with and saved with the corresponding constructed universal code, the constructed universal code is obtained.

[0157] If this is not the first time that the third-party code file is built, that is, the third-party code file has been built before, and the file identifier of the third-party code file is associated with the obtained built universal code and saved, the built universal code is directly obtained.

[0158] In practical applications, the embodiments of the present application provide at least the following methods for obtaining the constructed universal code:

[0159] In the first implementation mode, if the local storage contains constructed universal code associated with a file identifier of a third-party code file, the constructed universal code is obtained from the local storage.

[0160] Specifically, the file identifier of the third-party code file is used to query the local storage to determine whether the local storage contains matching built universal code. If so, the built universal code is directly obtained. This built universal code may be locally built by the front-end development node or downloaded from the management platform.

[0161] In some embodiments, if the local storage does not contain the constructed universal code associated with the file identifier, a decentralized management platform is queried based on the file identifier. If the management platform contains the constructed universal code associated with the file identifier, the constructed universal code is downloaded from the management platform.

[0162] In practical applications, see Figure 6 When the management platform is a separate physical server, the front-end development node sends a download request with a file identifier to the management platform. After receiving the download request, the management platform extracts the file identifier from the download request and then queries the file storage service based on the file identifier to obtain the corresponding built universal code. The management platform then sends a download response message with the built universal code to the front-end development node.

[0163] The front-end development node extracts the built common code from the download response message and saves the built common code in local storage.

[0164] See also Figure 7 When the management platform is a CDN system, the CDN system includes: a domain name management system (Domain Name System, referred to as DNS), an origin server and multiple CDN nodes.

[0165] The front-end development node initiates a download request with the file identifier to the DNS. The DNS resolves the domain name of the download request, obtains the IP address of the CDN node, and sends the download request to the CDN node. This CDN node can be the CDN node that is geographically closest to the front-end development node among multiple CDN nodes.

[0166] After receiving the download request, the CDN node extracts the file identifier from the download request and then queries the cache based on the file identifier to see if the corresponding built universal code exists. If so, the cached built universal code is directly returned to the front-end development node.

[0167] If not, the CDN node initiates a request to the origin server to obtain the built universal code corresponding to the file identifier. After receiving the request from the CDN node, the origin server returns the built universal code corresponding to the file identifier to the CDN node. After receiving the built universal code returned by the origin server, the CDN node caches the file identifier and the corresponding built universal code, and then returns the built universal code to the front-end development node.

[0168] The front-end development node saves the built common code in local storage.

[0169] See also Figure 8 When the management platform is a server cluster, the server cluster includes multiple cluster hosts. The front-end development node sends a download request carrying a file identifier to the server cluster. The server cluster maps the download request to one of the multiple cluster hosts based on network load balancing technology.

[0170] After receiving the download request, the cluster host extracts the file identifier from the download request, then queries the storage area based on the file identifier to obtain the corresponding constructed universal code, and then sends a download response message carrying the constructed universal code to the front-end development node.

[0171] The front-end development node extracts the built common code from the download response message and saves the built common code in local storage.

[0172] In an embodiment of the present application, by reusing the constructed functional code stored locally or in a decentralized management platform for front-end construction, the time complexity of the front-end construction process is reduced to a constant level, effectively solving the problem of the corresponding increase in front-end construction time in scenarios with an increasing amount of code, improving the front-end development efficiency, and at the same time improving the reusability and maintainability of the front-end code.

[0173] In the second implementation mode, since the decentralized management platform contains build products uploaded by multiple front-end development nodes, the build products saved in the management platform are more comprehensive than the build products saved by a single front-end development node.

[0174] Given this, in this application, the step of querying the local storage for the built universal code of the third-party code file can be skipped, and the decentralized management platform can be directly queried based on the file identifier of the third-party code file. If the management platform contains the built universal code associated with the file identifier of the third-party code file, the built universal code is downloaded from the management platform. The specific process of downloading the built universal code has been described above and will not be repeated here.

[0175] In an embodiment of the present application, since the management platform saves the constructed common codes uploaded by multiple front-end development nodes, the construction products saved in the management platform are more comprehensive. Therefore, when the constructed common code is downloaded from the management platform directly based on the file identifier of the third-party code file, the probability of obtaining the constructed common code can be effectively improved, thereby improving the efficiency of the front-end construction.

[0176] Step 305: Obtain executable code based on the obtained multiple constructed general codes and constructed business codes.

[0177] Specifically, the multiple constructed general codes and constructed business codes are combined and packaged to obtain one or more resource files. In actual applications, a multi-process parallel processing approach is adopted to combine and package the multiple constructed general codes and constructed business codes. This not only improves the packaging speed but also reduces the use of computer system resources during the packaging process, making the development process smoother for developers. Furthermore, the obtained resource files are optimized and compressed to obtain executable code.

[0178] After obtaining the executable code, it undergoes code verification and unit testing. When the executable code is verified to be compliant with the specifications and passes the unit tests, it is submitted to the code repository. Furthermore, the executable code is passed to the publishing system, which runs the executable code in the browser.

[0179] On the other hand, changes to the local front-end source code are detected in real time. When the front-end source code changes, it is automatically rebuilt to obtain executable code, which is then passed to the publishing system. The publishing system runs the executable code in the browser and refreshes the browser.

[0180] In an embodiment of the present application, when obtaining multiple third-party code files called by the business source code, for each third-party code file, it is determined whether the corresponding constructed function code has been associated and saved. If it is included, the construction process of the third-party code file is skipped, and the constructed function code of the third-party code file is directly obtained, and the executable code is obtained in conjunction with the constructed business code corresponding to the business source code. By reusing the constructed function code of the third-party code file generated in the past for front-end construction, the time spent on building the third-party code file is saved, which shortens the time it takes to convert the front-end source code into executable code. Accordingly, the front-end development time from writing the source code in the front-end programming language to running the executable code in the browser or Node.js is also shortened, thereby improving the development efficiency and release speed of the front-end development.

[0181] Secondly, by reusing the built functional code of the third-party code files generated in the past for front-end construction, the time complexity of the front-end construction process is reduced to a constant level, effectively solving the problem of the corresponding increase in front-end construction time in scenarios with an increasing amount of code, while improving the reusability and maintainability of the front-end code.

[0182] In addition, this application only builds multiple third-party code files called by the business source code, rather than building and packaging all third-party code files in the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the time for front-end construction, thereby improving the development efficiency of front-end development.

[0183] In order to better explain the embodiment of the present application, the following describes a front-end construction method provided by the embodiment of the present application in combination with a specific implementation scenario. The process of the method can be as follows: Figure 1 The front-end development node 101 shown in FIG. 101 is executed, including the following steps: Figure 9 As shown:

[0184] Step 901: The front-end development node obtains the front-end source code of the video application.

[0185] The front-end source code includes: the business source code and multiple third-party code files called by the business source code. For each third-party code file, the subsequent steps 902 to 910 are executed.

[0186] In step 902, the front-end development node generates a corresponding file number based on the absolute path of the third-party code file.

[0187] Step 903: The front-end development node queries the local storage based on the file number.

[0188] In step 904 , the front-end development node determines whether the local storage contains the constructed universal code that matches the file number. If so, step 905 is executed; otherwise, step 906 is executed.

[0189] In step 905 , the front-end development node skips the construction process of the third-party code file and obtains the constructed common code of the third-party code file from the local storage.

[0190] In step 906, the front-end development node queries the decentralized management platform based on the file number.

[0191] In step 907 , the front-end development node determines whether the management platform includes the constructed universal code matching the file number. If so, step 908 is executed; otherwise, step 909 is executed.

[0192] In step 908 , the front-end development node skips the construction process of the third-party code file and downloads the constructed universal code of the third-party code file from the management platform.

[0193] Step 909: The front-end development node builds the third-party code file to obtain the built universal code.

[0194] In step 910, the front-end development node uploads the constructed universal code to the management platform.

[0195] In step 911, the front-end development node constructs the business source code to obtain the constructed business code.

[0196] In step 912, the front-end development node combines and packages the obtained constructed business code and the plurality of constructed common codes to obtain a resource file.

[0197] In step 913, the front-end development node optimizes and compresses the resource file to obtain executable code.

[0198] In step 914, the front-end development node loads the executable code into the browser for execution.

[0199] In the embodiment of the present application, by reusing the constructed functional code of the third-party code files generated in the past for front-end construction, the time spent on constructing the third-party code files is saved, which shortens the front-end construction time. Correspondingly, the front-end development time is also shortened, thereby improving the development efficiency and release speed of the front-end development.

[0200] Secondly, by reusing the built functional code of the third-party code files generated in the past for front-end construction, the time complexity of the front-end construction process is reduced to a constant level. Even in scenarios where the amount of code increases, the front-end construction time will not increase accordingly, thereby improving development efficiency and the reusability and maintainability of the front-end code.

[0201] In addition, this application only builds multiple third-party code files called by the business source code, rather than building and packaging all third-party code files in the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the time for front-end construction, thereby improving the development efficiency of front-end development.

[0202] Based on the same technical concept, the embodiment of the present application provides a structural diagram of a front-end construction device, such as Figure 10 As shown, the front-end construction device 1000 includes:

[0203] An acquisition module 1001 is configured to acquire a front-end source code, wherein the front-end source code includes a business source code and a plurality of third-party code files called by the business source code;

[0204] A construction module 1002 is used to construct the business source code to obtain the corresponding constructed business code;

[0205] The construction module 1002 is further configured to perform the following operations on the plurality of third-party code files: if a corresponding constructed universal code has been stored in association with a file identifier of a third-party code file, then the constructed universal code is obtained; if a corresponding constructed universal code has not been stored in association with the file identifier of the third-party code file, then the third-party code file is constructed to obtain the corresponding constructed universal code;

[0206] The processing module 1003 is configured to obtain executable code based on the obtained multiple constructed general codes and the constructed business code.

[0207] Optionally, the building module 1002 is further configured to:

[0208] If the file identifier of a third-party code file is associated with the corresponding constructed universal code, the file identifier of the third-party code file is generated based on the file path information of the third-party code file before obtaining the constructed universal code.

[0209] Optionally, the file path information includes: the name of the third-party code library where the third-party code file is located, and the file name of the third-party code file;

[0210] The building block 1002 is specifically configured to:

[0211] Obtaining version information of the third-party code library;

[0212] The name of the third-party code library, the version information of the third-party code library, and the file name of the third-party code file are concatenated to obtain a file identifier of the third-party code file.

[0213] Optionally, the building module 1002 is specifically configured to:

[0214] If the local storage contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is obtained from the local storage.

[0215] Optionally, the building module 1002 is further configured to:

[0216] If the local storage does not contain the constructed universal code associated with the file identifier, querying a decentralized management platform based on the file identifier, the management platform being used to store the file identifiers and corresponding constructed universal codes reported by multiple front-end development nodes;

[0217] If the management platform includes the constructed universal code associated with the file identifier, the constructed universal code is downloaded from the management platform.

[0218] Optionally, the building module 1002 is specifically configured to:

[0219] If the decentralized management platform contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is downloaded from the management platform, and the management platform is used to save the file identifiers reported by multiple front-end development nodes and the corresponding constructed universal code.

[0220] Optionally, the building module 1002 is further configured to:

[0221] If there is no associated built universal code stored for the file identifier of the third-party code file, building the third-party code file, obtaining the corresponding built universal code, and then saving the file identifier and the corresponding built universal code in local storage;

[0222] The file identifier and the corresponding constructed universal code are uploaded to a decentralized management platform so that the management platform can store the file identifier and the corresponding constructed universal code in association with each other. The management platform is used to store the file identifiers and the corresponding constructed universal code reported by multiple front-end development nodes.

[0223] Optionally, the building module 1002 is further configured to:

[0224] The constructed universal codes not included in the local storage are downloaded from the management platform on a regular basis.

[0225] Optionally, the building module 1002 is further configured to:

[0226] For the multiple built common codes in the local storage, perform the following steps respectively:

[0227] Periodically obtaining a first version number of a constructed universal code and a second version number of the latest version corresponding to the constructed universal code in the management platform;

[0228] If the version number difference between the second version number and the first version number is greater than or equal to a preset threshold, the constructed universal code is deleted.

[0229] In an embodiment of the present application, by reusing the constructed functional code of the third-party code files generated in the past for front-end construction, the time spent on building the third-party code files is saved, which shortens the time it takes to convert the front-end source code into executable code using the front-end construction tools. Correspondingly, the front-end development time from writing the source code using the front-end programming language to running the executable code in the browser or Node.js is also shortened, thereby improving the development efficiency and release speed of the front-end development.

[0230] Secondly, by reusing the built functional code of the third-party code files generated in the past for front-end construction, the time complexity of the front-end construction process is reduced to a constant level, effectively solving the problem of the corresponding increase in front-end construction time in scenarios with an increasing amount of code, while improving the reusability and maintainability of the front-end code.

[0231] In addition, this application only builds multiple third-party code files called by the business source code, rather than building and packaging all third-party code files in the third-party code library. This not only reduces the size of the final executable code and the amount of useless code, but also reduces the time for front-end construction, thereby improving the development efficiency of front-end development.

[0232] Based on the same technical concept, the embodiment of the present application provides a computer device, which can be Figure 1 The front-end development node 101 and the decentralized management platform 102 shown in FIG. Figure 11 As shown, it includes at least one processor 1101 and a memory 1102 connected to the at least one processor. The specific connection medium between the processor 1101 and the memory 1102 is not limited in the embodiment of the present application. Figure 11 For example, the processor 1101 and the memory 1102 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.

[0233] In an embodiment of the present application, the memory 1102 stores instructions that can be executed by at least one processor 1101, and the at least one processor 1101 can execute the steps of the above-mentioned front-end construction method by executing the instructions stored in the memory 1102.

[0234] Among them, the processor 1101 is the control center of the computer device. It can use various interfaces and lines to connect various parts of the computer device. By running or executing instructions stored in the memory 1102 and calling data stored in the memory 1102, the front-end construction is realized. Optionally, the processor 1101 may include one or more processing units. The processor 1101 may integrate an application processor and a modem processor. The application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1101. In some embodiments, the processor 1101 and the memory 1102 may be implemented on the same chip. In some embodiments, they may also be implemented separately on separate chips.

[0235] The processor 1101 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.

[0236] Memory 1102 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. Memory 1102 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. Memory 1102 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer device, but is not limited thereto. The memory 1102 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0237] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by a computer device. When the program runs on the computer device, the computer device executes the steps of the above-mentioned front-end construction method.

[0238] Based on the same inventive concept, an embodiment of the present application provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer device, the computer device executes the steps of the above-mentioned front-end construction method.

[0239] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0240] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer device or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0241] These computer program instructions may also be stored in a computer readable memory that can direct a computer device or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0242] These computer program instructions can also be loaded onto a computer device or other programmable data processing device so that a series of operating steps are executed on the computer device or other programmable device to produce a process implemented by the computer device, thereby providing instructions for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0243] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0244] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

Claims

1. A front-end construction method, characterized in that: include: Obtaining front-end source code, the front-end source code including: business source code and multiple third-party code files called by the business source code; Constructing the business source code to obtain corresponding constructed business code; For the plurality of third-party code files, performing the following operations respectively: if a corresponding constructed universal code has been associated and saved with a file identifier corresponding to one of the third-party code files, obtaining the constructed universal code; if a corresponding constructed universal code has not been associated and saved with the file identifier of the third-party code file, constructing the third-party code file to obtain the corresponding constructed universal code; An executable code is obtained based on the obtained plurality of constructed common codes and the constructed business code.

2. The method according to claim 1, wherein If the file identifier of a third-party code file is associated with the corresponding constructed universal code, before obtaining the constructed universal code, the method further includes: A file identifier of the third-party code file is generated based on the file path information of the third-party code file.

3. The method according to claim 2, wherein The file path information includes: the name of the third-party code library where the third-party code file is located, and the file name of the third-party code file; The step of generating a file identifier of a third-party code file based on file path information of the third-party code file includes: Obtaining version information of the third-party code library; The name of the third-party code library, the version information of the third-party code library, and the file name of the third-party code file are concatenated to obtain a file identifier of the third-party code file.

4. The method according to claim 1, wherein If the file identifier of a third-party code file is associated with a corresponding constructed universal code, obtaining the constructed universal code includes: If the local storage contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is obtained from the local storage.

5. The method according to claim 4, wherein Also includes: If the local storage does not contain the constructed universal code associated with the file identifier, querying a decentralized management platform based on the file identifier, the management platform being used to store the file identifiers and corresponding constructed universal codes reported by multiple front-end development nodes; If the management platform includes the constructed universal code associated with the file identifier, the constructed universal code is downloaded from the management platform.

6. The method according to claim 1, wherein If the file identifier of a third-party code file is associated with a corresponding constructed universal code, obtaining the constructed universal code includes: If the decentralized management platform contains constructed universal code associated with the file identifier of the third-party code file, the constructed universal code is downloaded from the management platform, and the management platform is used to save the file identifiers reported by multiple front-end development nodes and the corresponding constructed universal code.

7. The method according to any one of claims 1 to 6, characterized in that: If the file identifier of the third-party code file does not have a corresponding stored constructed universal code, then the third-party code file is constructed to obtain the corresponding constructed universal code, further comprising: Saving the file identifier and the corresponding constructed universal code in local storage; The file identifier and the corresponding constructed universal code are uploaded to a decentralized management platform so that the management platform can store the file identifier and the corresponding constructed universal code in association with each other. The management platform is used to store the file identifiers and the corresponding constructed universal code reported by multiple front-end development nodes.

8. The method according to claim 7, wherein Also includes: The constructed universal codes not included in the local storage are downloaded from the management platform on a regular basis.

9. The method according to claim 7, wherein: Also includes: For the multiple built common codes in the local storage, perform the following steps respectively: Periodically obtaining a first version number of a constructed universal code and a second version number of the latest version corresponding to the constructed universal code in the management platform; If the version number difference between the second version number and the first version number is greater than or equal to a preset threshold, the constructed universal code is deleted.

10. A front-end construction device, characterized in that: include: An acquisition module is used to acquire front-end source code, wherein the front-end source code includes: business source code and multiple third-party code files called by the business source code; A construction module, used to construct the business source code to obtain the corresponding constructed business code; The construction module is further configured to perform the following operations on the plurality of third-party code files: if a corresponding constructed universal code has been stored in association with a file identifier of a third-party code file, then the constructed universal code is obtained; if a corresponding constructed universal code has not been stored in association with the file identifier of the third-party code file, then the third-party code file is constructed to obtain the corresponding constructed universal code; The processing module is used to obtain executable code based on the obtained multiple constructed common codes and the constructed business code.

11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium, characterized in that It stores a computer program that can be executed by a computer device. When the program is run on the computer device, the computer device executes the steps of any one of the methods according to claims 1 to 9.

13. A computer program product, characterized in that The computer program product comprises a computer program stored on a computer-readable storage medium, wherein the computer program comprises program instructions. When the program instructions are executed by a computer device, the computer device is caused to perform the steps of the method according to any one of claims 1 to 9.