@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
@@ -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,115 @@
1
+ 'use strict';
2
+
3
+ var devkit = require('@nx/devkit');
4
+ var path = require('path');
5
+ var R = require('ramda');
6
+ require('../../../../shared/logger.cjs');
7
+ var utils = require('../../../../shared/utils.cjs');
8
+
9
+ function _interopNamespaceDefault(e) {
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
27
+
28
+ /**
29
+ * Deeply merges two objects, combining their properties.
30
+ *
31
+ * @param {Record<string, any>} v1 - The first object.
32
+ * @param {Record<string, any>} v2 - The second object.
33
+ * @returns {Record<string, any>} - The merged object.
34
+ *
35
+ * @example
36
+ * const obj1 = { a: 1, b: { c: 2 } };
37
+ * const obj2 = { b: { d: 3 } };
38
+ * const merged = deepMerge(obj1, obj2); // Outputs: { a: 1, b: { c: 2, d: 3 } }
39
+ */ function deepMerge(v1, v2) {
40
+ if (Array.isArray(v1) && Array.isArray(v2)) {
41
+ return R__namespace.uniq(R__namespace.concat(v1, v2));
42
+ } else if (typeof v1 === 'object' && typeof v2 === 'object' && !R__namespace.isNil(v1) && !R__namespace.isNil(v2)) {
43
+ return R__namespace.mergeWith(deepMerge, v1, v2);
44
+ } else {
45
+ return v2;
46
+ }
47
+ }
48
+ /**
49
+ * Generates a name for js files.
50
+ *
51
+ * @param {string} [prefix] - An optional prefix for the chunk name.
52
+ * @returns - A function that takes an item and generates a chunk name.
53
+ *
54
+ * @example
55
+ * const generateChunkName = chunkName('prefix');
56
+ * const name = generateChunkName({ name: 'example' }); // Outputs: "prefix-example-Aj3_Dk7_2j.js"
57
+ */ const chunkName = (prefix)=>(x)=>{
58
+ const nameWithoutUnderscore = x.name.replace(/_/g, '');
59
+ const pre = prefix ? `${prefix}-` : '';
60
+ return `${pre}${nameWithoutUnderscore}-${utils.shortId(8)}.js`;
61
+ };
62
+ /**
63
+ * Returns the given object if the condition is true, otherwise returns null.
64
+ *
65
+ * @param {any} condition - The condition to evaluate.
66
+ * @param {Record<string, any>} obj - The object to return if the condition is true.
67
+ * @returns {Record<string, any> | null} - The object or null based on the condition.
68
+ *
69
+ * @example
70
+ * const obj = { a: 1 };
71
+ * const result = when(true, obj); // Outputs: { a: 1 }
72
+ * const result2 = when(false, obj); // Outputs: {}
73
+ */ const when = (condition, obj)=>condition ? obj : {};
74
+ /**
75
+ * Filters and generates plugin configurations based on conditions and the provided context.
76
+ *
77
+ * @param {Context} ctx - The main configuration object.
78
+ * @returns {any[]} - An array of generated plugin configurations.
79
+ */ const getPlugins = (ctx, ...pluginConfigs)=>pluginConfigs // Filters the plugins based on conditions
80
+ .filter((p)=>!p.condition || p.condition(ctx)) // Generates the configuration of each plugin and flattens the resulting array
81
+ .flatMap((p)=>p.generate(ctx));
82
+ /**
83
+ * Gets the paths to the tsconfig files for all relevant projects.
84
+ *
85
+ * @returns {string[]} - An array containing paths to tsconfig files for both app and lib projects.
86
+ *
87
+ * @example
88
+ * const projects = {
89
+ * 'my-app': {
90
+ * type: 'app',
91
+ * data: { root: 'apps/my-app' }
92
+ * },
93
+ * 'my-lib': {
94
+ * type: 'lib',
95
+ * data: { root: 'libs/my-lib' }
96
+ * }
97
+ * };
98
+ *
99
+ * const tsConfigPaths = getTsConfigPaths(projects);
100
+ * console.log(tsConfigPaths);
101
+ * // Output:
102
+ * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
103
+ */ const getNxTsConfigPaths = ()=>{
104
+ const isValid = (p)=>p.data.root.startsWith('apps/') || p.data.root.startsWith('libs/');
105
+ const getTsConfigPath = (p)=>path.resolve(p.data.root, `tsconfig.${p.type === 'app' ? 'app' : 'lib'}.json`);
106
+ const graph = devkit.readCachedProjectGraph();
107
+ const projects = graph.nodes;
108
+ return Object.values(projects).filter(isValid).map(getTsConfigPath);
109
+ };
110
+
111
+ exports.chunkName = chunkName;
112
+ exports.deepMerge = deepMerge;
113
+ exports.getNxTsConfigPaths = getNxTsConfigPaths;
114
+ exports.getPlugins = getPlugins;
115
+ exports.when = when;
@@ -1,16 +1,6 @@
1
- import type { PreRenderedChunk } from 'rollup';
2
- import type { PluginOption } from 'vite';
3
- import type { Context, PluginConfig } from '../types';
4
- /**
5
- * Generates a short ID string.
6
- *
7
- * @param {number} length - The length of the ID to generate.
8
- * @returns {string} - The generated ID.
9
- *
10
- * @example
11
- * const id = shortId(10); // Outputs: "Aj3_Dk7_2j"
12
- */
13
- export declare const shortId: (length: number) => string;
1
+ import { PreRenderedChunk } from 'rollup';
2
+ import { PluginOption } from 'vite';
3
+ import { Context, PluginConfig } from "../types.js";
14
4
  /**
15
5
  * Deeply merges two objects, combining their properties.
16
6
  *
@@ -23,7 +13,7 @@ export declare const shortId: (length: number) => string;
23
13
  * const obj2 = { b: { d: 3 } };
24
14
  * const merged = deepMerge(obj1, obj2); // Outputs: { a: 1, b: { c: 2, d: 3 } }
25
15
  */
26
- export declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
16
+ declare function deepMerge(v1: Record<string, any>, v2: Record<string, any>): Record<string, any>;
27
17
  /**
28
18
  * Generates a name for js files.
29
19
  *
@@ -34,7 +24,7 @@ export declare function deepMerge(v1: Record<string, any>, v2: Record<string, an
34
24
  * const generateChunkName = chunkName('prefix');
35
25
  * const name = generateChunkName({ name: 'example' }); // Outputs: "prefix-example-Aj3_Dk7_2j.js"
36
26
  */
37
- export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
27
+ declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => string;
38
28
  /**
39
29
  * Returns the given object if the condition is true, otherwise returns null.
40
30
  *
@@ -47,14 +37,14 @@ export declare const chunkName: (prefix?: string) => (x: PreRenderedChunk) => st
47
37
  * const result = when(true, obj); // Outputs: { a: 1 }
48
38
  * const result2 = when(false, obj); // Outputs: {}
49
39
  */
50
- export declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
40
+ declare const when: (condition: any, obj: Record<string, any>) => Record<string, any>;
51
41
  /**
52
42
  * Filters and generates plugin configurations based on conditions and the provided context.
53
43
  *
54
44
  * @param {Context} ctx - The main configuration object.
55
45
  * @returns {any[]} - An array of generated plugin configurations.
56
46
  */
57
- export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
47
+ declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]) => PluginOption[];
58
48
  /**
59
49
  * Gets the paths to the tsconfig files for all relevant projects.
60
50
  *
@@ -77,5 +67,5 @@ export declare const getPlugins: (ctx: Context, ...pluginConfigs: PluginConfig[]
77
67
  * // Output:
78
68
  * // ['apps/my-app/tsconfig.app.json', 'libs/my-lib/tsconfig.lib.json']
79
69
  */
