@strapi/strapi 5.12.1 → 5.12.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 (263) hide show
  1. package/dist/cli.js +89 -45
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +90 -42
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/package.json.js +6 -0
  6. package/dist/package.json.js.map +1 -0
  7. package/dist/package.json.mjs +4 -0
  8. package/dist/package.json.mjs.map +1 -0
  9. package/dist/src/cli/commands/admin/create-user.js +124 -0
  10. package/dist/src/cli/commands/admin/create-user.js.map +1 -0
  11. package/dist/src/cli/commands/admin/create-user.mjs +121 -0
  12. package/dist/src/cli/commands/admin/create-user.mjs.map +1 -0
  13. package/dist/src/cli/commands/admin/reset-user-password.js +61 -0
  14. package/dist/src/cli/commands/admin/reset-user-password.js.map +1 -0
  15. package/dist/src/cli/commands/admin/reset-user-password.mjs +58 -0
  16. package/dist/src/cli/commands/admin/reset-user-password.mjs.map +1 -0
  17. package/dist/src/cli/commands/build.js +29 -0
  18. package/dist/src/cli/commands/build.js.map +1 -0
  19. package/dist/src/cli/commands/build.mjs +27 -0
  20. package/dist/src/cli/commands/build.mjs.map +1 -0
  21. package/dist/src/cli/commands/components/list.js +32 -0
  22. package/dist/src/cli/commands/components/list.js.map +1 -0
  23. package/dist/src/cli/commands/components/list.mjs +29 -0
  24. package/dist/src/cli/commands/components/list.mjs.map +1 -0
  25. package/dist/src/cli/commands/configuration/dump.js +53 -0
  26. package/dist/src/cli/commands/configuration/dump.js.map +1 -0
  27. package/dist/src/cli/commands/configuration/dump.mjs +50 -0
  28. package/dist/src/cli/commands/configuration/dump.mjs.map +1 -0
  29. package/dist/src/cli/commands/configuration/restore.js +173 -0
  30. package/dist/src/cli/commands/configuration/restore.js.map +1 -0
  31. package/dist/src/cli/commands/configuration/restore.mjs +170 -0
  32. package/dist/src/cli/commands/configuration/restore.mjs.map +1 -0
  33. package/dist/src/cli/commands/console.js +31 -0
  34. package/dist/src/cli/commands/console.js.map +1 -0
  35. package/dist/src/cli/commands/console.mjs +28 -0
  36. package/dist/src/cli/commands/console.mjs.map +1 -0
  37. package/dist/src/cli/commands/content-types/list.js +32 -0
  38. package/dist/src/cli/commands/content-types/list.js.map +1 -0
  39. package/dist/src/cli/commands/content-types/list.mjs +29 -0
  40. package/dist/src/cli/commands/content-types/list.mjs.map +1 -0
  41. package/dist/src/cli/commands/controllers/list.js +32 -0
  42. package/dist/src/cli/commands/controllers/list.js.map +1 -0
  43. package/dist/src/cli/commands/controllers/list.mjs +29 -0
  44. package/dist/src/cli/commands/controllers/list.mjs.map +1 -0
  45. package/dist/src/cli/commands/develop.js +32 -0
  46. package/dist/src/cli/commands/develop.js.map +1 -0
  47. package/dist/src/cli/commands/develop.mjs +30 -0
  48. package/dist/src/cli/commands/develop.mjs.map +1 -0
  49. package/dist/src/cli/commands/export/action.js +126 -0
  50. package/dist/src/cli/commands/export/action.js.map +1 -0
  51. package/dist/src/cli/commands/export/action.mjs +124 -0
  52. package/dist/src/cli/commands/export/action.mjs.map +1 -0
  53. package/dist/src/cli/commands/export/command.js +15 -0
  54. package/dist/src/cli/commands/export/command.js.map +1 -0
  55. package/dist/src/cli/commands/export/command.mjs +13 -0
  56. package/dist/src/cli/commands/export/command.mjs.map +1 -0
  57. package/dist/src/cli/commands/generate.js +18 -0
  58. package/dist/src/cli/commands/generate.js.map +1 -0
  59. package/dist/src/cli/commands/generate.mjs +16 -0
  60. package/dist/src/cli/commands/generate.mjs.map +1 -0
  61. package/dist/src/cli/commands/hooks/list.js +32 -0
  62. package/dist/src/cli/commands/hooks/list.js.map +1 -0
  63. package/dist/src/cli/commands/hooks/list.mjs +29 -0
  64. package/dist/src/cli/commands/hooks/list.mjs.map +1 -0
  65. package/dist/src/cli/commands/import/action.js +124 -0
  66. package/dist/src/cli/commands/import/action.js.map +1 -0
  67. package/dist/src/cli/commands/import/action.mjs +122 -0
  68. package/dist/src/cli/commands/import/action.mjs.map +1 -0
  69. package/dist/src/cli/commands/import/command.js +59 -0
  70. package/dist/src/cli/commands/import/command.js.map +1 -0
  71. package/dist/src/cli/commands/import/command.mjs +57 -0
  72. package/dist/src/cli/commands/import/command.mjs.map +1 -0
  73. package/dist/src/cli/commands/index.js +64 -0
  74. package/dist/src/cli/commands/index.js.map +1 -0
  75. package/dist/src/cli/commands/index.mjs +62 -0
  76. package/dist/src/cli/commands/index.mjs.map +1 -0
  77. package/dist/src/cli/commands/middlewares/list.js +32 -0
  78. package/dist/src/cli/commands/middlewares/list.js.map +1 -0
  79. package/dist/src/cli/commands/middlewares/list.mjs +29 -0
  80. package/dist/src/cli/commands/middlewares/list.mjs.map +1 -0
  81. package/dist/src/cli/commands/policies/list.js +32 -0
  82. package/dist/src/cli/commands/policies/list.js.map +1 -0
  83. package/dist/src/cli/commands/policies/list.mjs +29 -0
  84. package/dist/src/cli/commands/policies/list.mjs.map +1 -0
  85. package/dist/src/cli/commands/report.js +39 -0
  86. package/dist/src/cli/commands/report.js.map +1 -0
  87. package/dist/src/cli/commands/report.mjs +37 -0
  88. package/dist/src/cli/commands/report.mjs.map +1 -0
  89. package/dist/src/cli/commands/routes/list.js +40 -0
  90. package/dist/src/cli/commands/routes/list.js.map +1 -0
  91. package/dist/src/cli/commands/routes/list.mjs +37 -0
  92. package/dist/src/cli/commands/routes/list.mjs.map +1 -0
  93. package/dist/src/cli/commands/services/list.js +32 -0
  94. package/dist/src/cli/commands/services/list.js.map +1 -0
  95. package/dist/src/cli/commands/services/list.mjs +29 -0
  96. package/dist/src/cli/commands/services/list.mjs.map +1 -0
  97. package/dist/src/cli/commands/start.js +28 -0
  98. package/dist/src/cli/commands/start.js.map +1 -0
  99. package/dist/src/cli/commands/start.mjs +26 -0
  100. package/dist/src/cli/commands/start.mjs.map +1 -0
  101. package/dist/src/cli/commands/telemetry/disable.js +72 -0
  102. package/dist/src/cli/commands/telemetry/disable.js.map +1 -0
  103. package/dist/src/cli/commands/telemetry/disable.mjs +69 -0
  104. package/dist/src/cli/commands/telemetry/disable.mjs.map +1 -0
  105. package/dist/src/cli/commands/telemetry/enable.js +88 -0
  106. package/dist/src/cli/commands/telemetry/enable.js.map +1 -0
  107. package/dist/src/cli/commands/telemetry/enable.mjs +85 -0
  108. package/dist/src/cli/commands/telemetry/enable.mjs.map +1 -0
  109. package/dist/src/cli/commands/templates/generate.js +15 -0
  110. package/dist/src/cli/commands/templates/generate.js.map +1 -0
  111. package/dist/src/cli/commands/templates/generate.mjs +13 -0
  112. package/dist/src/cli/commands/templates/generate.mjs.map +1 -0
  113. package/dist/src/cli/commands/transfer/action.js +141 -0
  114. package/dist/src/cli/commands/transfer/action.js.map +1 -0
  115. package/dist/src/cli/commands/transfer/action.mjs +139 -0
  116. package/dist/src/cli/commands/transfer/action.mjs.map +1 -0
  117. package/dist/src/cli/commands/transfer/command.js +61 -0
  118. package/dist/src/cli/commands/transfer/command.js.map +1 -0
  119. package/dist/src/cli/commands/transfer/command.mjs +59 -0
  120. package/dist/src/cli/commands/transfer/command.mjs.map +1 -0
  121. package/dist/src/cli/commands/ts/generate-types.js +40 -0
  122. package/dist/src/cli/commands/ts/generate-types.js.map +1 -0
  123. package/dist/src/cli/commands/ts/generate-types.mjs +37 -0
  124. package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -0
  125. package/dist/src/cli/commands/version.js +17 -0
  126. package/dist/src/cli/commands/version.js.map +1 -0
  127. package/dist/src/cli/commands/version.mjs +15 -0
  128. package/dist/src/cli/commands/version.mjs.map +1 -0
  129. package/dist/src/cli/utils/commander.js +125 -0
  130. package/dist/src/cli/utils/commander.js.map +1 -0
  131. package/dist/src/cli/utils/commander.mjs +116 -0
  132. package/dist/src/cli/utils/commander.mjs.map +1 -0
  133. package/dist/src/cli/utils/data-transfer.js +378 -0
  134. package/dist/src/cli/utils/data-transfer.js.map +1 -0
  135. package/dist/src/cli/utils/data-transfer.mjs +359 -0
  136. package/dist/src/cli/utils/data-transfer.mjs.map +1 -0
  137. package/dist/src/cli/utils/helpers.js +114 -0
  138. package/dist/src/cli/utils/helpers.js.map +1 -0
  139. package/dist/src/cli/utils/helpers.mjs +107 -0
  140. package/dist/src/cli/utils/helpers.mjs.map +1 -0
  141. package/dist/src/cli/utils/logger.js +125 -0
  142. package/dist/src/cli/utils/logger.js.map +1 -0
  143. package/dist/src/cli/utils/logger.mjs +104 -0
  144. package/dist/src/cli/utils/logger.mjs.map +1 -0
  145. package/dist/src/cli/utils/telemetry.js +27 -0
  146. package/dist/src/cli/utils/telemetry.js.map +1 -0
  147. package/dist/src/cli/utils/telemetry.mjs +25 -0
  148. package/dist/src/cli/utils/telemetry.mjs.map +1 -0
  149. package/dist/src/cli/utils/tsconfig.js +25 -0
  150. package/dist/src/cli/utils/tsconfig.js.map +1 -0
  151. package/dist/src/cli/utils/tsconfig.mjs +23 -0
  152. package/dist/src/cli/utils/tsconfig.mjs.map +1 -0
  153. package/dist/src/node/build.js +90 -0
  154. package/dist/src/node/build.js.map +1 -0
  155. package/dist/src/node/build.mjs +69 -0
  156. package/dist/src/node/build.mjs.map +1 -0
  157. package/dist/src/node/core/admin-customisations.js +27 -0
  158. package/dist/src/node/core/admin-customisations.js.map +1 -0
  159. package/dist/src/node/core/admin-customisations.mjs +25 -0
  160. package/dist/src/node/core/admin-customisations.mjs.map +1 -0
  161. package/dist/{chunks/aliases-BkD9BImE.js → src/node/core/aliases.js} +3 -42
  162. package/dist/src/node/core/aliases.js.map +1 -0
  163. package/dist/{chunks/aliases-CZgVGGH9.mjs → src/node/core/aliases.mjs} +4 -41
  164. package/dist/src/node/core/aliases.mjs.map +1 -0
  165. package/dist/src/node/core/config.js +18 -0
  166. package/dist/src/node/core/config.js.map +1 -0
  167. package/dist/src/node/core/config.mjs +16 -0
  168. package/dist/src/node/core/config.mjs.map +1 -0
  169. package/dist/src/node/core/dependencies.js +186 -0
  170. package/dist/src/node/core/dependencies.js.map +1 -0
  171. package/dist/src/node/core/dependencies.mjs +183 -0
  172. package/dist/src/node/core/dependencies.mjs.map +1 -0
  173. package/dist/src/node/core/env.js +32 -0
  174. package/dist/src/node/core/env.js.map +1 -0
  175. package/dist/src/node/core/env.mjs +29 -0
  176. package/dist/src/node/core/env.mjs.map +1 -0
  177. package/dist/src/node/core/errors.js +51 -0
  178. package/dist/src/node/core/errors.js.map +1 -0
  179. package/dist/src/node/core/errors.mjs +48 -0
  180. package/dist/src/node/core/errors.mjs.map +1 -0
  181. package/dist/src/node/core/files.js +68 -0
  182. package/dist/src/node/core/files.js.map +1 -0
  183. package/dist/src/node/core/files.mjs +63 -0
  184. package/dist/src/node/core/files.mjs.map +1 -0
  185. package/dist/src/node/core/managers.js +27 -0
  186. package/dist/src/node/core/managers.js.map +1 -0
  187. package/dist/src/node/core/managers.mjs +25 -0
  188. package/dist/src/node/core/managers.mjs.map +1 -0
  189. package/dist/src/node/core/monorepo.js +30 -0
  190. package/dist/src/node/core/monorepo.js.map +1 -0
  191. package/dist/src/node/core/monorepo.mjs +28 -0
  192. package/dist/src/node/core/monorepo.mjs.map +1 -0
  193. package/dist/src/node/core/plugins.js +140 -0
  194. package/dist/src/node/core/plugins.js.map +1 -0
  195. package/dist/src/node/core/plugins.mjs +137 -0
  196. package/dist/src/node/core/plugins.mjs.map +1 -0
  197. package/dist/src/node/core/timer.js +33 -0
  198. package/dist/src/node/core/timer.js.map +1 -0
  199. package/dist/src/node/core/timer.mjs +30 -0
  200. package/dist/src/node/core/timer.mjs.map +1 -0
  201. package/dist/src/node/create-build-context.js +111 -0
  202. package/dist/src/node/create-build-context.js.map +1 -0
  203. package/dist/src/node/create-build-context.mjs +109 -0
  204. package/dist/src/node/create-build-context.mjs.map +1 -0
  205. package/dist/src/node/develop.js +312 -0
  206. package/dist/src/node/develop.js.map +1 -0
  207. package/dist/src/node/develop.mjs +291 -0
  208. package/dist/src/node/develop.mjs.map +1 -0
  209. package/dist/src/node/staticFiles.js +81 -0
  210. package/dist/src/node/staticFiles.js.map +1 -0
  211. package/dist/src/node/staticFiles.mjs +78 -0
  212. package/dist/src/node/staticFiles.mjs.map +1 -0
  213. package/dist/src/node/vite/build.js +14 -0
  214. package/dist/src/node/vite/build.js.map +1 -0
  215. package/dist/src/node/vite/build.mjs +12 -0
  216. package/dist/src/node/vite/build.mjs.map +1 -0
  217. package/dist/{chunks/config-D3Y5s3ui.js → src/node/vite/config.js} +12 -50
  218. package/dist/src/node/vite/config.js.map +1 -0
  219. package/dist/{chunks/config-BFUn1raM.mjs → src/node/vite/config.mjs} +6 -44
  220. package/dist/src/node/vite/config.mjs.map +1 -0
  221. package/dist/src/node/vite/plugins.js +46 -0
  222. package/dist/src/node/vite/plugins.js.map +1 -0
  223. package/dist/src/node/vite/plugins.mjs +44 -0
  224. package/dist/src/node/vite/plugins.mjs.map +1 -0
  225. package/dist/{chunks/watch-gkyBsmAJ.js → src/node/vite/watch.js} +2 -45
  226. package/dist/src/node/vite/watch.js.map +1 -0
  227. package/dist/{chunks/watch-DUnlAAiK.mjs → src/node/vite/watch.mjs} +2 -45
  228. package/dist/src/node/vite/watch.mjs.map +1 -0
  229. package/dist/src/node/webpack/build.js +37 -0
  230. package/dist/src/node/webpack/build.js.map +1 -0
  231. package/dist/src/node/webpack/build.mjs +35 -0
  232. package/dist/src/node/webpack/build.mjs.map +1 -0
  233. package/dist/{chunks/config-Bcu3_xSp.js → src/node/webpack/config.js} +10 -8
  234. package/dist/src/node/webpack/config.js.map +1 -0
  235. package/dist/{chunks/config-DKpJU9io.mjs → src/node/webpack/config.mjs} +5 -3
  236. package/dist/src/node/webpack/config.mjs.map +1 -0
  237. package/dist/{chunks/watch-CNfkm7Fm.js → src/node/webpack/watch.js} +2 -51
  238. package/dist/src/node/webpack/watch.js.map +1 -0
  239. package/dist/{chunks/watch-BEC39t49.mjs → src/node/webpack/watch.mjs} +2 -51
  240. package/dist/src/node/webpack/watch.mjs.map +1 -0
  241. package/package.json +22 -22
  242. package/dist/chunks/aliases-BkD9BImE.js.map +0 -1
  243. package/dist/chunks/aliases-CZgVGGH9.mjs.map +0 -1
  244. package/dist/chunks/build-B6f5SABm.js +0 -87
  245. package/dist/chunks/build-B6f5SABm.js.map +0 -1
  246. package/dist/chunks/build-BQc6C2UF.mjs +0 -85
  247. package/dist/chunks/build-BQc6C2UF.mjs.map +0 -1
  248. package/dist/chunks/build-C4qN5x5L.js +0 -59
  249. package/dist/chunks/build-C4qN5x5L.js.map +0 -1
  250. package/dist/chunks/build-D6MP0Rwu.mjs +0 -57
  251. package/dist/chunks/build-D6MP0Rwu.mjs.map +0 -1
  252. package/dist/chunks/config-BFUn1raM.mjs.map +0 -1
  253. package/dist/chunks/config-Bcu3_xSp.js.map +0 -1
  254. package/dist/chunks/config-D3Y5s3ui.js.map +0 -1
  255. package/dist/chunks/config-DKpJU9io.mjs.map +0 -1
  256. package/dist/chunks/index-DGhshfMs.mjs +0 -3160
  257. package/dist/chunks/index-DGhshfMs.mjs.map +0 -1
  258. package/dist/chunks/index-DW2NjgW9.js +0 -3185
  259. package/dist/chunks/index-DW2NjgW9.js.map +0 -1
  260. package/dist/chunks/watch-BEC39t49.mjs.map +0 -1
  261. package/dist/chunks/watch-CNfkm7Fm.js.map +0 -1
  262. package/dist/chunks/watch-DUnlAAiK.mjs.map +0 -1
  263. package/dist/chunks/watch-gkyBsmAJ.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var readPkgUp = require('read-pkg-up');
