@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.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 (325) hide show
  1. package/README.md +1 -1
  2. package/cli/dist/lib/cli/project.js +2 -16
  3. package/cli/dist/lib/config.js +20 -29
  4. package/cli/dist/lib/local-test.js +3 -19
  5. package/cli/dist/lib/paths.js +11 -0
  6. package/cli/dist/lib/resolveNpmSpawn.d.ts +20 -0
  7. package/cli/dist/lib/resolveNpmSpawn.js +71 -0
  8. package/cli/dist/lib/template-engine/context/pluginPackageJsonData.js +21 -19
  9. package/cli/dist/lib/template-engine/context/standVitePackageJsonData.js +7 -8
  10. package/cli/dist/lib/template-engine/resolveVariantDir.d.ts +5 -1
  11. package/cli/dist/lib/template-engine/resolveVariantDir.js +22 -0
  12. package/cli/dist/lib/templates/shared/i18n.js +2 -2
  13. package/cli/dist/lib/templates/shared/paths.js +3 -4
  14. package/cli/dist/lib/types/package-config.d.ts +1 -0
  15. package/cli/lib/cli/project.ts +2 -18
  16. package/cli/lib/config.ts +19 -30
  17. package/cli/lib/local-test.ts +3 -22
  18. package/cli/lib/paths.ts +15 -0
  19. package/cli/lib/resolveNpmSpawn.ts +72 -0
  20. package/cli/lib/template-engine/buildStandIndexHtml.test.ts +1 -0
  21. package/cli/lib/template-engine/context/pluginPackageJsonData.ts +23 -23
  22. package/cli/lib/template-engine/context/standVitePackageJsonData.ts +7 -12
  23. package/cli/lib/template-engine/pluginEtaParity.test.ts +1 -0
  24. package/cli/lib/template-engine/resolveVariantDir.ts +22 -0
  25. package/cli/lib/template-engine/standAdvancedViteDevHostEta.test.ts +4 -3
  26. package/cli/lib/template-engine/standWebpackDevHostEta.test.ts +7 -6
  27. package/cli/lib/templates/shared/i18n.ts +2 -2
  28. package/cli/lib/templates/shared/paths.ts +3 -4
  29. package/cli/lib/types/package-config.ts +1 -0
  30. package/cli/package.json +1 -1
  31. package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts} +7 -5
  32. package/cli/project-templates/plugin/assets/vite/{sandbox-build.config.mjs → sandbox-build.config.ts} +7 -5
  33. package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.module.cjs → plugin-build.legacy.module.ts} +20 -7
  34. package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.umd.cjs → plugin-build.legacy.umd.ts} +20 -7
  35. package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.module.cjs → plugin-build.modern.module.ts} +9 -4
  36. package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.umd.cjs → plugin-build.modern.umd.ts} +9 -4
  37. package/cli/project-templates/plugin/assets/webpack/{sandbox-build.config.cjs → sandbox-build.config.ts} +13 -3
  38. package/cli/project-templates/plugin/bundler-vite/release.html.eta +1 -0
  39. package/cli/project-templates/plugin/bundler-webpack/public/release.html.eta +1 -0
  40. package/cli/project-templates/plugin/shared-base/public/demo/product-1.svg +10 -0
  41. package/cli/project-templates/plugin/shared-base/public/demo/product-2.svg +10 -0
  42. package/cli/project-templates/plugin/shared-base/scripts/build-runner.ts +22 -0
  43. package/cli/project-templates/plugin/shared-base/scripts/build-types.ts +17 -0
  44. package/cli/project-templates/plugin/shared-base/scripts/clean.ts +16 -0
  45. package/cli/project-templates/plugin/shared-base/scripts/dev-runner.ts +52 -0
  46. package/cli/project-templates/plugin/shared-base/scripts/npmRun.ts +61 -0
  47. package/cli/project-templates/plugin/shared-base/scripts/release-runner.ts +18 -0
  48. package/cli/project-templates/plugin/shared-base/scripts/scriptRuntime.ts +10 -0
  49. package/cli/project-templates/plugin/shared-base/src/dev/hostApp.tsx.eta +1 -0
  50. package/cli/project-templates/plugin/shared-base/src/dev-release.tsx.eta +1 -0
  51. package/cli/project-templates/plugin/shared-base/src/dev.tsx.eta +1 -1
  52. package/cli/project-templates/shared/partials/plugin-dev-host-app-advanced.eta +93 -0
  53. package/cli/project-templates/shared/partials/plugin-dev-host-app-minimal.eta +54 -0
  54. package/cli/project-templates/shared/partials/plugin-dev-tsx-advanced.eta +3 -2
  55. package/cli/project-templates/shared/partials/plugin-dev-tsx-debug.eta +18 -0
  56. package/cli/project-templates/shared/partials/plugin-dev-tsx-release.eta +33 -0
  57. package/cli/project-templates/shared/partials/plugin-dev-tsx-runtime-helpers.eta +8 -8
  58. package/cli/project-templates/shared/partials/plugin-index-ts.eta +0 -1
  59. package/cli/project-templates/shared/partials/plugin-vite-dev-host.eta +9 -5
  60. package/cli/project-templates/shared/partials/plugin-vite-plugin-build.eta +7 -5
  61. package/cli/project-templates/shared/partials/plugin-vite-release-html.eta +12 -0
  62. package/cli/project-templates/shared/partials/plugin-vite-sandbox-build.eta +7 -5
  63. package/cli/project-templates/shared/partials/plugin-webpack-dev-host-legacy.eta +12 -5
  64. package/cli/project-templates/shared/partials/plugin-webpack-dev-host-modern.eta +13 -6
  65. package/cli/project-templates/shared/partials/plugin-webpack-release-html.eta +12 -0
  66. package/cli/project-templates/shared/partials/plugin-webpack-sandbox-build.eta +13 -3
  67. package/cli/project-templates/shared/partials/plugin-wp-legacy-module.eta +28 -10
  68. package/cli/project-templates/shared/partials/plugin-wp-legacy-umd.eta +28 -10
  69. package/cli/project-templates/shared/partials/plugin-wp-modern-module.eta +9 -4
  70. package/cli/project-templates/shared/partials/plugin-wp-modern-umd.eta +9 -4
  71. package/cli/project-templates/shared/partials/stand-dev-host-vite-memory.eta +3 -3
  72. package/cli/project-templates/shared/partials/stand-dev-host-vite-subpath.eta +8 -4
  73. package/cli/project-templates/shared/partials/stand-dev-host-vite-umd.eta +5 -5
  74. package/cli/project-templates/shared/partials/stand-dev-host-vite.eta +3 -3
  75. package/cli/project-templates/shared/partials/stand-dev-host-webpack-subpath.eta +8 -4
  76. package/cli/project-templates/shared/partials/stand-dev-host-webpack-umd.eta +9 -3
  77. package/cli/project-templates/shared/partials/stand-dev-host-webpack.eta +8 -4
  78. package/cli/project-templates/shared/partials/stand-dev-storage-middleware.eta +370 -0
  79. package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts +80 -0
  80. package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.ts.eta +1 -0
  81. package/cli/project-templates/shared/stand-webpack-base/config/lib/{createWebpackStandConfig.cjs → createWebpackStandConfig.ts} +31 -19
  82. package/cli/project-templates/{stand/advanced/umd/vite/config/lib/umdServeMiddleware.mjs → shared/stand-webpack-base/config/lib/umdServeMiddleware.ts} +19 -11
  83. package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.ts.eta +1 -0
  84. package/cli/project-templates/stand/advanced/memory-usage/vite/config/lib/{createMemoryUsageStandConfig.mjs → createMemoryUsageStandConfig.ts} +25 -20
  85. package/cli/project-templates/stand/advanced/umd/vite/config/lib/umdServeMiddleware.ts +68 -0
  86. package/cli/project-templates/stand/react-adapter/webpack/README.md.eta +1 -0
  87. package/cli/project-templates/stand/react-adapter/webpack/config/dev-host.ts.eta +1 -0
  88. package/cli/project-templates/stand/react-adapter/webpack/package.json.eta +1 -0
  89. package/cli/project-templates/stand/react-adapter/webpack/public/index.html.eta +1 -0
  90. package/cli/project-templates/stand/react-adapter/webpack/src/dev/editorConfig.ts.eta +1 -0
  91. package/cli/project-templates/stand/react-adapter/webpack/src/dev/email.html.eta +1 -0
  92. package/cli/project-templates/stand/react-adapter/webpack/src/dev/getAuthToken.ts.eta +1 -0
  93. package/cli/project-templates/stand/react-adapter/webpack/src/dev/oauthCredentials.ts +9 -0
  94. package/cli/project-templates/stand/react-adapter/webpack/src/dev/storageProvider.ts.eta +1 -0
  95. package/cli/project-templates/stand/react-adapter/webpack/src/index.tsx.eta +1 -0
  96. package/cli/scripts/cli-matrix-smoke.ts +19 -10
  97. package/cli/scripts/verify-global-cli.ts +1 -1
  98. package/cli/scripts/vite-plugin-version-matrix.ts +299 -0
  99. package/cli/tsconfig.json +2 -2
  100. package/emailmaker-core.aa9efbce.js +1 -0
  101. package/emailmaker-esm.js +788 -153
  102. package/emailmaker.d.ts +32 -0
  103. package/emailmaker.js +4 -4
  104. package/iframe/js/amp.BGJMqoms.js +1 -1
  105. package/iframe/js/chunk.oX6nCJbK.js +1 -1
  106. package/iframe/js/iframe-eblock.js +1 -1
  107. package/iframe/js/iframe.js +1 -1
  108. package/iframe/js/rules.BSaCN7eK.js +1 -1
  109. package/iframe/js/sanitize-html.Dy7Uwo8P.js +1 -1
  110. package/images/integrations/activecampaign.svg +4 -0
  111. package/images/integrations/bento.svg +9 -0
  112. package/images/integrations/brevo.svg +7 -0
  113. package/images/integrations/campaign_monitor.svg +10 -0
  114. package/images/integrations/constant_contact.svg +24 -0
  115. package/images/integrations/dotdigital.svg +144 -0
  116. package/images/integrations/getresponse.svg +23 -0
  117. package/images/integrations/hubspot.svg +3 -0
  118. package/images/integrations/klaviyo.svg +10 -0
  119. package/images/integrations/mailchimp.svg +9 -0
  120. package/images/integrations/salesforce.svg +20 -0
  121. package/js/browser-image-compression.js +9 -0
  122. package/package.json +2 -5
  123. package/runtime/@ant-design/cssinjs/index.js +1 -1
  124. package/runtime/@ant-design/icons/index.js +1 -1
  125. package/runtime/@ant-design/pro-layout/index.js +1 -1
  126. package/runtime/README.md +13 -13
  127. package/runtime/antd/index.js +1 -1
  128. package/runtime/app-core/index.js +1 -2
  129. package/runtime/classnames/index.js +1 -1
  130. package/runtime/core/index.js +6 -6
  131. package/runtime/dayjs/index.js +1 -1
  132. package/runtime/di/index.js +1 -2
  133. package/runtime/disposable/index.js +1 -2
  134. package/runtime/errors-runtime/index.js +1 -2
  135. package/runtime/guid/index.js +1 -2
  136. package/runtime/index.js +2 -4
  137. package/runtime/package.json +2 -3
  138. package/runtime/prop-types/index.js +1 -1
  139. package/runtime/react/index.js +1 -1
  140. package/runtime/react/jsx-dev-runtime/index.js +1 -1
  141. package/runtime/react/jsx-runtime/index.js +1 -1
  142. package/runtime/react-dom/client/index.js +1 -1
  143. package/runtime/react-dom/index.js +1 -1
  144. package/runtime/react-router-dom/index.js +1 -1
  145. package/runtime/uuid/index.js +1 -1
  146. package/static/amd/{8fc2a596.js → 19aeb269.js} +88 -88
  147. package/static/core/192ec827.js +1 -0
  148. package/static/core/22c1de2e2.js +1 -0
  149. package/static/core/24faedf0.js +1 -0
  150. package/static/core/29231645.js +1 -0
  151. package/static/core/2a3177fc2.js +1 -0
  152. package/static/core/346aabd2.js +3 -0
  153. package/static/core/3b800ed6.js +1 -0
  154. package/static/core/3e840e90.js +1 -0
  155. package/static/core/40cc9fd7.js +1 -0
  156. package/static/core/421bdec22.js +1 -0
  157. package/static/core/4aaa358b2.js +903 -0
  158. package/static/core/50ff48bc.js +4 -0
  159. package/static/core/5282795d2.js +6 -0
  160. package/static/core/563a283d.js +1 -0
  161. package/static/core/5d47e095.js +47 -0
  162. package/static/core/5f574386.js +1 -0
  163. package/static/core/67a41193.js +1 -0
  164. package/static/core/698dace4.js +7 -0
  165. package/static/core/6b648e2d.js +1 -0
  166. package/static/core/7629adfd.js +1 -0
  167. package/static/core/7717f2932.js +3 -0
  168. package/static/core/776cb34a.js +1 -0
  169. package/static/core/78a1e31e.js +1 -0
  170. package/static/core/7d56d643.js +1 -0
  171. package/static/core/841752212.js +40 -0
  172. package/static/core/8477e97e.js +1 -0
  173. package/static/core/8756d562.js +1 -0
  174. package/static/core/91d328d8.js +1 -0
  175. package/static/core/9270dbb6.js +6 -0
  176. package/static/core/96371334.js +566 -0
  177. package/static/core/9b9ddaef2.js +168 -0
  178. package/static/core/af1da4b4.js +1 -0
  179. package/static/core/b5096b152.js +471 -0
  180. package/static/core/bde6775a.js +1 -0
  181. package/static/core/bf1b888c.js +4 -0
  182. package/static/core/cec8d739.js +11 -0
  183. package/static/core/cf45bf332.js +598 -0
  184. package/static/core/cfac3d32.js +1 -0
  185. package/static/core/d21c95cf2.js +1 -0
  186. package/static/core/dbd9ca52.js +1 -0
  187. package/static/core/dc590181.js +1 -0
  188. package/static/core/e0039d55.js +1 -0
  189. package/static/core/e4071c1a.js +4 -0
  190. package/static/core/ef87b75c.js +41 -0
  191. package/static/core/f47701f32.js +20 -0
  192. package/static/core/f83d7ac42.js +3 -0
  193. package/static/core/fcc67e6b.js +1 -0
  194. package/static/core/fd40d85c.js +1 -0
  195. package/static/core/fe638847.js +1 -0
  196. package/static/esm/{e8401d17.js → 203c9644.js} +3 -3
  197. package/static/esm/4b679053.js +27 -0
  198. package/static/esm/{b273a6c2.js → f31a26c6.js} +1 -1
  199. package/static/runtime/disposable-CD74igiJ.js +1 -0
  200. package/static/runtime/guid-C0wuVR8v.js +1 -0
  201. package/vite/index.d.ts +17 -6
  202. package/vite/index.js +315 -270
  203. package/vite/pluginDev/index.d.ts +10 -19
  204. package/vite/pluginDev/index.js +251 -204
  205. package/webpack/index.d.ts +24 -5
  206. package/webpack/index.js +168 -144
  207. package/webpack/pluginDev/index.d.ts +21 -22
  208. package/webpack/pluginDev/index.js +242 -177
  209. package/cli/dist/lib/template-engine/buildStandIndexHtml.test.d.ts +0 -2
  210. package/cli/dist/lib/template-engine/buildStandIndexHtml.test.js +0 -89
  211. package/cli/dist/lib/template-engine/emitEtaTree.test.d.ts +0 -2
  212. package/cli/dist/lib/template-engine/emitEtaTree.test.js +0 -34
  213. package/cli/dist/lib/template-engine/pluginEtaParity.test.d.ts +0 -2
  214. package/cli/dist/lib/template-engine/pluginEtaParity.test.js +0 -105
  215. package/cli/dist/lib/template-engine/resolveVariantDir.test.d.ts +0 -2
  216. package/cli/dist/lib/template-engine/resolveVariantDir.test.js +0 -52
  217. package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.d.ts +0 -2
  218. package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.js +0 -67
  219. package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.d.ts +0 -2
  220. package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.js +0 -83
  221. package/cli/dist/lib/template-engine/storageProviderEta.test.d.ts +0 -2
  222. package/cli/dist/lib/template-engine/storageProviderEta.test.js +0 -26
  223. package/cli/project-templates/plugin/shared-base/scripts/build-types.cjs +0 -8
  224. package/cli/project-templates/plugin/shared-base/scripts/clean.cjs +0 -6
  225. package/cli/project-templates/plugin/shared-base/scripts/dev-runner.cjs +0 -48
  226. package/cli/project-templates/plugin/shared-base/scripts/release-runner.cjs +0 -63
  227. package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.mjs +0 -80
  228. package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.cjs +0 -235
  229. package/cli/project-templates/shared/stand-webpack-base/config/lib/umdServeMiddleware.cjs +0 -38
  230. package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.cjs +0 -235
  231. package/emailmaker-core.80d62b88.js +0 -569
  232. package/runtime/_core/app-core/index.js +0 -1
  233. package/runtime/_core/chunks/app-core-DphKKh8f.js +0 -1
  234. package/runtime/_core/chunks/chunk-oqAt0Dze.js +0 -1
  235. package/runtime/_core/chunks/di-BHUzE57z.js +0 -1
  236. package/runtime/_core/chunks/disposable-PhM3rJkj.js +0 -1
  237. package/runtime/_core/chunks/errors-runtime-VjCOXaQX.js +0 -1
  238. package/runtime/_core/chunks/guid-D2-FTZQG.js +0 -1
  239. package/runtime/_core/di/index.js +0 -1
  240. package/runtime/_core/disposable/index.js +0 -1
  241. package/runtime/_core/errors-runtime/index.js +0 -1
  242. package/runtime/_core/guid/index.js +0 -1
  243. package/runtime/_core/index.js +0 -1
  244. package/shared/hostBootstrap.js +0 -47
  245. package/shared/pluginDevOptions.js +0 -31
  246. package/shared/runtimeManifest.js +0 -72
  247. package/shared/stringCase.js +0 -16
  248. package/static/core/2360f32a.js +0 -3
  249. package/static/core/2687db56.js +0 -3
  250. package/static/core/2b250af6.js +0 -1261
  251. package/static/core/3469930c.js +0 -302
  252. package/static/core/34ce9042.js +0 -201
  253. package/static/core/4091ba5b.js +0 -25
  254. package/static/core/41ce3a6a.js +0 -173
  255. package/static/core/4ac4908c.js +0 -2213
  256. package/static/core/519096c1.js +0 -2597
  257. package/static/core/5fa1772b.js +0 -116550
  258. package/static/core/61312909.js +0 -3
  259. package/static/core/62a98c07.js +0 -75301
  260. package/static/core/6309c0f2.js +0 -3
  261. package/static/core/68d9f440.js +0 -3
  262. package/static/core/73b645ab.js +0 -2
  263. package/static/core/81019351.js +0 -280
  264. package/static/core/835b37ef.js +0 -591
  265. package/static/core/91242fb3.js +0 -3
  266. package/static/core/972b15b0.js +0 -92399
  267. package/static/core/974ef468.js +0 -493
  268. package/static/core/a17614422.js +0 -38078
  269. package/static/core/a2fa7b5b.js +0 -4232
  270. package/static/core/a513adfd.js +0 -89857
  271. package/static/core/a7c73a9b.js +0 -3813
  272. package/static/core/b64c7c90.js +0 -228
  273. package/static/core/cdc9ba92.js +0 -4711
  274. package/static/core/d1db685d.js +0 -2193
  275. package/static/core/d661febc.js +0 -3
  276. package/static/core/d6d2d2d0.js +0 -23
  277. package/static/core/df1a1225.js +0 -607
  278. package/static/core/e5bff179.js +0 -1302
  279. package/static/core/e5d602f5.js +0 -2
  280. package/static/core/eb029366.js +0 -1532
  281. package/static/core/f46c035a.js +0 -2
  282. package/static/core/f8b9d89a.js +0 -461
  283. package/static/core/fd897ad7.js +0 -3
  284. package/static/core/fdd890c7.js +0 -6168
  285. package/static/esm/29eb18ff.js +0 -164
  286. package/vite/mime-types.js +0 -179
  287. package/vite/utils.js +0 -44
  288. /package/cli/project-templates/plugin/bundler-vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  289. /package/cli/project-templates/plugin/bundler-vite/config/{plugin-build.mjs.eta → plugin-build.ts.eta} +0 -0
  290. /package/cli/project-templates/plugin/bundler-vite/config/{sandbox-build.mjs.eta → sandbox-build.ts.eta} +0 -0
  291. /package/cli/project-templates/plugin/bundler-webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  292. /package/cli/project-templates/plugin/bundler-webpack/config/{plugin-build.cjs.eta → plugin-build.ts.eta} +0 -0
  293. /package/cli/project-templates/plugin/bundler-webpack/config/{sandbox-build.cjs.eta → sandbox-build.ts.eta} +0 -0
  294. /package/cli/project-templates/stand/advanced/memory-usage/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  295. /package/cli/project-templates/stand/advanced/shadow-dom/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  296. /package/cli/project-templates/stand/advanced/shadow-dom/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  297. /package/cli/project-templates/stand/advanced/subpath/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  298. /package/cli/project-templates/stand/advanced/subpath/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  299. /package/cli/project-templates/stand/advanced/umd/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  300. /package/cli/project-templates/stand/advanced/umd/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  301. /package/cli/project-templates/stand/closed-loop/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  302. /package/cli/project-templates/stand/closed-loop/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  303. /package/cli/project-templates/stand/oauth/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  304. /package/cli/project-templates/stand/oauth/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
  305. /package/cli/project-templates/stand/react-adapter/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
  306. /package/iframe/{iframe-eblock.80d62b88.html → iframe-eblock.aa9efbce.html} +0 -0
  307. /package/iframe/{iframe.80d62b88.html → iframe.aa9efbce.html} +0 -0
  308. /package/{runtime/chunks → static/runtime}/DownloadOutlined-a2ZUz7zB.js +0 -0
  309. /package/{runtime/chunks → static/runtime}/chunk-D-iEO58U.js +0 -0
  310. /package/{runtime/chunks → static/runtime}/classnames-DBEldvch.js +0 -0
  311. /package/{runtime/chunks → static/runtime}/client-5XqXGmAI.js +0 -0
  312. /package/{runtime/chunks → static/runtime}/dayjs.min-CO3mzOeV.js +0 -0
  313. /package/{runtime/_core/chunks/defineProperty-BGJFuFMq.js → static/runtime/defineProperty-CGNmw-jw.js} +0 -0
  314. /package/{runtime/chunks → static/runtime}/dist-Cns8cA2n.js +0 -0
  315. /package/{runtime/chunks → static/runtime}/dist-Ct0xRt3Y.js +0 -0
  316. /package/{runtime/chunks → static/runtime}/es-0FFT3fCz.js +0 -0
  317. /package/{runtime/chunks → static/runtime}/es-BwJ3eGbx.js +0 -0
  318. /package/{runtime/chunks → static/runtime}/es-D8EsVtRL.js +0 -0
  319. /package/{runtime/chunks → static/runtime}/es-Da4O25Kw.js +0 -0
  320. /package/{runtime/chunks → static/runtime}/jsx-dev-runtime-V4_MuHNS.js +0 -0
  321. /package/{runtime/chunks → static/runtime}/jsx-runtime-DBeCoE0b.js +0 -0
  322. /package/{runtime/chunks → static/runtime}/objectWithoutProperties-Bk0EDksJ.js +0 -0
  323. /package/{runtime/chunks → static/runtime}/prop-types-DxD5wgQ0.js +0 -0
  324. /package/{runtime/chunks → static/runtime}/react-TEeeBWTl.js +0 -0
  325. /package/{runtime/chunks → static/runtime}/react-dom-BKKa1g6U.js +0 -0
