A code asset whole life cycle management method, device, equipment and medium

By converting business components written in front-end development frameworks into native components and registering them with tags, and combining remote module federated packaging and asynchronous loading of content distribution networks, the problem of cross-environment generality and cloud-based operation and maintenance of front-end code assets is solved. This enables secure iteration, automatic early warning and unified management of components, improving operation and maintenance efficiency and security.

CN122240155APending Publication Date: 2026-06-19FOUNDER SECURITIES CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FOUNDER SECURITIES CO LTD
Filing Date
2026-05-21
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve cross-environment universality and unified cloud-based operation and maintenance of front-end code assets. They suffer from problems such as framework locking, build environment dependencies, and difficulties in version update maintenance, making it difficult to efficiently and securely reuse code assets across environments.

Method used

Business components are written using a front-end development framework, converted into native components and tagged for registration. The isolation sandbox is turned off, and remote module federation packaging entry and content delivery network asynchronous loading entry are defined. Path reuse and centralized entry management are adopted to generate a dynamic version metadata list, realizing asynchronous cloud retrieval and non-intrusive loading of components.

Benefits of technology

It has achieved the ability of components to run across environments, projects, and technology stacks, built a dynamic distribution link that is not limited by the operating environment, and established a hierarchical and controllable cloud-based automatic update and early warning governance mechanism, thereby improving the operation and maintenance efficiency and security of code assets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240155A_ABST
    Figure CN122240155A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and medium for full lifecycle management of code assets, relating to the field of computer technology. The method includes: using a front-end development framework to write business components and converting them into native components; completing tag registration; disabling the isolation sandbox and adding namespace prefixes to internal styles to achieve component configuration and style isolation; defining a remote module federation and asynchronous loading and packaging entry point for content delivery networks; adopting a global variable export specification and encapsulating a unified loading function to achieve asynchronous component retrieval; distributing updates through path reuse and centralized entry point management; assigning independent addresses or module identifiers to new versions; embedding obsolescence warning and automatic reporting code in old versions; and generating a dynamic version metadata list for consumers to retrieve the corresponding target version components according to a preset strategy. This enables atomic encapsulation of development once, constructs a fully compatible dynamic distribution chain, and establishes a hierarchical and controllable cloud-based automatic update and warning governance mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for full lifecycle management of code assets. Background Technology

[0002] As businesses evolve towards ultra-large scale and long cycles, front-end development has gradually shifted from page writing to asset-based delivery, resulting in a large accumulation of reusable business components and basic user interface assets within enterprises. However, due to the rapid iteration of front-end technology stacks and build tools, a large number of code assets are locked in specific frameworks and runtime environments, forming technology silos. This makes it difficult to achieve cross-environment generality and unified cloud-based operation and maintenance, which has become a prominent bottleneck in front-end engineering.

[0003] At the component encapsulation level, traditional components rely on specific frameworks, creating inherent cross-framework barriers. The same business component requires repeated development, leading to significant maintenance difficulties. At the component distribution and update level, static dependencies in node package managers require manual version upgrades, making batch synchronous updates impossible. Dynamic loading in module federation heavily relies on modern build tools, making it difficult to be compatible with a large number of legacy projects. Furthermore, incompatible updates can easily cause online failures, failing to establish a secure, controllable, and fully compatible component distribution and update system. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, device, and medium for full lifecycle management of code assets, which can achieve atomic encapsulation that can be developed once and used in all environments, build a dynamic distribution link that is not limited by the operating environment and is fully compatible, and establish a hierarchical and controllable cloud-based automatic update and early warning management mechanism.

[0005] To address the aforementioned technical problems, this invention provides a method for full lifecycle management of code assets, comprising: Use a front-end development framework to write business components, and then convert the written business components into native components; Register the native component with a tag, disable the isolation sandbox of the native component, and add a namespace prefix to the internal styles of the native component to complete the configuration and style isolation of the native component; Define a remote module federation packaging entry point and a content delivery network asynchronous loading packaging entry point for native components. When packaging, adopt the global variable export specification, encapsulate a unified loading function, and asynchronously pull native components from the content delivery network through the unified loading function. The update and distribution of native components are carried out by using path reuse and centralized entry management. New versions of native components are assigned independent access addresses or new module identifiers, and obsolescence warning and automatic reporting code is embedded in the original versions of native components. Generate a dynamic version metadata list that records native component information for each version, so that consumers can pull the corresponding target version components according to a preset strategy.

[0006] To address the aforementioned technical problems, the present invention also provides a code asset lifecycle management device, comprising: The component writing and conversion module is used to write business components using a front-end development framework and convert the written business components into native components. The component configuration isolation module is used to register tags for native components, disable the isolation sandbox of native components, and add namespace prefixes to the internal styles of native components to complete the configuration and style isolation of native components; The asynchronous component loading module is used to define the remote module federation packaging entry and the content delivery network asynchronous loading packaging entry for native components. During packaging, it adopts the global variable export specification, encapsulates a unified loading function, and asynchronously pulls native components from the content delivery network through the unified loading function. The component hierarchical governance module is used to update and distribute native components by using path reuse and centralized entry management. It assigns independent access addresses or new module identifiers to new versions of native components and embeds obsolete warning and automatic reporting code into existing versions of native components. The version manifest generation module is used to generate a dynamic version metadata manifest that records the native component information of each version, so that consumers can pull the corresponding target version components according to a preset strategy.

[0007] To address the aforementioned technical problems, the present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of the above-described code asset lifecycle management method.

[0008] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described code asset lifecycle management method.

