@postxl/generator 1.3.2 → 1.3.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.
@@ -140,20 +140,35 @@ class GeneratorManager {
140
140
  this.checkCircularDependencies();
141
141
  const generatorsSorted = this.topologicalSort();
142
142
  for (const generator of generatorsSorted) {
143
- // Not all generators extend the context and hence do not need to return it.
144
- // Therefore, if the generator does not return the context, we use the original context.
145
- context = (await generator.register(context)) ?? context;
143
+ try {
144
+ // Not all generators extend the context and hence do not need to return it.
145
+ // Therefore, if the generator does not return the context, we use the original context.
146
+ context = (await generator.register(context)) ?? context;
147
+ }
148
+ catch (error) {
149
+ throw new Error(`Generator ${(0, utils_1.yellow)(generator.id)} failed during register phase: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
150
+ }
146
151
  }
147
152
  for (const generator of generatorsSorted) {
148
153
  if (!generator.afterRegistrations) {
149
154
  continue;
150
155
  }
151
- await generator.afterRegistrations(context);
156
+ try {
157
+ await generator.afterRegistrations(context);
158
+ }
159
+ catch (error) {
160
+ throw new Error(`Generator ${(0, utils_1.yellow)(generator.id)} failed during afterRegistrations phase: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
161
+ }
152
162
  }
153
163
  for (const generator of generatorsSorted) {
154
- // Not all generators extend the context and hence do not need to return it.
155
- // Therefore, if the generator does not return the context, we use the original context.
156
- context = (await generator.generate(context)) ?? context;
164
+ try {
165
+ // Not all generators extend the context and hence do not need to return it.
166
+ // Therefore, if the generator does not return the context, we use the original context.
167
+ context = (await generator.generate(context)) ?? context;
168
+ }
169
+ catch (error) {
170
+ throw new Error(`Generator ${(0, utils_1.yellow)(generator.id)} failed during generate phase: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
171
+ }
157
172
  }
158
173
  return context;
159
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Core package that orchestrates the code generation of a PXL project",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -46,8 +46,8 @@
46
46
  "jszip": "3.10.1",
47
47
  "minimatch": "^10.1.1",
48
48
  "p-limit": "3.1.0",
49
- "@postxl/schema": "^1.2.0",
50
- "@postxl/utils": "^1.3.0"
49
+ "@postxl/schema": "^1.3.0",
50
+ "@postxl/utils": "^1.3.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/diff": "8.0.0"