Updating method and device of front-end framework, equipment and storage medium

By identifying the ecosystem dependency packages of the Vue framework and generating an AST, performing code transformation and multi-level verification, the problems of dependency incompatibility and low automation during the migration from Vue2 to Vue3 are solved, achieving efficient and stable framework upgrades.

CN121934864APending Publication Date: 2026-04-28CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING CHANGAN AUTOMOBILE CO LTD
Filing Date
2026-03-19
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The migration process from Vue2 to Vue3 suffers from issues such as dependency incompatibility, incomplete syntax conversion, and low automation, which affect upgrade efficiency and system stability, especially in complex projects where a lot of manual intervention is required.

Method used

By determining the recursive relationships between various dependency packages in the Vue framework, identifying ecosystem dependency packages, and generating an abstract syntax tree (AST) based on preset conditions, code transformation and multi-level validation are performed to ensure that the syntax, semantics, and style conform to the Vue3 specification, and new source code files are generated.

Benefits of technology

It achieves a smooth upgrade of the Vue framework from Vue2 to Vue3, reduces the manual screening process, improves upgrade efficiency and accuracy, and ensures the readability and runtime stability of the generated code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121934864A_ABST
    Figure CN121934864A_ABST
Patent Text Reader

Abstract

The invention relates to a front-end framework updating method and device, equipment and a storage medium. The method is applied to a Vue framework. Comprising the following steps: determining an ecological dependency packet from dependency data packets according to a preset recursive relationship among the dependency data packets in a Vue framework; the dependency data packet represents a data packet of a project application in the Vue framework, and the ecological dependency packet represents a dependency data packet belonging to the Vue framework; if the ecological dependency package meets a preset condition, generating a first AST of the ecological dependency package according to a source code file of the first framework; the first framework represents a Vue framework before updating, the first AST represents an abstract syntax tree of the ecological dependency packet in the first framework, and the source code file comprises code information corresponding to each dependency data packet; according to the first AST of the ecological dependency package, obtaining code information of the ecological dependency package in a second framework; the second framework represents the updated Vue framework; and determining a source code file of the second framework according to the code information of each ecological dependency package in the second framework.
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 specifically to a method, apparatus, device, and storage medium for updating a front-end framework. Background Technology

[0002] With the rapid development of front-end technology, Vue (view) framework, as one of the mainstream JavaScript frameworks, has been widely used in the development of various Web (World Wide Web) applications.

[0003] Vue2 and Vue3 differ significantly in their architecture, reactivity mechanism, and API (Application Programming Interface) paradigm. Upgrading from Vue2 to Vue3 can lead to issues such as incompatible dependency ecosystems, incomplete syntax conversion, and low automation, which can affect upgrade efficiency and system stability. Summary of the Invention

[0004] The purpose of this invention is to provide a method, apparatus, device, and storage medium for updating a front-end framework, so as to improve the efficiency and accuracy of front-end framework upgrades.

[0005] In a first aspect, the present invention provides a method for updating a front-end framework, which is applied to a view-based Vue front-end framework; the method includes:

[0006] Based on the pre-defined recursive relationship between the dependency packages in the Vue front-end framework, the ecosystem dependency packages are determined from each dependency package; wherein, the dependency package represents the package of the project application in the Vue front-end framework, and the ecosystem dependency package represents the dependency package belonging to the Vue front-end framework;

[0007] If it is determined that the ecological dependency package meets the preset conditions, then the first AST of the ecological dependency package is generated according to the source code file of the first framework; wherein, the first framework represents the Vue framework before the update, the first AST represents the abstract syntax tree of the ecological dependency package in the first framework, and the source code file includes the code information corresponding to each dependency data package.

[0008] Based on the first AST of the ecosystem dependency package, the code information of the ecosystem dependency package in the second framework is obtained; wherein, the second framework represents the updated Vue framework;

[0009] Based on the code information of each of the aforementioned ecological dependency packages in the second framework, the source code files of the second framework are determined.

[0010] Secondly, the present invention provides a front-end framework update device, which is applied to a Vue view front-end framework; the device includes:

[0011] The dependency package identification unit is used to determine the ecosystem dependency package from each dependency package according to the preset recursive relationship between each dependency package in the Vue front-end framework; wherein, the dependency package represents the package of the project application in the Vue front-end framework, and the ecosystem dependency package represents the dependency package belonging to the Vue front-end framework.

[0012] An AST generation unit is used to generate a first AST of the ecological dependency package based on the source code file of the first framework if it is determined that the ecological dependency package meets the preset conditions; wherein, the first framework represents the Vue framework before the update, the first AST represents the abstract syntax tree of the ecological dependency package in the first framework, and the source code file includes code information corresponding to each dependency package.

[0013] The code determination unit is used to obtain the code information of the ecological dependency package in the second framework based on the first AST of the ecological dependency package; wherein, the second framework represents the updated Vue framework;

[0014] The framework update unit is used to determine the source code file of the second framework based on the code information of each of the ecological dependency packages in the second framework.

[0015] Thirdly, the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0016] The memory stores computer-executed instructions;

[0017] The processor executes computer execution instructions stored in the memory to implement the method as described in the first aspect.

[0018] Fourthly, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect.

[0019] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0020] This invention provides a method, apparatus, device, and storage medium for updating a front-end framework, applicable to Vue framework upgrade scenarios. By determining the recursive relationships between dependency data packages in the Vue framework, the ecosystem dependency packages belonging to the Vue framework can be identified sequentially from each dependency data package. It is then determined whether the ecosystem dependency packages meet preset conditions. If so, the ecosystem dependency packages need to be converted into an abstract syntax tree (AST) based on the source code of the Vue framework before the upgrade. This AST is then further transformed to obtain new code information for the ecosystem dependency packages. Based on this new code information, new source code files are generated, thus completing the process of updating the Vue framework from the first framework to the second. By searching for dependency packages through recursion, the ecosystem dependency packages can be automatically identified, reducing the manual screening process. Through code and AST conversion, a smooth upgrade between the two framework versions is achieved, saving manpower and time, and improving the efficiency and accuracy of framework updates. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0022] Figure 1 A flowchart illustrating a front-end framework update method provided in an embodiment of the present invention;

[0023] Figure 2 A flowchart illustrating the code verification process provided in this embodiment of the invention;

[0024] Figure 3 A flowchart illustrating a front-end framework update method provided in an embodiment of the present invention;

[0025] Figure 4 A schematic diagram illustrating the generation process of the first AST provided in an embodiment of the present invention;

[0026] Figure 5 A flowchart illustrating a front-end framework update method provided in an embodiment of the present invention;

[0027] Figure 6 A structural block diagram of a front-end framework update device provided in an embodiment of the present invention;

[0028] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present invention;

[0029] Figure 8 This is a structural block diagram of an electronic device provided in an embodiment of the present invention.

[0030] The accompanying drawings illustrate specific embodiments of the invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0031] The embodiments of the present invention will be described below with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention and not for limiting the scope of protection of the present invention.

[0032] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0033] In the description of this invention, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances. Furthermore, in the description of this invention, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0034] It should be noted that, due to space limitations, this specification does not exhaustively list all possible implementation methods. Those skilled in the art, after reading this specification, should be able to deduce that any combination of technical features can constitute an optional implementation method, provided that the technical features do not contradict each other. The following provides a detailed description of each embodiment.

[0035] Vue2 is a mature and stable older version of the Vue framework, while Vue3 is a more advanced and higher-performing new version. Vue2 and Vue3 differ significantly in their architectural design, reactivity mechanism, and API paradigm. Vue3 implements a reactive system based on a proxy and fully promotes a composable API, resulting in performance improvements and code organization optimization. Current mainstream upgrade methods in the industry include incremental migration and complete rewriting: incremental solutions achieve gradual replacement by allowing the Vue2 and Vue3 ecosystems to coexist, but this incurs runtime performance losses, increased memory usage, and compatibility issues; complete rewriting, while providing a thorough upgrade, is costly in terms of manpower and time, making it unsuitable for large-scale existing projects.

[0036] Currently, there are no effective solutions to problems such as dependency incompatibility, incomplete syntax conversion, and low automation during the migration of Vue2 projects to Vue3. Especially in complex projects, many third-party dependencies lack Vue3 support. Traditional tools only perform superficial syntax mapping and cannot guarantee the coordinated conversion of templates, scripts, and styles. This leads to functional abnormalities or the need for a lot of manual intervention after migration, which seriously affects upgrade efficiency and system stability.

[0037] The present invention provides a method, apparatus, device and storage medium for updating a front-end framework, which aims to solve the above-mentioned technical problems in the prior art.

[0038] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present invention will now be described with reference to the accompanying drawings.

