@package-json/types
Version:
Auto-generated package.json types.
483 lines (475 loc) • 15 kB
TypeScript
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
type JSONSchemaForNPMPackageJsonFiles = {
[]: unknown;
} & {
/**
* The name of the package.
*/
name?: string;
/**
* Version must be parseable by node-semver, which is bundled with npm as a dependency.
*/
version?: string;
/**
* This helps people discover your package, as it's listed in 'npm search'.
*/
description?: string;
/**
* 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?:
| {
/**
* The url to your project's issue tracker.
*/
url?: string;
/**
* The email address to which issues should be reported.
*/
email?: string;
[]: unknown;
}
| 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
| (
| "AGPL-3.0-only"
| "Apache-2.0"
| "BSD-2-Clause"
| "BSD-3-Clause"
| "BSL-1.0"
| "CC0-1.0"
| "CDDL-1.0"
| "CDDL-1.1"
| "EPL-1.0"
| "EPL-2.0"
| "GPL-2.0-only"
| "GPL-3.0-only"
| "ISC"
| "LGPL-2.0-only"
| "LGPL-2.1-only"
| "LGPL-2.1-or-later"
| "LGPL-3.0-only"
| "LGPL-3.0-or-later"
| "MIT"
| "MPL-2.0"
| "MS-PL"
| "UNLICENSED"
);
author?: Person;
/**
* A list of people who contributed to this package.
*/
contributors?: Person[];
/**
* A list of people who maintains this package.
*/
maintainers?: Person[];
/**
* The 'files' field is an array of files to include in your project. If you name a folder in the array, then it will also include the files inside that folder.
*/
files?: string[];
/**
* The main field is a module ID that is the primary entry point to your program.
*/
main?: string;
bin?:
| string
| {
[]: string;
};
/**
* When set to "module", the type field allows a package to specify all .js files within are ES modules. If the "type" field is omitted or set to "commonjs", all .js files are treated as CommonJS.
*/
type?: "commonjs" | "module";
/**
* Set the types property to point to your bundled declaration file.
*/
types?: string;
/**
* Note that the "typings" field is synonymous with "types", and could be used as well.
*/
typings?: string;
/**
* The "typesVersions" field is used since TypeScript 3.1 to support features that were only made available in newer TypeScript versions.
*/
typesVersions?: {
/**
* Contains overrides for the TypeScript version that matches the version range matching the property key.
*/
[]: {
/**
* Maps all file paths to the file paths specified in the array.
*/
"*"?: string[];
};
};
/**
* Specify either a single file or an array of filenames to put in place for the man program to find.
*/
man?: string[] | string;
directories?: {
/**
* If you specify a 'bin' directory, then all the files in that folder will be used as the 'bin' hash.
*/
bin?: string;
/**
* Put markdown files in here. Eventually, these will be displayed nicely, maybe, someday.
*/
doc?: string;
/**
* Put example scripts in here. Someday, it might be exposed in some clever way.
*/
example?: string;
/**
* Tell people where the bulk of your library is. Nothing special is done with the lib folder in any way, but it's useful meta info.
*/
lib?: string;
/**
* A folder that is full of man pages. Sugar to generate a 'man' array by walking the folder.
*/
man?: string;
test?: string;
[]: unknown;
};
/**
* Specify the place where your code lives. This is helpful for people who want to contribute.
*/
repository?:
| {
type?: string;
url?: string;
directory?: string;
[]: unknown;
}
| string;
funding?: FundingUrl | FundingWay | [FundingUrl | FundingWay, ...(FundingUrl | FundingWay)[]];
/**
* The 'scripts' member is an object hash of script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.
*/
scripts?: {
/**
* Run code quality tools, e.g. ESLint, TSLint, etc.
*/
lint?: string;
/**
* Run BEFORE the package is published (Also run on local npm install without any arguments).
*/
prepublish?: string;
/**
* Run both BEFORE the package is packed and published, and on local npm install without any arguments. This is run AFTER prepublish, but BEFORE prepublishOnly.
*/
prepare?: string;
/**
* Run BEFORE the package is prepared and packed, ONLY on npm publish.
*/
prepublishOnly?: string;
/**
* run BEFORE a tarball is packed (on npm pack, npm publish, and when installing git dependencies).
*/
prepack?: string;
/**
* Run AFTER the tarball has been generated and moved to its final destination.
*/
postpack?: string;
/**
* Publishes a package to the registry so that it can be installed by name. See https://docs.npmjs.com/cli/v8/commands/npm-publish
*/
publish?: string;
postpublish?: ScriptsPublishAfter;
/**
* Run BEFORE the package is installed.
*/
preinstall?: string;
install?: ScriptsInstallAfter;
postinstall?: ScriptsInstallAfter;
preuninstall?: ScriptsUninstallBefore;
uninstall?: ScriptsUninstallBefore;
/**
* Run AFTER the package is uninstalled.
*/
postuninstall?: string;
preversion?: ScriptsVersionBefore;
version?: ScriptsVersionBefore;
/**
* Run AFTER bump the package version.
*/
postversion?: string;
pretest?: ScriptsTest;
test?: ScriptsTest;
posttest?: ScriptsTest;
prestop?: ScriptsStop;
stop?: ScriptsStop;
poststop?: ScriptsStop;
prestart?: ScriptsStart;
start?: ScriptsStart;
poststart?: ScriptsStart;
prerestart?: ScriptsRestart;
restart?: ScriptsRestart;
postrestart?: ScriptsRestart;
/**
* Start dev server to serve application files
*/
serve?: string;
[]: string | undefined;
};
/**
* A 'config' hash can be used to set configuration parameters used in package scripts that persist across upgrades.
*/
config?: {
[]: unknown;
};
dependencies?: Dependency;
devDependencies?: Dependency;
optionalDependencies?: Dependency;
peerDependencies?: Dependency;
/**
* When a user installs your package, warnings are emitted if packages specified in "peerDependencies" are not already installed. The "peerDependenciesMeta" field serves to provide more information on how your peer dependencies are utilized. Most commonly, it allows peer dependencies to be marked as optional. Metadata for this field is specified with a simple hash of the package name to a metadata object.
*/
peerDependenciesMeta?: {
[]: {
/**
* Specifies that this peer dependency is optional and should not be installed automatically.
*/
optional?: boolean;
[]: unknown;
};
};
/**
* Array of package names that will be bundled when publishing the package.
*/
bundleDependencies?: string[] | boolean;
/**
* Resolutions is used to support selective version resolutions using yarn, which lets you define custom package versions or ranges inside your dependencies. For npm, use overrides instead. See: https://classic.yarnpkg.com/en/docs/selective-version-resolutions
*/
resolutions?: {
[]: unknown;
};
/**
* Overrides is used to support selective version overrides using npm, which lets you define custom package versions or ranges inside your dependencies. For yarn, use resolutions instead. See: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides
*/
overrides?: {
[]: unknown;
};
/**
* Defines which package manager is expected to be used when working on the current project. This field is currently experimental and needs to be opted-in; see https://nodejs.org/api/corepack.html
*/
packageManager?: string;
engines?: {
node?: string;
[]: string;
};
/**
* Defines which tools and versions are expected to be used when Volta is installed.
*/
volta?: {
/**
* The value of that entry should be a path to another JSON file which also has a "volta" section
*/
extends?: string;
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` "(node|npm|pnpm|yarn)".
*/
[]: string;
};
engineStrict?: boolean;
/**
* Specify which operating systems your module will run on.
*/
os?: string[];
/**
* Specify that your code only runs on certain cpu architectures.
*/
cpu?: string[];
/**
* If set to true, then npm will refuse to publish it.
*/
private?: boolean | ("false" | "true");
publishConfig?: {
access?: "public" | "restricted";
tag?: string;
registry?: string;
[]: unknown;
};
dist?: {
shasum?: string;
tarball?: string;
[]: unknown;
};
readme?: string;
/**
* An ECMAScript module ID that is the primary entry point to your program.
*/
module?: string;
/**
* A module ID with untranspiled code that is the primary entry point to your program.
*/
esnext?:
| string
| {
main?: string;
browser?: string;
[]: string;
};
/**
* Allows packages within a directory to depend on one another using direct linking of local files. Additionally, dependencies within a workspace are hoisted to the workspace root when possible to reduce duplication. Note: It's also a good idea to set "private" to true when using this feature.
*/
workspaces?:
| string[]
| {
/**
* Workspace package paths. Glob patterns are supported.
*/
packages?: string[];
/**
* Packages to block from hoisting to the workspace root. Currently only supported in Yarn only.
*/
nohoist?: string[];
[]: unknown;
};
/**
* Any property starting with _ is valid.
*
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` "^_".
*/
[]: any;
};
/**
* A person who has been involved in creating or maintaining this package.
*/
type Person = {
name: string;
url?: string;
email?: string;
[]: unknown;
} & Person1;
type Person1 =
| {
name: string;
url?: string;
email?: string;
[]: unknown;
}
| string;
/**
* URL to a website with details about how to fund the package.
*/
type FundingUrl = string;
/**
* Run AFTER the package is published.
*/
type ScriptsPublishAfter = string;
/**
* Run AFTER the package is installed.
*/
type ScriptsInstallAfter = string;
/**
* Run BEFORE the package is uninstalled.
*/
type ScriptsUninstallBefore = string;
/**
* Run BEFORE bump the package version.
*/
type ScriptsVersionBefore = string;
/**
* Run by the 'npm test' command.
*/
type ScriptsTest = string;
/**
* Run by the 'npm stop' command.
*/
type ScriptsStop = string;
/**
* Run by the 'npm start' command.
*/
type ScriptsStart = string;
/**
* Run by the 'npm restart' command. Note: 'npm restart' will run the stop and start scripts if no restart script is provided.
*/
type ScriptsRestart = string;
/**
* Used to inform about ways to help fund development of the package.
*/
interface FundingWay {
url: FundingUrl;
/**
* The type of funding or the platform through which funding can be provided, e.g. patreon, opencollective, tidelift or github.
*/
type?: string;
}
/**
* Dependencies are specified with a simple hash of package name to 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.
*/
interface Dependency {
[]: string;
}
/**
* Skip evaluating `U` if `T` is `unknown`.
*/
type EvalIfNotUnknown<T, U> = unknown extends T ? never : U;
/**
* Resolve mapped types and show the derived keys and their types when hovering in
* VS Code, instead of just showing the names those mapped types are defined with.
*/
type Prettify<T> = {
[]: T[K];
} & {};
/**
* Get the keys of T without any keys of U.
*/
type Without<T, U> = {
[]?: never;
};
/**
* Restrict using either exclusively the keys of `T` or exclusively the keys of `U`.
*
* No unique keys of `T` can be used simultaneously with any unique keys of `U`.
*
* @example
* ```ts
* const myVar: XOR<{ data: object }, { error: object }>
* ```
*
* Supports from 2 up to 3 generic parameters.
*
* More: https://github.com/maninak/ts-xor/tree/master#description
*/
type XOR<A, B, C = unknown> = Prettify<(A & Without<B & C, A>) | (B & Without<A & C, B>) | EvalIfNotUnknown<C, C & Without<A & B, C>>>;
interface Export {
[]: Export | string | undefined;
default?: Export | string;
import?: Export | string;
require?: Export | string;
types?: Export | string;
}
interface TopLevelExport extends Record<`./${string}`, Export | string | undefined> {
'.'?: Export | string;
'./package.json'?: './package.json';
}
/**
* The "exports" field is used to restrict external access to non-exported module files, also enables a module to import itself using "name".
*/
type Exports = null | XOR<XOR<TopLevelExport, Export>, `./${string}`, `./${string}`[]>;
type PackageJson = {
exports?: Exports;
} & JSONSchemaForNPMPackageJsonFiles;
declare const definePackageJson: (json: PackageJson) => PackageJson;
export { type Dependency, type FundingUrl, type FundingWay, type JSONSchemaForNPMPackageJsonFiles, type PackageJson as PackageJSON, type PackageJson, type Person, type Person1, type ScriptsInstallAfter, type ScriptsPublishAfter, type ScriptsRestart, type ScriptsStart, type ScriptsStop, type ScriptsTest, type ScriptsUninstallBefore, type ScriptsVersionBefore, definePackageJson as default, definePackageJson as definePackageJSON, definePackageJson };