@trackunit/react-graphql-tools 0.0.26-alpha-001fc30993.0 → 0.0.26

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/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.0.26-alpha-001fc30993.0](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.25...react-graphql-tools/0.0.26-alpha-001fc30993.0) (2023-08-14)
5
+ ## [0.0.26](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.25...react-graphql-tools/0.0.26) (2023-08-17)
6
6
 
7
7
  ## [0.0.25](https://github.com/Trackunit/manager/compare/react-graphql-tools/0.0.24...react-graphql-tools/0.0.25) (2023-08-01)
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-graphql-tools",
3
- "version": "0.0.26-alpha-001fc30993.0",
3
+ "version": "0.0.26",
4
4
  "main": "src/index.js",
5
5
  "executors": "./executors.json",
6
6
  "repository": "https://github.com/Trackunit/manager",
@@ -41,7 +41,14 @@ export default config;
41
41
  }
42
42
  yield (0, generateHooks_1.generateHooks)({ nxRoot: context.root, codeGenFilePath, isVerbose: context.isVerbose, tsConfigPath });
43
43
  if (process.env.SKIP_SCRUB !== "true") {
44
- yield (0, scrubFile_1.scrubFile)((0, path_1.join)(fullLibRoot, "src", "generated", "graphql-api", "graphql.ts"), nxRoot, context.isVerbose);
44
+ const pathToGenerateFile = (0, path_1.join)(fullLibRoot, "src", "generated", "graphql-api", "graphql.ts");
45
+ if (context.isVerbose) {
46
+ console.log("Scrubbing file: ", pathToGenerateFile);
47
+ }
48
+ if (!(0, fs_1.existsSync)(pathToGenerateFile)) {
49
+ throw new Error(`Generated file not found in ${pathToGenerateFile}.`);
50
+ }
51
+ yield (0, scrubFile_1.scrubFile)(pathToGenerateFile, nxRoot, context.isVerbose);
45
52
  }
46
53
  return { success: 1 };
