CN117421061A - Code sharing method, device, equipment and storage medium - Google Patents

Code sharing method, device, equipment and storage medium Download PDF

Info

Publication number
CN117421061A
CN117421061A CN202311327091.5A CN202311327091A CN117421061A CN 117421061 A CN117421061 A CN 117421061A CN 202311327091 A CN202311327091 A CN 202311327091A CN 117421061 A CN117421061 A CN 117421061A
Authority
CN
China
Prior art keywords
module
federation
plug
plugin
configuration
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
CN202311327091.5A
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.)
Inspur Cloud Information Technology Co Ltd
Original Assignee
Inspur Cloud Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Cloud Information Technology Co Ltd filed Critical Inspur Cloud Information Technology Co Ltd
Priority to CN202311327091.5A priority Critical patent/CN117421061A/en
Publication of CN117421061A publication Critical patent/CN117421061A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/445Program loading or initiating
    • G06F9/44557Code layout in executable memory
    • G06F9/44563Sharing
    • 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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a code sharing method, a device, equipment and a storage medium, which relate to the technical field of computers and comprise the following steps: acquiring an initial module federation plugin, and secondarily packaging the initial module federation plugin based on a preset packaging rule to obtain a packaged module federation plugin; configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in; and respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application. The method and the device configure each target application by utilizing the target module federation plugin obtained by processing the initial module federation plugin, so that code sharing among applications is realized based on a module federation technology. In this way, the repeated loading of the common code can be effectively reduced, and the timeliness of component update can be improved.

Description

