CN107391528B - Front-end component dependent information searching method and equipment - Google Patents

Front-end component dependent information searching method and equipment Download PDF

Info

Publication number
CN107391528B
CN107391528B CN201710192716.XA CN201710192716A CN107391528B CN 107391528 B CN107391528 B CN 107391528B CN 201710192716 A CN201710192716 A CN 201710192716A CN 107391528 B CN107391528 B CN 107391528B
Authority
CN
China
Prior art keywords
product code
end component
dependency information
information
search request
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
CN201710192716.XA
Other languages
Chinese (zh)
Other versions
CN107391528A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of CN107391528A publication Critical patent/CN107391528A/en
Application granted granted Critical
Publication of CN107391528B publication Critical patent/CN107391528B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/951Indexing; Web crawling techniques

Abstract

The application aims to provide a front-end component dependent information searching method and device, and the method and device are used for solving the problems that only local codes can be searched and dependent information cannot be intuitively acquired in the prior art. Specifically, obtaining the dependency information of the front-end component and storing the dependency information in a cache; obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user; providing dependency information of the target front-end component to a user. After receiving a search request of a user, the method can directly search the dependency information needed by the user in the cache, and the dependency information is obtained by analyzing codes based on the whole network instead of being only searched by an editor based on the local codes of the user, so that the searching efficiency is high, and an intuitive search result can be obtained.

Description