47
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/executor.ts"],"names":[],"mappings":";;;;AACA,2BAAgC;AAChC,+BAA4B;AAC5B,mDAAgD;AAChD,2CAAwC;AAExC;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,OAAwB,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC;IAEnF,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC;QACxC,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAE3C,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IAED,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACxD,IAAI,CAAC,IAAA,eAAU,EAAC,eAAe,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,gCAAgC,WAAW;;;;;;;;;CAS9D,CAAC,CAAC;KACA;IAED,MAAM,IAAA,6BAAa,EAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3G,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,EAAE;QACrC,MAAM,IAAA,qBAAS,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAChH;IACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC,CAAA,CAAC;AAnCW,QAAA,kBAAkB,sBAmC7B;AAEF,kBAAe,0BAAkB,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { generateHooks } from \"./generateHooks\";\nimport { scrubFile } from \"./scrubFile\";\n\n/**\n * This executor generates react hooks for all graphql files.\n *\n * @param _unused unused props from nx\n * @param context The execution context for this executor\n * @returns {Promise<{ success: number; }>} success when finished\n */\nexport const CreateGraphqlHooks = async (_unused: unknown, context: ExecutorContext) => {\n const nxRoot = `${context.root}`;\n if (!context.projectsConfigurations) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n const libRoot = context.projectsConfigurations.projects[context.projectName!].root;\n\n const fullLibRoot = join(nxRoot, libRoot);\n const tsConfigPath = existsSync(join(fullLibRoot, \"tsconfig.lib.json\"))\n ? join(fullLibRoot, \"tsconfig.lib.json\")\n : join(fullLibRoot, \"tsconfig.app.json\");\n\n if (!tsConfigPath) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n\n const codeGenFilePath = join(fullLibRoot, \"codegen.ts\");\n if (!existsSync(codeGenFilePath)) {\n throw new Error(`codegen.ts file not found in ${fullLibRoot} please add this file and run again to generate hooks. The content should be\nimport { type CodegenConfig } from \"@graphql-codegen/cli\";\nimport { getGraphqlCodegenConfig } from \"@trackunit/iris-app-build-utilities\";\n\nconst config: CodegenConfig = {\n ...getGraphqlCodegenConfig(__dirname),\n // You can override codegen default config here\n};\nexport default config;\n`);\n }\n\n await generateHooks({ nxRoot: context.root, codeGenFilePath, isVerbose: context.isVerbose, tsConfigPath });\n if (process.env.SKIP_SCRUB !== \"true\") {\n await scrubFile(join(fullLibRoot, \"src\", \"generated\", \"graphql-api\", \"graphql.ts\"), nxRoot, context.isVerbose);\n }\n return { success: 1 };\n};\n\nexport default CreateGraphqlHooks;\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/executor.ts"],"names":[],"mappings":";;;;AACA,2BAAgC;AAChC,+BAA4B;AAC5B,mDAAgD;AAChD,2CAAwC;AAExC;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAO,OAAgB,EAAE,OAAwB,EAAE,EAAE;IACrF,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC,IAAI,CAAC;IAEnF,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC;QACxC,CAAC,CAAC,IAAA,WAAI,EAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAE3C,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;KAC/D;IAED,MAAM,eAAe,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACxD,IAAI,CAAC,IAAA,eAAU,EAAC,eAAe,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,gCAAgC,WAAW;;;;;;;;;CAS9D,CAAC,CAAC;KACA;IAED,MAAM,IAAA,6BAAa,EAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3G,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,MAAM,EAAE;QACrC,MAAM,kBAAkB,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;QAC9F,IAAI,OAAO,CAAC,SAAS,EAAE;YACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;SACrD;QACD,IAAI,CAAC,IAAA,eAAU,EAAC,kBAAkB,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,+BAA+B,kBAAkB,GAAG,CAAC,CAAC;SACvE;QACD,MAAM,IAAA,qBAAS,EAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KAChE;IACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC,CAAA,CAAC;AA1CW,QAAA,kBAAkB,sBA0C7B;AAEF,kBAAe,0BAAkB,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { generateHooks } from \"./generateHooks\";\nimport { scrubFile } from \"./scrubFile\";\n\n/**\n * This executor generates react hooks for all graphql files.\n *\n * @param _unused unused props from nx\n * @param context The execution context for this executor\n * @returns {Promise<{ success: number; }>} success when finished\n */\nexport const CreateGraphqlHooks = async (_unused: unknown, context: ExecutorContext) => {\n const nxRoot = `${context.root}`;\n if (!context.projectsConfigurations) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n const libRoot = context.projectsConfigurations.projects[context.projectName!].root;\n\n const fullLibRoot = join(nxRoot, libRoot);\n const tsConfigPath = existsSync(join(fullLibRoot, \"tsconfig.lib.json\"))\n ? join(fullLibRoot, \"tsconfig.lib.json\")\n : join(fullLibRoot, \"tsconfig.app.json\");\n\n if (!tsConfigPath) {\n throw new Error(\"context projectsConfigurations is required\");\n }\n\n const codeGenFilePath = join(fullLibRoot, \"codegen.ts\");\n if (!existsSync(codeGenFilePath)) {\n throw new Error(`codegen.ts file not found in ${fullLibRoot} please add this file and run again to generate hooks. The content should be\nimport { type CodegenConfig } from \"@graphql-codegen/cli\";\nimport { getGraphqlCodegenConfig } from \"@trackunit/iris-app-build-utilities\";\n\nconst config: CodegenConfig = {\n ...getGraphqlCodegenConfig(__dirname),\n // You can override codegen default config here\n};\nexport default config;\n`);\n }\n\n await generateHooks({ nxRoot: context.root, codeGenFilePath, isVerbose: context.isVerbose, tsConfigPath });\n if (process.env.SKIP_SCRUB !== \"true\") {\n const pathToGenerateFile = join(fullLibRoot, \"src\", \"generated\", \"graphql-api\", \"graphql.ts\");\n if (context.isVerbose) {\n console.log(\"Scrubbing file: \", pathToGenerateFile);\n }\n if (!existsSync(pathToGenerateFile)) {\n throw new Error(`Generated file not found in ${pathToGenerateFile}.`);\n }\n await scrubFile(pathToGenerateFile, nxRoot, context.isVerbose);\n }\n return { success: 1 };\n};\n\nexport default CreateGraphqlHooks;\n"]}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scrubFile = exports.scrubFileContent = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ /* eslint-disable no-console */
5
6
  const fs_1 = require("fs");