80
- export declare const getNxTsConfigPaths: () => string[];
81
- //# sourceMappingURL=helpers.d.ts.map
70
+ declare const getNxTsConfigPaths: () => string[];
71
+ export { deepMerge, chunkName, when, getPlugins, getNxTsConfigPaths };
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ var minimatch = require('minimatch');
4
+ var logger = require('../../../../shared/logger.cjs');
5
+ var utils = require('../../../../shared/utils.cjs');
6
+ var types = require('../types.cjs');
7
+ var helpers = require('./helpers.cjs');
8
+ var viteCommand = require('./viteCommand.cjs');
9
+
10
+ /**
11
+ * Initializes the project configuration with default values.
12
+ *
13
+ * @example
14
+ * const config = { type: ProjectType.APP, path: '/path/to/project', viteEnv: { mode: ViteMode.DEV } };
15
+ * const initializedConfig = initializeConfig(config);
16
+ */ const initializeConfig = (ccfg, pcfg, localPkgJson)=>{
17
+ const { envPrefix } = ccfg;
18
+ const localPkgName = localPkgJson['name'];
19
+ const { name = localPkgName, overrides = {}, shadowDom = false, chunkPrefix = getInitials(localPkgName), resolveEnvs = {
20
+ default: true,
21
+ local: true
22
+ }, fileName = `${envPrefix}-${chunkPrefix}-index`, externalizeLibs = {
23
+ default: true,
24
+ glob: []
25
+ } } = pcfg;
26
+ const viteCmd = viteCommand.getViteCommand(pcfg.viteEnv.mode);
27
+ const isVerbose = Object.keys(viteCmd.flags).some((x)=>[
28
+ types.Flag.VERBOSE,
29
+ types.Flag.VERBOSE_ALIAS
30
+ ].includes(x));
31
+ const logLevel = isVerbose ? logger.LogLevel.DEBUG : pcfg.logLevel ?? logger.LogLevel.INFO;
32
+ logger.setLogLevel(logLevel);
33
+ return {
34
+ viteCmd,
35
+ cfg: {
36
+ ...pcfg,
37
+ name,
38
+ fileName,
39
+ logLevel,
40
+ overrides,
41
+ chunkPrefix,
42
+ shadowDom,
43
+ resolveEnvs,
44
+ externalizeLibs: externalizeLibs
45
+ }
46
+ };
47
+ };
48
+ /**
49
+ * Handles merging configurations and logs any errors.
50
+ *
51
+ * @param {UserConfig} defaultConfig - The default configuration.
52
+ * @param {UserConfig} overrides - The overrides configuration.
53
+ * @returns {UserConfig} - The merged configuration.
54
+ */ const mergeConfigs = (defaultConfig, overrides)=>{
55
+ try {
56
+ return helpers.deepMerge(defaultConfig, overrides);
57
+ } catch (err) {
58
+ logger.logger.error('Error merging vite configs: ', err);
59
+ return defaultConfig;
60
+ }
61
+ };
62
+ /**
63
+ * Resolves glob patterns to actual package names found in package.json dependencies.
64
+ * This function is used to determine which packages should be treated as external
65
+ * in a Rollup or Vite build configuration.
66
+ *
67
+ * @param {string} path - The base path where package.json is located.
68
+ * @param {string | string[]} globs - A glob pattern or an array of glob patterns to match dependencies against.
69
+ * @returns {string[]} An array of package names that match the given glob patterns.
70
+ *
71
+ * @example
72
+ * // Example of using `getExternalDependencies` to find all dependencies starting with "my-lib" and "lodash"
73
+ * const projectPath = '/path/to/project';
74
+ * const globs = ['my-lib*', 'lodash'];
75
+ * const externalDependencies = getExternalDependencies(projectPath, globs);
76
+ * console.log(externalDependencies);
77
+ * // Output might be: ['my-lib/utils', 'my-lib/core', 'lodash']
78
+ */ const getExternalDependencies = (path, globs = [])=>{
79
+ const pkgJson = utils.getPkgJson(path); // Assumes getLocalPkgJson is a function that reads and parses package.json
80
+ const dependencies = Object.keys(pkgJson.dependencies || {});
81
+ const globPatterns = Array.isArray(globs) ? globs : [
82
+ globs
83
+ ];
84
+ return dependencies.filter((dep)=>globPatterns.some((pattern)=>minimatch.minimatch(dep, pattern)));
85
+ };
86
+ /**
87
+ * Generates a string of initials based on the input string,
88
+ * following certain rules:
89
+ * 1. A word is considered as a sequence of characters
90
+ * separated by hyphens.
91
+ * 2. If the string contains '@', any characters before
92
+ * and including the next '/' are ignored.
93
+ * 3. The first character of each word is taken to form
94
+ * the initials.
95
+ *
96
+ * @param {string} input - The input string from which to generate the initials.
97
+ * @returns {string} The initials formed by taking the first character
98
+ * of each word, after applying the specified rules.
99
+ *
100
+ * @example
101
+ * getInitials("player-script"); // returns "ps"
102
+ * getInitials("ssv-admin"); // returns "sa"
103
+ * getInitials("@nizza/customize-live"); // returns "cl"
104
+ */ function getInitials(input) {
105
+ const cleanedInput = input.includes('@') ? input.split('/')[1] : input;
106
+ const words = cleanedInput?.split('-');
107
+ const initials = words?.map((word)=>word.charAt(0)).join('');
108
+ return initials ?? '';
109
+ }
110
+
111
+ exports.getExternalDependencies = getExternalDependencies;
112
+ exports.getInitials = getInitials;
113
+ exports.initializeConfig = initializeConfig;
114
+ exports.mergeConfigs = mergeConfigs;
@@ -1,5 +1,5 @@
1
- import { type UserConfig } from 'vite';
2
- import { type CommonProjectConfig, type ProjectConfig, type ProjectConfigInitialized } from '../types';
1
+ import { UserConfig } from 'vite';
2
+ import { CommonProjectConfig, ProjectConfig, ProjectConfigInitialized } from "../types.js";
3
3
  /**
4
4
  * Initializes the project configuration with default values.
5
5
  *
@@ -7,8 +7,8 @@ import { type CommonProjectConfig, type ProjectConfig, type ProjectConfigInitial
7
7
  * const config = { type: ProjectType.APP, path: '/path/to/project', viteEnv: { mode: ViteMode.DEV } };
8
8
  * const initializedConfig = initializeConfig(config);
9
9
  */
