@vue/server-renderer 3.2.37 → 3.2.38

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.
@@ -288,16 +288,16 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
288
288
  push(`<!--]-->`); // close
289
289
  break;
290
290
  default:
291
- if (shapeFlag & 1 /* ELEMENT */) {
291
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
292
292
  renderElementVNode(push, vnode, parentComponent, slotScopeId);
293
293
  }
294
- else if (shapeFlag & 6 /* COMPONENT */) {
294
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
295
295
  push(renderComponentVNode(vnode, parentComponent, slotScopeId));
296
296
  }
297
- else if (shapeFlag & 64 /* TELEPORT */) {
297
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
298
298
  renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
299
299
  }
300
- else if (shapeFlag & 128 /* SUSPENSE */) {
300
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
301
301
  renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
302
302
  }
303
303
  else {
@@ -354,10 +354,10 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
354
354
  }
355
355
  }
356
356
  if (!hasChildrenOverride) {
357
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
357
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
358
358
  push(shared.escapeHtml(children));
359
359
  }
360
- else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
360
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
361
361
  renderVNodeChildren(push, children, parentComponent, slotScopeId);
362
362
  }
363
363
  }
@@ -454,7 +454,7 @@ async function resolveTeleports(context) {
454
454
  for (const key in context.__teleportBuffers) {
455
455
  // note: it's OK to await sequentially here because the Promises were
456
456
  // created eagerly in parallel.
457
- context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
457
+ context.teleports[key] = await unrollBuffer(await Promise.all([context.__teleportBuffers[key]]));
458
458
  }
459
459
  }
460
460
  }
@@ -657,11 +657,15 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
657
657
  fallbackRenderFn();
658
658
  }
659
659
  }
660
+ const commentTestRE = /^<!--.*-->$/s;
660
661
  const commentRE = /<!--[^]*?-->/gm;
661
662
  function isComment(item) {
662
- return (typeof item === 'string' &&
663
- commentRE.test(item) &&
664
- !item.replace(commentRE, '').trim());
663
+ if (typeof item !== 'string' || !commentTestRE.test(item))
664
+ return false;
665
+ // if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
666
+ if (item.length <= 8)
667
+ return true;
668
+ return !item.replace(commentRE, '').trim();
665
669
  }
666
670
 
