depflow 2.0.0-dev.1 → 2.0.0-dev.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.
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 +3 -2
  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
@@ -1,6 +1,7 @@
1
- import { Utilities } from "vortez";
2
- export declare class DepFlowCLI extends Utilities.DebugUI {
1
+ import { DebugUI } from "@netfeez/vterm";
2
+ export declare class DepFlowCLI extends DebugUI {
3
3
  readonly configPath: string;
4
+ protected readonly projectRoot: string;
4
5
  constructor(configPath?: string);
5
6
  commandAdd(command: string, args: string[]): Promise<void>;
6
7
  commandRemove(command: string, args: string[]): Promise<void>;
@@ -8,6 +9,7 @@ export declare class DepFlowCLI extends Utilities.DebugUI {
8
9
  uninstall(command: string, args: string[]): Promise<void>;
9
10
  list(command: string, args: string[]): Promise<void>;
10
11
  rewritePaths(command: string, args: string[]): Promise<void>;
12
+ commandSync(command: string, args: string[]): Promise<void>;
11
13
  }
12
14
  export declare namespace DepFlowCLI { }
13
15
  export default DepFlowCLI;
@@ -1,22 +1,28 @@
1
- import { Utilities } from "vortez";
2
- import Validator from "../Validator.js";
3
- import { Utils } from "../Utils.js";
4
- import Config from "../Config.js";
5
- import schemas from "../schemas.js";
6
- import Dependency from "../Dependency.js";
7
- import { Tsconfig } from "../Tsconfig.js";
8
- import { PathFixer } from "../PathFixer.js";
9
- export class DepFlowCLI extends Utilities.DebugUI {
1
+ import { DebugUI } from "@netfeez/vterm";
2
+ import Validator from "../support/Validator.js";
3
+ import Utils from "../support/Utils.js";
4
+ import Config from "../config/Config.js";
5
+ import schemas from "../config/schemas.js";
6
+ import Dependency from "../support/Dependency.js";
7
+ import Tsconfig from "../config/Tsconfig.js";
8
+ import pathResolver from "../support/PathResolver/PathResolver.js";
9
+ import ImportMap from "../config/ImportMap.js";
10
+ import path from "node:path";
11
+ export class DepFlowCLI extends DebugUI {
10
12
  configPath;
13
+ projectRoot;
11
14
  constructor(configPath = 'depFlow.json') {
12
15
  super();
13
16
  this.configPath = configPath;
17
+ const absoluteConfigPath = path.resolve(process.cwd(), this.configPath);
18
+ this.projectRoot = path.dirname(absoluteConfigPath);
14
19
  this.addCommand('add', this.commandAdd, { usage: 'dep add <repo_url> [name]', description: 'Add a dependency to the configuration file.' });
15
20
  this.addCommand('remove', this.commandRemove, { usage: 'dep remove <name> | <repo_url>', description: 'Remove a dependency from the configuration file by name or repo URL.' });
16
21
  this.addCommand('install', this.commandInstall, { usage: 'dep install [name1 name2 ...]', description: 'Install dependencies. If names are provided, only those dependencies will be installed.' });
17
22
  this.addCommand('uninstall', this.uninstall, { usage: 'dep uninstall [name1 name2 ...]', description: 'Uninstall dependencies. If names are provided, only those dependencies will be uninstalled.' });
18
23
  this.addCommand('list', this.list, { usage: 'dep list', description: 'List all dependencies in the configuration file.' });
19
- this.addCommand('rewrite-paths', this.rewritePaths, { usage: 'dep rewrite-paths [--watch] [-p <tsconfig_path>]', description: 'Rewrite paths in tsconfig.json based on the dependencies. Use --watch to keep watching for changes.' });
24
+ this.addCommand('rewrite-paths', this.rewritePaths, { usage: 'dep rewrite-paths [--watch] [--cdn]', description: 'Resolve and rewrite paths in built files based on depFlow configuration.' });
25
+ this.addCommand('sync', this.commandSync, { usage: 'dep sync', description: 'Syncs depFlow.json with tsconfig.json and generates the importmap.' });
20
26
  }
21
27
  async commandAdd(command, args) {
22
28
  this.out.info(`&C(255,180,220)╭──────────────────────────────────────────────────`);
@@ -68,7 +74,7 @@ export class DepFlowCLI extends Utilities.DebugUI {
68
74
  throw new Error(args.length > 0 ? 'Specified dependencies not found.' : 'No dependencies to install.');
69
75
  for (const dep of toInstall) {
70
76
  this.out.info(`&C(255,180,220)│ Installing "${dep.name}" from "${dep.repo}"...`);
71
- const dependency = new Dependency(dep);
77
+ const dependency = new Dependency(config, dep);
72
78
  const result = await dependency.install();
73
79
  this.out.info(`&C(255,180,220)│ ${result.join('\n').replace(/\n/g, '\n&C(255,180,220)│ ')}`);
74
80
  this.out.info(`&C(255,180,220)│ &C3Installed dependency: &C3${dep.name}`);
@@ -81,6 +87,7 @@ export class DepFlowCLI extends Utilities.DebugUI {
81
87
  finally {
82
88
  this.out.info(`&C(255,180,220)╰──────────────────────────────────────────────────`);
83
89
  }
90
+ this.commandSync('sync', []);
84
91
  }
85
92
  async uninstall(command, args) {
86
93
  this.out.info(`&C(255,180,220)╭──────────────────────────────────────────────────`);
@@ -93,7 +100,7 @@ export class DepFlowCLI extends Utilities.DebugUI {
93
100
  throw new Error(args.length > 0 ? 'Specified dependencies not found.' : 'No dependencies to uninstall.');
94
101
  for (const dep of toUninstall) {
95
102
  this.out.info(`&C(255,180,220)│ Uninstalling "${dep.name}" from "${dep.repo}"...`);
96
- const dependency = new Dependency(dep);
103
+ const dependency = new Dependency(config, dep);
97
104
  const result = await dependency.uninstall();
98
105
  this.out.info(`&C(255,180,220)│ ${result.join('\n').replace(/\n/g, '\n&C(255,180,220)│ ')}`);
99
106
  this.out.info(`&C(255,180,220)│ &C3Uninstalled dependency: &C3${dep.name}`);
@@ -129,33 +136,17 @@ export class DepFlowCLI extends Utilities.DebugUI {
129
136
  this.out.info(`&C(255,180,220)╭──────────────────────────────────────────────────`);
130
137
  try {
131
138
  const config = await Config.load(this.configPath);
132
- const execPath = process.cwd();
133
139
  const watch = args.includes('--watch') || args.includes('-w');
134
- const projectPath = (Utils.getFlagValue(args, '-p', false)[0] ||
135
- Utils.getFlagValue(args, '--project', false)[0] ||
136
- config.tsconfig || config.webTsconfig ||
137
- Utilities.Path.join(execPath, 'tsconfig.json'));
138
- const tsconfig = await Tsconfig.load(projectPath);
139
- const options = tsconfig.compilerOptions;
140
- if (!options)
141
- throw new Error('tsconfig.json must have "compilerOptions" to rewrite paths.');
142
- if (!options.paths)
143
- throw new Error('tsconfig.json must have "paths" in compilerOptions to rewrite paths.');
144
- if (!options.outDir)
145
- throw new Error('tsconfig.json must have an "outDir" specified in compilerOptions to rewrite paths.');
146
- if (!options.baseUrl && !options.rootDir) {
147
- this.out.warn(`&C(255,180,220)│ &C3Warning: Neither "baseUrl" nor "rootDir" found. Resolving paths relative to project root.`);
148
- }
149
- const fixer = new PathFixer({
150
- paths: options.paths,
151
- baseUrl: options.baseUrl,
152
- rootDir: options.rootDir,
153
- outDir: options.outDir
154
- });
140
+ const useCDN = args.includes('--cdn');
141
+ const mode = useCDN ? 'cdn' : 'local';
142
+ this.out.info(`&C(255,180,220)│ Mode: &C3${useCDN ? 'CDN' : 'Local'}`);
143
+ if (watch)
144
+ this.out.info(`&C(255,180,220)│ Watcher: &C2Enabled`);
145
+ const resolver = new pathResolver(config, { logger: this.out });
155
146
  if (watch)
156
- await fixer.watch();
147
+ await resolver.watch(mode);
157
148
  else
158
- await fixer.run();
149
+ await resolver.rewritePaths(mode);
159
150
  }
160
151
  catch (error) {
161
152
  this.out.error(`&C(255,180,220)│ &C1${error.message || error}`);
@@ -164,6 +155,39 @@ export class DepFlowCLI extends Utilities.DebugUI {
164
155
  this.out.info(`&C(255,180,220)╰──────────────────────────────────────────────────`);
165
156
  }
166
157
  }
158
+ async commandSync(command, args) {
159
+ this.out.info(`&C(255,180,220)╭──────────────────────────────────────────────────`);
160
+ this.out.info(`&C(255,180,220)│ Synchronizing configurations...`);
161
+ try {
162
+ const useCDN = args.includes('--cdn');
163
+ const mode = useCDN ? 'cdn' : 'local';
164
+ const config = await Config.load(this.configPath);
165
+ const resolver = new pathResolver(config, { logger: this.out });
166
+ const tsconfigFile = config.tsconfig;
167
+ const importMapFile = config.importmap;
168
+ if (tsconfigFile) {
169
+ const tsconfig = await Tsconfig.load(this.projectRoot, tsconfigFile, { logger: this.out });
170
+ tsconfig.updatePaths(resolver.aliases);
171
+ await tsconfig.save();
172
+ }
173
+ else
174
+ this.out.warn(`&C(255,180,220)│ No tsconfig file specified in configuration. Skipping tsconfig synchronization.`);
175
+ if (importMapFile) {
176
+ const importmap = await ImportMap.load(this.projectRoot, importMapFile, { logger: this.out });
177
+ importmap.updateImports(resolver.aliases, mode);
178
+ await importmap.save();
179
+ }
180
+ else
181
+ this.out.warn(`&C(255,180,220)│ No import map file specified in configuration. Skipping import map synchronization.`);
182
+ this.out.info(`&C(255,180,220)│ &C2Successfully synced all configurations.`);
183
+ }
184
+ catch (error) {
185
+ this.out.error(`&C(255,180,220)│ &C1Error during sync: ${error.message}`);
186
+ }
187
+ finally {
188
+ this.out.info(`&C(255,180,220)╰──────────────────────────────────────────────────`);
189
+ }
190
+ }
167
191
  }
168
192
  export default DepFlowCLI;
169
193
  //# sourceMappingURL=DepFLowCLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepFLowCLI.js","sourceRoot":"","sources":["../../src/cli/DepFLowCLI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,YAA8B,MAAM,yCAAyC,CAAC;AACrF,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,OAAO,UAAW,SAAQ,OAAO;IAGf;IAFD,WAAW,CAAS;IACvC,YACoB,aAAqB,cAAc;QACnD,KAAK,EAAE,CAAC;QADQ,eAAU,GAAV,UAAU,CAAyB;QAEnD,MAAM,kBA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}
@@ -1,10 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import DepFlowCLI from "./DepFLowCLI.js";
3
- const cli = new DepFlowCLI();
3
+ import { Utils } from "../support/Utils.js";
4
+ import schemas from "../config/schemas.js";
5
+ function startupSchemaValidation(flowPath) {
6
+ const jsonSchema = schemas.config.jsonSchema;
7
+ Utils.addVscodeValidation(flowPath, jsonSchema);
8
+ }
9
+ const skip = 2;
10
+ const [commandName, ...args] = process.argv.slice(skip);
11
+ const flowTag = (Utils.getFlagValue(args, '--flow') ||
12
+ Utils.getFlagValue(args, '-f'));
13
+ const flowPath = flowTag[0] || 'depflow.json';
14
+ const cli = new DepFlowCLI(flowPath);
15
+ startupSchemaValidation(flowPath);
16
+ console.log(flowPath);
4
17
  try {
5
- const skip = 2;
6
- const [commandName, ...args] = process.argv.slice(skip);
7
- if (commandName) {
18
+ if (commandName !== null) {
8
19
  const command = cli.getCommand(commandName);
9
20
  if (command) {
10
21
  await command.exec.call(cli, commandName, args);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";AAEA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,SAAS,uBAAuB,CAAC,QAAgB;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;IAC7C,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAExD,MAAM,OAAO,GAAG,CACZ,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;IAClC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CACjC,CAAC;AAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC;AAC9C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AAErC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtB,IAAI,CAAC;IACD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACJ,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC;YACjD,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;;QAAM,GAAG,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC;AAAC,OAAO,KAAU,EAAE,CAAC;IAClB,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC/E,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;IAC9D,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import schemas from './schemas.js';
2
+ export declare class Config {
3
+ /**
4
+ * Loads the configuration from a file at the specified path.
5
+ * If the file does not exist, it creates a new configuration file with default values and returns those defaults.
6
+ * If the file exists, it reads the content, parses it as JSON, and processes it using the defined schema to ensure it conforms to the expected structure.
7
+ * This method is essential for managing application settings or other relevant information in a structured format that can be easily read and modified as needed.
8
+ * @param path The file system path of the configuration file to load.
9
+ * @returns A promise that resolves to the loaded configuration object, which conforms to the expected structure defined in the Config.Config type.
10
+ * @throws Will throw an error if there is an issue during the file reading or writing process, such as insufficient permissions or invalid path.
11
+ */
12
+ static load(path: string): Promise<Config.Config>;
13
+ /**
14
+ * Saves the provided configuration object to a file at the specified path.
15
+ * It converts the configuration object into a JSON string with proper formatting and writes it to the file using the File.write method.
16
+ * This function is essential for persisting configuration data, allowing applications to store settings or other relevant information in a structured format that can be easily read and modified as needed.
17
+ * @param path The file system path where the configuration should be saved.
18
+ * @param config The configuration object to be saved, which should conform to the expected structure defined in the Config.ConfigToProcess type.
19
+ * @returns A promise that resolves when the save operation is complete.
20
+ * @throws Will throw an error if there is an issue during the file writing process, such as insufficient permissions or invalid path.
21
+ */
22
+ static save(path: string, config: Config.ConfigToProcess): Promise<void>;
23
+ }
24
+ export declare namespace Config {
25
+ type Config = typeof schemas.config.infer;
26
+ type ConfigToProcess = typeof schemas.config.inferToProcess;
27
+ }
28
+ export default Config;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @author NetFeez <netfeez.dev@gmail.com>
3
+ * @description Utility to help with File operations.
4
+ * @license Apache-2.0
5
+ */
6
+ import { File } from '@netfeez/common-node';
7
+ import schemas from './schemas.js';
8
+ export class Config {
9
+ /**
10
+ * Loads the configuration from a file at the specified path.
11
+ * If the file does not exist, it creates a new configuration file with default values and returns those defaults.
12
+ * If the file exists, it reads the content, parses it as JSON, and processes it using the defined schema to ensure it conforms to the expected structure.
13
+ * This method is essential for managing application settings or other relevant information in a structured format that can be easily read and modified as needed.
14
+ * @param path The file system path of the configuration file to load.
15
+ * @returns A promise that resolves to the loaded configuration object, which conforms to the expected structure defined in the Config.Config type.
16
+ * @throws Will throw an error if there is an issue during the file reading or writing process, such as insufficient permissions or invalid path.
17
+ */
18
+ static async load(path) {
19
+ if (!await File.exists(path)) {
20
+ const defaults = schemas.config.processData({});
21
+ await Config.save(path, defaults);
22
+ return defaults;
23
+ }
24
+ else {
25
+ const content = await File.read(path, 'utf-8');
26
+ const json = JSON.parse(content);
27
+ const config = schemas.config.processData(json);
28
+ return config;
29
+ }
30
+ }
31
+ /**
32
+ * Saves the provided configuration object to a file at the specified path.
33
+ * It converts the configuration object into a JSON string with proper formatting and writes it to the file using the File.write method.
34
+ * This function is essential for persisting configuration data, allowing applications to store settings or other relevant information in a structured format that can be easily read and modified as needed.
35
+ * @param path The file system path where the configuration should be saved.
36
+ * @param config The configuration object to be saved, which should conform to the expected structure defined in the Config.ConfigToProcess type.
37
+ * @returns A promise that resolves when the save operation is complete.
38
+ * @throws Will throw an error if there is an issue during the file writing process, such as insufficient permissions or invalid path.
39
+ */
40
+ static async save(path, config) {
41
+ const content = JSON.stringify(config, null, 2);
42
+ await File.write(path, content, 'utf-8');
43
+ }
44
+ }
45
+ export default Config;
46
+ //# sourceMappingURL=Config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,OAAO,MAAM;IACf;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAY;QAC1B,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAChD,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAClC,OAAO,QAAQ,CAAC;QACpB,CAAC;aAAM,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IACD;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,MAA8B;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACJ;AAMD,eAAe,MAAM,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { Logger } from '@netfeez/vterm';
2
+ import AliasCompiler from '../support/PathResolver/AliasCompiler.js';
3
+ export declare class ImportMap {
4
+ protected data: ImportMap.Data;
5
+ protected projectRoot: string;
6
+ protected filename: string;
7
+ protected logger: Logger;
8
+ constructor(data: ImportMap.Data, projectRoot: string, filename: string, options?: ImportMap.Options);
9
+ /**
10
+ * Updates the import map data based on the provided compiled aliases.
11
+ * It constructs an "imports" section where each alias is mapped to its target path.
12
+ * @param aliases An array of compiled aliases.
13
+ * @param mode The resolution mode ('local' or 'cdn').
14
+ */
15
+ updateImports(aliases: AliasCompiler.CompiledAlias[], mode: 'local' | 'cdn'): void;
16
+ save(filename?: string): Promise<void>;
17
+ static save(projectRoot: string, filename: string, data: ImportMap.Data, options?: ImportMap.Options): Promise<void>;
18
+ /**
19
+ * Factory method: Loads, validates (or creates default), and returns an instance of the ImportMap class.
20
+ * It checks if the specified import map file exists, and if it does, it attempts to read and parse its content as JSON.
21
+ * If the file does not exist or contains invalid JSON, it initializes the data with a default structure containing an empty "imports" object.
22
+ * Finally, it returns a new instance of ImportMap with the loaded or default data, allowing for further manipulation and saving of the import map configuration.
23
+ * @param projectRoot The root directory of the project where the import map file is located.
24
+ * @param filename The name of the import map file to load (e.g., 'import-map.json').
25
+ * @param options Additional options for loading, such as a logger for logging messages during the load process.
26
+ * @returns A promise that resolves to an instance of ImportMap initialized with the loaded or default data.
27
+ */
28
+ static load(projectRoot: string, filename: string, options?: ImportMap.Options): Promise<ImportMap>;
29
+ }
30
+ export declare namespace ImportMap {
31
+ interface Data {
32
+ imports: Record<string, string>;
33
+ }
34
+ interface Options {
35
+ logger?: Logger;
36
+ }
37
+ }
38
+ export default ImportMap;
@@ -0,0 +1,83 @@
1
+ import PATH from 'node:path';
2
+ import { Logger } from '@netfeez/vterm';
3
+ import { File, Path } from '@netfeez/common-node';
4
+ export class ImportMap {
5
+ data;
6
+ projectRoot;
7
+ filename;
8
+ logger;
9
+ constructor(data, projectRoot, filename, options = {}) {
10
+ this.data = data;
11
+ this.projectRoot = projectRoot;
12
+ this.filename = filename;
13
+ this.logger = options.logger || new Logger({ name: 'IMP-MAP' });
14
+ }
15
+ /**
16
+ * Updates the import map data based on the provided compiled aliases.
17
+ * It constructs an "imports" section where each alias is mapped to its target path.
18
+ * @param aliases An array of compiled aliases.
19
+ * @param mode The resolution mode ('local' or 'cdn').
20
+ */
21
+ updateImports(aliases, mode) {
22
+ if (!this.data.imports)
23
+ this.data.imports = {};
24
+ for (const aliasObj of aliases) {
25
+ const key = aliasObj.isWildcard ? `${aliasObj.alias}/` : aliasObj.alias;
26
+ let target = mode === 'cdn' && aliasObj.targets.cdn
27
+ ? aliasObj.targets.cdn
28
+ : aliasObj.targets.local;
29
+ if (target === aliasObj.targets.local) {
30
+ target = PATH.relative(this.projectRoot, target);
31
+ if (!target.startsWith('./'))
32
+ target = `./${target}`;
33
+ target = Path.normalize(target);
34
+ }
35
+ if (aliasObj.isWildcard) {
36
+ if (!target.endsWith('/'))
37
+ target += '/';
38
+ }
39
+ this.data.imports[key] = target;
40
+ }
41
+ }
42
+ async save(filename = this.filename) {
43
+ await ImportMap.save(this.projectRoot, filename, this.data, { logger: this.logger });
44
+ }
45
+ static async save(projectRoot, filename, data, options = {}) {
46
+ const logger = options.logger || new Logger({ name: 'IMP-MAP' });
47
+ const importMapPath = PATH.resolve(projectRoot, filename);
48
+ const folder = PATH.dirname(importMapPath);
49
+ if (!await File.exists(folder))
50
+ await File.mkdir(folder, { recursive: true });
51
+ const json = JSON.stringify(data, null, 4);
52
+ await File.write(importMapPath, json);
53
+ logger.log(`&C2Generated &C4${filename}`);
54
+ }
55
+ /**
56
+ * Factory method: Loads, validates (or creates default), and returns an instance of the ImportMap class.
57
+ * It checks if the specified import map file exists, and if it does, it attempts to read and parse its content as JSON.
58
+ * If the file does not exist or contains invalid JSON, it initializes the data with a default structure containing an empty "imports" object.
59
+ * Finally, it returns a new instance of ImportMap with the loaded or default data, allowing for further manipulation and saving of the import map configuration.
60
+ * @param projectRoot The root directory of the project where the import map file is located.
61
+ * @param filename The name of the import map file to load (e.g., 'import-map.json').
62
+ * @param options Additional options for loading, such as a logger for logging messages during the load process.
63
+ * @returns A promise that resolves to an instance of ImportMap initialized with the loaded or default data.
64
+ */
65
+ static async load(projectRoot, filename, options = {}) {
66
+ const logger = options.logger || new Logger({ name: 'IMP-MAP' });
67
+ const importMapPath = PATH.resolve(projectRoot, filename);
68
+ let data = { imports: {} };
69
+ if (!await File.exists(importMapPath)) {
70
+ logger.warn(`&C3${filename} not found. Creating defaults...`);
71
+ const data = { imports: {} };
72
+ await ImportMap.save(projectRoot, filename, data, { logger });
73
+ }
74
+ else {
75
+ const content = await File.read(importMapPath, 'utf-8');
76
+ const json = JSON.parse(content);
77
+ data = json;
78
+ }
79
+ return new ImportMap(data, projectRoot, filename, { logger });
80
+ }
81
+ }
82
+ export default ImportMap;
83
+ //# sourceMappingURL=ImportMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImportMap.js","sourceR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'../support/PathResolver/AliasCompiler.js';
4
+ export declare class Tsconfig {
5
+ protected data: Tsconfig.Data;
6
+ protected projectRoot: string;
7
+ protected filename: string;
8
+ protected logger: Logger;
9
+ constructor(data: Tsconfig.Data, projectRoot: string, filename: string, options?: Tsconfig.Options);
10
+ /**
11
+ * Updates the paths in the tsconfig data based on the provided compiled aliases.
12
+ * It ensures that the compilerOptions and paths properties exist in the tsconfig data, and then iterates through the compiled aliases to construct the appropriate path mappings.
13
+ * For each alias, it calculates the relative path from the project root to the local target and normalizes it. If the alias is a wildcard, it appends '/*' to the target path.
14
+ * Finally, it updates the paths in the tsconfig data with the new mappings, allowing TypeScript to resolve module paths according to the defined aliases.
15
+ * @param aliases An array of compiled aliases containing alias names, target paths, and wildcard information.
16
+ */
17
+ updatePaths(aliases: AliasCompiler.CompiledAlias[]): void;
18
+ /**
19
+ * Saves the current tsconfig data to a file.
20
+ * It constructs the path to the tsconfig file using the project root and filename, converts the data to a JSON string with proper formatting, and writes it to the file system using the File.write method.
21
+ * The method also includes error handling to log any issues that occur during the save process, ensuring that users are informed of any problems when attempting to save the tsconfig configuration.
22
+ * @param filename The name of the tsconfig file to save (default is the instance's filename property).
23
+ * @returns A promise that resolves when the save operation is complete, or rejects if an error occurs during the process.
24
+ */
25
+ save(filename?: string): Promise<void>;
26
+ /**
27
+ * Static method to save tsconfig data to a specified file. It takes the project root, filename, tsconfig data, and options (including a logger) as parameters.
28
+ * The method constructs the full path to the tsconfig file, converts the data to a formatted JSON string, and writes it to the file system.
29
+ * It also includes error handling to log any issues that arise during the save process, providing feedback on whether the operation was successful or if it encountered problems.
30
+ * @param projectRoot The root directory of the project where the tsconfig file should be saved.
31
+ * @param filename The name of the tsconfig file (default is 'tsconfig.json').
32
+ * @param data The tsconfig data to be saved, structured according to the defined schema.
33
+ * @param options Additional options for saving, such as a logger for logging messages during the save process.
34
+ * @returns A promise that resolves when the save operation is complete, or rejects if an error occurs during the process.
35
+ * @throws Will throw an error if there is an issue during the save process, which can be caught by the caller to handle it appropriately.
36
+ */
37
+ static save(projectRoot: string, filename: string | undefined, data: Tsconfig.Data, options?: Tsconfig.Options): Promise<void>;
38
+ /**
39
+ * Static method to load tsconfig data from a specified file.
40
+ * It takes the project root, filename, and options (including a logger) as parameters.
41
+ * The method checks if the tsconfig file exists, and if it does, it reads the content, parses it as JSON, and processes it using the defined schema to ensure it conforms to the expected structure.
42
+ * If the file does not exist, it creates a default tsconfig data object using the schema. Finally, it returns an instance of the Tsconfig class initialized with the loaded or default data.
43
+ * @param projectRoot The root directory of the project where the tsconfig file is located.
44
+ * @param filename The name of the tsconfig file to load (default is 'tsconfig.json').
45
+ * @param options Additional options for loading, such as a logger for logging messages during the load process.
46
+ * @returns A promise that resolves to an instance of the Tsconfig class containing the loaded data, or rejects if there is an error during the load process.
47
+ * @throws Will throw an error if there is an issue during the load process, which
48
+ */
49
+ static load(projectRoot: string, filename: string, options: Tsconfig.Options): Promise<Tsconfig>;
50
+ }
51
+ export declare namespace Tsconfig {
52
+ type Data = schemas.basicTsconfig['infer'];
53
+ interface Options {
54
+ logger?: Logger;
55
+ }
56
+ }
57
+ export default Tsconfig;
@@ -0,0 +1,99 @@
1
+ import PATH from 'node:path';
2
+ import { Logger } from '@netfeez/vterm';
3
+ import { File, Path } from '@netfeez/common-node';
4
+ import schemas from "./schemas.js";
5
+ export class Tsconfig {
6
+ data;
7
+ projectRoot;
8
+ filename;
9
+ logger;
10
+ constructor(data, projectRoot, filename, options = {}) {
11
+ this.data = data;
12
+ this.projectRoot = projectRoot;
13
+ this.filename = filename;
14
+ this.logger = options.logger || new Logger({ name: 'TS-CFG' });
15
+ }
16
+ /**
17
+ * Updates the paths in the tsconfig data based on the provided compiled aliases.
18
+ * It ensures that the compilerOptions and paths properties exist in the tsconfig data, and then iterates through the compiled aliases to construct the appropriate path mappings.
19
+ * For each alias, it calculates the relative path from the project root to the local target and normalizes it. If the alias is a wildcard, it appends '/*' to the target path.
20
+ * Finally, it updates the paths in the tsconfig data with the new mappings, allowing TypeScript to resolve module paths according to the defined aliases.
21
+ * @param aliases An array of compiled aliases containing alias names, target paths, and wildcard information.
22
+ */
23
+ updatePaths(aliases) {
24
+ if (!this.data.compilerOptions)
25
+ this.data.compilerOptions = {};
26
+ if (!this.data.compilerOptions.paths)
27
+ this.data.compilerOptions.paths = {};
28
+ for (const aliasObj of aliases) {
29
+ const key = aliasObj.isWildcard ? `${aliasObj.alias}/*` : aliasObj.alias;
30
+ let target = PATH.relative(this.projectRoot, aliasObj.targets.local);
31
+ target = Path.normalize(target);
32
+ if (aliasObj.isWildcard) {
33
+ const suffix = target.endsWith('/') ? '*' : '/*';
34
+ target = `${target}${suffix}`;
35
+ }
36
+ this.data.compilerOptions.paths[key] = [target];
37
+ }
38
+ }
39
+ /**
40
+ * Saves the current tsconfig data to a file.
41
+ * It constructs the path to the tsconfig file using the project root and filename, converts the data to a JSON string with proper formatting, and writes it to the file system using the File.write method.
42
+ * The method also includes error handling to log any issues that occur during the save process, ensuring that users are informed of any problems when attempting to save the tsconfig configuration.
43
+ * @param filename The name of the tsconfig file to save (default is the instance's filename property).
44
+ * @returns A promise that resolves when the save operation is complete, or rejects if an error occurs during the process.
45
+ */
46
+ async save(filename = this.filename) {
47
+ await Tsconfig.save(this.projectRoot, filename, this.data, { logger: this.logger });
48
+ }
49
+ /**
50
+ * Static method to save tsconfig data to a specified file. It takes the project root, filename, tsconfig data, and options (including a logger) as parameters.
51
+ * The method constructs the full path to the tsconfig file, converts the data to a formatted JSON string, and writes it to the file system.
52
+ * It also includes error handling to log any issues that arise during the save process, providing feedback on whether the operation was successful or if it encountered problems.
53
+ * @param projectRoot The root directory of the project where the tsconfig file should be saved.
54
+ * @param filename The name of the tsconfig file (default is 'tsconfig.json').
55
+ * @param data The tsconfig data to be saved, structured according to the defined schema.
56
+ * @param options Additional options for saving, such as a logger for logging messages during the save process.
57
+ * @returns A promise that resolves when the save operation is complete, or rejects if an error occurs during the process.
58
+ * @throws Will throw an error if there is an issue during the save process, which can be caught by the caller to handle it appropriately.
59
+ */
60
+ static async save(projectRoot, filename = 'tsconfig.json', data, options = {}) {
61
+ const logger = options.logger || new Logger({ name: 'TS-CFG' });
62
+ const tsconfigPath = PATH.resolve(projectRoot, filename);
63
+ const folder = PATH.dirname(tsconfigPath);
64
+ if (!await File.exists(folder))
65
+ await File.mkdir(folder, { recursive: true });
66
+ const json = JSON.stringify(data, null, 4);
67
+ await File.write(tsconfigPath, json);
68
+ logger.log(`&C2Updated &C4${filename}&C2 successfully.`);
69
+ }
70
+ /**
71
+ * Static method to load tsconfig data from a specified file.
72
+ * It takes the project root, filename, and options (including a logger) as parameters.
73
+ * The method checks if the tsconfig file exists, and if it does, it reads the content, parses it as JSON, and processes it using the defined schema to ensure it conforms to the expected structure.
74
+ * If the file does not exist, it creates a default tsconfig data object using the schema. Finally, it returns an instance of the Tsconfig class initialized with the loaded or default data.
75
+ * @param projectRoot The root directory of the project where the tsconfig file is located.
76
+ * @param filename The name of the tsconfig file to load (default is 'tsconfig.json').
77
+ * @param options Additional options for loading, such as a logger for logging messages during the load process.
78
+ * @returns A promise that resolves to an instance of the Tsconfig class containing the loaded data, or rejects if there is an error during the load process.
79
+ * @throws Will throw an error if there is an issue during the load process, which
80
+ */
81
+ static async load(projectRoot, filename, options) {
82
+ const logger = options.logger || new Logger({ name: 'TS-CFG' });
83
+ const tsconfigPath = PATH.resolve(projectRoot, filename);
84
+ let data;
85
+ if (!await File.exists(tsconfigPath)) {
86
+ logger.warn(`&C3${filename} not found. Creating defaults...`);
87
+ data = schemas.basicTsconfig.processData({});
88
+ this.save(projectRoot, filename, data, { logger }).catch(err => logger.error(`Failed to create default tsconfig:`, err.message));
89
+ }
90
+ else {
91
+ const content = await File.read(tsconfigPath, 'utf-8');
92
+ const json = JSON.parse(content);
93
+ data = schemas.basicTsconfig.processData(json);
94
+ }
95
+ return new Tsconfig(data, projectRoot, filename, { logger });
96
+ }
97
+ }
98
+ export default Tsconfig;
99
+ //# sourceMappingURL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