@colbymchenry/codegraph 0.7.10 → 0.9.0
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.
- package/README.md +70 -54
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1232
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1048
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1279
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -109
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -53
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -338
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -63
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -27
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -246
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -86
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -355
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -59
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -200
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1319
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -89
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -170
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -41
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -129
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -347
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/index.d.ts +0 -13
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -17
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -184
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -70
package/dist/utils.js
DELETED
|
@@ -1,549 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CodeGraph Utilities
|
|
4
|
-
*
|
|
5
|
-
* Common utility functions for memory management, concurrency, batching,
|
|
6
|
-
* and security validation.
|
|
7
|
-
*
|
|
8
|
-
* @module utils
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { Mutex, processInBatches, MemoryMonitor, validatePathWithinRoot } from 'codegraph';
|
|
13
|
-
*
|
|
14
|
-
* // Use mutex for concurrent safety
|
|
15
|
-
* const mutex = new Mutex();
|
|
16
|
-
* await mutex.withLock(async () => {
|
|
17
|
-
* await performCriticalOperation();
|
|
18
|
-
* });
|
|
19
|
-
*
|
|
20
|
-
* // Process items in batches to manage memory
|
|
21
|
-
* const results = await processInBatches(items, 100, async (item) => {
|
|
22
|
-
* return await processItem(item);
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* // Monitor memory usage
|
|
26
|
-
* const monitor = new MemoryMonitor(512, (usage) => {
|
|
27
|
-
* console.warn(`Memory usage exceeded 512MB: ${usage / 1024 / 1024}MB`);
|
|
28
|
-
* });
|
|
29
|
-
* monitor.start();
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
33
|
-
if (k2 === undefined) k2 = k;
|
|
34
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
35
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
36
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
37
|
-
}
|
|
38
|
-
Object.defineProperty(o, k2, desc);
|
|
39
|
-
}) : (function(o, m, k, k2) {
|
|
40
|
-
if (k2 === undefined) k2 = k;
|
|
41
|
-
o[k2] = m[k];
|
|
42
|
-
}));
|
|
43
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
44
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
45
|
-
}) : function(o, v) {
|
|
46
|
-
o["default"] = v;
|
|
47
|
-
});
|
|
48
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
49
|
-
var ownKeys = function(o) {
|
|
50
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
51
|
-
var ar = [];
|
|
52
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
53
|
-
return ar;
|
|
54
|
-
};
|
|
55
|
-
return ownKeys(o);
|
|
56
|
-
};
|
|
57
|
-
return function (mod) {
|
|
58
|
-
if (mod && mod.__esModule) return mod;
|
|
59
|
-
var result = {};
|
|
60
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
61
|
-
__setModuleDefault(result, mod);
|
|
62
|
-
return result;
|
|
63
|
-
};
|
|
64
|
-
})();
|
|
65
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
-
exports.MemoryMonitor = exports.Mutex = exports.FileLock = void 0;
|
|
67
|
-
exports.validatePathWithinRoot = validatePathWithinRoot;
|
|
68
|
-
exports.validateProjectPath = validateProjectPath;
|
|
69
|
-
exports.isPathWithinRoot = isPathWithinRoot;
|
|
70
|
-
exports.isPathWithinRootReal = isPathWithinRootReal;
|
|
71
|
-
exports.safeJsonParse = safeJsonParse;
|
|
72
|
-
exports.clamp = clamp;
|
|
73
|
-
exports.normalizePath = normalizePath;
|
|
74
|
-
exports.processInBatches = processInBatches;
|
|
75
|
-
exports.readFileInChunks = readFileInChunks;
|
|
76
|
-
exports.debounce = debounce;
|
|
77
|
-
exports.throttle = throttle;
|
|
78
|
-
exports.estimateSize = estimateSize;
|
|
79
|
-
const fs = __importStar(require("fs"));
|
|
80
|
-
const path = __importStar(require("path"));
|
|
81
|
-
// ============================================================
|
|
82
|
-
// SECURITY UTILITIES
|
|
83
|
-
// ============================================================
|
|
84
|
-
/**
|
|
85
|
-
* Sensitive system directories that should never be used as project roots.
|
|
86
|
-
* Checked on all platforms; non-applicable paths are harmlessly skipped.
|
|
87
|
-
*/
|
|
88
|
-
const SENSITIVE_PATHS = new Set([
|
|
89
|
-
'/', '/etc', '/usr', '/bin', '/sbin', '/var', '/tmp', '/dev', '/proc', '/sys',
|
|
90
|
-
'/root', '/boot', '/lib', '/lib64', '/opt',
|
|
91
|
-
'C:\\', 'C:\\Windows', 'C:\\Windows\\System32',
|
|
92
|
-
]);
|
|
93
|
-
/**
|
|
94
|
-
* Validate that a resolved file path stays within the project root.
|
|
95
|
-
* Prevents path traversal attacks (e.g. node.filePath = "../../etc/passwd").
|
|
96
|
-
*
|
|
97
|
-
* @param projectRoot - The project root directory
|
|
98
|
-
* @param filePath - The relative file path to validate
|
|
99
|
-
* @returns The resolved absolute path, or null if it escapes the root
|
|
100
|
-
*/
|
|
101
|
-
function validatePathWithinRoot(projectRoot, filePath) {
|
|
102
|
-
const resolved = path.resolve(projectRoot, filePath);
|
|
103
|
-
const normalizedRoot = path.resolve(projectRoot);
|
|
104
|
-
if (!resolved.startsWith(normalizedRoot + path.sep) && resolved !== normalizedRoot) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
return resolved;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Validate that a path is a safe project root directory.
|
|
111
|
-
*
|
|
112
|
-
* Rejects sensitive system directories and ensures the path is
|
|
113
|
-
* a real, existing directory. Used at MCP and API entry points
|
|
114
|
-
* to prevent arbitrary directory access.
|
|
115
|
-
*
|
|
116
|
-
* @param dirPath - The path to validate
|
|
117
|
-
* @returns An error message if invalid, or null if valid
|
|
118
|
-
*/
|
|
119
|
-
function validateProjectPath(dirPath) {
|
|
120
|
-
const resolved = path.resolve(dirPath);
|
|
121
|
-
// Block sensitive system directories
|
|
122
|
-
if (SENSITIVE_PATHS.has(resolved) || SENSITIVE_PATHS.has(resolved.toLowerCase())) {
|
|
123
|
-
return `Refusing to operate on sensitive system directory: ${resolved}`;
|
|
124
|
-
}
|
|
125
|
-
// Also block common sensitive home subdirectories
|
|
126
|
-
const homeDir = require('os').homedir();
|
|
127
|
-
const sensitiveHomeDirs = ['.ssh', '.gnupg', '.aws', '.config'];
|
|
128
|
-
for (const dir of sensitiveHomeDirs) {
|
|
129
|
-
const sensitivePath = path.join(homeDir, dir);
|
|
130
|
-
if (resolved === sensitivePath || resolved.startsWith(sensitivePath + path.sep)) {
|
|
131
|
-
return `Refusing to operate on sensitive directory: ${resolved}`;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Verify it's a real directory
|
|
135
|
-
try {
|
|
136
|
-
const stats = fs.statSync(resolved);
|
|
137
|
-
if (!stats.isDirectory()) {
|
|
138
|
-
return `Path is not a directory: ${resolved}`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
return `Path does not exist or is not accessible: ${resolved}`;
|
|
143
|
-
}
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Check if a file path resolves to a location within the given root directory.
|
|
148
|
-
*
|
|
149
|
-
* Prevents path traversal attacks by ensuring the resolved absolute path
|
|
150
|
-
* starts with the resolved root path. Handles '..' sequences, symlink-like
|
|
151
|
-
* relative paths, and platform-specific separators.
|
|
152
|
-
*
|
|
153
|
-
* @param filePath - The path to check (can be relative or absolute)
|
|
154
|
-
* @param rootDir - The root directory that filePath must stay within
|
|
155
|
-
* @returns true if filePath resolves to a location within rootDir
|
|
156
|
-
*/
|
|
157
|
-
function isPathWithinRoot(filePath, rootDir) {
|
|
158
|
-
const resolvedPath = path.resolve(rootDir, filePath);
|
|
159
|
-
const resolvedRoot = path.resolve(rootDir);
|
|
160
|
-
return resolvedPath.startsWith(resolvedRoot + path.sep) || resolvedPath === resolvedRoot;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Like isPathWithinRoot but also resolves symlinks via fs.realpathSync.
|
|
164
|
-
*
|
|
165
|
-
* This catches symlink escapes where the logical path appears to be within
|
|
166
|
-
* root but the real path on disk points elsewhere. Falls back to logical
|
|
167
|
-
* path checking if realpath resolution fails (e.g. broken symlink).
|
|
168
|
-
*/
|
|
169
|
-
function isPathWithinRootReal(filePath, rootDir) {
|
|
170
|
-
// First do the cheap logical check
|
|
171
|
-
if (!isPathWithinRoot(filePath, rootDir)) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
// Then verify with realpath to catch symlink escapes
|
|
175
|
-
try {
|
|
176
|
-
const realPath = fs.realpathSync(path.resolve(rootDir, filePath));
|
|
177
|
-
const realRoot = fs.realpathSync(rootDir);
|
|
178
|
-
return realPath.startsWith(realRoot + path.sep) || realPath === realRoot;
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
// If realpath fails (broken symlink, permissions), fall back to logical check
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Safely parse JSON with a fallback value.
|
|
187
|
-
* Prevents crashes from corrupted database metadata.
|
|
188
|
-
*/
|
|
189
|
-
function safeJsonParse(value, fallback) {
|
|
190
|
-
try {
|
|
191
|
-
return JSON.parse(value);
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
return fallback;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Clamp a numeric value to a range.
|
|
199
|
-
* Used to enforce sane limits on MCP tool inputs.
|
|
200
|
-
*/
|
|
201
|
-
function clamp(value, min, max) {
|
|
202
|
-
return Math.max(min, Math.min(max, value));
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Normalize a file path to use forward slashes.
|
|
206
|
-
* Fixes Windows backslash paths so glob matching works consistently.
|
|
207
|
-
*/
|
|
208
|
-
function normalizePath(filePath) {
|
|
209
|
-
return filePath.replace(/\\/g, '/');
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Cross-process file lock using a lock file with PID tracking.
|
|
213
|
-
*
|
|
214
|
-
* Prevents multiple processes (e.g., git hooks, CLI, MCP server) from
|
|
215
|
-
* writing to the same database simultaneously.
|
|
216
|
-
*/
|
|
217
|
-
class FileLock {
|
|
218
|
-
lockPath;
|
|
219
|
-
held = false;
|
|
220
|
-
/** Locks older than this are considered stale regardless of PID status */
|
|
221
|
-
static STALE_TIMEOUT_MS = 2 * 60 * 1000; // 2 minutes
|
|
222
|
-
constructor(lockPath) {
|
|
223
|
-
this.lockPath = lockPath;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Acquire the lock. Throws if the lock is held by another live process.
|
|
227
|
-
*/
|
|
228
|
-
acquire() {
|
|
229
|
-
// Check for existing lock
|
|
230
|
-
if (fs.existsSync(this.lockPath)) {
|
|
231
|
-
try {
|
|
232
|
-
const content = fs.readFileSync(this.lockPath, 'utf-8').trim();
|
|
233
|
-
const pid = parseInt(content, 10);
|
|
234
|
-
const stat = fs.statSync(this.lockPath);
|
|
235
|
-
const lockAge = Date.now() - stat.mtimeMs;
|
|
236
|
-
// Treat locks older than the timeout as stale, regardless of PID
|
|
237
|
-
if (lockAge < FileLock.STALE_TIMEOUT_MS && !isNaN(pid) && this.isProcessAlive(pid)) {
|
|
238
|
-
throw new Error(`CodeGraph database is locked by another process (PID ${pid}). ` +
|
|
239
|
-
`If this is stale, run 'codegraph unlock' or delete ${this.lockPath}`);
|
|
240
|
-
}
|
|
241
|
-
// Stale lock (dead process or timed out) - remove it
|
|
242
|
-
fs.unlinkSync(this.lockPath);
|
|
243
|
-
}
|
|
244
|
-
catch (err) {
|
|
245
|
-
if (err instanceof Error && err.message.includes('locked by another')) {
|
|
246
|
-
throw err;
|
|
247
|
-
}
|
|
248
|
-
// Other errors reading lock file - try to remove it
|
|
249
|
-
try {
|
|
250
|
-
fs.unlinkSync(this.lockPath);
|
|
251
|
-
}
|
|
252
|
-
catch { /* ignore */ }
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
// Write our PID to the lock file using exclusive create flag
|
|
256
|
-
try {
|
|
257
|
-
fs.writeFileSync(this.lockPath, String(process.pid), { flag: 'wx' });
|
|
258
|
-
this.held = true;
|
|
259
|
-
}
|
|
260
|
-
catch (err) {
|
|
261
|
-
if (err.code === 'EEXIST') {
|
|
262
|
-
// Race condition: another process grabbed the lock between our check and write
|
|
263
|
-
throw new Error('CodeGraph database is locked by another process. ' +
|
|
264
|
-
`If this is stale, run 'codegraph unlock' or delete ${this.lockPath}`);
|
|
265
|
-
}
|
|
266
|
-
throw err;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Release the lock
|
|
271
|
-
*/
|
|
272
|
-
release() {
|
|
273
|
-
if (!this.held)
|
|
274
|
-
return;
|
|
275
|
-
try {
|
|
276
|
-
// Only remove if we still own it (check PID)
|
|
277
|
-
const content = fs.readFileSync(this.lockPath, 'utf-8').trim();
|
|
278
|
-
if (parseInt(content, 10) === process.pid) {
|
|
279
|
-
fs.unlinkSync(this.lockPath);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
catch {
|
|
283
|
-
// Lock file already gone - that's fine
|
|
284
|
-
}
|
|
285
|
-
this.held = false;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Execute a function while holding the lock
|
|
289
|
-
*/
|
|
290
|
-
withLock(fn) {
|
|
291
|
-
this.acquire();
|
|
292
|
-
try {
|
|
293
|
-
return fn();
|
|
294
|
-
}
|
|
295
|
-
finally {
|
|
296
|
-
this.release();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Execute an async function while holding the lock
|
|
301
|
-
*/
|
|
302
|
-
async withLockAsync(fn) {
|
|
303
|
-
this.acquire();
|
|
304
|
-
try {
|
|
305
|
-
return await fn();
|
|
306
|
-
}
|
|
307
|
-
finally {
|
|
308
|
-
this.release();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Check if a process is still running
|
|
313
|
-
*/
|
|
314
|
-
isProcessAlive(pid) {
|
|
315
|
-
try {
|
|
316
|
-
process.kill(pid, 0);
|
|
317
|
-
return true;
|
|
318
|
-
}
|
|
319
|
-
catch {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
exports.FileLock = FileLock;
|
|
325
|
-
/**
|
|
326
|
-
* Process items in batches to manage memory
|
|
327
|
-
*
|
|
328
|
-
* @param items - Array of items to process
|
|
329
|
-
* @param batchSize - Number of items per batch
|
|
330
|
-
* @param processor - Function to process each item
|
|
331
|
-
* @param onBatchComplete - Optional callback after each batch
|
|
332
|
-
* @returns Array of results
|
|
333
|
-
*/
|
|
334
|
-
async function processInBatches(items, batchSize, processor, onBatchComplete) {
|
|
335
|
-
const results = [];
|
|
336
|
-
for (let i = 0; i < items.length; i += batchSize) {
|
|
337
|
-
const batch = items.slice(i, Math.min(i + batchSize, items.length));
|
|
338
|
-
const batchResults = await Promise.all(batch.map((item, idx) => processor(item, i + idx)));
|
|
339
|
-
results.push(...batchResults);
|
|
340
|
-
if (onBatchComplete) {
|
|
341
|
-
onBatchComplete(Math.min(i + batchSize, items.length), items.length);
|
|
342
|
-
}
|
|
343
|
-
// Allow GC between batches
|
|
344
|
-
if (global.gc) {
|
|
345
|
-
global.gc();
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return results;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Simple mutex lock for preventing concurrent operations
|
|
352
|
-
*/
|
|
353
|
-
class Mutex {
|
|
354
|
-
locked = false;
|
|
355
|
-
waitQueue = [];
|
|
356
|
-
/**
|
|
357
|
-
* Acquire the lock
|
|
358
|
-
*
|
|
359
|
-
* @returns A release function to call when done
|
|
360
|
-
*/
|
|
361
|
-
async acquire() {
|
|
362
|
-
while (this.locked) {
|
|
363
|
-
await new Promise((resolve) => {
|
|
364
|
-
this.waitQueue.push(resolve);
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
this.locked = true;
|
|
368
|
-
return () => {
|
|
369
|
-
this.locked = false;
|
|
370
|
-
const next = this.waitQueue.shift();
|
|
371
|
-
if (next) {
|
|
372
|
-
next();
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Execute a function while holding the lock
|
|
378
|
-
*/
|
|
379
|
-
async withLock(fn) {
|
|
380
|
-
const release = await this.acquire();
|
|
381
|
-
try {
|
|
382
|
-
return await fn();
|
|
383
|
-
}
|
|
384
|
-
finally {
|
|
385
|
-
release();
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Check if the lock is currently held
|
|
390
|
-
*/
|
|
391
|
-
isLocked() {
|
|
392
|
-
return this.locked;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
exports.Mutex = Mutex;
|
|
396
|
-
/**
|
|
397
|
-
* Chunked file reader for large files
|
|
398
|
-
*
|
|
399
|
-
* Reads a file in chunks to avoid loading entire file into memory.
|
|
400
|
-
*/
|
|
401
|
-
async function* readFileInChunks(filePath, chunkSize = 64 * 1024) {
|
|
402
|
-
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
403
|
-
const fd = fs.openSync(filePath, 'r');
|
|
404
|
-
const buffer = Buffer.alloc(chunkSize);
|
|
405
|
-
try {
|
|
406
|
-
let bytesRead;
|
|
407
|
-
while ((bytesRead = fs.readSync(fd, buffer, 0, chunkSize, null)) > 0) {
|
|
408
|
-
yield buffer.toString('utf-8', 0, bytesRead);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
finally {
|
|
412
|
-
fs.closeSync(fd);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* Debounce a function
|
|
417
|
-
*
|
|
418
|
-
* @param fn - Function to debounce
|
|
419
|
-
* @param delay - Delay in milliseconds
|
|
420
|
-
* @returns Debounced function
|
|
421
|
-
*/
|
|
422
|
-
function debounce(fn, delay) {
|
|
423
|
-
let timeoutId = null;
|
|
424
|
-
return (...args) => {
|
|
425
|
-
if (timeoutId) {
|
|
426
|
-
clearTimeout(timeoutId);
|
|
427
|
-
}
|
|
428
|
-
timeoutId = setTimeout(() => {
|
|
429
|
-
fn(...args);
|
|
430
|
-
timeoutId = null;
|
|
431
|
-
}, delay);
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Throttle a function
|
|
436
|
-
*
|
|
437
|
-
* @param fn - Function to throttle
|
|
438
|
-
* @param limit - Minimum time between calls in milliseconds
|
|
439
|
-
* @returns Throttled function
|
|
440
|
-
*/
|
|
441
|
-
function throttle(fn, limit) {
|
|
442
|
-
let lastCall = 0;
|
|
443
|
-
let timeoutId = null;
|
|
444
|
-
return (...args) => {
|
|
445
|
-
const now = Date.now();
|
|
446
|
-
const remaining = limit - (now - lastCall);
|
|
447
|
-
if (remaining <= 0) {
|
|
448
|
-
if (timeoutId) {
|
|
449
|
-
clearTimeout(timeoutId);
|
|
450
|
-
timeoutId = null;
|
|
451
|
-
}
|
|
452
|
-
lastCall = now;
|
|
453
|
-
fn(...args);
|
|
454
|
-
}
|
|
455
|
-
else if (!timeoutId) {
|
|
456
|
-
timeoutId = setTimeout(() => {
|
|
457
|
-
lastCall = Date.now();
|
|
458
|
-
timeoutId = null;
|
|
459
|
-
fn(...args);
|
|
460
|
-
}, remaining);
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Estimate memory usage of an object (rough approximation)
|
|
466
|
-
*
|
|
467
|
-
* @param obj - Object to measure
|
|
468
|
-
* @returns Approximate size in bytes
|
|
469
|
-
*/
|
|
470
|
-
function estimateSize(obj) {
|
|
471
|
-
const seen = new WeakSet();
|
|
472
|
-
function sizeOf(value) {
|
|
473
|
-
if (value === null || value === undefined) {
|
|
474
|
-
return 0;
|
|
475
|
-
}
|
|
476
|
-
switch (typeof value) {
|
|
477
|
-
case 'boolean':
|
|
478
|
-
return 4;
|
|
479
|
-
case 'number':
|
|
480
|
-
return 8;
|
|
481
|
-
case 'string':
|
|
482
|
-
return 2 * value.length;
|
|
483
|
-
case 'object':
|
|
484
|
-
if (seen.has(value)) {
|
|
485
|
-
return 0;
|
|
486
|
-
}
|
|
487
|
-
seen.add(value);
|
|
488
|
-
if (Array.isArray(value)) {
|
|
489
|
-
return value.reduce((acc, item) => acc + sizeOf(item), 0);
|
|
490
|
-
}
|
|
491
|
-
return Object.entries(value).reduce((acc, [key, val]) => acc + sizeOf(key) + sizeOf(val), 0);
|
|
492
|
-
default:
|
|
493
|
-
return 0;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return sizeOf(obj);
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Memory monitor for tracking usage during operations
|
|
500
|
-
*/
|
|
501
|
-
class MemoryMonitor {
|
|
502
|
-
checkInterval = null;
|
|
503
|
-
peakUsage = 0;
|
|
504
|
-
threshold;
|
|
505
|
-
onThresholdExceeded;
|
|
506
|
-
constructor(thresholdMB = 500, onThresholdExceeded) {
|
|
507
|
-
this.threshold = thresholdMB * 1024 * 1024;
|
|
508
|
-
this.onThresholdExceeded = onThresholdExceeded;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Start monitoring memory usage
|
|
512
|
-
*/
|
|
513
|
-
start(intervalMs = 1000) {
|
|
514
|
-
this.stop();
|
|
515
|
-
this.peakUsage = 0;
|
|
516
|
-
this.checkInterval = setInterval(() => {
|
|
517
|
-
const usage = process.memoryUsage().heapUsed;
|
|
518
|
-
if (usage > this.peakUsage) {
|
|
519
|
-
this.peakUsage = usage;
|
|
520
|
-
}
|
|
521
|
-
if (usage > this.threshold && this.onThresholdExceeded) {
|
|
522
|
-
this.onThresholdExceeded(usage);
|
|
523
|
-
}
|
|
524
|
-
}, intervalMs);
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Stop monitoring
|
|
528
|
-
*/
|
|
529
|
-
stop() {
|
|
530
|
-
if (this.checkInterval) {
|
|
531
|
-
clearInterval(this.checkInterval);
|
|
532
|
-
this.checkInterval = null;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Get peak memory usage in bytes
|
|
537
|
-
*/
|
|
538
|
-
getPeakUsage() {
|
|
539
|
-
return this.peakUsage;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Get current memory usage in bytes
|
|
543
|
-
*/
|
|
544
|
-
getCurrentUsage() {
|
|
545
|
-
return process.memoryUsage().heapUsed;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
exports.MemoryMonitor = MemoryMonitor;
|
|
549
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,wDAQC;AAYD,kDA6BC;AAaD,4CAIC;AASD,oDAeC;AAMD,sCAMC;AAMD,sBAEC;AAMD,sCAEC;AAiID,4CA0BC;AAyDD,4CAiBC;AASD,4BAeC;AASD,4BA0BC;AAQD,oCAmCC;AA1dD,uCAAyB;AACzB,2CAA6B;AAE7B,+DAA+D;AAC/D,qBAAqB;AACrB,+DAA+D;AAE/D;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAC1C,MAAM,EAAE,aAAa,EAAE,uBAAuB;CAC/C,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,WAAmB,EAAE,QAAgB;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEjD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,QA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CAAC;YAC7C,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC3B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACzB,CAAC;YACD,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACvD,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;IACxC,CAAC;CACF;AAvDD,sCAuDC"}
|
package/scripts/local-install.sh
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Build the current branch and link it as the global `codegraph` for
|
|
3
|
-
# hands-on testing. Replaces any existing global install for as long
|
|
4
|
-
# as the symlink is in place.
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# ./scripts/local-install.sh # build + link
|
|
8
|
-
# ./scripts/local-install.sh --undo # unlink + restore the published version
|
|
9
|
-
|
|
10
|
-
set -euo pipefail
|
|
11
|
-
|
|
12
|
-
cd "$(dirname "$0")/.."
|
|
13
|
-
|
|
14
|
-
PKG=$(node -p "require('./package.json').name")
|
|
15
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
16
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
17
|
-
|
|
18
|
-
if [ "${1:-}" = "--undo" ]; then
|
|
19
|
-
echo "→ unlinking ${PKG}"
|
|
20
|
-
npm unlink -g "${PKG}" >/dev/null 2>&1 || true
|
|
21
|
-
echo "→ reinstalling published ${PKG}"
|
|
22
|
-
npm install -g "${PKG}"
|
|
23
|
-
echo "done: global codegraph -> $(command -v codegraph)"
|
|
24
|
-
exit 0
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
echo "→ building ${PKG} ${VERSION} (${BRANCH})"
|
|
28
|
-
npm run build
|
|
29
|
-
|
|
30
|
-
echo "→ linking globally"
|
|
31
|
-
npm link
|
|
32
|
-
|
|
33
|
-
LINKED=$(command -v codegraph || echo "(not on PATH)")
|
|
34
|
-
echo
|
|
35
|
-
echo "✓ global codegraph now points to this branch"
|
|
36
|
-
echo " binary: ${LINKED}"
|
|
37
|
-
echo " branch: ${BRANCH}"
|
|
38
|
-
echo " version: ${VERSION}"
|
|
39
|
-
echo
|
|
40
|
-
echo "To restore the published version:"
|
|
41
|
-
echo " ./scripts/local-install.sh --undo"
|