CN109062577A - A kind of front end script is split and destructing optimization method and system - Google Patents

A kind of front end script is split and destructing optimization method and system Download PDF

Info

Publication number
CN109062577A
CN109062577A CN201811035167.6A CN201811035167A CN109062577A CN 109062577 A CN109062577 A CN 109062577A CN 201811035167 A CN201811035167 A CN 201811035167A CN 109062577 A CN109062577 A CN 109062577A
Authority
CN
China
Prior art keywords
script
code
service
subservice
service resources
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
CN201811035167.6A
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.)
Fujian Star Software Co Ltd
Original Assignee
Fujian Star Software 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 Fujian Star Software Co Ltd filed Critical Fujian Star Software Co Ltd
Priority to CN201811035167.6A priority Critical patent/CN109062577A/en
Publication of CN109062577A publication Critical patent/CN109062577A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation

Abstract

The present invention provides a kind of front end script and splits and destructing optimization method, comprising: individually splits out general skeleton code from service resources script, makes all service resources scripts unified using the split skeleton code branched away;Destructing processing is carried out to service resources script, each subservice code is split into independent script file, goes to request corresponding script file again when user enters specific business, and execute corresponding subservice code.It is split the present invention also provides a kind of front end script and deconstructs optimization system, be a set of for the excessive front end engineering prioritization scheme with service resources script load bottleneck problem of Javascript service resources script volume.

Description