667
671
  function ssrInterpolate(value) {
@@ -669,7 +673,7 @@ function ssrInterpolate(value) {
669
673
  }
670
674
 
671
675
  function toRaw(observed) {
672
- const raw = observed && observed["__v_raw" /* RAW */];
676
+ const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
673
677
  return raw ? toRaw(raw) : observed;
674
678
  }
675
679
 
@@ -689,7 +693,7 @@ function warn(msg, ...args) {
689
693
  const appWarnHandler = instance && instance.appContext.config.warnHandler;
690
694
  const trace = getComponentTrace();
691
695
  if (appWarnHandler) {
692
- callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
696
+ callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
693
697
  msg + args.join(''),
694
698
  instance && instance.proxy,
695
699
  trace
@@ -788,35 +792,35 @@ function formatProp(key, value, raw) {
788
792
  }
789
793
 
790
794
  const ErrorTypeStrings = {
791
- ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
792
- ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
793
- ["c" /* CREATED */]: 'created hook',
794
- ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
795
- ["m" /* MOUNTED */]: 'mounted hook',
796
- ["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
797
- ["u" /* UPDATED */]: 'updated',
798
- ["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
799
- ["um" /* UNMOUNTED */]: 'unmounted hook',
800
- ["a" /* ACTIVATED */]: 'activated hook',
801
- ["da" /* DEACTIVATED */]: 'deactivated hook',
802
- ["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
803
- ["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
804
- ["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
805
- [0 /* SETUP_FUNCTION */]: 'setup function',
806
- [1 /* RENDER_FUNCTION */]: 'render function',
807
- [2 /* WATCH_GETTER */]: 'watcher getter',
808
- [3 /* WATCH_CALLBACK */]: 'watcher callback',
809
- [4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
810
- [5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
811
- [6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
812
- [7 /* VNODE_HOOK */]: 'vnode hook',
813
- [8 /* DIRECTIVE_HOOK */]: 'directive hook',
814
- [9 /* TRANSITION_HOOK */]: 'transition hook',
815
- [10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
816
- [11 /* APP_WARN_HANDLER */]: 'app warnHandler',
817
- [12 /* FUNCTION_REF */]: 'ref function',
818
- [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
819
- [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
795
+ ["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
796
+ ["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
797
+ ["c" /* LifecycleHooks.CREATED */]: 'created hook',
798
+ ["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
799
+ ["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
800
+ ["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
801
+ ["u" /* LifecycleHooks.UPDATED */]: 'updated',
802
+ ["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
803
+ ["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
804
+ ["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
805
+ ["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
806
+ ["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
807
+ ["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
808
+ ["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
809
+ [0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
810
+ [1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
811
+ [2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
812
+ [3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
813
+ [4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
814
+ [5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
815
+ [6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
816
+ [7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
817
+ [8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
818
+ [9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
819
+ [10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
820
+ [11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
821
+ [12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
822
+ [13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
823
+ [14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
820
824
  'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
821
825
  };
822
826
  function callWithErrorHandling(fn, instance, type, args) {
@@ -851,7 +855,7 @@ function handleError(err, instance, type, throwInDev = true) {
851
855
  // app-level handling
852
856
  const appErrorHandler = instance.appContext.config.errorHandler;
853
857
  if (appErrorHandler) {
854
- callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
858
+ callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
855
859
  return;
856
860
  }
857
861
  }
@@ -285,16 +285,16 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
285
285
  push(`<!--]-->`); // close
286
286
  break;
287
287
  default:
288
- if (shapeFlag & 1 /* ELEMENT */) {
288
+ if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
289
289
  renderElementVNode(push, vnode, parentComponent, slotScopeId);
290
290
  }
291
- else if (shapeFlag & 6 /* COMPONENT */) {
291
+ else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
292
292
  push(renderComponentVNode(vnode, parentComponent, slotScopeId));
293
293
  }
294
- else if (shapeFlag & 64 /* TELEPORT */) {
294
+ else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
295
295
  renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
296
296
  }
297
- else if (shapeFlag & 128 /* SUSPENSE */) {
297
+ else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
298
298
  renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
299
299
  }
300
300
  else {
@@ -351,10 +351,10 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
351
351
  }
352
352
  }
353
353
  if (!hasChildrenOverride) {
354
- if (shapeFlag & 8 /* TEXT_CHILDREN */) {
354
+ if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
355
355
  push(shared.escapeHtml(children));
356
356
  }
357
- else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
357
+ else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
358
358
  renderVNodeChildren(push, children, parentComponent, slotScopeId);
359
359
  }
360
360
  }
@@ -451,7 +451,7 @@ async function resolveTeleports(context) {
451
451
  for (const key in context.__teleportBuffers) {
452
452
  // note: it's OK to await sequentially here because the Promises were
453
453
  // created eagerly in parallel.
454
- context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
454
+ context.teleports[key] = await unrollBuffer(await Promise.all([context.__teleportBuffers[key]]));
455
455
  }
456
456
  }
457
457
  }
@@ -654,11 +654,15 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
654
654
  fallbackRenderFn();
655
655
  }
656
656
  }
657
+ const commentTestRE = /^<!--.*-->$/s;
657
658
  const commentRE = /<!--[^]*?-->/gm;
658
659
  function isComment(item) {
659
- return (typeof item === 'string' &&
660
- commentRE.test(item) &&
661
- !item.replace(commentRE, '').trim());
660
+ if (typeof item !== 'string' || !commentTestRE.test(item))
661
+ return false;
662
+ // if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
663
+ if (item.length <= 8)
664
+ return true;
665
+ return !item.replace(commentRE, '').trim();
662
666
  }
663
667
 
664
668
  function ssrInterpolate(value) {