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

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 (250) hide show
  1. package/dist/cjs/executors/deploy/helpers.d.ts +4 -0
  2. package/dist/cjs/executors/deploy/helpers.js +26 -0
  3. package/dist/cjs/executors/deploy/index.d.ts +11 -0
  4. package/dist/cjs/executors/deploy/index.js +22 -0
  5. package/dist/{src → cjs}/executors/environments/helpers.d.ts +4 -4
  6. package/dist/cjs/executors/environments/helpers.js +63 -0
  7. package/dist/{src/executors/environments/executor.d.ts → cjs/executors/environments/index.d.ts} +5 -5
  8. package/dist/cjs/executors/environments/index.js +54 -0
  9. package/dist/{src → cjs}/executors/publish/helpers.d.ts +3 -3
  10. package/dist/cjs/executors/publish/helpers.js +51 -0
  11. package/dist/cjs/executors/publish/index.d.ts +12 -0
  12. package/dist/cjs/executors/publish/index.js +53 -0
  13. package/dist/cjs/executors/shared/utils.d.ts +34 -0
  14. package/dist/cjs/executors/shared/utils.js +78 -0
  15. package/dist/{src → cjs}/executors/update-executors-file/helpers.d.ts +7 -6
  16. package/dist/cjs/executors/update-executors-file/helpers.js +76 -0
  17. package/dist/{src/executors/update-executors-file/executor.d.ts → cjs/executors/update-executors-file/index.d.ts} +5 -5
  18. package/dist/cjs/executors/update-executors-file/index.js +41 -0
  19. package/dist/cjs/executors/vtex-link/constants.d.ts +4 -0
  20. package/dist/cjs/executors/vtex-link/constants.js +9 -0
  21. package/dist/{src → cjs}/executors/vtex-link/helpers.d.ts +15 -15
  22. package/dist/cjs/executors/vtex-link/helpers.js +206 -0
  23. package/dist/cjs/executors/vtex-link/index.d.ts +5 -0
  24. package/dist/cjs/executors/vtex-link/index.js +30 -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.d.ts +10 -0
  30. package/dist/cjs/index.d.ts.map +1 -0
  31. package/dist/cjs/index.js +59 -0
  32. package/dist/cjs/scripts/changeset-pre-mode.d.ts +2 -0
  33. package/dist/cjs/scripts/changeset-pre-mode.js +41 -0
  34. package/dist/{src → cjs/shared}/logger.d.ts +5 -6
  35. package/dist/cjs/shared/logger.js +98 -0
  36. package/dist/{src → cjs}/shared/utils.d.ts +2 -2
  37. package/dist/cjs/shared/utils.js +25 -0
  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.d.ts +4 -0
  42. package/dist/cjs/vite/config-builder/configs/app.js +13 -0
  43. package/dist/cjs/vite/config-builder/configs/base.d.ts +4 -0
  44. package/dist/cjs/vite/config-builder/configs/base.js +57 -0
  45. package/dist/cjs/vite/config-builder/configs/index.d.ts +7 -0
  46. package/dist/cjs/vite/config-builder/configs/index.js +36 -0
  47. package/dist/cjs/vite/config-builder/configs/lib.d.ts +4 -0
  48. package/dist/cjs/vite/config-builder/configs/lib.js +57 -0
  49. package/dist/cjs/vite/config-builder/configs/script.d.ts +4 -0
  50. package/dist/cjs/vite/config-builder/configs/script.js +45 -0
  51. package/dist/cjs/vite/config-builder/main.d.ts +10 -0
  52. package/dist/cjs/vite/config-builder/main.js +43 -0
  53. package/dist/{src → cjs}/vite/config-builder/plugins.d.ts +7 -7
  54. package/dist/cjs/vite/config-builder/plugins.js +95 -0
  55. package/dist/{src → cjs}/vite/config-builder/shared/types.d.ts +17 -17
  56. package/dist/cjs/vite/config-builder/shared/types.js +33 -0
  57. package/dist/{src → cjs}/vite/config-builder/shared/utils/helpers.d.ts +10 -10
  58. package/dist/cjs/vite/config-builder/shared/utils/helpers.js +124 -0
  59. package/dist/{src → cjs}/vite/config-builder/shared/utils/projectConfig.d.ts +8 -8
  60. package/dist/cjs/vite/config-builder/shared/utils/projectConfig.js +114 -0
  61. package/dist/{src → cjs}/vite/config-builder/shared/utils/viteCommand.d.ts +4 -4
  62. package/dist/cjs/vite/config-builder/shared/utils/viteCommand.js +59 -0
  63. package/dist/cjs/vite/plugins/shadow-dom-inject-css/index.d.ts +7 -0
  64. package/dist/{src → cjs}/vite/plugins/shadow-dom-inject-css/index.js +4 -19
  65. package/dist/cjs/vite/plugins/third-party-css-inject/main.d.ts +17 -0
  66. package/dist/{src → cjs}/vite/plugins/third-party-css-inject/main.js +13 -14
  67. package/dist/cjs/vite/plugins/third-party-css-inject/utils.d.ts +5 -0
  68. package/dist/{src → cjs}/vite/plugins/third-party-css-inject/utils.js +8 -20
  69. package/dist/esm/executors/deploy/helpers.d.ts +4 -0
  70. package/dist/esm/executors/deploy/helpers.js +22 -0
  71. package/dist/esm/executors/deploy/index.d.ts +11 -0
  72. package/dist/esm/executors/deploy/index.js +20 -0
  73. package/dist/esm/executors/deploy/schema.json +41 -0
  74. package/dist/esm/executors/environments/helpers.d.ts +21 -0
  75. package/dist/esm/executors/environments/helpers.js +59 -0
  76. package/dist/esm/executors/environments/index.d.ts +16 -0
  77. package/dist/{src/executors/environments/executor.js → esm/executors/environments/index.js} +23 -30
  78. package/dist/esm/executors/environments/schema.json +9 -0
  79. package/dist/esm/executors/publish/helpers.d.ts +19 -0
  80. package/dist/esm/executors/publish/helpers.js +48 -0
  81. package/dist/esm/executors/publish/index.d.ts +12 -0
  82. package/dist/esm/executors/publish/index.js +51 -0
  83. package/dist/esm/executors/publish/schema.json +19 -0
  84. package/dist/esm/executors/shared/utils.d.ts +34 -0
  85. package/dist/esm/executors/shared/utils.js +72 -0
  86. package/dist/esm/executors/update-executors-file/helpers.d.ts +25 -0
  87. package/dist/esm/executors/update-executors-file/helpers.js +71 -0
  88. package/dist/esm/executors/update-executors-file/index.d.ts +12 -0
  89. package/dist/esm/executors/update-executors-file/index.js +39 -0
  90. package/dist/esm/executors/update-executors-file/schema.json +9 -0
  91. package/dist/esm/executors/vtex-link/constants.d.ts +4 -0
  92. package/dist/esm/executors/vtex-link/constants.js +5 -0
  93. package/dist/esm/executors/vtex-link/helpers.d.ts +77 -0
  94. package/dist/esm/executors/vtex-link/helpers.js +192 -0
  95. package/dist/esm/executors/vtex-link/index.d.ts +5 -0
  96. package/dist/esm/executors/vtex-link/index.js +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.ts +10 -0
  103. package/dist/esm/index.d.ts.map +1 -0
  104. package/dist/esm/index.js +13 -0
  105. package/dist/esm/scripts/changeset-pre-mode.d.ts +2 -0
  106. package/dist/esm/scripts/changeset-pre-mode.js +39 -0
  107. package/dist/esm/shared/logger.d.ts +33 -0
  108. package/dist/{src → esm/shared}/logger.js +28 -39
  109. package/dist/esm/shared/utils.d.ts +11 -0
  110. package/dist/esm/shared/utils.js +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.ts +4 -0
  115. package/dist/esm/vite/config-builder/configs/app.js +11 -0
  116. package/dist/esm/vite/config-builder/configs/base.d.ts +4 -0
  117. package/dist/{src → esm}/vite/config-builder/configs/base.js +22 -22
  118. package/dist/esm/vite/config-builder/configs/index.d.ts +7 -0
  119. package/dist/esm/vite/config-builder/configs/index.js +30 -0
  120. package/dist/esm/vite/config-builder/configs/lib.d.ts +4 -0
  121. package/dist/{src → esm}/vite/config-builder/configs/lib.js +16 -18
  122. package/dist/esm/vite/config-builder/configs/script.d.ts +4 -0
  123. package/dist/esm/vite/config-builder/configs/script.js +43 -0
  124. package/dist/esm/vite/config-builder/main.d.ts +10 -0
  125. package/dist/esm/vite/config-builder/main.js +41 -0
  126. package/dist/esm/vite/config-builder/plugins.d.ts +30 -0
  127. package/dist/esm/vite/config-builder/plugins.js +89 -0
  128. package/dist/esm/vite/config-builder/shared/types.d.ts +155 -0
  129. package/dist/{src → esm}/vite/config-builder/shared/types.js +2 -27
  130. package/dist/esm/vite/config-builder/shared/utils/helpers.d.ts +81 -0
  131. package/dist/esm/vite/config-builder/shared/utils/helpers.js +98 -0
  132. package/dist/esm/vite/config-builder/shared/utils/projectConfig.d.ts +60 -0
  133. package/dist/esm/vite/config-builder/shared/utils/projectConfig.js +109 -0
  134. package/dist/esm/vite/config-builder/shared/utils/viteCommand.d.ts +24 -0
  135. package/dist/esm/vite/config-builder/shared/utils/viteCommand.js +56 -0
  136. package/dist/esm/vite/plugins/shadow-dom-inject-css/index.d.ts +7 -0
  137. package/dist/esm/vite/plugins/shadow-dom-inject-css/index.js +27 -0
  138. package/dist/esm/vite/plugins/third-party-css-inject/main.d.ts +17 -0
  139. package/dist/esm/vite/plugins/third-party-css-inject/main.js +45 -0
  140. package/dist/esm/vite/plugins/third-party-css-inject/utils.d.ts +5 -0
  141. package/dist/esm/vite/plugins/third-party-css-inject/utils.js +97 -0
  142. package/dist/executors.json +29 -0
  143. package/package.json +36 -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.map +0 -1
  171. package/dist/src/executors/update-executors-file/helpers.js +0 -70
  172. package/dist/src/executors/update-executors-file/types.d.ts +0 -14
  173. package/dist/src/executors/update-executors-file/types.d.ts.map +0 -1
  174. package/dist/src/executors/update-executors-file/types.js +0 -4
  175. package/dist/src/executors/vtex-link/constants.d.ts +0 -4
  176. package/dist/src/executors/vtex-link/constants.d.ts.map +0 -1
  177. package/dist/src/executors/vtex-link/constants.js +0 -24
  178. package/dist/src/executors/vtex-link/executor.d.ts +0 -5
  179. package/dist/src/executors/vtex-link/executor.d.ts.map +0 -1
  180. package/dist/src/executors/vtex-link/executor.js +0 -35
  181. package/dist/src/executors/vtex-link/helpers.d.ts.map +0 -1
  182. package/dist/src/executors/vtex-link/helpers.js +0 -187
  183. package/dist/src/executors/vtex-link/types.d.ts.map +0 -1
  184. package/dist/src/executors/vtex-link/types.js +0 -4
  185. package/dist/src/index.d.ts +0 -2
  186. package/dist/src/index.d.ts.map +0 -1
  187. package/dist/src/index.js +0 -6
  188. package/dist/src/logger.d.ts.map +0 -1
  189. package/dist/src/scripts/changeset-pre-mode.d.ts +0 -2
  190. package/dist/src/scripts/changeset-pre-mode.d.ts.map +0 -1
  191. package/dist/src/scripts/changeset-pre-mode.js +0 -41
  192. package/dist/src/shared/index.d.ts +0 -2
  193. package/dist/src/shared/index.d.ts.map +0 -1
  194. package/dist/src/shared/index.js +0 -6
  195. package/dist/src/shared/utils.d.ts.map +0 -1
  196. package/dist/src/shared/utils.js +0 -22
  197. package/dist/src/vite/config-builder/configs/app.d.ts +0 -4
  198. package/dist/src/vite/config-builder/configs/app.d.ts.map +0 -1
  199. package/dist/src/vite/config-builder/configs/app.js +0 -19
  200. package/dist/src/vite/config-builder/configs/base.d.ts +0 -4
  201. package/dist/src/vite/config-builder/configs/base.d.ts.map +0 -1
  202. package/dist/src/vite/config-builder/configs/index.d.ts +0 -7
  203. package/dist/src/vite/config-builder/configs/index.d.ts.map +0 -1
  204. package/dist/src/vite/config-builder/configs/index.js +0 -28
  205. package/dist/src/vite/config-builder/configs/lib.d.ts +0 -4
  206. package/dist/src/vite/config-builder/configs/lib.d.ts.map +0 -1
  207. package/dist/src/vite/config-builder/configs/script.d.ts +0 -4
  208. package/dist/src/vite/config-builder/configs/script.d.ts.map +0 -1
  209. package/dist/src/vite/config-builder/configs/script.js +0 -42
  210. package/dist/src/vite/config-builder/index.d.ts +0 -3
  211. package/dist/src/vite/config-builder/index.d.ts.map +0 -1
  212. package/dist/src/vite/config-builder/index.js +0 -7
  213. package/dist/src/vite/config-builder/main.d.ts +0 -10
  214. package/dist/src/vite/config-builder/main.d.ts.map +0 -1
  215. package/dist/src/vite/config-builder/main.js +0 -37
  216. package/dist/src/vite/config-builder/plugins.d.ts.map +0 -1
  217. package/dist/src/vite/config-builder/plugins.js +0 -88
  218. package/dist/src/vite/config-builder/shared/index.d.ts +0 -3
  219. package/dist/src/vite/config-builder/shared/index.d.ts.map +0 -1
  220. package/dist/src/vite/config-builder/shared/index.js +0 -7
  221. package/dist/src/vite/config-builder/shared/types.d.ts.map +0 -1
  222. package/dist/src/vite/config-builder/shared/utils/helpers.d.ts.map +0 -1
  223. package/dist/src/vite/config-builder/shared/utils/helpers.js +0 -61
  224. package/dist/src/vite/config-builder/shared/utils/index.d.ts +0 -4
  225. package/dist/src/vite/config-builder/shared/utils/index.d.ts.map +0 -1
  226. package/dist/src/vite/config-builder/shared/utils/index.js +0 -8
  227. package/dist/src/vite/config-builder/shared/utils/projectConfig.d.ts.map +0 -1
  228. package/dist/src/vite/config-builder/shared/utils/projectConfig.js +0 -85
  229. package/dist/src/vite/config-builder/shared/utils/viteCommand.d.ts.map +0 -1
  230. package/dist/src/vite/config-builder/shared/utils/viteCommand.js +0 -54
  231. package/dist/src/vite/index.d.ts +0 -3
  232. package/dist/src/vite/index.d.ts.map +0 -1
  233. package/dist/src/vite/index.js +0 -7
  234. package/dist/src/vite/plugins/index.d.ts +0 -3
  235. package/dist/src/vite/plugins/index.d.ts.map +0 -1
  236. package/dist/src/vite/plugins/index.js +0 -7
  237. package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts +0 -8
  238. package/dist/src/vite/plugins/shadow-dom-inject-css/index.d.ts.map +0 -1
  239. package/dist/src/vite/plugins/third-party-css-inject/index.d.ts +0 -4
  240. package/dist/src/vite/plugins/third-party-css-inject/index.d.ts.map +0 -1
  241. package/dist/src/vite/plugins/third-party-css-inject/index.js +0 -13
  242. package/dist/src/vite/plugins/third-party-css-inject/main.d.ts +0 -17
  243. package/dist/src/vite/plugins/third-party-css-inject/main.d.ts.map +0 -1
  244. package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts +0 -5
  245. package/dist/src/vite/plugins/third-party-css-inject/utils.d.ts.map +0 -1
  246. /package/dist/{src → cjs}/executors/deploy/schema.json +0 -0
  247. /package/dist/{src → cjs}/executors/environments/schema.json +0 -0
  248. /package/dist/{src → cjs}/executors/publish/schema.json +0 -0
  249. /package/dist/{src → cjs}/executors/update-executors-file/schema.json +0 -0
  250. /package/dist/{src → cjs}/executors/vtex-link/schema.json +0 -0
