useblocks 1.1.18 → 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.
- package/iframe/js/amp.DAh9j5NQ.js +1 -0
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.B4dVzZIU.js +1 -1
- package/package.json +1 -1
- package/singlepage_headless_plugin.html +1 -1
- package/static/core/{9cff1281.js → 4b2f0647.js} +1 -1
- package/static/core/518d327c.js +1 -0
- package/static/core/{4563fc0f.js → 5abb5c27.js} +1 -1
- package/static/core/{35607bb1.js → 7eb3f045.js} +1 -1
- package/static/core/{d40f545f.js → 9721d8c0.js} +1 -1
- package/static/core/{ae8e0b50.js → 9b1a1232.js} +1 -1
- package/static/core/{5314a021.js → b639c36e.js} +1 -1
- package/static/core/{1f689931.js → b98ddc69.js} +1 -1
- package/static/core/bec00455.js +834 -0
- package/static/core/{509ab76b.js → c52a21ea.js} +1 -1
- package/static/core/{2badccbb.js → c547314f.js} +6 -6
- package/static/core/{f996d4e4.js → d172b1ec.js} +1 -1
- package/static/core/{3a42c130.js → d241e8cb.js} +1 -1
- package/static/core/{dd0f0da5.js → d6d622d8.js} +1 -1
- package/static/esm/{d7803c14.js → bead096a.js} +1 -1
- package/two_step_headless_plugin.html +1 -1
- package/{useblocks-core.4d06f79d.js → useblocks-core.728f1c0e.js} +1 -1
- package/useblocks-esm.js +3 -3
- package/useblocks.js +16 -10
- package/vite/index.cjs +21 -3
- package/vite/index.js +21 -3
- package/webpack/index.cjs +21 -3
- package/webpack/index.js +21 -3
- package/iframe/js/amp.D-Tohkio.js +0 -1
- package/static/core/6bcdbb89.js +0 -1
- package/static/core/7af8064f.js +0 -834
- /package/iframe/{iframe-eblock.4d06f79d.html → iframe-eblock.728f1c0e.html} +0 -0
- /package/iframe/{iframe.4d06f79d.html → iframe.728f1c0e.html} +0 -0
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 = "useblocks";
|
|
|
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
|
|
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;
|