CN107766036B - Module construction method and device and terminal equipment - Google Patents

Module construction method and device and terminal equipment Download PDF

Info

Publication number
CN107766036B
CN107766036B CN201710953135.3A CN201710953135A CN107766036B CN 107766036 B CN107766036 B CN 107766036B CN 201710953135 A CN201710953135 A CN 201710953135A CN 107766036 B CN107766036 B CN 107766036B
Authority
CN
China
Prior art keywords
module
constructed
data structure
structure information
association
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
CN201710953135.3A
Other languages
Chinese (zh)
Other versions
CN107766036A (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.)
Shenzhen Kingdom Technology Co ltd
Original Assignee
Shenzhen Kingdom 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 Shenzhen Kingdom Technology Co ltd filed Critical Shenzhen Kingdom Technology Co ltd
Priority to CN201710953135.3A priority Critical patent/CN107766036B/en
Publication of CN107766036A publication Critical patent/CN107766036A/en
Application granted granted Critical
Publication of CN107766036B publication Critical patent/CN107766036B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Abstract

The invention is suitable for the technical field of internet, and provides a module construction method, a module construction device and terminal equipment, wherein the module construction method comprises the following steps: acquiring a source program of a module to be constructed, and analyzing and acquiring all associated modules of the module to be constructed based on data structure information of the source program; modifying the data structure information of the module to be built according to the obtained all the associated modules and the associated information of each associated module and the module to be built; and generating the module to be constructed according to the modified data structure information, wherein a configuration file is not required to be constructed in the compiling stage of the AMD module, and the associated information of the AMD module is not required to be acquired from the configuration file in the constructing stage of the AMD module, but is automatically processed and generated according to the data structure information of the AMD module.

Description

