depflow 2.0.0-dev.1 → 2.0.0-dev.3

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.
Files changed (94) hide show
  1. package/build/{bin → cli}/DepFLowCLI.d.ts +4 -2
  2. package/build/{bin → cli}/DepFLowCLI.js +60 -36
  3. package/build/cli/DepFLowCLI.js.map +1 -0
  4. package/build/{bin → cli}/bin.js +15 -4
  5. package/build/cli/bin.js.map +1 -0
  6. package/build/config/Config.d.ts +28 -0
  7. package/build/config/Config.js +46 -0
  8. package/build/config/Config.js.map +1 -0
  9. package/build/config/ImportMap.d.ts +38 -0
  10. package/build/config/ImportMap.js +83 -0
  11. package/build/config/ImportMap.js.map +1 -0
  12. package/build/config/Tsconfig.d.ts +57 -0
  13. package/build/config/Tsconfig.js +99 -0
  14. package/build/config/Tsconfig.js.map +1 -0
  15. package/build/config/schemas.d.ts +592 -0
  16. package/build/config/schemas.js +51 -0
  17. package/build/config/schemas.js.map +1 -0
  18. package/build/support/Dependency.d.ts +127 -0
  19. package/build/support/Dependency.js +307 -0
  20. package/build/support/Dependency.js.map +1 -0
  21. package/build/support/File.d.ts +80 -0
  22. package/build/support/File.js +123 -0
  23. package/build/support/File.js.map +1 -0
  24. package/build/support/Git.js.map +1 -0
  25. package/build/support/PathFixer.d.ts +36 -0
  26. package/build/support/PathFixer.js +161 -0
  27. package/build/support/PathFixer.js.map +1 -0
  28. package/build/support/PathResolver/AliasCompiler.d.ts +25 -0
  29. package/build/support/PathResolver/AliasCompiler.js +39 -0
  30. package/build/support/PathResolver/AliasCompiler.js.map +1 -0
  31. package/build/support/PathResolver/PathResolver.d.ts +45 -0
  32. package/build/support/PathResolver/PathResolver.js +99 -0
  33. package/build/support/PathResolver/PathResolver.js.map +1 -0
  34. package/build/support/PathResolver/PathRewriter.d.ts +18 -0
  35. package/build/support/PathResolver/PathRewriter.js +47 -0
  36. package/build/support/PathResolver/PathRewriter.js.map +1 -0
  37. package/build/support/PathResolver/Utils.d.ts +36 -0
  38. package/build/support/PathResolver/Utils.js +45 -0
  39. package/build/support/PathResolver/Utils.js.map +1 -0
  40. package/build/support/PathResolver.d.ts +100 -0
  41. package/build/support/PathResolver.js +280 -0
  42. package/build/support/PathResolver.js.map +1 -0
  43. package/build/support/Resolver/AliasCompiler.d.ts +18 -0
  44. package/build/support/Resolver/AliasCompiler.js +32 -0
  45. package/build/support/Resolver/AliasCompiler.js.map +1 -0
  46. package/build/support/Resolver/PathResolver.d.ts +25 -0
  47. package/build/support/Resolver/PathResolver.js +79 -0
  48. package/build/support/Resolver/PathResolver.js.map +1 -0
  49. package/build/support/Resolver/PathRewriter.d.ts +10 -0
  50. package/build/support/Resolver/PathRewriter.js +39 -0
  51. package/build/support/Resolver/PathRewriter.js.map +1 -0
  52. package/build/support/Resolver/Utils.d.ts +36 -0
  53. package/build/support/Resolver/Utils.js +45 -0
  54. package/build/support/Resolver/Utils.js.map +1 -0
  55. package/build/support/Utils.d.ts +30 -0
  56. package/build/support/Utils.js +95 -0
  57. package/build/support/Utils.js.map +1 -0
  58. package/build/support/Validator.d.ts +22 -0
  59. package/build/support/Validator.js +28 -0
  60. package/build/support/Validator.js.map +1 -0
  61. package/package.json +4 -3
  62. package/build/Config.d.ts +0 -15
  63. package/build/Config.js +0 -21
  64. package/build/Config.js.map +0 -1
  65. package/build/Dependency.d.ts +0 -86
  66. package/build/Dependency.js +0 -264
  67. package/build/Dependency.js.map +0 -1
  68. package/build/File.d.ts +0 -9
  69. package/build/File.js +0 -41
  70. package/build/File.js.map +0 -1
  71. package/build/Git.js.map +0 -1
  72. package/build/PathFixer.d.ts +0 -35
  73. package/build/PathFixer.js +0 -143
  74. package/build/PathFixer.js.map +0 -1
  75. package/build/Tsconfig.d.ts +0 -13
  76. package/build/Tsconfig.js +0 -16
  77. package/build/Tsconfig.js.map +0 -1
  78. package/build/Utils.d.ts +0 -16
  79. package/build/Utils.js +0 -40
  80. package/build/Utils.js.map +0 -1
  81. package/build/Validator.d.ts +0 -9
  82. package/build/Validator.js +0 -15
  83. package/build/Validator.js.map +0 -1
  84. package/build/bin/DepFLowCLI.js.map +0 -1
  85. package/build/bin/bin.d.ts +0 -2
  86. package/build/bin/bin.js.map +0 -1
  87. package/build/bin.js +0 -26
  88. package/build/bin.js.map +0 -1
  89. package/build/schemas.d.ts +0 -296
  90. package/build/schemas.js +0 -29
  91. package/build/schemas.js.map +0 -1
  92. /package/build/{bin.d.ts → cli/bin.d.ts} +0 -0
  93. /package/build/{Git.d.ts → support/Git.d.ts} +0 -0
  94. /package/build/{Git.js → support/Git.js} +0 -0