[0009] The beneficial effects of this invention are as follows: The above-mentioned code asset lifecycle management method provided by this invention uses a front-end development framework to write business components. By converting business components into native components and completing tag registration, disabling the isolation sandbox and adding style namespace prefixes, it can achieve atomic encapsulation that allows for one-time development and universal applicability across all environments. This frees components from the constraints of the front-end framework and enables them to run universally across environments, projects, and technology stacks. By defining remote module federation packaging entry points and content distribution network asynchronous loading packaging entry points, and adopting global variable export specifications and encapsulating unified loading functions, it can build a dynamic distribution link that is not limited by the operating environment and is fully compatible, realizing asynchronous cloud retrieval and non-intrusive loading of components. By reusing paths and centrally managing entry points, it realizes component update distribution, assigns independent addresses and module identifiers to new versions, and embeds obsolescence warnings and automatic reporting code. At the same time, it generates a dynamic version metadata list, which can establish a hierarchical and controllable cloud automatic update and warning governance mechanism, realizing secure iteration, automatic warning, accurate distribution, and unified management of component versions, and significantly improving the operation and maintenance efficiency and usage security of code assets.

[0010] In addition, the present invention also provides a corresponding code asset lifecycle management device, electronic device and computer-readable storage medium for the code asset lifecycle management method, which have the same or corresponding technical features as the code asset lifecycle management method mentioned above, and have the same effect. Attached Figure Description

[0011] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 A flowchart illustrating the code asset lifecycle management method provided in this embodiment of the invention; Figure 2 This is a schematic diagram of the system logic architecture corresponding to the code asset full lifecycle management method provided in this embodiment of the invention; Figure 3 This is a schematic diagram illustrating the process of releasing the initial version of a component according to an embodiment of the present invention; Figure 4 A schematic diagram illustrating the worker decision-making and initial use process for the access method provided in this embodiment of the invention; Figure 5 A schematic diagram illustrating the process of automatic compatibility iteration update provided in an embodiment of the present invention; Figure 6 A schematic diagram illustrating the process of destructive updates and legacy system governance provided in this embodiment of the invention; Figure 7 A schematic diagram illustrating the runtime perception, statistics, and automated governance process provided in this embodiment of the invention; Figure 8 This is a schematic diagram of the code asset lifecycle management device provided in an embodiment of the present invention. Detailed Implementation

[0013] As businesses evolve towards ultra-large scale and long cycles, front-end development has shifted from simple page writing to asset-based delivery. Enterprises have accumulated a large number of business assets, such as financial transaction components and basic user interface (UI) components. However, the rapid iteration of front-end technology stacks, including upgrades from Vue2 to Vue3 and React 16 to React 18, as well as the iteration of build tools, has locked these business assets into specific technology environments, creating numerous technology silos. Achieving cross-environment reuse and cloud-based operation and maintenance of code assets has become a bottleneck that urgently needs to be overcome in the field of front-end engineering. At the component encapsulation level, the underlying operating logic of traditional development frameworks is incompatible, creating a natural cross-framework barrier. The same business component is difficult to reuse in different frameworks or legacy pages. Enterprises often need to repeatedly develop to adapt to multiple technology stacks, resulting in wasted manpower, inconsistent business logic performance, and significantly increased maintenance costs. While current framework-based component encapsulation solutions are convenient to develop, they suffer from severe framework locking issues, requiring high refactoring costs for reuse. At the component usage level, modern reuse solutions such as module federation have excessively high requirements for the build environment, making it difficult to integrate with a large number of outdated projects that cannot be upgraded, resulting in loading gaps. Traditional Node Package Manager (NPM) static dependency models rely on manual version upgrades and repackaging and release, making it difficult to achieve synchronized updates of core logic in large-scale enterprise scenarios. Some dynamic update solutions lack granular security control, easily leading to online crashes due to incompatible updates. Overall, existing component encapsulation and distribution methods generally suffer from framework locking, strong build environment dependencies, and high version update and maintenance costs, making it difficult to support efficient, secure, and cross-environmental large-scale reuse of enterprise front-end assets. To address the shortcomings of framework locking, build environment dependencies, and difficulties in version update maintenance, this invention provides a method for full lifecycle management of code assets.

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.

[0015] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0016] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0017] The specific application environment architecture or specific hardware architecture on which the execution of the code asset lifecycle management method depends is described here.

[0018] The embodiments of the present invention provide a method for full lifecycle management of code assets, and the method is described in detail in conjunction with the execution flow of the full lifecycle management method of code assets. Figure 1 A flowchart of the code asset lifecycle management method provided in this embodiment of the invention is shown below. Figure 1 As shown, the method includes: S101. Use a front-end development framework to write business components and convert the written business components into native components.

[0019] It should be noted that a component refers to a code functional unit with independent functionality, including not only UI view components, but also pure logic modules, business algorithm packages, or data processing units. The full lifecycle refers to the complete evolution of a code module from source code writing (development state), standardization and translation (encapsulation state), remote delivery and distribution (supply state), runtime access (consumer state), to version retirement and secure decommissioning (governance state).

[0020] When executing step S101, in order to solve the problems of framework locking and production efficiency, this invention can, given the low development efficiency and complex state management of native components (Web Components), use a front-end development framework (such as Vue3) to write business components, and then use the native component conversion (defineCustomElement) method built into the framework (Vue) to convert the written business components (Vue3 components) into native components that conform to the browser's native specifications, so that the components can run independently without the original front-end development framework, effectively breaking the framework locking problem.