A kind of front end script is split and destructing optimization method and system
Technical field
The present invention relates to communication technique fields more particularly to a kind of front end script to split and destructing optimization method and system.
Background technique
To front end Javascript, (a kind of literal translation formula scripting language is a kind of regime type, weak type, based on prototype Language, built-in support type) code is when being packaged, it will usually skeleton code and service code are packaged into service resources foot Originally be stored in the same resource file, in the service resources script after each packing can containing a skeleton code, therefore The multipage of package deal complexity is led in application, the volume that duplicate skeleton code will cause resource file in multiple business increases It causes to require to download duplicate skeleton code when request resource file every time.On the other hand, it is usually contained under a service code Multiple subservice codes, and with the continuous expansion of business, more and more subservice codes will also result in service resources file Constantly increase, bottleneck occur in the reading and load for influencing service resources script.
Summary of the invention
One of the technical problem to be solved in the present invention, be to provide a kind of front end script split with destructing optimization method, be It is a set of to be engineered for the excessive front end with service resources script load bottleneck problem of Javascript service resources script volume Prioritization scheme.
One of problem of the invention is achieved in that
A kind of front end script is split and destructing optimization method, comprising:
General skeleton code is individually splitted out from service resources script, all service resources scripts is allowed uniformly to make With the split skeleton code branched away;
Destructing processing is carried out to service resources script, each subservice code is split into independent script file, when User goes to request corresponding script file again when entering specific business, and executes corresponding subservice code.
Further, described individually to split out general skeleton code, allow all service resources scripts are unified to use The split skeleton code branched away, specifically:
A front end projects are created, service code and skeleton code are programmed into the projects of front end, complete industry The coding for logic of being engaged in reuses engineering tool and carries out the skeleton code write and service code to be packaged a business of generation Resource script extracts all during coding is built into service resources script from the service resources script of generation Common skeleton code configures a unique identifier for each skeleton code, then by these common frame generations Code is bundled in an independent framework resources script;
When constructing other front end projects, service code is write in the projects of front end, and use engineering chemical industry The service code write is carried out a service resources script of packing generation and first passed through when executing service resources script by tool Identifier directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads service resources foot Service code in this, to complete the operation of the front end projects.
Further, described that destructing processing is carried out to service resources script, each subservice code is split into independence Script file, go to request corresponding script file again when user enters specific business, and execute corresponding subservice generation Code, specifically:
It, will be all under service code in the service resources script during coding is built into service resources script Subservice code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted The subservice code come is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will not The identifier record of mapping relations and each subservice code between same subservice code gets off and saves into a number According to dictionary file;
When some specific business of client executing, go in data dictionary file to search the relevant subservice code of the business Identifier and mapping relations, and gone under server-side requested service resource script as filename according to identifier with mapping relations Script file, load and execute corresponding subservice code.
The second technical problem to be solved by the present invention, be to provide a kind of front end script split with destructing optimization system, be It is a set of to be engineered for the excessive front end with service resources script load bottleneck problem of Javascript service resources script volume Optimization system.
The two of problem of the invention, are achieved in that
A kind of front end script split with destructing optimization system, including script splits module and script deconstructs module;
The script splits module and allows for individually splitting out general skeleton code from service resources script All service resources scripts are unified to use the split skeleton code branched away;
The script destructing module tears each subservice code open for carrying out destructing processing to service resources script It is divided into independent script file, goes to request corresponding script file again when user enters specific business, and execute corresponding Subservice code.
Further, the script splits module specifically:
A front end projects are created, service code and skeleton code are programmed into the projects of front end, complete industry The coding for logic of being engaged in reuses engineering tool and carries out the skeleton code write and service code to be packaged a business of generation Resource script extracts all during coding is built into service resources script from the service resources script of generation Common skeleton code configures a unique identifier for each skeleton code, then by these common frame generations Code is bundled in an independent framework resources script;
When constructing other front end projects, service code is write in the projects of front end, and use engineering chemical industry The service code write is carried out a service resources script of packing generation and first passed through when executing service resources script by tool Identifier directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads service resources foot Service code in this, to complete the operation of the front end projects.
Further, the script deconstructs module specifically:
It, will be all under service code in the service resources script during coding is built into service resources script Subservice code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted The subservice code come is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will not The identifier record of mapping relations and each subservice code between same subservice code gets off and saves into a number According to dictionary file;
When some specific business of client executing, go in data dictionary file to search the relevant subservice code of the business Identifier and mapping relations, and gone under server-side requested service resource script as filename according to identifier with mapping relations Script file, load and execute corresponding subservice code.
The present invention has the advantages that
1. the packing of couple Javascript is transformed, the fractionation of skeleton code and service code is carried out, it is possible to reduce business The volume of resource script, the Cache Framework code when client request loads service resources script, avoids same skeleton code The repeated downloads in each business;
2. pair service code carries out destructing optimization, the volume of single service resources script is reduced, and allows client at runtime Corresponding subservice code under delay loading service resources script is removed at end as required, solves the load bottle of service resources script Neck.
Detailed description of the invention
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is the execution flow chart that a kind of front end script of the present invention splits and deconstructs optimization method.
Fig. 2 is the structural schematic diagram that a kind of front end script of the present invention splits and deconstructs optimization system.
Specific embodiment
To be clearer and more comprehensible the present invention, now with a preferred embodiment, and attached drawing is cooperated to be described in detail below.
As shown in Figure 1, a kind of front end script of the invention is split and destructing optimization method, comprising:
1, it is directed to service resources script volume problems of too: general skeleton code is individually torn open from service resources script It branches away, allows all service resources scripts are unified to use the split skeleton code branched away, specifically:
The front end a Javascript projects are created, service code and frame generation are programmed into the projects of front end Code (introducing skeleton code in the entry file of front end projects), the coding of finishing service logic reuse engineering chemical industry The skeleton code and service code that write be packaged by tool generates a service resources script, and coding is being built into business During resource script, all common skeleton codes are extracted from the service resources script of generation, are each frame Code all configures a unique identifier, these common skeleton codes are then bundled to an independent framework resources foot In this, to be used in other front end projects, principle be exactly in multiple service resources scripts to common frame generation The dependence of code is all defined as a new independent framework resources script, when service resources script needs to use existing frame generation When code, the skeleton code in framework resources script is called directly, can thus accomplish all service resources scripts to identical Skeleton code unified use;The principle of extraction be for each skeleton code configure an exclusive identifier, that is, It says for the same skeleton code, even if being cited in different service resources scripts, its identifier is also the same, institute To be only packaged a framework resources script during constructing front end projects, no longer imported newly in service resources script Skeleton code, but by identifier directly from framework resources script reference skeleton code;
When constructing other front end projects, service code is write in the projects of front end, and use engineering chemical industry The service code write is carried out a service resources script of packing generation and first passed through when executing service resources script by tool Identifier directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads service resources foot Service code in this, to complete the operation of the front end projects.In this way in multiple business scenarios, avoid multiple Repeat in service resources script with a skeleton code, reduce the volume of service resources script, while by framework resources Script is buffered in client, and such client only needs to load the service code in service resources script, reduce from server-side Request the number of framework resources script (skeleton code).
2, bottleneck problem is loaded for service resources script: destructing processing is carried out to service resources script, by every sub- industry Business code all splits into independent script file, goes to request corresponding script file again when user enters specific business, and hold The corresponding subservice code of row, specifically:
It, will be all under service code in the service resources script during coding is built into service resources script Subservice code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted The subservice code come is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will not The identifier record of mapping relations and each subservice code between same subservice code gets off and saves into a number According to dictionary file, the reference to the data dictionary file is added in the entrance of service resources script;
When some specific business of client executing, go in data dictionary file to search the relevant subservice code of the business Identifier and mapping relations, the effect for inquiring mapping relations is exactly the dependence recorded between subservice, avoids missing son Business, and the script file under server-side requested service resource script as filename is gone with mapping relations according to identifier, add It carries and executes corresponding subservice code.
As shown in Fig. 2, a kind of front end script of the invention, which is split, splits module and foot with destructing optimization system, including script This destructing module;
It is for service resources script volume problems of too that the script, which splits module: for by general skeleton code from It is individually splitted out in service resources script, makes all service resources scripts unified using the split skeleton code branched away, tool Body are as follows:
The front end a Javascript projects are created, service code and frame generation are programmed into the projects of front end Code (introducing skeleton code in the entry file of front end projects), the coding of finishing service logic reuse engineering chemical industry The skeleton code and service code that write be packaged by tool generates a service resources script, and coding is being built into business During resource script, all common skeleton codes are extracted from the service resources script of generation, are each frame Code all configures a unique identifier, these common skeleton codes are then bundled to an independent framework resources foot In this, to be used in other front end projects, principle be exactly in multiple service resources scripts to common frame generation The dependence of code is all defined as a new independent framework resources script, when service resources script needs to use existing frame generation When code, the skeleton code in framework resources script is called directly, can thus accomplish all service resources scripts to identical Skeleton code unified use;The principle of extraction be for each skeleton code configure an exclusive identifier, that is, It says for the same skeleton code, even if being cited in different service resources scripts, its identifier is also the same, institute To be only packaged a framework resources script during constructing front end projects, no longer imported newly in service resources script Skeleton code, but by identifier directly from framework resources script reference skeleton code;
When constructing other front end projects, service code is write in the projects of front end, and use engineering chemical industry The service code write is carried out a service resources script of packing generation and first passed through when executing service resources script by tool Identifier directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads service resources foot Service code in this, to complete the operation of the front end projects.In this way in multiple business scenarios, avoid multiple Repeat in service resources script with a skeleton code, reduce the volume of service resources script, while by framework resources Script is buffered in client, and such client only needs to load the service code in service resources script, reduce from server-side Request the number of framework resources script (skeleton code).
The script destructing module is to load bottleneck problem for service resources script: for carrying out to service resources script Destructing processing, splits into independent script file for each subservice code, goes to request again when user enters specific business Corresponding script file, and corresponding subservice code is executed, specifically:
It, will be all under service code in the service resources script during coding is built into service resources script Subservice code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted The subservice code come is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will not The identifier record of mapping relations and each subservice code between same subservice code gets off and saves into a number According to dictionary file, the reference to the data dictionary file is added in the entrance of service resources script;
When some specific business of client executing, go in data dictionary file to search the relevant subservice code of the business Identifier and mapping relations, the effect for inquiring mapping relations is exactly the dependence recorded between subservice, avoids missing son Business, and the script file under server-side requested service resource script as filename is gone with mapping relations according to identifier, add It carries and executes corresponding subservice code., for carrying out destructing processing to service resources script, each subservice code is split It at independent script file, goes to request corresponding script file again when user enters specific business, and executes corresponding son Service code.
Advantages of the present invention is as follows:
1, the packing of Javascript is transformed, carries out the fractionation of skeleton code and service code, it is possible to reduce business The volume of resource script, the Cache Framework code when client request loads service resources script, avoids same skeleton code The repeated downloads in each business;
2, destructing optimization is carried out to service code, reduces the volume of single service resources script, and allow client at runtime Corresponding subservice code under delay loading service resources script is removed at end as required, solves the load bottle of service resources script Neck.
Although specific embodiments of the present invention have been described above, those familiar with the art should be managed Solution, we are merely exemplary described specific embodiment, rather than for the restriction to the scope of the present invention, it is familiar with this The technical staff in field should be covered of the invention according to modification and variation equivalent made by spirit of the invention In scope of the claimed protection.

