@strapi/typescript-utils 5.50.1 → 5.50.2

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 (172) hide show
  1. package/dist/compile.d.ts +5 -0
  2. package/dist/compile.d.ts.map +1 -0
  3. package/dist/compile.js +12 -0
  4. package/dist/compile.js.map +1 -0
  5. package/dist/compile.mjs +10 -0
  6. package/dist/compile.mjs.map +1 -0
  7. package/dist/compilers/basic.d.ts +11 -0
  8. package/dist/compilers/basic.d.ts.map +1 -0
  9. package/dist/compilers/basic.js +58 -0
  10. package/dist/compilers/basic.js.map +1 -0
  11. package/dist/compilers/basic.mjs +36 -0
  12. package/dist/compilers/basic.mjs.map +1 -0
  13. package/dist/compilers/index.d.ts +3 -0
  14. package/dist/compilers/index.d.ts.map +1 -0
  15. package/dist/compilers/index.js +8 -0
  16. package/dist/compilers/index.js.map +1 -0
  17. package/dist/compilers/index.mjs +3 -0
  18. package/dist/compilers/index.mjs.map +1 -0
  19. package/dist/generators/common/imports.d.ts +5 -0
  20. package/dist/generators/common/imports.d.ts.map +1 -0
  21. package/dist/generators/common/imports.js +42 -0
  22. package/dist/generators/common/imports.js.map +1 -0
  23. package/dist/generators/common/imports.mjs +19 -0
  24. package/dist/generators/common/imports.mjs.map +1 -0
  25. package/dist/generators/common/index.d.ts +4 -0
  26. package/dist/generators/common/index.d.ts.map +1 -0
  27. package/dist/generators/common/models/attributes.d.ts +17 -0
  28. package/dist/generators/common/models/attributes.d.ts.map +1 -0
  29. package/dist/generators/common/models/attributes.js +152 -0
  30. package/dist/generators/common/models/attributes.js.map +1 -0
  31. package/dist/generators/common/models/attributes.mjs +124 -0
  32. package/dist/generators/common/models/attributes.mjs.map +1 -0
  33. package/dist/generators/common/models/index.d.ts +7 -0
  34. package/dist/generators/common/models/index.d.ts.map +1 -0
  35. package/dist/generators/common/models/mappers.d.ts +9 -0
  36. package/dist/generators/common/models/mappers.d.ts.map +1 -0
  37. package/dist/generators/common/models/mappers.js +227 -0
  38. package/dist/generators/common/models/mappers.js.map +1 -0
  39. package/dist/generators/common/models/mappers.mjs +202 -0
  40. package/dist/generators/common/models/mappers.mjs.map +1 -0
  41. package/dist/generators/common/models/schema.d.ts +7 -0
  42. package/dist/generators/common/models/schema.d.ts.map +1 -0
  43. package/dist/generators/common/models/schema.js +79 -0
  44. package/dist/generators/common/models/schema.js.map +1 -0
  45. package/dist/generators/common/models/schema.mjs +57 -0
  46. package/dist/generators/common/models/schema.mjs.map +1 -0
  47. package/dist/generators/common/models/utils.d.ts +54 -0
  48. package/dist/generators/common/models/utils.d.ts.map +1 -0
  49. package/dist/generators/common/models/utils.js +109 -0
  50. package/dist/generators/common/models/utils.js.map +1 -0
  51. package/dist/generators/common/models/utils.mjs +81 -0
  52. package/dist/generators/common/models/utils.mjs.map +1 -0
  53. package/dist/generators/components/index.d.ts +9 -0
  54. package/dist/generators/components/index.d.ts.map +1 -0
  55. package/dist/generators/components/index.js +76 -0
  56. package/dist/generators/components/index.js.map +1 -0
  57. package/dist/generators/components/index.mjs +54 -0
  58. package/dist/generators/components/index.mjs.map +1 -0
  59. package/dist/generators/constants.d.ts +3 -0
  60. package/dist/generators/constants.d.ts.map +1 -0
  61. package/dist/generators/constants.js +8 -0
  62. package/dist/generators/constants.js.map +1 -0
  63. package/dist/generators/constants.mjs +5 -0
  64. package/dist/generators/constants.mjs.map +1 -0
  65. package/dist/generators/content-types/index.d.ts +9 -0
  66. package/dist/generators/content-types/index.d.ts.map +1 -0
  67. package/dist/generators/content-types/index.js +76 -0
  68. package/dist/generators/content-types/index.js.map +1 -0
  69. package/dist/generators/content-types/index.mjs +54 -0
  70. package/dist/generators/content-types/index.mjs.map +1 -0
  71. package/dist/generators/index.d.ts +23 -0
  72. package/dist/generators/index.d.ts.map +1 -0
  73. package/dist/generators/index.js +81 -0
  74. package/dist/generators/index.js.map +1 -0
  75. package/dist/generators/index.mjs +74 -0
  76. package/dist/generators/index.mjs.map +1 -0
  77. package/dist/generators/utils.d.ts +52 -0
  78. package/dist/generators/utils.d.ts.map +1 -0
  79. package/dist/generators/utils.js +164 -0
  80. package/dist/generators/utils.js.map +1 -0
  81. package/dist/generators/utils.mjs +131 -0
  82. package/dist/generators/utils.mjs.map +1 -0
  83. package/dist/index.d.ts +5 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +28 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/index.mjs +14 -0
  88. package/dist/index.mjs.map +1 -0
  89. package/dist/utils/format-host.d.ts +3 -0
  90. package/dist/utils/format-host.d.ts.map +1 -0
  91. package/dist/utils/format-host.js +33 -0
  92. package/dist/utils/format-host.js.map +1 -0
  93. package/dist/utils/format-host.mjs +11 -0
  94. package/dist/utils/format-host.mjs.map +1 -0
  95. package/dist/utils/get-config-path.d.ts +10 -0
  96. package/dist/utils/get-config-path.d.ts.map +1 -0
  97. package/dist/utils/get-config-path.js +43 -0
  98. package/dist/utils/get-config-path.js.map +1 -0
  99. package/dist/utils/get-config-path.mjs +18 -0
  100. package/dist/utils/get-config-path.mjs.map +1 -0
  101. package/dist/utils/index.d.ts +9 -0
  102. package/dist/utils/index.d.ts.map +1 -0
  103. package/dist/utils/is-using-typescript-sync.d.ts +5 -0
  104. package/dist/utils/is-using-typescript-sync.d.ts.map +1 -0
  105. package/dist/utils/is-using-typescript-sync.js +20 -0
  106. package/dist/utils/is-using-typescript-sync.js.map +1 -0
  107. package/dist/utils/is-using-typescript-sync.mjs +14 -0
  108. package/dist/utils/is-using-typescript-sync.mjs.map +1 -0
  109. package/dist/utils/is-using-typescript.d.ts +5 -0
  110. package/dist/utils/is-using-typescript.d.ts.map +1 -0
  111. package/dist/utils/is-using-typescript.js +20 -0
  112. package/dist/utils/is-using-typescript.js.map +1 -0
  113. package/dist/utils/is-using-typescript.mjs +14 -0
  114. package/dist/utils/is-using-typescript.mjs.map +1 -0
  115. package/dist/utils/report-diagnostics.d.ts +6 -0
  116. package/dist/utils/report-diagnostics.d.ts.map +1 -0
  117. package/dist/utils/report-diagnostics.js +37 -0
  118. package/dist/utils/report-diagnostics.js.map +1 -0
  119. package/dist/utils/report-diagnostics.mjs +15 -0
  120. package/dist/utils/report-diagnostics.mjs.map +1 -0
  121. package/dist/utils/resolve-config-options.d.ts +12 -0
  122. package/dist/utils/resolve-config-options.d.ts.map +1 -0
  123. package/dist/utils/resolve-config-options.js +39 -0
  124. package/dist/utils/resolve-config-options.js.map +1 -0
  125. package/dist/utils/resolve-config-options.mjs +17 -0
  126. package/dist/utils/resolve-config-options.mjs.map +1 -0
  127. package/dist/utils/resolve-outdir-sync.d.ts +5 -0
  128. package/dist/utils/resolve-outdir-sync.d.ts.map +1 -0
  129. package/dist/utils/resolve-outdir-sync.js +19 -0
  130. package/dist/utils/resolve-outdir-sync.js.map +1 -0
  131. package/dist/utils/resolve-outdir-sync.mjs +13 -0
  132. package/dist/utils/resolve-outdir-sync.mjs.map +1 -0
  133. package/dist/utils/resolve-outdir.d.ts +5 -0
  134. package/dist/utils/resolve-outdir.d.ts.map +1 -0
  135. package/dist/utils/resolve-outdir.js +19 -0
  136. package/dist/utils/resolve-outdir.js.map +1 -0
  137. package/dist/utils/resolve-outdir.mjs +13 -0
  138. package/dist/utils/resolve-outdir.mjs.map +1 -0
  139. package/package.json +25 -10
  140. package/.eslintrc.cjs +0 -16
  141. package/index.d.ts +0 -5
  142. package/jest.config.js +0 -6
  143. package/lib/__tests__/generators/schemas/attributes.test.js +0 -903
  144. package/lib/__tests__/generators/schemas/imports.test.js +0 -56
  145. package/lib/__tests__/generators/schemas/utils.test.js +0 -314
  146. package/lib/__tests__/generators/utils.test.js +0 -43
  147. package/lib/compile.js +0 -10
  148. package/lib/compilers/basic.js +0 -50
  149. package/lib/compilers/index.js +0 -7
  150. package/lib/generators/common/imports.js +0 -34
  151. package/lib/generators/common/index.js +0 -9
  152. package/lib/generators/common/models/attributes.js +0 -198
  153. package/lib/generators/common/models/index.js +0 -15
  154. package/lib/generators/common/models/mappers.js +0 -144
  155. package/lib/generators/common/models/schema.js +0 -93
  156. package/lib/generators/common/models/utils.js +0 -178
  157. package/lib/generators/components/index.js +0 -74
  158. package/lib/generators/constants.js +0 -6
  159. package/lib/generators/content-types/index.js +0 -74
  160. package/lib/generators/index.js +0 -122
  161. package/lib/generators/utils.js +0 -217
  162. package/lib/index.js +0 -13
  163. package/lib/utils/format-host.js +0 -15
  164. package/lib/utils/get-config-path.js +0 -29
  165. package/lib/utils/index.js +0 -21
  166. package/lib/utils/is-using-typescript-sync.js +0 -19
  167. package/lib/utils/is-using-typescript.js +0 -17
  168. package/lib/utils/report-diagnostics.js +0 -19
  169. package/lib/utils/resolve-config-options.js +0 -23
  170. package/lib/utils/resolve-outdir-sync.js +0 -18
  171. package/lib/utils/resolve-outdir.js +0 -18
  172. package/lint-staged.config.mjs +0 -1
