Package 

Class KotlinNpmResolutionManager

  • All Implemented Interfaces:

    
    public final class KotlinNpmResolutionManager
    
                        

    configuring. Global initial state. NpmResolverPlugin should be applied for each project that requires NPM resolution. When applied, KotlinProjectNpmResolver will be created for the corresponding project and will subscribe to all js compilations. NpmResolverPlugin requires kotlin mulitplatform or plaform plugin applied first.

    up-to-date-checked. This state is compilation local: one compilation may be in up-to-date-checked state, while another may be steel in configuring state. New compilations may be added in this state, but compilations that are already up-to-date-checked cannot be changed. Initiated by calling KotlinPackageJsonTask.producerInputs getter (will be called by Gradle). KotlinCompilationNpmResolver will create and resolve aggregated compilation configuration, which contains all related compilation configuration and NPM tools configuration. NPM tools configuration contains all dependencies that is required for all enabled tasks related to this compilation. It is important to resolve this configuration inside particular project and not globally. Aggregated configuration will be analyzed for gradle internal dependencies (project dependencies), gradle external dependencies and npm dependencies. This collections will be treated as packageJson task inputs.

    package-json-created. This state also compilation local. Initiated by executing packageJson task for particular compilation. If packageJson task is up-to-date, this state is reached by first calling KotlinCompilationNpmResolver.getResolutionOrResolveIfForced which may be called by compilation that depends on this compilation. Note that package.json will be executed only for required compilations, while other may be missed.

    Prepared. Global final state. Initiated by executing global rootPackageJson task.

    Installed. All created package.json files will be gathered and package manager will be executed. Package manager will create lock file, that will be parsed for transitive npm dependencies that will be added to the root NpmDependency objects. kotlinNpmInstall task may be up-to-date. In this case, installed state will be reached by first call of installIfNeeded without executing package manager.

    Resolution will be used from NpmDependency by calling getNpmDependencyResolvedCompilation. Also resolution will be checked before calling NpmProject.require and executing any task that requires npm dependencies or node_modules.

    User can call requireInstalled to get resolution info.

    In this case forceFullResolve will be set, and all compilations will be resolved even without packageJson task execution.

    During building gradle project model, all NpmDependency will be asked for there files, and getNpmDependencyResolvedCompilation will be called. In the forceFullResolve mode project will be fully resolved: all package.json files will be created, and package manager will be called. We are manually tracking package.json files contents to avoid calling package manager if nothing was changes.

    Note that in this case resolution process will be performed outside of task execution.