[0021] It should be noted that the implementing entity of this invention can be a supplier. This supplier is the entity responsible for the development and delivery of component assets, including the standardized translation and construction of component source code, deployment of full protocol artifacts, maintenance of version lists, and lifecycle governance, providing the consumer side with component resources and version management capabilities that are adaptable to multiple environments.

[0022] S102. Register the native component with a tag, disable the isolation sandbox of the native component, and add a namespace prefix to the internal styles of the native component to complete the configuration and style isolation of the native component.

[0023] In step S102, in order to solve the problems of duplicate registration and access conflicts, this invention performs tag registration, disables the isolation sandbox and adds style namespace prefixes to the native components. This can avoid the defects such as style penetration failure and theme inconsistency caused by the default sandbox mechanism of native components while preserving the cross-framework running capability of the components. The namespace prefix achieves precise isolation of the internal styles of the components, prevents style conflicts and pollution, and finally completes the standardized configuration and secure and controllable style management of the components.

[0024] S103. Define remote module federation packaging entry and content delivery network asynchronous loading packaging entry for native components. When packaging, adopt the global variable export specification, encapsulate a unified loading function, and asynchronously pull native components from the content delivery network through the unified loading function.

[0025] When executing step S103, this invention constructs a dual-entry loading system adapted to multiple scenarios by configuring a remote module federation packaging entry and a content delivery network asynchronous loading packaging entry for native components. Combined with the global variable export specification and the encapsulation of a unified loading function, it realizes the cloud-based and asynchronous retrieval and loading of components, effectively compatible with modern build environments and old project environments, and greatly improves the flexibility, versatility and operational stability of component loading, providing reliable support for cross-environment and non-intrusive reuse of code assets.

[0026] S104. The native components are updated and distributed by means of path reuse and centralized entry management. The new version of the native components is assigned an independent access address or a brand-new module identifier, and the obsolescence warning and automatic reporting code is embedded in the original version of the native components.

[0027] When executing step S104, the present invention realizes the update and distribution of native components through path reuse and centralized entry management, assigns independent access addresses or new module identifiers to new versions of components, and embeds obsolescence warning and automatic reporting code into old versions. This can ensure smooth iteration of component versions, achieve parallel compatibility between new and old versions and full-link monitoring, effectively avoid operational failures caused by version updates, establish a hierarchical and controllable component update and obsolescence governance mechanism, and ensure the safe and orderly iteration of code assets.

[0028] S105. Generate a dynamic version metadata list that records the native component information of each version, so that consumers can pull the corresponding target version components according to the preset strategy.

[0029] When executing step S105, the present invention generates a dynamic version metadata list containing native component information of each version, which enables unified collection and management of component versions throughout their entire lifecycle. Consumers can accurately match and pull the required target version components based on the list information and preset strategies, thereby achieving flexible scheduling and secure selection of versions.

[0030] In the code asset lifecycle management method provided in this invention, business components are written using a front-end development framework. By converting these business components into native components and completing tag registration, disabling the isolation sandbox, and adding style namespace prefixes, atomic encapsulation that enables one-time development and universal applicability across all environments can be achieved. This frees the components from the constraints of the front-end framework, giving them universal operation capabilities across environments, projects, and technology stacks. By defining remote module federation packaging entry points and content distribution network asynchronous loading packaging entry points, and adopting global variable export specifications and encapsulating unified loading functions, a dynamic distribution link that is not limited by the operating environment and is fully compatible can be built, enabling asynchronous cloud retrieval and non-intrusive loading of components. Component update and distribution are achieved through path reuse and centralized entry point management. Independent addresses and module identifiers are assigned to new versions, and obsolescence warnings and automatic reporting code are embedded. At the same time, a dynamic version metadata list is generated, which can establish a hierarchical and controllable cloud automatic update and warning governance mechanism. This enables secure iteration, automatic warning, accurate distribution, and unified management of component versions, significantly improving the operational efficiency and security of code assets.

[0031] Figure 2 This is a schematic diagram of the system logic architecture corresponding to the code asset full lifecycle management method provided in this embodiment of the invention. (See diagram below.) Figure 2As shown, the system is a code delivery and full lifecycle governance system across heterogeneous environments. Its overall logical architecture consists of four organic parts: development layer, transformation layer, supply layer and application layer, which fully present the entire lifecycle process of code assets from writing to distribution and loading. The development layer, acting as the production end of component source code, supports developers in writing business components using high-level declarative languages ​​through front-end development frameworks such as Vue 3, and allows the reference of third-party user interface component libraries. The transformation layer, as an intermediate processing stage, translates source code with framework characteristics into atomic code artifacts that conform to native browser specifications through entry configuration, dynamic namespace injection of styles, deprecated version-aware code injection, and compilation transformation. This provides a standardized input source for the distribution and construction of the supply layer, and offers component registration and style isolation capabilities. The supply layer encapsulates the translated artifacts using multiple protocols, and builds and hosts module federated distribution artifacts and content delivery network asynchronous mapping distribution artifacts, providing dual-path dynamic delivery capabilities. The application layer, as the execution end, can select module federated loading or content delivery network loading methods based on environment compatibility in different build tools (such as Webpack 5 and Vite) and other heterogeneous front-end host environments, enabling cross-environment component loading and use.

[0032] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, step S102 performs tag registration on native components, closes the isolation sandbox of native components, and adds namespace prefixes to the internal styles of native components. Specifically, it may include: performing tag registration operation on native components, starting a singleton control and anti-duplicate registration mechanism during the registration process, detecting the tag registration status of native components, terminating the registration process if the tag has been registered, and completing the tag registration if the tag has not been registered; closing the isolation sandbox of native components to allow native components to access the global style environment of the host application; and adding corresponding namespace prefixes to the internal styles of native components during the component construction stage to distinguish the styles of native components from the styles of the host application through the namespace prefixes.