@@ -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,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,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 getBaseConfig: (ctx: Context) => UserConfig;
4
+ export { getBaseConfig };
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var plugins = require('../plugins.js');
4
+ var types = require('../shared/types.js');
5
+ var helpers = require('../shared/utils/helpers.js');
6
+ require('minimatch');
7
+ require('../../../shared/logger.js');
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,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,36 @@
1
+ 'use strict';
2
+
3
+ var types = require('../shared/types.js');
4
+ require('@nx/devkit');
5
+ require('nanoid');
6
+ require('path');
7
+ require('ramda');
8
+ require('minimatch');
9
+ require('../../../shared/logger.js');
10
+ require('fs');
11
+ require('chalk');
12
+ require('mri');
13
+ require('vite');
14
+ var app = require('./app.js');
15
+ var base = require('./base.js');
16
+ var lib = require('./lib.js');
17
+ var script = require('./script.js');
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,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,57 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var plugins = require('../plugins.js');
5
+ require('../shared/types.js');
6
+ var helpers = require('../shared/utils/helpers.js');
7
+ var projectConfig = require('../shared/utils/projectConfig.js');
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 getScriptConfig: (ctx: Context) => UserConfig;
4
+ export { getScriptConfig };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var plugins = require('../plugins.js');
5
+ require('../shared/types.js');
6
+ var helpers = require('../shared/utils/helpers.js');
7
+ require('minimatch');
8
+ require('../../../shared/logger.js');
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,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,43 @@
1
+ 'use strict';
2
+
3
+ var vite = require('vite');
4
+ var logger = require('../../shared/logger.js');
5
+ var utils = require('../../shared/utils.js');
6
+ var index = require('./configs/index.js');
7
+ require('./shared/types.js');
8
+ require('@nx/devkit');
9
+ require('nanoid');
10
+ require('path');
11
+ require('ramda');
12
+ var projectConfig = require('./shared/utils/projectConfig.js');
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;
@@ -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,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.js');
13
+ var types = require('./shared/types.js');
14
+ var helpers = require('./shared/utils/helpers.js');
15
+ require('minimatch');
16
+ require('../../shared/logger.js');
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,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 };
@@ -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 { PreRenderedChunk } from 'rollup';
2
- import type { PluginOption } from 'vite';
3
- import type { Context, PluginConfig } from '../types';
1
+ import { PreRenderedChunk } from 'rollup';
2
+ import { PluginOption } from 'vite';
3
+ import { Context, PluginConfig } from "../types.js";
4
4
  /**
5
5
  * Generates a short ID string.
6
6
  *
@@ -10,7 +10,7 @@ import type { Context, PluginConfig } from '../types';
10
10
  * @example
11
11
  * const id = shortId(10); // Outputs: "Aj3_Dk7_2j"
12
12
  */