Module construction method and device and terminal equipment
Technical Field
The invention belongs to the technical field of internet, and particularly relates to a module construction method, a module construction device and terminal equipment.
Background
The internet technology is developing at a high speed, the demand of users for browsing various web pages is increasing day by day, and the existing web page development method of the website is continuously updated. At present, a browser end is mainly a mode of modular development of Javascript (JS), and Asynchronous Module Definition (AMD) is a JS Module Definition specification for asynchronously loading JS modules.
When an existing AMD module is written, a configuration file must be written to declare all relevant information of the AMD module, and then the AMD module is constructed according to the configuration file. However, the AMD module must be constructed by relying on the configuration file in the writing stage, and the related information of the AMD module cannot be automatically processed and generated.
Disclosure of Invention
In view of this, embodiments of the present invention provide a module construction method, a module construction device, and a terminal device, so as to solve the problem that the module construction must depend on a configuration file in a writing stage, and cannot automatically process and generate the associated information of the AMD module.
A first aspect of an embodiment of the present invention provides a method for constructing a module, including:
acquiring a source program of a module to be constructed, and analyzing and acquiring all associated modules of the module to be constructed based on data structure information of the source program;
modifying the data structure information of the module to be built according to the obtained all the associated modules and the associated information of each associated module and the module to be built;
and constructing a module according to the modified data structure information.
A second aspect of an embodiment of the present invention provides a module construction apparatus, including:
the acquisition module is used for acquiring a source program of a module to be constructed and analyzing and acquiring all related modules of the module to be constructed based on data structure information of the source program;
the modification module is used for modifying the data structure information of the module to be constructed according to the acquired all the association modules and the association information of each association module and the module to be constructed;
and the construction module is used for constructing the module according to the modified data structure information.
A third aspect of the present embodiment provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method provided in the first aspect of the present embodiment when executing the computer program.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium storing a computer program which, when executed by one or more processors, performs the steps of the method provided by the first aspect of embodiments of the present invention.
A fifth aspect of embodiments of the present invention provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method provided by the first aspect of embodiments of the present invention.
The method comprises the steps of obtaining a source program of a module to be built, and analyzing and obtaining all relevant modules of the module to be built based on data structure information of the source program; modifying the data structure information of the module to be built according to the obtained all the associated modules and the associated information of each associated module and the module to be built; according to the modified data structure information construction module, a configuration file is not required to be constructed in the compiling stage of the AMD module, and the relevant information of the AMD module is not required to be acquired from the configuration file in the construction stage of the AMD, but is automatically processed and generated according to the data structure information of the AMD module.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic implementation flow diagram of a method for constructing a module according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of an apparatus for constructing modules provided in an embodiment of the present invention;
fig. 3 is a schematic block diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Fig. 1 is a schematic implementation flow diagram of a building method of a module according to an embodiment of the present invention, and as shown in the figure, the method may include the following steps:
step S101, a source program of a module to be built is obtained, and all related modules of the module to be built are obtained through analysis based on data structure information of the source program.
The embodiment of the invention can be applied to the front end of the browser, such as the development of web pages. When a webpage is developed, a front end needs to be modularized, and the front end modularization refers to a front end technology for decomposing a complex logic into a plurality of simple basic functions. Generally, a web page is developed and divided into a plurality of functional modules according to different functions presented to a user, and each functional module can be understood as a module to be constructed. The development can be carried out according to each functional module, and if the whole webpage is integrally developed, the file to be maintained is far larger than the file of one module, so that the embodiment of the invention focuses on the construction process of one module.
The computer programming language operated in the existing browser is generally a JavaScript language, which may be referred to as JS for short. The JS Module Definition specification may adopt Asynchronous Module Definition (AMD), and a Module to be constructed in the embodiment of the present invention represents an AMD Module, and may also be understood as a JS language or JS Module in the form of AMD. And the source program of the module to be built refers to the source code in the JS language form. And the process of construction is from the source code or source program to the process of publication. The data structure information refers to an Abstract Syntax Tree (AST), and is a data structure storing computer language information, and we can parse and obtain all associated modules of the module to be constructed based on the data structure information of the source program of the module to be constructed, where the associated modules may be resource information that the module to be constructed must depend on in the process of issuing and running, and may also be called dependent modules of the module to be constructed.
As an example, when constructing a playlist module, the content needs to be modified according to the operation of a presentation module that is actually playing videos and music by the user. That is, the playlist module needs to depend on the presentation module, and the presentation module is the related module or the dependent module of the playlist module.
As an embodiment, obtaining a source program of a module to be built includes:
acquiring attribute information of a module to be constructed, and acquiring the name and the source program of the module to be constructed according to file path information in the attribute information of the module to be constructed.
In this embodiment of the present invention, the attribute information of the module to be built may be file information of the module to be built, where the file information of the module to be built includes file path information of the module to be built, that is, a storage path of the module to be built, and according to the storage path of the module to be built, an Identification (ID) of the module to be built and a source program of the module to be built may be obtained, and then the source program of the module to be built is cached.
As another embodiment of the present invention, analyzing and acquiring all the associated modules of the module to be built based on the data structure information of the source program includes:
analyzing and obtaining a sub-level correlation module of the module to be built based on the data structure information of the source program;
and taking the obtained child level association module as a parent level module, analyzing and obtaining the child level association module of the parent level module based on the data structure information of the parent level module until no child level association module exists after the obtained child level association module is taken as the parent level module, wherein all the obtained child level association modules are all association modules of the module to be built.
In the embodiment of the invention, since one module to be constructed may have an association module, the association module may also have an association module. The relationship between the parent module and the child association module is that the child association module is a module directly associated with or dependent on the parent module.
By way of example, assume that module a to be built has three association modules B, C, D; the association module B may further include association modules B1 and B2, the association module C may include association module C1, and the association module D may include association modules D1, D2 and D3; the association module B1 may also exist as association modules B11, B12. Therefore, the processes of all the associated modules of the module to be constructed need to analyze and obtain the child-level associated module B, C, D of the module to be constructed according to the data structure information of the source program of the module to be constructed, then the obtained child-level associated module B, C, D is respectively used as a parent-level module, and the child-level associated modules B1 and B2 of the parent-level module B are respectively obtained according to the data structure information of the parent-level module B, C, D, as the same as the process of obtaining the child-level associated module of the module to be constructed from the module to be constructed; a child association module C1 of the parent association module C, a child association module D1, D2, D3 of D; after the child level association module is obtained, the obtained child level association modules B1, B2, C1, D1, D2 and D3 are continuously obtained as parent level modules until the obtained child level association modules do not exist after the obtained child level association modules are used as parent level modules. And all obtained sub-level association modules B, C, D, B1, B2, C1, D1, D2, D3, B11 and B12 are called association modules or dependent modules of the module to be constructed. The association module B, C, D having direct dependency relationship with the module to be constructed is a sub-level association module of the module to be constructed, and the association modules B1, B2, C1, D1, D2, D3, B11 and B12 having indirect dependency relationship with the module to be constructed are non-sub-level association modules of the module to be constructed.
As another embodiment of the present invention, after all the associated modules of the module to be constructed are obtained, all the obtained associated modules need to be deduplicated, that is, only one of the duplicated associated modules is reserved. In addition, each associated module should have unique name information.
As another embodiment of the present invention, the obtaining of the sub-level association module of the module to be built based on the analysis of the data structure information of the source program includes:
searching a callback function based on the data structure information of the source program, and searching a require function according to the data structure information of the callback function;
and acquiring a sub-level association module of the module to be constructed through the require function.
In the embodiment of the present invention, the callback function refers to a define function, the define function is searched in the data structure information of the source program, after the define function is found, a require function is continuously searched in the data structure information of the define function, and a sub-level association module of the module to be constructed is defined in the require function.
The default function and the requiree function are both functions in a JS modular tool RequireJS, and the RequireJS is a JavaScript module loader. The define function is used to define a module (registered as a module in requirejs) and the requirefunction is used to load and use the module.
After acquiring a child association module, taking the child association module as a parent module, wherein the process of acquiring the child association module of the parent module from the parent module is consistent with the process of acquiring the child association module of the module to be constructed from the module to be constructed, namely, acquiring attribute information of the parent module, acquiring the name and the source program of the parent module according to file path information in the attribute information of the parent module and caching the name and the source program, searching a callback function according to data structure information of the parent module, and searching a require function according to data structure information of the callback function; and acquiring a child level association module of the parent level module through the require function.
And S102, modifying the data structure information of the module to be built according to the acquired all the associated modules and the associated information of each associated module and the module to be built.
In the embodiment of the present invention, since the data structure information is actually an AST parse tree, that is, a tree structure corresponding to the syntax of the source code, the statements in the source code can be mapped to each node in the tree. During the translation and compilation of the source code, the parser creates a parse tree. The parse tree includes information of the source code, and the AST parse tree may also be subject to modification as an intermediate representation of the source code. And the process of modifying the data structure information of the module to be built by associating the or each associated module with the associated information of the module to be built is actually the process of modifying the AST parse tree. The association information of each association module and the module to be constructed may be a direct or indirect dependency relationship between each association module and the module to be constructed.
Specifically, the modifying the data structure information of the module to be built according to the obtained association information of all the association modules and the association information of each association module and the module to be built includes: and writing the acquired all the associated modules and the associated information of each associated module and the module to be constructed into a callback function in the data structure information of the module to be constructed.
In the embodiment of the present invention, it can be known from the foregoing example that all the obtained associated modules also have a hierarchical relationship, so that when modifying the data structure information of the module to be constructed, not only all the associated modules need to be written into the data structure information of the module to be constructed, but also the associated information of each associated module and the module to be constructed should be written into the data structure information of the module to be constructed. And writing the data structure information written into the module to be constructed into the callback function in the data structure information of the module to be constructed.
And step S103, constructing a module according to the modified data structure information.
In the embodiment of the present invention, the data structure information is used as an intermediate representation form of a source code, and if the data structure information is modified, because the data structure information is actually still the source code of the module to be constructed, the modified data structure information may also be represented as modified source code information, and therefore, the module to be constructed may be generated according to the modified data structure information.
The method comprises the steps of obtaining a source program of a module to be built, and analyzing and obtaining all relevant modules of the module to be built based on data structure information of the source program; modifying the data structure information of the module to be built according to the obtained all the associated modules and the associated information of each associated module and the module to be built; and generating the module to be constructed according to the modified data structure information, wherein a configuration file is not required to be constructed in the compiling stage of the AMD module, and the associated information of the AMD module is not required to be acquired from the configuration file in the constructing stage of the AMD module, but is automatically processed and generated according to the data structure information of the AMD module.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 2 is a schematic block diagram of a module building apparatus according to an embodiment of the present invention, and only a part related to the embodiment of the present invention is shown for convenience of explanation.
The building device 2 of the module may be a software unit, a hardware unit or a combination of software and hardware unit built in a terminal device (e.g. a mobile phone, a computer, a notebook), or may be integrated into the terminal device as a separate pendant.
The building device 2 of the module comprises:
the acquisition module 21 is configured to acquire a source program of a module to be built, and analyze and acquire all associated modules of the module to be built based on data structure information of the source program;
the modification module 22 is configured to modify the data structure information of the module to be built according to the obtained all association modules and the association information of each association module and the module to be built;
and the building module 23 is configured to build a module according to the modified data structure information.
Optionally, the obtaining module 21 includes:
a sub-level association module obtaining unit 211, configured to obtain a sub-level association module of the module to be built based on the data structure information of the source program through analysis;
and a loop obtaining unit 212, configured to use the obtained child-level association module as a parent module, and obtain a child-level association module of the parent module based on data structure information analysis of the parent module until there is no child-level association module after the obtained child-level association module is used as the parent module, where all obtained child-level association modules are all association modules of the module to be built.
Optionally, the sub-level association module obtaining unit 211 includes:
the function acquisition subunit is used for searching a callback function based on the data structure information of the source program and searching a require function according to the data structure information of the callback function;
and the sub-level association module acquisition subunit is used for acquiring the sub-level association module of the module to be constructed through the require function.
Optionally, the obtaining module 21 is specifically configured to:
acquiring attribute information of a module to be constructed, and acquiring the name and the source program of the module to be constructed according to file path information in the attribute information of the module to be constructed.
Optionally, the modification module 22 is specifically configured to:
and writing the acquired associated modules and the associated information of each associated module into the callback function in the data structure information of the module to be built.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the module construction apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 3 is a schematic block diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 3, the terminal device 3 of this embodiment includes: one or more processors 30, a memory 31, and a computer program 32 stored in the memory 31 and executable on the processors 30. The processor 30 implements the steps in the above-described embodiment of the building method of each module, for example, steps S101 to S103 shown in fig. 1, when executing the computer program 32. Alternatively, the processor 30 implements the functions of the modules/units in the terminal device embodiments described above, such as the functions of the modules 21 to 23 shown in fig. 2, when executing the computer program 32.
Illustratively, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the processor 30 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the computer program 32 may be divided into an acquisition module, a modification module, a construction module.
The acquisition module is used for acquiring a source program of a module to be constructed and analyzing and acquiring all associated modules of the module to be constructed based on data structure information of the source program;
the modification module is used for modifying the data structure information of the module to be constructed according to the acquired all the association modules and the association information of each association module and the module to be constructed;
and the construction module is used for constructing the module according to the modified data structure information.
Optionally, the obtaining module includes:
a sub-level association module obtaining unit, configured to obtain a sub-level association module of the module to be built based on data structure information analysis of the source program;
and the cycle acquisition unit is used for taking the obtained child-level association module as a parent module, analyzing and obtaining the child-level association module of the parent module based on the data structure information of the parent module until no child-level association module exists after the obtained child-level association module is taken as the parent module, and obtaining all the obtained child-level association modules which are all the association modules of the module to be constructed.
Optionally, the sub-level association module obtaining unit includes:
the function acquisition subunit is used for searching a callback function based on the data structure information of the source program and searching a require function according to the data structure information of the callback function;
and the sub-level association module acquisition subunit is used for acquiring the sub-level association module of the module to be constructed through the require function.
Optionally, the obtaining module is specifically configured to:
acquiring attribute information of a module to be constructed, and acquiring the name and the source program of the module to be constructed according to file path information in the attribute information of the module to be constructed.
Optionally, the modification module is specifically configured to:
and writing the acquired associated modules and the associated information of each associated module into the callback function in the data structure information of the module to be built.
The terminal device includes, but is not limited to, a processor 30 and a memory 31. It will be appreciated by those skilled in the art that fig. 3 is only one example of a terminal device 3 and does not constitute a limitation of the terminal device 3 and may comprise more or less components than those shown, or some components may be combined, or different components, for example the terminal device may further comprise input devices, output devices, network access devices, buses, etc.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or a memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal device 3. The memory 31 is used for storing the computer program and other programs and data required by the terminal device. The memory 31 may also be used to temporarily store data that has been output or is to be output.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed terminal device, apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A method of building a module, comprising:
acquiring a source program of a module to be constructed, and analyzing and acquiring all associated modules of the module to be constructed based on data structure information of the source program; the module to be constructed is an AMD module; the module to be constructed is a functional module; the data structure information refers to an abstract syntax tree;
modifying the data structure information of the module to be constructed according to the obtained all the associated modules and the associated information of each associated module and the module to be constructed, wherein the modifying comprises the following steps: writing all the obtained associated modules and the associated information of each associated module and the module to be constructed into a callback function in the data structure information of the module to be constructed;
and constructing a module according to the modified data structure information.
2. The method for building the module according to claim 1, wherein the parsing and acquiring all the associated modules of the module to be built based on the data structure information of the source program comprises:
analyzing and obtaining a sub-level correlation module of the module to be built based on the data structure information of the source program;
and taking the obtained child level association module as a parent level module, analyzing and obtaining the child level association module of the parent level module based on the data structure information of the parent level module until no child level association module exists after the obtained child level association module is taken as the parent level module, wherein all the obtained child level association modules are all association modules of the module to be built.
3. The method for building the module according to claim 2, wherein the obtaining the sub-level associated module of the module to be built based on the data structure information analysis of the source program comprises:
searching a callback function based on the data structure information of the source program, and searching a require function according to the data structure information of the callback function;
and acquiring a sub-level association module of the module to be constructed through the require function.
4. The module building method according to claim 1, wherein the acquiring of the source program of the module to be built includes:
acquiring attribute information of a module to be constructed, and acquiring the name and the source program of the module to be constructed according to file path information in the attribute information of the module to be constructed.
5. The module construction method according to claim 3 or 4, wherein the modifying the data structure information of the module to be constructed according to the obtained association information of all the association modules and each association module and the module to be constructed comprises:
and writing the acquired all the associated modules and the associated information of each associated module and the module to be constructed into a callback function in the data structure information of the module to be constructed.
6. An apparatus for building a module, comprising:
the acquisition module is used for acquiring a source program of a module to be constructed and analyzing and acquiring all related modules of the module to be constructed based on data structure information of the source program; the module to be constructed is an AMD module; the module to be constructed is a functional module; the data structure information refers to an abstract syntax tree;
the modification module is used for modifying the data structure information of the module to be constructed according to the obtained all the association modules and the association information of each association module and the module to be constructed, and comprises the following steps: writing all the obtained associated modules and the associated information of each associated module and the module to be constructed into a callback function in the data structure information of the module to be constructed;
and the construction module is used for constructing the module according to the modified data structure information.
7. The module building apparatus of claim 6, wherein the obtaining module comprises:
a sub-level association module obtaining unit, configured to obtain a sub-level association module of the module to be built based on data structure information analysis of the source program;
and the cycle acquisition unit is used for taking the obtained child-level association module as a parent module, analyzing and obtaining the child-level association module of the parent module based on the data structure information of the parent module until no child-level association module exists after the obtained child-level association module is taken as the parent module, and obtaining all the obtained child-level association modules which are all the association modules of the module to be constructed.
8. The module building apparatus according to claim 7, wherein the sub-level association module obtaining unit includes:
the function acquisition subunit is used for searching a callback function based on the data structure information of the source program and searching a require function according to the data structure information of the callback function;
and the sub-level association module acquisition subunit is used for acquiring the sub-level association module of the module to be constructed through the require function.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by one or more processors, implements the steps of the method according to any one of claims 1 to 5.
CN201710953135.3A 2017-10-13 2017-10-13 Module construction method and device and terminal equipment Active CN107766036B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710953135.3A CN107766036B (en) 2017-10-13 2017-10-13 Module construction method and device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710953135.3A CN107766036B (en) 2017-10-13 2017-10-13 Module construction method and device and terminal equipment

