🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@codemap-ai/code-index

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemap-ai/code-index - npm Package Compare versions

Comparing version
1.2.0
to
1.3.0
+2
-2
dist/file-discovery.js

@@ -83,3 +83,3 @@ "use strict";

const name = node_path_1.default.basename(absolutePath);
const extension = (0, language_utils_js_1.normalizeExtension)(name);
const extension = (0, language_utils_js_1.extensionFromFilename)(name);
const language = (0, language_utils_js_1.inferLanguage)(extension);

@@ -168,3 +168,3 @@ const mimeType = (0, language_utils_js_1.inferMimeType)(extension);

const relativePath = normalizeRepositoryFilePath(node_path_1.default.relative(workspacePath, absolutePath).split(node_path_1.default.sep).join("/"));
const extension = (0, language_utils_js_1.normalizeExtension)(name);
const extension = (0, language_utils_js_1.extensionFromFilename)(name);
const language = (0, language_utils_js_1.inferLanguage)(extension);

@@ -171,0 +171,0 @@ const mimeType = (0, language_utils_js_1.inferMimeType)(extension);

@@ -1,6 +0,7 @@

export { collectSingleFile, collectWorkspaceFiles, IGNORED_NAMES, MAX_PARSE_BYTES, MAX_PARSE_BYTES_BY_LANGUAGE, PARSE_TOOL_NAME, PARSE_TOOL_VERSION, type WorkspaceFileCandidate, } from "./file-discovery.js";
export { BINARY_SAMPLE_BYTES, SOURCE_LANGUAGE_BY_EXTENSION, MIME_TYPE_BY_EXTENSION, buildFileSha256, inferLanguage, inferMimeType, isBinaryBuffer, normalizeExtension, readSampleBuffer, } from "./language-utils.js";
export { collectSingleFile, collectWorkspaceFiles, IGNORED_NAMES, isPathIgnored, MAX_PARSE_BYTES, MAX_PARSE_BYTES_BY_LANGUAGE, normalizeRepositoryFilePath, PARSE_TOOL_NAME, PARSE_TOOL_VERSION, type WorkspaceFileCandidate, } from "./file-discovery.js";
export { BINARY_SAMPLE_BYTES, SOURCE_LANGUAGE_BY_EXTENSION, MIME_TYPE_BY_EXTENSION, buildFileSha256, extensionFromFilename, inferLanguage, inferMimeType, isBinaryBuffer, normalizeExtension, readSampleBuffer, } from "./language-utils.js";
export { loadTypeScriptResolverConfigs, normalizeWorkspaceRelativePath, type TypeScriptPathAliasPattern, type TypeScriptResolverConfig, } from "./ts-resolver.js";
export { parseWorkspaceFileSemantics, type ParsedWorkspaceSemantics, } from "./parsers/index.js";
export { JS_TS_EXTENSIONS, DART_EXTENSIONS, PHP_EXTENSIONS, PYTHON_EXTENSIONS, JAVA_EXTENSIONS, KOTLIN_EXTENSIONS, } from "./parsers/shared.js";
export type { ParsedCallDraft, ParsedExportDraft, ParsedExternalSymbolDraft, ParsedImportDraft, ParsedParseIssueDraft, ParsedRelationshipDraft, ParsedSymbolDraft, RepoExportKind, RepoFileParseStatus, RepoImportKind, RepoImportResolutionKind, RepoParseIssueSeverity, RepoSymbolKind, RepoSymbolRelationshipKind, } from "./parsers/types.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACd,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACd,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseWorkspaceFileSemantics = exports.normalizeWorkspaceRelativePath = exports.loadTypeScriptResolverConfigs = exports.readSampleBuffer = exports.normalizeExtension = exports.isBinaryBuffer = exports.inferMimeType = exports.inferLanguage = exports.buildFileSha256 = exports.MIME_TYPE_BY_EXTENSION = exports.SOURCE_LANGUAGE_BY_EXTENSION = exports.BINARY_SAMPLE_BYTES = exports.PARSE_TOOL_VERSION = exports.PARSE_TOOL_NAME = exports.MAX_PARSE_BYTES_BY_LANGUAGE = exports.MAX_PARSE_BYTES = exports.IGNORED_NAMES = exports.collectWorkspaceFiles = exports.collectSingleFile = void 0;
exports.KOTLIN_EXTENSIONS = exports.JAVA_EXTENSIONS = exports.PYTHON_EXTENSIONS = exports.PHP_EXTENSIONS = exports.DART_EXTENSIONS = exports.JS_TS_EXTENSIONS = exports.parseWorkspaceFileSemantics = exports.normalizeWorkspaceRelativePath = exports.loadTypeScriptResolverConfigs = exports.readSampleBuffer = exports.normalizeExtension = exports.isBinaryBuffer = exports.inferMimeType = exports.inferLanguage = exports.extensionFromFilename = exports.buildFileSha256 = exports.MIME_TYPE_BY_EXTENSION = exports.SOURCE_LANGUAGE_BY_EXTENSION = exports.BINARY_SAMPLE_BYTES = exports.PARSE_TOOL_VERSION = exports.PARSE_TOOL_NAME = exports.normalizeRepositoryFilePath = exports.MAX_PARSE_BYTES_BY_LANGUAGE = exports.MAX_PARSE_BYTES = exports.isPathIgnored = exports.IGNORED_NAMES = exports.collectWorkspaceFiles = exports.collectSingleFile = void 0;
var file_discovery_js_1 = require("./file-discovery.js");