[0039] Figure 1 This is a flowchart illustrating a front-end framework update method according to an embodiment of the present invention. This method can be executed by a front-end framework update device. The method is applied to the Vue front-end framework. Figure 1 As shown, the method includes the following steps:

[0040] S101. Based on the pre-defined recursive relationship between the dependency packages in the Vue front-end framework, determine the ecosystem dependency packages from each dependency package; whereby, the dependency package represents the package of the project application in the Vue front-end framework, and the ecosystem dependency package represents the dependency package belonging to the Vue front-end framework.

[0041] For example, in the Vue framework, a Vue project may depend on multiple packages. A Vue project can directly depend on multiple packages, and these directly dependent packages can in turn depend on other packages, which in turn depend on even more packages. This creates a recursive dependency relationship between the packages, and these recursively dependent packages are called dependent packages.

[0042] The process involves obtaining the recursive relationships between dependency packages. For example, the first-level dependency packages can be read from a pre-defined dependency configuration table. This table may include dependencies on the front-end main framework, front-end UI (User Interface) framework, utility functions, graphs, web environment, and Node environment. This step produces the names and installation version numbers of all first-level dependency packages. The Node environment refers to an environment that allows JavaScript code to run independently of a browser, either on a server or local computer. Based on the obtained names and installation version numbers of the first-level dependency packages, the process searches for folders within the Node package. These folders contain all installed dependency packages and their dependencies. The dependency configuration tables within each folder are then read. These tables also contain dependencies on the front-end main framework, front-end UI framework, utility functions, graphs, web environment, and Node environment, thus producing the names and version numbers of the dependency packages that the first-level dependency packages depend on. This process continues based on the newly generated dependency packages, determining the dependency packages with dependencies at the next level, until the final layer of dependency packages is identified, thus obtaining the pre-defined recursive relationships between all dependency packages. In this embodiment, a dependency tree or dependency graph can be used to represent the preset recursive relationship.

[0043] Based on the pre-defined recursive relationships between dependency packages, each dependency package can be sequentially filtered to identify one or more ecosystem dependency packages, thus avoiding misjudgments or omissions caused by relying solely on dependency declarations in package.json. Ecosystem dependency packages refer to dependency packages specific to the Vue front-end framework; for example, dependency packages with the "Vue" field in their names can be identified as ecosystem dependency packages. This process not only focuses on direct dependencies but also recursively resolves nested dependency levels, ensuring that subsequent processing focuses on the core components that actually participate in framework interactions.

[0044] S102. If it is determined that the ecological dependency package meets the preset conditions, the first AST of the ecological dependency package is generated according to the source code file of the first framework; wherein, the first framework represents the Vue framework before the update, the first AST represents the abstract syntax tree of the ecological dependency package in the first framework, and the source code file includes the code information corresponding to each dependency data package.

[0045] For example, after obtaining all the ecosystem dependency packages, for each ecosystem dependency package, it can be determined whether the ecosystem dependency package meets preset conditions. Preset conditions are used to determine whether an upgrade from Vue2 to Vue3 is needed for the ecosystem dependency package. In this embodiment, the first framework is the Vue2 framework, and the second framework is the Vue3 framework. For example, the preset condition could be identifying the version number of the ecosystem dependency package. If the version number is in the format of 3.x, then the current dependency is a Vue3 ecosystem dependency package, and the application can be directly obtained without additional upgrade processing; if the version number is in the format of 2.x, then the current dependency is a Vue2 ecosystem dependency package, which meets the preset condition and requires further processing. That is, the preset conditions can identify officially provided Vue3 ecosystem dependency versions and those not officially provided Vue3 ecosystem dependency versions.

[0046] For the pre-update Vue2 framework, the Vue2 source code files can be obtained. These files contain all of Vue2's code, including information about various dependency packages. After confirming that a specific dependency package meets predefined conditions, its code information (i.e., the pre-update code information) can be retrieved from the Vue2 source code files. Based on this pre-update Vue2 framework's code information, an Abstract Syntax Tree (AST) for that dependency package can be generated as the first AST. The AST is a formal representation of the source code's logical structure, accurately reflecting the relationships between modules such as templates, scripts, and styles.

[0047] Code conversion rules between code and AST can be preset. Based on these preset rules, the code information of ecosystem dependency packages is converted into a first AST. In this embodiment, the preset code conversion rules are not specifically limited.

[0048] S103. Based on the first AST of the ecosystem dependency package, obtain the code information of the ecosystem dependency package in the second framework; where the second framework represents the updated Vue framework.

[0049] For example, the first AST can include multiple nodes. By performing semantic analysis and rule mapping on the nodes in the first AST, the first AST can be converted into code information suitable for the second framework, namely the Vue3 framework. For instance, optional APIs in the first AST can be automatically refactored into composable APIs while maintaining the correct binding of data flow, lifecycle hooks, and scope styles.

[0050] In this embodiment, for each node of the first AST, based on the preset framework upgrade rules for the conversion from Vue2 to Vue3, the nodes in the first AST can be updated while maintaining the hierarchy between nodes, i.e., the tree structure of the first AST remains unchanged. After obtaining the updated AST, the updated AST is then converted into code form, which serves as the code information for the ecosystem dependency package in Vue3.

[0051] In this embodiment, the method further includes: if it is determined that the code information of each ecological dependency package in the second framework meets the preset verification rules, then the source code file of the second framework is determined according to the code information of each ecological dependency package in the second framework; wherein, the preset verification rules are used to verify at least one of the syntax, semantics, and format of the code information.

[0052] Specifically, pre-defined validation rules are in place to verify code information. After obtaining the code information of the ecosystem dependency packages in the second framework, a series of automated checks and evaluations need to be performed on this code information based on the pre-defined validation rules. Only when all checks pass the judgment criteria is it allowed to be included in the final source code file.

[0053] The core of validation is to ensure that the generated code meets production-grade standards in terms of syntax, style, and semantics. Specifically, the preset validation rules include, but are not limited to, the following three categories:

[0054] First, there's syntax compliance verification, which checks whether the generated code conforms to JavaScript / TypeScript and Vue3 template syntax specifications. For example, it checks whether reactive APIs like `ref()` and `reactive()` are correctly called within the `setup()` context; confirms that lifecycle hooks such as `onMounted` and `onUnmounted` are registered legally; and verifies... <script setup>`语法使用是否符合预设的推荐规则。也就是说,在语法合规性验证阶段,可以使用Vue3的编译器内核对生成代码进行静态分析,重点检查组合式API的调用规范性,例如验证ref、reactive等响应式API是否在正确的作用域内声明,生命周期钩子是否以函数形式正确注册,以及setup函数的返回对象是否包含模板引用的所有响应式变量,这一阶段直接关系到代码能否正常运行。

[0055] 二是语义完整性校验,旨在确保代码逻辑的一致性与正确性。典型场景包括:比对模板模块中引用的变量名称与脚本模块中导出的响应式数据是否存在匹配关系,防止出现未定义变量绑定;验证`v-model`修饰符的绑定路径是否指向有效的响应式引用;检查组件`props`声明与父级传递参数之间的类型和命名一致性;确认事件发射与监听机制在父子组件间的对接准确性。事件发射和监听机制属于父子组件之间的通信机制,父子组件是指一个组件中包含另一个组件,外层的组件为父组件,内层的组件即为子组件。对接准确性是指父子组件间的通信的准确性,根据对接准确性可以校验语义完整性。该类校验可通过构建抽象语法树并遍历节点间引用关系来实现跨模块语义关联分析。也就是说,语义完整性检查会进行跨模块的关联分析,它通过比对模板AST和脚本AST,确保模板中使用的每个变量都在setup中正确定义;同时验证指令参数的合法性,如检查v-for的迭代格式是否正确,v-model的绑定值是否有效。此外,还会确认样式作用域标识符是否在模板和样式中同步生成。只有通过所有这些校验的组件才会被确认为合格的迁移成果,最终输出符合企业级开发标准的Vue3单文件组件。

[0056] 三是格式规范化校验,用于统一代码风格,提升可读性与团队协作效率。具体涵盖缩进方式(空格或Tab)、引号使用(单引号或双引号)、分号结尾、行宽限制等编码规范。此类校验常依赖主流前端工程化工具链配置标准化规则集自动执行,并支持按项目需求灵活调整策略。也就是说,代码风格校验可以按照预设规则对生成的代码进行精细化调整,包括统一缩进为2个空格、强制使用单引号、自动补全或移除分号等,并对模板中的属性排序和换行进行标准化处理。这个过程不仅保证了代码风格的一致性,也显著提升了代码的可读性和可维护性。

[0057] 上述各类校验规则可独立运行,也可组合成流水线式质检流程。例如,先由TypeScript进行类型检查,再由ESLint执行语法规则扫描,最后通过Prettier统一格式化输出。任一环节失败即中断后续集成操作,并生成详细的错误报告提示开发者定位问题。

