# Code Static Reliance Analysis

The tool provides a code static dependency analysis plug-in that makes it easy for developers to see the file composition and dependencies of code packages to optimize code packages size and content.

# Operating environment

  • Download and install the developer tools1.03.2101150or above, and download the download for .

# Turn on the code static dependency analysis plug-in

Developers can launch the plug-in through two portals: 1. Navigation bar at the top of the directory tree 2. Project Settings - Local Code - Code Dependency Analysis

Entrance

# See the composition of the code package

When you start the analysis plug-in, you can see by default the file composition of the project and the corresponding code volume, as well as the non-dependent (i.e., unused) code file size

Code packages make up

# See code dependencies

Clicking on any file (not dependent) allows you to view the dependency graph for that code file. Click the right button to quickly open the code editing of the corresponding file.

Code dependencies

# View unreliable files

By switching a filter (choose unreliable files) or a shortcut entry, developers can see the current unreliable file status of their project and optimize their code files according to their own conditions.

Non-reliance files

# Get analytical data

From version 1.6.1, miniprogram-ci added theanalysisCodemethod, which can be invoked to obtain JSON data from the code that statically relies on the analysis results.Please see miniprogram-ci documentation

# Introduction to the Principles

The code static dependency analysis plug-in will perform dependency analysis on the code files in the code package (files with suffixes named json, js, wxml, wxss, and wss), starting from the apagejson / game.json entry, find the dependencies of the various code files in a project, and build a file dependency diagram. Files that do not detect dependencies are marked as non-dependent files. In addition to the code file, the rest of the code package (such as images, etc.) will be marked as a source file, not involved in the dependency analysis.