Publications (2)

Publication Number Publication Date
CN107766036A CN107766036A (en) 2018-03-06
CN107766036B true CN107766036B (en) 2020-09-18

Family

ID=61269292

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710953135.3A Active CN107766036B (en) 2017-10-13 2017-10-13 Module construction method and device and terminal equipment

Country Status (1)

Country Link
CN (1) CN107766036B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874246A (en) * 2018-08-28 2020-03-10 Tcl集团股份有限公司 Module loading method, system and equipment
CN111338686A (en) * 2020-02-12 2020-06-26 中国平安人寿保险股份有限公司 Software construction method, equipment, server and readable storage medium
CN111491018B (en) * 2020-04-07 2022-06-10 中国建设银行股份有限公司 Model downloading method and system
CN115016831A (en) * 2022-08-08 2022-09-06 北京安普诺信息技术有限公司 Dependent component information acquisition method and device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101639775A (en) * 2009-09-01 2010-02-03 用友软件股份有限公司 Constructing method of component and device
CN105893013A (en) * 2015-12-07 2016-08-24 乐视云计算有限公司 Engineering construction system and construction method thereof

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9898445B2 (en) * 2012-08-16 2018-02-20 Qualcomm Incorporated Resource prefetching via sandboxed execution
CN107203401B (en) * 2016-03-17 2020-11-06 创新先进技术有限公司 Front-end project construction method, device and system
CN105893052B (en) * 2016-04-20 2019-04-16 中国银行股份有限公司 A kind of war packet analyzer

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101639775A (en) * 2009-09-01 2010-02-03 用友软件股份有限公司 Constructing method of component and device
CN105893013A (en) * 2015-12-07 2016-08-24 乐视云计算有限公司 Engineering construction system and construction method thereof