@@ -0,0 +1,131 @@
1
+ import path from 'node:path';
2
+ import assert from 'node:assert';
3
+ import * as ts from 'typescript';
4
+ import fse from 'fs-extra';
5
+ import chalk from 'chalk';
6
+
7
+ const { factory } = ts;
8
+ const MODULE_DECLARATION = '@strapi/strapi';
9
+ const PUBLIC_NAMESPACE = 'Public';
10
+ /**
11
+ * Aggregate the given TypeScript nodes into a single string
12
+ */ const emitDefinitions = (definitions)=>{
13
+ const nodeArray = factory.createNodeArray(definitions);
14
+ const sourceFile = ts.createSourceFile('placeholder.ts', '', ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS);
15
+ const printer = ts.createPrinter({
16
+ omitTrailingSemicolon: true
17
+ });
18
+ return printer.printList(ts.ListFormat.MultiLine, nodeArray, sourceFile);
19
+ };
20
+ /**
21
+ * Save the given string representation of TS nodes in a file
22
+ * If the given directory doesn't exist, it'll be created automatically
23
+ *
24
+ * @return The path of the created file
25
+ */ const saveDefinitionToFileSystem = async (dir, file, content)=>{
26
+ const filepath = path.join(dir, file);
27
+ fse.ensureDirSync(dir);
28
+ await fse.writeFile(filepath, content);
29
+ return filepath;
30
+ };
31
+ /**
32
+ * Format the given definitions.
33
+ * Uses the existing config if one is defined in the project.
34
+ */ const format = async (content)=>{
35
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
36
+ const prettier = await import('prettier'); // ESM-only
37
+ const configFile = await prettier.resolveConfigFile();
38
+ const config = configFile ? await prettier.resolveConfig(configFile) : {
39
+ singleQuote: true,
40
+ useTabs: false,
41
+ tabWidth: 2
42
+ };
43
+ Object.assign(config, {
44
+ parser: 'typescript'
45
+ });
46
+ return prettier.format(content, config);
47
+ };
48
+ /**
49
+ * Generate the extension block for a shared component from strapi/strapi
50
+ */ const generateSharedExtensionDefinition = (registry, definitions)=>{
51
+ const properties = definitions.map(({ uid, definition })=>factory.createPropertySignature(undefined, factory.createStringLiteral(uid, true), undefined, factory.createTypeReferenceNode(factory.createIdentifier(definition.name.escapedText))));
52
+ return factory.createModuleDeclaration([
53
+ factory.createModifier(ts.SyntaxKind.DeclareKeyword)
54
+ ], factory.createStringLiteral(MODULE_DECLARATION, true), factory.createModuleBlock([
55
+ factory.createModuleDeclaration([
56
+ factory.createModifier(ts.SyntaxKind.ExportKeyword)
57
+ ], factory.createIdentifier(PUBLIC_NAMESPACE), factory.createModuleBlock(properties.length > 0 ? [
58
+ factory.createInterfaceDeclaration([
59
+ factory.createModifier(ts.SyntaxKind.ExportKeyword)
60
+ ], factory.createIdentifier(registry), undefined, undefined, properties)
61
+ ] : []), ts.NodeFlags.Namespace)
62
+ ]), ts.NodeFlags.ExportContext);
63
+ };
64
+ const createLogger = (options = {})=>{
65
+ const { silent = false, debug = false } = options;
66
+ const state = {
67
+ errors: 0,
68
+ warning: 0
69
+ };
70
+ return {
71
+ get warnings () {
72
+ return state.warning;
73
+ },
74
+ get errors () {
75
+ return state.errors;
76
+ },
77
+ debug (...args) {
78
+ if (silent || !debug) {
79
+ return;
80
+ }
81
+ console.log(chalk.cyan(`[DEBUG]\t[${new Date().toISOString()}] (Typegen)`), ...args);
82
+ },
83
+ info (...args) {
84
+ if (silent) {
85
+ return;
86
+ }
87
+ console.info(chalk.blue(`[INFO]\t[${new Date().toISOString()}] (Typegen)`), ...args);
88
+ },
89
+ warn (...args) {
90
+ state.warning += 1;
91
+ if (silent) {
92
+ return;
93
+ }
94
+ console.warn(chalk.yellow(`[WARN]\t[${new Date().toISOString()}] (Typegen)`), ...args);
95
+ },
96
+ error (...args) {
97
+ state.errors += 1;
98
+ if (silent) {
99
+ return;
100
+ }
101
+ console.error(chalk.red(`[ERROR]\t[${new Date().toISOString()}] (Typegen)`), ...args);
102
+ }
103
+ };
104
+ };
105
+ const timer = ()=>{
106
+ const state = {
107
+ start: null,
108
+ end: null
109
+ };
110
+ return {
111
+ start () {
112
+ assert(state.start === null, 'The timer has already been started');
113
+ assert(state.end === null, 'The timer has already been ended');
114
+ state.start = Date.now();
115
+ return this;
116
+ },
117
+ end () {
118
+ assert(state.start !== null, 'The timer needs to be started before ending it');
119
+ assert(state.end === null, 'The timer has already been ended');
120
+ state.end = Date.now();
121
+ return this;
122
+ },
123
+ get duration () {
124
+ assert(state.start !== null, 'The timer has not been started');
125
+ return ((state.end ?? Date.now) - state.start) / 1000;
126
+ }
127
+ };
128
+ };
129
+
130
+ export { createLogger, emitDefinitions, format, generateSharedExtensionDefinition, saveDefinitionToFileSystem, timer };
131
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sources":["../../src/generators/utils.ts"],"sourcesContent":["import path from 'node:path';\nimport assert from 'node:assert';\nimport * as ts from 'typescript';\nimport fse from 'fs-extra';\nimport chalk from 'chalk';\n\nconst { factory } = ts;\n\nconst MODULE_DECLARATION = '@strapi/strapi';\nconst PUBLIC_NAMESPACE = 'Public';\n\n/**\n * Aggregate the given TypeScript nodes into a single string\n */\nexport const emitDefinitions = (definitions: ts.Node[]): string => {\n const nodeArray = factory.createNodeArray(definitions);\n\n const sourceFile = ts.createSourceFile(\n 'placeholder.ts',\n '',\n ts.ScriptTarget.ESNext,\n true,\n ts.ScriptKind.TS\n );\n\n const printer = ts.createPrinter({ omitTrailingSemicolon: true });\n\n return printer.printList(ts.ListFormat.MultiLine, nodeArray, sourceFile);\n};\n\n/**\n * Save the given string representation of TS nodes in a file\n * If the given directory doesn't exist, it'll be created automatically\n *\n * @return The path of the created file\n */\nexport const saveDefinitionToFileSystem = async (\n dir: string,\n file: string,\n content: string\n): Promise<string> => {\n const filepath = path.join(dir, file);\n\n fse.ensureDirSync(dir);\n await fse.writeFile(filepath, content);\n\n return filepath;\n};\n\n/**\n * Format the given definitions.\n * Uses the existing config if one is defined in the project.\n */\nexport const format = async (content: string): Promise<string> => {\n // eslint-disable-next-line node/no-unsupported-features/es-syntax\n const prettier = await import('prettier'); // ESM-only\n\n const configFile = await prettier.resolveConfigFile();\n const config: any = configFile\n ? await prettier.resolveConfig(configFile)\n : // Default config\n {\n singleQuote: true,\n useTabs: false,\n tabWidth: 2,\n };\n\n Object.assign(config, { parser: 'typescript' });\n\n return prettier.format(content, config);\n};\n\n/**\n * Generate the extension block for a shared component from strapi/strapi\n */\nexport const generateSharedExtensionDefinition = (\n registry: string,\n definitions: Array<{ uid: string; definition: ts.InterfaceDeclaration }>\n): ts.ModuleDeclaration => {\n const properties = definitions.map(({ uid, definition }) =>\n factory.createPropertySignature(\n undefined,\n factory.createStringLiteral(uid, true),\n undefined,\n factory.createTypeReferenceNode(\n factory.createIdentifier(definition.name.escapedText as string)\n )\n )\n );\n\n return factory.createModuleDeclaration(\n [factory.createModifier(ts.SyntaxKind.DeclareKeyword)],\n factory.createStringLiteral(MODULE_DECLARATION, true),\n factory.createModuleBlock([\n factory.createModuleDeclaration(\n [factory.createModifier(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(PUBLIC_NAMESPACE),\n factory.createModuleBlock(\n properties.length > 0\n ? [\n factory.createInterfaceDeclaration(\n [factory.createModifier(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(registry),\n undefined,\n undefined,\n properties\n ),\n ]\n : []\n ),\n ts.NodeFlags.Namespace\n ),\n ]),\n ts.NodeFlags.ExportContext\n );\n};\n\ninterface CreateLoggerOptions {\n silent?: boolean;\n debug?: boolean;\n}\n\nexport const createLogger = (options: CreateLoggerOptions = {}) => {\n const { silent = false, debug = false } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args: any[]) {\n if (silent || !debug) {\n return;\n }\n\n console.log(chalk.cyan(`[DEBUG]\\t[${new Date().toISOString()}] (Typegen)`), ...args);\n },\n\n info(...args: any[]) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`[INFO]\\t[${new Date().toISOString()}] (Typegen)`), ...args);\n },\n\n warn(...args: any[]) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(chalk.yellow(`[WARN]\\t[${new Date().toISOString()}] (Typegen)`), ...args);\n },\n\n error(...args: any[]) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(chalk.red(`[ERROR]\\t[${new Date().toISOString()}] (Typegen)`), ...args);\n },\n };\n};\n\nexport const timer = () => {\n const state: { start: number | null; end: number | null } = {\n start: null,\n end: null,\n };\n\n return {\n start() {\n assert(state.start === null, 'The timer has already been started');\n assert(state.end === null, 'The timer has already been ended');\n\n state.start = Date.now();\n\n return this;\n },\n\n end() {\n assert(state.start !== null, 'The timer needs to be started before ending it');\n assert(state.end === null, 'The timer has already been ended');\n\n state.end = Date.now();\n\n return this;\n },\n\n get duration() {\n assert(state.start !== null, 'The timer has not been started');\n\n return (((state.end ?? Date.now) as any) - (state.start as number)) / 1000;\n },\n };\n};\n\nexport type Logger = ReturnType<typeof createLogger>;\n\n/**\n * Options passed to each artifact generator (content-types, components).\n */\nexport interface GeneratorOptions {\n strapi: any;\n logger: Logger;\n pwd?: string;\n}\n"],"names":["factory","ts","MODULE_DECLARATION","PUBLIC_NAMESPACE","emitDefinitions","definitions","nodeArray","createNodeArray","sourceFile","createSourceFile","ScriptTarget","ESNext","ScriptKind","TS","printer","createPrinter","omitTrailingSemicolon","printList","ListFormat","MultiLine","saveDefinitionToFileSystem","dir","file","content","filepath","path","join","fse","ensureDirSync","writeFile","format","prettier","configFile","resolveConfigFile","config","resolveConfig","singleQuote","useTabs","tabWidth","Object","assign","parser","generateSharedExtensionDefinition","registry","properties","map","uid","definition","createPropertySignature","undefined","createStringLiteral","createTypeReferenceNode","createIdentifier","name","escapedText","createModuleDeclaration","createModifier","SyntaxKind","DeclareKeyword","createModuleBlock","ExportKeyword","length","createInterfaceDeclaration","NodeFlags","Namespace","ExportContext","createLogger","options","silent","debug","state","errors","warning","warnings","args","console","log","chalk","cyan","Date","toISOString","info","blue","warn","yellow","error","red","timer","start","end","assert","now","duration"],"mappings":";;;;;;AAMA,MAAM,EAAEA,OAAO,EAAE,GAAGC,EAAAA;AAEpB,MAAMC,kBAAAA,GAAqB,gBAAA;AAC3B,MAAMC,gBAAAA,GAAmB,QAAA;AAEzB;;IAGO,MAAMC,eAAAA,GAAkB,CAACC,WAAAA,GAAAA;IAC9B,MAAMC,SAAAA,GAAYN,OAAAA,CAAQO,eAAe,CAACF,WAAAA,CAAAA;AAE1C,IAAA,MAAMG,UAAAA,GAAaP,EAAAA,CAAGQ,gBAAgB,CACpC,kBACA,EAAA,EACAR,EAAAA,CAAGS,YAAY,CAACC,MAAM,EACtB,IAAA,EACAV,EAAAA,CAAGW,UAAU,CAACC,EAAE,CAAA;IAGlB,MAAMC,OAAAA,GAAUb,EAAAA,CAAGc,aAAa,CAAC;QAAEC,qBAAAA,EAAuB;AAAK,KAAA,CAAA;IAE/D,OAAOF,OAAAA,CAAQG,SAAS,CAAChB,EAAAA,CAAGiB,UAAU,CAACC,SAAS,EAAEb,SAAAA,EAAWE,UAAAA,CAAAA;AAC/D;AAEA;;;;;AAKC,IACM,MAAMY,0BAAAA,GAA6B,OACxCC,KACAC,IAAAA,EACAC,OAAAA,GAAAA;AAEA,IAAA,MAAMC,QAAAA,GAAWC,IAAAA,C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CAAG,WAAW,CAAC,CAAA,EAAA,GAAMN,IAAAA,CAAAA;AAClF,QAAA;AACF,KAAA;AACF;MAEaa,KAAAA,GAAQ,IAAA;AACnB,IAAA,MAAMjB,KAAAA,GAAsD;QAC1DkB,KAAAA,EAAO,IAAA;QACPC,GAAAA,EAAK;AACP,KAAA;IAEA,OAAO;AACLD,QAAAA,KAAAA,CAAAA,GAAAA;YACEE,MAAAA,CAAOpB,KAAAA,CAAMkB,KAAK,KAAK,IAAA,EAAM,oCAAA,CAAA;YAC7BE,MAAAA,CAAOpB,KAAAA,CAAMmB,GAAG,KAAK,IAAA,EAAM,kCAAA,CAAA;YAE3BnB,KAAAA,CAAMkB,KAAK,GAAGT,IAAAA,CAAKY,GAAG,EAAA;AAEtB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEAF,QAAAA,GAAAA,CAAAA,GAAAA;YACEC,MAAAA,CAAOpB,KAAAA,CAAMkB,KAAK,KAAK,IAAA,EAAM,gDAAA,CAAA;YAC7BE,MAAAA,CAAOpB,KAAAA,CAAMmB,GAAG,KAAK,IAAA,EAAM,kCAAA,CAAA;YAE3BnB,KAAAA,CAAMmB,GAAG,GAAGV,IAAAA,CAAKY,GAAG,EAAA;AAEpB,YAAA,OAAO,IAAI;AACb,QAAA,CAAA;AAEA,QAAA,IAAIC,QAAAA,CAAAA,GAAW;YACbF,MAAAA,CAAOpB,KAAAA,CAAMkB,KAAK,KAAK,IAAA,EAAM,gCAAA,CAAA;AAE7B,YAAA,OAAO,CAAC,CAAElB,MAAMmB,GAAG,IAAIV,IAAAA,CAAKY,GAAG,IAAarB,KAAAA,CAAMkB,KAAK,IAAe,IAAA;AACxE,QAAA;AACF,KAAA;AACF;;;;"}
@@ -0,0 +1,5 @@
1
+ export { compile } from './compile';
2
+ export * as compilers from './compilers';
3
+ export * as generators from './generators';
4
+ export * from './utils';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var compile = require('./compile.js');
4
+ var index = require('./compilers/index.js');
5
+ var index$1 = require('./generators/index.js');
6
+ var isUsingTypescript = require('./utils/is-using-typescript.js');
7
+ var isUsingTypescriptSync = require('./utils/is-using-typescript-sync.js');
8
+ var getConfigPath = require('./utils/get-config-path.js');
9
+ var reportDiagnostics = require('./utils/report-diagnostics.js');
10
+ var resolveConfigOptions = require('./utils/resolve-config-options.js');
11
+ var formatHost = require('./utils/format-host.js');
12
+ var resolveOutdir = require('./utils/resolve-outdir.js');
13
+ var resolveOutdirSync = require('./utils/resolve-outdir-sync.js');
14
+
15
+
16
+
17
+ exports.compile = compile.compile;
18
+ exports.compilers = index;
19
+ exports.generators = index$1;
20
+ exports.isUsingTypeScript = isUsingTypescript.isUsingTypeScript;
21
+ exports.isUsingTypeScriptSync = isUsingTypescriptSync.isUsingTypeScriptSync;
22
+ exports.getConfigPath = getConfigPath.getConfigPath;
23
+ exports.reportDiagnostics = reportDiagnostics.reportDiagnostics;
24
+ exports.resolveConfigOptions = resolveConfigOptions.resolveConfigOptions;
25
+ exports.formatHost = formatHost.formatHost;
26
+ exports.resolveOutDir = resolveOutdir.resolveOutDir;
27
+ exports.resolveOutDirSync = resolveOutdirSync.resolveOutDirSync;
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ export { compile } from './compile.mjs';
2
+ import * as index from './compilers/index.mjs';
3
+ export { index as compilers };
4
+ import * as index$1 from './generators/index.mjs';
5
+ export { index$1 as generators };
6
+ export { isUsingTypeScript } from './utils/is-using-typescript.mjs';
7
+ export { isUsingTypeScriptSync } from './utils/is-using-typescript-sync.mjs';
8
+ export { getConfigPath } from './utils/get-config-path.mjs';
9
+ export { reportDiagnostics } from './utils/report-diagnostics.mjs';
10
+ export { resolveConfigOptions } from './utils/resolve-config-options.mjs';
11
+ export { formatHost } from './utils/format-host.mjs';
12
+ export { resolveOutDir } from './utils/resolve-outdir.mjs';
13
+ export { resolveOutDirSync } from './utils/resolve-outdir-sync.mjs';
14
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import * as ts from 'typescript';
2
+ export declare const formatHost: ts.FormatDiagnosticsHost;
3
+ //# sourceMappingURL=format-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-host.d.ts","sourceRoot":"","sources":["../../src/utils/format-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,qBAI3B,CAAC"}
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var ts = require('typescript');
4
+ var _ = require('lodash/fp');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
25
+
26
+ const formatHost = {
27
+ getCanonicalFileName: _.identity,
28
+ getCurrentDirectory: ts__namespace.sys.getCurrentDirectory,
29
+ getNewLine: ()=>ts__namespace.sys.newLine
30
+ };
31
+
32
+ exports.formatHost = formatHost;
33
+ //# sourceMappingURL=format-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-host.js","sources":["../../src/utils/format-host.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { identity } from 'lodash/fp';\n\nexport const formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: identity,\n getCurrentDirectory: ts.sys.getCurrentDirectory,\n getNewLine: () => ts.sys.newLine,\n};\n"],"names":["formatHost","getCanonicalFileName","identity","getCurrentDirectory","ts","sys","getNewLine","newLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;MAGaA,UAAAA,GAAuC;IAClDC,oBAAAA,EAAsBC,UAAAA;IACtBC,mBAAAA,EAAqBC,aAAAA,CAAGC,GAAG,CAACF,mBAAmB;AAC/CG,IAAAA,UAAAA,EAAY,IAAMF,aAAAA,CAAGC,GAAG,CAACE;AAC3B;;;;"}
@@ -0,0 +1,11 @@
1
+ import * as ts from 'typescript';
2
+ import { identity } from 'lodash/fp';
3
+
4
+ const formatHost = {
5
+ getCanonicalFileName: identity,
6
+ getCurrentDirectory: ts.sys.getCurrentDirectory,
7
+ getNewLine: ()=>ts.sys.newLine
8
+ };
9
+
10
+ export { formatHost };
11
+ //# sourceMappingURL=format-host.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-host.mjs","sources":["../../src/utils/format-host.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { identity } from 'lodash/fp';\n\nexport const formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: identity,\n getCurrentDirectory: ts.sys.getCurrentDirectory,\n getNewLine: () => ts.sys.newLine,\n};\n"],"names":["formatHost","getCanonicalFileName","identity","getCurrentDirectory","ts","sys","getNewLine","newLine"],"mappings":";;;MAGaA,UAAAA,GAAuC;IAClDC,oBAAAA,EAAsBC,QAAAA;IACtBC,mBAAAA,EAAqBC,EAAAA,CAAGC,GAAG,CAACF,mBAAmB;AAC/CG,IAAAA,UAAAA,EAAY,IAAMF,EAAAA,CAAGC,GAAG,CAACE;AAC3B;;;;"}
@@ -0,0 +1,10 @@
1
+ interface GetConfigPathOptions {
2
+ filename?: string;
3
+ ancestorsLookup?: boolean;
4
+ }
5
+ /**
6
+ * Get the path of the typescript config file for a given directory
7
+ */
8
+ export declare const getConfigPath: (dir: string, { filename, ancestorsLookup }?: GetConfigPathOptions) => string | undefined;
9
+ export {};
10
+ //# sourceMappingURL=get-config-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config-path.d.ts","sourceRoot":"","sources":["../../src/utils/get-config-path.ts"],"names":[],"mappings":"AAKA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,MAAM,EACX,gCAAoE,oBAAyB,KAC5F,MAAM,GAAG,SAWX,CAAC"}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var path = require('node:path');
4
+ var ts = require('typescript');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var path__default = /*#__PURE__*/_interopDefault(path);
27
+ var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
28
+
29
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
30
+ /**
31
+ * Get the path of the typescript config file for a given directory
32
+ */ const getConfigPath = (dir, { filename = DEFAULT_TS_CONFIG_FILENAME, ancestorsLookup = false } = {})=>{
33
+ const dirAbsolutePath = path__default.default.resolve(dir);
34
+ let configFilePath = ts__namespace.findConfigFile(dirAbsolutePath, ts__namespace.sys.fileExists, filename);
35
+ if (configFilePath) configFilePath = path__default.default.resolve(configFilePath);
36
+ if (!configFilePath || ancestorsLookup) {
37
+ return configFilePath;
38
+ }
39
+ return configFilePath.startsWith(dirAbsolutePath) ? configFilePath : undefined;
40
+ };
41
+
42
+ exports.getConfigPath = getConfigPath;
43
+ //# sourceMappingURL=get-config-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config-path.js","sources":["../../src/utils/get-config-path.ts"],"sourcesContent":["import path from 'node:path';\nimport * as ts from 'typescript';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n\ninterface GetConfigPathOptions {\n filename?: string;\n ancestorsLookup?: boolean;\n}\n\n/**\n * Get the path of the typescript config file for a given directory\n */\nexport const getConfigPath = (\n dir: string,\n { filename = DEFAULT_TS_CONFIG_FILENAME, ancestorsLookup = false }: GetConfigPathOptions = {}\n): string | undefined => {\n const dirAbsolutePath = path.resolve(dir);\n let configFilePath = ts.findConfigFile(dirAbsolutePath, ts.sys.fileExists, filename);\n\n if (configFilePath) configFilePath = path.resolve(configFilePath);\n\n if (!configFilePath || ancestorsLookup) {\n return configFilePath;\n }\n\n return configFilePath.startsWith(dirAbsolutePath) ? configFilePath : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","getConfigPath","dir","filename","ancestorsLookup","dirAbsolutePath","path","resolve","configFilePath","ts","findConfigFile","sys","fileExists","startsWith","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,0BAAAA,GAA6B,eAAA;AAOnC;;AAEC,IACM,MAAMC,aAAAA,GAAgB,CAC3BC,KACA,EAAEC,QAAAA,GAAWH,0BAA0B,EAAEI,eAAAA,GAAkB,KAAK,EAAwB,GAAG,EAAE,GAAA;IAE7F,MAAMC,eAAAA,GAAkBC,qBAAAA,CAAKC,OAAO,CAACL,GAAAA,CAAAA;IACrC,IAAIM,cAAAA,GAAiBC,cAAGC,cAAc,CAACL,iBAAiBI,aAAAA,CAAGE,GAAG,CAACC,UAAU,EAAET,QAAAA,CAAAA;AAE3E,IAAA,IAAIK,cAAAA,EAAgBA,cAAAA,GAAiBF,qBAAAA,CAAKC,OAAO,CAACC,cAAAA,CAAAA;IAElD,IAAI,CAACA,kBAAkBJ,eAAAA,EAAiB;QACtC,OAAOI,cAAAA;AACT,IAAA;AAEA,IAAA,OAAOA,cAAAA,CAAeK,UAAU,CAACR,eAAAA,CAAAA,GAAmBG,cAAAA,GAAiBM,SAAAA;AACvE;;;;"}
@@ -0,0 +1,18 @@
1
+ import path from 'node:path';
2
+ import * as ts from 'typescript';
3
+
4
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
5
+ /**
6
+ * Get the path of the typescript config file for a given directory
7
+ */ const getConfigPath = (dir, { filename = DEFAULT_TS_CONFIG_FILENAME, ancestorsLookup = false } = {})=>{
8
+ const dirAbsolutePath = path.resolve(dir);
9
+ let configFilePath = ts.findConfigFile(dirAbsolutePath, ts.sys.fileExists, filename);
10
+ if (configFilePath) configFilePath = path.resolve(configFilePath);
11
+ if (!configFilePath || ancestorsLookup) {
12
+ return configFilePath;
13
+ }
14
+ return configFilePath.startsWith(dirAbsolutePath) ? configFilePath : undefined;
15
+ };
16
+
17
+ export { getConfigPath };
18
+ //# sourceMappingURL=get-config-path.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-config-path.mjs","sources":["../../src/utils/get-config-path.ts"],"sourcesContent":["import path from 'node:path';\nimport * as ts from 'typescript';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n\ninterface GetConfigPathOptions {\n filename?: string;\n ancestorsLookup?: boolean;\n}\n\n/**\n * Get the path of the typescript config file for a given directory\n */\nexport const getConfigPath = (\n dir: string,\n { filename = DEFAULT_TS_CONFIG_FILENAME, ancestorsLookup = false }: GetConfigPathOptions = {}\n): string | undefined => {\n const dirAbsolutePath = path.resolve(dir);\n let configFilePath = ts.findConfigFile(dirAbsolutePath, ts.sys.fileExists, filename);\n\n if (configFilePath) configFilePath = path.resolve(configFilePath);\n\n if (!configFilePath || ancestorsLookup) {\n return configFilePath;\n }\n\n return configFilePath.startsWith(dirAbsolutePath) ? configFilePath : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","getConfigPath","dir","filename","ancestorsLookup","dirAbsolutePath","path","resolve","configFilePath","ts","findConfigFile","sys","fileExists","startsWith","undefined"],"mappings":";;;AAGA,MAAMA,0BAAAA,GAA6B,eAAA;AAOnC;;AAEC,IACM,MAAMC,aAAAA,GAAgB,CAC3BC,KACA,EAAEC,QAAAA,GAAWH,0BAA0B,EAAEI,eAAAA,GAAkB,KAAK,EAAwB,GAAG,EAAE,GAAA;IAE7F,MAAMC,eAAAA,GAAkBC,IAAAA,CAAKC,OAAO,CAACL,GAAAA,CAAAA;IACrC,IAAIM,cAAAA,GAAiBC,GAAGC,cAAc,CAACL,iBAAiBI,EAAAA,CAAGE,GAAG,CAACC,UAAU,EAAET,QAAAA,CAAAA;AAE3E,IAAA,IAAIK,cAAAA,EAAgBA,cAAAA,GAAiBF,IAAAA,CAAKC,OAAO,CAACC,cAAAA,CAAAA;IAElD,IAAI,CAACA,kBAAkBJ,eAAAA,EAAiB;QACtC,OAAOI,cAAAA;AACT,IAAA;AAEA,IAAA,OAAOA,cAAAA,CAAeK,UAAU,CAACR,eAAAA,CAAAA,GAAmBG,cAAAA,GAAiBM,SAAAA;AACvE;;;;"}
@@ -0,0 +1,9 @@
1
+ export { isUsingTypeScript } from './is-using-typescript';
2
+ export { isUsingTypeScriptSync } from './is-using-typescript-sync';
3
+ export { getConfigPath } from './get-config-path';
4
+ export { reportDiagnostics } from './report-diagnostics';
5
+ export { resolveConfigOptions } from './resolve-config-options';
6
+ export { formatHost } from './format-host';
7
+ export { resolveOutDir } from './resolve-outdir';
8
+ export { resolveOutDirSync } from './resolve-outdir-sync';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
3
+ */
4
+ export declare const isUsingTypeScriptSync: (dir: string, filename?: string | undefined) => boolean;
5
+ //# sourceMappingURL=is-using-typescript-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript-sync.d.ts","sourceRoot":"","sources":["../../src/utils/is-using-typescript-sync.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,KAAK,MAAM,EACX,WAAU,MAAM,GAAG,SAAqB,KACvC,OAIF,CAAC"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var fse = require('fs-extra');
4
+ var getConfigPath = require('./get-config-path.js');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var fse__default = /*#__PURE__*/_interopDefault(fse);
9
+
10
+ /**
11
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
12
+ */ const isUsingTypeScriptSync = (dir, filename = undefined)=>{
13
+ const filePath = getConfigPath.getConfigPath(dir, {
14
+ filename
15
+ });
16
+ return filePath ? fse__default.default.pathExistsSync(filePath) : false;
17
+ };
18
+
19
+ exports.isUsingTypeScriptSync = isUsingTypeScriptSync;
20
+ //# sourceMappingURL=is-using-typescript-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript-sync.js","sources":["../../src/utils/is-using-typescript-sync.ts"],"sourcesContent":["import fse from 'fs-extra';\n\nimport { getConfigPath } from './get-config-path';\n\n/**\n * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)\n */\nexport const isUsingTypeScriptSync = (\n dir: string,\n filename: string | undefined = undefined\n): boolean => {\n const filePath = getConfigPath(dir, { filename });\n\n return filePath ? fse.pathExistsSync(filePath) : false;\n};\n"],"names":["isUsingTypeScriptSync","dir","filename","undefined","filePath","getConfigPath","fse","pathExistsSync"],"mappings":";;;;;;;;;AAIA;;AAEC,IACM,MAAMA,qBAAAA,GAAwB,CACnCC,GAAAA,EACAC,WAA+BC,SAAS,GAAA;IAExC,MAAMC,QAAAA,GAAWC,4BAAcJ,GAAAA,EAAK;AAAEC,QAAAA;AAAS,KAAA,CAAA;AAE/C,IAAA,OAAOE,QAAAA,GAAWE,oBAAAA,CAAIC,cAAc,CAACH,QAAAA,CAAAA,GAAY,KAAA;AACnD;;;;"}
@@ -0,0 +1,14 @@
1
+ import fse from 'fs-extra';
2
+ import { getConfigPath } from './get-config-path.mjs';
3
+
4
+ /**
5
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
6
+ */ const isUsingTypeScriptSync = (dir, filename = undefined)=>{
7
+ const filePath = getConfigPath(dir, {
8
+ filename
9
+ });
10
+ return filePath ? fse.pathExistsSync(filePath) : false;
11
+ };
12
+
13
+ export { isUsingTypeScriptSync };
14
+ //# sourceMappingURL=is-using-typescript-sync.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript-sync.mjs","sources":["../../src/utils/is-using-typescript-sync.ts"],"sourcesContent":["import fse from 'fs-extra';\n\nimport { getConfigPath } from './get-config-path';\n\n/**\n * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)\n */\nexport const isUsingTypeScriptSync = (\n dir: string,\n filename: string | undefined = undefined\n): boolean => {\n const filePath = getConfigPath(dir, { filename });\n\n return filePath ? fse.pathExistsSync(filePath) : false;\n};\n"],"names":["isUsingTypeScriptSync","dir","filename","undefined","filePath","getConfigPath","fse","pathExistsSync"],"mappings":";;;AAIA;;AAEC,IACM,MAAMA,qBAAAA,GAAwB,CACnCC,GAAAA,EACAC,WAA+BC,SAAS,GAAA;IAExC,MAAMC,QAAAA,GAAWC,cAAcJ,GAAAA,EAAK;AAAEC,QAAAA;AAAS,KAAA,CAAA;AAE/C,IAAA,OAAOE,QAAAA,GAAWE,GAAAA,CAAIC,cAAc,CAACH,QAAAA,CAAAA,GAAY,KAAA;AACnD;;;;"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
3
+ */
4
+ export declare const isUsingTypeScript: (dir: string, filename?: string | undefined) => Promise<boolean>;
5
+ //# sourceMappingURL=is-using-typescript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript.d.ts","sourceRoot":"","sources":["../../src/utils/is-using-typescript.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,EACX,WAAU,MAAM,GAAG,SAAqB,KACvC,OAAO,CAAC,OAAO,CAIjB,CAAC"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var fse = require('fs-extra');
4
+ var getConfigPath = require('./get-config-path.js');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var fse__default = /*#__PURE__*/_interopDefault(fse);
9
+
10
+ /**
11
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
12
+ */ const isUsingTypeScript = (dir, filename = undefined)=>{
13
+ const filePath = getConfigPath.getConfigPath(dir, {
14
+ filename
15
+ });
16
+ return fse__default.default.pathExists(filePath);
17
+ };
18
+
19
+ exports.isUsingTypeScript = isUsingTypeScript;
20
+ //# sourceMappingURL=is-using-typescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript.js","sources":["../../src/utils/is-using-typescript.ts"],"sourcesContent":["import fse from 'fs-extra';\n\nimport { getConfigPath } from './get-config-path';\n\n/**\n * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)\n */\nexport const isUsingTypeScript = (\n dir: string,\n filename: string | undefined = undefined\n): Promise<boolean> => {\n const filePath = getConfigPath(dir, { filename });\n\n return fse.pathExists(filePath as string);\n};\n"],"names":["isUsingTypeScript","dir","filename","undefined","filePath","getConfigPath","fse","pathExists"],"mappings":";;;;;;;;;AAIA;;AAEC,IACM,MAAMA,iBAAAA,GAAoB,CAC/BC,GAAAA,EACAC,WAA+BC,SAAS,GAAA;IAExC,MAAMC,QAAAA,GAAWC,4BAAcJ,GAAAA,EAAK;AAAEC,QAAAA;AAAS,KAAA,CAAA;IAE/C,OAAOI,oBAAAA,CAAIC,UAAU,CAACH,QAAAA,CAAAA;AACxB;;;;"}
@@ -0,0 +1,14 @@
1
+ import fse from 'fs-extra';
2
+ import { getConfigPath } from './get-config-path.mjs';
3
+
4
+ /**
5
+ * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)
6
+ */ const isUsingTypeScript = (dir, filename = undefined)=>{
7
+ const filePath = getConfigPath(dir, {
8
+ filename
9
+ });
10
+ return fse.pathExists(filePath);
11
+ };
12
+
13
+ export { isUsingTypeScript };
14
+ //# sourceMappingURL=is-using-typescript.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-using-typescript.mjs","sources":["../../src/utils/is-using-typescript.ts"],"sourcesContent":["import fse from 'fs-extra';\n\nimport { getConfigPath } from './get-config-path';\n\n/**\n * Checks if `dir` is a using TypeScript (whether there is a tsconfig file or not)\n */\nexport const isUsingTypeScript = (\n dir: string,\n filename: string | undefined = undefined\n): Promise<boolean> => {\n const filePath = getConfigPath(dir, { filename });\n\n return fse.pathExists(filePath as string);\n};\n"],"names":["isUsingTypeScript","dir","filename","undefined","filePath","getConfigPath","fse","pathExists"],"mappings":";;;AAIA;;AAEC,IACM,MAAMA,iBAAAA,GAAoB,CAC/BC,GAAAA,EACAC,WAA+BC,SAAS,GAAA;IAExC,MAAMC,QAAAA,GAAWC,cAAcJ,GAAAA,EAAK;AAAEC,QAAAA;AAAS,KAAA,CAAA;IAE/C,OAAOI,GAAAA,CAAIC,UAAU,CAACH,QAAAA,CAAAA;AACxB;;;;"}
@@ -0,0 +1,6 @@
1
+ import * as ts from 'typescript';
2
+ /**
3
+ * Report one or several diagnostic to the console
4
+ */
5
+ export declare const reportDiagnostics: (diagnostics: readonly ts.Diagnostic[] | ts.Diagnostic) => void;
6
+ //# sourceMappingURL=report-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-diagnostics.d.ts","sourceRoot":"","sources":["../../src/utils/report-diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,SAAS,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,KAAG,IAQzF,CAAC"}
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var ts = require('typescript');
4
+ var formatHost = require('./format-host.js');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
25
+
26
+ /**
27
+ * Report one or several diagnostic to the console
28
+ */ const reportDiagnostics = (diagnostics)=>{
29
+ const formattedDiagnostics = ts__namespace.formatDiagnosticsWithColorAndContext(Array.isArray(diagnostics) ? diagnostics : [
30
+ diagnostics
31
+ ], formatHost.formatHost);
32
+ console.error(formattedDiagnostics);
33
+ console.info(`Found ${diagnostics.length} error(s).${ts__namespace.sys.newLine}`);
34
+ };
35
+
36
+ exports.reportDiagnostics = reportDiagnostics;
37
+ //# sourceMappingURL=report-diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-diagnostics.js","sources":["../../src/utils/report-diagnostics.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nimport { formatHost } from './format-host';\n\n/**\n * Report one or several diagnostic to the console\n */\nexport const reportDiagnostics = (diagnostics: readonly ts.Diagnostic[] | ts.Diagnostic): void => {\n const formattedDiagnostics = ts.formatDiagnosticsWithColorAndContext(\n Array.isArray(diagnostics) ? diagnostics : [diagnostics],\n formatHost\n );\n\n console.error(formattedDiagnostics);\n console.info(`Found ${(diagnostics as ts.Diagnostic[]).length} error(s).${ts.sys.newLine}`);\n};\n"],"names":["reportDiagnostics","diagnostics","formattedDiagnostics","ts","formatDiagnosticsWithColorAndContext","Array","isArray","formatHost","console","error","info","length","sys","newLine"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;IAGO,MAAMA,iBAAAA,GAAoB,CAACC,WAAAA,GAAAA;IAChC,MAAMC,oBAAAA,GAAuBC,cAAGC,oCAAoC,CAClEC,MAAMC,OAAO,CAACL,eAAeA,WAAAA,GAAc;AAACA,QAAAA;KAAY,EACxDM,qBAAAA,CAAAA;AAGFC,IAAAA,OAAAA,CAAQC,KAAK,CAACP,oBAAAA,CAAAA;AACdM,IAAAA,OAAAA,CAAQE,IAAI,CAAC,CAAC,MAAM,EAAE,WAACT,CAAgCU,MAAM,CAAC,UAAU,EAAER,aAAAA,CAAGS,GAAG,CAACC,OAAO,CAAA,CAAE,CAAA;AAC5F;;;;"}
@@ -0,0 +1,15 @@
1
+ import * as ts from 'typescript';
2
+ import { formatHost } from './format-host.mjs';
3
+
4
+ /**
5
+ * Report one or several diagnostic to the console
6
+ */ const reportDiagnostics = (diagnostics)=>{
7
+ const formattedDiagnostics = ts.formatDiagnosticsWithColorAndContext(Array.isArray(diagnostics) ? diagnostics : [
8
+ diagnostics
9
+ ], formatHost);
10
+ console.error(formattedDiagnostics);
11
+ console.info(`Found ${diagnostics.length} error(s).${ts.sys.newLine}`);
12
+ };
13
+
14
+ export { reportDiagnostics };
15
+ //# sourceMappingURL=report-diagnostics.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-diagnostics.mjs","sources":["../../src/utils/report-diagnostics.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nimport { formatHost } from './format-host';\n\n/**\n * Report one or several diagnostic to the console\n */\nexport const reportDiagnostics = (diagnostics: readonly ts.Diagnostic[] | ts.Diagnostic): void => {\n const formattedDiagnostics = ts.formatDiagnosticsWithColorAndContext(\n Array.isArray(diagnostics) ? diagnostics : [diagnostics],\n formatHost\n );\n\n console.error(formattedDiagnostics);\n console.info(`Found ${(diagnostics as ts.Diagnostic[]).length} error(s).${ts.sys.newLine}`);\n};\n"],"names":["reportDiagnostics","diagnostics","formattedDiagnostics","ts","formatDiagnosticsWithColorAndContext","Array","isArray","formatHost","console","error","info","length","sys","newLine"],"mappings":";;;AAIA;;IAGO,MAAMA,iBAAAA,GAAoB,CAACC,WAAAA,GAAAA;IAChC,MAAMC,oBAAAA,GAAuBC,GAAGC,oCAAoC,CAClEC,MAAMC,OAAO,CAACL,eAAeA,WAAAA,GAAc;AAACA,QAAAA;KAAY,EACxDM,UAAAA,CAAAA;AAGFC,IAAAA,OAAAA,CAAQC,KAAK,CAACP,oBAAAA,CAAAA;AACdM,IAAAA,OAAAA,CAAQE,IAAI,CAAC,CAAC,MAAM,EAAE,WAACT,CAAgCU,MAAM,CAAC,UAAU,EAAER,EAAAA,CAAGS,GAAG,CAACC,OAAO,CAAA,CAAE,CAAA;AAC5F;;;;"}
@@ -0,0 +1,12 @@
1
+ import * as ts from 'typescript';
2
+ export declare const resolveConfigOptions: (configPath: string) => {
3
+ options: ts.CompilerOptions;
4
+ typeAcquisition?: ts.TypeAcquisition;
5
+ fileNames: string[];
6
+ projectReferences?: readonly ts.ProjectReference[];
7
+ watchOptions?: ts.WatchOptions;
8
+ raw?: any;
9
+ wildcardDirectories?: ts.MapLike<ts.WatchDirectoryFlags>;
10
+ compileOnSave?: boolean;
11
+ };
12
+ //# sourceMappingURL=resolve-config-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-config-options.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-config-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM;;;;;;;;;CAgBtD,CAAC"}