[0033] In implementation, to address the issues of the transformed native components being unusable directly and the potential for system errors and crashes due to duplicate registration, this invention designs an enhanced registration wrapper layer: a tag registration module enables the registration of custom tags, supporting both built-in default tag names and allowing users to dynamically input custom tag names; simultaneously, a registration status bit verification module encapsulates singleton control logic at the component entry point, retrieving internal status bits before executing registration, and stopping subsequent logic if the tag is already registered, effectively avoiding exceptions caused by duplicate tag registration, and significantly improving the stability and usability of the component in complex dynamically loaded environments.

[0034] To address the overly strict isolation logic of the native Shadow Document Object Model (ShadowDOM) mechanism, this invention employs a balanced strategy of dynamic style namespaces and escape isolation. On one hand, by configuring the shadow root node (shadowRoot) to a disabled state (false), Shadow DOM escape is achieved, actively breaking the strong isolation sandbox of the native component. This allows components to seamlessly consume the global theme color, font variables, and common styles from third-party user interface libraries within the host environment, resolving issues of inconsistent UI visuals and the failure of third-party library styles. On the other hand, a namespace with a specific prefix is ​​automatically added to the component during the build phase, achieving dynamic style namespace protection and balancing the risk of global style pollution caused by escape. Through this parallel approach of proactive openness and passive prefix isolation, a high degree of integration between component styles and the host environment is achieved, while ensuring that internal component styles do not contaminate the host application's page layout. This effectively solves the problems of global style isolation and style pollution, achieving the optimal solution for style compatibility.

[0035] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, step S103 defines a remote module federation packaging entry and a content delivery network asynchronous loading packaging entry for native components. When packaging, a global variable export specification is adopted, which may specifically include: using a single build configuration file to synchronously define a remote module federation packaging entry adapted to modern host projects and a content delivery network asynchronous loading packaging entry adapted to non-modular or legacy projects for native components; when building and packaging native components, a global variable export specification is adopted to export the module descriptor of the native components in the form of named global variables to ensure compatibility with different build tools and browser runtime environments.

[0036] In practice, this invention can effectively solve the access barriers of remote components in heterogeneous build environments (such as Webpack, Vite) and old engineering projects and non-engineering environments (such as native HTML) by building a single-build, dual-protocol distribution system in the conversion layer and the supply layer. The technical implementation is as follows: A dual-entry output architecture is adopted under a single build flow. To ensure component logic consistency and reduce maintenance costs, two independent packaging entry points are defined synchronously on the provider side through a single build configuration file. One is a remote module federation entry point adapted to modern build host projects to achieve runtime dependency sharing and on-demand loading; the other is an asynchronous loading entry point for content delivery networks adapted to projects that do not support module federation protocols, which completes asset retrieval by encapsulating a global loader. This allows the same set of business logic to generate different delivery protocols, achieving seamless coverage of the entire front-end runtime environment and significantly improving the universality and adaptability of component distribution.

[0037] For the module federation mode, this invention sets up a cross-build tool compatibility configuration. To solve the problem of difficulty in integrating the Webpack 5 module federation protocol in heterogeneous build tools such as Vite, a library export specification mode is adopted. In the build configuration, the library export type of the module federation is forced to be specified as a global variable mode, so that Webpack exports the module descriptor of the component as a named global variable. Since global variables are a universal standard that can be recognized by all browser environments and various build tools, this strategy can effectively shield the underlying protocol conflicts between different build toolchains, ensure the stable integration of Webpack build artifacts in heterogeneous build ecosystems, and greatly improve the reliability and compatibility of cross-environment component loading.

[0038] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, step S103 encapsulates a unified loading function, and asynchronously pulls native components from the content delivery network through the unified loading function. Specifically, it may include: encapsulating a unified loading function based on the remote module federated packaging entry and the content delivery network asynchronous loading packaging entry, configuring component module mapping relationships and asynchronous encapsulation logic in the unified loading function; when the host application triggers a loading action, the corresponding native components are asynchronously pulled from the content delivery network through dynamic script injection or asynchronous import mechanism.

[0039] In implementation, the asynchronous loading mechanism based on a dynamic mapping table (for content delivery network mode) is mainly used to adapt to legacy projects or non-engineering scenarios that do not support modular construction at all. This invention implements a dynamic module mapping engine in the cdnEntry.js entry file, constructing a component module mapping table. This mapping table is essentially a correspondence between component identifiers and asynchronous loading functions, accurately matching component identifiers with cloud component resources. This invention exposes a unified loading function to the global environment. When the host application calls this function, it can retrieve the corresponding component slice from the cloud through the browser's native dynamic script injection or asynchronous import mechanism, completing the asynchronous loading and use of the component. This mechanism completely breaks the dependence on the engineering environment, eliminating the need for complex modular configuration. Even if the project is not built using standardized engineering methods, component integration can be completed through simple function calls, effectively broadening the applicable scenarios of components, lowering the component access threshold for legacy and non-engineering projects, while ensuring the flexibility and stability of component loading. This ensures that components can be called efficiently and smoothly in various scenarios, further improving the reusability and deployment efficiency of component resources.