Also Published As

Publication number Publication date
CN107766036A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
US10496748B2 (en) Method and apparatus for outputting information
US11061648B2 (en) Method and system for arbitrary-granularity execution clone detection
CN107766036B (en) Module construction method and device and terminal equipment
CN109522018B (en) Page processing method and device and storage medium
US9311058B2 (en) Jabba language
CN112015430A (en) JavaScript code translation method and device, computer equipment and storage medium
CN111045678A (en) Method, device and equipment for executing dynamic code on page and storage medium
US11023654B2 (en) Analyzing document content and generating an appendix
CN114625844B (en) Code searching method, device and equipment
CN114153459A (en) Interface document generation method and device
CN112181924A (en) File conversion method, device, equipment and medium
CN110851136A (en) Data acquisition method and device, electronic equipment and storage medium
CN107368500B (en) Data extraction method and system
CN108073401B (en) Method and device for executing business logic and electronic equipment
CN111142871A (en) Front-end page development system, method, equipment and medium
KR20200103133A (en) Method and apparatus for performing extract-transfrom-load procedures in a hadoop-based big data processing system
CN114896269A (en) Structured query statement detection method and device, electronic equipment and storage medium
CN111459584B (en) Page rendering method and device and electronic equipment
CN113468258A (en) Heterogeneous data conversion method and device and storage medium
CN108255802B (en) Universal text parsing architecture and method and device for parsing text based on architecture
CN111291298A (en) Page display method and device, electronic equipment and storage medium
CN113609309B (en) Knowledge graph construction method and device, storage medium and electronic equipment
CN113448923B (en) File generation method, device and terminal
CN117610540A (en) Model verification method, system, storage medium and electronic equipment
CN117435607A (en) Statement conversion method, device, equipment and medium for database

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