@strapi/typescript-utils 5.50.0 → 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 (171) 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/compile.js +0 -10
  147. package/lib/compilers/basic.js +0 -50
  148. package/lib/compilers/index.js +0 -7
  149. package/lib/generators/common/imports.js +0 -34
  150. package/lib/generators/common/index.js +0 -9
  151. package/lib/generators/common/models/attributes.js +0 -198
  152. package/lib/generators/common/models/index.js +0 -15
  153. package/lib/generators/common/models/mappers.js +0 -144
  154. package/lib/generators/common/models/schema.js +0 -93
  155. package/lib/generators/common/models/utils.js +0 -178
  156. package/lib/generators/components/index.js +0 -74
  157. package/lib/generators/constants.js +0 -6
  158. package/lib/generators/content-types/index.js +0 -74
  159. package/lib/generators/index.js +0 -122
  160. package/lib/generators/utils.js +0 -216
  161. package/lib/index.js +0 -13
  162. package/lib/utils/format-host.js +0 -15
  163. package/lib/utils/get-config-path.js +0 -29
  164. package/lib/utils/index.js +0 -21
  165. package/lib/utils/is-using-typescript-sync.js +0 -19
  166. package/lib/utils/is-using-typescript.js +0 -17
  167. package/lib/utils/report-diagnostics.js +0 -19
  168. package/lib/utils/resolve-config-options.js +0 -23
  169. package/lib/utils/resolve-outdir-sync.js +0 -18
  170. package/lib/utils/resolve-outdir.js +0 -18
  171. package/lint-staged.config.mjs +0 -1
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var ts = require('typescript');
4
+ var reportDiagnostics = require('./report-diagnostics.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
+ const resolveConfigOptions = (configPath)=>{
27
+ // Parse the tsconfig.json file and resolve every file name & compiler options
28
+ const { errors, ...configOptions } = ts__namespace.getParsedCommandLineOfConfigFile(configPath, undefined, ts__namespace.sys);
29
+ // If there are errors in the tsconfig.json
30
+ // file, report them and exit early
31
+ if (errors.length > 0) {
32
+ reportDiagnostics.reportDiagnostics(errors);
33
+ process.exit(1);
34
+ }
35
+ return configOptions;
36
+ };
37
+
38
+ exports.resolveConfigOptions = resolveConfigOptions;
39
+ //# sourceMappingURL=resolve-config-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-config-options.js","sources":["../../src/utils/resolve-config-options.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nimport { reportDiagnostics } from './report-diagnostics';\n\nexport const resolveConfigOptions = (configPath: string) => {\n // Parse the tsconfig.json file and resolve every file name & compiler options\n const { errors, ...configOptions } = ts.getParsedCommandLineOfConfigFile(\n configPath,\n undefined,\n ts.sys as unknown as ts.ParseConfigFileHost\n )!;\n\n // If there are errors in the tsconfig.json\n // file, report them and exit early\n if (errors.length > 0) {\n reportDiagnostics(errors);\n process.exit(1);\n }\n\n return configOptions;\n};\n"],"names":["resolveConfigOptions","configPath","errors","configOptions","ts","getParsedCommandLineOfConfigFile","undefined","sys","length","reportDiagnostics","process","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,uBAAuB,CAACC,UAAAA,GAAAA;;AAEnC,IAAA,MAAM,EAAEC,MAAM,EAAE,GAAGC,aAAAA,EAAe,GAAGC,aAAAA,CAAGC,gCAAgC,CACtEJ,UAAAA,EACAK,SAAAA,EACAF,aAAAA,CAAGG,GAAG,CAAA;;;IAKR,IAAIL,MAAAA,CAAOM,MAAM,GAAG,CAAA,EAAG;QACrBC,mCAAAA,CAAkBP,MAAAA,CAAAA;AAClBQ,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;IAEA,OAAOR,aAAAA;AACT;;;;"}
@@ -0,0 +1,17 @@
1
+ import * as ts from 'typescript';
2
+ import { reportDiagnostics } from './report-diagnostics.mjs';
3
+
4
+ const resolveConfigOptions = (configPath)=>{
5
+ // Parse the tsconfig.json file and resolve every file name & compiler options
6
+ const { errors, ...configOptions } = ts.getParsedCommandLineOfConfigFile(configPath, undefined, ts.sys);
7
+ // If there are errors in the tsconfig.json
8
+ // file, report them and exit early
9
+ if (errors.length > 0) {
10
+ reportDiagnostics(errors);
11
+ process.exit(1);
12
+ }
13
+ return configOptions;
14
+ };
15
+
16
+ export { resolveConfigOptions };
17
+ //# sourceMappingURL=resolve-config-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-config-options.mjs","sources":["../../src/utils/resolve-config-options.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nimport { reportDiagnostics } from './report-diagnostics';\n\nexport const resolveConfigOptions = (configPath: string) => {\n // Parse the tsconfig.json file and resolve every file name & compiler options\n const { errors, ...configOptions } = ts.getParsedCommandLineOfConfigFile(\n configPath,\n undefined,\n ts.sys as unknown as ts.ParseConfigFileHost\n )!;\n\n // If there are errors in the tsconfig.json\n // file, report them and exit early\n if (errors.length > 0) {\n reportDiagnostics(errors);\n process.exit(1);\n }\n\n return configOptions;\n};\n"],"names":["resolveConfigOptions","configPath","errors","configOptions","ts","getParsedCommandLineOfConfigFile","undefined","sys","length","reportDiagnostics","process","exit"],"mappings":";;;AAIO,MAAMA,uBAAuB,CAACC,UAAAA,GAAAA;;AAEnC,IAAA,MAAM,EAAEC,MAAM,EAAE,GAAGC,aAAAA,EAAe,GAAGC,EAAAA,CAAGC,gCAAgC,CACtEJ,UAAAA,EACAK,SAAAA,EACAF,EAAAA,CAAGG,GAAG,CAAA;;;IAKR,IAAIL,MAAAA,CAAOM,MAAM,GAAG,CAAA,EAAG;QACrBC,iBAAAA,CAAkBP,MAAAA,CAAAA;AAClBQ,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;IAEA,OAAOR,aAAAA;AACT;;;;"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets the outDir value from config file (tsconfig)
3
+ */
4
+ export declare const resolveOutDirSync: (dir: string, configFilename?: string) => string | undefined;
5
+ //# sourceMappingURL=resolve-outdir-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir-sync.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-outdir-sync.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,EACX,iBAAgB,MAAmC,KAClD,MAAM,GAAG,SAIX,CAAC"}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var path = require('node:path');
4
+ var resolveConfigOptions = require('./resolve-config-options.js');
5
+ var isUsingTypescriptSync = require('./is-using-typescript-sync.js');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
12
+ /**
13
+ * Gets the outDir value from config file (tsconfig)
14
+ */ const resolveOutDirSync = (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME)=>{
15
+ return isUsingTypescriptSync.isUsingTypeScriptSync(dir) ? resolveConfigOptions.resolveConfigOptions(path__default.default.join(dir, configFilename)).options.outDir : undefined;
16
+ };
17
+
18
+ exports.resolveOutDirSync = resolveOutDirSync;
19
+ //# sourceMappingURL=resolve-outdir-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir-sync.js","sources":["../../src/utils/resolve-outdir-sync.ts"],"sourcesContent":["import path from 'node:path';\nimport { resolveConfigOptions } from './resolve-config-options';\nimport { isUsingTypeScriptSync } from './is-using-typescript-sync';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n/**\n * Gets the outDir value from config file (tsconfig)\n */\nexport const resolveOutDirSync = (\n dir: string,\n configFilename: string = DEFAULT_TS_CONFIG_FILENAME\n): string | undefined => {\n return isUsingTypeScriptSync(dir)\n ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir\n : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","resolveOutDirSync","dir","configFilename","isUsingTypeScriptSync","resolveConfigOptions","path","join","options","outDir","undefined"],"mappings":";;;;;;;;;;AAIA,MAAMA,0BAAAA,GAA6B,eAAA;AACnC;;AAEC,IACM,MAAMC,iBAAAA,GAAoB,CAC/BC,GAAAA,EACAC,iBAAyBH,0BAA0B,GAAA;IAEnD,OAAOI,2CAAAA,CAAsBF,GAAAA,CAAAA,GACzBG,yCAAAA,CAAqBC,qBAAAA,CAAKC,IAAI,CAACL,GAAAA,EAAKC,cAAAA,CAAAA,CAAAA,CAAiBK,OAAO,CAACC,MAAM,GACnEC,SAAAA;AACN;;;;"}
@@ -0,0 +1,13 @@
1
+ import path from 'node:path';
2
+ import { resolveConfigOptions } from './resolve-config-options.mjs';
3
+ import { isUsingTypeScriptSync } from './is-using-typescript-sync.mjs';
4
+
5
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
6
+ /**
7
+ * Gets the outDir value from config file (tsconfig)
8
+ */ const resolveOutDirSync = (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME)=>{
9
+ return isUsingTypeScriptSync(dir) ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir : undefined;
10
+ };
11
+
12
+ export { resolveOutDirSync };
13
+ //# sourceMappingURL=resolve-outdir-sync.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir-sync.mjs","sources":["../../src/utils/resolve-outdir-sync.ts"],"sourcesContent":["import path from 'node:path';\nimport { resolveConfigOptions } from './resolve-config-options';\nimport { isUsingTypeScriptSync } from './is-using-typescript-sync';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n/**\n * Gets the outDir value from config file (tsconfig)\n */\nexport const resolveOutDirSync = (\n dir: string,\n configFilename: string = DEFAULT_TS_CONFIG_FILENAME\n): string | undefined => {\n return isUsingTypeScriptSync(dir)\n ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir\n : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","resolveOutDirSync","dir","configFilename","isUsingTypeScriptSync","resolveConfigOptions","path","join","options","outDir","undefined"],"mappings":";;;;AAIA,MAAMA,0BAAAA,GAA6B,eAAA;AACnC;;AAEC,IACM,MAAMC,iBAAAA,GAAoB,CAC/BC,GAAAA,EACAC,iBAAyBH,0BAA0B,GAAA;IAEnD,OAAOI,qBAAAA,CAAsBF,GAAAA,CAAAA,GACzBG,oBAAAA,CAAqBC,IAAAA,CAAKC,IAAI,CAACL,GAAAA,EAAKC,cAAAA,CAAAA,CAAAA,CAAiBK,OAAO,CAACC,MAAM,GACnEC,SAAAA;AACN;;;;"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Gets the outDir value from config file (tsconfig)
3
+ */
4
+ export declare const resolveOutDir: (dir: string, configFilename?: string) => Promise<string | undefined>;
5
+ //# sourceMappingURL=resolve-outdir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-outdir.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,MAAM,EACX,iBAAgB,MAAmC,KAClD,OAAO,CAAC,MAAM,GAAG,SAAS,CAI5B,CAAC"}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var path = require('node:path');
4
+ var resolveConfigOptions = require('./resolve-config-options.js');
5
+ var isUsingTypescript = require('./is-using-typescript.js');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
12
+ /**
13
+ * Gets the outDir value from config file (tsconfig)
14
+ */ const resolveOutDir = async (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME)=>{
15
+ return await isUsingTypescript.isUsingTypeScript(dir) ? resolveConfigOptions.resolveConfigOptions(path__default.default.join(dir, configFilename)).options.outDir : undefined;
16
+ };
17
+
18
+ exports.resolveOutDir = resolveOutDir;
19
+ //# sourceMappingURL=resolve-outdir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir.js","sources":["../../src/utils/resolve-outdir.ts"],"sourcesContent":["import path from 'node:path';\nimport { resolveConfigOptions } from './resolve-config-options';\nimport { isUsingTypeScript } from './is-using-typescript';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n/**\n * Gets the outDir value from config file (tsconfig)\n */\nexport const resolveOutDir = async (\n dir: string,\n configFilename: string = DEFAULT_TS_CONFIG_FILENAME\n): Promise<string | undefined> => {\n return (await isUsingTypeScript(dir))\n ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir\n : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","resolveOutDir","dir","configFilename","isUsingTypeScript","resolveConfigOptions","path","join","options","outDir","undefined"],"mappings":";;;;;;;;;;AAIA,MAAMA,0BAAAA,GAA6B,eAAA;AACnC;;AAEC,IACM,MAAMC,aAAAA,GAAgB,OAC3BC,GAAAA,EACAC,iBAAyBH,0BAA0B,GAAA;AAEnD,IAAA,OAAO,MAAOI,mCAAAA,CAAkBF,GAAAA,CAAAA,GAC5BG,yCAAAA,CAAqBC,qBAAAA,CAAKC,IAAI,CAACL,GAAAA,EAAKC,cAAAA,CAAAA,CAAAA,CAAiBK,OAAO,CAACC,MAAM,GACnEC,SAAAA;AACN;;;;"}
@@ -0,0 +1,13 @@
1
+ import path from 'node:path';
2
+ import { resolveConfigOptions } from './resolve-config-options.mjs';
3
+ import { isUsingTypeScript } from './is-using-typescript.mjs';
4
+
5
+ const DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';
6
+ /**
7
+ * Gets the outDir value from config file (tsconfig)
8
+ */ const resolveOutDir = async (dir, configFilename = DEFAULT_TS_CONFIG_FILENAME)=>{
9
+ return await isUsingTypeScript(dir) ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir : undefined;
10
+ };
11
+
12
+ export { resolveOutDir };
13
+ //# sourceMappingURL=resolve-outdir.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-outdir.mjs","sources":["../../src/utils/resolve-outdir.ts"],"sourcesContent":["import path from 'node:path';\nimport { resolveConfigOptions } from './resolve-config-options';\nimport { isUsingTypeScript } from './is-using-typescript';\n\nconst DEFAULT_TS_CONFIG_FILENAME = 'tsconfig.json';\n/**\n * Gets the outDir value from config file (tsconfig)\n */\nexport const resolveOutDir = async (\n dir: string,\n configFilename: string = DEFAULT_TS_CONFIG_FILENAME\n): Promise<string | undefined> => {\n return (await isUsingTypeScript(dir))\n ? resolveConfigOptions(path.join(dir, configFilename)).options.outDir\n : undefined;\n};\n"],"names":["DEFAULT_TS_CONFIG_FILENAME","resolveOutDir","dir","configFilename","isUsingTypeScript","resolveConfigOptions","path","join","options","outDir","undefined"],"mappings":";;;;AAIA,MAAMA,0BAAAA,GAA6B,eAAA;AACnC;;AAEC,IACM,MAAMC,aAAAA,GAAgB,OAC3BC,GAAAA,EACAC,iBAAyBH,0BAA0B,GAAA;AAEnD,IAAA,OAAO,MAAOI,iBAAAA,CAAkBF,GAAAA,CAAAA,GAC5BG,oBAAAA,CAAqBC,IAAAA,CAAKC,IAAI,CAACL,GAAAA,EAAKC,cAAAA,CAAAA,CAAAA,CAAiBK,OAAO,CAACC,MAAM,GACnEC,SAAAA;AACN;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/typescript-utils",
3
- "version": "5.50.0",
3
+ "version": "5.50.2",
4
4
  "description": "Typescript support for Strapi",
5
5
  "keywords": [
6
6
  "strapi",
@@ -28,15 +28,24 @@
28
28
  "url": "https://strapi.io"
29
29
  }
30
30
  ],