[0058] 此外,校验规则可根据实际应用场景进行动态配置。例如,在开发调试阶段可启用宽松模式仅记录警告,而在生产环境则切换为严格模式强制拦截所有违规项。同时,系统支持自定义扩展校验插件,允许企业根据内部编码规范添加专属检查逻辑,增强方案的适应性与可扩展性。

[0059] 图2为代码校验的流程示意图。代码的校验是通过多层级质量检查确保生成代码的规范性和可维护性。本实施例对语法、语义、风格等维度的检查顺序不做具体限定。例如,在得到Vue3的代码后,首先进行语法合规性验证,检查组合式API使用是否符合Vue3官方规范,包括setup函数结构、响应式API正确性及生命周期钩子使用。若校验不通过,则不进行后续校验;若校验通过,则接着执行代码风格校验,对缩进规则、引号使用、分号配置等格式细节进行自动化调整以符合项目约定。若校验不通过,则不进行后续校验;若校验通过,则最后进行语义完整性检查,确保模板与脚本间的数据绑定一致性、指令参数有效性及样式作用域匹配度,最终输出所有通过全部校验的标准化Vue3单文件组件,也就是代码信息。

[0060] 这样设置的有益效果在于,在自动化迁移过程中嵌入多层次、可配置的代码质量控制机制,通过对生态依赖包在第二框架中生成的代码信息实施全面校验,仅在满足语法、语义、风格等多维标准的前提下才触发源码文件的最终生成动作,显著提升了升级流程的可靠性与输出结果的工程可用性,确保输出代码具备良好的可读性、语法正确性和运行稳定性。

[0061] S104、根据各生态依赖包在第二框架中的代码信息,确定第二框架的源码文件。

[0062] 示例性地,每一个满足预设条件的生态依赖包都可以对应生成第二框架下的代码信息,整合所有转换后的代码信息,生成符合第二框架规范的完整源码文件,完成整体架构升级。对于不满足预设条件的生态依赖包,可以直接获取官方提供的依赖包信息,添加至第二框架的源码文件中;对于除生态依赖包之外的数据依赖包,可以不进行更新。也就是说,第二框架的完整的源码文件中可以包括满足预设条件的生态依赖包的代码信息、不满足预设条件的生态依赖包的代码信息、以及除生态依赖包之外的数据依赖包的代码信息。

[0063] 本实施例中,通过递归的依赖分析,能够精准筛选需处理的依赖包,减少无效操作,解决了传统方法中无法区分实际使用依赖与冗余依赖的问题,提升了升级过程的针对性与效率;利用AST中间表示实现语法层级的无损转换,保障语义一致性,克服了手工重写易出错、渐进迁移性能差的技术缺陷,实现了语法结构的高保真迁移;并通过集中式代码生成策略统一输出格式与结构,降低了人工干预需求与升级成本,提升迁移结果的可靠性与可维护性。

[0064] 本发明实施例提供一种前端框架的更新方法,可以应用于Vue框架的升级场景中。通过确定Vue框架中各依赖数据包之间的递归关系,可以依次从各依赖数据包中确定出属于Vue框架的生态依赖包。判断生态依赖包是否满足预设条件,若是,则需要根据升级前的Vue框架的源码,将生态依赖包转换为抽象语法树的形式。再对该抽象语法树进行转换,得到生态依赖包的新的代码信息,从而根据新的代码信息,生成新的源码文件,即完成Vue框架从第一框架更新到第二框架的过程。通过递归关系进行依赖包的查找,可以自动确定出其中的生态依赖包,减少人工筛选的过程,通过进行代码和AST的转换,实现两种版本框架的丝滑升级,节约人力和时间,提高框架更新的效率和精度。

[0065] 图3为本发明实施例提供的一种前端框架的更新方法的流程示意图,该实施例是在上述实施例基础上的可选实施例。

[0066] 本实施例中,根据第一框架的源码文件,生成生态依赖包的第一AST,包括:从第一框架的源码文件中确定生态依赖包的代码信息;对生态依赖包的代码信息进行字符串扫描,得到生态依赖包的代码信息中的子模块;其中,子模块包括模板模块、脚本模块、以及样式模块中的至少一项;基于与各子模块对应的预设解析器,得到生态依赖包的第一AST。

[0067] 如图3所示,该方法包括以下步骤:

[0068] S301、根据Vue前端框架中各依赖数据包之间的预设递归关系,从各依赖数据包中确定生态依赖包;其中,依赖数据包表征Vue前端框架中的项目应用的数据包,生态依赖包表征属于Vue前端框架的依赖数据包。

[0069] 示例性地,本步骤可以参见上述步骤S101,不再赘述。

[0070] S302、若确定生态依赖包满足预设条件,则从第一框架的源码文件中确定生态依赖包的代码信息。

[0071] 示例性地,对于每一个生态依赖包,判断生态依赖包是否满足预设条件,若是,则可以从第一框架的源码文件中确定该生态依赖包的代码信息,即,从Vue2的源码中确定生态依赖包的相关代码。

[0072] 本实施例中,确定生态依赖包满足预设条件,包括:获取生态依赖包对应的目标版本数据包;其中,目标版本数据包表征到当前时刻为止最新版本的生态依赖包;根据生态依赖包对应的目标版本数据包,确定生态依赖包是否满足预设条件。

[0073] 具体的,对于每一个生态依赖包,获取生态依赖包的最新版本号,将最新版本号的数据包作为目标版本数据包。例如,可以通过调用公共包管理平台提供的元数据接口,查询某一特定名称的生态依赖包在注册中心所发布的所有版本记录,并从中提取出版本号最高的一个发布版本作为目标版本数据包。该目标版本数据包中不仅包含代码内容,还可以包括其自身的`package.json`文件,声明了对Vue框架的版本依赖关系。获取过程可通过HTTPS(Hypertext Transfer Protocol Secure,超文本传输安全协议)请求完成,响应数据通常以JSON格式返回,包含版本列表、发布时间、维护状态、作者信息等元数据。

[0074] 根据目标版本数据包的元数据,可以确定生态依赖包是否满足预设条件,例如,解析目标版本数据包的`package.json`文件,重点检查其对Vue核心库的版本约束是否覆盖Vue3范围,即,版本号是否为3.x,若是,则认为该依赖已适配Vue3,不需要再进行代码更改,即不满足预设条件;反之,若仅支持2.x的版本或未明确声明,则满足预设条件。

[0075] 先获取目标版本数据包,再基于其内容进行条件判断,判断结果作为是否启动AST生成与代码转换的前提条件,直接影响后续步骤的执行。

[0076] 这样设置的有益效果在于,实现了对前端生态依赖最新状态的动态感知,能够自动识别并采纳已支持Vue3的最新版本依赖包,有效提升了升级流程的自动化程度与准确性,降低了因版本错配导致的项目中断风险,增强了整体方案的鲁棒性和工程适用性。

[0077] 本实施例中,对于存在Vue3版本的依赖包,保留目标版本数据包,将项目的依赖配置表中对应的版本号更改为当前最新的版本号,保存变更后的名称和版本号到数据存储服务中。对于不存在Vue3版本的依赖包,升级回退,重新安装之前版本号的生态依赖包,即不保留目标版本数据包,保留Vue2框架中的生态依赖包,并提取该生态依赖包的文件包到预设的外部插件库文件夹中。即,存在Vue3版本的生态依赖包均升级版本,不存在Vue3版本的生态依赖包均提升依赖文件包到外部插件库文件夹中。

[0078] 也就是说,通过预设条件对Vue的生态依赖包进行版本兼容性鉴定,具体实施流程如下:首先通过查询官方仓库的元数据接口,批量获取每个生态依赖包的最新可用版本信息;随后使用包管理工具的下载功能,将各生态依赖包的最新版本暂存至临时目录,并解析其包配置文件中的依赖声明关系;重点检查每个生态依赖包对Vue框架的版本约束条件,通过分析依赖配置中声明的Vue版本范围,精确判断该依赖包与Vue3的兼容性状态;最终根据兼容性验证结果,可以将生态依赖包分类为官方支持Vue3的兼容版本、需要升级适配的过渡版本以及完全不兼容Vue3的遗留版本等,并生成详细的版本兼容性报告,为后续制定差异化的升级策略提供决策依据。

[0079] 对已确认兼容Vue3的生态依赖包执行版本升级操作。例如,可以筛选出所有官方支持Vue3的生态依赖包,通过包管理工具的版本更新命令,将这些依赖包的版本号批量更新至已验证兼容的最新版本,更新完成后,同步修改项目根目录下包配置文件中的对应依赖版本声明,确保版本约束条件与实际安装版本保持一致;同时建立变更记录追踪机制,详细记录每个升级操作的依赖名称、原版本号、新版本号以及升级时间戳等元数据;最后将这些变更信息持久化存储至数据管理服务中,形成完整的依赖升级审计日志,为后续的版本回滚和问题排查提供数据支持。

