@nizza/devkit 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (258) hide show
  1. package/dist/cjs/executors/deploy/helpers.cjs +26 -0
  2. package/dist/cjs/executors/deploy/helpers.d.cts +4 -0
  3. package/dist/cjs/executors/deploy/index.cjs +22 -0
  4. package/dist/cjs/executors/deploy/index.d.cts +11 -0
  5. package/dist/cjs/executors/environments/helpers.cjs +62 -0
  6. package/dist/{src/executors/environments/helpers.d.ts → cjs/executors/environments/helpers.d.cts} +9 -5
  7. package/dist/cjs/executors/environments/index.cjs +60 -0
  8. package/dist/{src/executors/environments/executor.d.ts → cjs/executors/environments/index.d.cts} +5 -5
  9. package/dist/cjs/executors/publish/helpers.cjs +51 -0
  10. package/dist/{src/executors/publish/helpers.d.ts → cjs/executors/publish/helpers.d.cts} +3 -3
  11. package/dist/cjs/executors/publish/index.cjs +53 -0
  12. package/dist/cjs/executors/publish/index.d.cts +12 -0
  13. package/dist/cjs/executors/shared/utils.cjs +67 -0
  14. package/dist/cjs/executors/shared/utils.d.cts +27 -0
  15. package/dist/cjs/executors/update-executors-file/helpers.cjs +64 -0
  16. package/dist/cjs/executors/update-executors-file/helpers.d.cts +17 -0
  17. package/dist/cjs/executors/update-executors-file/index.cjs +38 -0
  18. package/dist/{src/executors/update-executors-file/executor.d.ts → cjs/executors/update-executors-file/index.d.cts} +5 -5
  19. package/dist/cjs/executors/vtex-link/constants.cjs +9 -0
  20. package/dist/cjs/executors/vtex-link/constants.d.cts +4 -0
  21. package/dist/cjs/executors/vtex-link/helpers.cjs +206 -0
  22. package/dist/{src/executors/vtex-link/helpers.d.ts → cjs/executors/vtex-link/helpers.d.cts} +15 -15
  23. package/dist/cjs/executors/vtex-link/index.cjs +30 -0
  24. package/dist/cjs/executors/vtex-link/index.d.cts +5 -0
  25. package/dist/cjs/index-0ce2daf7.d.ts +2 -0
  26. package/dist/cjs/index-17143e35.d.ts +2 -0
  27. package/dist/cjs/index-3080371d.d.ts +3 -0
  28. package/dist/cjs/index-f6330edc.d.ts +2 -0
  29. package/dist/cjs/index.cjs +71 -0
  30. package/dist/cjs/index.d.cts +10 -0
  31. package/dist/cjs/index.d.cts.map +1 -0
  32. package/dist/cjs/scripts/changeset-pre-mode.cjs +41 -0
  33. package/dist/cjs/scripts/changeset-pre-mode.d.cts +2 -0
  34. package/dist/cjs/scripts/index.cjs +7 -0
  35. package/dist/cjs/scripts/index.d.cts +1 -0
  36. package/dist/cjs/shared/logger.cjs +98 -0
  37. package/dist/{src/logger.d.ts → cjs/shared/logger.d.cts} +5 -6
  38. package/dist/cjs/shared/utils.cjs +64 -0
  39. package/dist/cjs/shared/utils.d.cts +19 -0
  40. package/dist/{src/executors/vtex-link/types.d.ts → cjs/types-1282e639.d.ts} +3 -3
  41. package/dist/cjs/types-7377dcc9.d.ts +4 -0
  42. package/dist/cjs/types-763439e4.d.ts +14 -0
  43. package/dist/cjs/vite/config-builder/configs/app.cjs +13 -0
  44. package/dist/cjs/vite/config-builder/configs/app.d.cts +4 -0
  45. package/dist/cjs/vite/config-builder/configs/base.cjs +58 -0
  46. package/dist/cjs/vite/config-builder/configs/base.d.cts +4 -0
  47. package/dist/cjs/vite/config-builder/configs/index.cjs +36 -0
  48. package/dist/cjs/vite/config-builder/configs/index.d.cts +7 -0
  49. package/dist/cjs/vite/config-builder/configs/lib.cjs +57 -0
  50. package/dist/cjs/vite/config-builder/configs/lib.d.cts +4 -0
  51. package/dist/cjs/vite/config-builder/configs/script.cjs +46 -0
  52. package/dist/cjs/vite/config-builder/configs/script.d.cts +4 -0
  53. package/dist/cjs/vite/config-builder/main.cjs +42 -0
  54. package/dist/cjs/vite/config-builder/main.d.cts +10 -0
  55. package/dist/cjs/vite/config-builder/plugins.cjs +93 -0
  56. package/dist/{src/vite/config-builder/plugins.d.ts → cjs/vite/config-builder/plugins.d.cts} +7 -7
  57. package/dist/cjs/vite/config-builder/shared/types.cjs +33 -0
  58. package/dist/{src/vite/config-builder/shared/types.d.ts → cjs/vite/config-builder/shared/types.d.cts} +17 -17
  59. package/dist/cjs/vite/config-builder/shared/utils/helpers.cjs +115 -0
  60. package/dist/{src/vite/config-builder/shared/utils/helpers.d.ts → cjs/vite/config-builder/shared/utils/helpers.d.cts} +9 -19
  61. package/dist/cjs/vite/config-builder/shared/utils/projectConfig.cjs +114 -0
  62. package/dist/{src/vite/config-builder/shared/utils/projectConfig.d.ts → cjs/vite/config-builder/shared/utils/projectConfig.d.cts} +8 -8
  63. package/dist/cjs/vite/config-builder/shared/utils/viteCommand.cjs +59 -0
  64. package/dist/{src/vite/config-builder/shared/utils/viteCommand.d.ts → cjs/vite/config-builder/shared/utils/viteCommand.d.cts} +4 -4
  65. package/dist/{src/vite/plugins/shadow-dom-inject-css/index.js → cjs/vite/plugins/shadow-dom-inject-css/index.cjs} +4 -19
  66. package/dist/cjs/vite/plugins/shadow-dom-inject-css/index.d.cts +7 -0
  67. package/dist/{src/vite/plugins/third-party-css-inject/main.js → cjs/vite/plugins/third-party-css-inject/main.cjs} +13 -14
  68. package/dist/cjs/vite/plugins/third-party-css-inject/main.d.cts +17 -0
  69. package/dist/{src/vite/plugins/third-party-css-inject/utils.js → cjs/vite/plugins/third-party-css-inject/utils.cjs} +8 -20
  70. package/dist/cjs/vite/plugins/third-party-css-inject/utils.d.cts +5 -0
  71. package/dist/esm/executors/deploy/helpers.d.mts +4 -0
  72. package/dist/esm/executors/deploy/helpers.mjs +22 -0
  73. package/dist/esm/executors/deploy/index.d.mts +11 -0
  74. package/dist/esm/executors/deploy/index.mjs +20 -0
  75. package/dist/esm/executors/deploy/schema.json +41 -0
  76. package/dist/esm/executors/environments/helpers.d.mts +25 -0
  77. package/dist/esm/executors/environments/helpers.mjs +58 -0
  78. package/dist/esm/executors/environments/index.d.mts +16 -0
  79. package/dist/esm/executors/environments/index.mjs +58 -0
  80. package/dist/esm/executors/environments/schema.json +9 -0
  81. package/dist/esm/executors/publish/helpers.d.mts +19 -0
  82. package/dist/esm/executors/publish/helpers.mjs +48 -0
  83. package/dist/esm/executors/publish/index.d.mts +12 -0
  84. package/dist/esm/executors/publish/index.mjs +51 -0
  85. package/dist/esm/executors/publish/schema.json +19 -0
  86. package/dist/esm/executors/shared/utils.d.mts +27 -0
  87. package/dist/esm/executors/shared/utils.mjs +62 -0
  88. package/dist/esm/executors/update-executors-file/helpers.d.mts +17 -0
  89. package/dist/esm/executors/update-executors-file/helpers.mjs +59 -0
  90. package/dist/esm/executors/update-executors-file/index.d.mts +12 -0
  91. package/dist/esm/executors/update-executors-file/index.mjs +36 -0
  92. package/dist/esm/executors/update-executors-file/schema.json +9 -0
  93. package/dist/esm/executors/vtex-link/constants.d.mts +4 -0
  94. package/dist/esm/executors/vtex-link/constants.mjs +5 -0
  95. package/dist/esm/executors/vtex-link/helpers.d.mts +77 -0
  96. package/dist/esm/executors/vtex-link/helpers.mjs +192 -0
  97. package/dist/esm/executors/vtex-link/index.d.mts +5 -0
  98. package/dist/esm/executors/vtex-link/index.mjs +28 -0
  99. package/dist/esm/executors/vtex-link/schema.json +25 -0
  100. package/dist/esm/index-0ce2daf7.d.ts +2 -0
  101. package/dist/esm/index-17143e35.d.ts +2 -0
  102. package/dist/esm/index-3080371d.d.ts +3 -0
  103. package/dist/esm/index-f6330edc.d.ts +2 -0
  104. package/dist/esm/index.d.mts +10 -0
  105. package/dist/esm/index.d.mts.map +1 -0
  106. package/dist/esm/index.mjs +14 -0
  107. package/dist/esm/scripts/changeset-pre-mode.d.mts +2 -0
  108. package/dist/esm/scripts/changeset-pre-mode.mjs +39 -0
  109. package/dist/esm/scripts/index.d.mts +1 -0
  110. package/dist/esm/scripts/index.mjs +1 -0
  111. package/dist/esm/shared/logger.d.mts +33 -0
  112. package/dist/{src/logger.js → esm/shared/logger.mjs} +28 -39
  113. package/dist/esm/shared/utils.d.mts +19 -0
  114. package/dist/esm/shared/utils.mjs +60 -0
  115. package/dist/esm/types-1282e639.d.ts +12 -0
  116. package/dist/esm/types-7377dcc9.d.ts +4 -0
  117. package/dist/esm/types-763439e4.d.ts +14 -0
  118. package/dist/esm/vite/config-builder/configs/app.d.mts +4 -0
  119. package/dist/esm/vite/config-builder/configs/app.mjs +11 -0
  120. package/dist/esm/vite/config-builder/configs/base.d.mts +4 -0
  121. package/dist/{src/vite/config-builder/configs/base.js → esm/vite/config-builder/configs/base.mjs} +23 -22
  122. package/dist/esm/vite/config-builder/configs/index.d.mts +7 -0
  123. package/dist/esm/vite/config-builder/configs/index.mjs +30 -0
  124. package/dist/esm/vite/config-builder/configs/lib.d.mts +4 -0
  125. package/dist/{src/vite/config-builder/configs/lib.js → esm/vite/config-builder/configs/lib.mjs} +16 -18
  126. package/dist/esm/vite/config-builder/configs/script.d.mts +4 -0
  127. package/dist/esm/vite/config-builder/configs/script.mjs +44 -0
  128. package/dist/esm/vite/config-builder/main.d.mts +10 -0
  129. package/dist/esm/vite/config-builder/main.mjs +40 -0
  130. package/dist/esm/vite/config-builder/plugins.d.mts +30 -0
  131. package/dist/esm/vite/config-builder/plugins.mjs +87 -0
  132. package/dist/esm/vite/config-builder/shared/types.d.mts +155 -0
  133. package/dist/{src/vite/config-builder/shared/types.js → esm/vite/config-builder/shared/types.mjs} +2 -27
  134. package/dist/esm/vite/config-builder/shared/utils/helpers.d.mts +71 -0
  135. package/dist/esm/vite/config-builder/shared/utils/helpers.mjs +90 -0
  136. package/dist/esm/vite/config-builder/shared/utils/projectConfig.d.mts +60 -0
  137. package/dist/esm/vite/config-builder/shared/utils/projectConfig.mjs +109 -0
  138. package/dist/esm/vite/config-builder/shared/utils/viteCommand.d.mts +24 -0
  139. package/dist/esm/vite/config-builder/shared/utils/viteCommand.mjs +56 -0
  140. package/dist/esm/vite/plugins/shadow-dom-inject-css/index.d.mts +7 -0
  141. package/dist/esm/vite/plugins/shadow-dom-inject-css/index.mjs +27 -0
  142. package/dist/esm/vite/plugins/third-party-css-inject/main.d.mts +17 -0
  143. package/dist/esm/vite/plugins/third-party-css-inject/main.mjs +45 -0
  144. package/dist/esm/vite/plugins/third-party-css-inject/utils.d.mts +5 -0
  145. package/dist/esm/vite/plugins/third-party-css-inject/utils.mjs +97 -0
  146. package/dist/executors.json +29 -0
  147. package/executors.json +29 -0
  148. package/package.json +52 -6
  149. package/dist/package.json +0 -13
  150. package/dist/src/executors/deploy/executor.d.ts +0 -11
  151. package/dist/src/executors/deploy/executor.d.ts.map +0 -1
  152. package/dist/src/executors/deploy/executor.js +0 -27
  153. package/dist/src/executors/deploy/helpers.d.ts +0 -4
  154. package/dist/src/executors/deploy/helpers.d.ts.map +0 -1
  155. package/dist/src/executors/deploy/helpers.js +0 -40
  156. package/dist/src/executors/environments/executor.d.ts.map +0 -1
  157. package/dist/src/executors/environments/executor.js +0 -59
  158. package/dist/src/executors/environments/helpers.d.ts.map +0 -1
  159. package/dist/src/executors/environments/helpers.js +0 -63
  160. package/dist/src/executors/publish/executor.d.ts +0 -12
  161. package/dist/src/executors/publish/executor.d.ts.map +0 -1
  162. package/dist/src/executors/publish/executor.js +0 -58
  163. package/dist/src/executors/publish/helpers.d.ts.map +0 -1
  164. package/dist/src/executors/publish/helpers.js +0 -52
  165. package/dist/src/executors/shared/index.d.ts +0 -3
  166. package/dist/src/executors/shared/index.d.ts.map +0 -1
  167. package/dist/src/executors/shared/index.js +0 -7
  168. package/dist/src/executors/shared/types.d.ts +0 -4
  169. package/dist/src/executors/shared/types.d.ts.map +0 -1
  170. package/dist/src/executors/shared/types.js +0 -4
  171. package/dist/src/executors/shared/utils.d.ts +0 -34
  172. package/dist/src/executors/shared/utils.d.ts.map +0 -1
  173. package/dist/src/executors/shared/utils.js +0 -74
  174. package/dist/src/executors/update-executors-file/executor.d.ts.map +0 -1
  175. package/dist/src/executors/update-executors-file/executor.js +0 -46
  176. package/dist/src/executors/update-executors-file/helpers.d.ts +0 -24
  177. package/dist/src/executors/update-executors-file/helpers.d.ts.map +0 -1
  178. package/dist/src/executors/update-executors-file/helpers.js +0 -70
  179. package/dist/src/executors/update-executors-file/types.d.ts +0 -14
  180. package/dist/src/executors/update-executors-file/types.d.ts.map +0 -1
  181. package/dist/src/executors/update-executors-file/types.js +0 -4
  182. package/dist/src/executors/vtex-link/constants.d.ts +0 -4
  183. package/dist/src/executors/vtex-link/constants.d.ts.map +0 -1
  184. package/dist/src/executors/vtex-link/constants.js +0 -24
  185. package/dist/src/executors/vtex-link/executor.d.ts +0 -5
  186. package/dist/src/executors/vtex-link/executor.d.ts.map +0 -1
  187. package/dist/src/executors/vtex-link/executor.js +0 -35
  188. package/dist/src/executors/vtex-link/helpers.d.ts.map +0 -1
  189. package/dist/src/executors/vtex-link/helpers.js +0 -187
  190. package/dist/src/executors/vtex-link/types.d.ts.map +0 -1
  191. package/dist/src/executors/vtex-link/types.js +0 -4
  192. package/dist/src/index.d.ts +0 -2
  193. package/dist/src/index.d.ts.map +0 -1
  194. package/dist/src/index.js +0 -6
  195. package/dist/src/logger.d.ts.map +0 -1
  196. package/dist/src/scripts/changeset-pre-mode.d.ts +0 -2
  197. package/dist/src/scripts/changeset-pre-mode.d.ts.map +0 -1
  198. package/dist/src/scripts/changeset-pre-mode.js +0 -41
  199. package/dist/src/shared/index.d.ts +0 -2
  200. package/dist/src/shared/index.d.ts.map +0 -1
  201. package/dist/src/shared/index.js +0 -6
  202. package/dist/src/shared/utils.d.ts +0 -11
  203. package/dist/src/shared/utils.d.ts.map +0 -1
  204. package/dist/src/shared/utils.js +0 -22
  205. package/dist/src/vite/config-builder/configs/app.d.ts +0 -4
  206. package/dist/src/vite/config-builder/configs/app.d.ts.map +0 -1
  207. package/dist/src/vite/config-builder/configs/app.js +0 -19
  208. package/dist/src/vite/config-builder/configs/base.d.ts +0 -4
  209. package/dist/src/vite/config-builder/configs/base.d.ts.map +0 -1
  210. package/dist/src/vite/config-builder/configs/index.d.ts +0 -7
  211. package/dist/src/vite/config-builder/configs/index.d.ts.map +0 -1
  212. package/dist/src/vite/config-builder/configs/index.js +0 -28
  213. package/dist/src/vite/config-builder/configs/lib.d.ts +0 -4
  214. package/dist/src/vite/config-builder/configs/lib.d.ts.map +0 -1
  215. package/dist/src/vite/config-builder/configs/script.d.ts +0 -4
  216. package/dist/src/vite/config-builder/configs/script.d.ts.map +0 -1
  217. package/dist/src/vite/config-builder/configs/script.js +0 -42
  218. package/dist/src/vite/config-builder/index.d.ts +0 -3
  219. package/dist/src/vite/config-builder/index.d.ts.map +0 -1
  220. package/dist/src/vite/config-builder/index.js +0 -7
  221. package/dist/src/vite/config-builder/main.d.ts +0 -10
  222. package/dist/src/vite/config-builder/main.d.ts.map +0 -1
  223. package/dist/src/vite/config-builder/main.js +0 -37
  224. package/dist/src/vite/config-builder/plugins.d.ts.map +0 -1
  225. package/dist/src/vite/config-builder/plugins.js +0 -88
  226. package/dist/src/vite/config-builder/shared/index.d.ts +0 -3
  227. package/dist/src/vite/config-builder/shared/index.d.ts.map +0 -1
  228. package/dist/src/vite/config-builder/shared/index.js +0 -7
  229. package/dist/src/vite/config-builder/shared/types.d.ts.map +0 -1
  230. package/dist/src/vite/config-builder/shared/utils/helpers.d.ts.map +0 -1
  231. package/dist/src/vite/config-builder/shared/utils/helpers.js +0 -61
  232. package/dist/src/vite/config-builder/shared/utils/index.d.ts +0 -4
  233. package/dist/src/vite/config-builder/shared/utils/index.d.ts.map +0 -1
  234. package/dist/src/vite/config-builder/shared/utils/index.js +0 -8
  235. package/dist/src/vite/config-builder/shared/utils/projectConfig.d.ts.map +0 -1
  236. package/dist/src/vite/config-builder/shared/utils/projectConfig.js +0 -85
  237. package/dist/src/vite/config-builder/shared/utils/viteCommand.d.ts.map +0 -1
  238. package/dist/src/vite/config-builder/shared/utils/viteCommand.js +0 -54
  239. package/dist/src/vite/index.d.ts +0 -3
  240. package/dist/src/vite/index.d.ts.map +0 -1
  241. package/dist/src/vite/index.js +0 -7
  242. package/dist/src/vite/plugins/index.d.ts +0 -3
  243. package/dist/src/vite/plugins/index.d.ts.map +0 -1
  244. package/dist/src/vite/plugins/index.js +0 -7
  245. package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts +0 -8
  246. package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts.map +0 -1
  247. package/dist/src/vite/plugins/third-party-css-inject/index.d.ts +0 -4
  248. package/dist/src/vite/plugins/third-party-css-inject/index.d.ts.map +0 -1
  249. package/dist/src/vite/plugins/third-party-css-inject/index.js +0 -13
  250. package/dist/src/vite/plugins/third-party-css-inject/main.d.ts +0 -17
  251. package/dist/src/vite/plugins/third-party-css-inject/main.d.ts.map +0 -1
  252. package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts +0 -5
  253. package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts.map +0 -1
  254. /package/dist/{src → cjs}/executors/deploy/schema.json +0 -0
  255. /package/dist/{src → cjs}/executors/environments/schema.json +0 -0
  256. /package/dist/{src → cjs}/executors/publish/schema.json +0 -0
  257. /package/dist/{src → cjs}/executors/update-executors-file/schema.json +0 -0
  258. /package/dist/{src → cjs}/executors/vtex-link/schema.json +0 -0
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var devkit = require('@nx/devkit');
4
+ var crypto = require('crypto');
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+
8
+ /**
9
+ * Reads and parses the package.json file from the given project path.
10
+ *
11
+ * @param {string} projectPath - The path to the project.
12
+ * @returns {Record<string, any>} - The parsed package.json data.
13
+ *
14
+ * @example
15
+ * const pkgJsonData = getPkgJson('/path/to/project');
16
+ */ const getPkgJson = (projectPath)=>{
17
+ try {
18
+ const data = fs.readFileSync(path.resolve(projectPath, './package.json'), 'utf-8');
19
+ return JSON.parse(data);
20
+ } catch (err) {
21
+ devkit.logger.error('Error reading or parsing package.json');
22
+ throw err;
23
+ }
24
+ };
25
+ /**
26
+ * Generates a random alphanumeric identifier of a specified length.
27
+ *
28
+ * @param {number} [length=8] - The length of the identifier to generate. Defaults to 8 if not specified.
29
+ * @returns {string} - A string representing a unique identifier.
30
+ */ function shortId(length = 8) {
31
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
32
+ return Array.from(crypto.randomBytes(length), (b)=>chars[b % chars.length]).join('');
33
+ }
34
+ function combineGlobStyles(array) {
35
+ function createReadableKey(path) {
36
+ const pathParts = path.split('/').filter((part)=>part);
37
+ const fileName = pathParts.pop()?.split('.')[0];
38
+ const folderName = pathParts.pop()?.replace('.', '');
39
+ if (fileName && folderName) {
40
+ return `${folderName}-${fileName}`;
41
+ } else if (fileName) {
42
+ return fileName;
43
+ } else {
44
+ return '';
45
+ }
46
+ }
47
+ return array.reduce((result, item)=>{
48
+ const transformedItem = Object.entries(item).reduce((newItem, [key, value])=>{
49
+ const readableKey = createReadableKey(key);
50
+ const uniqueHash = shortId(5);
51
+ const newKey = `${readableKey}-${uniqueHash}`;
52
+ newItem[newKey] = value;
53
+ return newItem;
54
+ }, {});
55
+ return {
56
+ ...result,
57
+ ...transformedItem
58
+ };
59
+ }, {});
60
+ }
61
+
62
+ exports.combineGlobStyles = combineGlobStyles;
63
+ exports.getPkgJson = getPkgJson;
64
+ exports.shortId = shortId;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Reads and parses the package.json file from the given project path.
3
+ *
4
+ * @param {string} projectPath - The path to the project.
5
+ * @returns {Record<string, any>} - The parsed package.json data.
6
+ *
7
+ * @example
8
+ * const pkgJsonData = getPkgJson('/path/to/project');
9
+ */
10
+ declare const getPkgJson: (projectPath: string) => Record<string, any>;
11
+ /**
12
+ * Generates a random alphanumeric identifier of a specified length.
13
+ *
14
+ * @param {number} [length=8] - The length of the identifier to generate. Defaults to 8 if not specified.
15
+ * @returns {string} - A string representing a unique identifier.
16
+ */
17
+ declare function shortId(length?: number): string;
18
+ declare function combineGlobStyles(array: Record<string, any>[]): Record<string, string>;
19
+ export { getPkgJson, shortId, combineGlobStyles };
@@ -1,12 +1,12 @@
1
- export interface SharedContext {
1
+ interface SharedContext {
2
2
  vtexProjectPath: string;
3
3
  projectRoot: string;
4
4
  projectName: string;
5
5
  packageOrg: string;
6
6
  }
7
- export interface ExecutorOptions {
7
+ interface ExecutorOptions {
8
8
  packageOrg: string;
9
9
  rollback?: boolean;
10
10
  skipLink?: boolean;
11
11
  }
12
- //# sourceMappingURL=types.d.ts.map
12
+ export { SharedContext, ExecutorOptions };
@@ -0,0 +1,4 @@
1
+ type ExecutorResponse = {
2
+ success: boolean;
3
+ };
4
+ export { ExecutorResponse };
@@ -0,0 +1,14 @@
1
+ interface ExecutorOptions {
2
+ }
3
+ interface ExecutorConfig {
4
+ implementation: string;
5
+ schema: string;
6
+ description: string;
7
+ }
8
+ interface Executors {
9
+ [executorName: string]: ExecutorConfig;
10
+ }
11
+ interface ExecutorsFile {
12
+ executors: Executors;
13
+ }
14
+ export { ExecutorOptions, ExecutorConfig, Executors, ExecutorsFile };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ const getAppConfig = (ctx)=>{
4
+ const { port } = ctx.projectConfig;
5
+ return {
6
+ server: {
7
+ port,
8
+ host: true
9
+ }
10
+ };
11
+ };
12
+
13
+ exports.getAppConfig = getAppConfig;
@@ -0,0 +1,4 @@
1
+ import { UserConfig } from 'vite';
2
+ import { Context } from "../../../index-f6330edc.js";
3
+ declare const getAppConfig: (ctx: Context) => UserConfig;
4
+ export { getAppConfig };
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var plugins = require('../plugins.cjs');
4
+ var types = require('../shared/types.cjs');
5
+ var helpers = require('../shared/utils/helpers.cjs');
6
+ require('minimatch');
7
+ require('../../../shared/logger.cjs');
8
+ require('@nx/devkit');
9
+ require('crypto');
10
+ var fs = require('fs');
11
+ var path = require('path');
12
+ require('chalk');
13
+ require('mri');
14
+ require('vite');
15
+
16
+ const getBaseConfig = (ctx)=>{
17
+ const { commonConfig, projectConfig, viteCmd } = ctx;
18
+ const { resolveEnvs, path: path$1 } = projectConfig;
19
+ const { stage, target, flags: cmdOverrides } = viteCmd;
20
+ const NODE_ENV = target === types.Target.BUILD ? types.ViteMode.PROD : types.ViteMode.DEV;
21
+ const sourcemap = cmdOverrides?.[types.Flag.SOURCEMAP] ?? stage !== types.Stage.PROD;
22
+ const envPrefix = `${commonConfig.envPrefix.toUpperCase()}_`;
23
+ const omittedStages = resolveEnvs.local ? [
24
+ types.Stage.DEV
25
+ ] : [
26
+ types.Stage.DEV,
27
+ types.Stage.LOCAL
28
+ ];
29
+ const envPath = `environments/environment.${stage}.ts`;
30
+ const fallbackEnvPath = `environments/environment.ts`;
31
+ // Verify if the local Environment file is present
32
+ const envFilePath = fs.existsSync(path.resolve(path$1, 'src', envPath)) ? envPath : fallbackEnvPath;
33
+ return {
34
+ envPrefix,
35
+ plugins: helpers.getPlugins(ctx, plugins.basePlugins, plugins.bundleAnalysisPlugin),
36
+ resolve: {
37
+ alias: {
38
+ ...helpers.when(resolveEnvs.default && !omittedStages.includes(stage), {
39
+ '~env': envFilePath
40
+ })
41
+ }
42
+ },
43
+ define: {
44
+ 'module.hot': false,
45
+ 'process.env.DEBUG': null,
46
+ 'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
47
+ __vite_process_env_NODE_ENV: JSON.stringify(NODE_ENV)
48
+ },
49
+ build: {
50
+ sourcemap,
51
+ minify: true,
52
+ emptyOutDir: true,
53
+ cssCodeSplit: true
54
+ }
55
+ };
56
+ };
57
+
58
+ exports.getBaseConfig = getBaseConfig;
@@ -0,0 +1,4 @@
1
+ import { UserConfig } from 'vite';
2
+ import { Context } from "../../../index-f6330edc.js";
3
+ declare const getBaseConfig: (ctx: Context) => UserConfig;
4
+ export { getBaseConfig };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var types = require('../shared/types.cjs');
4
+ require('@nx/devkit');
5
+ require('path');
6
+ require('ramda');
7
+ require('../../../shared/logger.cjs');
8
+ require('crypto');
9
+ require('fs');
10
+ require('minimatch');
11
+ require('chalk');
12
+ require('mri');
13
+ require('vite');
14
+ var app = require('./app.cjs');
15
+ var base = require('./base.cjs');
16
+ var lib = require('./lib.cjs');
17
+ var script = require('./script.cjs');
18
+
19
+ const getConfig = (ctx, type = null)=>{
20
+ switch(type){
21
+ case types.ProjectType.APP:
22
+ return app.getAppConfig(ctx);
23
+ case types.ProjectType.LIB:
24
+ return lib.getLibConfig(ctx);
25
+ case types.ProjectType.SCRIPT:
26
+ return script.getScriptConfig(ctx);
27
+ default:
28
+ return base.getBaseConfig(ctx);
29
+ }
30
+ };
31
+
32
+ exports.getAppConfig = app.getAppConfig;
33
+ exports.getBaseConfig = base.getBaseConfig;
34
+ exports.getLibConfig = lib.getLibConfig;
35
+ exports.getScriptConfig = script.getScriptConfig;
36
+ exports.getConfig = getConfig;
@@ -0,0 +1,7 @@
1
+ import { ProjectType, Context } from "../../../index-f6330edc.js";
2
+ declare const getConfig: (ctx: Context, type?: ProjectType | null) => import("vite").UserConfig;
3
+ export * from "./app.js";
4
+ export * from "./base.js";
5
+ export * from "./lib.js";
6
+ export * from "./script.js";
7
+ export { getConfig };
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var plugins = require('../plugins.cjs');
5
+ require('../shared/types.cjs');
6
+ var helpers = require('../shared/utils/helpers.cjs');
7
+ var projectConfig = require('../shared/utils/projectConfig.cjs');
8
+ require('chalk');
9
+ require('mri');
10
+ require('vite');
11
+
12
+ const getLibConfig = (ctx)=>{
13
+ const { projectConfig: projectConfig$1, commonConfig } = ctx;
14
+ const { externalizeLibGlob = [] } = commonConfig;
15
+ const { name, path: path$1, externalizeLibs } = projectConfig$1;
16
+ const entry = path.resolve(path$1, projectConfig$1.entry ?? 'src/index.ts');
17
+ const defaultExternals = {
18
+ react: true,
19
+ 'react-dom': true,
20
+ 'react/jsx-runtime': true
21
+ };
22
+ // Get external dependencies based on glob patterns
23
+ const externalDeps = projectConfig.getExternalDependencies(path$1, [
24
+ ...externalizeLibGlob,
25
+ ...externalizeLibs.glob
26
+ ]);
27
+ const rollupExternal = [
28
+ ...externalDeps,
29
+ ...Object.keys(helpers.when(externalizeLibs.default, defaultExternals))
30
+ ];
31
+ const rollupGlobals = {
32
+ react: 'React',
33
+ 'react-dom': 'ReactDOM',
34
+ 'react/jsx-runtime': 'ReactJsxRuntime'
35
+ };
36
+ return {
37
+ plugins: helpers.getPlugins(ctx, plugins.dtsPlugin),
38
+ build: {
39
+ lib: {
40
+ name,
41
+ entry,
42
+ formats: [
43
+ 'es'
44
+ ],
45
+ fileName: (format)=>`index.${format === 'es' ? 'mjs' : 'cjs'}`
46
+ },
47
+ rollupOptions: {
48
+ external: rollupExternal,
49
+ output: {
50
+ globals: helpers.when(externalizeLibs.default, rollupGlobals)
51
+ }
52
+ }
53
+ }
54
+ };
55
+ };
56
+
57
+ exports.getLibConfig = getLibConfig;
@@ -0,0 +1,4 @@
1
+ import { UserConfig } from 'vite';
2
+ import { Context } from "../../../index-f6330edc.js";
3
+ declare const getLibConfig: (ctx: Context) => UserConfig;
4
+ export { getLibConfig };
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var plugins = require('../plugins.cjs');
5
+ require('../shared/types.cjs');
6
+ var helpers = require('../shared/utils/helpers.cjs');
7
+ require('minimatch');
8
+ require('../../../shared/logger.cjs');
9
+ require('@nx/devkit');
10
+ require('crypto');
11
+ require('fs');
12
+ require('chalk');
13
+ require('mri');
14
+ require('vite');
15
+
16
+ const getScriptConfig = (ctx)=>{
17
+ const { commonConfig, projectConfig } = ctx;
18
+ const { envPrefix } = commonConfig;
19
+ const { port } = projectConfig;
20
+ const { name, path: path$1, fileName, chunkPrefix } = projectConfig;
21
+ const entry = path.resolve(path$1, projectConfig.entry ?? 'src/main');
22
+ return {
23
+ plugins: helpers.getPlugins(ctx, plugins.injectCssIntoShadowDomPlugin, plugins.injectCssByJsPlugin),
24
+ server: {
25
+ port,
26
+ host: true
27
+ },
28
+ build: {
29
+ lib: {
30
+ name,
31
+ entry,
32
+ fileName,
33
+ formats: [
34
+ 'es'
35
+ ]
36
+ },
37
+ rollupOptions: {
38
+ output: {
39
+ chunkFileNames: helpers.chunkName(`${envPrefix}-${chunkPrefix}`)
40
+ }
41
+ }
42
+ }
43
+ };
44
+ };
45
+
46
+ exports.getScriptConfig = getScriptConfig;
@@ -0,0 +1,4 @@
1
+ import { UserConfig } from 'vite';
2
+ import { Context } from "../../../index-f6330edc.js";
3
+ declare const getScriptConfig: (ctx: Context) => UserConfig;
4
+ export { getScriptConfig };
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var vite = require('vite');
4
+ var logger = require('../../shared/logger.cjs');
5
+ var utils = require('../../shared/utils.cjs');
6
+ var index = require('./configs/index.cjs');
7
+ require('./shared/types.cjs');
8
+ require('@nx/devkit');
9
+ require('path');
10
+ require('ramda');
11
+ var projectConfig = require('./shared/utils/projectConfig.cjs');
12
+ require('chalk');
13
+ require('mri');
14
+
15
+ /**
16
+ * Builds the configuration based on common and project-specific configurations.
17
+ *
18
+ * @param {CommonProjectConfig} commonConfig - The common configuration.
19
+ * @returns - Returns a function that accepts a project configuration and returns the Vite configuration.
20
+ */ const createConfigBuilder = (commonConfig)=>(projectConfig$1)=>{
21
+ try {
22
+ const localPkgJson = utils.getPkgJson(projectConfig$1.path);
23
+ const { cfg, viteCmd } = projectConfig.initializeConfig(commonConfig, projectConfig$1, localPkgJson);
24
+ const isDebug = logger.currentLogLevel === logger.LogLevel.DEBUG;
25
+ const { type, overrides } = cfg;
26
+ const ctx = {
27
+ viteCmd,
28
+ localPkgJson,
29
+ commonConfig,
30
+ projectConfig: cfg
31
+ };
32
+ const defaultConfig = projectConfig.mergeConfigs(index.getConfig(ctx), index.getConfig(ctx, type));
33
+ const config = projectConfig.mergeConfigs(defaultConfig, overrides);
34
+ if (isDebug) logger.logger.debug('Generated config:', config);
35
+ return vite.defineConfig(config);
36
+ } catch (err) {
37
+ logger.logger.error('buildConfig unexpected error:');
38
+ throw err;
39
+ }
40
+ };
41
+
42
+ exports.createConfigBuilder = createConfigBuilder;
@@ -0,0 +1,10 @@
1
+ import { UserConfig } from 'vite';
2
+ import { CommonProjectConfig, ProjectConfig } from "../../index-f6330edc.js";
3
+ /**
4
+ * Builds the configuration based on common and project-specific configurations.
5
+ *
6
+ * @param {CommonProjectConfig} commonConfig - The common configuration.
7
+ * @returns - Returns a function that accepts a project configuration and returns the Vite configuration.
8
+ */
9
+ declare const createConfigBuilder: (commonConfig: CommonProjectConfig) => (projectConfig: ProjectConfig) => UserConfig;
10
+ export { createConfigBuilder };
@@ -0,0 +1,93 @@
1
+ 'use strict';
2
+
3
+ var vitePluginCommonjs = require('@originjs/vite-plugin-commonjs');
4
+ var graphql = require('@rollup/plugin-graphql');
5
+ var react = require('@vitejs/plugin-react-swc');
6
+ var path = require('path');
7
+ var rollupPluginVisualizer = require('rollup-plugin-visualizer');
8
+ var cssInjectedByJsPlugin = require('vite-plugin-css-injected-by-js');
9
+ var dts = require('vite-plugin-dts');
10
+ var tsconfigPaths = require('vite-tsconfig-paths');
11
+ require('vite');
12
+ var index = require('../plugins/shadow-dom-inject-css/index.cjs');
13
+ var types = require('./shared/types.cjs');
14
+ var helpers = require('./shared/utils/helpers.cjs');
15
+ require('minimatch');
16
+ require('../../shared/logger.cjs');
17
+ require('@nx/devkit');
18
+ require('crypto');
19
+ require('fs');
20
+ require('chalk');
21
+ require('mri');
22
+
23
+ /**
24
+ * Base plugins configuration for apps and libs.
25
+ *
26
+ * Plugins configured:
27
+ * - vite-tsconfig-paths
28
+ * - @originjs/vite-plugin-commonjs
29
+ * - @rollup/plugin-graphql
30
+ * - @vitejs/plugin-react-swc
31
+ */ const basePlugins = {
32
+ generate: ()=>{
33
+ const projects = helpers.getNxTsConfigPaths();
34
+ return [
35
+ tsconfigPaths({
36
+ projects
37
+ }),
38
+ vitePluginCommonjs.viteCommonjs(),
39
+ graphql(),
40
+ react({
41
+ tsDecorators: true
42
+ })
43
+ ];
44
+ }
45
+ };
46
+ /**
47
+ * Plugin configuration for generating type declarations using vite-plugin-dts.
48
+ */ const dtsPlugin = {
49
+ generate: ({ projectConfig })=>[
50
+ dts({
51
+ tsconfigPath: path.resolve(projectConfig.path, 'tsconfig.lib.json'),
52
+ outDir: path.resolve(projectConfig.path, 'dist'),
53
+ entryRoot: path.resolve(projectConfig.path, 'src')
54
+ })
55
+ ],
56
+ condition: ({ projectConfig, viteCmd })=>viteCmd.stage !== types.Stage.LOCAL && projectConfig.dts == null ? true : !!projectConfig.dts
57
+ };
58
+ /**
59
+ * Plugin configuration for bundle analysis using rollup-plugin-visualizer.
60
+ */ const bundleAnalysisPlugin = {
61
+ generate: ({ projectConfig })=>[
62
+ rollupPluginVisualizer.visualizer({
63
+ emitFile: true,
64
+ projectRoot: path.resolve(projectConfig.path, 'dist'),
65
+ filename: 'bundle-analysis.html'
66
+ })
67
+ ],
68
+ condition: ({ viteCmd })=>viteCmd.flags?.[types.Flag.ANALYZE] === 'true'
69
+ };
70
+ /**
71
+ * Plugin configuration for injecting CSS into JS files
72
+ * using vite-plugin-css-injected-by-js.
73
+ */ const injectCssByJsPlugin = {
74
+ generate: (_)=>[
75
+ cssInjectedByJsPlugin()
76
+ ],
77
+ condition: ({ projectConfig })=>!projectConfig.shadowDom
78
+ };
79
+ /**
80
+ * Plugin configuration for injecting CSS into Shadow Dom.
81
+ * using local plugin.
82
+ */ const injectCssIntoShadowDomPlugin = {
83
+ generate: (_)=>[
84
+ index.injectCssIntoShadowDom()
85
+ ],
86
+ condition: ({ projectConfig })=>projectConfig.shadowDom
87
+ };
88
+
89
+ exports.basePlugins = basePlugins;
90
+ exports.bundleAnalysisPlugin = bundleAnalysisPlugin;
91
+ exports.dtsPlugin = dtsPlugin;
92
+ exports.injectCssByJsPlugin = injectCssByJsPlugin;
93
+ exports.injectCssIntoShadowDomPlugin = injectCssIntoShadowDomPlugin;
@@ -1,4 +1,4 @@
1
- import { type PluginConfig } from './shared';
1
+ import { PluginConfig } from "../../index-f6330edc.js";
2
2
  /**
3
3
  * Base plugins configuration for apps and libs.
4
4
  *
@@ -8,23 +8,23 @@ import { type PluginConfig } from './shared';
8
8
  * - @rollup/plugin-graphql
9
9
  * - @vitejs/plugin-react-swc
10
10
  */
11
- export declare const basePlugins: PluginConfig;
11
+ declare const basePlugins: PluginConfig;
12
12
  /**
13
13
  * Plugin configuration for generating type declarations using vite-plugin-dts.
14
14
  */
15
- export declare const dtsPlugin: PluginConfig;
15
+ declare const dtsPlugin: PluginConfig;
16
16
  /**
17
17
  * Plugin configuration for bundle analysis using rollup-plugin-visualizer.
18
18
  */
19
- export declare const bundleAnalysisPlugin: PluginConfig;
19
+ declare const bundleAnalysisPlugin: PluginConfig;
20
20
  /**
21
21
  * Plugin configuration for injecting CSS into JS files
22
22
  * using vite-plugin-css-injected-by-js.
23
23
  */
24
- export declare const injectCssByJsPlugin: PluginConfig;
24
+ declare const injectCssByJsPlugin: PluginConfig;
25
25
  /**
26
26
  * Plugin configuration for injecting CSS into Shadow Dom.
27
27
  * using local plugin.
28
28
  */
29
- export declare const injectCssIntoShadowDomPlugin: PluginConfig;
30
- //# sourceMappingURL=plugins.d.ts.map
29
+ declare const injectCssIntoShadowDomPlugin: PluginConfig;
30
+ export { basePlugins, dtsPlugin, bundleAnalysisPlugin, injectCssByJsPlugin, injectCssIntoShadowDomPlugin };
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ exports.ViteMode = void 0;
4
+ (function(ViteMode) {
5
+ ViteMode["PROD"] = "production";
6
+ ViteMode["DEV"] = "development";
7
+ })(exports.ViteMode || (exports.ViteMode = {}));
8
+ exports.Stage = void 0;
9
+ (function(Stage) {
10
+ Stage["PROD"] = "prod";
11
+ Stage["DEV"] = "dev";
12
+ Stage["STAGING"] = "staging";
13
+ Stage["LOCAL"] = "local";
14
+ })(exports.Stage || (exports.Stage = {}));
15
+ exports.ProjectType = void 0;
16
+ (function(ProjectType) {
17
+ ProjectType["APP"] = "app";
18
+ ProjectType["LIB"] = "lib";
19
+ ProjectType["SCRIPT"] = "script";
20
+ })(exports.ProjectType || (exports.ProjectType = {}));
21
+ exports.Flag = void 0;
22
+ (function(Flag) {
23
+ Flag["SOURCEMAP"] = "source-maps";
24
+ Flag["ANALYZE"] = "analyze";
25
+ Flag["VERBOSE"] = "verbose";
26
+ Flag["VERBOSE_ALIAS"] = "v";
27
+ })(exports.Flag || (exports.Flag = {}));
28
+ exports.Target = void 0;
29
+ (function(Target) {
30
+ Target["BUILD"] = "build";
31
+ Target["PREVIEW"] = "preview";
32
+ Target["SERVE"] = "serve";
33
+ })(exports.Target || (exports.Target = {}));