[0040] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, step S104 adopts the path reuse and centralized entry management approach to update and distribute native components, assigns independent access addresses or new module identifiers to new versions of native components, and embeds obsolescence warning and automatic reporting code into the original version of native components. Specifically, it may include: updating and distributing native components using the path reuse and centralized entry management approach; wherein, path reuse is applied to compatibility upgrades where the external interface of the native component does not change, and a covered update distribution mode is used to push the verified compatibility code product to a set logical address so that the consumer can complete the dynamic mounting of the component according to the set logical address and obtain the new version of the native component during the page loading process; centralized entry management includes distributing and dynamically mounting native components through a unified logical address, and uniformly managing the release and update of components; for version iterations where the external interface of the native component changes, a path isolation release method is used to assign independent access addresses or new module identifiers to the new version of native components, without overwriting the resources of the original version of native components; obsolescence warning and automatic reporting code is embedded in the construction entry logic of the original version of native components.

[0041] In implementation, this invention constructs a code version governance mechanism that combines compile-time stability and runtime dynamism. By predicting update risks and implementing differentiated distribution logic, this mechanism effectively solves the technical contradiction between the excessively long update chain of traditional package management (NPM) and the uncontrollable update risks of module federation (MF), providing a reliable guarantee for the stable operation and efficient reuse of components.

[0042] Different governance strategies are adopted for different types of component updates: For compatibility upgrades that do not change external interfaces (APIs), seamless upgrades are achieved through path reuse and centralized entry point management. The supplier pushes verified compatibility code artifacts to a fixed logical URL address, and the consumer side does not need to re-execute NPM downloads or build packages; it can automatically obtain the latest version when the page loads. This leverages the advantages of dynamic response, greatly improves the efficiency of fixing core business logic, and eliminates update lag in cross-team collaboration.

[0043] For destructive updates that may cause host crashes, such as interface changes or core logic refactoring, version security control is achieved through path isolation release and parallel operation of old and new versions, combined with an automated early warning and reporting mechanism. This avoids system failures caused by update operations. At the same time, through version isolation, early warning and reporting measures, the component update process is ensured to be standardized and orderly, further improving the compatibility and operational stability of components, and providing strong support for the efficient reuse and long-term operation and maintenance of code assets.

[0044] Furthermore, in specific implementation, the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, after embedding the obsolescence warning and automatic reporting code, may further include: identifying the host application's operating environment through the embedded code during the runtime phase; when the identified environment type is a production environment, disabling the warning output and reporting the usage data of the original version components through the embedded code in the production environment; when the identified environment type is a development environment or a testing environment, triggering the warning output through the embedded code in the development environment or testing environment, displaying component upgrade guidance and new version path information.

[0045] In implementation, after embedding obsolescence warning and automatic reporting code, this invention can perform warning detection logic, the execution flow of which is as follows: First, the injected code block will detect the current host application's runtime environment, such as by identifying the global variable `process.env.NODE_ENV` or the URL parameters of the host page, to accurately perceive the current runtime scenario. Subsequently, a tiered response strategy is executed according to different environments: In the production environment, the warning code remains silent to ensure that the old version of the business logic can continue to run stably without producing any side effects. At the same time, the automatic reporting function is enabled to report the actual usage of the old version, which facilitates the supplier to accurately count the application scenarios and usage frequency of the old version, providing data support for subsequent version iterations; In the development or testing environment, when developers call the old version of the component, the warning logic will be triggered immediately. This invention can automatically output a prominent obsolescence warning in the developer console, or display a migration notification floating in the UI layer. The migration notification may include an upgrade guide link and the access path of the new version of the component.

[0046] The aforementioned early warning and detection mechanism upgrades traditional document-based notifications to strong code-level alerts. This ensures absolute security for online operations by avoiding forced automatic updates that could cause system crashes, thus guaranteeing the continued operation of older versions. Furthermore, it accurately reaches relevant personnel during the development phase, providing clear warnings and migration guidelines to drive a smooth transition of component assets to the new version. Simultaneously, the automatic reporting function tracks the usage of older versions in real time, especially for applications with low iteration frequencies, enabling end-to-end version control. This avoids operational risks caused by version chaos and provides accurate data support for subsequent version optimization and iteration, further enhancing the manageability and operational stability of component assets.

[0047] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management method provided in the embodiments of the present invention, step S105 generates a dynamic version metadata list that records the information of native components of each version, so that the consumer can pull the corresponding target version component according to a preset strategy. Specifically, it may include: generating a dynamic version metadata list (Manifest), recording the version identifier, access address and corresponding association information of each version of native component in the dynamic version metadata list; sending the dynamic version metadata list to the consumer so that the consumer can determine the target version component from the dynamic version metadata list according to a preset strategy, and pull the target version component according to the access address recorded in the dynamic version metadata list.

[0048] To support the stable operation of the aforementioned hybrid model during implementation, this invention introduces a metadata scheduling layer based on manifest files on the supply side, constructing a standardized and controllable component scheduling system. This invention maintains a dynamically updatable metadata manifest, which records the historical version information and corresponding component address of each component module, while also clearly labeling each version with a version number and version identifier (including major version, compatible version, obsolete version, etc.). During the conversion layer processing, this invention can automatically inject warning codes and reporting functions based on the component's version identifier, achieving precise version control. Before requesting a component, the consumer-side loader can first parse this metadata manifest, and then automatically match and retrieve the corresponding version of the component according to the host's preset version strategy, ensuring the accuracy and adaptability of component loading. This approach not only enables refined management of component versions, clearly distinguishing the functional differences and applicable scenarios of different versions, but also effectively avoids issues such as version confusion and loading errors, ensuring the stability and compatibility of component loading. Furthermore, it allows for real-time synchronization of component version information, enabling suppliers to accurately grasp the usage and iteration progress of components, providing support for the full lifecycle management of components, further improving the efficiency of component distribution and use, ensuring stable and efficient component calls in hybrid mode, and adapting to the usage needs of different scenarios.

