@vue/server-renderer 3.5.39 → 3.5.41

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.
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @vue/server-renderer v3.5.39
2
+ * @vue/server-renderer v3.5.41
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { createVNode, ssrUtils, ssrContextKey, warn as warn$2, Fragment, Static, Comment, Text, mergeProps, createApp, initDirectivesForSSR } from 'vue';
7
- import { isOn, escapeHtml, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, isObject, normalizeCssVarValue, makeMap, isPromise, toDisplayString, isFunction, EMPTY_OBJ, getGlobalThis, NOOP, looseEqual, looseIndexOf, escapeHtmlComment, isVoidTag, hasOwn } from '@vue/shared';
6
+ import { createVNode, ssrUtils, ssrContextKey, warn, Fragment, Static, Comment, Text, mergeProps, handleError, createApp, initDirectivesForSSR } from '@vue/runtime-dom';
7
+ import { isOn, escapeHtml, isRenderableAttrValue, isSVGTag, propsToAttrMap, isBooleanAttr, includeBooleanAttr, isSSRSafeAttrName, normalizeClass, isString, normalizeStyle, stringifyStyle, isArray, isObject, normalizeCssVarValue, makeMap, isPromise, toDisplayString, looseEqual, looseIndexOf, escapeHtmlComment, NOOP, isVoidTag, isFunction, hasOwn } from '@vue/shared';
8
8
  export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
9
9
 