10
- export declare const initializeConfig: (ccfg: CommonProjectConfig, pcfg: ProjectConfig, localPkgJson: Record<string, any>) => {
11
- viteCmd: import("../types").ViteCommand;
10
+ declare const initializeConfig: (ccfg: CommonProjectConfig, pcfg: ProjectConfig, localPkgJson: Record<string, any>) => {
11
+ viteCmd: import("../types.js").ViteCommand;
12
12
  cfg: ProjectConfigInitialized;
13
13
  };
14
14
  /**
@@ -18,7 +18,7 @@ export declare const initializeConfig: (ccfg: CommonProjectConfig, pcfg: Project
18
18
  * @param {UserConfig} overrides - The overrides configuration.
19
19
  * @returns {UserConfig} - The merged configuration.
20
20
  */
21
- export declare const mergeConfigs: (defaultConfig: UserConfig, overrides: UserConfig) => UserConfig;
21
+ declare const mergeConfigs: (defaultConfig: UserConfig, overrides: UserConfig) => UserConfig;
22
22
  /**
23
23
  * Resolves glob patterns to actual package names found in package.json dependencies.
24
24
  * This function is used to determine which packages should be treated as external
@@ -36,7 +36,7 @@ export declare const mergeConfigs: (defaultConfig: UserConfig, overrides: UserCo
36
36
  * console.log(externalDependencies);
37
37
  * // Output might be: ['my-lib/utils', 'my-lib/core', 'lodash']
38
38
  */
39
- export declare const getExternalDependencies: (path: string, globs?: string | string[]) => string[];
39
+ declare const getExternalDependencies: (path: string, globs?: string | string[]) => string[];
40
40
  /**
41
41
  * Generates a string of initials based on the input string,
42
42
  * following certain rules:
@@ -56,5 +56,5 @@ export declare const getExternalDependencies: (path: string, globs?: string | st
56
56
  * getInitials("ssv-admin"); // returns "sa"
57
57
  * getInitials("@nizza/customize-live"); // returns "cl"
58
58
  */
59
- export declare function getInitials(input: string): string;
60
- //# sourceMappingURL=projectConfig.d.ts.map
59
+ declare function getInitials(input: string): string;
60
+ export { initializeConfig, mergeConfigs, getExternalDependencies, getInitials };
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+ var argv = require('mri');
5
+ var vite = require('vite');
6
+ var types = require('../types.cjs');
7
+
8
+ /**
9
+ * Retrieves the Vite command details.
10
+ *
11
+ * @param {ViteMode} mode - The Vite mode.
12
+ * @returns {ViteCommand} - The command details.
13
+ *
14
+ * @example
15
+ * const command = getViteCommand(ViteMode.PROD);
16
+ * // Outputs: { stage: Stage.PROD, target: 'build', flags: {} }
17
+ */ function getViteCommand(mode) {
18
+ const nxEnv = vite.loadEnv(mode, process.cwd(), 'NX');
19
+ const nxCommandString = process?.env?.['npm_package_scripts_nx'];
20
+ const modeIsProd = mode === types.ViteMode.PROD;
21
+ const stage = (nxEnv?.['NX_TASK_TARGET_CONFIGURATION']) ?? (modeIsProd ? types.Stage.PROD : types.Stage.DEV);
22
+ const target = nxEnv?.['NX_TASK_TARGET_TARGET'] ?? types.Target.BUILD;
23
+ const flags = getViteCmdFlags(nxCommandString);
24
+ const showIn = {
25
+ prod: (...args)=>modeIsProd && console.log(...args),
26
+ dev: (...args)=>!modeIsProd && console.log(...args)
27
+ };
28
+ try {
29
+ showIn.prod(chalk.cyan('Build Stage:'), chalk.green(stage));
30
+ showIn.dev(chalk.green(' ➜ '), chalk.bold.white(`Stage: `), chalk.cyan(stage));
31
+ } catch {
32
+ showIn.prod(console.log('Build Stage:', stage));
33
+ showIn.dev(console.log(` ➜ Stage: `, stage));
34
+ }
35
+ return {
36
+ stage,
37
+ target,
38
+ flags
39
+ };
40
+ }
41
+ /**
42
+ * Parses the command string to extract flags.
43
+ *
44
+ * @param {string | undefined} commandString - The command string.
45
+ * @returns {Record<string, string>} - The flags extracted from the command string.
46
+ *
47
+ * @example
48
+ * const flags = getViteCmdFlags('nx run core:build --source-maps');
49
+ * // Outputs: { 'source-maps: 'true' }
50
+ */ function getViteCmdFlags(commandString) {
51
+ if (!commandString) return {};
52
+ const cleanedCommandString = commandString.replace(/"/g, '');
53
+ const args = argv(cleanedCommandString.split(' '));
54
+ delete args['_'];
55
+ return args;
56
+ }
57
+
58
+ exports.getViteCmdFlags = getViteCmdFlags;
59
+ exports.getViteCommand = getViteCommand;
@@ -1,4 +1,4 @@
1
- import { ViteMode, type ViteCommand } from '../types';
1
+ import { ViteMode, ViteCommand } from "../types.js";
2
2
  /**
3
3
  * Retrieves the Vite command details.
4
4
  *
@@ -9,7 +9,7 @@ import { ViteMode, type ViteCommand } from '../types';
9
9
  * const command = getViteCommand(ViteMode.PROD);
10
10
  * // Outputs: { stage: Stage.PROD, target: 'build', flags: {} }
11
11
  */
12
- export declare function getViteCommand(mode: ViteMode): ViteCommand;
12
+ declare function getViteCommand(mode: ViteMode): ViteCommand;
13
13
  /**
14
14
  * Parses the command string to extract flags.
15
15
  *
@@ -20,5 +20,5 @@ export declare function getViteCommand(mode: ViteMode): ViteCommand;
20
20
  * const flags = getViteCmdFlags('nx run core:build --source-maps');
21
21
  * // Outputs: { 'source-maps: 'true' }
22
22
  */
23
- export declare function getViteCmdFlags(commandString: string | undefined): Record<string, string>;
24
- //# sourceMappingURL=viteCommand.d.ts.map
23
+ declare function getViteCmdFlags(commandString: string | undefined): Record<string, string>;
24
+ export { getViteCommand, getViteCmdFlags };
@@ -1,21 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: function() {
13
- return _default;
14
- },
15
- injectCssIntoShadowDom: function() {
16
- return injectCssIntoShadowDom;
17
- }
18
- });
1
+ 'use strict';
2
+
19
3
  function injectCssIntoShadowDom() {
20
4
  const fileRegex = /\.(css)$/;
21
5
  let server;
@@ -41,4 +25,5 @@ function injectCssIntoShadowDom() {
41
25
  }
42
26
  };