[0080] 对不兼容Vue3的生态依赖包执行版本回退操作。例如,可以筛选出所有官方未提供Vue3支持版本的生态依赖包,立即终止当前正在进行的版本升级流程,并启动版本回退机制,通过包管理工具的版本锁定功能,将这些依赖包的版本号精确恢复到升级前的状态;回退过程中可以同步校验依赖包的完整性,确保重新安装的版本与项目原有代码保持完全兼容;同时建立回退操作记录,详细记录每个回退依赖的名称、目标版本号以及回退原因分析;最后将这些回退信息同步更新至项目配置文件和数据管理服务,确保整个依赖包的状态与升级前保持一致,为后续采用替代方案提供稳定的基础环境。

[0081] 将不兼容Vue3的生态依赖包从Node包管理体系中剥离,转化为项目内部的本地化插件。例如,针对已确认不兼容Vue3的生态依赖包,提取代码信息,包括所有运行时必需的资源文件;随后在项目源码目录下创建独立的外部插件库文件夹,将提取的代码信息作为依赖文件包完整迁移至该文件夹;完成文件迁移后,通过包管理工具从项目的配置文件中移除对该生态依赖包的声明,详细记录此次变更的依赖名称、迁移路径、版本信息以及变更类型,并将这些元数据持久化存储至数据管理服务,形成完整的依赖本地化改造记录。

[0082] 本实施例中,每完成递归关系中一个层级的生态依赖包的识别,就将该层级中满足预设条件的生态依赖包进行本地化处理,再依据递归关系,将本地化处理的生态依赖包作为起点,重新进行递归关系的循环。对于新发现的Vue3兼容的生态依赖包,执行版本升级并更新其元数据信息;对于仍不兼容的生态依赖包,则继续执行本地化提取。通过这种层层递进的递归分析策略,确保项目直接或间接依赖的所有包都得到妥善处理,最终确定出完全兼容Vue3的所有生态依赖包和不兼容的所有本地化的生态依赖包,避免后续对生态依赖包的处理出现遗漏。

[0083] 本实施例中,根据生态依赖包对应的目标版本数据包,确定生态依赖包是否满足预设条件,包括:若生态依赖包对应的目标版本数据包的标识信息中包括预设的第一标识,则确定生态依赖包满足预设条件;若生态依赖包对应的目标版本数据包的标识信息中包括预设的第二标识,则确定生态依赖包不满足预设条件。

[0084] 具体的,每个数据包对应有自己的标识信息,通过分析目标版本数据包的元数据等标识信息,可以快速判断其是否适配更新后的前端框架环境。目标版本数据包是指截至当前时间点所发布的最新版本的生态依赖包,标识信息通常体现在版本标签、发布说明、package.json中的关键词字段、自定义标记字段或版本号命名规则中。

[0085] 预设的第一标识可以是表征第一框架的标识,预设的第二标识可以是表征第二框架的标识。例如,第一标识可以是2.1、2.1、2.3等2.x的形式,第二标识可以是3.1、3.1、3.3等3.x的形式。当检测到生态依赖包对应的目标版本数据包的标识信息中包括2.x形式的标识,则认为生态依赖包满足预设条件;当检测到生态依赖包对应的目标版本数据包的标识信息中包括3.x形式的标识,则认为生态依赖包不满足预设条件。

[0086] 对于未包含第一标识和第二标识的依赖包,系统可默认将该依赖包进入待定队列,触发更深层次的源码分析或人工评审流程,形成分级处理机制。

[0087] 这样设置的有益效果在于,在不深入解析源码的前提下,利用生态依赖包自身携带的元数据标识信息,快速区分其是否具备向Vue3迁移的基础条件,减少了不必要的网络请求和本地存储开销,提升依赖兼容性识别效率、降低无效处理成本、增强系统自动化决策能力。

[0088] 每个生态依赖包对应有自己的代码信息,不同版本的代码信息可以不同,第一框架的源码文件中可以包括所应用的版本的代码信息,从而可以从源码文件中获取生态依赖包的代码信息。第一框架的源码文件中也可以包括生态依赖包的代码信息的引入位置,从而从该引入位置处获取代码信息。即,可以定位生态依赖包在项目目录结构中的物理路径,读取对应源码文件的内容。源码文件以文本形式加载至内存,保留原始字符编码与格式信息,确保后续解析过程中语义的完整性不受破坏。例如,在Vue前端框架中,典型生态依赖包可能表现为.vue文件。

[0089] S303、对生态依赖包的代码信息进行字符串扫描,得到生态依赖包的代码信息中的子模块;其中,子模块包括模板模块、脚本模块、以及样式模块中的至少一项。

[0090] 示例性地,以二进制流形式读取.vue文件,解码为完整文本字符串,对生态依赖包的代码信息进行字符串扫描,以识别并分离出模板模块、脚本模块和样式模块等子模块。扫描过程可以采用状态机驱动的词法分析方法,结合正则表达式匹配标签边界,适用于多种语言变体。具体而言,系统初始化一个读取指针,逐字符遍历源码字符串,根据当前上下文状态判断是否进入特定模块的区域。例如,当检测到`<template>`起始标签时,切换至"模板模块”,持续收集内容直至遇到闭合标签`< / template>`;同理处理`<script>`与`<style>`区块,`<script>`所对应的区域为脚本模块,`<style>`对应的区域为样式模块,实现对子模块的分割。模板模块被编译为渲染函数,脚本模块经转译生成组件逻辑,样式模块则根据语言和作用域配置进行转换封装。

[0091] 本实施例中,针对SFC(Single-FtFile Component,单文件组件),还可以识别组件名称、混入配置、继承链等元数据,为向define Component和组合式API的转换提供结构基础。具体的,对于属性接口,分析验证props定义格式,识别类型验证规则和默认值设置;对于事件接口,解析遍历$emit调用点,建立事件名与载荷数据的映射关系;对于插槽系统,检测分析具名插槽和作用域插槽的使用模式,识别slot和slot-scope等过时语法。还可以检查v-model双向绑定和.sync修饰符的组件实现,确保后续转换后的代码信息符合Vue3的通信协议。还可以重点处理Vue3中变更的实例API,通过数据流追踪识别this.$parent、this.$children等层级访问模式,转换为新的上下文API;分析$refs的使用场景,适配组合式API中的ref引用机制;检查$attrs和$listeners的透传逻辑,映射为Vue3的统一属性处理。还可以建立钩子函数映射表,确保created、beforeDestroy等钩子正确转换为新版本等效实现。分析过程采用增量扫描策略,通过递归关系确定组件转换顺序,确保基础组件优先处理。最终生成组件级转换清单,包含每个文件的详细迁移方案和依赖影响评估结果,为系统化重构提供精准指导。

[0092] S304、基于与各子模块对应的预设解析器,得到生态依赖包的第一AST。

[0093] 示例性地,每个子模块对应有自己的预设解析器,根据预设的解析器,对子模块进行针对性解析,结合各子模块的解析结果,得到生态依赖包的第一AST。每个预设解析器专用于处理特定类型的代码模块,具备对语法规则的深度理解能力。本实施例中,对解析器的选用不做具体限定。三类解析结果在语义层面保持关联,共同构成完整的AST。

[0094] 通过分阶段、模块化的处理流程,实现对前端框架中生态依赖包源码的结构化解析。核心在于将SFC这一混合式代码单元解耦为独立逻辑模块,并针对不同语法域采用专用解析策略,从而提升AST生成的准确性与可操作性。

[0095] 本实施例中,基于与各子模块对应的预设解析器,得到生态依赖包的第一AST,包括:基于预设的第一解析器,对模板模块进行解析处理,得到模板模块的模板AST;其中,模板AST用于描述文档对象模型DOM结构;基于预设的第二解析器,对脚本模块进行解析处理,得到脚本模块的组件配置对象;其中,组件配置对象包括组件的数据、方法、以及生命周期逻辑中的至少一项;基于预设的第三解析器,对样式模块进行解析处理,得到样式模块的样式信息;其中,样式信息表征样式作用域规则;根据模板AST、组件配置对象、以及样式信息,得到生态依赖包的第一AST。

[0096] 具体的,第一解析器用于处理模板模块,即`.vue`文件中的`<template>`区块,其功能是将HTML-like模板语言转换为描述页面结构的抽象语法树。该解析过程基于词法与语法分析技术,识别标签嵌套关系、指令(如`v-if`、`v-for`)、插值表达式(`{{}}`)等语法单元,并构建出反映DOM(Document Object Model,文档对象模型)层级结构的模板AST。该模板AST不仅记录节点类型和属性,还保留了绑定表达式的变量引用信息,为后续API范式转换提供上下文支持。例如,在一个包含条件渲染与列表循环的组件中,第一解析器可准确识别`v-show="isVisible"`对应的控制逻辑变量,并在AST中建立指向脚本模块中`data`字段的潜在关联路径。

[0097] 模板模块的解析阶段采用基于正则表达式与语法解析器混合的解析策略:首先通过HTML(Hyper Text Markup Language,超文本标记语言)解析器构建模板的DOM结构树,同时使用Vue指令解析器识别特殊的模板语法结构。针对过滤器语法,解析器建立管道操作符的调用链图,记录过滤器的名称、参数和嵌套关系。特性语法识别采用多模式匹配算法:对于指令系统,重点检测.sync修饰符、.native事件修饰符等Vue2特有语法;针对动态组件,分析is属性的绑定表达式类型和组件解析逻辑;对于属性绑定,识别v-bind="object"的对象合并语法及其与普通属性的优先级关系,同时检测v-for与v-if的优先级差异、key Code事件修饰符等行为特性。

[0098] 第二解析器负责解析脚本模块,即`<script>`区块内的JavaScript / TypeScript代码,目标是从选项式API结构中提取组件的核心逻辑单元。该解析器通过静态分析手段识别`data`、`methods`、`computed`、`watch`及生命周期钩子(如`mounted`、`created`)等配置项,形成结构化的组件配置对象。此对象作为业务逻辑的载体,承载了组件的状态管理、行为定义与响应式机制初始化信息。在具体实现中,第二解析器可结合ESLint-like工具链完成语法树遍历,识别函数声明、变量定义及API调用模式,从而判断是否存在已被Vue3废弃的API(如`beforeDestroy`),并在配置对象中标注风险标记。

[0099] 第三解析器专用于处理样式模块,即`<style>`区块的内容,重点在于捕获样式作用域规则。对于带有`scoped`属性的样式模块,第三解析器需解析选择器并提取其作用域标识符(通常为哈希值前缀),确保每个CSS(Cascading Style Sheets,层叠样式表)规则仅应用于当前组件内部元素。该解析过程涉及CSS词法切分、选择器匹配与属性提取,最终生成包含原始样式文本及其作用域配置的样式信息结构。例如,对于一条规则`.btn{color:red;}`,若其位于`scoped`样式模块中,则第三解析器会将其转换为`.btn[data-v-f382a]{color:red;}`的形式,并将映射关系记录于输出信息中。此外,支持`lang="scss"`或`lang="less"`的扩展语法也是该解析器的能力之一,可通过集成外部编译器预处理器实现对嵌套规则、变量声明等功能的支持。

[0100] 本实施例通过精细化的文件解析和处理流水线实现组件解构,文件读取与解码阶段采用流式处理机制:通过Node.js的fs.createReadStream创建可读流,使用UTF-8编码逐块读取.vue文件内容,通过缓冲区合并机制重构完整文件字符串。处理过程中包含编码自动检测和BOM(Byte Order Mark,字节顺序标记)头清除,确保文本内容的准确性。结构化解析引擎基于状态机模型实现:解析器维护标签栈和上下文状态,通过正则表达式匹配标签开闭模式,精准识别<template>、<script>、<style>的边界位置。针对嵌套标签和注释内容采用特殊处理策略,避免误解析。同时提取每个标签的属性键值对,如lang="ts"、scoped等配置信息。内容提取与规范化采用语义化切片技术:对template内容保留原始缩进格式,处理包含插值表达式的动态内容;对script内容执行JavaScript语法验证,处理ES模块导入导出语句;对style内容进行CSS语法检查,支持Sass、Less等预处理器语法识别。建立各子模块间的依赖关系图,如style中scoped属性与template的关联性。多流水线并行处理采用工作队列模式:模板流水线通过Vue模板编译器将HTML转换为渲染函数,处理指令系统和组件引用;脚本流水线通过Babel转译器处理ES6+语法和TypeScript类型注解,生成标准化ES模块;样式流水线根据lang属性调用对应预处理器,应用scoped属性哈希化处理,输出CSS模块。模块集成与输出通过资源描述符统一管理:生成包含源码映射信息的标准化模块对象,记录各区块的编译后内容、依赖关系和输出格式,为后续的AST转换阶段提供结构化的输入数据

[0101] 上述三种子模块的解析器并行工作,各自独立处理不同类型的语言模块,但在语义层面保持协同一致性。模板AST中的变量名需与组件配置对象中的`data`字段对应,而样式信息中的选择器应能正确匹配模板中定义的类名。这种分治式架构既提高了解析效率,又保证了各子模块语义完整性。最终,将三者输出的结果进行融合,构造出涵盖视图结构、逻辑配置与样式规则的统一AST结构,作为生态依赖包在原框架下的完整中间表示。例如,可以建立模板表达式与脚本数据项的映射关系,识别v-model的双向绑定逻辑,分析事件处理函数与methods方法的关联性。通过作用域分析将样式哈希标识注入对应模板节点,形成样式与内容的绑定关系。虚拟节点树生成阶段通过节点转换器统一节点格式,将模板模块的元素节点、指令节点、表达式节点与脚本模块中的数据引用、方法调用进行融合,生成包含类型、属性、子节点、绑定信息的完整的第一AST。

[0102] 图4为第一AST的生成过程示意图。图4中,模板模块通过HTML(HyperText MarkupLanguage,超文本标记语言)解析器得到模块AST,脚本模块通过JS解析器得到组件配置,样式模块通过样式解析器得到作用域规则,将模板AST与组件配置进行整合和绑定分析,再注入样式作用域规则,得到完整的虚拟节点树,也就是第一AST。

[0103] 这样设置的有益效果在于,对前端框架单文件组件的多维度提取,采用了针对不同语言特征定制的专用解析器,能够精准捕捉模板的DOM结构、脚本的逻辑配置以及样式的封装规则,因而解决了传统单一解析器难以兼顾多种语法特性的技术难题。通过保留样式作用域信息并与模板节点精确绑定,有效防止了组件间样式冲突问题,保障了转换后应用的视觉表现一致性。

[0104] 本实施例中,还包括:对生态依赖包的模板模块进行语法扫描处理,确定模板模块中的语法信息;若模板模块中的语法信息中包括预设的关键语法,则生成生态依赖包的风险报告;其中,风险报告用于提示用户进行人工校验。

[0105] 具体的,对生态依赖包的模板模块进行语法扫描处理,是指以文件流或字符串形式读取`.vue`单文件组件中的`<template>`区块内容,采用词法分析与语法解析相结合的技术手段,逐行解析模板中的指令、表达式、属性绑定及特殊标记。该扫描过程基于预设的规则库执行,规则库中预先配置了Vue2至Vue3版本演进过程中已被废弃、行为变更或推荐替换的关键语法,例如过滤器(filter)、`.sync`修饰符、`v-bind`对象合并语法、`slot-scope`作用域插槽、`is`动态组件绑定等。扫描器通过正则匹配、状态机识别或轻量级AST构建方式提取模板中的语法单元,并对其进行分类标注。

[0106] 进一步地,确定模板模块中的语法信息,是指将扫描结果结构化为包含语法类型、出现位置(如文件路径、行号、列数)、上下文环境(父节点、子元素、绑定方式)在内的语法信息。语法信息中可以记录有关键语法的存在与否,还可以反映关键语法的使用频率、嵌套深度和关联逻辑复杂度,为后续风险等级划分提供依据。

[0107] 当检测到模板模块中存在预设的关键语法时,可以自动生成生态依赖包的风险报告。该风险报告是一种结构化的诊断输出文档,通常以JSON、YAML或HTML格式呈现,内容至少包括:涉及的关键语法列表、对应源码位置、官方迁移建议、潜在影响说明(如渲染异常、响应式失效、事件绑定错误)、推荐处理策略(自动转换 / 手动重写 / 第三方替代方案)以及是否需要人工校验的明确提示。报告可通过命令行工具输出,也可集成至可视化界面中供团队协作审查。

[0108] 语法扫描处理可在不同粒度层级上执行,例如,既可以针对单个组件文件进行细粒度分析,也可对整个项目或依赖包批量扫描并聚合统计结果,生成全局风险热力图,辅助决策者评估整体迁移难度。

[0109] 此外,风险报告的生成可结合上下文语义增强判断准确性。例如,对于`.sync`修饰符的使用,若其绑定的是简单属性且未嵌套在复杂表达式中,则可判定为低风险并支持安全转换;而若出现在动态组件或高阶函数调用中,则标记为高风险并强制触发人工校验流程。

