CN116339747A - JS file generation method, device, equipment and storage medium - Google Patents

JS file generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN116339747A
CN116339747A CN202310467586.1A CN202310467586A CN116339747A CN 116339747 A CN116339747 A CN 116339747A CN 202310467586 A CN202310467586 A CN 202310467586A CN 116339747 A CN116339747 A CN 116339747A
Authority
CN
China
Prior art keywords
file
dill
preset
initial
compiling
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.)
Pending
Application number
CN202310467586.1A
Other languages
Chinese (zh)
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.)
Zhengcaiyun Co ltd
Original Assignee
Zhengcaiyun Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengcaiyun Co ltd filed Critical Zhengcaiyun Co ltd
Priority to CN202310467586.1A priority Critical patent/CN116339747A/en
Publication of CN116339747A publication Critical patent/CN116339747A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a JS file generation method, a device, equipment and a storage medium, which relate to the technical field of computers and comprise the following steps: compiling the source code through a Flutter frame to obtain an initial dill file, and inserting a preset method collector into the initial dill file by using a preset abstract syntax tree compiler to obtain a modified dill file; compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and operating the initial JS file, and after the operation of the preset browser is finished, removing a to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file; and compiling the target dill file through the router framework to obtain a target JS file. Thus, the size of the obtained target JS file is greatly reduced.

Description