Code sharing 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 sharing codes.
Background
At present, as the front-end projects developed are more and more, the functions are more and more complex, if the sharing is realized by a first mode (copying codes and revising logic to achieve a page or a component with identical appearance functions), the same and similar functions can appear repeatedly in the same project, so that in order to be rapidly online, a mature module/function is copied among different projects, a great deal of redundancy of codes among projects is caused, and as time passes, a small change optimization needs a great deal of manpower time to restore the architecture of the whole project, so that the content to be deleted is determined, errors are prone to occur, and the maintenance of the projects becomes difficult. If sharing is implemented by the second method (collecting the same pages or components between the projects together and then packing them into npm (Node Package Manager, node package manager) packages, and the packages refer to npm to achieve sharing, with the increase of the public resource file, the package version becomes more and more frequent, and after each package is increased, the departments and the developers of each project group need to be notified to update the public package, and frequent notification is made to the developers to update the version number of the public package, so that not only is the experience of use reduced, but also inconvenience is brought to the development test.
Disclosure of Invention
In view of the above, the present invention aims to provide a method, an apparatus, a device and a storage medium for sharing codes, which can effectively reduce the repeated loading of common codes, improve the timeliness of component update and the efficiency of project development, and can realize the accurate control of code sharing by loading and hot plug on demand. The specific scheme is as follows:
in a first aspect, the present application provides a code sharing method, including:
acquiring an initial module federation plugin, and secondarily packaging the initial module federation plugin based on a preset packaging rule to obtain a packaged module federation plugin;
configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in;
and respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application.
Optionally, the performing secondary packaging on the initial module federation plugin based on a preset packaging rule includes:
and completing secondary packaging operation corresponding to the initial module federal plug-in by configuring corresponding identification items.
Optionally, the performing, based on the target module federation plugin, a corresponding weback configuration modification operation on each target application includes:
and in the process of executing corresponding weback configuration modification operation on each target application, the corresponding weback configuration modification operation is completed by introducing the target module federation plugin and performing corresponding plugin information configuration.
Optionally, the performing the corresponding weback configuration modification operation by introducing the target module federation plugin and performing corresponding plugin information configuration includes:
after the target module federation plugin is introduced, if the current target application belongs to the first preset type application, corresponding plugin information configuration is performed based on application name information and application identification information corresponding to the current target application, so that corresponding weback configuration modification operation is completed.
Optionally, the performing the corresponding weback configuration modification operation by introducing the target module federation plugin and performing corresponding plugin information configuration includes:
after the target module federation plugin is introduced, if the current target application belongs to a second preset type application, in the process of carrying out plugin information configuration based on the application name information and the application identification information corresponding to the current target application, corresponding export configuration operation and file name configuration operation are executed so as to complete corresponding weback configuration modification operation.
Optionally, the code sharing based on the obtained target applications after each configuration includes:
after the target application after each configuration is obtained, matching is carried out by utilizing the application name information and the application identification information respectively corresponding to the target application after each configuration, and code sharing is carried out based on a matching result.
Optionally, the configuring, according to a preset plug-in configuration rule, a plug-in on which the encapsulated module federal plug-in depends includes:
and configuring the container plug-in depending on the federal plug-in for realizing the packaged module according to a preset plug-in configuration rule.
In a second aspect, the present application provides a code sharing apparatus, including:
the plug-in packaging module is used for obtaining an initial module federation plug-in and carrying out secondary packaging on the initial module federation plug-in based on preset packaging rules so as to obtain a packaged module federation plug-in;
the plug-in configuration module is used for configuring the plug-ins on which the encapsulated module federation plug-ins depend according to preset plug-in configuration rules so as to obtain corresponding target module federation plug-ins;
and the code sharing module is used for respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to carry out code sharing based on each obtained configured target application.
In a third aspect, the present application provides an electronic device, including:
a memory for storing a computer program;
and a processor for executing the computer program to implement the steps of the code sharing method.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the aforementioned code sharing method.
Therefore, in the application, the initial module federation plugin is obtained first, and the initial module federation plugin is packaged for the second time based on a preset packaging rule, so as to obtain the packaged module federation plugin. And then configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in. And finally, respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application. In this way, an initial module federation plugin provided by a module federation technology is obtained, and then the module federation plugin is subjected to secondary packaging and plugin configuration to obtain a corresponding target module federation plugin. And then configuring each target application based on the target module federation plugin so as to share codes based on each configured target application. Therefore, the repeated loading of the common code can be effectively reduced, the instantaneity of component update and the efficiency of project development are improved, and the accurate control of code sharing can be realized through loading and hot plug on demand.
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 flow chart of a code sharing method provided in the present application;
FIG. 2 is a schematic flow chart of a specific code sharing method provided in the present application;
fig. 3 is a schematic structural diagram of a code sharing device provided in the present application;
fig. 4 is a block diagram of an electronic device provided in the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, as the front-end projects of development are more and more, functions are more and more complex, the projects are mainly shared in a first mode or a second mode, the former is easy to cause a large amount of code redundancy, and the latter reduces project development efficiency. Therefore, the code sharing scheme can effectively reduce repeated loading of the common codes, improve the instantaneity of component updating and the efficiency of project development, and can realize accurate control of code sharing by loading and hot plug on demand.
Referring to fig. 1, the embodiment of the invention discloses a code sharing method, which comprises the following steps:
step S11, acquiring an initial module federation plugin, and carrying out secondary packaging on the initial module federation plugin based on preset packaging rules to obtain a packaged module federation plugin.
Specifically, in this embodiment, the performing secondary packaging on the initial module federation plugin based on a preset packaging rule may specifically include: and completing secondary packaging operation corresponding to the initial module federal plug-in by configuring corresponding identification items. That is, in this embodiment, after obtaining weback 5 (static resource packaging tool, which is a module packaging tool facing modern Web applications, it may package a plurality of resources such as JavaScript, CSS (Cascading Style Sheets, cascading style sheets), pictures, etc. into one or more files, so as to load and use module Federation (module federation) provided in a browser, in order to avoid limitation in the subsequent application, it is necessary to perform secondary packaging on Module Federation Plugin corresponding to module Federation, that is, the initial module federation plugin. It should be appreciated that in the process of encapsulation, the secondary encapsulation is performed again, specifically based on the original type definition of Module Federation Plugin Options (module federal plug-in option). The package adds corresponding id (identity document) items, namely an identity identification item and is matched with the original name (service external name) to achieve the function of unique identification.
And step S12, configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in.
In this embodiment, configuring, according to a preset plug-in configuration rule, a plug-in on which the federal plug-in of the packaged module depends may specifically include: and configuring the container plug-in depending on the federal plug-in for realizing the packaged module according to a preset plug-in configuration rule. That is, there is a need to configure a Container plug in plug-in and a Container Reference Plugin (Container reference plug-in) plug-in that are relied upon to implement the post-package module federal plug-in. Wherein it is to be appreciated that the container plug-in is specifically configured to add an entry dependency and add an asynchronous dependency to the current dependency, and the container reference plug-in is specifically configured to add a request to resolve a user and analyze whether it is a remote module, and then load the remote module.
In particular, with respect to the container plug-in, it should be understood that, for implementing code sharing between subsequent applications, weback (static module packaging tool for modern JavaScript applications) configuration needs to be separately performed, and the configuration uses modules. The shared content needs to be contained in the object, the key in the object is plug, the state corresponding to the key is an array, and the array content needs to be created using new Module Federation Plugin (obj), which is a parameter required for creating the object, needs to correspond to the dependent parameter encapsulated in step S11. The parameters specifically required may be configured according to actual requirements, and the parameters include, but are not limited to, name: module name, id: module id, exposes: to derive which file, the key value is the name at the time of import, and the value is the current file path, filename: externally providing the packed file name and library: type of build product (Type inside configuration may be umd, commonjs, var etc.), remote Type: the dependent remote application library type, the configured value may be umd, commonjs, script, var, etc., remote: remote application, runtime, application dependent: configured with this option, one chunk, shareScope (shared scope) named by this name would be for module split: scope name, shared of all shared modules: shared modules are required between applications. When new Module Federation Plugin is called, after all plug-ins are registered in the function, the corresponding content plug in is triggered according to the obj [ 'outlets' ] parameter, and after the content plug in is triggered, the internal addEntry is triggered to generate entry dependency and add asynchronous dependency to the current dependency.
In addition, with respect to the container referencing plug-ins, it should be understood that, based on the foregoing information, after all plug-ins are registered in the function, the corresponding Container Reference Plugin is triggered according to the obj [ 'remote' ] parameter, and the Container Reference Plugin triggers an internal Externals plug-in (external expansion plug-in), then executes a compare. And when the operations related to the container plug-in and the container reference plug-in are completed and a management (android development file name) file is generated through build packaging and sent to a browser during subsequent code sharing, when the browser is opened in the form of an index.
And step S13, based on the target module federation plugins, respectively executing corresponding weback configuration modification operation on each target application so as to share codes based on the obtained target applications after each configuration.
Specifically, in this embodiment, the performing, based on the target module federation plugin, a corresponding weback configuration modification operation on each target application may specifically include: and in the process of executing corresponding weback configuration modification operation on each target application, the corresponding weback configuration modification operation is completed by introducing the target module federation plugin and performing corresponding plugin information configuration. It should be understood that the performing the corresponding weback configuration modification operation by introducing the target module federation plugin and performing corresponding plugin information configuration includes: after the target module federation plugin is introduced, if the current target application belongs to the first preset type application, corresponding plugin information configuration is performed based on application name information and application identification information corresponding to the current target application, so that corresponding weback configuration modification operation is completed. For example, when configuring the weback configuration of the application 1, the target module federal plugin is introduced and plugin information is configured, the configuration name is used as the name of the current application, the unique id of the current application is configured, the configuration UMD (Universal Module Definition, universal module definition specification) standard is exported, the object configuration of the remote application referenced by the current application of the remote is configured as (application 1 needs to enjoy the code of application 2, remote needs to configure { the name of application 2: "name", the id of application 2: "id" }), and the configuration dependency package array shared (the dependency needed by application 1 is stored in the array).
It should be understood that the performing the corresponding weback configuration modification operation by introducing the target module federation plugin and performing corresponding plugin information configuration includes: after the target module federation plugin is introduced, if the current target application belongs to a second preset type application, in the process of carrying out plugin information configuration based on the application name information and the application identification information corresponding to the current target application, corresponding export configuration operation and file name configuration operation are executed so as to complete corresponding weback configuration modification operation. The second preset type application is a remote application. For example, the remote application 2 is configured, the remote application 2 is substantially the same as the application 1 configuration, but the remote application 2 has more exports and filename configurations than the application 1, the purpose of the exports is to export the code or module required by the application 1 to the outside through the exports to facilitate the introduction of the application 1, and the purpose of the filename is to configure js (JavaScript, an transliterated script language) file names (to provide the packaged file names to the outside) that the remote application 2 is introduced by other applications. After the application and the remote application are configured, the application corresponds to the name and the expose in the weback configuration through the report ('remote application name/exposed module name'). The manner of use is indistinguishable from the introduction of a common asynchronous component. At this time, sharing among codes is realized.
The basic principles of the method are divided into a host consumer, a remote producer and a C host+remote production and consumption integrated, wherein B produces modules through a module federal technology, the modules are shared by a target module federal plug-in, the modules shared by the A and the C are obtained and used in respective applications, and the modules can be consumed by the A by the C because the C application has both production capacity and consumption capacity, so that the modules can be shared between A, B, C.
Meanwhile, in this embodiment, the code sharing performed by the target application based on the obtained configurations includes: after the target application after each configuration is obtained, matching is carried out by utilizing the application name information and the application identification information respectively corresponding to the target application after each configuration, and code sharing is carried out based on a matching result. When the codes are shared, unique identification information provided by the application, namely the id and the name, is shared to a remote place, the remote application can be matched after the id and the name are taken, and the remote codes required by the application can be shared after the matching is successful.
In summary, it can be seen that the embodiment not only can reduce the repeated loading of the common code, improve the project performance and the compiling speed, but also can realize the immediate updating of the components and the accurate control code sharing by loading and hot plug as required. And code sharing across applications and code compatibility across technology stacks are effectively realized, and codes can be infinitely nested.
Therefore, in the embodiment of the application, the initial module federation plugin is obtained first, and the initial module federation plugin is packaged for the second time based on the preset packaging rule, so as to obtain the packaged module federation plugin. And then configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in. And finally, respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application. In this way, an initial module federation plugin provided by a module federation technology is obtained, and then the module federation plugin is subjected to secondary packaging and plugin configuration to obtain a corresponding target module federation plugin. And then configuring each target application based on the target module federation plugin so as to share codes based on each configured target application. Therefore, the repeated loading of the common code can be effectively reduced, the instantaneity of component update and the efficiency of project development are improved, and the accurate control of code sharing can be realized through loading and hot plug on demand.
Referring to fig. 3, the embodiment of the application further correspondingly discloses a code sharing device, which includes:
the plug-in packaging module 11 is used for obtaining an initial module federation plug-in and secondarily packaging the initial module federation plug-in based on preset packaging rules to obtain a packaged module federation plug-in;
the plug-in configuration module 12 is configured to configure a plug-in on which the encapsulated module federation plug-in is dependent according to a preset plug-in configuration rule, so as to obtain a corresponding target module federation plug-in;
and the code sharing module 13 is configured to execute corresponding weback configuration modification operation on each target application based on the target module federation plugin, so as to perform code sharing based on each configured target application.
The more specific working process of each module may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
Therefore, in the embodiment of the application, the initial module federation plugin is obtained first, and the initial module federation plugin is packaged for the second time based on the preset packaging rule, so that the packaged module federation plugin is obtained. And then configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in. And finally, respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application. In this way, an initial module federation plugin provided by a module federation technology is obtained, and then the module federation plugin is subjected to secondary packaging and plugin configuration to obtain a corresponding target module federation plugin. And then configuring each target application based on the target module federation plugin so as to share codes based on each configured target application. Therefore, the repeated loading of the common code can be effectively reduced, the instantaneity of component update and the efficiency of project development are improved, and the accurate control of code sharing can be realized through loading and hot plug on demand.
In some specific embodiments, the package module 11 may specifically include:
and the secondary packaging unit is used for completing secondary packaging operation corresponding to the initial module federal plug-in by configuring corresponding identity items.
In some specific embodiments, the code sharing module 13 may specifically include:
and the weback configuration modification sub-module is used for completing corresponding weback configuration modification operation by introducing the federal plugin of the target module and performing corresponding plugin information configuration in the process of executing corresponding weback configuration modification operation on each target application.
In some specific embodiments, the weback configuration modification submodule may specifically include:
and the weback configuration modification unit is used for carrying out corresponding plug-in information configuration based on the application name information and the application identification information corresponding to the current target application if the current target application belongs to the first preset type application after the target module federation plug-in is introduced, so as to complete the corresponding weback configuration modification operation.
In some embodiments, the weback configuration modification unit may be specifically configured to, after introducing the target module federation plugin, if the current target application belongs to a second preset type application, execute a corresponding export configuration operation and a file name configuration operation in a process of performing plugin information configuration based on the application name information and the application identification information corresponding to the current target application, so as to complete the corresponding weback configuration modification operation.
In some embodiments, the weback configuration modification unit may be specifically configured to match, after obtaining the target application after each configuration, by using the application name information and the application identification information respectively corresponding to the target application after each configuration, and perform code sharing based on a matching result.
In some specific embodiments, the plug-in configuration module may specifically include:
and the plug-in configuration unit is used for configuring the container plug-in and the container reference plug-in which the packaged module federation plug-in depends according to a preset plug-in configuration rule.
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. Wherein the memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement the relevant steps in the code sharing method disclosed in any 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 code sharing method performed by the electronic device 20 disclosed in any of the previous embodiments.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the previously disclosed code sharing 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 code sharing method, comprising:
acquiring an initial module federation plugin, and secondarily packaging the initial module federation plugin based on a preset packaging rule to obtain a packaged module federation plugin;
configuring the plug-in on which the encapsulated module federation plug-in depends according to a preset plug-in configuration rule so as to obtain a corresponding target module federation plug-in;
and respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to share codes based on each obtained configured target application.
2. The code sharing method according to claim 1, wherein the secondarily packaging the initial module federation plugin based on a preset packaging rule includes:
and completing secondary packaging operation corresponding to the initial module federal plug-in by configuring corresponding identification items.
3. The code sharing method according to claim 1, wherein the performing, based on the target module federal plugin, a corresponding weback configuration modification operation on each target application, respectively, includes:
and in the process of executing corresponding weback configuration modification operation on each target application, the corresponding weback configuration modification operation is completed by introducing the target module federation plugin and performing corresponding plugin information configuration.
4. The code sharing method according to claim 3, wherein said performing the corresponding weback configuration modification operation by introducing the target module federal plugin and performing the corresponding plugin information configuration includes:
after the target module federation plugin is introduced, if the current target application belongs to the first preset type application, corresponding plugin information configuration is performed based on application name information and application identification information corresponding to the current target application, so that corresponding weback configuration modification operation is completed.
5. The code sharing method according to claim 4, wherein said performing the corresponding weback configuration modification operation by introducing the target module federal plugin and performing the corresponding plugin information configuration includes:
after the target module federation plugin is introduced, if the current target application belongs to a second preset type application, in the process of carrying out plugin information configuration based on the application name information and the application identification information corresponding to the current target application, corresponding export configuration operation and file name configuration operation are executed so as to complete corresponding weback configuration modification operation.
6. The code sharing method according to claim 4, wherein the code sharing based on the obtained target applications after each configuration includes:
after the target application after each configuration is obtained, matching is carried out by utilizing the application name information and the application identification information respectively corresponding to the target application after each configuration, and code sharing is carried out based on a matching result.
7. The code sharing method according to any one of claims 1 to 6, wherein the configuring, according to a preset plug-in configuration rule, a plug-in on which the post-package module federation plug-in is implemented, includes:
and configuring the container plug-in depending on the federal plug-in for realizing the packaged module according to a preset plug-in configuration rule.
8. A code sharing apparatus, comprising:
the plug-in packaging module is used for obtaining an initial module federation plug-in and carrying out secondary packaging on the initial module federation plug-in based on preset packaging rules so as to obtain a packaged module federation plug-in;
the plug-in configuration module is used for configuring the plug-ins on which the encapsulated module federation plug-ins depend according to preset plug-in configuration rules so as to obtain corresponding target module federation plug-ins;
and the code sharing module is used for respectively executing corresponding weback configuration modification operation on each target application based on the target module federation plugin so as to carry out code sharing based on each obtained configured target application.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the code sharing method of any one of claims 1 to 7.
10. A computer readable storage medium for storing a computer program which when executed by a processor implements the code sharing method of any of claims 1 to 7.
CN202311327091.5A 2023-10-13 2023-10-13 Code sharing method, device, equipment and storage medium Pending CN117421061A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311327091.5A CN117421061A (en) 2023-10-13 2023-10-13 Code sharing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311327091.5A CN117421061A (en) 2023-10-13 2023-10-13 Code sharing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117421061A true CN117421061A (en) 2024-01-19

Family

ID=89522053

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311327091.5A Pending CN117421061A (en) 2023-10-13 2023-10-13 Code sharing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117421061A (en)

Similar Documents

Publication Publication Date Title
CN100418056C (en) System and method for generating methods
US9086931B2 (en) System for translating diverse programming languages
CN110825362A (en) Low-code application software development system and method
US9965259B2 (en) System for translating diverse programming languages
US10296297B2 (en) Execution semantics for sub-processes in BPEL
US11667033B2 (en) Systems and methods for robotic process automation
CN104156313A (en) Method for automatically generating Web service testing case
Afreen et al. A taxonomy of software’s non-functional requirements
CN113778445A (en) Cross-platform component generation method and device, electronic equipment and storage medium
US9552239B2 (en) Using sub-processes across business processes in different composites
CN112000334A (en) Page development method, device, server and storage medium
CN113448678A (en) Application information generation method, deployment method, device, system and storage medium
CN109343970B (en) Application program-based operation method and device, electronic equipment and computer medium
CN107608672B (en) UI module manager, UI module management method and system
Miculan et al. A calculus for attribute-based memory updates
CN117421061A (en) Code sharing method, device, equipment and storage medium
CN110515893A (en) Date storage method, device, equipment and computer readable storage medium
CN115390846A (en) Compiling construction method and device, electronic equipment and storage medium
CN112148263B (en) Front-end standard framework, and generation method, device, equipment and storage medium thereof
US9141383B2 (en) Subprocess definition and visualization in BPEL
CN110554867A (en) Application processing method and device
CN116521161A (en) Form page construction method, device, equipment and storage medium
Arno et al. Reusing OPC UA information models in the Asset Administration Shell
CN117992539A (en) Digital asset processing method, device, equipment and medium based on blockchain
CN114398073A (en) Application updating method and device based on RN

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