6
7
  const path_1 = require("path");
7
8
  const prettier = tslib_1.__importStar(require("prettier"));
@@ -87,7 +88,6 @@ const scrubFileContent = (fileContent, nxRoot, isVerbose) => tslib_1.__awaiter(v
87
88
  lastWidth = generatedFile.getFullWidth();
88
89
  removeUnusedIdentifiers(generatedFile);
89
90
  if (isVerbose) {
90
- // eslint-disable-next-line no-console
91
91
  console.log("Cleanup", lastWidth, generatedFile.getFullWidth());
92
92
  }
93
93
  } while (lastWidth !== generatedFile.getFullWidth());
@@ -104,7 +104,6 @@ const scrubFileContent = (fileContent, nxRoot, isVerbose) => tslib_1.__awaiter(v
104
104
  if (isVerbose) {
105
105
  const end = new Date().getTime();
106
106
  const time = end - start;
107
- // eslint-disable-next-line no-console
108
107
  console.log("Execution time: " + time);
109
108
  }
110
109
  return generatedFile.getFullText();
@@ -116,7 +115,11 @@ exports.scrubFileContent = scrubFileContent;
116
115
  * @param file The file to scrub.
117
116
  */
118
117
  const scrubFile = (file, nxRoot, isVerbose) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
119
- const scrubbedFileContent = yield (0, exports.scrubFileContent)((0, fs_1.readFileSync)(file, { encoding: "utf-8" }), nxRoot, isVerbose);
118
+ const fileContent = (0, fs_1.readFileSync)(file, { encoding: "utf-8" });
119
+ if (fileContent.length === 0) {
120
+ console.warn(`File ${file} is empty`);
121
+ }
122
+ const scrubbedFileContent = yield (0, exports.scrubFileContent)(fileContent, nxRoot, isVerbose);
120
123
  let options = null;
121
124
  try {
122
125
  options = prettier
@@ -125,11 +128,9 @@ const scrubFile = (file, nxRoot, isVerbose) => tslib_1.__awaiter(void 0, void 0,
125
128
  editorconfig: false,
126
129
  config: (0, path_1.join)(nxRoot, ".prettierrc"),
127
130
  })
128
- // eslint-disable-next-line no-console
129
131
  .catch((error) => console.log(error));
130
132
  }
131
133
  catch (e) {
132
- // eslint-disable-next-line no-console
133
134
  console.log(e);
134
135
  }
