@dcloudio/uni-cli-shared 3.0.0-alpha-4070720250804001 → 3.0.0-alpha-4070620250731002

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 (163) hide show
  1. package/dist/easycom.d.ts +0 -1
  2. package/dist/easycom.js +13 -17
  3. package/dist/hbx/alias.js +10 -43
  4. package/dist/hbx/index.js +0 -10
  5. package/dist/hbx/log.js +1 -23
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -3
  8. package/dist/json/index.d.ts +1 -1
  9. package/dist/json/index.js +1 -2
  10. package/dist/json/manifest.d.ts +0 -1
  11. package/dist/json/manifest.js +1 -11
  12. package/dist/json/mp/jsonFile.js +2 -4
  13. package/dist/json/mp/pages.js +0 -1
  14. package/dist/json/mp/types.d.ts +1 -4
  15. package/dist/json/uni-x/manifest.d.ts +0 -1
  16. package/dist/json/uni-x/manifest.js +1 -5
  17. package/dist/messages/zh_CN.js +0 -1
  18. package/dist/uni_modules.cloud.d.ts +4 -10
  19. package/dist/uni_modules.cloud.js +19 -58
  20. package/dist/uni_modules.d.ts +0 -2
  21. package/dist/uni_modules.js +2 -81
  22. package/dist/uts.js +0 -16
  23. package/dist/vite/autoImport.js +0 -2
  24. package/dist/vite/cloud.js +5 -51
  25. package/dist/vite/plugins/index.d.ts +0 -1
  26. package/dist/vite/plugins/index.js +1 -3
  27. package/dist/vite/plugins/inject.js +1 -3
  28. package/dist/vite/plugins/uts/uni_modules.d.ts +0 -1
  29. package/dist/vite/plugins/uts/uni_modules.js +14 -63
  30. package/dist/vite/plugins/uts/uvue.js +3 -17
  31. package/dist/vite/plugins/vitejs/plugins/css.js +5 -40
  32. package/dist/vue/transforms/transformUTSComponent.js +3 -8
  33. package/package.json +38 -38
  34. package/dist/vite/plugins/stats.d.ts +0 -2
  35. package/dist/vite/plugins/stats.js +0 -42
  36. package/dist/workers.d.ts +0 -14
  37. package/dist/workers.js +0 -187
  38. package/lib/vapor/@vitejs/plugin-vue/LICENSE +0 -21
  39. package/lib/vapor/@vitejs/plugin-vue/README.md +0 -278
  40. package/lib/vapor/@vitejs/plugin-vue/dist/index.cjs +0 -3105
  41. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.cts +0 -113
  42. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.mts +0 -111
  43. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.ts +0 -113
  44. package/lib/vapor/@vitejs/plugin-vue/dist/index.mjs +0 -3090
  45. package/lib/vapor/@vitejs/plugin-vue/package.json +0 -50
  46. package/lib/vapor/@vue/compiler-core/LICENSE +0 -21
  47. package/lib/vapor/@vue/compiler-core/README.md +0 -1
  48. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +0 -6902
  49. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6779
  50. package/lib/vapor/@vue/compiler-core/dist/compiler-core.esm-bundler.js +0 -5870
  51. package/lib/vapor/@vue/compiler-core/index.js +0 -7
  52. package/lib/vapor/@vue/compiler-core/package.json +0 -58
  53. package/lib/vapor/@vue/compiler-dom/LICENSE +0 -21
  54. package/lib/vapor/@vue/compiler-dom/README.md +0 -1
  55. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -936
  56. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -856
  57. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +0 -6682
  58. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +0 -14
  59. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +0 -693
  60. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.js +0 -6855
  61. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.prod.js +0 -14
  62. package/lib/vapor/@vue/compiler-dom/index.js +0 -7
  63. package/lib/vapor/@vue/compiler-dom/package.json +0 -57
  64. package/lib/vapor/@vue/compiler-sfc/LICENSE +0 -21
  65. package/lib/vapor/@vue/compiler-sfc/README.md +0 -80
  66. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -21682
  67. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +0 -66272
  68. package/lib/vapor/@vue/compiler-sfc/package.json +0 -68
  69. package/lib/vapor/@vue/compiler-ssr/LICENSE +0 -21
  70. package/lib/vapor/@vue/compiler-ssr/README.md +0 -1
  71. package/lib/vapor/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1402
  72. package/lib/vapor/@vue/compiler-ssr/package.json +0 -34
  73. package/lib/vapor/@vue/compiler-vapor/LICENSE +0 -21
  74. package/lib/vapor/@vue/compiler-vapor/README.md +0 -1
  75. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +0 -4540
  76. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +0 -37020
  77. package/lib/vapor/@vue/compiler-vapor/package.json +0 -49
  78. package/lib/vapor/@vue/reactivity/LICENSE +0 -21
  79. package/lib/vapor/@vue/reactivity/README.md +0 -19
  80. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.js +0 -2033
  81. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1841
  82. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.js +0 -2023
  83. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.prod.js +0 -5
  84. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -1992
  85. package/lib/vapor/@vue/reactivity/dist/reactivity.global.js +0 -2082
  86. package/lib/vapor/@vue/reactivity/dist/reactivity.global.prod.js +0 -5
  87. package/lib/vapor/@vue/reactivity/index.js +0 -7
  88. package/lib/vapor/@vue/reactivity/package.json +0 -55
  89. package/lib/vapor/@vue/runtime-core/LICENSE +0 -21
  90. package/lib/vapor/@vue/runtime-core/README.md +0 -28
  91. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.js +0 -8972
  92. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -7088
  93. package/lib/vapor/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8913
  94. package/lib/vapor/@vue/runtime-core/index.js +0 -7
  95. package/lib/vapor/@vue/runtime-core/package.json +0 -54
  96. package/lib/vapor/@vue/runtime-dom/LICENSE +0 -21
  97. package/lib/vapor/@vue/runtime-dom/README.md +0 -13
  98. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.js +0 -1797
  99. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1646
  100. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +0 -12929
  101. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +0 -6
  102. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1838
  103. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.js +0 -13086
  104. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.prod.js +0 -6
  105. package/lib/vapor/@vue/runtime-dom/index.js +0 -7
  106. package/lib/vapor/@vue/runtime-dom/package.json +0 -60
  107. package/lib/vapor/@vue/runtime-vapor/LICENSE +0 -21
  108. package/lib/vapor/@vue/runtime-vapor/README.md +0 -8
  109. package/lib/vapor/@vue/runtime-vapor/dist/runtime-vapor.esm-bundler.js +0 -3242
  110. package/lib/vapor/@vue/runtime-vapor/package.json +0 -47
  111. package/lib/vapor/@vue/server-renderer/LICENSE +0 -21
  112. package/lib/vapor/@vue/server-renderer/README.md +0 -178
  113. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.js +0 -1144
  114. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -871
  115. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.js +0 -8756
  116. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +0 -5
  117. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-bundler.js +0 -1366
  118. package/lib/vapor/@vue/server-renderer/index.js +0 -7
  119. package/lib/vapor/@vue/server-renderer/package.json +0 -55
  120. package/lib/vapor/@vue/shared/LICENSE +0 -21
  121. package/lib/vapor/@vue/shared/README.md +0 -3
  122. package/lib/vapor/@vue/shared/dist/shared.cjs.js +0 -698
  123. package/lib/vapor/@vue/shared/dist/shared.cjs.prod.js +0 -690
  124. package/lib/vapor/@vue/shared/dist/shared.esm-bundler.js +0 -616
  125. package/lib/vapor/@vue/shared/index.js +0 -7
  126. package/lib/vapor/@vue/shared/package.json +0 -47
  127. package/lib/vapor/@vue/vue/LICENSE +0 -21
  128. package/lib/vapor/@vue/vue/README.md +0 -62
  129. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.js +0 -1
  130. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.mjs +0 -1
  131. package/lib/vapor/@vue/vue/compiler-sfc/index.d.mts +0 -1
  132. package/lib/vapor/@vue/vue/compiler-sfc/index.d.ts +0 -1
  133. package/lib/vapor/@vue/vue/compiler-sfc/index.js +0 -3
  134. package/lib/vapor/@vue/vue/compiler-sfc/index.mjs +0 -3
  135. package/lib/vapor/@vue/vue/compiler-sfc/package.json +0 -4
  136. package/lib/vapor/@vue/vue/compiler-sfc/register-ts.js +0 -3
  137. package/lib/vapor/@vue/vue/dist/vue.cjs.js +0 -80
  138. package/lib/vapor/@vue/vue/dist/vue.cjs.prod.js +0 -66
  139. package/lib/vapor/@vue/vue/dist/vue.esm-browser.js +0 -18840
  140. package/lib/vapor/@vue/vue/dist/vue.esm-browser.prod.js +0 -12
  141. package/lib/vapor/@vue/vue/dist/vue.esm-bundler.js +0 -72
  142. package/lib/vapor/@vue/vue/dist/vue.global.js +0 -18820
  143. package/lib/vapor/@vue/vue/dist/vue.global.prod.js +0 -12
  144. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.js +0 -15648
  145. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.prod.js +0 -9
  146. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.js +0 -12953
  147. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.prod.js +0 -6
  148. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-bundler.js +0 -29
  149. package/lib/vapor/@vue/vue/dist/vue.runtime.global.js +0 -13111
  150. package/lib/vapor/@vue/vue/dist/vue.runtime.global.prod.js +0 -6
  151. package/lib/vapor/@vue/vue/index.js +0 -7
  152. package/lib/vapor/@vue/vue/index.mjs +0 -1
  153. package/lib/vapor/@vue/vue/jsx-runtime/index.d.ts +0 -25
  154. package/lib/vapor/@vue/vue/jsx-runtime/index.js +0 -15
  155. package/lib/vapor/@vue/vue/jsx-runtime/index.mjs +0 -12
  156. package/lib/vapor/@vue/vue/jsx-runtime/package.json +0 -5
  157. package/lib/vapor/@vue/vue/jsx.d.ts +0 -22
  158. package/lib/vapor/@vue/vue/package.json +0 -114
  159. package/lib/vapor/@vue/vue/server-renderer/index.d.mts +0 -1
  160. package/lib/vapor/@vue/vue/server-renderer/index.d.ts +0 -1
  161. package/lib/vapor/@vue/vue/server-renderer/index.js +0 -1
  162. package/lib/vapor/@vue/vue/server-renderer/index.mjs +0 -1
  163. package/lib/vapor/@vue/vue/server-renderer/package.json +0 -4