Front-end component dependent information searching method and equipment
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for searching dependent information of a front-end component.
Background
With the rise of the ajax (Asynchronous JavaScript And XML) technology, front-end development plays a more And more important role. As the performance of browsers gets better and better, the network bandwidth is no longer a bottleneck of front-end product experience, and RIA (Rich Internet Application) applications or SPA (single page Web Application) have also come to be developed rapidly.
The single-page application is visible anywhere in an enterprise-level application scenario, the business logic is more complex than the traditional front-end page, and the code maintenance is more difficult.
Development and maintenance of front-end code sub-modules become a practical technical standard, and are born in the AMD (Asynchronous Module Definition) standard and the CMD (Common Module Definition) standard of a community, and the problems of respective scenes are solved in two days, so that the following front-end code development basically hands over Module Definition and dependency management between modules to a mature Module loader of a third party. However, as more and more products are maintained, common components are introduced into different products by third-party tools (requirejs, seajs, web pack, etc.) and are distributed in each service code. Thus, when updating common components, it is difficult to know exactly which products or code files a front-end component is referenced by.
In the development of complex web products, after front-end codes are modularly managed, a certain code file depends on the functions of other modules, and only the module management library of a third party is needed to be used for introducing other modules according to a corresponding mode. The dependency between the front-end scripts of a complete web product is complex, and at present, no tool or system can allow a developer to quickly know which files a file is referenced by, and no tool can see the dependency between objects during code operation. Particularly, in a production environment, codes at the front end are all packaged and compressed into a file, and in some products developed by an MVVM (Model-View Model) framework, dependency relationships between modules are not only embodied on definitions of third-party module management library classes, but also embodied in dynamic dependency injection provided by an internal application program interface. Therefore, it is necessary to analyze which code files or modules are referenced by which other code files or modules, and it is necessary to solve not only the statically defined dependencies, but also the runtime dynamic dependencies.
In the prior art, when searching the dependency information of the code file, a user needs to manually search the file name in the local code through an editor to find out which other files or modules reference a certain code file. Because only the locally stored codes can be searched, the dependent information in the codes of other projects cannot be searched, and the dependent information cannot be intuitively acquired due to the function of the editor.
Content of application
An object of the present application is to provide a method and an apparatus for searching dependent information of a front-end component, so as to solve the problem that only a local code can be searched and dependent information cannot be intuitively obtained in the prior art.
To achieve the above object, the present application provides a front-end component dependent information searching method, including:
acquiring the dependency information of the front-end component and storing the dependency information in a cache;
obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user;
providing dependency information of the target front-end component to a user.
According to another aspect of the present application, there is also provided a front-end component dependent information search apparatus, including:
the internal service device is used for acquiring the dependency information of the front-end component and storing the dependency information in the cache;
the search processing device is used for acquiring the dependency information of the target front-end component corresponding to the search request from the cache according to the search request of the user;
and the message service device is used for providing the dependency information of the target front-end component for the user.
The present application also provides a front-end component dependent information search apparatus, including:
a processor;
and a memory arranged to store computer executable instructions that, when executed, cause the processor to: acquiring the dependency information of the front-end component and storing the dependency information in a cache; obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user; providing dependency information of the target front-end component to a user.
Compared with the prior art, the method and the device have the advantages that the server side obtains the dependency information of the front-end component in a pre-obtaining mode and stores the dependency information in the cache, the dependency information required by the user can be directly searched in the cache after the search request of the user is received, and the dependency information is obtained through code analysis based on the whole network instead of only searching through an editor based on the local code of the user, so that the search efficiency is high, and an intuitive search result can be obtained.
In addition, the local service and the virtual test data required by the running code are provided by the server side, so that the product code can be run at the server side to obtain the dynamic dependence information of the front-end component in the product code, the dynamic dependence information can be searched in the search result, and the searching accuracy is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a front-end component dependent information searching method according to an embodiment of the present application;
fig. 2 is a specific processing flow diagram of a first step in the front-end component dependent information searching method;
fig. 3 is a specific processing flow diagram of a first step in the front-end component dependent information searching method;
fig. 4 is a flowchart of a preferred front-end component dependent information searching method according to an embodiment of the present application;
fig. 5 is a specific service flow when the method according to the embodiment of the present application is used to perform a front-end component dependent information search;
FIG. 6 is a schematic structural diagram of a system for deploying the front-end component dependent information search method;
FIG. 7 is an internal block diagram of a windowless browser service;
fig. 8 is a schematic structural diagram of a front-end component dependent information search apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an internal service device in the front-end component dependent information search apparatus;
the same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
Fig. 1 shows a processing flow chart of a front-end component dependent information search method provided in an embodiment of the present application, where the method may be executed on a server side, and specifically includes the following steps:
and step S101, acquiring the dependency information of the front-end component and storing the dependency information in a cache. The front-end component can be a code file or a code module (i.e., modular code). By means of pre-acquisition, a database comprising a certain amount of front-end component dependence information is constructed in a cache, and since the dependence information of the front-end components is obtained by relying on product codes in the whole network and is not limited to product codes local to users, cross-product dependence relationship search can be achieved.
And step S102, acquiring the dependency information of the target front-end component corresponding to the search request from the cache according to the search request of the user. The target front-end component refers to a front-end component as a search target, and the search request includes tag information for uniquely identifying the target front-end component, which may include, but is not limited to, a component name and the like.
Step S103, providing the dependency information of the target front-end component for the user. Because the dependency information of the product can be directly acquired through the search request, a user can directly know which code files or modules depend on the front-end component A through the dependency information provided by the server, and therefore the problem that the search result is not intuitive when the user searches in the local editor is solved. Further, when the dependency information is provided for the user, the dependency information can be provided in a graphical and tabular manner.
The server side obtains the dependency information of the front-end component in a pre-obtaining mode, stores the dependency information in the cache, and can directly search the dependency information needed by the user in the cache after receiving a search request of the user.
Preferably, the specific processing flow of step S101 is as shown in fig. 2, and includes the following steps:
in step S1011, the product code is read from the version control system repository.
In this embodiment, the specific manner of obtaining may be periodic obtaining, or obtaining driven by an event. When the product code is obtained regularly, the time interval can be set according to actual requirements, for example, the product code is read once from the version control system warehouse for three to five days according to the updating frequency of the product code in the version control system warehouse. When the product code is read, the relevant product code is read from the version control system warehouse by calling an application program interface provided by the version control system warehouse and is copied to the server side. The version control system repository may be any existing version control system repository, such as a git repository (gitlab).
In consideration of the overhead of acquiring product codes and front-end component dependent information according to the product codes, the server side does not read and analyze all the product codes in the version control system warehouse, but selectively reads specific product codes. In a preferred embodiment, each time a product code is read from the version control system repository, N product codes with higher access frequency are read from the version control system repository according to the access frequency of the product code, where N is a positive integer. The access frequency is used to indicate the number of times the product code is queried in a period (e.g., the last update cycle), and the higher the access frequency, the higher the possibility that the product code is queried is indicated, so that the product code is preferentially read for the user to query.
Step S1012, obtaining dependency information of the front-end component in the product code according to the product code. Wherein, for product code based on a specific front-end development language (such as JavaScript), the dependency information can comprise static dependency information and dynamic dependency information.
Taking a product code based on JavaScript as an example, the static dependency information of the front-end component in the product code can be obtained by analyzing the product code. In an actual scene, most product codes are managed in a modularized mode, and when the product codes depend on the product codes, the front-end components are quoted directly by using a corresponding mode of a third-party module management library class. Therefore, the server side can preset corresponding plug-ins of the third-party module management library class, and analyze the product codes using different third-party module management library classes by using the corresponding plug-ins to obtain the dependency information of each front-end component.
For the dynamic dependency information of the front-end component in the product code, since the dynamic dependency information can be determined only after the product code is run, the server side needs to provide an environment suitable for the running of the product code, and the dynamic dependency information of the front-end component in the product code is obtained by running the product code. In this embodiment, running the product code refers to running based on a local service of the server and virtual test data (Mock data), and in this way, dynamic dependency information of the front-end component in the product code can be obtained. Further, the storing of the static dependency information and the dynamic dependency information of the front-end component in the product code in the form of a specific data structure specifically includes, when obtaining the dependency information of the front-end component in the product code according to the product code: constructing a data structure from the product code, wherein the data structure includes dependency information for a front-end component in the product code. Specifically, the data structure may be in the form of a key-value, the name of the product code (e.g., file name + saving path) is used as a key, and the dependency information of the front-end component in the product code is used as a value for saving.
Step S1013, storing the dependency information of the front-end component in the product code in a cache. The cache of the server side can store the data structure, and the data structure corresponding to a certain product code is provided when the search request of the user is obtained, so that the search is facilitated.
Preferably, the search request input by the user includes a component name, repository information, and branch information. The specific flow of step S102 is shown in fig. 3, and specifically includes:
s1021, according to the warehouse information and the branch information in the search request, a data structure of the target product code is obtained from a cache, wherein the data structure of the target product code comprises dependency information of a front-end component in the target product code.
Taking a git warehouse as an example, one warehouse corresponds to one product, the product corresponding to the search request can be determined through warehouse information, and the branch information is used for determining that the search request is specific to the code version in the product, so that the target product code corresponding to the search request can be determined through the warehouse information and the branch information, and the data structure of the target product code can be obtained from the cache. In an actual scenario, the branch information may be null, and at this time, the server may search the cache for a product code of a default branch in the corresponding product.
And S1022, obtaining, from the data structure, dependency information of the target front-end component corresponding to the search request according to the component name in the search request. Because the data structure stores the dependency information of all the front-end components in the target product code, the dependency information of the target front-end component can be found by the component name, and then the dependency information of the target front-end component is provided for the user.
Furthermore, considering the system overhead of obtaining the product code and obtaining the front-end component dependency information according to the product code, when the server reads the product code from the version control system warehouse, the server selectively reads the product code according to the access frequency of the product code, so that the cache may not have the dependency information of the target front-end component corresponding to the user search request. To avoid this problem, the present application provides a preferred front-end component dependent information searching method, whose processing flow is shown in fig. 4, and in addition to the foregoing processing steps, the method further includes:
and step S104, if the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user, reading the target product code from the version control system warehouse according to the warehouse information and the branch information in the search request.
If the dependency information of the target front-end component corresponding to the search request does not exist in the cache, the search cannot be completed, and therefore the dependency information needs to be acquired from the version control system warehouse in a real-time reading mode according to the search request. The specific reading mode can be similar to that when the product code is read, an application program interface of a version control system warehouse is called, and the target product code is determined and obtained according to the warehouse information and the branch information.
Step S105, constructing a data structure according to the target product code, wherein the data structure of the target product code comprises dependency information of a front-end component in the target product code.
For the dependency information of the front-end component contained in the target product code, the static dependency information and the dynamic dependency information can be obtained by adopting plug-in analysis and running based on local service and virtual test data, and a corresponding data structure is constructed accordingly.
And step S106, obtaining the dependency information of the target front-end component corresponding to the search request from the data structure according to the component name in the search request.
Since real-time reading and processing are required when the dependent information of the target front-end component corresponding to the search request cannot be obtained from the cache, the time consumption is significantly longer than that of directly searching the dependent information of the target front-end component in the cache. In order to optimize the user experience, if the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user, the method further includes: and feeding back the processing progress of the search request to the user in real time. The processing progress including the current searching state and the staged execution result is fed back to the user, so that the user can know the current situation at any time, and the use experience of the user is optimized.
When the dependency relationships of a plurality of front-end components are queried at a single time, the processing progress can be fed back to the user in real time, and the current searching state and the staged execution result are informed to the user. Thus, the method further comprises: and if the dependency information of the target front-end component corresponding to the search request is acquired from the cache according to a plurality of search requests of the user, feeding back the processing progress of the search requests to the user in real time.
For example, a certain search request needs to search for dependency information of a front-end component a in a product code a, a front-end component B in a product code B, and a front-end component C in a product code C at the same time. And if the cache only comprises the data structures of the product code A and the product code C, positioning the corresponding data structure according to the warehouse information and the branch information in the search request, taking out the data structure from the cache, and searching corresponding dependency information based on the component names a and C. Since the cache does not have the data structure of the product code B, the product code B needs to be read from the version control system warehouse in real time, and then the corresponding static dependency information and the dynamic dependency information are obtained through processing, in the process, the processing progress of the search by the front-end component a, the front-end component B and the front-end component c can be fed back to the user, so that the user can know the current processing progress of the search request in real time.
In addition, in a practical scenario, a user often needs to search for dependency information of multiple front-end components in the same product code, and in order to reduce the overhead of system resources, part of the processing at the server side may be transferred to the browser side of the user for processing. For example, after the server side obtains the data structure of the target product code from the cache according to the warehouse information and the branch information in the search request, the data structure is directly returned to the browser side of the user, and if the user needs to search the dependency information of multiple front-end components in the same product code, the user can directly query in the data structure to obtain the dependency information of the multiple front-end components without information interaction with the server side.
Therefore, the front-end component dependent information searching method provided by the embodiment of the application mainly has the following functions:
1. the method provides online service, and can search which files are statically depended on by a file in a certain front-end product without downloading source codes of corresponding products.
2. The method provides online service, and can search which modules depend on one module dynamically in a certain front-end product without downloading source codes of corresponding products.
3. An online service is provided that can search for which other products a file or module is used and dependent on without downloading the source code for several products.
The specific business process when the method is adopted to search the front-end component dependent information is shown in fig. 5, and the method comprises the following steps:
step S501, a user logs in a system for deploying the front-end component dependent information searching method at a browser end.
Step S502, inputting the component name needing to search the dependency information.
Step S503, selecting git warehouse to be searched, wherein one git warehouse corresponds to one product, thereby determining warehouse information.
Step S504, select the branch to be searched, determine the branch information, and search the default branch if not selected here.
Step S505, the server of the system reads the data structure of the pre-constructed product code from the cache according to the warehouse information and the branch information selected by the user, and executes step S507;
step S506, if the cache does not exist, acquiring the product code in real time, analyzing and constructing a data structure, and executing step S507;
step S507, returning the data structure to the browser end of the user;
and step S508, the browser end performs screening according to the data structure returned by the server end and the component name input by the user, and displays the dependency information of the front-end component.
Fig. 6 shows a structure of a system for deploying the front-end component dependent information search method, where a server side mainly provides the following services to implement various functions of the method, and specifically includes:
a. the identity check service 610 is accessed for verification of user login.
b. The git service 620 reads the relevant product codes in the git warehouse by calling an application program interface of the git warehouse by using the account number accessed to the git warehouse and the corresponding verification certificate, and copies the product codes to the server side;
c. the task planning service 630, which updates the product code of the git warehouse with a high access frequency once every three to five days, and runs other related services on the server side to read the dependency information of the front-end components in the product code, and forms a data structure, and updates the data structure into the cache;
d. message service 640 functions to maintain the browser-side and server-side communication of the user. Under the condition that the cache of the server side is invalid, the git service can pull the corresponding product code from the git warehouse again, and the internal server service analyzes the product code again to obtain the dependency information, so that the time consumption is long, and under the condition, the current processing progress of the browser side can be informed in real time through the message service. In addition, when the dependency information of a plurality of front-end components is queried at a time, the service is also used for informing the current processing progress of the browser end.
e. The internal server service 650 is used for providing an environment suitable for the product code running inside the server side, because much dependency information can be obtained only after the product code runs. The operation here is only operated by means of local services and mock data on the server side.
f. The cache service 660 is configured to store a data structure formed by dependency information of the front-end component in the data product code.
g. The windowless browser service 670, running in the windowless browser kernel through the code obtained by the git service and based on the running environment provided by the internal server service. And analyzing the static dependency information of the front-end component in the whole product code and the dynamic dependency information in the runtime to form a data structure. Specifically, as shown in fig. 7, the internal structure of the service provides a third-party module management library plug-in, the static dependency analysis module analyzes different product codes to obtain static dependency information, and the dynamic dependency relationship of each product code is dynamically analyzed by the dynamic dependency analysis module during the product operation period, so as to construct a data structure.
According to another aspect of the present application, there is also provided a front-end component dependent information searching apparatus, which has a structure as shown in fig. 8, and includes an internal service device 810, a search processing device 820, and a message service device 830.
Specifically, the internal service device 810 is configured to obtain dependency information of the front-end component and store the dependency information in a cache. The front-end components can be code files or code modules (namely modularized codes), a database comprising a certain amount of front-end component dependence information is constructed in a cache in a pre-acquisition mode, and since the dependence information of the front-end components is obtained by depending on product codes in the whole network and is not limited to product codes local to users, cross-product dependence relationship search can be realized.
The search processing device 820 is configured to obtain, from the cache, dependency information of a target front-end component corresponding to a search request according to the search request of a user. The target front-end component refers to a front-end component as a search target, and the search request includes tag information for uniquely identifying the target front-end component, which may include, but is not limited to, a component name and the like.
The message service device 830 is used for providing the dependency information of the target front-end component to the user. Because the dependency information of the product can be directly acquired through the search request, a user can directly know which code files or modules depend on the front-end component A through the dependency information provided by the server, and therefore the problem that the search result is not intuitive when the user searches in the local editor is solved. Further, when the dependency information is provided for the user, the dependency information can be provided in a graphical and tabular manner.
Here, it should be understood by those skilled in the art that the device may include, but is not limited to, a user device, a network device, or a device formed by integrating a user device and a network device through a network, such as a server, or a device formed by integrating a server and a user's browser through a network. The user equipment comprises but is not limited to a personal computer, a touch terminal and the like; including but not limited to implementations such as a network host, a single network server, multiple sets of network servers, or a cloud-computing-based collection of computers. Here, the Cloud is made up of a large number of hosts or web servers based on Cloud Computing (Cloud Computing), which is a type of distributed Computing, one virtual computer consisting of a collection of loosely coupled computers.
The server side obtains the dependency information of the front-end component in a pre-obtaining mode, stores the dependency information in the cache, and can directly search the dependency information needed by the user in the cache after receiving a search request of the user.
Preferably, the specific structure of the internal service device 810 is as shown in fig. 9, and includes a code obtaining module 811, a dependency analysis module 812 and a cache service module 813.
Specifically, the code acquisition module 811 is used to read product codes from a version control system repository.
In this embodiment, the specific manner of acquisition may be periodic acquisition, or acquisition driven by an event. When the product code is obtained regularly, the time interval can be set according to actual requirements, for example, the product code is read once from the version control system warehouse for three to five days according to the updating frequency of the product code in the version control system warehouse. When the product code is read, the relevant product code is read from the version control system warehouse by calling an application program interface provided by the version control system warehouse and is copied to the server side. The version control system repository may be any existing version control system repository, such as a git repository (gitlab).
In consideration of the overhead of acquiring product codes and front-end component dependent information according to the product codes, the server side does not read and analyze all the product codes in the version control system warehouse, but selectively reads specific product codes. As a preferred embodiment, each time the code obtaining module reads a product code from the version control system repository, the code obtaining module reads N product codes with higher access frequencies from the version control system repository according to the access frequency of the product code, where N is a positive integer. The access frequency is used to indicate the number of times the product code is queried in a period (e.g., the last update cycle), and the higher the access frequency, the higher the possibility that the product code is queried is indicated, so that the product code is preferentially read for the user to query.
The dependency analysis module 812 is configured to obtain dependency information of a front-end component in the product code according to the product code. Wherein, for product code based on a specific front-end development language (such as JavaScript), the dependency information can comprise static dependency information and dynamic dependency information.
Taking a product code based on JavaScript as an example, the static dependency information of the front-end component in the product code can be obtained by analyzing the product code. In an actual scene, most product codes are managed in a modularized mode, and when the product codes depend on the product codes, the front-end components are quoted directly by using a corresponding mode of a third-party module management library class. Therefore, the server side can preset corresponding plug-ins of the third-party module management library class, and analyze the product codes using different third-party module management library classes by using the corresponding plug-ins to obtain the dependency information of each front-end component.
For the dynamic dependency information of the front-end component in the product code, since the dynamic dependency information can be determined only after the product code is run, the server side needs to provide an environment suitable for the running of the product code, and the dynamic dependency information of the front-end component in the product code is obtained by running the product code. In this embodiment, running the product code refers to running based on a local service of the server and virtual test data (Mock data), and in this way, dynamic dependency information of the front-end component in the product code can be obtained.
Further, the static dependency information and the dynamic dependency information of the front-end component in the product code are stored in the form of a specific data structure, that is, the dependency analysis module constructs a data structure according to the product code, wherein the data structure includes the dependency information of the front-end component in the product code. Specifically, the data structure may be in the form of a key-value, the name of the product code (e.g., file name + saving path) is used as a key, and the dependency information of the front-end component in the product code is used as a value for saving.
The cache service module 813 is configured to store the dependency information of the front-end component in the product code in a cache. The cache of the server side can store the data structure, and the data structure corresponding to a certain product code is provided when the search request of the user is obtained, so that the search is facilitated.
Preferably, the search request input by the user includes a component name, repository information, and branch information. The dependency analysis module 820 is specifically configured to obtain a data structure of a target product code from a cache according to the warehouse information and the branch information in the search request, and obtain dependency information of a target front-end component corresponding to the search request from the data structure according to a component name in the search request, where the data structure of the target product code includes dependency information of the front-end component in the target product code.
Taking a git warehouse as an example, one warehouse corresponds to one product, the product corresponding to the search request can be determined through warehouse information, and the branch information is used for determining that the search request is specific to the code version in the product, so that the target product code corresponding to the search request can be determined through the warehouse information and the branch information, and the data structure of the target product code can be obtained from the cache. In an actual scenario, the branch information may be null, and at this time, the server may search the cache for a product code of a default branch in the corresponding product.
Because the data structure stores the dependency information of all the front-end components in the target product code, the dependency information of the target front-end component can be found by the component name, and then the dependency information of the target front-end component is provided for the user.
Furthermore, considering the system overhead of obtaining the product code and obtaining the front-end component dependency information according to the product code, when the server reads the product code from the version control system warehouse, the server selectively reads the product code according to the access frequency of the product code, so that the cache may not have the dependency information of the target front-end component corresponding to the user search request.
To avoid this problem, the code obtaining module 811 is further configured to, when the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user, read the target product code from the version control system repository according to the repository information and the branch information in the search request. If the dependency information of the target front-end component corresponding to the search request does not exist in the cache, the search cannot be completed, and therefore the dependency information needs to be acquired from the version control system warehouse in a real-time reading mode according to the search request. The specific reading mode can be similar to that when the product code is read, an application program interface of a version control system warehouse is called, and the target product code is determined and obtained according to the warehouse information and the branch information.
The dependency analysis module 812 is further configured to construct a data structure according to the target product code, where the data structure of the target product code includes dependency information of a front-end component in the target product code. For the dependency information of the front-end component contained in the target product code, the static dependency information and the dynamic dependency information can be obtained by adopting plug-in analysis and running based on local service and virtual test data, and a corresponding data structure is constructed accordingly.
The search processing device 820 is further configured to obtain, from the data structure, dependency information of a target front-end component corresponding to the search request according to the component name in the search request.
Since real-time reading and processing are required when the dependent information of the target front-end component corresponding to the search request cannot be obtained from the cache, the time consumption is significantly longer than that of directly searching the dependent information of the target front-end component in the cache. In order to optimize the user experience, the message service device 830 is further configured to, according to the search request of the user, feed back the processing progress of the search request to the user in real time when the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache. The processing progress including the current searching state and the staged execution result is fed back to the user, so that the user can know the current situation at any time, and the use experience of the user is optimized.
When the dependency relationships of a plurality of front-end components are queried at a single time, the processing progress can be fed back to the user in real time, and the current searching state and the staged execution result are informed to the user. Therefore, the message service device 830 is further configured to feed back the processing progress of the multiple search requests to the user in real time when the dependency information of the target front-end component corresponding to the search request is simultaneously obtained from the cache according to the multiple search requests of the user.
For example, a certain search request needs to search for dependency information of a front-end component a in a product code a, a front-end component B in a product code B, and a front-end component C in a product code C at the same time. And if the cache only comprises the data structures of the product code A and the product code C, positioning the corresponding data structure according to the warehouse information and the branch information in the search request, taking out the data structure from the cache, and searching corresponding dependency information based on the component names a and C. Since the cache does not have the data structure of the product code B, the product code B needs to be read from the version control system warehouse in real time, and then the corresponding static dependency information and the dynamic dependency information are obtained through processing, in the process, the processing progress of the search by the front-end component a, the front-end component B and the front-end component c can be fed back to the user, so that the user can know the current processing progress of the search request in real time.
In addition, in a practical scenario, a user often needs to search for dependency information of multiple front-end components in the same product code, and in order to reduce the overhead of system resources, part of the processing at the server side may be transferred to the browser side of the user for processing. For example, after the server side obtains the data structure of the target product code from the cache according to the warehouse information and the branch information in the search request, the data structure is directly returned to the browser side of the user, and if the user needs to search the dependency information of multiple front-end components in the same product code, the user can directly query in the data structure to obtain the dependency information of the multiple front-end components without information interaction with the server side.
An embodiment of the present application further provides a front-end component dependent information search device, where the device includes:
a processor;
and a memory arranged to store computer executable instructions that, when executed, cause the processor to: acquiring the dependency information of the front-end component and storing the dependency information in a cache; obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user; providing dependency information of the target front-end component to a user.
To sum up, in the technical scheme of the application, the server side acquires the dependency information of the front-end component in a pre-acquisition mode, stores the dependency information in the cache, and can directly search the dependency information needed by the user in the cache after receiving the search request of the user. In addition, the local service and the virtual test data required by the running code are provided by the server side, so that the product code can be run at the server side to obtain the dynamic dependence information of the front-end component in the product code, the dynamic dependence information can be searched in the search result, and the searching accuracy is improved.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (19)