JS file generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a JS file.
Background
The Flutter framework may compile the code into JS code artifacts that are browser-allowable. But at this stage, the Flutter web compilation product is too large, even in the simplest demo case, the compilation product is nearly 1.4M. Therefore, how to reduce the size of the Flutter web compilation product is a problem to be solved.
Disclosure of Invention
Accordingly, the present invention is directed to a method, apparatus, device and storage medium for generating a JS file, which reduce the size of a JS file product, and further increase the access speed of a website. The specific scheme is as follows:
in a first aspect, the present application discloses a JS file generating method, including:
acquiring an initial dill file obtained after compiling source codes through a router frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file;
compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list;
after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file;
and compiling the target dill file through the router framework to obtain a target JS file.
Optionally, before the inserting, by the preset abstract syntax tree compiler, a preset method collector into the initial dill file to obtain a modified dill file, the method further includes:
defining a global container list and a method collection function to obtain the preset method collector.
Optionally, the inserting, by using a preset abstract syntax tree compiler, a preset method collector into the initial dill file to obtain a modified dill file includes:
and acquiring a preset method collector by using a preset abstract syntax tree compiler, and respectively injecting the preset method collector into all method nodes of the initial dill file to obtain a modified dill file.
Optionally, after compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, including:
and compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router framework, starting a preset browser and running the initial JS file by using a UI automation script.
Optionally, after the operation of the preset browser is finished, performing a rejection process on a to-be-rejected method function determined based on the preset method function list in the initial dill file to obtain a target dill file, where the rejection process includes:
after the operation of the preset browser is finished, the initial dill file is obtained by using the preset abstract syntax tree compiler, and method functions which are not contained in the method function list in the initial dill file are removed based on the method function list so as to obtain a target dill file.
In a second aspect, the present application discloses a JS file generating device, including:
the method comprises a method function insertion module, a method function generation module and a method function generation module, wherein the method function insertion module is used for acquiring an initial dill file obtained by compiling source codes through a router frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file;
the file running module is used for starting a preset browser and running the initial JS file through a preset automation script after compiling the modified dill file into the initial JS file through the router frame, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list;
the function rejection module is used for rejecting the to-be-rejected method function determined based on the preset method function list in the initial dill file after the operation of the preset browser is finished so as to obtain a target dill file;
and the file compiling module is used for compiling the target dill file through the router framework to obtain a target JS file.
Optionally, the file running module includes:
and the file compiling and running unit is used for compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router frame, starting a preset browser and running the initial JS file by utilizing a UI (user interface) automation script.
Optionally, the function rejection module includes:
and the function rejecting unit is used for acquiring the initial dill file by using the preset abstract syntax tree compiler after the operation of the preset browser is finished, and rejecting the method functions which are not included in the method function list in the initial dill file based on the method function list so as to obtain a target dill file.
In a third aspect, the present application discloses an electronic device comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the JS file generation method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program, where the computer program when executed by a processor implements the foregoing JS file generating method.
In the application, an initial dill file obtained after compiling source codes through a router frame is obtained, and a preset abstract syntax tree compiler is utilized to insert a preset method collector into the initial dill file so as to obtain a modified dill file; compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list; after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file; and compiling the target dill file through the router framework to obtain a target JS file. It can be seen that, the method functions used in the initial JS file running process are collected through the inserted preset method collector and stored in the preset method function list, then the unused method functions in the initial dill file are removed correspondingly according to the preset method function list to obtain the target dill file, and the target JS file can be obtained according to the target dill file. Therefore, codes which are not used in the running process of the Flutter web compiling product can be removed according to the actual running scene, the size of the JS file can be greatly reduced, the codes do not need to be manually removed in the whole process, unused method functions can be automatically collected by running the initial dill file through a preset browser after the initial dill file is obtained, and then the method functions are removed, so that the labor cost is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a JS file generating method disclosed in the present application;
FIG. 2 is a flowchart of a specific JS file generation method disclosed in the present application;
fig. 3 is a schematic structural diagram of a JS file generating device disclosed in the present application;
fig. 4 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
At this stage, the Flutter web compilation product is too large, even in the simplest demo case, the compilation product is nearly 1.4M. While the compiler can only delete dead codes when performing static compiling, the invention introduces a method for removing the dead codes according to scenes.
Referring to fig. 1, an embodiment of the present application discloses a JS file generating method, including:
step S11: and obtaining an initial dill file obtained after compiling the source code through the Flutter frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file.
In this embodiment, before the inserting, by the preset abstract syntax tree compiler, the preset method collector into the initial dill file to obtain the modified dill file, the method further includes: defining a global container list and a method collection function to obtain the preset method collector. I.e. a global Container can be defined, the Container name in the present invention is Container, and a method of inserting a method name into the Container list is also disclosed, the method name in the present invention is: a methodCollector. The inserting a preset method collector into the initial dill file by using a preset abstract syntax tree compiler to obtain a modified dill file includes: and acquiring a preset method collector by using a preset abstract syntax tree compiler, and respectively injecting the preset method collector into all method nodes of the initial dill file to obtain a modified dill file. After an initial dill file obtained by compiling source codes through a router framework is obtained, a node of a method selector is obtained by utilizing a preset abstract syntax tree (Abstract Syntax Tree, AST) compiler, and then the method selector node is injected into each method node in the initial dill file to obtain a modified dill file.
Step S12: after compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list.
In this embodiment, after compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, including: and compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router framework, starting a preset browser and running the initial JS file by using a UI automation script. After the initial JS file is obtained, the modified dill file is compiled by utilizing a preset dart2JS compiler in the router framework to obtain the initial JS file. And then starting a browser and running the JS file through a UI automation script so as to collect the method functions used in the initial JS file running process by using the preset method collector and store the method functions into a preset method function list.
Step S13: and after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file.
In this embodiment, after the operation of the preset browser is finished, performing a rejection process on a to-be-rejected method function determined based on the preset method function list in the initial dill file to obtain a target dill file, including: after the operation of the preset browser is finished, the initial dill file is obtained by using the preset abstract syntax tree compiler, and method functions which are not contained in the method function list in the initial dill file are removed based on the method function list so as to obtain a target dill file. And returning to the preset method function list after the preset browser runs. And then acquiring the initial dill file by using the preset abstract syntax tree compiler, and eliminating the method functions which are not included in the method function list in the initial dill file to obtain a target dill file.
Step S14: and compiling the target dill file through the router framework to obtain a target JS file.
In this embodiment, the target dill file is compiled by a preset dart2JS compiler in the router framework, so as to obtain a target JS file.
It can be seen that, in this embodiment, an initial dill file obtained after compiling source codes through a router frame is first obtained, and a preset abstract syntax tree compiler is used to insert a preset method collector into the initial dill file to obtain a modified dill file; compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list; after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file; and compiling the target dill file through the router framework to obtain a target JS file. It can be seen that, the method functions used in the initial JS file running process are collected through the inserted preset method collector and stored in the preset method function list, then the unused method functions in the initial dill file are removed correspondingly according to the preset method function list to obtain the target dill file, and the target JS file can be obtained according to the target dill file. Therefore, codes which are not used in the running process of the Flutter web compiling product can be removed according to the actual running scene, the size of the JS file can be greatly reduced, the codes do not need to be manually removed in the whole process, unused method functions can be automatically collected by running the initial dill file through a preset browser after the initial dill file is obtained, and then the method functions are removed, so that the labor cost is reduced.
Referring to fig. 2, the JS file generating method disclosed in the present application specifically includes: creating a method collector: defining a global Container name as Container, and a method of inserting a method name into the Container list, we define the method name as: a methodCollector. And at the same time, the method is called in the main method of the service code. And obtaining a bill file obtained by compiling the source code, obtaining the node of the method dcollector through converting the bill file into an AST script, and simultaneously injecting the node of the method dcollector into all method nodes in the bill file to generate a new bill file. And compiling the dill file into a JS file by a dart2JS compiler, starting a browser, and running the JS file by a UI automation script. And when the browser runs, returning to the running method list collected by the method collector, and reprocessing the dill file through converting the dill file into an AST script, and rejecting the methods which are not contained in the effective method list to generate a new dill file. And finally compiling the new dill file into a JS file as a final product.
As described with reference to fig. 3, the embodiment of the present application further correspondingly discloses a JS file generating device, including:
the method function inserting module 11 is used for obtaining an initial dill file obtained after compiling source codes through a router frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file;
the file running module 12 is configured to, after compiling the modified dill file into an initial JS file by using the router framework, start a preset browser and run the initial JS file by using a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list;
the function rejection module 13 is configured to reject the to-be-rejected method function determined based on the preset method function list in the initial dill file after the operation of the preset browser is finished, so as to obtain a target dill file;
and the file compiling module 14 is configured to compile the target dill file through the router framework to obtain a target JS file.
It can be seen that, in this embodiment, an initial dill file obtained after compiling source codes through a router frame is first obtained, and a preset abstract syntax tree compiler is used to insert a preset method collector into the initial dill file to obtain a modified dill file; compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list; after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file; and compiling the target dill file through the router framework to obtain a target JS file. It can be seen that, the method functions used in the initial JS file running process are collected through the inserted preset method collector and stored in the preset method function list, then the unused method functions in the initial dill file are removed correspondingly according to the preset method function list to obtain the target dill file, and the target JS file can be obtained according to the target dill file. Therefore, codes which are not used in the running process of the Flutter web compiling product can be removed according to the actual running scene, the size of the JS file can be greatly reduced, the codes do not need to be manually removed in the whole process, unused method functions can be automatically collected by running the initial dill file through a preset browser after the initial dill file is obtained, and then the method functions are removed, so that the labor cost is reduced.
In some specific embodiments, the JS file generating device may specifically further include:
and the method collector generating module is used for defining a global container list and a method collecting function to obtain the preset method collector.
In some specific embodiments, the method function inserting module 11 may specifically be configured to obtain a preset method collector by using a preset abstract syntax tree compiler, and inject the preset method collector into all method nodes of the initial dill file respectively to obtain a modified dill file.
In some specific embodiments, the file running module 12 may specifically include:
and the file compiling and running unit is used for compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router frame, starting a preset browser and running the initial JS file by utilizing a UI (user interface) automation script.
In some specific embodiments, the function rejection module 13 may specifically include:
and the function rejecting unit is used for acquiring the initial dill file by using the preset abstract syntax tree compiler after the operation of the preset browser is finished, and rejecting the method functions which are not included in the method function list in the initial dill file based on the method function list so as to obtain a target dill file.
Further, the embodiment of the present application further discloses an electronic device, and fig. 4 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 4 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement relevant steps in the JS file generation method disclosed in any one of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the JS file generation method disclosed by any of the preceding embodiments that is executed by the electronic device 20.
Further, the application also discloses a computer readable storage medium for storing a computer program; the above-mentioned computer program, when executed by the processor, implements the above-mentioned disclosed JS file generation method. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing has outlined the detailed description of the preferred embodiment of the present application, and the detailed description of the principles and embodiments of the present application has been provided herein by way of example only to facilitate the understanding of the method and core concepts of the present application; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. A JS file generation method, characterized by comprising:
acquiring an initial dill file obtained after compiling source codes through a router frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file;
compiling the modified dill file into an initial JS file through the router framework, starting a preset browser and running the initial JS file through a preset automation script, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list;
after the operation of the preset browser is finished, removing the to-be-removed method function determined based on the preset method function list in the initial dill file to obtain a target dill file;
and compiling the target dill file through the router framework to obtain a target JS file.
2. The JS file generation method of claim 1, wherein before inserting a preset method collector into the initial dill file to obtain a modified dill file using a preset abstract syntax tree compiler, further comprises:
defining a global container list and a method collection function to obtain the preset method collector.
3. The JS file generation method of claim 2, wherein inserting a preset method collector into the initial dill file using a preset abstract syntax tree compiler to obtain a modified dill file, includes:
and acquiring a preset method collector by using a preset abstract syntax tree compiler, and respectively injecting the preset method collector into all method nodes of the initial dill file to obtain a modified dill file.
4. The JS file generation method of claim 1, wherein after compiling the modified dill file into an initial JS file by the router framework, starting a preset browser and running the initial JS file by a preset automation script, comprising:
and compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router framework, starting a preset browser and running the initial JS file by using a UI automation script.
5. The JS file generation method of any of claims 1 to 4, characterized in that, after the preset browser is running, the method function to be culled determined based on the preset method function list in the initial dill file is culled to obtain a target dill file, which includes:
after the operation of the preset browser is finished, the initial dill file is obtained by using the preset abstract syntax tree compiler, and method functions which are not contained in the method function list in the initial dill file are removed based on the method function list so as to obtain a target dill file.
6. A JS file generating apparatus, characterized by comprising:
the method comprises a method function insertion module, a method function generation module and a method function generation module, wherein the method function insertion module is used for acquiring an initial dill file obtained by compiling source codes through a router frame, and inserting a preset method collector into the initial dill file by utilizing a preset abstract syntax tree compiler to obtain a modified dill file;
the file running module is used for starting a preset browser and running the initial JS file through a preset automation script after compiling the modified dill file into the initial JS file through the router frame, so that the preset method collector collects method functions used in the running process of the initial JS file and stores the method functions into a preset method function list;
the function rejection module is used for rejecting the to-be-rejected method function determined based on the preset method function list in the initial dill file after the operation of the preset browser is finished so as to obtain a target dill file;
and the file compiling module is used for compiling the target dill file through the router framework to obtain a target JS file.
7. The JS file generation device of claim 6, wherein the file running module includes:
and the file compiling and running unit is used for compiling the modified dill file into an initial JS file through a preset dart2JS compiler in the router frame, starting a preset browser and running the initial JS file by utilizing a UI (user interface) automation script.
8. The JS file generation device of claim 6, wherein the function culling module includes:
and the function rejecting unit is used for acquiring the initial dill file by using the preset abstract syntax tree compiler after the operation of the preset browser is finished, and rejecting the method functions which are not included in the method function list in the initial dill file based on the method function list so as to obtain a target dill file.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor configured to execute the computer program to implement the JS file generation method as set forth in any one of claims 1 to 5.
10. A computer-readable storage medium storing a computer program which, when executed by a processor, implements the JS file generation method as set forth in any one of claims 1 to 5.
CN202310467586.1A 2023-04-25 2023-04-25 JS file generation method, device, equipment and storage medium Pending CN116339747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310467586.1A CN116339747A (en) 2023-04-25 2023-04-25 JS file generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310467586.1A CN116339747A (en) 2023-04-25 2023-04-25 JS file generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116339747A true CN116339747A (en) 2023-06-27

