@norescan/scanner 0.0.0-stage → 0.1.1
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/dist/ignore.d.ts +14 -0
- package/dist/ignore.d.ts.map +1 -0
- package/dist/ignore.js +82 -0
- package/dist/ignore.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/scanner.d.ts +34 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +133 -0
- package/dist/scanner.js.map +1 -0
- package/package.json +27 -3
- package/README.md +0 -3
package/dist/ignore.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const HARDCODED_IGNORES: string[];
|
|
2
|
+
export declare class IgnoreEngine {
|
|
3
|
+
private ig;
|
|
4
|
+
constructor(customPatterns?: string[]);
|
|
5
|
+
/**
|
|
6
|
+
* Adds rules from a file if it exists.
|
|
7
|
+
*/
|
|
8
|
+
loadIgnoreFile(filePath: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether a relative path should be ignored.
|
|
11
|
+
*/
|
|
12
|
+
ignores(relativePath: string, isDirectory?: boolean): boolean;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB,UA2B7B,CAAC;AAEF,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAS;gBAEP,cAAc,GAAE,MAAM,EAAO;IASzC;;OAEG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5D;;OAEG;IACI,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,OAAO;CAYnE"}
|
package/dist/ignore.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IgnoreEngine = exports.HARDCODED_IGNORES = void 0;
|
|
7
|
+
const ignore_1 = __importDefault(require("ignore"));
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const shared_1 = require("@norescan/shared");
|
|
10
|
+
exports.HARDCODED_IGNORES = [
|
|
11
|
+
'.git',
|
|
12
|
+
'.git/**',
|
|
13
|
+
'node_modules',
|
|
14
|
+
'node_modules/**',
|
|
15
|
+
'dist',
|
|
16
|
+
'dist/**',
|
|
17
|
+
'build',
|
|
18
|
+
'build/**',
|
|
19
|
+
'.turbo',
|
|
20
|
+
'.turbo/**',
|
|
21
|
+
'.norescan',
|
|
22
|
+
'.norescan/**',
|
|
23
|
+
'.code-cache',
|
|
24
|
+
'.code-cache/**',
|
|
25
|
+
'.codecache',
|
|
26
|
+
'.codecache/**',
|
|
27
|
+
'.bugbrain',
|
|
28
|
+
'.bugbrain/**',
|
|
29
|
+
'.repomind',
|
|
30
|
+
'.repomind/**',
|
|
31
|
+
'.cache',
|
|
32
|
+
'.cache/**',
|
|
33
|
+
'coverage',
|
|
34
|
+
'coverage/**',
|
|
35
|
+
'.pnpm-store',
|
|
36
|
+
'.pnpm-store/**',
|
|
37
|
+
];
|
|
38
|
+
class IgnoreEngine {
|
|
39
|
+
ig;
|
|
40
|
+
constructor(customPatterns = []) {
|
|
41
|
+
// ignore() is default export
|
|
42
|
+
this.ig = ignore_1.default();
|
|
43
|
+
this.ig.add(exports.HARDCODED_IGNORES);
|
|
44
|
+
if (customPatterns.length > 0) {
|
|
45
|
+
this.ig.add(customPatterns);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Adds rules from a file if it exists.
|
|
50
|
+
*/
|
|
51
|
+
async loadIgnoreFile(filePath) {
|
|
52
|
+
try {
|
|
53
|
+
const content = await promises_1.default.readFile(filePath, 'utf8');
|
|
54
|
+
const lines = content
|
|
55
|
+
.split(/\r?\n/)
|
|
56
|
+
.map((l) => l.trim())
|
|
57
|
+
.filter((l) => l.length > 0 && !l.startsWith('#'));
|
|
58
|
+
if (lines.length > 0) {
|
|
59
|
+
this.ig.add(lines);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// File does not exist or unreadable, ignore
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether a relative path should be ignored.
|
|
68
|
+
*/
|
|
69
|
+
ignores(relativePath, isDirectory = false) {
|
|
70
|
+
const normalized = (0, shared_1.normalizePath)(relativePath);
|
|
71
|
+
if (!normalized || normalized === '.')
|
|
72
|
+
return false;
|
|
73
|
+
// Security check: always ignore sensitive files (credentials, keys, .env)
|
|
74
|
+
if ((0, shared_1.isSensitivePath)(normalized)) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
const testPath = isDirectory ? `${normalized}/` : normalized;
|
|
78
|
+
return this.ig.ignores(testPath);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.IgnoreEngine = IgnoreEngine;
|
|
82
|
+
//# sourceMappingURL=ignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAwC;AACxC,gEAAkC;AAElC,6CAAkE;AAErD,QAAA,iBAAiB,GAAG;IAC/B,MAAM;IACN,SAAS;IACT,cAAc;IACd,iBAAiB;IACjB,MAAM;IACN,SAAS;IACT,OAAO;IACP,UAAU;IACV,QAAQ;IACR,WAAW;IACX,WAAW;IACX,cAAc;IACd,aAAa;IACb,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AAC;QAC/C,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QAEpD,0EAA0E;QAC1E,IAAI,IAAA,wBAAe,EAAC,UAAU,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;QAC7D,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACF;AA7CD,oCA6CC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ignore.js"), exports);
|
|
18
|
+
__exportStar(require("./scanner.js"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FileFingerprint } from '@norescan/fingerprint';
|
|
2
|
+
import { NoReScanConfig } from '@norescan/shared';
|
|
3
|
+
export interface ScanOptions {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
config?: Partial<NoReScanConfig>;
|
|
6
|
+
onProgress?: (scannedCount: number, currentPath: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ScanResult {
|
|
9
|
+
fingerprints: Map<string, FileFingerprint>;
|
|
10
|
+
stats: {
|
|
11
|
+
totalFiles: number;
|
|
12
|
+
ignoredFiles: number;
|
|
13
|
+
skippedLargeFiles: number;
|
|
14
|
+
skippedSymlinks: number;
|
|
15
|
+
durationMs: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class FileScanner {
|
|
19
|
+
private projectRoot;
|
|
20
|
+
private maxFileSizeBytes;
|
|
21
|
+
private ignoreEngine;
|
|
22
|
+
constructor(options: ScanOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Initializes ignore rules from .gitignore and .norescanignore (or legacy .repomindignore).
|
|
25
|
+
*/
|
|
26
|
+
init(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Performs recursive discovery and fingerprinting.
|
|
29
|
+
*/
|
|
30
|
+
scan(onProgress?: (count: number, path: string) => void): Promise<ScanResult>;
|
|
31
|
+
private walkDirectory;
|
|
32
|
+
private processFile;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAqD,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErG,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC3C,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAQD,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,YAAY,CAAe;gBAEvB,OAAO,EAAE,WAAW;IAOhC;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IASlC;;OAEG;IACU,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;YAmB5E,aAAa;YA+Db,WAAW;CAuB1B"}
|
package/dist/scanner.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileScanner = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const ignore_js_1 = require("./ignore.js");
|
|
10
|
+
const fingerprint_1 = require("@norescan/fingerprint");
|
|
11
|
+
const shared_1 = require("@norescan/shared");
|
|
12
|
+
const BINARY_EXTENSIONS = new Set([
|
|
13
|
+
'.png', '.jpg', '.jpeg', '.gif', '.ico', '.pdf', '.zip', '.tar', '.gz', '.7z',
|
|
14
|
+
'.exe', '.dll', '.so', '.dylib', '.bin', '.obj', '.o', '.pyc', '.wasm',
|
|
15
|
+
'.woff', '.woff2', '.ttf', '.eot', '.mp3', '.mp4', '.mov', '.avi'
|
|
16
|
+
]);
|
|
17
|
+
class FileScanner {
|
|
18
|
+
projectRoot;
|
|
19
|
+
maxFileSizeBytes;
|
|
20
|
+
ignoreEngine;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.projectRoot = (0, shared_1.normalizePath)(node_path_1.default.resolve(options.projectRoot));
|
|
23
|
+
const maxKb = options.config?.maxFileSizeKb ?? 2048;
|
|
24
|
+
this.maxFileSizeBytes = maxKb * 1024;
|
|
25
|
+
this.ignoreEngine = new ignore_js_1.IgnoreEngine(options.config?.ignorePatterns || []);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Initializes ignore rules from .gitignore and .norescanignore (or legacy .repomindignore).
|
|
29
|
+
*/
|
|
30
|
+
async init() {
|
|
31
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.gitignore'));
|
|
32
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.norescanignore'));
|
|
33
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.codecacheignore'));
|
|
34
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.code-cacheignore'));
|
|
35
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.bugbrainignore'));
|
|
36
|
+
await this.ignoreEngine.loadIgnoreFile(node_path_1.default.join(this.projectRoot, '.repomindignore'));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Performs recursive discovery and fingerprinting.
|
|
40
|
+
*/
|
|
41
|
+
async scan(onProgress) {
|
|
42
|
+
const startTime = Date.now();
|
|
43
|
+
const fingerprints = new Map();
|
|
44
|
+
const stats = {
|
|
45
|
+
totalFiles: 0,
|
|
46
|
+
ignoredFiles: 0,
|
|
47
|
+
skippedLargeFiles: 0,
|
|
48
|
+
skippedSymlinks: 0,
|
|
49
|
+
durationMs: 0,
|
|
50
|
+
};
|
|
51
|
+
await this.walkDirectory('', fingerprints, stats, onProgress);
|
|
52
|
+
stats.totalFiles = fingerprints.size;
|
|
53
|
+
stats.durationMs = Date.now() - startTime;
|
|
54
|
+
return { fingerprints, stats };
|
|
55
|
+
}
|
|
56
|
+
async walkDirectory(relativeDir, results, stats, onProgress) {
|
|
57
|
+
const currentAbsoluteDir = node_path_1.default.join(this.projectRoot, relativeDir);
|
|
58
|
+
let entries;
|
|
59
|
+
try {
|
|
60
|
+
entries = await promises_1.default.readdir(currentAbsoluteDir, { withFileTypes: true });
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
for (const entry of entries) {
|
|
66
|
+
const relPath = (0, shared_1.normalizePath)(relativeDir ? `${relativeDir}/${entry.name}` : entry.name);
|
|
67
|
+
if (entry.isDirectory()) {
|
|
68
|
+
if (this.ignoreEngine.ignores(relPath, true)) {
|
|
69
|
+
stats.ignoredFiles++;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
await this.walkDirectory(relPath, results, stats, onProgress);
|
|
73
|
+
}
|
|
74
|
+
else if (entry.isSymbolicLink()) {
|
|
75
|
+
try {
|
|
76
|
+
const targetPath = await promises_1.default.realpath(node_path_1.default.join(this.projectRoot, relPath));
|
|
77
|
+
// Check if symlink target is within projectRoot
|
|
78
|
+
(0, shared_1.assertPathContained)(targetPath, this.projectRoot);
|
|
79
|
+
const stat = await promises_1.default.stat(targetPath);
|
|
80
|
+
if (stat.isDirectory()) {
|
|
81
|
+
if (!this.ignoreEngine.ignores(relPath, true)) {
|
|
82
|
+
await this.walkDirectory(relPath, results, stats, onProgress);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (stat.isFile()) {
|
|
86
|
+
await this.processFile(relPath, stat.size, results, stats, onProgress);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// Symlink points outside root or is broken -> safe skip
|
|
91
|
+
stats.skippedSymlinks++;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (entry.isFile()) {
|
|
95
|
+
const ext = node_path_1.default.extname(entry.name).toLowerCase();
|
|
96
|
+
if (BINARY_EXTENSIONS.has(ext)) {
|
|
97
|
+
stats.ignoredFiles++;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (this.ignoreEngine.ignores(relPath, false)) {
|
|
101
|
+
stats.ignoredFiles++;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const stat = await promises_1.default.stat(node_path_1.default.join(this.projectRoot, relPath));
|
|
106
|
+
await this.processFile(relPath, stat.size, results, stats, onProgress);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// File might have been removed concurrently
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async processFile(relPath, fileSize, results, stats, onProgress) {
|
|
115
|
+
if (fileSize > this.maxFileSizeBytes) {
|
|
116
|
+
stats.skippedLargeFiles++;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const absPath = node_path_1.default.join(this.projectRoot, relPath);
|
|
120
|
+
try {
|
|
121
|
+
const fp = await (0, fingerprint_1.computeFingerprint)(absPath, relPath);
|
|
122
|
+
results.set(relPath, fp);
|
|
123
|
+
if (onProgress) {
|
|
124
|
+
onProgress(results.size, relPath);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
shared_1.defaultLogger.warn(`Failed to fingerprint file: ${relPath}`, err);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.FileScanner = FileScanner;
|
|
133
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../src/scanner.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAkC;AAClC,0DAA6B;AAC7B,2CAA2C;AAC3C,uDAA4E;AAC5E,6CAAqG;AAmBrG,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAC7E,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO;IACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAClE,CAAC,CAAC;AAEH,MAAa,WAAW;IACd,WAAW,CAAS;IACpB,gBAAgB,CAAS;IACzB,YAAY,CAAe;IAEnC,YAAY,OAAoB;QAC9B,IAAI,CAAC,WAAW,GAAG,IAAA,sBAAa,EAAC,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,aAAa,IAAI,IAAI,CAAC;QACpD,IAAI,CAAC,gBAAgB,GAAG,KAAK,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,wBAAY,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc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AI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;oBACjE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;gBACzE,CAAC;gBAAC,MAAM,CAAC;oBACP,4CAA4C;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW,CACvB,OAAe,EACf,QAAgB,EAChB,OAAqC,EACrC,KAAoC,EACpC,UAAkD;QAElD,IAAI,QAAQ,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACrC,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,IAAA,gCAAkB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACzB,IAAI,UAAU,EAAE,CAAC;gBACf,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,sBAAa,CAAC,IAAI,CAAC,+BAA+B,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF;AApID,kCAoIC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norescan/scanner",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Recursive file discovery with ignore rules and security sandboxing for norescan",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@norescan/fingerprint": "0.1.1",
|
|
9
|
+
"@norescan/shared": "0.1.1",
|
|
10
|
+
"ignore": "^7.0.3"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^22.13.10",
|
|
14
|
+
"typescript": "^5.8.2",
|
|
15
|
+
"vitest": "^3.0.8"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"clean": "rimraf dist",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
}
|
|
6
30
|
}
|
package/README.md
DELETED