npm package: @ikulichkov/fn-extractor
Description: ��# fn-extractor  CLI-CB8;8B0 4;O 872;5G5=8O :>40 87 JavaScript/TypeScript ?@>5:B>2 8 Roblox D09;>2.  ## >7<>6=>AB8  - **
Latest version: 1.5.2

��# fn-extractor

CLI-CB8;8B0 4;O 872;5G5=8O :>40 87 JavaScript/TypeScript ?@>5:B>2 8 Roblox D09;>2.

## >7<>6=>AB8

- **72;5G5=85 DC=:F89 87 JS/TS ?@>5:B>2** A 02B><0B8G5A:8< ?>8A:>< 7028A8<>AB59
- ** 01>B0 A Roblox ?@>5:B0<8** (.rbxlx D09;K)
- **>8A: DC=:F89 8 <>4C;59** 2 Lua-A:@8?B0E
- **72;5G5=85 7028A8<>AB59** 87 Roblox A:@8?B>2

## #AB0=>2:0

### :0: dev-7028A8<>ABL (@5:><5=4C5BAO)

```bash
npm  i -D @ikulichkov/fn-extractor
# 8;8
yarn add -D @ikulichkov/fn-extractor
````

### 3;>10;L=>

```bash
npm  i -g @ikulichkov/fn-extractor
# 8;8
yarn global add @ikulichkov/fn-extractor
```

## ><0=4K

### `fn`   72;5G5=85 DC=:F89 87 JS/TS ?@>5:B0

72;5:05B C:070==K5 DC=:F88 8 8E 7028A8<>AB8 87 JavaScript/TypeScript ?@>5:B0.

```bash
# 3;C18=0 7028A8<>AB59 ?> C<>;G0=8N   2
npx fn <FuncName>

# C:070BL A>1AB25==CN 3;C18=C (?@8<5@: 3)
npx fn <FuncName> 3

# =5A:>;L:> DC=:F89
npx fn FuncA FuncB FuncC

# C:070BL :>=:@5B=K9 D09; 4;O DC=:F88 (5A;8 5ABL 4C1;8:0BK)
npx fn MyFunc@src/utils.js
```

**0@0<5B@K:**

| @3C<5=B              | =0G5=85 ?> C<>;G0=8N | ?8A0=85                                                   |
| --------------------- | --------------------- | ---------------------------------------------------------- |
| `<FuncName> [FuncB& ]` |                       | <5=0 DC=:F89, :>B>@K5 =C6=> M:A?>@B8@>20BL                |
| `[depth]`             | `2`                   | 0:A8<0;L=0O 3;C18=0 @5:C@A82=>3> ?>8A:0 7028A8<KE DC=:F89 |

**KE>4=>9 D09;:** `functions.json`

```json
[
  {
    "path": "src/utils/math.js",
    "imports": [
      "import * as R from 'ramda';"
    ],
    "functions": {
      "sum": "export function sum(a, b) { return a + b; }"
    }
  }
]
```

---

### `extract`   72;5G5=85 :>40 87 ?0?:8

72;5:05B 25AL :>4 87 JS/CSS/HTML D09;>2 2 C:070==>9 48@5:B>@88.

```bash
# 872;5GL :>4 87 B5:CI59 48@5:B>@88
npx extract

# 872;5GL :>4 87 C:070==>9 48@5:B>@88
npx extract ./src
```

**KE>4=>9 D09;:** `extracted_codes.json`

```json
{
  "path/to/file.js": ":>4 D09;0...",
  "path/to/file.css": ":>4 D09;0...",
  "path/to/file.html": ":>4 D09;0..."
}
```

---

### `rbx`   72;5G5=85 A:@8?B>2 87 .rbxlx

0@A8B Roblox D09; (.rbxlx) 8 872;5:05B 2A5 A:@8?BK (Script, LocalScript, ModuleScript).

```bash
# =09B8 ?5@2K9 .rbxlx 2 B5:CI59 48@5:B>@88
npx rbx

# C:070BL :>=:@5B=K9 D09;
npx rbx game.rbxlx

# C:070BL D09; 8 2KE>4=>9 JSON
npx rbx game.rbxlx scripts.json

# C:070BL B>;L:> 2KE>4=>9 D09; (02B>-?>8A: .rbxlx)
npx rbx scripts.json
```

**KE>4=>9 D09;:** `scripts.json` (8;8 C:070==K9 D09;)

```json
{
  "ReplicatedStorage/MyModule": "local MyModule = {}\nreturn MyModule",
  "ServerScriptService/MyScript": "print('Hello')"
}
```

---

### `rbxfn`   >8A: DC=:F88 2 Roblox A:@8?B0E

I5B DC=:F8N ?> 8<5=8 2> 2A5E A:@8?B0E ?@>5:B0 8 872;5:05B 5Q :>4.

```bash
# ?>8A: 2 ?5@2>< .rbxlx 2 B5:CI59 48@5:B>@88
npx rbxfn MyFunction

