@emailmaker/emailmaker 1.1.24 → 1.1.25

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.
@@ -0,0 +1 @@
1
+ __emailmaker__.define(`static/core/b827e0bb.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/957ff2fc.js`],function(e,t,n){e("./354bf8a9.js"),t.default=e("./957ff2fc.js").t});
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title>Two-step flow: design → subject/preheader (headless)</title>
6
- <script id="plugin-script" type="text/javascript" src="emailmaker.js?89101e30"></script>
6
+ <script id="plugin-script" type="text/javascript" src="emailmaker.js?f6a81a2b"></script>
7
7
  <style>
8
8
  body {
9
9
  margin: 0;
package/webpack/index.cjs CHANGED
@@ -31,6 +31,25 @@ function toPascalCase(str) {
31
31
  //#endregion
32
32
  //#region src/shared/hostBootstrap.ts
33
33
  /**
34
+ * Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
35
+ * into the contractual runtime `publicPath` (always trailing-slash terminated).
36
+ *
37
+ * Unlike `path.posix.join`, this preserves the `//` in absolute URLs
38
+ * (`http://localhost:3032` must NOT collapse to `http:/localhost:3032`), so an
39
+ * absolute origin passed in Vite `serve`/`build` reaches the runtime intact.
40
+ *
41
+ * - No `publicPath`: keeps the leading-slash semantics of `outputFolder`
42
+ * (`/product` -> `/product/`, resolved against the host `document.baseURI`).
43
+ * - With `publicPath`: `http://host:3032` + `/product` -> `http://host:3032/product/`.
44
+ */
45
+ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
46
+ const folder = outputFolder != null && outputFolder !== "" ? String(outputFolder) : defaultOutputFolder;
47
+ const base = String(publicPath || "").replace(/\/+$/, "");
48
+ if (!base) return `${folder.replace(/\/+$/, "")}/`;
49
+ const segment = folder.replace(/^\/+/, "").replace(/\/+$/, "");
50
+ return `${(segment ? `${base}/${segment}` : base).replace(/\/+$/, "")}/`;
51
+ }
52
+ /**
34
53
  * Host plugin bootstrap: sets contractual `window.__ns__.publicPath` (e.g. `/product/`)
35
54
  * before product entry runs. Publish bootstrap uses script/meta detection only when
36
55
  * `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
@@ -106,7 +125,7 @@ var BUNDLER_DEFAULT_APP_NAME = "emailmaker";
106
125
  var PLUGIN_NAME = `${toPascalCase(BUNDLER_DEFAULT_APP_NAME)}WebpackPlugin`;
107
126
  var PACKAGE_ENTRY_NAME = `${BUNDLER_DEFAULT_APP_NAME}.js`;
108
127
  var ESM_PACKAGE_ENTRY_NAME = `${BUNDLER_DEFAULT_APP_NAME}-esm.js`;
109
- var DEFAULT_OUTPUT_FOLDER = BUNDLER_DEFAULT_APP_NAME;
128
+ var DEFAULT_OUTPUT_FOLDER = `/${BUNDLER_DEFAULT_APP_NAME}`;
110
129
  var DEFAULT_MODULES_PATH = "node_modules";
111
130
  var DEFAULT_STARTUP_PREFETCH_MODE = "eager";
112
131
  var ENVIRONMENT_VARIABLE = `__${BUNDLER_DEFAULT_APP_NAME}__`;
@@ -189,8 +208,7 @@ var WebpackPlugin = class {
189
208
  apply(compiler) {
190
209
  const rawPub = compiler.options.output.publicPath;
191
210
  const optionsPublicPath = typeof rawPub === "string" ? rawPub : "";
192
- const publicPath = this._publicPath === void 0 ? optionsPublicPath : this._publicPath;
193
- const initFragment = createInitFragment(ENVIRONMENT_VARIABLE, publicPath + (publicPath.endsWith("/") ? "" : "/") + this._outputFolder + "/", this._startupPrefetchMode);
211
+ const initFragment = createInitFragment(ENVIRONMENT_VARIABLE, joinHostPublicPath(this._publicPath === void 0 ? optionsPublicPath : this._publicPath, this._outputFolder, DEFAULT_OUTPUT_FOLDER), this._startupPrefetchMode);
194
212
  const webpack = compiler.webpack;
195
213
  const javascript = webpack.javascript;
196
214
  this._sources = webpack.sources;
package/webpack/index.js CHANGED
@@ -7,6 +7,25 @@ function toPascalCase(str) {
7
7
  //#endregion
8
8
  //#region src/shared/hostBootstrap.ts
9
9
  /**
10
+ * Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
11
+ * into the contractual runtime `publicPath` (always trailing-slash terminated).
12
+ *
13
+ * Unlike `path.posix.join`, this preserves the `//` in absolute URLs
14
+ * (`http://localhost:3032` must NOT collapse to `http:/localhost:3032`), so an
15
+ * absolute origin passed in Vite `serve`/`build` reaches the runtime intact.
16
+ *
17
+ * - No `publicPath`: keeps the leading-slash semantics of `outputFolder`
18
+ * (`/product` -> `/product/`, resolved against the host `document.baseURI`).
19
+ * - With `publicPath`: `http://host:3032` + `/product` -> `http://host:3032/product/`.
20
+ */
21
+ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
22
+ const folder = outputFolder != null && outputFolder !== "" ? String(outputFolder) : defaultOutputFolder;
23
+ const base = String(publicPath || "").replace(/\/+$/, "");
24
+ if (!base) return `${folder.replace(/\/+$/, "")}/`;
25
+ const segment = folder.replace(/^\/+/, "").replace(/\/+$/, "");
26
+ return `${(segment ? `${base}/${segment}` : base).replace(/\/+$/, "")}/`;
27
+ }
28
+ /**
10
29
  * Host plugin bootstrap: sets contractual `window.__ns__.publicPath` (e.g. `/product/`)
11
30
  * before product entry runs. Publish bootstrap uses script/meta detection only when
12
31
  * `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
@@ -82,7 +101,7 @@ var BUNDLER_DEFAULT_APP_NAME = "emailmaker";
82
101
  var PLUGIN_NAME = `${toPascalCase(BUNDLER_DEFAULT_APP_NAME)}WebpackPlugin`;
83
102
  var PACKAGE_ENTRY_NAME = `${BUNDLER_DEFAULT_APP_NAME}.js`;
84
103
  var ESM_PACKAGE_ENTRY_NAME = `${BUNDLER_DEFAULT_APP_NAME}-esm.js`;
85
- var DEFAULT_OUTPUT_FOLDER = BUNDLER_DEFAULT_APP_NAME;
104
+ var DEFAULT_OUTPUT_FOLDER = `/${BUNDLER_DEFAULT_APP_NAME}`;
86
105
  var DEFAULT_MODULES_PATH = "node_modules";
87
106
  var DEFAULT_STARTUP_PREFETCH_MODE = "eager";
88
107
  var ENVIRONMENT_VARIABLE = `__${BUNDLER_DEFAULT_APP_NAME}__`;
@@ -165,8 +184,7 @@ var WebpackPlugin = class {
165
184
  apply(compiler) {
166
185
  const rawPub = compiler.options.output.publicPath;
167
186
  const optionsPublicPath = typeof rawPub === "string" ? rawPub : "";
168
- const publicPath = this._publicPath === void 0 ? optionsPublicPath : this._publicPath;
169
- const initFragment = createInitFragment(ENVIRONMENT_VARIABLE, publicPath + (publicPath.endsWith("/") ? "" : "/") + this._outputFolder + "/", this._startupPrefetchMode);
187
+ const initFragment = createInitFragment(ENVIRONMENT_VARIABLE, joinHostPublicPath(this._publicPath === void 0 ? optionsPublicPath : this._publicPath, this._outputFolder, DEFAULT_OUTPUT_FOLDER), this._startupPrefetchMode);
170
188
  const webpack = compiler.webpack;
171
189
  const javascript = webpack.javascript;
172
190
  this._sources = webpack.sources;
@@ -1 +0,0 @@
1
- __emailmaker__.define(`static/core/8194155c.js`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/28fbe0b6.js`],function(e,t,n){e("./354bf8a9.js"),t.default=e("./28fbe0b6.js").t});