1 | import Parser from './Parser';
|
2 | import { SoftwarePackage } from '@stencila/schema';
|
3 | /**
|
4 | * Dockter `Parser` class for Node.js.
|
5 | */
|
6 | export default class JavascriptParser extends Parser {
|
7 | /**
|
8 | * Parse a folder to detect any `package.json` or `*.js` source code files
|
9 | * and return a `SoftwarePackage` instance
|
10 | */
|
11 | parse(): Promise<SoftwarePackage | null>;
|
12 | /**
|
13 | * Create a `SoftwarePackage` instance from a Node.js package meta-data object
|
14 | *
|
15 | * Meta-data for a packages dependencies is obtained from https://registry.npmjs.org/ using the
|
16 | * JSON API documented at https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md
|
17 | * and https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md.
|
18 | * Currently we fetch the abbreviated metadata because the full meta data can be very large.
|
19 | *
|
20 | * The column "NodeJS" in https://github.com/codemeta/codemeta/blob/master/crosswalk.csv
|
21 | * is used to translate package meta-data into a `SoftwarePackage` instance.
|
22 | *
|
23 | * @param data Package object
|
24 | */
|
25 | private createPackage;
|
26 | }
|