useblocks-cli 1.1.49 → 1.1.56

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 (2) hide show
  1. package/dist/index.js +27 -38
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -418,9 +418,9 @@ var DEFAULT_EXTENSIONS_API_PACKAGE = "useblocks-extensions-api";
418
418
  var DEFAULT_EXTENSIONS_REACT_PACKAGE = "useblocks-extensions-react";
419
419
  var DEFAULT_EXTENSIONS_SANDBOX_PACKAGE = "useblocks-extensions-sandbox";
420
420
  var DEFAULT_CLI_PACKAGE = "useblocks-cli";
421
- var DEFAULT_VERSION = "1.1.49";
422
- var DEFAULT_UI_KIT_VERSION = "1.1.49";
423
- var DEFAULT_CLI_VERSION = "1.1.49";
421
+ var DEFAULT_VERSION = "1.1.56";
422
+ var DEFAULT_UI_KIT_VERSION = "1.1.56";
423
+ var DEFAULT_CLI_VERSION = "1.1.56";
424
424
  var DEFAULT_OPENAPI_BASE_URL = "https://app.useblocks.io/api";
425
425
  var DEFAULT_CDN_URL = "https://cdn.useblocks.io";
426
426
  var DEFAULT_BACKEND_DOMAIN = "api.useblocks.io";