5
+
6
+ /**
7
+ * Load information about the strapi CMS monorepo (if applicable)
8
+ *
9
+ * @internal
10
+ */ async function loadStrapiMonorepo(cwd) {
11
+ let p = cwd;
12
+ while(p !== '/'){
13
+ const readResult = await readPkgUp({
14
+ cwd: p
15
+ });
16
+ if (!readResult) {
17
+ return undefined;
18
+ }
19
+ if (readResult.packageJson.isStrapiMonorepo) {
20
+ return {
21
+ path: path.dirname(readResult.path)
22
+ };
23
+ }
24
+ p = path.dirname(path.dirname(readResult.path));
25
+ }
26
+ return undefined;
27
+ }
28
+
29
+ exports.loadStrapiMonorepo = loadStrapiMonorepo;
30
+ //# sourceMappingURL=monorepo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monorepo.js","sources":["../../../../src/node/core/monorepo.ts"],"sourcesContent":["import path from 'path';\nimport readPkgUp from 'read-pkg-up';\n\ninterface StrapiMonorepo {\n path: string;\n}\n\n/**\n * Load information about the strapi CMS monorepo (if applicable)\n *\n * @internal\n */\nasync function loadStrapiMonorepo(cwd: string): Promise<StrapiMonorepo | undefined> {\n let p = cwd;\n\n while (p !== '/') {\n const readResult = await readPkgUp({ cwd: p });\n\n if (!readResult) {\n return undefined;\n }\n\n if (readResult.packageJson.isStrapiMonorepo) {\n return { path: path.dirname(readResult.path) };\n }\n\n p = path.dirname(path.dirname(readResult.path));\n }\n\n return undefined;\n}\n\nexport { loadStrapiMonorepo };\nexport type { StrapiMonorepo };\n"],"names":["loadStrapiMonorepo","cwd","p","readResult","readPkgUp","undefined","packageJson","isStrapiMonorepo","path","dirname"],"mappings":";;;;;AAOA;;;;IAKA,eAAeA,mBAAmBC,GAAW,EAAA;AAC3C,IAAA,IAAIC,CAAID,GAAAA,GAAAA;AAER,IAAA,MAAOC,MAAM,GAAK,CAAA;QAChB,MAAMC,UAAAA,GAAa,MAAMC,SAAU,CAAA;YAAEH,GAAKC,EAAAA;AAAE,SAAA,CAAA;AAE5C,QAAA,IAAI,CAACC,UAAY,EAAA;YACf,OAAOE,SAAAA;AACT;AAEA,QAAA,IAAIF,UAAWG,CAAAA,WAAW,CAACC,gBAAgB,EAAE;YAC3C,OAAO;AAAEC,gBAAAA,IAAAA,EAAMA,IAAKC,CAAAA,OAAO,CAACN,UAAAA,CAAWK,IAAI;AAAE,aAAA;AAC/C;AAEAN,QAAAA,CAAAA,GAAIM,KAAKC,OAAO,CAACD,KAAKC,OAAO,CAACN,WAAWK,IAAI,CAAA,CAAA;AAC/C;IAEA,OAAOH,SAAAA;AACT;;;;"}
@@ -0,0 +1,28 @@
1
+ import path from 'path';
2
+ import readPkgUp from 'read-pkg-up';
3
+
4
+ /**
5
+ * Load information about the strapi CMS monorepo (if applicable)
6
+ *
7
+ * @internal
8
+ */ async function loadStrapiMonorepo(cwd) {
9
+ let p = cwd;
10
+ while(p !== '/'){
11
+ const readResult = await readPkgUp({
12
+ cwd: p
13
+ });
14
+ if (!readResult) {
15
+ return undefined;
16
+ }
17
+ if (readResult.packageJson.isStrapiMonorepo) {
18
+ return {
19
+ path: path.dirname(readResult.path)
20
+ };
21
+ }
22
+ p = path.dirname(path.dirname(readResult.path));
23
+ }
24
+ return undefined;
25
+ }
26
+
27
+ export { loadStrapiMonorepo };
28
+ //# sourceMappingURL=monorepo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monorepo.mjs","sources":["../../../../src/node/core/monorepo.ts"],"sourcesContent":["import path from 'path';\nimport readPkgUp from 'read-pkg-up';\n\ninterface StrapiMonorepo {\n path: string;\n}\n\n/**\n * Load information about the strapi CMS monorepo (if applicable)\n *\n * @internal\n */\nasync function loadStrapiMonorepo(cwd: string): Promise<StrapiMonorepo | undefined> {\n let p = cwd;\n\n while (p !== '/') {\n const readResult = await readPkgUp({ cwd: p });\n\n if (!readResult) {\n return undefined;\n }\n\n if (readResult.packageJson.isStrapiMonorepo) {\n return { path: path.dirname(readResult.path) };\n }\n\n p = path.dirname(path.dirname(readResult.path));\n }\n\n return undefined;\n}\n\nexport { loadStrapiMonorepo };\nexport type { StrapiMonorepo };\n"],"names":["loadStrapiMonorepo","cwd","p","readResult","readPkgUp","undefined","packageJson","isStrapiMonorepo","path","dirname"],"mappings":";;;AAOA;;;;IAKA,eAAeA,mBAAmBC,GAAW,EAAA;AAC3C,IAAA,IAAIC,CAAID,GAAAA,GAAAA;AAER,IAAA,MAAOC,MAAM,GAAK,CAAA;QAChB,MAAMC,UAAAA,GAAa,MAAMC,SAAU,CAAA;YAAEH,GAAKC,EAAAA;AAAE,SAAA,CAAA;AAE5C,QAAA,IAAI,CAACC,UAAY,EAAA;YACf,OAAOE,SAAAA;AACT;AAEA,QAAA,IAAIF,UAAWG,CAAAA,WAAW,CAACC,gBAAgB,EAAE;YAC3C,OAAO;AAAEC,gBAAAA,IAAAA,EAAMA,IAAKC,CAAAA,OAAO,CAACN,UAAAA,CAAWK,IAAI;AAAE,aAAA;AAC/C;AAEAN,QAAAA,CAAAA,GAAIM,KAAKC,OAAO,CAACD,KAAKC,OAAO,CAACN,WAAWK,IAAI,CAAA,CAAA;AAC/C;IAEA,OAAOH,SAAAA;AACT;;;;"}
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ var os = require('node:os');
4
+ var path = require('node:path');
5
+ var fs = require('node:fs');
6
+ var camelCase = require('lodash/camelCase');
7
+ var utils = require('@strapi/utils');
8
+ var dependencies = require('./dependencies.js');
9
+ var files = require('./files.js');
10
+ var errors = require('./errors.js');
11
+
12
+ const validatePackageHasStrapi = (pkg)=>'strapi' in pkg && typeof pkg.strapi === 'object' && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
13
+ const validatePackageIsPlugin = (pkg)=>validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';
14
+ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
15
+ const plugins = {};
16
+ /**
17
+ * This is the list of dependencies that are installed in the user's project.
18
+ * It will include libraries like "react", so we need to collect the ones that
19
+ * are plugins.
20
+ */ const deps = strapi.config.get('info.dependencies', {});
21
+ logger.debug("Dependencies from user's project", os.EOL, deps);
22
+ for (const dep of Object.keys(deps)){
23
+ const pkg = await dependencies.getModule(dep, cwd);
24
+ if (pkg && validatePackageIsPlugin(pkg)) {
25
+ const name = pkg.strapi.name || pkg.name;
26
+ if (!name) {
27
+ /**
28
+ * Unlikely to happen, but you never know.
29
+ */ throw Error("You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!");
30
+ }
31
+ plugins[name] = {
32
+ name,
33
+ importName: camelCase(name),
34
+ type: 'module',
35
+ modulePath: dep
36
+ };
37
+ }
38
+ }
39
+ const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
40
+ logger.debug("User's plugins file", os.EOL, userPluginsFile);
41
+ for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)){
42
+ if (userPluginConfig.enabled && userPluginConfig.resolve) {
43
+ const sysPath = files.convertModulePathToSystemPath(userPluginConfig.resolve);
44
+ plugins[userPluginName] = {
45
+ name: userPluginName,
46
+ importName: camelCase(userPluginName),
47
+ type: 'local',
48
+ /**
49
+ * User plugin paths are resolved from the entry point
50
+ * of the app, because that's how you import them.
51
+ */ modulePath: files.convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),
52
+ path: sysPath
53
+ };
54
+ }
55
+ }
56
+ return plugins;
57
+ };
58
+ const PLUGIN_CONFIGS = [
59
+ 'plugins.js',
60
+ 'plugins.mjs',
61
+ 'plugins.ts'
62
+ ];
63
+ const loadUserPluginsFile = async (root)=>{
64
+ for (const file of PLUGIN_CONFIGS){
65
+ const filePath = path.join(root, file);
66
+ const configFile = await files.loadFile(filePath);
67
+ if (configFile) {
68
+ /**
69
+ * Configs can be a function or they can be just an object!
70
+ */ return typeof configFile === 'function' ? configFile({
71
+ env: utils.env
72
+ }) : configFile;
73
+ }
74
+ }
75
+ return {};
76
+ };
77
+ const getMapOfPluginsWithAdmin = (plugins)=>{
78
+ /**
79
+ * This variable stores the import paths for plugins.
80
+ * The keys are the module paths of the plugins, and the values are the paths
81
+ * to the admin part of the plugins, which is either loaded from the
82
+ * package.json exports or from the legacy strapi-admin.js file.
83
+ */ const pluginImportPaths = {};
84
+ return Object.values(plugins).filter((plugin)=>{
85
+ if (!plugin) {
86
+ return false;
87
+ }
88
+ /**
89
+ * There are two ways a plugin should be imported, either it's local to the strapi app,
90
+ * or it's an actual npm module that's installed and resolved via node_modules.
91
+ *
92
+ * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because
93
+ * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.
94
+ *
95
+ * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`
96
+ * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`
97
+ * then it doesn't have an admin part to the package.
98
+ */ try {
99
+ const localPluginPath = plugin.path;
100
+ if (localPluginPath) {
101
+ // Here we are loading a locally installed plugin
102
+ const packageJsonPath = path.join(localPluginPath, 'package.json');
103
+ if (fs.existsSync(packageJsonPath)) {
104
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
105
+ const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;
106
+ if (localAdminPath) {
107
+ pluginImportPaths[plugin.modulePath] = localAdminPath;
108
+ return true;
109
+ }
110
+ }
111
+ // Check if legacy admin file exists in local plugin
112
+ if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {
113
+ pluginImportPaths[plugin.modulePath] = 'strapi-admin';
114
+ return true;
115
+ }
116
+ }
117
+ // This plugin is a module, so we need to check if it has a strapi-admin export
118
+ if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {
119
+ pluginImportPaths[plugin.modulePath] = 'strapi-admin';
120
+ return true;
121
+ }
122
+ return false;
123
+ } catch (err) {
124
+ if (errors.isError(err) && 'code' in err && (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')) {
125
+ /**
126
+ * the plugin does not contain FE code, so we
127
+ * don't want to import it anyway
128
+ */ return false;
129
+ }
130
+ throw err;
131
+ }
132
+ }).map((plugin)=>({
133
+ ...plugin,
134
+ modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`
135
+ }));
136
+ };
137
+
138
+ exports.getEnabledPlugins = getEnabledPlugins;
139
+ exports.getMapOfPluginsWithAdmin = getMapOfPluginsWithAdmin;
140
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","config","get","debug","os","EOL","dep","Object","keys","getModule","name","Error","importName","camelCase","type","modulePath","userPluginsFile","loadUserPluginsFile","dirs","app","userPluginName","userPluginConfig","entries","enabled","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GACZ,IAAA,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CACzBD,IAAAA,GAAAA,CAAIC,MAAM,KAAK,IAAA;AAEjB,MAAMG,uBAAAA,GAA0B,CAACJ,GAC/BD,GAAAA,wBAAAA,CAAyBC,QAAQA,GAAIC,CAAAA,MAAM,CAACI,IAAI,KAAK,QAAA;AAEjDC,MAAAA,iBAAAA,GAAoB,OAAO,EAC/BC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVR,MAAM,EACwD,GAAA;AAG9D,IAAA,MAAMS,UAAsC,EAAC;AAE7C;;;;MAKA,MAAMC,OAAOV,MAAOW,CAAAA,MAAM,CAACC,GAAG,CAAC,qBAAqB,EAAC,CAAA;AAErDL,IAAAA,MAAAA,CAAOM,KAAK,CAAC,kCAAoCC,EAAAA,EAAAA,CAAGC,GAAG,EAAEL,IAAAA,CAAAA;AAEzD,IAAA,KAAK,MAAMM,GAAAA,IAAOC,MAAOC,CAAAA,IAAI,CAACR,IAAO,CAAA,CAAA;QACnC,MAAMX,GAAAA,GAAM,MAAMoB,sBAAAA,CAAUH,GAAKV,EAAAA,GAAAA,CAAAA;QAEjC,IAAIP,GAAA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AiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAGoC,cAAAA;wBACvC,OAAO,IAAA;AACT;AACF;;AAGA,gBAAA,IAAIN,GAAGC,UAAU,CAAClB,KAAKM,IAAI,CAACS,iBAAiB,iBAAqB,CAAA,CAAA,EAAA;AAChEJ,oBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;oBACvC,OAAO,IAAA;AACT;AACF;;YAGA,IAAIuC,OAAAA,CAAQ9B,OAAO,CAAC,CAAC,EAAEkB,OAAO3B,UAAU,CAAC,aAAa,CAAC,CAAG,EAAA;AACxDwB,gBAAAA,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,GAAG,cAAA;gBACvC,OAAO,IAAA;AACT;YAEA,OAAO,KAAA;AACT,SAAA,CAAE,OAAOwC,GAAK,EAAA;AACZ,YAAA,IACEC,cAAQD,CAAAA,GAAAA,CAAAA,IACR,MAAUA,IAAAA,GAAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAsBF,IAAAA,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAC/E,EAAA;AACA;;;AAGC,cACD,OAAO,KAAA;AACT;YAEA,MAAMF,GAAAA;AACR;AACF,KAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;AACT3B,YAAAA,UAAAA,EAAY,CAAC,EAAE2B,MAAO3B,CAAAA,UAAU,CAAC,CAAC,EAAEwB,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,CAAC;SAC3E,CAAA,CAAA;AACJ;;;;;"}
@@ -0,0 +1,137 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+ import fs from 'node:fs';
4
+ import camelCase from 'lodash/camelCase';
5
+ import { env } from '@strapi/utils';
6
+ import { getModule } from './dependencies.mjs';
7
+ import { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files.mjs';
8
+ import { isError } from './errors.mjs';
9
+
10
+ const validatePackageHasStrapi = (pkg)=>'strapi' in pkg && typeof pkg.strapi === 'object' && !Array.isArray(pkg.strapi) && pkg.strapi !== null;
11
+ const validatePackageIsPlugin = (pkg)=>validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';
12
+ const getEnabledPlugins = async ({ cwd, logger, runtimeDir, strapi })=>{
13
+ const plugins = {};
14
+ /**
15
+ * This is the list of dependencies that are installed in the user's project.
16
+ * It will include libraries like "react", so we need to collect the ones that
17
+ * are plugins.
18
+ */ const deps = strapi.config.get('info.dependencies', {});
19
+ logger.debug("Dependencies from user's project", os.EOL, deps);
20
+ for (const dep of Object.keys(deps)){
21
+ const pkg = await getModule(dep, cwd);
22
+ if (pkg && validatePackageIsPlugin(pkg)) {
23
+ const name = pkg.strapi.name || pkg.name;
24
+ if (!name) {
25
+ /**
26
+ * Unlikely to happen, but you never know.
27
+ */ throw Error("You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!");
28
+ }
29
+ plugins[name] = {
30
+ name,
31
+ importName: camelCase(name),
32
+ type: 'module',
33
+ modulePath: dep
34
+ };
35
+ }
36
+ }
37
+ const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);
38
+ logger.debug("User's plugins file", os.EOL, userPluginsFile);
39
+ for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)){
40
+ if (userPluginConfig.enabled && userPluginConfig.resolve) {
41
+ const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);
42
+ plugins[userPluginName] = {
43
+ name: userPluginName,
44
+ importName: camelCase(userPluginName),
45
+ type: 'local',
46
+ /**
47
+ * User plugin paths are resolved from the entry point
48
+ * of the app, because that's how you import them.
49
+ */ modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),
50
+ path: sysPath
51
+ };
52
+ }
53
+ }
54
+ return plugins;
55
+ };
56
+ const PLUGIN_CONFIGS = [
57
+ 'plugins.js',
58
+ 'plugins.mjs',
59
+ 'plugins.ts'
60
+ ];
61
+ const loadUserPluginsFile = async (root)=>{
62
+ for (const file of PLUGIN_CONFIGS){
63
+ const filePath = path.join(root, file);
64
+ const configFile = await loadFile(filePath);
65
+ if (configFile) {
66
+ /**
67
+ * Configs can be a function or they can be just an object!
68
+ */ return typeof configFile === 'function' ? configFile({
69
+ env
70
+ }) : configFile;
71
+ }
72
+ }
73
+ return {};
74
+ };
75
+ const getMapOfPluginsWithAdmin = (plugins)=>{
76
+ /**
77
+ * This variable stores the import paths for plugins.
78
+ * The keys are the module paths of the plugins, and the values are the paths
79
+ * to the admin part of the plugins, which is either loaded from the
80
+ * package.json exports or from the legacy strapi-admin.js file.
81
+ */ const pluginImportPaths = {};
82
+ return Object.values(plugins).filter((plugin)=>{
83
+ if (!plugin) {
84
+ return false;
85
+ }
86
+ /**
87
+ * There are two ways a plugin should be imported, either it's local to the strapi app,
88
+ * or it's an actual npm module that's installed and resolved via node_modules.
89
+ *
90
+ * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because
91
+ * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.
92
+ *
93
+ * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`
94
+ * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`
95
+ * then it doesn't have an admin part to the package.
96
+ */ try {
97
+ const localPluginPath = plugin.path;
98
+ if (localPluginPath) {
99
+ // Here we are loading a locally installed plugin
100
+ const packageJsonPath = path.join(localPluginPath, 'package.json');
101
+ if (fs.existsSync(packageJsonPath)) {
102
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
103
+ const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;
104
+ if (localAdminPath) {
105
+ pluginImportPaths[plugin.modulePath] = localAdminPath;
106
+ return true;
107
+ }
108
+ }
109
+ // Check if legacy admin file exists in local plugin
110
+ if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {
111
+ pluginImportPaths[plugin.modulePath] = 'strapi-admin';
112
+ return true;
113
+ }
114
+ }
115
+ // This plugin is a module, so we need to check if it has a strapi-admin export
116
+ if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {
117
+ pluginImportPaths[plugin.modulePath] = 'strapi-admin';
118
+ return true;
119
+ }
120
+ return false;
121
+ } catch (err) {
122
+ if (isError(err) && 'code' in err && (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')) {
123
+ /**
124
+ * the plugin does not contain FE code, so we
125
+ * don't want to import it anyway
126
+ */ return false;
127
+ }
128
+ throw err;
129
+ }
130
+ }).map((plugin)=>({
131
+ ...plugin,
132
+ modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`
133
+ }));
134
+ };
135
+
136
+ export { getEnabledPlugins, getMapOfPluginsWithAdmin };
137
+ //# sourceMappingURL=plugins.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.mjs","sources":["../../../../src/node/core/plugins.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport camelCase from 'lodash/camelCase';\nimport { env } from '@strapi/utils';\nimport { getModule, PackageJson } from './dependencies';\nimport { convertModulePathToSystemPath, convertSystemPathToModulePath, loadFile } from './files';\nimport type { BaseContext } from '../types';\nimport { isError } from './errors';\n\ninterface LocalPluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * The path to the plugin, relative to the app's root directory\n * in system format\n */\n path: string;\n /**\n * The path to the plugin, relative to the runtime directory\n * in module format (i.e. with forward slashes) because thats\n * where it should be used as an import\n */\n modulePath: string;\n type: 'local';\n}\n\ninterface ModulePluginMeta {\n name: string;\n /**\n * camelCased version of the plugin name\n */\n importName: string;\n /**\n * Modules don't have a path because we never resolve them to their node_modules\n * because we simply do not require it.\n */\n path?: never;\n /**\n * The path to the plugin, relative to the app's root directory\n * in module format (i.e. with forward slashes)\n */\n modulePath: string;\n type: 'module';\n}\n\ntype PluginMeta = LocalPluginMeta | ModulePluginMeta;\n\ninterface StrapiPlugin extends PackageJson {\n strapi: {\n description?: string;\n displayName?: string;\n kind: 'plugin';\n name?: string;\n required?: boolean;\n };\n}\n\nconst validatePackageHasStrapi = (\n pkg: PackageJson\n): pkg is PackageJson & { strapi: Record<string, unknown> } =>\n 'strapi' in pkg &&\n typeof pkg.strapi === 'object' &&\n !Array.isArray(pkg.strapi) &&\n pkg.strapi !== null;\n\nconst validatePackageIsPlugin = (pkg: PackageJson): pkg is StrapiPlugin =>\n validatePackageHasStrapi(pkg) && pkg.strapi.kind === 'plugin';\n\nconst getEnabledPlugins = async ({\n cwd,\n logger,\n runtimeDir,\n strapi,\n}: Pick<BaseContext, 'cwd' | 'logger' | 'strapi' | 'runtimeDir'>): Promise<\n Record<string, PluginMeta>\n> => {\n const plugins: Record<string, PluginMeta> = {};\n\n /**\n * This is the list of dependencies that are installed in the user's project.\n * It will include libraries like \"react\", so we need to collect the ones that\n * are plugins.\n */\n const deps = strapi.config.get('info.dependencies', {});\n\n logger.debug(\"Dependencies from user's project\", os.EOL, deps);\n\n for (const dep of Object.keys(deps)) {\n const pkg = await getModule(dep, cwd);\n\n if (pkg && validatePackageIsPlugin(pkg)) {\n const name = pkg.strapi.name || pkg.name;\n\n if (!name) {\n /**\n * Unlikely to happen, but you never know.\n */\n throw Error(\n \"You're trying to import a plugin that doesn't have a name – check the package.json of that plugin!\"\n );\n }\n\n plugins[name] = {\n name,\n importName: camelCase(name),\n type: 'module',\n modulePath: dep,\n };\n }\n }\n\n const userPluginsFile = await loadUserPluginsFile(strapi.dirs.app.config);\n\n logger.debug(\"User's plugins file\", os.EOL, userPluginsFile);\n\n for (const [userPluginName, userPluginConfig] of Object.entries(userPluginsFile)) {\n if (userPluginConfig.enabled && userPluginConfig.resolve) {\n const sysPath = convertModulePathToSystemPath(userPluginConfig.resolve);\n plugins[userPluginName] = {\n name: userPluginName,\n importName: camelCase(userPluginName),\n type: 'local',\n /**\n * User plugin paths are resolved from the entry point\n * of the app, because that's how you import them.\n */\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, sysPath)),\n path: sysPath,\n };\n }\n }\n\n return plugins;\n};\n\nconst PLUGIN_CONFIGS = ['plugins.js', 'plugins.mjs', 'plugins.ts'];\n\ntype UserPluginConfigFile = Record<string, { enabled: boolean; resolve: string }>;\n\nconst loadUserPluginsFile = async (root: string): Promise<UserPluginConfigFile> => {\n for (const file of PLUGIN_CONFIGS) {\n const filePath = path.join(root, file);\n const configFile = await loadFile(filePath);\n\n if (configFile) {\n /**\n * Configs can be a function or they can be just an object!\n */\n return typeof configFile === 'function' ? configFile({ env }) : configFile;\n }\n }\n\n return {};\n};\n\nconst getMapOfPluginsWithAdmin = (plugins: Record<string, PluginMeta>) => {\n /**\n * This variable stores the import paths for plugins.\n * The keys are the module paths of the plugins, and the values are the paths\n * to the admin part of the plugins, which is either loaded from the\n * package.json exports or from the legacy strapi-admin.js file.\n */\n const pluginImportPaths: Record<string, string> = {};\n\n return Object.values(plugins)\n .filter((plugin) => {\n if (!plugin) {\n return false;\n }\n\n /**\n * There are two ways a plugin should be imported, either it's local to the strapi app,\n * or it's an actual npm module that's installed and resolved via node_modules.\n *\n * We first check if the plugin is local to the strapi app, using a regular `fs.existsSync` because\n * the pathToPlugin will be relative i.e. `/Users/my-name/strapi-app/src/plugins/my-plugin`.\n *\n * If the file doesn't exist well then it's probably a node_module, so instead we use `require.resolve`\n * which will resolve the path to the module in node_modules. If it fails with the specific code `MODULE_NOT_FOUND`\n * then it doesn't have an admin part to the package.\n */\n try {\n const localPluginPath = plugin.path;\n if (localPluginPath) {\n // Here we are loading a locally installed plugin\n const packageJsonPath = path.join(localPluginPath, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const localAdminPath = packageJson?.exports?.['./strapi-admin']?.import;\n\n if (localAdminPath) {\n pluginImportPaths[plugin.modulePath] = localAdminPath;\n return true;\n }\n }\n\n // Check if legacy admin file exists in local plugin\n if (fs.existsSync(path.join(localPluginPath, 'strapi-admin.js'))) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n }\n\n // This plugin is a module, so we need to check if it has a strapi-admin export\n if (require.resolve(`${plugin.modulePath}/strapi-admin`)) {\n pluginImportPaths[plugin.modulePath] = 'strapi-admin';\n return true;\n }\n\n return false;\n } catch (err) {\n if (\n isError(err) &&\n 'code' in err &&\n (err.code === 'MODULE_NOT_FOUND' || err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED')\n ) {\n /**\n * the plugin does not contain FE code, so we\n * don't want to import it anyway\n */\n return false;\n }\n\n throw err;\n }\n })\n .map((plugin) => ({\n ...plugin,\n modulePath: `${plugin.modulePath}/${pluginImportPaths[plugin.modulePath]}`,\n }));\n};\n\nexport { getEnabledPlugins, getMapOfPluginsWithAdmin };\nexport type { PluginMeta, LocalPluginMeta, ModulePluginMeta };\n"],"names":["validatePackageHasStrapi","pkg","strapi","Array","isArray","validatePackageIsPlugin","kind","getEnabledPlugins","cwd","logger","runtimeDir","plugins","deps","config","get","debug","os","EOL","dep","Object","keys","getModule","name","Error","importName","camelCase","type","modulePath","userPluginsFile","loadUserPluginsFile","dirs","app","userPluginName","userPluginConfig","entries","enabled","resolve","sysPath","convertModulePathToSystemPath","convertSystemPathToModulePath","path","relative","PLUGIN_CONFIGS","root","file","filePath","join","configFile","loadFile","env","getMapOfPluginsWithAdmin","pluginImportPaths","values","filter","plugin","localPluginPath","packageJsonPath","fs","existsSync","packageJson","JSON","parse","readFileSync","localAdminPath","exports","import","require","err","isError","code","map"],"mappings":";;;;;;;;;AA6DA,MAAMA,2BAA2B,CAC/BC,GAAAA,GAEA,YAAYA,GACZ,IAAA,OAAOA,IAAIC,MAAM,KAAK,YACtB,CAACC,KAAAA,CAAMC,OAAO,CAACH,GAAAA,CAAIC,MAAM,CACzBD,IAAAA,GAAAA,CAAIC,MAAM,KAAK,IA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AAAA,KACTA,GAAAA,CAAIE,IAAI,KAAK,kBAAsBF,IAAAA,GAAAA,CAAIE,IAAI,KAAK,+BAA8B,CAC/E,EAAA;AACA;;;AAGC,cACD,OAAO,KAAA;AACT;YAEA,MAAMF,GAAAA;AACR;AACF,KAAA,CAAA,CACCG,GAAG,CAAC,CAAChB,MAAAA,IAAY;AAChB,YAAA,GAAGA,MAAM;AACT3B,YAAAA,UAAAA,EAAY,CAAC,EAAE2B,MAAO3B,CAAAA,UAAU,CAAC,CAAC,EAAEwB,iBAAiB,CAACG,MAAAA,CAAO3B,UAAU,CAAC,CAAC;SAC3E,CAAA,CAAA;AACJ;;;;"}
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var perf_hooks = require('perf_hooks');
4
+
5
+ function getTimer() {
6
+ const timings = {};
7
+ const startTimes = {};
8
+ function start(name) {
9
+ if (typeof startTimes[name] !== 'undefined') {
10
+ throw new Error(`Timer "${name}" already started, cannot overwrite`);
11
+ }
12
+ startTimes[name] = perf_hooks.performance.now();
13
+ }
14
+ function end(name) {
15
+ if (typeof startTimes[name] === 'undefined') {
16
+ throw new Error(`Timer "${name}" never started, cannot end`);
17
+ }
18
+ timings[name] = perf_hooks.performance.now() - startTimes[name];
19
+ return timings[name];
20
+ }
21
+ return {
22
+ start,
23
+ end,
24
+ getTimings: ()=>timings
25
+ };
26
+ }
27
+ const prettyTime = (timeInMs)=>{
28
+ return `${Math.ceil(timeInMs)}ms`;
29
+ };
30
+
31
+ exports.getTimer = getTimer;
32
+ exports.prettyTime = prettyTime;
33
+ //# sourceMappingURL=timer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.js","sources":["../../../../src/node/core/timer.ts"],"sourcesContent":["import { performance } from 'perf_hooks';\n\nexport interface TimeMeasurer {\n start: (name: string) => void;\n end: (name: string) => number;\n getTimings: () => Record<string, number>;\n}\n\nexport function getTimer(): TimeMeasurer {\n const timings: Record<string, number> = {};\n const startTimes: Record<string, number> = {};\n\n function start(name: string): void {\n if (typeof startTimes[name] !== 'undefined') {\n throw new Error(`Timer \"${name}\" already started, cannot overwrite`);\n }\n\n startTimes[name] = performance.now();\n }\n\n function end(name: string): number {\n if (typeof startTimes[name] === 'undefined') {\n throw new Error(`Timer \"${name}\" never started, cannot end`);\n }\n\n timings[name] = performance.now() - startTimes[name];\n return timings[name];\n }\n\n return { start, end, getTimings: () => timings };\n}\n\nexport const prettyTime = (timeInMs: number): string => {\n return `${Math.ceil(timeInMs)}ms`;\n};\n"],"names":["getTimer","timings","startTimes","start","name","Error","performance","now","end","getTimings","prettyTime","timeInMs","Math","ceil"],"mappings":";;;;AAQO,SAASA,QAAAA,GAAAA;AACd,IAAA,MAAMC,UAAkC,EAAC;AACzC,IAAA,MAAMC,aAAqC,EAAC;AAE5C,IAAA,SAASC,MAAMC,IAAY,EAAA;AACzB,QAAA,IAAI,OAAOF,UAAU,CAACE,IAAAA,CAAK,KAAK,WAAa,EAAA;AAC3C,YAAA,MAAM,IAAIC,KAAM,CAAA,CAAC,OAAO,EAAED,IAAAA,CAAK,mCAAmC,CAAC,CAAA;AACrE;AAEAF,QAAAA,UAAU,CAACE,IAAAA,CAAK,GAAGE,sBAAAA,CAAYC,GAAG,EAAA;AACpC;AAEA,IAAA,SAASC,IAAIJ,IAAY,EAAA;AACvB,QAAA,IAAI,OAAOF,UAAU,CAACE,IAAAA,CAAK,KAAK,WAAa,EAAA;AAC3C,YAAA,MAAM,IAAIC,KAAM,CAAA,CAAC,OAAO,EAAED,IAAAA,CAAK,2BAA2B,CAAC,CAAA;AAC7D;QAEAH,OAAO,CAACG,KAAK,GAAGE,sBAAAA,CAAYC,GAAG,EAAKL,GAAAA,UAAU,CAACE,IAAK,CAAA;QACpD,OAAOH,OAAO,CAACG,IAAK,CAAA;AACtB;IAEA,OAAO;AAAED,QAAAA,KAAAA;AAAOK,QAAAA,GAAAA;AAAKC,QAAAA,UAAAA,EAAY,IAAMR;AAAQ,KAAA;AACjD;AAEO,MAAMS,aAAa,CAACC,QAAAA,GAAAA;AACzB,IAAA,OAAO,CAAC,EAAEC,IAAAA,CAAKC,IAAI,CAACF,QAAAA,CAAAA,CAAU,EAAE,CAAC;AACnC;;;;;"}
@@ -0,0 +1,30 @@
1
+ import { performance } from 'perf_hooks';
2
+
3
+ function getTimer() {
4
+ const timings = {};
5
+ const startTimes = {};
6
+ function start(name) {
7
+ if (typeof startTimes[name] !== 'undefined') {
8
+ throw new Error(`Timer "${name}" already started, cannot overwrite`);
9
+ }
10
+ startTimes[name] = performance.now();
11
+ }
12
+ function end(name) {
13
+ if (typeof startTimes[name] === 'undefined') {
14
+ throw new Error(`Timer "${name}" never started, cannot end`);
15
+ }
16
+ timings[name] = performance.now() - startTimes[name];
17
+ return timings[name];
18
+ }
19
+ return {
20
+ start,
21
+ end,
22
+ getTimings: ()=>timings
23
+ };
24
+ }
25
+ const prettyTime = (timeInMs)=>{
26
+ return `${Math.ceil(timeInMs)}ms`;
27
+ };
28
+
29
+ export { getTimer, prettyTime };
30
+ //# sourceMappingURL=timer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timer.mjs","sources":["../../../../src/node/core/timer.ts"],"sourcesContent":["import { performance } from 'perf_hooks';\n\nexport interface TimeMeasurer {\n start: (name: string) => void;\n end: (name: string) => number;\n getTimings: () => Record<string, number>;\n}\n\nexport function getTimer(): TimeMeasurer {\n const timings: Record<string, number> = {};\n const startTimes: Record<string, number> = {};\n\n function start(name: string): void {\n if (typeof startTimes[name] !== 'undefined') {\n throw new Error(`Timer \"${name}\" already started, cannot overwrite`);\n }\n\n startTimes[name] = performance.now();\n }\n\n function end(name: string): number {\n if (typeof startTimes[name] === 'undefined') {\n throw new Error(`Timer \"${name}\" never started, cannot end`);\n }\n\n timings[name] = performance.now() - startTimes[name];\n return timings[name];\n }\n\n return { start, end, getTimings: () => timings };\n}\n\nexport const prettyTime = (timeInMs: number): string => {\n return `${Math.ceil(timeInMs)}ms`;\n};\n"],"names":["getTimer","timings","startTimes","start","name","Error","performance","now","end","getTimings","prettyTime","timeInMs","Math","ceil"],"mappings":";;AAQO,SAASA,QAAAA,GAAAA;AACd,IAAA,MAAMC,UAAkC,EAAC;AACzC,IAAA,MAAMC,aAAqC,EAAC;AAE5C,IAAA,SAASC,MAAMC,IAAY,EAAA;AACzB,QAAA,IAAI,OAAOF,UAAU,CAACE,IAAAA,CAAK,KAAK,WAAa,EAAA;AAC3C,YAAA,MAAM,IAAIC,KAAM,CAAA,CAAC,OAAO,EAAED,IAAAA,CAAK,mCAAmC,CAAC,CAAA;AACrE;AAEAF,QAAAA,UAAU,CAACE,IAAAA,CAAK,GAAGE,WAAAA,CAAYC,GAAG,EAAA;AACpC;AAEA,IAAA,SAASC,IAAIJ,IAAY,EAAA;AACvB,QAAA,IAAI,OAAOF,UAAU,CAACE,IAAAA,CAAK,KAAK,WAAa,EAAA;AAC3C,YAAA,MAAM,IAAIC,KAAM,CAAA,CAAC,OAAO,EAAED,IAAAA,CAAK,2BAA2B,CAAC,CAAA;AAC7D;QAEAH,OAAO,CAACG,KAAK,GAAGE,WAAAA,CAAYC,GAAG,EAAKL,GAAAA,UAAU,CAACE,IAAK,CAAA;QACpD,OAAOH,OAAO,CAACG,IAAK,CAAA;AACtB;IAEA,OAAO;AAAED,QAAAA,KAAAA;AAAOK,QAAAA,GAAAA;AAAKC,QAAAA,UAAAA,EAAY,IAAMR;AAAQ,KAAA;AACjD;AAEO,MAAMS,aAAa,CAACC,QAAAA,GAAAA;AACzB,IAAA,OAAO,CAAC,EAAEC,IAAAA,CAAKC,IAAI,CAACF,QAAAA,CAAAA,CAAU,EAAE,CAAC;AACnC;;;;"}
@@ -0,0 +1,111 @@
1
+ 'use strict';
2
+
3
+ var os = require('node:os');
4
+ var path = require('node:path');
5
+ var fs = require('node:fs/promises');
6
+ var browserslist = require('browserslist');
7
+ var core = require('@strapi/core');
8
+ var env = require('./core/env.js');
9
+ var plugins = require('./core/plugins.js');
10
+ var adminCustomisations = require('./core/admin-customisations.js');
11
+
12
+ const DEFAULT_BROWSERSLIST = [
13
+ 'last 3 major versions',
14
+ 'Firefox ESR',
15
+ 'last 2 Opera versions',
16
+ 'not dead'
17
+ ];
18
+ const createBuildContext = async ({ cwd, logger, tsconfig, strapi, options = {} })=>{
19
+ /**
20
+ * If you make a new strapi instance when one already exists,
21
+ * you will overwrite the global and the app will _most likely_
22
+ * crash and die.
23
+ */ const strapiInstance = strapi ?? core.createStrapi({
24
+ // Directories
25
+ appDir: cwd,
26
+ distDir: tsconfig?.config.options.outDir ?? '',
27
+ // Options
28
+ autoReload: true,
29
+ serveAdminPanel: false
30
+ });
31
+ const serverAbsoluteUrl = strapiInstance.config.get('server.absoluteUrl');
32
+ const adminAbsoluteUrl = strapiInstance.config.get('admin.absoluteUrl');
33
+ const adminPath = strapiInstance.config.get('admin.path');
34
+ // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)
35
+ const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;
36
+ const adminPublicPath = new URL(adminAbsoluteUrl).pathname;
37
+ const serverPublicPath = new URL(serverAbsoluteUrl).pathname;
38
+ const appDir = strapiInstance.dirs.app.root;
39
+ await env.loadEnv(cwd);
40
+ const env$1 = env.getStrapiAdminEnvVars({
41
+ ADMIN_PATH: adminPublicPath,
42
+ STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,
43
+ STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled)
44
+ });
45
+ const envKeys = Object.keys(env$1);
46
+ if (envKeys.length > 0) {
47
+ logger.info([
48
+ 'Including the following ENV variables as part of the JS bundle:',
49
+ ...envKeys.map((key)=>` - ${key}`)
50
+ ].join(os.EOL));
51
+ }
52
+ const distPath = path.join(strapiInstance.dirs.dist.root, 'build');
53
+ const distDir = path.relative(cwd, distPath);
54
+ /**
55
+ * If the distPath already exists, clean it
56
+ */ try {
57
+ logger.debug(`Cleaning dist folder: ${distPath}`);
58
+ await fs.rm(distPath, {
59
+ recursive: true,
60
+ force: true
61
+ });
62
+ logger.debug('Cleaned dist folder');
63
+ } catch {
64
+ // do nothing, it will fail if the folder does not exist
65
+ logger.debug('There was no dist folder to clean');
66
+ }
67
+ const runtimeDir = path.join(cwd, '.strapi', 'client');
68
+ const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));
69
+ const plugins$1 = await plugins.getEnabledPlugins({
70
+ cwd,
71
+ logger,
72
+ runtimeDir,
73
+ strapi: strapiInstance
74
+ });
75
+ logger.debug('Enabled plugins', os.EOL, plugins$1);
76
+ const pluginsWithFront = plugins.getMapOfPluginsWithAdmin(plugins$1);
77
+ logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);
78
+ const target = browserslist.loadConfig({
79
+ path: cwd
80
+ }) ?? DEFAULT_BROWSERSLIST;
81
+ const customisations = await adminCustomisations.loadUserAppFile({
82
+ appDir,
83
+ runtimeDir
84
+ });
85
+ const features = strapiInstance.config.get('features', undefined);
86
+ const { bundler = 'vite', ...restOptions } = options;
87
+ const buildContext = {
88
+ appDir,
89
+ adminPath,
90
+ basePath: adminPublicPath,
91
+ bundler,
92
+ customisations,
93
+ cwd,
94
+ distDir,
95
+ distPath,
96
+ entry,
97
+ env: env$1,
98
+ features,
99
+ logger,
100
+ options: restOptions,
101
+ plugins: pluginsWithFront,
102
+ runtimeDir,
103
+ strapi: strapiInstance,
104
+ target,
105
+ tsconfig
106
+ };
107
+ return buildContext;
108
+ };
109
+
110
+ exports.createBuildContext = createBuildContext;
111
+ //# sourceMappingURL=create-build-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-build-context.js","sources":["../../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport type { Core, Modules } from '@strapi/types';\nimport type { Server } from 'node:http';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n hmrServer?: Server;\n hmrClientPort?: number;\n}\n\ninterface BuildContext<TOptions = unknown> extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions & TOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs<TOptions = unknown> extends CLIContext {\n strapi?: Core.Strapi;\n options?: TOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async <TOptions extends BaseOptions>({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {} as TOptions,\n}: CreateBuildContextArgs<TOptions>): Promise<BuildContext<TOptions>> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverAbsoluteUrl = strapiInstance.config.get<string>('server.absoluteUrl');\n const adminAbsoluteUrl = strapiInstance.config.get<string>('admin.absoluteUrl');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n // NOTE: Checks that both the server and admin will be served from the same origin (protocol, host, port)\n const sameOrigin = new URL(adminAbsoluteUrl).origin === new URL(serverAbsoluteUrl).origin;\n\n const adminPublicPath = new URL(adminAbsoluteUrl).pathname;\n const serverPublicPath = new URL(serverAbsoluteUrl).pathname;\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPublicPath,\n STRAPI_ADMIN_BACKEND_URL: sameOrigin ? serverPublicPath : serverAbsoluteUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n });\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.info(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const buildContext = {\n appDir,\n adminPath,\n basePath: adminPublicPath,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions as BaseOptions & TOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n } satisfies BuildContext<TOptions>;\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["DEFAULT_BROWSERSLIST","createBuildContext","cwd","logger","tsconfig","strapi","options","strapiInstance","createStrapi","appDir","distDir","config","outDir","autoReload","serveAdminPanel","serverAbsoluteUrl","get","adminAbsoluteUrl","adminPath","sameOrigin","URL","origin","adminPublicPath","pathname","serverPublicPath","dirs","app","root","loadEnv","env","getStrapiAdminEnvVars","ADMIN_PATH","STRAPI_ADMIN_BACKEND_URL","STRAPI_TELEMETRY_DISABLED","String","telemetry","isDisabled","envKeys","Object","keys","length","info","map","key","join","os","EOL","distPath","path","dist","relative","debug","fs","rm","recursive","force","runtimeDir","entry","plugins","getEnabledPlugins","pluginsWithFront","getMapOfPluginsWithAdmin","target","browserslist","loadConfig","customisations","loadUserAppFile","features","undefined","bundler","restOptions","buildContext","basePath"],"mappings":";;;;;;;;;;;AAkDA,MAAMA,oBAAuB,GAAA;AAC3B,IAAA,uBAAA;AACA,IAAA,aAAA;AACA,IAAA,uBAAA;AACA,IAAA;AACD,CAAA;AAED,MAAMC,kBAAqB,GAAA,OAAqC,EAC9DC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,OAAU,GAAA,EAAc,EACS,GAAA;AACjC;;;;MAKA,MAAMC,cACJF,GAAAA,MAAAA,IACAG,iBAAa,CAAA;;QAEXC,MAAQP,EAAAA,GAAAA;QACRQ,OAASN,EAAAA,QAAAA,EAAUO,MAAOL,CAAAA,OAAAA,CAAQM,MAAU,IAAA,EAAA;;QAE5CC,UAAY,EAAA,IAAA;QACZC,eAAiB,EAAA;AACnB,KAAA,CAAA;AAEF,IAAA,MAAMC,iBAAoBR,GAAAA,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,oBAAA,CAAA;AAC5D,IAAA,MAAMC,gBAAmBV,GAAAA,cAAAA,CAAeI,MAAM,CAACK,GAAG,CAAS,mBAAA,CAAA;AAC3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