2026-01-01 23:09:06 +00:00
|
|
|
// Node.js native scope
|
2025-11-25 11:59:11 +00:00
|
|
|
import * as path from 'node:path';
|
|
|
|
|
import * as stream from 'node:stream';
|
|
|
|
|
import * as fs from 'node:fs';
|
|
|
|
|
import * as fsPromises from 'node:fs/promises';
|
2020-03-13 20:22:56 +00:00
|
|
|
|
2025-11-25 11:59:11 +00:00
|
|
|
export { path, stream, fs, fsPromises };
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* List files in a directory recursively, returning relative paths
|
|
|
|
|
*/
|
|
|
|
|
export async function listFileTree(dirPath: string, _pattern: string = '**/*'): Promise<string[]> {
|
|
|
|
|
const results: string[] = [];
|
|
|
|
|
|
|
|
|
|
async function walkDir(currentPath: string, relativePath: string = '') {
|
|
|
|
|
const entries = await fsPromises.readdir(currentPath, { withFileTypes: true });
|
|
|
|
|
for (const entry of entries) {
|
|
|
|
|
const entryRelPath = relativePath ? path.join(relativePath, entry.name) : entry.name;
|
|
|
|
|
const entryFullPath = path.join(currentPath, entry.name);
|
|
|
|
|
|
|
|
|
|
if (entry.isDirectory()) {
|
|
|
|
|
await walkDir(entryFullPath, entryRelPath);
|
|
|
|
|
} else if (entry.isFile()) {
|
|
|
|
|
results.push(entryRelPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await walkDir(dirPath);
|
|
|
|
|
return results;
|
|
|
|
|
}
|
2020-03-13 20:22:56 +00:00
|
|
|
|
2026-01-01 23:09:06 +00:00
|
|
|
// Re-export browser-compatible plugins from ts_shared
|
|
|
|
|
export * from '../ts_shared/plugins.js';
|
|
|
|
|
|
|
|
|
|
// Additional Node.js-specific @pushrocks packages
|
2023-07-26 16:13:33 +02:00
|
|
|
import * as smartpath from '@push.rocks/smartpath';
|
|
|
|
|
import * as smartrequest from '@push.rocks/smartrequest';
|
|
|
|
|
import * as smartunique from '@push.rocks/smartunique';
|
|
|
|
|
import * as smartrx from '@push.rocks/smartrx';
|
2023-11-06 18:14:21 +01:00
|
|
|
import * as smarturl from '@push.rocks/smarturl';
|
2020-03-13 20:22:56 +00:00
|
|
|
|
2025-08-18 01:29:06 +00:00
|
|
|
export {
|
|
|
|
|
smartpath,
|
|
|
|
|
smartrequest,
|
|
|
|
|
smartunique,
|
|
|
|
|
smartrx,
|
|
|
|
|
smarturl,
|
|
|
|
|
};
|
2026-01-01 23:40:13 +00:00
|
|
|
|
|
|
|
|
// Node.js-specific: tar-stream for true streaming TAR support
|
|
|
|
|
import * as tarStream from 'tar-stream';
|
|
|
|
|
export { tarStream };
|