# ?>8A: 2 C:070==>< .rbxlx 8;8 JSON
npx rbxfn MyFunction game.rbxlx
npx rbxfn MyFunction scripts.json
```

**KE>4=>9 D09;:** `rbxfn.json`

```json
{
  "ServerScriptService/MyScript": {
    "hits": [
      { "line": 5, "text": "function MyFunction()" }
    ],
    "function": {
      "name": "MyFunction",
      "startLine": 5,
      "endLine": 10,
      "code": "function MyFunction()\n  -- :>4 DC=:F88\nend"
    }
  }
}
```

---

### `rbxmodule`   >8A: <>4C;O 2 Roblox A:@8?B0E

I5B <>4C;L ?> 8<5=8 8 2A5 <5AB0, 345 >= 8A?>;L7C5BAO (require).

```bash
# ?>8A: 2 ?5@2>< .rbxlx
npx rbxmodule HeroConfig

# ?>8A: 2 C:070==>< D09;5
npx rbxmodule HeroConfig game.rbxlx
npx rbxmodule HeroConfig scripts.json
```

**KE>4=>9 D09;:** `rbxmodule.<ModuleName>.json`

```json
{
  "ReplicatedStorage/HeroConfig": {
    "code": "local HeroConfig = {}\nreturn HeroConfig",
    "requireLines": []
  },
  "ServerScriptService/MyScript": {
    "code": "local HeroConfig = require(...)",
    "requireLines": [
      { "line": 3, "text": "local HeroConfig = require(ReplicatedStorage:WaitForChild(\"HeroConfig\"))" }
    ]
  }
}
```

---

### `rbxfile`   72;5G5=85 A:@8?B0 A ?@O<K<8 7028A8<>ABO<8

72;5:05B C:070==K9 A:@8?B 8 B>;L:> 53> ?@O<K5 7028A8<>AB8 (require).

```bash
# 8=B5@0:B82=K9 2K1>@ A:@8?B0
npx rbxfile MyScript

# 87 C:070==>3> 8AB>G=8:0
npx rbxfile MyScript game.rbxlx
npx rbxfile MyScript scripts.json
```

**A>15==>AB8:**
- A;8 =0945=> =5A:>;L:> A:@8?B>2 A B0:8< 8<5=5<, ?>O28BAO 8=B5@0:B82=>5 <5=N 4;O 2K1>@0
- >445@68205BAO =02830F8O AB@5;:0<8 �!/�! 8 2K1>@ Enter

**KE>4=>9 D09;:** `rbxfile.json`

```json
{
  "entry": "ServerScriptService/MyScript",
  "files": {
    "ServerScriptService/MyScript": {
      "code": "local Config = require(...)",
      "requires": ["ReplicatedStorage/Config"]
    },
    "ReplicatedStorage/Config": {
      "code": "local Config = {}",
      "requires": []
    }
  }
}
```

---

### `rbxfilefull`   72;5G5=85 A:@8?B0 A> 2A5<8 7028A8<>ABO<8

72;5:05B C:070==K9 A:@8?B 8 **2A5** 53> 7028A8<>AB8 @5:C@A82=> (2:;NG0O 7028A8<>AB8 7028A8<>AB59).

```bash
# 8=B5@0:B82=K9 2K1>@ A:@8?B0
npx rbxfilefull MyScript

# 87 C:070==>3> 8AB>G=8:0
npx rbxfilefull MyScript game.rbxlx
npx rbxfilefull MyScript scripts.json
```

**KE>4=>9 D09;:** `rbxfilefull.json` (D>@<0B B0:>9 65, :0: C `rbxfile.json`, => A ?>;=K< 3@0D>< 7028A8<>AB59)

---

## KAB@K9 AB0@B

>102LB5 O@;K:8 2 `package.json`:

```jsonc
{
  "scripts": {
    "fn": "fn",
    "extract": "extract",
    "rbx": "rbx",
    "rbxfn": "rbxfn",
    "rbxmodule": "rbxmodule",
    "rbxfile": "rbxfile",
    "rbxfilefull": "rbxfilefull"
  }
}
```

"5?5@L <>6=> 8A?>;L7>20BL:
```bash
yarn fn MyFunc
yarn rbx
yarn rbxfn MyFunction
```

## 8F5=78O

MIT � 2025 Aleksey Kulichkov