[0110] 本实施例中,还可以对生态依赖包进行风险等级的标记,例如,对于Vue3可兼容的生态依赖包,可以在风险报告标注为低风险;对于Vue3不兼容的生态依赖包,可以在风险报告标注为高风险。

[0111] 这样设置的有益效果在于,实现了在不修改源码的前提下,对前端框架升级过程中模板层潜在兼容性问题进行识别与分级预警,有效避免了因自动化转换导致的行为偏差或运行错误,提升了升级流程的透明度与可信度。

[0112] S305、根据生态依赖包的第一AST,得到生态依赖包在第二框架中的代码信息;其中,第二框架表征更新后的Vue框架。

[0113] 示例性地,提出了一种基于AST的语法范式转换机制,旨在实现从Vue2选项式API向Vue3组合式API的自动化、结构化迁移。例如,可以先将第一框架的AST映射为第二框架的AST,再将第二框架的AST转换为第二框架的代码信息。本实施例中,可以预设Vue2到Vue3的AST映射规则,实现对AST的自动映射。例如,将识别出的选项式结构系统性地转换为组合式API等效实现,data中的响应式数据转换为ref或reactive声明,methods中的函数提取为独立函数,computed和watch重新包装为对应的组合式函数,生命周期钩子映射为预设格式的函数调用。整个过程保持代码语义的严格等价性,确保转换后的行为一致性。

[0114] 本实施例中,根据生态依赖包的第一AST,得到生态依赖包在第二框架中的代码信息,包括:根据第一AST,基于预设的语法映射规则,确定生态依赖包的第二AST;其中,预设的语法映射规则用于将选项式API转换为组合式API,第二AST表征生态依赖包在第一框架的抽象语法树;根据第二AST,基于预设的代码生成器,生成生态依赖包在第二框架中的代码信息。

[0115] 具体的,第一AST是指基于Vue2源码生成的抽象语法树,其完整保留了原有代码的结构信息和语义关系,涵盖模板结构、脚本配置对象及样式作用域等维度。而第二AST则是指符合Vue3规范的抽象语法树,其节点类型、属性定义及组织方式均适配于Vue3运行时环境。二者之间通过预设的语法映射规则建立转换桥梁,该规则以声明式配置形式存在,包含但不限于API名称重命名策略、数据响应式机制替换逻辑、生命周期钩子对应关系、指令语法演变路径等内容。

[0116] 例如,在数据响应式层面,第一AST中`data`字段内的每个属性需被识别并映射为Vue3中的`ref`或`reactive`调用表达式,具体选择依据变量是否为基本类型或引用类型进行判断:若为字符串、数字等基础值,则转换为`const x=ref(initialValue)`;若为对象或数组,则转换为`const obj=reactive({})`。又如,对于`methods`中的函数成员,不再作为配置项注册,而是提取为独立的JavaScript函数,并确保其上下文绑定正确,以便在`setup`函数中直接调用或通过`return`暴露给模板使用。

[0117] 此外,生命周期钩子的转换也可以遵循明确的映射规则,如Vue2中的`mounted`对应Vue3中的`onMounted`,`beforeDestroy`转为`onBeforeUnmount`,并在转换过程中自动导入相应的Composition API函数。对于模板层涉及的特殊语法,如过滤器(filter)、`.sync`修饰符、`v-model`的多参数形式等,也通过第一AST节点遍历识别后,分别转换为函数调用、`v-model`双绑拆解或`useModel`模式等Vue3推荐写法。

[0118] 该语法映射过程采用递归遍历方式对第一AST进行深度优先扫描,针对每一类节点(如标识符、对象属性、函数调用、生命周期钩子等)应用匹配规则,生成新的节点结构并构建出完整的第二AST。整个转换过程保持AST层级结构稳定,仅调整节点类型与内部表达形式,确保语义连贯性和结构完整性。

[0119] 预设的代码生成器可以是一种可插拔的代码输出引擎,能够将标准化的第二AST还原为合法、可读、格式合规的Vue3源码文本。工作原理是遍历第二AST的每一个节点,按照预设的语法规则逐级拼接代码字符串,同时注入必要的导入语句,如自动添加`import{ref,reactive,onMounted}from'vue'`等依赖引入。本实施例中,对代码的生成过程不做具体限定。

[0120] 本实施例中,Vue3的SFC的整合与生成是一个系统性的代码重构过程,核心目标是将经过转换的抽象语法树序列化为符合新规范的文件格式。可以基于三个子模块的维度,来生成代码信息。

[0121] 例如,代码生成器深度遍历第二AST,根据每个节点的类型和属性信息重构出标准的模板模块。对于指令系统,代码生成器按照Vue3的新规范重新编写指令表达式,特别是对双向数据绑定指令进行针对性处理,根据使用场景差异生成对应的属性与事件组合。同时,代码生成器会确保所有在模板中使用的变量都与后续脚本部分暴露的响应式数据保持严格对应。然后,会从第二AST中提取所有组合式逻辑要素,构建完整的脚本模块。自动生成必要的应用程序编程接口导入语句,引入响应式引用、计算属性和生命周期函数等核心功能。接着,代码生成器会将原有的数据选项拆解为独立的响应式变量声明,将计算方法重构为计算函数调用,把原有的方法转化为标准函数定义,并将生命周期钩子映射到新的组合式应用程序编程接口函数,所有需要在模板中使用的变量和函数都会被组织并导出。最后,样式处理模块会完整保留原有的样式规则和作用域标识。如果存在作用域样式,生成器会在样式标签上添加相应的作用域属性,确保样式隔离机制能够正常工作。样式内容本身除必要的格式调整外,基本保持原样输出。得到Vue3框架下的三个子模块后,进行子模块的统一合成,从而将三个独立生成的子模块按照单文件组件标准格式进行组装。模板代码被包裹在专用标签内,脚本逻辑以标准语法形式封装,样式内容则保持原有的结构完整性。通过精确定位各模块的边界和衔接关系,最终输出符合Vue3工程规范的完整单文件组件,即得到代码信息。

[0122] 这样设置的有益效果在于,实现了从前端框架旧版本到新版本的核心语法范式的无损转换,采用了基于AST的中间表示与规则驱动的转换机制,避免了字符串替换带来的语义歧义风险,解决了传统迁移手段中存在的API不兼容、逻辑错乱、样式失效等问题,提高代码转换准确性、降低人工维护成本、保障系统稳定性与可维护性。

[0123] S306、根据各生态依赖包在第二框架中的代码信息,确定第二框架的源码文件。

[0124] 示例性地,本步骤可以参见上述步骤S104,不再赘述。

[0125] 本发明实施例提供一种前端框架的更新方法,可以应用于Vue框架的升级场景中。通过确定Vue框架中各依赖数据包之间的递归关系,可以依次从各依赖数据包中确定出属于Vue框架的生态依赖包。判断生态依赖包是否满足预设条件,若是,则需要根据升级前的Vue框架的源码,将生态依赖包转换为抽象语法树的形式。再对该抽象语法树进行转换,得到生态依赖包的新的代码信息,从而根据新的代码信息,生成新的源码文件,即完成Vue框架从第一框架更新到第二框架的过程。通过递归关系进行依赖包的查找,可以自动确定出其中的生态依赖包,减少人工筛选的过程,通过进行代码和AST的转换,实现两种版本框架的丝滑升级,节约人力和时间,提高框架更新的效率和精度。

[0126] 图5为本发明实施例提供的一种前端框架的更新方法的流程示意图,该实施例是在上述实施例基础上的可选实施例。

[0127] 本实施例中,根据Vue框架中各依赖数据包之间的预设递归关系,从各依赖数据包中确定生态依赖包,包括:根据Vue框架中各依赖数据包之间的预设递归关系,对各依赖数据包进行遍历处理,得到当前遍历到的依赖数据包;若当前遍历到的依赖数据包的标识信息中包括预设标识,则确定当前遍历到的依赖数据包为生态依赖包。

[0128] 如图5所示,该方法包括以下步骤:

[0129] S501、根据Vue框架中各依赖数据包之间的预设递归关系,对各依赖数据包进行遍历处理,得到当前遍历到的依赖数据包。

[0130] 示例性地,识别和筛选属于Vue生态体系的依赖数据包,获取各依赖数据包之间的预设递归关系,从而提升前端框架升级过程中对依赖管理的精准度与完整性。例如,可以基于项目中各依赖数据包之间存在的预设递归关系,构建完整的依赖图谱,并对该图谱执行深度优先或广度优先的遍历操作,逐层访问每一个被引用的依赖数据包的节点,确定出当前遍历到的依赖数据包。

[0131] S502、若当前遍历到的依赖数据包的标识信息中包括预设标识,则确定当前遍历到的依赖数据包为生态依赖包。

