@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.5
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.
- package/README.md +1 -1
- package/cli/dist/lib/cli/project.js +2 -16
- package/cli/dist/lib/config.js +20 -29
- package/cli/dist/lib/local-test.js +3 -19
- package/cli/dist/lib/paths.js +11 -0
- package/cli/dist/lib/resolveNpmSpawn.d.ts +20 -0
- package/cli/dist/lib/resolveNpmSpawn.js +71 -0
- package/cli/dist/lib/template-engine/context/pluginPackageJsonData.js +21 -19
- package/cli/dist/lib/template-engine/context/standVitePackageJsonData.js +7 -8
- package/cli/dist/lib/template-engine/resolveVariantDir.d.ts +5 -1
- package/cli/dist/lib/template-engine/resolveVariantDir.js +22 -0
- package/cli/dist/lib/templates/shared/i18n.js +2 -2
- package/cli/dist/lib/templates/shared/paths.js +3 -4
- package/cli/dist/lib/types/package-config.d.ts +1 -0
- package/cli/lib/cli/project.ts +2 -18
- package/cli/lib/config.ts +19 -30
- package/cli/lib/local-test.ts +3 -22
- package/cli/lib/paths.ts +15 -0
- package/cli/lib/resolveNpmSpawn.ts +72 -0
- package/cli/lib/template-engine/buildStandIndexHtml.test.ts +1 -0
- package/cli/lib/template-engine/context/pluginPackageJsonData.ts +23 -23
- package/cli/lib/template-engine/context/standVitePackageJsonData.ts +7 -12
- package/cli/lib/template-engine/pluginEtaParity.test.ts +1 -0
- package/cli/lib/template-engine/resolveVariantDir.ts +22 -0
- package/cli/lib/template-engine/standAdvancedViteDevHostEta.test.ts +4 -3
- package/cli/lib/template-engine/standWebpackDevHostEta.test.ts +7 -6
- package/cli/lib/templates/shared/i18n.ts +2 -2
- package/cli/lib/templates/shared/paths.ts +3 -4
- package/cli/lib/types/package-config.ts +1 -0
- package/cli/package.json +1 -1
- package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/vite/{sandbox-build.config.mjs → sandbox-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.module.cjs → plugin-build.legacy.module.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.umd.cjs → plugin-build.legacy.umd.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.module.cjs → plugin-build.modern.module.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.umd.cjs → plugin-build.modern.umd.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{sandbox-build.config.cjs → sandbox-build.config.ts} +13 -3
- package/cli/project-templates/plugin/bundler-vite/release.html.eta +1 -0
- package/cli/project-templates/plugin/bundler-webpack/public/release.html.eta +1 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-1.svg +10 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-2.svg +10 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-runner.ts +22 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-types.ts +17 -0
- package/cli/project-templates/plugin/shared-base/scripts/clean.ts +16 -0
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.ts +52 -0
- package/cli/project-templates/plugin/shared-base/scripts/npmRun.ts +61 -0
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.ts +18 -0
- package/cli/project-templates/plugin/shared-base/scripts/scriptRuntime.ts +10 -0
- package/cli/project-templates/plugin/shared-base/src/dev/hostApp.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev-release.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev.tsx.eta +1 -1
- package/cli/project-templates/shared/partials/plugin-dev-host-app-advanced.eta +93 -0
- package/cli/project-templates/shared/partials/plugin-dev-host-app-minimal.eta +54 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-advanced.eta +3 -2
- package/cli/project-templates/shared/partials/plugin-dev-tsx-debug.eta +18 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-release.eta +33 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-runtime-helpers.eta +8 -8
- package/cli/project-templates/shared/partials/plugin-index-ts.eta +0 -1
- package/cli/project-templates/shared/partials/plugin-vite-dev-host.eta +9 -5
- package/cli/project-templates/shared/partials/plugin-vite-plugin-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-vite-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-vite-sandbox-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-legacy.eta +12 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-modern.eta +13 -6
- package/cli/project-templates/shared/partials/plugin-webpack-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-webpack-sandbox-build.eta +13 -3
- package/cli/project-templates/shared/partials/plugin-wp-legacy-module.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-legacy-umd.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-modern-module.eta +9 -4
- package/cli/project-templates/shared/partials/plugin-wp-modern-umd.eta +9 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-memory.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-vite-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-umd.eta +5 -5
- package/cli/project-templates/shared/partials/stand-dev-host-vite.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-umd.eta +9 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-storage-middleware.eta +370 -0
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts +80 -0
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/shared/stand-webpack-base/config/lib/{createWebpackStandConfig.cjs → createWebpackStandConfig.ts} +31 -19
- package/cli/project-templates/{stand/advanced/umd/vite/config/lib/umdServeMiddleware.mjs → shared/stand-webpack-base/config/lib/umdServeMiddleware.ts} +19 -11
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/stand/advanced/memory-usage/vite/config/lib/{createMemoryUsageStandConfig.mjs → createMemoryUsageStandConfig.ts} +25 -20
- package/cli/project-templates/stand/advanced/umd/vite/config/lib/umdServeMiddleware.ts +68 -0
- package/cli/project-templates/stand/react-adapter/webpack/README.md.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/config/dev-host.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/package.json.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/public/index.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/editorConfig.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/email.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/getAuthToken.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/oauthCredentials.ts +9 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/storageProvider.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/index.tsx.eta +1 -0
- package/cli/scripts/cli-matrix-smoke.ts +19 -10
- package/cli/scripts/verify-global-cli.ts +1 -1
- package/cli/scripts/vite-plugin-version-matrix.ts +299 -0
- package/cli/tsconfig.json +2 -2
- package/emailmaker-core.ed344c04.js +1 -0
- package/emailmaker-esm.js +788 -153
- package/emailmaker.d.ts +32 -0
- package/emailmaker.js +4 -4
- package/iframe/js/amp.BGJMqoms.js +1 -1
- package/iframe/js/chunk.oX6nCJbK.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.BSaCN7eK.js +1 -1
- package/iframe/js/sanitize-html.Dy7Uwo8P.js +1 -1
- package/images/integrations/activecampaign.svg +4 -0
- package/images/integrations/bento.svg +9 -0
- package/images/integrations/brevo.svg +7 -0
- package/images/integrations/campaign_monitor.svg +10 -0
- package/images/integrations/constant_contact.svg +24 -0
- package/images/integrations/dotdigital.svg +144 -0
- package/images/integrations/getresponse.svg +23 -0
- package/images/integrations/hubspot.svg +3 -0
- package/images/integrations/klaviyo.svg +10 -0
- package/images/integrations/mailchimp.svg +9 -0
- package/images/integrations/salesforce.svg +20 -0
- package/js/browser-image-compression.js +9 -0
- package/package.json +2 -5
- package/runtime/@ant-design/cssinjs/index.js +1 -1
- package/runtime/@ant-design/icons/index.js +1 -1
- package/runtime/@ant-design/pro-layout/index.js +1 -1
- package/runtime/README.md +13 -13
- package/runtime/antd/index.js +1 -1
- package/runtime/app-core/index.js +1 -2
- package/runtime/classnames/index.js +1 -1
- package/runtime/core/index.js +6 -6
- package/runtime/dayjs/index.js +1 -1
- package/runtime/di/index.js +1 -2
- package/runtime/disposable/index.js +1 -2
- package/runtime/errors-runtime/index.js +1 -2
- package/runtime/guid/index.js +1 -2
- package/runtime/index.js +2 -4
- package/runtime/package.json +2 -3
- package/runtime/prop-types/index.js +1 -1
- package/runtime/react/index.js +1 -1
- package/runtime/react/jsx-dev-runtime/index.js +1 -1
- package/runtime/react/jsx-runtime/index.js +1 -1
- package/runtime/react-dom/client/index.js +1 -1
- package/runtime/react-dom/index.js +1 -1
- package/runtime/react-router-dom/index.js +1 -1
- package/runtime/uuid/index.js +1 -1
- package/static/amd/{8fc2a596.js → 19aeb269.js} +88 -88
- package/static/core/192ec827.js +1 -0
- package/static/core/22c1de2e2.js +1 -0
- package/static/core/24faedf0.js +1 -0
- package/static/core/29231645.js +1 -0
- package/static/core/2a3177fc2.js +1 -0
- package/static/core/346aabd2.js +3 -0
- package/static/core/3b800ed6.js +1 -0
- package/static/core/3e840e90.js +1 -0
- package/static/core/40cc9fd7.js +1 -0
- package/static/core/421bdec22.js +1 -0
- package/static/core/50ff48bc.js +4 -0
- package/static/core/5282795d2.js +6 -0
- package/static/core/555e2e2f2.js +903 -0
- package/static/core/563a283d.js +1 -0
- package/static/core/5d47e095.js +47 -0
- package/static/core/5f574386.js +1 -0
- package/static/core/67a41193.js +1 -0
- package/static/core/698dace4.js +7 -0
- package/static/core/6b648e2d.js +1 -0
- package/static/core/7629adfd.js +1 -0
- package/static/core/7717f2932.js +3 -0
- package/static/core/776cb34a.js +1 -0
- package/static/core/78a1e31e.js +1 -0
- package/static/core/7d56d643.js +1 -0
- package/static/core/841752212.js +40 -0
- package/static/core/8477e97e.js +1 -0
- package/static/core/8756d562.js +1 -0
- package/static/core/91d328d8.js +1 -0
- package/static/core/9270dbb6.js +6 -0
- package/static/core/96371334.js +566 -0
- package/static/core/9b9ddaef2.js +168 -0
- package/static/core/af1da4b4.js +1 -0
- package/static/core/b5096b152.js +471 -0
- package/static/core/bde6775a.js +1 -0
- package/static/core/bf1b888c.js +4 -0
- package/static/core/c3747df72.js +598 -0
- package/static/core/cec8d739.js +11 -0
- package/static/core/cfac3d32.js +1 -0
- package/static/core/d21c95cf2.js +1 -0
- package/static/core/dbd9ca52.js +1 -0
- package/static/core/dc590181.js +1 -0
- package/static/core/e0039d55.js +1 -0
- package/static/core/e4071c1a.js +4 -0
- package/static/core/ef87b75c.js +41 -0
- package/static/core/f47701f32.js +20 -0
- package/static/core/f83d7ac42.js +3 -0
- package/static/core/fcc67e6b.js +1 -0
- package/static/core/fd40d85c.js +1 -0
- package/static/core/fe638847.js +1 -0
- package/static/esm/{e8401d17.js → 203c9644.js} +3 -3
- package/static/esm/4b679053.js +27 -0
- package/static/esm/{b273a6c2.js → f31a26c6.js} +1 -1
- package/static/runtime/disposable-CD74igiJ.js +1 -0
- package/static/runtime/guid-C0wuVR8v.js +1 -0
- package/vite/index.d.ts +17 -6
- package/vite/index.js +315 -270
- package/vite/pluginDev/index.d.ts +10 -19
- package/vite/pluginDev/index.js +251 -204
- package/webpack/index.d.ts +24 -5
- package/webpack/index.js +168 -144
- package/webpack/pluginDev/index.d.ts +21 -22
- package/webpack/pluginDev/index.js +242 -177
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.js +0 -89
- package/cli/dist/lib/template-engine/emitEtaTree.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/emitEtaTree.test.js +0 -34
- package/cli/dist/lib/template-engine/pluginEtaParity.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/pluginEtaParity.test.js +0 -105
- package/cli/dist/lib/template-engine/resolveVariantDir.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/resolveVariantDir.test.js +0 -52
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.js +0 -67
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.js +0 -83
- package/cli/dist/lib/template-engine/storageProviderEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/storageProviderEta.test.js +0 -26
- package/cli/project-templates/plugin/shared-base/scripts/build-types.cjs +0 -8
- package/cli/project-templates/plugin/shared-base/scripts/clean.cjs +0 -6
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.cjs +0 -48
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.cjs +0 -63
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.mjs +0 -80
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.cjs +0 -235
- package/cli/project-templates/shared/stand-webpack-base/config/lib/umdServeMiddleware.cjs +0 -38
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.cjs +0 -235
- package/emailmaker-core.80d62b88.js +0 -569
- package/runtime/_core/app-core/index.js +0 -1
- package/runtime/_core/chunks/app-core-DphKKh8f.js +0 -1
- package/runtime/_core/chunks/chunk-oqAt0Dze.js +0 -1
- package/runtime/_core/chunks/di-BHUzE57z.js +0 -1
- package/runtime/_core/chunks/disposable-PhM3rJkj.js +0 -1
- package/runtime/_core/chunks/errors-runtime-VjCOXaQX.js +0 -1
- package/runtime/_core/chunks/guid-D2-FTZQG.js +0 -1
- package/runtime/_core/di/index.js +0 -1
- package/runtime/_core/disposable/index.js +0 -1
- package/runtime/_core/errors-runtime/index.js +0 -1
- package/runtime/_core/guid/index.js +0 -1
- package/runtime/_core/index.js +0 -1
- package/shared/hostBootstrap.js +0 -47
- package/shared/pluginDevOptions.js +0 -31
- package/shared/runtimeManifest.js +0 -72
- package/shared/stringCase.js +0 -16
- package/static/core/2360f32a.js +0 -3
- package/static/core/2687db56.js +0 -3
- package/static/core/2b250af6.js +0 -1261
- package/static/core/3469930c.js +0 -302
- package/static/core/34ce9042.js +0 -201
- package/static/core/4091ba5b.js +0 -25
- package/static/core/41ce3a6a.js +0 -173
- package/static/core/4ac4908c.js +0 -2213
- package/static/core/519096c1.js +0 -2597
- package/static/core/5fa1772b.js +0 -116550
- package/static/core/61312909.js +0 -3
- package/static/core/62a98c07.js +0 -75301
- package/static/core/6309c0f2.js +0 -3
- package/static/core/68d9f440.js +0 -3
- package/static/core/73b645ab.js +0 -2
- package/static/core/81019351.js +0 -280
- package/static/core/835b37ef.js +0 -591
- package/static/core/91242fb3.js +0 -3
- package/static/core/972b15b0.js +0 -92399
- package/static/core/974ef468.js +0 -493
- package/static/core/a17614422.js +0 -38078
- package/static/core/a2fa7b5b.js +0 -4232
- package/static/core/a513adfd.js +0 -89857
- package/static/core/a7c73a9b.js +0 -3813
- package/static/core/b64c7c90.js +0 -228
- package/static/core/cdc9ba92.js +0 -4711
- package/static/core/d1db685d.js +0 -2193
- package/static/core/d661febc.js +0 -3
- package/static/core/d6d2d2d0.js +0 -23
- package/static/core/df1a1225.js +0 -607
- package/static/core/e5bff179.js +0 -1302
- package/static/core/e5d602f5.js +0 -2
- package/static/core/eb029366.js +0 -1532
- package/static/core/f46c035a.js +0 -2
- package/static/core/f8b9d89a.js +0 -461
- package/static/core/fd897ad7.js +0 -3
- package/static/core/fdd890c7.js +0 -6168
- package/static/esm/29eb18ff.js +0 -164
- package/vite/mime-types.js +0 -179
- package/vite/utils.js +0 -44
- /package/cli/project-templates/plugin/bundler-vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{plugin-build.mjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{sandbox-build.mjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{plugin-build.cjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{sandbox-build.cjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/memory-usage/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/react-adapter/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/iframe/{iframe-eblock.80d62b88.html → iframe-eblock.ed344c04.html} +0 -0
- /package/iframe/{iframe.80d62b88.html → iframe.ed344c04.html} +0 -0
- /package/{runtime/chunks → static/runtime}/DownloadOutlined-a2ZUz7zB.js +0 -0
- /package/{runtime/chunks → static/runtime}/chunk-D-iEO58U.js +0 -0
- /package/{runtime/chunks → static/runtime}/classnames-DBEldvch.js +0 -0
- /package/{runtime/chunks → static/runtime}/client-5XqXGmAI.js +0 -0
- /package/{runtime/chunks → static/runtime}/dayjs.min-CO3mzOeV.js +0 -0
- /package/{runtime/_core/chunks/defineProperty-BGJFuFMq.js → static/runtime/defineProperty-CGNmw-jw.js} +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Cns8cA2n.js +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Ct0xRt3Y.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-0FFT3fCz.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-BwJ3eGbx.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-D8EsVtRL.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-Da4O25Kw.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-dev-runtime-V4_MuHNS.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-runtime-DBeCoE0b.js +0 -0
- /package/{runtime/chunks → static/runtime}/objectWithoutProperties-Bk0EDksJ.js +0 -0
- /package/{runtime/chunks → static/runtime}/prop-types-DxD5wgQ0.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-TEeeBWTl.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-dom-BKKa1g6U.js +0 -0
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
|
|
5
|
+
interface UmdServeOptions {
|
|
6
|
+
packageRoot: string;
|
|
7
|
+
publicPath: string;
|
|
8
|
+
}
|
|
3
9
|
|
|
4
10
|
const MIME_TYPES = {
|
|
5
11
|
'.css': 'text/css; charset=utf-8',
|
|
@@ -16,30 +22,29 @@ const MIME_TYPES = {
|
|
|
16
22
|
'.woff': 'font/woff',
|
|
17
23
|
'.woff2': 'font/woff2',
|
|
18
24
|
'.ttf': 'font/ttf',
|
|
19
|
-
}
|
|
25
|
+
} as const satisfies Record<string, string>;
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @returns {import('connect').NextHandleFunction}
|
|
24
|
-
*/
|
|
25
|
-
export function createUmdServeMiddleware(opts) {
|
|
26
|
-
const { packageRoot, publicPath } = opts;
|
|
27
|
+
export function createUmdServeMiddleware(options: UmdServeOptions) {
|
|
28
|
+
const { packageRoot, publicPath } = options;
|
|
27
29
|
|
|
28
|
-
return
|
|
30
|
+
return (req: IncomingMessage, res: ServerResponse, next: () => void): void => {
|
|
29
31
|
if (!req.url || (req.method !== 'GET' && req.method !== 'HEAD')) {
|
|
30
32
|
next();
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
35
|
+
|
|
33
36
|
const requestPath = decodeURIComponent(new URL(req.url, 'http://localhost').pathname);
|
|
34
37
|
if (!requestPath.startsWith(publicPath)) {
|
|
35
38
|
next();
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
const relativePath = requestPath.slice(publicPath.length);
|
|
39
43
|
if (!relativePath || relativePath.endsWith('/')) {
|
|
40
44
|
next();
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
47
|
+
|
|
43
48
|
const absolutePath = path.resolve(packageRoot, relativePath);
|
|
44
49
|
const relativeFromRoot = path.relative(packageRoot, absolutePath);
|
|
45
50
|
if (relativeFromRoot.startsWith('..') || path.isAbsolute(relativeFromRoot)) {
|
|
@@ -47,14 +52,17 @@ export function createUmdServeMiddleware(opts) {
|
|
|
47
52
|
res.end('Forbidden');
|
|
48
53
|
return;
|
|
49
54
|
}
|
|
55
|
+
|
|
50
56
|
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isFile()) {
|
|
51
57
|
next();
|
|
52
58
|
return;
|
|
53
59
|
}
|
|
54
|
-
|
|
60
|
+
|
|
61
|
+
const contentType = MIME_TYPES[path.extname(absolutePath).toLowerCase() as keyof typeof MIME_TYPES];
|
|
55
62
|
if (contentType) {
|
|
56
63
|
res.setHeader('Content-Type', contentType);
|
|
57
64
|
}
|
|
65
|
+
|
|
58
66
|
res.end(fs.readFileSync(absolutePath));
|
|
59
67
|
};
|
|
60
68
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-dev-storage-middleware', it) %>
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
import path from 'path';
|
|
1
|
+
import path from 'node:path';
|
|
2
2
|
import react from '@vitejs/plugin-react';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
|
-
import {
|
|
4
|
+
import type { PluginOption, ProxyOptions, UserConfigExport } from 'vite';
|
|
5
5
|
import { defineConfig } from 'vite';
|
|
6
6
|
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
7
7
|
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
|
|
8
|
+
import devStorageMiddleware from '../../scripts/devStorageMiddleware.ts';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function createMemoryUsageStandConfig(options) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
interface CreateMemoryUsageStandConfigOptions {
|
|
11
|
+
projectRoot: string;
|
|
12
|
+
vitePlugin: () => PluginOption[];
|
|
13
|
+
closedLoop?: boolean;
|
|
14
|
+
apiBaseUrl: string;
|
|
15
|
+
apiOrigin: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function createMemoryUsageStandConfig(options: CreateMemoryUsageStandConfigOptions): UserConfigExport {
|
|
19
|
+
const {
|
|
20
|
+
projectRoot,
|
|
21
|
+
vitePlugin,
|
|
22
|
+
closedLoop,
|
|
23
|
+
apiBaseUrl,
|
|
24
|
+
apiOrigin,
|
|
25
|
+
} = options;
|
|
21
26
|
|
|
22
|
-
const proxy = {
|
|
27
|
+
const proxy: Record<string, string | ProxyOptions> = {
|
|
23
28
|
'/api': {
|
|
24
29
|
target: apiBaseUrl,
|
|
25
30
|
secure: false,
|
|
26
31
|
changeOrigin: true,
|
|
27
|
-
configure: (
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
32
|
+
configure: (proxyInstance) => {
|
|
33
|
+
proxyInstance.on('proxyReq', (proxyRequest) => {
|
|
34
|
+
if (proxyRequest.getHeader('origin')) {
|
|
35
|
+
proxyRequest.setHeader('origin', apiOrigin);
|
|
31
36
|
}
|
|
32
37
|
});
|
|
33
38
|
},
|
|
@@ -60,7 +65,7 @@ export function createMemoryUsageStandConfig(options) {
|
|
|
60
65
|
{
|
|
61
66
|
name: 'dev-storage',
|
|
62
67
|
configureServer(server) {
|
|
63
|
-
server.middlewares.use(
|
|
68
|
+
server.middlewares.use(devStorageMiddleware());
|
|
64
69
|
},
|
|
65
70
|
},
|
|
66
71
|
],
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
|
|
5
|
+
interface UmdServeOptions {
|
|
6
|
+
packageRoot: string;
|
|
7
|
+
publicPath: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const MIME_TYPES = {
|
|
11
|
+
'.css': 'text/css; charset=utf-8',
|
|
12
|
+
'.js': 'application/javascript; charset=utf-8',
|
|
13
|
+
'.json': 'application/json; charset=utf-8',
|
|
14
|
+
'.html': 'text/html; charset=utf-8',
|
|
15
|
+
'.map': 'application/json; charset=utf-8',
|
|
16
|
+
'.svg': 'image/svg+xml',
|
|
17
|
+
'.png': 'image/png',
|
|
18
|
+
'.jpg': 'image/jpeg',
|
|
19
|
+
'.jpeg': 'image/jpeg',
|
|
20
|
+
'.gif': 'image/gif',
|
|
21
|
+
'.webp': 'image/webp',
|
|
22
|
+
'.woff': 'font/woff',
|
|
23
|
+
'.woff2': 'font/woff2',
|
|
24
|
+
'.ttf': 'font/ttf',
|
|
25
|
+
} as const satisfies Record<string, string>;
|
|
26
|
+
|
|
27
|
+
export function createUmdServeMiddleware(options: UmdServeOptions) {
|
|
28
|
+
const { packageRoot, publicPath } = options;
|
|
29
|
+
|
|
30
|
+
return (req: IncomingMessage, res: ServerResponse, next: () => void): void => {
|
|
31
|
+
if (!req.url || (req.method !== 'GET' && req.method !== 'HEAD')) {
|
|
32
|
+
next();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const requestPath = decodeURIComponent(new URL(req.url, 'http://localhost').pathname);
|
|
37
|
+
if (!requestPath.startsWith(publicPath)) {
|
|
38
|
+
next();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const relativePath = requestPath.slice(publicPath.length);
|
|
43
|
+
if (!relativePath || relativePath.endsWith('/')) {
|
|
44
|
+
next();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const absolutePath = path.resolve(packageRoot, relativePath);
|
|
49
|
+
const relativeFromRoot = path.relative(packageRoot, absolutePath);
|
|
50
|
+
if (relativeFromRoot.startsWith('..') || path.isAbsolute(relativeFromRoot)) {
|
|
51
|
+
res.statusCode = 403;
|
|
52
|
+
res.end('Forbidden');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isFile()) {
|
|
57
|
+
next();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const contentType = MIME_TYPES[path.extname(absolutePath).toLowerCase() as keyof typeof MIME_TYPES];
|
|
62
|
+
if (contentType) {
|
|
63
|
+
res.setHeader('Content-Type', contentType);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
res.end(fs.readFileSync(absolutePath));
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-readme', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-dev-host-webpack', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-package-json', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-webpack-index-shell', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-editor-config', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-dev-email', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-get-auth-token', it) %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const oauthCredentials = {
|
|
2
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
3
|
+
clientSecret: 'YOUR_CLIENT_SECRET',
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export function hasOAuthCredentials() {
|
|
7
|
+
return oauthCredentials.clientId !== 'YOUR_CLIENT_ID'
|
|
8
|
+
&& oauthCredentials.clientSecret !== 'YOUR_CLIENT_SECRET';
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-storage-provider', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('stand-host-react-adapter', it) %>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* Run from repository root:
|
|
7
7
|
* npx tsx build-tools/cli/scripts/cli-matrix-smoke.ts
|
|
8
8
|
* npx tsx build-tools/cli/scripts/cli-matrix-smoke.ts --repo-root=. --skip-install
|
|
9
|
+
* npx tsx build-tools/cli/scripts/cli-matrix-smoke.ts --only-plugins
|
|
9
10
|
*
|
|
10
11
|
* Env (optional):
|
|
11
12
|
* CLI_MATRIX_LOG — absolute or relative log path
|
|
@@ -22,20 +23,18 @@
|
|
|
22
23
|
import * as fs from 'fs';
|
|
23
24
|
import * as path from 'path';
|
|
24
25
|
import { spawnSync } from 'child_process';
|
|
25
|
-
import { createRequire } from 'module';
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
import { findNpmCliJs } from '../lib/resolveNpmSpawn';
|
|
28
|
+
|
|
29
|
+
/** Same strategy as lib/resolveNpmSpawn: on Windows `npm` is not a real .exe, spawn fails with ENOENT. */
|
|
30
|
+
function resolveNpmSpawn(_repoRoot: string, npmArgs: string[]): { command: string; args: string[] } {
|
|
29
31
|
if (process.platform === 'win32') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const npmPackageJson = requireFromRepo.resolve('npm/package.json');
|
|
32
|
+
const cliJs = findNpmCliJs('npm');
|
|
33
|
+
if (cliJs) {
|
|
33
34
|
return {
|
|
34
35
|
command: process.execPath,
|
|
35
|
-
args: [
|
|
36
|
+
args: [cliJs, ...npmArgs],
|
|
36
37
|
};
|
|
37
|
-
} catch {
|
|
38
|
-
/* fall through */
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
return { command: 'npm', args: npmArgs };
|
|
@@ -48,6 +47,8 @@ interface CliMatrixOptions {
|
|
|
48
47
|
skipInstall: boolean;
|
|
49
48
|
noLocalTest: boolean;
|
|
50
49
|
cliScript: string | null;
|
|
50
|
+
/** Only cases whose id starts with `plugin-` (excludes demo-stand matrix rows). */
|
|
51
|
+
onlyPlugins: boolean;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
interface MatrixCase {
|
|
@@ -66,6 +67,7 @@ function parseArgs(argv: string[]): CliMatrixOptions {
|
|
|
66
67
|
let cliScript: string | null = process.env.CLI_MATRIX_CLI
|
|
67
68
|
? path.resolve(cwd, process.env.CLI_MATRIX_CLI)
|
|
68
69
|
: null;
|
|
70
|
+
let onlyPlugins = false;
|
|
69
71
|
|
|
70
72
|
for (const arg of argv) {
|
|
71
73
|
if (arg.startsWith('--repo-root=')) {
|
|
@@ -80,6 +82,8 @@ function parseArgs(argv: string[]): CliMatrixOptions {
|
|
|
80
82
|
skipInstall = true;
|
|
81
83
|
} else if (arg === '--no-local-test') {
|
|
82
84
|
noLocalTest = true;
|
|
85
|
+
} else if (arg === '--only-plugins') {
|
|
86
|
+
onlyPlugins = true;
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
|
|
@@ -97,6 +101,7 @@ function parseArgs(argv: string[]): CliMatrixOptions {
|
|
|
97
101
|
skipInstall,
|
|
98
102
|
noLocalTest,
|
|
99
103
|
cliScript,
|
|
104
|
+
onlyPlugins,
|
|
100
105
|
};
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -288,7 +293,11 @@ function main(): void {
|
|
|
288
293
|
logLine(opts.logPath, `Log: ${opts.logPath}`);
|
|
289
294
|
logLine(opts.logPath, `skipInstall=${opts.skipInstall} useLocalTest=${useLocalTest}`);
|
|
290
295
|
|
|
291
|
-
|
|
296
|
+
let cases = buildCases();
|
|
297
|
+
if (opts.onlyPlugins) {
|
|
298
|
+
cases = cases.filter((c) => c.id.startsWith('plugin-'));
|
|
299
|
+
logLine(opts.logPath, `filtered to plugin-only: ${cases.length} case(s)`);
|
|
300
|
+
}
|
|
292
301
|
const npmEnv = cleanNpmEnv();
|
|
293
302
|
let failed = 0;
|
|
294
303
|
let ok = 0;
|
|
@@ -214,7 +214,7 @@ function assertGeneratedProjectNoRawEnv(outDir: string, label: string): void {
|
|
|
214
214
|
checkNoEmailmaker(outDir, label);
|
|
215
215
|
walkFiles(outDir, (full) => {
|
|
216
216
|
const rel = normalizeRel(full, outDir);
|
|
217
|
-
if (/^scripts\/.*\.cjs$/i.test(rel.replace(/\\/g, '/'))) return;
|
|
217
|
+
if (/^scripts\/.*\.(cjs|ts)$/i.test(rel.replace(/\\/g, '/'))) return;
|
|
218
218
|
let text: string;
|
|
219
219
|
try {
|
|
220
220
|
text = fs.readFileSync(full, 'utf8');
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Vite version matrix for generated plugin templates only (vite bundler).
|
|
4
|
+
*
|
|
5
|
+
* 1) Generates each plugin-vite-* case via build/cli/bin/createPlugin.js (same flags as cli-matrix-smoke).
|
|
6
|
+
* 2) For each pinned Vite major, copies the project (without node_modules/dist/.vite), patches devDependencies.vite,
|
|
7
|
+
* runs npm install + npm run build.
|
|
8
|
+
* 3) Writes a report with bundle size (dist/index.js) and pass/fail.
|
|
9
|
+
*
|
|
10
|
+
* Usage (repo root):
|
|
11
|
+
* npx tsx build-tools/cli/scripts/vite-plugin-version-matrix.ts
|
|
12
|
+
* npx tsx build-tools/cli/scripts/vite-plugin-version-matrix.ts --repo-root=. --out-base=tmp/vite-plugin-matrix
|
|
13
|
+
*
|
|
14
|
+
* Env:
|
|
15
|
+
* VITE_MATRIX_VERSIONS — comma-separated exact versions (default: 3.2.11,5.4.21,8.0.1)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import * as fs from 'fs';
|
|
19
|
+
import * as path from 'path';
|
|
20
|
+
import { spawnSync } from 'child_process';
|
|
21
|
+
|
|
22
|
+
import { findNpmCliJs } from '../lib/resolveNpmSpawn';
|
|
23
|
+
|
|
24
|
+
function resolveNpmSpawn(_repoRoot: string, npmArgs: string[]): { command: string; args: string[] } {
|
|
25
|
+
if (process.platform === 'win32') {
|
|
26
|
+
const cliJs = findNpmCliJs('npm');
|
|
27
|
+
if (cliJs) {
|
|
28
|
+
return { command: process.execPath, args: [cliJs, ...npmArgs] };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { command: 'npm', args: npmArgs };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function cleanNpmEnv(): NodeJS.ProcessEnv {
|
|
35
|
+
const env: NodeJS.ProcessEnv = { ...process.env };
|
|
36
|
+
for (const key of Object.keys(env)) {
|
|
37
|
+
if (key.startsWith('REACT_APP_') || key.startsWith('VITE_')) {
|
|
38
|
+
delete env[key];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const key of [
|
|
42
|
+
'NODE_ENV',
|
|
43
|
+
'INIT_CWD',
|
|
44
|
+
'npm_command',
|
|
45
|
+
'npm_lifecycle_event',
|
|
46
|
+
'npm_lifecycle_script',
|
|
47
|
+
'npm_package_json',
|
|
48
|
+
'npm_package_name',
|
|
49
|
+
'npm_package_version',
|
|
50
|
+
'npm_config_local_prefix',
|
|
51
|
+
'npm_config_prefix',
|
|
52
|
+
'npm_config_production',
|
|
53
|
+
'npm_config_only',
|
|
54
|
+
'npm_config_omit',
|
|
55
|
+
'NPM_CONFIG_PRODUCTION',
|
|
56
|
+
'NPM_CONFIG_ONLY',
|
|
57
|
+
'NPM_CONFIG_OMIT',
|
|
58
|
+
]) {
|
|
59
|
+
delete env[key];
|
|
60
|
+
}
|
|
61
|
+
return env;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface MatrixCase {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly extraArgs: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const VITE_PLUGIN_CASES: MatrixCase[] = [
|
|
70
|
+
{
|
|
71
|
+
id: 'plugin-vite-minimal-npm',
|
|
72
|
+
extraArgs: ['--kind', 'plugin', '--preset', 'minimal', '--bundler', 'vite', '--target', 'npm-package'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'plugin-vite-minimal-browser',
|
|
76
|
+
extraArgs: ['--kind', 'plugin', '--preset', 'minimal', '--bundler', 'vite', '--target', 'browser'],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'plugin-vite-advanced-npm',
|
|
80
|
+
extraArgs: ['--kind', 'plugin', '--preset', 'advanced', '--bundler', 'vite', '--target', 'npm-package'],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'plugin-vite-advanced-browser',
|
|
84
|
+
extraArgs: ['--kind', 'plugin', '--preset', 'advanced', '--bundler', 'vite', '--target', 'browser'],
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
const DEFAULT_VITE_VERSIONS = ['3.2.11', '5.4.21', '8.0.1'];
|
|
89
|
+
|
|
90
|
+
function parseArgs(argv: string[]): { repoRoot: string; outBase: string } {
|
|
91
|
+
const cwd = process.cwd();
|
|
92
|
+
let repoRoot = cwd;
|
|
93
|
+
let outBaseExplicit: string | null = null;
|
|
94
|
+
for (const arg of argv) {
|
|
95
|
+
if (arg.startsWith('--repo-root=')) {
|
|
96
|
+
repoRoot = path.resolve(cwd, arg.slice('--repo-root='.length));
|
|
97
|
+
} else if (arg.startsWith('--out-base=')) {
|
|
98
|
+
outBaseExplicit = path.resolve(cwd, arg.slice('--out-base='.length));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const outBase = outBaseExplicit ?? path.join(repoRoot, 'tmp', 'vite-plugin-matrix');
|
|
102
|
+
return { repoRoot, outBase };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function resolveCliScript(repoRoot: string): string | null {
|
|
106
|
+
const buildCli = path.join(repoRoot, 'build', 'cli', 'bin', 'createPlugin.js');
|
|
107
|
+
return fs.existsSync(buildCli) ? buildCli : null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function shouldCopyPath(absPath: string, rootDir: string): boolean {
|
|
111
|
+
const rel = path.relative(rootDir, absPath);
|
|
112
|
+
if (rel === '') return true;
|
|
113
|
+
const norm = rel.replace(/\\/g, '/');
|
|
114
|
+
const parts = norm.split('/').filter(Boolean);
|
|
115
|
+
if (parts.includes('node_modules')) return false;
|
|
116
|
+
if (parts.includes('dist')) return false;
|
|
117
|
+
if (parts.includes('.vite')) return false;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function copyProjectWithoutArtifacts(src: string, dest: string, projectRoot: string): void {
|
|
122
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
123
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
124
|
+
for (const ent of entries) {
|
|
125
|
+
const s = path.join(src, ent.name);
|
|
126
|
+
const d = path.join(dest, ent.name);
|
|
127
|
+
if (!shouldCopyPath(s, projectRoot)) continue;
|
|
128
|
+
if (ent.isDirectory()) {
|
|
129
|
+
copyProjectWithoutArtifacts(s, d, projectRoot);
|
|
130
|
+
} else {
|
|
131
|
+
fs.copyFileSync(s, d);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function patchViteVersion(packageJsonPath: string, viteVersion: string): void {
|
|
137
|
+
const raw = fs.readFileSync(packageJsonPath, 'utf8');
|
|
138
|
+
const data = JSON.parse(raw) as { devDependencies?: Record<string, string> };
|
|
139
|
+
if (!data.devDependencies) data.devDependencies = {};
|
|
140
|
+
data.devDependencies.vite = viteVersion;
|
|
141
|
+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function distIndexSize(projectRoot: string): number | null {
|
|
145
|
+
const p = path.join(projectRoot, 'dist', 'index.js');
|
|
146
|
+
if (!fs.existsSync(p)) return null;
|
|
147
|
+
return fs.statSync(p).size;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function runStep(
|
|
151
|
+
cwd: string,
|
|
152
|
+
command: string,
|
|
153
|
+
args: string[],
|
|
154
|
+
env: NodeJS.ProcessEnv,
|
|
155
|
+
): { ok: boolean; stderr: string; stdout: string } {
|
|
156
|
+
const result = spawnSync(command, args, {
|
|
157
|
+
cwd,
|
|
158
|
+
env,
|
|
159
|
+
encoding: 'utf8',
|
|
160
|
+
maxBuffer: 20 * 1024 * 1024,
|
|
161
|
+
shell: false,
|
|
162
|
+
});
|
|
163
|
+
const code = result.status ?? 1;
|
|
164
|
+
return {
|
|
165
|
+
ok: code === 0,
|
|
166
|
+
stderr: result.stderr ?? '',
|
|
167
|
+
stdout: result.stdout ?? '',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface ReportRow {
|
|
172
|
+
caseId: string;
|
|
173
|
+
viteVersion: string;
|
|
174
|
+
ok: boolean;
|
|
175
|
+
bytes: number | null;
|
|
176
|
+
errorSnippet: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function main(): void {
|
|
180
|
+
const { repoRoot, outBase } = parseArgs(process.argv.slice(2));
|
|
181
|
+
const cli = resolveCliScript(repoRoot);
|
|
182
|
+
if (!cli) {
|
|
183
|
+
console.error('ERROR: build/cli/bin/createPlugin.js not found. Run repo build first.');
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const versionsEnv = process.env.VITE_MATRIX_VERSIONS?.trim();
|
|
188
|
+
const viteVersions = versionsEnv
|
|
189
|
+
? versionsEnv.split(',').map((s) => s.trim()).filter(Boolean)
|
|
190
|
+
: DEFAULT_VITE_VERSIONS;
|
|
191
|
+
|
|
192
|
+
const localBuildDir = path.join(repoRoot, 'build');
|
|
193
|
+
const useLocalTest = fs.existsSync(localBuildDir);
|
|
194
|
+
|
|
195
|
+
const genBase = path.join(outBase, 'gen');
|
|
196
|
+
const reportPath = path.join(outBase, 'report.md');
|
|
197
|
+
fs.mkdirSync(genBase, { recursive: true });
|
|
198
|
+
|
|
199
|
+
const npmEnv = cleanNpmEnv();
|
|
200
|
+
const baseCliArgs = ['--interactive', 'false', '--force'];
|
|
201
|
+
if (useLocalTest) {
|
|
202
|
+
baseCliArgs.push('--local-test', '--local-build-dir', localBuildDir);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const rows: ReportRow[] = [];
|
|
206
|
+
|
|
207
|
+
console.log(`repoRoot=${repoRoot}`);
|
|
208
|
+
console.log(`outBase=${outBase}`);
|
|
209
|
+
console.log(`viteVersions=${viteVersions.join(', ')}`);
|
|
210
|
+
console.log(`localTest=${useLocalTest}`);
|
|
211
|
+
|
|
212
|
+
for (const { id, extraArgs } of VITE_PLUGIN_CASES) {
|
|
213
|
+
const outDir = path.join(genBase, id);
|
|
214
|
+
fs.rmSync(outDir, { recursive: true, force: true });
|
|
215
|
+
|
|
216
|
+
const genArgs = [cli, ...baseCliArgs, id, '--output-dir', outDir, ...extraArgs];
|
|
217
|
+
const gen = runStep(repoRoot, process.execPath, genArgs, process.env);
|
|
218
|
+
if (!gen.ok) {
|
|
219
|
+
console.error(`FAIL generate ${id}\n${gen.stderr.slice(-4000)}`);
|
|
220
|
+
for (const v of viteVersions) {
|
|
221
|
+
rows.push({
|
|
222
|
+
caseId: id,
|
|
223
|
+
viteVersion: v,
|
|
224
|
+
ok: false,
|
|
225
|
+
bytes: null,
|
|
226
|
+
errorSnippet: 'generate failed',
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
for (const v of viteVersions) {
|
|
233
|
+
const runId = `${id}-vite-${v.replace(/\./g, '_')}`;
|
|
234
|
+
const runDir = path.join(outBase, 'runs', runId);
|
|
235
|
+
fs.rmSync(runDir, { recursive: true, force: true });
|
|
236
|
+
copyProjectWithoutArtifacts(outDir, runDir, outDir);
|
|
237
|
+
patchViteVersion(path.join(runDir, 'package.json'), v);
|
|
238
|
+
|
|
239
|
+
const npmInstall = resolveNpmSpawn(repoRoot, ['install']);
|
|
240
|
+
const inst = runStep(runDir, npmInstall.command, npmInstall.args, npmEnv);
|
|
241
|
+
if (!inst.ok) {
|
|
242
|
+
console.error(`FAIL npm install ${runId}`);
|
|
243
|
+
rows.push({
|
|
244
|
+
caseId: id,
|
|
245
|
+
viteVersion: v,
|
|
246
|
+
ok: false,
|
|
247
|
+
bytes: null,
|
|
248
|
+
errorSnippet: inst.stderr.slice(-1200),
|
|
249
|
+
});
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const npmBuild = resolveNpmSpawn(repoRoot, ['run', 'build']);
|
|
254
|
+
const bld = runStep(runDir, npmBuild.command, npmBuild.args, npmEnv);
|
|
255
|
+
const bytes = bld.ok ? distIndexSize(runDir) : null;
|
|
256
|
+
rows.push({
|
|
257
|
+
caseId: id,
|
|
258
|
+
viteVersion: v,
|
|
259
|
+
ok: bld.ok,
|
|
260
|
+
bytes,
|
|
261
|
+
errorSnippet: bld.ok ? '' : (bld.stderr + bld.stdout).slice(-2000),
|
|
262
|
+
});
|
|
263
|
+
console.log(`${runId}: ${bld.ok ? 'OK' : 'FAIL'} ${bytes != null ? `${bytes} B` : ''}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const failed = rows.filter((r) => !r.ok).length;
|
|
268
|
+
const lines: string[] = [
|
|
269
|
+
'# Vite plugin template matrix',
|
|
270
|
+
'',
|
|
271
|
+
`Generated: ${new Date().toISOString()}`,
|
|
272
|
+
'',
|
|
273
|
+
'| Case | Vite | Build | dist/index.js |',
|
|
274
|
+
'|------|------|-------|---------------|',
|
|
275
|
+
];
|
|
276
|
+
for (const r of rows) {
|
|
277
|
+
const size = r.bytes != null ? `${r.bytes}` : '—';
|
|
278
|
+
const st = r.ok ? 'ok' : 'FAIL';
|
|
279
|
+
lines.push(`| ${r.caseId} | ${r.viteVersion} | ${st} | ${size} |`);
|
|
280
|
+
}
|
|
281
|
+
lines.push('');
|
|
282
|
+
lines.push('## Failures (stderr/tail)');
|
|
283
|
+
lines.push('');
|
|
284
|
+
for (const r of rows) {
|
|
285
|
+
if (r.ok) continue;
|
|
286
|
+
lines.push(`### ${r.caseId} @ ${r.viteVersion}`);
|
|
287
|
+
lines.push('');
|
|
288
|
+
lines.push('```');
|
|
289
|
+
lines.push(r.errorSnippet || '(no output)');
|
|
290
|
+
lines.push('```');
|
|
291
|
+
lines.push('');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
fs.writeFileSync(reportPath, lines.join('\n'), 'utf8');
|
|
295
|
+
console.log(`Report: ${reportPath}`);
|
|
296
|
+
process.exit(failed > 0 ? 1 : 0);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
main();
|