@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.
- 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.aa9efbce.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/4aaa358b2.js +903 -0
- package/static/core/50ff48bc.js +4 -0
- package/static/core/5282795d2.js +6 -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/cec8d739.js +11 -0
- package/static/core/cf45bf332.js +598 -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.aa9efbce.html} +0 -0
- /package/iframe/{iframe.80d62b88.html → iframe.aa9efbce.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
|
@@ -31,6 +31,7 @@ function mockPackageConfig(): PackageConfig {
|
|
|
31
31
|
uiLanguage: 'en',
|
|
32
32
|
versions: {
|
|
33
33
|
typescript: '5.0.0',
|
|
34
|
+
tsx: '4.21.0',
|
|
34
35
|
vite: '5.0.0',
|
|
35
36
|
webpack: '5.0.0',
|
|
36
37
|
webpackCli: '5.0.0',
|
|
@@ -59,21 +60,21 @@ function oauthWebpackOptions(overrides: Partial<GenerateFilesInput> = {}): Gener
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
test('stand oauth webpack config/dev-host.
|
|
63
|
+
test('stand oauth webpack config/dev-host.ts uses literal api values', () => {
|
|
63
64
|
const options = oauthWebpackOptions();
|
|
64
65
|
const { files } = generateFiles(options);
|
|
65
|
-
const devHost = utf8(files['config/dev-host.
|
|
66
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
66
67
|
assert.match(devHost, /target: "http:\/\/localhost:3000"/);
|
|
67
68
|
assert.match(devHost, /setHeader\('origin', "http:\/\/localhost:3000"\)/);
|
|
68
69
|
assert.match(devHost, /new MyAppWebpackPlugin\(\)/);
|
|
69
70
|
});
|
|
70
71
|
|
|
71
|
-
test('stand-closed webpack config/dev-host.
|
|
72
|
+
test('stand-closed webpack config/dev-host.ts includes wp-json proxy', () => {
|
|
72
73
|
const options = oauthWebpackOptions({
|
|
73
74
|
standMode: 'closed-loop',
|
|
74
75
|
});
|
|
75
76
|
const { files } = generateFiles(options);
|
|
76
|
-
const devHost = utf8(files['config/dev-host.
|
|
77
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
77
78
|
assert.match(devHost, /context: \['\/wp-json'\]/);
|
|
78
79
|
});
|
|
79
80
|
|
|
@@ -83,7 +84,7 @@ test('advanced subpath webpack dev-host uses subpath static directory', () => {
|
|
|
83
84
|
advancedProfile: 'subpath',
|
|
84
85
|
});
|
|
85
86
|
const { files } = generateFiles(options);
|
|
86
|
-
const devHost = utf8(files['config/dev-host.
|
|
87
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
87
88
|
assert.match(devHost, /public', 'advanced', 'subpath'/);
|
|
88
89
|
assert.match(devHost, /publicPath: "\/advanced\/subpath\/"/);
|
|
89
90
|
});
|
|
@@ -94,7 +95,7 @@ test('advanced umd webpack dev-host serves bundle without webpack plugin', () =>
|
|
|
94
95
|
advancedProfile: 'umd',
|
|
95
96
|
});
|
|
96
97
|
const { files } = generateFiles(options);
|
|
97
|
-
const devHost = utf8(files['config/dev-host.
|
|
98
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
98
99
|
assert.match(devHost, /const umdPackageRoot = path\.dirname\(require\.resolve\("@acme\/editor\/package\.json"\)\);/);
|
|
99
100
|
assert.match(devHost, /plugins: \[\],/);
|
|
100
101
|
assert.match(devHost, /publicPath: "\/MyApp\/"/);
|
|
@@ -160,7 +160,7 @@ const MESSAGES = {
|
|
|
160
160
|
'readmeStand.storageProviderFile':
|
|
161
161
|
'- `src/dev/storageProvider.ts` - StorageProvider (`pathMode`, `./storage`)',
|
|
162
162
|
'readmeStand.storageMiddleware':
|
|
163
|
-
'- `scripts/devStorageMiddleware.
|
|
163
|
+
'- `scripts/devStorageMiddleware.ts` - middleware for `/dev-storage`',
|
|
164
164
|
'readmeStand.storageFolder': '- `storage/` - folder for uploaded files',
|
|
165
165
|
'readmeStand.configDir':
|
|
166
166
|
'- `config/` - bundler config used by `npm run start` and `npm run build`',
|
|
@@ -323,7 +323,7 @@ const MESSAGES = {
|
|
|
323
323
|
'readmeStand.storageProviderFile':
|
|
324
324
|
'- `src/dev/storageProvider.ts` - StorageProvider (`pathMode`, `./storage`)',
|
|
325
325
|
'readmeStand.storageMiddleware':
|
|
326
|
-
'- `scripts/devStorageMiddleware.
|
|
326
|
+
'- `scripts/devStorageMiddleware.ts` - middleware для `/dev-storage`',
|
|
327
327
|
'readmeStand.storageFolder': '- `storage/` - папка для загруженных файлов',
|
|
328
328
|
'readmeStand.configDir':
|
|
329
329
|
'- `config/` - bundler-конфиг для `npm run start` и `npm run build`',
|
|
@@ -7,15 +7,14 @@ function getGeneratedPaths(options: StandEtaRoutingInput) {
|
|
|
7
7
|
const isSubpathAdvancedStand = isStand
|
|
8
8
|
&& getDemoStandMode(options) === 'advanced'
|
|
9
9
|
&& getAdvancedStandProfile(options) === 'subpath';
|
|
10
|
-
const ext = bundler === 'vite' ? 'mjs' : 'cjs';
|
|
11
10
|
|
|
12
11
|
return {
|
|
13
12
|
indexHtml: bundler === 'vite'
|
|
14
13
|
? (isSubpathAdvancedStand ? 'advanced/subpath/index.html' : 'index.html')
|
|
15
14
|
: (isSubpathAdvancedStand ? 'public/advanced/subpath/index.html' : 'public/index.html'),
|
|
16
|
-
devConfig:
|
|
17
|
-
pluginBuildConfig: isStand ? undefined :
|
|
18
|
-
sandboxBuildConfig: isStand ? undefined :
|
|
15
|
+
devConfig: 'config/dev-host.ts',
|
|
16
|
+
pluginBuildConfig: isStand ? undefined : 'config/plugin-build.ts',
|
|
17
|
+
sandboxBuildConfig: isStand ? undefined : 'config/sandbox-build.ts',
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
20
|
|
package/cli/package.json
CHANGED
package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { defineConfig } from 'vite';
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { defineConfig, type UserConfigExport } from 'vite';
|
|
4
4
|
import PluginDev from '__PKG__/vite/pluginDev';
|
|
5
5
|
|
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const projectRoot = path.resolve(__dirname, '..');
|
|
8
8
|
const pluginDevExternals = false;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const config = defineConfig({
|
|
11
11
|
root: projectRoot,
|
|
12
12
|
plugins: [
|
|
13
13
|
PluginDev({ externals: pluginDevExternals }),
|
|
@@ -24,4 +24,6 @@ export default defineConfig({
|
|
|
24
24
|
fileName: () => 'index.js',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
});
|
|
27
|
+
}) satisfies UserConfigExport;
|
|
28
|
+
|
|
29
|
+
export default config;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { defineConfig } from 'vite';
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { defineConfig, type UserConfigExport } from 'vite';
|
|
4
4
|
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
const projectRoot = path.resolve(__dirname, '..');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const config = defineConfig(({ mode }) => ({
|
|
9
9
|
root: projectRoot,
|
|
10
10
|
build: {
|
|
11
11
|
sourcemap: true,
|
|
@@ -19,4 +19,6 @@ export default defineConfig(({ mode }) => ({
|
|
|
19
19
|
fileName: () => 'sandbox.js',
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
}));
|
|
22
|
+
})) satisfies UserConfigExport;
|
|
23
|
+
|
|
24
|
+
export default config;
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import type { Configuration } from 'webpack';
|
|
3
5
|
|
|
6
|
+
type LegacyExternals = Record<string, string>;
|
|
7
|
+
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
9
|
const projectRoot = path.resolve(__dirname, '..');
|
|
5
10
|
|
|
6
|
-
function readJsonSync(relativePath) {
|
|
11
|
+
function readJsonSync(relativePath: string): LegacyExternals {
|
|
7
12
|
const absPath = path.resolve(projectRoot, relativePath);
|
|
8
|
-
|
|
13
|
+
if (!fs.existsSync(absPath)) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const parsed = JSON.parse(fs.readFileSync(absPath, 'utf8')) as Record<string, string | number | boolean | null>;
|
|
18
|
+
const entries = Object.entries(parsed).filter((entry): entry is [string, string] => typeof entry[1] === 'string');
|
|
19
|
+
return Object.fromEntries(entries);
|
|
9
20
|
}
|
|
10
21
|
|
|
11
|
-
function getExternals() {
|
|
22
|
+
function getExternals(): LegacyExternals {
|
|
12
23
|
return {
|
|
13
24
|
...readJsonSync('node_modules/__EXT_API__/externals.json'),
|
|
14
25
|
...readJsonSync('node_modules/__EXT_REACT__/externals.json'),
|
|
15
26
|
};
|
|
16
27
|
}
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
const config = {
|
|
19
30
|
entry: path.resolve(projectRoot, 'src/index.ts'),
|
|
20
31
|
devtool: 'source-map',
|
|
21
32
|
mode: 'production',
|
|
@@ -50,4 +61,6 @@ module.exports = {
|
|
|
50
61
|
type: 'module',
|
|
51
62
|
},
|
|
52
63
|
},
|
|
53
|
-
};
|
|
64
|
+
} satisfies Configuration;
|
|
65
|
+
|
|
66
|
+
export default config;
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import type { Configuration } from 'webpack';
|
|
3
5
|
|
|
6
|
+
type LegacyExternals = Record<string, string>;
|
|
7
|
+
|
|
8
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
9
|
const projectRoot = path.resolve(__dirname, '..');
|
|
5
10
|
|
|
6
|
-
function readJsonSync(relativePath) {
|
|
11
|
+
function readJsonSync(relativePath: string): LegacyExternals {
|
|
7
12
|
const absPath = path.resolve(projectRoot, relativePath);
|
|
8
|
-
|
|
13
|
+
if (!fs.existsSync(absPath)) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const parsed = JSON.parse(fs.readFileSync(absPath, 'utf8')) as Record<string, string | number | boolean | null>;
|
|
18
|
+
const entries = Object.entries(parsed).filter((entry): entry is [string, string] => typeof entry[1] === 'string');
|
|
19
|
+
return Object.fromEntries(entries);
|
|
9
20
|
}
|
|
10
21
|
|
|
11
|
-
function getExternals() {
|
|
22
|
+
function getExternals(): LegacyExternals {
|
|
12
23
|
return {
|
|
13
24
|
...readJsonSync('node_modules/__EXT_API__/externals.json'),
|
|
14
25
|
...readJsonSync('node_modules/__EXT_REACT__/externals.json'),
|
|
15
26
|
};
|
|
16
27
|
}
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
const config = {
|
|
19
30
|
entry: path.resolve(projectRoot, 'src/index.ts'),
|
|
20
31
|
devtool: 'source-map',
|
|
21
32
|
mode: 'production',
|
|
@@ -53,4 +64,6 @@ module.exports = {
|
|
|
53
64
|
globalObject: 'this',
|
|
54
65
|
umdNamedDefine: true,
|
|
55
66
|
},
|
|
56
|
-
};
|
|
67
|
+
} satisfies Configuration;
|
|
68
|
+
|
|
69
|
+
export default config;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import type { Configuration } from 'webpack';
|
|
4
|
+
import PluginDev from '__PKG__/webpack/pluginDev';
|
|
3
5
|
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
7
|
const projectRoot = path.resolve(__dirname, '..');
|
|
5
8
|
const pluginDevExternals = false;
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
const config = {
|
|
8
11
|
entry: path.resolve(projectRoot, 'src/index.ts'),
|
|
9
12
|
devtool: 'source-map',
|
|
10
13
|
mode: 'production',
|
|
@@ -41,4 +44,6 @@ module.exports = {
|
|
|
41
44
|
type: 'module',
|
|
42
45
|
},
|
|
43
46
|
},
|
|
44
|
-
};
|
|
47
|
+
} satisfies Configuration;
|
|
48
|
+
|
|
49
|
+
export default config;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import type { Configuration } from 'webpack';
|
|
4
|
+
import PluginDev from '__PKG__/webpack/pluginDev';
|
|
3
5
|
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
7
|
const projectRoot = path.resolve(__dirname, '..');
|
|
5
8
|
const pluginDevExternals = false;
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
const config = {
|
|
8
11
|
entry: path.resolve(projectRoot, 'src/index.ts'),
|
|
9
12
|
devtool: 'source-map',
|
|
10
13
|
mode: 'production',
|
|
@@ -44,4 +47,6 @@ module.exports = {
|
|
|
44
47
|
globalObject: 'this',
|
|
45
48
|
umdNamedDefine: true,
|
|
46
49
|
},
|
|
47
|
-
};
|
|
50
|
+
} satisfies Configuration;
|
|
51
|
+
|
|
52
|
+
export default config;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import type { Configuration } from 'webpack';
|
|
4
|
+
|
|
5
|
+
interface WebpackArgv {
|
|
6
|
+
mode?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
2
10
|
const projectRoot = path.resolve(__dirname, '..');
|
|
3
11
|
|
|
4
|
-
|
|
12
|
+
const config = (_env: Record<string, never>, argv: WebpackArgv = {}) => {
|
|
5
13
|
const isDev = argv.mode !== 'production';
|
|
6
14
|
|
|
7
15
|
return {
|
|
@@ -34,5 +42,7 @@ module.exports = (_env, argv = {}) => {
|
|
|
34
42
|
clean: false,
|
|
35
43
|
iife: true,
|
|
36
44
|
},
|
|
37
|
-
};
|
|
45
|
+
} satisfies Configuration;
|
|
38
46
|
};
|
|
47
|
+
|
|
48
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('plugin-vite-release-html', it) %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('plugin-webpack-release-html', it) %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="272" height="272" viewBox="0 0 272 272" role="img" aria-label="Demo product 1">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="a" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#e8eef5"/>
|
|
5
|
+
<stop offset="100%" stop-color="#c5d4e8"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="272" height="272" fill="url(#a)"/>
|
|
9
|
+
<text x="136" y="142" text-anchor="middle" font-family="Arial,Helvetica,sans-serif" font-size="15" fill="#445566">Demo � 1</text>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="272" height="272" viewBox="0 0 272 272" role="img" aria-label="Demo product 2">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="b" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#f0ebe3"/>
|
|
5
|
+
<stop offset="100%" stop-color="#d8cbb8"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="272" height="272" fill="url(#b)"/>
|
|
9
|
+
<text x="136" y="142" text-anchor="middle" font-family="Arial,Helvetica,sans-serif" font-size="15" fill="#554433">Demo � 2</text>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { copyPublicTypes } from './build-types.ts';
|
|
2
|
+
import { cleanBuildArtifacts } from './clean.ts';
|
|
3
|
+
import { runScriptSync } from './npmRun.ts';
|
|
4
|
+
import { isExecutedAsScript } from './scriptRuntime.ts';
|
|
5
|
+
|
|
6
|
+
export function buildProject(): void {
|
|
7
|
+
console.log('[build] clean');
|
|
8
|
+
cleanBuildArtifacts();
|
|
9
|
+
|
|
10
|
+
console.log('[build] public types');
|
|
11
|
+
copyPublicTypes();
|
|
12
|
+
|
|
13
|
+
console.log('[build] app bundle');
|
|
14
|
+
runScriptSync('build:app');
|
|
15
|
+
|
|
16
|
+
console.log('[build] sandbox bundle');
|
|
17
|
+
runScriptSync('build:sandbox');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isExecutedAsScript(import.meta.url)) {
|
|
21
|
+
buildProject();
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { isExecutedAsScript } from './scriptRuntime.ts';
|
|
5
|
+
|
|
6
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const sourcePath = path.resolve(scriptDir, '..', 'src', 'public-types.d.ts');
|
|
8
|
+
const targetPath = path.resolve(scriptDir, '..', 'dist', 'public-types.d.ts');
|
|
9
|
+
|
|
10
|
+
export function copyPublicTypes(): void {
|
|
11
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
12
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (isExecutedAsScript(import.meta.url)) {
|
|
16
|
+
copyPublicTypes();
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { isExecutedAsScript } from './scriptRuntime.ts';
|
|
5
|
+
|
|
6
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
export function cleanBuildArtifacts(): void {
|
|
9
|
+
for (const target of ['dist', path.join('public', 'sandbox.js')]) {
|
|
10
|
+
fs.rmSync(path.resolve(scriptDir, '..', target), { force: true, recursive: true });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (isExecutedAsScript(import.meta.url)) {
|
|
15
|
+
cleanBuildArtifacts();
|
|
16
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { ChildProcess } from 'node:child_process';
|
|
4
|
+
import { runScript } from './npmRun.ts';
|
|
5
|
+
|
|
6
|
+
function waitForFile(filePath: string, timeoutMs = 30_000, pollMs = 250): Promise<void> {
|
|
7
|
+
const startedAt = Date.now();
|
|
8
|
+
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const check = (): void => {
|
|
11
|
+
if (fs.existsSync(filePath)) {
|
|
12
|
+
resolve();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (Date.now() - startedAt >= timeoutMs) {
|
|
17
|
+
reject(new Error(`Timed out waiting for file: ${filePath}`));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setTimeout(check, pollMs);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
check();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function main(): Promise<void> {
|
|
29
|
+
const sandbox = runScript('dev:sandbox');
|
|
30
|
+
const sandboxFilePath = path.resolve(process.cwd(), 'public', 'sandbox.js');
|
|
31
|
+
let app: ChildProcess | undefined;
|
|
32
|
+
|
|
33
|
+
const shutdown = (): void => {
|
|
34
|
+
sandbox.kill('SIGINT');
|
|
35
|
+
app?.kill('SIGINT');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
process.on('SIGINT', shutdown);
|
|
39
|
+
process.on('SIGTERM', shutdown);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
await waitForFile(sandboxFilePath);
|
|
43
|
+
app = runScript('dev:host');
|
|
44
|
+
} catch (error) {
|
|
45
|
+
shutdown();
|
|
46
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
console.error(message);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
void main();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { spawn, spawnSync, type ChildProcess, type SpawnOptionsWithoutStdio } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
interface CommandSpec {
|
|
4
|
+
executable: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface RunScriptOptions {
|
|
9
|
+
env?: NodeJS.ProcessEnv;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function resolveNpmRunCommand(scriptName: string): CommandSpec {
|
|
13
|
+
const npmRunArgs = ['run', scriptName];
|
|
14
|
+
|
|
15
|
+
if (process.platform === 'win32') {
|
|
16
|
+
const npmExecPath = process.env.npm_execpath;
|
|
17
|
+
if (typeof npmExecPath === 'string' && npmExecPath.length > 0) {
|
|
18
|
+
return {
|
|
19
|
+
executable: process.execPath,
|
|
20
|
+
args: [npmExecPath, ...npmRunArgs],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
executable: process.env.ComSpec || 'cmd.exe',
|
|
26
|
+
args: ['/d', '/s', '/c', 'npm', ...npmRunArgs],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
executable: 'npm',
|
|
32
|
+
args: npmRunArgs,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function createSpawnOptions(env: NodeJS.ProcessEnv = {}): SpawnOptionsWithoutStdio {
|
|
37
|
+
return {
|
|
38
|
+
cwd: process.cwd(),
|
|
39
|
+
stdio: 'inherit',
|
|
40
|
+
shell: false,
|
|
41
|
+
env: { ...process.env, ...env },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function runScript(scriptName: string, options: RunScriptOptions = {}): ChildProcess {
|
|
46
|
+
const { executable, args } = resolveNpmRunCommand(scriptName);
|
|
47
|
+
return spawn(executable, args, createSpawnOptions(options.env));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function runScriptSync(scriptName: string, options: RunScriptOptions = {}): void {
|
|
51
|
+
const { executable, args } = resolveNpmRunCommand(scriptName);
|
|
52
|
+
const result = spawnSync(executable, args, createSpawnOptions(options.env));
|
|
53
|
+
|
|
54
|
+
if (result.error) {
|
|
55
|
+
throw result.error;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof result.status === 'number' && result.status !== 0) {
|
|
59
|
+
process.exit(result.status);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { buildProject } from './build-runner.ts';
|
|
2
|
+
import { runScript } from './npmRun.ts';
|
|
3
|
+
|
|
4
|
+
function main(): void {
|
|
5
|
+
buildProject();
|
|
6
|
+
console.log('[release] dev host — open /release.html');
|
|
7
|
+
|
|
8
|
+
const app = runScript('dev:host', { env: { EM_DEV_RELEASE: '1' } });
|
|
9
|
+
|
|
10
|
+
const shutdown = (): void => {
|
|
11
|
+
app.kill('SIGINT');
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
process.on('SIGINT', shutdown);
|
|
15
|
+
process.on('SIGTERM', shutdown);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<% if (it.isMinimal) { %><%~ include('plugin-dev-host-app-minimal', it) %><% } else { %><%~ include('plugin-dev-host-app-advanced', it) %><% } %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%~ include('plugin-dev-tsx-release', it) %>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
<%~ include('plugin-dev-tsx-debug', it) %>
|