@git.zone/tsdoc 1.10.0 → 1.10.2

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.
@@ -463,7 +463,7 @@ Do not wrap the JSON in markdown code blocks or add any other text.`,
463
463
  }
464
464
 
465
465
  // Load from disk
466
- const contents = await plugins.smartfile.fs.toStringSync(filePath);
466
+ const contents = await plugins.fsInstance.file(filePath).encoding('utf8').read() as string;
467
467
  const tokenCount = this.countTokens(contents);
468
468
  const relativePath = plugins.path.relative(this.projectRoot, filePath);
469
469
 
@@ -31,16 +31,32 @@ export class LazyFileLoader {
31
31
 
32
32
  for (const globPattern of globs) {
33
33
  try {
34
- const smartFiles = await plugins.smartfile.fs.fileTreeToObject(this.projectRoot, globPattern);
35
- const fileArray = Array.isArray(smartFiles) ? smartFiles : [smartFiles];
34
+ const virtualDir = await plugins.smartfileFactory.virtualDirectoryFromPath(this.projectRoot);
35
+ // Filter files based on glob pattern using simple pattern matching
36
+ const smartFiles = virtualDir.filter(file => {
37
+ // Simple glob matching
38
+ const relativePath = file.relative;
39
+ if (globPattern.includes('**')) {
40
+ // Handle ** patterns - match any path
41
+ const pattern = globPattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*');
42
+ return new RegExp(`^${pattern}$`).test(relativePath);
43
+ } else if (globPattern.includes('*')) {
44
+ // Handle single * patterns
45
+ const pattern = globPattern.replace(/\*/g, '[^/]*');
46
+ return new RegExp(`^${pattern}$`).test(relativePath);
47
+ } else {
48
+ // Exact match
49
+ return relativePath === globPattern;
50
+ }
51
+ }).listFiles();
36
52
 
37
- for (const smartFile of fileArray) {
53
+ for (const smartFile of smartFiles) {
38
54
  try {
39
- const meta = await this.getMetadata(smartFile.path);
55
+ const meta = await this.getMetadata(smartFile.absolutePath);
40
56
  metadata.push(meta);
41
57
  } catch (error) {
42
58
  // Skip files that can't be read
43
- console.warn(`Failed to get metadata for ${smartFile.path}:`, error.message);
59
+ console.warn(`Failed to get metadata for ${smartFile.absolutePath}:`, error.message);
44
60
  }
45
61
  }
46
62
  } catch (error) {
@@ -104,7 +120,7 @@ export class LazyFileLoader {
104
120
  // Load files in parallel
105
121
  const loadPromises = metadata.map(async (meta) => {
106
122
  try {
107
- const contents = await plugins.smartfile.fs.toStringSync(meta.path);
123
+ const contents = await plugins.fsInstance.file(meta.path).encoding('utf8').read() as string;
108
124
  const tokenCount = tokenizer(contents);
109
125
 
110
126
  const fileInfo: IFileInfo = {
@@ -138,7 +154,7 @@ export class LazyFileLoader {
138
154
  tokenizer: (content: string) => number
139
155
  ): Promise<IFileInfo> {
140
156
  const meta = await this.getMetadata(filePath);
141
- const contents = await plugins.smartfile.fs.toStringSync(filePath);
157
+ const contents = await plugins.fsInstance.file(filePath).encoding('utf8').read() as string;
142
158
  const tokenCount = tokenizer(contents);
143
159
  const relativePath = plugins.path.relative(this.projectRoot, filePath);
144
160
 
package/ts/plugins.ts CHANGED
@@ -10,6 +10,7 @@ import * as smartai from '@push.rocks/smartai';
10
10
  import * as smartcli from '@push.rocks/smartcli';
11
11
  import * as smartdelay from '@push.rocks/smartdelay';
12
12
  import * as smartfile from '@push.rocks/smartfile';
13
+ import * as smartfs from '@push.rocks/smartfs';
13
14
  import * as smartgit from '@push.rocks/smartgit';
14
15
  import * as smartinteract from '@push.rocks/smartinteract';
15
16
  import * as smartlog from '@push.rocks/smartlog';
@@ -25,6 +26,7 @@ export {
25
26
  smartcli,
26
27
  smartdelay,
27
28
  smartfile,
29
+ smartfs,
28
30
  smartgit,
29
31
  smartinteract,
30
32
  smartlog,
@@ -34,6 +36,13 @@ export {
34
36
  smarttime,
35
37
  };
36
38
 
39
+ // Create a shared SmartFs instance for filesystem operations
40
+ const smartFsNodeProvider = new smartfs.SmartFsProviderNode();
41
+ export const fsInstance = new smartfs.SmartFs(smartFsNodeProvider);
42
+
43
+ // Create a shared SmartFileFactory for in-memory file operations
44
+ export const smartfileFactory = smartfile.SmartFileFactory.nodeFs();
45
+
37
46
  // @git.zone scope
38
47
  import * as tspublish from '@git.zone/tspublish';
39
48