"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/module-info/index.ts" (20 Feb 2024, 956 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 const merge = require('lodash.merge');
    2 import * as Debug from 'debug';
    3 import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
    4 
    5 const debug = Debug('snyk-module-info');
    6 
    7 export function ModuleInfo(plugin, policy) {
    8   return {
    9     async inspect(
   10       root,
   11       targetFile,
   12       options,
   13       snykHttpClient,
   14     ): Promise<pluginApi.SinglePackageResult | pluginApi.MultiProjectResult> {
   15       const pluginOptions = merge(
   16         {
   17           args: options._doubleDashArgs,
   18         },
   19         options,
   20       );
   21 
   22       debug('calling plugin inspect()', { root, targetFile, pluginOptions });
   23       const info = await plugin.inspect(
   24         root,
   25         targetFile,
   26         pluginOptions,
   27         snykHttpClient,
   28       );
   29       debug('plugin inspect() done');
   30 
   31       // attach policy if not provided by plugin
   32       if (policy && !info.package.policy) {
   33         info.package.policy = policy.toString();
   34       }
   35 
   36       return info;
   37     },
   38   };
   39 }