@ingenyus/swarm-wasp 0.2.0 → 0.2.1

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 (41) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/common/index.d.ts +0 -1
  3. package/dist/common/index.d.ts.map +1 -1
  4. package/dist/common/index.js +9 -34
  5. package/dist/generators/action/action-generator.js +20 -24
  6. package/dist/generators/action/index.js +20 -24
  7. package/dist/generators/action/schema.js +1 -5
  8. package/dist/generators/api/api-generator.js +21 -25
  9. package/dist/generators/api/index.js +21 -25
  10. package/dist/generators/api/schema.js +1 -5
  11. package/dist/generators/api-namespace/api-namespace-generator.js +21 -25
  12. package/dist/generators/api-namespace/index.js +21 -25
  13. package/dist/generators/api-namespace/schema.js +1 -5
  14. package/dist/generators/base/component-generator.base.js +19 -23
  15. package/dist/generators/base/index.js +20 -24
  16. package/dist/generators/base/operation-generator.base.js +20 -24
  17. package/dist/generators/base/wasp-generator.base.js +12 -16
  18. package/dist/generators/config/index.js +12 -16
  19. package/dist/generators/config/wasp-config-generator.js +12 -16
  20. package/dist/generators/crud/crud-generator.js +20 -24
  21. package/dist/generators/crud/index.js +20 -24
  22. package/dist/generators/crud/schema.js +1 -5
  23. package/dist/generators/feature/feature-generator.js +16 -20
  24. package/dist/generators/feature/index.js +16 -20
  25. package/dist/generators/feature/schema.js +1 -5
  26. package/dist/generators/index.js +24 -28
  27. package/dist/generators/job/index.js +19 -23
  28. package/dist/generators/job/job-generator.js +19 -23
  29. package/dist/generators/job/schema.js +1 -5
  30. package/dist/generators/query/index.js +20 -24
  31. package/dist/generators/query/query-generator.js +20 -24
  32. package/dist/generators/query/schema.js +1 -5
  33. package/dist/generators/route/index.js +19 -23
  34. package/dist/generators/route/route-generator.js +19 -23
  35. package/dist/generators/route/schema.js +1 -5
  36. package/dist/index.js +30 -56
  37. package/dist/plugins/wasp.d.ts.map +1 -1
  38. package/package.json +2 -2
  39. package/dist/common/plugin.d.ts +0 -2
  40. package/dist/common/plugin.d.ts.map +0 -1
  41. package/dist/common/plugin.js +0 -41
@@ -90,16 +90,12 @@ function getRouteNameFromPath(routePath) {
90
90
  return `${toPascalCase(cleanSegment)}Page`;
91
91
  }
92
92
 
93
- // src/common/plugin.ts
94
- import path2 from "path";
95
- import { fileURLToPath } from "url";
96
-
97
93
  // src/common/prisma.ts
98
94
  import {
99
95
  getSchema
100
96
  } from "@mrleebo/prisma-ast";
101
97
  import fs2 from "fs";
102
- import path3 from "path";
98
+ import path2 from "path";
103
99
 
104
100
  // src/common/schemas.ts
105
101
  import { commandRegistry } from "@ingenyus/swarm";