1. A front-end component dependent information searching method, wherein the method comprises:
reading a product code from a version control system repository;
acquiring dependency information of a front-end component in the product code according to the product code;
storing dependency information of a front-end component in the product code in a cache;
obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user;
providing dependency information of the target front-end component to a user.
2. The method of claim 1, wherein reading the product code from the version control system repository comprises:
and reading N product codes with higher access frequency from the version control system warehouse according to the access frequency of the product codes, wherein N is a positive integer.
3. The method of claim 1, wherein the dependency information includes dynamic dependency information and static dependency information;
acquiring dependency information of a front-end component in the product code according to the product code, wherein the dependency information comprises:
analyzing the product code to obtain the static dependency information of the front-end component in the product code, and operating the product code to obtain the dynamic dependency information of the front-end component in the product code.
4. The method of claim 3, wherein running the product code to obtain dynamic dependency information of a front-end component in the product code comprises:
and running the product code based on local service and virtual test data to acquire dynamic dependency information of a front-end component in the product code.
5. The method of claim 1, wherein obtaining dependency information of a front-end component in the product code from the product code comprises:
constructing a data structure from the product code, wherein the data structure includes dependency information for a front-end component in the product code.
6. The method of any of claims 1-5, wherein the search request includes a component name, repository information, and branch information;
obtaining the dependency information of the target front-end component corresponding to the search request from the cache according to the search request of the user, including:
obtaining a data structure of a target product code from a cache according to the warehouse information and the branch information in the search request, wherein the data structure of the target product code comprises dependency information of a front-end component in the target product code;
and acquiring the dependency information of the target front-end component corresponding to the search request from the data structure according to the component name in the search request.
7. The method of claim 6, wherein the method further comprises:
if the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user, reading a target product code from a version control system warehouse according to warehouse information and branch information in the search request;
constructing a data structure according to the target product code, wherein the data structure of the target product code comprises dependency information of a front-end component in the target product code;
and acquiring the dependency information of the target front-end component corresponding to the search request from the data structure according to the component name in the search request.
8. The method according to claim 7, wherein if the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user, the processing progress of the search request is fed back to the user in real time.
9. The method according to claim 1, wherein if dependency information of a target front-end component corresponding to a plurality of search requests of a user is obtained from the cache at the same time according to the search requests, the processing progress of the search requests is fed back to the user in real time.
10. A front-end component-dependent information searching apparatus, wherein the apparatus comprises:
the internal service device comprises a code acquisition module, a dependence analysis module and a cache service module, wherein the code acquisition module is used for reading a product code from the version control system warehouse; the dependency analysis module is used for acquiring dependency information of a front-end component in the product code according to the product code; the cache service module is used for storing the dependency information of the front-end component in the product code in a cache;
the search processing device is used for acquiring the dependency information of the target front-end component corresponding to the search request from the cache according to the search request of the user;
and the message service device is used for providing the dependency information of the target front-end component for the user.
11. The apparatus of claim 10, wherein the code obtaining module is configured to read N product codes with higher access frequency from the version control system repository according to the access frequency of the product codes, where N is a positive integer.
12. The device of claim 10, wherein the dependency information includes dynamic dependency information and static dependency information;
the dependency analysis module is used for analyzing the product code to obtain the static dependency information of the front-end component in the product code, and operating the product code to obtain the dynamic dependency information of the front-end component in the product code.
13. The apparatus of claim 12, wherein the dependency analysis module is configured to run the product code based on local services and virtual test data to obtain dynamic dependency information of a front-end component in the product code.
14. The apparatus of claim 10, wherein the dependency analysis module is to construct a data structure from the product code, wherein the data structure includes dependency information for a front-end component in the product code.
15. The apparatus of any of claims 10 to 14, wherein the search request includes a component name, repository information, and branch information;
the search processing device is configured to obtain a data structure of a target product code from a cache according to the warehouse information and the branch information in the search request, and obtain dependency information of a target front-end component corresponding to the search request from the data structure according to a component name in the search request, where the data structure of the target product code includes dependency information of the front-end component in the target product code.
16. The apparatus of claim 15, wherein the code obtaining module is further configured to, when dependency information of a target front-end component corresponding to a search request cannot be obtained from the cache according to the search request of a user, read a target product code from a version control system repository according to repository information and branch information in the search request;
the dependency analysis module is further configured to construct a data structure according to the target product code, where the data structure of the target product code includes dependency information of a front-end component in the target product code;
and the search processing device is also used for acquiring the dependency information of the target front-end component corresponding to the search request from the data structure according to the component name in the search request.
17. The device according to claim 16, wherein the message service device is further configured to feed back a processing progress of the search request to the user in real time when the dependency information of the target front-end component corresponding to the search request cannot be obtained from the cache according to the search request of the user.
18. The apparatus according to claim 10, wherein the message service device is further configured to feed back, in real time, processing progress of multiple search requests to the user when dependency information of a target front-end component corresponding to the search request is obtained from the cache according to the multiple search requests of the user at the same time.
19. A front-end component-dependent information searching apparatus, wherein the apparatus comprises:
a processor;
and a memory arranged to store computer executable instructions that, when executed, cause the processor to: reading a product code from a version control system repository; acquiring dependency information of a front-end component in the product code according to the product code; storing dependency information of a front-end component in the product code in a cache; obtaining the dependency information of a target front-end component corresponding to a search request from the cache according to the search request of a user; providing dependency information of the target front-end component to a user.
CN201710192716.XA 2016-03-30 2017-03-28 Front-end component dependent information searching method and equipment Active CN107391528B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2016101917568 2016-03-30
CN201610191756 2016-03-30

Publications (2)

Publication Number Publication Date
CN107391528A CN107391528A (en) 2017-11-24
CN107391528B true CN107391528B (en) 2021-04-20

Family

ID=60338566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710192716.XA Active CN107391528B (en) 2016-03-30 2017-03-28 Front-end component dependent information searching method and equipment

Country Status (1)

Country Link
CN (1) CN107391528B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111143790B (en) * 2019-12-13 2022-07-12 广州方硅信息技术有限公司 Code obfuscation method, device, equipment and storage medium
CN112527872A (en) * 2020-12-18 2021-03-19 湖南快乐阳光互动娱乐传媒有限公司 Data query method and device, storage medium and electronic equipment
CN114826899B (en) * 2022-03-16 2024-01-23 青岛海尔科技有限公司 Debugging method and device for equipment control service, storage medium and electronic device
CN117369865B (en) * 2023-12-07 2024-04-05 麒麟软件有限公司 GNU linux universal application program packaging method and graphical application packer

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866878A (en) * 2006-06-13 2006-11-22 南京大学 Method for forming safety guarantee estimation flow of information technology product based on dependency relationship
CN1968154A (en) * 2006-09-15 2007-05-23 华为技术有限公司 System and method for service expansion using plug
CN101963987A (en) * 2010-09-30 2011-02-02 百度在线网络技术(北京)有限公司 Methods and equipments for generating and loading web page file
CN102360308A (en) * 2011-09-29 2012-02-22 用友软件股份有限公司 Distributed deployment system and method of components
CN104951339A (en) * 2015-06-05 2015-09-30 烽火通信科技股份有限公司 Automatic searching and installing system and method based on Bundle dependency
CN104991773A (en) * 2015-06-30 2015-10-21 小米科技有限责任公司 Program generation method and apparatus
CN105099739A (en) * 2014-05-15 2015-11-25 中国移动通信集团公司 Plug-in type software deployment method and apparatus, and application server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866878A (en) * 2006-06-13 2006-11-22 南京大学 Method for forming safety guarantee estimation flow of information technology product based on dependency relationship
CN1968154A (en) * 2006-09-15 2007-05-23 华为技术有限公司 System and method for service expansion using plug
CN101963987A (en) * 2010-09-30 2011-02-02 百度在线网络技术(北京)有限公司 Methods and equipments for generating and loading web page file
CN102360308A (en) * 2011-09-29 2012-02-22 用友软件股份有限公司 Distributed deployment system and method of components
CN105099739A (en) * 2014-05-15 2015-11-25 中国移动通信集团公司 Plug-in type software deployment method and apparatus, and application server
CN104951339A (en) * 2015-06-05 2015-09-30 烽火通信科技股份有限公司 Automatic searching and installing system and method based on Bundle dependency
CN104991773A (en) * 2015-06-30 2015-10-21 小米科技有限责任公司 Program generation method and apparatus

