From 2ba7b2f86c337100d2eafda16525705750e12d9c Mon Sep 17 00:00:00 2001 From: Viktor <8722478+binjospookie@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:14:26 +0300 Subject: [PATCH] added: see log --- CHANGELOG.md | 10 ++ package-lock.json | 12 +-- package.json | 4 +- src/api/findUnusedExports.ts | 5 +- website/package-lock.json | 111 ++++++++++++----------- website/package.json | 4 +- website/src/content/docs/intro/js-api.md | 8 +- 7 files changed, 89 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a60b0ee..17c0e07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,16 @@ title: Change Log The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](http://semver.org). +## 1.1.0 + +### Added + +- `pkgName` to JS Api -> `findUnusedExports` + +### Changed + +- bump dev deps + ## 1.0.7 ### Changed diff --git a/package-lock.json b/package-lock.json index 08f7f01..a8a8ee8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pure-index", - "version": "1.0.7", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pure-index", - "version": "1.0.7", + "version": "1.1.0", "license": "MIT", "dependencies": { "@swc/core": "1.4.2", @@ -20,7 +20,7 @@ "pure-index": "dist/bin/index.js" }, "devDependencies": { - "@types/node": "20.11.19", + "@types/node": "20.11.24", "effector": "23.2.0", "prettier": "3.2.5", "tsup": "8.0.2", @@ -901,9 +901,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/package.json b/package.json index 094f473..c5443d8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pure-index", "type": "module", - "version": "1.0.7", + "version": "1.1.0", "description": "Pure Index is a tool for packages. It helps to clean your packages of unused exports with ease.", "main": "./dist/api/index.js", "types": "./dist/api/index.d.ts", @@ -27,7 +27,7 @@ "node": ">= 16" }, "devDependencies": { - "@types/node": "20.11.19", + "@types/node": "20.11.24", "effector": "23.2.0", "prettier": "3.2.5", "tsup": "8.0.2", diff --git a/src/api/findUnusedExports.ts b/src/api/findUnusedExports.ts index 5a30155..0a43690 100644 --- a/src/api/findUnusedExports.ts +++ b/src/api/findUnusedExports.ts @@ -36,6 +36,7 @@ export const mergeUnusedExports = ( type Params = { entry: string; location?: string; + pkgName?: string; }; type ListItem = { @@ -46,8 +47,8 @@ type ListItem = { parserConfig?: Config['parserConfig']; }; -const findUnusedExports = async ({ entry, location = '' }: Params, list: ListItem[]) => { - const { name } = await readJSON(join(location, 'package.json')); +const findUnusedExports = async ({ entry, location = '', pkgName }: Params, list: ListItem[]) => { + const name = pkgName || (await readJSON(join(location, 'package.json'))).name; const pkg = { name, path: join(location, entry) }; const tasks = list.map((x) => diff --git a/website/package-lock.json b/website/package-lock.json index 5f21c86..7db5005 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -8,8 +8,8 @@ "name": "website", "version": "0.0.1", "dependencies": { - "@astrojs/starlight": "^0.19.1", - "astro": "^4.4.1", + "@astrojs/starlight": "^0.21.1", + "astro": "^4.4.9", "sharp": "0.33.2" } }, @@ -105,18 +105,20 @@ } }, "node_modules/@astrojs/starlight": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@astrojs/starlight/-/starlight-0.19.1.tgz", - "integrity": "sha512-HcrgWAdOJRVRhiOf4TySzpCek/6N56jq5Iz0ahDTE5Fv2tHHA2cLIRAOvVF+iPNVZa349hqv6QSCmzUHA2JK4Q==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@astrojs/starlight/-/starlight-0.21.1.tgz", + "integrity": "sha512-nQ5EwKnB3eI8jxQrbgzZJJcyxeIiL3GzsAhl//1fE541MlD+PKy53v1PsYPi/RILdjt1Pg39rf1fkJC/rhXRgw==", "dependencies": { "@astrojs/mdx": "^2.1.1", "@astrojs/sitemap": "^3.0.5", "@pagefind/default-ui": "^1.0.3", "@types/hast": "^3.0.3", "@types/mdast": "^4.0.3", - "astro-expressive-code": "^0.32.4", + "astro-expressive-code": "^0.33.4", "bcp-47": "^2.1.0", + "hast-util-from-html": "^2.0.1", "hast-util-select": "^6.0.2", + "hast-util-to-string": "^3.0.0", "hastscript": "^8.0.0", "mdast-util-directive": "^3.0.0", "mdast-util-to-markdown": "^2.1.0", @@ -860,9 +862,9 @@ } }, "node_modules/@expressive-code/core": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@expressive-code/core/-/core-0.32.4.tgz", - "integrity": "sha512-S0OwgZCy29OCcwFUBTLDrShUovIUWZcQn3EvSoKsGfzf/wTisK7XqZ1uH0Y7Mlof3Hf9uJMjOhJZvxTLtQUdSQ==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@expressive-code/core/-/core-0.33.4.tgz", + "integrity": "sha512-IywACrwcR/7cIPBQ1qG/RsgvNp85/CAX6okxR0Niztrd7rh4IcEhAsz51jX/NPNnhU9yPynTT+mLdM1URqrnvw==", "dependencies": { "@ctrl/tinycolor": "^3.6.0", "hast-util-to-html": "^8.0.4", @@ -1119,11 +1121,11 @@ } }, "node_modules/@expressive-code/plugin-frames": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-frames/-/plugin-frames-0.32.4.tgz", - "integrity": "sha512-XOQrLqlVEy5JbqsBhDcSJQinceQ5j/Z8cE0/27Lnlcj4oXRdiQNjMVtstC/xZUeWEbm+FI9ZZP4Z9yihol61Aw==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-frames/-/plugin-frames-0.33.4.tgz", + "integrity": "sha512-6HE5f8dAPjzmhs7yZJHVyH+w/UwVpktjlTvrUumrytHo6hidGlkB5lptWJlSAd9JXzev5BQEb4xrqQ0xQqO5+A==", "dependencies": { - "@expressive-code/core": "^0.32.4", + "@expressive-code/core": "^0.33.4", "hastscript": "^7.2.0" } }, @@ -1169,28 +1171,20 @@ } }, "node_modules/@expressive-code/plugin-shiki": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-shiki/-/plugin-shiki-0.32.4.tgz", - "integrity": "sha512-zZzTXFFTpG+fmBG6C+4KzIyh1nFPdn4gLJ8E9LhBVufmRkn3gZplkE99lulfillsKyUZTRw3+dC3xYZWEZKzPw==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-shiki/-/plugin-shiki-0.33.4.tgz", + "integrity": "sha512-XnDchHqCGk046hgQnu83t9+SDrRjsvpvUEBiI0wl4RljVDr1E0yllx0y6C1yEuKfFfasib6BxX/PkItgQdi/0Q==", "dependencies": { - "@expressive-code/core": "^0.32.4", - "shikiji": "^0.8.0" - } - }, - "node_modules/@expressive-code/plugin-shiki/node_modules/shikiji": { - "version": "0.8.7", - "resolved": "https://registry.npmjs.org/shikiji/-/shikiji-0.8.7.tgz", - "integrity": "sha512-j5usxwI0yHkDTHOuhuSJl9+wT5CNYeYO82dJMSJBlJ/NYT5SIebGcPoL6y9QOyH15wGrJC4LOP2nz5k8mUDGRQ==", - "dependencies": { - "hast-util-to-html": "^9.0.0" + "@expressive-code/core": "^0.33.4", + "shiki": "^1.1.7" } }, "node_modules/@expressive-code/plugin-text-markers": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.32.4.tgz", - "integrity": "sha512-lFlo3uwTp7vUmfXtLPn2aXs0CPFqdFvKiR3y8gtNzmBeYWPqVahF4RFUCN9ZpztCmXp5V8p2ADvNHzoNwCBwzA==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.33.4.tgz", + "integrity": "sha512-hl3E+8iZJMYGDaKsN4bOPOEBb9QeFjg+zQkOJRtjJgsmIYmaZpoQTzTg/JMduE8PLNsD30nAMwG/AbjN/klwZQ==", "dependencies": { - "@expressive-code/core": "^0.32.4", + "@expressive-code/core": "^0.33.4", "hastscript": "^7.2.0", "unist-util-visit-parents": "^5.1.3" } @@ -1979,6 +1973,11 @@ "win32" ] }, + "node_modules/@shikijs/core": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.1.7.tgz", + "integrity": "sha512-gTYLUIuD1UbZp/11qozD3fWpUTuMqPSf3svDMMrL0UmlGU7D9dPw/V1FonwAorCUJBltaaESxq90jrSjQyGixg==" + }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", @@ -2249,9 +2248,9 @@ } }, "node_modules/astro": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/astro/-/astro-4.4.1.tgz", - "integrity": "sha512-nJLgNg8UXKBJYXjWtekgv1TYZES++LAdShgyKL8L5yJMeiqlDSO+/Laq5VfRKoL9hzBdyolJMB0WDE/+bRZytg==", + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/astro/-/astro-4.4.9.tgz", + "integrity": "sha512-FTWhzKjao7rHHiF/CqPqPS18AFad+fmUcYUFhWWIsYETHcc9g0IIIiv6cHXUE7g6mEZf7ycAa+WdboeEHUhraQ==", "dependencies": { "@astrojs/compiler": "^2.5.3", "@astrojs/internal-helpers": "0.2.1", @@ -2312,7 +2311,7 @@ "tsconfck": "^3.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.1", - "vite": "^5.1.2", + "vite": "^5.1.4", "vitefu": "^0.2.5", "which-pm": "^2.1.1", "yargs-parser": "^21.1.1", @@ -2330,12 +2329,12 @@ } }, "node_modules/astro-expressive-code": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.32.4.tgz", - "integrity": "sha512-/Kq8wLMz0X2gbLWGmPryqEdFV/om/GROsoLtPFqLrLCRD5CpwxXAW185BIGZKf4iYsyJim1vvcpQm5Y9hV5B1g==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/astro-expressive-code/-/astro-expressive-code-0.33.4.tgz", + "integrity": "sha512-PtXLjd89WBA1WsDYlt3V1LZs9Pa8FFoXilaGDSyfxtbYJ2OPHjWh2JJvCiXmfXmY3HkPJ2oW9Jjo6om5vUlVcg==", "dependencies": { "hast-util-to-html": "^8.0.4", - "remark-expressive-code": "^0.32.4" + "remark-expressive-code": "^0.33.4" }, "peerDependencies": { "astro": "^3.3.0 || ^4.0.0-beta" @@ -3497,14 +3496,14 @@ } }, "node_modules/expressive-code": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/expressive-code/-/expressive-code-0.32.4.tgz", - "integrity": "sha512-r+yUP2JV181tVR2EyYked7lT2W8bvL9o7xpdKU6q60FMU7Wh/DbGtH0jg+WmDxKK1C57iXF9chbBv+BsDPlUEQ==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/expressive-code/-/expressive-code-0.33.4.tgz", + "integrity": "sha512-vb6DLHjG+jbLJGTvOUhxagsru7oUiBrQEsL9+hcWJvlxIqQ5mRFqjamQS9kCIhXXbfYWiYI7/wfTGxQxuHxsZQ==", "dependencies": { - "@expressive-code/core": "^0.32.4", - "@expressive-code/plugin-frames": "^0.32.4", - "@expressive-code/plugin-shiki": "^0.32.4", - "@expressive-code/plugin-text-markers": "^0.32.4" + "@expressive-code/core": "^0.33.4", + "@expressive-code/plugin-frames": "^0.33.4", + "@expressive-code/plugin-shiki": "^0.33.4", + "@expressive-code/plugin-text-markers": "^0.33.4" } }, "node_modules/extend": { @@ -6377,11 +6376,11 @@ } }, "node_modules/remark-expressive-code": { - "version": "0.32.4", - "resolved": "https://registry.npmjs.org/remark-expressive-code/-/remark-expressive-code-0.32.4.tgz", - "integrity": "sha512-khV7fVBpVDOyz9EXU+6MFwLj7BtY3DLVlNMMJYQcfp9ksLMxG/i83rIJbMUZCRof9bDBmFFlrF0VDvqJ0/MNeQ==", + "version": "0.33.4", + "resolved": "https://registry.npmjs.org/remark-expressive-code/-/remark-expressive-code-0.33.4.tgz", + "integrity": "sha512-ucGzDknAY6LJKkcNSaYh9N0SEr1LDA0shageM1xa+4fu/o+7g6R1/ApF7d2c+cj1ERLvaF4OaUa87n5baY+MDA==", "dependencies": { - "expressive-code": "^0.32.4", + "expressive-code": "^0.33.4", "hast-util-to-html": "^8.0.4", "unist-util-visit": "^4.1.2" } @@ -7315,6 +7314,14 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.1.7.tgz", + "integrity": "sha512-9kUTMjZtcPH3i7vHunA6EraTPpPOITYTdA5uMrvsJRexktqP0s7P3s9HVK80b4pP42FRVe03D7fT3NmJv2yYhw==", + "dependencies": { + "@shikijs/core": "1.1.7" + } + }, "node_modules/shikiji": { "version": "0.9.19", "resolved": "https://registry.npmjs.org/shikiji/-/shikiji-0.9.19.tgz", @@ -7948,9 +7955,9 @@ } }, "node_modules/vite": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.3.tgz", - "integrity": "sha512-UfmUD36DKkqhi/F75RrxvPpry+9+tTkrXfMNZD+SboZqBCMsxKtO52XeGzzuh7ioz+Eo/SYDBbdb0Z7vgcDJew==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.4.tgz", + "integrity": "sha512-n+MPqzq+d9nMVTKyewqw6kSt+R3CkvF9QAKY8obiQn8g1fwTscKxyfaYnC632HtBXAQGc1Yjomphwn1dtwGAHg==", "dependencies": { "esbuild": "^0.19.3", "postcss": "^8.4.35", diff --git a/website/package.json b/website/package.json index edf7268..e78a235 100644 --- a/website/package.json +++ b/website/package.json @@ -10,8 +10,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/starlight": "^0.19.1", - "astro": "^4.4.1", + "@astrojs/starlight": "^0.21.1", + "astro": "^4.4.9", "sharp": "0.33.2" }, "volta": { diff --git a/website/src/content/docs/intro/js-api.md b/website/src/content/docs/intro/js-api.md index 39b799c..403d4b3 100644 --- a/website/src/content/docs/intro/js-api.md +++ b/website/src/content/docs/intro/js-api.md @@ -34,7 +34,13 @@ Path to the package index file. Relative to the package location. - **Required**: `false` - **Default**: `''` -Path to the directory containing `package.json` of the package. Relative to the directory of the script call. +#### pkgName + +- **Type**: `string` +- **Required**: `false` +- **Default**: `undefined` + +Allows you to specify the name of the package to be searched (instead of `package.json -> name`). #### repositories