Family

ID=86876117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310467586.1A Pending CN116339747A (en) 2023-04-25 2023-04-25 JS file generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116339747A (en)

Similar Documents

Publication Publication Date Title
CN108279932B (en) Method and device for dynamically configuring user interface of mobile terminal
US8869111B2 (en) Method and system for generating test cases for a software application
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
CN113238740B (en) Code generation method, code generation device, storage medium and electronic device
CN113326030A (en) Service request processing method and device
CN113568604B (en) Method and device for updating wind control strategy and computer readable storage medium
CN105573836A (en) Data processing method and device
CN110989992A (en) Resource processing method and device
CN106484488B (en) Integrated cloud Compilation Method and system
CN111832273A (en) Method and device for determining destination message, storage medium and electronic device
CN116339747A (en) JS file generation method, device, equipment and storage medium
CN117032668A (en) Processing method, device, system and platform of visual rule engine
CN111381935A (en) DSL configuration expression-based function implementation method and system
CN116185391A (en) Application programming interface generation method, device, equipment and storage medium
CN116541278A (en) Unit test case generation method, device, equipment and storage medium
CN110806973A (en) Automatic generation method and device of interface message
CN115016782A (en) vue component generation method and device
CN115373731A (en) Public code resource sharing method, device, equipment and storage medium
CN112905467A (en) Test case execution management method, device, equipment and storage medium
CN110334024B (en) Test case management method, device and terminal based on tree structure
CN113687852A (en) Automatic generation method and device for log collection configuration file
CN114860566A (en) Source code testing method and device, electronic equipment and storage medium
CN112965694A (en) Data processing method, device, equipment and storage medium
CN113641352B (en) Method and system for automatically generating SNMP (simple network management protocol) codes
CN112000414B (en) Configurable display method and device for parameter information

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