10
10
  const shouldIgnoreProp = /* @__PURE__ */ makeMap(
@@ -38,7 +38,7 @@ function ssrRenderDynamicAttr(key, value, tag) {
38
38
  return ``;
39
39
  }
40
40
  const attrKey = tag && (tag.indexOf("-") > 0 || isSVGTag(tag)) ? key : propsToAttrMap[key] || key.toLowerCase();
41
- if (isBooleanAttr(attrKey)) {
41
+ if (isBooleanAttr(attrKey) || attrKey === "hidden" && (typeof value === "boolean" || typeof value === "number")) {
42
42
  return includeBooleanAttr(value) ? ` ${attrKey}` : ``;
43
43
  } else if (isSSRSafeAttrName(attrKey)) {
44
44
  return value === "" ? ` ${attrKey}` : ` ${attrKey}="${escapeHtml(value)}"`;
@@ -113,7 +113,9 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
113
113
  slotBuffer.push(item);
114
114
  };
115
115
  const ret = slotFn(
116
- slotProps,
116
+ // keep the slot function's contract in sync with `renderSlot`, which also
117
+ // normalizes nullish props before invoking the slot
118
+ slotProps || {},
117
119
  bufferedPush,
118
120
  parentComponent,
119
121
  slotScopeId ? " " + slotScopeId : ""
@@ -206,314 +208,6 @@ function ssrInterpolate(value) {
206
208
  return escapeHtml(toDisplayString(value));
207
209
  }
208
210
 
209
- // @__NO_SIDE_EFFECTS__
210
- function isProxy(value) {
211
- return value ? !!value["__v_raw"] : false;
212
- }
213
- // @__NO_SIDE_EFFECTS__
214
- function toRaw(observed) {
215
- const raw = observed && observed["__v_raw"];
216
- return raw ? /* @__PURE__ */ toRaw(raw) : observed;
217
- }
218
-
219
- // @__NO_SIDE_EFFECTS__
220
- function isRef(r) {
221
- return r ? r["__v_isRef"] === true : false;
222
- }
223
-
224
- const stack = [];
225
- function pushWarningContext$1(vnode) {
226
- stack.push(vnode);
227
- }
228
- function popWarningContext$1() {
229
- stack.pop();
230
- }
231
- let isWarning = false;
232
- function warn$1(msg, ...args) {
233
- if (isWarning) return;
234
- isWarning = true;
235
- const instance = stack.length ? stack[stack.length - 1].component : null;
236
- const appWarnHandler = instance && instance.appContext.config.warnHandler;
237
- const trace = getComponentTrace();
238
- if (appWarnHandler) {
239
- callWithErrorHandling(
240
- appWarnHandler,
241
- instance,
242
- 11,
243
- [
244
- // eslint-disable-next-line no-restricted-syntax
245
- msg + args.map((a) => {
246
- var _a, _b;
247
- return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
248
- }).join(""),
249
- instance && instance.proxy,
250
- trace.map(
251
- ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
252
- ).join("\n"),
253
- trace
254
- ]
255
- );
256
- } else {
257
- const warnArgs = [`[Vue warn]: ${msg}`, ...args];
258
- if (trace.length && // avoid spamming console during tests
259
- true) {
260
- warnArgs.push(`
261
- `, ...formatTrace(trace));
262
- }
263
- console.warn(...warnArgs);
264
- }
265
- isWarning = false;
266
- }
267
- function getComponentTrace() {
268
- let currentVNode = stack[stack.length - 1];
269
- if (!currentVNode) {
270
- return [];
271
- }
272
- const normalizedStack = [];
273
- while (currentVNode) {
274
- const last = normalizedStack[0];
275
- if (last && last.vnode === currentVNode) {
276
- last.recurseCount++;
277
- } else {
278
- normalizedStack.push({
279
- vnode: currentVNode,
280
- recurseCount: 0
281
- });
282
- }
283
- const parentInstance = currentVNode.component && currentVNode.component.parent;
284
- currentVNode = parentInstance && parentInstance.vnode;
285
- }
286
- return normalizedStack;
287
- }
288
- function formatTrace(trace) {
289
- const logs = [];
290
- trace.forEach((entry, i) => {
291
- logs.push(...i === 0 ? [] : [`
292
- `], ...formatTraceEntry(entry));
293
- });
294
- return logs;
295
- }
296
- function formatTraceEntry({ vnode, recurseCount }) {
297
- const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
298
- const isRoot = vnode.component ? vnode.component.parent == null : false;
299
- const open = ` at <${formatComponentName(
300
- vnode.component,
301
- vnode.type,
302
- isRoot
303
- )}`;
304
- const close = `>` + postfix;
305
- return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
306
- }
307
- function formatProps(props) {
308
- const res = [];
309
- const keys = Object.keys(props);
310
- keys.slice(0, 3).forEach((key) => {
311
- res.push(...formatProp(key, props[key]));
312
- });
313
- if (keys.length > 3) {
314
- res.push(` ...`);
315
- }
316
- return res;
317
- }
318
- function formatProp(key, value, raw) {
319
- if (isString(value)) {
320
- value = JSON.stringify(value);
321
- return raw ? value : [`${key}=${value}`];
322
- } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
323
- return raw ? value : [`${key}=${value}`];
324
- } else if (isRef(value)) {
325
- value = formatProp(key, toRaw(value.value), true);
326
- return raw ? value : [`${key}=Ref<`, value, `>`];
327
- } else if (isFunction(value)) {
328
- return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
329
- } else {
330
- value = toRaw(value);
331
- return raw ? value : [`${key}=`, value];
332
- }
333
- }
334
-
335
- const ErrorTypeStrings = {
336
- ["sp"]: "serverPrefetch hook",
337
- ["bc"]: "beforeCreate hook",
338
- ["c"]: "created hook",
339
- ["bm"]: "beforeMount hook",
340
- ["m"]: "mounted hook",
341
- ["bu"]: "beforeUpdate hook",
342
- ["u"]: "updated",
343
- ["bum"]: "beforeUnmount hook",
344
- ["um"]: "unmounted hook",
345
- ["a"]: "activated hook",
346
- ["da"]: "deactivated hook",
347
- ["ec"]: "errorCaptured hook",
348
- ["rtc"]: "renderTracked hook",
349
- ["rtg"]: "renderTriggered hook",
350
- [0]: "setup function",
351
- [1]: "render function",
352
- [2]: "watcher getter",
353
- [3]: "watcher callback",
354
- [4]: "watcher cleanup function",
355
- [5]: "native event handler",
356
- [6]: "component event handler",
357
- [7]: "vnode hook",
358
- [8]: "directive hook",
359
- [9]: "transition hook",
360
- [10]: "app errorHandler",
361
- [11]: "app warnHandler",
362
- [12]: "ref function",
363
- [13]: "async component loader",
364
- [14]: "scheduler flush",
365
- [15]: "component update",
366
- [16]: "app unmount cleanup function"
367
- };
368
- function callWithErrorHandling(fn, instance, type, args) {
369
- try {
370
- return args ? fn(...args) : fn();
371
- } catch (err) {
372
- handleError(err, instance, type);
373
- }
374
- }
375
- function handleError(err, instance, type, throwInDev = true) {
376
- const contextVNode = instance ? instance.vnode : null;
377
- const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
378
- if (instance) {
379
- let cur = instance.parent;
380
- const exposedInstance = instance.proxy;
381
- const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
382
- while (cur) {
383
- const errorCapturedHooks = cur.ec;
384
- if (errorCapturedHooks) {
385
- for (let i = 0; i < errorCapturedHooks.length; i++) {
386
- if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
387
- return;
388
- }
389
- }
390
- }
391
- cur = cur.parent;
392
- }
393
- if (errorHandler) {
394
- callWithErrorHandling(errorHandler, null, 10, [
395
- err,
396
- exposedInstance,
397
- errorInfo
398
- ]);
399
- return;
400
- }
401
- }
402
- logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
403
- }
404
- function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
405
- if (!!(process.env.NODE_ENV !== "production")) {
406
- const info = ErrorTypeStrings[type];
407
- if (contextVNode) {
408
- pushWarningContext$1(contextVNode);
409
- }
410
- warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
411
- if (contextVNode) {
412
- popWarningContext$1();
413
- }
414
- if (throwInDev) {
415
- throw err;
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
- {
460
- const g = getGlobalThis();
461
- const registerGlobalSetter = (key, setter) => {
462
- let setters;
463
- if (!(setters = g[key])) setters = g[key] = [];
464
- setters.push(setter);
465
- return (v) => {
466
- if (setters.length > 1) setters.forEach((set) => set(v));
467
- else setters[0](v);
468
- };
469
- };
470
- registerGlobalSetter(
471
- `__VUE_INSTANCE_SETTERS__`,
472
- (v) => v
473
- );
474
- registerGlobalSetter(
475
- `__VUE_SSR_SETTERS__`,
476
- (v) => v
477
- );
478
- }
479
- !!(process.env.NODE_ENV !== "production") ? {
480
- } : {
481
- };
482
- const classifyRE = /(?:^|[-_])\w/g;
483
- const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
484
- function getComponentName(Component, includeInferred = true) {
485
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
486
- }
487
- function formatComponentName(instance, Component, isRoot = false) {
488
- let name = getComponentName(Component);
489
- if (!name && Component.__file) {
490
- const match = Component.__file.match(/([^/\\]+)\.\w+$/);
491
- if (match) {
492
- name = match[1];
493
- }
494
- }
495
- if (!name && instance) {
496
- const inferFromRegistry = (registry) => {
497
- for (const key in registry) {
498
- if (registry[key] === Component) {
499
- return key;
500
- }
501
- }
502
- };
503
- name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
504
- instance.parent.type.components
505
- ) || inferFromRegistry(instance.appContext.components);
506
- }
507
- return name ? classify(name) : isRoot ? `App` : `Anonymous`;
508
- }
509
- function isClassComponent(value) {
510
- return isFunction(value) && "__vccOpts" in value;
511
- }
512
-
513
- const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
514
- !!(process.env.NODE_ENV !== "production") || true ? devtools : void 0;
515
- !!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook : NOOP;
516
-
517
211
  function ssrRenderList(source, renderItem) {
518
212
  if (isArray(source) || isString(source)) {
519
213
  for (let i = 0, l = source.length; i < l; i++) {
@@ -660,7 +354,11 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
660
354
  }).catch(NOOP);
661
355
  return p.then(() => renderComponentSubTree(instance, slotScopeId));
662
356
  } else {
663
- return renderComponentSubTree(instance, slotScopeId);
357
+ try {
358
+ return renderComponentSubTree(instance, slotScopeId);
359
+ } catch (err) {
360
+ return Promise.reject(err);
361
+ }
664
362
  }
665
363
  }
666
364
  function renderComponentSubTree(instance, slotScopeId) {
@@ -722,6 +420,8 @@ function renderComponentSubTree(instance, slotScopeId) {
722
420
  instance.data,
723
421
  instance.ctx
724
422
  );
423
+ } catch (err) {
424
+ handleError(err, instance, 1);
725
425
  } finally {
726
426
  setCurrentRenderingInstance(prev);
727
427
  }
@@ -734,7 +434,7 @@ function renderComponentSubTree(instance, slotScopeId) {
734
434
  );
735
435
  } else {
736
436
  const componentName = comp.name || comp.__file || `<Anonymous>`;
737
- warn$2(`Component ${componentName} is missing template or render function.`);
437
+ warn(`Component ${componentName} is missing template or render function.`);
738
438
  push(`<!---->`);
739
439
  }
