CN111443906B - Application access method and device - Google Patents

Application access method and device Download PDF

Info

Publication number
CN111443906B
CN111443906B CN202010216087.1A CN202010216087A CN111443906B CN 111443906 B CN111443906 B CN 111443906B CN 202010216087 A CN202010216087 A CN 202010216087A CN 111443906 B CN111443906 B CN 111443906B
Authority
CN
China
Prior art keywords
module
compiled
application
compiling
modules
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010216087.1A
Other languages
Chinese (zh)
Other versions
CN111443906A (en
Inventor
李明忠
周伟
李自强
王睿宇
苏雅迪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010216087.1A priority Critical patent/CN111443906B/en
Publication of CN111443906A publication Critical patent/CN111443906A/en
Application granted granted Critical
Publication of CN111443906B publication Critical patent/CN111443906B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to an access method and device for an application, wherein the method comprises the following steps: receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application; searching a first module from modules to be compiled included in a front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are uncompiled in the compiling process; under the condition that a first module is found out from the modules to be compiled, compiling the first module to obtain a first module code corresponding to the first module; and responding to the application access request and returning the first module code corresponding to the first module. The application solves the technical problem of lower compiling efficiency of the module in the compiling process of the front-end application in the related technology.

Description

Application access method and device
Technical Field
The present application relates to the field of computers, and in particular, to an application access method and apparatus.
Background
Along with the development of front-end technology, front-end development from the development of static web pages to complex front-end and back-end interaction to node. Js-based full stack development, more and more things need to be done by the front-end, and the logic and interaction effect of the front-end code are more and more complex and are less easy to manage. Before the front-end code is deployed and operated, four steps of flow processing are generally needed: compiling, optimizing, merging, confusing and deploying services. As the files in the project continue to increase, the time taken to compile and optimize the two parts remains linearly increasing. In the project development stage, the compiling time required by developers to wait is longer and longer, and the compiling efficiency is lower and lower.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The application provides an application access method and device, which at least solve the technical problem of low compiling efficiency of a module in the compiling process of a front-end application in the related technology.
According to an aspect of an embodiment of the present application, there is provided an access method for an application, including:
receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application;
searching the first module from modules to be compiled included in the front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are modules which are not compiled in the compiling process;
under the condition that the first module is found out from the modules to be compiled, compiling the first module to obtain a first module code corresponding to the first module;
and responding to the application access request and returning the first module code corresponding to the first module.
Optionally, compiling the first module, and obtaining the first module code corresponding to the first module includes:
Searching a first module path corresponding to the first module from a module to be compiled and a module path with a corresponding relation, wherein the module path is used for indicating a storage path of a module file of the module to be compiled;
and compiling the module file indicated by the first module path to obtain a first module code.
Optionally, after compiling the module file indicated by the first module path to obtain the first module code, the method further includes:
acquiring a second module path corresponding to the first module code, wherein the second module path is used for indicating a storage path of the first module code;
and storing the first module code into the front-end application, and updating the module to be compiled and the module path with the corresponding relation by using the first module and the second module path with the corresponding relation.
Optionally, before receiving the application access request, the method further comprises:
obtaining module marking information, wherein the module marking information is used for marking the module to be compiled from modules included in the front-end application;
determining whether each module in a compiling queue of the front-end application is in the module marking information;
Under the condition that each module is determined to be in the module marking information, recording the module paths of each module and each module with a corresponding relation to obtain a module list;
compiling each module to obtain application codes under the condition that each module is determined not to be in the module marking information;
and storing the module list into the application code to obtain the front-end application.
Optionally, after searching the first module from the modules to be compiled included in the front-end application, the method further includes:
searching a second module code corresponding to the first module under the condition that the first module is not searched;
and responding to the application access request and returning the second module code corresponding to the first module.
According to another aspect of the embodiment of the present application, there is also provided an access device for an application, including:
the receiving module is used for receiving an application access request, wherein the application access request is used for requesting to access a first module of the front-end application;
the front-end application comprises a to-be-compiled module and a compiled module, wherein the compiled module is a module compiled in a compiling process, and the to-be-compiled module is a module not compiled in the compiling process;
The first compiling module is used for compiling the first module to obtain a first module code corresponding to the first module under the condition that the first module is found out from the modules to be compiled;
and the first return module is used for responding to the application access request and returning the first module code corresponding to the first module.
Optionally, the compiling module includes:
the searching unit is used for searching a first module path corresponding to the first module from the module to be compiled and the module paths with the corresponding relation, wherein the module path is used for indicating the storage path of the module file of the module to be compiled;
and the compiling unit is used for compiling the module file indicated by the first module path to obtain a first module code.
Optionally, the apparatus further comprises:
the first obtaining module is used for obtaining a second module path corresponding to the first module code after compiling the module file indicated by the first module path to obtain the first module code, wherein the second module path is used for indicating a storage path of the first module code;
and the processing module is used for storing the first module code into the front-end application, and updating the module to be compiled and the module path with the corresponding relation by using the first module and the second module path with the corresponding relation.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that executes the above-described method when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor executing the method described above by the computer program.
In the embodiment of the application, the method comprises the steps of receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application; searching a first module from modules to be compiled included in a front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are uncompiled in the compiling process; under the condition that a first module is found out from the modules to be compiled, compiling the first module to obtain a first module code corresponding to the first module; responding to the mode that the application access request returns the first module code corresponding to the first module, dividing the modules included in the front-end application into two types of to-be-compiled modules and compiled modules, compiling part of the modules in the compiling process of the front-end application to obtain compiled modules, recording the to-be-compiled modules in the front-end application, wherein the to-be-compiled modules are all to be compiled when the to-be-accessed to obtain the corresponding first module codes and return the first module codes to the access party initiating the application access request, compiling the to-be-compiled modules when the to-be-compiled modules need to be accessed, achieving the purpose that the modules of the front-end application are compiled as required, compiling part of the modules as compiled modules in the compiling process of the front-end application, shortening the compiling time of the front-end application, achieving the technical effect of improving the compiling efficiency of the modules in the compiling process of the front-end application, and further solving the technical problem that the compiling efficiency of the modules in the compiling process of the front-end application in the related technology is lower.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a hardware environment of an access method of an application according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative method of application access in accordance with an embodiment of the present application;
FIG. 3 is a schematic diagram of an access method for an application according to an alternative embodiment of the application;
FIG. 4 is a schematic illustration of an access device for an alternative application in accordance with an embodiment of the present application;
and
fig. 5 is a block diagram of a structure of a terminal according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, a method embodiment of access to an application is provided.
Alternatively, in the present embodiment, the above-described access method of the application may be applied to a hardware environment constituted by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, the server 103 is connected to the terminal 101 through a network, which may be used to provide services (such as game services, application services, etc.) to the terminal or clients installed on the terminal, and a database may be provided on the server or independent of the server, for providing data storage services to the server 103, where the network includes, but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, or the like. The access method of the application of the embodiment of the present application may be executed by the server 103, may be executed by the terminal 101, or may be executed by both the server 103 and the terminal 101. The method for accessing the application executed by the terminal 101 according to the embodiment of the present application may be executed by a client installed thereon.
FIG. 2 is a flow chart of an alternative method of application access, as shown in FIG. 2, according to an embodiment of the application, which may include the steps of:
step S202, an application access request is received, wherein the application access request is used for requesting to access a first module of a front-end application;
step S204, searching the first module from the modules to be compiled included in the front-end application, wherein the front-end application includes the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are modules which are not compiled in the compiling process;
step S206, compiling the first module to obtain a first module code corresponding to the first module under the condition that the first module is found out from the modules to be compiled;
and step S208, responding to the application access request and returning the first module code corresponding to the first module.
Through the steps S202 to S208, the modules included in the front-end application are divided into two types of modules to be compiled and compiled modules, the partial modules are compiled in the compiling process of the front-end application to obtain compiled modules, the modules to be compiled are recorded in the front-end application, the modules to be compiled are all the first module codes corresponding to the modules to be compiled when the modules to be compiled need to be accessed and returned to the accessing party initiating the application access request, the modules to be compiled are compiled when the modules to be compiled need to be accessed, the aim that the modules of the front-end application are compiled as required is achieved, and only part of the modules are compiled as compiled modules in the compiling process of the front-end application, so that the compiling time of the front-end application can be shortened, the technical effect of improving the compiling efficiency of the modules in the compiling process of the front-end application is achieved, and the technical problem that the compiling efficiency of the modules in the compiling process of the front-end application in the related technology is lower is solved.
Alternatively, in this embodiment, the above-mentioned access method of the application may be, but not limited to, applied to a background server corresponding to the front-end application.
In the technical solution provided in step S202, the front-end application may, but is not limited to, an application including various functions, such as: games, web pages, browsers, shopping, finance, financial, multimedia, live, and the like.
Alternatively, in this embodiment, the application access request is used to request access to the first module of the front-end application, and the application access request may be initiated by a user on the browser, but is not limited to.
In the technical solution provided in step S204, the front-end application includes a module to be compiled and a compiled module, and a module list corresponding to the front-end application may be deployed on the server, where the module list is used to record uncompiled modules in the front-end application, that is, the module to be compiled.
Alternatively, in this embodiment, the module to be compiled may be, but not limited to, a business module, and the compiled module may be, but not limited to, a master module. The business module is a module that is compiled on demand during access by the front-end application, which may be, but is not limited to, a module that requires update optimization during update optimization of the front-end application.
Alternatively, in the present embodiment, the number of modules to be compiled may be, but not limited to, one or more, and the number of compiled modules may be, but not limited to, one or more.
In the technical solution provided in step S206, the modules may be compiled using a compiling tool, for example: the compilation tool may include, but is not limited to, weback, and the like.
As an optional embodiment, compiling the first module, to obtain a first module code corresponding to the first module includes:
s11, searching a first module path corresponding to the first module from a module to be compiled and a module path with a corresponding relation, wherein the module path is used for indicating a storage path of a module file of the module to be compiled;
and S12, compiling the module file indicated by the first module path to obtain a first module code.
Optionally, in this embodiment, the background server records the module to be compiled and the module path with a corresponding relationship, that is, the module list may be recorded in a key value pair manner, where the id and path of the module to be compiled represent a storage path corresponding to the module to be compiled as a key value pair.
Alternatively, in the present embodiment, the above module list may be, but is not limited to, a symbol table of a compiler.
As an optional embodiment, after compiling the module file indicated by the first module path to obtain the first module code, the method further includes:
s21, acquiring a second module path corresponding to the first module code, wherein the second module path is used for indicating a storage path of the first module code;
s22, storing the first module codes into the front-end application, and updating the module to be compiled and the module path module with the corresponding relation by using the first module and the second module path with the corresponding relation.
Optionally, in this embodiment, after each module to be compiled is compiled, the module to be compiled is stored in the front-end application, and the module paths in the module to be compiled and the module paths with the corresponding relationship are updated to be compiled module paths, so that when the module is accessed again, the module can be directly accessed to the compiled module paths.
As an alternative embodiment, before receiving the application access request, the method further includes:
s31, module marking information is obtained, wherein the module marking information is used for marking the module to be compiled from the modules included in the front-end application;
S32, determining whether each module in the compiling queue of the front-end application is in the module marking information;
s33, under the condition that each module is determined to be in the module marking information, recording the module paths of each module and each module with a corresponding relation to obtain the module list;
s34, compiling each module to obtain application codes under the condition that each module is determined not to be in the module marking information;
and S35, storing the module list into the application code to obtain the front-end application.
Alternatively, in this embodiment, before receiving the application access request, the developer may declare the module to be compiled through the module marking information during the compiling process of the front-end application. The module markup information may include, but is not limited to, a specified function import module (string id, string path).
For example: the developer can declare the service module id by specifying a function import module (string id, string path). The function does not have any code logic, but simply declares the module on the path of the file as a business module and specifies an id. The master module in the project is modified, assuming src/main. Js, in which all business modules in the project are declared.
Taking weback compiling as an example, the weback is uniformly put into a compiling queue for compiling for all modules at the same time. On the basis of which business modules can be marked by the developer using the importModule, these marked modules are regarded as deferred compilations. When using an importModule markup module, two parameters, id and path, are defined, which can be used to determine the time when the module needs to be compiled.
Optionally, in this embodiment, when compiling the source code file, weback invokes a corresponding preprocessing function according to the file suffix. The function parameter is string source, representing the content of the source code file. And the Webpack reads all files, matches the files with an import module (string id, string path) by using a character string matching algorithm, and acquires the id and the path if the files are matched, and stores the id and the path in a symbol table of a compiler as a module to be compiled.
Alternatively, in this embodiment, according to the normal front-end compilation process, weback configures only the path of the compiled module, so that only the compiled module is compiled to obtain the application code. And writing the content of the symbol table into the compiled application code. And compiling the modules in the symbol table as required in the subsequent access process.
As an optional embodiment, after searching the first module from the modules to be compiled included in the front-end application, the method further includes:
s41, searching a second module code corresponding to the first module under the condition that the first module is not found;
s42, responding to the application access request and returning the second module code corresponding to the first module.
Optionally, in this embodiment, if the first module requested to be accessed by the application access request is not in the module to be compiled, the second module code corresponding to the compiled first module is directly returned to the browser.
The application also provides an alternative embodiment which provides a method for compiling on demand based on hot module replacement. The scheme can solve the problems that the compiling time is too long and the compiling efficiency is reduced due to the increase of the number of the modules. The method comprises the steps of firstly dividing a code module of a front-end application into a main module and a service module, dividing the code module into the main module and the service module according to the use requirement of a user on the application according to the use rate and other parameters of the user on the module, dividing the module which can basically meet the use requirement of the user into the main module for compiling in a compiling stage, and dividing the module which is less used by the user into the service module for compiling in an access stage of the front-end application.
Such as: the module with higher utilization rate of the user (higher may but not limited to refer to the first few of the higher-to-lower order of the utilization rate or the utilization rate) is used as the main module, and the module with lower utilization rate of the user (lower may but not limited to refer to the last few of the lower-to-higher order of the utilization rate or the utilization rate is used as the service module). Taking video application as an example, a search module, a member module, a home page module, a television play module, a variety module and the like with higher user use rate can be divided into main modules, and modules except the main modules are divided into service modules. Alternatively, a game module, a novel module, a music module, or the like, which has a low user usage rate, may be divided into service modules, and blocks other than the service modules may be divided into service modules.
In the front-end compiling and developing stage, only the main module is compiled, and the service modules are omitted, so that the number of modules entering a compiling link can be reduced while the use needs of users can be basically met, the compiling time is shortened, and the time consumed by the front-end application in the compiling stage is saved. When the front-end application is accessed, the corresponding service modules are matched according to the URL route, only the matched service modules are compiled, and the application codes are replaced and updated through the thermal modules, so that the use requirements of users on the front-end application are met.
In this optional embodiment, an application access method based on the on-demand compiling method is further provided, where in an access stage of a front-end application, a main module compiled in a compiling development stage of the front-end application is invoked according to an access request of a user, or when a user needs to access a service module not compiled in the compiling development stage of the front-end application, the service module to be accessed is compiled and then provided for the user to access. FIG. 3 is a schematic illustration of an access method for an application according to an alternative embodiment of the application, as shown in FIG. 3, the process comprising the steps of:
step 1, business module declares: the service module is first declared by specifying a function importModule (string id, string path). The function does not have any code logic, but simply declares the module on the path of the file as a business module and specifies an id.
Step 2, js file preprocessing function: when compiling a source code file, the Webpack calls a corresponding preprocessing function according to the file suffix. The function parameter may be a string source, representing the content of the source code file. The Webpack reads all files, matches the files with an import module (string id, string path) by using a string matching algorithm, acquires the id and path successfully matched, and stores the id and path in a symbol table of a compiler.
Step 3, compiling a main module: according to the normal front-end compilation flow, weback only configures the path of the master module, so only the master module is compiled. And writing the content of the symbol table in the step 2 into the compiled object. Used in step 4 and step 5.
Step 4, compiling the process as required: when a user inputs in the browser address bar or clicks a link address provided by a search engine to access a website, a server receives an Http request, and transmits a path character string in an Http request header to a compiler, and the compiler uses the path character string as an id to inquire a symbol table, find a file path defining a service module, and compile the module.
Step 5, link updating: and modifying a symbol table in the main module, and updating the service module id and the corresponding path into a successfully compiled module path.
Step 6, rendering by a service module: and when the main module runs, finding a corresponding successfully compiled module path according to the symbol table, and executing.
Through the process, the scheme of compiling on demand (compiling only the function modules required by the service) is adopted by utilizing the characteristic that a user only uses a part of functions in the project each time, so that the compiling time can be obviously shortened, the efficiency is improved, the compiling speed is accelerated, and the development efficiency is improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
According to another aspect of the embodiment of the present application, there is also provided an access device for an application implementing the access method for an application described above. Fig. 4 is a schematic diagram of an access device for an alternative application according to an embodiment of the present application, as shown in fig. 4, the device may include:
a receiving module 42, configured to receive an application access request, where the application access request is used to request access to a first module of a front-end application;
a first search module 44, configured to search for the first module from modules to be compiled included in the front-end application, where the front-end application includes the modules to be compiled and compiled modules, the compiled modules are modules compiled during the compiling process, and the modules to be compiled are modules not compiled during the compiling process;
the first compiling module 46 is configured to compile the first module to obtain a first module code corresponding to the first module when the first module is found out from the modules to be compiled;
and the first return module 48 is configured to return the first module code corresponding to the first module in response to the application access request.
It should be noted that, the receiving module 42 in this embodiment may be used to perform step S202 in the embodiment of the present application, the first searching module 44 in this embodiment may be used to perform step S204 in the embodiment of the present application, the first compiling module 46 in this embodiment may be used to perform step S206 in the embodiment of the present application, and the first returning module 48 in this embodiment may be used to perform step S208 in the embodiment of the present application.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that the above modules may be implemented in software or hardware as a part of the apparatus in the hardware environment shown in fig. 1.
Through the modules, the modules included in the front-end application are divided into two types of to-be-compiled modules and compiled modules, part of the modules are compiled in the compiling process of the front-end application to obtain compiled modules, the to-be-compiled modules are recorded in the front-end application, the to-be-compiled modules are all the first module codes corresponding to the to-be-compiled modules when the to-be-compiled modules need to be accessed and returned to an access party initiating an application access request, the to-be-compiled modules are compiled when the to-be-compiled modules need to be accessed, the purpose that the modules of the front-end application are compiled as required is achieved, and only part of the modules are compiled as the compiled modules in the compiling process of the front-end application, so that the compiling time of the front-end application can be shortened, the technical effect of improving the compiling efficiency of the modules in the compiling process of the front-end application is achieved, and the technical problem that the compiling efficiency of the modules in the compiling process of the front-end application in the related technology is lower is solved.
As an alternative embodiment, the compiling module includes:
the searching unit is used for searching a first module path corresponding to the first module from the module to be compiled and the module paths with the corresponding relation, wherein the module path is used for indicating the storage path of the module file of the module to be compiled;
and the compiling unit is used for compiling the module file indicated by the first module path to obtain a first module code.
As an alternative embodiment, the apparatus further comprises:
the first obtaining module is used for obtaining a second module path corresponding to the first module code after compiling the module file indicated by the first module path to obtain the first module code, wherein the second module path is used for indicating a storage path of the first module code;
and the processing module is used for storing the first module code into the front-end application, and updating the module to be compiled and the module path with the corresponding relation by using the first module and the second module path with the corresponding relation.
As an alternative embodiment, the apparatus further comprises:
the second obtaining module is used for obtaining module marking information before receiving the application access request, wherein the module marking information is used for marking the module to be compiled from the modules included in the front-end application;
A determining module, configured to determine whether each module in a compilation queue of the front-end application is in the module tag information;
a recording module, configured to record, when it is determined that each module is in the module label information, the module paths of each module and each module that have a correspondence relationship, and obtain a module list;
the second compiling module is used for compiling each module to obtain application codes under the condition that each module is determined not to be in the module marking information;
and the storage module is used for storing the module list into the application code to obtain the front-end application.
As an alternative embodiment, the apparatus further comprises:
the second searching module is used for searching a second module code corresponding to the first module under the condition that the first module is not found after searching the first module from the modules to be compiled included in the front-end application;
and the second return module is used for responding to the application access request and returning the second module code corresponding to the first module.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that the above modules may be implemented in software or in hardware as part of the apparatus shown in fig. 1, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the present application, there is also provided a server or a terminal for implementing the access method of the above application.
Fig. 5 is a block diagram of a terminal according to an embodiment of the present application, and as shown in fig. 5, the terminal may include: one or more (only one is shown in the figure) processors 501, memory 503, and transmission means 505, as shown in fig. 5, the terminal may further comprise input output devices 507.
The memory 503 may be used to store software programs and modules, such as program instructions/modules corresponding to the application accessing method and apparatus in the embodiment of the present application, and the processor 501 executes the software programs and modules stored in the memory 503, thereby executing various functional applications and data processing, that is, implementing the application accessing method described above. Memory 503 may include high-speed random access memory, but may also include non-volatile memory, such as magnetic storage, flash memory, or other non-volatile solid state memory. In some examples, the memory 503 may further include memory located remotely from the processor 501, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 505 is used for receiving or transmitting data via a network, and may also be used for data transmission between the processor and the memory. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 505 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 505 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
Wherein in particular the memory 503 is used for storing application programs.
The processor 501 may call an application stored in the memory 503 via the transmission means 505 to perform the following steps:
s1, receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application;
s2, searching the first module from modules to be compiled included in the front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are modules which are not compiled in the compiling process;
S3, compiling the first module under the condition that the first module is found out from the modules to be compiled, and obtaining a first module code corresponding to the first module;
and S4, responding to the application access request and returning the first module code corresponding to the first module.
By adopting the embodiment of the application, an access scheme of the application is provided. The front-end application comprises two modules, namely a to-be-compiled module and a compiled module, wherein part of the modules are compiled in the compiling process of the front-end application to obtain compiled modules, the to-be-compiled modules are recorded in the front-end application, the to-be-compiled modules are all first module codes which are compiled when the to-be-compiled modules need to be accessed and are returned to an access party which initiates an application access request, the to-be-compiled modules are compiled when the to-be-compiled modules need to be accessed, the purpose that the modules of the front-end application are compiled as required is achieved, and only part of the modules are compiled as the compiled modules in the compiling process of the front-end application, so that the compiling time of the front-end application can be shortened, the technical effect of improving the compiling efficiency of the modules in the compiling process of the front-end application is achieved, and the technical problem that the compiling efficiency of the modules in the compiling process of the front-end application in the related technology is low is solved.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is only illustrative, and the terminal may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 5 is not limited to the structure of the electronic device. For example, the terminal may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in fig. 5, or have a different configuration than shown in fig. 5.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute in association with hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The embodiment of the application also provides a storage medium. Alternatively, in the present embodiment, the above-described storage medium may be used for executing the program code of the access method of the application.
Alternatively, in this embodiment, the storage medium may be located on at least one network device of the plurality of network devices in the network shown in the above embodiment.
Alternatively, in the present embodiment, the storage medium is configured to store program code for performing the steps of:
s1, receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application;
s2, searching the first module from modules to be compiled included in the front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are modules which are not compiled in the compiling process;
s3, compiling the first module under the condition that the first module is found out from the modules to be compiled, and obtaining a first module code corresponding to the first module;
and S4, responding to the application access request and returning the first module code corresponding to the first module.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments, and this embodiment is not described herein.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.

Claims (10)

1. An access method for an application, comprising:
receiving an application access request, wherein the application access request is used for requesting to access a first module of a front-end application;
searching the first module from modules to be compiled included in the front-end application, wherein the front-end application comprises the modules to be compiled and compiled modules, the compiled modules are compiled in the compiling process, and the modules to be compiled are modules which are not compiled in the compiling process;
under the condition that the first module is found out from the modules to be compiled, compiling the first module to obtain a first module code corresponding to the first module;
responding to the application access request and returning the first module code corresponding to the first module;
before receiving the application access request, the method further comprises: dividing a module with the utilization rate larger than or equal to the utilization rate threshold value in the front-end application into a main module, and dividing a module with the utilization rate smaller than the utilization rate threshold value in the front-end application into service modules; and compiling the main module in the compiling process, and not compiling the business module.
2. The method of claim 1, wherein compiling the first module to obtain a first module code corresponding to the first module comprises:
searching a first module path corresponding to the first module from a module to be compiled and a module path with a corresponding relation, wherein the module path is used for indicating a storage path of a module file of the module to be compiled;
and compiling the module file indicated by the first module path to obtain a first module code.
3. The method of claim 2, wherein after compiling the module file indicated by the first module path to obtain the first module code, the method further comprises:
acquiring a second module path corresponding to the first module code, wherein the second module path is used for indicating a storage path of the first module code;
and storing the first module code into the front-end application, and updating the module to be compiled and the module path with the corresponding relation by using the first module and the second module path with the corresponding relation.
4. The method of claim 1, wherein prior to receiving the application access request, the method further comprises:
Obtaining module marking information, wherein the module marking information is used for marking the module to be compiled from modules included in the front-end application;
determining whether each module in a compiling queue of the front-end application is in the module marking information;
under the condition that each module is determined to be in the module marking information, recording the module paths of each module and each module with a corresponding relation to obtain a module list;
compiling each module to obtain application codes under the condition that each module is determined not to be in the module marking information;
and storing the module list into the application code to obtain the front-end application.
5. The method of claim 1, wherein after searching for the first module from among modules to be compiled included in the front-end application, the method further comprises:
searching a second module code corresponding to the first module under the condition that the first module is not searched;
and responding to the application access request and returning the second module code corresponding to the first module.
6. An access device for an application, comprising:
The receiving module is used for receiving an application access request, wherein the application access request is used for requesting to access a first module of the front-end application;
the front-end application comprises a to-be-compiled module and a compiled module, wherein the compiled module is a module compiled in a compiling process, and the to-be-compiled module is a module not compiled in the compiling process;
the first compiling module is used for compiling the first module to obtain a first module code corresponding to the first module under the condition that the first module is found out from the modules to be compiled;
the first return module is used for responding to the application access request and returning the first module code corresponding to the first module;
the apparatus further comprises: the dividing module is used for dividing the module with the utilization rate larger than or equal to the utilization rate threshold value in the front-end application into main modules and dividing the module with the utilization rate smaller than the utilization rate threshold value in the front-end application into service modules before receiving the application access request; and the processing module is used for compiling the main module in the compiling process and not compiling the service module.
7. The apparatus of claim 6, wherein the compiling module comprises:
the searching unit is used for searching a first module path corresponding to the first module from the module to be compiled and the module paths with the corresponding relation, wherein the module path is used for indicating the storage path of the module file of the module to be compiled;
and the compiling unit is used for compiling the module file indicated by the first module path to obtain a first module code.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the first obtaining module is used for obtaining a second module path corresponding to the first module code after compiling the module file indicated by the first module path to obtain the first module code, wherein the second module path is used for indicating a storage path of the first module code;
and the processing module is used for storing the first module code into the front-end application, and updating the module to be compiled and the module path with the corresponding relation by using the first module and the second module path with the corresponding relation.
9. A storage medium comprising a stored program, wherein the program when run performs the method of any one of the preceding claims 1 to 5.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor performs the method according to any of the preceding claims 1 to 5 by means of the computer program.
CN202010216087.1A 2020-03-25 2020-03-25 Application access method and device Active CN111443906B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010216087.1A CN111443906B (en) 2020-03-25 2020-03-25 Application access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010216087.1A CN111443906B (en) 2020-03-25 2020-03-25 Application access method and device

Publications (2)

Publication Number Publication Date
CN111443906A CN111443906A (en) 2020-07-24
CN111443906B true CN111443906B (en) 2023-09-05

Family

ID=71629625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010216087.1A Active CN111443906B (en) 2020-03-25 2020-03-25 Application access method and device

Country Status (1)

Country Link
CN (1) CN111443906B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527306B (en) * 2020-10-27 2024-05-28 百果园技术(新加坡)有限公司 Method, device, equipment and medium for realizing independence of modules in project development

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9134975B1 (en) * 2014-08-22 2015-09-15 International Business Machines Corporation Determining which computer programs are candidates to be recompiled after application of updates to a compiler
CN108897545A (en) * 2018-06-29 2018-11-27 南昌华勤电子科技有限公司 Code compiling method and device
CN109358841A (en) * 2018-08-15 2019-02-19 中国平安人寿保险股份有限公司 Web application develops Compilation Method, device and storage equipment, computer equipment
CN109375921A (en) * 2018-08-15 2019-02-22 中国平安人寿保险股份有限公司 Page file quickly compiles method, apparatus and storage equipment, computer equipment
CN110569035A (en) * 2019-08-08 2019-12-13 数字广东网络建设有限公司 Code compiling method, device, equipment and storage medium of software development project

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9134975B1 (en) * 2014-08-22 2015-09-15 International Business Machines Corporation Determining which computer programs are candidates to be recompiled after application of updates to a compiler
CN108897545A (en) * 2018-06-29 2018-11-27 南昌华勤电子科技有限公司 Code compiling method and device
CN109358841A (en) * 2018-08-15 2019-02-19 中国平安人寿保险股份有限公司 Web application develops Compilation Method, device and storage equipment, computer equipment
CN109375921A (en) * 2018-08-15 2019-02-22 中国平安人寿保险股份有限公司 Page file quickly compiles method, apparatus and storage equipment, computer equipment
CN110569035A (en) * 2019-08-08 2019-12-13 数字广东网络建设有限公司 Code compiling method, device, equipment and storage medium of software development project

Also Published As

Publication number Publication date
CN111443906A (en) 2020-07-24

Similar Documents

Publication Publication Date Title
US9483449B1 (en) Optimizing page output through run-time reordering of page content
CN101635655B (en) Method, device and system for page performance test
CN103502983B (en) Memoizing Web-browsing computation with DOM-based isomorphism
JP5526128B2 (en) Embed macros in web pages that contain advertisements
CN110245069B (en) Page version testing method and device and page display method and device
US9203905B1 (en) Sessionization of visitor activity
CN104424199A (en) Search method and device
CN102203765A (en) Uniquely identifying network-distributed devices without explicitly provided device or user identifying information
CN107276842B (en) Interface test method and device and electronic equipment
CN103051706A (en) Dynamic webpage request processing system and method for dynamic website
CN103383687A (en) Page processing method and device
CN102368248B (en) Page downloading control method and system of IE kernel browser
US20160085874A1 (en) System and method to identify machine-readable codes
CN111803917B (en) Resource processing method and device
US20140379925A1 (en) Apparatus and method for interworking between app store servers to share application information
US20170339252A1 (en) Generating a response to a client device in an internet of things domain
CN110647634B (en) Method and device for searching media resources, storage medium and electronic device
CN106202368B (en) Preloading method and device
CN116719523A (en) Page rendering method and electronic device
CN111443906B (en) Application access method and device
KR101265164B1 (en) System for providing shorten URL browsing with branding , method thereof, and web client thereof
CN105224870A (en) Suspected virus applies the method and apparatus uploaded
CN111767498A (en) Method and device for realizing file information sharing
CN111813816A (en) Data processing method, data processing device, computer readable storage medium and computer equipment
US20140115111A1 (en) Customizable Sequence of Content

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant