CN112486490A - Front-end code packaging method and device, electronic equipment and storage medium - Google Patents
Front-end code packaging method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112486490A CN112486490A CN202011478743.1A CN202011478743A CN112486490A CN 112486490 A CN112486490 A CN 112486490A CN 202011478743 A CN202011478743 A CN 202011478743A CN 112486490 A CN112486490 A CN 112486490A
- Authority
- CN
- China
- Prior art keywords
- code
- service
- calling
- file
- codes
- 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.)
- Granted
Links
- 238000004806 packaging method and process Methods 0.000 title claims abstract description 92
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000012856 packing Methods 0.000 claims abstract description 52
- 238000012545 processing Methods 0.000 claims abstract description 17
- 230000011218 segmentation Effects 0.000 claims description 24
- 230000008676 import Effects 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 10
- 238000000605 extraction Methods 0.000 claims description 4
- 238000011161 development Methods 0.000 abstract description 10
- 230000006870 function Effects 0.000 description 11
- 230000018109 developmental process Effects 0.000 description 8
- 238000007726 management method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 239000012634 fragment Substances 0.000 description 3
- 230000005012 migration Effects 0.000 description 3
- 238000013508 migration Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- VOZKAJLKRJDJLL-UHFFFAOYSA-N 2,4-diaminotoluene Chemical compound CC1=CC=C(N)C=C1N VOZKAJLKRJDJLL-UHFFFAOYSA-N 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/37—Compiler construction; Parser generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention relates to the technical field of webpage development, and discloses a front-end code packaging method, which comprises the following steps: acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code; identifying the file lengths of the service code and the calling code, and configuring a code division point of the service code and the calling code according to the file lengths of the service code and the calling code; according to the code division points of the service codes, a code packing tool is used for packing the service codes to generate service code files; and performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using a code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file. Furthermore, the present disclosure relates to blockchain techniques, in which the front-end code may be stored. The invention can improve the development efficiency of the front-end page.
Description
Technical Field
The invention relates to the technical field of webpage development, in particular to a front-end code packaging method and device, electronic equipment and a computer readable storage medium.
Background
In the current front-end page development technology, in order to meet efficient development, a front-end code written by a developer is packaged by a scaffold and then is issued to an online operation. The method commonly used in the industry is vue-cli scaffold, the existing code packaging is automatically optimized when compiling and packaging are carried out, the vue-cli scaffold does not need manual configuration under the common condition, the webpack scaffold is packaged inside the scaffold to form a universal basic function, and the front-end code packaging can be completed.
However, packaging the front-end code by vue-cli scaffolding has disadvantages: 1. the packaged front-end code is lack of flexibility in general configuration, and the packaged front-end code is a default name plus a number, so that developers can not know which code file the written specific logic is divided into, and the development efficiency of a front-end page is influenced; 2. it is very likely to package the business logic part of the front-end code into a code file, and any change will require re-downloading the code file of the whole business logic, thereby also affecting the development efficiency of the front-end page.
Disclosure of Invention
The invention provides a front-end code packaging method and device, electronic equipment and a computer readable storage medium, and mainly aims to improve the development efficiency of a front-end page.
In order to achieve the above object, the present invention provides a front-end code packing method, including:
acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
identifying the file lengths of the service code and the calling code, and configuring a code division point of the service code and the calling code according to the file lengths of the service code and the calling code;
according to the code division points of the service codes, a preset code packing tool is used for packing the service codes to generate service code files;
and performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using the code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file.
Optionally, the performing service logic classification on the front-end code to obtain a service code and a call code includes:
and identifying the service type of the front-end code, and executing the service logic classification of the front-end code by using a preset code classification tool according to the service type to obtain a service code and a calling code.
Optionally, the identifying the file lengths of the service code and the calling code includes:
acquiring code lines, code parameters and configuration files of the service codes and the calling codes;
calculating the code operation values of the service code and the calling code according to the code lines, the code parameters and the configuration file;
and identifying the storage spaces of the service codes and the calling codes according to the code operation values to obtain the file lengths of the service codes and the calling codes.
Optionally, the root calculates the code operation value of the service code and the calling code according to the code line, the code parameter, and the configuration file, and includes:
calculating code operation values of the service code and the calling code by using the following method;
ρX=E(X+μX+σX)
ρY=E(Y+μY+σY)
where ρ isXA code run value representing a service code, X representing a code line of the service code, muXCode parameter, σ, representing a service codeXProfile, p, representing a service codeYRepresenting the code run value of the calling code, Y representing the code line of the calling code, muYCode parameter, σ, representing the calling codeYA configuration file representing the calling code, and E represents the expectation of the code running value.
Optionally, the configuring a code division point of the service code and the calling code according to the file length of the service code and the calling code includes:
setting a segmentation critical value of a code segment in the service code and the calling code according to the file length of the service code and the calling code, and identifying whether a code segmentation limit point exists in the service code and the calling code;
if no code division limiting point exists, marking the code division limiting point in the service code and the calling code by using a code division statement according to the division critical value;
and if the code division limiting points exist, marking the code division limiting points at the tail ends of the code lines of the service codes and the calling codes by using the code division sentences according to the division critical values.
Optionally, the performing file packaging on the service code by using a preset code packaging tool according to the code division point of the service code to generate a service code file includes:
acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by using the code packing tool;
according to the code division points of the service codes, carrying out code division on the service codes by using the division components in the code packaging tool to generate code files;
and storing the code file into the local warehouse according to the storage dependence to form a service code file.
Optionally, the performing, according to a preset code packing rule and the code division point of the calling code, file packing on the generic import code by using the code packing tool to generate a generic code file includes:
acquiring a code compiling environment of the universal introduced code, and establishing storage dependence of the universal introduced code and a local warehouse in the code compiling environment of the universal introduced code by using the code packaging tool;
according to the code segmentation point of the universal introduced code, utilizing a segmentation component in the code packaging tool to perform code segmentation on the universal introduced code to generate a universal code file;
identifying whether the universal code file is extracted or not according to the code packing rule;
if the universal code file does not need to be extracted, the universal code file is put into the local warehouse according to the storage dependence to form a calling code file;
if the general code file needs to be extracted, extracting the general code file by using a code file extraction tool to obtain an extracted code file, and transferring the extracted code file to the local warehouse according to the storage dependence to form a calling code file.
In order to solve the above problem, the present invention further provides a front-end code packaging apparatus, including:
the classification module is used for acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
the configuration module is used for identifying the file lengths of the service codes and the calling codes and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
the packaging module is used for carrying out file packaging on the service codes by using a preset code packaging tool according to the code division points of the service codes to generate service code files;
the packaging module is further used for introducing generalization processing to the calling code to generate a universal introduced code, and performing file packaging to the universal introduced code by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to implement the front-end code packing method described above.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the front-end code packaging method described above.
The embodiment of the invention firstly obtains the front end code, and carries out service logic classification on the front end code to obtain the service code and the calling code, thereby realizing purpose classification of the front end code and improving the processing efficiency of the front end code; secondly, the embodiment of the invention identifies the file lengths of the service code and the calling code, and configures the code division points of the service code and the calling code according to the file lengths of the service code and the calling code so as to better realize the configuration of the division points when the codes are packed, thereby helping a user to better search the corresponding code fragment position; furthermore, according to the code division point of the service code, the embodiment of the invention utilizes a preset code packing tool to pack the service code to generate a service code file, and performs introduction generalization processing on the calling code to generate a universal introduction code, and utilizes the code packing tool to pack the universal introduction code according to a preset code packing rule and the code division value of the calling code to generate a universal code file, thereby ensuring flexible configuration during code packing, enabling developers to quickly inquire the position of the code compiled by themselves and avoiding packing the service logic part of the front-end code into one code file. Therefore, the front-end code packaging method, the front-end code packaging device, the electronic equipment and the storage medium can improve the development efficiency of the front-end page.
Drawings
Fig. 1 is a schematic flowchart of a front-end code packing method according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart illustrating a step of the front-end code packing method provided in FIG. 1 according to a first embodiment of the present invention;
fig. 3 is a block diagram of a front-end code packaging apparatus according to an embodiment of the present invention;
fig. 4 is a schematic internal structural diagram of an electronic device implementing a front-end code packaging method according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a front-end code packaging method. The execution body of the front-end code packaging method includes, but is not limited to, at least one of electronic devices such as a server and a terminal, which can be configured to execute the method provided by the embodiments of the present application. In other words, the front-end code packing method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a front-end code packaging method according to an embodiment of the present invention. In the embodiment of the present invention, the front-end code packing method includes:
s1, acquiring front end codes, and carrying out service logic classification on the front end codes to obtain service codes and calling codes.
In the embodiment of the invention, the front-end code is a front-end page source code which can run in a browser, and different front-end pages can be displayed by compiling different front-end codes, such as a mall order page, an information entry page, a user login page and the like. In the present invention, the front-end code is compiled by a developer, and includes: html code, css code, JavaScript code, and the like.
Further, because in different business scenarios, the front-end code compiled by the developer will also be used in different actual businesses, for example, the front-end code compiled by the developer a is used to edit a front-end page, and the front-end code compiled by the developer B is used to make calls for other developers. Therefore, the embodiment of the invention realizes the purpose classification of the front-end code by carrying out service logic classification on the front-end code, and improves the processing efficiency of the front-end code.
In detail, the performing service logic classification on the front-end code to obtain a service code and a calling code includes: and identifying the service type of the front-end code, and executing the service logic classification of the front-end code by using a preset code classification tool according to the service type to obtain a service code and a calling code.
The service type of the front-end code is identified according to user requirements, for example, if the user requirements are to develop a mall page, the corresponding service type is to develop a service code, and the preset code classification tool may be a git tool.
Further, to ensure privacy and security of the front-end code, the front-end code may also be stored in a blockchain node.
S2, identifying the file length of the service code and the calling code, and configuring the code division point of the service code and the calling code according to the file length of the service code and the calling code.
In the embodiment of the present invention, the file length refers to a code size of a corresponding code, that is, a size of a required storage space. The embodiment of the invention can better realize the configuration of the division points of the codes during packaging by identifying the file lengths of the service codes and the calling codes, thereby helping a user to better search the corresponding code fragment positions.
In detail, the identifying the file length of the service code and the calling code includes: acquiring code lines, code parameters and configuration files of the service codes and the calling codes; calculating the code operation values of the service code and the calling code according to the code lines, the code parameters and the configuration file; and identifying the storage spaces of the service codes and the calling codes according to the code operation values to obtain the file lengths of the service codes and the calling codes.
Wherein the code line is used for marking the instrumented code in the second line of the code, the code parameter refers to the code content, and the configuration file is used for characterizing the code logic.
In an optional embodiment of the present invention, the code running value of the service code and the calling code is calculated by the following method:
ρX=E(X+μX+σX)
ρY=E(Y+μY+σY)
where ρ isXA code run value representing a service code, X representing a code line of the service code, muXCode parameter, σ, representing a service codeXProfile, p, representing a service codeYRepresenting the code run value of the calling code, Y representing the code line of the calling code, muYCode parameter, σ, representing the calling codeYA configuration file representing the calling code, and E represents the expectation of the code running value.
In an alternative embodiment, the storage space is obtained by an identification statement, which comprises a select statement.
Furthermore, the embodiment of the invention configures the code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes so as to realize the flexibility of division and packaging of the subsequent service codes and the calling codes, so that corresponding developers can quickly inquire the code position compiled by the corresponding developers.
Specifically, the configuring the code division points of the service code and the calling code according to the file lengths of the service code and the calling code includes: setting a segmentation critical value of a code segment in the service code and the calling code according to the file length of the service code and the calling code, and identifying whether a code segmentation limit point exists in the service code and the calling code; if no code division limiting point exists, marking the code division limiting point in the service code and the calling code by using a code division statement according to the division critical value; and if the code division limiting points exist, marking the code division limiting points at the tail ends of the code lines of the service codes and the calling codes by using the code division sentences according to the division critical values.
Wherein the segmentation threshold is set by an optimization, split bins, minsize attribute, for example, setting the segmentation threshold to 150 KB.
In a preferred embodiment, the code partitioning restriction point includes: functions, objects, classes, and the like, the code segmentation limit points are identified by query statements, the code instrumentation statements include insert statements, and the code segmentation limit points are used to mark locations of code segmentation.
And S3, according to the code division points of the service codes, performing file packaging on the service codes by using a preset code packaging tool to generate service code files.
It should be understood that the volume of the service code is very large, and if the service code is directly subjected to file packaging, it is very easy to cause that the time for loading the front-end page is too long, which results in poor user interaction experience.
In detail, referring to fig. 2, the generating a service code file by performing file packaging on the service code by using a preset code packaging tool according to the code division point of the service code includes:
s20, acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by using the code packaging tool;
s21, according to the code division points of the service codes, carrying out code division on the service codes by using the division components in the code packaging tool to generate code files;
and S22, storing the code file into the local warehouse according to the storage dependence to form a service code file.
The code packaging tool can be a webpack tool, and the code compiling environment is an integrated environment for compiling the service code, such as Myeclipse, Eclipse, sublime and the like; the storage dependency refers to a directory location where the business code is stored in a local repository; the local warehouse can be a maven warehouse, the segmentation component can be a common component, the format of the service code file is jar packet, and the service code file can run in a front-end browser.
And S4, performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using the code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file.
The embodiment of the invention realizes the introduction mode of the calling code generalization by introducing the generalization treatment to the calling code so as to realize the compatibility with other calling components and avoid the complexity that the calling code is required to be introduced again when different code components are called, wherein the introduction mode comprises the following steps: < script > tag import, import (ES6 mode), require (commonss mode), and AMD mode.
In detail, the performing an import generalization process on the calling code to generate a generic import code includes: and storing the calling codes in the same directory by using a code migration tool to form a universal introduction code, for example, the universal introduction code comprises three calling codes of a function, a class and an attribute, and migrating the three calling codes of the function, the class and the attribute to the src directory by using the code migration tool to form the universal introduction code of the function, the class and the attribute.
In an optional embodiment, the code migration tool is compiled through a script, and the script may be a JavaScript script.
Further, the embodiment of the invention performs file packaging on the general import code by using the code packaging tool based on a preset code packaging rule and the code division point of the calling code to generate a general code file.
In this embodiment of the present invention, the preset code packing rule includes: if the calling code of the universal introduced code is referred for 2 times or more than 2 times, the calling code is extracted as a new calling code, so that the condition that the same calling code is packaged to different places for many times is avoided, the packaging volume of the code is reduced, for example, calling parties A and B need to call a universal code C, if C is directly introduced into A and B, AC and BC are obtained, the universal code C is easily packaged repeatedly, the packaging volume of the code is increased, and the page loading speed is influenced. Optionally, the preset code packing rule is set by a minChunks attribute.
In detail, the file packing is performed on the general import code by using the code packing tool according to a preset code packing rule and the code division point of the calling code, and a general code file is generated, including: acquiring a code compiling environment of the universal introduced code, and establishing storage dependence of the universal introduced code and a local warehouse in the code compiling environment of the universal introduced code by using the code packaging tool; according to the code segmentation point of the universal introduced code, utilizing a segmentation component in the code packaging tool to perform code segmentation on the universal introduced code to generate a universal code file; identifying whether the universal code file is extracted or not according to the code packing rule; if the universal code file does not need to be extracted, the universal code file is put into the local warehouse according to the storage dependence to form a calling code file; if the general code file needs to be extracted, extracting the general code file by using a code file extraction tool to obtain an extracted code file, and transferring the extracted code file to the local warehouse according to the storage dependence to form a calling code file.
In an alternative embodiment of the present invention, the code file extraction tool is compiled by Java voice.
The embodiment of the invention firstly obtains the front end code, and carries out service logic classification on the front end code to obtain the service code and the calling code, thereby realizing purpose classification of the front end code and improving the processing efficiency of the front end code; secondly, the embodiment of the invention identifies the file lengths of the service code and the calling code, and configures the code division points of the service code and the calling code according to the file lengths of the service code and the calling code so as to better realize the configuration of the division points when the codes are packed, thereby helping a user to better search the corresponding code fragment position; furthermore, according to the code division point of the service code, the embodiment of the invention utilizes a preset code packing tool to pack the service code to generate a service code file, and performs introduction generalization processing on the calling code to generate a universal introduction code, and utilizes the code packing tool to pack the universal introduction code according to a preset code packing rule and the code division value of the calling code to generate a universal code file, thereby ensuring flexible configuration during code packing, enabling developers to quickly inquire the position of the code compiled by themselves and avoiding packing the service logic part of the front-end code into one code file. Therefore, the invention can improve the development efficiency of the front-end page.
Fig. 3 is a functional block diagram of the front-end code packaging apparatus according to the present invention.
The front-end code packaging device 100 of the present invention can be installed in an electronic device. According to the implemented functions, the front-end code packaging device may include a classification module 101, a configuration module 102, and a packaging module 103. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the classification module 101 is configured to obtain a front-end code, perform service logic classification on the front-end code, and obtain a service code and a call code;
the configuration module 102 is configured to identify file lengths of the service code and the call code, and configure a code division point of the service code and the call code according to the file lengths of the service code and the call code;
the packaging module 103 is configured to perform file packaging on the service codes by using a preset code packaging tool according to the code division points of the service codes, so as to generate a service code file;
the packaging module 103 is further configured to perform import generalization processing on the calling code to generate a general import code, and perform file packaging on the general import code by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a general code file.
In detail, when the modules in the front-end code packaging apparatus 100 in the embodiment of the present invention are used, the same technical means as the front-end code packaging method described in fig. 1 and fig. 2 are adopted, and the same technical effect can be produced, and details are not described here.
Fig. 4 is a schematic structural diagram of an electronic device implementing the front-end code packaging method according to the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a front-end code wrapper 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile 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 electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of a front-end code packaging program, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (e.g., executing front-end code packaging programs, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 4 only shows an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The front-end code packaging program 12 stored in the memory 11 of the electronic device 1 is a combination of a plurality of programs, and when running in the processor 10, can realize:
acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
identifying the file lengths of the service code and the calling code, and configuring a code division point of the service code and the calling code according to the file lengths of the service code and the calling code;
according to the code division points of the service codes, a preset code packing tool is used for packing the service codes to generate service code files;
and performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using the code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file.
Specifically, the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the foregoing program, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a non-volatile computer-readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
identifying the file lengths of the service code and the calling code, and configuring a code division point of the service code and the calling code according to the file lengths of the service code and the calling code;
according to the code division points of the service codes, a preset code packing tool is used for packing the service codes to generate service code files;
and performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using the code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules 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, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention 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 invention 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 signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
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 system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A front-end code packing method, the method comprising:
acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
identifying the file lengths of the service code and the calling code, and configuring a code division point of the service code and the calling code according to the file lengths of the service code and the calling code;
according to the code division points of the service codes, a preset code packing tool is used for packing the service codes to generate service code files;
and performing introduction generalization processing on the calling code to generate a universal introduction code, and performing file packaging on the universal introduction code by using the code packaging tool according to a preset code packaging rule and a code division value of the calling code to generate a universal code file.
2. The front-end code packing method of claim 1, wherein said classifying the front-end code into service logic to obtain a service code and a call code comprises:
identifying a service type of the front-end code;
and executing the business logic classification of the front-end code by using a preset code classification tool according to the business type to obtain a business code and a calling code.
3. The front-end code packaging method of claim 1, wherein the identifying the file length of the service code and the calling code comprises:
acquiring code lines, code parameters and configuration files of the service codes and the calling codes;
calculating the code operation values of the service code and the calling code according to the code lines, the code parameters and the configuration file;
and identifying the storage spaces of the service codes and the calling codes according to the code operation values to obtain the file lengths of the service codes and the calling codes.
4. The front-end code packing method of claim 3, wherein the root computing the code run values of the service code and the calling code from the code lines, the code parameters, and the configuration file comprises:
calculating code operation values of the service code and the calling code by using the following method;
ρX=E(X+μX+σX)
ρY=E(Y+μY+σY)
where ρ isXA code run value representing a service code, X representing a code line of the service code, muXCode parameter, σ, representing a service codeXProfile, p, representing a service codeYRepresenting the code run value of the calling code, Y representing the code line of the calling code, muYCode parameter, σ, representing the calling codeYA configuration file representing the calling code, and E represents the expectation of the code running value.
5. The front-end code packaging method of any one of claims 1 to 4, wherein the configuring the code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes comprises:
setting a segmentation critical value of a code segment in the service code and the calling code according to the file length of the service code and the calling code, and identifying whether a code segmentation limit point exists in the service code and the calling code;
if no code division limiting point exists, marking the code division limiting point in the service code and the calling code by using a code division statement according to the division critical value;
and if the code division limiting points exist, marking the code division limiting points at the tail ends of the code lines of the service codes and the calling codes by using the code division sentences according to the division critical values.
6. The front-end code packing method of claim 1, wherein the generating a service code file by performing file packing on the service code according to the code division point of the service code by using a preset code packing tool comprises:
acquiring a code compiling environment of the service code, and establishing storage dependence of the service code and a local warehouse in the code compiling environment by using the code packing tool;
according to the code division points of the service codes, carrying out code division on the service codes by using the division components in the code packaging tool to generate code files;
and storing the code file into the local warehouse according to the storage dependence to form a service code file.
7. The front-end code packing method of claim 1, wherein the generating a generic code file by performing file packing on the generic import code with the code packing tool according to a preset code packing rule and a code splitting point of the calling code comprises:
acquiring a code compiling environment of the universal introduced code, and establishing storage dependence of the universal introduced code and a local warehouse in the code compiling environment of the universal introduced code by using the code packaging tool;
according to the code segmentation point of the universal introduced code, utilizing a segmentation component in the code packaging tool to perform code segmentation on the universal introduced code to generate a universal code file;
identifying whether the universal code file is extracted or not according to the code packing rule;
if the universal code file does not need to be extracted, the universal code file is put into the local warehouse according to the storage dependence to form a calling code file;
if the general code file needs to be extracted, extracting the general code file by using a code file extraction tool to obtain an extracted code file, and transferring the extracted code file to the local warehouse according to the storage dependence to form a calling code file.
8. A front-end code packing apparatus, the apparatus comprising:
the classification module is used for acquiring a front-end code, and performing service logic classification on the front-end code to obtain a service code and a calling code;
the configuration module is used for identifying the file lengths of the service codes and the calling codes and configuring code division points of the service codes and the calling codes according to the file lengths of the service codes and the calling codes;
the packaging module is used for carrying out file packaging on the service codes by using a preset code packaging tool according to the code division points of the service codes to generate service code files;
the packaging module is further used for introducing generalization processing to the calling code to generate a universal introduced code, and performing file packaging to the universal introduced code by using the code packaging tool according to a preset code packaging rule and a code segmentation value of the calling code to generate a universal code file.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the front-end code packing method of any of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, implements the front-end code packing method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011478743.1A CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011478743.1A CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112486490A true CN112486490A (en) | 2021-03-12 |
CN112486490B CN112486490B (en) | 2024-03-19 |
Family
ID=74917939
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011478743.1A Active CN112486490B (en) | 2020-12-15 | 2020-12-15 | Front-end code packaging method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112486490B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113032003A (en) * | 2021-04-08 | 2021-06-25 | 平安国际智慧城市科技股份有限公司 | Development file export method and device, electronic equipment and computer storage medium |
CN113377376A (en) * | 2021-06-09 | 2021-09-10 | 中国工商银行股份有限公司 | Data packet generation method, data packet generation device, electronic device, and storage medium |
CN113608746A (en) * | 2021-08-16 | 2021-11-05 | 北京字节跳动网络技术有限公司 | Code conversion processing method and device, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
US20190310835A1 (en) * | 2017-03-28 | 2019-10-10 | Tencent Technology (Shenzhen) Company Limited | Application development method, tool, and device, and storage medium |
CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
CN111459497A (en) * | 2020-04-10 | 2020-07-28 | 深圳市盟天科技有限公司 | WebPack-based resource package compiling method, system, server and storage medium |
CN111552640A (en) * | 2020-04-24 | 2020-08-18 | 北京字节跳动网络技术有限公司 | Code detection method, device, equipment and storage medium |
-
2020
- 2020-12-15 CN CN202011478743.1A patent/CN112486490B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103135976A (en) * | 2011-11-30 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Code automatic generation method and device |
US20190310835A1 (en) * | 2017-03-28 | 2019-10-10 | Tencent Technology (Shenzhen) Company Limited | Application development method, tool, and device, and storage medium |
CN110825369A (en) * | 2019-11-07 | 2020-02-21 | 四川长虹电器股份有限公司 | Method for automatically generating codes based on java language |
CN111459497A (en) * | 2020-04-10 | 2020-07-28 | 深圳市盟天科技有限公司 | WebPack-based resource package compiling method, system, server and storage medium |
CN111552640A (en) * | 2020-04-24 | 2020-08-18 | 北京字节跳动网络技术有限公司 | Code detection method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
菜鸟学院: "Webpack:代码分割", pages 1 - 6, Retrieved from the Internet <URL:http://www.noobyard.com/article/p-gelqzvmr-kt.html> * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113032003A (en) * | 2021-04-08 | 2021-06-25 | 平安国际智慧城市科技股份有限公司 | Development file export method and device, electronic equipment and computer storage medium |
CN113032003B (en) * | 2021-04-08 | 2024-04-02 | 深圳赛安特技术服务有限公司 | Development file export method, development file export device, electronic equipment and computer storage medium |
CN113377376A (en) * | 2021-06-09 | 2021-09-10 | 中国工商银行股份有限公司 | Data packet generation method, data packet generation device, electronic device, and storage medium |
CN113608746A (en) * | 2021-08-16 | 2021-11-05 | 北京字节跳动网络技术有限公司 | Code conversion processing method and device, computer equipment and storage medium |
CN113608746B (en) * | 2021-08-16 | 2023-10-27 | 北京字节跳动网络技术有限公司 | Code conversion processing method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112486490B (en) | 2024-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112486490B (en) | Front-end code packaging method and device, electronic equipment and storage medium | |
CN111428451B (en) | Text online editing method and device, electronic equipment and storage medium | |
CN112506779A (en) | Software interface testing method and device, electronic equipment and storage medium | |
CN113239106A (en) | Excel file export method and device, electronic equipment and storage medium | |
CN113377661A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN112528307A (en) | Service request checking method and device, electronic equipment and storage medium | |
CN112650909A (en) | Product display method and device, electronic equipment and storage medium | |
CN113032275A (en) | Method and device for testing field, electronic equipment and storage medium | |
CN113297180A (en) | Data migration method and device, electronic equipment and storage medium | |
CN115048111B (en) | Code generation method, device, equipment and medium based on metadata | |
CN114398282A (en) | Test script generation method, device, equipment and storage medium | |
CN113434542A (en) | Data relation identification method and device, electronic equipment and storage medium | |
CN112579475A (en) | Code testing method, device, equipment and readable storage medium | |
CN111625236A (en) | Front-end development method and device based on componentization, electronic equipment and storage medium | |
CN112667244A (en) | Data verification method and device, electronic equipment and computer readable storage medium | |
CN112214256A (en) | Operation control method and device for machine learning, electronic equipment and storage medium | |
CN113485711A (en) | Task triggering method and device based on dependency relationship, electronic equipment and medium | |
CN114942855A (en) | Interface calling method and device, electronic equipment and storage medium | |
CN114625376A (en) | Data transfer mode conversion method and device, electronic equipment and readable storage medium | |
CN114911479A (en) | Interface generation method, device, equipment and storage medium based on configuration | |
CN114185522A (en) | Page theme customizing method and device, electronic equipment and storage medium | |
CN112579046A (en) | User story analysis method and device, electronic equipment and storage medium | |
CN114356379A (en) | Backup-based service upgrading method, device, equipment and storage medium | |
CN112527443A (en) | Prompt box display method and device, electronic equipment and computer readable storage medium | |
CN112637280A (en) | Data transmission method and device, electronic equipment and storage medium |
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 |