[0132] 示例性地,针对每个遍历到的依赖数据包,提取依赖数据包的标识信息,例如,标识信息中可以包括名称、版本标签、作者信息或仓库地址等。预先设置有预设标识,判断当前遍历到的依赖数据包的标识信息中是否含有预设标识。例如,预设标识可以是"vue”。若依赖数据包的标识信息中不含有预设标识,则确定该依赖数据包不是生态依赖包,不对该依赖数据包进行后续的升级处理;若当前遍历到的依赖数据包的标识信息中含有预设标识,则确定当前遍历到的依赖数据包为生态依赖包,需要执行后续的升级步骤。

[0133] 本实施例中,基于预设的递归关系可以穿透多层级的嵌套依赖链,识别出间接引入但仍属于Vue生态的生态依赖包,例如,可以识别出某些UI库内部依赖的`@vue / compiler-dom`或状态管理工具链中嵌套的`vue-router`。避免了传统方法仅分析顶层`package.json`而导致的漏判问题,确保所有与Vue运行时相关联的代码单元均能被有效捕获。

[0134] 本实施例中,还包括:根据当前遍历到的依赖数据包的标识信息,确定当前遍历到的依赖数据包在第一框架的源码文件中的位置信息;根据位置信息,从第一框架的源码文件中确定当前遍历到的依赖数据包的属性信息,并进行存储;其中,属性信息表征依赖数据包被使用的方法、值、组件和配置参数中的至少一项。

[0135] 具体的,依赖数据包被应用于源码中,例如,可以在源码的某一位置处标明依赖数据包的标识信息,表征在该位置处引入依赖数据包。基于依赖数据包的唯一标识信息(如包名、版本号等),在第一框架的源码文件中定位标识信息的引入位置,即得到依赖数据包的位置信息。可借助静态代码分析工具或自定义词法解析器实现位置信息的查找,支持多语言环境下的准确识别。

[0136] 在确定了依赖数据包在源码中的位置信息后,从对应源码片段中提取依赖数据包具体的属性信息,属性信息包括但不限于被调用的具体方法名称、传入的参数值类型与结构、作为组件标签在模板中使用的频次与属性配置、以及在初始化过程中涉及的配置参数等。这些属性信息构成该依赖数据包的实际"使用画像”。将依赖数据包和属性信息以结构化数据的形式进行持久化存储,便于后续分析调用。例如,对于一个名为`vue-router`的生态依赖包,可通过位置信息定位其在main.js中的引入语句及router / index.js中的路由定义逻辑,进而提取其是否使用了嵌套路由、动态路由匹配、导航守卫等高级特性,从而判断迁移时所需适配的功能范围。

[0137] 这样设置的有益效果在于,实现了对依赖数据包在源码层级的细粒度使用追踪,提升迁移精准性与风险可控性,为后续变更影响分析、API映射策略选择及人工复核优先级排序提供了可靠的数据基础。

[0138] S503、若确定生态依赖包满足预设条件,则根据第一框架的源码文件,生成生态依赖包的第一AST;其中,第一框架表征更新前的Vue框架,第一AST表征生态依赖包在第一框架的抽象语法树,源码文件中包括各依赖数据包对应的代码信息。

[0139] 示例性地,本步骤可以参见上述步骤S102,不再赘述。

[0140] S504、根据生态依赖包的第一AST,得到生态依赖包在第二框架中的代码信息;其中,第二框架表征更新后的Vue框架。

[0141] 示例性地,本步骤可以参见上述步骤S103,不再赘述。

[0142] S505、根据各生态依赖包在第二框架中的代码信息,确定第二框架的源码文件。

[0143] 示例性地,本步骤可以参见上述步骤S104,不再赘述。

[0144] 本发明实施例提供一种前端框架的更新方法,可以应用于Vue框架的升级场景中。通过确定Vue框架中各依赖数据包之间的递归关系,可以依次从各依赖数据包中确定出属于Vue框架的生态依赖包。判断生态依赖包是否满足预设条件,若是,则需要根据升级前的Vue框架的源码,将生态依赖包转换为抽象语法树的形式。再对该抽象语法树进行转换,得到生态依赖包的新的代码信息,从而根据新的代码信息,生成新的源码文件,即完成Vue框架从第一框架更新到第二框架的过程。通过递归关系进行依赖包的查找,可以自动确定出其中的生态依赖包,减少人工筛选的过程,通过进行代码和AST的转换,实现两种版本框架的丝滑升级,节约人力和时间,提高框架更新的效率和精度。

[0145] 图6为本发明实施例提供的一种前端框架的更新装置的结构框图。为了便于说明,仅示出了与本公开实施例相关的部分。该装置应用于Vue框架。参照图6,前端框架的更新装置600包括:依赖包识别单元601、AST生成单元602、代码确定单元603和框架更新单元604。

[0146] 依赖包识别单元601,用于根据Vue前端框架中各依赖数据包之间的预设递归关系,从各依赖数据包中确定生态依赖包;其中,依赖数据包表征Vue前端框架中的项目应用的数据包,生态依赖包表征属于Vue前端框架的依赖数据包;

[0147] AST生成单元602,用于若确定生态依赖包满足预设条件,则根据第一框架的源码文件,生成生态依赖包的第一AST;其中,第一框架表征更新前的Vue框架,第一AST表征生态依赖包在第一框架的抽象语法树,源码文件中包括各依赖数据包对应的代码信息;

[0148] 代码确定单元603,用于根据生态依赖包的第一AST,得到生态依赖包在第二框架中的代码信息;其中,第二框架表征更新后的Vue框架;

[0149] 框架更新单元604,用于根据各生态依赖包在第二框架中的代码信息,确定第二框架的源码文件。

[0150] 一个示例中,AST生成单元602,包括:

[0151] 目标获取模块,用于获取生态依赖包对应的目标版本数据包;其中,目标版本数据包表征到当前时刻为止最新版本的生态依赖包;

[0152] 条件判断模块,用于根据生态依赖包对应的目标版本数据包,确定生态依赖包是否满足预设条件。

[0153] 一个示例中,条件判断模块,具体用于:

[0154] 若生态依赖包对应的目标版本数据包的标识信息中包括预设的第一标识,则确定生态依赖包满足预设条件;

[0155] 若生态依赖包对应的目标版本数据包的标识信息中包括预设的第二标识,则确定生态依赖包不满足预设条件。

[0156] 一个示例中,AST生成单元602,包括:

[0157] 代码确定模块,用于从第一框架的源码文件中确定生态依赖包的代码信息;

[0158] 子模块确定模块,用于对生态依赖包的代码信息进行字符串扫描,得到生态依赖包的代码信息中的子模块;其中,子模块包括模板模块、脚本模块、以及样式模块中的至少一项;

[0159] AST确定模块,用于基于与各子模块对应的预设解析器,得到生态依赖包的第一AST。

[0160] 一个示例中,AST确定模块,具体用于:

[0161] 基于预设的第一解析器,对模板模块进行解析处理,得到模板模块的模板AST;其中,模板AST用于描述文档对象模型DOM结构;

[0162] 基于预设的第二解析器,对脚本模块进行解析处理,得到脚本模块的组件配置对象;其中,组件配置对象包括组件的数据、方法、以及生命周期逻辑中的至少一项;

[0163] 基于预设的第三解析器,对样式模块进行解析处理,得到样式模块的样式信息;其中,样式信息表征样式作用域规则;

[0164] 根据模板AST、组件配置对象、以及样式信息,得到生态依赖包的第一AST。

[0165] 一个示例中,还包括:

[0166] 模板扫描单元,用于对生态依赖包的模板模块进行语法扫描处理,确定模板模块中的语法信息;

[0167] 报告生成单元,用于若模板模块中的语法信息中包括预设的关键语法,则生成生态依赖包的风险报告;其中,风险报告用于提示用户进行人工校验。

[0168] 一个示例中,代码确定单元603,具体用于:

[0169] 根据第一AST,基于预设的语法映射规则,确定生态依赖包的第二AST;其中,预设的语法映射规则用于将选项式API转换为组合式API,第二AST表征生态依赖包在第一框架的抽象语法树;

[0170] 根据第二AST,基于预设的代码生成器,生成生态依赖包在第二框架中的代码信息。

[0171] 一个示例中,还包括:

[0172] 代码校验单元,用于若确定各生态依赖包在第二框架中的代码信息满足预设的校验规则,则执行根据各生态依赖包在第二框架中的代码信息,确定第二框架的源码文件;其中,预设的校验规则用于对代码信息的语法、语义、格式中的至少一项进行校验。

[0173] 一个示例中,依赖包识别单元601,包括:

[0174] 数据包遍历模块,用于根据Vue框架中各依赖数据包之间的预设递归关系,对各依赖数据包进行遍历处理,得到当前遍历到的依赖数据包;

