@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
@@ -116,19 +116,15 @@ function getFeatureImportPath(featurePath) {
116
116
  return segments.join("/");
117
117
  }
118
118
 
119
- // src/common/plugin.ts
120
- import path2 from "path";
121
- import { fileURLToPath } from "url";
122
-
123
119
  // src/common/prisma.ts
124
120
  import {
125
121
  getSchema
126
122
  } from "@mrleebo/prisma-ast";
127
123
  import fs2 from "fs";
128
- import path3 from "path";
124
+ import path2 from "path";
129
125
  async function getEntityMetadata(modelName) {
130
126
  try {
131
- const schemaPath = path3.join(process.cwd(), "schema.prisma");
127
+ const schemaPath = path2.join(process.cwd(), "schema.prisma");
132
128
  const schemaContent = fs2.readFileSync(schemaPath, "utf8");
133
129
  const schema3 = getSchema(schemaContent);
134
130
  const model = schema3.list?.find(
@@ -303,7 +299,7 @@ var commonSchemas = {
303
299
  // src/common/templates.ts
304
300
  import { toKebabCase } from "@ingenyus/swarm";
305
301
  import { Eta } from "eta";
306
- import path4 from "path";
302
+ import path3 from "path";
307
303
  var TemplateUtility = class {
308
304
  constructor(fileSystem) {
309
305
  this.fileSystem = fileSystem;
@@ -311,14 +307,14 @@ var TemplateUtility = class {
311
307
  processTemplate(templatePath, replacements) {
312
308
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
313
309
  const functionHeader = declarations ? `const ${declarations};` : void 0;
314
- const templateDir = path4.dirname(templatePath);
310
+ const templateDir = path3.dirname(templatePath);
315
311
  const eta = new Eta({
316
312
  autoTrim: false,
317
313
  autoEscape: false,
318
314
  views: templateDir,
319
315
  functionHeader
320
316
  });
321
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
317
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
322
318
  if (this.fileSystem.existsSync(templatePath)) {
323
319
  return eta.render(templateName, replacements);
324
320
  } else {
@@ -336,11 +332,11 @@ var TemplateUtility = class {
336
332
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
337
333
  const generatorDirName = toKebabCase(generatorName);
338
334
  const currentFilePath = new URL(currentFileUrl).pathname;
339
- const currentFileDir = path4.dirname(currentFilePath);
340
- const currentFileName = path4.basename(currentFilePath);
335
+ const currentFileDir = path3.dirname(currentFilePath);
336
+ const currentFileName = path3.basename(currentFilePath);
341
337
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
342
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
343
- return path4.join(
338
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
339
+ return path3.join(
344
340
  startDir,
345
341
  "generators",
346
342
  generatorDirName,
@@ -358,7 +354,7 @@ import {
358
354
  toKebabCase as toKebabCase2,
359
355
  validateFeaturePath as validateFeaturePath3
360
356
  } from "@ingenyus/swarm";
361
- import path7 from "path";
357
+ import path6 from "path";
362
358
 
363
359
  // src/generators/feature/feature-generator.ts
364
360
  import {
@@ -366,7 +362,7 @@ import {
366
362
  logger as singletonLogger3,
367
363
  validateFeaturePath as validateFeaturePath2
368
364
  } from "@ingenyus/swarm";
369
- import path6 from "path";
365
+ import path5 from "path";
370
366
 
371
367
  // src/generators/base/wasp-generator.base.ts
372
368
  import {
@@ -382,14 +378,14 @@ import {
382
378
  parseHelperMethodDefinition,
383
379
  logger as singletonLogger
384
380
  } from "@ingenyus/swarm";
385
- import path5 from "path";
381
+ import path4 from "path";
386
382
  var WaspConfigGenerator = class {
387
383
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
388
384
  this.logger = logger;
389
385
  this.fileSystem = fileSystem;
390
386
  this.templateUtility = new TemplateUtility(fileSystem);
391
387
  }
392
- path = path5;
388
+ path = path4;
393
389
  templateUtility;
394
390
  /**
395
391
  * Gets the template path for feature config templates.
@@ -418,7 +414,7 @@ var WaspConfigGenerator = class {
418
414
  this.logger.error(`Template not found: ${templatePath}`);
419
415
  return;
420
416
  }
421
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
417
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
422
418
  if (this.fileSystem.existsSync(configFilePath)) {
423
419
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
424
420
  return;
@@ -434,7 +430,7 @@ var WaspConfigGenerator = class {
434
430
  */
435
431
  update(featurePath, declaration) {
436
432
  const configDir = getFeatureDir(this.fileSystem, featurePath);
437
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
433
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
438
434
  if (!this.fileSystem.existsSync(configFilePath)) {
439
435
  const templatePath = this.getTemplatePath("feature.wasp.eta");
440
436
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -944,18 +940,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
944
940
  const { target } = args;
945
941
  const segments = validateFeaturePath2(target);
946
942
  const normalisedPath = normaliseFeaturePath(target);
947
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
943
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
948
944
  if (segments.length > 1) {
949
945
  const parentPath = segments.slice(0, -1).join("/");
950
946
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
951
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
947
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
952
948
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
953
949
  handleFatalError2(
954
950
  `Parent feature '${parentPath}' does not exist. Please create it first.`
955
951
  );
956
952
  }
957
953
  }
958
- const featureDir = path6.join(sourceRoot, normalisedPath);
954
+ const featureDir = path5.join(sourceRoot, normalisedPath);
959
955
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
960
956
  this.configGenerator.generate(normalisedPath);
961
957
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -992,7 +988,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
992
988
  const currentPath = pathSegments.join("/");
993
989
  const featureName = pathSegments[pathSegments.length - 1];
994
990
  const featureDir = getFeatureDir(this.fileSystem, currentPath);
995
- const configPath = path7.join(featureDir, `feature.wasp.ts`);
991
+ const configPath = path6.join(featureDir, `feature.wasp.ts`);
996
992
  if (this.fileSystem.existsSync(configPath)) {
997
993
  return configPath;
998
994
  }
@@ -1065,7 +1061,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
1065
1061
  const featureDir = getFeatureDir(fileSystem, normalisedPath);
1066
1062
  const typeKey = type.toLowerCase();
1067
1063
  const typeDirectory = TYPE_DIRECTORIES[typeKey];
1068
- const targetDirectory = path7.join(featureDir, typeDirectory);
1064
+ const targetDirectory = path6.join(featureDir, typeDirectory);
1069
1065
  const importDirectory = `@src/${normalisedPath}/${typeDirectory}`;
1070
1066
  return { targetDirectory, importDirectory };
1071
1067
  }
@@ -26,16 +26,12 @@ var realFileSystem = {
26
26
  statSync: fs.statSync
27
27
  };
28
28
 
29
- // src/common/plugin.ts
30
- import path from "path";
31
- import { fileURLToPath } from "url";
32
-
33
29
  // src/common/prisma.ts
34
30
  import {
35
31
  getSchema
36
32
  } from "@mrleebo/prisma-ast";
37
33
  import fs2 from "fs";
38
- import path2 from "path";
34
+ import path from "path";
39
35
 
40
36
  // src/common/schemas.ts
41
37
  import { commandRegistry } from "@ingenyus/swarm";
@@ -4,7 +4,7 @@ import {
4
4
  logger as singletonLogger3,
5
5
  validateFeaturePath as validateFeaturePath2
6
6
  } from "@ingenyus/swarm";
7
- import path6 from "path";
7
+ import path5 from "path";
8
8
 
9
9
  // src/common/filesystem.ts
10
10
  import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
@@ -58,16 +58,12 @@ function getFeatureDir(fileSystem, featureName) {
58
58
  return path.join(waspRoot, "src", normalisedPath);
59
59
  }
60
60
 
61
- // src/common/plugin.ts
62
- import path2 from "path";
63
- import { fileURLToPath } from "url";
64
-
65
61
  // src/common/prisma.ts
66
62
  import {
67
63
  getSchema
68
64
  } from "@mrleebo/prisma-ast";
69
65
  import fs2 from "fs";
70
- import path3 from "path";
66
+ import path2 from "path";
71
67
 
72
68
  // src/common/schemas.ts
73
69
  import { commandRegistry } from "@ingenyus/swarm";
@@ -124,7 +120,7 @@ var commonSchemas = {
124
120
  // src/common/templates.ts
125
121
  import { toKebabCase } from "@ingenyus/swarm";
126
122
  import { Eta } from "eta";
127
- import path4 from "path";
123
+ import path3 from "path";
128
124
  var TemplateUtility = class {
129
125
  constructor(fileSystem) {
130
126
  this.fileSystem = fileSystem;
@@ -132,14 +128,14 @@ var TemplateUtility = class {
132
128
  processTemplate(templatePath, replacements) {
133
129
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
134
130
  const functionHeader = declarations ? `const ${declarations};` : void 0;
135
- const templateDir = path4.dirname(templatePath);
131
+ const templateDir = path3.dirname(templatePath);
136
132
  const eta = new Eta({
137
133
  autoTrim: false,
138
134
  autoEscape: false,
139
135
  views: templateDir,
140
136
  functionHeader
141
137
  });
142
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
138
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
143
139
  if (this.fileSystem.existsSync(templatePath)) {
144
140
  return eta.render(templateName, replacements);
145
141
  } else {
@@ -157,11 +153,11 @@ var TemplateUtility = class {
157
153
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
158
154
  const generatorDirName = toKebabCase(generatorName);
159
155
  const currentFilePath = new URL(currentFileUrl).pathname;
160
- const currentFileDir = path4.dirname(currentFilePath);
161
- const currentFileName = path4.basename(currentFilePath);
156
+ const currentFileDir = path3.dirname(currentFilePath);
157
+ const currentFileName = path3.basename(currentFilePath);
162
158
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
163
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
164
- return path4.join(
159
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
160
+ return path3.join(
165
161
  startDir,
166
162
  "generators",
167
163
  generatorDirName,
@@ -185,14 +181,14 @@ import {
185
181
  parseHelperMethodDefinition,
186
182
  logger as singletonLogger
187
183
  } from "@ingenyus/swarm";
188
- import path5 from "path";
184
+ import path4 from "path";
189
185
  var WaspConfigGenerator = class {
190
186
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
191
187
  this.logger = logger;
192
188
  this.fileSystem = fileSystem;
193
189
  this.templateUtility = new TemplateUtility(fileSystem);
194
190
  }
195
- path = path5;
191
+ path = path4;
196
192
  templateUtility;
197
193
  /**
198
194
  * Gets the template path for feature config templates.
@@ -221,7 +217,7 @@ var WaspConfigGenerator = class {
221
217
  this.logger.error(`Template not found: ${templatePath}`);
222
218
  return;
223
219
  }
224
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
220
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
225
221
  if (this.fileSystem.existsSync(configFilePath)) {
226
222
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
227
223
  return;
@@ -237,7 +233,7 @@ var WaspConfigGenerator = class {
237
233
  */
238
234
  update(featurePath, declaration) {
239
235
  const configDir = getFeatureDir(this.fileSystem, featurePath);
240
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
236
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
241
237
  if (!this.fileSystem.existsSync(configFilePath)) {
242
238
  const templatePath = this.getTemplatePath("feature.wasp.eta");
243
239
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -747,18 +743,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
747
743
  const { target } = args;
748
744
  const segments = validateFeaturePath2(target);
749
745
  const normalisedPath = normaliseFeaturePath(target);
750
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
746
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
751
747
  if (segments.length > 1) {
752
748
  const parentPath = segments.slice(0, -1).join("/");
753
749
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
754
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
750
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
755
751
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
756
752
  handleFatalError2(
757
753
  `Parent feature '${parentPath}' does not exist. Please create it first.`
758
754
  );
759
755
  }
760
756
  }
761
- const featureDir = path6.join(sourceRoot, normalisedPath);
757
+ const featureDir = path5.join(sourceRoot, normalisedPath);
762
758
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
763
759
  this.configGenerator.generate(normalisedPath);
764
760
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -4,7 +4,7 @@ import {
4
4
  logger as singletonLogger3,
5
5
  validateFeaturePath as validateFeaturePath2
6
6
  } from "@ingenyus/swarm";
7
- import path6 from "path";
7
+ import path5 from "path";
8
8
 
9
9
  // src/common/filesystem.ts
10
10
  import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
@@ -58,16 +58,12 @@ function getFeatureDir(fileSystem, featureName) {
58
58
  return path.join(waspRoot, "src", normalisedPath);
59
59
  }
60
60
 
61
- // src/common/plugin.ts
62
- import path2 from "path";
63
- import { fileURLToPath } from "url";
64
-
65
61
  // src/common/prisma.ts
66
62
  import {
67
63
  getSchema
68
64
  } from "@mrleebo/prisma-ast";
69
65
  import fs2 from "fs";
70
- import path3 from "path";
66
+ import path2 from "path";
71
67
 
72
68
  // src/common/schemas.ts
73
69
  import { commandRegistry } from "@ingenyus/swarm";
@@ -124,7 +120,7 @@ var commonSchemas = {
124
120
  // src/common/templates.ts
125
121
  import { toKebabCase } from "@ingenyus/swarm";
126
122
  import { Eta } from "eta";
127
- import path4 from "path";
123
+ import path3 from "path";
128
124
  var TemplateUtility = class {
129
125
  constructor(fileSystem) {
130
126
  this.fileSystem = fileSystem;
@@ -132,14 +128,14 @@ var TemplateUtility = class {
132
128
  processTemplate(templatePath, replacements) {
133
129
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
134
130
  const functionHeader = declarations ? `const ${declarations};` : void 0;
135
- const templateDir = path4.dirname(templatePath);
131
+ const templateDir = path3.dirname(templatePath);
136
132
  const eta = new Eta({
137
133
  autoTrim: false,
138
134
  autoEscape: false,
139
135
  views: templateDir,
140
136
  functionHeader
141
137
  });
142
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
138
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
143
139
  if (this.fileSystem.existsSync(templatePath)) {
144
140
  return eta.render(templateName, replacements);
145
141
  } else {
@@ -157,11 +153,11 @@ var TemplateUtility = class {
157
153
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
158
154
  const generatorDirName = toKebabCase(generatorName);
159
155
  const currentFilePath = new URL(currentFileUrl).pathname;
160
- const currentFileDir = path4.dirname(currentFilePath);
161
- const currentFileName = path4.basename(currentFilePath);
156
+ const currentFileDir = path3.dirname(currentFilePath);
157
+ const currentFileName = path3.basename(currentFilePath);
162
158
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
163
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
164
- return path4.join(
159
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
160
+ return path3.join(
165
161
  startDir,
166
162
  "generators",
167
163
  generatorDirName,
@@ -185,14 +181,14 @@ import {
185
181
  parseHelperMethodDefinition,
186
182
  logger as singletonLogger
187
183
  } from "@ingenyus/swarm";
188
- import path5 from "path";
184
+ import path4 from "path";
189
185
  var WaspConfigGenerator = class {
190
186
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
191
187
  this.logger = logger;
192
188
  this.fileSystem = fileSystem;
193
189
  this.templateUtility = new TemplateUtility(fileSystem);
194
190
  }
195
- path = path5;
191
+ path = path4;
196
192
  templateUtility;
197
193
  /**
198
194
  * Gets the template path for feature config templates.
@@ -221,7 +217,7 @@ var WaspConfigGenerator = class {
221
217
  this.logger.error(`Template not found: ${templatePath}`);
222
218
  return;
223
219
  }
224
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
220
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
225
221
  if (this.fileSystem.existsSync(configFilePath)) {
226
222
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
227
223
  return;
@@ -237,7 +233,7 @@ var WaspConfigGenerator = class {
237
233
  */
238
234
  update(featurePath, declaration) {
239
235
  const configDir = getFeatureDir(this.fileSystem, featurePath);
240
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
236
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
241
237
  if (!this.fileSystem.existsSync(configFilePath)) {
242
238
  const templatePath = this.getTemplatePath("feature.wasp.eta");
243
239
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -747,18 +743,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
747
743
  const { target } = args;
748
744
  const segments = validateFeaturePath2(target);
749
745
  const normalisedPath = normaliseFeaturePath(target);
750
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
746
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
751
747
  if (segments.length > 1) {
752
748
  const parentPath = segments.slice(0, -1).join("/");
753
749
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
754
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
750
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
755
751
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
756
752
  handleFatalError2(
757
753
  `Parent feature '${parentPath}' does not exist. Please create it first.`
758
754
  );
759
755
  }
760
756
  }
761
- const featureDir = path6.join(sourceRoot, normalisedPath);
757
+ const featureDir = path5.join(sourceRoot, normalisedPath);
762
758
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
763
759
  this.configGenerator.generate(normalisedPath);
764
760
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -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";
@@ -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,19 +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
-
150
146
  // src/common/prisma.ts
151
147
  import {
152
148
  getSchema
153
149
  } from "@mrleebo/prisma-ast";
154
150
  import fs2 from "fs";
155
- import path3 from "path";
151
+ import path2 from "path";
156
152
  async function getEntityMetadata(modelName) {
157
153
  try {
158
- const schemaPath = path3.join(process.cwd(), "schema.prisma");
154
+ const schemaPath = path2.join(process.cwd(), "schema.prisma");
159
155
  const schemaContent = fs2.readFileSync(schemaPath, "utf8");
160
156
  const schema9 = getSchema(schemaContent);
161
157
  const model = schema9.list?.find(
@@ -330,7 +326,7 @@ var commonSchemas = {
330
326
  // src/common/templates.ts
331
327
  import { toKebabCase } from "@ingenyus/swarm";
332
328
  import { Eta } from "eta";
333
- import path4 from "path";
329
+ import path3 from "path";
334
330
  var TemplateUtility = class {
335
331
  constructor(fileSystem) {
336
332
  this.fileSystem = fileSystem;
@@ -338,14 +334,14 @@ var TemplateUtility = class {
338
334
  processTemplate(templatePath, replacements) {
339
335
  const declarations = Object.keys(replacements).map((key) => `${key}=it.${key}`).join(", ");
340
336
  const functionHeader = declarations ? `const ${declarations};` : void 0;
341
- const templateDir = path4.dirname(templatePath);
337
+ const templateDir = path3.dirname(templatePath);
342
338
  const eta = new Eta({
343
339
  autoTrim: false,
344
340
  autoEscape: false,
345
341
  views: templateDir,
346
342
  functionHeader
347
343
  });
348
- const templateName = path4.basename(templatePath).replace(/\.eta$/, "");
344
+ const templateName = path3.basename(templatePath).replace(/\.eta$/, "");
349
345
  if (this.fileSystem.existsSync(templatePath)) {
350
346
  return eta.render(templateName, replacements);
351
347
  } else {
@@ -363,11 +359,11 @@ var TemplateUtility = class {
363
359
  resolveTemplatePath(relativePath, generatorName, currentFileUrl) {
364
360
  const generatorDirName = toKebabCase(generatorName);
365
361
  const currentFilePath = new URL(currentFileUrl).pathname;
366
- const currentFileDir = path4.dirname(currentFilePath);
367
- const currentFileName = path4.basename(currentFilePath);
362
+ const currentFileDir = path3.dirname(currentFilePath);
363
+ const currentFileName = path3.basename(currentFilePath);
368
364
  const isInstalledPackage = currentFileDir.includes("node_modules") && currentFileDir.endsWith("/dist") && currentFileName === "index.js";
369
- const startDir = isInstalledPackage ? currentFileDir : path4.dirname(path4.dirname(currentFileDir));
370
- return path4.join(
365
+ const startDir = isInstalledPackage ? currentFileDir : path3.dirname(path3.dirname(currentFileDir));
366
+ return path3.join(
371
367
  startDir,
372
368
  "generators",
373
369
  generatorDirName,
@@ -383,7 +379,7 @@ import {
383
379
  logger as singletonLogger3,
384
380
  validateFeaturePath as validateFeaturePath2
385
381
  } from "@ingenyus/swarm";
386
- import path6 from "path";
382
+ import path5 from "path";
387
383
 
388
384
  // src/generators/base/wasp-generator.base.ts
389
385
  import {
@@ -399,14 +395,14 @@ import {
399
395
  parseHelperMethodDefinition,
400
396
  logger as singletonLogger
401
397
  } from "@ingenyus/swarm";
402
- import path5 from "path";
398
+ import path4 from "path";
403
399
  var WaspConfigGenerator = class {
404
400
  constructor(logger = singletonLogger, fileSystem = realFileSystem) {
405
401
  this.logger = logger;
406
402
  this.fileSystem = fileSystem;
407
403
  this.templateUtility = new TemplateUtility(fileSystem);
408
404
  }
409
- path = path5;
405
+ path = path4;
410
406
  templateUtility;
411
407
  /**
412
408
  * Gets the template path for feature config templates.
@@ -435,7 +431,7 @@ var WaspConfigGenerator = class {
435
431
  this.logger.error(`Template not found: ${templatePath}`);
436
432
  return;
437
433
  }
438
- const configFilePath = path5.join(featureDir, `feature.wasp.ts`);
434
+ const configFilePath = path4.join(featureDir, `feature.wasp.ts`);
439
435
  if (this.fileSystem.existsSync(configFilePath)) {
440
436
  this.logger.warn(`Feature config already exists: ${configFilePath}`);
441
437
  return;
@@ -451,7 +447,7 @@ var WaspConfigGenerator = class {
451
447
  */
452
448
  update(featurePath, declaration) {
453
449
  const configDir = getFeatureDir(this.fileSystem, featurePath);
454
- const configFilePath = path5.join(configDir, `feature.wasp.ts`);
450
+ const configFilePath = path4.join(configDir, `feature.wasp.ts`);
455
451
  if (!this.fileSystem.existsSync(configFilePath)) {
456
452
  const templatePath = this.getTemplatePath("feature.wasp.eta");
457
453
  if (!this.fileSystem.existsSync(templatePath)) {
@@ -961,18 +957,18 @@ var FeatureGenerator = class extends WaspGeneratorBase {
961
957
  const { target } = args;
962
958
  const segments = validateFeaturePath2(target);
963
959
  const normalisedPath = normaliseFeaturePath(target);
964
- const sourceRoot = path6.join(findWaspRoot(this.fileSystem), "src");
960
+ const sourceRoot = path5.join(findWaspRoot(this.fileSystem), "src");
965
961
  if (segments.length > 1) {
966
962
  const parentPath = segments.slice(0, -1).join("/");
967
963
  const parentNormalisedPath = normaliseFeaturePath(parentPath);
968
- const parentFeatureDir = path6.join(sourceRoot, parentNormalisedPath);
964
+ const parentFeatureDir = path5.join(sourceRoot, parentNormalisedPath);
969
965
  if (!this.fileSystem.existsSync(parentFeatureDir)) {
970
966
  handleFatalError2(
971
967
  `Parent feature '${parentPath}' does not exist. Please create it first.`
972
968
  );
973
969
  }
974
970
  }
975
- const featureDir = path6.join(sourceRoot, normalisedPath);
971
+ const featureDir = path5.join(sourceRoot, normalisedPath);
976
972
  this.fileSystem.mkdirSync(featureDir, { recursive: true });
977
973
  this.configGenerator.generate(normalisedPath);
978
974
  this.logger.success(`Generated feature: ${normalisedPath}`);
@@ -1009,7 +1005,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
1009
1005
  const currentPath = pathSegments.join("/");
1010
1006
  const featureName = pathSegments[pathSegments.length - 1];
1011
1007
  const featureDir = getFeatureDir(this.fileSystem, currentPath);
1012
- const configPath = path7.join(featureDir, `feature.wasp.ts`);
1008
+ const configPath = path6.join(featureDir, `feature.wasp.ts`);
1013
1009
  if (this.fileSystem.existsSync(configPath)) {
1014
1010
  return configPath;
1015
1011
  }
@@ -1082,7 +1078,7 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
1082
1078
  const featureDir = getFeatureDir(fileSystem, normalisedPath);
1083
1079
  const typeKey = type.toLowerCase();
1084
1080
  const typeDirectory = TYPE_DIRECTORIES[typeKey];
1085
- const targetDirectory = path7.join(featureDir, typeDirectory);
1081
+ const targetDirectory = path6.join(featureDir, typeDirectory);
1086
1082
  const importDirectory = `@src/${normalisedPath}/${typeDirectory}`;
1087
1083
  return { targetDirectory, importDirectory };
1088
1084
  }
@@ -1530,7 +1526,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1530
1526
  force = false,
1531
1527
  entities,
1532
1528
  method,
1533
- path: path9,
1529
+ path: path8,
1534
1530
  auth,
1535
1531
  customMiddleware
1536
1532
  } = args;
@@ -1540,7 +1536,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1540
1536
  feature,
1541
1537
  Array.isArray(entities) ? entities : entities ? [entities] : [],
1542
1538
  method,
1543
- path9,
1539
+ path8,
1544
1540
  apiFile,
1545
1541
  auth,
1546
1542
  importPath,
@@ -1596,7 +1592,7 @@ var ApiGenerator = class extends ComponentGeneratorBase {
1596
1592
 
1597
1593
  // src/generators/api-namespace/api-namespace-generator.ts
1598
1594
  import { toCamelCase as toCamelCase3 } from "@ingenyus/swarm";
1599
- import path8 from "path";
1595
+ import path7 from "path";
1600
1596
 
1601
1597
  // src/generators/api-namespace/schema.ts
1602
1598
  import { z as z5 } from "zod";
@@ -1644,7 +1640,7 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
1644
1640
  }
1645
1641
  async updateConfigFile(namespaceName, importDirectory, namespacePath, args, configFilePath) {
1646
1642
  const { force = false } = args;
1647
- const importPath = path8.join(importDirectory, namespaceName);
1643
+ const importPath = path7.join(importDirectory, namespaceName);
1648
1644
  const definition = await this.getDefinition(
1649
1645
  namespaceName,
1650
1646
  importPath,