Claims (6)

1. a kind of front end script is split and destructing optimization method, it is characterised in that: include:
General skeleton code is individually splitted out from service resources script, all service resources scripts is allowed uniformly to use quilt The skeleton code splitted out;
Destructing processing is carried out to service resources script, each subservice code is split into independent script file, works as user It goes to request corresponding script file again when into specific business, and executes corresponding subservice code.
2. a kind of front end script as described in claim 1 is split and destructing optimization method, it is characterised in that: it is described will be general Skeleton code individually splits out, and allows all service resources scripts are unified to use the split skeleton code branched away, specifically:
A front end projects are created, service code and skeleton code are programmed into the projects of front end, finishing service is patrolled The coding collected reuses engineering tool and carries out the skeleton code write and service code to be packaged a service resources of generation Script extracts all public during coding is built into service resources script from the service resources script of generation Skeleton code, for each skeleton code configure a unique identifier, then these common skeleton codes are beaten It wraps into an independent framework resources script;
When constructing other front end projects, service code is write in the projects of front end, and use engineering tool will The service code write carries out a service resources script of packing generation and first passes through mark when executing service resources script Symbol directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads in service resources script Service code, to complete the operation of the front end projects.
3. a kind of front end script as described in claim 1 is split and destructing optimization method, it is characterised in that: described to be provided to business Source script carries out destructing processing, and each subservice code is split into independent script file, when user enters specific business When go to request corresponding script file again, and execute corresponding subservice code, specifically:
During coding is built into service resources script, by sub- industry all under service code in the service resources script Business code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted Subservice code is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will be different The identifier record of mapping relations and each subservice code between subservice code gets off and saves into one data word Allusion quotation file;
When some specific business of client executing, go in data dictionary file to search the mark of the relevant subservice code of the business Know symbol and mapping relations, and removes with mapping relations the foot under server-side requested service resource script as filename according to identifier This document loads and executes corresponding subservice code.
4. a kind of front end script is split and destructing optimization system, it is characterised in that: split module including script and script deconstructs mould Block;
The script splits module and allows all for individually splitting out general skeleton code from service resources script Service resources script is unified to use the split skeleton code branched away;
The script destructing module splits into each subservice code for carrying out destructing processing to service resources script Independent script file goes to request corresponding script file again, and executes corresponding sub- industry when user enters specific business Business code.
5. a kind of front end script as claimed in claim 4 is split and destructing optimization system, it is characterised in that: the script is split Module specifically:
A front end projects are created, service code and skeleton code are programmed into the projects of front end, finishing service is patrolled The coding collected reuses engineering tool and carries out the skeleton code write and service code to be packaged a service resources of generation Script extracts all public during coding is built into service resources script from the service resources script of generation Skeleton code, for each skeleton code configure a unique identifier, then these common skeleton codes are beaten It wraps into an independent framework resources script;
When constructing other front end projects, service code is write in the projects of front end, and use engineering tool will The service code write carries out a service resources script of packing generation and first passes through mark when executing service resources script Symbol directly quotes corresponding skeleton code from framework resources script and is loaded and cached, and then loads in service resources script Service code, to complete the operation of the front end projects.
6. a kind of front end script as claimed in claim 4 is split and destructing optimization system, it is characterised in that: the script destructing Module specifically:
During coding is built into service resources script, by sub- industry all under service code in the service resources script Business code individually extracts, and is one unique identifier of each subservice code configuration, is each extracted Subservice code is all packaged into an independent script file, and filename is exactly the identifier of subservice code, will be different The identifier record of mapping relations and each subservice code between subservice code gets off and saves into one data word Allusion quotation file;
When some specific business of client executing, go in data dictionary file to search the mark of the relevant subservice code of the business Know symbol and mapping relations, and removes with mapping relations the foot under server-side requested service resource script as filename according to identifier This document loads and executes corresponding subservice code.
CN201811035167.6A 2018-09-06 2018-09-06 A kind of front end script is split and destructing optimization method and system Pending CN109062577A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811035167.6A CN109062577A (en) 2018-09-06 2018-09-06 A kind of front end script is split and destructing optimization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811035167.6A CN109062577A (en) 2018-09-06 2018-09-06 A kind of front end script is split and destructing optimization method and system