[0049] The following is a timeline diagram illustrating the code asset lifecycle management method provided in this embodiment of the invention: Figure 3 This is a schematic diagram illustrating the process of releasing the initial version of a component according to an embodiment of the present invention. For example... Figure 3As shown, this stage is the initial version release stage of the component, marking the beginning of the entire lifecycle of cross-framework code assets. Asset developers first define the component's major version number (e.g., v1.0) and mark it as normal, then execute the build and release instructions. Upon receiving the build instructions, the provider's transformation and build layer performs standardized transpilation processing on the component source code, including key steps such as style escape and singleton registration encapsulation, converting framework-specific code into native component artifacts adapted to multiple protocols. After transpilation, the provider synchronously deploys the v1.0 version's full-protocol artifacts (module federation protocol artifacts, content delivery network asynchronous loading artifacts) to the remote resource service, while simultaneously updating the version list, recording the version's status and address information, providing standardized component resources and version information for subsequent consumer-side integration. This stage completes the transformation of the component from source code to a distributable asset, building initial delivery capabilities usable across environments, laying the foundation for subsequent integration, iteration, and governance.

[0050] Figure 4 This is a schematic diagram illustrating the worker decision-making and initial use process for the access method provided in an embodiment of the present invention. (See attached diagram.) Figure 4 As shown, this stage involves manual decision-making and initial use of the access method, a crucial step in establishing a connection between the consumer and component assets. The consumer manually selects the appropriate access protocol based on the host project's build environment: for projects with modern build capabilities like Webpack and Vite, a module federation solution is used, configuring a remote module federation entry point and dynamically mounting the component at runtime by loading the remote entry file, ultimately achieving successful component rendering; for older projects or environments that don't support modular building, such as native HTML, a content delivery network (CDN) solution is used, introducing a CDN mapping loading script, loading the CDN entry file, and executing a dynamic loading function to fetch the component, also achieving successful component rendering. Both paths ensure normal component loading and successful rendering, solving the access adaptation problem in heterogeneous environments and verifying the effectiveness of the single-build, dual-protocol distribution system, providing a fundamental guarantee for the stable operation and iterative updates of subsequent components.

[0051] Figure 5 This is a schematic diagram illustrating the automatic compatibility iteration update process provided in an embodiment of the present invention. Figure 5As shown, this stage is the compatibility iteration automatic update stage, which realizes seamless component upgrades and automatic cross-environment synchronization. Asset developers release patch versions that do not change external interfaces (such as v1.1) and mark them as compatible, then execute the build and release command; the supply side adopts a path reuse strategy, directly overwriting the new version artifacts to the original logical address, without modifying the consumer-side entry configuration. When the consumer-side host project runs, it requests resources through the original address, without modifying any code or rebuilding, and can automatically pull and load the latest version of the component, achieving seamless upgrades with one-stop release and network-wide effectiveness. This stage effectively eliminates update lag in cross-team collaboration, significantly improves the efficiency of defect repair and performance optimization in a distributed environment, and ensures the stable operation of consumer-side business, solving the pain point of excessively long update chains in traditional package management.

[0052] Figure 6 This is a schematic diagram illustrating the process of destructive updates and legacy system governance injection provided in an embodiment of the present invention. Figure 6 As shown, this phase, the disruptive update and legacy version governance injection phase, is used to handle major version iterations involving interface changes or core logic refactoring. Asset developers release an incompatible new version (e.g., v2.0) and mark the old version (v1.x) as obsolete, then execute the build release command. The supply side implements differentiated code injection by converting the build layer: the new version artifact retains only clean business code, while the old version artifact is infused with an environment-aware early warning module and an asynchronous profile reporting module. Finally, the supply side deploys version v2.0 to a new access address, while retaining the original v1.x version at the original address and loading governance patches, achieving path isolation between the new and old versions. This phase avoids the impact of disruptive updates on existing business and lays the foundation for subsequent monitoring, early warning, and obsolescence governance of the old version, achieving controllable risk and a smooth transition during major version iterations.

[0053] Figure 7 This is a schematic diagram illustrating the runtime awareness, statistics, and automated governance process provided in an embodiment of the present invention. Figure 7As shown, this stage, namely runtime awareness, statistics, and automated governance, is a crucial link in achieving closed-loop management of component assets throughout their entire lifecycle. When an old project loads old version component resources, it receives code artifacts with governance logic returned by the provider and executes different strategies based on the runtime environment: In the development / testing environment, this invention can pop up a strong warning and migration guide in the console, proactively reaching developers to prompt them to perceive the risks and initiate a version migration plan; in the production environment, it remains silent while automatically collecting the call fingerprints and host information of the old version and reporting them to the statistics service. The statistics service will summarize data such as the distribution of existing applications and call frequency of the old version and provide feedback to the asset developers. Once it is confirmed that there are no active applications in the old version, the asset developers modify the version list configuration, completely remove the access permissions of the old version, and complete the formal decommissioning of the component asset. This stage upgrades traditional document-based notifications to strong code-level reminders, ensuring the security and stability of online business while accurately driving the smooth evolution of assets to new versions, achieving controllable governance of the entire link from component release, iteration to decommissioning.

