@nizza/devkit 0.1.0-alpha.2 → 0.1.0-alpha.4

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