@pegasusheavy/nestjs-prisma-graphql 1.4.2 → 1.4.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.
package/dist/index.js CHANGED
@@ -587,13 +587,16 @@ function getGraphqlImport(args) {
587
587
  if (sourceFileType === "output" && fileType === "model") {
588
588
  sourceFileType = "model";
589
589
  }
590
- const specifier = relativePath(
590
+ let specifier = relativePath(
591
591
  sourceFile.getFilePath(),
592
592
  getSourceFile({
593
593
  name: typeName,
594
594
  type: sourceFileType
595
595
  }).getFilePath()
596
596
  );
597
+ if (config.esmCompatible && !specifier.startsWith("@") && !specifier.endsWith(".js")) {
598
+ specifier += ".js";
599
+ }
597
600
  return { name: typeName, specifier };
598
601
  }
599
602
  function getGraphqlInputType(inputTypes, pattern) {
@@ -787,10 +790,13 @@ function inputType(args) {
787
790
  namedImports: [{ name: classDecoratorName }]
788
791
  });
789
792
  if (config.esmCompatible) {
790
- const typeRegistryPath = relativePath(
793
+ let typeRegistryPath = relativePath(
791
794
  sourceFile.getFilePath(),
792
795
  `${output}/type-registry.ts`
793
796
  );
797
+ if (!typeRegistryPath.endsWith(".js")) {
798
+ typeRegistryPath += ".js";
799
+ }
794
800
  importDeclarations.add("registerType", typeRegistryPath);
795
801
  importDeclarations.add("getType", typeRegistryPath);
796
802
  }
@@ -919,10 +925,13 @@ function inputType(args) {
919
925
  name: "Field"
920
926
  });
921
927
  if (graphqlType === "GraphQLDecimal") {
922
- const decimalHelpersPath = relativePath(
928
+ let decimalHelpersPath = relativePath(
923
929
  sourceFile.getFilePath(),
924
930
  `${output}/decimal-helpers.ts`
925
931
  );
932
+ if (config.esmCompatible && !decimalHelpersPath.endsWith(".js")) {
933
+ decimalHelpersPath += ".js";
934
+ }
926
935
  importDeclarations.add("transformToDecimal", decimalHelpersPath);
927
936
  importDeclarations.add("Transform", "class-transformer");
928
937
  importDeclarations.add("Type", "class-transformer");
@@ -1481,10 +1490,13 @@ function modelOutputType(outputType2, args) {
1481
1490
  importDeclarations.add("ObjectType", nestjsGraphql);
1482
1491
  const lazyTypes = /* @__PURE__ */ new Set();
1483
1492
  if (config.esmCompatible) {
1484
- const typeRegistryPath = relativePath(
1493
+ let typeRegistryPath = relativePath(
1485
1494
  sourceFile.getFilePath(),
1486
1495
  `${output}/type-registry.ts`
1487
1496
  );
1497
+ if (!typeRegistryPath.endsWith(".js")) {
1498
+ typeRegistryPath += ".js";
1499
+ }
1488
1500
  importDeclarations.add("registerType", typeRegistryPath);
1489
1501
  importDeclarations.add("getType", typeRegistryPath);
1490
1502
  }
@@ -2005,7 +2017,10 @@ function generateRegisterAllTypes(args) {
2005
2017
  const fileText = file.getText();
2006
2018
  const registerMatch = /registerType\(['"]([^'"]+)['"]/.exec(fileText);
2007
2019
  if (registerMatch) {
2008
- const relPath = relativePath(sourceFile.getFilePath(), filePath);
2020
+ let relPath = relativePath(sourceFile.getFilePath(), filePath);
2021
+ if (!relPath.endsWith(".js")) {
2022
+ relPath += ".js";
2023
+ }
2009
2024
  importPaths.push(relPath);
2010
2025
  typeNames.push(registerMatch[1]);
2011
2026
  }