Publications (1)

Publication Number Publication Date
CN109062577A true CN109062577A (en) 2018-12-21

Family

ID=64759822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811035167.6A Pending CN109062577A (en) 2018-09-06 2018-09-06 A kind of front end script is split and destructing optimization method and system

Country Status (1)

Country Link
CN (1) CN109062577A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857375A (en) * 2018-12-25 2019-06-07 上海尼好系统集成有限公司 A kind of front end development system of matching rear end exploitation test
CN110244955A (en) * 2019-05-29 2019-09-17 广州至真信息科技有限公司 A kind of processing method of application, device, server and medium
CN113468125A (en) * 2021-09-03 2021-10-01 深圳市信润富联数字科技有限公司 File service method, system, equipment and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153493A1 (en) * 2003-08-07 2010-06-17 Teamon Systems, Inc. Communications system providing extensible protocol translation and configuration features and related methods
CN106570071A (en) * 2016-10-14 2017-04-19 上海斐讯数据通信技术有限公司 Method and system for loading front end page of cloud access controller
CN106843869A (en) * 2017-01-16 2017-06-13 百融(北京)金融信息服务股份有限公司 A kind of front end Development Engineering system and method
CN108132809A (en) * 2017-11-29 2018-06-08 五八有限公司 Method, apparatus, terminal and the storage medium of loading

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153493A1 (en) * 2003-08-07 2010-06-17 Teamon Systems, Inc. Communications system providing extensible protocol translation and configuration features and related methods
CN106570071A (en) * 2016-10-14 2017-04-19 上海斐讯数据通信技术有限公司 Method and system for loading front end page of cloud access controller
CN106843869A (en) * 2017-01-16 2017-06-13 百融(北京)金融信息服务股份有限公司 A kind of front end Development Engineering system and method
CN108132809A (en) * 2017-11-29 2018-06-08 五八有限公司 Method, apparatus, terminal and the storage medium of loading

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
BTFRANKENSTEIN: "webpack中的代码分割", 《HTTPS://WWW.JIANSHU.COM/P/C42A817DC8CF》 *
即刻出发_: "webpack 代码拆分", 《HTTPS://SEGMENTFAULT.COM/A/1190000007649417?UTM_SOURCE=WEEKLY&UTM_MEDIUM=EMAIL&UTM_CAMPAIGN=EMAIL_WEEKLY》 *
江庆 等: "Vue+Webpack框架在银行App前端开发的应用", 《金融科技时代》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857375A (en) * 2018-12-25 2019-06-07 上海尼好系统集成有限公司 A kind of front end development system of matching rear end exploitation test
CN110244955A (en) * 2019-05-29 2019-09-17 广州至真信息科技有限公司 A kind of processing method of application, device, server and medium
CN110244955B (en) * 2019-05-29 2023-04-18 广州至真信息科技有限公司 Application processing method, device, server and medium
CN113468125A (en) * 2021-09-03 2021-10-01 深圳市信润富联数字科技有限公司 File service method, system, equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
JP5719487B2 (en) Method, system, and computer program product for installing an application on a runtime instance, and a computer program (application installation)
CN105022630B (en) A kind of assembly management system and assembly management method
CN109062577A (en) A kind of front end script is split and destructing optimization method and system
US20110010690A1 (en) System and Method of Automatically Transforming Serial Streaming Programs Into Parallel Streaming Programs
CN106547527B (en) JavaScript file construction method and device
CN108304175B (en) Code file isolation packaging method and device
CN106372130B (en) A kind of static resource management method
CN109766099B (en) Front-end source code compiling method and device, storage medium and computer equipment
US8386608B1 (en) Service scripting framework
CN109032631B (en) Application program patch package obtaining method and device, computer equipment and storage medium
CN109783071B (en) Drools rule engine-based government rule design method and system
CN109597618B (en) Program development method, program development device, computer device, and storage medium
US11068243B2 (en) Application stack builder based on node features
CN110321134A (en) A kind of method of application installation package, the storage medium of generating is with application server
WO2015021809A1 (en) Dynamic language code execution method and apparatus
CN103488517B (en) PHP code Compilation Method, PHP code operation method and device
US9207956B2 (en) Class loading device for a java runtime environment, cluster system and method of executing a function
CN106020920A (en) Preprocessing method and system for JCVM interpreter
CN111723314B (en) Webpage display method and device, electronic equipment and computer readable storage medium
CN113268239B (en) View construction method, device, equipment and storage medium of desktop application
CN111596970B (en) Method, device, equipment and storage medium for dynamic library delay loading
US10922682B2 (en) Java card application memory footprint optimization
CN106293862B (en) A kind of analysis method and device of expandable mark language XML data
CN111259042B (en) Dynamic query method and system
CN115951890B (en) Method, system and device for transcoding between different front end frameworks

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