@@ -1,1366 +0,0 @@
1
- /**
2
- * @vue/server-renderer v3.6.0-alpha.2
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
- import { createVNode as createVNode$1, ssrUtils, ssrContextKey, warn as warn$2, Fragment as Fragment$1, Static, Comment as Comment$1, Text as Text$1, mergeProps as mergeProps$1, createApp, initDirectivesForSSR } from 'vue';
7
- import { makeMap, isOn, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, escapeHtml, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, isObject, normalizeCssVarValue, toDisplayString, isFunction, EMPTY_OBJ, extend, NOOP, looseEqual, looseIndexOf, escapeHtmlComment, isPromise, isVoidTag } from '@vue/shared';
8
- export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
9
- import { normalizeClass as normalizeClass$1, normalizeStyle as normalizeStyle$1 } from '@dcloudio/uni-shared';
10
-
11
- const shouldIgnoreProp = /* @__PURE__ */ makeMap(
12
- `,key,ref,innerHTML,textContent,ref_key,ref_for`
13
- );
14
- function ssrRenderAttrs(props, tag) {
15
- let ret = "";
16
- for (const key in props) {
17
- if (shouldIgnoreProp(key) || isOn(key) || tag === "textarea" && key === "value") {
18
- continue;
19
- }
20
- const value = props[key];
21
- if (key === "class") {
22
- ret += ` class="${ssrRenderClass(value)}"`;
23
- } else if (key === "style") {
24
- ret += ` style="${ssrRenderStyle(value)}"`;
25
- } else if (key === "className") {
26
- ret += ` class="${String(value)}"`;
27
- } else {
28
- ret += ssrRenderDynamicAttr(key, value, tag);
29
- }
30
- }
31
- return ret;
32
- }
33
- function ssrRenderDynamicAttr(key, value, tag) {
34
- if (!isRenderableAttrValue(value)) {
35
- return ``;
36
- }
37
- const attrKey = tag && (tag.indexOf("-") > 0 || isSVGTag(tag)) ? key : propsToAttrMap[key] || key.toLowerCase();
38
- if (isBooleanAttr(attrKey)) {
39
- return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
40
- } else if (isSSRSafeAttrName(attrKey)) {
41
- return value === "" ? ` ${attrKey}` : ` ${attrKey}="${escapeHtml(value)}"`;
42
- } else {
43
- console.warn(
44
- `[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`
45
- );
46
- return ``;
47
- }
48
- }
49
- function ssrRenderAttr(key, value) {
50
- if (!isRenderableAttrValue(value)) {
51
- return ``;
52
- }
53
- return ` ${key}="${escapeHtml(value)}"`;
54
- }
55
- function ssrRenderClass(raw) {
56
- return escapeHtml(normalizeClass(raw));
57
- }
58
- function ssrRenderStyle(raw) {
59
- if (!raw) {
60
- return "";
61
- }
62
- if (isString(raw)) {
63
- return escapeHtml(raw);
64
- }
65
- const styles = normalizeStyle(ssrResetCssVars(raw));
66
- return escapeHtml(stringifyStyle(styles));
67
- }
68
- function ssrResetCssVars(raw) {
69
- if (!isArray(raw) && isObject(raw)) {
70
- const res = {};
71
- for (const key in raw) {
72
- if (key.startsWith(":--")) {
73
- res[key.slice(1)] = normalizeCssVarValue(raw[key]);
74
- } else {
75
- res[key] = raw[key];
76
- }
77
- }
78
- return res;
79
- }
80
- return raw;
81
- }
82
-
83
- function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
84
- return renderComponentVNode(
85
- createVNode$1(comp, props, children),
86
- parentComponent,
87
- slotScopeId
88
- );
89
- }
90
-
91
- const { ensureValidVNode } = ssrUtils;
92
- function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
93
- push(`<!--[-->`);
94
- ssrRenderSlotInner(
95
- slots,
96
- slotName,
97
- slotProps,
98
- fallbackRenderFn,
99
- push,
100
- parentComponent,
101
- slotScopeId
102
- );
103
- push(`<!--]-->`);
104
- }
105
- function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
106
- const slotFn = slots[slotName];
107
- if (slotFn) {
108
- const slotBuffer = [];
109
- const bufferedPush = (item) => {
110
- slotBuffer.push(item);
111
- };
112
- const ret = slotFn(
113
- slotProps,
114
- bufferedPush,
115
- parentComponent,
116
- slotScopeId ? " " + slotScopeId : ""
117
- );
118
- if (isArray(ret)) {
119
- const validSlotContent = ensureValidVNode(ret);
120
- if (validSlotContent) {
121
- renderVNodeChildren(
122
- push,
123
- validSlotContent,
124
- parentComponent,
125
- slotScopeId
126
- );
127
- } else if (fallbackRenderFn) {
128
- fallbackRenderFn();
129
- }
130
- } else {
131
- let isEmptySlot = true;
132
- if (transition) {
133
- isEmptySlot = false;
134
- } else {
135
- for (let i = 0; i < slotBuffer.length; i++) {
136
- if (!isComment(slotBuffer[i])) {
137
- isEmptySlot = false;
138
- break;
139
- }
140
- }
141
- }
142
- if (isEmptySlot) {
143
- if (fallbackRenderFn) {
144
- fallbackRenderFn();
145
- }
146
- } else {
147
- let start = 0;
148
- let end = slotBuffer.length;
149
- if (transition && slotBuffer[0] === "<!--[-->" && slotBuffer[end - 1] === "<!--]-->") {
150
- start++;
151
- end--;
152
- }
153
- for (let i = start; i < end; i++) {
154
- push(slotBuffer[i]);
155
- }
156
- }
157
- }
158
- } else if (fallbackRenderFn) {
159
- fallbackRenderFn();
160
- }
161
- }
162
- const commentTestRE = /^<!--[\s\S]*-->$/;
163
- const commentRE = /<!--[^]*?-->/gm;
164
- function isComment(item) {
165
- if (typeof item !== "string" || !commentTestRE.test(item)) return false;
166
- if (item.length <= 8) return true;
167
- return !item.replace(commentRE, "").trim();
168
- }
169
-
170
- function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
171
- parentPush("<!--teleport start-->");
172
- const context = parentComponent.appContext.provides[ssrContextKey];
173
- const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
174
- const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
175
- const bufferIndex = targetBuffer.length;
176
- let teleportContent;
177
- if (disabled) {
178
- contentRenderFn(parentPush);
179
- teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
180
- } else {
181
- const { getBuffer, push } = createBuffer();
182
- push(`<!--teleport start anchor-->`);
183
- contentRenderFn(push);
184
- push(`<!--teleport anchor-->`);
185
- teleportContent = getBuffer();
186
- }
187
- targetBuffer.splice(bufferIndex, 0, teleportContent);
188
- parentPush("<!--teleport end-->");
189
- }
190
-
191
- function ssrInterpolate(value) {
192
- return escapeHtml(toDisplayString(value));
193
- }
194
-
195
- let activeSub = void 0;
196
- function setActiveSub(sub) {
197
- try {
198
- return activeSub;
199
- } finally {
200
- activeSub = sub;
201
- }
202
- }
203
-
204
- function isProxy(value) {
205
- return value ? !!value["__v_raw"] : false;
206
- }
207
- function toRaw(observed) {
208
- const raw = observed && observed["__v_raw"];
209
- return raw ? toRaw(raw) : observed;
210
- }
211
-
212
- function isRef(r) {
213
- return r ? r["__v_isRef"] === true : false;
214
- }
215
-
216
- const stack = [];
217
- function pushWarningContext$1(ctx) {
218
- stack.push(ctx);
219
- }
220
- function popWarningContext$1() {
221
- stack.pop();
222
- }
223
- let isWarning = false;
224
- function warn$1(msg, ...args) {
225
- if (isWarning) return;
226
- isWarning = true;
227
- const prevSub = setActiveSub();
228
- const entry = stack.length ? stack[stack.length - 1] : null;
229
- const instance = isVNode$2(entry) ? entry.component : entry;
230
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
231
- const trace = getComponentTrace();
232
- if (appWarnHandler) {
233
- callWithErrorHandling(
234
- appWarnHandler,
235
- instance,
236
- 11,
237
- [
238
- // eslint-disable-next-line no-restricted-syntax
239
- msg + args.map((a) => {
240
- var _a, _b;
241
- return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
242
- }).join(""),
243
- instance && instance.proxy || instance,
244
- trace.map(
245
- ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
246
- ).join("\n"),
247
- trace
248
- ]
249
- );
250
- } else {
251
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
252
- if (trace.length && // avoid spamming console during tests
253
- true) {
254
- warnArgs.push(`
255
- `, ...formatTrace(trace));
256
- }
257
- console.warn(...warnArgs);
258
- }
259
- setActiveSub(prevSub);
260
- isWarning = false;
261
- }
262
- function getComponentTrace() {
263
- let currentCtx = stack[stack.length - 1];
264
- if (!currentCtx) {
265
- return [];
266
- }
267
- const normalizedStack = [];
268
- while (currentCtx) {
269
- const last = normalizedStack[0];
270
- if (last && last.ctx === currentCtx) {
271
- last.recurseCount++;
272
- } else {
273
- normalizedStack.push({
274
- ctx: currentCtx,
275
- recurseCount: 0
276
- });
277
- }
278
- if (isVNode$2(currentCtx)) {
279
- const parent = currentCtx.component && currentCtx.component.parent;
280
- currentCtx = parent && parent.vnode || parent;
281
- } else {
282
- currentCtx = currentCtx.parent;
283
- }
284
- }
285
- return normalizedStack;
286
- }
287
- function formatTrace(trace) {
288
- const logs = [];
289
- trace.forEach((entry, i) => {
290
- logs.push(...i === 0 ? [] : [`
291
- `], ...formatTraceEntry(entry));
292
- });
293
- return logs;
294
- }
295
- function formatTraceEntry({ ctx, recurseCount }) {
296
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
297
- const instance = isVNode$2(ctx) ? ctx.component : ctx;
298
- const isRoot = instance ? instance.parent == null : false;
299
- const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
300
- const close = `>` + postfix;
301
- return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
302
- }
303
- function formatProps(props) {
304
- const res = [];
305
- const keys = Object.keys(props);
306
- keys.slice(0, 3).forEach((key) => {
307
- res.push(...formatProp(key, props[key]));
308
- });
309
- if (keys.length > 3) {
310
- res.push(` ...`);
311
- }
312
- return res;
313
- }
314
- function formatProp(key, value, raw) {
315
- if (isString(value)) {
316
- value = JSON.stringify(value);
317
- return raw ? value : [`${key}=${value}`];
318
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
319
- return raw ? value : [`${key}=${value}`];
320
- } else if (isRef(value)) {
321
- value = formatProp(key, toRaw(value.value), true);
322
- return raw ? value : [`${key}=Ref<`, value, `>`];
323
- } else if (isFunction(value)) {
324
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
325
- } else {
326
- value = toRaw(value);
327
- return raw ? value : [`${key}=`, value];
328
- }
329
- }
330
-
331
- const ErrorTypeStrings = {
332
- ["sp"]: "serverPrefetch hook",
333
- ["bc"]: "beforeCreate hook",
334
- ["c"]: "created hook",
335
- ["bm"]: "beforeMount hook",
336
- ["m"]: "mounted hook",
337
- ["bu"]: "beforeUpdate hook",
338
- ["u"]: "updated",
339
- ["bum"]: "beforeUnmount hook",
340
- ["um"]: "unmounted hook",
341
- ["a"]: "activated hook",
342
- ["da"]: "deactivated hook",
343
- ["ec"]: "errorCaptured hook",
344
- ["rtc"]: "renderTracked hook",
345
- ["rtg"]: "renderTriggered hook",
346
- [0]: "setup function",
347
- [1]: "render function",
348
- [2]: "watcher getter",
349
- [3]: "watcher callback",
350
- [4]: "watcher cleanup function",
351
- [5]: "native event handler",
352
- [6]: "component event handler",
353
- [7]: "vnode hook",
354
- [8]: "directive hook",
355
- [9]: "transition hook",
356
- [10]: "app errorHandler",
357
- [11]: "app warnHandler",
358
- [12]: "ref function",
359
- [13]: "async component loader",
360
- [14]: "scheduler flush",
361
- [15]: "component update",
362
- [16]: "app unmount cleanup function"
363
- };
364
- function callWithErrorHandling(fn, instance, type, args) {
365
- try {
366
- return args ? fn(...args) : fn();
367
- } catch (err) {
368
- handleError(err, instance, type);
369
- }
370
- }
371
- function handleError(err, instance, type, throwInDev = true) {
372
- const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
373
- if (instance) {
374
- let cur = instance.parent;
375
- const exposedInstance = instance.proxy || instance;
376
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] || type : `https://vuejs.org/error-reference/#runtime-${type}`;
377
- while (cur) {
378
- const errorCapturedHooks = cur.ec;
379
- if (errorCapturedHooks) {
380
- for (let i = 0; i < errorCapturedHooks.length; i++) {
381
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
382
- return;
383
- }
384
- }
385
- }
386
- cur = cur.parent;
387
- }
388
- if (errorHandler) {
389
- const prevSub = setActiveSub();
390
- callWithErrorHandling(errorHandler, null, 10, [
391
- err,
392
- exposedInstance,
393
- errorInfo
394
- ]);
395
- setActiveSub(prevSub);
396
- return;
397
- }
398
- }
399
- logError(err, type, instance, throwInDev, throwUnhandledErrorInProduction);
400
- }
401
- function logError(err, type, instance, throwInDev = true, throwInProd = false) {
402
- if (!!(process.env.NODE_ENV !== "production")) {
403
- const info = ErrorTypeStrings[type] || type;
404
- if (instance) {
405
- pushWarningContext$1(instance);
406
- }
407
- warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
408
- if (instance) {
409
- popWarningContext$1();
410
- }
411
- if (err instanceof Error) {
412
- console.error(
413
- `---BEGIN:EXCEPTION---${err.message}
414
- ${err.stack || ""}---END:EXCEPTION---`
415
- );
416
- } else {
417
- console.error(err);
418
- }
419
- } else if (throwInProd) {
420
- throw err;
421
- } else {
422
- console.error(err);
423
- }
424
- }
425
-
426
- let devtools;
427
- let buffer = [];
428
- function setDevtoolsHook(hook, target) {
429
- var _a, _b;
430
- devtools = hook;
431
- if (devtools) {
432
- devtools.enabled = true;
433
- buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
434
- buffer = [];
435
- } else if (
436
- // handle late devtools injection - only do this if we are in an actual
437
- // browser environment to avoid the timer handle stalling test runner exit
438
- // (#4815)
439
- typeof window !== "undefined" && // some envs mock window but not fully
440
- window.HTMLElement && // also exclude jsdom
441
- // eslint-disable-next-line no-restricted-syntax
442
- !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
443
- ) {
444
- const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
445
- replay.push((newHook) => {
446
- setDevtoolsHook(newHook, target);
447
- });
448
- setTimeout(() => {
449
- if (!devtools) {
450
- target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
451
- buffer = [];
452
- }
453
- }, 3e3);
454
- } else {
455
- buffer = [];
456
- }
457
- }
458
-
459
- let currentRenderingInstance = null;
460
- let currentScopeId = null;
461
-
462
- const isTeleport = (type) => type.__isTeleport;
463
-
464
- function setTransitionHooks(vnode, hooks) {
465
- if (vnode.shapeFlag & 6 && vnode.component) {
466
- vnode.transition = hooks;
467
- setTransitionHooks(vnode.component.subTree, hooks);
468
- } else if (vnode.shapeFlag & 128) {
469
- vnode.ssContent.transition = hooks.clone(vnode.ssContent);
470
- vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
471
- } else {
472
- vnode.transition = hooks;
473
- }
474
- }
475
-
476
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
477
-
478
- const internalObjectProto = {};
479
- const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
480
-
481
- const isSuspense = (type) => type.__isSuspense;
482
-
483
- const Fragment = Symbol.for("v-fgt");
484
- const Text = Symbol.for("v-txt");
485
- const Comment = Symbol.for("v-cmt");
486
- function isVNode$2(value) {
487
- return value ? value.__v_isVNode === true : false;
488
- }
489
- const createVNodeWithArgsTransform = (...args) => {
490
- return _createVNode(
491
- ...args
492
- );
493
- };
494
- const normalizeKey = ({ key }) => key != null ? key : null;
495
- const normalizeRef = ({
496
- ref,
497
- ref_key,
498
- ref_for
499
- }) => {
500
- if (typeof ref === "number") {
501
- ref = "" + ref;
502
- }
503
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
504
- };
505
- function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
506
- const vnode = {
507
- __v_isVNode: true,
508
- __v_skip: true,
509
- type,
510
- props,
511
- key: props && normalizeKey(props),
512
- ref: props && normalizeRef(props),
513
- scopeId: currentScopeId,
514
- slotScopeIds: null,
515
- children,
516
- component: null,
517
- suspense: null,
518
- ssContent: null,
519
- ssFallback: null,
520
- dirs: null,
521
- transition: null,
522
- el: null,
523
- anchor: null,
524
- target: null,
525
- targetStart: null,
526
- targetAnchor: null,
527
- staticCount: 0,
528
- shapeFlag,
529
- patchFlag,
530
- dynamicProps,
531
- dynamicChildren: null,
532
- appContext: null,
533
- ctx: currentRenderingInstance,
534
- // fixed by xxxxxx
535
- hostInstance: currentRenderingInstance
536
- };
537
- if (needFullChildrenNormalization) {
538
- normalizeChildren(vnode, children);
539
- if (shapeFlag & 128) {
540
- type.normalize(vnode);
541
- }
542
- } else if (children) {
543
- vnode.shapeFlag |= isString(children) ? 8 : 16;
544
- }
545
- if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
546
- warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
547
- }
548
- if (type == "button") {
549
- if (vnode.props == null) vnode.props = {};
550
- if (!vnode.props["hoverClass"] && !vnode.props["hover-class"]) {
551
- vnode.props["hoverClass"] = "button-hover";
552
- }
553
- }
554
- return vnode;
555
- }
556
- const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
557
- function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
558
- if (!type || type === NULL_DYNAMIC_COMPONENT) {
559
- if (!!(process.env.NODE_ENV !== "production") && !type) {
560
- warn$1(`Invalid vnode type when creating vnode: ${type}.`);
561
- }
562
- type = Comment;
563
- }
564
- if (isVNode$2(type)) {
565
- const cloned = cloneVNode(
566
- type,
567
- props,
568
- true
569
- /* mergeRef: true */
570
- );
571
- if (children) {
572
- normalizeChildren(cloned, children);
573
- }
574
- cloned.patchFlag = -2;
575
- return cloned;
576
- }
577
- if (isClassComponent(type)) {
578
- type = type.__vccOpts;
579
- }
580
- if (props) {
581
- props = guardReactiveProps(props);
582
- let { class: klass, style } = props;
583
- if (klass && !isString(klass)) {
584
- props.class = normalizeClass$1(klass);
585
- }
586
- if (isObject(style)) {
587
- if (isProxy(style) && !isArray(style)) {
588
- style = extend({}, style);
589
- }
590
- props.style = normalizeStyle$1(style);
591
- }
592
- }
593
- const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
594
- if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
595
- type = toRaw(type);
596
- warn$1(
597
- `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
598
- `
599
- Component that was made reactive: `,
600
- type
601
- );
602
- }
603
- return createBaseVNode(
604
- type,
605
- props,
606
- children,
607
- patchFlag,
608
- dynamicProps,
609
- shapeFlag,
610
- isBlockNode,
611
- true
612
- );
613
- }
614
- function guardReactiveProps(props) {
615
- if (!props) return null;
616
- return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
617
- }
618
- function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
619
- const { props, ref, patchFlag, children, transition } = vnode;
620
- const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
621
- const cloned = {
622
- __v_isVNode: true,
623
- __v_skip: true,
624
- type: vnode.type,
625
- props: mergedProps,
626
- key: mergedProps && normalizeKey(mergedProps),
627
- ref: extraProps && extraProps.ref ? (
628
- // #2078 in the case of <component :is="vnode" ref="extra"/>
629
- // if the vnode itself already has a ref, cloneVNode will need to merge
630
- // the refs so the single vnode can be set on multiple refs
631
- mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
632
- ) : ref,
633
- scopeId: vnode.scopeId,
634
- slotScopeIds: vnode.slotScopeIds,
635
- children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
636
- target: vnode.target,
637
- targetStart: vnode.targetStart,
638
- targetAnchor: vnode.targetAnchor,
639
- staticCount: vnode.staticCount,
640
- shapeFlag: vnode.shapeFlag,
641
- // if the vnode is cloned with extra props, we can no longer assume its
642
- // existing patch flag to be reliable and need to add the FULL_PROPS flag.
643
- // note: preserve flag for fragments since they use the flag for children
644
- // fast paths only.
645
- patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
646
- dynamicProps: vnode.dynamicProps,
647
- dynamicChildren: vnode.dynamicChildren,
648
- appContext: vnode.appContext,
649
- // fixed by xxxxxx
650
- hostInstance: vnode.hostInstance,
651
- dirs: vnode.dirs,
652
- transition,
653
- // These should technically only be non-null on mounted VNodes. However,
654
- // they *should* be copied for kept-alive vnodes. So we just always copy
655
- // them since them being non-null during a mount doesn't affect the logic as
656
- // they will simply be overwritten.
657
- component: vnode.component,
658
- suspense: vnode.suspense,
659
- ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
660
- ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
661
- el: vnode.el,
662
- anchor: vnode.anchor,
663
- ctx: vnode.ctx,
664
- ce: vnode.ce
665
- };
666
- if (transition && cloneTransition) {
667
- setTransitionHooks(
668
- cloned,
669
- transition.clone(cloned)
670
- );
671
- }
672
- return cloned;
673
- }
674
- function deepCloneVNode(vnode) {
675
- const cloned = cloneVNode(vnode);
676
- if (isArray(vnode.children)) {
677
- cloned.children = vnode.children.map(deepCloneVNode);
678
- }
679
- return cloned;
680
- }
681
- function createTextVNode(text = " ", flag = 0) {
682
- return createVNode(Text, null, text, flag);
683
- }
684
- function normalizeChildren(vnode, children) {
685
- let type = 0;
686
- const { shapeFlag } = vnode;
687
- if (children == null) {
688
- children = null;
689
- } else if (isArray(children)) {
690
- type = 16;
691
- } else if (typeof children === "object") {
692
- if (shapeFlag & (1 | 64)) {
693
- const slot = children.default;
694
- if (slot) {
695
- slot._c && (slot._d = false);
696
- normalizeChildren(vnode, slot());
697
- slot._c && (slot._d = true);
698
- }
699
- return;
700
- } else {
701
- type = 32;
702
- const slotFlag = children._;
703
- if (!slotFlag && !isInternalObject(children)) {
704
- children._ctx = currentRenderingInstance;
705
- }
706
- }
707
- } else if (isFunction(children)) {
708
- children = { default: children, _ctx: currentRenderingInstance };
709
- type = 32;
710
- } else {
711
- children = String(children);
712
- if (shapeFlag & 64) {
713
- type = 16;
714
- children = [createTextVNode(children)];
715
- } else {
716
- type = 8;
717
- }
718
- }
719
- vnode.children = children;
720
- vnode.shapeFlag |= type;
721
- }
722
- function mergeProps(...args) {
723
- const ret = {};
724
- for (let i = 0; i < args.length; i++) {
725
- const toMerge = args[i];
726
- for (const key in toMerge) {
727
- if (key === "class") {
728
- if (ret.class !== toMerge.class) {
729
- ret.class = normalizeClass$1([ret.class, toMerge.class]);
730
- }
731
- } else if (key === "style") {
732
- ret.style = normalizeStyle$1([ret.style, toMerge.style]);
733
- } else if (isOn(key)) {
734
- const existing = ret[key];
735
- const incoming = toMerge[key];
736
- if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
737
- ret[key] = existing ? [].concat(existing, incoming) : incoming;
738
- }
739
- } else if (key !== "") {
740
- ret[key] = toMerge[key];
741
- }
742
- }
743
- }
744
- return ret;
745
- }
746
-
747
- !!(process.env.NODE_ENV !== "production") ? {
748
- } : {
749
- };
750
- const classifyRE = /(?:^|[-_])(\w)/g;
751
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
752
- function getComponentName(Component, includeInferred = true) {
753
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
754
- }
755
- function formatComponentName(instance, Component, isRoot = false) {
756
- let name = getComponentName(Component);
757
- if (!name && Component.__file) {
758
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
759
- if (match) {
760
- name = match[1];
761
- }
762
- }
763
- if (!name && instance && instance.parent) {
764
- const inferFromRegistry = (registry) => {
765
- for (const key in registry) {
766
- if (registry[key] === Component) {
767
- return key;
768
- }
769
- }
770
- };
771
- name = inferFromRegistry(
772
- instance.components || instance.parent.type.components
773
- ) || inferFromRegistry(instance.appContext.components);
774
- }
775
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
776
- }
777
- function isClassComponent(value) {
778
- return isFunction(value) && "__vccOpts" in value;
779
- }
780
-
781
- const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
782
- !!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
783
- !!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook : NOOP;
784
-
785
- function ssrRenderList(source, renderItem) {
786
- if (isArray(source) || isString(source)) {
787
- for (let i = 0, l = source.length; i < l; i++) {
788
- renderItem(source[i], i);
789
- }
790
- } else if (typeof source === "number") {
791
- if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
792
- warn(`The v-for range expect an integer value but got ${source}.`);
793
- return;
794
- }
795
- for (let i = 0; i < source; i++) {
796
- renderItem(i + 1, i);
797
- }
798
- } else if (isObject(source)) {
799
- if (source[Symbol.iterator]) {
800
- const arr = Array.from(source);
801
- for (let i = 0, l = arr.length; i < l; i++) {
802
- renderItem(arr[i], i);
803
- }
804
- } else {
805
- const keys = Object.keys(source);
806
- for (let i = 0, l = keys.length; i < l; i++) {
807
- const key = keys[i];
808
- renderItem(source[key], key, i);
809
- }
810
- }
811
- }
812
- }
813
-
814
- async function ssrRenderSuspense(push, { default: renderContent }) {
815
- if (renderContent) {
816
- renderContent();
817
- } else {
818
- push(`<!---->`);
819
- }
820
- }
821
-
822
- function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
823
- if (typeof dir !== "function" && dir.getSSRProps) {
824
- return dir.getSSRProps(
825
- {
826
- dir,
827
- instance: ssrUtils.getComponentPublicInstance(instance.$),
828
- value,
829
- oldValue: void 0,
830
- arg,
831
- modifiers
832
- },
833
- null
834
- ) || {};
835
- }
836
- return {};
837
- }
838
-
839
- const ssrLooseEqual = looseEqual;
840
- function ssrLooseContain(arr, value) {
841
- return looseIndexOf(arr, value) > -1;
842
- }
843
- function ssrRenderDynamicModel(type, model, value) {
844
- switch (type) {
845
- case "radio":
846
- return looseEqual(model, value) ? " checked" : "";
847
- case "checkbox":
848
- return (isArray(model) ? ssrLooseContain(model, value) : model) ? " checked" : "";
849
- default:
850
- return ssrRenderAttr("value", model);
851
- }
852
- }
853
- function ssrGetDynamicModelProps(existingProps = {}, model) {
854
- const { type, value } = existingProps;
855
- switch (type) {
856
- case "radio":
857
- return looseEqual(model, value) ? { checked: true } : null;
858
- case "checkbox":
859
- return (isArray(model) ? ssrLooseContain(model, value) : model) ? { checked: true } : null;
860
- default:
861
- return { value: model };
862
- }
863
- }
864
-
865
- function ssrCompile(template, instance) {
866
- {
867
- throw new Error(
868
- `On-the-fly template compilation is not supported in the ESM build of @vue/server-renderer. All templates must be pre-compiled into render functions.`
869
- );
870
- }
871
- }
872
-
873
- const {
874
- createComponentInstance,
875
- setCurrentRenderingInstance,
876
- setupComponent,
877
- renderComponentRoot,
878
- normalizeVNode,
879
- pushWarningContext,
880
- popWarningContext
881
- } = ssrUtils;
882
- function createBuffer() {
883
- let appendable = false;
884
- const buffer = [];
885
- return {
886
- getBuffer() {
887
- return buffer;
888
- },
889
- push(item) {
890
- const isStringItem = isString(item);
891
- if (appendable && isStringItem) {
892
- buffer[buffer.length - 1] += item;
893
- return;
894
- }
895
- buffer.push(item);
896
- appendable = isStringItem;
897
- if (isPromise(item) || isArray(item) && item.hasAsync) {
898
- buffer.hasAsync = true;
899
- }
900
- }
901
- };
902
- }
903
- function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
904
- const instance = vnode.component = createComponentInstance(
905
- vnode,
906
- parentComponent,
907
- null
908
- );
909
- if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(vnode);
910
- const res = setupComponent(
911
- instance,
912
- true
913
- /* isSSR */
914
- );
915
- if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
916
- const hasAsyncSetup = isPromise(res);
917
- let prefetches = instance.sp;
918
- if (hasAsyncSetup || prefetches) {
919
- const p = Promise.resolve(res).then(() => {
920
- if (hasAsyncSetup) prefetches = instance.sp;
921
- if (prefetches) {
922
- return Promise.all(
923
- prefetches.map((prefetch) => prefetch.call(instance.proxy))
924
- );
925
- }
926
- }).catch(NOOP);
927
- return p.then(() => renderComponentSubTree(instance, slotScopeId));
928
- } else {
929
- return renderComponentSubTree(instance, slotScopeId);
930
- }
931
- }
932
- function renderComponentSubTree(instance, slotScopeId) {
933
- if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(instance.vnode);
934
- const comp = instance.type;
935
- const { getBuffer, push } = createBuffer();
936
- if (isFunction(comp)) {
937
- let root = renderComponentRoot(instance);
938
- if (!comp.props) {
939
- for (const key in instance.attrs) {
940
- if (key.startsWith(`data-v-`)) {
941
- (root.props || (root.props = {}))[key] = ``;
942
- }
943
- }
944
- }
945
- renderVNode(push, instance.subTree = root, instance, slotScopeId);
946
- } else {
947
- if ((!instance.render || instance.render === NOOP) && !instance.ssrRender && !comp.ssrRender && isString(comp.template)) {
948
- comp.ssrRender = ssrCompile(comp.template);
949
- }
950
- const ssrRender = instance.ssrRender || comp.ssrRender;
951
- if (ssrRender) {
952
- let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
953
- let hasCloned = false;
954
- let cur = instance;
955
- while (true) {
956
- const scopeId = cur.vnode.scopeId;
957
- if (scopeId) {
958
- if (!hasCloned) {
959
- attrs = { ...attrs };
960
- hasCloned = true;
961
- }
962
- attrs[scopeId] = "";
963
- }
964
- const parent = cur.parent;
965
- if (parent && parent.subTree && parent.subTree === cur.vnode) {
966
- cur = parent;
967
- } else {
968
- break;
969
- }
970
- }
971
- if (slotScopeId) {
972
- if (!hasCloned) attrs = { ...attrs };
973
- const slotScopeIdList = slotScopeId.trim().split(" ");
974
- for (let i = 0; i < slotScopeIdList.length; i++) {
975
- attrs[slotScopeIdList[i]] = "";
976
- }
977
- }
978
- const prev = setCurrentRenderingInstance(instance);
979
- try {
980
- ssrRender(
981
- instance.proxy,
982
- push,
983
- instance,
984
- attrs,
985
- // compiler-optimized bindings
986
- instance.props,
987
- instance.setupState,
988
- instance.data,
989
- instance.ctx
990
- );
991
- } finally {
992
- setCurrentRenderingInstance(prev);
993
- }
994
- } else if (instance.render && instance.render !== NOOP) {
995
- renderVNode(
996
- push,
997
- instance.subTree = renderComponentRoot(instance),
998
- instance,
999
- slotScopeId
1000
- );
1001
- } else {
1002
- const componentName = comp.name || comp.__file || `<Anonymous>`;
1003
- warn$2(`Component ${componentName} is missing template or render function.`);
1004
- push(`<!---->`);
1005
- }
1006
- }
1007
- if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
1008
- return getBuffer();
1009
- }
1010
- function renderVNode(push, vnode, parentComponent, slotScopeId) {
1011
- const { type, shapeFlag, children, dirs, props } = vnode;
1012
- if (dirs) {
1013
- vnode.props = applySSRDirectives(vnode, props, dirs);
1014
- }
1015
- switch (type) {
1016
- case Text$1:
1017
- push(escapeHtml(children));
1018
- break;
1019
- case Comment$1:
1020
- push(
1021
- children ? `<!--${escapeHtmlComment(children)}-->` : `<!---->`
1022
- );
1023
- break;
1024
- case Static:
1025
- push(children);
1026
- break;
1027
- case Fragment$1:
1028
- if (vnode.slotScopeIds) {
1029
- slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
1030
- }
1031
- push(`<!--[-->`);
1032
- renderVNodeChildren(
1033
- push,
1034
- children,
1035
- parentComponent,
1036
- slotScopeId
1037
- );
1038
- push(`<!--]-->`);
1039
- break;
1040
- default:
1041
- if (shapeFlag & 1) {
1042
- renderElementVNode(push, vnode, parentComponent, slotScopeId);
1043
- } else if (shapeFlag & 6) {
1044
- push(renderComponentVNode(vnode, parentComponent, slotScopeId));
1045
- } else if (shapeFlag & 64) {
1046
- renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
1047
- } else if (shapeFlag & 128) {
1048
- renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
1049
- } else {
1050
- warn$2(
1051
- "[@vue/server-renderer] Invalid VNode type:",
1052
- type,
1053
- `(${typeof type})`
1054
- );
1055
- }
1056
- }
1057
- }
1058
- function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
1059
- for (let i = 0; i < children.length; i++) {
1060
- renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
1061
- }
1062
- }
1063
- function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
1064
- const tag = vnode.type;
1065
- let { props, children, shapeFlag, scopeId } = vnode;
1066
- let openTag = `<${tag}`;
1067
- if (props) {
1068
- openTag += ssrRenderAttrs(props, tag);
1069
- }
1070
- if (scopeId) {
1071
- openTag += ` ${scopeId}`;
1072
- }
1073
- let curParent = parentComponent;
1074
- let curVnode = vnode;
1075
- while (curParent && curVnode === curParent.subTree) {
1076
- curVnode = curParent.vnode;
1077
- if (curVnode.scopeId) {
1078
- openTag += ` ${curVnode.scopeId}`;
1079
- }
1080
- curParent = curParent.parent;
1081
- }
1082
- if (slotScopeId) {
1083
- openTag += ` ${slotScopeId}`;
1084
- }
1085
- push(openTag + `>`);
1086
- if (!isVoidTag(tag)) {
1087
- let hasChildrenOverride = false;
1088
- if (props) {
1089
- if (props.innerHTML) {
1090
- hasChildrenOverride = true;
1091
- push(props.innerHTML);
1092
- } else if (props.textContent) {
1093
- hasChildrenOverride = true;
1094
- push(escapeHtml(props.textContent));
1095
- } else if (tag === "textarea" && props.value) {
1096
- hasChildrenOverride = true;
1097
- push(escapeHtml(props.value));
1098
- }
1099
- }
1100
- if (!hasChildrenOverride) {
1101
- if (shapeFlag & 8) {
1102
- push(escapeHtml(children));
1103
- } else if (shapeFlag & 16) {
1104
- renderVNodeChildren(
1105
- push,
1106
- children,
1107
- parentComponent,
1108
- slotScopeId
1109
- );
1110
- }
1111
- }
1112
- push(`</${tag}>`);
1113
- }
1114
- }
1115
- function applySSRDirectives(vnode, rawProps, dirs) {
1116
- const toMerge = [];
1117
- for (let i = 0; i < dirs.length; i++) {
1118
- const binding = dirs[i];
1119
- const {
1120
- dir: { getSSRProps }
1121
- } = binding;
1122
- if (getSSRProps) {
1123
- const props = getSSRProps(binding, vnode);
1124
- if (props) toMerge.push(props);
1125
- }
1126
- }
1127
- return mergeProps$1(rawProps || {}, ...toMerge);
1128
- }
1129
- function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
1130
- const target = vnode.props && vnode.props.to;
1131
- const disabled = vnode.props && vnode.props.disabled;
1132
- if (!target) {
1133
- if (!disabled) {
1134
- warn$2(`[@vue/server-renderer] Teleport is missing target prop.`);
1135
- }
1136
- return [];
1137
- }
1138
- if (!isString(target)) {
1139
- warn$2(
1140
- `[@vue/server-renderer] Teleport target must be a query selector string.`
1141
- );
1142
- return [];
1143
- }
1144
- ssrRenderTeleport(
1145
- push,
1146
- (push2) => {
1147
- renderVNodeChildren(
1148
- push2,
1149
- vnode.children,
1150
- parentComponent,
1151
- slotScopeId
1152
- );
1153
- },
1154
- target,
1155
- disabled || disabled === "",
1156
- parentComponent
1157
- );
1158
- }
1159
-
1160
- const { isVNode: isVNode$1 } = ssrUtils;
1161
- function nestedUnrollBuffer(buffer, parentRet, startIndex) {
1162
- if (!buffer.hasAsync) {
1163
- return parentRet + unrollBufferSync$1(buffer);
1164
- }
1165
- let ret = parentRet;
1166
- for (let i = startIndex; i < buffer.length; i += 1) {
1167
- const item = buffer[i];
1168
- if (isString(item)) {
1169
- ret += item;
1170
- continue;
1171
- }
1172
- if (isPromise(item)) {
1173
- return item.then((nestedItem) => {
1174
- buffer[i] = nestedItem;
1175
- return nestedUnrollBuffer(buffer, ret, i);
1176
- });
1177
- }
1178
- const result = nestedUnrollBuffer(item, ret, 0);
1179
- if (isPromise(result)) {
1180
- return result.then((nestedItem) => {
1181
- buffer[i] = nestedItem;
1182
- return nestedUnrollBuffer(buffer, "", i);
1183
- });
1184
- }
1185
- ret = result;
1186
- }
1187
- return ret;
1188
- }
1189
- function unrollBuffer$1(buffer) {
1190
- return nestedUnrollBuffer(buffer, "", 0);
1191
- }
1192
- function unrollBufferSync$1(buffer) {
1193
- let ret = "";
1194
- for (let i = 0; i < buffer.length; i++) {
1195
- let item = buffer[i];
1196
- if (isString(item)) {
1197
- ret += item;
1198
- } else {
1199
- ret += unrollBufferSync$1(item);
1200
- }
1201
- }
1202
- return ret;
1203
- }
1204
- async function renderToString(input, context = {}) {
1205
- if (isVNode$1(input)) {
1206
- return renderToString(createApp({ render: () => input }), context);
1207
- }
1208
- const vnode = createVNode$1(input._component, input._props);
1209
- vnode.appContext = input._context;
1210
- input.provide(ssrContextKey, context);
1211
- const buffer = await renderComponentVNode(vnode);
1212
- const result = await unrollBuffer$1(buffer);
1213
- await resolveTeleports(context);
1214
- if (context.__watcherHandles) {
1215
- for (const unwatch of context.__watcherHandles) {
1216
- unwatch();
1217
- }
1218
- }
1219
- return result;
1220
- }
1221
- async function resolveTeleports(context) {
1222
- if (context.__teleportBuffers) {
1223
- context.teleports = context.teleports || {};
1224
- for (const key in context.__teleportBuffers) {
1225
- context.teleports[key] = await unrollBuffer$1(
1226
- await Promise.all([context.__teleportBuffers[key]])
1227
- );
1228
- }
1229
- }
1230
- }
1231
-
1232
- const { isVNode } = ssrUtils;
1233
- async function unrollBuffer(buffer, stream) {
1234
- if (buffer.hasAsync) {
1235
- for (let i = 0; i < buffer.length; i++) {
1236
- let item = buffer[i];
1237
- if (isPromise(item)) {
1238
- item = await item;
1239
- }
1240
- if (isString(item)) {
1241
- stream.push(item);
1242
- } else {
1243
- await unrollBuffer(item, stream);
1244
- }
1245
- }
1246
- } else {
1247
- unrollBufferSync(buffer, stream);
1248
- }
1249
- }
1250
- function unrollBufferSync(buffer, stream) {
1251
- for (let i = 0; i < buffer.length; i++) {
1252
- let item = buffer[i];
1253
- if (isString(item)) {
1254
- stream.push(item);
1255
- } else {
1256
- unrollBufferSync(item, stream);
1257
- }
1258
- }
1259
- }
1260
- function renderToSimpleStream(input, context, stream) {
1261
- if (isVNode(input)) {
1262
- return renderToSimpleStream(
1263
- createApp({ render: () => input }),
1264
- context,
1265
- stream
1266
- );
1267
- }
1268
- const vnode = createVNode$1(input._component, input._props);
1269
- vnode.appContext = input._context;
1270
- input.provide(ssrContextKey, context);
1271
- Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
1272
- if (context.__watcherHandles) {
1273
- for (const unwatch of context.__watcherHandles) {
1274
- unwatch();
1275
- }
1276
- }
1277
- }).then(() => stream.push(null)).catch((error) => {
1278
- stream.destroy(error);
1279
- });
1280
- return stream;
1281
- }
1282
- function renderToStream(input, context = {}) {
1283
- console.warn(
1284
- `[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`
1285
- );
1286
- return renderToNodeStream(input, context);
1287
- }
1288
- function renderToNodeStream(input, context = {}) {
1289
- {
1290
- throw new Error(
1291
- `ESM build of renderToStream() does not support renderToNodeStream(). Use pipeToNodeWritable() with an existing Node.js Writable stream instance instead.`
1292
- );
1293
- }
1294
- }
1295
- function pipeToNodeWritable(input, context = {}, writable) {
1296
- renderToSimpleStream(input, context, {
1297
- push(content) {
1298
- if (content != null) {
1299
- writable.write(content);
1300
- } else {
1301
- writable.end();
1302
- }
1303
- },
1304
- destroy(err) {
1305
- writable.destroy(err);
1306
- }
1307
- });
1308
- }
1309
- function renderToWebStream(input, context = {}) {
1310
- if (typeof ReadableStream !== "function") {
1311
- throw new Error(
1312
- `ReadableStream constructor is not available in the global scope. If the target environment does support web streams, consider using pipeToWebWritable() with an existing WritableStream instance instead.`
1313
- );
1314
- }
1315
- const encoder = new TextEncoder();
1316
- let cancelled = false;
1317
- return new ReadableStream({
1318
- start(controller) {
1319
- renderToSimpleStream(input, context, {
1320
- push(content) {
1321
- if (cancelled) return;
1322
- if (content != null) {
1323
- controller.enqueue(encoder.encode(content));
1324
- } else {
1325
- controller.close();
1326
- }
1327
- },
1328
- destroy(err) {
1329
- controller.error(err);
1330
- }
1331
- });
1332
- },
1333
- cancel() {
1334
- cancelled = true;
1335
- }
1336
- });
1337
- }
1338
- function pipeToWebWritable(input, context = {}, writable) {
1339
- const writer = writable.getWriter();
1340
- const encoder = new TextEncoder();
1341
- let hasReady = false;
1342
- try {
1343
- hasReady = isPromise(writer.ready);
1344
- } catch (e) {
1345
- }
1346
- renderToSimpleStream(input, context, {
1347
- async push(content) {
1348
- if (hasReady) {
1349
- await writer.ready;
1350
- }
1351
- if (content != null) {
1352
- return writer.write(encoder.encode(content));
1353
- } else {
1354
- return writer.close();
1355
- }
1356
- },
1357
- destroy(err) {
1358
- console.log(err);
1359
- writer.close();
1360
- }
1361
- });
1362
- }
1363
-
1364
- initDirectivesForSSR();
1365
-
1366
- export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };