diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000..e5b6d8d --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000..6e8b055 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.changeset/small-emus-guess.md b/.changeset/small-emus-guess.md new file mode 100644 index 0000000..cc57051 --- /dev/null +++ b/.changeset/small-emus-guess.md @@ -0,0 +1,5 @@ +--- +'dts-buddy': patch +--- + +feat: upgrade to tinyglobby diff --git a/package.json b/package.json index 7eac9da..3ad477d 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,11 @@ "dependencies": { "@jridgewell/source-map": "^0.3.5", "@jridgewell/sourcemap-codec": "^1.4.15", - "globrex": "^0.1.2", "kleur": "^4.1.5", "locate-character": "^3.0.0", "magic-string": "^0.30.4", "sade": "^1.8.1", - "tiny-glob": "^0.2.9", + "tinyglobby": "^0.2.10", "ts-api-utils": "^1.0.3" }, "peerDependencies": { @@ -24,7 +23,6 @@ }, "devDependencies": { "@changesets/cli": "^2.28.1", - "@types/globrex": "^0.1.2", "@types/node": "^20.7.2", "@types/semver": "^7.5.3", "prettier": "^3.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a18e03..becb92e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: '@jridgewell/sourcemap-codec': specifier: ^1.4.15 version: 1.4.15 - globrex: - specifier: ^0.1.2 - version: 0.1.2 kleur: specifier: ^4.1.5 version: 4.1.5 @@ -29,9 +26,9 @@ importers: sade: specifier: ^1.8.1 version: 1.8.1 - tiny-glob: - specifier: ^0.2.9 - version: 0.2.9 + tinyglobby: + specifier: ^0.2.10 + version: 0.2.10 ts-api-utils: specifier: ^1.0.3 version: 1.0.3(typescript@5.7.3) @@ -39,9 +36,6 @@ importers: '@changesets/cli': specifier: ^2.28.1 version: 2.28.1 - '@types/globrex': - specifier: ^0.1.2 - version: 0.1.2 '@types/node': specifier: ^20.7.2 version: 20.8.6 @@ -161,9 +155,6 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@types/globrex@0.1.2': - resolution: {integrity: sha512-W+8iW69LnEae5H09PxjpmI3CdJyKUTBAoDyqWx6T5ewhX5unBHYYQsGYXlXQP8l3HE/Y71vswPAvxkJC92FQhQ==} - '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} @@ -246,6 +237,14 @@ packages: fastq@1.19.0: resolution: {integrity: sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==} + fdir@6.4.2: + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -266,16 +265,10 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} - globalyzer@0.1.0: - resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} - globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} - globrex@0.1.2: - resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} - graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -404,6 +397,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} @@ -485,8 +482,9 @@ packages: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} - tiny-glob@0.2.9: - resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==} + tinyglobby@0.2.10: + resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} + engines: {node: '>=12.0.0'} tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} @@ -725,8 +723,6 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.0 - '@types/globrex@0.1.2': {} - '@types/node@12.20.55': {} '@types/node@20.8.6': @@ -800,6 +796,10 @@ snapshots: dependencies: reusify: 1.0.4 + fdir@6.4.2(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -825,8 +825,6 @@ snapshots: dependencies: is-glob: 4.0.3 - globalyzer@0.1.0: {} - globby@11.1.0: dependencies: array-union: 2.1.0 @@ -836,8 +834,6 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 - globrex@0.1.2: {} - graceful-fs@4.2.11: {} human-id@4.1.1: {} @@ -932,6 +928,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + pify@4.0.1: {} prettier@2.8.8: {} @@ -992,10 +990,10 @@ snapshots: term-size@2.2.1: {} - tiny-glob@0.2.9: + tinyglobby@0.2.10: dependencies: - globalyzer: 0.1.0 - globrex: 0.1.2 + fdir: 6.4.2(picomatch@4.0.2) + picomatch: 4.0.2 tmp@0.0.33: dependencies: diff --git a/src/utils.js b/src/utils.js index 55fd943..7364d2e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,8 +1,7 @@ /** @import { Binding, Declaration, Module, Namespace } from './types' */ import fs from 'node:fs'; import path from 'node:path'; -import glob from 'tiny-glob/sync.js'; -import globrex from 'globrex'; +import { globSync } from 'tinyglobby'; import ts from 'typescript'; import * as tsu from 'ts-api-utils'; import { getLocator } from 'locate-character'; @@ -158,10 +157,10 @@ export function get_input_files(cwd, include, exclude) { const included = new Set(); for (const pattern of include) { - for (const file of glob(pattern, { cwd })) { + for (const file of globSync(pattern, { cwd })) { const resolved = path.resolve(cwd, file); if (fs.statSync(resolved).isDirectory()) { - for (const file of glob('**/*.{js,jsx,ts,tsx}', { cwd: resolved })) { + for (const file of globSync('**/*.{js,jsx,ts,tsx}', { cwd: resolved, ignore: exclude })) { included.add(path.resolve(resolved, file)); } } else { @@ -170,14 +169,7 @@ export function get_input_files(cwd, include, exclude) { } } - let input = Array.from(included); - - for (const pattern of exclude) { - const { regex } = globrex(pattern, { globstar: true }); - input = input.filter((file) => !regex.test(file)); - } - - return input.map((file) => path.resolve(file)); + return Array.from(included).map((file) => path.resolve(file)); } /** diff --git a/test/test.js b/test/test.js index 6fbc139..66568ea 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ import fs from 'node:fs'; -import glob from 'tiny-glob/sync.js'; +import { globSync } from 'tinyglobby'; import { test } from 'uvu'; import * as assert from 'uvu/assert'; import { createBundle } from '../src/index.js'; @@ -26,7 +26,7 @@ for (const sample of fs.readdirSync('test/samples')) { : {}) }; - for (const file of glob('**', { cwd: `${dir}/input`, filesOnly: true })) { + for (const file of globSync('**', { cwd: `${dir}/input`, onlyFiles: true })) { const parts = file.split(/[\/\\]/); const basename = parts.pop(); @@ -60,8 +60,8 @@ for (const sample of fs.readdirSync('test/samples')) { } } - const actual = glob('**', { cwd: `${dir}/actual`, filesOnly: true }).sort(); - const output = glob('**', { cwd: `${dir}/${output_dir}`, filesOnly: true }).sort(); + const actual = globSync('**', { cwd: `${dir}/actual`, onlyFiles: true }).sort(); + const output = globSync('**', { cwd: `${dir}/${output_dir}`, onlyFiles: true }).sort(); assert.equal(actual, output);