useblocks 1.1.46 → 1.1.49
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.BP7EklKo.js +1 -0
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.4N5s3OV-.js +1 -1
- package/monacoeditorwork/css.worker.bundle.js +40524 -40442
- package/monacoeditorwork/editor.worker.bundle.js +9740 -9697
- package/monacoeditorwork/html.worker.bundle.js +50513 -50431
- package/monacoeditorwork/json.worker.bundle.js +14570 -14527
- package/monacoeditorwork/ts.worker.bundle.js +119593 -119455
- package/npm-publish.manifest.json +7 -7
- package/package.json +1 -1
- package/runtime/@ant-design/cssinjs/index.js +1 -1
- package/runtime/@ant-design/icons/index.js +2 -2
- package/runtime/README.md +1 -1
- package/runtime/THIRD_PARTY_LICENSES.txt +70 -42
- package/runtime/antd/index.js +1 -1
- package/runtime/react/index.js +3 -3
- package/runtime/react/jsx-runtime/index.js +1 -1
- package/runtime/react-dom/client/index.js +4 -4
- package/runtime/react-dom/index.js +3 -3
- package/runtime/react-router-dom/index.js +2 -2
- package/singlepage_headless_plugin.html +1 -1
- package/static/core/{cc8f145d.js → 11296a18.js} +55 -55
- package/static/core/{a321a57d.js → 13d197af.js} +26 -26
- package/static/core/13f581cc.js +924 -0
- package/static/core/{90ec6d2b2.js → 1ca5f3772.js} +184 -155
- package/static/core/{b9529b8a.js → 339377b8.js} +16684 -16503
- package/static/core/{6e2d88d5.js → 386cf7b3.js} +3573 -3559
- package/static/core/{6df04323.js → 3b4845f7.js} +537 -518
- package/static/core/{526b23c2.js → 3dea3b87.js} +7 -7
- package/static/core/59023866.js +2090 -0
- package/static/core/{4a2af478.js → 7a229b90.js} +3 -3
- package/static/core/{6b8432a3.js → 8c81db36.js} +3 -3
- package/static/core/{b8b730b2.js → 8e110c69.js} +22 -22
- package/static/core/{35e13192.js → a11c28c2.js} +172 -168
- package/static/core/{9c1c1b89.js → aacf134d.js} +745 -664
- package/static/core/{350eac23.js → acb049cb.js} +1349 -1297
- package/static/core/{cefd6620.js → c59f9731.js} +7640 -6595
- package/static/core/{4eb628d3.js → de79e0c5.js} +3947 -3705
- package/static/core/e7c24fe9.js +649 -0
- package/static/esm/{dab4cdfd.js → 448d4bb0.js} +70 -70
- package/static/esm/{7c5227f0.js → d180c108.js} +50 -47
- package/static/runtime/{DownloadOutlined-CgJ8OpH_.js → DownloadOutlined-Dg_G2xO7.js} +4 -4
- package/static/runtime/client-CfXgU5Vo.js +7580 -0
- package/static/runtime/{defineProperty-B-FyVNQF.js → defineProperty-C_9hhJHt.js} +1 -1
- package/static/runtime/dom-export-CHgQ7Ws9.js +8069 -0
- package/static/runtime/{es-DnZp8dh1.js → es-BPfImJ0x.js} +5 -5
- package/static/runtime/{es-B2DS-PLP.js → es-DcH6fwd6.js} +2 -2
- package/static/runtime/{es-deqzngIL.js → es-_OY-D9g1.js} +2 -2
- package/static/runtime/{jsx-dev-runtime-Wj1_6O79.js → jsx-dev-runtime-DDukXY54.js} +2 -2
- package/static/runtime/jsx-runtime-BodCQYDg.js +22 -0
- package/static/runtime/react-BHNx_xzv.js +290 -0
- package/static/runtime/react-dom-CyByzibb.js +127 -0
- package/two_step_headless_plugin.html +1 -1
- package/{useblocks-core.2116f1b9.js → useblocks-core.15a9129c.js} +82 -76
- package/useblocks-esm.js +628 -3198
- package/useblocks.d.ts +184 -52
- package/useblocks.js +818 -12588
- package/vite/index.cjs +46 -21
- package/vite/index.d.ts +0 -1
- package/vite/index.js +46 -21
- package/vite/pluginDev/index.d.ts +0 -1
- package/webpack/index.cjs +46 -21
- package/webpack/index.d.ts +0 -1
- package/webpack/index.js +46 -21
- package/webpack/pluginDev/index.d.ts +0 -1
- package/iframe/js/amp.CVC2Iq48.js +0 -1
- package/static/core/9421a704.js +0 -869
- package/static/core/9c79239d.js +0 -2063
- package/static/core/df0652cc.js +0 -1119
- package/static/esm/2fb07398.js +0 -3480
- package/static/esm/352121c5.js +0 -55
- package/static/esm/64966e1c.js +0 -18
- package/static/runtime/client-CM3WFcip.js +0 -7
- package/static/runtime/dist-DUS42Hru.js +0 -3421
- package/static/runtime/jsx-runtime-DmPQfqtr.js +0 -28
- package/static/runtime/react-DIf5CLST.js +0 -258
- package/static/runtime/react-dom-Cc3IcUkg.js +0 -5604
- /package/iframe/{iframe-eblock.2116f1b9.html → iframe-eblock.15a9129c.html} +0 -0
- /package/iframe/{iframe.2116f1b9.html → iframe.15a9129c.html} +0 -0
package/vite/index.cjs
CHANGED
|
@@ -92,6 +92,51 @@ async function copyFolder(src, dest, filter) {
|
|
|
92
92
|
}));
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
|
+
//#region src/shared/publicPathResolve.ts
|
|
96
|
+
/**
|
|
97
|
+
* Build-time mirror of build-tools/plugins/shared/publicPathResolve.ts (SSOT).
|
|
98
|
+
* bundler-plugins tsc emits declarations with rootDir = src/, so shared helpers must live here.
|
|
99
|
+
*/
|
|
100
|
+
/** JS-выражение: document.baseURI с fallback на location.href */
|
|
101
|
+
var PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION = `(
|
|
102
|
+
typeof document !== 'undefined' && document.baseURI
|
|
103
|
+
? document.baseURI
|
|
104
|
+
: (typeof window !== 'undefined' && window.location ? window.location.href : '')
|
|
105
|
+
)`;
|
|
106
|
+
/**
|
|
107
|
+
* Тело IIFE для нормализации publicPath в сгенерированном bootstrap-коде.
|
|
108
|
+
* `rawPathExpression` — JS-выражение, дающее сырой путь.
|
|
109
|
+
*/
|
|
110
|
+
function generateNormalizePublicPathBody(rawPathExpression) {
|
|
111
|
+
return `
|
|
112
|
+
var rawPath = ${rawPathExpression};
|
|
113
|
+
if (!rawPath) {
|
|
114
|
+
rawPath = './';
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
var normalizedPath = String(rawPath);
|
|
118
|
+
if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {
|
|
119
|
+
return normalizedPath.charAt(normalizedPath.length - 1) === '/'
|
|
120
|
+
? normalizedPath
|
|
121
|
+
: normalizedPath + '/';
|
|
122
|
+
}
|
|
123
|
+
var baseUrl = ${PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION};
|
|
124
|
+
var resolved = baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;
|
|
125
|
+
return resolved.charAt(resolved.length - 1) === '/'
|
|
126
|
+
? resolved
|
|
127
|
+
: resolved + '/';
|
|
128
|
+
} catch (e) {
|
|
129
|
+
var fallback = String(rawPath);
|
|
130
|
+
return fallback.charAt(fallback.length - 1) === '/'
|
|
131
|
+
? fallback
|
|
132
|
+
: fallback + '/';
|
|
133
|
+
}`.trim();
|
|
134
|
+
}
|
|
135
|
+
function generateNormalizePublicPathIIFE(rawPathExpression) {
|
|
136
|
+
return `(function() {${generateNormalizePublicPathBody(rawPathExpression)}
|
|
137
|
+
})()`;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
95
140
|
//#region src/shared/hostBootstrap.ts
|
|
96
141
|
/**
|
|
97
142
|
* Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
|
|
@@ -123,27 +168,7 @@ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
|
|
|
123
168
|
* `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
|
|
124
169
|
*/
|
|
125
170
|
function createNormalizedPublicPathAssignment(environmentVariable, rawPath) {
|
|
126
|
-
|
|
127
|
-
return [
|
|
128
|
-
`if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = (function() {`,
|
|
129
|
-
` var rawPath = ${literal};`,
|
|
130
|
-
" if (!rawPath) {",
|
|
131
|
-
" rawPath = './';",
|
|
132
|
-
" }",
|
|
133
|
-
" try {",
|
|
134
|
-
" var normalizedPath = String(rawPath);",
|
|
135
|
-
" if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {",
|
|
136
|
-
" return normalizedPath;",
|
|
137
|
-
" }",
|
|
138
|
-
" var baseUrl = typeof document !== 'undefined' && document.baseURI",
|
|
139
|
-
" ? document.baseURI",
|
|
140
|
-
" : (typeof window !== 'undefined' && window.location ? window.location.href : '');",
|
|
141
|
-
" return baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;",
|
|
142
|
-
" } catch (_error) {",
|
|
143
|
-
" return String(rawPath);",
|
|
144
|
-
" }",
|
|
145
|
-
"})();"
|
|
146
|
-
].join(" ");
|
|
171
|
+
return `if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = ${generateNormalizePublicPathIIFE(JSON.stringify(String(rawPath || "")))};`;
|
|
147
172
|
}
|
|
148
173
|
function createInitFragment$1(environmentVariable, publicPath, startupPrefetchMode) {
|
|
149
174
|
return [
|
package/vite/index.d.ts
CHANGED
package/vite/index.js
CHANGED
|
@@ -63,6 +63,51 @@ async function copyFolder(src, dest, filter) {
|
|
|
63
63
|
}));
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
+
//#region src/shared/publicPathResolve.ts
|
|
67
|
+
/**
|
|
68
|
+
* Build-time mirror of build-tools/plugins/shared/publicPathResolve.ts (SSOT).
|
|
69
|
+
* bundler-plugins tsc emits declarations with rootDir = src/, so shared helpers must live here.
|
|
70
|
+
*/
|
|
71
|
+
/** JS-выражение: document.baseURI с fallback на location.href */
|
|
72
|
+
var PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION = `(
|
|
73
|
+
typeof document !== 'undefined' && document.baseURI
|
|
74
|
+
? document.baseURI
|
|
75
|
+
: (typeof window !== 'undefined' && window.location ? window.location.href : '')
|
|
76
|
+
)`;
|
|
77
|
+
/**
|
|
78
|
+
* Тело IIFE для нормализации publicPath в сгенерированном bootstrap-коде.
|
|
79
|
+
* `rawPathExpression` — JS-выражение, дающее сырой путь.
|
|
80
|
+
*/
|
|
81
|
+
function generateNormalizePublicPathBody(rawPathExpression) {
|
|
82
|
+
return `
|
|
83
|
+
var rawPath = ${rawPathExpression};
|
|
84
|
+
if (!rawPath) {
|
|
85
|
+
rawPath = './';
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
var normalizedPath = String(rawPath);
|
|
89
|
+
if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {
|
|
90
|
+
return normalizedPath.charAt(normalizedPath.length - 1) === '/'
|
|
91
|
+
? normalizedPath
|
|
92
|
+
: normalizedPath + '/';
|
|
93
|
+
}
|
|
94
|
+
var baseUrl = ${PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION};
|
|
95
|
+
var resolved = baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;
|
|
96
|
+
return resolved.charAt(resolved.length - 1) === '/'
|
|
97
|
+
? resolved
|
|
98
|
+
: resolved + '/';
|
|
99
|
+
} catch (e) {
|
|
100
|
+
var fallback = String(rawPath);
|
|
101
|
+
return fallback.charAt(fallback.length - 1) === '/'
|
|
102
|
+
? fallback
|
|
103
|
+
: fallback + '/';
|
|
104
|
+
}`.trim();
|
|
105
|
+
}
|
|
106
|
+
function generateNormalizePublicPathIIFE(rawPathExpression) {
|
|
107
|
+
return `(function() {${generateNormalizePublicPathBody(rawPathExpression)}
|
|
108
|
+
})()`;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
66
111
|
//#region src/shared/hostBootstrap.ts
|
|
67
112
|
/**
|
|
68
113
|
* Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
|
|
@@ -94,27 +139,7 @@ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
|
|
|
94
139
|
* `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
|
|
95
140
|
*/
|
|
96
141
|
function createNormalizedPublicPathAssignment(environmentVariable, rawPath) {
|
|
97
|
-
|
|
98
|
-
return [
|
|
99
|
-
`if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = (function() {`,
|
|
100
|
-
` var rawPath = ${literal};`,
|
|
101
|
-
" if (!rawPath) {",
|
|
102
|
-
" rawPath = './';",
|
|
103
|
-
" }",
|
|
104
|
-
" try {",
|
|
105
|
-
" var normalizedPath = String(rawPath);",
|
|
106
|
-
" if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {",
|
|
107
|
-
" return normalizedPath;",
|
|
108
|
-
" }",
|
|
109
|
-
" var baseUrl = typeof document !== 'undefined' && document.baseURI",
|
|
110
|
-
" ? document.baseURI",
|
|
111
|
-
" : (typeof window !== 'undefined' && window.location ? window.location.href : '');",
|
|
112
|
-
" return baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;",
|
|
113
|
-
" } catch (_error) {",
|
|
114
|
-
" return String(rawPath);",
|
|
115
|
-
" }",
|
|
116
|
-
"})();"
|
|
117
|
-
].join(" ");
|
|
142
|
+
return `if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = ${generateNormalizePublicPathIIFE(JSON.stringify(String(rawPath || "")))};`;
|
|
118
143
|
}
|
|
119
144
|
function createInitFragment$1(environmentVariable, publicPath, startupPrefetchMode) {
|
|
120
145
|
return [
|
package/webpack/index.cjs
CHANGED
|
@@ -30,6 +30,51 @@ function toPascalCase(str) {
|
|
|
30
30
|
return `${str}`.toLowerCase().replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/\s+(.)(\w*)/g, (_m, a, b) => `${a.toUpperCase()}${b}`).replace(/\w/, (s) => s.toUpperCase());
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
|
+
//#region src/shared/publicPathResolve.ts
|
|
34
|
+
/**
|
|
35
|
+
* Build-time mirror of build-tools/plugins/shared/publicPathResolve.ts (SSOT).
|
|
36
|
+
* bundler-plugins tsc emits declarations with rootDir = src/, so shared helpers must live here.
|
|
37
|
+
*/
|
|
38
|
+
/** JS-выражение: document.baseURI с fallback на location.href */
|
|
39
|
+
var PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION = `(
|
|
40
|
+
typeof document !== 'undefined' && document.baseURI
|
|
41
|
+
? document.baseURI
|
|
42
|
+
: (typeof window !== 'undefined' && window.location ? window.location.href : '')
|
|
43
|
+
)`;
|
|
44
|
+
/**
|
|
45
|
+
* Тело IIFE для нормализации publicPath в сгенерированном bootstrap-коде.
|
|
46
|
+
* `rawPathExpression` — JS-выражение, дающее сырой путь.
|
|
47
|
+
*/
|
|
48
|
+
function generateNormalizePublicPathBody(rawPathExpression) {
|
|
49
|
+
return `
|
|
50
|
+
var rawPath = ${rawPathExpression};
|
|
51
|
+
if (!rawPath) {
|
|
52
|
+
rawPath = './';
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
var normalizedPath = String(rawPath);
|
|
56
|
+
if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {
|
|
57
|
+
return normalizedPath.charAt(normalizedPath.length - 1) === '/'
|
|
58
|
+
? normalizedPath
|
|
59
|
+
: normalizedPath + '/';
|
|
60
|
+
}
|
|
61
|
+
var baseUrl = ${PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION};
|
|
62
|
+
var resolved = baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;
|
|
63
|
+
return resolved.charAt(resolved.length - 1) === '/'
|
|
64
|
+
? resolved
|
|
65
|
+
: resolved + '/';
|
|
66
|
+
} catch (e) {
|
|
67
|
+
var fallback = String(rawPath);
|
|
68
|
+
return fallback.charAt(fallback.length - 1) === '/'
|
|
69
|
+
? fallback
|
|
70
|
+
: fallback + '/';
|
|
71
|
+
}`.trim();
|
|
72
|
+
}
|
|
73
|
+
function generateNormalizePublicPathIIFE(rawPathExpression) {
|
|
74
|
+
return `(function() {${generateNormalizePublicPathBody(rawPathExpression)}
|
|
75
|
+
})()`;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
33
78
|
//#region src/shared/hostBootstrap.ts
|
|
34
79
|
/**
|
|
35
80
|
* Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
|
|
@@ -61,27 +106,7 @@ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
|
|
|
61
106
|
* `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
|
|
62
107
|
*/
|
|
63
108
|
function createNormalizedPublicPathAssignment(environmentVariable, rawPath) {
|
|
64
|
-
|
|
65
|
-
return [
|
|
66
|
-
`if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = (function() {`,
|
|
67
|
-
` var rawPath = ${literal};`,
|
|
68
|
-
" if (!rawPath) {",
|
|
69
|
-
" rawPath = './';",
|
|
70
|
-
" }",
|
|
71
|
-
" try {",
|
|
72
|
-
" var normalizedPath = String(rawPath);",
|
|
73
|
-
" if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {",
|
|
74
|
-
" return normalizedPath;",
|
|
75
|
-
" }",
|
|
76
|
-
" var baseUrl = typeof document !== 'undefined' && document.baseURI",
|
|
77
|
-
" ? document.baseURI",
|
|
78
|
-
" : (typeof window !== 'undefined' && window.location ? window.location.href : '');",
|
|
79
|
-
" return baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;",
|
|
80
|
-
" } catch (_error) {",
|
|
81
|
-
" return String(rawPath);",
|
|
82
|
-
" }",
|
|
83
|
-
"})();"
|
|
84
|
-
].join(" ");
|
|
109
|
+
return `if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = ${generateNormalizePublicPathIIFE(JSON.stringify(String(rawPath || "")))};`;
|
|
85
110
|
}
|
|
86
111
|
function createInitFragment(environmentVariable, publicPath, startupPrefetchMode) {
|
|
87
112
|
return [
|
package/webpack/index.d.ts
CHANGED
package/webpack/index.js
CHANGED
|
@@ -6,6 +6,51 @@ function toPascalCase(str) {
|
|
|
6
6
|
return `${str}`.toLowerCase().replace(/[-_]+/g, " ").replace(/[^\w\s]/g, "").replace(/\s+(.)(\w*)/g, (_m, a, b) => `${a.toUpperCase()}${b}`).replace(/\w/, (s) => s.toUpperCase());
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
|
+
//#region src/shared/publicPathResolve.ts
|
|
10
|
+
/**
|
|
11
|
+
* Build-time mirror of build-tools/plugins/shared/publicPathResolve.ts (SSOT).
|
|
12
|
+
* bundler-plugins tsc emits declarations with rootDir = src/, so shared helpers must live here.
|
|
13
|
+
*/
|
|
14
|
+
/** JS-выражение: document.baseURI с fallback на location.href */
|
|
15
|
+
var PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION = `(
|
|
16
|
+
typeof document !== 'undefined' && document.baseURI
|
|
17
|
+
? document.baseURI
|
|
18
|
+
: (typeof window !== 'undefined' && window.location ? window.location.href : '')
|
|
19
|
+
)`;
|
|
20
|
+
/**
|
|
21
|
+
* Тело IIFE для нормализации publicPath в сгенерированном bootstrap-коде.
|
|
22
|
+
* `rawPathExpression` — JS-выражение, дающее сырой путь.
|
|
23
|
+
*/
|
|
24
|
+
function generateNormalizePublicPathBody(rawPathExpression) {
|
|
25
|
+
return `
|
|
26
|
+
var rawPath = ${rawPathExpression};
|
|
27
|
+
if (!rawPath) {
|
|
28
|
+
rawPath = './';
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
var normalizedPath = String(rawPath);
|
|
32
|
+
if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {
|
|
33
|
+
return normalizedPath.charAt(normalizedPath.length - 1) === '/'
|
|
34
|
+
? normalizedPath
|
|
35
|
+
: normalizedPath + '/';
|
|
36
|
+
}
|
|
37
|
+
var baseUrl = ${PUBLIC_PATH_RESOLUTION_BASE_EXPRESSION};
|
|
38
|
+
var resolved = baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;
|
|
39
|
+
return resolved.charAt(resolved.length - 1) === '/'
|
|
40
|
+
? resolved
|
|
41
|
+
: resolved + '/';
|
|
42
|
+
} catch (e) {
|
|
43
|
+
var fallback = String(rawPath);
|
|
44
|
+
return fallback.charAt(fallback.length - 1) === '/'
|
|
45
|
+
? fallback
|
|
46
|
+
: fallback + '/';
|
|
47
|
+
}`.trim();
|
|
48
|
+
}
|
|
49
|
+
function generateNormalizePublicPathIIFE(rawPathExpression) {
|
|
50
|
+
return `(function() {${generateNormalizePublicPathBody(rawPathExpression)}
|
|
51
|
+
})()`;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
9
54
|
//#region src/shared/hostBootstrap.ts
|
|
10
55
|
/**
|
|
11
56
|
* Joins an integrator-provided `publicPath` prefix with the product `outputFolder`
|
|
@@ -37,27 +82,7 @@ function joinHostPublicPath(publicPath, outputFolder, defaultOutputFolder) {
|
|
|
37
82
|
* `publicPath` is still unset — plugin-dev must rely on host prepend, not detection.
|
|
38
83
|
*/
|
|
39
84
|
function createNormalizedPublicPathAssignment(environmentVariable, rawPath) {
|
|
40
|
-
|
|
41
|
-
return [
|
|
42
|
-
`if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = (function() {`,
|
|
43
|
-
` var rawPath = ${literal};`,
|
|
44
|
-
" if (!rawPath) {",
|
|
45
|
-
" rawPath = './';",
|
|
46
|
-
" }",
|
|
47
|
-
" try {",
|
|
48
|
-
" var normalizedPath = String(rawPath);",
|
|
49
|
-
" if (/^[a-zA-Z][a-zA-Z\\d+\\-.]*:/.test(normalizedPath) || normalizedPath.indexOf('//') === 0) {",
|
|
50
|
-
" return normalizedPath;",
|
|
51
|
-
" }",
|
|
52
|
-
" var baseUrl = typeof document !== 'undefined' && document.baseURI",
|
|
53
|
-
" ? document.baseURI",
|
|
54
|
-
" : (typeof window !== 'undefined' && window.location ? window.location.href : '');",
|
|
55
|
-
" return baseUrl ? new URL(normalizedPath, baseUrl).href : normalizedPath;",
|
|
56
|
-
" } catch (_error) {",
|
|
57
|
-
" return String(rawPath);",
|
|
58
|
-
" }",
|
|
59
|
-
"})();"
|
|
60
|
-
].join(" ");
|
|
85
|
+
return `if (!window.${environmentVariable}.publicPath) window.${environmentVariable}.publicPath = ${generateNormalizePublicPathIIFE(JSON.stringify(String(rawPath || "")))};`;
|
|
61
86
|
}
|
|
62
87
|
function createInitFragment(environmentVariable, publicPath, startupPrefetchMode) {
|
|
63
88
|
return [
|