export type AutoCompleteIndicator = (string & {}); /** export interface representing the parsed package name and its components. */ export interface ParsedPackageName { name: string; version: string; path: string; } /** export interface representing the URLs generated for the npm registry. */ export interface RegistryURLs { searchURL: string; packageURL: string; packageVersionURL: string; version: string | null; name: string; path: string; } export interface PackageURLs { searchURL: string; packageURL: string; packageVersionURL: string; version: string; name: string; path: string; } export interface PackageSearchResult { packages: SearchObject[]; info: SearchInfo; } export interface SearchPackage { name: string; scope: string; version: string; description: string; keywords: string[]; date: string; links: Links; author: Author; publisher: Publisher; maintainers: Maintainer[]; } export interface Links { npm: string; homepage: string; repository: string; bugs: string; } /** * A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you. */ export type Author = string | { name: string; email?: string; url?: string; } export interface Publisher { username: string; email: string; } export interface Maintainer { username?: string; name: string; email: string; } export interface SearchInfo { total: number; time: string; objects: SearchObject[]; } export interface SearchObject { package: SearchPackage; flags: Flags; score: Score; searchScore: number; } export interface Flags { insecure: number; } export interface Score { final: number; detail: Detail; } export interface Detail { quality: number; popularity: number; maintenance: number; } export interface PackageInfo { versions: string[]; tags: Record; } export interface FullPackage { name: string; scope: string; version: string; description: string; keywords: string[]; date: string; links: Links; author: Author; publisher: Publisher; maintainers: Maintainer[]; versions: Record; "dist-tags": Record; } export interface FullPackageVersion { /** * The name is what your thing is called. * Some rules: - The name must be less than or equal to 214 characters. This includes the scope for scoped packages. - The name can’t start with a dot or an underscore. - New packages must not have uppercase letters in the name. - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters. */ name?: string; /** * Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.) */ version?: string; /** * Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require" * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field * * @default 'commonjs' * @since Node.js v14 */ type?: "module" | "commonjs" | AutoCompleteIndicator; sideEffects: boolean; /** * Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`. */ description?: string; publishConfig?: { access?: string; main?: string; types?: string; browser?: string; module?: string; exports?: Record | string> | string; }; directories: Record; /** * The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files. */ files?: string[]; /** * Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`. */ keywords?: string[]; author?: Author; /** * The url to the project homepage. */ homepage?: string; /** * The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package. */ bugs?: | string | { url?: string; email?: string; }; /** * You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it. */ license?: string; /** * Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you. * For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install: */ repository?: | string | { type: string; url: string; /** * If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives: */ directory?: string; }; /** * Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. */ dependencies?: Record; /** * If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use. * In this case, it’s best to map these additional items in a `devDependencies` object. */ devDependencies?: Record; /** * If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail. */ optionalDependencies?: Record; /** * In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation. */ peerDependencies?: Record; gitHead: string; scripts: Record; /** * TypeScript typings, typically ending by .d.ts */ types?: string; typings?: string; /** * The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned. * This should be a module ID relative to the root of your package folder. * For most modules, it makes the most sense to have a main script and often not much else. */ main?: string; /** * If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window) */ browser?: string | false | Record; /** * Non-Standard Node.js alternate entry-point to main. * An initial implementation for supporting CJS packages (from main), and use module for ESM modules. */ module?: string; exports: string | Record< "import" | "require" | "." | "node" | "browser" | AutoCompleteIndicator, Record< "import" | "require" | AutoCompleteIndicator, string > | string >; /** * A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs. */ bin?: string | Record; /** * Specify either a single file or an array of filenames to put in place for the `man` program to find. */ man?: string | string[]; workspaces?: string[]; _id: string; _nodeVersion: string; _npmVersion: string; dist: { integrity: string; shasum: string; tarball: string; fileCount: number; unpackedSize: number; "npm-signature": string; signatures: { keyid: string; sig: string; }[]; }; _npmUser: { name: string; email: string; }; maintainers: Maintainer[]; _npmOperationalInternal: { host: string; tmp: string; }; _hasShrinkwrap: boolean; } /** * Recursive type for the `exports` / `imports` condition tree. * * A leaf is a string (resolved path) or `null` (explicit exclusion). * A branch is an object mapping condition keys to nested entries, * or an array of entries (fallback list). * * @see https://nodejs.org/api/packages.html#conditional-exports */ export type PackageExportEntry = | string | null | PackageExportEntry[] | { [condition: string]: PackageExportEntry }; export interface PackageJson { /** * The name is what your thing is called. * Some rules: - The name must be less than or equal to 214 characters. This includes the scope for scoped packages. - The name can’t start with a dot or an underscore. - New packages must not have uppercase letters in the name. - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters. */ name?: string; /** * Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.) */ version?: string; /** * Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`. */ description?: string; /** * Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`. */ keywords?: string[]; /** * The url to the project homepage. */ homepage?: string; /** * The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package. */ bugs?: | string | { url?: string; email?: string; }; /** * You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it. */ license?: string; /** * Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you. * For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install: */ repository?: | string | { type: string; url: string; /** * If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives: */ directory?: string; }; scripts?: Record; /** * If you set `"private": true` in your package.json, then npm will refuse to publish it. */ private?: boolean; /** * The “author” is one person. */ author?: Author; /** * “contributors” is an array of people. */ contributors?: Author[]; /** * The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files. */ files?: string[]; /** * The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned. * This should be a module ID relative to the root of your package folder. * For most modules, it makes the most sense to have a main script and often not much else. */ main?: string; /** * If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window) */ browser?: string | false | Record; /** * A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs. */ bin?: string | Record; /** * Specify either a single file or an array of filenames to put in place for the `man` program to find. */ man?: string | string[]; /** * Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL. */ dependencies?: Record; /** * If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use. * In this case, it’s best to map these additional items in a `devDependencies` object. */ devDependencies?: Record; /** * If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail. */ optionalDependencies?: Record; /** * In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation. */ peerDependencies?: Record; /** * TypeScript typings, typically ending by .d.ts */ types?: string; typings?: string; /** * Non-Standard Node.js alternate entry-point to main. * An initial implementation for supporting CJS packages (from main), and use module for ESM modules. */ module?: string; /** * Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require" * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field * * @default 'commonjs' * @since Node.js v14 */ type?: "module" | "commonjs" | AutoCompleteIndicator; /** * Alternate and extensible alternative to "main" entry point. * * When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension. * * The `exports` field supports arbitrary nesting of condition keys, * array fallbacks, and `null` to explicitly exclude subpaths. * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/packages.html#exports * * @since Node.js v12.7 (unflagged v14) */ exports?: PackageExportEntry; /** * Package-internal import mappings (`#` imports). * * Allows a package to define private resolution aliases that are * only importable from within the package itself. Supports the same * condition nesting as `exports`. * * Docs: * - https://nodejs.org/docs/latest-v14.x/api/packages.html#imports * * @since Node.js v14 */ imports?: Record; workspaces?: string[]; [key: string]: any; // deno-lint-ignore no-explicit-any }