first commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { A as AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default } from './entry-styles-1.mjs-CzJNKBbH.mjs';
|
||||
|
||||
const AppFooterStyles_CJFLV6sm = [
|
||||
AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { AppFooterStyles_CJFLV6sm as default };
|
||||
//# sourceMappingURL=AppFooter-styles.CJFLV6sm.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AppFooter-styles.CJFLV6sm.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/AppFooter-styles.CJFLV6sm.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/CoachingSystem.vue?vue&type=style&index=0&scoped=b904ba0d&inline&used&lang.css
|
||||
var CoachingSystem_vue_vue_type_style_index_0_scoped_b904ba0d_inline_used_lang_default = ".coaching-section[data-v-b904ba0d]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.coaching-inner[data-v-b904ba0d]{background:var(--coaching-bg,#f1f5f9);border-radius:var(--card-radius,16px);grid-template-columns:1.15fr .85fr;align-items:center;gap:30px;padding:calc(clamp(24px,5vw,44px)) calc(clamp(18px,4vw,36px));display:grid}.coaching-badge[data-v-b904ba0d]{color:var(--primary-color,#1e3a8a);background:#fffc;border-radius:9999px;margin-bottom:12px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.coaching-title[data-v-b904ba0d]{color:var(--text-color,#0f172a);letter-spacing:-.6px;margin-bottom:14px;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.coaching-title strong[data-v-b904ba0d]{color:var(--primary-color,#1e3a8a)}.coaching-desc[data-v-b904ba0d]{color:#475569;word-break:keep-all;margin-bottom:22px;font-size:calc(clamp(.85rem,2.2vw,.98rem));line-height:1.6}.coaching-points[data-v-b904ba0d]{flex-direction:column;gap:14px;display:flex}.cp-item[data-v-b904ba0d]{align-items:flex-start;gap:12px;display:flex}.cp-icon[data-v-b904ba0d]{flex-shrink:0;font-size:1.4rem}.cp-title[data-v-b904ba0d]{color:var(--text-color,#0f172a);margin-bottom:2px;font-size:calc(clamp(.88rem,2.2vw,.98rem));font-weight:800}.cp-desc[data-v-b904ba0d]{color:#64748b;word-break:keep-all;font-size:calc(clamp(.76rem,1.8vw,.85rem));line-height:1.45}.visual-card[data-v-b904ba0d]{background:#fff;border-radius:12px;padding:20px;box-shadow:0 8px 24px #00000014}.vc-header[data-v-b904ba0d]{border-bottom:1px solid #e2e8f0;margin-bottom:16px;padding-bottom:10px}.vc-tag[data-v-b904ba0d]{color:var(--accent-color,#d97706);letter-spacing:.5px;font-size:.72rem;font-weight:800;display:block}.vc-title[data-v-b904ba0d]{color:#0f172a;font-size:1.05rem;font-weight:800}.timeline-step[data-v-b904ba0d]{gap:12px;margin-bottom:14px;display:flex;position:relative}.step-circle[data-v-b904ba0d]{color:#475569;background:#e2e8f0;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:24px;height:24px;font-size:.75rem;font-weight:800;display:flex}.timeline-step.active .step-circle[data-v-b904ba0d]{background:var(--accent-color,#d97706);color:#fff}.timeline-step strong[data-v-b904ba0d]{color:#1e293b;margin-bottom:2px;font-size:.85rem;display:block}.timeline-step p[data-v-b904ba0d]{color:#64748b;word-break:keep-all;font-size:.76rem;line-height:1.4}@media (width<=820px){.coaching-inner[data-v-b904ba0d]{grid-template-columns:1fr}}";
|
||||
|
||||
const CoachingSystemStyles_Cdye9kFG = [
|
||||
CoachingSystem_vue_vue_type_style_index_0_scoped_b904ba0d_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { CoachingSystemStyles_Cdye9kFG as default };
|
||||
//# sourceMappingURL=CoachingSystem-styles.Cdye9kFG.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CoachingSystem-styles.Cdye9kFG.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/CoachingSystem-styles-1.mjs-CG6t1zkM.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/CoachingSystem-styles.Cdye9kFG.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/ConsultForm.vue?vue&type=style&index=0&scoped=a1de5e55&inline&used&lang.css
|
||||
var ConsultForm_vue_vue_type_style_index_0_scoped_a1de5e55_inline_used_lang_default = ".consult-section[data-v-a1de5e55]{background:0 0;justify-content:center;align-items:center;width:100%;padding:calc(clamp(35px,6vw,65px)) 16px;display:flex}.consult-card[data-v-a1de5e55]{box-sizing:border-box;background:#fffbf8;border:1px solid #fed7aa;border-radius:16px;width:100%;max-width:580px;padding:calc(clamp(24px,5vw,40px)) calc(clamp(20px,4vw,36px));box-shadow:0 10px 25px #ea580c1a}.consult-header[data-v-a1de5e55]{margin-bottom:24px}.consult-title[data-v-a1de5e55]{color:#c2410c;letter-spacing:-.5px;margin-bottom:8px;font-size:calc(clamp(1.45rem,3.5vw,1.85rem));font-weight:800;line-height:1.3}.consult-desc[data-v-a1de5e55]{color:#9a3412;letter-spacing:-.3px;font-size:calc(clamp(.88rem,2.2vw,.98rem));line-height:1.5}.form-grid[data-v-a1de5e55]{grid-template-columns:1fr 1fr;gap:16px;margin-bottom:18px;display:grid}.form-group[data-v-a1de5e55]{flex-direction:column;gap:6px;display:flex}.form-group.full-width[data-v-a1de5e55]{grid-column:1/-1}.form-label[data-v-a1de5e55]{color:#7c2d12;letter-spacing:-.3px;font-size:.88rem;font-weight:700}.form-input[data-v-a1de5e55],.form-select[data-v-a1de5e55],.form-textarea[data-v-a1de5e55]{color:#1e293b;box-sizing:border-box;background:#fff7ed;border:1px solid #fed7aa;border-radius:12px;outline:none;width:100%;padding:12px 14px;font-family:inherit;font-size:.95rem;transition:all .2s}.form-input[data-v-a1de5e55]::-moz-placeholder{color:#94a3b8;font-size:.9rem}.form-textarea[data-v-a1de5e55]::-moz-placeholder{color:#94a3b8;font-size:.9rem}.form-input[data-v-a1de5e55]::placeholder,.form-textarea[data-v-a1de5e55]::placeholder{color:#94a3b8;font-size:.9rem}.form-input[data-v-a1de5e55]:focus,.form-select[data-v-a1de5e55]:focus,.form-textarea[data-v-a1de5e55]:focus{background:#fff;border-color:#ea580c;box-shadow:0 0 0 3px #ea580c33}.select-wrap[data-v-a1de5e55]{width:100%;position:relative}.form-select[data-v-a1de5e55]{appearance:none;cursor:pointer;background-image:url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20fill%3D%22none%22%20stroke%3D%22%2364748b%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E);background-position:right 14px center;background-repeat:no-repeat;padding-right:36px}.form-textarea[data-v-a1de5e55]{resize:vertical;min-height:90px;line-height:1.5}.privacy-wrap[data-v-a1de5e55]{margin-bottom:22px}.privacy-label[data-v-a1de5e55]{color:#9a3412;cursor:pointer;align-items:flex-start;gap:10px;font-size:.82rem;line-height:1.45;display:flex}.privacy-checkbox[data-v-a1de5e55]{cursor:pointer;accent-color:#ea580c;width:16px;height:16px;margin-top:3px}.button-group[data-v-a1de5e55]{flex-direction:column;gap:12px;display:flex}.btn-submit[data-v-a1de5e55]{color:#fff;cursor:pointer;letter-spacing:-.3px;background:#ea580c;border:none;border-radius:12px;width:100%;padding:16px 20px;font-size:1.08rem;font-weight:800;transition:all .2s;box-shadow:0 4px 14px #0000001f}.btn-submit[data-v-a1de5e55]:hover:not(:disabled){background:#c2410c;transform:translateY(-1px);box-shadow:0 6px 18px #00000029}.btn-submit[data-v-a1de5e55]:disabled{opacity:.7;cursor:not-allowed}.btn-call[data-v-a1de5e55]{text-align:center;color:#9a3412;cursor:pointer;letter-spacing:-.3px;box-sizing:border-box;background:#fff1e6;border:2px solid #ea580c;border-radius:12px;width:100%;padding:15px 20px;font-size:1.02rem;font-weight:800;text-decoration:none;transition:all .2s;display:block}.btn-call[data-v-a1de5e55]:hover{background:#ffe4d6}.success-box[data-v-a1de5e55]{text-align:center;padding:40px 20px}.success-title[data-v-a1de5e55]{color:#c2410c;margin-bottom:12px;font-size:1.25rem;font-weight:800}.success-desc[data-v-a1de5e55]{color:#475569;margin-bottom:24px;font-size:.95rem;line-height:1.6}.btn-reset[data-v-a1de5e55]{color:#ea580c;cursor:pointer;background:0 0;border:1px solid #ea580c;border-radius:8px;padding:10px 24px;font-size:.9rem;font-weight:700}@media (width<=520px){.form-grid[data-v-a1de5e55]{grid-template-columns:1fr;gap:14px}}";
|
||||
|
||||
const ConsultFormStyles_dITK8tm = [
|
||||
ConsultForm_vue_vue_type_style_index_0_scoped_a1de5e55_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { ConsultFormStyles_dITK8tm as default };
|
||||
//# sourceMappingURL=ConsultForm-styles.dIT-K8tm.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ConsultForm-styles.dIT-K8tm.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/ConsultForm-styles-1.mjs-CBZkNvOJ.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/ConsultForm-styles.dIT-K8tm.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/FaqAccordion.vue?vue&type=style&index=0&scoped=b60d9732&inline&used&lang.css
|
||||
var FaqAccordion_vue_vue_type_style_index_0_scoped_b60d9732_inline_used_lang_default = ".faq-section[data-v-b60d9732]{max-width:860px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-b60d9732]{text-align:center;margin-bottom:28px}.section-badge[data-v-b60d9732]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-b60d9732]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-b60d9732]{color:#64748b;word-break:keep-all;margin-top:6px;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.faq-list[data-v-b60d9732]{flex-direction:column;gap:12px;display:flex}.faq-item[data-v-b60d9732]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,12px);overflow:hidden;box-shadow:0 2px 8px #00000008}.faq-question[data-v-b60d9732]{text-align:left;cursor:pointer;width:100%;color:var(--text-color,#0f172a);background:0 0;border:none;gap:12px;padding:calc(clamp(14px,3vw,18px));font-size:calc(clamp(.9rem,2.2vw,1.02rem));font-weight:800}.faq-question[data-v-b60d9732],.q-icon[data-v-b60d9732]{align-items:center;display:flex}.q-icon[data-v-b60d9732]{background:var(--primary-color,#1e3a8a);color:#fff;border-radius:6px;flex-shrink:0;justify-content:center;width:26px;height:26px;font-size:.85rem;font-weight:900}.q-text[data-v-b60d9732]{word-break:keep-all;flex-grow:1;line-height:1.45}.toggle-icon[data-v-b60d9732]{color:#94a3b8;flex-shrink:0;font-size:.8rem}.faq-answer[data-v-b60d9732]{border-top:1px solid var(--border-color,#f1f5f9);background:#f8fafc;gap:12px;padding:0 calc(clamp(14px,3vw,18px)) calc(clamp(16px,3vw,20px));display:flex}.a-icon[data-v-b60d9732]{background:var(--accent-color,#d97706);color:#fff;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;width:26px;height:26px;margin-top:12px;font-size:.85rem;font-weight:900;display:flex}.a-text[data-v-b60d9732]{color:#334155;word-break:keep-all;margin-top:12px;font-size:calc(clamp(.82rem,2vw,.92rem));line-height:1.65}";
|
||||
|
||||
const FaqAccordionStyles_DAcJkXd4 = [
|
||||
FaqAccordion_vue_vue_type_style_index_0_scoped_b60d9732_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { FaqAccordionStyles_DAcJkXd4 as default };
|
||||
//# sourceMappingURL=FaqAccordion-styles.DAcJkXd4.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FaqAccordion-styles.DAcJkXd4.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/FaqAccordion-styles-1.mjs-DdvnJwjo.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/FaqAccordion-styles.DAcJkXd4.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/HeroBanner.vue?vue&type=style&index=0&scoped=e180d4a0&inline&used&lang.css
|
||||
var HeroBanner_vue_vue_type_style_index_0_scoped_e180d4a0_inline_used_lang_default = ".hero-banner[data-v-e180d4a0]{background:var(--hero-gradient,linear-gradient(135deg,#0f172a 0,#1e3a8a 100%));color:#fff;text-align:center;padding:calc(clamp(40px,8vw,80px)) 16px calc(clamp(35px,6vw,60px));position:relative;overflow:hidden;box-shadow:0 4px 20px #00000026}.hero-banner[data-v-e180d4a0]:before{content:\"\";pointer-events:none;background:radial-gradient(circle at 50% 20%,#d9770626,#0000 60%);position:absolute;inset:0}.hero-container[data-v-e180d4a0]{z-index:1;max-width:900px;margin:0 auto;position:relative}.hero-badge-wrap[data-v-e180d4a0]{flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;margin-bottom:20px;display:flex}.hero-badge[data-v-e180d4a0]{background:var(--accent-color,#d97706);color:#fff;letter-spacing:-.3px;padding:6px 14px;font-size:calc(clamp(.78rem,2.2vw,.9rem));font-weight:700}.hero-badge[data-v-e180d4a0],.hero-subbadge[data-v-e180d4a0]{border-radius:9999px;display:inline-block}.hero-subbadge[data-v-e180d4a0]{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);color:#e2e8f0;background:#ffffff26;padding:6px 12px;font-size:calc(clamp(.75rem,2vw,.85rem))}.hero-title[data-v-e180d4a0]{word-break:keep-all;letter-spacing:-.8px;margin-bottom:18px;font-size:calc(clamp(1.65rem,5vw,2.85rem));font-weight:900;line-height:1.3}.region-highlight[data-v-e180d4a0]{color:var(--hero-region-color,#cbd5e1);font-size:.85em;font-weight:700}.subject-highlight[data-v-e180d4a0]{color:var(--accent-light,#fbbf24);text-underline-offset:6px;text-decoration:underline}.hero-desc[data-v-e180d4a0]{color:#e2e8f0;word-break:keep-all;margin-bottom:30px;font-size:calc(clamp(.92rem,2.6vw,1.15rem));line-height:1.65}.hero-cta-group[data-v-e180d4a0]{flex-direction:column;align-items:center;gap:14px;margin-bottom:26px;display:flex}.btn-hero-primary[data-v-e180d4a0]{color:#fff;background:var(--hero-btn-bg,linear-gradient(135deg,#d97706 0,#b45309 100%));border-radius:var(--card-radius,12px);justify-content:center;align-items:center;width:100%;max-width:480px;min-height:48px;padding:calc(clamp(14px,3.5vw,18px)) calc(clamp(20px,5vw,36px));font-size:calc(clamp(.95rem,2.8vw,1.2rem));font-weight:800;transition:transform .2s,box-shadow .2s;display:inline-flex;box-shadow:0 8px 24px #d9770659}.btn-hero-primary[data-v-e180d4a0]:hover{transform:translateY(-2px);box-shadow:0 12px 28px #d9770673}.hero-call-info[data-v-e180d4a0]{color:#cbd5e1;align-items:center;gap:6px;font-size:calc(clamp(.85rem,2.2vw,.95rem));display:flex}.hero-call-info strong[data-v-e180d4a0]{color:#fff;font-size:1.1em}.hero-tags[data-v-e180d4a0]{flex-wrap:wrap;justify-content:center;gap:6px;display:flex}.tag-item[data-v-e180d4a0]{color:#cbd5e1;background:#ffffff14;border:1px solid #ffffff26;border-radius:6px;padding:4px 10px;font-size:calc(clamp(.72rem,1.8vw,.82rem))}";
|
||||
|
||||
const HeroBannerStyles_CvIa3HUq = [
|
||||
HeroBanner_vue_vue_type_style_index_0_scoped_e180d4a0_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { HeroBannerStyles_CvIa3HUq as default };
|
||||
//# sourceMappingURL=HeroBanner-styles.CvIa3HUq.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"HeroBanner-styles.CvIa3HUq.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/HeroBanner-styles-1.mjs-CBpJALnR.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/HeroBanner-styles.CvIa3HUq.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/NearbySchools.vue?vue&type=style&index=0&scoped=3f609b93&inline&used&lang.css
|
||||
var NearbySchools_vue_vue_type_style_index_0_scoped_3f609b93_inline_used_lang_default = ".schools-section[data-v-3f609b93]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-3f609b93]{text-align:center;margin-bottom:30px}.section-badge[data-v-3f609b93]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-3f609b93]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-3f609b93]{color:#64748b;word-break:keep-all;max-width:720px;margin-top:8px;margin-left:auto;margin-right:auto;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.schools-grid[data-v-3f609b93]{grid-template-columns:repeat(2,1fr);gap:18px;display:grid}.school-card[data-v-3f609b93]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,14px);padding:calc(clamp(18px,3.5vw,26px));position:relative;box-shadow:0 4px 14px #0000000a}.school-type-badge[data-v-3f609b93]{border-radius:4px;margin-bottom:10px;padding:3px 8px;font-size:.75rem;font-weight:700;display:inline-block}.school-type-badge.middle[data-v-3f609b93]{color:#0369a1;background:#e0f2fe}.school-type-badge.high[data-v-3f609b93]{color:#b45309;background:#fef3c7}.school-type-badge.elem[data-v-3f609b93]{color:#475569;background:#f1f5f9}.school-name[data-v-3f609b93]{color:var(--text-color,#0f172a);letter-spacing:-.4px;margin-bottom:10px;font-size:calc(clamp(1.05rem,2.6vw,1.25rem));font-weight:800}.school-focus[data-v-3f609b93]{color:#334155;border-bottom:1px dashed var(--border-color,#e2e8f0);word-break:keep-all;margin-bottom:14px;padding-bottom:12px;font-size:calc(clamp(.82rem,2vw,.92rem));line-height:1.6}.school-checklist[data-v-3f609b93]{flex-direction:column;gap:8px;list-style:none;display:flex}.school-checklist li[data-v-3f609b93]{color:#475569;word-break:keep-all;font-size:calc(clamp(.8rem,2vw,.9rem));line-height:1.5}@media (width<=640px){.schools-grid[data-v-3f609b93]{grid-template-columns:1fr}}";
|
||||
|
||||
const NearbySchoolsStyles_C57PEwif = [
|
||||
NearbySchools_vue_vue_type_style_index_0_scoped_3f609b93_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { NearbySchoolsStyles_C57PEwif as default };
|
||||
//# sourceMappingURL=NearbySchools-styles.C57PEwif.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NearbySchools-styles.C57PEwif.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/NearbySchools-styles-1.mjs-BJEoqjx7.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/NearbySchools-styles.C57PEwif.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/ProcessGuide.vue?vue&type=style&index=0&scoped=686ff019&inline&used&lang.css
|
||||
var ProcessGuide_vue_vue_type_style_index_0_scoped_686ff019_inline_used_lang_default = ".process-section[data-v-686ff019]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-686ff019]{text-align:center;margin-bottom:28px}.section-badge[data-v-686ff019]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-686ff019]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-686ff019]{color:#64748b;word-break:keep-all;margin-top:6px;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.process-flow[data-v-686ff019]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,16px);justify-content:space-between;align-items:center;gap:10px;padding:calc(clamp(20px,4vw,32px)) calc(clamp(16px,3vw,24px));display:flex;box-shadow:0 4px 14px #0000000a}.flow-step[data-v-686ff019]{text-align:center;flex:1}.step-num-circle[data-v-686ff019]{background:var(--primary-color,#1e3a8a);color:#fff;border-radius:50%;justify-content:center;align-items:center;width:38px;height:38px;margin:0 auto 12px;font-size:1.1rem;font-weight:900;display:flex}.flow-step.highlight .step-num-circle[data-v-686ff019]{background:var(--accent-color,#d97706)}.step-label[data-v-686ff019]{color:var(--text-color,#0f172a);word-break:keep-all;margin-bottom:6px;font-size:calc(clamp(.88rem,2.2vw,1rem));font-weight:800}.step-desc[data-v-686ff019]{color:#64748b;word-break:keep-all;font-size:calc(clamp(.74rem,1.8vw,.82rem));line-height:1.45}.flow-arrow[data-v-686ff019]{color:#cbd5e1;font-size:1.2rem;font-weight:900}@media (width<=768px){.process-flow[data-v-686ff019]{flex-direction:column;gap:18px}.flow-arrow[data-v-686ff019]{transform:rotate(90deg)}}";
|
||||
|
||||
const ProcessGuideStyles_Biu6P_Tv = [
|
||||
ProcessGuide_vue_vue_type_style_index_0_scoped_686ff019_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { ProcessGuideStyles_Biu6P_Tv as default };
|
||||
//# sourceMappingURL=ProcessGuide-styles.Biu6P_Tv.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ProcessGuide-styles.Biu6P_Tv.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/ProcessGuide-styles-1.mjs-Olz3Llhe.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/ProcessGuide-styles.Biu6P_Tv.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/QuickMetrics.vue?vue&type=style&index=0&scoped=21ea3ae5&inline&used&lang.css
|
||||
var QuickMetrics_vue_vue_type_style_index_0_scoped_21ea3ae5_inline_used_lang_default = ".metrics-section[data-v-21ea3ae5]{z-index:2;max-width:1080px;margin:-24px auto 40px;padding:0 16px;position:relative}.metrics-grid[data-v-21ea3ae5]{grid-template-columns:repeat(4,1fr);gap:12px;display:grid}.metric-card[data-v-21ea3ae5]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,12px);text-align:center;padding:calc(clamp(14px,2.5vw,20px)) 10px;transition:transform .2s,box-shadow .2s;box-shadow:0 4px 16px #0000000f}.metric-card[data-v-21ea3ae5]:hover{transform:translateY(-3px);box-shadow:0 8px 24px #0000001a}.metric-icon[data-v-21ea3ae5]{margin-bottom:4px;font-size:calc(clamp(1.2rem,3vw,1.6rem))}.metric-num[data-v-21ea3ae5]{color:var(--primary-color,#1e3a8a);letter-spacing:-.5px;font-size:calc(clamp(1.15rem,3.2vw,1.8rem));font-weight:900;line-height:1.2}.metric-label[data-v-21ea3ae5]{color:var(--text-color,#1e293b);word-break:keep-all;margin-top:4px;font-size:calc(clamp(.75rem,2vw,.88rem));font-weight:700}.metric-sub[data-v-21ea3ae5]{color:#64748b;word-break:keep-all;margin-top:2px;font-size:calc(clamp(.68rem,1.7vw,.78rem))}@media (width<=768px){.metrics-grid[data-v-21ea3ae5]{grid-template-columns:repeat(2,1fr);gap:10px}}@media (width<=320px){.metrics-grid[data-v-21ea3ae5]{grid-template-columns:1fr;gap:8px}}";
|
||||
|
||||
const QuickMetricsStyles_C4BIqcXM = [
|
||||
QuickMetrics_vue_vue_type_style_index_0_scoped_21ea3ae5_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { QuickMetricsStyles_C4BIqcXM as default };
|
||||
//# sourceMappingURL=QuickMetrics-styles.C4BIqcXM.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"QuickMetrics-styles.C4BIqcXM.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/QuickMetrics-styles-1.mjs-CletefM0.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/QuickMetrics-styles.C4BIqcXM.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/SubjectMastery.vue?vue&type=style&index=0&scoped=86323762&inline&used&lang.css
|
||||
var SubjectMastery_vue_vue_type_style_index_0_scoped_86323762_inline_used_lang_default = ".mastery-section[data-v-86323762]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-86323762]{text-align:center;margin-bottom:28px}.section-badge[data-v-86323762]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-86323762]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-86323762]{color:#64748b;word-break:keep-all;margin-top:6px;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.grade-focus-grid[data-v-86323762]{grid-template-columns:repeat(2,1fr);gap:18px;margin-bottom:30px;display:grid}.grade-focus-card[data-v-86323762]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,14px);flex-direction:column;padding:calc(clamp(18px,3.5vw,24px));display:flex;box-shadow:0 4px 14px #0000000a}.grade-header[data-v-86323762]{margin-bottom:12px}.grade-pill[data-v-86323762]{color:#fff;background:var(--primary-color,#1e3a8a);border-radius:9999px;margin-bottom:6px;padding:3px 10px;font-size:.75rem;font-weight:800;display:inline-block}.grade-pill.accent-pill[data-v-86323762]{background:var(--accent-color,#d97706)}.focus-title[data-v-86323762]{color:var(--text-color,#0f172a);letter-spacing:-.4px;font-size:calc(clamp(1.02rem,2.5vw,1.2rem));font-weight:800}.exam-pattern-box[data-v-86323762]{border-left:3px solid var(--accent-color,#d97706);color:#334155;word-break:keep-all;background:#f8fafc;border-radius:4px;margin-bottom:14px;padding:10px 12px;font-size:calc(clamp(.78rem,2vw,.86rem));line-height:1.55}.badge-tag[data-v-86323762]{color:var(--accent-color,#d97706);margin-bottom:3px;font-size:.82em;font-weight:800;display:block}.points-list[data-v-86323762]{flex-direction:column;gap:10px;list-style:none;display:flex}.points-list li[data-v-86323762]{color:#475569;word-break:keep-all;align-items:flex-start;gap:8px;font-size:calc(clamp(.8rem,2vw,.88rem));line-height:1.5;display:flex}.check-icon[data-v-86323762]{color:#10b981;flex-shrink:0;font-weight:900}.roadmap-steps[data-v-86323762]{flex-direction:column;gap:12px;margin-top:6px;display:flex}.rm-step[data-v-86323762]{align-items:flex-start;gap:10px;display:flex}.rm-badge[data-v-86323762]{color:var(--primary-color,#1e3a8a);background:#1e3a8a14;border-radius:4px;flex-shrink:0;margin-top:2px;padding:2px 6px;font-size:.7rem;font-weight:800}.rm-step strong[data-v-86323762]{color:#1e293b;margin-bottom:2px;font-size:.86rem;display:block}.rm-step p[data-v-86323762]{color:#64748b;word-break:keep-all;font-size:.78rem;line-height:1.45}.skills-wrap[data-v-86323762]{background:var(--skills-bg,#f8fafc);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,14px);padding:calc(clamp(20px,4vw,30px))}.skills-title[data-v-86323762]{color:var(--text-color,#0f172a);text-align:center;letter-spacing:-.4px;margin-bottom:20px;font-size:calc(clamp(1.05rem,2.8vw,1.3rem));font-weight:800}.skills-grid[data-v-86323762]{grid-template-columns:repeat(3,1fr);gap:14px;display:grid}.skill-item[data-v-86323762]{border:1px solid var(--border-color,#e2e8f0);background:#fff;border-radius:10px;padding:16px;box-shadow:0 2px 8px #00000008}.skill-num[data-v-86323762]{color:var(--accent-color,#d97706);margin-bottom:4px;font-size:1.1rem;font-weight:900}.skill-name[data-v-86323762]{color:var(--text-color,#1e293b);margin-bottom:6px;font-size:calc(clamp(.9rem,2.2vw,1rem));font-weight:800}.skill-desc[data-v-86323762]{color:#64748b;word-break:keep-all;font-size:calc(clamp(.78rem,1.9vw,.85rem));line-height:1.5}@media (width<=768px){.grade-focus-grid[data-v-86323762],.skills-grid[data-v-86323762]{grid-template-columns:1fr}}";
|
||||
|
||||
const SubjectMasteryStyles_DiHpurSx = [
|
||||
SubjectMastery_vue_vue_type_style_index_0_scoped_86323762_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { SubjectMasteryStyles_DiHpurSx as default };
|
||||
//# sourceMappingURL=SubjectMastery-styles.DiHpurSx.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SubjectMastery-styles.DiHpurSx.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/SubjectMastery-styles-1.mjs-DxpJWvI3.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/SubjectMastery-styles.DiHpurSx.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/SuccessStories.vue?vue&type=style&index=0&scoped=c02790d7&inline&used&lang.css
|
||||
var SuccessStories_vue_vue_type_style_index_0_scoped_c02790d7_inline_used_lang_default = ".stories-section[data-v-c02790d7]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-c02790d7]{text-align:center;margin-bottom:28px}.section-badge[data-v-c02790d7]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-c02790d7]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-c02790d7]{color:#64748b;word-break:keep-all;margin-top:6px;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.stories-grid[data-v-c02790d7]{grid-template-columns:repeat(3,1fr);gap:16px;display:grid}.story-card[data-v-c02790d7]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,14px);flex-direction:column;justify-content:space-between;padding:calc(clamp(18px,3vw,24px));display:flex;box-shadow:0 4px 14px #0000000a}.story-top[data-v-c02790d7]{margin-bottom:12px}.student-info[data-v-c02790d7]{color:#475569;margin-bottom:6px;font-size:calc(clamp(.82rem,2vw,.9rem));font-weight:800;display:block}.grade-jump[data-v-c02790d7]{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.before[data-v-c02790d7]{color:#94a3b8;font-size:.82rem;text-decoration:line-through}.arrow[data-v-c02790d7]{color:var(--accent-color,#d97706)}.after[data-v-c02790d7],.arrow[data-v-c02790d7]{font-weight:900}.after[data-v-c02790d7]{color:var(--primary-color,#1e3a8a);font-size:calc(clamp(.95rem,2.4vw,1.1rem))}.story-review[data-v-c02790d7]{color:#334155;word-break:keep-all;flex-grow:1;margin-bottom:14px;font-size:calc(clamp(.82rem,2vw,.92rem));line-height:1.6}.story-sub[data-v-c02790d7]{color:#94a3b8;border-top:1px dashed var(--border-color,#e2e8f0);padding-top:10px;font-size:.75rem}@media (width<=820px){.stories-grid[data-v-c02790d7]{grid-template-columns:1fr}}";
|
||||
|
||||
const SuccessStoriesStyles_DsOt6tgx = [
|
||||
SuccessStories_vue_vue_type_style_index_0_scoped_c02790d7_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { SuccessStoriesStyles_DsOt6tgx as default };
|
||||
//# sourceMappingURL=SuccessStories-styles.DsOt6tgx.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SuccessStories-styles.DsOt6tgx.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/SuccessStories-styles-1.mjs-BZOEicK_.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/SuccessStories-styles.DsOt6tgx.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region components/TeacherVerification.vue?vue&type=style&index=0&scoped=3a1b2ceb&inline&used&lang.css
|
||||
var TeacherVerification_vue_vue_type_style_index_0_scoped_3a1b2ceb_inline_used_lang_default = ".teacher-section[data-v-3a1b2ceb]{max-width:1080px;margin:0 auto 50px;padding:0 16px}.section-header[data-v-3a1b2ceb]{text-align:center;margin-bottom:28px}.section-badge[data-v-3a1b2ceb]{color:var(--primary-color,#1e3a8a);background:var(--badge-bg,#1e3a8a14);border-radius:9999px;margin-bottom:8px;padding:5px 12px;font-size:calc(clamp(.78rem,2vw,.88rem));font-weight:700;display:inline-block}.section-title[data-v-3a1b2ceb]{color:var(--text-color,#1e293b);letter-spacing:-.6px;word-break:keep-all;font-size:calc(clamp(1.3rem,3.8vw,1.95rem));font-weight:800;line-height:1.35}.section-desc[data-v-3a1b2ceb]{color:#64748b;word-break:keep-all;max-width:680px;margin-top:6px;margin-left:auto;margin-right:auto;font-size:calc(clamp(.85rem,2.2vw,.98rem))}.steps-grid[data-v-3a1b2ceb]{grid-template-columns:repeat(4,1fr);gap:14px;display:grid}.step-card[data-v-3a1b2ceb]{background:var(--bg-card,#fff);border:1px solid var(--border-color,#e2e8f0);border-radius:var(--card-radius,14px);text-align:center;padding:calc(clamp(16px,3vw,22px)) 14px;box-shadow:0 3px 12px #0000000a}.step-badge[data-v-3a1b2ceb]{color:var(--accent-color,#d97706);background:#d977061a;border-radius:4px;margin-bottom:8px;padding:2px 8px;font-size:.72rem;font-weight:800;display:inline-block}.step-icon[data-v-3a1b2ceb]{margin-bottom:8px;font-size:2rem}.step-title[data-v-3a1b2ceb]{color:var(--text-color,#0f172a);word-break:keep-all;margin-bottom:6px;font-size:calc(clamp(.92rem,2.2vw,1.05rem));font-weight:800}.step-desc[data-v-3a1b2ceb]{color:#64748b;word-break:keep-all;font-size:calc(clamp(.75rem,1.8vw,.84rem));line-height:1.5}@media (width<=768px){.steps-grid[data-v-3a1b2ceb]{grid-template-columns:repeat(2,1fr)}}@media (width<=360px){.steps-grid[data-v-3a1b2ceb]{grid-template-columns:1fr}}";
|
||||
|
||||
const TeacherVerificationStyles_CY_h0OMc = [
|
||||
TeacherVerification_vue_vue_type_style_index_0_scoped_3a1b2ceb_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { TeacherVerificationStyles_CY_h0OMc as default };
|
||||
//# sourceMappingURL=TeacherVerification-styles.CY_h0OMc.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TeacherVerification-styles.CY_h0OMc.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/TeacherVerification-styles-1.mjs-DoOVuhR1.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/TeacherVerification-styles.CY_h0OMc.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,100 @@
|
||||
import { _ as _plugin_vue_export_helper_default, u as useHead, a as useRuntimeConfig } from '../virtual/entry.mjs';
|
||||
import { p as parseRouteSlug, g as generateSeoMeta, H as HeroBanner_default, Q as QuickMetrics_default, N as NearbySchools_default, S as SubjectMastery_default, T as TeacherVerification_default, C as CoachingSystem_default, a as SuccessStories_default, P as ProcessGuide_default, F as FaqAccordion_default, b as ConsultForm_default, c as getCurriculumBySubject } from './seoHelper-Dn7JBAuK.mjs';
|
||||
import { mergeProps, unref, useSSRContext } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent } from 'vue/server-renderer';
|
||||
import './nitro.mjs';
|
||||
import 'unhead/server';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'nostics';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'devalue';
|
||||
|
||||
//#region pages/[...slug].vue
|
||||
var _sfc_main = {
|
||||
__name: "[...slug]",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
const route = useRoute();
|
||||
const config = useRuntimeConfig();
|
||||
const slug = route.params.slug;
|
||||
const parsed = parseRouteSlug(slug);
|
||||
const curriculum = getCurriculumBySubject(parsed.subjectKey);
|
||||
const seo = generateSeoMeta(parsed, config.public.siteName, config.public.siteDomain);
|
||||
useHead({
|
||||
title: seo.title,
|
||||
meta: seo.meta,
|
||||
link: seo.link,
|
||||
script: seo.script
|
||||
});
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_HeroBanner = HeroBanner_default;
|
||||
const _component_QuickMetrics = QuickMetrics_default;
|
||||
const _component_NearbySchools = NearbySchools_default;
|
||||
const _component_SubjectMastery = SubjectMastery_default;
|
||||
const _component_TeacherVerification = TeacherVerification_default;
|
||||
const _component_CoachingSystem = CoachingSystem_default;
|
||||
const _component_SuccessStories = SuccessStories_default;
|
||||
const _component_ProcessGuide = ProcessGuide_default;
|
||||
const _component_FaqAccordion = FaqAccordion_default;
|
||||
const _component_ConsultForm = ConsultForm_default;
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "landing-page-wrap" }, _attrs))} data-v-81d99cec><div class="ad-location-bar" data-v-81d99cec><span class="loc-badge-tag" data-v-81d99cec>[지역센터]</span><span class="loc-text" data-v-81d99cec>${ssrInterpolate(unref(parsed).shortRegionName)} (${ssrInterpolate(unref(parsed).sigungu)}) 관내 초·중·고 전담</span><span class="loc-tag" data-v-81d99cec>1:1 맞춤 배정 센터</span></div>`);
|
||||
_push(ssrRenderComponent(_component_HeroBanner, {
|
||||
region: unref(parsed).region,
|
||||
shortRegionName: unref(parsed).shortRegionName,
|
||||
grade: unref(parsed).grade,
|
||||
subjectName: unref(parsed).subjectName
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_QuickMetrics, { regionDong: unref(parsed).dong }, null, _parent));
|
||||
_push(ssrRenderComponent(_component_NearbySchools, {
|
||||
regionDong: unref(parsed).dong,
|
||||
grade: unref(parsed).grade,
|
||||
subjectName: unref(parsed).subjectName
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_SubjectMastery, {
|
||||
regionDong: unref(parsed).dong,
|
||||
grade: unref(parsed).grade,
|
||||
curriculum: unref(curriculum)
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_TeacherVerification, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_CoachingSystem, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_SuccessStories, {
|
||||
regionDong: unref(parsed).dong,
|
||||
grade: unref(parsed).grade,
|
||||
subjectName: unref(parsed).subjectName
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_ProcessGuide, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_FaqAccordion, {
|
||||
regionDong: unref(parsed).dong,
|
||||
grade: unref(parsed).grade,
|
||||
subjectName: unref(parsed).subjectName
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_ConsultForm, {
|
||||
regionName: unref(parsed).shortRegionName,
|
||||
defaultGrade: unref(parsed).grade,
|
||||
defaultSubject: unref(parsed).subjectName
|
||||
}, null, _parent));
|
||||
_push(`</div>`);
|
||||
};
|
||||
}
|
||||
};
|
||||
var _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/[...slug].vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
var ____slug__default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["__scopeId", "data-v-81d99cec"]]);
|
||||
|
||||
export { ____slug__default as default };
|
||||
//# sourceMappingURL=_...slug_-D-7ch2s3.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_...slug_-D-7ch2s3.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/_...slug_-D-7ch2s3.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region pages/[...slug].vue?vue&type=style&index=0&scoped=81d99cec&inline&used&lang.css
|
||||
var ____slug__vue_vue_type_style_index_0_scoped_81d99cec_inline_used_lang_default = ".landing-page-wrap[data-v-81d99cec]{width:100%;overflow-x:hidden}.ad-location-bar[data-v-81d99cec]{color:#334155;flex-wrap:wrap;align-items:center;gap:8px;max-width:1080px;margin:10px auto;padding:8px 16px;font-size:calc(clamp(.78rem,2vw,.88rem));display:flex}.loc-pin[data-v-81d99cec]{font-size:1rem}.loc-text[data-v-81d99cec]{font-weight:700}.loc-tag[data-v-81d99cec],.loc-text[data-v-81d99cec]{color:var(--primary-color,#1e3a8a)}.loc-tag[data-v-81d99cec]{background:var(--badge-bg,#1e3a8a14);border-radius:4px;padding:2px 8px;font-size:.75rem;font-weight:800}";
|
||||
|
||||
const ____slug_Styles_CT2yr3kk = [
|
||||
____slug__vue_vue_type_style_index_0_scoped_81d99cec_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { ____slug_Styles_CT2yr3kk as default };
|
||||
//# sourceMappingURL=_...slug_-styles.CT2yr3kk.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"_...slug_-styles.CT2yr3kk.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/_...slug_-styles-1.mjs-BtpLjWAQ.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/_...slug_-styles.CT2yr3kk.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { a as app_vue_vue_type_style_index_0_inline_used_lang_default } from './entry-styles-2.mjs-BVOYfNT6.mjs';
|
||||
|
||||
const appStyles_Cw0M3vbz = [
|
||||
app_vue_vue_type_style_index_0_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { appStyles_Cw0M3vbz as default };
|
||||
//# sourceMappingURL=app-styles.Cw0M3vbz.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"app-styles.Cw0M3vbz.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/app-styles.Cw0M3vbz.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,5 @@
|
||||
//#region components/AppFooter.vue?vue&type=style&index=0&scoped=3b29a045&inline&used&lang.css
|
||||
var AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default = ".site-footer[data-v-3b29a045]{background:var(--footer-bg,#0f172a);color:#94a3b8;border-top:1px solid #ffffff14;padding:calc(clamp(30px,5vw,50px)) 16px;font-size:calc(clamp(.72rem,1.8vw,.82rem))}.footer-container[data-v-3b29a045]{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:24px;max-width:1080px;margin:0 auto;display:flex}.footer-info[data-v-3b29a045]{flex:500px}.footer-brand[data-v-3b29a045]{color:#fff;margin-bottom:8px;font-size:calc(clamp(1rem,2.4vw,1.15rem));font-weight:800}.footer-meta[data-v-3b29a045]{word-break:keep-all;margin-bottom:12px;line-height:1.6}.footer-copy[data-v-3b29a045]{color:#64748b}.footer-links[data-v-3b29a045]{flex-shrink:0;align-items:center;gap:10px;display:flex}.f-link[data-v-3b29a045]{color:#cbd5e1}.f-divider[data-v-3b29a045]{color:#475569}@media (width<=640px){.footer-container[data-v-3b29a045]{flex-direction:column;gap:16px}}";
|
||||
|
||||
export { AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default as A };
|
||||
//# sourceMappingURL=entry-styles-1.mjs-CzJNKBbH.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"entry-styles-1.mjs-CzJNKBbH.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/entry-styles-1.mjs-CzJNKBbH.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,5 @@
|
||||
//#region app.vue?vue&type=style&index=0&inline&used&lang.css
|
||||
var app_vue_vue_type_style_index_0_inline_used_lang_default = "*,:after,:before{box-sizing:border-box;margin:0;padding:0}html{color:var(--text-color,#1e293b);-webkit-text-size-adjust:100%;word-break:keep-all;font-family:Pretendard,-apple-system,BlinkMacSystemFont,system-ui,Roboto,Helvetica Neue,Segoe UI,Apple SD Gothic Neo,Noto Sans KR,Malgun Gothic,sans-serif;font-size:16px;line-height:1.5}body,html{background-color:var(--bg-body,#fff);overflow-x:hidden}body{width:100%;min-width:280px}.site-wrapper{flex-direction:column;width:100%;min-height:100vh;display:flex;overflow-x:hidden}.site-main{flex:1;width:100%}a{color:inherit;text-decoration:none}button,input,select,textarea{font-family:inherit;font-size:inherit}";
|
||||
|
||||
export { app_vue_vue_type_style_index_0_inline_used_lang_default as a };
|
||||
//# sourceMappingURL=entry-styles-2.mjs-BVOYfNT6.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"entry-styles-2.mjs-BVOYfNT6.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/entry-styles-2.mjs-BVOYfNT6.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { A as AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default } from './entry-styles-1.mjs-CzJNKBbH.mjs';
|
||||
import { a as app_vue_vue_type_style_index_0_inline_used_lang_default } from './entry-styles-2.mjs-BVOYfNT6.mjs';
|
||||
|
||||
const entryStyles_Do9mzw8X = [
|
||||
AppFooter_vue_vue_type_style_index_0_scoped_3b29a045_inline_used_lang_default,
|
||||
app_vue_vue_type_style_index_0_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { entryStyles_Do9mzw8X as default };
|
||||
//# sourceMappingURL=entry-styles.Do9mzw8X.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"entry-styles.Do9mzw8X.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/entry-styles.Do9mzw8X.mjs"],"names":["style_0","style_1"],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,419 @@
|
||||
import { _ as _plugin_vue_export_helper_default, u as useHead, b as useRouter, i as isAbsoluteHref, e as encodeRoutePath, s as sanitizeAnchorHref, n as navigateTo, r as resolveRouteObject, c as isRootedPath, a as useRuntimeConfig, d as useNuxtApp, f as nuxtLinkDefaults } from '../virtual/entry.mjs';
|
||||
import { useSSRContext, mergeProps, withCtx, createTextVNode, toDisplayString, defineComponent, resolveComponent, shallowRef, h, unref, computed } from 'vue';
|
||||
import { B as joinURL, M as parseQuery, O as hasProtocol, P as withTrailingSlash, Q as withoutTrailingSlash } from './nitro.mjs';
|
||||
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent } from 'vue/server-renderer';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'nostics';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'unhead/server';
|
||||
import 'devalue';
|
||||
import 'vue-router';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
|
||||
//#region ../site1/node_modules/nuxt/dist/app/components/nuxt-link.js
|
||||
var firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);
|
||||
/* @__NO_SIDE_EFFECTS__ */
|
||||
function defineNuxtLink(options) {
|
||||
const componentName = options.componentName || "NuxtLink";
|
||||
function isHashLinkWithoutHashMode(link) {
|
||||
return typeof link === "string" && link.startsWith("#");
|
||||
}
|
||||
function resolveTrailingSlashBehavior(to, resolve, trailingSlash) {
|
||||
const effectiveTrailingSlash = trailingSlash ?? options.trailingSlash;
|
||||
if (!to || effectiveTrailingSlash !== "append" && effectiveTrailingSlash !== "remove") return to;
|
||||
if (typeof to === "string") return applyTrailingSlashBehavior(to, effectiveTrailingSlash);
|
||||
const path = "path" in to && to.path !== void 0 ? to.path : resolve(to).path;
|
||||
return {
|
||||
...to,
|
||||
name: void 0,
|
||||
path: applyTrailingSlashBehavior(path, effectiveTrailingSlash)
|
||||
};
|
||||
}
|
||||
/**
|
||||
* The link state `<NuxtLink>` renders with. Kept separate from `useNuxtLink` so the component
|
||||
* does not resolve the `<RouterLink>` link state backing `route`/`isActive`/`isExactActive`,
|
||||
* which it never reads.
|
||||
*/
|
||||
function useLinkTarget(props) {
|
||||
const router = useRouter();
|
||||
const config = /* @__PURE__ */ useRuntimeConfig();
|
||||
const rootedHref = router.options?.history?.createHref ?? ((path) => joinURL(config.app.baseURL, path));
|
||||
const hasTarget = computed(() => !!unref(props.target) && unref(props.target) !== "_self");
|
||||
const isAbsoluteUrl = computed(() => {
|
||||
const path = unref(props.to) || unref(props.href) || "";
|
||||
return typeof path === "string" && isAbsoluteHref(path);
|
||||
});
|
||||
const isExternal = computed(() => {
|
||||
if (unref(props.external)) return true;
|
||||
const path = unref(props.to) || unref(props.href) || "";
|
||||
if (typeof path === "object") return false;
|
||||
return path === "" || isAbsoluteUrl.value;
|
||||
});
|
||||
const to = computed(() => {
|
||||
const path = unref(props.to) || unref(props.href) || "";
|
||||
if (isExternal.value) return path;
|
||||
return resolveTrailingSlashBehavior(path, router.resolve, unref(props.trailingSlash));
|
||||
});
|
||||
const href = computed(() => {
|
||||
const effectiveTrailingSlash = unref(props.trailingSlash) ?? options.trailingSlash;
|
||||
if (!to.value || isAbsoluteUrl.value || isHashLinkWithoutHashMode(to.value)) {
|
||||
const raw = to.value;
|
||||
return typeof raw === "string" ? sanitizeAnchorHref(raw) : raw;
|
||||
}
|
||||
if (isExternal.value) {
|
||||
const path = typeof to.value === "object" && "path" in to.value ? resolveRouteObject(to.value) : to.value;
|
||||
const href = typeof path === "object" ? router.resolve(path).href : path;
|
||||
const safe = typeof href === "string" ? sanitizeAnchorHref(href) : href;
|
||||
return safe === null ? null : applyTrailingSlashBehavior(safe, effectiveTrailingSlash);
|
||||
}
|
||||
if (typeof to.value === "object") return router.resolve(to.value)?.href ?? null;
|
||||
return applyTrailingSlashBehavior(isRootedPath(to.value) ? rootedHref(to.value) : router.resolve(to.value).href, effectiveTrailingSlash);
|
||||
});
|
||||
return {
|
||||
to,
|
||||
hasTarget,
|
||||
isAbsoluteUrl,
|
||||
isExternal,
|
||||
href,
|
||||
async navigate(_e) {
|
||||
if (href.value === null) return;
|
||||
await navigateTo(href.value, {
|
||||
replace: unref(props.replace),
|
||||
external: isExternal.value || hasTarget.value
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
function useNuxtLink(props) {
|
||||
const router = useRouter();
|
||||
const target = useLinkTarget(props);
|
||||
const builtinRouterLink = resolveComponent("RouterLink");
|
||||
const useBuiltinLink = builtinRouterLink && typeof builtinRouterLink !== "string" ? builtinRouterLink.useLink : void 0;
|
||||
const link = target.isExternal.value ? void 0 : useBuiltinLink?.({
|
||||
...props,
|
||||
to: target.to,
|
||||
viewTransition: unref(props.viewTransition)
|
||||
});
|
||||
return {
|
||||
...target,
|
||||
isActive: link?.isActive ?? computed(() => target.to.value === router.currentRoute.value.path),
|
||||
isExactActive: link?.isExactActive ?? computed(() => target.to.value === router.currentRoute.value.path),
|
||||
route: link?.route ?? computed(() => router.resolve(target.to.value))
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Render an internal link as a plain anchor, matching the markup `<RouterLink>` produces
|
||||
* for the same location.
|
||||
*/
|
||||
function renderStaticInternalLink(props, slots, router, rawTo) {
|
||||
const route = router.resolve(resolveTrailingSlashBehavior(rawTo, router.resolve, props.trailingSlash));
|
||||
const currentRoute = router.currentRoute.value;
|
||||
const index = activeRecordIndex(route, currentRoute);
|
||||
const isActive = index > -1 && includesParams(currentRoute.params, route.params);
|
||||
const isExactActive = index > -1 && index === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.params);
|
||||
let dataInternal;
|
||||
const routerOptions = router.options;
|
||||
const href = sanitizeAnchorHref(route.href);
|
||||
return h("a", {
|
||||
"aria-current": isExactActive ? props.ariaCurrentValue ?? "page" : null,
|
||||
href,
|
||||
"class": {
|
||||
[getLinkClass(props.activeClass || options.activeClass, routerOptions.linkActiveClass, "router-link-active")]: isActive,
|
||||
[getLinkClass(props.exactActiveClass || options.exactActiveClass, routerOptions.linkExactActiveClass, "router-link-exact-active")]: isExactActive
|
||||
},
|
||||
"rel": props.rel || void 0,
|
||||
"data-internal": dataInternal
|
||||
}, slots.default?.({
|
||||
route,
|
||||
href,
|
||||
isActive,
|
||||
isExactActive,
|
||||
navigate: () => navigateTo(route.href, { replace: props.replace })
|
||||
}));
|
||||
}
|
||||
return defineComponent({
|
||||
name: componentName,
|
||||
props: {
|
||||
to: {
|
||||
type: [String, Object],
|
||||
required: false
|
||||
},
|
||||
href: {
|
||||
type: [String, Object],
|
||||
required: false
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
rel: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
noRel: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
prefetch: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
prefetchOn: {
|
||||
type: [String, Object],
|
||||
required: false
|
||||
},
|
||||
noPrefetch: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
activeClass: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
exactActiveClass: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
prefetchedClass: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
replace: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
ariaCurrentValue: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
external: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
custom: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
trailingSlash: {
|
||||
type: String,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
useLink: useNuxtLink,
|
||||
setup(props, { slots }) {
|
||||
const router = useRouter();
|
||||
if (!props.custom) {
|
||||
const rawTo = props.to || props.href || "";
|
||||
if (!(props.external || typeof rawTo === "string" && (rawTo === "" || isAbsoluteHref(rawTo))) && !isHashLinkWithoutHashMode(rawTo) && (!props.target || props.target === "_self")) return () => renderStaticInternalLink(props, slots, router, rawTo);
|
||||
}
|
||||
const routerLinkComponent = resolveComponent("RouterLink");
|
||||
const { to, href, navigate, isExternal, hasTarget, isAbsoluteUrl } = useLinkTarget(props);
|
||||
const prefetched = shallowRef(false);
|
||||
const el = void 0;
|
||||
const elRef = void 0;
|
||||
function shouldPrefetch(mode) {
|
||||
return false;
|
||||
}
|
||||
async function prefetch(nuxtApp = useNuxtApp()) {}
|
||||
return () => {
|
||||
const target = props.target || null;
|
||||
const rel = firstNonUndefined(props.noRel ? "" : props.rel, options.externalRelAttribute, isAbsoluteUrl.value || hasTarget.value ? "noopener noreferrer" : "") || null;
|
||||
const getCustomSlotProps = (routerLinkSlotProps) => ({
|
||||
navigate,
|
||||
get route() {
|
||||
if (!href.value) return;
|
||||
const url = new URL(href.value, "http://localhost");
|
||||
return {
|
||||
path: url.pathname,
|
||||
fullPath: url.pathname,
|
||||
get query() {
|
||||
return parseQuery(url.search);
|
||||
},
|
||||
hash: url.hash,
|
||||
params: {},
|
||||
name: void 0,
|
||||
matched: [],
|
||||
redirectedFrom: void 0,
|
||||
meta: {},
|
||||
href: href.value
|
||||
};
|
||||
},
|
||||
rel,
|
||||
target,
|
||||
isExternal: isExternal.value || hasTarget.value,
|
||||
isActive: false,
|
||||
isExactActive: false,
|
||||
...routerLinkSlotProps,
|
||||
href: typeof routerLinkSlotProps?.href === "string" ? sanitizeAnchorHref(routerLinkSlotProps.href) : href.value,
|
||||
prefetch,
|
||||
prefetched: prefetched.value,
|
||||
shouldPrefetch
|
||||
});
|
||||
if (!isExternal.value && !hasTarget.value && !isHashLinkWithoutHashMode(to.value)) {
|
||||
const routerLinkProps = {
|
||||
ref: elRef,
|
||||
to: to.value,
|
||||
activeClass: props.activeClass || options.activeClass,
|
||||
exactActiveClass: props.exactActiveClass || options.exactActiveClass,
|
||||
replace: props.replace,
|
||||
ariaCurrentValue: props.ariaCurrentValue,
|
||||
custom: props.custom
|
||||
};
|
||||
if (!props.custom) routerLinkProps.rel = props.rel || void 0;
|
||||
return h(routerLinkComponent, routerLinkProps, props.custom && slots.default ? { default: (slotProps) => slots.default(getCustomSlotProps(slotProps)) } : slots.default);
|
||||
}
|
||||
if (props.custom) {
|
||||
if (!slots.default) return null;
|
||||
return slots.default(getCustomSlotProps());
|
||||
}
|
||||
return h("a", {
|
||||
ref: el,
|
||||
href: href.value || null,
|
||||
rel,
|
||||
target,
|
||||
onClick: async (event) => {
|
||||
if (isExternal.value || hasTarget.value) return;
|
||||
event.preventDefault();
|
||||
try {
|
||||
const encodedHref = encodeRoutePath(href.value ?? "");
|
||||
return await (props.replace ? router.replace(encodedHref) : router.push(encodedHref));
|
||||
} finally {}
|
||||
}
|
||||
}, slots.default?.());
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
var NuxtLink = /* @__PURE__ */ defineNuxtLink(nuxtLinkDefaults);
|
||||
function isSameRouteRecord(a, b) {
|
||||
return (a.aliasOf || a) === (b.aliasOf || b);
|
||||
}
|
||||
function getOriginalPath(record) {
|
||||
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
|
||||
}
|
||||
function isEquivalentArray(a, b) {
|
||||
return Array.isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
|
||||
}
|
||||
function isSameParamValue(a, b) {
|
||||
return Array.isArray(a) ? isEquivalentArray(a, b) : Array.isArray(b) ? isEquivalentArray(b, a) : (a && a.valueOf()) === (b && b.valueOf());
|
||||
}
|
||||
function isSameRouteLocationParams(a, b) {
|
||||
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
||||
for (const key in a) if (!isSameParamValue(a[key], b[key])) return false;
|
||||
return true;
|
||||
}
|
||||
function includesParams(outer, inner) {
|
||||
for (const key in inner) {
|
||||
const innerValue = inner[key];
|
||||
const outerValue = outer[key];
|
||||
if (typeof innerValue === "string") {
|
||||
if (innerValue !== outerValue) return false;
|
||||
} else if (!Array.isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value.valueOf() !== outerValue[i].valueOf())) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function activeRecordIndex(route, currentRoute) {
|
||||
const { matched } = route;
|
||||
const { length } = matched;
|
||||
const routeMatched = matched[length - 1];
|
||||
const currentMatched = currentRoute.matched;
|
||||
if (!routeMatched || !currentMatched.length) return -1;
|
||||
const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
|
||||
if (index > -1) return index;
|
||||
const parentRecordPath = getOriginalPath(matched[length - 2]);
|
||||
return length > 1 && getOriginalPath(routeMatched) === parentRecordPath && currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index;
|
||||
}
|
||||
/** Resolve an active-link class, falling back from the per-link value to the router-wide one. */
|
||||
function getLinkClass(propClass, globalClass, defaultClass) {
|
||||
return propClass ?? globalClass ?? defaultClass;
|
||||
}
|
||||
function applyTrailingSlashBehavior(to, trailingSlash) {
|
||||
if (trailingSlash !== "append" && trailingSlash !== "remove") return to;
|
||||
const normalizeFn = trailingSlash === "append" ? withTrailingSlash : withoutTrailingSlash;
|
||||
if (hasProtocol(to) && !to.startsWith("http")) return to;
|
||||
return normalizeFn(to, true);
|
||||
}
|
||||
//#endregion
|
||||
//#region ../site1/node_modules/nuxt/dist/app/components/error-404.vue
|
||||
var _sfc_main = {
|
||||
__name: "error-404",
|
||||
__ssrInlineRender: true,
|
||||
props: {
|
||||
appName: {
|
||||
type: String,
|
||||
default: "Nuxt"
|
||||
},
|
||||
status: {
|
||||
type: Number,
|
||||
default: 404
|
||||
},
|
||||
statusText: {
|
||||
type: String,
|
||||
default: "Page not found"
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: "Sorry, the page you are looking for could not be found."
|
||||
},
|
||||
backHome: {
|
||||
type: String,
|
||||
default: "Go back home"
|
||||
},
|
||||
backToPrevious: {
|
||||
type: String,
|
||||
default: "Go back"
|
||||
}
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
useHead({
|
||||
title: `${props.status} - ${props.statusText} | ${props.appName}`,
|
||||
script: [{
|
||||
innerHTML: `(()=>{if(!(window.history.state&&window.history.state.back||document.referrer.startsWith(window.location.origin+"/")))return;const t=document.querySelector("[data-back-home]"),e=document.querySelector("[data-back-previous]");t&&e&&(e.onclick=()=>window.history.back(),t.hidden=!0,e.hidden=!1)})();`,
|
||||
tagPosition: "bodyClose"
|
||||
}],
|
||||
style: [{ innerHTML: `*,:after,:before{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:after,:before{--un-content:""}html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}a{-webkit-text-decoration:inherit;text-decoration:inherit}a,button{color:inherit}button{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0;text-transform:none}[type=button],button{-webkit-appearance:button;background-color:#0000;background-image:none}h1,h2,p{margin:0}button{cursor:pointer}[hidden]:where(:not([hidden=until-found])){display:none}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }` }]
|
||||
});
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_NuxtLink = NuxtLink;
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "antialiased bg-white dark:bg-neutral-950 dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-neutral-950 tracking-wide" }, _attrs))} data-v-5f53d16d><div class="max-w-520px text-center" data-v-5f53d16d><h1 class="font-medium leading-none mb-4 sm:text-[72px] tabular-nums text-[56px]" data-v-5f53d16d>${ssrInterpolate(__props.status)}</h1><h2 class="font-semibold mb-2 sm:text-3xl text-2xl" data-v-5f53d16d>${ssrInterpolate(__props.statusText)}</h2><p class="mb-4 px-2 text-md text-neutral-500" data-v-5f53d16d>${ssrInterpolate(__props.description)}</p><div class="flex items-center justify-center w-full" data-v-5f53d16d>`);
|
||||
_push(ssrRenderComponent(_component_NuxtLink, {
|
||||
to: "/",
|
||||
"data-back-home": "",
|
||||
class: "font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"
|
||||
}, {
|
||||
default: withCtx((_, _push, _parent, _scopeId) => {
|
||||
if (_push) _push(`${ssrInterpolate(__props.backHome)}`);
|
||||
else return [createTextVNode(toDisplayString(__props.backHome), 1)];
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(` <button type="button" data-back-previous hidden class="appearance-none bg-transparent border-0 cursor-pointer font-medium font-sans hover:text-[#00DC82] p-0 text-inherit text-sm underline underline-offset-3" data-v-5f53d16d>${ssrInterpolate(__props.backToPrevious)}</button></div></div></div>`);
|
||||
};
|
||||
}
|
||||
};
|
||||
var _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../site1/node_modules/nuxt/dist/app/components/error-404.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
var error_404_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["__scopeId", "data-v-5f53d16d"]]);
|
||||
|
||||
export { error_404_default as default };
|
||||
//# sourceMappingURL=error-404-DelmxDv8.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error-404-DelmxDv8.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-404-DelmxDv8.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region ../site1/node_modules/nuxt/dist/app/components/error-404.vue?vue&type=style&index=0&scoped=5f53d16d&inline&used&lang.css
|
||||
var error_404_vue_vue_type_style_index_0_scoped_5f53d16d_inline_used_lang_default = ".grid[data-v-5f53d16d]{display:grid}.mb-2[data-v-5f53d16d]{margin-bottom:.5rem}.mb-4[data-v-5f53d16d]{margin-bottom:1rem}.max-w-520px[data-v-5f53d16d]{max-width:520px}.min-h-screen[data-v-5f53d16d]{min-height:100vh}.w-full[data-v-5f53d16d]{width:100%}.flex[data-v-5f53d16d]{display:flex}.cursor-pointer[data-v-5f53d16d]{cursor:pointer}.appearance-none[data-v-5f53d16d]{appearance:none}.place-content-center[data-v-5f53d16d]{place-content:center}.items-center[data-v-5f53d16d]{align-items:center}.justify-center[data-v-5f53d16d]{justify-content:center}.overflow-hidden[data-v-5f53d16d]{overflow:hidden}.border-0[data-v-5f53d16d]{border-width:0}.bg-transparent[data-v-5f53d16d]{background-color:#0000}.bg-white[data-v-5f53d16d]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.p-0[data-v-5f53d16d]{padding:0}.px-2[data-v-5f53d16d]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-5f53d16d]{text-align:center}.text-\\[56px\\][data-v-5f53d16d]{font-size:56px}.text-2xl[data-v-5f53d16d]{font-size:1.5rem;line-height:2rem}.text-sm[data-v-5f53d16d]{font-size:.875rem;line-height:1.25rem}.text-neutral-500[data-v-5f53d16d]{--un-text-opacity:1;color:rgb(115 115 115/var(--un-text-opacity))}.text-neutral-950[data-v-5f53d16d]{--un-text-opacity:1;color:rgb(10 10 10/var(--un-text-opacity))}.hover\\:text-\\[\\#00DC82\\][data-v-5f53d16d]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.text-inherit[data-v-5f53d16d]{color:inherit}.font-medium[data-v-5f53d16d]{font-weight:500}.font-semibold[data-v-5f53d16d]{font-weight:600}.leading-none[data-v-5f53d16d]{line-height:1}.tracking-wide[data-v-5f53d16d]{letter-spacing:.025em}.font-sans[data-v-5f53d16d]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-5f53d16d]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline[data-v-5f53d16d]{text-decoration-line:underline}.underline-offset-3[data-v-5f53d16d]{text-underline-offset:3px}.antialiased[data-v-5f53d16d]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\\:bg-neutral-950[data-v-5f53d16d]{--un-bg-opacity:1;background-color:rgb(10 10 10/var(--un-bg-opacity))}.dark\\:text-white[data-v-5f53d16d]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (width>=640px){.sm\\:text-\\[72px\\][data-v-5f53d16d]{font-size:72px}.sm\\:text-3xl[data-v-5f53d16d]{font-size:1.875rem;line-height:2.25rem}}";
|
||||
|
||||
const error404Styles_CokM88Qa = [
|
||||
error_404_vue_vue_type_style_index_0_scoped_5f53d16d_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { error404Styles_CokM88Qa as default };
|
||||
//# sourceMappingURL=error-404-styles.CokM88Qa.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error-404-styles.CokM88Qa.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-404-styles-1.mjs-yGy1IfGi.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-404-styles.CokM88Qa.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { _ as _plugin_vue_export_helper_default, u as useHead } from '../virtual/entry.mjs';
|
||||
import { useSSRContext, mergeProps } from 'vue';
|
||||
import { ssrRenderAttrs, ssrInterpolate } from 'vue/server-renderer';
|
||||
import './nitro.mjs';
|
||||
import 'unhead/server';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'nostics';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'devalue';
|
||||
import 'vue-router';
|
||||
|
||||
//#region ../site1/node_modules/nuxt/dist/app/components/error-500.vue
|
||||
var _sfc_main = {
|
||||
__name: "error-500",
|
||||
__ssrInlineRender: true,
|
||||
props: {
|
||||
appName: {
|
||||
type: String,
|
||||
default: "Nuxt"
|
||||
},
|
||||
status: {
|
||||
type: Number,
|
||||
default: 500
|
||||
},
|
||||
statusText: {
|
||||
type: String,
|
||||
default: "Internal server error"
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: "This page is temporarily unavailable."
|
||||
},
|
||||
refresh: {
|
||||
type: String,
|
||||
default: "Refresh this page"
|
||||
}
|
||||
},
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
useHead({
|
||||
title: `${props.status} - ${props.statusText} | ${props.appName}`,
|
||||
script: [],
|
||||
style: [{ innerHTML: `*,:after,:before{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:after,:before{--un-content:""}html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }` }]
|
||||
});
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "antialiased bg-white dark:bg-neutral-950 dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-neutral-950 tracking-wide" }, _attrs))} data-v-02e6d203><div class="max-w-520px text-center" data-v-02e6d203><h1 class="font-medium leading-none mb-4 sm:text-[72px] tabular-nums text-[56px]" data-v-02e6d203>${ssrInterpolate(__props.status)}</h1><h2 class="font-semibold mb-2 sm:text-3xl text-2xl" data-v-02e6d203>${ssrInterpolate(__props.statusText)}</h2><p class="mb-4 px-2 text-md text-neutral-500" data-v-02e6d203>${ssrInterpolate(__props.description)}</p></div></div>`);
|
||||
};
|
||||
}
|
||||
};
|
||||
var _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../site1/node_modules/nuxt/dist/app/components/error-500.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
var error_500_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["__scopeId", "data-v-02e6d203"]]);
|
||||
|
||||
export { error_500_default as default };
|
||||
//# sourceMappingURL=error-500-_lvxeZxk.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error-500-_lvxeZxk.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-500-_lvxeZxk.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region ../site1/node_modules/nuxt/dist/app/components/error-500.vue?vue&type=style&index=0&scoped=02e6d203&inline&used&lang.css
|
||||
var error_500_vue_vue_type_style_index_0_scoped_02e6d203_inline_used_lang_default = ".grid[data-v-02e6d203]{display:grid}.mb-2[data-v-02e6d203]{margin-bottom:.5rem}.mb-4[data-v-02e6d203]{margin-bottom:1rem}.max-w-520px[data-v-02e6d203]{max-width:520px}.min-h-screen[data-v-02e6d203]{min-height:100vh}.place-content-center[data-v-02e6d203]{place-content:center}.overflow-hidden[data-v-02e6d203]{overflow:hidden}.bg-white[data-v-02e6d203]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-02e6d203]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-02e6d203]{text-align:center}.text-\\[56px\\][data-v-02e6d203]{font-size:56px}.text-2xl[data-v-02e6d203]{font-size:1.5rem;line-height:2rem}.text-neutral-500[data-v-02e6d203]{--un-text-opacity:1;color:rgb(115 115 115/var(--un-text-opacity))}.text-neutral-950[data-v-02e6d203]{--un-text-opacity:1;color:rgb(10 10 10/var(--un-text-opacity))}.font-medium[data-v-02e6d203]{font-weight:500}.font-semibold[data-v-02e6d203]{font-weight:600}.leading-none[data-v-02e6d203]{line-height:1}.tracking-wide[data-v-02e6d203]{letter-spacing:.025em}.font-sans[data-v-02e6d203]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-02e6d203]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased[data-v-02e6d203]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\\:bg-neutral-950[data-v-02e6d203]{--un-bg-opacity:1;background-color:rgb(10 10 10/var(--un-bg-opacity))}.dark\\:text-white[data-v-02e6d203]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (width>=640px){.sm\\:text-\\[72px\\][data-v-02e6d203]{font-size:72px}.sm\\:text-3xl[data-v-02e6d203]{font-size:1.875rem;line-height:2.25rem}}";
|
||||
|
||||
const error500Styles_Tpdhuaa7 = [
|
||||
error_500_vue_vue_type_style_index_0_scoped_02e6d203_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { error500Styles_Tpdhuaa7 as default };
|
||||
//# sourceMappingURL=error-500-styles.Tpdhuaa7.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error-500-styles.Tpdhuaa7.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-500-styles-1.mjs-01oKqNsk.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/error-500-styles.Tpdhuaa7.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { escapeHtml } from '@vue/shared';
|
||||
|
||||
//#region src/runtime/server/renderer/error-template.ts
|
||||
const _messages = {
|
||||
"appName": "Nuxt",
|
||||
"status": 500,
|
||||
"statusText": "Internal server error",
|
||||
"description": "This page is temporarily unavailable.",
|
||||
"refresh": "Refresh this page"
|
||||
};
|
||||
const template = (messages) => {
|
||||
messages = {
|
||||
..._messages,
|
||||
...messages
|
||||
};
|
||||
return "<!DOCTYPE html><html lang=\"en\"><head><title>" + escapeHtml(messages.status) + " - " + escapeHtml(messages.statusText) + " | " + escapeHtml(messages.appName) + "</title><meta charset=\"utf-8\"><meta content=\"width=device-width,initial-scale=1,minimum-scale=1\" name=\"viewport\"><style>*,:after,:before{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--un-default-border-color,#e5e7eb)}:after,:before{--un-content:\"\"}html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 #0000;--un-ring-shadow:0 0 #0000;--un-shadow-inset: ;--un-shadow:0 0 #0000;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:#93c5fd80;--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.grid{display:grid}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.max-w-520px{max-width:520px}.min-h-screen{min-height:100vh}.place-content-center{place-content:center}.overflow-hidden{overflow:hidden}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-\\[56px\\]{font-size:56px}.text-2xl{font-size:1.5rem;line-height:2rem}.text-neutral-500{--un-text-opacity:1;color:rgb(115 115 115/var(--un-text-opacity))}.text-neutral-950{--un-text-opacity:1;color:rgb(10 10 10/var(--un-text-opacity))}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-wide{letter-spacing:.025em}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\\:bg-neutral-950{--un-bg-opacity:1;background-color:rgb(10 10 10/var(--un-bg-opacity))}.dark\\:text-white{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(width>=640px){.sm\\:text-\\[72px\\]{font-size:72px}.sm\\:text-3xl{font-size:1.875rem;line-height:2.25rem}}</style></head><body class=\"antialiased bg-white dark:bg-neutral-950 dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-neutral-950 tracking-wide\"><div class=\"max-w-520px text-center\"><h1 class=\"font-medium leading-none mb-4 sm:text-[72px] tabular-nums text-[56px]\">" + escapeHtml(messages.status) + "</h1><h2 class=\"font-semibold mb-2 sm:text-3xl text-2xl\">" + escapeHtml(messages.statusText) + "</h2><p class=\"mb-4 px-2 text-md text-neutral-500\">" + escapeHtml(messages.description) + "</p></div></body></html>";
|
||||
};
|
||||
|
||||
export { template };
|
||||
//# sourceMappingURL=error-template.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"error-template.mjs","sources":["../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/error-template.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,9 @@
|
||||
//#region pages/index.vue?vue&type=style&index=0&scoped=01dba7e2&inline&used&lang.css
|
||||
var index_vue_vue_type_style_index_0_scoped_01dba7e2_inline_used_lang_default = ".landing-page-wrap[data-v-01dba7e2]{width:100%;overflow-x:hidden}";
|
||||
|
||||
const indexStyles_DCHX_zt6 = [
|
||||
index_vue_vue_type_style_index_0_scoped_01dba7e2_inline_used_lang_default
|
||||
];
|
||||
|
||||
export { indexStyles_DCHX_zt6 as default };
|
||||
//# sourceMappingURL=index-styles.DCHX_zt6.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index-styles.DCHX_zt6.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/index-styles-1.mjs-C8Y6VFfi.js","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/index-styles.DCHX_zt6.mjs"],"names":["style_0"],"mappings":"","x_google_ignoreList":[0,1]}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"nitro.mjs","sources":["../../../../../site1/node_modules/destr/dist/index.mjs","../../../../../site1/node_modules/ufo/dist/index.mjs","../../../../../site1/node_modules/radix3/dist/index.mjs","../../../../../site1/node_modules/defu/dist/defu.mjs","../../../../../site1/node_modules/node-mock-http/dist/index.mjs","../../../../../site1/node_modules/h3/dist/index.mjs","../../../../../site1/node_modules/nitropack/node_modules/hookable/dist/index.mjs","../../../../../site1/node_modules/node-fetch-native/dist/native.mjs","../../../../../site1/node_modules/ofetch/dist/shared/ofetch.CWycOUEr.mjs","../../../../../site1/node_modules/ofetch/dist/node.mjs","../../../../../site1/node_modules/unstorage/dist/shared/unstorage.zVDD2mZo.mjs","../../../../../site1/node_modules/unstorage/dist/index.mjs","../../../../../site1/node_modules/unstorage/drivers/utils/index.mjs","../../../../../site1/node_modules/unstorage/drivers/utils/node-fs.mjs","../../../../../site1/node_modules/unstorage/drivers/fs-lite.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/storage.mjs","../../../../../site1/node_modules/ohash/dist/crypto/node/index.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/hash.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/cache.mjs","../../../../../site1/node_modules/klona/dist/index.mjs","../../../../../site1/node_modules/scule/dist/index.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/utils.env.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/config.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/route-rules-utils.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/route-rules.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/utils.mjs","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/event.mjs","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/error.mjs","../../../../../site1/node_modules/@unhead/vue/dist/shared/vue.DKb5ZKVl.mjs","../../../../../site1/node_modules/@unhead/vue/dist/shared/vue.D2XR8FqS.mjs","../../../../../site1/node_modules/@unhead/vue/dist/server.mjs","../../../../../site1/node_modules/@unhead/vue/dist/legacy.mjs","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/handlers/error.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/error/utils.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/error/prod.mjs","../../../../../site1/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/static.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/app.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/renderer.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/lib/http-graceful-shutdown.mjs","../../../../../site1/node_modules/nitropack/dist/runtime/internal/shutdown.mjs"],"names":["HASH_RE","ENC_PIPE_RE","createRouter","f","h","i","l","createError","mergeHeaders","nodeFetch","Headers","Headers$1","AbortController$1","normalizeKey","defineDriver","DRIVER_NAME","dirname","fsPromises","resolve","fsp","_inlineAppConfig","createRadixRouter","callNodeRequestHandler","fetchNodeRequestHandler","gracefulShutdown"],"mappings":"","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]}
|
||||
@@ -0,0 +1,97 @@
|
||||
import { _ as _plugin_vue_export_helper_default, u as useHead, a as useRuntimeConfig } from '../virtual/entry.mjs';
|
||||
import { c as getCurriculumBySubject, d as getRegionByDong, g as generateSeoMeta, H as HeroBanner_default, Q as QuickMetrics_default, N as NearbySchools_default, S as SubjectMastery_default, T as TeacherVerification_default, C as CoachingSystem_default, a as SuccessStories_default, P as ProcessGuide_default, F as FaqAccordion_default, b as ConsultForm_default } from './seoHelper-Dn7JBAuK.mjs';
|
||||
import { mergeProps, unref, useSSRContext } from 'vue';
|
||||
import { ssrRenderAttrs, ssrRenderComponent } from 'vue/server-renderer';
|
||||
import './nitro.mjs';
|
||||
import 'unhead/server';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'nostics';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'devalue';
|
||||
import 'vue-router';
|
||||
|
||||
//#region pages/index.vue
|
||||
var _sfc_main = {
|
||||
__name: "index",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
const config = useRuntimeConfig();
|
||||
const defaultCurriculum = getCurriculumBySubject("english");
|
||||
const defaultRegion = getRegionByDong("황금동") || {
|
||||
fullName: "대한민국 전국 전 지역",
|
||||
sido: "전국",
|
||||
sigungu: "전지역",
|
||||
dong: "전국"
|
||||
};
|
||||
const seo = generateSeoMeta({
|
||||
sido: "전국",
|
||||
sigungu: "맞춤",
|
||||
dong: "1:1",
|
||||
grade: "초중고",
|
||||
subjectName: "전과목",
|
||||
targetTerm: "방문·화상과외",
|
||||
fullKeyword: "전국 초중고 1:1 방문 과외 및 실시간 화상과외"
|
||||
}, config.public.siteName, config.public.siteDomain);
|
||||
useHead({
|
||||
title: `${config.public.siteName} | 전국 초·중·고 1:1 맞춤 방문과외 & 화상코칭`,
|
||||
meta: seo.meta,
|
||||
link: seo.link,
|
||||
script: seo.script
|
||||
});
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_HeroBanner = HeroBanner_default;
|
||||
const _component_QuickMetrics = QuickMetrics_default;
|
||||
const _component_NearbySchools = NearbySchools_default;
|
||||
const _component_SubjectMastery = SubjectMastery_default;
|
||||
const _component_TeacherVerification = TeacherVerification_default;
|
||||
const _component_CoachingSystem = CoachingSystem_default;
|
||||
const _component_SuccessStories = SuccessStories_default;
|
||||
const _component_ProcessGuide = ProcessGuide_default;
|
||||
const _component_FaqAccordion = FaqAccordion_default;
|
||||
const _component_ConsultForm = ConsultForm_default;
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "landing-page-wrap" }, _attrs))} data-v-01dba7e2>`);
|
||||
_push(ssrRenderComponent(_component_HeroBanner, {
|
||||
region: unref(defaultRegion),
|
||||
grade: "초·중·고",
|
||||
subjectName: "국영수사과"
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_QuickMetrics, { regionDong: "전국" }, null, _parent));
|
||||
_push(ssrRenderComponent(_component_NearbySchools, { regionDong: "주요 학군" }, null, _parent));
|
||||
_push(ssrRenderComponent(_component_SubjectMastery, {
|
||||
regionDong: "전국",
|
||||
grade: "중·고등",
|
||||
curriculum: unref(defaultCurriculum)
|
||||
}, null, _parent));
|
||||
_push(ssrRenderComponent(_component_TeacherVerification, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_CoachingSystem, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_SuccessStories, { regionDong: "수강생" }, null, _parent));
|
||||
_push(ssrRenderComponent(_component_ProcessGuide, null, null, _parent));
|
||||
_push(ssrRenderComponent(_component_FaqAccordion, { regionDong: "전국" }, null, _parent));
|
||||
_push(ssrRenderComponent(_component_ConsultForm, {
|
||||
regionName: "전국 전 지역",
|
||||
defaultSubject: "영어"
|
||||
}, null, _parent));
|
||||
_push(`</div>`);
|
||||
};
|
||||
}
|
||||
};
|
||||
var _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/index.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
var pages_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["__scopeId", "data-v-01dba7e2"]]);
|
||||
|
||||
export { pages_default as default };
|
||||
//# sourceMappingURL=pages-DZejV8vw.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pages-DZejV8vw.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/pages-DZejV8vw.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"seoHelper-Dn7JBAuK.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/seoHelper-Dn7JBAuK.js"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { c as defineEventHandler, u as useRuntimeConfig, r as readBody, e as createError } from '../../_/nitro.mjs';
|
||||
import 'unhead/server';
|
||||
import 'vue';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
|
||||
const consult_post = defineEventHandler(async (event) => {
|
||||
const config = useRuntimeConfig();
|
||||
const body = await readBody(event);
|
||||
const {
|
||||
studentName,
|
||||
parentPhone,
|
||||
name,
|
||||
phone,
|
||||
schoolName,
|
||||
grade,
|
||||
location,
|
||||
regionName,
|
||||
memo,
|
||||
url
|
||||
} = body || {};
|
||||
const finalStudentName = studentName || name || "\uBBF8\uAE30\uC7AC";
|
||||
const finalParentPhone = parentPhone || phone || "";
|
||||
const finalLocation = location || regionName || "\uBBF8\uAE30\uC7AC";
|
||||
const finalGrade = grade || "\uBBF8\uC9C0\uC815";
|
||||
const finalSchool = schoolName || "\uBBF8\uAE30\uC7AC";
|
||||
if (!finalParentPhone) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: "\uBD80\uBAA8\uB2D8 \uC5F0\uB77D\uCC98\uB97C \uC62C\uBC14\uB974\uAC8C \uC785\uB825\uD574\uC8FC\uC138\uC694."
|
||||
});
|
||||
}
|
||||
const webhookUrl = config.discordWebhookUrl || "https://discordapp.com/api/webhooks/1557204310369116210/9J4y96kmSbYNGtw5OxRgIz7InWcM8o3f8UX0Ad71-IyofwdS7tWmXkF7dj457-I8Ypiu";
|
||||
const siteName = config.public.siteName || "1:1 \uB9DE\uCDA4\uACFC\uC678";
|
||||
const siteDomain = config.public.siteDomain || "https://aeseo.cloud";
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
const kstTime = new Intl.DateTimeFormat("ko-KR", {
|
||||
timeZone: "Asia/Seoul",
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
hour12: false
|
||||
}).format(now);
|
||||
const discordPayload = {
|
||||
username: `${siteName} \uC0C1\uB2F4 \uC54C\uB9BC \uBD07`,
|
||||
avatar_url: "https://cdn-icons-png.flaticon.com/512/2997/2997295.png",
|
||||
embeds: [
|
||||
{
|
||||
title: `[\uC2E0\uADDC \uBB34\uB8CC \uC0C1\uB2F4 \uC2E0\uCCAD \uC811\uC218] ${finalLocation} - ${finalGrade} (${finalStudentName} \uD559\uC0DD)`,
|
||||
description: `**${siteName}** \uC0AC\uC774\uD2B8\uC5D0\uC11C \uC0C8\uB85C\uC6B4 1:1 \uD559\uC2B5 \uC0C1\uB2F4 \uC2E0\uCCAD\uC774 \uC811\uC218\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`,
|
||||
color: 10033947,
|
||||
// 신뢰감 있는 딥 레드/네이비
|
||||
fields: [
|
||||
{
|
||||
name: "[\uC811\uC218 \uC0AC\uC774\uD2B8]",
|
||||
value: `**${siteName}**
|
||||
${siteDomain}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uC0AC\uB294 \uACF3]",
|
||||
value: finalLocation,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uD559\uC0DD \uC774\uB984]",
|
||||
value: `**${finalStudentName}**`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uBD80\uBAA8\uB2D8 \uC5F0\uB77D\uCC98]",
|
||||
value: `**${finalParentPhone}**`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uB2E4\uB2C8\uB294 \uD559\uAD50]",
|
||||
value: finalSchool,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uD559\uB144]",
|
||||
value: finalGrade,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uC811\uC218 \uC77C\uC2DC (KST)]",
|
||||
value: kstTime,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: "[\uC720\uC785 \uD398\uC774\uC9C0 URL]",
|
||||
value: url ? `${url}` : `${siteDomain}`,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: "[\uC0C1\uB2F4\uBB38\uC758 \uB0B4\uC6A9 (\uC120\uD0DD)]",
|
||||
value: memo && memo.trim() ? memo.trim() : "\uC785\uB825\uB41C \uC0C1\uC138 \uBB38\uC758 \uB0B4\uC6A9 \uC5C6\uC74C",
|
||||
inline: false
|
||||
}
|
||||
],
|
||||
footer: {
|
||||
text: `${siteName} \uC2E4\uC2DC\uAC04 \uC0C1\uB2F4 \uC54C\uB9BC \uC2DC\uC2A4\uD15C`
|
||||
},
|
||||
timestamp: now.toISOString()
|
||||
}
|
||||
]
|
||||
};
|
||||
try {
|
||||
const res = await fetch(webhookUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(discordPayload)
|
||||
});
|
||||
if (!res.ok) {
|
||||
const errText = await res.text();
|
||||
console.error("[Discord Webhook Error]:", res.status, errText);
|
||||
return {
|
||||
success: false,
|
||||
message: "\uB514\uC2A4\uCF54\uB4DC \uC804\uC1A1 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
message: "\uC0C1\uB2F4 \uC2E0\uCCAD\uC774 \uC815\uC0C1\uC801\uC73C\uB85C \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
|
||||
};
|
||||
} catch (err) {
|
||||
console.error("[Consult Submission Error]:", err.message);
|
||||
return {
|
||||
success: false,
|
||||
message: "\uC11C\uBC84 \uC624\uB958\uB85C \uC778\uD574 \uC804\uC1A1\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4."
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
export { consult_post as default };
|
||||
//# sourceMappingURL=consult.post.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"consult.post.mjs","sources":["../../../../../server/api/consult.post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qBAAe,kBAAA,CAAmB,OAAO,KAAA,KAAU;AACjD,EAAA,MAAM,SAAS,gBAAA,EAAiB;AAChC,EAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,KAAK,CAAA;AAEjC,EAAA,MAAM;AAAA,IACJ,WAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA;AAAA,GACF,GAAI,QAAQ,EAAC;AAEb,EAAA,MAAM,gBAAA,GAAmB,eAAe,IAAA,IAAQ,oBAAA;AAChD,EAAA,MAAM,gBAAA,GAAmB,eAAe,KAAA,IAAS,EAAA;AACjD,EAAA,MAAM,aAAA,GAAgB,YAAY,UAAA,IAAc,oBAAA;AAChD,EAAA,MAAM,aAAa,KAAA,IAAS,oBAAA;AAC5B,EAAA,MAAM,cAAc,UAAA,IAAc,oBAAA;AAElC,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,MAAM,WAAA,CAAY;AAAA,MAChB,UAAA,EAAY,GAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KAChB,CAAA;AAAA,EACH;AAEA,EAAA,MAAM,UAAA,GAAa,OAAO,iBAAA,IAAqB,8HAAA;AAC/C,EAAA,MAAM,QAAA,GAAW,MAAA,CAAO,MAAA,CAAO,QAAA,IAAY,8BAAA;AAC3C,EAAA,MAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,UAAA,IAAc,qBAAA;AAG/C,EAAA,MAAM,GAAA,uBAAU,IAAA,EAAK;AACrB,EAAA,MAAM,OAAA,GAAU,IAAI,IAAA,CAAK,cAAA,CAAe,OAAA,EAAS;AAAA,IAC/C,QAAA,EAAU,YAAA;AAAA,IACV,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO,SAAA;AAAA,IACP,GAAA,EAAK,SAAA;AAAA,IACL,IAAA,EAAM,SAAA;AAAA,IACN,MAAA,EAAQ,SAAA;AAAA,IACR,MAAA,EAAQ,SAAA;AAAA,IACR,MAAA,EAAQ;AAAA,GACT,CAAA,CAAE,MAAA,CAAO,GAAG,CAAA;AAGb,EAAA,MAAM,cAAA,GAAiB;AAAA,IACrB,QAAA,EAAU,GAAG,QAAQ,CAAA,iCAAA,CAAA;AAAA,IACrB,UAAA,EAAY,yDAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN;AAAA,QACE,OAAO,CAAA,mEAAA,EAAoB,aAAa,CAAA,GAAA,EAAM,UAAU,KAAK,gBAAgB,CAAA,cAAA,CAAA;AAAA,QAC7E,WAAA,EAAa,KAAK,QAAQ,CAAA,iJAAA,CAAA;AAAA,QAC1B,KAAA,EAAO,QAAA;AAAA;AAAA,QACP,MAAA,EAAQ;AAAA,UACN;AAAA,YACE,IAAA,EAAM,mCAAA;AAAA,YACN,KAAA,EAAO,KAAK,QAAQ,CAAA;AAAA,EAAO,UAAU,CAAA,CAAA;AAAA,YACrC,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,uBAAA;AAAA,YACN,KAAA,EAAO,aAAA;AAAA,YACP,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,6BAAA;AAAA,YACN,KAAA,EAAO,KAAK,gBAAgB,CAAA,EAAA,CAAA;AAAA,YAC5B,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,yCAAA;AAAA,YACN,KAAA,EAAO,KAAK,gBAAgB,CAAA,EAAA,CAAA;AAAA,YAC5B,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,mCAAA;AAAA,YACN,KAAA,EAAO,WAAA;AAAA,YACP,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,gBAAA;AAAA,YACN,KAAA,EAAO,UAAA;AAAA,YACP,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,mCAAA;AAAA,YACN,KAAA,EAAO,OAAA;AAAA,YACP,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,uCAAA;AAAA,YACN,OAAO,GAAA,GAAM,CAAA,EAAG,GAAG,CAAA,CAAA,GAAK,GAAG,UAAU,CAAA,CAAA;AAAA,YACrC,MAAA,EAAQ;AAAA,WACV;AAAA,UACA;AAAA,YACE,IAAA,EAAM,wDAAA;AAAA,YACN,OAAO,IAAA,IAAQ,IAAA,CAAK,MAAK,GAAI,IAAA,CAAK,MAAK,GAAI,wEAAA;AAAA,YAC3C,MAAA,EAAQ;AAAA;AACV,SACF;AAAA,QACA,MAAA,EAAQ;AAAA,UACN,IAAA,EAAM,GAAG,QAAQ,CAAA,gEAAA;AAAA,SACnB;AAAA,QACA,SAAA,EAAW,IAAI,WAAA;AAAY;AAC7B;AACF,GACF;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,UAAA,EAAY;AAAA,MAClC,MAAA,EAAQ,MAAA;AAAA,MACR,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB;AAAA,OAClB;AAAA,MACA,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,cAAc;AAAA,KACpC,CAAA;AAED,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,MAAM,OAAA,GAAU,MAAM,GAAA,CAAI,IAAA,EAAK;AAC/B,MAAA,OAAA,CAAQ,KAAA,CAAM,0BAAA,EAA4B,GAAA,CAAI,MAAA,EAAQ,OAAO,CAAA;AAC7D,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,KAAA;AAAA,QACT,OAAA,EAAS;AAAA,OACX;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,IAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,EACF,SAAS,GAAA,EAAU;AACjB,IAAA,OAAA,CAAQ,KAAA,CAAM,6BAAA,EAA+B,GAAA,CAAI,OAAO,CAAA;AACxD,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,KAAA;AAAA,MACT,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AACF,CAAC,CAAA;;"}
|
||||
@@ -0,0 +1,566 @@
|
||||
import { j as joinRelativeURL, u as useRuntimeConfig, g as appRootTag, h as appRootAttrs, i as appSpaLoaderTag, k as appSpaLoaderAttrs, w as writeEarlyHints, e as createError, b as useNitroApp, l as getRouteRules, m as createHead, N as NUXT_PRERENDER_NO_SSR_ROUTES, n as unheadOptions, o as appId, p as getQuery, q as appHead, d as destr, v as NUXT_SSR_STREAMING, x as renderSSRHeadOptions, y as appTeleportAttrs, z as NUXT_NO_SCRIPTS_PATTERNS, A as relative, B as joinURL, C as appTeleportTag, D as NUXT_PAGE_PATTERNS, E as defineRenderHandler, F as toRequestEvent, G as setResponseHeader } from '../_/nitro.mjs';
|
||||
import { defineDiagnostics, createConsoleReporter } from 'nostics';
|
||||
import { renderToString } from 'vue/server-renderer';
|
||||
import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'vue-bundle-renderer/runtime';
|
||||
import { propsToString, renderSSRHead } from 'unhead/server';
|
||||
import { stringify, uneval } from 'devalue';
|
||||
|
||||
//#region src/runtime/utils/paths.ts
|
||||
function baseURL() {
|
||||
return useRuntimeConfig().app.baseURL;
|
||||
}
|
||||
function buildAssetsDir() {
|
||||
return useRuntimeConfig().app.buildAssetsDir;
|
||||
}
|
||||
function buildAssetsURL(...path) {
|
||||
return joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
|
||||
}
|
||||
function publicAssetsURL(...path) {
|
||||
const app = useRuntimeConfig().app;
|
||||
const publicBase = app.cdnURL || app.baseURL;
|
||||
return path.length ? joinRelativeURL(publicBase, ...path) : publicBase;
|
||||
}
|
||||
|
||||
//#region src/runtime/utils/response.ts
|
||||
/**
|
||||
* The response the renderer builds, keeping its body as the renderer produced it.
|
||||
*
|
||||
* A real `Response` turns every body into a `ReadableStream`, which would send a rendered
|
||||
* document as a chunked stream where nitro sends the string it was given. The renderer only
|
||||
* reads the fields below back, so this describes just those.
|
||||
*/
|
||||
var NodeRenderResponse = class {
|
||||
body;
|
||||
status;
|
||||
statusText;
|
||||
headers;
|
||||
constructor(body, init) {
|
||||
this.body = body;
|
||||
this.status = init?.status || 200;
|
||||
this.statusText = init?.statusText || "";
|
||||
this.headers = init?.headers instanceof Headers ? init.headers : new Headers(init?.headers);
|
||||
}
|
||||
};
|
||||
|
||||
//#region src/runtime/server/renderer/cache.ts
|
||||
function lazyCachedFunction(fn) {
|
||||
let res = null;
|
||||
return () => {
|
||||
if (res === null) res = fn().catch((err) => {
|
||||
res = null;
|
||||
throw err;
|
||||
});
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* E8xxx
|
||||
* SSR rendering diagnostics, sharing the range with the server runtime that
|
||||
* hosts the renderer.
|
||||
*/
|
||||
const docsBase = (code) => `https://nuxt.com/docs/4.x/errors/${code.replace("NUXT_", "").toLowerCase()}`;
|
||||
const rendererDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
||||
docsBase,
|
||||
reporters: [/* @__PURE__ */ createConsoleReporter(void 0)],
|
||||
codes: {
|
||||
NUXT_E8001: {
|
||||
why: (p) => `\`render:html\` mutated \`body\`/\`bodyAppend\` while streaming (\`${p.path}\`). These fields are silently dropped because the body is about to stream.`,
|
||||
fix: "Use the `render:html:close` hook instead.",
|
||||
docs: false
|
||||
},
|
||||
NUXT_E8002: {
|
||||
why: (p) => `SSR streaming committed the response before render completed (\`${p.path}\`). The following mutations did not reach the client and were dropped:\n - ${p.mutations}`,
|
||||
fix: (p) => `Move the mutation into a plugin (which runs before the shell is flushed), or opt this route out of streaming with \`routeRules: { '${p.path}': { streaming: false } }\` or the \`render:route\` hook.`,
|
||||
docs: false
|
||||
},
|
||||
NUXT_E8004: {
|
||||
why: "The server bundle is not available.",
|
||||
fix: "Ensure the Nuxt build completed successfully and the server entry was emitted by your builder.",
|
||||
docs: false
|
||||
},
|
||||
NUXT_E8006: {
|
||||
why: (p) => `The payload for \`${p.path}\` is ${p.size}, which will increase the page size and slow down hydration.${p.keys ? ` Largest payload keys:\n - ${p.keys}` : ""}`,
|
||||
fix: "Use the `pick` or `transform` options of `useAsyncData`/`useFetch` to strip out data the client does not need.",
|
||||
docs: false
|
||||
},
|
||||
NUXT_E8007: {
|
||||
why: (p) => `\`${p.path}\` relies on client-side JavaScript, but \`features.noScripts: 'production'\` will strip scripts from this route in production:\n - ${p.reasons}`,
|
||||
fix: "Remove the client-side dependency from this route, or scope script stripping with the `noScripts` route rule instead of enabling it globally."
|
||||
},
|
||||
NUXT_E8009: {
|
||||
why: (p) => `A page error interrupted the stream for \`${p.path}\`, and ${p.what} also failed while rendering the error response.\n ${p.cause}`,
|
||||
fix: "Fix the page error first. If it keeps happening, report the failure below - the browser will show a blank or partial page instead of the error page."
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//#region src/runtime/server/renderer/build-files.ts
|
||||
const APP_ROOT_OPEN_TAG = `<${appRootTag}${propsToString(appRootAttrs)}>`;
|
||||
const APP_ROOT_CLOSE_TAG = `</${appRootTag}>`;
|
||||
const getServerEntry = () => import('../virtual/entry.mjs').then(function (n) { return n.g; }).then((r) => r.default || r);
|
||||
const getPrecomputedDependencies = () => import('../virtual/precomputed.mjs').then((r) => "default" in r ? r.default : r).then((r) => typeof r === "function" ? r() : r);
|
||||
/** Load the build artifacts for a set of renderer options, caching each of them on the returned object. */
|
||||
function createBuildFiles(options) {
|
||||
const buildAssetsURL = (...path) => options.buildAssetsURL(...path);
|
||||
const getSSRRenderer = lazyCachedFunction(async () => {
|
||||
const createSSRApp = await getServerEntry();
|
||||
if (!createSSRApp) throw rendererDiagnostics.NUXT_E8004();
|
||||
const precomputed = await getPrecomputedDependencies();
|
||||
const renderer = createRenderer(createSSRApp, {
|
||||
precomputed,
|
||||
manifest: void 0,
|
||||
renderToString: renderToString$1,
|
||||
buildAssetsURL
|
||||
});
|
||||
async function renderToString$1(input, context) {
|
||||
const html = await renderToString(input, context);
|
||||
return APP_ROOT_OPEN_TAG + html + APP_ROOT_CLOSE_TAG;
|
||||
}
|
||||
return renderer;
|
||||
});
|
||||
const getSPARenderer = lazyCachedFunction(async () => {
|
||||
const precomputed = await getPrecomputedDependencies();
|
||||
const template = renderSPATemplate();
|
||||
const renderer = createRenderer(() => () => {}, {
|
||||
precomputed,
|
||||
manifest: void 0,
|
||||
renderToString: () => template,
|
||||
buildAssetsURL
|
||||
});
|
||||
const result = await renderer.renderToString({});
|
||||
const renderToString = (ssrContext) => {
|
||||
const config = ssrContext.runtimeConfig;
|
||||
ssrContext.modules ||= /* @__PURE__ */ new Set();
|
||||
ssrContext.payload.serverRendered = false;
|
||||
ssrContext.config = {
|
||||
public: config.public,
|
||||
app: config.app
|
||||
};
|
||||
return Promise.resolve(result);
|
||||
};
|
||||
return {
|
||||
rendererContext: renderer.rendererContext,
|
||||
renderToString
|
||||
};
|
||||
});
|
||||
return {
|
||||
getRenderer: (ssrContext) => ssrContext.noSSR ? getSPARenderer() : getSSRRenderer(),
|
||||
getSSRRenderer,
|
||||
getServerApp: lazyCachedFunction(getServerEntry)
|
||||
};
|
||||
}
|
||||
function renderSPATemplate() {
|
||||
{
|
||||
`<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>`;
|
||||
return APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG + ("");
|
||||
}
|
||||
}
|
||||
const getSSRStyles = lazyCachedFunction(() => import('../virtual/styles.mjs').then((r) => r.default || r));
|
||||
const getInlinedCSS = lazyCachedFunction(() => import('../virtual/styles.mjs').then((r) => r.inlinedCSS || {}));
|
||||
|
||||
//#region src/runtime/server/renderer/instance.ts
|
||||
/**
|
||||
* Create the renderer state for a set of options.
|
||||
*
|
||||
* Called by `createNuxtRenderer()`; call it directly only to render against the same
|
||||
* artifacts as a renderer created elsewhere (an island handler sharing the server bundle
|
||||
* loaded for page renders), and pass the result to `createNuxtRenderer()`.
|
||||
*/
|
||||
function createRendererInstance(options) {
|
||||
return {
|
||||
options,
|
||||
...createBuildFiles(options)
|
||||
};
|
||||
}
|
||||
|
||||
//#region src/runtime/server/renderer/runtime.ts
|
||||
/** The event to pass to application code and to the render hooks. */
|
||||
function appEvent(event) {
|
||||
return event["~app"] ?? event;
|
||||
}
|
||||
function getRequestState(event) {
|
||||
return event.context.nuxt;
|
||||
}
|
||||
|
||||
//#region src/runtime/utils/renderer/options.ts
|
||||
globalThis.__buildAssetsURL = buildAssetsURL;
|
||||
globalThis.__publicAssetsURL = publicAssetsURL;
|
||||
/** The capabilities a nitropack v2 host provides to the Nuxt renderer. */
|
||||
const rendererOptions = {
|
||||
runtimeConfig: (event) => useRuntimeConfig(appEvent(event)),
|
||||
buildAssetsURL,
|
||||
publicAssetsURL,
|
||||
getRouteRules: (event) => getRouteRules(appEvent(event)),
|
||||
hooks: () => useNitroApp().hooks,
|
||||
createResponse: (body, init) => new NodeRenderResponse(body, init),
|
||||
createError: (init) => createError({
|
||||
statusCode: init.status,
|
||||
statusMessage: init.statusText,
|
||||
message: init.statusText,
|
||||
data: init.data
|
||||
}),
|
||||
writeEarlyHints: (event, hints) => writeEarlyHints(appEvent(event), hints.link),
|
||||
onRenderSuccess: void 0,
|
||||
prerender: void 0
|
||||
};
|
||||
/**
|
||||
* The renderer the page and island handlers share, so that both render against a single
|
||||
* load of the server bundle and its manifest.
|
||||
*/
|
||||
const rendererInstance = createRendererInstance(rendererOptions);
|
||||
|
||||
//#region src/runtime/server/renderer/url.ts
|
||||
/**
|
||||
* The fragment of a request URL, avoiding the lazy URL parse that reading `hash` triggers when
|
||||
* there is none. A fragment is never sent over the wire, so it can only appear on a URL the
|
||||
* server constructed itself.
|
||||
*/
|
||||
function urlHash(url) {
|
||||
return url.href.includes("#") ? url.hash : "";
|
||||
}
|
||||
|
||||
//#region src/runtime/server/renderer/app.ts
|
||||
new Set(NUXT_PRERENDER_NO_SSR_ROUTES);
|
||||
function createServerHead() {
|
||||
return createHead(unheadOptions);
|
||||
}
|
||||
function createSSRContext(options, event) {
|
||||
const url = event.url.pathname + event.url.search + urlHash(event.url);
|
||||
const ssrContext = {
|
||||
url,
|
||||
event: appEvent(event),
|
||||
runtimeConfig: options.runtimeConfig(event),
|
||||
noSSR: getRequestState(event)?.noSSR || (false),
|
||||
head: createServerHead(),
|
||||
error: false,
|
||||
nuxt: void 0,
|
||||
payload: {},
|
||||
["~payloadReducers"]: Object.create(null),
|
||||
modules: /* @__PURE__ */ new Set()
|
||||
};
|
||||
return ssrContext;
|
||||
}
|
||||
/**
|
||||
* Turn the response the renderer assembled into a web-standard `Response`, carrying the
|
||||
* headers queued on the event alongside the ones the response names for itself.
|
||||
*/
|
||||
function returnRenderResponse(options, event, response) {
|
||||
const headers = new Headers(event.res.headers);
|
||||
for (const name in response.headers) headers.set(name, response.headers[name]);
|
||||
return options.createResponse(response.body ?? null, {
|
||||
status: response.statusCode ?? event.res.status,
|
||||
statusText: response.statusMessage ?? event.res.statusText,
|
||||
headers
|
||||
});
|
||||
}
|
||||
function setSSRError(ssrContext, error) {
|
||||
ssrContext.error = true;
|
||||
ssrContext.payload = { error };
|
||||
ssrContext.url = error.url;
|
||||
}
|
||||
|
||||
function renderPayloadJsonScript(opts) {
|
||||
const contents = opts.data ? encodeForwardSlashes(stringify(opts.data, opts.ssrContext["~payloadReducers"])) : "";
|
||||
const payload = {
|
||||
"type": "application/json",
|
||||
"innerHTML": contents,
|
||||
"data-nuxt-data": appId,
|
||||
"data-ssr": !(opts.ssrContext.noSSR)
|
||||
};
|
||||
payload.id = "__NUXT_DATA__";
|
||||
if (opts.src) payload["data-src"] = opts.src;
|
||||
const config = uneval(opts.ssrContext.config);
|
||||
return [payload, { innerHTML: `window.__NUXT__={};window.__NUXT__.config=${config}` }];
|
||||
}
|
||||
/**
|
||||
* Encode forward slashes as unicode escape sequences to prevent
|
||||
* Google from treating them as internal links and trying to crawl them.
|
||||
* @see https://github.com/nuxt/nuxt/issues/24175
|
||||
*/
|
||||
function encodeForwardSlashes(str) {
|
||||
return str.replaceAll("/", "\\u002F");
|
||||
}
|
||||
|
||||
//#region src/runtime/server/renderer/inline-styles.ts
|
||||
async function renderInlineStyles(usedModules) {
|
||||
const styleMap = await getSSRStyles();
|
||||
const inlinedStyles = /* @__PURE__ */ new Set();
|
||||
const promises = [];
|
||||
for (const mod of usedModules) if (mod in styleMap && styleMap[mod]) promises.push(styleMap[mod]());
|
||||
for (const styles of await Promise.all(promises)) for (const style of styles) inlinedStyles.add(style);
|
||||
return Array.from(inlinedStyles).map((style) => ({ innerHTML: style }));
|
||||
}
|
||||
|
||||
//#region src/runtime/server/renderer/inlined-css.ts
|
||||
/**
|
||||
* Build a predicate telling whether the contents of an emitted CSS file were
|
||||
* inlined as `<style>` tags for this request, meaning its `<link>` can be
|
||||
* dropped.
|
||||
*
|
||||
* The builder can only remove a link at build time when every CSS source in
|
||||
* the file is inlined for a module that is always rendered. For the rest it
|
||||
* records the modules that inline each source, and the answer depends on what
|
||||
* the request actually rendered: a component inside `<ClientOnly>` never
|
||||
* reaches `ssrContext.modules`, so its styles are only ever delivered by the
|
||||
* link. (#36058)
|
||||
*/
|
||||
async function createInlinedCSSFilter(modules) {
|
||||
const inlinedCSS = await getInlinedCSS();
|
||||
return (file) => {
|
||||
const conditions = inlinedCSS[file.slice(file.lastIndexOf("/") + 1)];
|
||||
if (!conditions) return false;
|
||||
if (!modules?.size) return false;
|
||||
for (const inliners of conditions) {
|
||||
let inlined = false;
|
||||
for (const id of inliners) if (modules.has(id)) {
|
||||
inlined = true;
|
||||
break;
|
||||
}
|
||||
if (!inlined) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
const entryIds = ["../site1/node_modules/nuxt/dist/app/entry.js"];
|
||||
|
||||
const entryFileName = "CKG19VCq.js";
|
||||
|
||||
//#region src/runtime/server/renderer/index.ts
|
||||
const HAS_APP_TELEPORTS = !!(appTeleportAttrs.id);
|
||||
const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : "";
|
||||
const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `</${appTeleportTag}>` : "";
|
||||
/**
|
||||
* Create a Nuxt SSR renderer, returning a web-standard handler for the requests a Nuxt
|
||||
* app serves from its pages.
|
||||
*
|
||||
* Everything the renderer reads belongs to the renderer it was created for, so a bundle
|
||||
* may create as many as it needs. Pass an instance from `createRendererInstance()` to
|
||||
* render against the artifacts already loaded for another renderer.
|
||||
*/
|
||||
function createNuxtRenderer(optionsOrInstance) {
|
||||
const instance = "getRenderer" in optionsOrInstance ? optionsOrInstance : createRendererInstance(optionsOrInstance);
|
||||
return { fetch: (event) => fetch(instance, event) };
|
||||
}
|
||||
function fetch(instance, event) {
|
||||
const runtime = instance.options;
|
||||
const isErrorRoute = event.url.pathname.startsWith("/__nuxt_error");
|
||||
if (isErrorRoute && !getRequestState(event)?.["~rendering-error"]) {
|
||||
return Promise.reject(runtime.createError({
|
||||
status: 404,
|
||||
statusText: "Page Not Found: /__nuxt_error"
|
||||
}));
|
||||
}
|
||||
const ssrError = isErrorRoute ? getQuery(event.url.href) : null;
|
||||
const render = () => renderRoute(instance, event, ssrError).then((response) => returnRenderResponse(runtime, event, response));
|
||||
const rendering = render();
|
||||
return rendering;
|
||||
}
|
||||
async function renderRoute(instance, event, ssrError) {
|
||||
const runtime = instance.options;
|
||||
const hooks = runtime.hooks();
|
||||
const hookEvent = appEvent(event);
|
||||
runtime.prerender?.payloadCache;
|
||||
const ssrContext = createSSRContext(runtime, event);
|
||||
ssrContext.head.push(appHead);
|
||||
if (ssrError) {
|
||||
const status = ssrError.status || ssrError.statusCode;
|
||||
if (status) ssrError.status = ssrError.statusCode = Number.parseInt(status);
|
||||
if (typeof ssrError.data === "string") try {
|
||||
ssrError.data = destr(ssrError.data);
|
||||
} catch {}
|
||||
setSSRError(ssrContext, ssrError);
|
||||
}
|
||||
const routeOptions = runtime.getRouteRules(event);
|
||||
const NO_SCRIPTS = !!routeOptions.noScripts;
|
||||
if (routeOptions.ssr === false && true) ssrContext.noSSR = true;
|
||||
!ssrContext.noSSR && !ssrError && false;
|
||||
const renderer = await instance.getRenderer(ssrContext);
|
||||
for (const id of entryIds) ssrContext.modules.add(id);
|
||||
const canStream = NUXT_SSR_STREAMING;
|
||||
const renderRouteContext = {
|
||||
canStream,
|
||||
prefersStream: false
|
||||
};
|
||||
await hooks.callHook("render:route", renderRouteContext, { event: hookEvent });
|
||||
const _rendered = await (renderer.renderToString(ssrContext)).catch(async (error) => {
|
||||
if ((ssrContext["~renderResponse"] || ssrContext._renderResponse) && error.message === "skipping render") return {};
|
||||
const _err = !ssrError && ssrContext.payload?.error || error;
|
||||
await ssrContext.nuxt?.hooks.callHook("app:error", _err);
|
||||
throw _err;
|
||||
});
|
||||
const inlinedStyles = !ssrContext["~renderResponse"] && !ssrContext._renderResponse && true ? await renderInlineStyles(ssrContext.modules ?? []) : [];
|
||||
await ssrContext.nuxt?.hooks.callHook("app:rendered", {
|
||||
ssrContext,
|
||||
renderResult: _rendered
|
||||
});
|
||||
if (ssrContext["~renderResponse"] || ssrContext._renderResponse) return ssrContext["~renderResponse"] || ssrContext._renderResponse;
|
||||
if (ssrContext.payload?.error && !ssrError) throw ssrContext.payload.error;
|
||||
const { styles, scripts } = getRequestDependencies(ssrContext, renderer.rendererContext);
|
||||
pushNoScriptsHints(ssrContext, NO_SCRIPTS);
|
||||
if (!NO_SCRIPTS) {
|
||||
const path = entryImportMapPath(instance, event, ssrContext);
|
||||
ssrContext.head.push({ script: [{
|
||||
type: "importmap",
|
||||
innerHTML: { imports: { "#entry": path } }
|
||||
}] });
|
||||
}
|
||||
if (inlinedStyles.length) ssrContext.head.push({ style: inlinedStyles });
|
||||
const link = [];
|
||||
const inlinedHrefs = [];
|
||||
const isCSSInlined = await createInlinedCSSFilter(ssrContext.modules) ;
|
||||
for (const resource of Object.values(styles)) {
|
||||
if (isCSSInlined?.(resource.file)) {
|
||||
inlinedHrefs.push(renderer.rendererContext.buildAssetsURL(resource.file));
|
||||
continue;
|
||||
}
|
||||
link.push({
|
||||
rel: "stylesheet",
|
||||
href: renderer.rendererContext.buildAssetsURL(resource.file),
|
||||
crossorigin: ""
|
||||
});
|
||||
}
|
||||
if (link.length) ssrContext.head.push({ link });
|
||||
const dependencyOptions = {
|
||||
exclude: ssrContext["~lazyHydratedModules"]?.size ? ssrContext["~lazyHydratedModules"] : void 0,
|
||||
scripts: !NO_SCRIPTS
|
||||
};
|
||||
const excludeHrefs = new Set(link.map((l) => l.href));
|
||||
for (const href of inlinedHrefs) excludeHrefs.add(href);
|
||||
for (const id of ssrContext["~neverHydratedModules"] ?? []) {
|
||||
const file = renderer.rendererContext.manifest?.[id]?.file;
|
||||
if (file) excludeHrefs.add(renderer.rendererContext.buildAssetsURL(file));
|
||||
}
|
||||
const hints = [];
|
||||
for (const l of getPreloadLinks(ssrContext, renderer.rendererContext, dependencyOptions)) if (!excludeHrefs.has(l.href)) hints.push(l);
|
||||
for (const l of getPrefetchLinks(ssrContext, renderer.rendererContext, dependencyOptions)) if (!excludeHrefs.has(l.href)) hints.push(l);
|
||||
if (hints.length) ssrContext.head.push({ link: hints });
|
||||
if (!NO_SCRIPTS) ssrContext.head.push({ script: renderPayloadJsonScript({
|
||||
ssrContext,
|
||||
data: stripInlineOnlyPayloadFields(ssrContext.payload)
|
||||
}) }, {
|
||||
tagPosition: "bodyClose",
|
||||
tagPriority: "high"
|
||||
});
|
||||
if (!routeOptions.noScripts) {
|
||||
const tagPosition = "head";
|
||||
ssrContext.head.push({ script: Object.values(scripts).map((resource) => ({
|
||||
type: resource.module ? "module" : null,
|
||||
src: renderer.rendererContext.buildAssetsURL(resource.file),
|
||||
defer: resource.module ? null : true,
|
||||
tagPosition,
|
||||
crossorigin: ""
|
||||
})) });
|
||||
}
|
||||
const { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs } = renderSSRHead(ssrContext.head, renderSSRHeadOptions);
|
||||
const htmlContext = {
|
||||
htmlAttrs: htmlAttrs ? [htmlAttrs] : [],
|
||||
head: normalizeChunks([headTags]),
|
||||
bodyAttrs: bodyAttrs ? [bodyAttrs] : [],
|
||||
bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
|
||||
body: [_rendered.html, APP_TELEPORT_OPEN_TAG + (HAS_APP_TELEPORTS ? joinTags([ssrContext.teleports?.[`#${appTeleportAttrs.id}`]]) : "") + APP_TELEPORT_CLOSE_TAG],
|
||||
bodyAppend: [bodyTags]
|
||||
};
|
||||
await hooks.callHook("render:html", htmlContext, { event: hookEvent });
|
||||
return {
|
||||
body: renderHTMLDocument(htmlContext),
|
||||
statusCode: event.res.status,
|
||||
statusMessage: event.res.statusText,
|
||||
headers: {
|
||||
"content-type": "text/html;charset=utf-8",
|
||||
"x-powered-by": "Nuxt"
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Routes served without scripts navigate with full-page loads. This emits the
|
||||
* declarative navigation hints that speed those up, on both the pages served
|
||||
* without scripts (a blanket rule over same-origin links) and scripted pages
|
||||
* that may link to them (rules scoped to the `noScripts` route patterns):
|
||||
*
|
||||
* - speculation rules, so supporting browsers prefetch and prerender the
|
||||
* target ahead of the navigation;
|
||||
* - when view transitions are enabled, an opt-in to same-origin cross-document
|
||||
* view transitions, animating the navigation without a client runtime (the
|
||||
* client-side `startViewTransition` plugin is not shipped).
|
||||
*
|
||||
* Both tags are declarative and execute no JavaScript.
|
||||
*/
|
||||
function pushNoScriptsHints(ssrContext, noScripts) {
|
||||
if (noScripts) pushSpeculationRulesScript(ssrContext, NUXT_PAGE_PATTERNS.length ? NUXT_PAGE_PATTERNS : ["/*"]);
|
||||
else if (NUXT_NO_SCRIPTS_PATTERNS.length) pushSpeculationRulesScript(ssrContext, NUXT_NO_SCRIPTS_PATTERNS);
|
||||
else return;
|
||||
}
|
||||
const entryPaths = /* @__PURE__ */ new WeakMap();
|
||||
/** URL of the hashed entry chunk, which `#entry` is pinned to so chunk hashes stay stable across it. */
|
||||
function entryImportMapPath(instance, event, ssrContext) {
|
||||
const cached = entryPaths.get(instance);
|
||||
if (cached) return cached;
|
||||
const url = instance.options.buildAssetsURL(entryFileName);
|
||||
if (ssrContext.runtimeConfig.app.cdnURL || /^(?:\/|\.+\/)/.test(url)) {
|
||||
entryPaths.set(instance, url);
|
||||
return url;
|
||||
}
|
||||
const path = relative(event.url.pathname.replace(/\/[^/]+$/, "/"), joinURL("/", url));
|
||||
return /^(?:\/|\.+\/)/.test(path) ? path : `./${path}`;
|
||||
}
|
||||
function pushSpeculationRulesScript(ssrContext, patterns) {
|
||||
const rules = patterns.map((href_matches) => ({
|
||||
where: { href_matches },
|
||||
eagerness: "moderate"
|
||||
}));
|
||||
ssrContext.head.push({ script: [{
|
||||
tagPosition: "head",
|
||||
type: "speculationrules",
|
||||
innerHTML: {
|
||||
prefetch: rules,
|
||||
prerender: rules
|
||||
}
|
||||
}] });
|
||||
}
|
||||
function normalizeChunks(chunks) {
|
||||
const result = [];
|
||||
for (const _chunk of chunks) {
|
||||
const chunk = _chunk?.trim();
|
||||
if (chunk) result.push(chunk);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function joinTags(tags) {
|
||||
return tags.join("");
|
||||
}
|
||||
function joinAttrs(chunks) {
|
||||
if (chunks.length === 0) return "";
|
||||
return " " + chunks.join(" ");
|
||||
}
|
||||
function renderHTMLDocument(html) {
|
||||
return `<!DOCTYPE html><html${joinAttrs(html.htmlAttrs)}><head>${joinTags(html.head)}</head><body${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body></html>`;
|
||||
}
|
||||
function stripInlineOnlyPayloadFields(payload) {
|
||||
if (!payload.prefetchLinks) return payload;
|
||||
const { prefetchLinks: _, ...rest } = payload;
|
||||
return rest;
|
||||
}
|
||||
|
||||
const renderer = createNuxtRenderer(rendererInstance);
|
||||
const handler = defineRenderHandler(async (event) => {
|
||||
const response = await renderer.fetch(toRequestEvent(event));
|
||||
for (const [name, value] of response.headers) {
|
||||
if (name === "set-cookie") continue;
|
||||
setResponseHeader(event, name, value);
|
||||
}
|
||||
return {
|
||||
body: response.body,
|
||||
statusCode: response.status,
|
||||
statusMessage: response.statusText || void 0
|
||||
};
|
||||
});
|
||||
|
||||
const renderer$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null,
|
||||
default: handler
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { baseURL as b, renderer$1 as r };
|
||||
//# sourceMappingURL=renderer.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"renderer.mjs","sources":["../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/paths.mjs","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/response.mjs","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/cache.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/diagnostics.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/build-files.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/instance.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/runtime.js","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/utils/renderer/options.mjs","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/url.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/app.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/payload.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/inline-styles.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/inlined-css.js","../../../../../site1/node_modules/nuxt/dist/runtime/server/renderer/index.js","../../../../../site1/node_modules/@nuxt/nitro-server/dist/runtime/handlers/renderer.mjs"],"names":[],"mappings":"","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"entry.mjs","sources":["../../../../../site1/node_modules/nostics/dist/index.mjs","../../../../../site1/node_modules/hookable/dist/index.mjs","../../../../../site1/node_modules/unhead/dist/shared/unhead.CGPOfp5O.mjs","../../../../../site1/node_modules/unhead/dist/shared/unhead.-hZVKou0.mjs","../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/server.mjs"],"names":["START_LOCATION$1","entry"],"mappings":"","x_google_ignoreList":[0,1,2,3,4]}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"precomputed.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/client.precomputed.mjs"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,25 @@
|
||||
const interopDefault = r => r.default || r || [];
|
||||
const styles = {
|
||||
"../site1/node_modules/nuxt/dist/app/entry.js": () => import('../_/entry-styles.Do9mzw8X.mjs').then(interopDefault),
|
||||
"components/AppFooter.vue": () => import('../_/AppFooter-styles.CJFLV6sm.mjs').then(interopDefault),
|
||||
"app.vue": () => import('../_/app-styles.Cw0M3vbz.mjs').then(interopDefault),
|
||||
"pages/[...slug].vue": () => import('../_/_...slug_-styles.CT2yr3kk.mjs').then(interopDefault),
|
||||
"pages/index.vue": () => import('../_/index-styles.DCHX_zt6.mjs').then(interopDefault),
|
||||
"../site1/node_modules/nuxt/dist/app/components/error-404.vue": () => import('../_/error-404-styles.CokM88Qa.mjs').then(interopDefault),
|
||||
"../site1/node_modules/nuxt/dist/app/components/error-500.vue": () => import('../_/error-500-styles.Tpdhuaa7.mjs').then(interopDefault),
|
||||
"components/TeacherVerification.vue": () => import('../_/TeacherVerification-styles.CY_h0OMc.mjs').then(interopDefault),
|
||||
"components/QuickMetrics.vue": () => import('../_/QuickMetrics-styles.C4BIqcXM.mjs').then(interopDefault),
|
||||
"components/CoachingSystem.vue": () => import('../_/CoachingSystem-styles.Cdye9kFG.mjs').then(interopDefault),
|
||||
"components/HeroBanner.vue": () => import('../_/HeroBanner-styles.CvIa3HUq.mjs').then(interopDefault),
|
||||
"components/NearbySchools.vue": () => import('../_/NearbySchools-styles.C57PEwif.mjs').then(interopDefault),
|
||||
"components/ProcessGuide.vue": () => import('../_/ProcessGuide-styles.Biu6P_Tv.mjs').then(interopDefault),
|
||||
"components/ConsultForm.vue": () => import('../_/ConsultForm-styles.dIT-K8tm.mjs').then(interopDefault),
|
||||
"components/SubjectMastery.vue": () => import('../_/SubjectMastery-styles.DiHpurSx.mjs').then(interopDefault),
|
||||
"components/SuccessStories.vue": () => import('../_/SuccessStories-styles.DsOt6tgx.mjs').then(interopDefault),
|
||||
"components/FaqAccordion.vue": () => import('../_/FaqAccordion-styles.DAcJkXd4.mjs').then(interopDefault)
|
||||
};
|
||||
|
||||
const inlinedCSS = {"error-404.D0m1Jkqd.css":[["../site1/node_modules/nuxt/dist/app/components/error-404.vue"]],"error-500.gbIBGjPp.css":[["../site1/node_modules/nuxt/dist/app/components/error-500.vue"]],"seoHelper.Dk6QJIiW.css":[["components/HeroBanner.vue"],["components/QuickMetrics.vue"],["components/NearbySchools.vue"],["components/SubjectMastery.vue"],["components/TeacherVerification.vue"],["components/CoachingSystem.vue"],["components/SuccessStories.vue"],["components/ProcessGuide.vue"],["components/FaqAccordion.vue"],["components/ConsultForm.vue"]],"_...C-muEq89.css":[["pages/[...slug].vue"]],"pages.ZxAsEPPV.css":[["pages/index.vue"]]};
|
||||
|
||||
export { styles as default, inlinedCSS };
|
||||
//# sourceMappingURL=styles.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"styles.mjs","sources":["../../../../../site1/node_modules/.cache/nuxt/.nuxt/dist/server/styles.mjs"],"names":[],"mappings":"","x_google_ignoreList":[0]}
|
||||
@@ -0,0 +1,42 @@
|
||||
import process from 'node:process';globalThis._importMeta_={url:import.meta.url,env:process.env};import { Server as Server$1 } from 'node:http';
|
||||
import { Server } from 'node:https';
|
||||
import { t as toNodeListener, d as destr, u as useRuntimeConfig, a as trapUnhandledNodeErrors, s as setupGracefulShutdown, b as useNitroApp } from './chunks/_/nitro.mjs';
|
||||
import 'unhead/server';
|
||||
import 'vue';
|
||||
import 'unhead/legacy';
|
||||
import 'unhead/plugins';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
|
||||
const cert = process.env.NITRO_SSL_CERT;
|
||||
const key = process.env.NITRO_SSL_KEY;
|
||||
const nitroApp = useNitroApp();
|
||||
const server = cert && key ? new Server({ key, cert }, toNodeListener(nitroApp.h3App)) : new Server$1(toNodeListener(nitroApp.h3App));
|
||||
const port = destr(process.env.NITRO_PORT || process.env.PORT) || 3e3;
|
||||
const host = process.env.NITRO_HOST || process.env.HOST;
|
||||
const path = process.env.NITRO_UNIX_SOCKET;
|
||||
const listener = server.listen(path ? { path } : { port, host }, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
const protocol = cert && key ? "https" : "http";
|
||||
const addressInfo = listener.address();
|
||||
if (typeof addressInfo === "string") {
|
||||
console.log(`Listening on unix socket ${addressInfo}`);
|
||||
return;
|
||||
}
|
||||
const baseURL = (useRuntimeConfig().app.baseURL || "").replace(/\/$/, "");
|
||||
const url = `${protocol}://${addressInfo.family === "IPv6" ? `[${addressInfo.address}]` : addressInfo.address}:${addressInfo.port}${baseURL}`;
|
||||
console.log(`Listening on ${url}`);
|
||||
});
|
||||
trapUnhandledNodeErrors();
|
||||
setupGracefulShutdown(listener, nitroApp);
|
||||
const nodeServer = {};
|
||||
|
||||
export { nodeServer as default };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../../site1/node_modules/nitropack/dist/presets/node/runtime/node-server.mjs"],"names":["HttpsServer","HttpServer"],"mappings":"","x_google_ignoreList":[0]}
|
||||
+14616
File diff suppressed because it is too large
Load Diff
+50
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.29.9",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A+parser+%28babylon%29%22+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"javascript",
|
||||
"parser",
|
||||
"tc39",
|
||||
"ecmascript",
|
||||
"@babel/parser"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-parser"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"types": "./typings/babel-parser.d.ts",
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"typings/babel-parser.d.ts",
|
||||
"index.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.29.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.29.7",
|
||||
"@babel/helper-check-duplicate-nodes": "^7.29.7",
|
||||
"@babel/helper-fixtures": "^7.29.7",
|
||||
"@babel/helper-string-parser": "^7.29.7",
|
||||
"@babel/helper-validator-identifier": "^7.29.7",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"bin": "./bin/babel-parser.js",
|
||||
"type": "commonjs"
|
||||
}
|
||||
Generated
Vendored
+6801
File diff suppressed because it is too large
Load Diff
+58
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name": "@vue/compiler-core",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/compiler-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
"types": "dist/compiler-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-core.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-core.cjs.prod.js",
|
||||
"development": "./dist/compiler-core.cjs.js",
|
||||
"default": "./dist/compiler-core.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/compiler-core.esm-bundler.js",
|
||||
"import": "./dist/compiler-core.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.29.8",
|
||||
"@vue/shared": "3.5.43",
|
||||
"entities": "^7.0.1",
|
||||
"estree-walker": "^2.0.2",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.29.8"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+692
@@ -0,0 +1,692 @@
|
||||
/**
|
||||
* @vue/compiler-dom v3.5.43
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var compilerCore = require('@vue/compiler-core');
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const V_MODEL_RADIO = /* @__PURE__ */ Symbol(``);
|
||||
const V_MODEL_CHECKBOX = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
const V_MODEL_TEXT = /* @__PURE__ */ Symbol(``);
|
||||
const V_MODEL_SELECT = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
const V_MODEL_DYNAMIC = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
const V_ON_WITH_MODIFIERS = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
const V_ON_WITH_KEYS = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
const V_SHOW = /* @__PURE__ */ Symbol(``);
|
||||
const TRANSITION = /* @__PURE__ */ Symbol(``);
|
||||
const TRANSITION_GROUP = /* @__PURE__ */ Symbol(
|
||||
``
|
||||
);
|
||||
compilerCore.registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
const parserOptions = {
|
||||
parseMode: "html",
|
||||
isVoidTag: shared.isVoidTag,
|
||||
isNativeTag: (tag) => shared.isHTMLTag(tag) || shared.isSVGTag(tag) || shared.isMathMLTag(tag),
|
||||
isPreTag: (tag) => tag === "pre",
|
||||
isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea",
|
||||
decodeEntities: void 0,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (tag === "Transition" || tag === "transition") {
|
||||
return TRANSITION;
|
||||
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent, rootNamespace) {
|
||||
let ns = parent ? parent.ns : rootNamespace;
|
||||
if (parent && ns === 2) {
|
||||
if (parent.tag === "annotation-xml") {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (parent.props.some(
|
||||
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||
)) {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||
ns = 0;
|
||||
}
|
||||
} else if (parent && ns === 1) {
|
||||
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||
ns = 0;
|
||||
}
|
||||
}
|
||||
if (ns === 0) {
|
||||
if (tag === "svg") {
|
||||
return 1;
|
||||
}
|
||||
if (tag === "math") {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
}
|
||||
};
|
||||
|
||||
const transformStyle = (node) => {
|
||||
if (node.type === 1) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 && p.name === "style" && p.value) {
|
||||
node.props[i] = {
|
||||
type: 7,
|
||||
name: `bind`,
|
||||
arg: compilerCore.createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = shared.parseStringStyle(cssText);
|
||||
return compilerCore.createSimpleExpression(
|
||||
JSON.stringify(normalized),
|
||||
false,
|
||||
loc,
|
||||
3
|
||||
);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return compilerCore.createCompilerError(
|
||||
code,
|
||||
loc,
|
||||
DOMErrorMessages
|
||||
);
|
||||
}
|
||||
const DOMErrorCodes = {
|
||||
"X_V_HTML_NO_EXPRESSION": 54,
|
||||
"54": "X_V_HTML_NO_EXPRESSION",
|
||||
"X_V_HTML_WITH_CHILDREN": 55,
|
||||
"55": "X_V_HTML_WITH_CHILDREN",
|
||||
"X_V_TEXT_NO_EXPRESSION": 56,
|
||||
"56": "X_V_TEXT_NO_EXPRESSION",
|
||||
"X_V_TEXT_WITH_CHILDREN": 57,
|
||||
"57": "X_V_TEXT_WITH_CHILDREN",
|
||||
"X_V_MODEL_ON_INVALID_ELEMENT": 58,
|
||||
"58": "X_V_MODEL_ON_INVALID_ELEMENT",
|
||||
"X_V_MODEL_ARG_ON_ELEMENT": 59,
|
||||
"59": "X_V_MODEL_ARG_ON_ELEMENT",
|
||||
"X_V_MODEL_ON_FILE_INPUT_ELEMENT": 60,
|
||||
"60": "X_V_MODEL_ON_FILE_INPUT_ELEMENT",
|
||||
"X_V_MODEL_UNNECESSARY_VALUE": 61,
|
||||
"61": "X_V_MODEL_UNNECESSARY_VALUE",
|
||||
"X_V_SHOW_NO_EXPRESSION": 62,
|
||||
"62": "X_V_SHOW_NO_EXPRESSION",
|
||||
"X_TRANSITION_INVALID_CHILDREN": 63,
|
||||
"63": "X_TRANSITION_INVALID_CHILDREN",
|
||||
"X_IGNORED_SIDE_EFFECT_TAG": 64,
|
||||
"64": "X_IGNORED_SIDE_EFFECT_TAG",
|
||||
"__EXTEND_POINT__": 65,
|
||||
"65": "__EXTEND_POINT__"
|
||||
};
|
||||
const DOMErrorMessages = {
|
||||
[54]: `v-html is missing expression.`,
|
||||
[55]: `v-html will override element children.`,
|
||||
[56]: `v-text is missing expression.`,
|
||||
[57]: `v-text will override element children.`,
|
||||
[58]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[59]: `v-model argument is not supported on plain elements.`,
|
||||
[60]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[61]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[62]: `v-show is missing expression.`,
|
||||
[63]: `<Transition> expects exactly one child element or component.`,
|
||||
[64]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(54, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(55, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`innerHTML`, true, loc),
|
||||
exp || compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(56, loc)
|
||||
);
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(
|
||||
createDOMCompilerError(57, loc)
|
||||
);
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
compilerCore.createObjectProperty(
|
||||
compilerCore.createSimpleExpression(`textContent`, true),
|
||||
exp ? compilerCore.getConstantType(exp, context) > 0 ? exp : compilerCore.createCallExpression(
|
||||
context.helperString(compilerCore.TO_DISPLAY_STRING),
|
||||
[exp],
|
||||
loc
|
||||
) : compilerCore.createSimpleExpression("", true)
|
||||
)
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = compilerCore.transformModel(dir, node, context);
|
||||
if (!baseResult.props.length || node.tagType === 1) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
59,
|
||||
dir.arg.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === "input" || isCustomElement) {
|
||||
const type = compilerCore.findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case "radio":
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case "checkbox":
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case "file":
|
||||
isInvalidType = true;
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
60,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (compilerCore.hasDynamicKeyVBind(node)) {
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
} else ;
|
||||
} else if (tag === "select") {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
} else ;
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
} else {
|
||||
context.onError(
|
||||
createDOMCompilerError(
|
||||
58,
|
||||
dir.loc
|
||||
)
|
||||
);
|
||||
}
|
||||
baseResult.props = baseResult.props.filter(
|
||||
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||
);
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /* @__PURE__ */ shared.makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /* @__PURE__ */ shared.makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||
);
|
||||
const maybeKeyModifier = /* @__PURE__ */ shared.makeMap("left,right");
|
||||
const isKeyboardEvent = /* @__PURE__ */ shared.makeMap(`onkeyup,onkeydown,onkeypress`);
|
||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i].content;
|
||||
if (modifier === "native" && compilerCore.checkCompatEnabled(
|
||||
"COMPILER_V_ON_NATIVE",
|
||||
context,
|
||||
loc
|
||||
)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else if (isEventOptionModifier(modifier)) {
|
||||
eventOptionModifiers.push(modifier);
|
||||
} else {
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (compilerCore.isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content.toLowerCase())) {
|
||||
keyModifiers.push(modifier);
|
||||
} else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
} else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
} else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = compilerCore.isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||
return isStaticClick ? compilerCore.createSimpleExpression(event, true) : key.type !== 4 ? compilerCore.createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
]) : key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return compilerCore.transformOn(dir, node, context, (baseResult) => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length) return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||
if (nonKeyModifiers.includes("right")) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes("middle")) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||
(!compilerCore.isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
|
||||
handlerExp = compilerCore.createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(shared.capitalize).join("");
|
||||
key = compilerCore.isStaticExp(key) ? compilerCore.createSimpleExpression(`${key.content}${modifierPostfix}`, true) : compilerCore.createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [compilerCore.createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(
|
||||
createDOMCompilerError(62, loc)
|
||||
);
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
|
||||
const stringifyStatic = (children, context, parent) => {
|
||||
if (context.scopes.vSlot > 0) {
|
||||
return;
|
||||
}
|
||||
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20;
|
||||
let nc = 0;
|
||||
let ec = 0;
|
||||
const currentChunk = [];
|
||||
const stringifyCurrentChunk = (currentIndex) => {
|
||||
if (nc >= 20 || ec >= 5) {
|
||||
const staticCall = compilerCore.createCallExpression(context.helper(compilerCore.CREATE_STATIC), [
|
||||
JSON.stringify(
|
||||
currentChunk.map((node) => stringifyNode(node, context)).join("")
|
||||
).replace(expReplaceRE, `" + $1 + "`),
|
||||
// the 2nd argument indicates the number of DOM nodes this static vnode
|
||||
// will insert / hydrate
|
||||
String(currentChunk.length)
|
||||
]);
|
||||
const deleteCount = currentChunk.length - 1;
|
||||
if (isParentCached) {
|
||||
children.splice(
|
||||
currentIndex - currentChunk.length,
|
||||
currentChunk.length,
|
||||
// @ts-expect-error
|
||||
staticCall
|
||||
);
|
||||
} else {
|
||||
currentChunk[0].codegenNode.value = staticCall;
|
||||
if (currentChunk.length > 1) {
|
||||
children.splice(currentIndex - currentChunk.length + 1, deleteCount);
|
||||
const cacheIndex = context.cached.indexOf(
|
||||
currentChunk[currentChunk.length - 1].codegenNode
|
||||
);
|
||||
if (cacheIndex > -1) {
|
||||
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) {
|
||||
const c = context.cached[i2];
|
||||
if (c) c.index -= deleteCount;
|
||||
}
|
||||
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
return deleteCount;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
let i = 0;
|
||||
for (; i < children.length; i++) {
|
||||
const child = children[i];
|
||||
const isCached = isParentCached || getCachedNode(child);
|
||||
if (isCached) {
|
||||
const result = analyzeNode(child);
|
||||
if (result) {
|
||||
nc += result[0];
|
||||
ec += result[1];
|
||||
currentChunk.push(child);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i -= stringifyCurrentChunk(i);
|
||||
nc = 0;
|
||||
ec = 0;
|
||||
currentChunk.length = 0;
|
||||
}
|
||||
stringifyCurrentChunk(i);
|
||||
};
|
||||
const getCachedNode = (node) => {
|
||||
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) {
|
||||
return node.codegenNode;
|
||||
}
|
||||
};
|
||||
const dataAriaRE = /^(?:data|aria)-/;
|
||||
const isStringifiableAttr = (name, ns) => {
|
||||
return (ns === 0 ? shared.isKnownHtmlAttr(name) : ns === 1 ? shared.isKnownSvgAttr(name) : ns === 2 ? shared.isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
|
||||
};
|
||||
const isNonStringifiable = /* @__PURE__ */ shared.makeMap(
|
||||
`caption,thead,tr,th,tbody,td,tfoot,colgroup,col`
|
||||
);
|
||||
function analyzeNode(node) {
|
||||
if (node.type === 1 && isNonStringifiable(node.tag)) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === 1 && compilerCore.findDir(node, "once", true)) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === 12) {
|
||||
return [1, 0];
|
||||
}
|
||||
let nc = 1;
|
||||
let ec = node.props.length > 0 ? 1 : 0;
|
||||
let bailed = false;
|
||||
const bail = () => {
|
||||
bailed = true;
|
||||
return false;
|
||||
};
|
||||
function walk(node2) {
|
||||
const isOptionTag = node2.tag === "option" && node2.ns === 0;
|
||||
for (let i = 0; i < node2.props.length; i++) {
|
||||
const p = node2.props[i];
|
||||
if (p.type === 6 && !isStringifiableAttr(p.name, node2.ns)) {
|
||||
return bail();
|
||||
}
|
||||
if (p.type === 7 && p.name === "bind") {
|
||||
if (p.arg && (p.arg.type === 8 || p.arg.isStatic && !isStringifiableAttr(p.arg.content, node2.ns))) {
|
||||
return bail();
|
||||
}
|
||||
if (p.exp && (p.exp.type === 8 || p.exp.constType < 3)) {
|
||||
return bail();
|
||||
}
|
||||
if (isOptionTag && compilerCore.isStaticArgOf(p.arg, "value") && p.exp && !p.exp.isStatic) {
|
||||
return bail();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < node2.children.length; i++) {
|
||||
nc++;
|
||||
const child = node2.children[i];
|
||||
if (child.type === 1) {
|
||||
if (child.props.length > 0) {
|
||||
ec++;
|
||||
}
|
||||
walk(child);
|
||||
if (bailed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return walk(node) ? [nc, ec] : false;
|
||||
}
|
||||
function stringifyNode(node, context) {
|
||||
if (shared.isString(node)) {
|
||||
return node;
|
||||
}
|
||||
if (shared.isSymbol(node)) {
|
||||
return ``;
|
||||
}
|
||||
switch (node.type) {
|
||||
case 1:
|
||||
return stringifyElement(node, context);
|
||||
case 2:
|
||||
return shared.escapeHtml(node.content);
|
||||
case 3:
|
||||
return `<!--${shared.escapeHtml(node.content)}-->`;
|
||||
case 5:
|
||||
return shared.escapeHtml(shared.toDisplayString(evaluateConstant(node.content)));
|
||||
case 8:
|
||||
return shared.escapeHtml(evaluateConstant(node));
|
||||
case 12:
|
||||
return stringifyNode(node.content, context);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function stringifyElement(node, context) {
|
||||
let res = `<${node.tag}`;
|
||||
let innerHTML = "";
|
||||
for (let i = 0; i < node.props.length; i++) {
|
||||
const p = node.props[i];
|
||||
if (p.type === 6) {
|
||||
res += ` ${p.name}`;
|
||||
if (p.value) {
|
||||
res += `="${shared.escapeHtml(p.value.content)}"`;
|
||||
}
|
||||
} else if (p.type === 7) {
|
||||
if (p.name === "bind") {
|
||||
const exp = p.exp;
|
||||
if (exp.content[0] === "_") {
|
||||
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
||||
continue;
|
||||
}
|
||||
if ((shared.isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") {
|
||||
continue;
|
||||
}
|
||||
let evaluated = evaluateConstant(exp);
|
||||
if (evaluated != null) {
|
||||
const arg = p.arg && p.arg.content;
|
||||
if (arg === "hidden" && typeof evaluated === "number" && !shared.includeBooleanAttr(evaluated)) {
|
||||
continue;
|
||||
}
|
||||
if (arg === "class") {
|
||||
evaluated = shared.normalizeClass(evaluated);
|
||||
} else if (arg === "style") {
|
||||
evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
|
||||
}
|
||||
res += ` ${p.arg.content}="${shared.escapeHtml(
|
||||
evaluated
|
||||
)}"`;
|
||||
}
|
||||
} else if (p.name === "html") {
|
||||
innerHTML = evaluateConstant(p.exp);
|
||||
} else if (p.name === "text") {
|
||||
innerHTML = shared.escapeHtml(
|
||||
shared.toDisplayString(evaluateConstant(p.exp))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context.scopeId) {
|
||||
res += ` ${context.scopeId}`;
|
||||
}
|
||||
res += `>`;
|
||||
if (innerHTML) {
|
||||
res += innerHTML;
|
||||
} else {
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
res += stringifyNode(node.children[i], context);
|
||||
}
|
||||
}
|
||||
if (!shared.isVoidTag(node.tag)) {
|
||||
res += `</${node.tag}>`;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function evaluateConstant(exp) {
|
||||
if (exp.type === 4) {
|
||||
return new Function(`return (${exp.content})`)();
|
||||
} else {
|
||||
let res = ``;
|
||||
exp.children.forEach((c) => {
|
||||
if (shared.isString(c) || shared.isSymbol(c)) {
|
||||
return;
|
||||
}
|
||||
if (c.type === 2) {
|
||||
res += c.content;
|
||||
} else if (c.type === 5) {
|
||||
res += shared.toDisplayString(evaluateConstant(c.content));
|
||||
} else {
|
||||
res += evaluateConstant(c);
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...[]
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: compilerCore.noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
// override compiler-core
|
||||
on: transformOn,
|
||||
// override compiler-core
|
||||
show: transformShow
|
||||
};
|
||||
function compile(src, options = {}) {
|
||||
return compilerCore.baseCompile(
|
||||
src,
|
||||
shared.extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...options.nodeTransforms || []
|
||||
],
|
||||
directiveTransforms: shared.extend(
|
||||
{},
|
||||
DOMDirectiveTransforms,
|
||||
options.directiveTransforms || {}
|
||||
),
|
||||
transformHoist: stringifyStatic
|
||||
})
|
||||
);
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return compilerCore.baseParse(template, shared.extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
exports.DOMDirectiveTransforms = DOMDirectiveTransforms;
|
||||
exports.DOMErrorCodes = DOMErrorCodes;
|
||||
exports.DOMErrorMessages = DOMErrorMessages;
|
||||
exports.DOMNodeTransforms = DOMNodeTransforms;
|
||||
exports.TRANSITION = TRANSITION;
|
||||
exports.TRANSITION_GROUP = TRANSITION_GROUP;
|
||||
exports.V_MODEL_CHECKBOX = V_MODEL_CHECKBOX;
|
||||
exports.V_MODEL_DYNAMIC = V_MODEL_DYNAMIC;
|
||||
exports.V_MODEL_RADIO = V_MODEL_RADIO;
|
||||
exports.V_MODEL_SELECT = V_MODEL_SELECT;
|
||||
exports.V_MODEL_TEXT = V_MODEL_TEXT;
|
||||
exports.V_ON_WITH_KEYS = V_ON_WITH_KEYS;
|
||||
exports.V_ON_WITH_MODIFIERS = V_ON_WITH_MODIFIERS;
|
||||
exports.V_SHOW = V_SHOW;
|
||||
exports.compile = compile;
|
||||
exports.createDOMCompilerError = createDOMCompilerError;
|
||||
exports.parse = parse;
|
||||
exports.parserOptions = parserOptions;
|
||||
exports.transformStyle = transformStyle;
|
||||
Object.keys(compilerCore).forEach(function (k) {
|
||||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = compilerCore[k];
|
||||
});
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"name": "@vue/compiler-dom",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/compiler-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
"types": "dist/compiler-dom.d.ts",
|
||||
"unpkg": "dist/compiler-dom.global.js",
|
||||
"jsdelivr": "dist/compiler-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/compiler-dom.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/compiler-dom.cjs.prod.js",
|
||||
"development": "./dist/compiler-dom.cjs.js",
|
||||
"default": "./dist/compiler-dom.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/compiler-dom.esm-bundler.js",
|
||||
"import": "./dist/compiler-dom.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
"compat": true,
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43",
|
||||
"@vue/compiler-core": "3.5.43"
|
||||
}
|
||||
}
|
||||
+1420
File diff suppressed because it is too large
Load Diff
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@vue/compiler-ssr",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/compiler-ssr",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"buildOptions": {
|
||||
"prod": false,
|
||||
"formats": [
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/compiler-ssr"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43",
|
||||
"@vue/compiler-dom": "3.5.43"
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//#region src/index-node.ts
|
||||
function addCustomCommand() {}
|
||||
function addCustomTab() {}
|
||||
function onDevToolsClientConnected(_fn) {
|
||||
return new Promise(() => {});
|
||||
}
|
||||
function onDevToolsConnected(_fn) {
|
||||
return new Promise(() => {});
|
||||
}
|
||||
function removeCustomCommand() {}
|
||||
function setupDevToolsPlugin(_pluginDescriptor, _setupFn) {}
|
||||
//#endregion
|
||||
export { addCustomCommand, addCustomTab, onDevToolsClientConnected, onDevToolsConnected, removeCustomCommand, setupDevToolsPlugin, setupDevToolsPlugin as setupDevtoolsPlugin };
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@vue/devtools-api",
|
||||
"type": "module",
|
||||
"version": "8.2.1",
|
||||
"author": "webfansplz",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"directory": "packages/devtools-api",
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/devtools.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"node": {
|
||||
"import": "./dist/index-node.js",
|
||||
"require": "./dist/index-node.cjs"
|
||||
},
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"unpkg": "dist/vue-devtools-api.global.js",
|
||||
"jsdelivr": "dist/vue-devtools-api.global.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@vue/devtools-kit": "^8.2.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsdown --clean",
|
||||
"prepare:type": "tsdown --dts-only",
|
||||
"stub": "tsdown --watch --onSuccess 'tsdown --dts-only'"
|
||||
}
|
||||
}
|
||||
+1905
File diff suppressed because it is too large
Load Diff
+55
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "@vue/reactivity",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/reactivity",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
"types": "dist/reactivity.d.ts",
|
||||
"unpkg": "dist/reactivity.global.js",
|
||||
"jsdelivr": "dist/reactivity.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/reactivity.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/reactivity.cjs.prod.js",
|
||||
"development": "./dist/reactivity.cjs.js",
|
||||
"default": "./dist/reactivity.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/reactivity.esm-bundler.js",
|
||||
"import": "./dist/reactivity.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/reactivity"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueReactivity",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+7006
File diff suppressed because it is too large
Load Diff
+52
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "@vue/runtime-core",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/runtime-core",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
"types": "dist/runtime-core.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/runtime-core.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/runtime-core.cjs.prod.js",
|
||||
"development": "./dist/runtime-core.cjs.js",
|
||||
"default": "./dist/runtime-core.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/runtime-core.esm-bundler.js",
|
||||
"import": "./dist/runtime-core.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeCore",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/runtime-core"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43",
|
||||
"@vue/reactivity": "3.5.43"
|
||||
}
|
||||
}
|
||||
+1867
File diff suppressed because it is too large
Load Diff
+60
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "@vue/runtime-dom",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/runtime-dom",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
"types": "dist/runtime-dom.d.ts",
|
||||
"unpkg": "dist/runtime-dom.global.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/runtime-dom.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/runtime-dom.cjs.prod.js",
|
||||
"development": "./dist/runtime-dom.cjs.js",
|
||||
"default": "./dist/runtime-dom.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/runtime-dom.esm-bundler.js",
|
||||
"import": "./dist/runtime-dom.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeDOM",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/runtime-dom"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43",
|
||||
"@vue/runtime-core": "3.5.43",
|
||||
"@vue/reactivity": "3.5.43",
|
||||
"csstype": "^3.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+904
@@ -0,0 +1,904 @@
|
||||
/**
|
||||
* @vue/server-renderer v3.5.43
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var Vue = require('@vue/runtime-dom');
|
||||
var shared = require('@vue/shared');
|
||||
var compilerSsr = require('@vue/compiler-ssr');
|
||||
|
||||
function _interopNamespaceDefault(e) {
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
for (var k in e) {
|
||||
n[k] = e[k];
|
||||
}
|
||||
}
|
||||
n.default = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var Vue__namespace = /*#__PURE__*/_interopNamespaceDefault(Vue);
|
||||
|
||||
const shouldIgnoreProp = /* @__PURE__ */ shared.makeMap(
|
||||
`,key,ref,innerHTML,textContent,ref_key,ref_for`
|
||||
);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
let ret = "";
|
||||
for (let key in props) {
|
||||
if (shouldIgnoreProp(key) || shared.isOn(key) || tag === "textarea" && key === "value" || // force as property (not rendered in SSR)
|
||||
key.startsWith(".")) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (key.startsWith("^")) key = key.slice(1);
|
||||
if (key === "class") {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
} else if (key === "style") {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
} else if (key === "className") {
|
||||
if (value != null) {
|
||||
ret += ` class="${shared.escapeHtml(String(value))}"`;
|
||||
}
|
||||
} else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function ssrRenderDynamicAttr(key, value, tag) {
|
||||
if (!shared.isRenderableAttrValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
const attrKey = tag && (tag.indexOf("-") > 0 || shared.isSVGTag(tag)) ? key : shared.propsToAttrMap[key] || key.toLowerCase();
|
||||
if (shared.isBooleanAttr(attrKey) || attrKey === "hidden" && (typeof value === "boolean" || typeof value === "number")) {
|
||||
return shared.includeBooleanAttr(value) ? ` ${attrKey}` : ``;
|
||||
} else if (shared.isSSRSafeAttrName(attrKey)) {
|
||||
return value === "" ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
|
||||
} else {
|
||||
console.warn(
|
||||
`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`
|
||||
);
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
function ssrRenderAttr(key, value) {
|
||||
if (!shared.isRenderableAttrValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
return ` ${key}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
function ssrRenderClass(raw) {
|
||||
return shared.escapeHtml(shared.normalizeClass(raw));
|
||||
}
|
||||
function ssrRenderStyle(raw) {
|
||||
if (!raw) {
|
||||
return "";
|
||||
}
|
||||
if (shared.isString(raw)) {
|
||||
return shared.escapeHtml(raw);
|
||||
}
|
||||
const styles = shared.normalizeStyle(ssrResetCssVars(raw));
|
||||
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||
}
|
||||
function ssrResetCssVars(raw) {
|
||||
if (!shared.isArray(raw) && shared.isObject(raw)) {
|
||||
const res = {};
|
||||
for (const key in raw) {
|
||||
if (key.startsWith(":--")) {
|
||||
res[key.slice(1)] = shared.normalizeCssVarValue(raw[key]);
|
||||
} else {
|
||||
res[key] = raw[key];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
||||
return renderComponentVNode(
|
||||
Vue.createVNode(comp, props, children),
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
}
|
||||
|
||||
const { ensureValidVNode } = Vue.ssrUtils;
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
||||
push(`<!--[-->`);
|
||||
ssrRenderSlotInner(
|
||||
slots,
|
||||
slotName,
|
||||
slotProps,
|
||||
fallbackRenderFn,
|
||||
push,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
push(`<!--]-->`);
|
||||
}
|
||||
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
|
||||
const slotFn = slots[slotName];
|
||||
if (slotFn) {
|
||||
const slotBuffer = [];
|
||||
const bufferedPush = (item) => {
|
||||
slotBuffer.push(item);
|
||||
};
|
||||
const ret = slotFn(
|
||||
// keep the slot function's contract in sync with `renderSlot`, which also
|
||||
// normalizes nullish props before invoking the slot
|
||||
slotProps || {},
|
||||
bufferedPush,
|
||||
parentComponent,
|
||||
slotScopeId ? " " + slotScopeId : ""
|
||||
);
|
||||
if (shared.isArray(ret)) {
|
||||
const validSlotContent = ensureValidVNode(ret);
|
||||
if (validSlotContent) {
|
||||
renderVNodeChildren(
|
||||
push,
|
||||
validSlotContent,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
} else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
} else {
|
||||
let isEmptySlot = true;
|
||||
if (transition) {
|
||||
isEmptySlot = false;
|
||||
} else {
|
||||
for (let i = 0; i < slotBuffer.length; i++) {
|
||||
if (!isComment(slotBuffer[i])) {
|
||||
isEmptySlot = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isEmptySlot) {
|
||||
if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
} else {
|
||||
let start = 0;
|
||||
let end = slotBuffer.length;
|
||||
if (transition && slotBuffer[0] === "<!--[-->" && slotBuffer[end - 1] === "<!--]-->") {
|
||||
start++;
|
||||
end--;
|
||||
}
|
||||
if (start < end) {
|
||||
for (let i = start; i < end; i++) {
|
||||
push(slotBuffer[i]);
|
||||
}
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
} else if (transition) {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
const commentTestRE = /^<!--[\s\S]*-->$/;
|
||||
const commentRE = /<!--[^]*?-->/gm;
|
||||
function isComment(item) {
|
||||
if (typeof item !== "string" || !commentTestRE.test(item)) return false;
|
||||
if (item.length <= 8) return true;
|
||||
return !item.replace(commentRE, "").trim();
|
||||
}
|
||||
|
||||
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||
parentPush("<!--teleport start-->");
|
||||
const context = parentComponent.appContext.provides[Vue.ssrContextKey];
|
||||
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||
const targetBuffer = teleportBuffers[target] || (teleportBuffers[target] = []);
|
||||
const bufferIndex = targetBuffer.length;
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
|
||||
} else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
push(`<!--teleport start anchor-->`);
|
||||
contentRenderFn(push);
|
||||
push(`<!--teleport anchor-->`);
|
||||
teleportContent = getBuffer();
|
||||
}
|
||||
targetBuffer.splice(bufferIndex, 0, teleportContent);
|
||||
if (shared.isPromise(teleportContent) || shared.isArray(teleportContent) && teleportContent.hasAsync) {
|
||||
targetBuffer.hasAsync = true;
|
||||
}
|
||||
parentPush("<!--teleport end-->");
|
||||
}
|
||||
|
||||
function ssrInterpolate(value) {
|
||||
return shared.escapeHtml(shared.toDisplayString(value));
|
||||
}
|
||||
|
||||
function ssrRenderList(source, renderItem) {
|
||||
if (shared.isArray(source) || shared.isString(source)) {
|
||||
for (let i = 0, l = source.length; i < l; i++) {
|
||||
renderItem(source[i], i);
|
||||
}
|
||||
} else if (typeof source === "number") {
|
||||
for (let i = 0; i < source; i++) {
|
||||
renderItem(i + 1, i);
|
||||
}
|
||||
} else if (shared.isObject(source)) {
|
||||
if (source[Symbol.iterator]) {
|
||||
let i = 0;
|
||||
for (const item of source) {
|
||||
renderItem(item, i++);
|
||||
}
|
||||
} else {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
const key = keys[i];
|
||||
renderItem(source[key], key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ssrRenderSuspense(push, { default: renderContent }) {
|
||||
if (renderContent) {
|
||||
renderContent();
|
||||
} else {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
||||
if (typeof dir !== "function" && dir.getSSRProps) {
|
||||
return dir.getSSRProps(
|
||||
{
|
||||
dir,
|
||||
instance: Vue.ssrUtils.getComponentPublicInstance(instance.$),
|
||||
value,
|
||||
oldValue: void 0,
|
||||
arg,
|
||||
modifiers
|
||||
},
|
||||
null
|
||||
) || {};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
const ssrLooseEqual = shared.looseEqual;
|
||||
function ssrLooseContain(arr, value) {
|
||||
return shared.looseIndexOf(arr, value) > -1;
|
||||
}
|
||||
function ssrRenderDynamicModel(type, model, value) {
|
||||
switch (type) {
|
||||
case "radio":
|
||||
return shared.looseEqual(model, value) ? " checked" : "";
|
||||
case "checkbox":
|
||||
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? " checked" : "";
|
||||
default:
|
||||
return ssrRenderAttr("value", model);
|
||||
}
|
||||
}
|
||||
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||
const { type, value } = existingProps;
|
||||
switch (type) {
|
||||
case "radio":
|
||||
return shared.looseEqual(model, value) ? { checked: true } : null;
|
||||
case "checkbox":
|
||||
return (shared.isArray(model) ? ssrLooseContain(model, value) : model) ? { checked: true } : null;
|
||||
default:
|
||||
return { value: model };
|
||||
}
|
||||
}
|
||||
|
||||
var helpers = /*#__PURE__*/Object.freeze({
|
||||
__proto__: null,
|
||||
ssrGetDirectiveProps: ssrGetDirectiveProps,
|
||||
ssrGetDynamicModelProps: ssrGetDynamicModelProps,
|
||||
ssrIncludeBooleanAttr: shared.includeBooleanAttr,
|
||||
ssrInterpolate: ssrInterpolate,
|
||||
ssrLooseContain: ssrLooseContain,
|
||||
ssrLooseEqual: ssrLooseEqual,
|
||||
ssrRenderAttr: ssrRenderAttr,
|
||||
ssrRenderAttrs: ssrRenderAttrs,
|
||||
ssrRenderClass: ssrRenderClass,
|
||||
ssrRenderComponent: ssrRenderComponent,
|
||||
ssrRenderDynamicAttr: ssrRenderDynamicAttr,
|
||||
ssrRenderDynamicModel: ssrRenderDynamicModel,
|
||||
ssrRenderList: ssrRenderList,
|
||||
ssrRenderSlot: ssrRenderSlot,
|
||||
ssrRenderSlotInner: ssrRenderSlotInner,
|
||||
ssrRenderStyle: ssrRenderStyle,
|
||||
ssrRenderSuspense: ssrRenderSuspense,
|
||||
ssrRenderTeleport: ssrRenderTeleport,
|
||||
ssrRenderVNode: renderVNode
|
||||
});
|
||||
|
||||
const compileCache = /* @__PURE__ */ Object.create(null);
|
||||
function ssrCompile(template, instance) {
|
||||
const Component = instance.type;
|
||||
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
||||
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
||||
const finalCompilerOptions = shared.extend(
|
||||
shared.extend(
|
||||
{
|
||||
isCustomElement,
|
||||
delimiters
|
||||
},
|
||||
compilerOptions
|
||||
),
|
||||
componentCompilerOptions
|
||||
);
|
||||
finalCompilerOptions.isCustomElement = finalCompilerOptions.isCustomElement || shared.NO;
|
||||
finalCompilerOptions.isNativeTag = finalCompilerOptions.isNativeTag || shared.NO;
|
||||
const cacheKey = JSON.stringify(
|
||||
{
|
||||
template,
|
||||
compilerOptions: finalCompilerOptions
|
||||
},
|
||||
(key, value) => {
|
||||
return shared.isFunction(value) ? value.toString() : value;
|
||||
}
|
||||
);
|
||||
const cached = compileCache[cacheKey];
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
finalCompilerOptions.onError = (err) => {
|
||||
{
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
const { code } = compilerSsr.compile(template, finalCompilerOptions);
|
||||
const requireMap = {
|
||||
vue: Vue__namespace,
|
||||
"vue/server-renderer": helpers
|
||||
};
|
||||
const fakeRequire = (id) => requireMap[id];
|
||||
return compileCache[cacheKey] = Function("require", code)(fakeRequire);
|
||||
}
|
||||
|
||||
const {
|
||||
createComponentInstance,
|
||||
setCurrentRenderingInstance,
|
||||
setupComponent,
|
||||
renderComponentRoot,
|
||||
normalizeVNode,
|
||||
pushWarningContext,
|
||||
popWarningContext
|
||||
} = Vue.ssrUtils;
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
const buffer = [];
|
||||
return {
|
||||
getBuffer() {
|
||||
return buffer;
|
||||
},
|
||||
push(item) {
|
||||
const isStringItem = shared.isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
return;
|
||||
}
|
||||
buffer.push(item);
|
||||
appendable = isStringItem;
|
||||
if (shared.isPromise(item) || shared.isArray(item) && item.hasAsync) {
|
||||
buffer.hasAsync = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
||||
const instance = vnode.component = createComponentInstance(
|
||||
vnode,
|
||||
parentComponent,
|
||||
null
|
||||
);
|
||||
const res = setupComponent(
|
||||
instance,
|
||||
true
|
||||
/* isSSR */
|
||||
);
|
||||
const hasAsyncSetup = shared.isPromise(res);
|
||||
let prefetches = instance.sp;
|
||||
if (hasAsyncSetup || prefetches) {
|
||||
const p = Promise.resolve(res).then(() => {
|
||||
if (hasAsyncSetup) prefetches = instance.sp;
|
||||
if (prefetches) {
|
||||
return Promise.all(
|
||||
prefetches.map((prefetch) => prefetch.call(instance.proxy))
|
||||
);
|
||||
}
|
||||
}).catch(shared.NOOP);
|
||||
return p.then(() => renderComponentSubTree(instance, slotScopeId));
|
||||
} else {
|
||||
try {
|
||||
return renderComponentSubTree(instance, slotScopeId);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance, slotScopeId) {
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (shared.isFunction(comp)) {
|
||||
let root = renderComponentRoot(instance);
|
||||
if (!comp.props) {
|
||||
for (const key in instance.attrs) {
|
||||
if (key.startsWith(`data-v-`)) {
|
||||
(root.props || (root.props = {}))[key] = ``;
|
||||
}
|
||||
}
|
||||
}
|
||||
renderVNode(push, instance.subTree = root, instance, slotScopeId);
|
||||
} else {
|
||||
if ((!instance.render || instance.render === shared.NOOP) && !instance.ssrRender && !comp.ssrRender && shared.isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template, instance);
|
||||
}
|
||||
const ssrRender = instance.ssrRender || comp.ssrRender;
|
||||
if (ssrRender) {
|
||||
let attrs = instance.inheritAttrs !== false ? instance.attrs : void 0;
|
||||
let hasCloned = false;
|
||||
let cur = instance;
|
||||
while (true) {
|
||||
const scopeId = cur.vnode.scopeId;
|
||||
if (scopeId) {
|
||||
if (!hasCloned) {
|
||||
attrs = { ...attrs };
|
||||
hasCloned = true;
|
||||
}
|
||||
attrs[scopeId] = "";
|
||||
}
|
||||
const parent = cur.parent;
|
||||
if (parent && parent.subTree && parent.subTree === cur.vnode) {
|
||||
cur = parent;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (slotScopeId) {
|
||||
if (!hasCloned) attrs = { ...attrs };
|
||||
const slotScopeIdList = slotScopeId.trim().split(" ");
|
||||
for (let i = 0; i < slotScopeIdList.length; i++) {
|
||||
attrs[slotScopeIdList[i]] = "";
|
||||
}
|
||||
}
|
||||
const prev = setCurrentRenderingInstance(instance);
|
||||
try {
|
||||
ssrRender(
|
||||
instance.proxy,
|
||||
push,
|
||||
instance,
|
||||
attrs,
|
||||
// compiler-optimized bindings
|
||||
instance.props,
|
||||
instance.setupState,
|
||||
instance.data,
|
||||
instance.ctx
|
||||
);
|
||||
} catch (err) {
|
||||
Vue.handleError(err, instance, 1);
|
||||
} finally {
|
||||
setCurrentRenderingInstance(prev);
|
||||
}
|
||||
} else if (instance.render && instance.render !== shared.NOOP) {
|
||||
renderVNode(
|
||||
push,
|
||||
instance.subTree = renderComponentRoot(instance),
|
||||
instance,
|
||||
slotScopeId
|
||||
);
|
||||
} else {
|
||||
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
||||
Vue.warn(`Component ${componentName} is missing template or render function.`);
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const { type, shapeFlag, children, dirs, props } = vnode;
|
||||
if (dirs) {
|
||||
vnode.props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
switch (type) {
|
||||
case Vue.Text:
|
||||
push(shared.escapeHtml(children));
|
||||
break;
|
||||
case Vue.Comment:
|
||||
push(
|
||||
children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`
|
||||
);
|
||||
break;
|
||||
case Vue.Static:
|
||||
push(children);
|
||||
break;
|
||||
case Vue.Fragment:
|
||||
if (vnode.slotScopeIds) {
|
||||
slotScopeId = (slotScopeId ? slotScopeId + " " : "") + vnode.slotScopeIds.join(" ");
|
||||
}
|
||||
push(`<!--[-->`);
|
||||
renderVNodeChildren(
|
||||
push,
|
||||
children,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
push(`<!--]-->`);
|
||||
break;
|
||||
default:
|
||||
if (shapeFlag & 1) {
|
||||
renderElementVNode(push, vnode, parentComponent, slotScopeId);
|
||||
} else if (shapeFlag & 6) {
|
||||
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
|
||||
} else if (shapeFlag & 64) {
|
||||
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
|
||||
} else if (shapeFlag & 128) {
|
||||
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
||||
} else {
|
||||
Vue.warn(
|
||||
"[@vue/server-renderer] Invalid VNode type:",
|
||||
type,
|
||||
`(${typeof type})`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
|
||||
}
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
const renderedScopeIds = [];
|
||||
const appendScopeId = (id) => {
|
||||
if (id && (!props || !shared.hasOwn(props, id)) && !renderedScopeIds.includes(id)) {
|
||||
openTag += ` ${id}`;
|
||||
renderedScopeIds.push(id);
|
||||
}
|
||||
};
|
||||
if (scopeId) {
|
||||
appendScopeId(scopeId);
|
||||
}
|
||||
let curParent = parentComponent;
|
||||
let curVnode = vnode;
|
||||
while (curParent && curVnode === curParent.subTree) {
|
||||
curVnode = curParent.vnode;
|
||||
if (curVnode.scopeId) {
|
||||
appendScopeId(curVnode.scopeId);
|
||||
}
|
||||
curParent = curParent.parent;
|
||||
}
|
||||
if (slotScopeId) {
|
||||
const slotScopeIdList = slotScopeId.trim().split(" ");
|
||||
for (let i = 0; i < slotScopeIdList.length; i++) {
|
||||
appendScopeId(slotScopeIdList[i]);
|
||||
}
|
||||
}
|
||||
push(openTag + `>`);
|
||||
if (!shared.isVoidTag(tag)) {
|
||||
let hasChildrenOverride = false;
|
||||
if (props) {
|
||||
if (props.innerHTML) {
|
||||
hasChildrenOverride = true;
|
||||
push(props.innerHTML);
|
||||
} else if (props.textContent) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.textContent));
|
||||
} else if (tag === "textarea" && props.value) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.value));
|
||||
}
|
||||
}
|
||||
if (!hasChildrenOverride) {
|
||||
if (shapeFlag & 8) {
|
||||
push(shared.escapeHtml(children));
|
||||
} else if (shapeFlag & 16) {
|
||||
renderVNodeChildren(
|
||||
push,
|
||||
children,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
}
|
||||
}
|
||||
push(`</${tag}>`);
|
||||
}
|
||||
}
|
||||
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
const toMerge = [];
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const binding = dirs[i];
|
||||
const {
|
||||
dir: { getSSRProps }
|
||||
} = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props) toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return Vue.mergeProps(rawProps || {}, ...toMerge);
|
||||
}
|
||||
function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
||||
const target = vnode.props && vnode.props.to;
|
||||
const disabled = vnode.props && vnode.props.disabled;
|
||||
if (!target) {
|
||||
if (!disabled) {
|
||||
Vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
if (!shared.isString(target)) {
|
||||
Vue.warn(
|
||||
`[@vue/server-renderer] Teleport target must be a query selector string.`
|
||||
);
|
||||
return [];
|
||||
}
|
||||
ssrRenderTeleport(
|
||||
push,
|
||||
(push2) => {
|
||||
renderVNodeChildren(
|
||||
push2,
|
||||
vnode.children,
|
||||
parentComponent,
|
||||
slotScopeId
|
||||
);
|
||||
},
|
||||
target,
|
||||
disabled || disabled === "",
|
||||
parentComponent
|
||||
);
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = Vue.ssrUtils;
|
||||
function nestedUnrollBuffer(buffer, parentRet, startIndex) {
|
||||
if (!buffer.hasAsync) {
|
||||
return parentRet + unrollBufferSync$1(buffer);
|
||||
}
|
||||
let ret = parentRet;
|
||||
for (let i = startIndex; i < buffer.length; i += 1) {
|
||||
const item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
continue;
|
||||
}
|
||||
if (shared.isPromise(item)) {
|
||||
return item.then((nestedItem) => {
|
||||
buffer[i] = nestedItem;
|
||||
return nestedUnrollBuffer(buffer, ret, i);
|
||||
});
|
||||
}
|
||||
const result = nestedUnrollBuffer(item, ret, 0);
|
||||
if (shared.isPromise(result)) {
|
||||
return result.then((nestedItem) => {
|
||||
buffer[i] = nestedItem;
|
||||
return nestedUnrollBuffer(buffer, "", i);
|
||||
});
|
||||
}
|
||||
ret = result;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function unrollBuffer$1(buffer) {
|
||||
return nestedUnrollBuffer(buffer, "", 0);
|
||||
}
|
||||
function unrollBufferSync$1(buffer) {
|
||||
let ret = "";
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
} else {
|
||||
ret += unrollBufferSync$1(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
async function renderToString(input, context = {}) {
|
||||
if (isVNode$1(input)) {
|
||||
return renderToString(Vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
const vnode = Vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
input.provide(Vue.ssrContextKey, context);
|
||||
const buffer = await renderComponentVNode(vnode);
|
||||
const result = await unrollBuffer$1(buffer);
|
||||
await resolveTeleports(context);
|
||||
if (context.__watcherHandles) {
|
||||
for (const unwatch of context.__watcherHandles) {
|
||||
unwatch();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function resolveTeleports(context) {
|
||||
if (context.__teleportBuffers) {
|
||||
context.teleports = context.teleports || {};
|
||||
for (const key in context.__teleportBuffers) {
|
||||
context.teleports[key] = await unrollBuffer$1(
|
||||
context.__teleportBuffers[key]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { isVNode } = Vue.ssrUtils;
|
||||
async function unrollBuffer(buffer, stream) {
|
||||
if (buffer.hasAsync) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
} else {
|
||||
await unrollBuffer(item, stream);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unrollBufferSync(buffer, stream);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync(buffer, stream) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
} else {
|
||||
unrollBufferSync(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderToSimpleStream(input, context, stream) {
|
||||
if (isVNode(input)) {
|
||||
return renderToSimpleStream(
|
||||
Vue.createApp({ render: () => input }),
|
||||
context,
|
||||
stream
|
||||
);
|
||||
}
|
||||
const vnode = Vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
input.provide(Vue.ssrContextKey, context);
|
||||
Promise.resolve(renderComponentVNode(vnode)).then((buffer) => unrollBuffer(buffer, stream)).then(() => resolveTeleports(context)).then(() => {
|
||||
if (context.__watcherHandles) {
|
||||
for (const unwatch of context.__watcherHandles) {
|
||||
unwatch();
|
||||
}
|
||||
}
|
||||
}).then(() => stream.push(null)).catch((error) => {
|
||||
stream.destroy(error);
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
function renderToStream(input, context = {}) {
|
||||
console.warn(
|
||||
`[@vue/server-renderer] renderToStream is deprecated - use renderToNodeStream instead.`
|
||||
);
|
||||
return renderToNodeStream(input, context);
|
||||
}
|
||||
function renderToNodeStream(input, context = {}) {
|
||||
const stream = new (require("node:stream")).Readable({ read() {
|
||||
} }) ;
|
||||
if (!stream) {
|
||||
throw new Error(
|
||||
`ESM build of renderToStream() does not support renderToNodeStream(). Use pipeToNodeWritable() with an existing Node.js Writable stream instance instead.`
|
||||
);
|
||||
}
|
||||
return renderToSimpleStream(input, context, stream);
|
||||
}
|
||||
function pipeToNodeWritable(input, context = {}, writable) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (content != null) {
|
||||
writable.write(content);
|
||||
} else {
|
||||
writable.end();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
writable.destroy(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
function renderToWebStream(input, context = {}) {
|
||||
if (typeof ReadableStream !== "function") {
|
||||
throw new Error(
|
||||
`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.`
|
||||
);
|
||||
}
|
||||
const encoder = new TextEncoder();
|
||||
let cancelled = false;
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
renderToSimpleStream(input, context, {
|
||||
push(content) {
|
||||
if (cancelled) return;
|
||||
if (content != null) {
|
||||
controller.enqueue(encoder.encode(content));
|
||||
} else {
|
||||
controller.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
controller.error(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
cancelled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
function pipeToWebWritable(input, context = {}, writable) {
|
||||
const writer = writable.getWriter();
|
||||
const encoder = new TextEncoder();
|
||||
let hasReady = false;
|
||||
try {
|
||||
hasReady = shared.isPromise(writer.ready);
|
||||
} catch (e) {
|
||||
}
|
||||
renderToSimpleStream(input, context, {
|
||||
async push(content) {
|
||||
if (hasReady) {
|
||||
await writer.ready;
|
||||
}
|
||||
if (content != null) {
|
||||
return writer.write(encoder.encode(content));
|
||||
} else {
|
||||
return writer.close();
|
||||
}
|
||||
},
|
||||
destroy(err) {
|
||||
console.log(err);
|
||||
writer.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vue.initDirectivesForSSR();
|
||||
|
||||
exports.ssrIncludeBooleanAttr = shared.includeBooleanAttr;
|
||||
exports.pipeToNodeWritable = pipeToNodeWritable;
|
||||
exports.pipeToWebWritable = pipeToWebWritable;
|
||||
exports.renderToNodeStream = renderToNodeStream;
|
||||
exports.renderToSimpleStream = renderToSimpleStream;
|
||||
exports.renderToStream = renderToStream;
|
||||
exports.renderToString = renderToString;
|
||||
exports.renderToWebStream = renderToWebStream;
|
||||
exports.ssrGetDirectiveProps = ssrGetDirectiveProps;
|
||||
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
||||
exports.ssrInterpolate = ssrInterpolate;
|
||||
exports.ssrLooseContain = ssrLooseContain;
|
||||
exports.ssrLooseEqual = ssrLooseEqual;
|
||||
exports.ssrRenderAttr = ssrRenderAttr;
|
||||
exports.ssrRenderAttrs = ssrRenderAttrs;
|
||||
exports.ssrRenderClass = ssrRenderClass;
|
||||
exports.ssrRenderComponent = ssrRenderComponent;
|
||||
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
||||
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
||||
exports.ssrRenderList = ssrRenderList;
|
||||
exports.ssrRenderSlot = ssrRenderSlot;
|
||||
exports.ssrRenderSlotInner = ssrRenderSlotInner;
|
||||
exports.ssrRenderStyle = ssrRenderStyle;
|
||||
exports.ssrRenderSuspense = ssrRenderSuspense;
|
||||
exports.ssrRenderTeleport = ssrRenderTeleport;
|
||||
exports.ssrRenderVNode = renderVNode;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "@vue/server-renderer",
|
||||
"version": "3.5.43",
|
||||
"description": "@vue/server-renderer",
|
||||
"main": "index.js",
|
||||
"module": "dist/server-renderer.esm-bundler.js",
|
||||
"types": "dist/server-renderer.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/server-renderer.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/server-renderer.cjs.prod.js",
|
||||
"development": "./dist/server-renderer.cjs.js",
|
||||
"default": "./dist/server-renderer.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/server-renderer.esm-bundler.js",
|
||||
"import": "./dist/server-renderer.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueServerRenderer",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/server-renderer"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.43",
|
||||
"@vue/compiler-ssr": "3.5.43",
|
||||
"@vue/runtime-dom": "3.5.43"
|
||||
}
|
||||
}
|
||||
+655
@@ -0,0 +1,655 @@
|
||||
/**
|
||||
* @vue/shared v3.5.43
|
||||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||||
* @license MIT
|
||||
**/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function makeMap(str) {
|
||||
const map = /* @__PURE__ */ Object.create(null);
|
||||
for (const key of str.split(",")) map[key] = 1;
|
||||
return (val) => val in map;
|
||||
}
|
||||
|
||||
const EMPTY_OBJ = {};
|
||||
const EMPTY_ARR = [];
|
||||
const NOOP = () => {
|
||||
};
|
||||
const NO = () => false;
|
||||
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
||||
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
||||
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
const isObject = (val) => val !== null && typeof val === "object";
|
||||
const isPromise = (val) => {
|
||||
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||
);
|
||||
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||
);
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = /* @__PURE__ */ Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-\w/g;
|
||||
const camelize = cacheStringFunction(
|
||||
(str) => {
|
||||
return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
|
||||
}
|
||||
);
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
const hyphenate = cacheStringFunction(
|
||||
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||
);
|
||||
const capitalize = cacheStringFunction((str) => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
});
|
||||
const toHandlerKey = cacheStringFunction(
|
||||
(str) => {
|
||||
const s = str ? `on${capitalize(str)}` : ``;
|
||||
return s;
|
||||
}
|
||||
);
|
||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||
const invokeArrayFns = (fns, ...arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](...arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value, writable = false) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable,
|
||||
value
|
||||
});
|
||||
};
|
||||
const looseToNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = isString(val) ? Number(val) : NaN;
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||
};
|
||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||
function genPropsAccessExp(name) {
|
||||
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||
}
|
||||
function genCacheKey(source, options) {
|
||||
return source + JSON.stringify(
|
||||
options,
|
||||
(_, val) => typeof val === "function" ? val.toString() : val
|
||||
);
|
||||
}
|
||||
|
||||
const PatchFlags = {
|
||||
"TEXT": 1,
|
||||
"1": "TEXT",
|
||||
"CLASS": 2,
|
||||
"2": "CLASS",
|
||||
"STYLE": 4,
|
||||
"4": "STYLE",
|
||||
"PROPS": 8,
|
||||
"8": "PROPS",
|
||||
"FULL_PROPS": 16,
|
||||
"16": "FULL_PROPS",
|
||||
"NEED_HYDRATION": 32,
|
||||
"32": "NEED_HYDRATION",
|
||||
"STABLE_FRAGMENT": 64,
|
||||
"64": "STABLE_FRAGMENT",
|
||||
"KEYED_FRAGMENT": 128,
|
||||
"128": "KEYED_FRAGMENT",
|
||||
"UNKEYED_FRAGMENT": 256,
|
||||
"256": "UNKEYED_FRAGMENT",
|
||||
"NEED_PATCH": 512,
|
||||
"512": "NEED_PATCH",
|
||||
"DYNAMIC_SLOTS": 1024,
|
||||
"1024": "DYNAMIC_SLOTS",
|
||||
"DEV_ROOT_FRAGMENT": 2048,
|
||||
"2048": "DEV_ROOT_FRAGMENT",
|
||||
"CACHED": -1,
|
||||
"-1": "CACHED",
|
||||
"BAIL": -2,
|
||||
"-2": "BAIL"
|
||||
};
|
||||
const PatchFlagNames = {
|
||||
[1]: `TEXT`,
|
||||
[2]: `CLASS`,
|
||||
[4]: `STYLE`,
|
||||
[8]: `PROPS`,
|
||||
[16]: `FULL_PROPS`,
|
||||
[32]: `NEED_HYDRATION`,
|
||||
[64]: `STABLE_FRAGMENT`,
|
||||
[128]: `KEYED_FRAGMENT`,
|
||||
[256]: `UNKEYED_FRAGMENT`,
|
||||
[512]: `NEED_PATCH`,
|
||||
[1024]: `DYNAMIC_SLOTS`,
|
||||
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||
[-1]: `CACHED`,
|
||||
[-2]: `BAIL`
|
||||
};
|
||||
|
||||
const ShapeFlags = {
|
||||
"ELEMENT": 1,
|
||||
"1": "ELEMENT",
|
||||
"FUNCTIONAL_COMPONENT": 2,
|
||||
"2": "FUNCTIONAL_COMPONENT",
|
||||
"STATEFUL_COMPONENT": 4,
|
||||
"4": "STATEFUL_COMPONENT",
|
||||
"TEXT_CHILDREN": 8,
|
||||
"8": "TEXT_CHILDREN",
|
||||
"ARRAY_CHILDREN": 16,
|
||||
"16": "ARRAY_CHILDREN",
|
||||
"SLOTS_CHILDREN": 32,
|
||||
"32": "SLOTS_CHILDREN",
|
||||
"TELEPORT": 64,
|
||||
"64": "TELEPORT",
|
||||
"SUSPENSE": 128,
|
||||
"128": "SUSPENSE",
|
||||
"COMPONENT_SHOULD_KEEP_ALIVE": 256,
|
||||
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
||||
"COMPONENT_KEPT_ALIVE": 512,
|
||||
"512": "COMPONENT_KEPT_ALIVE",
|
||||
"COMPONENT": 6,
|
||||
"6": "COMPONENT"
|
||||
};
|
||||
|
||||
const SlotFlags = {
|
||||
"STABLE": 1,
|
||||
"1": "STABLE",
|
||||
"DYNAMIC": 2,
|
||||
"2": "DYNAMIC",
|
||||
"FORWARDED": 3,
|
||||
"3": "FORWARDED"
|
||||
};
|
||||
const slotFlagsText = {
|
||||
[1]: "STABLE",
|
||||
[2]: "DYNAMIC",
|
||||
[3]: "FORWARDED"
|
||||
};
|
||||
|
||||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
|
||||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
||||
const isGloballyWhitelisted = isGloballyAllowed;
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
start = Math.max(0, Math.min(start, source.length));
|
||||
end = Math.max(0, Math.min(end, source.length));
|
||||
if (start > end) return "";
|
||||
let lines = source.split(/(\r?\n)/);
|
||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length) continue;
|
||||
const line = j + 1;
|
||||
res.push(
|
||||
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||
);
|
||||
const lineLength = lines[j].length;
|
||||
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||
if (j === i) {
|
||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||
const length = Math.max(
|
||||
1,
|
||||
end > count ? lineLength - pad : end - start
|
||||
);
|
||||
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||
} else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + "^".repeat(length));
|
||||
}
|
||||
count += lineLength + newLineSeqLength;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join("\n");
|
||||
}
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
} else if (isString(value) || isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:([^]+)/;
|
||||
const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
if (!styles) return "";
|
||||
if (isString(styles)) return styles;
|
||||
let ret = "";
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
if (isString(value) || typeof value === "number") {
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = "";
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
} else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeClass(value[i]);
|
||||
if (normalized) {
|
||||
res += normalized + " ";
|
||||
}
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
function normalizeProps(props) {
|
||||
if (!props) return null;
|
||||
let { class: klass, style } = props;
|
||||
if (klass && !isString(klass)) {
|
||||
props.class = normalizeClass(klass);
|
||||
}
|
||||
if (style) {
|
||||
props.style = normalizeStyle(style);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
|
||||
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
||||
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
||||
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||
);
|
||||
function includeBooleanAttr(value) {
|
||||
return !!value || value === "";
|
||||
}
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return attrValidationCache[name] = !isUnsafe;
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: "accept-charset",
|
||||
className: "class",
|
||||
htmlFor: "for",
|
||||
httpEquiv: "http-equiv"
|
||||
};
|
||||
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||
);
|
||||
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||
);
|
||||
const isKnownMathMLAttr = /* @__PURE__ */ makeMap(
|
||||
`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`
|
||||
);
|
||||
function isRenderableAttrValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === "string" || type === "number" || type === "boolean";
|
||||
}
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = "" + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = "";
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34:
|
||||
escaped = """;
|
||||
break;
|
||||
case 38:
|
||||
escaped = "&";
|
||||
break;
|
||||
case 39:
|
||||
escaped = "'";
|
||||
break;
|
||||
case 60:
|
||||
escaped = "<";
|
||||
break;
|
||||
case 62:
|
||||
escaped = ">";
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.slice(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||
}
|
||||
const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
let prev;
|
||||
do {
|
||||
prev = src;
|
||||
src = src.replace(commentStripRE, "");
|
||||
} while (src !== prev);
|
||||
return src;
|
||||
}
|
||||
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
||||
function getEscapedCssVarName(key, doubleEscape) {
|
||||
return key.replace(
|
||||
cssVarNameEscapeSymbolsRE,
|
||||
(s) => doubleEscape ? s === '"' ? '\\\\\\"' : `\\\\${s}` : `\\${s}`
|
||||
);
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b, seen) {
|
||||
if (a.length !== b.length) return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i], seen);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseCompareCollections(a, b, seen) {
|
||||
if (a.size !== b.size) return false;
|
||||
const candidates = Array.from(b);
|
||||
const matched = new Uint8Array(candidates.length);
|
||||
for (const item of a) {
|
||||
let index = -1;
|
||||
for (let i = 0; i < candidates.length; i++) {
|
||||
if (!matched[i] && looseEqual(item, candidates[i], seen)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < 0) return false;
|
||||
matched[index] = 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function looseCompareObjects(a, b, seen) {
|
||||
let aValidType = isMap(a);
|
||||
let bValidType = isMap(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
||||
}
|
||||
aValidType = isSet(a);
|
||||
bValidType = isSet(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseCompareNested(a, b, seen, compare) {
|
||||
if (!seen) {
|
||||
seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
|
||||
}
|
||||
const [seenA, seenB] = seen;
|
||||
if (seenA.has(a) || seenB.has(b)) {
|
||||
return seenA.get(a) === b && seenB.get(b) === a;
|
||||
}
|
||||
seenA.set(a, b);
|
||||
seenB.set(b, a);
|
||||
const equal = compare(a, b, seen);
|
||||
seenA.delete(a);
|
||||
seenB.delete(b);
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b, seen) {
|
||||
if (a === b) return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isSymbol(a);
|
||||
bValidType = isSymbol(b);
|
||||
if (aValidType || bValidType) {
|
||||
return a === b;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
return looseCompareNested(a, b, seen, looseCompareObjects);
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex((item) => looseEqual(item, val));
|
||||
}
|
||||
|
||||
const isRef = (val) => {
|
||||
return !!(val && val["__v_isRef"] === true);
|
||||
};
|
||||
const toDisplayString = (val) => {
|
||||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (isRef(val)) {
|
||||
return replacer(_key, val.value);
|
||||
} else if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce(
|
||||
(entries, [key, val2], i) => {
|
||||
entries[stringifySymbol(key, i) + " =>"] = val2;
|
||||
return entries;
|
||||
},
|
||||
{}
|
||||
)
|
||||
};
|
||||
} else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
||||
};
|
||||
} else if (isSymbol(val)) {
|
||||
return stringifySymbol(val);
|
||||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
const stringifySymbol = (v, i = "") => {
|
||||
var _a;
|
||||
return (
|
||||
// Symbol.description in es2019+ so we need to cast here to pass
|
||||
// the lib: es2016 check
|
||||
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
|
||||
);
|
||||
};
|
||||
|
||||
function normalizeCssVarValue(value) {
|
||||
if (value == null) {
|
||||
return "initial";
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
return value === "" ? " " : value;
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.PatchFlags = PatchFlags;
|
||||
exports.ShapeFlags = ShapeFlags;
|
||||
exports.SlotFlags = SlotFlags;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.genCacheKey = genCacheKey;
|
||||
exports.genPropsAccessExp = genPropsAccessExp;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getEscapedCssVarName = getEscapedCssVarName;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.includeBooleanAttr = includeBooleanAttr;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isBuiltInDirective = isBuiltInDirective;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyAllowed = isGloballyAllowed;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownHtmlAttr = isKnownHtmlAttr;
|
||||
exports.isKnownMathMLAttr = isKnownMathMLAttr;
|
||||
exports.isKnownSvgAttr = isKnownSvgAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isMathMLTag = isMathMLTag;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isRegExp = isRegExp;
|
||||
exports.isRenderableAttrValue = isRenderableAttrValue;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.looseToNumber = looseToNumber;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeCssVarValue = normalizeCssVarValue;
|
||||
exports.normalizeProps = normalizeProps;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.slotFlagsText = slotFlagsText;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@vue/shared",
|
||||
"version": "3.5.43",
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
"types": "dist/shared.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/shared.d.ts",
|
||||
"node": {
|
||||
"production": "./dist/shared.cjs.prod.js",
|
||||
"development": "./dist/shared.cjs.js",
|
||||
"default": "./dist/shared.cjs.prod.js"
|
||||
},
|
||||
"module": "./dist/shared.esm-bundler.js",
|
||||
"import": "./dist/shared.esm-bundler.js",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/core.git",
|
||||
"directory": "packages/shared"
|
||||
},
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"author": "Evan You",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/core/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/shared#readme"
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "devalue",
|
||||
"description": "Gets the job done when JSON.stringify can't",
|
||||
"version": "6.0.2",
|
||||
"repository": "sveltejs/devalue",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./types/types.d.ts",
|
||||
"import": "./src/index.js",
|
||||
"default": "./src/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"types"
|
||||
],
|
||||
"types": "./types/types.d.ts",
|
||||
"engines": {
|
||||
"node": ">=22.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.29.6",
|
||||
"@js-temporal/polyfill": "^0.5.1",
|
||||
"@types/node": "^24.12.0",
|
||||
"prettier": "^3.2.4",
|
||||
"publint": "^0.3.12",
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "8.3.0",
|
||||
"vitest": "5.0.1"
|
||||
},
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"changeset:version": "changeset version",
|
||||
"changeset:publish": "changeset publish",
|
||||
"build": "tsc",
|
||||
"test": "vitest run --project unit",
|
||||
"test:unit": "vitest run --project unit",
|
||||
"test:watch": "vitest --project unit",
|
||||
"test:types": "tsc -p . --noEmit",
|
||||
"check:format": "prettier --check .",
|
||||
"format": "prettier --write .",
|
||||
"bench": "node --allow-natives-syntax ./benchmarking/run.js",
|
||||
"bench:compare": "node --allow-natives-syntax ./benchmarking/compare/index.js"
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/* Baseline 2025 runtimes */
|
||||
|
||||
/** @type {(array_buffer: ArrayBuffer) => string} */
|
||||
export function encode_native(array_buffer) {
|
||||
return new Uint8Array(array_buffer).toBase64();
|
||||
}
|
||||
|
||||
/** @type {(base64: string) => ArrayBuffer} */
|
||||
export function decode_native(base64) {
|
||||
return Uint8Array.fromBase64(base64).buffer;
|
||||
}
|
||||
|
||||
/* Node-compatible runtimes */
|
||||
|
||||
/** @type {(array_buffer: ArrayBuffer) => string} */
|
||||
export function encode_buffer(array_buffer) {
|
||||
return Buffer.from(array_buffer).toString('base64');
|
||||
}
|
||||
|
||||
/** @type {(base64: string) => ArrayBuffer} */
|
||||
export function decode_buffer(base64) {
|
||||
return Uint8Array.from(Buffer.from(base64, 'base64')).buffer;
|
||||
}
|
||||
|
||||
/* Legacy runtimes */
|
||||
|
||||
/** @type {(array_buffer: ArrayBuffer) => string} */
|
||||
export function encode_legacy(array_buffer) {
|
||||
const array = new Uint8Array(array_buffer);
|
||||
let binary = '';
|
||||
|
||||
// the maximum number of arguments to String.fromCharCode.apply
|
||||
// should be around 0xFFFF in modern engines
|
||||
const chunk_size = 0x8000;
|
||||
for (let i = 0; i < array.length; i += chunk_size) {
|
||||
const chunk = array.subarray(i, i + chunk_size);
|
||||
// `apply` accepts any array-like at runtime; lib types only admit `number[]`.
|
||||
binary += String.fromCharCode.apply(
|
||||
null,
|
||||
/** @type {number[]} */ (/** @type {unknown} */ (chunk))
|
||||
);
|
||||
}
|
||||
|
||||
return btoa(binary);
|
||||
}
|
||||
|
||||
/** @type {(base64: string) => ArrayBuffer} */
|
||||
export function decode_legacy(base64) {
|
||||
const binary_string = atob(base64);
|
||||
const len = binary_string.length;
|
||||
const array = new Uint8Array(len);
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
array[i] = binary_string.charCodeAt(i);
|
||||
}
|
||||
|
||||
return array.buffer;
|
||||
}
|
||||
|
||||
const native = typeof Uint8Array.fromBase64 === 'function';
|
||||
const buffer = typeof process === 'object' && process.versions?.node !== undefined;
|
||||
|
||||
export const encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
||||
export const decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export const UNDEFINED = -1;
|
||||
export const HOLE = -2;
|
||||
export const NAN = -3;
|
||||
export const POSITIVE_INFINITY = -4;
|
||||
export const NEGATIVE_INFINITY = -5;
|
||||
export const NEGATIVE_ZERO = -6;
|
||||
export const SPARSE = -7;
|
||||
|
||||
// The largest valid value for a JavaScript array's `length` property,
|
||||
// and the largest valid array index (one less than the max length).
|
||||
export const MAX_ARRAY_LEN = 2 ** 32 - 1;
|
||||
export const MAX_ARRAY_INDEX = MAX_ARRAY_LEN - 1;
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export { uneval } from './uneval.js';
|
||||
export { parse, unflatten } from './parse.js';
|
||||
export { stringify, stringifyAsync } from './stringify.js';
|
||||
export {
|
||||
default_stringify_operations as defaultStringifyOperations,
|
||||
default_parse_operations as defaultParseOperations
|
||||
} from './operations.js';
|
||||
export { DevalueError, filter_array_indices as filterArrayIndices } from './utils.js';
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
const SOURCE = Symbol('JavaScriptSource');
|
||||
|
||||
export class JavaScriptSource {
|
||||
/**
|
||||
* @param {TemplateStringsArray} strings
|
||||
* @param {unknown[]} values
|
||||
*/
|
||||
constructor(strings, values) {
|
||||
this.strings = strings;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(value: unknown) => string} fn
|
||||
*/
|
||||
render(fn) {
|
||||
const { strings, values } = this;
|
||||
let result = strings[0];
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
const value = values[i];
|
||||
result += JavaScriptSource.is_fragment(value)
|
||||
? JavaScriptSource.from(value).render(fn)
|
||||
: fn(value);
|
||||
result += strings[i + 1];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(value: unknown) => void} fn
|
||||
* @param {Set<string>} reserved
|
||||
* @param {Set<readonly string[]>} templates
|
||||
*/
|
||||
visit(fn, reserved, templates) {
|
||||
const { strings, values } = this;
|
||||
// Each template site reuses its string array, but its interpolations can change.
|
||||
if (!templates.has(strings)) {
|
||||
templates.add(strings);
|
||||
for (const string of strings) {
|
||||
// Generated names are ASCII, but literal identifiers can use Unicode escapes.
|
||||
const decoded = string.replace(
|
||||
/\\u(?:([\da-f]{4})|\{([\da-f]+)\})/gi,
|
||||
(escape, hex, code_point) => {
|
||||
const code = parseInt(hex || code_point, 16);
|
||||
return code < 128 ? String.fromCharCode(code) : escape;
|
||||
}
|
||||
);
|
||||
// Conservatively reserve words even in property names, strings and comments.
|
||||
for (const name of decoded.match(/[a-zA-Z_$][\w$]*/g) || []) reserved.add(name);
|
||||
}
|
||||
}
|
||||
for (const value of values) {
|
||||
if (JavaScriptSource.is_fragment(value)) {
|
||||
JavaScriptSource.from(value).visit(fn, reserved, templates);
|
||||
} else {
|
||||
fn(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {unknown} value
|
||||
* @returns {value is JavaScriptFragment}
|
||||
*/
|
||||
static is_fragment(value) {
|
||||
return typeof value === 'object' && value !== null && SOURCE in value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {JavaScriptFragment} fragment
|
||||
* @returns {JavaScriptSource}
|
||||
*/
|
||||
static from(fragment) {
|
||||
if (!JavaScriptSource.is_fragment(fragment)) {
|
||||
throw new TypeError('Invalid JavaScript fragment');
|
||||
}
|
||||
return fragment[SOURCE];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {TemplateStringsArray} strings
|
||||
* @param {...unknown} values
|
||||
* @returns {JavaScriptFragment}
|
||||
*/
|
||||
export function js(strings, ...values) {
|
||||
if (!Array.isArray(strings) || !Array.isArray(strings.raw)) {
|
||||
throw new TypeError(
|
||||
'`js` must be used as a tagged template, but was called as a regular function'
|
||||
);
|
||||
}
|
||||
return { [SOURCE]: new JavaScriptSource(strings, values) };
|
||||
}
|
||||
|
||||
/**
|
||||
* The opaque result of the `js` tag passed to an `uneval` replacer.
|
||||
* @typedef {{ readonly [SOURCE]: JavaScriptSource }} JavaScriptFragment
|
||||
*/
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
import { MAX_ARRAY_INDEX } from './constants.js';
|
||||
import {
|
||||
enumerable_symbols,
|
||||
get_type,
|
||||
is_buffer,
|
||||
is_plain_object,
|
||||
valid_array_indices
|
||||
} from './utils.js';
|
||||
|
||||
/**
|
||||
* Merges caller-provided operation overrides over the defaults. Iterating the
|
||||
* default keys (rather than the override's own keys) means nullish members
|
||||
* fall back to the default, and inherited members — e.g. from a class
|
||||
* instance — are picked up.
|
||||
*
|
||||
* @template {Record<string, any>} T
|
||||
* @param {T} defaults
|
||||
* @param {Partial<T> | undefined} overrides
|
||||
* @returns {T}
|
||||
*/
|
||||
export function merge_operations(defaults, overrides) {
|
||||
if (!overrides) return defaults;
|
||||
|
||||
const merged = /** @type {T} */ ({});
|
||||
|
||||
for (const key of /** @type {(keyof T)[]} */ (Object.keys(defaults))) {
|
||||
merged[key] = overrides[key] ?? defaults[key];
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
/** @type {{ kind: 'not-plain' }} */
|
||||
const NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: 'not-plain' });
|
||||
|
||||
/** @type {{ kind: 'symbol-keys' }} */
|
||||
const SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: 'symbol-keys' });
|
||||
|
||||
/**
|
||||
* The default implementations of every introspection/extraction operation
|
||||
* `stringify` performs on the value being serialized. Each one uses native
|
||||
* JavaScript semantics (property access, iteration, prototype methods, etc).
|
||||
*
|
||||
* Pass overrides via the `operations` option of `stringify`/`stringifyAsync`
|
||||
* to customize how values are inspected — e.g. to serialize values without
|
||||
* triggering getters, proxy traps, or patched prototype methods, or to
|
||||
* serialize values that live in a different JavaScript runtime (a `node:vm`
|
||||
* context, a WASM-hosted engine, a remote process) through handle objects.
|
||||
*
|
||||
* The object is frozen — it is shared by every `stringify` call that does
|
||||
* not override a given operation.
|
||||
*
|
||||
*/
|
||||
/** @type {import('./types.js').DefaultStringifyOperations} */
|
||||
const stringify_operations = {
|
||||
identify: (value) => value,
|
||||
|
||||
typeOf: (value) => (value === null ? 'null' : typeof value),
|
||||
|
||||
toPrimitive: (value) => value,
|
||||
|
||||
tagOf: (value) => get_type(value),
|
||||
|
||||
isThenable: (value) => typeof value.then === 'function',
|
||||
|
||||
toPromise: (thenable) => Promise.resolve(thenable),
|
||||
|
||||
unbox: (boxed) => boxed.valueOf(),
|
||||
|
||||
toISOString: (date) => (isNaN(date.getDate()) ? '' : date.toISOString()),
|
||||
|
||||
toStringValue: (value) => value.toString(),
|
||||
|
||||
regExpInfo: (regexp) => ({ source: regexp.source, flags: regexp.flags }),
|
||||
|
||||
valuesOf: (set) => set,
|
||||
|
||||
entriesOf: (map) => map,
|
||||
|
||||
viewInfo: (view) => {
|
||||
// Node Buffers may share a pool containing unrelated, sensitive data.
|
||||
// Copy only the visible bytes, without using Buffer's pooling or slice.
|
||||
if (is_buffer(view)) view = new Uint8Array(view);
|
||||
|
||||
return {
|
||||
buffer: view.buffer,
|
||||
byteOffset: view.byteOffset,
|
||||
byteLength: view.byteLength,
|
||||
length: view.length,
|
||||
bufferByteLength: view.buffer.byteLength
|
||||
};
|
||||
},
|
||||
|
||||
toArrayBuffer: (buffer) => buffer,
|
||||
|
||||
lengthOf: (array) => array.length,
|
||||
|
||||
hasOwn: (value, key) => Object.hasOwn(value, key),
|
||||
|
||||
indicesOf: (array) => valid_array_indices(array),
|
||||
|
||||
shapeOf: (value) => {
|
||||
if (!is_plain_object(value)) return NOT_PLAIN;
|
||||
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
||||
|
||||
return {
|
||||
kind: Object.getPrototypeOf(value) === null ? 'null-proto' : 'plain',
|
||||
keys: Object.keys(value)
|
||||
};
|
||||
},
|
||||
|
||||
get: (value, key) => value[key]
|
||||
};
|
||||
|
||||
export const default_stringify_operations = /* @__PURE__ */ Object.freeze(stringify_operations);
|
||||
|
||||
const array_buffer_byte_length = /** @type {() => number} */ (
|
||||
Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength')?.get
|
||||
);
|
||||
|
||||
const shared_array_buffer_byte_length =
|
||||
typeof SharedArrayBuffer === 'undefined'
|
||||
? undefined
|
||||
: Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, 'byteLength')?.get;
|
||||
|
||||
/**
|
||||
* The default implementations of every construction operation `parse` and
|
||||
* `unflatten` perform while reviving a value. Each one uses native
|
||||
* JavaScript semantics (built-in constructors, property assignment, etc).
|
||||
*
|
||||
* Pass overrides via the `operations` option of `parse`/`unflatten` to
|
||||
* customize how values are built — e.g. to construct them from the
|
||||
* intrinsics of a different realm (a `node:vm` context), or to build up
|
||||
* values inside another JavaScript runtime (a WASM-hosted engine, a remote
|
||||
* process) through handle objects.
|
||||
*
|
||||
* The object is frozen — it is shared by every `parse` call that does not
|
||||
* override a given operation.
|
||||
*
|
||||
*/
|
||||
/** @type {import('./types.js').DefaultParseOperations} */
|
||||
const parse_operations = {
|
||||
fromPrimitive: (primitive) => primitive,
|
||||
|
||||
fromISOString: (iso) => new Date(iso),
|
||||
|
||||
fromStringValue: (tag, text) => {
|
||||
if (tag === 'URL') return new URL(text);
|
||||
if (tag === 'URLSearchParams') return new URLSearchParams(text);
|
||||
// 'Temporal.Instant', 'Temporal.PlainDate', ...
|
||||
// @ts-expect-error TS doesn't know about Temporal yet
|
||||
return Temporal[tag.slice(9)].from(text);
|
||||
},
|
||||
|
||||
fromArrayBuffer: (buffer) => buffer,
|
||||
|
||||
fromRegExpInfo: (source, flags) => new RegExp(source, flags),
|
||||
|
||||
fromViewInfo: (tag, buffer, byteOffset, length) => {
|
||||
// A reviver can replace an ArrayBuffer with a length or array-like value,
|
||||
// which a typed array constructor would use to allocate a new buffer.
|
||||
// The native getters check internal slots, so they work across realms
|
||||
// and cannot be fooled by a forged prototype or Symbol.toStringTag.
|
||||
try {
|
||||
array_buffer_byte_length.call(buffer);
|
||||
} catch (error) {
|
||||
if (!shared_array_buffer_byte_length) throw error;
|
||||
shared_array_buffer_byte_length.call(buffer);
|
||||
}
|
||||
|
||||
const Constructor = /** @type {any} */ (globalThis)[tag];
|
||||
return byteOffset !== undefined
|
||||
? new Constructor(buffer, byteOffset, length)
|
||||
: new Constructor(buffer);
|
||||
},
|
||||
|
||||
box: (value) => Object(value),
|
||||
|
||||
createArray: (length) => new Array(length),
|
||||
|
||||
createSparseArray: (length) => {
|
||||
/** @type {any[]} */
|
||||
const array = [];
|
||||
|
||||
// Setting `array.length = length` (or equivalently calling
|
||||
// `new Array(length)`) on an untrusted length is a DoS vector: V8
|
||||
// eagerly allocates a contiguous backing store for array lengths below
|
||||
// ~10^8, so a small payload with a huge declared length can force
|
||||
// arbitrary memory allocation. Touching the largest-possible index
|
||||
// first forces V8 into dictionary-elements mode, where `length` is
|
||||
// just a number and no contiguous allocation occurs.
|
||||
array[MAX_ARRAY_INDEX] = undefined;
|
||||
delete array[MAX_ARRAY_INDEX];
|
||||
array.length = length;
|
||||
|
||||
return array;
|
||||
},
|
||||
|
||||
createObject: () => ({}),
|
||||
|
||||
createNullPrototypeObject: () => Object.create(null),
|
||||
|
||||
createSet: () => new Set(),
|
||||
|
||||
createMap: () => new Map(),
|
||||
|
||||
set: (target, key, value) => {
|
||||
target[key] = value;
|
||||
},
|
||||
|
||||
addValue: (set, value) => {
|
||||
set.add(value);
|
||||
},
|
||||
|
||||
addEntry: (map, key, value) => {
|
||||
map.set(key, value);
|
||||
}
|
||||
};
|
||||
|
||||
export const default_parse_operations = /* @__PURE__ */ Object.freeze(parse_operations);
|
||||
+312
@@ -0,0 +1,312 @@
|
||||
import { decode64 } from './base64.js';
|
||||
import {
|
||||
HOLE,
|
||||
NAN,
|
||||
NEGATIVE_INFINITY,
|
||||
NEGATIVE_ZERO,
|
||||
POSITIVE_INFINITY,
|
||||
SPARSE,
|
||||
UNDEFINED
|
||||
} from './constants.js';
|
||||
import { default_parse_operations, merge_operations } from './operations.js';
|
||||
import { is_valid_array_index, is_valid_array_len } from './utils.js';
|
||||
|
||||
function invalid() {
|
||||
throw new Error('Invalid input');
|
||||
}
|
||||
|
||||
/**
|
||||
* Revive a value serialized with `devalue.stringify`
|
||||
* @param {string} serialized
|
||||
* @param {Record<string, (value: any) => any>} [revivers]
|
||||
* @param {import('./types.js').ParseOptions} [options]
|
||||
*/
|
||||
export function parse(serialized, revivers, options) {
|
||||
return unflatten(JSON.parse(serialized), revivers, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Revive a value flattened with `devalue.stringify`
|
||||
* @param {number | any[]} parsed
|
||||
* @param {Record<string, (value: any) => any>} [revivers]
|
||||
* @param {import('./types.js').ParseOptions} [options]
|
||||
*/
|
||||
export function unflatten(parsed, revivers, options) {
|
||||
/** @type {import('./types.js').ParseOperations} */
|
||||
const ops = merge_operations(default_parse_operations, options?.operations);
|
||||
|
||||
if (typeof parsed === 'number') return hydrate(parsed, true);
|
||||
|
||||
if (!Array.isArray(parsed) || parsed.length === 0) {
|
||||
invalid();
|
||||
}
|
||||
|
||||
const values = /** @type {any[]} */ (parsed);
|
||||
|
||||
const hydrated = Array(values.length);
|
||||
|
||||
/**
|
||||
* A set of values currently being hydrated with custom revivers,
|
||||
* used to detect invalid cyclical dependencies
|
||||
* @type {Set<number> | null}
|
||||
*/
|
||||
let hydrating = null;
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {any}
|
||||
*/
|
||||
function get_raw(index) {
|
||||
if (!is_valid_array_index(index) || index >= values.length) {
|
||||
invalid();
|
||||
}
|
||||
|
||||
return values[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {any}
|
||||
*/
|
||||
function hydrate(index, standalone = false) {
|
||||
if (index === UNDEFINED) return ops.fromPrimitive(undefined);
|
||||
if (index === NAN) return ops.fromPrimitive(NaN);
|
||||
if (index === POSITIVE_INFINITY) return ops.fromPrimitive(Infinity);
|
||||
if (index === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
|
||||
if (index === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
|
||||
|
||||
if (standalone || typeof index !== 'number') {
|
||||
invalid();
|
||||
}
|
||||
|
||||
if (index in hydrated) return hydrated[index];
|
||||
|
||||
if (index >= values.length) {
|
||||
invalid();
|
||||
}
|
||||
|
||||
const value = values[index];
|
||||
|
||||
if (!value || typeof value !== 'object') {
|
||||
hydrated[index] = ops.fromPrimitive(value);
|
||||
} else if (Array.isArray(value)) {
|
||||
if (typeof value[0] === 'string') {
|
||||
const type = value[0];
|
||||
|
||||
const reviver = revivers && Object.hasOwn(revivers, type) ? revivers[type] : undefined;
|
||||
|
||||
if (reviver) {
|
||||
let i = value[1];
|
||||
if (typeof i !== 'number') {
|
||||
// if it's not a number, it was serialized by a builtin reviver
|
||||
// so we need to munge it into the format expected by a custom reviver
|
||||
i = values.push(value[1]) - 1;
|
||||
}
|
||||
|
||||
// If the payload is already hydrated, its recursion has already
|
||||
// terminated (e.g. a self-referential object cached itself before
|
||||
// following its own back-reference), so revive it directly. Falling
|
||||
// through to the `hydrating` guard here would wrongly reject a valid
|
||||
// cycle. An actually infinite payload (e.g. `[["Custom", 0]]`) is never
|
||||
// cached, so it still hits the guard below.
|
||||
if (Object.hasOwn(hydrated, i)) {
|
||||
return (hydrated[index] = reviver(hydrated[i]));
|
||||
}
|
||||
|
||||
hydrating ??= new Set();
|
||||
|
||||
if (hydrating.has(i)) {
|
||||
throw new Error('Invalid circular reference');
|
||||
}
|
||||
|
||||
hydrating.add(i);
|
||||
hydrated[index] = reviver(hydrate(i));
|
||||
hydrating.delete(i);
|
||||
|
||||
return hydrated[index];
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 'Date':
|
||||
hydrated[index] = ops.fromISOString(value[1]);
|
||||
break;
|
||||
|
||||
case 'Set':
|
||||
const set = ops.createSet();
|
||||
hydrated[index] = set;
|
||||
for (let i = 1; i < value.length; i += 1) {
|
||||
ops.addValue(set, hydrate(value[i]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Map':
|
||||
const map = ops.createMap();
|
||||
hydrated[index] = map;
|
||||
for (let i = 1; i < value.length; i += 2) {
|
||||
ops.addEntry(map, hydrate(value[i]), hydrate(value[i + 1]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'RegExp':
|
||||
hydrated[index] = ops.fromRegExpInfo(value[1], value[2]);
|
||||
break;
|
||||
|
||||
case 'Object': {
|
||||
const wrapped_index = value[1];
|
||||
|
||||
// Only a primitive can be boxed. The negative sentinels below are the
|
||||
// ones `stringify` emits for boxed numbers; every other sentinel
|
||||
// (`UNDEFINED`, `HOLE`, `SPARSE`) would box `undefined` into a plain
|
||||
// `{}`, which is not a value `stringify` can produce.
|
||||
const is_boxable_sentinel =
|
||||
wrapped_index === NAN ||
|
||||
wrapped_index === POSITIVE_INFINITY ||
|
||||
wrapped_index === NEGATIVE_INFINITY ||
|
||||
wrapped_index === NEGATIVE_ZERO;
|
||||
|
||||
if (!is_boxable_sentinel) {
|
||||
const wrapped = get_raw(wrapped_index);
|
||||
|
||||
const is_bigint = Array.isArray(wrapped) && wrapped[0] === 'BigInt';
|
||||
|
||||
if ((wrapped === undefined || typeof wrapped === 'object') && !is_bigint) {
|
||||
// avoid infinite recusion in case of malformed input
|
||||
invalid();
|
||||
}
|
||||
}
|
||||
|
||||
hydrated[index] = ops.box(hydrate(wrapped_index));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BigInt':
|
||||
hydrated[index] = ops.fromPrimitive(BigInt(value[1]));
|
||||
break;
|
||||
|
||||
case 'null':
|
||||
const obj = ops.createNullPrototypeObject();
|
||||
hydrated[index] = obj;
|
||||
for (let i = 1; i < value.length; i += 2) {
|
||||
const key = value[i];
|
||||
if (typeof key !== 'string') {
|
||||
throw new Error('Cannot parse an object with a non-string key');
|
||||
}
|
||||
|
||||
if (key === '__proto__') {
|
||||
throw new Error('Cannot parse an object with a `__proto__` property');
|
||||
}
|
||||
|
||||
ops.set(obj, key, hydrate(value[i + 1]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Int8Array':
|
||||
case 'Uint8Array':
|
||||
case 'Uint8ClampedArray':
|
||||
case 'Int16Array':
|
||||
case 'Uint16Array':
|
||||
case 'Float16Array':
|
||||
case 'Int32Array':
|
||||
case 'Uint32Array':
|
||||
case 'Float32Array':
|
||||
case 'Float64Array':
|
||||
case 'BigInt64Array':
|
||||
case 'BigUint64Array':
|
||||
case 'DataView': {
|
||||
const buffer_index = value[1];
|
||||
|
||||
const raw = get_raw(buffer_index);
|
||||
|
||||
if (!Array.isArray(raw) || raw[0] !== 'ArrayBuffer') {
|
||||
// without this, if we receive malformed input we could
|
||||
// end up trying to hydrate in a circle or allocate
|
||||
// huge amounts of memory when we call `new TypedArrayConstructor(buffer)`
|
||||
invalid();
|
||||
}
|
||||
|
||||
const buffer = hydrate(buffer_index);
|
||||
|
||||
hydrated[index] = ops.fromViewInfo(type, buffer, value[2], value[3]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'ArrayBuffer': {
|
||||
const base64 = value[1];
|
||||
if (typeof base64 !== 'string') {
|
||||
throw new Error('Invalid ArrayBuffer encoding');
|
||||
}
|
||||
hydrated[index] = ops.fromArrayBuffer(decode64(base64));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'URL':
|
||||
case 'URLSearchParams':
|
||||
case 'Temporal.Duration':
|
||||
case 'Temporal.Instant':
|
||||
case 'Temporal.PlainDate':
|
||||
case 'Temporal.PlainTime':
|
||||
case 'Temporal.PlainDateTime':
|
||||
case 'Temporal.PlainMonthDay':
|
||||
case 'Temporal.PlainYearMonth':
|
||||
case 'Temporal.ZonedDateTime': {
|
||||
// the same tags `toStringValue` serializes on the stringify side
|
||||
hydrated[index] = ops.fromStringValue(type, value[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Unknown type ${type}`);
|
||||
}
|
||||
} else if (value[0] === SPARSE) {
|
||||
// Sparse array encoding: [SPARSE, length, idx, val, idx, val, ...]
|
||||
const len = value[1];
|
||||
|
||||
if (!is_valid_array_len(len)) {
|
||||
invalid();
|
||||
}
|
||||
|
||||
// `len` comes from the input rather than being bounded by it, so
|
||||
// `createSparseArray` is responsible for not allocating storage
|
||||
// proportional to it.
|
||||
const array = ops.createSparseArray(len);
|
||||
hydrated[index] = array;
|
||||
|
||||
for (let i = 2; i < value.length; i += 2) {
|
||||
const idx = value[i];
|
||||
|
||||
if (!is_valid_array_index(idx) || idx >= len) {
|
||||
invalid();
|
||||
}
|
||||
|
||||
ops.set(array, idx, hydrate(value[i + 1]));
|
||||
}
|
||||
} else {
|
||||
const array = ops.createArray(value.length);
|
||||
hydrated[index] = array;
|
||||
|
||||
for (let i = 0; i < value.length; i += 1) {
|
||||
const n = value[i];
|
||||
if (n === HOLE) continue;
|
||||
|
||||
ops.set(array, i, hydrate(n));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const object = ops.createObject();
|
||||
hydrated[index] = object;
|
||||
|
||||
for (const key of Object.keys(value)) {
|
||||
if (key === '__proto__') {
|
||||
throw new Error('Cannot parse an object with a `__proto__` property');
|
||||
}
|
||||
|
||||
ops.set(object, key, hydrate(value[key]));
|
||||
}
|
||||
}
|
||||
|
||||
return hydrated[index];
|
||||
}
|
||||
|
||||
return hydrate(0);
|
||||
}
|
||||
+438
@@ -0,0 +1,438 @@
|
||||
import { DevalueError, MAP_KEY, format_path, quote_key, stringify_string } from './utils.js';
|
||||
import {
|
||||
HOLE,
|
||||
NAN,
|
||||
NEGATIVE_INFINITY,
|
||||
NEGATIVE_ZERO,
|
||||
POSITIVE_INFINITY,
|
||||
SPARSE,
|
||||
UNDEFINED
|
||||
} from './constants.js';
|
||||
import { encode64 } from './base64.js';
|
||||
import { default_stringify_operations, merge_operations } from './operations.js';
|
||||
|
||||
/**
|
||||
* Turn a value into a JSON string that can be parsed with `devalue.parse`
|
||||
* @param {any} value
|
||||
* @param {Record<string, (value: any) => any>} [reducers]
|
||||
* @param {import('./types.js').StringifyOptions} [options]
|
||||
*/
|
||||
export function stringify(value, reducers, options) {
|
||||
const stringified = run(false, value, reducers, options);
|
||||
return typeof stringified === 'string' ? stringified : `[${stringified.join(',')}]`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a value into a JSON string that can be parsed with `devalue.parse`
|
||||
* @param {any} value
|
||||
* @param {Record<string, (value: any) => any>} [reducers]
|
||||
* @param {import('./types.js').StringifyOptions} [options]
|
||||
*/
|
||||
export async function stringifyAsync(value, reducers, options) {
|
||||
const stringified = run(true, value, reducers, options);
|
||||
|
||||
if (typeof stringified === 'string') {
|
||||
return stringified;
|
||||
}
|
||||
|
||||
let out = '[';
|
||||
|
||||
for (let i = 0; i < stringified.length; i += 1) {
|
||||
let value = stringified[i];
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
await value;
|
||||
value = stringified[i];
|
||||
|
||||
if (i === 0 && value < 0) {
|
||||
return `${value}`;
|
||||
}
|
||||
}
|
||||
|
||||
out += value;
|
||||
|
||||
if (i < stringified.length - 1) {
|
||||
out += ',';
|
||||
}
|
||||
}
|
||||
|
||||
out += ']';
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} async
|
||||
* @param {any} value
|
||||
* @param {Record<string, (value: any) => any>} [reducers]
|
||||
* @param {import('./types.js').StringifyOptions} [options]
|
||||
*/
|
||||
function run(async, value, reducers, options) {
|
||||
const ops = merge_operations(default_stringify_operations, options?.operations);
|
||||
|
||||
/** @type {any[]} */
|
||||
const stringified = [];
|
||||
|
||||
/** @type {Map<any, number>} */
|
||||
const indexes = new Map();
|
||||
|
||||
/** @type {Array<{ key: string, fn: (value: any) => any }>} */
|
||||
const custom = [];
|
||||
if (reducers) {
|
||||
for (const key of Object.getOwnPropertyNames(reducers)) {
|
||||
custom.push({ key, fn: reducers[key] });
|
||||
}
|
||||
}
|
||||
|
||||
// the path to the value being serialized, recorded as-is and only
|
||||
// formatted by `error` — see `format_path`
|
||||
/** @type {any[]} */
|
||||
let keys = [];
|
||||
|
||||
let p = 0;
|
||||
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {any} thing
|
||||
* @returns {never}
|
||||
*/
|
||||
function error(message, thing) {
|
||||
const path = format_path(keys, (key) => {
|
||||
const key_type = ops.typeOf(key);
|
||||
const key_is_primitive =
|
||||
key_type !== 'object' && key_type !== 'function' && key_type !== 'symbol';
|
||||
return key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : '...';
|
||||
});
|
||||
|
||||
throw new DevalueError(message, path, thing, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} thing
|
||||
* @param {number} [index]
|
||||
*/
|
||||
function flatten(thing, index) {
|
||||
const type = ops.typeOf(thing);
|
||||
|
||||
if (type === 'undefined') return UNDEFINED;
|
||||
|
||||
/** @type {number | undefined} */
|
||||
let number;
|
||||
|
||||
// `ops.toPrimitive` is the boundary between the value being serialized and
|
||||
// plain host JavaScript: everything below operates on the extracted host
|
||||
// primitive, so native comparisons and arithmetic are correct there.
|
||||
if (type === 'number') {
|
||||
number = /** @type {number} */ (ops.toPrimitive(thing));
|
||||
if (Number.isNaN(number)) return NAN;
|
||||
if (number === Infinity) return POSITIVE_INFINITY;
|
||||
if (number === -Infinity) return NEGATIVE_INFINITY;
|
||||
if (number === 0 && 1 / number < 0) return NEGATIVE_ZERO;
|
||||
}
|
||||
|
||||
const id = ops.identify(thing);
|
||||
|
||||
if (indexes.has(id)) return /** @type {number} */ (indexes.get(id));
|
||||
|
||||
index ??= p++;
|
||||
indexes.set(id, index);
|
||||
|
||||
for (const { key, fn } of custom) {
|
||||
const value = fn(thing);
|
||||
if (value) {
|
||||
stringified[index] = `["${key}",${flatten(value)}]`;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'function') {
|
||||
error(`Cannot stringify a function`, thing);
|
||||
} else if (type === 'symbol') {
|
||||
error(`Cannot stringify a Symbol primitive`, thing);
|
||||
}
|
||||
|
||||
/** @type {string | Promise<any>} */
|
||||
let str = '';
|
||||
|
||||
if (type !== 'object') {
|
||||
str = stringify_primitive(type === 'number' ? number : ops.toPrimitive(thing));
|
||||
} else if (ops.isThenable(thing)) {
|
||||
if (!async) {
|
||||
error(`Cannot stringify a Promise or thenable — use stringifyAsync instead`, thing);
|
||||
}
|
||||
|
||||
// the callback runs after the synchronous walk has unwound `keys`,
|
||||
// so the path to the thenable has to be captured and reinstated
|
||||
const prev_keys = keys.slice();
|
||||
|
||||
str = ops.toPromise(thing).then((value) => {
|
||||
keys = prev_keys;
|
||||
|
||||
const i = flatten(value, index);
|
||||
if (i < 0) stringified[index] = i;
|
||||
});
|
||||
|
||||
// Promises are awaited sequentially, and traversal may throw before
|
||||
// reaching them. Handle rejections immediately, but keep the original
|
||||
// promise so awaiting it still propagates the error to the caller.
|
||||
str.catch(() => {});
|
||||
} else {
|
||||
const tag = ops.tagOf(thing);
|
||||
|
||||
switch (tag) {
|
||||
case 'Number':
|
||||
case 'String':
|
||||
case 'Boolean':
|
||||
case 'BigInt':
|
||||
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
||||
break;
|
||||
|
||||
case 'Date':
|
||||
str = `["Date","${ops.toISOString(thing)}"]`;
|
||||
break;
|
||||
|
||||
case 'URL':
|
||||
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
||||
break;
|
||||
|
||||
case 'URLSearchParams':
|
||||
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
||||
break;
|
||||
|
||||
case 'RegExp':
|
||||
const { source, flags } = ops.regExpInfo(thing);
|
||||
str = flags
|
||||
? `["RegExp",${stringify_string(source)},"${flags}"]`
|
||||
: `["RegExp",${stringify_string(source)}]`;
|
||||
break;
|
||||
|
||||
case 'Array': {
|
||||
// For dense arrays (no holes), we iterate normally.
|
||||
// When we encounter the first hole, we call Object.keys
|
||||
// to determine the sparseness, then decide between:
|
||||
// - HOLE encoding: [-2, val, -2, ...] (default)
|
||||
// - Sparse encoding: [-7, length, idx, val, ...] (for very sparse arrays)
|
||||
// Only the sparse path avoids iterating every slot, which
|
||||
// is what protects against the DoS of e.g. `arr[1000000] = 1`.
|
||||
let mostly_dense = false;
|
||||
|
||||
const length = ops.lengthOf(thing);
|
||||
|
||||
str = '[';
|
||||
|
||||
for (let i = 0; i < length; i += 1) {
|
||||
if (i > 0) str += ',';
|
||||
|
||||
if (ops.hasOwn(thing, i)) {
|
||||
keys.push(i);
|
||||
str += flatten(ops.get(thing, i));
|
||||
keys.pop();
|
||||
} else if (mostly_dense) {
|
||||
// Use dense encoding. The heuristic guarantees the
|
||||
// array is only mildly sparse, so iterating over every
|
||||
// slot is fine.
|
||||
str += HOLE;
|
||||
} else {
|
||||
// Decide between HOLE encoding and sparse encoding.
|
||||
//
|
||||
// HOLE encoding: each hole is serialized as the HOLE
|
||||
// sentinel (-2). For example, [, "a", ,] becomes
|
||||
// [-2, 0, -2]. Each hole costs 3 chars ("-2" + comma).
|
||||
//
|
||||
// Sparse encoding: lists only populated indices.
|
||||
// For example, [, "a", ,] becomes [-7, 3, 1, 0] — the
|
||||
// -7 sentinel, the array length (3), then index-value
|
||||
// pairs. This avoids paying per-hole, but each element
|
||||
// costs extra chars to write its index.
|
||||
//
|
||||
// The values are the same size either way, so the
|
||||
// choice comes down to structural overhead:
|
||||
//
|
||||
// HOLE overhead:
|
||||
// 3 chars per hole ("-2" + comma)
|
||||
// = (L - P) * 3
|
||||
//
|
||||
// Sparse overhead:
|
||||
// "-7," — 3 chars (sparse sentinel + comma)
|
||||
// + length + "," — (d + 1) chars (array length + comma)
|
||||
// + per element: index + "," — (d + 1) chars
|
||||
// = (4 + d) + P * (d + 1)
|
||||
//
|
||||
// where L is the array length, P is the number of
|
||||
// populated elements, and d is the number of digits
|
||||
// in L (an upper bound on the digits in any index).
|
||||
//
|
||||
// Sparse encoding is cheaper when:
|
||||
// (4 + d) + P * (d + 1) < (L - P) * 3
|
||||
const populated_keys = ops.indicesOf(thing);
|
||||
const population = populated_keys.length;
|
||||
const d = String(length).length;
|
||||
|
||||
const hole_cost = (length - population) * 3;
|
||||
const sparse_cost = 4 + d + population * (d + 1);
|
||||
|
||||
if (hole_cost > sparse_cost) {
|
||||
str = '[' + SPARSE + ',' + length;
|
||||
for (let j = 0; j < populated_keys.length; j++) {
|
||||
const key = populated_keys[j];
|
||||
keys.push(+key);
|
||||
str += ',' + key + ',' + flatten(ops.get(thing, key));
|
||||
keys.pop();
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
mostly_dense = true;
|
||||
str += HOLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str += ']';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Set':
|
||||
str = '["Set"';
|
||||
|
||||
for (const value of ops.valuesOf(thing)) {
|
||||
str += `,${flatten(value)}`;
|
||||
}
|
||||
|
||||
str += ']';
|
||||
break;
|
||||
|
||||
case 'Map':
|
||||
str = '["Map"';
|
||||
|
||||
for (const [key, value] of ops.entriesOf(thing)) {
|
||||
keys.push(MAP_KEY, key);
|
||||
str += `,${flatten(key)},${flatten(value)}`;
|
||||
keys.pop();
|
||||
keys.pop();
|
||||
}
|
||||
|
||||
str += ']';
|
||||
break;
|
||||
|
||||
case 'Int8Array':
|
||||
case 'Uint8Array':
|
||||
case 'Uint8ClampedArray':
|
||||
case 'Int16Array':
|
||||
case 'Uint16Array':
|
||||
case 'Float16Array':
|
||||
case 'Int32Array':
|
||||
case 'Uint32Array':
|
||||
case 'Float32Array':
|
||||
case 'Float64Array':
|
||||
case 'BigInt64Array':
|
||||
case 'BigUint64Array': {
|
||||
const info = ops.viewInfo(thing);
|
||||
str = '["' + tag + '",' + flatten(info.buffer);
|
||||
|
||||
// handle subarrays
|
||||
if (info.byteLength !== info.bufferByteLength) {
|
||||
str += `,${info.byteOffset},${info.length}`;
|
||||
}
|
||||
|
||||
str += ']';
|
||||
break;
|
||||
}
|
||||
|
||||
case 'DataView': {
|
||||
const info = ops.viewInfo(thing);
|
||||
str = '["' + tag + '",' + flatten(info.buffer);
|
||||
|
||||
if (info.byteLength !== info.bufferByteLength) {
|
||||
str += `,${info.byteOffset},${info.byteLength}`;
|
||||
}
|
||||
|
||||
str += ']';
|
||||
break;
|
||||
}
|
||||
|
||||
case 'ArrayBuffer': {
|
||||
const base64 = encode64(ops.toArrayBuffer(thing));
|
||||
|
||||
str = `["ArrayBuffer","${base64}"]`;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Temporal.Duration':
|
||||
case 'Temporal.Instant':
|
||||
case 'Temporal.PlainDate':
|
||||
case 'Temporal.PlainTime':
|
||||
case 'Temporal.PlainDateTime':
|
||||
case 'Temporal.PlainMonthDay':
|
||||
case 'Temporal.PlainYearMonth':
|
||||
case 'Temporal.ZonedDateTime':
|
||||
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
||||
break;
|
||||
|
||||
default: {
|
||||
const shape = ops.shapeOf(thing);
|
||||
|
||||
if (shape.kind === 'not-plain') {
|
||||
error(`Cannot stringify arbitrary non-POJOs`, thing);
|
||||
}
|
||||
|
||||
if (shape.kind === 'symbol-keys') {
|
||||
error(`Cannot stringify POJOs with symbolic keys`, thing);
|
||||
}
|
||||
|
||||
if (shape.kind === 'null-proto') {
|
||||
str = '["null"';
|
||||
for (const key of shape.keys) {
|
||||
if (key === '__proto__') {
|
||||
error(`Cannot stringify objects with __proto__ keys`, thing);
|
||||
}
|
||||
|
||||
keys.push(key);
|
||||
str += `,${quote_key(key)},${flatten(ops.get(thing, key))}`;
|
||||
keys.pop();
|
||||
}
|
||||
str += ']';
|
||||
} else {
|
||||
str = '{';
|
||||
let started = false;
|
||||
for (const key of shape.keys) {
|
||||
if (key === '__proto__') {
|
||||
error(`Cannot stringify objects with __proto__ keys`, thing);
|
||||
}
|
||||
|
||||
if (started) str += ',';
|
||||
started = true;
|
||||
keys.push(key);
|
||||
str += `${quote_key(key)}:${flatten(ops.get(thing, key))}`;
|
||||
keys.pop();
|
||||
}
|
||||
str += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stringified[index] = str;
|
||||
return index;
|
||||
}
|
||||
|
||||
const index = flatten(value);
|
||||
|
||||
// special case — value is represented as a negative index
|
||||
if (index < 0) return `${index}`;
|
||||
|
||||
return stringified;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} thing
|
||||
* @returns {string}
|
||||
*/
|
||||
function stringify_primitive(thing) {
|
||||
const type = typeof thing;
|
||||
if (type === 'string') return stringify_string(thing);
|
||||
if (thing === void 0) return UNDEFINED.toString();
|
||||
if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
|
||||
if (type === 'bigint') return `["BigInt","${thing}"]`;
|
||||
return String(thing);
|
||||
}
|
||||
+623
@@ -0,0 +1,623 @@
|
||||
/**
|
||||
* @import { UnevalReplacer } from './types';
|
||||
*/
|
||||
import { js, JavaScriptSource } from './javascript-source.js';
|
||||
import {
|
||||
DevalueError,
|
||||
MAP_KEY,
|
||||
enumerable_symbols,
|
||||
escaped,
|
||||
format_path,
|
||||
get_name,
|
||||
get_type,
|
||||
is_buffer,
|
||||
is_plain_object,
|
||||
is_primitive,
|
||||
stringify_key,
|
||||
stringify_sparse_array,
|
||||
stringify_string,
|
||||
valid_array_indices
|
||||
} from './utils.js';
|
||||
|
||||
const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
|
||||
// Short strings have bounded escaping/output costs per reference.
|
||||
const MIN_STRING_LENGTH = 128;
|
||||
|
||||
/**
|
||||
* Turn a value into the JavaScript that creates an equivalent value
|
||||
* @param {any} value
|
||||
* @param {UnevalReplacer} [replacer]
|
||||
*/
|
||||
export function uneval(value, replacer) {
|
||||
/** @type {Map<any, string>} */
|
||||
const names = new Map();
|
||||
const reserved = new Set();
|
||||
const templates = new Set();
|
||||
const seen = new Set();
|
||||
|
||||
// the path to the value being walked, recorded as-is and only formatted
|
||||
// by `error` — see `format_path`
|
||||
/** @type {any[]} */
|
||||
const keys = [];
|
||||
|
||||
/** @type {Map<any, JavaScriptSource>} */
|
||||
const custom = new Map();
|
||||
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {any} thing
|
||||
* @returns {never}
|
||||
*/
|
||||
function error(message, thing) {
|
||||
const path = format_path(keys, (key) => (is_primitive(key) ? stringify_primitive(key) : '...'));
|
||||
throw new DevalueError(message, path, thing, value);
|
||||
}
|
||||
|
||||
/** @type {Map<string | bigint, number> | undefined} */
|
||||
let primitive_counts;
|
||||
/** @type {Map<string | bigint, string> | undefined} */
|
||||
let primitives;
|
||||
|
||||
/** @param {any} thing */
|
||||
function stringify_cached_primitive(thing) {
|
||||
if (
|
||||
(typeof thing === 'string' && thing.length >= MIN_STRING_LENGTH) ||
|
||||
typeof thing === 'bigint'
|
||||
) {
|
||||
primitives ??= new Map();
|
||||
let literal = primitives.get(thing);
|
||||
if (literal === undefined) {
|
||||
literal = stringify_primitive(thing);
|
||||
primitives.set(thing, literal);
|
||||
}
|
||||
return literal;
|
||||
}
|
||||
return stringify_primitive(thing);
|
||||
}
|
||||
|
||||
/** @param {any} thing */
|
||||
function walk(thing) {
|
||||
if (!is_primitive(thing)) {
|
||||
if (seen.has(thing)) {
|
||||
if (!names.has(thing)) names.set(thing, '');
|
||||
return;
|
||||
}
|
||||
|
||||
seen.add(thing);
|
||||
|
||||
if (replacer) {
|
||||
const fragment = replacer(thing, js);
|
||||
|
||||
if (fragment) {
|
||||
const source = JavaScriptSource.from(fragment);
|
||||
custom.set(thing, source);
|
||||
source.visit(walk, reserved, templates);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fragment !== undefined && fragment !== null && fragment !== false) {
|
||||
throw new TypeError('Invalid uneval replacer result');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof thing === 'function') {
|
||||
error(`Cannot stringify a function`, thing);
|
||||
}
|
||||
|
||||
const type = get_type(thing);
|
||||
|
||||
switch (type) {
|
||||
case 'BigInt':
|
||||
case 'String':
|
||||
walk(thing.valueOf());
|
||||
return;
|
||||
|
||||
case 'Number':
|
||||
case 'Boolean':
|
||||
case 'Date':
|
||||
case 'RegExp':
|
||||
case 'URL':
|
||||
case 'URLSearchParams':
|
||||
return;
|
||||
|
||||
case 'Array':
|
||||
// Never scan the logical length of a dictionary-backed sparse array.
|
||||
for (const i of valid_array_indices(thing)) {
|
||||
keys.push(+i);
|
||||
walk(thing[i]);
|
||||
keys.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Set':
|
||||
for (const value of thing) walk(value);
|
||||
break;
|
||||
|
||||
case 'Map':
|
||||
for (const [key, value] of thing) {
|
||||
keys.push(MAP_KEY, key);
|
||||
walk(key);
|
||||
walk(value);
|
||||
keys.pop();
|
||||
keys.pop();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Int8Array':
|
||||
case 'Uint8Array':
|
||||
case 'Uint8ClampedArray':
|
||||
case 'Int16Array':
|
||||
case 'Uint16Array':
|
||||
case 'Float16Array':
|
||||
case 'Int32Array':
|
||||
case 'Uint32Array':
|
||||
case 'Float32Array':
|
||||
case 'Float64Array':
|
||||
case 'BigInt64Array':
|
||||
case 'BigUint64Array':
|
||||
case 'DataView':
|
||||
// Buffer pools can contain unrelated, sensitive bytes.
|
||||
if (!is_buffer(thing)) walk(thing.buffer);
|
||||
return;
|
||||
|
||||
case 'ArrayBuffer':
|
||||
return;
|
||||
|
||||
case 'Temporal.Duration':
|
||||
case 'Temporal.Instant':
|
||||
case 'Temporal.PlainDate':
|
||||
case 'Temporal.PlainTime':
|
||||
case 'Temporal.PlainDateTime':
|
||||
case 'Temporal.PlainMonthDay':
|
||||
case 'Temporal.PlainYearMonth':
|
||||
case 'Temporal.ZonedDateTime':
|
||||
return;
|
||||
|
||||
default:
|
||||
if (!is_plain_object(thing)) {
|
||||
error(`Cannot stringify arbitrary non-POJOs`, thing);
|
||||
}
|
||||
|
||||
if (enumerable_symbols(thing).length > 0) {
|
||||
error(`Cannot stringify POJOs with symbolic keys`, thing);
|
||||
}
|
||||
|
||||
for (const key of Object.keys(thing)) {
|
||||
if (key === '__proto__') {
|
||||
error(`Cannot stringify objects with __proto__ keys`, thing);
|
||||
}
|
||||
|
||||
keys.push(key);
|
||||
walk(thing[key]);
|
||||
keys.pop();
|
||||
}
|
||||
}
|
||||
} else if (typeof thing === 'symbol') {
|
||||
error(`Cannot stringify a Symbol primitive`, thing);
|
||||
} else if (
|
||||
(typeof thing === 'string' && thing.length >= MIN_STRING_LENGTH) ||
|
||||
typeof thing === 'bigint'
|
||||
) {
|
||||
primitive_counts ??= new Map();
|
||||
primitive_counts.set(thing, (primitive_counts.get(thing) || 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
walk(value);
|
||||
|
||||
let name_index = 0;
|
||||
function next_name() {
|
||||
let name;
|
||||
do {
|
||||
name = get_name(name_index++);
|
||||
} while (reserved.has(name));
|
||||
return name;
|
||||
}
|
||||
|
||||
// Wait until every custom source has been visited before assigning names.
|
||||
for (const thing of names.keys()) names.set(thing, next_name());
|
||||
if (primitive_counts) {
|
||||
for (const [thing, count] of primitive_counts) {
|
||||
if (count < 2) continue;
|
||||
const name = next_name();
|
||||
const length = stringify_cached_primitive(thing).length;
|
||||
// Include the declaration and IIFE overhead even if one already exists.
|
||||
if (length * count > length + (count + 1) * name.length + 40) names.set(thing, name);
|
||||
}
|
||||
}
|
||||
|
||||
// Reuse the traversal set to track declarations during serialization.
|
||||
seen.clear();
|
||||
const inlining = custom.size > 0 ? new Set() : null;
|
||||
|
||||
/** @type {Map<any, () => void>} */
|
||||
const initializers = new Map();
|
||||
|
||||
/** @type {string[]} */
|
||||
const statements = [];
|
||||
|
||||
/**
|
||||
* @param {any} thing
|
||||
* @returns {string}
|
||||
*/
|
||||
function stringify(thing) {
|
||||
const name = names.get(thing);
|
||||
|
||||
if (name) {
|
||||
if (!seen.has(thing)) {
|
||||
if (is_primitive(thing)) {
|
||||
seen.add(thing);
|
||||
statements.push(`let ${name}=${stringify_cached_primitive(thing)}`);
|
||||
return name;
|
||||
}
|
||||
const type = custom.has(thing) ? null : get_type(thing);
|
||||
|
||||
switch (type) {
|
||||
case 'Object':
|
||||
seen.add(thing);
|
||||
statements.push(
|
||||
`let ${name}=${Object.getPrototypeOf(thing) === null ? 'Object.create(null)' : '{}'}`
|
||||
);
|
||||
Object.keys(thing).forEach((key) => {
|
||||
statements.push(`${name}${safe_prop(key)}=${stringify(thing[key])}`);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'Array': {
|
||||
seen.add(thing);
|
||||
const indices = valid_array_indices(thing);
|
||||
const array =
|
||||
thing.length > 32 + 2 * indices.length
|
||||
? stringify_sparse_array(thing.length)
|
||||
: `Array(${thing.length})`;
|
||||
statements.push(`let ${name}=${array}`);
|
||||
for (const i of indices) {
|
||||
statements.push(`${name}[${i}]=${stringify(thing[i])}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Set':
|
||||
case 'Map': {
|
||||
seen.add(thing);
|
||||
/** @type {string[]} */
|
||||
const entries = [];
|
||||
let initialized = false;
|
||||
let statement_index = -1;
|
||||
|
||||
// Collect a ready prefix until a reference needs the collection.
|
||||
// Emit subsequent entries eagerly, preserving insertion order.
|
||||
const initialize = () => {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
initializers.delete(thing);
|
||||
statements.push(
|
||||
`let ${name}=new ${type}${entries.length ? `([${entries.join(',')}])` : ''}`
|
||||
);
|
||||
};
|
||||
|
||||
initializers.set(thing, initialize);
|
||||
|
||||
for (const entry of thing) {
|
||||
const args =
|
||||
type === 'Map' ? `${stringify(entry[0])},${stringify(entry[1])}` : stringify(entry);
|
||||
|
||||
if (!initialized) {
|
||||
entries.push(type === 'Map' ? `[${args}]` : args);
|
||||
} else {
|
||||
const call = `.${type === 'Map' ? 'set' : 'add'}(${args})`;
|
||||
if (statement_index === statements.length - 1) {
|
||||
statements[statement_index] += call;
|
||||
} else {
|
||||
statement_index = statements.push(name + call) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialize();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
const str = actually_stringify(thing);
|
||||
if (!seen.has(thing)) statements.push(`let ${name}=${str}`);
|
||||
seen.add(thing);
|
||||
}
|
||||
} else {
|
||||
initializers.get(thing)?.();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
if (is_primitive(thing)) {
|
||||
return stringify_cached_primitive(thing);
|
||||
}
|
||||
|
||||
if (inlining === null) return actually_stringify(thing);
|
||||
|
||||
// A singly referenced value can still be part of a custom constructor's
|
||||
// cycle. If inlining it re-enters itself, hoist it to break the cycle.
|
||||
if (inlining.has(thing)) {
|
||||
names.set(thing, next_name());
|
||||
return stringify(thing);
|
||||
}
|
||||
|
||||
inlining.add(thing);
|
||||
const str = actually_stringify(thing);
|
||||
inlining.delete(thing);
|
||||
return names.get(thing) || str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} thing
|
||||
* @returns {string}
|
||||
*/
|
||||
function actually_stringify(thing) {
|
||||
const source = custom.get(thing);
|
||||
|
||||
if (source) {
|
||||
return source.render(stringify);
|
||||
}
|
||||
|
||||
const type = get_type(thing);
|
||||
|
||||
switch (type) {
|
||||
case 'Number':
|
||||
case 'String':
|
||||
case 'Boolean':
|
||||
case 'BigInt':
|
||||
return `Object(${stringify(thing.valueOf())})`;
|
||||
|
||||
case 'RegExp':
|
||||
const { source, flags } = thing;
|
||||
return flags
|
||||
? `new RegExp(${stringify_string(source)},"${flags}")`
|
||||
: `new RegExp(${stringify_string(source)})`;
|
||||
|
||||
case 'Date':
|
||||
return `new Date(${thing.getTime()})`;
|
||||
|
||||
case 'URL':
|
||||
return `new URL(${stringify_string(thing.toString())})`;
|
||||
|
||||
case 'URLSearchParams':
|
||||
return `new URLSearchParams(${stringify_string(thing.toString())})`;
|
||||
|
||||
case 'Array': {
|
||||
// For dense arrays (no holes), we iterate normally.
|
||||
// When we encounter the first hole, we collect own indices
|
||||
// to determine the sparseness, then decide between:
|
||||
// - Array literal with holes: [,"a",,] (default)
|
||||
// - Object.assign with a sparse-safe allocator (for very sparse arrays)
|
||||
// Only the Object.assign path avoids iterating every slot, which
|
||||
// is what protects against the DoS of e.g. `arr[1000000] = 1`.
|
||||
let has_holes = false;
|
||||
|
||||
let result = '[';
|
||||
|
||||
for (let i = 0; i < thing.length; i += 1) {
|
||||
if (i > 0) result += ',';
|
||||
|
||||
if (Object.hasOwn(thing, i)) {
|
||||
result += stringify(thing[i]);
|
||||
} else if (!has_holes) {
|
||||
// Decide between array literal and Object.assign.
|
||||
//
|
||||
// Array literal: holes are consecutive commas.
|
||||
// For example, [, "a", ,] is written as [,"a",,].
|
||||
// Each hole costs 1 char (a comma).
|
||||
//
|
||||
// Object.assign: populated indices are listed explicitly.
|
||||
// For example, [, "a", ,] would be written as
|
||||
// Object.assign(sparse(3),{1:"a"}), where sparse(n) stands
|
||||
// for the expression emitted by stringify_sparse_array(n).
|
||||
// This avoids paying per-hole, but has fixed overhead for
|
||||
// the allocator and wrapper, plus each index and colon.
|
||||
//
|
||||
// The serialized values are the same size either way, so
|
||||
// the choice comes down to the structural overhead:
|
||||
//
|
||||
// Array literal overhead:
|
||||
// 1 char per element or hole (comma separators)
|
||||
// + 2 chars for "[" and "]"
|
||||
// = L + 2
|
||||
//
|
||||
// Object.assign overhead:
|
||||
// "Object.assign(" — 14 chars
|
||||
// + allocator expression — A chars
|
||||
// + ",{" — 2 chars
|
||||
// + for each populated element:
|
||||
// index + ":" + "," — (d + 2) chars
|
||||
// + "})" — 2 chars
|
||||
// = (18 + A) + P * (d + 2)
|
||||
//
|
||||
// where L is the array length, P is the number of
|
||||
// populated elements, A is the allocator length, and d
|
||||
// is the number of digits in L (an upper bound per index).
|
||||
//
|
||||
// Object.assign is cheaper when:
|
||||
// (18 + A) + P * (d + 2) < L + 2
|
||||
const populated_keys = valid_array_indices(/** @type {any[]} */ (thing));
|
||||
const population = populated_keys.length;
|
||||
const d = String(thing.length).length;
|
||||
const array = stringify_sparse_array(thing.length);
|
||||
|
||||
const hole_cost = thing.length + 2;
|
||||
const sparse_cost = array.length + 18 + population * (d + 2);
|
||||
|
||||
if (hole_cost > sparse_cost) {
|
||||
const entries = populated_keys.map((k) => `${k}:${stringify(thing[k])}`).join(',');
|
||||
return `Object.assign(${array},{${entries}})`;
|
||||
}
|
||||
|
||||
has_holes = true;
|
||||
}
|
||||
// else: already decided on array literal, hole is just an empty slot
|
||||
// (the comma separator is all we need — no content for this position)
|
||||
}
|
||||
|
||||
const tail = thing.length === 0 || Object.hasOwn(thing, thing.length - 1) ? '' : ',';
|
||||
return result + tail + ']';
|
||||
}
|
||||
|
||||
case 'Set':
|
||||
return `new Set([${Array.from(thing, stringify).join(',')}])`;
|
||||
|
||||
case 'Map': {
|
||||
const entries = Array.from(thing, ([k, v]) => `[${stringify(k)},${stringify(v)}]`);
|
||||
return `new Map([${entries.join(',')}])`;
|
||||
}
|
||||
|
||||
case 'Int8Array':
|
||||
case 'Uint8Array':
|
||||
case 'Uint8ClampedArray':
|
||||
case 'Int16Array':
|
||||
case 'Uint16Array':
|
||||
case 'Float16Array':
|
||||
case 'Int32Array':
|
||||
case 'Uint32Array':
|
||||
case 'Float32Array':
|
||||
case 'Float64Array':
|
||||
case 'BigInt64Array':
|
||||
case 'BigUint64Array': {
|
||||
if (is_buffer(thing)) thing = new Uint8Array(thing);
|
||||
|
||||
if (thing.buffer.byteLength % thing.BYTES_PER_ELEMENT !== 0) {
|
||||
return `new ${type}(${stringify(thing.buffer)},${thing.byteOffset},${thing.length})`;
|
||||
}
|
||||
|
||||
let str = `new ${type}`;
|
||||
|
||||
if (!names.has(thing.buffer)) {
|
||||
str += `([${stringify_typed_array_elements(type, thing.buffer)}])`;
|
||||
} else {
|
||||
str += `(${stringify(thing.buffer)})`;
|
||||
}
|
||||
|
||||
// handle subarrays
|
||||
if (thing.byteLength !== thing.buffer.byteLength) {
|
||||
const start = thing.byteOffset / thing.BYTES_PER_ELEMENT;
|
||||
const end = start + thing.length;
|
||||
str += `.subarray(${start},${end})`;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
case 'DataView': {
|
||||
let str = `new DataView`;
|
||||
|
||||
if (!names.has(thing.buffer)) {
|
||||
str += `(new Uint8Array([${new Uint8Array(thing.buffer)}]).buffer`;
|
||||
} else {
|
||||
str += `(${stringify(thing.buffer)}`;
|
||||
}
|
||||
|
||||
// handle subviews
|
||||
if (thing.byteLength !== thing.buffer.byteLength) {
|
||||
str += `,${thing.byteOffset},${thing.byteLength}`;
|
||||
}
|
||||
|
||||
return str + ')';
|
||||
}
|
||||
|
||||
case 'ArrayBuffer': {
|
||||
const ui8 = new Uint8Array(thing);
|
||||
return `new Uint8Array([${ui8.toString()}]).buffer`;
|
||||
}
|
||||
|
||||
case 'Temporal.Duration':
|
||||
case 'Temporal.Instant':
|
||||
case 'Temporal.PlainDate':
|
||||
case 'Temporal.PlainTime':
|
||||
case 'Temporal.PlainDateTime':
|
||||
case 'Temporal.PlainMonthDay':
|
||||
case 'Temporal.PlainYearMonth':
|
||||
case 'Temporal.ZonedDateTime':
|
||||
return `${type}.from(${stringify_string(thing.toString())})`;
|
||||
|
||||
default:
|
||||
const keys = Object.keys(thing);
|
||||
const obj = keys.map((key) => `${safe_key(key)}:${stringify(thing[key])}`).join(',');
|
||||
const proto = Object.getPrototypeOf(thing);
|
||||
if (proto === null) {
|
||||
return keys.length > 0 ? `{${obj},__proto__:null}` : `{__proto__:null}`;
|
||||
}
|
||||
|
||||
return `{${obj}}`;
|
||||
}
|
||||
}
|
||||
|
||||
const str = stringify(value);
|
||||
|
||||
if (statements.length === 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return `(function(){${statements.join(';')};return ${str}}())`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the elements of `buffer`, read as `type`, as a comma-separated list.
|
||||
* The view is created from `type` rather than from the serialized value's own
|
||||
* constructor, which may be a subclass like Node's `Buffer` whose `toString`
|
||||
* decodes the bytes instead of listing them.
|
||||
* `BigInt64Array`/`BigUint64Array` elements are bigints and must be written
|
||||
* with an `n` suffix, otherwise the emitted `new BigInt64Array([...])` throws.
|
||||
* @param {string} type
|
||||
* @param {ArrayBufferLike} buffer
|
||||
*/
|
||||
function stringify_typed_array_elements(type, buffer) {
|
||||
const array = new /** @type {any} */ (globalThis)[type](buffer);
|
||||
|
||||
if (type === 'BigInt64Array' || type === 'BigUint64Array') {
|
||||
return Array.from(array, (element) => `${element}n`).join(',');
|
||||
}
|
||||
|
||||
// Float arrays can hold `-0`, which `toString()` collapses to `"0"`, silently
|
||||
// losing the sign on round-trip. Emit `-0` explicitly for those elements.
|
||||
if (
|
||||
array instanceof Float32Array ||
|
||||
array instanceof Float64Array ||
|
||||
(typeof Float16Array !== 'undefined' && array instanceof Float16Array)
|
||||
) {
|
||||
return Array.from(array, (element) => (Object.is(element, -0) ? '-0' : `${element}`)).join(',');
|
||||
}
|
||||
|
||||
return array.toString();
|
||||
}
|
||||
|
||||
/** @param {string} c */
|
||||
function escape_unsafe_char(c) {
|
||||
return escaped[c] || c;
|
||||
}
|
||||
|
||||
/** @param {string} str */
|
||||
function escape_unsafe_chars(str) {
|
||||
return str.replace(unsafe_chars, escape_unsafe_char);
|
||||
}
|
||||
|
||||
/** @param {string} key */
|
||||
function safe_key(key) {
|
||||
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key) ? key : escape_unsafe_chars(JSON.stringify(key));
|
||||
}
|
||||
|
||||
/** @param {string} key */
|
||||
function safe_prop(key) {
|
||||
return /^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(key)
|
||||
? `.${key}`
|
||||
: `[${escape_unsafe_chars(JSON.stringify(key))}]`;
|
||||
}
|
||||
|
||||
/** @param {any} thing */
|
||||
function stringify_primitive(thing) {
|
||||
const type = typeof thing;
|
||||
if (type === 'string') return stringify_string(thing);
|
||||
if (thing === void 0) return 'void 0';
|
||||
if (thing === 0 && 1 / thing < 0) return '-0';
|
||||
const str = String(thing);
|
||||
if (type === 'number') return str.replace(/^(-)?0\./, '$1.');
|
||||
if (type === 'bigint') return thing + 'n';
|
||||
return str;
|
||||
}
|
||||
+297
@@ -0,0 +1,297 @@
|
||||
import { MAX_ARRAY_INDEX, MAX_ARRAY_LEN } from './constants.js';
|
||||
|
||||
const name_chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
|
||||
const reserved_names =
|
||||
/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
|
||||
|
||||
/** @type {Record<string, string>} */
|
||||
export const escaped = {
|
||||
'<': '\\u003C',
|
||||
'\\': '\\\\',
|
||||
'\b': '\\b',
|
||||
'\f': '\\f',
|
||||
'\n': '\\n',
|
||||
'\r': '\\r',
|
||||
'\t': '\\t',
|
||||
'\u2028': '\\u2028',
|
||||
'\u2029': '\\u2029'
|
||||
};
|
||||
|
||||
export class DevalueError extends Error {
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {string[]} keys
|
||||
* @param {any} [value] - The value that failed to be serialized
|
||||
* @param {any} [root] - The root value being serialized
|
||||
*/
|
||||
constructor(message, keys, value, root) {
|
||||
super(message);
|
||||
this.name = 'DevalueError';
|
||||
this.path = keys.join('');
|
||||
this.value = value;
|
||||
this.root = root;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a Map key on the path being serialized. The key itself is recorded
|
||||
* right after the marker, so nothing is formatted or allocated per entry.
|
||||
*/
|
||||
export const MAP_KEY = Symbol();
|
||||
|
||||
/**
|
||||
* Formats the path recorded on the way to the value being serialized — a
|
||||
* property key, an array index, or `MAP_KEY` followed by a Map key — into
|
||||
* the segments a `DevalueError` joins. Only runs when an error is raised.
|
||||
* @param {any[]} keys
|
||||
* @param {(key: any) => string} format_map_key
|
||||
* @returns {string[]}
|
||||
*/
|
||||
export function format_path(keys, format_map_key) {
|
||||
/** @type {string[]} */
|
||||
const path = [];
|
||||
|
||||
for (let i = 0; i < keys.length; i += 1) {
|
||||
const segment = keys[i];
|
||||
|
||||
if (segment === MAP_KEY) {
|
||||
path.push(`.get(${format_map_key(keys[++i])})`);
|
||||
} else if (typeof segment === 'number') {
|
||||
path.push(`[${segment}]`);
|
||||
} else {
|
||||
path.push(stringify_key(segment));
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/** @param {any} thing */
|
||||
export function is_primitive(thing) {
|
||||
return thing === null || (typeof thing !== 'object' && typeof thing !== 'function');
|
||||
}
|
||||
|
||||
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype)
|
||||
.sort()
|
||||
.join('\0');
|
||||
|
||||
/** @param {any} thing */
|
||||
export function is_plain_object(thing) {
|
||||
const proto = Object.getPrototypeOf(thing);
|
||||
|
||||
return (
|
||||
proto === Object.prototype ||
|
||||
proto === null ||
|
||||
Object.getPrototypeOf(proto) === null ||
|
||||
Object.getOwnPropertyNames(proto).sort().join('\0') === object_proto_names
|
||||
);
|
||||
}
|
||||
|
||||
/** @param {any} thing */
|
||||
export function get_type(thing) {
|
||||
return Object.prototype.toString.call(thing).slice(8, -1);
|
||||
}
|
||||
|
||||
/** @param {any} thing */
|
||||
export function is_buffer(thing) {
|
||||
return typeof Buffer !== 'undefined' && Buffer.isBuffer(thing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit an array whose storage is not proportional to its declared length.
|
||||
* Touching and deleting the largest valid index forces dictionary elements
|
||||
* before setting the length; assigning .length on [] can still eagerly allocate.
|
||||
* @param {number} length
|
||||
*/
|
||||
export function stringify_sparse_array(length) {
|
||||
return `(function(a){a[${MAX_ARRAY_INDEX}]=0;delete a[${MAX_ARRAY_INDEX}];a.length=${length};return a}([]))`;
|
||||
}
|
||||
|
||||
/** Returns the compact JavaScript identifier at `index`. @param {number} index */
|
||||
export function get_name(index) {
|
||||
let name = '';
|
||||
|
||||
do {
|
||||
name = name_chars[index % name_chars.length] + name;
|
||||
index = ~~(index / name_chars.length) - 1;
|
||||
} while (index >= 0);
|
||||
|
||||
return reserved_names.test(name) ? `${name}0` : name;
|
||||
}
|
||||
|
||||
/** @param {string} char */
|
||||
function get_escaped_char(char) {
|
||||
switch (char) {
|
||||
case '"':
|
||||
return '\\"';
|
||||
case '<':
|
||||
return '\\u003C';
|
||||
case '\\':
|
||||
return '\\\\';
|
||||
case '\n':
|
||||
return '\\n';
|
||||
case '\r':
|
||||
return '\\r';
|
||||
case '\t':
|
||||
return '\\t';
|
||||
case '\b':
|
||||
return '\\b';
|
||||
case '\f':
|
||||
return '\\f';
|
||||
case '\u2028':
|
||||
return '\\u2028';
|
||||
case '\u2029':
|
||||
return '\\u2029';
|
||||
default:
|
||||
return char < ' ' ? `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}` : '';
|
||||
}
|
||||
}
|
||||
|
||||
// characters `stringify_string` always escapes: quote, backslash, `<`, control
|
||||
// characters and the line/paragraph separators. Surrogates are only escaped
|
||||
// when unpaired, which `isWellFormed` detects natively, so well-formed pairs
|
||||
// such as emoji stay on the fast path
|
||||
const needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
|
||||
|
||||
/** @param {string} str */
|
||||
export function stringify_string(str) {
|
||||
// the common case: nothing to escape, no per-character work
|
||||
if (!needs_escape.test(str) && str.isWellFormed()) return `"${str}"`;
|
||||
|
||||
let result = '';
|
||||
let last_pos = 0;
|
||||
const len = str.length;
|
||||
|
||||
for (let i = 0; i < len; i += 1) {
|
||||
const code = str.charCodeAt(i);
|
||||
if (code >= 0xd800 && code <= 0xdfff) {
|
||||
// A well-formed surrogate pair passes through untouched; an unpaired
|
||||
// surrogate cannot survive UTF-8 transport, so it is escaped.
|
||||
if (code <= 0xdbff && i + 1 < len && (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
result += str.slice(last_pos, i) + `\\u${code.toString(16)}`;
|
||||
last_pos = i + 1;
|
||||
continue;
|
||||
}
|
||||
const replacement = get_escaped_char(str[i]);
|
||||
if (replacement) {
|
||||
result += str.slice(last_pos, i) + replacement;
|
||||
last_pos = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
|
||||
}
|
||||
|
||||
// Property names repeat across the values of one call and across calls, so
|
||||
// their quoted form is cached. Names come from the data being serialized, so
|
||||
// the cache is bounded in both directions: only short names are kept, and the
|
||||
// cache is emptied once it holds 1024 of them. Longer names are quoted on
|
||||
// every visit, like every other string.
|
||||
const MAX_CACHED_KEY_LENGTH = 64;
|
||||
|
||||
/** @type {Map<string, string>} */
|
||||
const quoted_keys = new Map();
|
||||
|
||||
/** @param {string} key */
|
||||
export function quote_key(key) {
|
||||
if (key.length > MAX_CACHED_KEY_LENGTH) return stringify_string(key);
|
||||
|
||||
let quoted = quoted_keys.get(key);
|
||||
|
||||
if (quoted === undefined) {
|
||||
if (quoted_keys.size >= 1024) quoted_keys.clear();
|
||||
quoted = stringify_string(key);
|
||||
quoted_keys.set(key, quoted);
|
||||
}
|
||||
|
||||
return quoted;
|
||||
}
|
||||
|
||||
/** @param {Record<string | symbol, any>} object */
|
||||
export function enumerable_symbols(object) {
|
||||
const symbols = Object.getOwnPropertySymbols(object);
|
||||
// Own symbols always have a descriptor; the optional chain only satisfies the lib's
|
||||
// `PropertyDescriptor | undefined` return type.
|
||||
return symbols.length === 0
|
||||
? symbols
|
||||
: symbols.filter((symbol) => Object.getOwnPropertyDescriptor(object, symbol)?.enumerable);
|
||||
}
|
||||
|
||||
const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
||||
|
||||
/** @param {string} key */
|
||||
export function stringify_key(key) {
|
||||
return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';
|
||||
}
|
||||
|
||||
/** @param {number} n */
|
||||
export function is_valid_array_index(n) {
|
||||
if (!Number.isInteger(n)) return false;
|
||||
if (n < 0) return false;
|
||||
if (n > MAX_ARRAY_INDEX) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @param {number} n */
|
||||
export function is_valid_array_len(n) {
|
||||
if (!Number.isInteger(n)) return false;
|
||||
if (n < 0) return false;
|
||||
if (n > MAX_ARRAY_LEN) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @param {string} s */
|
||||
function is_valid_array_index_string(s) {
|
||||
if (s.length === 0) return false;
|
||||
if (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const c = s.charCodeAt(i);
|
||||
if (c < 48 || c > 57) return false;
|
||||
}
|
||||
// by this point we know it's a string of digits, but it has to be within
|
||||
// the range of valid array indices
|
||||
return is_valid_array_index(+s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the leading run of valid array indices in `keys`.
|
||||
* @param {readonly string[]} keys
|
||||
*/
|
||||
function array_index_cut(keys) {
|
||||
for (var i = keys.length - 1; i >= 0; i--) {
|
||||
if (is_valid_array_index_string(keys[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the populated indices of an array.
|
||||
* @param {unknown[]} array
|
||||
*/
|
||||
export function valid_array_indices(array) {
|
||||
const keys = Object.keys(array);
|
||||
keys.length = array_index_cut(keys);
|
||||
return keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the own enumerable string keys of an array-like value, in property
|
||||
* order, returns the leading run of them that are valid array indices.
|
||||
*
|
||||
* This is the filtering half of the `indicesOf` stringify operation,
|
||||
* exposed so that custom operations — which typically already have the keys
|
||||
* in hand, e.g. from a foreign runtime — don't have to reimplement it.
|
||||
*
|
||||
* Does not modify `keys`.
|
||||
*
|
||||
* @param {readonly string[]} keys
|
||||
* @returns {string[]}
|
||||
*/
|
||||
export function filter_array_indices(keys) {
|
||||
return keys.slice(0, array_index_cut(keys));
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fromCodePoint = void 0;
|
||||
exports.replaceCodePoint = replaceCodePoint;
|
||||
exports.decodeCodePoint = decodeCodePoint;
|
||||
const decodeMap = new Map([
|
||||
[0, 65533],
|
||||
// C1 Unicode control character reference replacements
|
||||
[128, 8364],
|
||||
[130, 8218],
|
||||
[131, 402],
|
||||
[132, 8222],
|
||||
[133, 8230],
|
||||
[134, 8224],
|
||||
[135, 8225],
|
||||
[136, 710],
|
||||
[137, 8240],
|
||||
[138, 352],
|
||||
[139, 8249],
|
||||
[140, 338],
|
||||
[142, 381],
|
||||
[145, 8216],
|
||||
[146, 8217],
|
||||
[147, 8220],
|
||||
[148, 8221],
|
||||
[149, 8226],
|
||||
[150, 8211],
|
||||
[151, 8212],
|
||||
[152, 732],
|
||||
[153, 8482],
|
||||
[154, 353],
|
||||
[155, 8250],
|
||||
[156, 339],
|
||||
[158, 382],
|
||||
[159, 376],
|
||||
]);
|
||||
/**
|
||||
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
|
||||
*/
|
||||
exports.fromCodePoint =
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, n/no-unsupported-features/es-builtins
|
||||
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : ((codePoint) => {
|
||||
let output = "";
|
||||
if (codePoint > 65535) {
|
||||
codePoint -= 65536;
|
||||
output += String.fromCharCode(((codePoint >>> 10) & 1023) | 55296);
|
||||
codePoint = 56320 | (codePoint & 1023);
|
||||
}
|
||||
output += String.fromCharCode(codePoint);
|
||||
return output;
|
||||
});
|
||||
/**
|
||||
* Replace the given code point with a replacement character if it is a
|
||||
* surrogate or is outside the valid range. Otherwise return the code
|
||||
* point unchanged.
|
||||
*/
|
||||
function replaceCodePoint(codePoint) {
|
||||
var _a;
|
||||
if ((codePoint >= 55296 && codePoint <= 57343) ||
|
||||
codePoint > 1114111) {
|
||||
return 65533;
|
||||
}
|
||||
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
|
||||
}
|
||||
/**
|
||||
* Replace the code point if relevant, then convert it to a string.
|
||||
*
|
||||
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
|
||||
* @param codePoint The code point to decode.
|
||||
* @returns The decoded code point.
|
||||
*/
|
||||
function decodeCodePoint(codePoint) {
|
||||
return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
|
||||
}
|
||||
//# sourceMappingURL=decode-codepoint.js.map
|
||||
+568
@@ -0,0 +1,568 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.xmlDecodeTree = exports.htmlDecodeTree = exports.replaceCodePoint = exports.fromCodePoint = exports.decodeCodePoint = exports.EntityDecoder = exports.DecodingMode = void 0;
|
||||
exports.determineBranch = determineBranch;
|
||||
exports.decodeHTML = decodeHTML;
|
||||
exports.decodeHTMLAttribute = decodeHTMLAttribute;
|
||||
exports.decodeHTMLStrict = decodeHTMLStrict;
|
||||
exports.decodeXML = decodeXML;
|
||||
const decode_codepoint_js_1 = require("./decode-codepoint.js");
|
||||
const decode_data_html_js_1 = require("./generated/decode-data-html.js");
|
||||
const decode_data_xml_js_1 = require("./generated/decode-data-xml.js");
|
||||
const bin_trie_flags_js_1 = require("./internal/bin-trie-flags.js");
|
||||
var CharCodes;
|
||||
(function (CharCodes) {
|
||||
CharCodes[CharCodes["NUM"] = 35] = "NUM";
|
||||
CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
|
||||
CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
|
||||
CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
|
||||
CharCodes[CharCodes["NINE"] = 57] = "NINE";
|
||||
CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
|
||||
CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
|
||||
CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
|
||||
CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
|
||||
CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
|
||||
CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
|
||||
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
|
||||
})(CharCodes || (CharCodes = {}));
|
||||
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
|
||||
const TO_LOWER_BIT = 32;
|
||||
function isNumber(code) {
|
||||
return code >= CharCodes.ZERO && code <= CharCodes.NINE;
|
||||
}
|
||||
function isHexadecimalCharacter(code) {
|
||||
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_F) ||
|
||||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_F));
|
||||
}
|
||||
function isAsciiAlphaNumeric(code) {
|
||||
return ((code >= CharCodes.UPPER_A && code <= CharCodes.UPPER_Z) ||
|
||||
(code >= CharCodes.LOWER_A && code <= CharCodes.LOWER_Z) ||
|
||||
isNumber(code));
|
||||
}
|
||||
/**
|
||||
* Checks if the given character is a valid end character for an entity in an attribute.
|
||||
*
|
||||
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
|
||||
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
|
||||
*/
|
||||
function isEntityInAttributeInvalidEnd(code) {
|
||||
return code === CharCodes.EQUALS || isAsciiAlphaNumeric(code);
|
||||
}
|
||||
var EntityDecoderState;
|
||||
(function (EntityDecoderState) {
|
||||
EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
|
||||
EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
|
||||
EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
|
||||
EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
|
||||
EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
|
||||
})(EntityDecoderState || (EntityDecoderState = {}));
|
||||
var DecodingMode;
|
||||
(function (DecodingMode) {
|
||||
/** Entities in text nodes that can end with any character. */
|
||||
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
|
||||
/** Only allow entities terminated with a semicolon. */
|
||||
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
|
||||
/** Entities in attributes have limitations on ending characters. */
|
||||
DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
|
||||
})(DecodingMode || (exports.DecodingMode = DecodingMode = {}));
|
||||
/**
|
||||
* Token decoder with support of writing partial entities.
|
||||
*/
|
||||
class EntityDecoder {
|
||||
constructor(
|
||||
/** The tree used to decode entities. */
|
||||
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: False positive
|
||||
decodeTree,
|
||||
/**
|
||||
* The function that is called when a codepoint is decoded.
|
||||
*
|
||||
* For multi-byte named entities, this will be called multiple times,
|
||||
* with the second codepoint, and the same `consumed` value.
|
||||
*
|
||||
* @param codepoint The decoded codepoint.
|
||||
* @param consumed The number of bytes consumed by the decoder.
|
||||
*/
|
||||
emitCodePoint,
|
||||
/** An object that is used to produce errors. */
|
||||
errors) {
|
||||
this.decodeTree = decodeTree;
|
||||
this.emitCodePoint = emitCodePoint;
|
||||
this.errors = errors;
|
||||
/** The current state of the decoder. */
|
||||
this.state = EntityDecoderState.EntityStart;
|
||||
/** Characters that were consumed while parsing an entity. */
|
||||
this.consumed = 1;
|
||||
/**
|
||||
* The result of the entity.
|
||||
*
|
||||
* Either the result index of a numeric entity, or the codepoint of a
|
||||
* numeric entity.
|
||||
*/
|
||||
this.result = 0;
|
||||
/** The current index in the decode tree. */
|
||||
this.treeIndex = 0;
|
||||
/** The number of characters that were consumed in excess. */
|
||||
this.excess = 1;
|
||||
/** The mode in which the decoder is operating. */
|
||||
this.decodeMode = DecodingMode.Strict;
|
||||
/** The number of characters that have been consumed in the current run. */
|
||||
this.runConsumed = 0;
|
||||
}
|
||||
/** Resets the instance to make it reusable. */
|
||||
startEntity(decodeMode) {
|
||||
this.decodeMode = decodeMode;
|
||||
this.state = EntityDecoderState.EntityStart;
|
||||
this.result = 0;
|
||||
this.treeIndex = 0;
|
||||
this.excess = 1;
|
||||
this.consumed = 1;
|
||||
this.runConsumed = 0;
|
||||
}
|
||||
/**
|
||||
* Write an entity to the decoder. This can be called multiple times with partial entities.
|
||||
* If the entity is incomplete, the decoder will return -1.
|
||||
*
|
||||
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
|
||||
* entity is incomplete, and resume when the next string is written.
|
||||
*
|
||||
* @param input The string containing the entity (or a continuation of the entity).
|
||||
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
||||
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
||||
*/
|
||||
write(input, offset) {
|
||||
switch (this.state) {
|
||||
case EntityDecoderState.EntityStart: {
|
||||
if (input.charCodeAt(offset) === CharCodes.NUM) {
|
||||
this.state = EntityDecoderState.NumericStart;
|
||||
this.consumed += 1;
|
||||
return this.stateNumericStart(input, offset + 1);
|
||||
}
|
||||
this.state = EntityDecoderState.NamedEntity;
|
||||
return this.stateNamedEntity(input, offset);
|
||||
}
|
||||
case EntityDecoderState.NumericStart: {
|
||||
return this.stateNumericStart(input, offset);
|
||||
}
|
||||
case EntityDecoderState.NumericDecimal: {
|
||||
return this.stateNumericDecimal(input, offset);
|
||||
}
|
||||
case EntityDecoderState.NumericHex: {
|
||||
return this.stateNumericHex(input, offset);
|
||||
}
|
||||
case EntityDecoderState.NamedEntity: {
|
||||
return this.stateNamedEntity(input, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Switches between the numeric decimal and hexadecimal states.
|
||||
*
|
||||
* Equivalent to the `Numeric character reference state` in the HTML spec.
|
||||
*
|
||||
* @param input The string containing the entity (or a continuation of the entity).
|
||||
* @param offset The current offset.
|
||||
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
||||
*/
|
||||
stateNumericStart(input, offset) {
|
||||
if (offset >= input.length) {
|
||||
return -1;
|
||||
}
|
||||
if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
|
||||
this.state = EntityDecoderState.NumericHex;
|
||||
this.consumed += 1;
|
||||
return this.stateNumericHex(input, offset + 1);
|
||||
}
|
||||
this.state = EntityDecoderState.NumericDecimal;
|
||||
return this.stateNumericDecimal(input, offset);
|
||||
}
|
||||
/**
|
||||
* Parses a hexadecimal numeric entity.
|
||||
*
|
||||
* Equivalent to the `Hexademical character reference state` in the HTML spec.
|
||||
*
|
||||
* @param input The string containing the entity (or a continuation of the entity).
|
||||
* @param offset The current offset.
|
||||
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
||||
*/
|
||||
stateNumericHex(input, offset) {
|
||||
while (offset < input.length) {
|
||||
const char = input.charCodeAt(offset);
|
||||
if (isNumber(char) || isHexadecimalCharacter(char)) {
|
||||
// Convert hex digit to value (0-15); 'a'/'A' -> 10.
|
||||
const digit = char <= CharCodes.NINE
|
||||
? char - CharCodes.ZERO
|
||||
: (char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10;
|
||||
this.result = this.result * 16 + digit;
|
||||
this.consumed++;
|
||||
offset++;
|
||||
}
|
||||
else {
|
||||
return this.emitNumericEntity(char, 3);
|
||||
}
|
||||
}
|
||||
return -1; // Incomplete entity
|
||||
}
|
||||
/**
|
||||
* Parses a decimal numeric entity.
|
||||
*
|
||||
* Equivalent to the `Decimal character reference state` in the HTML spec.
|
||||
*
|
||||
* @param input The string containing the entity (or a continuation of the entity).
|
||||
* @param offset The current offset.
|
||||
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
||||
*/
|
||||
stateNumericDecimal(input, offset) {
|
||||
while (offset < input.length) {
|
||||
const char = input.charCodeAt(offset);
|
||||
if (isNumber(char)) {
|
||||
this.result = this.result * 10 + (char - CharCodes.ZERO);
|
||||
this.consumed++;
|
||||
offset++;
|
||||
}
|
||||
else {
|
||||
return this.emitNumericEntity(char, 2);
|
||||
}
|
||||
}
|
||||
return -1; // Incomplete entity
|
||||
}
|
||||
/**
|
||||
* Validate and emit a numeric entity.
|
||||
*
|
||||
* Implements the logic from the `Hexademical character reference start
|
||||
* state` and `Numeric character reference end state` in the HTML spec.
|
||||
*
|
||||
* @param lastCp The last code point of the entity. Used to see if the
|
||||
* entity was terminated with a semicolon.
|
||||
* @param expectedLength The minimum number of characters that should be
|
||||
* consumed. Used to validate that at least one digit
|
||||
* was consumed.
|
||||
* @returns The number of characters that were consumed.
|
||||
*/
|
||||
emitNumericEntity(lastCp, expectedLength) {
|
||||
var _a;
|
||||
// Ensure we consumed at least one digit.
|
||||
if (this.consumed <= expectedLength) {
|
||||
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
||||
return 0;
|
||||
}
|
||||
// Figure out if this is a legit end of the entity
|
||||
if (lastCp === CharCodes.SEMI) {
|
||||
this.consumed += 1;
|
||||
}
|
||||
else if (this.decodeMode === DecodingMode.Strict) {
|
||||
return 0;
|
||||
}
|
||||
this.emitCodePoint((0, decode_codepoint_js_1.replaceCodePoint)(this.result), this.consumed);
|
||||
if (this.errors) {
|
||||
if (lastCp !== CharCodes.SEMI) {
|
||||
this.errors.missingSemicolonAfterCharacterReference();
|
||||
}
|
||||
this.errors.validateNumericCharacterReference(this.result);
|
||||
}
|
||||
return this.consumed;
|
||||
}
|
||||
/**
|
||||
* Parses a named entity.
|
||||
*
|
||||
* Equivalent to the `Named character reference state` in the HTML spec.
|
||||
*
|
||||
* @param input The string containing the entity (or a continuation of the entity).
|
||||
* @param offset The current offset.
|
||||
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
||||
*/
|
||||
stateNamedEntity(input, offset) {
|
||||
const { decodeTree } = this;
|
||||
let current = decodeTree[this.treeIndex];
|
||||
// The length is the number of bytes of the value, including the current byte.
|
||||
let valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
|
||||
while (offset < input.length) {
|
||||
// Handle compact runs (possibly inline): valueLength == 0 and SEMI_REQUIRED bit set.
|
||||
if (valueLength === 0 && (current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) {
|
||||
const runLength = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7; /* 2..63 */
|
||||
// If we are starting a run, check the first char.
|
||||
if (this.runConsumed === 0) {
|
||||
const firstChar = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE;
|
||||
if (input.charCodeAt(offset) !== firstChar) {
|
||||
return this.result === 0
|
||||
? 0
|
||||
: this.emitNotTerminatedNamedEntity();
|
||||
}
|
||||
offset++;
|
||||
this.excess++;
|
||||
this.runConsumed++;
|
||||
}
|
||||
// Check remaining characters in the run.
|
||||
while (this.runConsumed < runLength) {
|
||||
if (offset >= input.length) {
|
||||
return -1;
|
||||
}
|
||||
const charIndexInPacked = this.runConsumed - 1;
|
||||
const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)];
|
||||
const expectedChar = charIndexInPacked % 2 === 0
|
||||
? packedWord & 0xff
|
||||
: (packedWord >> 8) & 0xff;
|
||||
if (input.charCodeAt(offset) !== expectedChar) {
|
||||
this.runConsumed = 0;
|
||||
return this.result === 0
|
||||
? 0
|
||||
: this.emitNotTerminatedNamedEntity();
|
||||
}
|
||||
offset++;
|
||||
this.excess++;
|
||||
this.runConsumed++;
|
||||
}
|
||||
this.runConsumed = 0;
|
||||
this.treeIndex += 1 + (runLength >> 1);
|
||||
current = decodeTree[this.treeIndex];
|
||||
valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
|
||||
}
|
||||
if (offset >= input.length)
|
||||
break;
|
||||
const char = input.charCodeAt(offset);
|
||||
/*
|
||||
* Implicit semicolon handling for nodes that require a semicolon but
|
||||
* don't have an explicit ';' branch stored in the trie. If we have
|
||||
* a value on the current node, it requires a semicolon, and the
|
||||
* current input character is a semicolon, emit the entity using the
|
||||
* current node (without descending further).
|
||||
*/
|
||||
if (char === CharCodes.SEMI &&
|
||||
valueLength !== 0 &&
|
||||
(current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) !== 0) {
|
||||
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
||||
}
|
||||
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
|
||||
if (this.treeIndex < 0) {
|
||||
return this.result === 0 ||
|
||||
// If we are parsing an attribute
|
||||
(this.decodeMode === DecodingMode.Attribute &&
|
||||
// We shouldn't have consumed any characters after the entity,
|
||||
(valueLength === 0 ||
|
||||
// And there should be no invalid characters.
|
||||
isEntityInAttributeInvalidEnd(char)))
|
||||
? 0
|
||||
: this.emitNotTerminatedNamedEntity();
|
||||
}
|
||||
current = decodeTree[this.treeIndex];
|
||||
valueLength = (current & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
|
||||
// If the branch is a value, store it and continue
|
||||
if (valueLength !== 0) {
|
||||
// If the entity is terminated by a semicolon, we are done.
|
||||
if (char === CharCodes.SEMI) {
|
||||
return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
||||
}
|
||||
// If we encounter a non-terminated (legacy) entity while parsing strictly, then ignore it.
|
||||
if (this.decodeMode !== DecodingMode.Strict &&
|
||||
(current & bin_trie_flags_js_1.BinTrieFlags.FLAG13) === 0) {
|
||||
this.result = this.treeIndex;
|
||||
this.consumed += this.excess;
|
||||
this.excess = 0;
|
||||
}
|
||||
}
|
||||
// Increment offset & excess for next iteration
|
||||
offset++;
|
||||
this.excess++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Emit a named entity that was not terminated with a semicolon.
|
||||
*
|
||||
* @returns The number of characters consumed.
|
||||
*/
|
||||
emitNotTerminatedNamedEntity() {
|
||||
var _a;
|
||||
const { result, decodeTree } = this;
|
||||
const valueLength = (decodeTree[result] & bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH) >> 14;
|
||||
this.emitNamedEntityData(result, valueLength, this.consumed);
|
||||
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.missingSemicolonAfterCharacterReference();
|
||||
return this.consumed;
|
||||
}
|
||||
/**
|
||||
* Emit a named entity.
|
||||
*
|
||||
* @param result The index of the entity in the decode tree.
|
||||
* @param valueLength The number of bytes in the entity.
|
||||
* @param consumed The number of characters consumed.
|
||||
*
|
||||
* @returns The number of characters consumed.
|
||||
*/
|
||||
emitNamedEntityData(result, valueLength, consumed) {
|
||||
const { decodeTree } = this;
|
||||
this.emitCodePoint(valueLength === 1
|
||||
? decodeTree[result] &
|
||||
~(bin_trie_flags_js_1.BinTrieFlags.VALUE_LENGTH | bin_trie_flags_js_1.BinTrieFlags.FLAG13)
|
||||
: decodeTree[result + 1], consumed);
|
||||
if (valueLength === 3) {
|
||||
// For multi-byte values, we need to emit the second byte.
|
||||
this.emitCodePoint(decodeTree[result + 2], consumed);
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
/**
|
||||
* Signal to the parser that the end of the input was reached.
|
||||
*
|
||||
* Remaining data will be emitted and relevant errors will be produced.
|
||||
*
|
||||
* @returns The number of characters consumed.
|
||||
*/
|
||||
end() {
|
||||
var _a;
|
||||
switch (this.state) {
|
||||
case EntityDecoderState.NamedEntity: {
|
||||
// Emit a named entity if we have one.
|
||||
return this.result !== 0 &&
|
||||
(this.decodeMode !== DecodingMode.Attribute ||
|
||||
this.result === this.treeIndex)
|
||||
? this.emitNotTerminatedNamedEntity()
|
||||
: 0;
|
||||
}
|
||||
// Otherwise, emit a numeric entity if we have one.
|
||||
case EntityDecoderState.NumericDecimal: {
|
||||
return this.emitNumericEntity(0, 2);
|
||||
}
|
||||
case EntityDecoderState.NumericHex: {
|
||||
return this.emitNumericEntity(0, 3);
|
||||
}
|
||||
case EntityDecoderState.NumericStart: {
|
||||
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
||||
return 0;
|
||||
}
|
||||
case EntityDecoderState.EntityStart: {
|
||||
// Return 0 if we have no entity.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.EntityDecoder = EntityDecoder;
|
||||
/**
|
||||
* Creates a function that decodes entities in a string.
|
||||
*
|
||||
* @param decodeTree The decode tree.
|
||||
* @returns A function that decodes entities in a string.
|
||||
*/
|
||||
function getDecoder(decodeTree) {
|
||||
let returnValue = "";
|
||||
const decoder = new EntityDecoder(decodeTree, (data) => (returnValue += (0, decode_codepoint_js_1.fromCodePoint)(data)));
|
||||
return function decodeWithTrie(input, decodeMode) {
|
||||
let lastIndex = 0;
|
||||
let offset = 0;
|
||||
while ((offset = input.indexOf("&", offset)) >= 0) {
|
||||
returnValue += input.slice(lastIndex, offset);
|
||||
decoder.startEntity(decodeMode);
|
||||
const length = decoder.write(input,
|
||||
// Skip the "&"
|
||||
offset + 1);
|
||||
if (length < 0) {
|
||||
lastIndex = offset + decoder.end();
|
||||
break;
|
||||
}
|
||||
lastIndex = offset + length;
|
||||
// If `length` is 0, skip the current `&` and continue.
|
||||
offset = length === 0 ? lastIndex + 1 : lastIndex;
|
||||
}
|
||||
const result = returnValue + input.slice(lastIndex);
|
||||
// Make sure we don't keep a reference to the final string.
|
||||
returnValue = "";
|
||||
return result;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Determines the branch of the current node that is taken given the current
|
||||
* character. This function is used to traverse the trie.
|
||||
*
|
||||
* @param decodeTree The trie.
|
||||
* @param current The current node.
|
||||
* @param nodeIdx The index right after the current node and its value.
|
||||
* @param char The current character.
|
||||
* @returns The index of the next node, or -1 if no branch is taken.
|
||||
*/
|
||||
function determineBranch(decodeTree, current, nodeIndex, char) {
|
||||
const branchCount = (current & bin_trie_flags_js_1.BinTrieFlags.BRANCH_LENGTH) >> 7;
|
||||
const jumpOffset = current & bin_trie_flags_js_1.BinTrieFlags.JUMP_TABLE;
|
||||
// Case 1: Single branch encoded in jump offset
|
||||
if (branchCount === 0) {
|
||||
return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
|
||||
}
|
||||
// Case 2: Multiple branches encoded in jump table
|
||||
if (jumpOffset) {
|
||||
const value = char - jumpOffset;
|
||||
return value < 0 || value >= branchCount
|
||||
? -1
|
||||
: decodeTree[nodeIndex + value] - 1;
|
||||
}
|
||||
// Case 3: Multiple branches encoded in packed dictionary (two keys per uint16)
|
||||
const packedKeySlots = (branchCount + 1) >> 1;
|
||||
/*
|
||||
* Treat packed keys as a virtual sorted array of length `branchCount`.
|
||||
* Key(i) = low byte for even i, high byte for odd i in slot i>>1.
|
||||
*/
|
||||
let lo = 0;
|
||||
let hi = branchCount - 1;
|
||||
while (lo <= hi) {
|
||||
const mid = (lo + hi) >>> 1;
|
||||
const slot = mid >> 1;
|
||||
const packed = decodeTree[nodeIndex + slot];
|
||||
const midKey = (packed >> ((mid & 1) * 8)) & 0xff;
|
||||
if (midKey < char) {
|
||||
lo = mid + 1;
|
||||
}
|
||||
else if (midKey > char) {
|
||||
hi = mid - 1;
|
||||
}
|
||||
else {
|
||||
return decodeTree[nodeIndex + packedKeySlots + mid];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
const htmlDecoder = /* #__PURE__ */ getDecoder(decode_data_html_js_1.htmlDecodeTree);
|
||||
const xmlDecoder = /* #__PURE__ */ getDecoder(decode_data_xml_js_1.xmlDecodeTree);
|
||||
/**
|
||||
* Decodes an HTML string.
|
||||
*
|
||||
* @param htmlString The string to decode.
|
||||
* @param mode The decoding mode.
|
||||
* @returns The decoded string.
|
||||
*/
|
||||
function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
|
||||
return htmlDecoder(htmlString, mode);
|
||||
}
|
||||
/**
|
||||
* Decodes an HTML string in an attribute.
|
||||
*
|
||||
* @param htmlAttribute The string to decode.
|
||||
* @returns The decoded string.
|
||||
*/
|
||||
function decodeHTMLAttribute(htmlAttribute) {
|
||||
return htmlDecoder(htmlAttribute, DecodingMode.Attribute);
|
||||
}
|
||||
/**
|
||||
* Decodes an HTML string, requiring all entities to be terminated by a semicolon.
|
||||
*
|
||||
* @param htmlString The string to decode.
|
||||
* @returns The decoded string.
|
||||
*/
|
||||
function decodeHTMLStrict(htmlString) {
|
||||
return htmlDecoder(htmlString, DecodingMode.Strict);
|
||||
}
|
||||
/**
|
||||
* Decodes an XML string, requiring all entities to be terminated by a semicolon.
|
||||
*
|
||||
* @param xmlString The string to decode.
|
||||
* @returns The decoded string.
|
||||
*/
|
||||
function decodeXML(xmlString) {
|
||||
return xmlDecoder(xmlString, DecodingMode.Strict);
|
||||
}
|
||||
var decode_codepoint_js_2 = require("./decode-codepoint.js");
|
||||
Object.defineProperty(exports, "decodeCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.decodeCodePoint; } });
|
||||
Object.defineProperty(exports, "fromCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.fromCodePoint; } });
|
||||
Object.defineProperty(exports, "replaceCodePoint", { enumerable: true, get: function () { return decode_codepoint_js_2.replaceCodePoint; } });
|
||||
// Re-export for use by eg. htmlparser2
|
||||
var decode_data_html_js_2 = require("./generated/decode-data-html.js");
|
||||
Object.defineProperty(exports, "htmlDecodeTree", { enumerable: true, get: function () { return decode_data_html_js_2.htmlDecodeTree; } });
|
||||
var decode_data_xml_js_2 = require("./generated/decode-data-xml.js");
|
||||
Object.defineProperty(exports, "xmlDecodeTree", { enumerable: true, get: function () { return decode_data_xml_js_2.xmlDecodeTree; } });
|
||||
//# sourceMappingURL=decode.js.map
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
// Generated using scripts/write-decode-map.ts
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.xmlDecodeTree = void 0;
|
||||
const decode_shared_js_1 = require("../internal/decode-shared.js");
|
||||
exports.xmlDecodeTree = (0, decode_shared_js_1.decodeBase64)("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");
|
||||
//# sourceMappingURL=decode-data-xml.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user