@@ -8,4 +8,6 @@ Object.defineProperty(exports, "collectSingleFile", { enumerable: true, get: function () { return file_discovery_js_1.collectSingleFile; } });

Object.defineProperty(exports, "IGNORED_NAMES", { enumerable: true, get: function () { return file_discovery_js_1.IGNORED_NAMES; } });
Object.defineProperty(exports, "isPathIgnored", { enumerable: true, get: function () { return file_discovery_js_1.isPathIgnored; } });
Object.defineProperty(exports, "MAX_PARSE_BYTES", { enumerable: true, get: function () { return file_discovery_js_1.MAX_PARSE_BYTES; } });
Object.defineProperty(exports, "MAX_PARSE_BYTES_BY_LANGUAGE", { enumerable: true, get: function () { return file_discovery_js_1.MAX_PARSE_BYTES_BY_LANGUAGE; } });
Object.defineProperty(exports, "normalizeRepositoryFilePath", { enumerable: true, get: function () { return file_discovery_js_1.normalizeRepositoryFilePath; } });
Object.defineProperty(exports, "PARSE_TOOL_NAME", { enumerable: true, get: function () { return file_discovery_js_1.PARSE_TOOL_NAME; } });

@@ -18,2 +20,3 @@ Object.defineProperty(exports, "PARSE_TOOL_VERSION", { enumerable: true, get: function () { return file_discovery_js_1.PARSE_TOOL_VERSION; } });

Object.defineProperty(exports, "buildFileSha256", { enumerable: true, get: function () { return language_utils_js_1.buildFileSha256; } });
Object.defineProperty(exports, "extensionFromFilename", { enumerable: true, get: function () { return language_utils_js_1.extensionFromFilename; } });
Object.defineProperty(exports, "inferLanguage", { enumerable: true, get: function () { return language_utils_js_1.inferLanguage; } });

@@ -29,1 +32,8 @@ Object.defineProperty(exports, "inferMimeType", { enumerable: true, get: function () { return language_utils_js_1.inferMimeType; } });