@@ -1,7 +1,6 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createRequire } from 'module';
4
- import { createViteStandConfig } from './lib/createViteStandConfig.mjs';
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createViteStandConfig } from './lib/createViteStandConfig.ts';
5
4
  import VitePlugin from '<%~ it.standVitePluginPackage %>/vite';
6
5
 
7
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -15,4 +14,9 @@ export default createViteStandConfig({
15
14
  closedLoop: <%= it.standClosedLoop %>,
16
15
  plugins: [...VitePlugin({ outputFolder: <%~ JSON.stringify(it.standViteOutputFolder) %> })],
17
16
  extraServerMiddlewares: [],
17
+ build: {
18
+ rollupOptions: {
19
+ input: path.resolve(projectRoot, 'advanced', 'subpath', 'index.html'),
20
+ },
21
+ },
18
22
  });
@@ -1,8 +1,8 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createRequire } from 'module';
4
- import { createViteStandConfig } from './lib/createViteStandConfig.mjs';
5
- import { createUmdServeMiddleware } from './lib/umdServeMiddleware.mjs';
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createRequire } from 'node:module';
4
+ import { createViteStandConfig } from './lib/createViteStandConfig.ts';
5
+ import { createUmdServeMiddleware } from './lib/umdServeMiddleware.ts';
6
6
 
7
7
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
8
  const projectRoot = path.resolve(__dirname, '..');
@@ -1,6 +1,6 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createViteStandConfig } from './lib/createViteStandConfig.mjs';
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createViteStandConfig } from './lib/createViteStandConfig.ts';
4
4
  import VitePlugin from '<%~ it.standVitePluginPackage %>/vite';
5
5
 
6
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -1,12 +1,14 @@
1
- const path = require('path');
2
- const { createWebpackStandConfig } = require('./lib/createWebpackStandConfig.cjs');
3
- const <%= it.standWebpackPluginClassName %> = require('<%~ it.packageName %>/webpack');
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createWebpackStandConfig } from './lib/createWebpackStandConfig.ts';
4
+ import <%= it.standWebpackPluginClassName %> from '<%~ it.packageName %>/webpack';
4
5
 
5
6
  const umdOpts = null;
6
7
 
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
9
  const projectRoot = path.resolve(__dirname, '..');
8
10
 
9
- module.exports = createWebpackStandConfig({
11
+ const config = createWebpackStandConfig({
10
12
  projectRoot,
11
13
  plugins: [new <%= it.standWebpackPluginClassName %>({ publicPath: <%~ JSON.stringify(it.standRoutePath) %> })],
12
14
  outputPublicPath: <%~ JSON.stringify(it.standRoutePath) %>,
@@ -25,3 +27,5 @@ module.exports = createWebpackStandConfig({
25
27
  ],
26
28
  umd: umdOpts,
27
29
  });
30
+
31
+ export default config;
@@ -1,12 +1,16 @@
1
- const path = require('path');
2
- const { createWebpackStandConfig } = require('./lib/createWebpackStandConfig.cjs');
1
+ import path from 'node:path';
2
+ import { createRequire } from 'node:module';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { createWebpackStandConfig } from './lib/createWebpackStandConfig.ts';
3
5
 
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const require = createRequire(import.meta.url);
4
8
  const umdPackageRoot = path.dirname(require.resolve(<%~ JSON.stringify(it.packageName + '/package.json') %>));
5
9
  const umdOpts = { packageRoot: umdPackageRoot, publicPath: <%~ JSON.stringify(it.standUmdPublicPath) %> };
6
10
 
7
11
  const projectRoot = path.resolve(__dirname, '..');
8
12
 
9
- module.exports = createWebpackStandConfig({
13
+ const config = createWebpackStandConfig({
10
14
  projectRoot,
11
15
  plugins: [],
12
16
  outputPublicPath: <%~ JSON.stringify(it.standRoutePath) %>,
@@ -33,3 +37,5 @@ module.exports = createWebpackStandConfig({
33
37
  ],
34
38
  umd: umdOpts,
35
39
  });
40
+
41
+ export default config;
@@ -1,12 +1,14 @@
1
- const path = require('path');
2
- const { createWebpackStandConfig } = require('./lib/createWebpackStandConfig.cjs');
3
- const <%= it.standWebpackPluginClassName %> = require('<%~ it.packageName %>/webpack');
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { createWebpackStandConfig } from './lib/createWebpackStandConfig.ts';
4
+ import <%= it.standWebpackPluginClassName %> from '<%~ it.packageName %>/webpack';
4
5
 
5
6
  const umdOpts = null;
6
7
 
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
9
  const projectRoot = path.resolve(__dirname, '..');
8
10
 
9
- module.exports = createWebpackStandConfig({
11
+ const config = createWebpackStandConfig({
10
12
  projectRoot,
11
13
  plugins: [new <%= it.standWebpackPluginClassName %>()],
12
14
  outputPublicPath: <%~ JSON.stringify(it.standRoutePath) %>,
@@ -33,3 +35,5 @@ module.exports = createWebpackStandConfig({
33
35
  ],
34
36
  umd: umdOpts,
35
37
  });
38
+
39
+ export default config;
@@ -0,0 +1,370 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import type { IncomingMessage, ServerResponse } from 'node:http';
4
+ import formidable from 'formidable';
5
+
6
+ interface StorageItem {
7
+ id: string;
8
+ name: string;
9
+ folderId: string;
10
+ isFolder: boolean;
11
+ size?: number;
12
+ date: string;
13
+ type?: string;
14
+ url?: string;
15
+ }
16
+
17
+ interface StorageRequestBody {
18
+ name?: string;
19
+ parentId?: string;
20
+ parentid?: string;
21
+ folderId?: string;
22
+ url?: string;
23
+ path?: string;
24
+ id?: string;
25
+ }
26
+
27
+ const STORAGE_DIR = path.resolve(process.cwd(), 'storage');
28
+ const BASE = '/dev-storage';
29
+
30
+ function ensureDir(dir: string): void {
31
+ if (!fs.existsSync(dir)) {
32
+ fs.mkdirSync(dir, { recursive: true });
33
+ }
34
+ }
35
+
36
+ function sanitizePath(relativePath: string): string {
37
+ if (!relativePath || relativePath === '/' || relativePath === '.') {
38
+ return '';
39
+ }
40
+
41
+ return path.normalize(relativePath).replace(/^(\.\.(\/|\\|$))+/, '').replace(/\\/g, '/').trim();
42
+ }
43
+
44
+ function resolvePath(relativePath: string): string | null {
45
+ const safe = sanitizePath(relativePath);
46
+ const full = path.join(STORAGE_DIR, safe);
47
+ const resolved = path.resolve(full);
48
+ if (!resolved.startsWith(path.resolve(STORAGE_DIR))) {
49
+ return null;
50
+ }
51
+
52
+ return resolved;
53
+ }
54
+
55
+ function toFileItem(fullPath: string): StorageItem {
56
+ const stat = fs.statSync(fullPath);
57
+ const name = path.basename(fullPath);
58
+ const rel = path.relative(STORAGE_DIR, fullPath).replace(/\\/g, '/');
59
+ const folderId = path.dirname(rel) === '.' ? '' : path.dirname(rel).replace(/\\/g, '/');
60
+
61
+ return {
62
+ id: rel,
63
+ name,
64
+ folderId,
65
+ isFolder: stat.isDirectory(),
66
+ size: stat.isFile() ? stat.size : undefined,
67
+ date: stat.mtime.toISOString(),
68
+ type: stat.isFile() ? getMimeType(name) : undefined,
69
+ };
70
+ }
71
+
72
+ function getMimeType(name: string): string {
73
+ const ext = path.extname(name).toLowerCase();
74
+ const types = {
75
+ '.jpg': 'image/jpeg',
76
+ '.jpeg': 'image/jpeg',
77
+ '.png': 'image/png',
78
+ '.gif': 'image/gif',
79
+ '.webp': 'image/webp',
80
+ '.svg': 'image/svg+xml',
81
+ '.pdf': 'application/pdf',
82
+ '.zip': 'application/zip',
83
+ } as const;
84
+
85
+ return types[ext as keyof typeof types] || 'application/octet-stream';
86
+ }
87
+
88
+ function normalizeJsonBody(rawBody: string): StorageRequestBody {
89
+ if (!rawBody) {
90
+ return {};
91
+ }
92
+
93
+ const parsed = JSON.parse(rawBody) as Partial<Record<keyof StorageRequestBody, string>>;
94
+ return {
95
+ name: typeof parsed.name === 'string' ? parsed.name : undefined,
96
+ parentId: typeof parsed.parentId === 'string' ? parsed.parentId : undefined,
97
+ parentid: typeof parsed.parentid === 'string' ? parsed.parentid : undefined,
98
+ folderId: typeof parsed.folderId === 'string' ? parsed.folderId : undefined,
99
+ url: typeof parsed.url === 'string' ? parsed.url : undefined,
100
+ path: typeof parsed.path === 'string' ? parsed.path : undefined,
101
+ id: typeof parsed.id === 'string' ? parsed.id : undefined,
102
+ };
103
+ }
104
+
105
+ function parseJsonBody(req: IncomingMessage): Promise<StorageRequestBody> {
106
+ return new Promise((resolve) => {
107
+ let body = '';
108
+ req.on('data', (chunk: Buffer | string) => {
109
+ body += typeof chunk === 'string' ? chunk : chunk.toString('utf8');
110
+ });
111
+ req.on('end', () => {
112
+ try {
113
+ resolve(normalizeJsonBody(body));
114
+ } catch {
115
+ resolve({});
116
+ }
117
+ });
118
+ });
119
+ }
120
+
121
+ function sendJson<T>(res: ServerResponse, data: T, status = 200): void {
122
+ res.writeHead(status, { 'Content-Type': 'application/json' });
123
+ res.end(JSON.stringify(data));
124
+ }
125
+
126
+ function sendItemsResponse(res: ServerResponse, items: StorageItem[]): void {
127
+ sendJson(res, {
128
+ items,
129
+ pagination: { page: 1, limit: 1000, total: items.length, totalPages: 1 },
130
+ });
131
+ }
132
+
133
+ async function handleGetItems(_req: IncomingMessage, res: ServerResponse, url: string): Promise<void> {
134
+ const folderId = (new URL(url, 'http://x').searchParams.get('folderId') || '').trim();
135
+ const dir = folderId ? resolvePath(folderId) : path.resolve(STORAGE_DIR);
136
+ if (!dir || !fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
137
+ sendItemsResponse(res, []);
138
+ return;
139
+ }
140
+
141
+ const items = fs.readdirSync(dir).map((name) => toFileItem(path.join(dir, name)));
142
+ sendItemsResponse(res, items);
143
+ }
144
+
145
+ async function handleCreateFolder(req: IncomingMessage, res: ServerResponse): Promise<void> {
146
+ const body = await parseJsonBody(req);
147
+ const name = (body.name || '').trim();
148
+ const parentId = (body.parentId ?? body.parentid ?? '').trim();
149
+ if (!name || /[\\/:*?"<>|]/.test(name)) {
150
+ sendJson(res, { error: 'Invalid folder name' }, 400);
151
+ return;
152
+ }
153
+
154
+ const parentDir = parentId ? resolvePath(parentId) : STORAGE_DIR;
155
+ if (!parentDir || !fs.existsSync(parentDir)) {
156
+ sendJson(res, { error: 'Parent folder not found' }, 404);
157
+ return;
158
+ }
159
+
160
+ const folderPath = path.join(parentDir, name);
161
+ ensureDir(folderPath);
162
+ const rel = path.relative(STORAGE_DIR, folderPath).replace(/\\/g, '/');
163
+ const folderId = path.dirname(rel) === '.' ? '' : path.dirname(rel).replace(/\\/g, '/');
164
+ sendJson(res, {
165
+ id: rel,
166
+ name,
167
+ folderId,
168
+ isFolder: true,
169
+ date: fs.statSync(folderPath).mtime.toISOString(),
170
+ });
171
+ }
172
+
173
+ function readFormField(field: string | string[] | undefined): string {
174
+ if (typeof field === 'string') {
175
+ return field.trim();
176
+ }
177
+
178
+ if (Array.isArray(field) && typeof field[0] === 'string') {
179
+ return field[0].trim();
180
+ }
181
+
182
+ return '';
183
+ }
184
+
185
+ async function handleUpload(req: IncomingMessage, res: ServerResponse): Promise<void> {
186
+ const form = new formidable.IncomingForm({ multiples: true });
187
+ const [fields, files] = await new Promise<[formidable.Fields, formidable.Files]>((resolve, reject) => {
188
+ form.parse(req, (error, parsedFields, parsedFiles) => {
189
+ if (error) {
190
+ reject(error);
191
+ return;
192
+ }
193
+
194
+ resolve([parsedFields, parsedFiles]);
195
+ });
196
+ });
197
+
198
+ const folderId = readFormField(fields.folderId);
199
+ const targetDir = folderId ? resolvePath(folderId) : STORAGE_DIR;
200
+ if (!targetDir || !fs.existsSync(targetDir)) {
201
+ sendJson(res, { error: 'Folder not found' }, 404);
202
+ return;
203
+ }
204
+
205
+ const fileEntries = Array.isArray(files.file)
206
+ ? files.file
207
+ : files.file
208
+ ? [files.file]
209
+ : [];
210
+ const items: StorageItem[] = [];
211
+
212
+ for (const file of fileEntries) {
213
+ if (!file.filepath || !fs.existsSync(file.filepath)) {
214
+ continue;
215
+ }
216
+
217
+ const originalName = file.originalFilename || file.newFilename || path.basename(file.filepath);
218
+ const name = originalName.replace(/[\\/:*?"<>|]/g, '_');
219
+ const destination = path.join(targetDir, name);
220
+ fs.copyFileSync(file.filepath, destination);
221
+
222
+ const rel = path.relative(STORAGE_DIR, destination).replace(/\\/g, '/');
223
+ const responseFolderId = path.dirname(rel) === '.' ? '' : path.dirname(rel).replace(/\\/g, '/');
224
+ items.push({
225
+ id: rel,
226
+ name,
227
+ folderId: responseFolderId,
228
+ isFolder: false,
229
+ size: fs.statSync(destination).size,
230
+ date: fs.statSync(destination).mtime.toISOString(),
231
+ type: getMimeType(name),
232
+ });
233
+ }
234
+
235
+ sendJson(res, { items, success: true });
236
+ }
237
+
238
+ async function handleUploadByUrl(req: IncomingMessage, res: ServerResponse): Promise<void> {
239
+ const body = await parseJsonBody(req);
240
+ const url = (body.url || '').trim();
241
+ const folderId = (body.folderId || '').trim();
242
+ if (!url) {
243
+ sendJson(res, { error: 'Missing url' }, 400);
244
+ return;
245
+ }
246
+
247
+ const targetDir = folderId ? resolvePath(folderId) : STORAGE_DIR;
248
+ if (!targetDir || !fs.existsSync(targetDir)) {
249
+ sendJson(res, { error: 'Folder not found' }, 404);
250
+ return;
251
+ }
252
+
253
+ try {
254
+ const response = await fetch(url);
255
+ if (!response.ok) {
256
+ throw new Error('Fetch failed');
257
+ }
258
+
259
+ const buffer = Buffer.from(await response.arrayBuffer());
260
+ const name = (url.split('/').pop() || 'file').split('?')[0] || 'file';
261
+ const destination = path.join(targetDir, name);
262
+ fs.writeFileSync(destination, buffer);
263
+
264
+ const rel = path.relative(STORAGE_DIR, destination).replace(/\\/g, '/');
265
+ const responseFolderId = path.dirname(rel) === '.' ? '' : path.dirname(rel).replace(/\\/g, '/');
266
+ sendJson(res, {
267
+ id: rel,
268
+ name,
269
+ folderId: responseFolderId,
270
+ isFolder: false,
271
+ size: buffer.length,
272
+ date: fs.statSync(destination).mtime.toISOString(),
273
+ type: getMimeType(name),
274
+ url: `/dev-storage/file/${encodeURIComponent(rel)}`,
275
+ });
276
+ } catch (error) {
277
+ const message = error instanceof Error ? error.message : String(error);
278
+ sendJson(res, { error: message }, 500);
279
+ }
280
+ }
281
+
282
+ async function handleDeleteItem(req: IncomingMessage, res: ServerResponse, pathOverride = ''): Promise<void> {
283
+ let targetPath = pathOverride.trim();
284
+
285
+ if (!targetPath) {
286
+ const pathParam = (new URL(req.url || '/', 'http://x').searchParams.get('path') || '').trim();
287
+ const body = await parseJsonBody(req);
288
+ targetPath = pathParam || (body.path || body.id || '').trim();
289
+ }
290
+
291
+ if (!targetPath) {
292
+ sendJson(res, { error: 'Missing path' }, 400);
293
+ return;
294
+ }
295
+
296
+ const fullPath = resolvePath(targetPath);
297
+ if (!fullPath || !fs.existsSync(fullPath)) {
298
+ sendJson(res, { error: 'Not found' }, 404);
299
+ return;
300
+ }
301
+
302
+ fs.rmSync(fullPath, { recursive: true });
303
+ sendJson(res, { success: true });
304
+ }
305
+
306
+ function handleGetFile(res: ServerResponse, pathPart: string): void {
307
+ const decoded = decodeURIComponent(pathPart);
308
+ const fullPath = resolvePath(decoded);
309
+ if (!fullPath || !fs.existsSync(fullPath) || !fs.statSync(fullPath).isFile()) {
310
+ res.writeHead(404);
311
+ res.end();
312
+ return;
313
+ }
314
+
315
+ const stream = fs.createReadStream(fullPath);
316
+ const mime = getMimeType(path.basename(fullPath));
317
+ res.writeHead(200, { 'Content-Type': mime });
318
+ stream.pipe(res);
319
+ }
320
+
321
+ export default function devStorageMiddleware() {
322
+ ensureDir(STORAGE_DIR);
323
+
324
+ return (req: IncomingMessage, res: ServerResponse, next: () => void): void => {
325
+ if (!req.url || !req.url.startsWith(BASE)) {
326
+ next();
327
+ return;
328
+ }
329
+
330
+ const pathPart = req.url.slice(BASE.length).replace(/^\//, '');
331
+ const method = req.method || 'GET';
332
+
333
+ if (method === 'GET' && (pathPart === 'items' || pathPart.startsWith('items?'))) {
334
+ void handleGetItems(req, res, req.url);
335
+ return;
336
+ }
337
+
338
+ if (method === 'GET' && pathPart.startsWith('file/')) {
339
+ handleGetFile(res, pathPart.slice(5));
340
+ return;
341
+ }
342
+
343
+ if (method === 'POST' && pathPart === 'folder') {
344
+ void handleCreateFolder(req, res);
345
+ return;
346
+ }
347
+
348
+ if (method === 'POST' && pathPart === 'upload') {
349
+ void handleUpload(req, res);
350
+ return;
351
+ }
352
+
353
+ if (method === 'POST' && pathPart === 'upload-by-url') {
354
+ void handleUploadByUrl(req, res);
355
+ return;
356
+ }
357
+
358
+ if (method === 'DELETE' && pathPart === 'item') {
359
+ void handleDeleteItem(req, res);
360
+ return;
361
+ }
362
+
363
+ if (method === 'DELETE' && pathPart.startsWith('item/')) {
364
+ void handleDeleteItem(req, res, decodeURIComponent(pathPart.slice(5)));
365
+ return;
366
+ }
367
+
368
+ next();
369
+ };
370
+ }
@@ -0,0 +1,80 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { PluginOption, UserConfig, UserConfigExport } from 'vite';
3
+ import { defineConfig } from 'vite';
4
+ import devStorageMiddleware from '../../scripts/devStorageMiddleware.ts';
5
+
6
+ type DevServerMiddleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
7
+
8
+ interface CreateViteStandConfigOptions {
9
+ projectRoot: string;
10
+ open?: string;
11
+ apiBaseUrl: string;
12
+ apiOrigin: string;
13
+ closedLoop?: boolean;
14
+ plugins?: PluginOption[];
15
+ extraServerMiddlewares?: DevServerMiddleware[];
16
+ build?: UserConfig['build'];
17
+ resolve?: UserConfig['resolve'];
18
+ serverPort?: number;
19
+ }
20
+
21
+ export function createViteStandConfig(options: CreateViteStandConfigOptions): UserConfigExport {
22
+ const {
23
+ projectRoot,
24
+ open,
25
+ apiBaseUrl,
26
+ apiOrigin,
27
+ closedLoop,
28
+ plugins = [],
29
+ extraServerMiddlewares = [],
30
+ build,
31
+ resolve,
32
+ serverPort = 3000,
33
+ } = options;
34
+
35
+ const proxy: NonNullable<UserConfig['server']>['proxy'] = {
36
+ '/api': {
37
+ target: apiBaseUrl,
38
+ secure: false,
39
+ changeOrigin: true,
40
+ configure: (proxyInstance) => {
41
+ proxyInstance.on('proxyReq', (proxyRequest) => {
42
+ if (proxyRequest.getHeader('origin')) {
43
+ proxyRequest.setHeader('origin', apiOrigin);
44
+ }
45
+ });
46
+ },
47
+ },
48
+ };
49
+
50
+ if (closedLoop) {
51
+ proxy['/wp-json'] = {
52
+ target: apiBaseUrl,
53
+ secure: false,
54
+ changeOrigin: true,
55
+ };
56
+ }
57
+
58
+ return defineConfig(() => ({
59
+ root: projectRoot,
60
+ plugins: [
61
+ ...plugins,
62
+ {
63
+ name: 'dev-storage',
64
+ configureServer(server) {
65
+ server.middlewares.use(devStorageMiddleware());
66
+ for (const middleware of extraServerMiddlewares) {
67
+ server.middlewares.use(middleware);
68
+ }
69
+ },
70
+ },
71
+ ],
72
+ ...(resolve ? { resolve } : {}),
73
+ server: {
74
+ ...(open !== undefined && open !== null ? { open } : {}),
75
+ port: serverPort,
76
+ proxy,
77
+ },
78
+ ...(build ? { build } : {}),
79
+ }));
80
+ }
@@ -0,0 +1 @@
1
+ <%~ include('stand-dev-storage-middleware', it) %>
@@ -1,16 +1,33 @@
1
- const path = require('path');
1
+ import path from 'node:path';
2
+ import type { ClientRequest } from 'node:http';
3
+ import type { Configuration, WebpackPluginInstance } from 'webpack';
4
+ import devStorageMiddleware from '../../scripts/devStorageMiddleware.ts';
5
+ import { createUmdServeMiddleware } from './umdServeMiddleware.ts';
2
6
 
3
- /**
4
- * @param {object} options
5
- * @param {string} options.projectRoot
6
- * @param {any[]} options.plugins
7
- * @param {string} options.outputPublicPath
8
- * @param {string} options.staticDirectory — абсолютный путь к static directory
9
- * @param {string} options.open
10
- * @param {object[]} options.proxy
11
- * @param {{ packageRoot: string; publicPath: string } | null} [options.umd]
12
- */
13
- function createWebpackStandConfig(options) {
7
+ interface UmdServeOptions {
8
+ packageRoot: string;
9
+ publicPath: string;
10
+ }
11
+
12
+ interface ProxyRule {
13
+ context: string[];
14
+ target: string;
15
+ secure: boolean;
16
+ changeOrigin: boolean;
17
+ onProxyReq?: (proxyRequest: ClientRequest) => void;
18
+ }
19
+
20
+ interface CreateWebpackStandConfigOptions {
21
+ projectRoot: string;
22
+ plugins: WebpackPluginInstance[];
23
+ outputPublicPath: string;
24
+ staticDirectory: string;
25
+ open: string;
26
+ proxy: ProxyRule[];
27
+ umd?: UmdServeOptions | null;
28
+ }
29
+
30
+ export function createWebpackStandConfig(options: CreateWebpackStandConfigOptions): Configuration {
14
31
  const {
15
32
  projectRoot,
16
33
  plugins,
@@ -21,9 +38,6 @@ function createWebpackStandConfig(options) {
21
38
  umd,
22
39
  } = options;
23
40
 
24
- const devStorage = require(path.resolve(projectRoot, 'scripts/devStorageMiddleware.cjs'));
25
- const { createUmdServeMiddleware } = require(path.join(__dirname, 'umdServeMiddleware.cjs'));
26
-
27
41
  const umdMiddleware = umd ? createUmdServeMiddleware(umd) : null;
28
42
 
29
43
  return {
@@ -65,9 +79,9 @@ function createWebpackStandConfig(options) {
65
79
  liveReload: true,
66
80
  allowedHosts: 'all',
67
81
  setupMiddlewares: (middlewares, devServer) => {
68
- devServer.app.use(devStorage());
82
+ devServer.app?.use(devStorageMiddleware());
69
83
  if (umdMiddleware) {
70
- devServer.app.use(umdMiddleware);
84
+ devServer.app?.use(umdMiddleware);
71
85
  }
72
86
  return middlewares;
73
87
  },
@@ -75,5 +89,3 @@ function createWebpackStandConfig(options) {
75
89
  },
76
90
  };
77
91
  }
78
-
79
- module.exports = { createWebpackStandConfig };