740
440
  }
@@ -781,7 +481,7 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
781
481
  } else if (shapeFlag & 128) {
782
482
  renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
783
483
  } else {
784
- warn$2(
484
+ warn(
785
485
  "[@vue/server-renderer] Invalid VNode type:",
786
486
  type,
787
487
  `(${typeof type})`
@@ -875,12 +575,12 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
875
575
  const disabled = vnode.props && vnode.props.disabled;
876
576
  if (!target) {
877
577
  if (!disabled) {
878
- warn$2(`[@vue/server-renderer] Teleport is missing target prop.`);
578
+ warn(`[@vue/server-renderer] Teleport is missing target prop.`);
879
579
  }
880
580
  return [];
881
581
  }
882
582
  if (!isString(target)) {
883
- warn$2(
583
+ warn(
884
584
  `[@vue/server-renderer] Teleport target must be a query selector string.`
885
585
  );
886
586
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/server-renderer",
3
- "version": "3.5.39",
3
+ "version": "3.5.41",
4
4
  "description": "@vue/server-renderer",
5
5
  "main": "index.js",
6
6
  "module": "dist/server-renderer.esm-bundler.js",
@@ -45,11 +45,9 @@
45
45
  "url": "https://github.com/vuejs/core/issues"
46
46
  },
47
47
  "homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
48
- "peerDependencies": {
49
- "vue": "3.5.39"
50
- },
51
48
  "dependencies": {
52
- "@vue/shared": "3.5.39",
53
- "@vue/compiler-ssr": "3.5.39"
49
+ "@vue/shared": "3.5.41",
50
+ "@vue/runtime-dom": "3.5.41",
51
+ "@vue/compiler-ssr": "3.5.41"
54
52
  }
55
53
  }