31
- "main": "./lib/index.js",
32
- "types": "index.d.ts",
33
- "directories": {
34
- "lib": "./lib"
35
- },
31
+ "main": "./dist/index.js",
32
+ "module": "./dist/index.mjs",
33
+ "source": "./src/index.ts",
34
+ "types": "./dist/index.d.ts",
35
+ "files": [
36
+ "dist/",
37
+ "tsconfigs/"
38
+ ],
36
39
  "scripts": {
37
- "lint": "run -T eslint .",
38
- "test": "run -T jest",
39
- "test:watch": "run -T jest --watch"
40
+ "build": "run -T npm-run-all clean --parallel build:code build:types",
41
+ "build:code": "run -T rollup -c",
42
+ "build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
43
+ "clean": "run -T rimraf dist",
44
+ "lint": "run -T eslint . --max-warnings=0",
45
+ "test:ts": "run -T tsc --noEmit",
46
+ "test:unit": "run -T jest",
47
+ "test:unit:watch": "run -T jest --watch",
48
+ "watch": "run -T rollup -c -w"
40
49
  },
41
50
  "dependencies": {
42
51
  "chalk": "4.1.2",
@@ -47,7 +56,13 @@
47
56
  "typescript": "5.9.3"
48
57
  },
49
58
  "devDependencies": {
50
- "@types/fs-extra": "11.0.4"
59
+ "@types/fs-extra": "11.0.4",
60
+ "@types/jest": "29.5.2",
61
+ "@types/lodash": "^4.14.191",
62
+ "@types/node": "20.19.41",
63
+ "eslint-config-custom": "5.50.2",
64
+ "jest": "29.6.0",
65
+ "tsconfig": "5.50.2"
51
66
  },
52
67
  "engines": {
53
68
  "node": ">=20.0.0 <=26.x.x",
package/.eslintrc.cjs DELETED
@@ -1,16 +0,0 @@
1
- // @ts-check
2
-
3
- /** @type {import('eslint').Linter.Config} */
4
- const config = {
5
- root: true,
6
- extends: ['eslint-config-custom/back'],
7
- ignorePatterns: [
8
- 'node_modules/',
9
- '.eslintrc.cjs',
10
- 'index.d.ts',
11
- 'coverage/',
12
- 'lint-staged.config.mjs',
13
- ],
14
- };
15
-
16
- module.exports = config;
package/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- // FIXME: to remove when migrating this package to ts
2
- declare module '@strapi/typescript-utils' {
3
- const utils: any;
4
- export = utils;
5
- }
package/jest.config.js DELETED
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- preset: '../../../jest-preset.unit.js',
5
- displayName: 'Typescript utils',
6
- };