[0175] 生态确定模块,用于若当前遍历到的依赖数据包的标识信息中包括预设标识,则确定当前遍历到的依赖数据包为生态依赖包。

[0176] 一个示例中,还包括:

[0177] 位置确定单元,用于根据当前遍历到的依赖数据包的标识信息,确定当前遍历到的依赖数据包在第一框架的源码文件中的位置信息;

[0178] 信息存储单元,用于根据位置信息,从第一框架的源码文件中确定当前遍历到的依赖数据包的属性信息,并进行存储;其中,属性信息表征依赖数据包被使用的方法、值、组件和配置参数中的至少一项。

[0179] 图7为本申请实施例提供的一种电子设备的结构框图,如图7所示,电子设备包括:存储器71,处理器72;存储器71,用于存储处理器72可执行指令的存储器。

[0180] 其中,处理器72被配置为执行如上述实施例提供的方法。

[0181] 电子设备还包括接收器73和发送器74。接收器73用于接收其他设备发送的指令和数据,发送器74用于向外部设备发送指令和数据。

[0182] 图8是根据一示例性实施例示出的一种电子设备的框图,该设备可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,个人数字助理,车辆等装置。

[0183] 该装置800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入 / 输出(I / O)接口812,传感器组件814,以及通信组件816。

[0184] 处理组件802通常控制装置800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。

[0185] 装置800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入 / 输出(I / O)接口812,传感器组件814,以及通信组件816。

[0186] 存储器804被配置为存储各种类型的数据以支持在装置800的操作。这些数据的示例包括用于在装置800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。

[0187] 电源组件806为装置800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为装置800生成、管理和分配电力相关联的组件。

[0188] 多媒体组件808包括在所述装置800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和 / 或后置摄像头。当装置800处于操作模式,如拍摄模式或视频模式时,前置摄像头和 / 或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。

[0189] 音频组件810被配置为输出和 / 或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当装置800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。

[0190] I / O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。

[0191] 传感器组件814包括一个或多个传感器,用于为装置800提供各个方面的状态评估。例如,传感器组件814可以检测到装置800的打开 / 关闭状态,组件的相对定位,例如组件为装置800的显示器和小键盘,传感器组件814还可以检测装置800或装置800一个组件的位置改变,用户与装置800接触的存在或不存在,装置800方位或加速 / 减速和装置800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。

[0192] 通信组件816被配置为便于装置800和其他设备之间有线或无线方式的通信。装置800可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。

[0193] 在示例性实施例中,装置800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。

[0194] 在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器804,上述指令可由装置800的处理器820执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。

[0195] 一种非临时性计算机可读存储介质,当该存储介质中的指令由电子设备的处理器执行时,使得电子设备能够执行上述前端框架的更新方法。

[0196] 本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求书指出。

[0197] 以上实施例仅是为充分说明本发明而所举的较佳的实施例,本发明的保护范围不限于此。本技术领域的技术人员在本发明基础上所作的等同替代或变换,均在本发明的保护范围之内。< / script>

Claims

1. A method for updating a front-end framework, characterized in that, The method is applied to the Vue front-end framework; the method includes: Based on the pre-defined recursive relationship between the dependency packages in the Vue front-end framework, the ecosystem dependency packages are determined from each dependency package; wherein, the dependency package represents the package of the project application in the Vue front-end framework, and the ecosystem dependency package represents the dependency package belonging to the Vue front-end framework; If it is determined that the ecological dependency package meets the preset conditions, then the first AST of the ecological dependency package is generated according to the source code file of the first framework; wherein, the first framework represents the Vue framework before the update, the first AST represents the abstract syntax tree of the ecological dependency package in the first framework, and the source code file includes the code information corresponding to each dependency data package. Based on the first AST of the ecosystem dependency package, the code information of the ecosystem dependency package in the second framework is obtained; wherein, the second framework represents the updated Vue framework; Based on the code information of each of the aforementioned ecological dependency packages in the second framework, the source code files of the second framework are determined.

2. The method according to claim 1, characterized in that, Determining that the ecological dependency package meets preset conditions includes: Obtain the target version data package corresponding to the ecosystem dependency package; wherein, the target version data package represents the latest version of the ecosystem dependency package up to the current time; Based on the target version data package corresponding to the ecosystem dependency package, determine whether the ecosystem dependency package meets the preset conditions.

3. The method according to claim 2, characterized in that, Based on the target version data package corresponding to the ecosystem dependency package, determine whether the ecosystem dependency package meets preset conditions, including: If the identification information of the target version data package corresponding to the ecological dependency package includes a preset first identifier, then the ecological dependency package is determined to meet the preset condition; If the identification information of the target version data package corresponding to the ecological dependency package includes a preset second identifier, then it is determined that the ecological dependency package does not meet the preset conditions.

4. The method according to claim 1, characterized in that, Based on the source code files of the first framework, the first AST of the ecological dependency package is generated, including: The code information of the ecosystem dependency package is determined from the source code file of the first framework; The code information of the ecosystem dependency package is scanned to obtain the sub-modules in the code information of the ecosystem dependency package; wherein, the sub-modules include at least one of the template module, script module, and style module; Based on the preset parser corresponding to each submodule, the first AST of the ecological dependency package is obtained.

5. The method according to claim 4, characterized in that, Based on the preset parser corresponding to each submodule, the first AST of the ecological dependency package is obtained, including: Based on a preset first parser, the template module is parsed to obtain the template AST of the template module; wherein, the template AST is used to describe the Document Object Model (DOM) structure; Based on a preset second parser, the script module is parsed to obtain the component configuration object of the script module; wherein, the component configuration object includes at least one of the component's data, methods, and lifecycle logic; Based on a preset third parser, the style module is parsed to obtain the style information of the style module; wherein, the style information represents the style scope rules; The first AST of the ecosystem dependency package is obtained based on the template AST, the component configuration object, and the style information.

6. The method according to claim 4, characterized in that, Also includes: The template module of the ecological dependency package is subjected to syntax scanning to determine the syntax information in the template module; If the syntax information in the template module includes preset key syntax, a risk report for the ecosystem dependency package is generated; wherein, the risk report is used to prompt the user to perform manual verification.

7. The method according to claim 1, characterized in that, Based on the first AST of the ecological dependency package, the code information of the ecological dependency package in the second framework is obtained, including: Based on the first AST, and using preset syntax mapping rules, a second AST of the ecosystem dependency package is determined; wherein, the preset syntax mapping rules are used to convert optional APIs into composite APIs, and the second AST represents the abstract syntax tree of the ecosystem dependency package in the first framework; Based on the second AST, and using a preset code generator, the code information of the ecological dependency package in the second framework is generated.

8. The method according to claim 1, characterized in that, Also includes: If it is determined that the code information of each of the ecological dependency packages in the second framework meets the preset verification rules, then the step of determining the source code file of the second framework based on the code information of each of the ecological dependency packages in the second framework is executed; wherein, the preset verification rules are used to verify at least one of the syntax, semantics, and format of the code information.

9. The method according to any one of claims 1-8, characterized in that, Based on the pre-defined recursive relationships between dependency packages in the Vue framework, the ecosystem dependency packages are determined from each dependency package, including: Based on the pre-defined recursive relationship between the dependency data packages in the Vue framework, each dependency data package is traversed to obtain the currently traversed dependency data package; If the identifier information of the currently traversed dependency data package includes a preset identifier, then the currently traversed dependency data package is determined to be the ecosystem dependency package.

10. The method according to claim 9, characterized in that, Also includes: Based on the identification information of the currently traversed dependency data package, determine the location information of the currently traversed dependency data package in the source code file of the first frame; Based on the location information, the attribute information of the currently traversed dependency data package is determined from the source code file of the first framework and stored; wherein, the attribute information represents at least one of the methods, values, components and configuration parameters used by the dependency data package.

11. A front-end framework update device, characterized in that, The device is applied to the Vue front-end framework; the device includes: The dependency package identification unit is used to determine the ecosystem dependency package from each dependency package according to the preset recursive relationship between each dependency package in the Vue front-end framework; wherein, the dependency package represents the package of the project application in the Vue front-end framework, and the ecosystem dependency package represents the dependency package belonging to the Vue front-end framework. An AST generation unit is used to generate a first AST of the ecological dependency package based on the source code file of the first framework if it is determined that the ecological dependency package meets the preset conditions; wherein, the first framework represents the Vue framework before the update, the first AST represents the abstract syntax tree of the ecological dependency package in the first framework, and the source code file includes code information corresponding to each dependency package. The code determination unit is used to obtain the code information of the ecological dependency package in the second framework based on the first AST of the ecological dependency package; wherein, the second framework represents the updated Vue framework; The framework update unit is used to determine the source code file of the second framework based on the code information of each of the ecological dependency packages in the second framework.

12. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-10.

14. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-10.