13
- export declare const shortId: (length: number) => string;
13
+ declare const shortId: (length: number) => string;
14
14
  /**
15
15
  * Deeply merges two objects, combining their properties.
16
16
  *
@@ -23,7 +23,7 @@ export declare const shortId: (length: number) => string;
23
23
  * const obj2 = { b: { d: 3 } };
24
24
  * const merged = deepMerge(obj1, obj2); // Outputs: { a: 1, b: { c: 2, d: 3 } }
25
25
  */
26
- export declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
26
+ declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
27
27
  /**
28
28
  * Generates a name for js files.
29
29
  *
@@ -34,7 +34,7 @@ export declare function deepMerge(v1: Record<string, any>, v2: Record<string, an
34
34
  * const generateChunkName = chunkName('prefix');
35
35
  * const name = generateChunkName({ name: 'example' }); // Outputs: "prefix-example-Aj3_Dk7_2j.js"
36
36
  */
37
- export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
37
+ declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
38
38
  /**
39
39
  * Returns the given object if the condition is true, otherwise returns null.
40
40
  *
@@ -47,14 +47,14 @@ export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => st
47
47
  * const result = when(true, obj); // Outputs: { a: 1 }
48
48
  * const result2 = when(false, obj); // Outputs: {}
49
49
  */
50
- export declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
50
+ declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
51
51
  /**
52
52
  * Filters and generates plugin configurations based on conditions and the provided context.
53
53
  *
54
54
  * @param {Context} ctx - The main configuration object.
55
55
  * @returns {any[]} - An array of generated plugin configurations.
56
56
  */
57
- export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
57
+ declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
58
58
  /**
59
59
  * Gets the paths to the tsconfig files for all relevant projects.
60
60
  *
@@ -77,5 +77,5 @@ export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]
77
77
  * // Output:
78
78
  * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
79
79
  */
80
- export declare const getNxTsConfigPaths: () => string[];
81
- //# sourceMappingURL=helpers.d.ts.map
80
+ declare const getNxTsConfigPaths: () => string[];
81
+ export { shortId, deepMerge, chunkName, when, getPlugins, getNxTsConfigPaths };