135
136
  if (!options) {
@@ -1 +1 @@
1
- {"version":3,"file":"scrubFile.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/scrubFile.ts"],"names":[],"mappings":";;;;AAAA,2BAAiD;AACjD,+BAA4B;AAC5B,2DAAqC;AACrC,uCAAgE;AAEhE;;;;;;GA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ACtC,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;KACnE;IAED,IAAA,kBAAa,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA,CAAC;AA9BW,QAAA,SAAS,aA8BpB","sourcesContent":["import { readFileSync, writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport * as prettier from \"prettier\";\nimport { EnumDeclaration, Project, SourceFile } from \"ts-morph\";\n\n/**\n * Removes unused identifiers from the source file.\n *\n * This does more then sourceFile.fixUnusedIdentifiers(diagnostic) as it also removes unused enums and interfaces.\n *\n * @param sourceFile The source file to remove unused identifiers from.\n */\nconst removeUnusedIdentifiers = (sourceFile: SourceFile) => {\n const diagnostics = sourceFile.getPreEmitDiagnostics();\n diagnostics.forEach(diagnostic => {\n const messageText = diagnostic.getMessageText();\n\n if (typeof messageText === \"string\" && messageText.startsWith(\"'\")) {\n const identifierName = messageText.match(/'([^']+)'/)?.[1];\n if (identifierName) {\n if (messageText.includes(\"is declared but never used\")) {\n const identifier =\n sourceFile.getVariableDeclaration(identifierName) ||\n sourceFile.getInterface(identifierName) ||\n sourceFile.getEnum(identifierName) ||\n sourceFile.getClass(identifierName) ||\n sourceFile.getTypeAlias(identifierName);\n\n if (!identifier) {\n // eslint-disable-next-line no-console\n console.log(\"Could not find: \", messageText);\n } else {\n identifier.remove();\n }\n }\n }\n }\n });\n};\n\nconst convertEnumToConstObject = (enumDeclaration: EnumDeclaration) => {\n const enumName = enumDeclaration.getName();\n const members = enumDeclaration.getMembers();\n\n const properties = members.map(member => {\n const name = member.getName();\n const value = member.getValue();\n return `${name}: '${value}'`;\n });\n\n const lowerCaseFirstLetter = enumName[0].toLowerCase() + enumName.slice(1);\n const constObjectText = `export const ${lowerCaseFirstLetter} = {\\n ${properties.join(\n \",\\n \"\n )},\\n} as const;\\nexport type ${enumName} = typeof ${lowerCaseFirstLetter}[keyof typeof ${lowerCaseFirstLetter}];`;\n\n // Replace the EnumDeclaration with the const object text\n enumDeclaration.replaceWithText(constObjectText);\n};\n\n/**\n * Generates React hooks from your graphql files.\n */\nexport const scrubFileContent = async (fileContent: string, nxRoot: string, isVerbose?: boolean) => {\n const start = new Date().getTime();\n\n const project = new Project({\n compilerOptions: {\n noUnusedLocals: true,\n noUnusedParameters: true,\n },\n });\n const generatedFile = project.createSourceFile(\"tmp.ts\", fileContent);\n\n generatedFile.insertStatements(0, \"/* eslint-disable @typescript-eslint/no-explicit-any */\");\n generatedFile.insertStatements(1, \"/* eslint-disable @typescript-eslint/array-type */\");\n\n generatedFile.getTypeAliases().forEach(node => {\n if (!node.getName().startsWith(\"Incremental\")) {\n node.setIsExported(false);\n }\n if (\n node.getName().startsWith(\"Query\") ||\n node.getName().startsWith(\"Mutation\") ||\n // Since they reference each other we remove them here.\n node.getName() === \"Site\" ||\n node.getName() === \"Event\" ||\n node.getName() === \"Asset\"\n ) {\n node.remove();\n }\n });\n generatedFile.getEnums().forEach(node => {\n node.setIsExported(false);\n });\n let lastWidth = 0;\n do {\n lastWidth = generatedFile.getFullWidth();\n removeUnusedIdentifiers(generatedFile);\n if (isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Cleanup\", lastWidth, generatedFile.getFullWidth());\n }\n } while (lastWidth !== generatedFile.getFullWidth());\n\n generatedFile.getTypeAliases().forEach(node => {\n node.setIsExported(true);\n });\n generatedFile.getVariableStatements().forEach(variableStatement => {\n variableStatement.setIsExported(true);\n });\n generatedFile.getEnums().forEach(node => {\n node.setIsExported(true);\n convertEnumToConstObject(node);\n });\n\n if (isVerbose) {\n const end = new Date().getTime();\n const time = end - start;\n // eslint-disable-next-line no-console\n console.log(\"Execution time: \" + time);\n }\n return generatedFile.getFullText();\n};\n\n/**\n * Scrubs the file content.\n *\n * @param file The file to scrub.\n */\nexport const scrubFile = async (file: string, nxRoot: string, isVerbose?: boolean) => {\n const scrubbedFileContent = await scrubFileContent(readFileSync(file, { encoding: \"utf-8\" }), nxRoot, isVerbose);\n\n let options = null;\n try {\n options = prettier\n .resolveConfig(join(nxRoot, \".prettierrc\"), {\n useCache: false,\n editorconfig: false,\n config: join(nxRoot, \".prettierrc\"),\n })\n // eslint-disable-next-line no-console\n .catch((error: Error) => console.log(error));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n if (!options) {\n throw new Error(\"Could not find prettier config\");\n }\n const prettierOptions = await options;\n\n let prettySrc = scrubbedFileContent;\n if (prettierOptions) {\n prettierOptions.parser = \"typescript\";\n prettySrc = prettier.format(scrubbedFileContent, prettierOptions);\n }\n\n writeFileSync(file, prettySrc, { encoding: \"utf-8\" });\n return prettySrc;\n};\n"]}
1
+ {"version":3,"file":"scrubFile.js","sourceRoot":"","sources":["../../../../../../../libs/react/graphql-tools/src/executors/createHooks/scrubFile.ts"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,2BAAiD;AACjD,+BAA4B;AAC5B,2DAAqC;AACrC,uCAAgE;AAEhE;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,CAAC,UAAsB,EAAE,EAAE;IACzD,MAAM,WAAW,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;IACvD,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;;QAC/B,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;QAEhD,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAClE,MAAM,cAAc,GAAG,MAAA,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAG,CAAC,CAAC,CAAC;YAC3D,IAAI,cAAc,EAAE;gBAClB,IAAI,WAAW,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE;oBACtD,MAAM,UAAU,GACd,UAAU,CAAC,sBAAsB,CAAC,cAAc,CAAC;wBACjD,UAAU,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C;KACvC;IACD,MAAM,mBAAmB,GAAG,MAAM,IAAA,wBAAgB,EAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAEnF,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI;QACF,OAAO,GAAG,QAAQ;aACf,aAAa,CAAC,IAAA,WAAI,EAAC,MAAM,EAAE,aAAa,CAAC,EAAE;YAC1C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,IAAA,WAAI,EAAC,MAAM,EAAE,aAAa,CAAC;SACpC,CAAC;aACD,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAChD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAChB;IACD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC;IAEtC,IAAI,SAAS,GAAG,mBAAmB,CAAC;IACpC,IAAI,eAAe,EAAE;QACnB,eAAe,CAAC,MAAM,GAAG,YAAY,CAAC;QACtC,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;KACnE;IAED,IAAA,kBAAa,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACtD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAA,CAAC;AAhCW,QAAA,SAAS,aAgCpB","sourcesContent":["/* eslint-disable no-console */\nimport { readFileSync, writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport * as prettier from \"prettier\";\nimport { EnumDeclaration, Project, SourceFile } from \"ts-morph\";\n\n/**\n * Removes unused identifiers from the source file.\n *\n * This does more then sourceFile.fixUnusedIdentifiers(diagnostic) as it also removes unused enums and interfaces.\n *\n * @param sourceFile The source file to remove unused identifiers from.\n */\nconst removeUnusedIdentifiers = (sourceFile: SourceFile) => {\n const diagnostics = sourceFile.getPreEmitDiagnostics();\n diagnostics.forEach(diagnostic => {\n const messageText = diagnostic.getMessageText();\n\n if (typeof messageText === \"string\" && messageText.startsWith(\"'\")) {\n const identifierName = messageText.match(/'([^']+)'/)?.[1];\n if (identifierName) {\n if (messageText.includes(\"is declared but never used\")) {\n const identifier =\n sourceFile.getVariableDeclaration(identifierName) ||\n sourceFile.getInterface(identifierName) ||\n sourceFile.getEnum(identifierName) ||\n sourceFile.getClass(identifierName) ||\n sourceFile.getTypeAlias(identifierName);\n\n if (!identifier) {\n // eslint-disable-next-line no-console\n console.log(\"Could not find: \", messageText);\n } else {\n identifier.remove();\n }\n }\n }\n }\n });\n};\n\nconst convertEnumToConstObject = (enumDeclaration: EnumDeclaration) => {\n const enumName = enumDeclaration.getName();\n const members = enumDeclaration.getMembers();\n\n const properties = members.map(member => {\n const name = member.getName();\n const value = member.getValue();\n return `${name}: '${value}'`;\n });\n\n const lowerCaseFirstLetter = enumName[0].toLowerCase() + enumName.slice(1);\n const constObjectText = `export const ${lowerCaseFirstLetter} = {\\n ${properties.join(\n \",\\n \"\n )},\\n} as const;\\nexport type ${enumName} = typeof ${lowerCaseFirstLetter}[keyof typeof ${lowerCaseFirstLetter}];`;\n\n // Replace the EnumDeclaration with the const object text\n enumDeclaration.replaceWithText(constObjectText);\n};\n\n/**\n * Generates React hooks from your graphql files.\n */\nexport const scrubFileContent = async (fileContent: string, nxRoot: string, isVerbose?: boolean) => {\n const start = new Date().getTime();\n\n const project = new Project({\n compilerOptions: {\n noUnusedLocals: true,\n noUnusedParameters: true,\n },\n });\n const generatedFile = project.createSourceFile(\"tmp.ts\", fileContent);\n\n generatedFile.insertStatements(0, \"/* eslint-disable @typescript-eslint/no-explicit-any */\");\n generatedFile.insertStatements(1, \"/* eslint-disable @typescript-eslint/array-type */\");\n\n generatedFile.getTypeAliases().forEach(node => {\n if (!node.getName().startsWith(\"Incremental\")) {\n node.setIsExported(false);\n }\n if (\n node.getName().startsWith(\"Query\") ||\n node.getName().startsWith(\"Mutation\") ||\n // Since they reference each other we remove them here.\n node.getName() === \"Site\" ||\n node.getName() === \"Event\" ||\n node.getName() === \"Asset\"\n ) {\n node.remove();\n }\n });\n generatedFile.getEnums().forEach(node => {\n node.setIsExported(false);\n });\n let lastWidth = 0;\n do {\n lastWidth = generatedFile.getFullWidth();\n removeUnusedIdentifiers(generatedFile);\n if (isVerbose) {\n console.log(\"Cleanup\", lastWidth, generatedFile.getFullWidth());\n }\n } while (lastWidth !== generatedFile.getFullWidth());\n\n generatedFile.getTypeAliases().forEach(node => {\n node.setIsExported(true);\n });\n generatedFile.getVariableStatements().forEach(variableStatement => {\n variableStatement.setIsExported(true);\n });\n generatedFile.getEnums().forEach(node => {\n node.setIsExported(true);\n convertEnumToConstObject(node);\n });\n\n if (isVerbose) {\n const end = new Date().getTime();\n const time = end - start;\n console.log(\"Execution time: \" + time);\n }\n return generatedFile.getFullText();\n};\n\n/**\n * Scrubs the file content.\n *\n * @param file The file to scrub.\n */\nexport const scrubFile = async (file: string, nxRoot: string, isVerbose?: boolean) => {\n const fileContent = readFileSync(file, { encoding: \"utf-8\" });\n if (fileContent.length === 0) {\n console.warn(`File ${file} is empty`);\n }\n const scrubbedFileContent = await scrubFileContent(fileContent, nxRoot, isVerbose);\n\n let options = null;\n try {\n options = prettier\n .resolveConfig(join(nxRoot, \".prettierrc\"), {\n useCache: false,\n editorconfig: false,\n config: join(nxRoot, \".prettierrc\"),\n })\n .catch((error: Error) => console.log(error));\n } catch (e) {\n console.log(e);\n }\n if (!options) {\n throw new Error(\"Could not find prettier config\");\n }\n const prettierOptions = await options;\n\n let prettySrc = scrubbedFileContent;\n if (prettierOptions) {\n prettierOptions.parser = \"typescript\";\n prettySrc = prettier.format(scrubbedFileContent, prettierOptions);\n }\n\n writeFileSync(file, prettySrc, { encoding: \"utf-8\" });\n return prettySrc;\n};\n"]}