importy 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/dist/index.js +8 -9
  3. package/package.json +37 -32
package/README.md CHANGED
@@ -6,7 +6,7 @@ A powerful CLI tool for analyzing JavaScript/TypeScript imports from libraries.
6
6
  [![npm version](https://img.shields.io/npm/v/importy.svg)](https://www.npmjs.com/package/importy)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
- > **Version 0.1.1** - First stable release! 🎉 See [CHANGELOG.md](CHANGELOG.md) for details.
9
+ > **Version 0.1.2** - See [CHANGELOG.md](CHANGELOG.md) for details.
10
10
 
11
11
  ## 📖 Documentation
12
12
 
@@ -45,7 +45,7 @@ yarn global add importy
45
45
  pnpm add -g importy
46
46
 
47
47
  # Verify installation
48
- importy --version # Should output: 0.1.0
48
+ importy --version # Should output: 0.1.2
49
49
  ```
50
50
 
51
51
  ## Usage
@@ -139,8 +139,8 @@ Importy uses parallel processing with promises, making it efficient even for lar
139
139
 
140
140
  ```bash
141
141
  # Clone the repository
142
- git clone https://github.com/yourusername/importy.git
143
- cd importy
142
+ git clone https://github.com/tvshevchuk/Importy.git
143
+ cd Importy
144
144
 
145
145
  # Install dependencies
146
146
  npm install
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@ import os from "os";
13
13
  import path from "path";
14
14
  import * as parser from "@babel/parser";
15
15
  import _traverse from "@babel/traverse";
16
- var traverse = _traverse.default;
16
+ import picomatch from "picomatch";
17
+ var traverse = typeof _traverse === "function" ? _traverse : _traverse.default;
17
18
  function isJavaScriptFile(file) {
18
19
  return /\.(js|ts|jsx|tsx)$/.test(file);
19
20
  }
@@ -24,15 +25,15 @@ function getAllFiles(dirPath, arrayOfFiles = [], includePattern, excludePattern,
24
25
  const fullPath = path.join(dirPath, file);
25
26
  try {
26
27
  const stat = fs.statSync(fullPath);
27
- if (excludePattern && stat.isDirectory() && minimatch(fullPath, excludePattern)) {
28
+ if (excludePattern && stat.isDirectory() && matchesPattern(fullPath, excludePattern)) {
28
29
  if (verbose) console.log(`Skipping excluded directory: ${fullPath}`);
29
30
  continue;
30
31
  }
31
32
  if (stat.isDirectory()) {
32
33
  getAllFiles(fullPath, arrayOfFiles, includePattern, excludePattern, verbose);
33
34
  } else if (isJavaScriptFile(fullPath)) {
34
- const shouldInclude = !includePattern || minimatch(fullPath, includePattern);
35
- const shouldExclude = excludePattern && minimatch(fullPath, excludePattern);
35
+ const shouldInclude = !includePattern || matchesPattern(fullPath, includePattern);
36
+ const shouldExclude = excludePattern && matchesPattern(fullPath, excludePattern);
36
37
  if (shouldInclude && !shouldExclude) {
37
38
  arrayOfFiles.push(fullPath);
38
39
  } else if (verbose) {
@@ -54,12 +55,10 @@ function getAllFiles(dirPath, arrayOfFiles = [], includePattern, excludePattern,
54
55
  }
55
56
  return arrayOfFiles;
56
57
  }
57
- function minimatch(filePath, pattern) {
58
+ function matchesPattern(filePath, pattern) {
58
59
  try {
59
- const regExpPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(/{{GLOBSTAR}}/g, ".*");
60
- const regex = new RegExp(`^${regExpPattern}$`, "i");
61
- const result = regex.test(filePath);
62
- return result;
60
+ const isMatch = picomatch(pattern, { dot: true });
61
+ return isMatch(filePath);
63
62
  } catch (_error) {
64
63
  console.warn(`Invalid pattern: ${pattern}`);
65
64
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "importy",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A CLI tool for analyzing JavaScript/TypeScript imports from libraries",
5
5
  "homepage": "https://tvshevchuk.github.io/Importy/",
6
6
  "bugs": {
@@ -20,27 +20,58 @@
20
20
  },
21
21
  "author": "Taras Shevchuk",
22
22
  "license": "MIT",
23
+ "packageManager": "pnpm@10.11.1",
23
24
  "publishConfig": {
24
25
  "registry": "https://registry.npmjs.org/"
25
26
  },
26
27
  "files": [
27
28
  "dist"
28
29
  ],
30
+ "scripts": {
31
+ "build": "tsup src/index.ts",
32
+ "start": "node dist/index.js",
33
+ "dev": "ts-node src/index.ts",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
36
+ "lint": "biome lint src/",
37
+ "lint:fix": "biome lint --write src/",
38
+ "format": "biome format src/",
39
+ "format:fix": "biome format --write src/",
40
+ "check": "biome check src/",
41
+ "check:fix": "biome check --write src/",
42
+ "prebuild": "npm run check",
43
+ "prepublishOnly": "npm run test && npm run build",
44
+ "version": "npm run check:fix && git add -A src",
45
+ "postversion": "git push && git push --tags",
46
+ "release": "./scripts/release.sh",
47
+ "release:patch": "./scripts/release.sh patch",
48
+ "release:minor": "./scripts/release.sh minor",
49
+ "release:major": "./scripts/release.sh major",
50
+ "release:check": "./scripts/release.sh --check",
51
+ "release:manual": "./scripts/release.sh --manual",
52
+ "prerelease": "npm run test && npm run check",
53
+ "docs:dev": "vitepress dev docs",
54
+ "docs:build": "vitepress build docs",
55
+ "docs:preview": "vitepress preview docs"
56
+ },
29
57
  "devDependencies": {
30
58
  "@babel/types": "7.27.3",
31
59
  "@biomejs/biome": "1.9.4",
32
60
  "@types/babel__traverse": "7.20.7",
33
61
  "@types/node": "22.15.29",
62
+ "@types/picomatch": "4.0.2",
34
63
  "ts-node": "10.9.2",
35
64
  "tsup": "8.5.0",
36
65
  "typescript": "5.8.3",
37
- "vitepress": "^1.6.3",
38
- "vitest": "1.6.1"
66
+ "vitepress": "1.6.3",
67
+ "vitest": "1.6.1",
68
+ "vue": "3.5.16"
39
69
  },
40
70
  "dependencies": {
41
71
  "@babel/parser": "7.27.5",
42
72
  "@babel/traverse": "7.27.4",
43
- "commander": "14.0.0"
73
+ "commander": "14.0.0",
74
+ "picomatch": "4.0.3"
44
75
  },
45
76
  "keywords": [
46
77
  "cli",
@@ -84,31 +115,5 @@
84
115
  "dead-code",
85
116
  "refactor",
86
117
  "migration"
87
- ],
88
- "scripts": {
89
- "build": "tsup src/index.ts",
90
- "start": "node dist/index.js",
91
- "dev": "ts-node src/index.ts",
92
- "test": "vitest run",
93
- "test:watch": "vitest",
94
- "lint": "biome lint src/",
95
- "lint:fix": "biome lint --write src/",
96
- "format": "biome format src/",
97
- "format:fix": "biome format --write src/",
98
- "check": "biome check src/",
99
- "check:fix": "biome check --write src/",
100
- "prebuild": "npm run check",
101
- "version": "npm run check:fix && git add -A src",
102
- "postversion": "git push && git push --tags",
103
- "release": "./scripts/release.sh",
104
- "release:patch": "./scripts/release.sh patch",
105
- "release:minor": "./scripts/release.sh minor",
106
- "release:major": "./scripts/release.sh major",
107
- "release:check": "./scripts/release.sh --check",
108
- "release:manual": "./scripts/release.sh --manual",
109
- "prerelease": "npm run test && npm run check",
110
- "docs:dev": "vitepress dev docs",
111
- "docs:build": "vitepress build docs",
112
- "docs:preview": "vitepress preview docs"
113
- }
114
- }
118
+ ]
119
+ }