@@ -156,7 +152,7 @@ var commonSchemas = {
156
152
  // src/common/templates.ts
157
153
  import { toKebabCase } from "@ingenyus/swarm";
158
154
  import { Eta } from "eta";
159
- import path4 from "path";
155
+ import path3 from "path";
160
156
  var TemplateUtility = class {
161
157
  constructor(fileSystem) {
162
158
  this.fileSystem = fileSystem;
@@ -164,14 +160,14 @@ var TemplateUtility = class {
164
160
  processTemplate(templatePath, replacements) {
165
161
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
166
162
  const functionHeader = declarations ? `const ${declarations};` : void 0;
167
- const templateDir = path4.dirname(templatePath);
163
+ const templateDir = path3.dirname(templatePath);
168
164
  const eta = new Eta({
169
165
  autoTrim: false,
170
166
  autoEscape: false,
171
167
  views: templateDir,
172
168
  functionHeader
173
169
  });
174
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
170
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
175
171
  if (this.fileSystem.existsSync(templatePath)) {
176
172
  return eta.render(templateName, replacements);
177
173
  } else {
@@ -189,11 +185,11 @@ var TemplateUtility = class {
189
185
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
190
186
  const generatorDirName = toKebabCase(generatorName);
191
187
  const currentFilePath = new URL(currentFileUrl).pathname;
192
- const currentFileDir = path4.dirname(currentFilePath);
193
- const currentFileName = path4.basename(currentFilePath);
188
+ const currentFileDir = path3.dirname(currentFilePath);
189
+ const currentFileName = path3.basename(currentFilePath);
194
190
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
195
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
196
- return path4.join(
191
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
192
+ return path3.join(
197
193
  startDir,
198
194
  "generators",
199
195
  generatorDirName,
@@ -211,7 +207,7 @@ import {
211
207
  toKebabCase as toKebabCase2,
212
208
  validateFeaturePath as validateFeaturePath3
213
209
  } from "@ingenyus/swarm";
214
- import path7 from "path";
210
+ import path6 from "path";
215
211
 
216
212
  // src/generators/feature/feature-generator.ts
217
213
  import {
@@ -219,7 +215,7 @@ import {
219
215
  logger as singletonLogger3,
220
216
  validateFeaturePath as validateFeaturePath2
221
217
  } from "@ingenyus/swarm";
222
- import path6 from "path";
218
+ import path5 from "path";
223
219
 
224
220
  // src/generators/base/wasp-generator.base.ts
225
221
  import {
@@ -235,14 +231,14 @@ import {
235
231
  parseHelperMethodDefinition,
236
232
  logger as singletonLogger
237
233
  } from "@ingenyus/swarm";
238
- import path5 from "path";
234
+ import path4 from "path";
239
235
  var WaspConfigGenerator = class {
240
236
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
241
237
  this.logger = logger;
242
238
  this.fileSystem = fileSystem;
243
239
  this.templateUtility = new TemplateUtility(fileSystem);
244
240
  }
245
- path = path5;
241
+ path = path4;
246
242
  templateUtility;
247
243
  /**
248
244
  * Gets the template path for feature config templates.
@@ -271,7 +267,7 @@ var WaspConfigGenerator = class {
271
267
  this.logger.error(`Template not found: ${templatePath}`);
272
268
  return;
273
269
  }
274
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
270
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
275
271
  if (this.fileSystem.existsSync(configFilePath)) {
276
272
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
277
273
  return;
@@ -287,7 +283,7 @@ var WaspConfigGenerator = class {
287
283
  */
288
284
  update(featurePath, declaration) {
289
285
  const configDir = getFeatureDir(this.fileSystem, featurePath);
290
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
286
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
291
287
  if (!this.fileSystem.existsSync(configFilePath)) {
292
288
  const templatePath = this.getTemplatePath("feature.wasp.eta");
293
289
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -797,18 +793,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
797
793
  const { target } = args;
798
794
  const segments = validateFeaturePath2(target);
799
795
  const normalisedPath = normaliseFeaturePath(target);
800
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
796
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
801
797
  if (segments.length > 1) {
802
798
  const parentPath = segments.slice(0, -1).join("/");
803
799
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
804
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
800
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
805
801
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
806
802
  handleFatalError2(
807
803
  `Parent feature '${parentPath}' does not exist. Please create it first.`
808
804
  );
809
805
  }
810
806
  }
811
- const featureDir = path6.join(sourceRoot, normalisedPath);
807
+ const featureDir = path5.join(sourceRoot, normalisedPath);
812
808
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
813
809
  this.configGenerator.generate(normalisedPath);
814
810
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -845,7 +841,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
845
841
  const currentPath = pathSegments.join("/");
846
842
  const featureName = pathSegments[pathSegments.length - 1];
847
843
  const featureDir = getFeatureDir(this.fileSystem, currentPath);
848
- const configPath = path7.join(featureDir, `feature.wasp.ts`);
844
+ const configPath = path6.join(featureDir, `feature.wasp.ts`);
849
845
  if (this.fileSystem.existsSync(configPath)) {
850
846
  return configPath;
851
847
  }
@@ -918,7 +914,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
918
914
  const featureDir = getFeatureDir(fileSystem, normalisedPath);
919
915
  const typeKey = type.toLowerCase();
920
916
  const typeDirectory = TYPE_DIRECTORIES[typeKey];
921
- const targetDirectory = path7.join(featureDir, typeDirectory);
917
+ const targetDirectory = path6.join(featureDir, typeDirectory);
922
918
  const importDirectory = `@src/${normalisedPath}/${typeDirectory}`;
923
919
  return { targetDirectory, importDirectory };
924
920
  }
@@ -90,16 +90,12 @@ function getRouteNameFromPath(routePath) {
90
90
  return `${toPascalCase(cleanSegment)}Page`;
91
91
  }
92
92
 
93
- // src/common/plugin.ts
94
- import path2 from "path";
95
- import { fileURLToPath } from "url";
96
-
97
93
  // src/common/prisma.ts
98
94
  import {
99
95
  getSchema
100
96
  } from "@mrleebo/prisma-ast";
101
97
  import fs2 from "fs";
102
- import path3 from "path";
98
+ import path2 from "path";
103
99
 
104
100
  // src/common/schemas.ts
105
101
  import { commandRegistry } from "@ingenyus/swarm";
@@ -156,7 +152,7 @@ var commonSchemas = {
156
152
  // src/common/templates.ts
157
153
  import { toKebabCase } from "@ingenyus/swarm";
158
154
  import { Eta } from "eta";
159
- import path4 from "path";
155
+ import path3 from "path";
160
156
  var TemplateUtility = class {
161
157
  constructor(fileSystem) {
162
158
  this.fileSystem = fileSystem;
@@ -164,14 +160,14 @@ var TemplateUtility = class {
164
160
  processTemplate(templatePath, replacements) {
165
161
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
166
162
  const functionHeader = declarations ? `const ${declarations};` : void 0;
167
- const templateDir = path4.dirname(templatePath);
163
+ const templateDir = path3.dirname(templatePath);
168
164
  const eta = new Eta({
169
165
  autoTrim: false,
170
166
  autoEscape: false,
171
167
  views: templateDir,
172
168
  functionHeader
173
169
  });
174
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
170
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
175
171
  if (this.fileSystem.existsSync(templatePath)) {
176
172
  return eta.render(templateName, replacements);
177
173
  } else {
@@ -189,11 +185,11 @@ var TemplateUtility = class {
189
185
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
190
186
  const generatorDirName = toKebabCase(generatorName);
191
187
  const currentFilePath = new URL(currentFileUrl).pathname;
192
- const currentFileDir = path4.dirname(currentFilePath);
193
- const currentFileName = path4.basename(currentFilePath);
188
+ const currentFileDir = path3.dirname(currentFilePath);
189
+ const currentFileName = path3.basename(currentFilePath);
194
190
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
195
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
196
- return path4.join(
191
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
192
+ return path3.join(
197
193
  startDir,
198
194
  "generators",
199
195
  generatorDirName,
@@ -211,7 +207,7 @@ import {
211
207
  toKebabCase as toKebabCase2,
212
208
  validateFeaturePath as validateFeaturePath3
213
209
  } from "@ingenyus/swarm";
214
- import path7 from "path";
210
+ import path6 from "path";
215
211
 
216
212
  // src/generators/feature/feature-generator.ts
217
213
  import {
@@ -219,7 +215,7 @@ import {
219
215
  logger as singletonLogger3,
220
216
  validateFeaturePath as validateFeaturePath2
221
217
  } from "@ingenyus/swarm";
222
- import path6 from "path";
218
+ import path5 from "path";
223
219
 
224
220
  // src/generators/base/wasp-generator.base.ts
225
221
  import {
@@ -235,14 +231,14 @@ import {
235
231
  parseHelperMethodDefinition,
236
232
  logger as singletonLogger
237
233
  } from "@ingenyus/swarm";
238
- import path5 from "path";
234
+ import path4 from "path";
239
235
  var WaspConfigGenerator = class {
240
236
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
241
237
  this.logger = logger;
242
238
  this.fileSystem = fileSystem;
243
239
  this.templateUtility = new TemplateUtility(fileSystem);
244
240
  }
245
- path = path5;
241
+ path = path4;
246
242
  templateUtility;
247
243
  /**
248
244
  * Gets the template path for feature config templates.
@@ -271,7 +267,7 @@ var WaspConfigGenerator = class {
271
267
  this.logger.error(`Template not found: ${templatePath}`);
272
268
  return;
273
269
  }
274
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
270
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
275
271
  if (this.fileSystem.existsSync(configFilePath)) {
276
272
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
277
273
  return;
@@ -287,7 +283,7 @@ var WaspConfigGenerator = class {
287
283
  */
288
284
  update(featurePath, declaration) {
289
285
  const configDir = getFeatureDir(this.fileSystem, featurePath);
290
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
286
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
291
287
  if (!this.fileSystem.existsSync(configFilePath)) {
292
288
  const templatePath = this.getTemplatePath("feature.wasp.eta");
293
289
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -797,18 +793,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
797
793
  const { target } = args;
798
794
  const segments = validateFeaturePath2(target);
799
795
  const normalisedPath = normaliseFeaturePath(target);
800
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
796
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
801
797
  if (segments.length > 1) {
802
798
  const parentPath = segments.slice(0, -1).join("/");
803
799
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
804
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
800
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
805
801
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
806
802
  handleFatalError2(
807
803
  `Parent feature '${parentPath}' does not exist. Please create it first.`
808
804
  );
809
805
  }
810
806
  }
811
- const featureDir = path6.join(sourceRoot, normalisedPath);
807
+ const featureDir = path5.join(sourceRoot, normalisedPath);
812
808
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
813
809
  this.configGenerator.generate(normalisedPath);
814
810
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -845,7 +841,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
845
841
  const currentPath = pathSegments.join("/");
846
842
  const featureName = pathSegments[pathSegments.length - 1];
847
843
  const featureDir = getFeatureDir(this.fileSystem, currentPath);
848
- const configPath = path7.join(featureDir, `feature.wasp.ts`);
844
+ const configPath = path6.join(featureDir, `feature.wasp.ts`);
849
845
  if (this.fileSystem.existsSync(configPath)) {
850
846
  return configPath;
851
847
  }
@@ -918,7 +914,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
918
914
  const featureDir = getFeatureDir(fileSystem, normalisedPath);
919
915
  const typeKey = type.toLowerCase();
920
916
  const typeDirectory = TYPE_DIRECTORIES[typeKey];
921
- const targetDirectory = path7.join(featureDir, typeDirectory);
917
+ const targetDirectory = path6.join(featureDir, typeDirectory);
922
918
  const importDirectory = `@src/${normalisedPath}/${typeDirectory}`;
923
919
  return { targetDirectory, importDirectory };
924
920
  }
@@ -14,16 +14,12 @@ var realFileSystem = {
14
14
  statSync: fs.statSync
15
15
  };
16
16
 
17
- // src/common/plugin.ts
18
- import path from "path";
19
- import { fileURLToPath } from "url";
20
-
21
17
  // src/common/prisma.ts
22
18
  import {
23
19
  getSchema
24
20
  } from "@mrleebo/prisma-ast";
25
21
  import fs2 from "fs";
26
- import path2 from "path";
22
+ import path from "path";
27
23
 
28
24
  // src/common/schemas.ts
29
25
  import { commandRegistry } from "@ingenyus/swarm";
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  toKebabCase as toKebabCase2,
66
66
  validateFeaturePath as validateFeaturePath3
67
67
  } from "@ingenyus/swarm";
68
- import path7 from "path";
68
+ import path6 from "path";
69
69
 
70
70
  // src/common/filesystem.ts
71
71
  import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
@@ -143,39 +143,15 @@ function getRouteNameFromPath(routePath) {
143
143
  return `${toPascalCase(cleanSegment)}Page`;
144
144
  }
145
145
 
146
- // src/common/plugin.ts
147
- import path2 from "path";
148
- import { fileURLToPath } from "url";
149
- function getPluginVersion() {
150
- const __dirname = path2.dirname(fileURLToPath(import.meta.url));
151
- let currentDir = __dirname;
152
- while (currentDir !== path2.dirname(currentDir)) {
153
- const packageJsonPath = path2.join(currentDir, "package.json");
154
- if (realFileSystem.existsSync(packageJsonPath)) {
155
- try {
156
- const packageJson = JSON.parse(
157
- realFileSystem.readFileSync(packageJsonPath, "utf8")
158
- );
159
- if (packageJson.name === "@ingenyus/swarm-wasp") {
160
- return packageJson.version;
161
- }
162
- } catch (e) {
163
- }
164
- }
165
- currentDir = path2.dirname(currentDir);
166
- }
167
- return "0.1.0";
168
- }
169
-
170
146
  // src/common/prisma.ts
171
147
  import {
172
148
  getSchema
173
149
  } from "@mrleebo/prisma-ast";
174
150
  import fs2 from "fs";
175
- import path3 from "path";
151
+ import path2 from "path";
176
152
  async function getEntityMetadata(modelName) {
177
153
  try {
178
- const schemaPath = path3.join(process.cwd(), "schema.prisma");
154
+ const schemaPath = path2.join(process.cwd(), "schema.prisma");
179
155
  const schemaContent = fs2.readFileSync(schemaPath, "utf8");
180
156
  const schema9 = getSchema(schemaContent);
181
157
  const model = schema9.list?.find(
@@ -350,7 +326,7 @@ var commonSchemas = {
350
326
  // src/common/templates.ts
351
327
  import { toKebabCase } from "@ingenyus/swarm";
352
328
  import { Eta } from "eta";
353
- import path4 from "path";
329
+ import path3 from "path";
354
330
  var TemplateUtility = class {
355
331
  constructor(fileSystem) {
356
332
  this.fileSystem = fileSystem;
@@ -358,14 +334,14 @@ var TemplateUtility = class {
358
334
  processTemplate(templatePath, replacements) {
359
335
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
360
336
  const functionHeader = declarations ? `const ${declarations};` : void 0;
361
- const templateDir = path4.dirname(templatePath);
337
+ const templateDir = path3.dirname(templatePath);
362
338
  const eta = new Eta({
363
339
  autoTrim: false,
364
340
  autoEscape: false,
365
341
  views: templateDir,
366
342
  functionHeader
367
343
  });
368
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
344
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
369
345
  if (this.fileSystem.existsSync(templatePath)) {
370
346
  return eta.render(templateName, replacements);
371
347
  } else {
@@ -383,11 +359,11 @@ var TemplateUtility = class {
383
359
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
384
360
  const generatorDirName = toKebabCase(generatorName);
385
361
  const currentFilePath = new URL(currentFileUrl).pathname;
386
- const currentFileDir = path4.dirname(currentFilePath);
387
- const currentFileName = path4.basename(currentFilePath);
362
+ const currentFileDir = path3.dirname(currentFilePath);
363
+ const currentFileName = path3.basename(currentFilePath);
388
364
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
389
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
390
- return path4.join(
365
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
366
+ return path3.join(
391
367
  startDir,
392
368
  "generators",
393
369
  generatorDirName,
@@ -403,7 +379,7 @@ import {
403
379
  logger as singletonLogger3,
404
380
  validateFeaturePath as validateFeaturePath2
405
381
  } from "@ingenyus/swarm";
406
- import path6 from "path";
382
+ import path5 from "path";
407
383
 
408
384
  // src/generators/base/wasp-generator.base.ts
409
385
  import {
@@ -419,14 +395,14 @@ import {
419
395
  parseHelperMethodDefinition,
420
396
  logger as singletonLogger
421
397
  } from "@ingenyus/swarm";
422
- import path5 from "path";
398
+ import path4 from "path";
423
399
  var WaspConfigGenerator = class {
424
400
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
425
401
  this.logger = logger;
426
402
  this.fileSystem = fileSystem;
427
403
  this.templateUtility = new TemplateUtility(fileSystem);
428
404
  }
429
- path = path5;
405
+ path = path4;
430
406
  templateUtility;
431
407
  /**
432
408
  * Gets the template path for feature config templates.
@@ -455,7 +431,7 @@ var WaspConfigGenerator = class {
455
431
  this.logger.error(`Template not found: ${templatePath}`);
456
432
  return;
457
433
  }
458
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
434
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
459
435
  if (this.fileSystem.existsSync(configFilePath)) {
460
436
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
461
437
  return;
@@ -471,7 +447,7 @@ var WaspConfigGenerator = class {
471
447
  */
472
448
  update(featurePath, declaration) {
473
449
  const configDir = getFeatureDir(this.fileSystem, featurePath);
474
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
450
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
475
451
  if (!this.fileSystem.existsSync(configFilePath)) {
476
452
  const templatePath = this.getTemplatePath("feature.wasp.eta");
477
453
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -981,18 +957,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
981
957
  const { target } = args;
982
958
  const segments = validateFeaturePath2(target);
983
959
  const normalisedPath = normaliseFeaturePath(target);
984
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
960
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
985
961
  if (segments.length > 1) {
986
962
  const parentPath = segments.slice(0, -1).join("/");
987
963
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
988
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
964
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
989
965
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
990
966
  handleFatalError2(
991
967
  `Parent feature '${parentPath}' does not exist. Please create it first.`
992
968
  );
993
969
  }
994
970
  }
995
- const featureDir = path6.join(sourceRoot, normalisedPath);
971
+ const featureDir = path5.join(sourceRoot, normalisedPath);
996
972
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
997
973
  this.configGenerator.generate(normalisedPath);
998
974
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -1029,7 +1005,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
1029
1005
  const currentPath = pathSegments.join("/");
1030
1006
  const featureName = pathSegments[pathSegments.length - 1];
1031
1007
  const featureDir = getFeatureDir(this.fileSystem, currentPath);
1032
- const configPath = path7.join(featureDir, `feature.wasp.ts`);
1008
+ const configPath = path6.join(featureDir, `feature.wasp.ts`);
1033
1009
  if (this.fileSystem.existsSync(configPath)) {
1034
1010
  return configPath;
1035
1011
  }
@@ -1102,7 +1078,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
1102
1078
  const featureDir = getFeatureDir(fileSystem, normalisedPath);
1103
1079
  const typeKey = type.toLowerCase();
1104
1080
  const typeDirectory = TYPE_DIRECTORIES[typeKey];
1105
- const targetDirectory = path7.join(featureDir, typeDirectory);
1081
+ const targetDirectory = path6.join(featureDir, typeDirectory);
1106
1082
  const importDirectory = `@src/${normalisedPath}/${typeDirectory}`;
1107
1083
  return { targetDirectory, importDirectory };
1108
1084
  }
@@ -1550,7 +1526,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1550
1526
  force = false,
1551
1527
  entities,
1552
1528
  method,
1553
- path: path10,
1529
+ path: path9,
1554
1530
  auth,
1555
1531
  customMiddleware
1556
1532
  } = args;
@@ -1560,7 +1536,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1560
1536
  feature,
1561
1537
  Array.isArray(entities) ? entities : entities ? [entities] : [],
1562
1538
  method,
1563
- path10,
1539
+ path9,
1564
1540
  apiFile,
1565
1541
  auth,
1566
1542
  importPath,
@@ -1616,7 +1592,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1616
1592
 
1617
1593
  // src/generators/api-namespace/api-namespace-generator.ts
1618
1594
  import { toCamelCase as toCamelCase3 } from "@ingenyus/swarm";
1619
- import path8 from "path";
1595
+ import path7 from "path";
1620
1596
 
1621
1597
  // src/generators/api-namespace/schema.ts
1622
1598
  import { z as z5 } from "zod";
@@ -1664,7 +1640,7 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
1664
1640
  }
1665
1641
  async updateConfigFile(namespaceName, importDirectory, namespacePath, args, configFilePath) {
1666
1642
  const { force = false } = args;
1667
- const importPath = path8.join(importDirectory, namespaceName);
1643
+ const importPath = path7.join(importDirectory, namespaceName);
1668
1644
  const definition = await this.getDefinition(
1669
1645
  namespaceName,
1670
1646
  importPath,
@@ -2226,8 +2202,6 @@ var RouteGenerator = class extends ComponentGeneratorBase {
2226
2202
  // src/plugins/wasp.ts
2227
2203
  var wasp = {
2228
2204
  name: PLUGIN_NAME,
2229
- version: getPluginVersion(),
2230
- description: "Wasp Plugin for Swarm",
2231
2205
  generators: [
2232
2206
  new ActionGenerator(),
2233
2207
  new ApiGenerator(),
@@ -2242,7 +2216,7 @@ var wasp = {
2242
2216
 
2243
2217
  // src/wasp-config/app.ts
2244
2218
  import fs3 from "fs";
2245
- import path9 from "path";
2219
+ import path8 from "path";
2246
2220
  import {
2247
2221
  App as WaspApp
2248
2222
  } from "wasp-config";
@@ -2535,7 +2509,7 @@ var App = class _App extends WaspApp {
2535
2509
  * Configures all feature modules by scanning the features directory
2536
2510
  */
2537
2511
  async configureFeatures() {
2538
- const featuresDir = path9.join(process.cwd(), "src", "features");
2512
+ const featuresDir = path8.join(process.cwd(), "src", "features");
2539
2513
  if (!fs3.existsSync(featuresDir)) {
2540
2514
  console.warn(
2541
2515
  "Features directory not found, skipping feature configuration"
@@ -2546,11 +2520,11 @@ var App = class _App extends WaspApp {
2546
2520
  let results = [];
2547
2521
  const list = fs3.readdirSync(dir, { withFileTypes: true });
2548
2522
  for (const entry of list) {
2549
- const fullPath = path9.join(dir, entry.name);
2523
+ const fullPath = path8.join(dir, entry.name);
2550
2524
  if (entry.isDirectory()) {
2551
2525
  results = results.concat(getAllFeatureFiles(fullPath));
2552
2526
  } else if (entry.isFile() && entry.name.endsWith(".wasp.ts")) {
2553
- results.push(path9.relative(featuresDir, fullPath));
2527
+ results.push(path8.relative(featuresDir, fullPath));
2554
2528
  }
2555
2529
  }
2556
2530
  return results;
@@ -2558,8 +2532,8 @@ var App = class _App extends WaspApp {
2558
2532
  const featureFiles = getAllFeatureFiles(featuresDir);
2559
2533
  for (const file of featureFiles) {
2560
2534
  try {
2561
- const featureName = path9.dirname(file);
2562
- const modulePath = path9.join(
2535
+ const featureName = path8.dirname(file);
2536
+ const modulePath = path8.join(
2563
2537
  process.cwd(),
2564
2538
  ".wasp",
2565
2539
  "src",
@@ -1 +1 @@
1
- {"version":3,"file":"wasp.d.ts","sourceRoot":"","sources":["../../src/plugins/wasp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAc9C,eAAO,MAAM,IAAI,EAAE,WAclB,CAAC"}
1
+ {"version":3,"file":"wasp.d.ts","sourceRoot":"","sources":["../../src/plugins/wasp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAa9C,eAAO,MAAM,IAAI,EAAE,WAYlB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ingenyus/swarm-wasp",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "Wasp-specific plugins for Swarm - Feature generators, commands, MCP tools, and enhanced Wasp configuration for Wasp development",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "@mrleebo/prisma-ast": "^0.13.0",
44
44
  "eta": "^4.0.1",
45
45
  "zod": "^4.1.11",
46
- "@ingenyus/swarm": "0.2.0"
46
+ "@ingenyus/swarm": "0.2.1"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "wasp-config": "*"
@@ -1,2 +0,0 @@
1
- export declare function getPluginVersion(): string;
2
- //# sourceMappingURL=plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/common/plugin.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,IAAI,MAAM,CAwBzC"}
@@ -1,41 +0,0 @@
1
- // src/common/plugin.ts
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
-
5
- // src/common/filesystem.ts
6
- import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
7
- import fs from "fs";
8
- var realFileSystem = {
9
- readFileSync: fs.readFileSync,
10
- writeFileSync: fs.writeFileSync,
11
- existsSync: fs.existsSync,
12
- copyFileSync: fs.copyFileSync,
13
- mkdirSync: fs.mkdirSync,
14
- readdirSync: fs.readdirSync,
15
- statSync: fs.statSync
16
- };
17
-
18
- // src/common/plugin.ts
19
- function getPluginVersion() {
20
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
- let currentDir = __dirname;
22
- while (currentDir !== path.dirname(currentDir)) {
23
- const packageJsonPath = path.join(currentDir, "package.json");
24
- if (realFileSystem.existsSync(packageJsonPath)) {
25
- try {
26
- const packageJson = JSON.parse(
27
- realFileSystem.readFileSync(packageJsonPath, "utf8")
28
- );
29
- if (packageJson.name === "@ingenyus/swarm-wasp") {
30
- return packageJson.version;
31
- }
32
- } catch (e) {
33
- }
34
- }
35
- currentDir = path.dirname(currentDir);
36
- }
37
- return "0.1.0";
38
- }
39
- export {
40
- getPluginVersion
41
- };