@@ -1462,7 +1462,7 @@ var ROOT_PKG = {
1462
1462
  packageManager: "pnpm@11.4.0",
1463
1463
  dependencies: {
1464
1464
  "@easylogic/colorpicker": "1.10.7",
1465
- "@emailmaker/filemanager": "^0.10.96",
1465
+ "@emailmaker/filemanager": "^0.10.102",
1466
1466
  "@emailmaker/ui-kit": "workspace:*",
1467
1467
  "@emailmaker/extensions-api": "workspace:*",
1468
1468
  "@emailmaker/extensions-react": "workspace:*",
@@ -1551,7 +1551,7 @@ var ROOT_PKG = {
1551
1551
  "react-infinite-scroll-component": "^7.2.1",
1552
1552
  "rc-input-number": "^9.5.0",
1553
1553
  "react-masonry-css": "^1.0.16",
1554
- "react-redux": "^9.3.0",
1554
+ "react-redux": "^7.2.3",
1555
1555
  "react-refresh": "^0.18.0",
1556
1556
  "react-router-dom": "^7.18.1",
1557
1557
  "react-split": "^2.0.13",
@@ -1984,18 +1984,6 @@ e({
1984
1984
  hasDefault: false,
1985
1985
  isCjs: true,
1986
1986
  isLocalWorkspace: false
1987
- }), e({
1988
- name: "prop-types",
1989
- exportName: "PropTypes",
1990
- hasDefault: true,
1991
- isCjs: true,
1992
- isLocalWorkspace: false
1993
- }), e({
1994
- name: "react-router-dom",
1995
- exportName: "ReactRouterDom",
1996
- hasDefault: false,
1997
- isCjs: false,
1998
- isLocalWorkspace: false
1999
1987
  }), e({
2000
1988
  name: "antd",
2001
1989
  exportName: "Antd",
@@ -2649,7 +2637,7 @@ var MESSAGES = {
2649
2637
  "readmeStand.angularCommandsProdUrl": "> Production-like URL: `http://localhost:{port}/` (`npm run build` then `npm run serve:dist`)",
2650
2638
  "readmeStand.angularCommandsProdUrlEsbuild": "> Client-like prod URL: `http://localhost:4200/` (`npm run build` then `npm run serve:chunk-repro`)",
2651
2639
  "readmeStand.angularEntryPoint": "- `src/main.ts` — bootstrap; `src/app/editor-host.ts` — editor init",
2652
- "readmeStand.angularConfigFile": "- `custom-webpack.config.cjs` — host plugin, `/api` proxy, CORP headers, esbuild-loader (TS) + EsbuildPlugin minify in production",
2640
+ "readmeStand.angularConfigFile": "- `webpack.config.js` — host plugin, `/api` proxy, CORP headers, esbuild-loader (TS) + EsbuildPlugin minify in production",
2653
2641
  "readmeStand.angularEsbuildConfigFile": "- `angular.json` — `@angular-builders/custom-esbuild:application`, assets under `panel/<app>/`, `esbuild/publicPath-shim.ts` sets `publicPath`",
2654
2642
  "readmeStand.angularEsbuildClientProd": "> Client-like prod: `npm run build` then `npm run serve:chunk-repro` (HTML :4200, JS chunks :4201). Same-origin baseline: `npm run serve:dist`. Readable build: `npm run build:debug`.",
2655
2643
  "readmeStand.modeResourceProxy": "resource proxy demo",
@@ -2906,10 +2894,11 @@ function buildStandVitePackageJsonData(options) {
2906
2894
  }
2907
2895
  //#endregion
2908
2896
  //#region lib/template-engine/context/standAngularPackageJsonData.ts
2909
- var ANGULAR_VERSION$1 = "^22.1.0";
2910
- var ANGULAR_BUILDERS_VERSION = "^22.0.1";
2911
- /** @angular/compiler-cli@22.x peer: >=6.0 <6.1 */
2912
- var ANGULAR_TYPESCRIPT_VERSION$1 = "~6.0.3";
2897
+ /** Client repro: Angular 19 + matching @angular-builders/custom-webpack major. */
2898
+ var ANGULAR_VERSION$1 = "^19.2.0";
2899
+ var ANGULAR_BUILDERS_VERSION = "^19.0.1";
2900
+ /** @angular/compiler-cli@19.x peer: >=5.5 <5.9 */
2901
+ var ANGULAR_TYPESCRIPT_VERSION$1 = "~5.7.2";
2913
2902
  /**
2914
2903
  * package.json для stand angular (Angular + @angular-builders/custom-webpack).
2915
2904
  */
@@ -2931,7 +2920,7 @@ function buildStandAngularPackageJsonData(options) {
2931
2920
  esbuild: packageConfig.versions.esbuild,
2932
2921
  "esbuild-loader": packageConfig.versions.esbuildLoader,
2933
2922
  rxjs: "^7.8.0",
2934
- "zone.js": "~0.16.0",
2923
+ "zone.js": "~0.15.0",
2935
2924
  formidable: "^3.5.2",
2936
2925
  "@types/node": "^22.10.0",
2937
2926
  "cross-env": "^7.0.3"
@@ -2940,7 +2929,6 @@ function buildStandAngularPackageJsonData(options) {
2940
2929
  name: pluginPackageName,
2941
2930
  version: "0.1.0",
2942
2931
  private: true,
2943
- type: "module",
2944
2932
  description: `${capitalize(packageConfig?.appName || "app")} Angular demo stand generated by cli`,
2945
2933
  scripts: buildAngularScripts(options),
2946
2934
  devDependencies
@@ -3610,6 +3598,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3610
3598
  "../../project-templates/shared/partials/plugin-wp-modern-module.eta": "import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Configuration } from 'webpack';\nimport PluginDev from '<%= it.packageConfig.packageName %>/webpack/pluginDev';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst projectRoot = path.resolve(__dirname, '..');\nconst pluginDevExternals = <%~ it.importsModeLiteral %>;\n\nconst config = {\n entry: path.resolve(projectRoot, 'src/index.ts'),\n devtool: 'source-map',\n mode: 'production',\n module: {\n rules: [\n {\n test: /\\.tsx?$/,\n use: { loader: 'ts-loader', options: { transpileOnly: true } },\n exclude: /node_modules/,\n },\n {\n test: /\\.(html|css)$/,\n resourceQuery: /raw/,\n type: 'asset/source',\n },\n ],\n },\n resolve: {\n extensions: ['.ts', '.tsx', '.js'],\n },\n plugins: [\n new PluginDev({ externals: pluginDevExternals }),\n ],\n optimization: {\n minimize: true,\n },\n experiments: { outputModule: true },\n output: {\n filename: 'index.js',\n path: path.resolve(projectRoot, 'dist'),\n clean: false,\n module: true,\n library: {\n type: 'module',\n },\n },\n} satisfies Configuration;\n\nexport default config;\n",
3611
3599
  "../../project-templates/shared/partials/plugin-wp-modern-umd.eta": "import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Configuration } from 'webpack';\nimport PluginDev from '<%= it.packageConfig.packageName %>/webpack/pluginDev';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst projectRoot = path.resolve(__dirname, '..');\nconst pluginDevExternals = <%~ it.importsModeLiteral %>;\n\nconst config = {\n entry: path.resolve(projectRoot, 'src/index.ts'),\n devtool: 'source-map',\n mode: 'production',\n module: {\n rules: [\n {\n test: /\\.tsx?$/,\n use: { loader: 'ts-loader', options: { transpileOnly: true } },\n exclude: /node_modules/,\n },\n {\n test: /\\.(html|css)$/,\n resourceQuery: /raw/,\n type: 'asset/source',\n },\n ],\n },\n resolve: {\n extensions: ['.ts', '.tsx', '.js'],\n },\n plugins: [\n new PluginDev({ externals: pluginDevExternals }),\n ],\n optimization: {\n minimize: true,\n },\n experiments: {},\n output: {\n filename: 'index.js',\n path: path.resolve(projectRoot, 'dist'),\n clean: false,\n library: {\n name: '<%= it.pluginClassName %>',\n type: 'umd',\n export: 'default',\n },\n globalObject: 'this',\n umdNamedDefine: true,\n },\n} satisfies Configuration;\n\nexport default config;\n",
3612
3600
  "../../project-templates/shared/partials/stand-angular-production-optimization.eta": "\"optimization\": {\n \"scripts\": true,\n \"styles\": {\n \"minify\": true,\n \"inlineCritical\": false\n },\n \"fonts\": true\n},\n",
3601
+ "../../project-templates/shared/partials/stand-demo-email-id.eta": "function createDemoEmailId() {\n if (typeof globalThis.crypto?.randomUUID === 'function') {\n return globalThis.crypto.randomUUID();\n }\n\n return `demo-email-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n",
3613
3602
  "../../project-templates/shared/partials/stand-dev-email-resource-proxy.eta": "<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <title><%= it.devEmailTitle %></title>\n</head>\n<body style=\"margin:0;padding:0;background:#f8f8f8;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" style=\"background:#f8f8f8;\">\n <tr>\n <td align=\"center\" style=\"padding:40px 20px;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"660\" style=\"max-width:660px;width:100%;background:#ffffff;\">\n <tr>\n <td style=\"padding:30px 40px 20px;\">\n <img src=\"<%= it.standCdnUrl %>/YOUR_CDN_SAMPLE_PROJECT_ID/240122_4213_7sMGu9U.png\" width=\"100\" alt=\"\" style=\"display:block;width:100%;max-width:100px;border:0;\">\n </td>\n </tr>\n <tr>\n <td style=\"padding:30px 40px 40px;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n <tr>\n <td width=\"291\" valign=\"bottom\">\n <img src=\"<%= it.standCdnUrl %>/YOUR_CDN_SAMPLE_PROJECT_ID/240112_4213_jmuAvfh.png\" width=\"291\" alt=\"\" style=\"display:block;width:100%;max-width:291px;border-radius:6px;border:0;\">\n </td>\n <td width=\"10\"></td>\n <td width=\"135\" valign=\"bottom\">\n <img src=\"<%= it.standCdnUrl %>/YOUR_CDN_SAMPLE_PROJECT_ID/240112_4213_34n4skn.png\" width=\"135\" alt=\"\" style=\"display:block;width:100%;max-width:135px;border-radius:6px;border:0;\">\n </td>\n <td width=\"10\"></td>\n <td width=\"134\" valign=\"bottom\">\n <img src=\"<%= it.standCdnUrl %>/YOUR_CDN_SAMPLE_PROJECT_ID/240112_4213_1BW0VnL.png\" width=\"134\" alt=\"\" style=\"display:block;width:100%;max-width:134px;border-radius:6px;border:0;\">\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td style=\"padding:0 40px 30px;\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n <tr>\n <td width=\"50%\" valign=\"top\" style=\"padding-right:10px;font-family:Arial,sans-serif;font-size:12px;line-height:16px;color:#4a5565;\">\n directHosts (placehold.co)\n </td>\n <td width=\"50%\" valign=\"top\" style=\"padding-left:10px;font-family:Arial,sans-serif;font-size:12px;line-height:16px;color:#4a5565;\">\n via proxy (dummyimage.com)\n </td>\n </tr>\n <tr>\n <td width=\"50%\" valign=\"top\" style=\"padding:8px 10px 0 0;\">\n <img src=\"<%= it.resourceProxyDemoDirectUrl %>\" width=\"200\" alt=\"directHosts demo (placehold.co)\" style=\"display:block;width:100%;max-width:200px;border:0;\">\n </td>\n <td width=\"50%\" valign=\"top\" style=\"padding:8px 0 0 10px;\">\n <img src=\"<%= it.resourceProxyDemoProxyUrl %>\" width=\"200\" alt=\"proxy demo (dummyimage.com)\" style=\"display:block;width:100%;max-width:200px;border:0;\">\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n</body>\n</html>\n",
3614
3603
  "../../project-templates/shared/partials/stand-dev-email.eta": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta name=\"x-apple-disable-message-reformatting\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <title><%= it.devEmailTitle %></title>\n <style type=\"text/css\">\n html {\n -webkit-text-size-adjust: none;\n -ms-text-size-adjust: none;\n }\n </style>\n <style em=\"styles\">\n@media only screen and (max-device-width:660px),only screen and (max-width:660px) {\n .em-narrow-table {\n width: 100%!important;\n max-width: 660px!important;\n min-width: 320px!important;\n }\n}\n</style>\n <!--[if gte mso 9]>\n <xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG></o:AllowPNG>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml>\n <![endif]-->\n</head>\n<body style=\"margin: 0; padding: 0; background-color: #F8F8F8;\">\n <span class=\"preheader\" style=\"display: none !important; visibility: hidden; opacity: 0; color: #F8F8F8; height: 0; width: 0; font-size: 1px;\">&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;‌&nbsp;</span>\n <!--[if !mso]><!-->\n <div style=\"font-size:0px;color:transparent;opacity:0;\">\n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n </div>\n <!--<![endif]-->\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" style=\"font-size: 1px; line-height: normal;\"\n bgcolor=\"#F8F8F8\">\n <tr em=\"group\">\n <td align=\"center\">\n <!--[if (gte mso 9)|(IE)]>\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"660\"><tr><td>\n <![endif]-->\n <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\" style=\"max-width: 660px; min-width: 660px; width: 660px;\" class=\"em-narrow-table\"></table>\n <!--[if (gte mso 9)|(IE)]>\n </td></tr></table>\n <![endif]-->\n </td>\n </tr>\n </table>\n</body>\n</html>\n",
3615
3604
  "../../project-templates/shared/partials/stand-dev-host-vite-memory.eta": "import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport VitePlugin from '<%~ it.standVitePluginPackage %>/vite';\nimport { createMemoryUsageStandConfig } from './lib/createMemoryUsageStandConfig.ts';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst projectRoot = path.resolve(__dirname, '..');\n\nexport default createMemoryUsageStandConfig({\n projectRoot,\n vitePlugin: VitePlugin,\n closedLoop: <%= it.standClosedLoop %>,\n apiBaseUrl: <%~ JSON.stringify(it.standOpenApiBaseUrl) %>,\n apiOrigin: <%~ JSON.stringify(it.standOpenApiOrigin) %>,\n});\n",
@@ -3625,15 +3614,15 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3625
3614
  "../../project-templates/shared/partials/stand-editor-config.eta": "import type { Config } from '<%~ it.packageName %>';\n\nconst mergeTagItems = [\n {\n label: 'Profile',\n value: 'profile',\n children: [\n { label: 'First name', value: 'profile.firstName' },\n { label: 'Last name', value: 'profile.lastName' },\n { label: 'Email', value: 'profile.email' },\n ],\n },\n {\n label: 'Company',\n value: 'company',\n children: [\n { label: 'Name', value: 'company.name' },\n { label: 'Industry', value: 'company.industry' },\n { label: 'Website', value: 'company.website' },\n ],\n },\n {\n label: 'Campaign',\n value: 'campaign',\n children: [\n { label: 'Title', value: 'campaign.title' },\n { label: 'Promo code', value: 'campaign.promoCode' },\n { label: 'CTA URL', value: 'campaign.ctaUrl' },\n ],\n },\n];\n\nconst baseEditorConfig = {\n theme: 'light',\n locale: 'ru_RU',\n autosaveTimeout: 15000,\n commonStylesEnabled: true,\n mergeTagsShow: true,\n imageCenterFileManagerView: true,\n fileManager: {\n defaultFolderName: 'demo-assets',\n enableMoveFolder: true,\n enableEdit: true,\n enableTrash: true,\n enableCopyFile: true,\n enableCopyFolder: true,\n },\n mergeTags: {\n syntax: ['{{' + '%value%' + '}}'],\n items: mergeTagItems,\n },\n} satisfies Partial<Config>;\n\nexport function createEditorConfig(): Partial<Config> {\n return baseEditorConfig;\n}\n\nexport const editorConfig = createEditorConfig();\n",
3626
3615
  "../../project-templates/shared/partials/stand-ensure-locale-script.eta": "import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { editorConfig } from '../src/dev/editorConfig';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst projectRoot = path.resolve(__dirname, '..');\nconst locale = String(editorConfig.locale || '').trim();\nconst localeDir = path.resolve(projectRoot, 'public', 'locales');\nconst localeFilePath = path.resolve(localeDir, `${locale}.po`);\nconst apiBaseUrl = <%~ JSON.stringify(it.standClosedLoopBaseUrl) %>;\nconst localeUrl = new URL(`wp-json/translations/v1/react_app/${encodeURIComponent(locale)}`, `${apiBaseUrl.replace(/\\/+$/, '')}/`).href;\n\nfunction normalizeLocaleText(text: string): string {\n const normalized = text.replace(/\\uFEFF/g, '').replace(/\\r\\n?/g, '\\n');\n return normalized.endsWith('\\n') ? normalized : `${normalized}\\n`;\n}\n\nfunction isPoCatalog(text: string): boolean {\n const normalized = normalizeLocaleText(text);\n return normalized.startsWith('msgid \"\"\\nmsgstr \"\"\\n') || normalized.includes('\\n\"Plural-Forms:');\n}\n\nasync function ensureLocaleFile(): Promise<void> {\n if (!locale) {\n throw new Error('editorConfig.locale is required for the closed-loop stand.');\n }\n\n try {\n const existing = await fs.readFile(localeFilePath, 'utf8');\n if (existing.trim() && isPoCatalog(existing)) {\n console.log(`[stand-locale] using existing public/locales/${locale}.po`);\n return;\n }\n } catch {\n // Download on first start when the file is absent.\n }\n\n const res = await fetch(localeUrl);\n if (!res.ok) {\n throw new Error(`Failed to download locale ${locale}: ${res.status} ${res.statusText}`);\n }\n\n const localeText = await res.text();\n if (!isPoCatalog(localeText)) {\n throw new Error(`Downloaded locale ${locale} is not a gettext catalog.`);\n }\n\n await fs.mkdir(localeDir, { recursive: true });\n await fs.writeFile(localeFilePath, normalizeLocaleText(localeText), 'utf8');\n console.log(`[stand-locale] saved public/locales/${locale}.po`);\n}\n\nensureLocaleFile().catch((error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`[stand-locale] ${message}`);\n process.exit(1);\n});\n",
3627
3616
  "../../project-templates/shared/partials/stand-get-auth-token.eta": "import { hasOAuthCredentials, oauthCredentials } from './oauthCredentials';\n\nexport async function getAuthToken() {\n if (!hasOAuthCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingOAuthCredentials) %>);\n }\n\n const formData = new FormData();\n formData.append('grant_type', 'client_credentials');\n formData.append('client_id', oauthCredentials.clientId);\n formData.append('client_secret', oauthCredentials.clientSecret);\n\n const response = await fetch('/api?oauth=token', {\n method: 'POST',\n body: formData,\n redirect: 'follow',\n });\n const payload = await response.json().catch(() => null);\n\n if (!response.ok || !payload || typeof payload.access_token !== 'string') {\n throw new Error(\n <%~ JSON.stringify(it.devAuthOauthTokenFetchFailed) %>,\n );\n }\n\n return payload.access_token;\n}\n",
3628
- "../../project-templates/shared/partials/stand-host-closed.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { hasStandaloneCredentials, standaloneCredentials } from './dev/standaloneCredentials';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\nconst baseUrl = <%~ JSON.stringify(it.standClosedLoopBaseUrl) %>;\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-closed-loop',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n if (!hasStandaloneCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingStandaloneCredentials) %>);\n }\n\n const instance = await <%= it.standProductApiName %>.init({\n standaloneKey: standaloneCredentials.standaloneKey,\n baseUrl,\n handleReadLocale: async (locale: string) => {\n const url = `/locales/${encodeURIComponent(locale)}.po`;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`Locale file not found: ${url}`);\n }\n return res.text();\n },\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostClosedLoopDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" />\n </>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3617
+ "../../project-templates/shared/partials/stand-host-closed.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { hasStandaloneCredentials, standaloneCredentials } from './dev/standaloneCredentials';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\nconst baseUrl = <%~ JSON.stringify(it.standClosedLoopBaseUrl) %>;\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-closed-loop',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n if (!hasStandaloneCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingStandaloneCredentials) %>);\n }\n\n const instance = await <%= it.standProductApiName %>.init({\n standaloneKey: standaloneCredentials.standaloneKey,\n baseUrl,\n handleReadLocale: async (locale: string) => {\n const url = `/locales/${encodeURIComponent(locale)}.po`;\n const res = await fetch(url);\n if (!res.ok) {\n throw new Error(`Locale file not found: ${url}`);\n }\n return res.text();\n },\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostClosedLoopDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" />\n </>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3629
3618
  "../../project-templates/shared/partials/stand-host-dev-server-webpack.eta": "/**\n * webpack-dev-server 5.2+ blocks cross-site script loads (403) unless assets\n * declare CORP cross-origin. Required for sandboxed editor iframe (no allow-same-origin).\n */\nexport const HOST_EDITOR_ASSET_HEADERS = Object.freeze({\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n 'Access-Control-Allow-Origin': '*',\n});\n\ntype DevServerConfig = {\n allowedHosts?: unknown;\n headers?: Record<string, string>;\n devMiddleware?: { headers?: Record<string, string> } & Record<string, unknown>;\n setupMiddlewares?: SetupMiddlewaresFn;\n} & Record<string, unknown>;\n\ntype WebpackConfig = {\n devServer?: DevServerConfig;\n};\n\ntype DevServerLike = {\n app?: {\n use: (middleware: HostEditorHeaderMiddleware) => void;\n };\n};\n\ntype HostEditorHeaderMiddleware = (\n req: unknown,\n res: { setHeader: (name: string, value: string) => void },\n next: () => void,\n) => void;\n\ntype SetupMiddlewaresFn = (\n middlewares: unknown[],\n devServer: DevServerLike,\n) => unknown[];\n\nexport function createHostEditorDevServerHeaderMiddleware(): HostEditorHeaderMiddleware {\n return (_req, res, next) => {\n for (const [key, value] of Object.entries(HOST_EDITOR_ASSET_HEADERS)) {\n res.setHeader(key, value);\n }\n next();\n };\n}\n\nexport function chainHostEditorDevServerSetupMiddleware(\n setupMiddlewares?: SetupMiddlewaresFn,\n): SetupMiddlewaresFn {\n return (middlewares, devServer) => {\n devServer.app?.use(createHostEditorDevServerHeaderMiddleware());\n if (typeof setupMiddlewares === 'function') {\n return setupMiddlewares(middlewares, devServer);\n }\n return middlewares;\n };\n}\n\nexport function mergeHostEditorDevServer(config: WebpackConfig): WebpackConfig {\n const existing = config.devServer || {};\n const existingDevMiddleware = existing.devMiddleware || {};\n\n config.devServer = {\n ...existing,\n allowedHosts: existing.allowedHosts ?? 'all',\n headers: {\n ...(existing.headers || {}),\n ...HOST_EDITOR_ASSET_HEADERS,\n },\n devMiddleware: {\n ...existingDevMiddleware,\n headers: {\n ...(existingDevMiddleware.headers || {}),\n ...HOST_EDITOR_ASSET_HEADERS,\n },\n },\n setupMiddlewares: chainHostEditorDevServerSetupMiddleware(existing.setupMiddlewares),\n };\n\n return config;\n}\n",
3630
- "../../project-templates/shared/partials/stand-host-oauth-default-banners.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-default-banners',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n<% if (it.standShowMemoryUsageBanner) { %>\n <div style={{ marginBottom: '12px', color: '#7c2d12', fontSize: '14px' }}>\n Memory usage stand: eager editor import + Vite 8 + host-side asset plugins for build reproduction.\n </div>\n<% } %>\n<% if (it.standShowSubpathBanner) { %>\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n Advanced subpath stand: page route and editor publicPath are intentionally not at server root.\n </div>\n<% } %>\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3631
- "../../project-templates/shared/partials/stand-host-oauth.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-oauth',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3632
- "../../project-templates/shared/partials/stand-host-react-adapter.eta": "import { createRoot } from 'react-dom/client';\nimport <%= it.standReactAdapterComponentName %> from '<%~ it.standReactAdapterPackage %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\nfunction StandHostApp() {\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n React adapter demo stand\n </div>\n <<%= it.standReactAdapterComponentName %>\n getAuthToken={getAuthToken}\n storageProvider={createLocalFolderStorageProvider()}\n content={{\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n }}\n config={editorConfig}\n container={{ style: { minHeight: '100vh' } }}\n />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<StandHostApp />);\n",
3633
- "../../project-templates/shared/partials/stand-host-resource-proxy-body.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\n<% if (it.standResourceProxyAuth === 'oauth') { %>\nimport { hasOAuthCredentials } from './dev/oauthCredentials';\n<% } else { %>\nimport { hasStandaloneCredentials, standaloneCredentials } from './dev/standaloneCredentials';\n<% } %>\nimport { demoStandConfig, hasDemoStandConfig } from './dev/demoStandConfig';\nimport { createResourceProxyDemoStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: <% if (it.standResourceProxyAuth === 'oauth') { %>'stand-resource-proxy-oauth'<% } else { %>'stand-resource-proxy-standalone'<% } %>,\n mountLabel: '#editor-root',\n } as const;\n\n try {\n<% if (it.standResourceProxyAuth === 'oauth') { %>\n if (!hasOAuthCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingOAuthCredentials) %>);\n }\n<% } else { %>\n if (!hasStandaloneCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingStandaloneCredentials) %>);\n }\n<% } %>\n if (!hasDemoStandConfig()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingDemoStandConfig) %>);\n }\n\n const emailCode = baseEmailHtml.replaceAll(\n 'YOUR_CDN_SAMPLE_PROJECT_ID',\n demoStandConfig.cdnSampleProjectId,\n );\n\n const instance = await <%= it.standProductApiName %>.init({\n<% if (it.standResourceProxyAuth !== 'oauth') { %>\n standaloneKey: standaloneCredentials.standaloneKey,\n<% } %>\n getAuthToken,\n storageProvider: createResourceProxyDemoStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: emailCode,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n <div\n style={{\n marginBottom: '12px',\n padding: '12px 16px',\n borderRadius: '8px',\n background: '#eef4ff',\n color: '#1e3a8a',\n fontSize: '13px',\n lineHeight: '20px',\n }}\n >\n <strong>Resource proxy demo:</strong>{' '}\n <code>placehold.co</code> is in <code>directHosts</code> (direct fetch);{' '}\n <code>dummyimage.com</code> goes through <code>/proxy/</code>.\n Open File Manager for seeded demo files or inspect the letter images.\n </div>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3619
+ "../../project-templates/shared/partials/stand-host-oauth-default-banners.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-default-banners',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n<% if (it.standShowMemoryUsageBanner) { %>\n <div style={{ marginBottom: '12px', color: '#7c2d12', fontSize: '14px' }}>\n Memory usage stand: eager editor import + Vite 8 + host-side asset plugins for build reproduction.\n </div>\n<% } %>\n<% if (it.standShowSubpathBanner) { %>\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n Advanced subpath stand: page route and editor publicPath are intentionally not at server root.\n </div>\n<% } %>\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3620
+ "../../project-templates/shared/partials/stand-host-oauth.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-oauth',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3621
+ "../../project-templates/shared/partials/stand-host-react-adapter.eta": "import { createRoot } from 'react-dom/client';\nimport <%= it.standReactAdapterComponentName %> from '<%~ it.standReactAdapterPackage %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('stand-demo-email-id', it) %>\n\nfunction StandHostApp() {\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n React adapter demo stand\n </div>\n <<%= it.standReactAdapterComponentName %>\n getAuthToken={getAuthToken}\n storageProvider={createLocalFolderStorageProvider()}\n content={{\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n }}\n config={editorConfig}\n container={{ style: { minHeight: '100vh' } }}\n />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<StandHostApp />);\n",
3622
+ "../../project-templates/shared/partials/stand-host-resource-proxy-body.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\n<% if (it.standResourceProxyAuth === 'oauth') { %>\nimport { hasOAuthCredentials } from './dev/oauthCredentials';\n<% } else { %>\nimport { hasStandaloneCredentials, standaloneCredentials } from './dev/standaloneCredentials';\n<% } %>\nimport { demoStandConfig, hasDemoStandConfig } from './dev/demoStandConfig';\nimport { createResourceProxyDemoStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: <% if (it.standResourceProxyAuth === 'oauth') { %>'stand-resource-proxy-oauth'<% } else { %>'stand-resource-proxy-standalone'<% } %>,\n mountLabel: '#editor-root',\n } as const;\n\n try {\n<% if (it.standResourceProxyAuth === 'oauth') { %>\n if (!hasOAuthCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingOAuthCredentials) %>);\n }\n<% } else { %>\n if (!hasStandaloneCredentials()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingStandaloneCredentials) %>);\n }\n<% } %>\n if (!hasDemoStandConfig()) {\n throw new Error(<%~ JSON.stringify(it.devAuthMissingDemoStandConfig) %>);\n }\n\n const emailCode = baseEmailHtml.replaceAll(\n 'YOUR_CDN_SAMPLE_PROJECT_ID',\n demoStandConfig.cdnSampleProjectId,\n );\n\n const instance = await <%= it.standProductApiName %>.init({\n<% if (it.standResourceProxyAuth !== 'oauth') { %>\n standaloneKey: standaloneCredentials.standaloneKey,\n<% } %>\n getAuthToken,\n storageProvider: createResourceProxyDemoStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: emailCode,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n <div\n style={{\n marginBottom: '12px',\n padding: '12px 16px',\n borderRadius: '8px',\n background: '#eef4ff',\n color: '#1e3a8a',\n fontSize: '13px',\n lineHeight: '20px',\n }}\n >\n <strong>Resource proxy demo:</strong>{' '}\n <code>placehold.co</code> is in <code>directHosts</code> (direct fetch);{' '}\n <code>dummyimage.com</code> goes through <code>/proxy/</code>.\n Open File Manager for seeded demo files or inspect the letter images.\n </div>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3634
3623
  "../../project-templates/shared/partials/stand-host-resource-proxy.eta": "<%~ include('stand-host-resource-proxy-body', it) %>\n",
3635
- "../../project-templates/shared/partials/stand-host-shadow-dom.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const shadowHostRef = useRef<HTMLDivElement | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n const shadowHost = shadowHostRef.current;\n if (!shadowHost || shadowHost.dataset.mounted === 'true' || instanceRef.current) {\n return;\n }\n\n shadowHost.dataset.mounted = 'true';\n\n const shadowRoot = shadowHost.attachShadow({ mode: 'closed' });\n const shadowStyle = document.createElement('style');\n shadowStyle.textContent = [\n ':host { display: block; min-height: 100vh; background: #ffffff; color: #111827; }',\n '#editor-root { min-height: 100vh; }',\n ].join(' ');\n\n const editorRoot = document.createElement('div');\n editorRoot.id = 'editor-root';\n\n shadowRoot.appendChild(shadowStyle);\n shadowRoot.appendChild(editorRoot);\n\n async function run() {\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-advanced-shadow-dom',\n mountLabel: '#shadow-host -> #editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: editorRoot,\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, editorRoot);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, editorRoot);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <>\n <style>{`\n html, body, #root {\n margin: 0;\n min-height: 100%;\n }\n\n body {\n background:\n linear-gradient(135deg, rgba(255, 84, 89, 0.15), rgba(91, 146, 255, 0.18)),\n repeating-linear-gradient(90deg, rgba(17, 24, 39, 0.04) 0 8px, transparent 8px 16px);\n }\n\n body * {\n box-sizing: border-box;\n font-family: 'Courier New', monospace !important;\n letter-spacing: 0.02em;\n }\n\n button, input, select, textarea {\n border-radius: 0 !important;\n }\n `}</style>\n <div style={{ padding: '24px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div style={{ marginBottom: '12px', color: '#111827', fontSize: '14px' }}>\n Advanced shadow-dom stand: closed shadow root + OAuth credentials + hostile host CSS\n </div>\n <div\n ref={shadowHostRef}\n id=\"shadow-host\"\n style={{ minHeight: '100vh', border: '2px dashed #111827', background: '#ffffff' }}\n />\n </div>\n </>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3636
- "../../project-templates/shared/partials/stand-host-umd.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\nconst editorGlobalName = <%~ JSON.stringify(it.standUmdEditorGlobalName) %>;\n\nfunction getEditorApi() {\n const editorApi = globalThis[editorGlobalName];\n if (!editorApi || typeof editorApi.init !== 'function') {\n throw new Error(`UMD bundle \"${editorGlobalName}\" was not found on window. Check <%~ it.standUmdScriptPath %>.`);\n }\n\n return editorApi;\n}\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorApi = ReturnType<typeof getEditorApi>;\ntype EditorInstance = Awaited<ReturnType<EditorApi['init']>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-advanced-umd',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await getEditorApi().init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n Advanced UMD stand: editor loads from <%= it.standUmdScriptPath %> via a plain script tag.\n </div>\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3624
+ "../../project-templates/shared/partials/stand-host-shadow-dom.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const shadowHostRef = useRef<HTMLDivElement | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n const shadowHost = shadowHostRef.current;\n if (!shadowHost || shadowHost.dataset.mounted === 'true' || instanceRef.current) {\n return;\n }\n\n shadowHost.dataset.mounted = 'true';\n\n const shadowRoot = shadowHost.attachShadow({ mode: 'closed' });\n const shadowStyle = document.createElement('style');\n shadowStyle.textContent = [\n ':host { display: block; min-height: 100vh; background: #ffffff; color: #111827; }',\n '#editor-root { min-height: 100vh; }',\n ].join(' ');\n\n const editorRoot = document.createElement('div');\n editorRoot.id = 'editor-root';\n\n shadowRoot.appendChild(shadowStyle);\n shadowRoot.appendChild(editorRoot);\n\n async function run() {\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-advanced-shadow-dom',\n mountLabel: '#shadow-host -> #editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: editorRoot,\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, editorRoot);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, editorRoot);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <>\n <style>{`\n html, body, #root {\n margin: 0;\n min-height: 100%;\n }\n\n body {\n background:\n linear-gradient(135deg, rgba(255, 84, 89, 0.15), rgba(91, 146, 255, 0.18)),\n repeating-linear-gradient(90deg, rgba(17, 24, 39, 0.04) 0 8px, transparent 8px 16px);\n }\n\n body * {\n box-sizing: border-box;\n font-family: 'Courier New', monospace !important;\n letter-spacing: 0.02em;\n }\n\n button, input, select, textarea {\n border-radius: 0 !important;\n }\n `}</style>\n <div style={{ padding: '24px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div style={{ marginBottom: '12px', color: '#111827', fontSize: '14px' }}>\n Advanced shadow-dom stand: closed shadow root + OAuth credentials + hostile host CSS\n </div>\n <div\n ref={shadowHostRef}\n id=\"shadow-host\"\n style={{ minHeight: '100vh', border: '2px dashed #111827', background: '#ffffff' }}\n />\n </div>\n </>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3625
+ "../../project-templates/shared/partials/stand-host-umd.eta": "import { useEffect, useRef, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport baseEmailHtml from './dev/email.html?raw';\nimport { editorConfig } from './dev/editorConfig';\nimport { getAuthToken } from './dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from './dev/storageProvider';\n\nconst editorGlobalName = <%~ JSON.stringify(it.standUmdEditorGlobalName) %>;\n\nfunction getEditorApi() {\n const editorApi = globalThis[editorGlobalName];\n if (!editorApi || typeof editorApi.init !== 'function') {\n throw new Error(`UMD bundle \"${editorGlobalName}\" was not found on window. Check <%~ it.standUmdScriptPath %>.`);\n }\n\n return editorApi;\n}\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorApi = ReturnType<typeof getEditorApi>;\ntype EditorInstance = Awaited<ReturnType<EditorApi['init']>>;\n\nfunction EditorApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'stand-advanced-umd',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await getEditorApi().init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div style={{ marginBottom: '12px', color: '#44506b', fontSize: '14px' }}>\n Advanced UMD stand: editor loads from <%= it.standUmdScriptPath %> via a plain script tag.\n </div>\n <div id=\"editor-root\" style={{ minHeight: '100vh' }} />\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<EditorApp />);\n",
3637
3626
  "../../project-templates/shared/partials/stand-package-json.eta": "<%~ JSON.stringify(it.standPackageJson, null, 2) + '\\n' %>\n",
3638
3627
  "../../project-templates/shared/partials/stand-readme.eta": "# <%= it.readmePluginPackageName %>\n\n<%= it.readmeGenerated %>\n\n<%= it.readmeWhatIncluded %>\n\n<%= it.readmeSimpleProject %>\n<%= it.readmeStorageProvider %>\n<%= it.readmeDevServer %>\n<% if (it.standAngular) { %>\n<%= it.readmeAngularHost %>\n<% } else { %>\n<%= it.readmeReactWrapper %>\n<%= it.readmeRouteHint %>\n<% } %>\n<% if (it.standReadmeIsResourceProxy === 'true') { %>\n\n<%= it.readmeStandResourceProxyAuth %>\n\n<%= it.readmeOauthTokenFile %>\n<% } else if (it.standReadmeIsClosedLoop === 'true') { %>\n<%= it.readmeClosedStandaloneKey %>\n<%= it.readmeClosedHandleReadLocale %>\n\n<%= it.readmeConfiguration %>\n\n<%= it.readmeClosedConfigHint %>\n<% } else { %>\n<%= it.readmeOauthProxy %>\n\n<%= it.readmeOauthTitle %>\n\n<%= it.readmeOauthHint %>\n<% } %>\n<% if (it.standReadmeIsResourceProxy === 'true') { %>\n\n<%= it.readmeStandResourceProxyHint %>\n\n<%= it.readmeStandResourceProxySecurityWarning %>\n\n<%= it.readmeStandResourceProxyDevRoutes %>\n\n<%= it.readmeStandResourceProxySampleProject %>\n<% } %>\n\n<%= it.readmeCommands %>\n\n```bash\nnpm install\n```\n\n<%= it.readmeCommandsDevelopment %>\n\n```bash\nnpm start\n```\n\n<%= it.readmeCommandsProduction %>\n\n<% if (it.standBundler === 'vite') { %>\n```bash\nnpm run build\nnpm run preview\n# alias: npm run serve:dist\n```\n<% } else { %>\n```bash\nnpm run build\nnpm run serve:dist\n```\n<% } %>\n\n<%= it.readmeCommandsProductionNote %>\n\n<% if (it.readmeModuleFederationHint) { %>\n\n<%= it.readmeModuleFederationHint %>\n\n<% } %>\n\n<% if (it.standAngular) { %>\n<%= it.readmeAngularCommandsDevUrl %>\n<%= it.readmeAngularCommandsProdUrl %>\n<% if (it.readmeAngularEsbuildClientProd) { %>\n<%= it.readmeAngularEsbuildClientProd %>\n<% } %>\n<% } else { %>\n> Production-like URL: `http://localhost:<%~ it.standPreviewPort %>/` (webpack/vite). Subpath stands may need the route suffix from dev mode.\n<% } %>\n\n<%= it.readmeStructure %>\n\n<%= it.readmeEntryPoint %>\n<%= it.readmeEmailTemplate %>\n<%= it.readmeEditorConfigFile %>\n<%= it.readmeStorageProviderFile %>\n<%= it.readmeStorageMiddleware %>\n<%= it.readmeStorageFolder %>\n<%= it.readmeConfigDir %>\n<% if (it.standReadmeIsClosedLoop === 'true') { %>\n<%= it.readmeStandaloneCredentialsFile %>\n<% } else if (it.standReadmeIsResourceProxy !== 'true') { %>\n<%= it.readmeOauthCredentialsFile %>\n<%= it.readmeOauthTokenFile %>\n<% } %>\n",
3639
3628
  "../../project-templates/shared/partials/stand-resource-proxy-demo-storage-provider.eta": "/** Demo URLs from buildResourceProxyStandPolicy (email + FM seed). */\nconst RESOURCE_PROXY_DEMO_DIRECT_URL = <%~ JSON.stringify(it.resourceProxyDemoDirectUrl) %>;\nconst RESOURCE_PROXY_DEMO_PROXY_URL = <%~ JSON.stringify(it.resourceProxyDemoProxyUrl) %>;\n\nfunction createResourceProxyDemoSeedFiles(): FileSystemItem[] {\n const date = new Date().toISOString();\n return [\n {\n id: 'demo-direct-placehold',\n name: 'directHosts (placehold.co).png',\n folderId: '',\n isFolder: false,\n type: 'image/png',\n size: 0,\n date,\n url: RESOURCE_PROXY_DEMO_DIRECT_URL,\n thumbnailUrl: RESOURCE_PROXY_DEMO_DIRECT_URL,\n },\n {\n id: 'demo-proxy-dummyimage',\n name: 'via proxy (dummyimage.com).png',\n folderId: '',\n isFolder: false,\n type: 'image/png',\n size: 0,\n date,\n url: RESOURCE_PROXY_DEMO_PROXY_URL,\n thumbnailUrl: RESOURCE_PROXY_DEMO_PROXY_URL,\n },\n ];\n}\n\nfunction isResourceProxyDemoFileId(id: string | undefined): boolean {\n return id === 'demo-direct-placehold' || id === 'demo-proxy-dummyimage';\n}\n\nfunction normalizeFolderId(folderId: string | undefined, rootId: string | undefined): string {\n if (!folderId || folderId === rootId) {\n return '';\n }\n return folderId;\n}\n\nfunction filterDemoItems(\n demoFiles: FileSystemItem[],\n folderId: string | undefined,\n rootId: string | undefined,\n options: { search?: string; itemType?: 'all' | 'file' | 'folder' },\n): FileSystemItem[] {\n const normalizedFolderId = normalizeFolderId(folderId, rootId);\n if (options.itemType === 'folder') {\n return [];\n }\n\n let items = demoFiles.filter((item) => item.folderId === normalizedFolderId);\n const search = (options.search || '').trim().toLowerCase();\n if (search) {\n items = items.filter((item) => item.name.toLowerCase().includes(search));\n }\n return items;\n}\n\nfunction removeDemoFile(demoFiles: FileSystemItem[], id: string): void {\n const index = demoFiles.findIndex((demoItem) => demoItem.id === id);\n if (index >= 0) {\n demoFiles.splice(index, 1);\n }\n}\n\n/**\n * Local folder storage with two seeded external-image demo files for resource-proxy stand.\n * Demo files can be deleted or moved during the session; they reappear after page reload.\n */\nexport function createResourceProxyDemoStorageProvider(): StorageProvider {\n const inner = createLocalFolderStorageProvider();\n const demoFiles = createResourceProxyDemoSeedFiles();\n\n return {\n ...inner,\n\n async getItems(options) {\n const result = await inner.getItems(options);\n const demoItems = filterDemoItems(demoFiles, options.folderId, inner.rootId, options);\n const items = [...demoItems, ...(result.items || [])];\n const pagination = result.pagination\n ? {\n ...result.pagination,\n total: (result.pagination.total ?? result.items?.length ?? 0) + demoItems.length,\n }\n : result.pagination;\n\n return { items, pagination };\n },\n\n async deleteItem(item, options) {\n if (isResourceProxyDemoFileId(item.id)) {\n removeDemoFile(demoFiles, item.id);\n return;\n }\n\n return inner.deleteItem!(item, options);\n },\n\n async deleteItems(items, options) {\n const demoItems = items.filter((item) => isResourceProxyDemoFileId(item.id));\n for (const item of demoItems) {\n removeDemoFile(demoFiles, item.id);\n }\n\n const remaining = items.filter((item) => !isResourceProxyDemoFileId(item.id));\n if (remaining.length === 0) {\n return {\n success: demoItems.every(() => true),\n detailed: demoItems.map((item) => ({ success: true, requestId: item.id })),\n };\n }\n\n const innerResult = await inner.deleteItems!(remaining, options);\n const demoDetailed = demoItems.map((item) => ({ success: true, requestId: item.id }));\n return {\n success: innerResult.success && demoDetailed.every((entry) => entry.success),\n detailed: [...demoDetailed, ...(innerResult.detailed || [])],\n };\n },\n\n async moveItem(item, targetFolderId) {\n if (isResourceProxyDemoFileId(item.id)) {\n const demoItem = demoFiles.find((entry) => entry.id === item.id);\n if (!demoItem) {\n throw new Error('Demo file not found');\n }\n demoItem.folderId = normalizeFolderId(targetFolderId, inner.rootId);\n return { id: demoItem.id, folderId: demoItem.folderId };\n }\n\n return inner.moveItem!(item, targetFolderId);\n },\n\n async renameItem(item, newName) {\n if (isResourceProxyDemoFileId(item.id)) {\n const demoItem = demoFiles.find((entry) => entry.id === item.id);\n if (!demoItem) {\n throw new Error('Demo file not found');\n }\n demoItem.name = newName;\n return { id: demoItem.id, name: newName };\n }\n\n return inner.renameItem!(item, newName);\n },\n };\n}\n",
@@ -3643,7 +3632,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3643
3632
  "../../project-templates/shared/partials/stand-webpack-index-body.eta": "<% if (it.standAdvancedUmd) { %>\n <script src=\"<%= it.standUmdScriptPath %>\"><\/script>\n<% } %>\n <script src=\"<%= it.standWebpackScriptSrc %>\"><\/script>\n",
3644
3633
  "../../project-templates/shared/partials/stand-webpack-index-shell.eta": "<!doctype html>\n<html lang=\"<%= it.standIndexHtmlLang %>\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title><%= it.standIndexHtmlTitle %></title>\n </head>\n <body>\n <div id=\"root\"></div>\n<%~ include('stand-webpack-index-body', it) %>\n </body>\n</html>\n",
3645
3634
  "../../project-templates/shared/stand-assets/scripts/assertDistReady.cjs": "#!/usr/bin/env node\n/**\n * Guards `serve:dist` / `vite preview` — fails fast when build output is missing.\n *\n * Usage: node ./scripts/assertDistReady.cjs [distRelativePath]\n * Default path: `dist`\n */\nconst fs = require('node:fs');\nconst path = require('node:path');\n\nconst distRelative = process.argv[2] || 'dist';\nconst distDir = path.resolve(process.cwd(), distRelative);\n\nfunction hasIndexHtml(dir) {\n if (fs.existsSync(path.join(dir, 'index.html'))) {\n return true;\n }\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n if (hasIndexHtml(path.join(dir, entry.name))) {\n return true;\n }\n }\n return false;\n}\n\nif (!fs.existsSync(distDir)) {\n console.error(`[serve:dist] Missing ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n}\n\nif (!fs.statSync(distDir).isDirectory()) {\n console.error(`[serve:dist] Expected ${distRelative}/ to be a directory.`);\n process.exit(1);\n}\n\nif (!hasIndexHtml(distDir)) {\n console.error(`[serve:dist] No index.html under ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n}\n",
3646
- "../../project-templates/shared/stand-assets/scripts/serveDist.cjs.eta": "#!/usr/bin/env node\n/**\n * Production-like static server for demo stands (`serve:dist`).\n * Serves built `dist/` and mirrors dev-server `/api` proxy for OAuth (`getAuthToken`).\n *\n * Usage: node ./scripts/serveDist.cjs [distRelativePath] [port]\n */\nconst http = require('node:http');\nconst https = require('node:https');\nconst fs = require('node:fs');\nconst path = require('node:path');\nconst { URL } = require('node:url');\n\nconst API_PROXY_ENABLED = <%= it.standClosedLoop ? 'false' : 'true' %>;\nconst API_TARGET = <%~ JSON.stringify(it.standOpenApiBaseUrl) %>;\nconst API_ORIGIN = <%~ JSON.stringify(it.standOpenApiOrigin) %>;\nconst DEFAULT_PORT = <%~ it.standPreviewPort %>;\n\nconst STATIC_HEADERS = {\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n 'Access-Control-Allow-Origin': '*',\n};\n\nconst MIME_TYPES = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'text/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n '.ico': 'image/x-icon',\n '.map': 'application/json; charset=utf-8',\n};\n\nfunction resolveContentType(filePath) {\n return MIME_TYPES[path.extname(filePath).toLowerCase()] || 'application/octet-stream';\n}\n\nfunction hasIndexHtml(dir) {\n if (fs.existsSync(path.join(dir, 'index.html'))) {\n return true;\n }\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n if (hasIndexHtml(path.join(dir, entry.name))) {\n return true;\n }\n }\n return false;\n}\n\nfunction resolveStaticFile(distDir, requestPath) {\n const safeSuffix = path.normalize(requestPath).replace(/^(\\.\\.[/\\\\])+/, '');\n const candidate = path.join(distDir, safeSuffix);\n if (!candidate.startsWith(distDir)) {\n return null;\n }\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n if (fs.existsSync(path.join(candidate, 'index.html'))) {\n return path.join(candidate, 'index.html');\n }\n return null;\n}\n\nfunction sendFile(res, filePath) {\n res.writeHead(200, {\n ...STATIC_HEADERS,\n 'Content-Type': resolveContentType(filePath),\n });\n fs.createReadStream(filePath).pipe(res);\n}\n\nfunction readRequestBody(req) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n req.on('data', (chunk) => chunks.push(chunk));\n req.on('end', () => resolve(Buffer.concat(chunks)));\n req.on('error', reject);\n });\n}\n\nfunction buildProxyRequestHeaders(req, targetUrl, bodyLength) {\n const headers = { ...req.headers, host: targetUrl.host };\n if (headers.origin) {\n headers.origin = API_ORIGIN;\n }\n delete headers.connection;\n delete headers['transfer-encoding'];\n if (bodyLength > 0) {\n headers['content-length'] = String(bodyLength);\n } else {\n delete headers['content-length'];\n }\n return headers;\n}\n\nfunction drainResponse(proxyRes) {\n return new Promise((resolve) => {\n proxyRes.on('end', resolve);\n proxyRes.resume();\n });\n}\n\nfunction proxyApiRequest(req, res, targetUrl, body, redirectCount, method) {\n const MAX_REDIRECTS = 5;\n if (redirectCount > MAX_REDIRECTS) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Too many redirects');\n return;\n }\n\n const requestMethod = method || req.method || 'GET';\n const transport = targetUrl.protocol === 'https:' ? https : http;\n const headers = buildProxyRequestHeaders(req, targetUrl, body.length);\n\n const proxyReq = transport.request(\n targetUrl,\n { method: requestMethod, headers },\n (proxyRes) => {\n const status = proxyRes.statusCode || 502;\n const location = proxyRes.headers.location;\n if (status >= 300 && status < 400 && location) {\n drainResponse(proxyRes).then(() => {\n const nextUrl = new URL(location, targetUrl);\n const useGet = status === 303;\n proxyApiRequest(\n req,\n res,\n nextUrl,\n useGet ? Buffer.alloc(0) : body,\n redirectCount + 1,\n useGet ? 'GET' : requestMethod,\n );\n });\n return;\n }\n\n const outHeaders = { ...proxyRes.headers };\n delete outHeaders.location;\n res.writeHead(status, outHeaders);\n proxyRes.pipe(res);\n },\n );\n\n proxyReq.on('error', (error) => {\n console.error('[serveDist] API proxy error:', error.message);\n if (!res.headersSent) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Bad Gateway');\n }\n });\n\n if (body.length > 0) {\n proxyReq.write(body);\n }\n proxyReq.end();\n}\n\nasync function proxyApi(req, res) {\n const body = await readRequestBody(req);\n const targetUrl = new URL(req.url || '/', API_TARGET);\n proxyApiRequest(req, res, targetUrl, body, 0);\n}\n\nfunction createServer(distDir) {\n return http.createServer((req, res) => {\n const requestUrl = new URL(req.url || '/', 'http://localhost');\n const pathname = decodeURIComponent(requestUrl.pathname);\n\n if (API_PROXY_ENABLED && pathname.startsWith('/api')) {\n proxyApi(req, res);\n return;\n }\n\n const filePath = resolveStaticFile(distDir, pathname === '/' ? '/index.html' : pathname);\n if (filePath) {\n sendFile(res, filePath);\n return;\n }\n\n res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Not Found');\n });\n}\n\nfunction main() {\n const distRelative = process.argv[2] || 'dist';\n const portArg = process.argv[3];\n const port = portArg !== undefined ? Number(portArg) : DEFAULT_PORT;\n const distDir = path.resolve(process.cwd(), distRelative);\n\n if (!fs.existsSync(distDir) || !fs.statSync(distDir).isDirectory()) {\n console.error(`[serveDist] Missing ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n }\n\n if (!hasIndexHtml(distDir)) {\n console.error(`[serveDist] No index.html under ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n }\n\n const server = createServer(distDir);\n server.listen(port, () => {\n console.log(`[serveDist] ${distRelative} → http://localhost:${port}/`);\n if (API_PROXY_ENABLED) {\n console.log(`[serveDist] /api → ${API_TARGET}`);\n }\n });\n}\n\nmain();\n",
3635
+ "../../project-templates/shared/stand-assets/scripts/serveDist.cjs.eta": "#!/usr/bin/env node\n/**\n * Production-like static server for demo stands (`serve:dist`).\n * Serves built `dist/`, mirrors dev-server `/api` proxy for OAuth (`getAuthToken`),\n * and mounts local `./storage` via `/dev-storage` (same middleware as `ng serve`).\n *\n * Usage: node ./scripts/serveDist.cjs [distRelativePath] [port]\n */\nconst http = require('node:http');\nconst https = require('node:https');\nconst fs = require('node:fs');\nconst path = require('node:path');\nconst { URL } = require('node:url');\n\nconst API_PROXY_ENABLED = <%= it.standClosedLoop ? 'false' : 'true' %>;\nconst API_TARGET = <%~ JSON.stringify(it.standOpenApiBaseUrl) %>;\nconst API_ORIGIN = <%~ JSON.stringify(it.standOpenApiOrigin) %>;\nconst DEFAULT_PORT = <%~ it.standPreviewPort %>;\n\nconst STATIC_HEADERS = {\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n 'Access-Control-Allow-Origin': '*',\n};\n\nconst MIME_TYPES = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'text/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n '.ico': 'image/x-icon',\n '.map': 'application/json; charset=utf-8',\n};\n\nfunction resolveContentType(filePath) {\n return MIME_TYPES[path.extname(filePath).toLowerCase()] || 'application/octet-stream';\n}\n\nfunction hasIndexHtml(dir) {\n if (fs.existsSync(path.join(dir, 'index.html'))) {\n return true;\n }\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n if (hasIndexHtml(path.join(dir, entry.name))) {\n return true;\n }\n }\n return false;\n}\n\nfunction resolveStaticFile(distDir, requestPath) {\n const safeSuffix = path.normalize(requestPath).replace(/^(\\.\\.[/\\\\])+/, '');\n const candidate = path.join(distDir, safeSuffix);\n if (!candidate.startsWith(distDir)) {\n return null;\n }\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {\n return candidate;\n }\n if (fs.existsSync(path.join(candidate, 'index.html'))) {\n return path.join(candidate, 'index.html');\n }\n return null;\n}\n\nfunction sendFile(res, filePath) {\n res.writeHead(200, {\n ...STATIC_HEADERS,\n 'Content-Type': resolveContentType(filePath),\n });\n fs.createReadStream(filePath).pipe(res);\n}\n\nfunction readRequestBody(req) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n req.on('data', (chunk) => chunks.push(chunk));\n req.on('end', () => resolve(Buffer.concat(chunks)));\n req.on('error', reject);\n });\n}\n\nfunction buildProxyRequestHeaders(req, targetUrl, bodyLength) {\n const headers = { ...req.headers, host: targetUrl.host };\n if (headers.origin) {\n headers.origin = API_ORIGIN;\n }\n delete headers.connection;\n delete headers['transfer-encoding'];\n if (bodyLength > 0) {\n headers['content-length'] = String(bodyLength);\n } else {\n delete headers['content-length'];\n }\n return headers;\n}\n\nfunction drainResponse(proxyRes) {\n return new Promise((resolve) => {\n proxyRes.on('end', resolve);\n proxyRes.resume();\n });\n}\n\nfunction proxyApiRequest(req, res, targetUrl, body, redirectCount, method) {\n const MAX_REDIRECTS = 5;\n if (redirectCount > MAX_REDIRECTS) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Too many redirects');\n return;\n }\n\n const requestMethod = method || req.method || 'GET';\n const transport = targetUrl.protocol === 'https:' ? https : http;\n const headers = buildProxyRequestHeaders(req, targetUrl, body.length);\n\n const proxyReq = transport.request(\n targetUrl,\n { method: requestMethod, headers },\n (proxyRes) => {\n const status = proxyRes.statusCode || 502;\n const location = proxyRes.headers.location;\n if (status >= 300 && status < 400 && location) {\n drainResponse(proxyRes).then(() => {\n const nextUrl = new URL(location, targetUrl);\n const useGet = status === 303;\n proxyApiRequest(\n req,\n res,\n nextUrl,\n useGet ? Buffer.alloc(0) : body,\n redirectCount + 1,\n useGet ? 'GET' : requestMethod,\n );\n });\n return;\n }\n\n const outHeaders = { ...proxyRes.headers };\n delete outHeaders.location;\n res.writeHead(status, outHeaders);\n proxyRes.pipe(res);\n },\n );\n\n proxyReq.on('error', (error) => {\n console.error('[serveDist] API proxy error:', error.message);\n if (!res.headersSent) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Bad Gateway');\n }\n });\n\n if (body.length > 0) {\n proxyReq.write(body);\n }\n proxyReq.end();\n}\n\nasync function proxyApi(req, res) {\n const body = await readRequestBody(req);\n const targetUrl = new URL(req.url || '/', API_TARGET);\n proxyApiRequest(req, res, targetUrl, body, 0);\n}\n\nfunction loadDevStorageMiddleware() {\n const middlewarePath = path.join(__dirname, 'devStorageMiddleware.ts');\n if (!fs.existsSync(middlewarePath)) {\n return null;\n }\n\n try {\n const { register } = require('tsx/cjs/api');\n register();\n const mod = require(middlewarePath);\n const factory = mod && (mod.default || mod);\n return typeof factory === 'function' ? factory() : null;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.warn(`[serveDist] dev-storage middleware not loaded: ${message}`);\n return null;\n }\n}\n\nfunction handleStaticRequest(distDir, req, res, pathname) {\n if (API_PROXY_ENABLED && pathname.startsWith('/api')) {\n proxyApi(req, res);\n return;\n }\n\n const filePath = resolveStaticFile(distDir, pathname === '/' ? '/index.html' : pathname);\n if (filePath) {\n sendFile(res, filePath);\n return;\n }\n\n res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Not Found');\n}\n\nfunction createServer(distDir, devStorageMiddleware) {\n return http.createServer((req, res) => {\n const requestUrl = new URL(req.url || '/', 'http://localhost');\n const pathname = decodeURIComponent(requestUrl.pathname);\n\n if (pathname.startsWith('/dev-storage')) {\n if (!devStorageMiddleware) {\n res.writeHead(503, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('dev-storage middleware unavailable (missing scripts/devStorageMiddleware.ts or tsx)');\n return;\n }\n\n devStorageMiddleware(req, res, () => {\n if (!res.headersSent) {\n res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Not Found');\n }\n });\n return;\n }\n\n handleStaticRequest(distDir, req, res, pathname);\n });\n}\n\nfunction main() {\n const distRelative = process.argv[2] || 'dist';\n const portArg = process.argv[3];\n const port = portArg !== undefined ? Number(portArg) : DEFAULT_PORT;\n const distDir = path.resolve(process.cwd(), distRelative);\n\n if (!fs.existsSync(distDir) || !fs.statSync(distDir).isDirectory()) {\n console.error(`[serveDist] Missing ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n }\n\n if (!hasIndexHtml(distDir)) {\n console.error(`[serveDist] No index.html under ${distRelative}/ — run \\`npm run build\\` first.`);\n process.exit(1);\n }\n\n const devStorageMiddleware = loadDevStorageMiddleware();\n const server = createServer(distDir, devStorageMiddleware);\n server.listen(port, () => {\n console.log(`[serveDist] ${distRelative} → http://localhost:${port}/`);\n if (API_PROXY_ENABLED) {\n console.log(`[serveDist] /api → ${API_TARGET}`);\n }\n if (devStorageMiddleware) {\n console.log('[serveDist] /dev-storage → ./storage');\n }\n });\n}\n\nmain();\n",
3647
3636
  "../../project-templates/shared/stand-assets/serve.json": "{\n \"headers\": [\n {\n \"source\": \"**/*\",\n \"headers\": [\n {\n \"key\": \"Cross-Origin-Resource-Policy\",\n \"value\": \"cross-origin\"\n },\n {\n \"key\": \"Access-Control-Allow-Origin\",\n \"value\": \"*\"\n }\n ]\n }\n ]\n}\n",
3648
3637
  "../../project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts": "import type { IncomingMessage, ServerResponse } from 'node:http';\nimport react from '@vitejs/plugin-react';\nimport type { PluginOption, UserConfig, UserConfigExport, ViteDevServer } from 'vite';\nimport { defineConfig } from 'vite';\nimport devStorageMiddleware from '../../scripts/devStorageMiddleware.ts';\nimport { createStandApiProxyOptions } from './standApiProxy.ts';\nimport { STAND_PREVIEW_HEADERS, STAND_PREVIEW_PORT } from './standPreviewSettings.ts';\nimport { STAND_VITE_PRODUCTION_BUILD } from './standProductionBuild.ts';\n\ntype DevServerMiddleware = (req: IncomingMessage, res: ServerResponse, next: () => void) => void;\n\ninterface CreateViteStandConfigOptions {\n projectRoot: string;\n open?: string;\n apiBaseUrl: string;\n apiOrigin: string;\n closedLoop?: boolean;\n plugins?: PluginOption[];\n extraServerMiddlewares?: DevServerMiddleware[];\n extraProxy?: Record<string, import('vite').ProxyOptions>;\n onConfigureServer?: (server: ViteDevServer) => void | (() => void);\n build?: UserConfig['build'];\n resolve?: UserConfig['resolve'];\n serverPort?: number;\n}\n\nexport function createViteStandConfig(options: CreateViteStandConfigOptions): UserConfigExport {\n const {\n projectRoot,\n open,\n apiBaseUrl,\n apiOrigin,\n closedLoop,\n plugins = [],\n extraServerMiddlewares = [],\n extraProxy = {},\n onConfigureServer,\n build,\n resolve,\n serverPort = 3000,\n } = options;\n\n return defineConfig(() => {\n const apiProxy = closedLoop\n ? undefined\n : {\n ...createStandApiProxyOptions(apiBaseUrl, apiOrigin),\n ...extraProxy,\n };\n\n return {\n root: projectRoot,\n plugins: [\n react(),\n ...plugins,\n {\n name: 'dev-storage',\n configureServer(server) {\n let disposeConfigureServer: void | (() => void);\n if (open && open !== '/') {\n server.middlewares.use((req, res, next) => {\n if (req.method === 'GET' && (req.url === '/' || req.url === '/index.html')) {\n res.statusCode = 302;\n res.setHeader('Location', open);\n res.end();\n return;\n }\n next();\n });\n }\n server.middlewares.use(devStorageMiddleware());\n for (const middleware of extraServerMiddlewares) {\n server.middlewares.use(middleware);\n }\n disposeConfigureServer = onConfigureServer?.(server);\n return () => {\n disposeConfigureServer?.();\n };\n },\n },\n ],\n ...(resolve ? { resolve } : {}),\n server: {\n ...(open !== undefined && open !== null ? { open } : {}),\n port: serverPort,\n ...(apiProxy ? { proxy: apiProxy } : {}),\n },\n build: {\n ...STAND_VITE_PRODUCTION_BUILD,\n ...build,\n },\n preview: {\n port: STAND_PREVIEW_PORT,\n ...(open && open !== '/' ? { open } : {}),\n headers: STAND_PREVIEW_HEADERS,\n ...(apiProxy ? { proxy: apiProxy } : {}),\n },\n };\n });\n}\n",
3649
3638
  "../../project-templates/shared/stand-vite-base/config/lib/standApiProxy.ts": "import type { ProxyOptions } from 'vite';\n\nexport function createStandApiProxyOptions(\n apiBaseUrl: string,\n apiOrigin: string,\n): Record<string, ProxyOptions> {\n return {\n '/api': {\n target: apiBaseUrl,\n secure: false,\n changeOrigin: true,\n configure: (proxyInstance) => {\n proxyInstance.on('proxyReq', (proxyRequest) => {\n if (proxyRequest.getHeader('origin')) {\n proxyRequest.setHeader('origin', apiOrigin);\n }\n });\n },\n },\n };\n}\n",
@@ -3689,7 +3678,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3689
3678
  "../../project-templates/stand/advanced/module-federation/vite/src/dev/oauthCredentials.ts": "export const oauthCredentials = {\n clientId: 'YOUR_CLIENT_ID',\n clientSecret: 'YOUR_CLIENT_SECRET',\n};\n\nexport function hasOAuthCredentials() {\n return oauthCredentials.clientId !== 'YOUR_CLIENT_ID'\n && oauthCredentials.clientSecret !== 'YOUR_CLIENT_SECRET';\n}\n",
3690
3679
  "../../project-templates/stand/advanced/module-federation/vite/src/dev/storageProvider.ts.eta": "<%~ include('stand-storage-provider', it) %>\n",
3691
3680
  "../../project-templates/stand/advanced/module-federation/vite/src/index.tsx.eta": "import { lazy, Suspense } from 'react';\nimport { createRoot } from 'react-dom/client';\n\nconst EditorRemote = lazy(() => import('editor/Editor'));\n\nfunction HostApp() {\n return (\n <div style={{ minHeight: '100vh', background: '#f5f7fb', padding: '24px' }}>\n <div style={{ margin: '0 auto', maxWidth: '1280px' }}>\n<% if (it.standShowModuleFederationBanner) { %>\n <div style={{ marginBottom: '12px', color: '#7c2d12', fontSize: '14px' }}>\n Module Federation stand — open <code>http://localhost:3000/</code> (remote/CDN on port 3001).\n </div>\n<% } %>\n <Suspense fallback={<div style={{ padding: '16px', fontSize: '14px' }}>Loading editor remote…</div>}>\n <EditorRemote />\n </Suspense>\n </div>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (!rootElement) {\n throw new Error(<%~ JSON.stringify(it.commonRootElementNotFound) %>);\n}\n\ncreateRoot(rootElement).render(<HostApp />);\n",
3692
- "../../project-templates/stand/advanced/module-federation/vite/src/remote/EditorApp.tsx.eta": "import { useEffect, useRef, useState } from 'react';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nexport default function EditorRemoteApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'module-federation',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: {\n ...editorConfig,\n codeMode: 'true',\n codeModeDirection: 'bottom',\n },\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '80vh' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '80vh' }} />\n </div>\n );\n}\n",
3681
+ "../../project-templates/stand/advanced/module-federation/vite/src/remote/EditorApp.tsx.eta": "import { useEffect, useRef, useState } from 'react';\nimport * as <%= it.standProductApiName %> from '<%~ it.packageName %>';\nimport baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\n\n<%~ include('editor-init-smoke', it) %>\n<%~ include('stand-demo-email-id', it) %>\ntype EditorInstance = Awaited<ReturnType<typeof <%= it.standProductApiName %>.init>>;\n\nexport default function EditorRemoteApp() {\n const instanceRef = useRef<EditorInstance | null>(null);\n const [initError, setInitError] = useState<string | null>(null);\n\n useEffect(() => {\n async function run() {\n if (instanceRef.current) {\n return;\n }\n\n const mountElement = document.getElementById('editor-root');\n const smokeMeta = {\n hostKind: 'stand-host',\n variant: 'module-federation',\n mountLabel: '#editor-root',\n } as const;\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: {\n ...editorConfig,\n codeMode: 'true',\n codeModeDirection: 'bottom',\n },\n });\n instanceRef.current = instance;\n reportEditorReady(smokeMeta, mountElement);\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement);\n setInitError(message);\n }\n }\n\n run();\n }, []);\n\n return (\n <div style={{ minHeight: '80vh' }}>\n {initError ? (\n <div style={{ marginBottom: '12px', color: '#b42318', fontSize: '14px' }}>\n Editor failed to initialize: {initError}\n </div>\n ) : null}\n <div id=\"editor-root\" style={{ minHeight: '80vh' }} />\n </div>\n );\n}\n",
3693
3682
  "../../project-templates/stand/advanced/module-federation/vite/src/remote/devShell.tsx": "import { createRoot } from 'react-dom/client';\n\n/** Dev-only remote shell; the MF host runs on localhost:3000. */\nfunction RemoteDevShell() {\n return (\n <div style={{ padding: '16px', fontFamily: 'system-ui, sans-serif', fontSize: '14px', color: '#44506b' }}>\n Editor MF remote (localhost:3001). Open host at <code>http://localhost:3000/</code>\n </div>\n );\n}\n\nconst rootElement = document.getElementById('root');\n\nif (rootElement) {\n createRoot(rootElement).render(<RemoteDevShell />);\n}\n",
3694
3683
  "../../project-templates/stand/advanced/module-federation/vite/src/types/mf.d.ts": "declare module 'editor/Editor' {\n import type { ComponentType } from 'react';\n\n const EditorRemoteApp: ComponentType;\n export default EditorRemoteApp;\n}\n",
3695
3684
  "../../project-templates/stand/advanced/shadow-dom/vite/README.md.eta": "<%~ include('stand-readme', it) %>\n",
@@ -3768,7 +3757,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3768
3757
  "../../project-templates/stand/angular/esbuild/src/app/app.component.html.eta": "<main class=\"page\">\n @if (initError()) {\n <p class=\"error\">Editor failed: {{ initError() }}</p>\n }\n @if (publicPathDiag()) {\n <pre class=\"diag\">{{ publicPathDiag() }}</pre>\n }\n <div id=\"editor-root\" class=\"editor-mount\"></div>\n</main>\n",
3769
3758
  "../../project-templates/stand/angular/esbuild/src/app/app.component.ts.eta": "import { Component, AfterViewInit, signal } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport type { PublicPathDiagSnapshot } from '../../scripts/publicPathDiagnostics';\n\ntype DiagBag = { __standPublicPathDiagnostics?: PublicPathDiagSnapshot[] };\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css',\n})\nexport class AppComponent implements AfterViewInit {\n readonly initError = signal<string | null>(null);\n readonly publicPathDiag = signal<string | null>(null);\n\n ngAfterViewInit(): void {\n import('./editor-host')\n .then(({ initOAuthEditor }) => initOAuthEditor())\n .then(() => {\n const bag = window as unknown as DiagBag;\n const last = bag.__standPublicPathDiagnostics?.at(-1);\n if (last) {\n this.publicPathDiag.set(JSON.stringify(last, null, 2));\n }\n })\n .catch((error) => {\n this.initError.set(error instanceof Error ? error.message : String(error));\n });\n }\n}\n",
3770
3759
  "../../project-templates/stand/angular/esbuild/src/app/app.config.ts.eta": "import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\n\nexport const appConfig: ApplicationConfig = {\n providers: [provideZoneChangeDetection({ eventCoalescing: true })],\n};\n",
3771
- "../../project-templates/stand/angular/esbuild/src/app/editor-host.ts.eta": "import baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\nimport { snapshotPublicPathDiagnostics } from '../../scripts/publicPathDiagnostics';\n\ntype EmailmakerModule = typeof import('<%~ it.packageName %>');\ntype EditorInstance = Awaited<ReturnType<EmailmakerModule['init']>>;\n\nlet editorInstance: EditorInstance | null = null;\n\nasync function loadEmailmakerModule(): Promise<EmailmakerModule> {\n return import('<%~ it.packageName %>');\n}\n\nfunction formatInitError(error: unknown): string {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n if (typeof error === 'string' && error.trim()) {\n return error.trim();\n }\n return 'Editor initialization failed.';\n}\n\nexport async function initOAuthEditor(): Promise<EditorInstance> {\n if (editorInstance) {\n return editorInstance;\n }\n\n snapshotPublicPathDiagnostics('before-emailmaker-import');\n const <%= it.standProductApiName %> = await loadEmailmakerModule();\n snapshotPublicPathDiagnostics('after-emailmaker-import');\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n\n editorInstance = instance;\n return instance;\n } catch (error) {\n const message = formatInitError(error);\n console.error('[editor-host] Editor initialization failed', error);\n throw new Error(message);\n }\n}\n",
3760
+ "../../project-templates/stand/angular/esbuild/src/app/editor-host.ts.eta": "import baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\nimport { snapshotPublicPathDiagnostics } from '../../scripts/publicPathDiagnostics';\n\n<%~ include('stand-demo-email-id', it) %>\n\ntype EmailmakerModule = typeof import('<%~ it.packageName %>');\ntype EditorInstance = Awaited<ReturnType<EmailmakerModule['init']>>;\n\nlet editorInstance: EditorInstance | null = null;\n\nasync function loadEmailmakerModule(): Promise<EmailmakerModule> {\n return import('<%~ it.packageName %>');\n}\n\nfunction formatInitError(error: unknown): string {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n if (typeof error === 'string' && error.trim()) {\n return error.trim();\n }\n return 'Editor initialization failed.';\n}\n\nexport async function initOAuthEditor(): Promise<EditorInstance> {\n if (editorInstance) {\n return editorInstance;\n }\n\n snapshotPublicPathDiagnostics('before-emailmaker-import');\n const <%= it.standProductApiName %> = await loadEmailmakerModule();\n snapshotPublicPathDiagnostics('after-emailmaker-import');\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n\n editorInstance = instance;\n return instance;\n } catch (error) {\n const message = formatInitError(error);\n console.error('[editor-host] Editor initialization failed', error);\n throw new Error(message);\n }\n}\n",
3772
3761
  "../../project-templates/stand/angular/esbuild/src/dev/editorConfig.ts.eta": "<%~ include('stand-editor-config', it) %>\n",
3773
3762
  "../../project-templates/stand/angular/esbuild/src/dev/email.html.eta": "<%~ include('stand-dev-email', it) %>\n",
3774
3763
  "../../project-templates/stand/angular/esbuild/src/dev/getAuthToken.ts.eta": "<%~ include('stand-get-auth-token', it) %>\n",
@@ -3783,8 +3772,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3783
3772
  "../../project-templates/stand/angular/esbuild/tsconfig.json.eta": "{\n \"compileOnSave\": false,\n \"compilerOptions\": {\n \"outDir\": \"./dist/out-tsc\",\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"skipLibCheck\": true,\n \"isolatedModules\": true,\n \"esModuleInterop\": true,\n \"experimentalDecorators\": true,\n \"moduleResolution\": \"bundler\",\n \"importHelpers\": true,\n \"target\": \"ES2022\",\n \"module\": \"ES2022\",\n \"lib\": [\"ES2022\", \"dom\"],\n \"useDefineForClassFields\": false\n },\n \"angularCompilerOptions\": {\n \"enableI18nLegacyMessageIdFormat\": false,\n \"strictInjectionParameters\": true,\n \"strictInputAccessModifiers\": true,\n \"strictTemplates\": true\n }\n}\n",
3784
3773
  "../../project-templates/stand/angular/esbuild/tsconfig.middleware.json.eta": "{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\"node\"],\n \"moduleResolution\": \"bundler\"\n },\n \"include\": [\"scripts/devStorageMiddleware.ts\", \"scripts/standDevMiddleware.ts\"]\n}\n",
3785
3774
  "../../project-templates/stand/angular/webpack/README.md.eta": "<%~ include('stand-readme', it) %>\n",
3786
- "../../project-templates/stand/angular/webpack/angular.json.eta": "{\n \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n \"version\": 1,\n \"newProjectRoot\": \"projects\",\n \"projects\": {\n \"angular-host\": {\n \"projectType\": \"application\",\n \"root\": \"\",\n \"sourceRoot\": \"src\",\n \"prefix\": \"app\",\n \"architect\": {\n \"build\": {\n \"builder\": \"@angular-builders/custom-webpack:browser\",\n \"options\": {\n \"customWebpackConfig\": {\n \"path\": \"./custom-webpack.config.cjs\"\n },\n \"outputPath\": \"dist/angular-host\",\n \"index\": \"src/index.html\",\n \"main\": \"src/main.ts\",\n \"polyfills\": [\"src/polyfills.ts\"],\n \"tsConfig\": \"tsconfig.app.json\",\n \"assets\": [\n {\n \"glob\": \"**/*\",\n \"input\": \"public\"\n },\n {\n \"glob\": \"serve.json\",\n \"input\": \".\",\n \"output\": \".\"\n },\n {\n \"glob\": \"**/*\",\n \"input\": \"node_modules/<%~ it.packageName %>\",\n \"output\": \"<%~ it.standAngularProductAssetsOutput %>\",\n \"ignore\": [\n \"*.md\",\n \"*.ts\",\n \"*.d.ts\",\n \"*.json\",\n \"*.ico\",\n \"*.pot\",\n \"*.npmignore\",\n \"*.gitignore\",\n \"robots.txt\",\n \"webpack/**\",\n \"vite/**\",\n \"react/**\"\n ]\n }\n ],\n \"styles\": [\"src/styles.css\"],\n \"scripts\": []\n },\n \"configurations\": {\n \"production\": {\n \"budgets\": [\n {\n \"type\": \"initial\",\n \"maximumWarning\": \"8mb\",\n \"maximumError\": \"16mb\"\n }\n ],\n \"outputHashing\": \"bundles\",\n \"optimization\": true,\n \"sourceMap\": false,\n \"namedChunks\": false,\n \"extractLicenses\": true\n },\n \"development\": {\n \"optimization\": false,\n \"extractLicenses\": false,\n \"sourceMap\": true,\n \"namedChunks\": true\n }\n },\n \"defaultConfiguration\": \"development\"\n },\n \"serve\": {\n \"builder\": \"@angular-builders/custom-webpack:dev-server\",\n \"configurations\": {\n \"production\": {\n \"buildTarget\": \"angular-host:build:production\"\n },\n \"development\": {\n \"buildTarget\": \"angular-host:build:development\"\n }\n },\n \"defaultConfiguration\": \"development\"\n }\n }\n }\n }\n}\n",
3787
- "../../project-templates/stand/angular/webpack/custom-webpack.config.cjs.eta": "const { register } = require('tsx/cjs/api');\n\nfunction resolveDefaultExport(mod) {\n return mod && typeof mod === 'object' && 'default' in mod ? mod.default : mod;\n}\n\nconst hostWebpackPluginModule = require('<%~ it.packageName %>/webpack');\nconst <%= it.standWebpackPluginClassName %> = resolveDefaultExport(hostWebpackPluginModule);\n\nregister();\nconst devStorageMiddleware = resolveDefaultExport(require('./scripts/devStorageMiddleware.ts'));\nconst { mergeHostEditorDevServer } = require('./scripts/hostDevServerHeaders.ts');\n\n/**\n * Production graph for Angular + custom-webpack: scope hoisting and vendor split.\n */\nfunction applyProductionConcatAndVendorSplit(config) {\n config.optimization = config.optimization || {};\n config.optimization.concatenateModules = true;\n\n const existingSplitChunks = config.optimization.splitChunks;\n const splitChunksObject =\n existingSplitChunks && typeof existingSplitChunks === 'object' && !Array.isArray(existingSplitChunks)\n ? existingSplitChunks\n : {};\n const existingCacheGroups =\n splitChunksObject.cacheGroups && typeof splitChunksObject.cacheGroups === 'object'\n ? splitChunksObject.cacheGroups\n : {};\n\n config.optimization.splitChunks = {\n ...splitChunksObject,\n cacheGroups: {\n ...existingCacheGroups,\n vendors: {\n ...(existingCacheGroups.vendors && typeof existingCacheGroups.vendors === 'object'\n ? existingCacheGroups.vendors\n : {}),\n test: /[\\\\/]node_modules[\\\\/]/,\n name: 'vendors',\n chunks: 'all',\n minSize: 0,\n priority: 10,\n enforce: true,\n },\n },\n };\n}\n\n/**\n * Typical Angular CustomWebpack host integration:\n * - CustomWebpack merge (Angular builder)\n * - output.publicPath: 'auto'\n * - scope hoisting (concatenateModules) + vendor split in production\n * - <%= it.standWebpackPluginClassName %> copies product assets + injects host publicPath bootstrap\n *\n * Repro (`STAND_REBUNDLE_REPRO=1`): the host plugin is off, so the bootstrap self-detects inside\n * the thin facade (~0.4 MB static closure in the lazy chunk). The rest of static/esm is copied\n * into embed/ at runtime and stays out of the compile graph.\n *\n * Mutate `config` in place — do not webpack-merge `module.rules` (breaks Angular style pipeline).\n */\nmodule.exports = (config, options) => {\n const rebundleRepro = process.env.STAND_REBUNDLE_REPRO === '1';\n const isProd =\n options?.configuration === 'production' ||\n config.mode === 'production';\n\n const apiProxy = {\n context: ['/api'],\n target: <%~ JSON.stringify(it.standOpenApiBaseUrl) %>,\n secure: false,\n changeOrigin: true,\n onProxyReq: (proxyReq) => {\n proxyReq.setHeader('origin', <%~ JSON.stringify(it.standOpenApiOrigin) %>);\n },\n };\n\n config.module.rules.push({\n test: /\\.html$/i,\n resourceQuery: /raw/,\n type: 'asset/source',\n });\n\n config.output.publicPath = 'auto';\n if (isProd) {\n applyProductionConcatAndVendorSplit(config);\n }\n if (!rebundleRepro) {\n config.plugins.push(new <%= it.standWebpackPluginClassName %>());\n }\n\n const prevSetupMiddlewares = config.devServer?.setupMiddlewares;\n config.devServer = {\n ...(config.devServer || {}),\n proxy: [\n ...(Array.isArray(config.devServer?.proxy) ? config.devServer.proxy : []),\n apiProxy,\n ],\n setupMiddlewares: (middlewares, devServer) => {\n devServer.app?.use(devStorageMiddleware());\n return typeof prevSetupMiddlewares === 'function'\n ? prevSetupMiddlewares(middlewares, devServer)\n : middlewares;\n },\n };\n mergeHostEditorDevServer(config);\n\n return config;\n};\n",
3775
+ "../../project-templates/stand/angular/webpack/angular.json.eta": "{\n \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n \"version\": 1,\n \"newProjectRoot\": \"projects\",\n \"projects\": {\n \"angular-host\": {\n \"projectType\": \"application\",\n \"root\": \"\",\n \"sourceRoot\": \"src\",\n \"prefix\": \"app\",\n \"architect\": {\n \"build\": {\n \"builder\": \"@angular-builders/custom-webpack:browser\",\n \"options\": {\n \"customWebpackConfig\": {\n \"path\": \"./webpack.config.js\"\n },\n \"outputPath\": \"dist/angular-host\",\n \"index\": \"src/index.html\",\n \"main\": \"src/main.ts\",\n \"polyfills\": \"src/polyfills.ts\",\n \"tsConfig\": \"tsconfig.app.json\",\n \"assets\": [\n {\n \"glob\": \"**/*\",\n \"input\": \"public\"\n },\n {\n \"glob\": \"serve.json\",\n \"input\": \".\",\n \"output\": \".\"\n }\n ],\n \"styles\": [\"src/styles.css\"],\n \"scripts\": []\n },\n \"configurations\": {\n \"production\": {\n \"budgets\": [\n {\n \"type\": \"initial\",\n \"maximumWarning\": \"8mb\",\n \"maximumError\": \"16mb\"\n }\n ],\n \"optimization\": {\n \"scripts\": true,\n \"styles\": {\n \"minify\": true,\n \"inlineCritical\": false\n },\n \"fonts\": true\n },\n \"outputHashing\": \"all\",\n \"sourceMap\": false,\n \"namedChunks\": false,\n \"extractLicenses\": true,\n \"vendorChunk\": false,\n \"buildOptimizer\": true\n },\n \"development\": {\n \"buildOptimizer\": false,\n \"optimization\": false,\n \"vendorChunk\": true,\n \"extractLicenses\": false,\n \"sourceMap\": true,\n \"namedChunks\": true\n },\n \"local\": {\n \"buildOptimizer\": false,\n \"optimization\": false,\n \"vendorChunk\": true,\n \"extractLicenses\": false,\n \"sourceMap\": true,\n \"namedChunks\": true\n }\n },\n \"defaultConfiguration\": \"production\"\n },\n \"serve\": {\n \"builder\": \"@angular-builders/custom-webpack:dev-server\",\n \"options\": {\n \"buildTarget\": \"angular-host:build:local\"\n },\n \"configurations\": {\n \"production\": {\n \"buildTarget\": \"angular-host:build:production\"\n },\n \"development\": {\n \"buildTarget\": \"angular-host:build:development\"\n }\n }\n }\n }\n }\n }\n}\n",
3788
3776
  "../../project-templates/stand/angular/webpack/package.json.eta": "<%~ include('stand-package-json', it) %>\n",
3789
3777
  "../../project-templates/stand/angular/webpack/scripts/chunkRepro.cjs.eta": "#!/usr/bin/env node\n/**\n * Cross-origin chunk repro: HTML on :4200, JS chunks on :4201.\n * Lazy chunk import.meta.url points at the CDN host; product assets stay on the page\n * origin (panel/<app>/).\n * Compile graph: thin facade only (~0.4 MB); static/esm is copied into panel/, not bundled.\n *\n * Usage: npm run build:rebundle && npm run serve:chunk-repro\n */\nconst http = require('node:http');\nconst https = require('node:https');\nconst fs = require('node:fs');\nconst path = require('node:path');\nconst { URL } = require('node:url');\n\nconst API_PROXY_ENABLED = <%= it.standClosedLoop ? 'false' : 'true' %>;\nconst API_TARGET = <%~ JSON.stringify(it.standOpenApiBaseUrl) %>;\nconst API_ORIGIN = <%~ JSON.stringify(it.standOpenApiOrigin) %>;\nconst SITE_PORT = 4200;\nconst CDN_PORT = 4201;\nconst DIST_RELATIVE = <%~ JSON.stringify(it.standAngularChunkReproDistRelative) %>;\n\nconst MIME = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'text/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.png': 'image/png',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n};\n\nconst STATIC_HEADERS = {\n 'Cross-Origin-Resource-Policy': 'cross-origin',\n 'Access-Control-Allow-Origin': '*',\n};\n\nfunction contentType(filePath) {\n return MIME[path.extname(filePath).toLowerCase()] || 'application/octet-stream';\n}\n\nfunction resolveFile(distDir, requestPath) {\n const safe = path.normalize(requestPath).replace(/^(\\.\\.[/\\\\])+/, '');\n const candidate = path.join(distDir, safe);\n if (!candidate.startsWith(distDir)) return null;\n if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;\n return null;\n}\n\nfunction patchIndexHtml(html, cdnOrigin) {\n return html.replace(\n /(<script\\b[^>]*\\ssrc=\")(?!https?:|\\/\\/)([^\"]+)\"/gi,\n (_, prefix, src) => `${prefix}${cdnOrigin}/${src.replace(/^\\//, '')}\"`,\n );\n}\n\nfunction readRequestBody(req) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n req.on('data', (chunk) => chunks.push(chunk));\n req.on('end', () => resolve(Buffer.concat(chunks)));\n req.on('error', reject);\n });\n}\n\nfunction buildProxyRequestHeaders(req, targetUrl, bodyLength) {\n const headers = { ...req.headers, host: targetUrl.host };\n if (headers.origin) {\n headers.origin = API_ORIGIN;\n }\n delete headers.connection;\n delete headers['transfer-encoding'];\n if (bodyLength > 0) {\n headers['content-length'] = String(bodyLength);\n } else {\n delete headers['content-length'];\n }\n return headers;\n}\n\nfunction drainResponse(proxyRes) {\n return new Promise((resolve) => {\n proxyRes.on('end', resolve);\n proxyRes.resume();\n });\n}\n\nfunction proxyApiRequest(req, res, targetUrl, body, redirectCount, method) {\n const MAX_REDIRECTS = 5;\n if (redirectCount > MAX_REDIRECTS) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Too many redirects');\n return;\n }\n\n const requestMethod = method || req.method || 'GET';\n const transport = targetUrl.protocol === 'https:' ? https : http;\n const headers = buildProxyRequestHeaders(req, targetUrl, body.length);\n\n const proxyReq = transport.request(\n targetUrl,\n { method: requestMethod, headers },\n (proxyRes) => {\n const status = proxyRes.statusCode || 502;\n const location = proxyRes.headers.location;\n if (status >= 300 && status < 400 && location) {\n drainResponse(proxyRes).then(() => {\n const nextUrl = new URL(location, targetUrl);\n const useGet = status === 303;\n proxyApiRequest(\n req,\n res,\n nextUrl,\n useGet ? Buffer.alloc(0) : body,\n redirectCount + 1,\n useGet ? 'GET' : requestMethod,\n );\n });\n return;\n }\n\n const outHeaders = { ...proxyRes.headers };\n delete outHeaders.location;\n res.writeHead(status, outHeaders);\n proxyRes.pipe(res);\n },\n );\n\n proxyReq.on('error', (error) => {\n console.error('[chunkRepro] API proxy error:', error.message);\n if (!res.headersSent) {\n res.writeHead(502, { 'Content-Type': 'text/plain; charset=utf-8' });\n res.end('Bad Gateway');\n }\n });\n\n if (body.length > 0) {\n proxyReq.write(body);\n }\n proxyReq.end();\n}\n\nasync function proxyApi(req, res) {\n const body = await readRequestBody(req);\n const targetUrl = new URL(req.url || '/', API_TARGET);\n proxyApiRequest(req, res, targetUrl, body, 0);\n}\n\nfunction createStaticServer(distDir, port, options = {}) {\n const { patchIndex = false, cdnOrigin = '' } = options;\n\n return http.createServer((req, res) => {\n const url = new URL(req.url || '/', `http://127.0.0.1:${port}`);\n const pathname = decodeURIComponent(url.pathname);\n\n if (patchIndex && API_PROXY_ENABLED && pathname.startsWith('/api')) {\n proxyApi(req, res);\n return;\n }\n\n let filePath = resolveFile(distDir, pathname === '/' ? '/index.html' : pathname);\n\n if (!filePath) {\n res.writeHead(404, STATIC_HEADERS);\n res.end('Not found');\n return;\n }\n\n if (patchIndex && filePath.endsWith('index.html')) {\n const raw = fs.readFileSync(filePath, 'utf8');\n res.writeHead(200, { ...STATIC_HEADERS, 'Content-Type': 'text/html; charset=utf-8' });\n res.end(patchIndexHtml(raw, cdnOrigin));\n return;\n }\n\n res.writeHead(200, { ...STATIC_HEADERS, 'Content-Type': contentType(filePath) });\n fs.createReadStream(filePath).pipe(res);\n }).listen(port, () => {\n console.log(`[chunkRepro] ${patchIndex ? 'site' : 'cdn'} → http://localhost:${port}/`);\n if (patchIndex && API_PROXY_ENABLED) {\n console.log(`[chunkRepro] /api → ${API_TARGET}`);\n }\n });\n}\n\nconst distDir = path.resolve(process.cwd(), DIST_RELATIVE);\nif (!fs.existsSync(path.join(distDir, 'index.html'))) {\n console.error(`[chunkRepro] Missing ${DIST_RELATIVE}/index.html — run \\`npm run build:rebundle\\` first.`);\n process.exit(1);\n}\n\nconst cdnOrigin = `http://localhost:${CDN_PORT}`;\ncreateStaticServer(distDir, CDN_PORT);\ncreateStaticServer(distDir, SITE_PORT, { patchIndex: true, cdnOrigin });\n\nconsole.log('[chunkRepro] Open http://localhost:4200/ — check Network + console [publicPath-diag]');\n",
3790
3778
  "../../project-templates/stand/angular/webpack/scripts/devStorageMiddleware.ts.eta": "<%~ include('stand-dev-storage-middleware', it) %>\n",
@@ -3795,7 +3783,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3795
3783
  "../../project-templates/stand/angular/webpack/src/app/app.component.html.eta": "<main class=\"page\">\n @if (initError()) {\n <p class=\"error\">Editor failed: {{ initError() }}</p>\n }\n @if (publicPathDiag()) {\n <pre class=\"diag\">{{ publicPathDiag() }}</pre>\n }\n <div id=\"editor-root\" class=\"editor-mount\"></div>\n</main>\n",
3796
3784
  "../../project-templates/stand/angular/webpack/src/app/app.component.ts.eta": "import { Component, AfterViewInit, signal } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport type { PublicPathDiagSnapshot } from '../../scripts/publicPathDiagnostics';\n\ntype DiagBag = { __standPublicPathDiagnostics?: PublicPathDiagSnapshot[] };\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css',\n})\nexport class AppComponent implements AfterViewInit {\n readonly initError = signal<string | null>(null);\n readonly publicPathDiag = signal<string | null>(null);\n\n ngAfterViewInit(): void {\n import('./editor-host')\n .then(({ initOAuthEditor }) => initOAuthEditor())\n .then(() => {\n const bag = window as unknown as DiagBag;\n const last = bag.__standPublicPathDiagnostics?.at(-1);\n if (last) {\n this.publicPathDiag.set(JSON.stringify(last, null, 2));\n }\n })\n .catch((error) => {\n this.initError.set(error instanceof Error ? error.message : String(error));\n });\n }\n}\n",
3797
3785
  "../../project-templates/stand/angular/webpack/src/app/app.config.ts.eta": "import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\n\nexport const appConfig: ApplicationConfig = {\n providers: [provideZoneChangeDetection({ eventCoalescing: true })],\n};\n",
3798
- "../../project-templates/stand/angular/webpack/src/app/editor-host.ts.eta": "import baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\nimport { snapshotPublicPathDiagnostics } from '../../scripts/publicPathDiagnostics';\n\n<%~ include('editor-init-smoke', it) %>\n\ntype EmailmakerModule = typeof import('<%~ it.packageName %>');\ntype EditorInstance = Awaited<ReturnType<EmailmakerModule['init']>>;\n\nlet editorInstance: EditorInstance | null = null;\n\nconst smokeMeta = {\n hostKind: 'stand-host' as const,\n variant: 'stand-angular',\n mountLabel: '#editor-root',\n};\n\nasync function loadEmailmakerModule(): Promise<EmailmakerModule> {\n return import('<%~ it.packageName %>');\n}\n\nfunction formatInitError(error: unknown): string {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n if (typeof error === 'string' && error.trim()) {\n return error.trim();\n }\n return 'Editor initialization failed.';\n}\n\nexport async function initOAuthEditor(): Promise<EditorInstance> {\n if (editorInstance) {\n return editorInstance;\n }\n\n const mountElement = document.getElementById('editor-root');\n snapshotPublicPathDiagnostics('before-emailmaker-import');\n const <%= it.standProductApiName %> = await loadEmailmakerModule();\n snapshotPublicPathDiagnostics('after-emailmaker-import');\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n\n editorInstance = instance;\n reportEditorReady(smokeMeta, mountElement);\n return instance;\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement) ?? formatInitError(error);\n throw new Error(message);\n }\n}\n",
3786
+ "../../project-templates/stand/angular/webpack/src/app/editor-host.ts.eta": "import baseEmailHtml from '../dev/email.html?raw';\nimport { editorConfig } from '../dev/editorConfig';\nimport { getAuthToken } from '../dev/getAuthToken';\nimport { createLocalFolderStorageProvider } from '../dev/storageProvider';\nimport { snapshotPublicPathDiagnostics } from '../../scripts/publicPathDiagnostics';\n\n<%~ include('stand-demo-email-id', it) %>\n<%~ include('editor-init-smoke', it) %>\n\ntype EmailmakerModule = typeof import('<%~ it.packageName %>');\ntype EditorInstance = Awaited<ReturnType<EmailmakerModule['init']>>;\n\nlet editorInstance: EditorInstance | null = null;\n\nconst smokeMeta = {\n hostKind: 'stand-host' as const,\n variant: 'stand-angular',\n mountLabel: '#editor-root',\n};\n\nasync function loadEmailmakerModule(): Promise<EmailmakerModule> {\n return import('<%~ it.packageName %>');\n}\n\nfunction formatInitError(error: unknown): string {\n if (error instanceof Error && error.message) {\n return error.message;\n }\n if (typeof error === 'string' && error.trim()) {\n return error.trim();\n }\n return 'Editor initialization failed.';\n}\n\nexport async function initOAuthEditor(): Promise<EditorInstance> {\n if (editorInstance) {\n return editorInstance;\n }\n\n const mountElement = document.getElementById('editor-root');\n snapshotPublicPathDiagnostics('before-emailmaker-import');\n const <%= it.standProductApiName %> = await loadEmailmakerModule();\n snapshotPublicPathDiagnostics('after-emailmaker-import');\n\n try {\n const instance = await <%= it.standProductApiName %>.init({\n getAuthToken,\n storageProvider: createLocalFolderStorageProvider(),\n element: '#editor-root',\n content: {\n email: {\n id: createDemoEmailId(),\n title: <%~ JSON.stringify(it.devHostDemoTitle) %>,\n code: baseEmailHtml,\n },\n },\n config: editorConfig,\n });\n\n editorInstance = instance;\n reportEditorReady(smokeMeta, mountElement);\n return instance;\n } catch (error) {\n const message = reportEditorInitError(smokeMeta, error, mountElement) ?? formatInitError(error);\n throw new Error(message);\n }\n}\n",
3799
3787
  "../../project-templates/stand/angular/webpack/src/dev/editorConfig.ts.eta": "<%~ include('stand-editor-config', it) %>\n",
3800
3788
  "../../project-templates/stand/angular/webpack/src/dev/email.html.eta": "<%~ include('stand-dev-email', it) %>\n",
3801
3789
  "../../project-templates/stand/angular/webpack/src/dev/getAuthToken.ts.eta": "<%~ include('stand-get-auth-token', it) %>\n",
@@ -3803,11 +3791,12 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
3803
3791
  "../../project-templates/stand/angular/webpack/src/dev/storageProvider.ts.eta": "<%~ include('stand-storage-provider', it) %>\n",
3804
3792
  "../../project-templates/stand/angular/webpack/src/index.html.eta": "<!doctype html>\n<html lang=\"<%~ it.standIndexHtmlLang %>\">\n <head>\n <meta charset=\"utf-8\" />\n <title><%~ it.standIndexHtmlTitle %></title>\n <base href=\"/\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <app-root></app-root>\n </body>\n</html>\n",
3805
3793
  "../../project-templates/stand/angular/webpack/src/main.ts.eta": "import { bootstrapApplication } from '@angular/platform-browser';\nimport { AppComponent } from './app/app.component';\nimport { appConfig } from './app/app.config';\n\nbootstrapApplication(AppComponent, appConfig).catch((error) => {\n console.error('[angular-stand] bootstrap failed', error);\n});\n",
3806
- "../../project-templates/stand/angular/webpack/src/polyfills.ts.eta": "import '../scripts/publicPath-shim';\nimport 'zone.js';\n",
3794
+ "../../project-templates/stand/angular/webpack/src/polyfills.ts.eta": "import 'zone.js';\n",
3807
3795
  "../../project-templates/stand/angular/webpack/src/styles.css": "body {\n margin: 0;\n background: #fff;\n color: #101828;\n}\n\ncode {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.92em;\n}\n",
3808
3796
  "../../project-templates/stand/angular/webpack/src/types.d.ts": "declare module '*?raw' {\n const content: string;\n export default content;\n}\n",
3809
3797
  "../../project-templates/stand/angular/webpack/tsconfig.app.json.eta": "{\n \"extends\": \"./tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"./out-tsc/app\",\n \"types\": []\n },\n \"files\": [\"src/main.ts\", \"src/polyfills.ts\"],\n \"include\": [\"src/**/*.d.ts\", \"src/**/*.ts\", \"scripts/publicPathDiagnostics.ts\"]\n}\n",
3810
3798
  "../../project-templates/stand/angular/webpack/tsconfig.json.eta": "{\n \"compileOnSave\": false,\n \"compilerOptions\": {\n \"outDir\": \"./dist/out-tsc\",\n \"strict\": true,\n \"noImplicitOverride\": true,\n \"noPropertyAccessFromIndexSignature\": true,\n \"noImplicitReturns\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"skipLibCheck\": true,\n \"isolatedModules\": true,\n \"esModuleInterop\": true,\n \"experimentalDecorators\": true,\n \"moduleResolution\": \"bundler\",\n \"importHelpers\": true,\n \"target\": \"ES2022\",\n \"module\": \"ES2022\",\n \"lib\": [\"ES2022\", \"dom\"],\n \"useDefineForClassFields\": false\n },\n \"angularCompilerOptions\": {\n \"enableI18nLegacyMessageIdFormat\": false,\n \"strictInjectionParameters\": true,\n \"strictInputAccessModifiers\": true,\n \"strictTemplates\": true\n }\n}\n",
3799
+ "../../project-templates/stand/angular/webpack/webpack.config.js.eta": "const { register } = require('tsx/cjs/api');\n\nfunction resolveDefaultExport(mod) {\n return mod && typeof mod === 'object' && 'default' in mod ? mod.default : mod;\n}\n\nconst hostWebpackPluginModule = require('<%~ it.packageName %>/webpack');\nconst <%= it.standWebpackPluginClassName %> = resolveDefaultExport(hostWebpackPluginModule);\n\nregister();\nconst devStorageMiddleware = resolveDefaultExport(require('./scripts/devStorageMiddleware.ts'));\nconst { mergeHostEditorDevServer } = require('./scripts/hostDevServerHeaders.ts');\n\n/**\n * Client repro graph only (`STAND_REBUNDLE_REPRO=1`): scope hoisting + forced vendor split.\n * Do NOT apply on the default production build — it overrides Angular splitChunks and breaks\n * bootstrap (scripts load out of order → blank page, ngAfterViewInit never runs).\n */\nfunction applyProductionConcatAndVendorSplit(config) {\n config.optimization = config.optimization || {};\n config.optimization.concatenateModules = true;\n\n const existingSplitChunks = config.optimization.splitChunks;\n const splitChunksObject =\n existingSplitChunks && typeof existingSplitChunks === 'object' && !Array.isArray(existingSplitChunks)\n ? existingSplitChunks\n : {};\n const existingCacheGroups =\n splitChunksObject.cacheGroups && typeof splitChunksObject.cacheGroups === 'object'\n ? splitChunksObject.cacheGroups\n : {};\n\n config.optimization.splitChunks = {\n ...splitChunksObject,\n cacheGroups: {\n ...existingCacheGroups,\n vendors: {\n ...(existingCacheGroups.vendors && typeof existingCacheGroups.vendors === 'object'\n ? existingCacheGroups.vendors\n : {}),\n test: /[\\\\/]node_modules[\\\\/]/,\n name: 'vendors',\n chunks: 'all',\n minSize: 0,\n priority: 10,\n enforce: true,\n },\n },\n };\n}\n\n/**\n * Client-like Angular host integration (webpack.config.js + custom-webpack:browser).\n * Host plugin copies product assets and injects publicPath bootstrap into the facade chunk.\n *\n * Repro (`STAND_REBUNDLE_REPRO=1`): host plugin off — publish bootstrap self-detects via import.meta.url.\n *\n * Mutate `config` in place — do not webpack-merge `module.rules` (breaks Angular style pipeline).\n */\nmodule.exports = (config, options) => {\n const rebundleRepro = process.env.STAND_REBUNDLE_REPRO === '1';\n const isProd =\n options?.configuration === 'production' ||\n config.mode === 'production';\n\n const apiProxy = {\n context: ['/api'],\n target: <%~ JSON.stringify(it.standOpenApiBaseUrl) %>,\n secure: false,\n changeOrigin: true,\n onProxyReq: (proxyReq) => {\n proxyReq.setHeader('origin', <%~ JSON.stringify(it.standOpenApiOrigin) %>);\n },\n };\n\n config.module.rules.push({\n test: /\\.html$/i,\n resourceQuery: /raw/,\n type: 'asset/source',\n });\n\n config.output.publicPath = 'auto';\n if (isProd && rebundleRepro) {\n applyProductionConcatAndVendorSplit(config);\n }\n if (!rebundleRepro) {\n config.plugins.push(\n new <%= it.standWebpackPluginClassName %>({\n logLevel: 'info',\n }),\n );\n }\n\n const prevSetupMiddlewares = config.devServer?.setupMiddlewares;\n config.devServer = {\n ...(config.devServer || {}),\n proxy: [\n ...(Array.isArray(config.devServer?.proxy) ? config.devServer.proxy : []),\n apiProxy,\n ],\n setupMiddlewares: (middlewares, devServer) => {\n devServer.app?.use(devStorageMiddleware());\n return typeof prevSetupMiddlewares === 'function'\n ? prevSetupMiddlewares(middlewares, devServer)\n : middlewares;\n },\n };\n mergeHostEditorDevServer(config);\n\n return config;\n};\n",
3811
3800
  "../../project-templates/stand/closed-loop/vite/README.md.eta": "<%~ include('stand-readme', it) %>\n",
3812
3801
  "../../project-templates/stand/closed-loop/vite/config/dev-host.ts.eta": "<%~ include('stand-dev-host-vite', it) %>\n",
3813
3802
  "../../project-templates/stand/closed-loop/vite/index.html.eta": "<%~ include('stand-vite-index-shell', it) %>\n",
package/package.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "yargs": "^17.5.1"
17
17
  },
18
18
  "name": "useblocks-cli",
19
- "version": "1.1.49"
19
+ "version": "1.1.56"
20
20
  }