[0054] From the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0055] Embodiments of the present invention also provide a code asset lifecycle management device. Figure 8 This is a schematic diagram of the code asset lifecycle management device provided in an embodiment of the present invention. This embodiment is based on functional modules, such as… Figure 8 As shown, the device includes: The component writing and conversion module 10 is used to write business components using a front-end development framework and convert the written business components into native components. The component configuration isolation module 11 is used to register tags for native components, close the isolation sandbox of native components, and add namespace prefixes to the internal styles of native components to complete the configuration and style isolation of native components; The asynchronous component loading module 12 is used to define the remote module federation packaging entry and the content delivery network asynchronous loading packaging entry for native components. When packaging, it adopts the global variable export specification, encapsulates a unified loading function, and asynchronously pulls native components from the content delivery network through the unified loading function. The component hierarchical governance module 13 is used to update and distribute native components by using path reuse and centralized entry management. It assigns independent access addresses or new module identifiers to new versions of native components and embeds obsolete warning and automatic reporting code into existing versions of native components. Version list generation module 14 is used to generate a dynamic version metadata list that records the native component information of each version, so that consumers can pull the corresponding target version components according to a preset strategy.

[0056] In the code asset lifecycle management device provided in this embodiment of the invention, business components can be written using a front-end development framework through the interaction of the five modules. By converting the business components into native components and completing tag registration, disabling the isolation sandbox and adding style namespace prefixes, atomic encapsulation that allows for one-time development and universal application across all environments can be achieved. This frees the components from the constraints of the front-end framework and enables them to run universally across environments, projects, and technology stacks. By defining remote module federation packaging entry points and content distribution network asynchronous loading packaging entry points, and by adopting global variable export specifications and encapsulating unified loading functions, a dynamic distribution link that is not limited by the operating environment and is fully compatible can be built, enabling asynchronous cloud retrieval and non-intrusive loading of components. Component update and distribution are achieved through path reuse and centralized entry point management. Independent addresses and module identifiers are assigned to new versions, and obsolescence warnings and automatic reporting code are embedded. At the same time, a dynamic version metadata list is generated, which can establish a hierarchical and controllable cloud automatic update and warning governance mechanism. This enables secure iteration, automatic warning, accurate distribution, and unified management of component versions, significantly improving the operational efficiency and security of code assets.

[0057] Since the embodiments of the code asset lifecycle management device and the code asset lifecycle management method correspond to each other, the descriptions of the features in the embodiments corresponding to the code asset lifecycle management device can be found in the relevant descriptions of the embodiments corresponding to the code asset lifecycle management method, and will not be repeated here. Furthermore, it has the same beneficial effects as the code asset lifecycle management method mentioned above.

[0058] Furthermore, in specific implementation, in the above-mentioned code asset lifecycle management device provided in the embodiments of the present invention, the component configuration isolation module 11 can be used to perform tag registration operations on native components. During the registration process, a singleton control and anti-duplicate registration mechanism is activated to detect the tag registration status of the native component. If the tag has been registered, the registration process is terminated; if the tag has not been registered, the tag registration is completed. The isolation sandbox of the native component is closed, so that the native component can access the global style environment of the host application. During the component construction stage, a corresponding namespace prefix is ​​added to the internal style of the native component to distinguish the style of the native component from the style of the host application through the namespace prefix.

[0059] Furthermore, in specific implementation, in the code asset lifecycle management device provided in the embodiments of the present invention, the asynchronous component loading module 12 can be used to synchronously define a remote module federation packaging entry for adapting to modern host projects and a content delivery network asynchronous loading packaging entry for adapting to non-modular or legacy projects using a single build configuration file; when building and packaging native components, a global variable export specification is adopted to export the module descriptor of the native components as a named global variable to ensure compatibility with different build tools and browser runtime environments; a unified loading function is encapsulated based on the remote module federation packaging entry and the content delivery network asynchronous loading packaging entry, and the component module mapping relationship and asynchronous encapsulation logic are configured in the unified loading function; when the host application triggers a loading action, the corresponding native component is asynchronously pulled from the content delivery network through dynamic script injection or asynchronous import mechanism.

[0060] Furthermore, in specific implementation, in the code asset lifecycle management device provided in the embodiments of the present invention, the component hierarchical governance module 13 can be used to update and distribute native components using path reuse and centralized entry management. Path reuse is applied to compatibility upgrades where the external interface of the native component remains unchanged. A covered update distribution mode is used to push the verified compatibility code product to a set logical address, so that the consumer can dynamically mount the component according to the set logical address and obtain the new version of the native component during page loading. Centralized entry management includes distributing and dynamically mounting native components through a unified logical address, and uniformly managing the release and update of components. For version iterations where the external interface of the native component changes, a path isolation release method is used to allocate an independent access address or a new module identifier to the new version of the native component, without overwriting the resources of the original version of the native component. Deprecation warning and automatic reporting code are embedded in the construction entry logic of the original version of the native component.

[0061] Furthermore, in a specific implementation, in the code asset lifecycle management device provided in the embodiments of the present invention, the version list generation module 14 is used to generate a dynamic version metadata list, which records the version identifier, access address and corresponding association information of each version of the native component; and sends the dynamic version metadata list to the consumer so that the consumer can determine the target version component from the dynamic version metadata list according to a preset strategy, and pull the target version component according to the access address recorded in the dynamic version metadata list.

[0062] Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the code asset lifecycle management method.

[0063] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above embodiments of the code asset lifecycle management method when running.

[0064] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0065] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the code asset lifecycle management method.

[0066] Embodiments of the present invention also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above embodiments of the code asset lifecycle management method.

[0067] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0068] The foregoing has provided a detailed description of a method, apparatus, device, and medium for full lifecycle management of code assets provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the protection scope of this invention.

