This commit is contained in:
21
node_modules/local-pkg/LICENSE
generated
vendored
Normal file
21
node_modules/local-pkg/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
55
node_modules/local-pkg/README.md
generated
vendored
Normal file
55
node_modules/local-pkg/README.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# local-pkg
|
||||
|
||||
[](https://www.npmjs.com/package/local-pkg)
|
||||
|
||||
Get information on local packages. Works on both CJS and ESM.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i local-pkg
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {
|
||||
getPackageInfo,
|
||||
importModule,
|
||||
isPackageExists,
|
||||
resolveModule,
|
||||
} from 'local-pkg'
|
||||
|
||||
isPackageExists('local-pkg') // true
|
||||
isPackageExists('foo') // false
|
||||
|
||||
await getPackageInfo('local-pkg')
|
||||
/* {
|
||||
* name: "local-pkg",
|
||||
* version: "0.1.0",
|
||||
* rootPath: "/path/to/node_modules/local-pkg",
|
||||
* packageJson: {
|
||||
* ...
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
// similar to `require.resolve` but works also in ESM
|
||||
resolveModule('local-pkg')
|
||||
// '/path/to/node_modules/local-pkg/dist/index.cjs'
|
||||
|
||||
// similar to `await import()` but works also in CJS
|
||||
const { importModule } = await importModule('local-pkg')
|
||||
```
|
||||
|
||||
## Sponsors
|
||||
|
||||
<p align="center">
|
||||
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
|
||||
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)
|
||||
27
node_modules/local-pkg/node_modules/confbox/LICENSE
generated
vendored
Normal file
27
node_modules/local-pkg/node_modules/confbox/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
## Third-Party Licenses
|
||||
|
||||
This software includes bundled third-party dependencies. The licenses and
|
||||
copyright notices for these dependencies are available in
|
||||
`dist/THIRD-PARTY-LICENSES.md` within the distributed package.
|
||||
191
node_modules/local-pkg/node_modules/confbox/README.md
generated
vendored
Normal file
191
node_modules/local-pkg/node_modules/confbox/README.md
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
# confbox
|
||||
|
||||
<!-- automd:badges color=yellow bundlephobia packagephobia -->
|
||||
|
||||
[](https://npmjs.com/package/confbox)
|
||||
[](https://npm.chart.dev/confbox)
|
||||
[](https://bundlephobia.com/package/confbox)
|
||||
[](https://packagephobia.com/result?p=confbox)
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
Parsing and serialization utils for [YAML](https://yaml.org/) ([js-yaml](https://github.com/nodeca/js-yaml)), [TOML](https://toml.io/) ([smol-toml](https://github.com/squirrelchat/smol-toml)), [JSONC](https://github.com/microsoft/node-jsonc-parser) ([jsonc-parser](https://github.com/microsoft/node-jsonc-parser)), [JSON5](https://json5.org/) ([json5](https://github.com/json5/json5)), [INI](https://en.wikipedia.org/wiki/INI_file) ([ini](https://www.npmjs.com/package/ini)) and [JSON](https://www.json.org/json-en.html).
|
||||
|
||||
✨ Zero dependency and tree-shakable
|
||||
|
||||
✨ Types exported out of the box
|
||||
|
||||
✨ Preserves code style (indentation and whitespace)
|
||||
|
||||
> [!TIP]
|
||||
> Use [unjs/c12](https://github.com/unjs/c12) for a full featured configuration loader!
|
||||
|
||||
## Usage
|
||||
|
||||
Install package:
|
||||
|
||||
<!-- automd:pm-i no-version -->
|
||||
|
||||
```sh
|
||||
# ✨ Auto-detect
|
||||
npx nypm install confbox
|
||||
|
||||
# npm
|
||||
npm install confbox
|
||||
|
||||
# yarn
|
||||
yarn add confbox
|
||||
|
||||
# pnpm
|
||||
pnpm add confbox
|
||||
|
||||
# bun
|
||||
bun install confbox
|
||||
|
||||
# deno
|
||||
deno install npm:confbox
|
||||
```
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
Import:
|
||||
|
||||
<!-- automd:jsimport cdn src="./src/index.ts" -->
|
||||
|
||||
**ESM** (Node.js, Bun, Deno)
|
||||
|
||||
```js
|
||||
import {
|
||||
parseJSON5,
|
||||
stringifyJSON5,
|
||||
parseJSONC,
|
||||
stringifyJSONC,
|
||||
parseYAML,
|
||||
stringifyYAML,
|
||||
parseJSON,
|
||||
stringifyJSON,
|
||||
parseTOML,
|
||||
stringifyTOML,
|
||||
parseINI,
|
||||
stringifyINI,
|
||||
} from "confbox";
|
||||
```
|
||||
|
||||
**CDN** (Deno and Browsers)
|
||||
|
||||
```js
|
||||
import {
|
||||
parseJSON5,
|
||||
stringifyJSON5,
|
||||
parseJSONC,
|
||||
stringifyJSONC,
|
||||
parseYAML,
|
||||
stringifyYAML,
|
||||
parseJSON,
|
||||
stringifyJSON,
|
||||
parseTOML,
|
||||
stringifyTOML,
|
||||
parseINI,
|
||||
stringifyINI,
|
||||
} from "https://esm.sh/confbox";
|
||||
```
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
<!-- automd:jsdocs src="./src/index" -->
|
||||
|
||||
### `parseINI(text, options?)`
|
||||
|
||||
Converts an [INI](https://www.ini.org/ini-en.html) string into an object.
|
||||
|
||||
**Note:** Style and indentation are not preserved currently.
|
||||
|
||||
### `parseJSON(text, options?)`
|
||||
|
||||
Converts a [JSON](https://www.json.org/json-en.html) string into an object.
|
||||
|
||||
Indentation status is auto-detected and preserved when stringifying back using `stringifyJSON`
|
||||
|
||||
### `parseJSON5(text, options?)`
|
||||
|
||||
Converts a [JSON5](https://json5.org/) string into an object.
|
||||
|
||||
### `parseJSONC(text, options?)`
|
||||
|
||||
Converts a [JSONC](https://github.com/microsoft/node-jsonc-parser) string into an object.
|
||||
|
||||
### `parseTOML(text)`
|
||||
|
||||
Converts a [TOML](https://toml.io/) string into an object.
|
||||
|
||||
### `parseYAML(text, options?)`
|
||||
|
||||
Converts a [YAML](https://yaml.org/) string into an object.
|
||||
|
||||
### `stringifyINI(value, options?)`
|
||||
|
||||
Converts a JavaScript value to an [INI](https://www.ini.org/ini-en.html) string.
|
||||
|
||||
**Note:** Style and indentation are not preserved currently.
|
||||
|
||||
### `stringifyJSON(value, options?)`
|
||||
|
||||
Converts a JavaScript value to a [JSON](https://www.json.org/json-en.html) string.
|
||||
|
||||
Indentation status is auto detected and preserved when using value from parseJSON.
|
||||
|
||||
### `stringifyJSON5(value, options?)`
|
||||
|
||||
Converts a JavaScript value to a [JSON5](https://json5.org/) string.
|
||||
|
||||
### `stringifyJSONC(value, options?)`
|
||||
|
||||
Converts a JavaScript value to a [JSONC](https://github.com/microsoft/node-jsonc-parser) string.
|
||||
|
||||
### `stringifyTOML(value)`
|
||||
|
||||
Converts a JavaScript value to a [TOML](https://toml.io/) string.
|
||||
|
||||
### `stringifyYAML(value, options?)`
|
||||
|
||||
Converts a JavaScript value to a [YAML](https://yaml.org/) string.
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
<!-- automd:fetch url="gh:unjs/.github/main/snippets/readme-contrib-node-pnpm.md" -->
|
||||
|
||||
## Contribution
|
||||
|
||||
<details>
|
||||
<summary>Local development</summary>
|
||||
|
||||
- Clone this repository
|
||||
- Install the latest LTS version of [Node.js](https://nodejs.org/en/)
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
||||
- Install dependencies using `pnpm install`
|
||||
- Run tests using `pnpm dev` or `pnpm test`
|
||||
|
||||
</details>
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
## License
|
||||
|
||||
<!-- automd:contributors license=MIT author=pi0 -->
|
||||
|
||||
Published under the [MIT](https://github.com/unjs/confbox/blob/main/LICENSE) license.
|
||||
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/confbox/graphs/contributors) 💛
|
||||
<br><br>
|
||||
<a href="https://github.com/unjs/confbox/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=unjs/confbox" />
|
||||
</a>
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
<!-- automd:with-automd -->
|
||||
|
||||
---
|
||||
|
||||
_🤖 auto updated with [automd](https://automd.unjs.io)_
|
||||
|
||||
<!-- /automd -->
|
||||
67
node_modules/local-pkg/node_modules/confbox/package.json
generated
vendored
Normal file
67
node_modules/local-pkg/node_modules/confbox/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "confbox",
|
||||
"version": "0.2.4",
|
||||
"description": "Compact YAML, TOML, JSONC, JSON5 and INI parser and serializer",
|
||||
"keywords": [
|
||||
"config",
|
||||
"ini",
|
||||
"json5",
|
||||
"jsonc",
|
||||
"toml",
|
||||
"unjs",
|
||||
"yaml"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "unjs/confbox",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"types": "./dist/index.d.mts",
|
||||
"exports": {
|
||||
".": "./dist/index.mjs",
|
||||
"./ini": "./dist/ini.mjs",
|
||||
"./json5": "./dist/json5.mjs",
|
||||
"./jsonc": "./dist/jsonc.mjs",
|
||||
"./toml": "./dist/toml.mjs",
|
||||
"./yaml": "./dist/yaml.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "obuild",
|
||||
"dev": "vitest dev --coverage",
|
||||
"bench": "pnpm build && node test/bench.mjs",
|
||||
"lint": "oxlint && oxfmt --check src test",
|
||||
"lint:fix": "oxlint --fix && oxfmt src test",
|
||||
"prepack": "pnpm build",
|
||||
"release": "pnpm test && pnpm build && changelogen --release && npm publish && git push --follow-tags",
|
||||
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
|
||||
"test:types": "tsgo --noEmit --skipLibCheck"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ini": "^4.1.1",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^25.2.1",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260206.1",
|
||||
"@vitest/coverage-v8": "^4.0.18",
|
||||
"automd": "^0.4.3",
|
||||
"changelogen": "^0.6.2",
|
||||
"detect-indent": "^7.0.2",
|
||||
"ini": "^6.0.0",
|
||||
"jiti": "^2.6.1",
|
||||
"js-toml": "^1.0.2",
|
||||
"js-yaml": "^4.1.1",
|
||||
"json5": "^2.2.3",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"mitata": "^1.0.34",
|
||||
"obuild": "^0.4.26",
|
||||
"oxfmt": "^0.28.0",
|
||||
"oxlint": "^1.43.0",
|
||||
"smol-toml": "^1.6.0",
|
||||
"toml": "^3.0.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vitest": "^4.0.18",
|
||||
"yaml": "^2.8.2"
|
||||
},
|
||||
"packageManager": "pnpm@10.28.2"
|
||||
}
|
||||
44
node_modules/local-pkg/node_modules/pkg-types/LICENSE
generated
vendored
Normal file
44
node_modules/local-pkg/node_modules/pkg-types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
266
node_modules/local-pkg/node_modules/pkg-types/README.md
generated
vendored
Normal file
266
node_modules/local-pkg/node_modules/pkg-types/README.md
generated
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
# pkg-types
|
||||
|
||||
<!-- automd:badges color=yellow codecov -->
|
||||
|
||||
[](https://npmjs.com/package/pkg-types)
|
||||
[](https://npm.chart.dev/pkg-types)
|
||||
[](https://codecov.io/gh/unjs/pkg-types)
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
Node.js utilities and TypeScript definitions for `package.json`, `tsconfig.json`, and other configuration files.
|
||||
|
||||
## Install
|
||||
|
||||
<!-- automd:pm-i -->
|
||||
|
||||
```sh
|
||||
# ✨ Auto-detect
|
||||
npx nypm install pkg-types
|
||||
|
||||
# npm
|
||||
npm install pkg-types
|
||||
|
||||
# yarn
|
||||
yarn add pkg-types
|
||||
|
||||
# pnpm
|
||||
pnpm install pkg-types
|
||||
|
||||
# bun
|
||||
bun install pkg-types
|
||||
|
||||
# deno
|
||||
deno install pkg-types
|
||||
```
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
## Usage
|
||||
|
||||
### Package Configuration
|
||||
|
||||
#### `readPackage`
|
||||
|
||||
Reads any package file format (package.json, package.json5, or package.yaml) with automatic format detection.
|
||||
|
||||
```js
|
||||
import { readPackage } from "pkg-types";
|
||||
const localPackage = await readPackage();
|
||||
// or
|
||||
const package = await readPackage("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
#### `writePackage`
|
||||
|
||||
Writes package data with format detection based on file extension.
|
||||
|
||||
```js
|
||||
import { writePackage } from "pkg-types";
|
||||
|
||||
await writePackage("path/to/package.json", pkg);
|
||||
await writePackage("path/to/package.json5", pkg);
|
||||
await writePackage("path/to/package.yaml", pkg);
|
||||
```
|
||||
|
||||
#### `findPackage`
|
||||
|
||||
Finds the nearest package file (package.json, package.json5, or package.yaml).
|
||||
|
||||
```js
|
||||
import { findPackage } from "pkg-types";
|
||||
const filename = await findPackage();
|
||||
// or
|
||||
const filename = await findPackage("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
#### `readPackageJSON`
|
||||
|
||||
```js
|
||||
import { readPackageJSON } from "pkg-types";
|
||||
const localPackageJson = await readPackageJSON();
|
||||
// or
|
||||
const packageJson = await readPackageJSON("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
#### `writePackageJSON`
|
||||
|
||||
```js
|
||||
import { writePackageJSON } from "pkg-types";
|
||||
|
||||
await writePackageJSON("path/to/package.json", pkg);
|
||||
```
|
||||
|
||||
#### `resolvePackageJSON`
|
||||
|
||||
```js
|
||||
import { resolvePackageJSON } from "pkg-types";
|
||||
const filename = await resolvePackageJSON();
|
||||
// or
|
||||
const packageJson = await resolvePackageJSON("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
### TypeScript Configuration
|
||||
|
||||
#### `readTSConfig`
|
||||
|
||||
```js
|
||||
import { readTSConfig } from "pkg-types";
|
||||
const tsconfig = await readTSConfig();
|
||||
// or
|
||||
const tsconfig2 = await readTSConfig("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
#### `writeTSConfig`
|
||||
|
||||
```js
|
||||
import { writeTSConfig } from "pkg-types";
|
||||
|
||||
await writeTSConfig("path/to/tsconfig.json", tsconfig);
|
||||
```
|
||||
|
||||
#### `resolveTSConfig`
|
||||
|
||||
```js
|
||||
import { resolveTSConfig } from "pkg-types";
|
||||
const filename = await resolveTSConfig();
|
||||
// or
|
||||
const tsconfig = await resolveTSConfig("/fully/resolved/path/to/folder");
|
||||
```
|
||||
|
||||
### File Resolution
|
||||
|
||||
#### `resolveFile`
|
||||
|
||||
```js
|
||||
import { resolveFile } from "pkg-types";
|
||||
const filename = await resolveFile("README.md", {
|
||||
startingFrom: id,
|
||||
rootPattern: /^node_modules$/,
|
||||
matcher: (filename) => filename.endsWith(".md"),
|
||||
});
|
||||
```
|
||||
|
||||
#### `resolveLockFile`
|
||||
|
||||
Find path to the lock file (`yarn.lock`, `package-lock.json`, `pnpm-lock.yaml`, `npm-shrinkwrap.json`, `bun.lockb`, `bun.lock`, `deno.lock`) or throws an error.
|
||||
|
||||
```js
|
||||
import { resolveLockFile } from "pkg-types";
|
||||
const lockfile = await resolveLockFile(".");
|
||||
```
|
||||
|
||||
#### `findWorkspaceDir`
|
||||
|
||||
Try to detect workspace dir by in order:
|
||||
|
||||
1. Farthest workspace file (`pnpm-workspace.yaml`, `lerna.json`, `turbo.json`, `rush.json`, `deno.json`, `deno.jsonc`)
|
||||
2. Closest `.git/config` file
|
||||
3. Farthest lockfile
|
||||
4. Farthest `package.json` file
|
||||
|
||||
If fails, throws an error.
|
||||
|
||||
```js
|
||||
import { findWorkspaceDir } from "pkg-types";
|
||||
const workspaceDir = await findWorkspaceDir(".");
|
||||
```
|
||||
|
||||
### Git Configuration
|
||||
|
||||
#### `resolveGitConfig`
|
||||
|
||||
Finds closest `.git/config` file.
|
||||
|
||||
```js
|
||||
import { resolveGitConfig } from "pkg-types";
|
||||
|
||||
const gitConfig = await resolveGitConfig(".")
|
||||
```
|
||||
|
||||
#### `readGitConfig`
|
||||
|
||||
Finds and reads closest `.git/config` file into a JS object.
|
||||
|
||||
```js
|
||||
import { readGitConfig } from "pkg-types";
|
||||
|
||||
const gitConfigObj = await readGitConfig(".")
|
||||
```
|
||||
|
||||
#### `writeGitConfig`
|
||||
|
||||
Stringifies git config object into INI text format and writes it to a file.
|
||||
|
||||
```js
|
||||
import { writeGitConfig } from "pkg-types";
|
||||
|
||||
await writeGitConfig(".git/config", gitConfigObj)
|
||||
```
|
||||
|
||||
#### `parseGitConfig`
|
||||
|
||||
Parses a git config file in INI text format into a JavaScript object.
|
||||
|
||||
```js
|
||||
import { parseGitConfig } from "pkg-types";
|
||||
|
||||
const gitConfigObj = parseGitConfig(gitConfigINI)
|
||||
```
|
||||
|
||||
#### `stringifyGitConfig`
|
||||
|
||||
Stringifies a git config object into a git config file INI text format.
|
||||
|
||||
```js
|
||||
import { stringifyGitConfig } from "pkg-types";
|
||||
|
||||
const gitConfigINI = stringifyGitConfig(gitConfigObj)
|
||||
```
|
||||
|
||||
## Types
|
||||
|
||||
**Note:** In order to make types working, you need to install `typescript` as a devDependency.
|
||||
|
||||
You can directly use typed interfaces:
|
||||
|
||||
```ts
|
||||
import type { TSConfig, PackageJSON, GitConfig } from "pkg-types";
|
||||
```
|
||||
|
||||
You can also use define utils for type support for using in plain `.js` files and auto-complete in IDE.
|
||||
|
||||
```js
|
||||
import type { definePackageJSON } from 'pkg-types'
|
||||
|
||||
const pkg = definePackageJSON({})
|
||||
```
|
||||
|
||||
```js
|
||||
import type { defineTSConfig } from 'pkg-types'
|
||||
|
||||
const pkg = defineTSConfig({})
|
||||
```
|
||||
|
||||
```js
|
||||
import type { defineGitConfig } from 'pkg-types'
|
||||
|
||||
const gitConfig = defineGitConfig({})
|
||||
```
|
||||
|
||||
## Alternatives
|
||||
|
||||
- [dominikg/tsconfck](https://github.com/dominikg/tsconfck)
|
||||
|
||||
## License
|
||||
|
||||
<!-- automd:contributors license=MIT author="pi0,danielroe" -->
|
||||
|
||||
Published under the [MIT](https://github.com/unjs/pkg-types/blob/main/LICENSE) license.
|
||||
Made by [@pi0](https://github.com/pi0), [@danielroe](https://github.com/danielroe) and [community](https://github.com/unjs/pkg-types/graphs/contributors) 💛
|
||||
<br><br>
|
||||
<a href="https://github.com/unjs/pkg-types/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=unjs/pkg-types" />
|
||||
</a>
|
||||
|
||||
<!-- /automd -->
|
||||
45
node_modules/local-pkg/node_modules/pkg-types/package.json
generated
vendored
Normal file
45
node_modules/local-pkg/node_modules/pkg-types/package.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "pkg-types",
|
||||
"version": "2.3.0",
|
||||
"description": "Node.js utilities and TypeScript definitions for `package.json` and `tsconfig.json`",
|
||||
"repository": "unjs/pkg-types",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
},
|
||||
"types": "./dist/index.d.mts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest --typecheck",
|
||||
"lint": "eslint && prettier -c src test",
|
||||
"lint:fix": "automd && eslint --fix . && prettier -w src test",
|
||||
"prepack": "pnpm build",
|
||||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
||||
"test": "vitest run --typecheck --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"confbox": "^0.2.2",
|
||||
"exsolve": "^1.0.7",
|
||||
"pathe": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@vitest/coverage-v8": "^3.2.4",
|
||||
"automd": "^0.4.0",
|
||||
"changelogen": "^0.6.2",
|
||||
"eslint": "^9.33.0",
|
||||
"eslint-config-unjs": "^0.5.0",
|
||||
"expect-type": "^1.2.2",
|
||||
"jiti": "^2.5.1",
|
||||
"prettier": "^3.6.2",
|
||||
"typescript": "^5.9.2",
|
||||
"unbuild": "^3.6.1",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.14.0"
|
||||
}
|
||||
65
node_modules/local-pkg/package.json
generated
vendored
Normal file
65
node_modules/local-pkg/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "local-pkg",
|
||||
"type": "module",
|
||||
"version": "1.1.2",
|
||||
"description": "Get information on local packages.",
|
||||
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
||||
"license": "MIT",
|
||||
"funding": "https://github.com/sponsors/antfu",
|
||||
"homepage": "https://github.com/antfu-collective/local-pkg#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/antfu-collective/local-pkg.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/antfu-collective/local-pkg/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"package"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"dependencies": {
|
||||
"mlly": "^1.7.4",
|
||||
"pkg-types": "^2.3.0",
|
||||
"quansync": "^0.2.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^5.2.1",
|
||||
"@antfu/ni": "^25.0.0",
|
||||
"@antfu/utils": "^9.2.0",
|
||||
"@types/chai": "^5.2.2",
|
||||
"@types/node": "^24.3.0",
|
||||
"bumpp": "^10.2.3",
|
||||
"chai": "^5.3.1",
|
||||
"eslint": "^9.33.0",
|
||||
"esno": "^4.8.0",
|
||||
"find-up-simple": "^1.0.1",
|
||||
"typescript": "^5.9.2",
|
||||
"unbuild": "^3.6.1",
|
||||
"unplugin-quansync": "^0.4.4",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"lint": "eslint .",
|
||||
"release": "bumpp",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run && node ./test/cjs.cjs && node ./test/esm.mjs"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user