Object.defineProperty(exports, "parseWorkspaceFileSemantics", { enumerable: true, get: function () { return index_js_1.parseWorkspaceFileSemantics; } });
var shared_js_1 = require("./parsers/shared.js");
Object.defineProperty(exports, "JS_TS_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.JS_TS_EXTENSIONS; } });
Object.defineProperty(exports, "DART_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.DART_EXTENSIONS; } });
Object.defineProperty(exports, "PHP_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.PHP_EXTENSIONS; } });
Object.defineProperty(exports, "PYTHON_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.PYTHON_EXTENSIONS; } });
Object.defineProperty(exports, "JAVA_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.JAVA_EXTENSIONS; } });
Object.defineProperty(exports, "KOTLIN_EXTENSIONS", { enumerable: true, get: function () { return shared_js_1.KOTLIN_EXTENSIONS; } });
export declare const SOURCE_LANGUAGE_BY_EXTENSION: Record<string, string>;
export declare const MIME_TYPE_BY_EXTENSION: Record<string, string>;
export declare const BINARY_SAMPLE_BYTES = 8192;
export declare function normalizeExtension(fileName: string): string | null;
/**
* Extract extension from a filename and normalize it.
* @example extensionFromFilename("file.TS") → "ts"
*/
export declare function extensionFromFilename(fileName: string): string | null;
/**
* Normalize an extension string, or extract + normalize from a filename.
* Accepts both "file.ts" (filename) and "ts" / ".TS" (extension string).
* @example normalizeExtension("file.TS") → "ts"
* @example normalizeExtension(".TS") → "ts"
* @example normalizeExtension("ts") → "ts"
*/
export declare function normalizeExtension(input: string): string | null;
export declare function inferLanguage(extension: string | null): string | null;

@@ -6,0 +18,0 @@ export declare function inferMimeType(extension: string | null): string | null;

@@ -1,1 +0,1 @@

{"version":3,"file":"language-utils.d.ts","sourceRoot":"","sources":["../src/language-utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY/D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAUzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,iBAGlD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,iBAGrD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,iBAGrD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,WAK5C;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gCASzE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,UAEvD"}
{"version":3,"file":"language-utils.d.ts","sourceRoot":"","sources":["../src/language-utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+E/D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiEzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,iBAGrD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,iBAGrD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,iBAGrD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,WAK5C;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gCASzE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,UAEvD"}

@@ -7,2 +7,3 @@ "use strict";

exports.BINARY_SAMPLE_BYTES = exports.MIME_TYPE_BY_EXTENSION = exports.SOURCE_LANGUAGE_BY_EXTENSION = void 0;
exports.extensionFromFilename = extensionFromFilename;
exports.normalizeExtension = normalizeExtension;

@@ -18,2 +19,3 @@ exports.inferLanguage = inferLanguage;

exports.SOURCE_LANGUAGE_BY_EXTENSION = {
// Source code — parsers available
ts: "TypeScript",

@@ -30,4 +32,77 @@ tsx: "TypeScript",

po: "Gettext",
// Source code — no parser yet, language label only
c: "C",
h: "C",
cpp: "C++",
cc: "C++",
cxx: "C++",
cs: "C#",
go: "Go",
rs: "Rust",
rb: "Ruby",
swift: "Swift",
lua: "Lua",
r: "R",
scala: "Scala",
groovy: "Groovy",
ex: "Elixir",
exs: "Elixir",
erl: "Erlang",
hs: "Haskell",
clj: "Clojure",
fs: "F#",
fsx: "F#",
// Data / config / markup
json: "JSON",
jsonc: "JSON",
json5: "JSON",
yaml: "YAML",
yml: "YAML",
toml: "TOML",
xml: "XML",
html: "HTML",
htm: "HTML",
css: "CSS",
scss: "SCSS",
sass: "Sass",
less: "Less",
md: "Markdown",
mdx: "MDX",
rst: "reStructuredText",
svg: "SVG",
csv: "CSV",
tsv: "TSV",
sql: "SQL",
graphql: "GraphQL",
gql: "GraphQL",
proto: "Protocol Buffers",
// Shell / infra
sh: "Shell",
bash: "Shell",
zsh: "Shell",
fish: "Shell",
ps1: "PowerShell",
bat: "Batch",
cmd: "Batch",
dockerfile: "Dockerfile",
makefile: "Makefile",
cmake: "CMake",
// Other text
env: "dotenv",
ini: "INI",
cfg: "Config",
conf: "Config",
txt: "Text",
log: "Log",
diff: "Diff",
patch: "Patch",
};
exports.MIME_TYPE_BY_EXTENSION = {
// Images
png: "image/png",
jpg: "image/jpeg",
jpeg: "image/jpeg",
gif: "image/gif",
webp: "image/webp",
// Source code
ts: "text/plain",

@@ -42,8 +117,74 @@ tsx: "text/plain",

kts: "text/x-kotlin",
c: "text/x-c",
h: "text/x-c",
cpp: "text/x-c++",
cc: "text/x-c++",
cxx: "text/x-c++",
cs: "text/x-csharp",
go: "text/x-go",
rs: "text/x-rust",
rb: "text/x-ruby",
swift: "text/x-swift",
lua: "text/x-lua",
scala: "text/x-scala",
ex: "text/x-elixir",
exs: "text/x-elixir",
hs: "text/x-haskell",
// Data / config / markup
json: "application/json",
jsonc: "application/json",
json5: "application/json",
yaml: "text/yaml",
yml: "text/yaml",
toml: "application/toml",
xml: "text/xml",
html: "text/html",
htm: "text/html",
css: "text/css",
scss: "text/x-scss",
sass: "text/x-sass",
less: "text/x-less",
md: "text/markdown",
mdx: "text/markdown",
svg: "image/svg+xml",
csv: "text/csv",
sql: "application/sql",
graphql: "application/graphql",
gql: "application/graphql",
// Shell / infra
sh: "text/x-shellscript",
bash: "text/x-shellscript",
zsh: "text/x-shellscript",
fish: "text/x-shellscript",
ps1: "text/x-powershell",
// Other text
env: "text/plain",
ini: "text/plain",
txt: "text/plain",
log: "text/plain",
diff: "text/plain",
};
exports.BINARY_SAMPLE_BYTES = 8192;
function normalizeExtension(fileName) {
/**
* Extract extension from a filename and normalize it.
* @example extensionFromFilename("file.TS") → "ts"
*/
function extensionFromFilename(fileName) {
const extension = node_path_1.default.extname(fileName).slice(1).trim().toLowerCase();
return extension || null;
}
/**
* Normalize an extension string, or extract + normalize from a filename.
* Accepts both "file.ts" (filename) and "ts" / ".TS" (extension string).
* @example normalizeExtension("file.TS") → "ts"
* @example normalizeExtension(".TS") → "ts"
* @example normalizeExtension("ts") → "ts"
*/
function normalizeExtension(input) {
const value = input.includes(".")
? node_path_1.default.extname(input).slice(1)
: input;
const normalized = value.trim().toLowerCase();
return normalized || null;
}
function inferLanguage(extension) {

@@ -50,0 +191,0 @@ if (!extension)

{
"name": "@codemap-ai/code-index",
"version": "1.2.0",
"version": "1.3.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",