Claims

1. A method for full lifecycle management of code assets, characterized in that, include: Use a front-end development framework to write business components, and then convert the written business components into native components; Register the native component with a tag, disable the isolation sandbox of the native component, and add a namespace prefix to the internal styles of the native component to complete the configuration and style isolation of the native component; Define a remote module federation packaging entry point and a content delivery network asynchronous loading packaging entry point for native components. When packaging, adopt the global variable export specification, encapsulate a unified loading function, and asynchronously pull native components from the content delivery network through the unified loading function. The update and distribution of native components are carried out by using path reuse and centralized entry management. New versions of native components are assigned independent access addresses or new module identifiers, and obsolescence warning and automatic reporting code is embedded in the original versions of native components. Generate a dynamic version metadata list that records native component information for each version, so that consumers can pull the corresponding target version components according to a preset strategy.

2. The method for full lifecycle management of code assets according to claim 1, characterized in that, Register the native component with a tag, disable the native component's isolation sandbox, and add namespace prefixes to the internal styles of the native component, including: Perform tag registration for native components. During the registration process, activate singleton control and anti-duplicate registration mechanism, check the tag registration status of native components, and terminate the registration process if the tag has been registered. If the tag has not been registered, complete the tag registration. Disable the isolation sandbox of native components to allow them to access the global style environment of the host application; add corresponding namespace prefixes to the internal styles of native components during the component construction phase to distinguish the styles of native components from those of the host application through the namespace prefixes.

3. The method for full lifecycle management of code assets according to claim 1, characterized in that, Define remote module federation packaging entry points and content delivery network asynchronous loading packaging entry points for native components, and adopt global variable export specifications during packaging, including: A single build configuration file is used to synchronously define a remote module federation packaging entry point for native components that adapts to modern host projects, and an asynchronous loading packaging entry point for content delivery networks that adapts to non-modular or legacy projects. When building and packaging native components, the global variable export specification is adopted, and the module descriptor of the native component is exported as a named global variable to ensure compatibility with different build tools and browser runtime environments.

4. The method for full lifecycle management of code assets according to claim 3, characterized in that, A unified loading function is encapsulated, through which native components are asynchronously fetched from the content delivery network, including: A unified loading function is encapsulated based on the remote module federated packaging entry and the content delivery network asynchronous loading packaging entry, and the component module mapping relationship and asynchronous encapsulation logic are configured in the unified loading function; When the host application triggers a loading action, the corresponding native components are asynchronously pulled from the content delivery network through dynamic script injection or asynchronous import mechanisms.

5. The method for full lifecycle management of code assets according to claim 1, characterized in that, Native component updates and distribution are implemented using path reuse and centralized entry point management. New versions of native components are assigned independent access addresses or entirely new module identifiers. Deprecation warning and automatic reporting code is embedded in existing versions of native components, including: Native components are updated and distributed using path reuse and centralized entry point management. Path reuse is applied to compatibility upgrades where the external interfaces of native components remain unchanged. An overlay-style update distribution mode pushes verified compatibility code artifacts to a designated logical address, enabling consumers to dynamically mount components based on the designated logical address and obtain the new version of the native component during page loading. Centralized entry point management includes distributing and dynamically mounting native components through a unified logical address, and uniformly controlling the release and updates of components. For version iterations where the external interfaces of native components have changed, a path isolation release method is used to assign independent access addresses or new module identifiers to the new version of the native component, without overwriting the resources of the original version of the native component; We've embedded deprecation warning and automatic reporting code into the build entry logic of the original native components.

6. The method for full lifecycle management of code assets according to claim 5, characterized in that, After embedding the obsolescence warning and automatic reporting code, it also includes: During runtime, the embedded code identifies the runtime environment of the host application. When the identified environment type is a production environment, the warning output is turned off and the usage data of the original version of the component is reported in the production environment by the embedded code. When the identified environment type is a development environment or a testing environment, an alert is triggered by the embedded code in the development environment or testing environment, displaying component upgrade instructions and new version path information.

7. The method for full lifecycle management of code assets according to claim 1, characterized in that, Generate a dynamic version metadata list that records native component information for each version, so that consumers can pull the corresponding target version components according to a preset strategy, including: Generate a dynamic version metadata list, which records the version identifier, access address and corresponding association information of each version of the native component; The dynamic version metadata list is sent to the consumer so that the consumer can determine the target version component from the dynamic version metadata list according to a preset strategy and retrieve the target version component according to the access address recorded in the dynamic version metadata list.

8. A device for managing the entire lifecycle of code assets, characterized in that, include: The component writing and conversion module is used to write business components using a front-end development framework and convert the written business components into native components. The component configuration isolation module is used to register tags for native components, disable the isolation sandbox of native components, and add namespace prefixes to the internal styles of native components to complete the configuration and style isolation of native components; The asynchronous component loading module is used to define the remote module federation packaging entry and the content delivery network asynchronous loading packaging entry for native components. During packaging, it adopts the global variable export specification, encapsulates a unified loading function, and asynchronously pulls native components from the content delivery network through the unified loading function. The component hierarchical governance module is used to update and distribute native components by using path reuse and centralized entry management. It assigns independent access addresses or new module identifiers to new versions of native components and embeds obsolete warning and automatic reporting code into existing versions of native components. The version manifest generation module is used to generate a dynamic version metadata manifest that records the native component information of each version, so that consumers can pull the corresponding target version components according to a preset strategy.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the code asset lifecycle management method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the code asset lifecycle management method as described in any one of claims 1 to 7.