43
27
  }
44
- const _default = injectCssIntoShadowDom;
28
+
29
+ exports.injectCssIntoShadowDom = injectCssIntoShadowDom;
@@ -0,0 +1,7 @@
1
+ import { ViteDevServer } from 'vite';
2
+ declare function injectCssIntoShadowDom(): {
3
+ name: string;
4
+ configureServer(_server: ViteDevServer): void;
5
+ transform(src: string, id: string): void;
6
+ };
7
+ export { injectCssIntoShadowDom };
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "thirdPartyCssInjectPlugin", {
6
- enumerable: true,
7
- get: function() {
8
- return thirdPartyCssInjectPlugin;
9
- }
10
- });
11
- const _utils = require("./utils");
12
- function thirdPartyCssInjectPlugin({ topExecutionPriority, execute } = {
1
+ 'use strict';
2
+
3
+ var utils = require('./utils.cjs');
4
+
5
+ /**
6
+ * Inject the CSS compiled with JS.
7
+ *
8
+ * @return {Plugin}
9
+ */ function thirdPartyCssInjectPlugin({ topExecutionPriority, execute } = {
13
10
  topExecutionPriority: true,
14
11
  execute: []
15
12
  }) {
@@ -33,12 +30,12 @@ function thirdPartyCssInjectPlugin({ topExecutionPriority, execute } = {
33
30
  const htmlChunk = bundle[name];
34
31
  let replacedHtml = htmlChunk.source;
35
32
  cssAssets.forEach((cssName)=>{
36
- replacedHtml = (0, _utils.removeLinkStyleSheets)(replacedHtml, cssName);
33
+ replacedHtml = utils.removeLinkStyleSheets(replacedHtml, cssName);
37
34
  htmlChunk.source = replacedHtml;
38
35
  });
39
36
  }
40
37
  const jsAsset = bundle[jsAssets[0]];
41
- const cssInjectionCode = await (0, _utils.buildCSSInjectionCode)(execute);
38
+ const cssInjectionCode = await utils.buildCSSInjectionCode(execute);
42
39
  const appCode = jsAsset.code;
43
40
  jsAsset.code = topExecutionPriority ? '' : appCode;
44
41
  jsAsset.code += cssInjectionCode ? cssInjectionCode.code : '';
@@ -46,3 +43,5 @@ function thirdPartyCssInjectPlugin({ topExecutionPriority, execute } = {
46
43
  }
47
44
  };
48
45
  }
46
+
47
+ exports.thirdPartyCssInjectPlugin = thirdPartyCssInjectPlugin;
@@ -0,0 +1,17 @@
1
+ import { Plugin } from 'vite';
2
+ interface Execute {
3
+ function: (data?: string) => void;
4
+ listen: string;
5
+ observer: string;
6
+ }
7
+ interface ThirdPartyCssInjectPlugin {
8
+ topExecutionPriority?: boolean;
9
+ execute?: Execute[];
10
+ }
11
+ /**
12
+ * Inject the CSS compiled with JS.
13
+ *
14
+ * @return {Plugin}
15
+ */
16
+ declare function thirdPartyCssInjectPlugin({ topExecutionPriority, execute }?: ThirdPartyCssInjectPlugin | undefined): Plugin;
17
+ export { Execute, ThirdPartyCssInjectPlugin, thirdPartyCssInjectPlugin };