Also Published As

Publication number Publication date
CN107391528A (en) 2017-11-24

Similar Documents

Publication Publication Date Title
US11544623B2 (en) Consistent filtering of machine learning data
Zeuch et al. Analyzing efficient stream processing on modern hardware
US10366053B1 (en) Consistent randomized record-level splitting of machine learning data
US11100420B2 (en) Input processing for machine learning
US10956422B2 (en) Integrating event processing with map-reduce
US8219581B2 (en) Method and system for analyzing ordered data using pattern matching in a relational database
CN107391528B (en) Front-end component dependent information searching method and equipment
JP5791149B2 (en) Computer-implemented method, computer program, and data processing system for database query optimization
US9514184B2 (en) Systems and methods for a high speed query infrastructure
CN109783562B (en) Service processing method and device
US9442718B1 (en) System for assisting in locating changes in source code version control system
US20220214872A1 (en) Dynamic review of software updates after pull requests
US11573790B2 (en) Generation of knowledge graphs based on repositories of code
CN115335821A (en) Offloading statistics collection
CN113962597A (en) Data analysis method and device, electronic equipment and storage medium
Cheng et al. Optimal alignments between large event logs and process models over distributed systems: An approach based on Petri nets
US20120310893A1 (en) Systems and methods for manipulating and archiving web content
CN113220530B (en) Data quality monitoring method and platform
CN113495723B (en) Method, device and storage medium for calling functional component
CN115544089A (en) Data processing method, device, equipment and storage medium
CN113448985A (en) API (application program interface) interface generation method, calling method and device and electronic equipment
CN112835901A (en) File storage method and device, computer equipment and computer readable storage medium
US11960560B1 (en) Methods for analyzing recurring accessibility issues with dynamic web site behavior and devices thereof
CN116028108B (en) Method, device, equipment and storage medium for analyzing dependent package installation time
CN113553320B (en) Data quality monitoring method and device

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