@@ -0,0 +1,123 @@
1
+ import { promises as FS } from 'node:fs';
2
+ import { Utilities } from 'vortez';
3
+ export class File {
4
+ /**
5
+ * Checks if a given path exists in the file system.
6
+ * It uses fs.access to determine if the path is accessible, returning true if it exists and false if it does not.
7
+ * This method is useful for verifying the presence of files or directories before attempting to read, write, or perform other operations on them, helping to prevent errors related to non-existent paths.
8
+ * @param path The file system path to check for existence.
9
+ * @returns A promise that resolves to true if the path exists, or false if it does not.
10
+ */
11
+ static async exists(path) {
12
+ try {
13
+ await FS.access(path);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ /**
21
+ * Checks if the given path is a file.
22
+ * It uses fs.stat to retrieve the file system statistics for the path and checks if it is a file using the isFile method.
23
+ * If the path does not exist or is not a file, it returns false.
24
+ * This method is useful for validating that a specific path points to a file before performing operations that require a file, such as reading or writing content.
25
+ * It helps to ensure that the expected file structure is in place and can prevent errors related to invalid paths or types.
26
+ * @param path The file system path to check.
27
+ * @returns A promise that resolves to true if the path is a file, or false if it is not.
28
+ * @throws Will throw an error if the path does not exist or is not a file.
29
+ */
30
+ static async isFile(path) {
31
+ try {
32
+ const stat = await FS.stat(path);
33
+ return stat.isFile();
34
+ }
35
+ catch {
36
+ return false;
37
+ }
38
+ }
39
+ /**
40
+ * Checks if the given path is a directory.
41
+ * It uses fs.stat to retrieve the file system statistics for the path and checks if it is a directory using the isDirectory method.
42
+ * If the path does not exist or is not a directory, it returns false.
43
+ * This method is useful for validating that a specific path points to a directory before performing operations that require a directory, such as creating files within it or listing its contents.
44
+ * It helps to ensure that the expected directory structure is in place and can prevent errors related to invalid paths or types.
45
+ * @param path The file system path to check.
46
+ * @returns A promise that resolves to true if the path is a directory, or false if it is not.
47
+ * @throws Will throw an error if the path does not exist or is not a directory.
48
+ */
49
+ static async isDirectory(path) {
50
+ try {
51
+ const stat = await FS.stat(path);
52
+ return stat.isDirectory();
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }
58
+ /**
59
+ * Reads the content of a file at the specified path using the given encoding (defaulting to 'utf-8').
60
+ * It first checks if the path is a file using the isFile method, and if it is not, it throws an error indicating that the path is not a file.
61
+ * If the path is valid, it uses fs.readFile to read the content of the file and returns it as a string.
62
+ * This method is essential for safely reading files while ensuring that the provided path points to a valid file, preventing errors related to invalid paths or types.
63
+ * @param path The file system path of the file to read.
64
+ * @param encoding The character encoding to use when reading the file (default is 'utf-8').
65
+ * @returns A promise that resolves to the content of the file as a string.
66
+ * @throws Will throw an error if the path does not point to a valid file.
67
+ */
68
+ static async read(path, encoding = 'utf-8') {
69
+ if (!await this.isFile(path))
70
+ throw new Error(`Path ${path} is not a file.`);
71
+ return await FS.readFile(path, encoding);
72
+ }
73
+ /**
74
+ * Writes the specified content to a file at the given path using the provided encoding (defaulting to 'utf-8').
75
+ * It uses fs.writeFile to write the content to the file, creating the file if it does not exist or overwriting it if it does.
76
+ * This method is crucial for saving data to files while ensuring that the content is properly encoded and that any necessary directories are in place before writing.
77
+ * It can be used for a variety of purposes, such as saving configuration files, logs, or any other data that needs to be persisted in the file system.
78
+ * @param path The file system path where the content should be written.
79
+ * @param content The string content to write to the file.
80
+ * @param encoding The character encoding to use when writing the file (default is 'utf-8').
81
+ * @returns A promise that resolves when the write operation is complete.
82
+ */
83
+ static async write(path, content, encoding = 'utf-8') {
84
+ await FS.writeFile(path, content, encoding);
85
+ }
86
+ /**
87
+ * Creates a directory at the specified path with the given options (such as recursive creation). It first checks if the path already exists using the exists method, and if it does, it throws an error to prevent overwriting existing files or directories. If the path does not exist, it uses fs.mkdir to create the directory according to the provided options. This method is essential for safely creating directories while ensuring that existing paths are not unintentionally overwritten, and it can be used to set up necessary directory structures for applications or projects.
88
+ * @param path The file system path where the directory should be created.
89
+ * @param options Optional settings for directory creation, such as { recursive: true } to create parent directories if they do not exist.
90
+ * @returns A promise that resolves when the directory has been successfully created.
91
+ * @throws Will throw an error if the path already exists or if there is an issue during directory creation.
92
+ */
93
+ static async mkdir(path, options) {
94
+ if (await this.exists(path))
95
+ throw new Error(`Path ${path} already exists.`);
96
+ await FS.mkdir(path, options);
97
+ }
98
+ /**
99
+ * Recursively retrieves all files with specified extensions from a given directory.
100
+ * It uses fs.readdir with the "withFileTypes" option to efficiently determine if an entry is a file or a directory.
101
+ * For directories, it calls itself recursively to gather files from subdirectories. For files, it checks if their extensions match the provided list and includes them in the result.
102
+ * This method returns a flat array of file paths that can be processed by the path resolver.
103
+ * @param dir The directory to scan for files.
104
+ * @param extensions An array of file extensions to filter the results (e.g., ['.js', '.ts']).
105
+ * @returns A promise that resolves to an array of file paths matching the specified extensions.
106
+ */
107
+ static async getAllFiles(dir, extensions) {
108
+ const result = [];
109
+ const entries = await FS.readdir(dir, { withFileTypes: true });
110
+ for (const entry of entries) {
111
+ const fullPath = Utilities.Path.join(dir, entry.name);
112
+ if (entry.isDirectory()) {
113
+ const files = await File.getAllFiles(fullPath, extensions);
114
+ result.push(...files);
115
+ }
116
+ else if (extensions.some(ext => fullPath.endsWith(ext)))
117
+ result.push(fullPath);
118
+ }
119
+ return result;
120
+ }
121
+ }
122
+ export default File;
123
+ //# sourceMappingURL=File.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"File.js","sourceRoot":"","sources":["../../src/support/File.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAY,MAAM,SAAS,C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O,KAAK,WAAW,IAAI,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;oBACrG,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBACpC,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IACD;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,IAAY,EAAE,MAAe;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,MAAc;QACnD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,WAAW,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,MAAe;QAClD,MAAM,OAAO,GAAG,UAAU,IAAI,OAAO,CAAC;QACtC,IAAI,MAAM;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,aAAa,MAAM,EAAE,CAAC,CAAC;;YACzD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACJ;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { schemas } from '../config/schemas.js';
2
+ export declare class PathResolver {
3
+ readonly config: schemas.config['infer'];
4
+ readonly options: PathResolver.Options;
5
+ readonly projectRoot: string;
6
+ static readonly IMPORT_REGEX: RegExp;
7
+ static readonly PROJECT_ROOT: string;
8
+ static readonly EXTENSIONS: string[];
9
+ absoluteOutDir: string;
10
+ private _compiledAliases;
11
+ constructor(config: schemas.config['infer'], options?: PathResolver.Options, projectRoot?: string);
12
+ /**
13
+ * Compila todos los resolvers (normales y npm) en una lista plana para el procesador.
14
+ */
15
+ get aliases(): PathResolver.ResolvedAlias[];
16
+ run(): Promise<void>;
17
+ private processFile;
18
+ private replaceLogic;
19
+ /**
20
+ * Watcher optimizado con debounce
21
+ */
22
+ watch(): Promise<void>;
23
+ static getAllFiles(dir: string, extensions: string[]): Promise<string[]>;
24
+ }
25
+ export declare namespace PathResolver {
26
+ interface Options {
27
+ mode: 'local' | 'cdn';
28
+ }
29
+ interface ResolvedAlias {
30
+ alias: string;
31
+ target: string;
32
+ isWildcard: boolean;
33
+ isRemote: boolean;
34
+ }
35
+ }
36
+ export default PathResolver;
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @author NetFeez <netfeez.dev@gmail.com>
3
+ * @description Utility for path resolution with Local/CDN support and dual path fixing.
4
+ * @license Apache-2.0
5
+ */
6
+ import path from 'path';
7
+ import syncFs, { promises as fs } from 'fs';
8
+ import { Logger, Utilities } from 'vortez';
9
+ import File from '../support/File.js';
10
+ const logger = new Logger({ prefix: 'PathResolver' });
11
+ export class PathResolver {
12
+ config;
13
+ options;
14
+ projectRoot;
15
+ static IMPORT_REGEX = /(from\s+['"])([^'"]+)(['"])/g;
16
+ static PROJECT_ROOT = process.cwd();
17
+ static EXTENSIONS = ['.js', '.d.ts', '.mjs', '.cjs'];
18
+ absoluteOutDir;
19
+ _compiledAliases = null;
20
+ constructor(config, options = { mode: 'local' }, projectRoot = PathResolver.PROJECT_ROOT) {
21
+ this.config = config;
22
+ this.options = options;
23
+ this.projectRoot = projectRoot;
24
+ // Determinamos el outDir basándonos en la configuración
25
+ // Si no se especifica, asumimos la raíz del proyecto
26
+ const outDir = config.outDir;
27
+ const fullPath = path.isAbsolute(outDir)
28
+ ? outDir
29
+ : path.join(projectRoot, outDir);
30
+ this.absoluteOutDir = path.resolve(fullPath);
31
+ }
32
+ /**
33
+ * Compila todos los resolvers (normales y npm) en una lista plana para el procesador.
34
+ */
35
+ get aliases() {
36
+ if (this._compiledAliases)
37
+ return this._compiledAliases;
38
+ const result = [];
39
+ const allDeps = [
40
+ ...(this.config.dependencies || []),
41
+ ...(this.config.npmDependencies || [])
42
+ ];
43
+ for (const dep of allDeps) {
44
+ if (!dep.resolver)
45
+ continue;
46
+ const { alias, target } = dep.resolver;
47
+ const isWildcard = alias.endsWith('/*');
48
+ const cleanAlias = alias.replace(/\/\*$/, '');
49
+ // Resolución del destino final
50
+ let finalTarget;
51
+ if (this.options.mode === 'cdn' && typeof target === 'object' && target.cdn) {
52
+ finalTarget = target.cdn;
53
+ }
54
+ else {
55
+ const localPath = typeof target === 'string' ? target : target.local;
56
+ // El target local se resuelve relativo a la raíz del proyecto
57
+ finalTarget = path.resolve(this.projectRoot, localPath.replace(/\/\*$/, ''));
58
+ }
59
+ result.push({
60
+ alias: cleanAlias,
61
+ target: finalTarget,
62
+ isWildcard,
63
+ isRemote: finalTarget.startsWith('http')
64
+ });
65
+ }
66
+ this._compiledAliases = result;
67
+ return result;
68
+ }
69
+ async run() {
70
+ logger.log(`&C2Starting path resolver in &C3${this.options.mode} &C2mode...`);
71
+ if (!await File.exists(this.absoluteOutDir)) {
72
+ return void logger.warn(`The output directory &C4${this.absoluteOutDir}&R does not exist.`);
73
+ }
74
+ const files = await PathResolver.getAllFiles(this.absoluteOutDir, PathResolver.EXTENSIONS);
75
+ logger.log(`&C2Found &C3${files.length} &C2files in &C4${this.absoluteOutDir}.`);
76
+ let rewrittenCount = 0;
77
+ for (const file of files) {
78
+ if (await this.processFile(file))
79
+ rewrittenCount++;
80
+ }
81
+ logger.log(`&C2Path aliases resolved in &C3${rewrittenCount} &C2files.`);
82
+ }
83
+ async processFile(file) {
84
+ const content = await fs.readFile(file, 'utf8');
85
+ const newContent = content.replace(PathResolver.IMPORT_REGEX, (match, prefix, modulePath, suffix) => {
86
+ return this.replaceLogic(file, match, prefix, modulePath, suffix);
87
+ });
88
+ if (content === newContent)
89
+ return false;
90
+ await fs.writeFile(file, newContent, 'utf8');
91
+ return true;
92
+ }
93
+ replaceLogic(file, match, prefix, modulePath, suffix) {
94
+ const aliasCfg = this.aliases.find(c => c.isWildcard ? modulePath.startsWith(`${c.alias}/`) : modulePath === c.alias);
95
+ if (!aliasCfg)
96
+ return match;
97
+ let resolvedPath;
98
+ // 1. Manejo de Wildcards
99
+ if (aliasCfg.isWildcard) {
100
+ const subPath = modulePath.substring(aliasCfg.alias.length + 1);
101
+ resolvedPath = aliasCfg.isRemote
102
+ ? `${aliasCfg.target}/${subPath}`
103
+ : path.join(aliasCfg.target, subPath);
104
+ }
105
+ else {
106
+ resolvedPath = aliasCfg.target;
107
+ }
108
+ // 2. Si es remoto (CDN), devolvemos la URL tal cual
109
+ if (aliasCfg.isRemote) {
110
+ return `${prefix}${resolvedPath}${suffix}`;
111
+ }
112
+ // 3. Si es local, calculamos la ruta relativa desde el archivo actual
113
+ const currentFileDir = path.dirname(file);
114
+ let relativeTarget = path.relative(currentFileDir, resolvedPath);
115
+ if (!relativeTarget.startsWith('.'))
116
+ relativeTarget = `./${relativeTarget}`;
117
+ // Normalizamos para asegurar compatibilidad con imports de JS (puntos y barras)
118
+ const finalTarget = Utilities.Path.normalize(relativeTarget);
119
+ return `${prefix}${finalTarget}${suffix}`;
120
+ }
121
+ /**
122
+ * Watcher optimizado con debounce
123
+ */
124
+ async watch() {
125
+ await this.run();
126
+ logger.log(`&C2Watching for changes in &C4${this.absoluteOutDir}...`);
127
+ const queue = new Map();
128
+ syncFs.watch(this.absoluteOutDir, { recursive: true }, (eventType, filename) => {
129
+ if (!filename || !PathResolver.EXTENSIONS.some(ext => filename.endsWith(ext)))
130
+ return;
131
+ const fullPath = path.join(this.absoluteOutDir, filename);
132
+ if (queue.has(fullPath))
133
+ clearTimeout(queue.get(fullPath));
134
+ queue.set(fullPath, setTimeout(async () => {
135
+ try {
136
+ if (await this.processFile(fullPath)) {
137
+ logger.log(`&C2File &C4${filename}&C2 updated.`);
138
+ }
139
+ }
140
+ catch (e) { }
141
+ queue.delete(fullPath);
142
+ }, 300));
143
+ });
144
+ }
145
+ static async getAllFiles(dir, extensions) {
146
+ const result = [];
147
+ const entries = await fs.readdir(dir, { withFileTypes: true });
148
+ for (const entry of entries) {
149
+ const fullPath = path.join(dir, entry.name);
150
+ if (entry.isDirectory()) {
151
+ result.push(...(await PathResolver.getAllFiles(fullPath, extensions)));
152
+ }
153
+ else if (extensions.some(ext => fullPath.endsWith(ext))) {
154
+ result.push(fullPath);
155
+ }
156
+ }
157
+ return result;
158
+ }
159
+ }
160
+ export default PathResolver;
161
+ //# sourceMappingURL=PathFixer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathFixer.js","sourceRoot":"","sources":["../../src/support/PathFixer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,EAAE,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAGtC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;AAEtD,MAAM,OAAO,YAAY;IASD;IACA;IACA;IAVb,MAAM,CAAU,YAAY,GAAG,8BAA8B,CAAC;IAC9D,MAAM,CAAU,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7C,MAAM,CAAU,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9D,cAAc,CAAS;IACtB,gBAAgB,GAAwC,IAAI,CAAC;IAErE,YACoB,MAA+B,EAC/B,UAAgC,EAAE,IAAI,EAAE,OAAO,EAAE,EACjD,cAAsB,YAAY,CAAC,YAAY;QAF/C,WAAM,GAAN,MAAM,CAAyB;QAC/B,YAAO,GAAP,OAAO,CAA0C;QACjD,gBAAW,GAAX,WAAW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AE,CAAC;gBACxD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;;AAeL,eAAe,YAAY,CAAC"}
@@ -0,0 +1,25 @@
1
+ import schemas from '../../config/schemas.js';
2
+ export declare class AliasCompiler {
3
+ private projectRoot;
4
+ constructor(projectRoot: string);
5
+ /**
6
+ * Compiles alias configurations from the provided config object into a structured format for path resolution.
7
+ * It processes both regular and wildcard aliases, resolving local paths to absolute paths based on the project root.
8
+ * The resulting compiled aliases include information about the alias name, whether it's a wildcard, and its target paths for local and CDN usage.
9
+ * @param config The configuration object containing dependencies with resolver entries to compile into aliases.
10
+ * @returns An array of compiled alias objects ready for use in path resolution.
11
+ */
12
+ compile(config: schemas.config['infer']): AliasCompiler.CompiledAlias[];
13
+ }
14
+ export declare namespace AliasCompiler {
15
+ interface Target {
16
+ local: string;
17
+ cdn?: string;
18
+ }
19
+ interface CompiledAlias {
20
+ alias: string;
21
+ targets: Target;
22
+ isWildcard: boolean;
23
+ }
24
+ }
25
+ export default AliasCompiler;
@@ -0,0 +1,39 @@
1
+ import path from 'node:path';
2
+ import Utils from './Utils.js';
3
+ export class AliasCompiler {
4
+ projectRoot;
5
+ constructor(projectRoot) {
6
+ this.projectRoot = projectRoot;
7
+ }
8
+ /**
9
+ * Compiles alias configurations from the provided config object into a structured format for path resolution.
10
+ * It processes both regular and wildcard aliases, resolving local paths to absolute paths based on the project root.
11
+ * The resulting compiled aliases include information about the alias name, whether it's a wildcard, and its target paths for local and CDN usage.
12
+ * @param config The configuration object containing dependencies with resolver entries to compile into aliases.
13
+ * @returns An array of compiled alias objects ready for use in path resolution.
14
+ */
15
+ compile(config) {
16
+ const result = [];
17
+ const allDeps = [...(config.dependencies || []), ...(config.npmDependencies || [])];
18
+ for (const dep of allDeps) {
19
+ if (typeof dep !== 'object' || !dep.resolver)
20
+ continue;
21
+ for (const entry of dep.resolver) {
22
+ const isWildcard = Utils.isWildcard(entry.alias);
23
+ const alias = Utils.removeWildcardSuffix(entry.alias);
24
+ const rawLocal = typeof entry.target === 'string' ? entry.target : entry.target.local;
25
+ const localTarget = path.isAbsolute(rawLocal)
26
+ ? Utils.removeWildcardSuffix(rawLocal)
27
+ : path.resolve(this.projectRoot, Utils.removeWildcardSuffix(rawLocal));
28
+ let cdnTarget;
29
+ if (typeof entry.target === 'object' && entry.target.cdn) {
30
+ cdnTarget = Utils.removeWildcardSuffix(entry.target.cdn);
31
+ }
32
+ result.push({ alias, isWildcard, targets: { local: localTarget, cdn: cdnTarget } });
33
+ }
34
+ }
35
+ return result;
36
+ }
37
+ }
38
+ export default AliasCompiler;
39
+ //# sourceMappingURL=AliasCompiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AliasCompiler.js","sourceRoot":"","sources":["../../../src/support/PathResolver/AliasCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,OAAO,aAAa;IACF;IAApB,YAAoB,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;IAAG,CAAC;IAC3C;;;;;;OAMG;IACI,OAAO,CAAC,MAA+B;QAC1C,MAAM,MAAM,GAAkC,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC;QAEpF,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YACxB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ;gBAAE,SAAS;YAEvD,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBAC/B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACjD,MAAM,KAAK,GAAG,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAEtD,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;gBACtF,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;oBACzC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC;oBACtC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAE3E,IAAI,SAA6B,CAAC;gBAClC,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;oBACvD,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC7D,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACxF,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAYD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Logger } from "@netfeez/vterm";
2
+ import schemas from '../../config/schemas.js';
3
+ import PathRewriter from './PathRewriter.js';
4
+ import AliasCompiler from './AliasCompiler.js';
5
+ export declare class PathResolver {
6
+ readonly config: schemas.config['infer'];
7
+ readonly options: PathResolver.Options;
8
+ static readonly PROJECT_ROOT: string;
9
+ static readonly EXTENSIONS: string[];
10
+ protected readonly logger: Logger;
11
+ protected readonly rewriter: PathRewriter;
12
+ protected readonly absoluteOutDir: string;
13
+ readonly aliases: AliasCompiler.CompiledAlias[];
14
+ constructor(config: schemas.config['infer'], options?: PathResolver.Options);
15
+ /**
16
+ * Resolves and rewrites paths in built files based on the provided mode (local or CDN).
17
+ * It processes all files in the output directory, rewriting import paths according to the configured aliases.
18
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use.
19
+ */
20
+ rewritePaths(mode: PathResolver.Mode): Promise<void>;
21
+ /**
22
+ * Processes a single file, rewriting import paths based on the configured aliases and the specified mode (local or CDN).
23
+ * It reads the file content, applies the path rewriting logic, and writes the updated content back to the file system if any changes were made.
24
+ * @param file The path of the file to process.
25
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use for rewriting.
26
+ * @returns A boolean indicating whether the file was modified (true if rewritten, false if no changes were made).
27
+ */
28
+ protected processFile(file: string, mode: PathResolver.Mode): Promise<boolean>;
29
+ /**
30
+ * Watches the output directory for changes and automatically rewrites paths in modified files based on the configured aliases and specified mode (local or CDN).
31
+ * It sets up a file system watcher that listens for changes in the output directory, and when a relevant file is modified, it triggers the path rewriting process for that file.
32
+ * The method includes debouncing to prevent excessive processing during rapid file changes, ensuring efficient handling of updates while maintaining responsiveness.
33
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use for rewriting when changes are detected.
34
+ * @returns A promise that resolves when the watcher is set up and running, allowing the application to continue monitoring for changes indefinitely until manually stopped.
35
+ * @throws Will throw an error if there is an issue setting up the file system watcher or processing files, which can be caught by the caller to handle it appropriately.
36
+ */
37
+ watch(mode: PathResolver.Mode): Promise<void>;
38
+ }
39
+ export declare namespace PathResolver {
40
+ type Mode = 'local' | 'cdn';
41
+ interface Options {
42
+ logger?: Logger;
43
+ }
44
+ }
45
+ export default PathResolver;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @author NetFeez <netfeez.dev@gmail.com>
3
+ * @description Utility for path resolution with Local/CDN support and dual path fixing.
4
+ * @license Apache-2.0
5
+ */
6
+ import PATH from "node:path";
7
+ import FS, { promises as FSP } from 'node:fs';
8
+ import { File } from '@netfeez/common-node';
9
+ import { Logger } from "@netfeez/vterm";
10
+ import Utils from '../Utils.js';
11
+ import PathRewriter from './PathRewriter.js';
12
+ import AliasCompiler from './AliasCompiler.js';
13
+ export class PathResolver {
14
+ config;
15
+ options;
16
+ static PROJECT_ROOT = process.cwd();
17
+ static EXTENSIONS = ['.js', '.ts', '.jsx', '.tsx'];
18
+ logger;
19
+ rewriter;
20
+ absoluteOutDir;
21
+ aliases;
22
+ constructor(config, options = {}) {
23
+ this.config = config;
24
+ this.options = options;
25
+ this.logger = options.logger || new Logger({ name: 'PATH-RW' });
26
+ const outDir = config.outDir || '.';
27
+ this.absoluteOutDir = !PATH.isAbsolute(outDir)
28
+ ? PATH.resolve(PathResolver.PROJECT_ROOT, outDir)
29
+ : outDir;
30
+ this.aliases = new AliasCompiler(PathResolver.PROJECT_ROOT).compile(config);
31
+ this.rewriter = new PathRewriter(this.aliases, PathResolver.PROJECT_ROOT);
32
+ }
33
+ /**
34
+ * Resolves and rewrites paths in built files based on the provided mode (local or CDN).
35
+ * It processes all files in the output directory, rewriting import paths according to the configured aliases.
36
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use.
37
+ */
38
+ async rewritePaths(mode) {
39
+ this.logger.log(`&C2Starting path resolver in &C3${mode} &C2mode...`);
40
+ if (!await File.exists(this.absoluteOutDir))
41
+ return void this.logger.warn(`Directory &C4${this.absoluteOutDir}&R not found.`);
42
+ const files = await File.getAllFiles(this.absoluteOutDir, PathResolver.EXTENSIONS);
43
+ let rewrittenCount = 0;
44
+ for (const file of files) {
45
+ if (await this.processFile(file, mode))
46
+ rewrittenCount++;
47
+ }
48
+ this.logger.log(`&C2Path aliases resolved in &C3${rewrittenCount} &C2files.`);
49
+ }
50
+ /**
51
+ * Processes a single file, rewriting import paths based on the configured aliases and the specified mode (local or CDN).
52
+ * It reads the file content, applies the path rewriting logic, and writes the updated content back to the file system if any changes were made.
53
+ * @param file The path of the file to process.
54
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use for rewriting.
55
+ * @returns A boolean indicating whether the file was modified (true if rewritten, false if no changes were made).
56
+ */
57
+ async processFile(file, mode) {
58
+ try {
59
+ const content = await FSP.readFile(file, 'utf8');
60
+ const newContent = this.rewriter.rewrite(content, file, mode);
61
+ if (content === newContent)
62
+ return false;
63
+ await FSP.writeFile(file, newContent, 'utf8');
64
+ return true;
65
+ }
66
+ catch (error) {
67
+ this.logger.error(`Failed to process file &C4${file}:`, error.message);
68
+ return false;
69
+ }
70
+ }
71
+ /**
72
+ * Watches the output directory for changes and automatically rewrites paths in modified files based on the configured aliases and specified mode (local or CDN).
73
+ * It sets up a file system watcher that listens for changes in the output directory, and when a relevant file is modified, it triggers the path rewriting process for that file.
74
+ * The method includes debouncing to prevent excessive processing during rapid file changes, ensuring efficient handling of updates while maintaining responsiveness.
75
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target paths to use for rewriting when changes are detected.
76
+ * @returns A promise that resolves when the watcher is set up and running, allowing the application to continue monitoring for changes indefinitely until manually stopped.
77
+ * @throws Will throw an error if there is an issue setting up the file system watcher or processing files, which can be caught by the caller to handle it appropriately.
78
+ */
79
+ async watch(mode) {
80
+ await this.rewritePaths(mode);
81
+ this.logger.log(`&C2Watching for changes in &C4${this.absoluteOutDir}...`);
82
+ const debouncedProcessor = Utils.debounce(async (fullPath, filename) => {
83
+ if (await this.processFile(fullPath, mode)) {
84
+ this.logger.log(`&C2File &C4${filename}&C2 updated.`);
85
+ }
86
+ }, 300);
87
+ FS.watch(this.absoluteOutDir, { recursive: true }, (eventType, filename) => {
88
+ if (!filename)
89
+ return;
90
+ const isTargetExtension = PathResolver.EXTENSIONS.some(ext => filename.endsWith(ext));
91
+ if (!isTargetExtension)
92
+ return;
93
+ const fullPath = PATH.join(this.absoluteOutDir, filename);
94
+ debouncedProcessor(fullPath, filename);
95
+ });
96
+ }
97
+ }
98
+ export default PathResolver;
99
+ //# sourceMappingURL=PathResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathResolver.js","sourceRoot":"","sources":["../../../src/support/PathResolver/PathResolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,YAAY;IAUD;IACA;IAVb,MAAM,CAAU,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7C,MAAM,CAAU,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhD,MAAM,CAAS;IACf,QAAQ,CAAe;IACvB,cAAc,CAAS;IAC1B,OAAO,CAAgC;IAEvD,YACoB,MAA+B,EAC/B,UAAgC,EAAE;QADlC,WAAM,GAAN,MAAM,CAAyB;QAC/B,YAAO,GAAP,OAAO,CAA2B;QAElD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAEhE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1C,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC;YACjD,CAAC,CAAC,MAAM,CAAC;QAEb,IAAI,CAAC,OAAO,GAAG,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AE,QAAQ,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACP,CAAC;;AAUL,eAAe,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ import AliasCompiler from "./AliasCompiler.js";
2
+ export declare class PathRewriter {
3
+ private readonly aliases;
4
+ private readonly projectRoot;
5
+ static readonly IMPORT_REGEX: RegExp;
6
+ constructor(aliases: AliasCompiler.CompiledAlias[], projectRoot: string);
7
+ /**
8
+ * Rewrites import paths in the given content based on the configured aliases.
9
+ * It detects import statements and replaces alias paths with their resolved targets.
10
+ * @param content The file content to rewrite.
11
+ * @param filePath The path of the file being processed (used for relative path calculations).
12
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target to use.
13
+ * @returns The rewritten content with resolved import paths.
14
+ */
15
+ rewrite(content: string, filePath: string, mode: 'local' | 'cdn'): string;
16
+ }
17
+ export declare namespace PathRewriter { }
18
+ export default PathRewriter;
@@ -0,0 +1,47 @@
1
+ import PATH from "node:path";
2
+ import { Path } from "@netfeez/common-node";
3
+ export class PathRewriter {
4
+ aliases;
5
+ projectRoot;
6
+ static IMPORT_REGEX = /(from\s+['"])([^'"]+)(['"])/g;
7
+ constructor(aliases, projectRoot) {
8
+ this.aliases = aliases;
9
+ this.projectRoot = projectRoot;
10
+ }
11
+ /**
12
+ * Rewrites import paths in the given content based on the configured aliases.
13
+ * It detects import statements and replaces alias paths with their resolved targets.
14
+ * @param content The file content to rewrite.
15
+ * @param filePath The path of the file being processed (used for relative path calculations).
16
+ * @param mode The resolution mode ('local' or 'cdn') to determine which target to use.
17
+ * @returns The rewritten content with resolved import paths.
18
+ */
19
+ rewrite(content, filePath, mode) {
20
+ return content.replace(PathRewriter.IMPORT_REGEX, (match, prefix, modulePath, suffix) => {
21
+ const aliasCfg = this.aliases.find(c => c.isWildcard ? modulePath.startsWith(`${c.alias}/`) : modulePath === c.alias);
22
+ if (!aliasCfg)
23
+ return match;
24
+ const isCDN = mode === 'cdn' && aliasCfg.targets.cdn;
25
+ const baseTarget = isCDN ? aliasCfg.targets.cdn : aliasCfg.targets.local;
26
+ let resolvedPath;
27
+ if (aliasCfg.isWildcard) {
28
+ const subPath = modulePath.substring(aliasCfg.alias.length + 1);
29
+ resolvedPath = isCDN
30
+ ? `${baseTarget.replace(/\/$/, '')}/${subPath}`
31
+ : PATH.join(baseTarget, subPath);
32
+ }
33
+ else {
34
+ resolvedPath = baseTarget;
35
+ }
36
+ if (isCDN)
37
+ return `${prefix}${resolvedPath}${suffix}`;
38
+ const currentFileDir = PATH.dirname(filePath);
39
+ let relativeTarget = PATH.relative(currentFileDir, resolvedPath);
40
+ if (!relativeTarget.startsWith('.'))
41
+ relativeTarget = `./${relativeTarget}`;
42
+ return `${prefix}${Path.normalize(relativeTarget)}${suffix}`;
43
+ });
44
+ }
45
+ }
46
+ export default PathRewriter;
47
+ //# sourceMappingURL=PathRewriter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathRewriter.js","sourceRoot":"","sources":["../../../src/support/PathResolver/PathRewriter.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAI5C,MAAM,OAAO,YAAY;IAGA;IACA;IAHd,MAAM,CAAU,YAAY,GAAG,8BAA8B,CAAC;IACrE,YACqB,OAAsC,EACtC,WAAmB;QADnB,YAAO,GAAP,OAAO,CAA+B;QACtC,gBAAW,GAAX,WAAW,CAAQ;IACrC,CAAC;IACJ;;;;;;;OAOG;IACI,OAAO,CAAC,OAAe,EAAE,QAAgB,EAAE,IAAqB;QACnE,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;YACpF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC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