Commit dd30f92
committed
perf(build): bundle all deps and stub heavy internals
Move @socketsecurity/lib and form-data from dependencies to
devDependencies so esbuild bundles them into the dist output,
making the SDK a zero-runtime-dependency package.
Add esbuild stub plugin to replace heavy modules with minimal stubs:
@socketsecurity/lib internals:
- npm-pack.js (2.5MB): npm tooling (arborist, cacache, pacote, semver)
— cacache usage degrades gracefully (safeGet returns undefined,
in-memory memoization still works)
- pico-pack.js (260KB): glob deps (picomatch, fast-glob, del)
- external-pack.js (134KB): replaced with identity-function shim for
yoctocolorsCjs (the only export the SDK reaches via logger.js) —
the SDK is a library, not a CLI, so terminal coloring is overhead
- globs.js, sorts.js: gateway modules to pico-pack and npm-pack
Third-party:
- mime-db (212KB): replaced with 3-entry lookup for the MIME types
the SDK actually uses (application/json, application/octet-stream,
multipart/form-data). Safe because the SDK always passes explicit
contentType to form-data, so mime.lookup is never called.
dist/index.js: 3,897KB → 568KB (85% reduction), zero dependencies.1 parent 3905010 commit dd30f92
4 files changed
Lines changed: 91 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
209 | 276 | | |
210 | 277 | | |
211 | 278 | | |
| |||
226 | 293 | | |
227 | 294 | | |
228 | 295 | | |
229 | | - | |
230 | | - | |
231 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
232 | 301 | | |
233 | 302 | | |
234 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 67 | | |
72 | 68 | | |
| 69 | + | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| |||
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
| 87 | + | |
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
| |||
120 | 118 | | |
121 | 119 | | |
122 | 120 | | |
123 | | - | |
| 121 | + | |
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments