@sonordev/site-kit 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +16 -6
- package/README.md +9 -7
- package/agent-manifest.json +7 -7
- package/dist/AnalyticsProvider-6PXC7UDP.js +32 -0
- package/dist/{AnalyticsProvider-Y2P2BPOI.js.map → AnalyticsProvider-6PXC7UDP.js.map} +1 -1
- package/dist/AnalyticsProvider-FVQIYSLY.mjs +11 -0
- package/dist/{AnalyticsProvider-2XIOMRCN.mjs.map → AnalyticsProvider-FVQIYSLY.mjs.map} +1 -1
- package/dist/{BlogViewTracker-6EGEDPP3.js → BlogViewTracker-S4HSRCW7.js} +6 -6
- package/dist/{BlogViewTracker-6EGEDPP3.js.map → BlogViewTracker-S4HSRCW7.js.map} +1 -1
- package/dist/{BlogViewTracker-R4YQ76WP.mjs → BlogViewTracker-ZUGLBOVI.mjs} +5 -5
- package/dist/{BlogViewTracker-R4YQ76WP.mjs.map → BlogViewTracker-ZUGLBOVI.mjs.map} +1 -1
- package/dist/ChatWidget-2TQWCXWP.js +22 -0
- package/dist/{ChatWidget-2OFWPCWF.js.map → ChatWidget-2TQWCXWP.js.map} +1 -1
- package/dist/ChatWidget-DG52ZIE6.mjs +13 -0
- package/dist/{ChatWidget-4AOGHYXQ.mjs.map → ChatWidget-DG52ZIE6.mjs.map} +1 -1
- package/dist/EngageWidget-2VUJADIU.mjs +12 -0
- package/dist/{EngageWidget-SFO2XRNG.mjs.map → EngageWidget-2VUJADIU.mjs.map} +1 -1
- package/dist/EngageWidget-Z7RC2INM.js +21 -0
- package/dist/{EngageWidget-T4KAAD3G.js.map → EngageWidget-Z7RC2INM.js.map} +1 -1
- package/dist/{FileField-7DF2SLPF.mjs → FileField-FSQ7W3A5.mjs} +5 -5
- package/dist/{FileField-7DF2SLPF.mjs.map → FileField-FSQ7W3A5.mjs.map} +1 -1
- package/dist/{FileField-CE2XNBBG.js → FileField-UOQHL25J.js} +6 -6
- package/dist/{FileField-CE2XNBBG.js.map → FileField-UOQHL25J.js.map} +1 -1
- package/dist/{FormSpotlight-IRLKSZGV.mjs → FormSpotlight-RHL5FWM2.mjs} +3 -3
- package/dist/{FormSpotlight-IRLKSZGV.mjs.map → FormSpotlight-RHL5FWM2.mjs.map} +1 -1
- package/dist/{FormSpotlight-ZD3WR5BC.js → FormSpotlight-TED32NHP.js} +15 -15
- package/dist/{FormSpotlight-ZD3WR5BC.js.map → FormSpotlight-TED32NHP.js.map} +1 -1
- package/dist/{FormStage-2OSRNQJL.mjs → FormStage-DINIRFOX.mjs} +3 -3
- package/dist/{FormStage-2OSRNQJL.mjs.map → FormStage-DINIRFOX.mjs.map} +1 -1
- package/dist/{FormStage-OSPXOUQE.js → FormStage-PFEBKHGY.js} +13 -13
- package/dist/{FormStage-OSPXOUQE.js.map → FormStage-PFEBKHGY.js.map} +1 -1
- package/dist/ManagedForm-43WLCUAK.js +23 -0
- package/dist/{ManagedForm-JCHGBBQW.js.map → ManagedForm-43WLCUAK.js.map} +1 -1
- package/dist/ManagedForm-545YAUFC.mjs +14 -0
- package/dist/{ManagedForm-5G37EDJT.mjs.map → ManagedForm-545YAUFC.mjs.map} +1 -1
- package/dist/{ManagedNewsletterForm-4LVJZROZ.js → ManagedNewsletterForm-I3QN57HB.js} +8 -8
- package/dist/{ManagedNewsletterForm-4LVJZROZ.js.map → ManagedNewsletterForm-I3QN57HB.js.map} +1 -1
- package/dist/{ManagedNewsletterForm-QJSVH23S.mjs → ManagedNewsletterForm-ZPY5RRKX.mjs} +7 -7
- package/dist/{ManagedNewsletterForm-QJSVH23S.mjs.map → ManagedNewsletterForm-ZPY5RRKX.mjs.map} +1 -1
- package/dist/{SignalCore-L6Z3YTCF.mjs → SignalCore-EEH5IM4U.mjs} +5 -5
- package/dist/{SignalCore-L6Z3YTCF.mjs.map → SignalCore-EEH5IM4U.mjs.map} +1 -1
- package/dist/{SignalCore-NQ4YEOI7.js → SignalCore-M4AXIMV4.js} +11 -11
- package/dist/{SignalCore-NQ4YEOI7.js.map → SignalCore-M4AXIMV4.js.map} +1 -1
- package/dist/SitemapSync-46G7LVZS.mjs +9 -0
- package/dist/{SitemapSync-MYSTLJOM.mjs.map → SitemapSync-46G7LVZS.mjs.map} +1 -1
- package/dist/SitemapSync-XK4JKCS7.js +18 -0
- package/dist/{SitemapSync-3LUZWBTB.js.map → SitemapSync-XK4JKCS7.js.map} +1 -1
- package/dist/SitemapSync.d.ts +3 -2
- package/dist/SitemapSync.d.ts.map +1 -1
- package/dist/analytics/AnalyticsProvider.d.ts +3 -1
- package/dist/analytics/AnalyticsProvider.d.ts.map +1 -1
- package/dist/analytics/WebVitals.d.ts +3 -1
- package/dist/analytics/WebVitals.d.ts.map +1 -1
- package/dist/analytics/dispatch.d.ts +4 -4
- package/dist/analytics/index.js +19 -19
- package/dist/analytics/index.mjs +7 -7
- package/dist/analytics/send-gate.d.ts +8 -37
- package/dist/analytics/send-gate.d.ts.map +1 -1
- package/dist/{api-NTHZ6PAW.mjs → api-D745LGGU.mjs} +3 -3
- package/dist/api-D745LGGU.mjs.map +1 -0
- package/dist/{api-N5OLQXYN.js → api-XR5APCH3.js} +3 -3
- package/dist/api-XR5APCH3.js.map +1 -0
- package/dist/blog/index.js +20 -20
- package/dist/blog/index.mjs +3 -3
- package/dist/blog/server-ui.js +14 -14
- package/dist/blog/server-ui.mjs +2 -2
- package/dist/{chunk-HMFFAUCD.js → chunk-3DWIYCQX.js} +2 -2
- package/dist/chunk-3DWIYCQX.js.map +1 -0
- package/dist/{chunk-3EPMDPWI.js → chunk-3SDMJMN2.js} +5 -5
- package/dist/{chunk-3EPMDPWI.js.map → chunk-3SDMJMN2.js.map} +1 -1
- package/dist/{chunk-LIYSLNEK.mjs → chunk-473WDGQZ.mjs} +3 -3
- package/dist/{chunk-LIYSLNEK.mjs.map → chunk-473WDGQZ.mjs.map} +1 -1
- package/dist/chunk-4U5NCKQY.mjs +39 -0
- package/dist/chunk-4U5NCKQY.mjs.map +1 -0
- package/dist/{chunk-ITFZZ6YT.js → chunk-53KMRZT7.js} +3 -3
- package/dist/{chunk-ITFZZ6YT.js.map → chunk-53KMRZT7.js.map} +1 -1
- package/dist/{chunk-N6AVWMIB.mjs → chunk-5KIEZHVK.mjs} +19 -18
- package/dist/chunk-5KIEZHVK.mjs.map +1 -0
- package/dist/{chunk-ZLPXFV5Y.js → chunk-5KIO6FXE.js} +5 -5
- package/dist/{chunk-ZLPXFV5Y.js.map → chunk-5KIO6FXE.js.map} +1 -1
- package/dist/chunk-5RNAUYWE.js +50 -0
- package/dist/chunk-5RNAUYWE.js.map +1 -0
- package/dist/{chunk-ACTLQ2RH.mjs → chunk-5UFDHGFE.mjs} +4 -4
- package/dist/chunk-5UFDHGFE.mjs.map +1 -0
- package/dist/{chunk-RO55G3OA.mjs → chunk-64BOVMXG.mjs} +3 -3
- package/dist/{chunk-RO55G3OA.mjs.map → chunk-64BOVMXG.mjs.map} +1 -1
- package/dist/{chunk-G5I3XEQS.mjs → chunk-6OP5XSMM.mjs} +3 -3
- package/dist/{chunk-G5I3XEQS.mjs.map → chunk-6OP5XSMM.mjs.map} +1 -1
- package/dist/{chunk-7Y2UPFSY.mjs → chunk-7AUDKXY5.mjs} +3 -3
- package/dist/{chunk-7Y2UPFSY.mjs.map → chunk-7AUDKXY5.mjs.map} +1 -1
- package/dist/{chunk-A2VLEORI.mjs → chunk-7C7XO5HX.mjs} +3 -3
- package/dist/{chunk-A2VLEORI.mjs.map → chunk-7C7XO5HX.mjs.map} +1 -1
- package/dist/chunk-A6UYV475.mjs +45 -0
- package/dist/chunk-A6UYV475.mjs.map +1 -0
- package/dist/{chunk-SZHKNGNR.mjs → chunk-AEARU24Q.mjs} +40 -26
- package/dist/chunk-AEARU24Q.mjs.map +1 -0
- package/dist/{chunk-ZDFVYSKK.mjs → chunk-AHZR4VGY.mjs} +5 -5
- package/dist/{chunk-ZDFVYSKK.mjs.map → chunk-AHZR4VGY.mjs.map} +1 -1
- package/dist/{chunk-4WQB2ORG.js → chunk-AY7JBGYC.js} +15 -15
- package/dist/chunk-AY7JBGYC.js.map +1 -0
- package/dist/{chunk-5737U6DI.js → chunk-B64AZC6P.js} +15 -15
- package/dist/{chunk-5737U6DI.js.map → chunk-B64AZC6P.js.map} +1 -1
- package/dist/{chunk-ZY5AVC4P.js → chunk-B6O7D5U4.js} +55 -49
- package/dist/chunk-B6O7D5U4.js.map +1 -0
- package/dist/{chunk-LHYVFWHL.js → chunk-BWSMUSDB.js} +8 -8
- package/dist/{chunk-LHYVFWHL.js.map → chunk-BWSMUSDB.js.map} +1 -1
- package/dist/{chunk-WSUQ76LN.js → chunk-BZLIOT7Q.js} +18 -18
- package/dist/{chunk-WSUQ76LN.js.map → chunk-BZLIOT7Q.js.map} +1 -1
- package/dist/{chunk-HH5KGXTK.mjs → chunk-C2MSD2UM.mjs} +4 -4
- package/dist/{chunk-HH5KGXTK.mjs.map → chunk-C2MSD2UM.mjs.map} +1 -1
- package/dist/{chunk-DPDV5Z4G.js → chunk-CQRLKNHQ.js} +12 -12
- package/dist/{chunk-DPDV5Z4G.js.map → chunk-CQRLKNHQ.js.map} +1 -1
- package/dist/{chunk-SJXGIUHP.mjs → chunk-CQS5ZYI6.mjs} +22 -9
- package/dist/chunk-CQS5ZYI6.mjs.map +1 -0
- package/dist/{chunk-LUYUFILE.js → chunk-DHIWR7CG.js} +4 -4
- package/dist/{chunk-LUYUFILE.js.map → chunk-DHIWR7CG.js.map} +1 -1
- package/dist/chunk-DQUBETXH.mjs +6 -0
- package/dist/{chunk-7U7C6XRI.mjs.map → chunk-DQUBETXH.mjs.map} +1 -1
- package/dist/chunk-ESP5RMB7.js +42 -0
- package/dist/chunk-ESP5RMB7.js.map +1 -0
- package/dist/chunk-G6WF4G3E.js +43 -0
- package/dist/chunk-G6WF4G3E.js.map +1 -0
- package/dist/{chunk-XWF7QPIP.mjs → chunk-GJ6NOLGC.mjs} +3 -3
- package/dist/{chunk-XWF7QPIP.mjs.map → chunk-GJ6NOLGC.mjs.map} +1 -1
- package/dist/{chunk-MTANHZKJ.mjs → chunk-GPLCPMVD.mjs} +7 -7
- package/dist/{chunk-MTANHZKJ.mjs.map → chunk-GPLCPMVD.mjs.map} +1 -1
- package/dist/{chunk-QWLL3B6U.js → chunk-H3D3ZGOJ.js} +26 -23
- package/dist/chunk-H3D3ZGOJ.js.map +1 -0
- package/dist/{chunk-NUH245XK.mjs → chunk-H44XZUOV.mjs} +16 -13
- package/dist/chunk-H44XZUOV.mjs.map +1 -0
- package/dist/{chunk-MIFP6QEQ.mjs → chunk-HIHAXEPD.mjs} +4 -4
- package/dist/{chunk-MIFP6QEQ.mjs.map → chunk-HIHAXEPD.mjs.map} +1 -1
- package/dist/{chunk-UOLY4NXK.mjs → chunk-IYCLN3XS.mjs} +15 -34
- package/dist/chunk-IYCLN3XS.mjs.map +1 -0
- package/dist/{chunk-HBMF3M5F.js → chunk-JE5DWAE6.js} +4 -4
- package/dist/{chunk-HBMF3M5F.js.map → chunk-JE5DWAE6.js.map} +1 -1
- package/dist/{chunk-KQ3VAOAF.mjs → chunk-JNABXCLY.mjs} +4 -4
- package/dist/{chunk-KQ3VAOAF.mjs.map → chunk-JNABXCLY.mjs.map} +1 -1
- package/dist/{chunk-3TXX5KIN.js → chunk-JNRHTZL4.js} +2 -2
- package/dist/{chunk-3TXX5KIN.js.map → chunk-JNRHTZL4.js.map} +1 -1
- package/dist/{chunk-I4PDSDVE.mjs → chunk-K2V3ZW36.mjs} +3 -3
- package/dist/{chunk-I4PDSDVE.mjs.map → chunk-K2V3ZW36.mjs.map} +1 -1
- package/dist/{chunk-L2LJQIM3.js → chunk-KPKQKFT4.js} +11 -11
- package/dist/chunk-KPKQKFT4.js.map +1 -0
- package/dist/chunk-KSL3WA2I.js +8 -0
- package/dist/{chunk-UTOHMK52.js.map → chunk-KSL3WA2I.js.map} +1 -1
- package/dist/{chunk-VWDT7H6L.js → chunk-KY6M76JW.js} +3 -3
- package/dist/{chunk-VWDT7H6L.js.map → chunk-KY6M76JW.js.map} +1 -1
- package/dist/{chunk-EBMPXFOP.mjs → chunk-LCSYJXIO.mjs} +3 -3
- package/dist/{chunk-EBMPXFOP.mjs.map → chunk-LCSYJXIO.mjs.map} +1 -1
- package/dist/{chunk-AWFZIXCT.js → chunk-N2PGTPWN.js} +25 -12
- package/dist/chunk-N2PGTPWN.js.map +1 -0
- package/dist/chunk-NSWO43XW.mjs +39 -0
- package/dist/chunk-NSWO43XW.mjs.map +1 -0
- package/dist/{chunk-KMGGAL2X.js → chunk-NZSFOZJV.js} +40 -26
- package/dist/chunk-NZSFOZJV.js.map +1 -0
- package/dist/{chunk-JJ26JKBJ.mjs → chunk-OA7KKOAK.mjs} +25 -31
- package/dist/chunk-OA7KKOAK.mjs.map +1 -0
- package/dist/{chunk-GQ6CUOLA.js → chunk-OC7AO7XS.js} +15 -15
- package/dist/{chunk-GQ6CUOLA.js.map → chunk-OC7AO7XS.js.map} +1 -1
- package/dist/{chunk-HDDV63XJ.mjs → chunk-QNPVVWR7.mjs} +3 -3
- package/dist/{chunk-HDDV63XJ.mjs.map → chunk-QNPVVWR7.mjs.map} +1 -1
- package/dist/{chunk-URVGBWCP.js → chunk-R3KTBKSW.js} +4 -4
- package/dist/{chunk-URVGBWCP.js.map → chunk-R3KTBKSW.js.map} +1 -1
- package/dist/{chunk-6CUBSQMD.mjs → chunk-RIYAMYLV.mjs} +3 -3
- package/dist/{chunk-6CUBSQMD.mjs.map → chunk-RIYAMYLV.mjs.map} +1 -1
- package/dist/{chunk-B4BFQSSS.mjs → chunk-RU54J2PY.mjs} +4 -4
- package/dist/chunk-RU54J2PY.mjs.map +1 -0
- package/dist/{chunk-7IPSQ5JR.js → chunk-S4RC6VAQ.js} +21 -20
- package/dist/chunk-S4RC6VAQ.js.map +1 -0
- package/dist/{chunk-3DPXOZAU.mjs → chunk-SHLWA6JY.mjs} +2 -2
- package/dist/chunk-SHLWA6JY.mjs.map +1 -0
- package/dist/{chunk-OXZYP32B.js → chunk-SYGGZZMU.js} +21 -17
- package/dist/chunk-SYGGZZMU.js.map +1 -0
- package/dist/{chunk-LF4L3ZP5.js → chunk-T5VTQUNF.js} +8 -8
- package/dist/{chunk-LF4L3ZP5.js.map → chunk-T5VTQUNF.js.map} +1 -1
- package/dist/{chunk-UOTXSWKZ.mjs → chunk-TP7H6BSK.mjs} +2 -2
- package/dist/{chunk-UOTXSWKZ.mjs.map → chunk-TP7H6BSK.mjs.map} +1 -1
- package/dist/{chunk-N6X76QUF.mjs → chunk-USKIL6V6.mjs} +3 -3
- package/dist/{chunk-N6X76QUF.mjs.map → chunk-USKIL6V6.mjs.map} +1 -1
- package/dist/{chunk-2KIGFOPM.js → chunk-UU47DGHE.js} +25 -44
- package/dist/chunk-UU47DGHE.js.map +1 -0
- package/dist/{chunk-B36PTS7B.mjs → chunk-VHZ4LHQT.mjs} +48 -42
- package/dist/chunk-VHZ4LHQT.mjs.map +1 -0
- package/dist/{chunk-7PLH3H3W.js → chunk-X5TCH7VZ.js} +3 -3
- package/dist/{chunk-7PLH3H3W.js.map → chunk-X5TCH7VZ.js.map} +1 -1
- package/dist/{chunk-LBS4PRC7.js → chunk-XK5AIWQG.js} +3 -3
- package/dist/{chunk-LBS4PRC7.js.map → chunk-XK5AIWQG.js.map} +1 -1
- package/dist/{chunk-U53KN4SA.js → chunk-XR32C47O.js} +26 -32
- package/dist/chunk-XR32C47O.js.map +1 -0
- package/dist/{chunk-DQM5GR2P.mjs → chunk-YCI36ZUS.mjs} +18 -14
- package/dist/chunk-YCI36ZUS.mjs.map +1 -0
- package/dist/{chunk-VA36CJRV.js → chunk-YYN4YZYZ.js} +4 -4
- package/dist/{chunk-VA36CJRV.js.map → chunk-YYN4YZYZ.js.map} +1 -1
- package/dist/cli/agent/checks.d.ts.map +1 -1
- package/dist/cli/agent/ssr-bailout.d.ts +27 -0
- package/dist/cli/agent/ssr-bailout.d.ts.map +1 -0
- package/dist/cli/agent/ssr-bailout.test.d.ts +2 -0
- package/dist/cli/agent/ssr-bailout.test.d.ts.map +1 -0
- package/dist/cli/api/{uptrade.d.ts → sonor.d.ts} +3 -2
- package/dist/cli/api/sonor.d.ts.map +1 -0
- package/dist/cli/codemod/transforms.d.ts.map +1 -1
- package/dist/cli/commands/config-regression.test.d.ts +2 -0
- package/dist/cli/commands/config-regression.test.d.ts.map +1 -0
- package/dist/cli/commands/faqs.d.ts.map +1 -1
- package/dist/cli/commands/images.d.ts.map +1 -1
- package/dist/cli/commands/locations.d.ts.map +1 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/config.d.ts +31 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.test.d.ts +2 -0
- package/dist/cli/config.test.d.ts.map +1 -0
- package/dist/cli/index.js +494 -518
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +487 -511
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/migrator/index.d.ts +1 -0
- package/dist/cli/migrator/index.d.ts.map +1 -1
- package/dist/cli/state.d.ts +7 -0
- package/dist/cli/state.d.ts.map +1 -0
- package/dist/cli/state.test.d.ts +2 -0
- package/dist/cli/state.test.d.ts.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +20 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +5 -4
- package/dist/client/index.mjs.map +1 -1
- package/dist/cms/index.js.map +1 -1
- package/dist/cms/index.mjs.map +1 -1
- package/dist/cms/sanity-image.d.ts +1 -1
- package/dist/commerce/index.js +59 -59
- package/dist/commerce/index.mjs +8 -8
- package/dist/engage/ChatWidget.d.ts.map +1 -1
- package/dist/engage/EngageWidget.d.ts +4 -4
- package/dist/engage/EngageWidget.d.ts.map +1 -1
- package/dist/engage/chat-launcher.test.d.ts +2 -0
- package/dist/engage/chat-launcher.test.d.ts.map +1 -0
- package/dist/engage/index.js +13 -10
- package/dist/engage/index.js.map +1 -1
- package/dist/engage/index.mjs +10 -7
- package/dist/engage/index.mjs.map +1 -1
- package/dist/engage/launcher-placement.d.ts +56 -0
- package/dist/engage/launcher-placement.d.ts.map +1 -0
- package/dist/engage/launcher-placement.test.d.ts +2 -0
- package/dist/engage/launcher-placement.test.d.ts.map +1 -0
- package/dist/engage/types.d.ts +41 -7
- package/dist/engage/types.d.ts.map +1 -1
- package/dist/fleet/FleetHeartbeat.d.ts +3 -2
- package/dist/fleet/FleetHeartbeat.d.ts.map +1 -1
- package/dist/fleet/heartbeat.d.ts +3 -2
- package/dist/fleet/heartbeat.d.ts.map +1 -1
- package/dist/fleet/heartbeat.test.d.ts +2 -0
- package/dist/fleet/heartbeat.test.d.ts.map +1 -0
- package/dist/fleet/index.js +9 -8
- package/dist/fleet/index.mjs +5 -4
- package/dist/forms/index.js +16 -16
- package/dist/forms/index.mjs +9 -9
- package/dist/forms/server.js +10 -10
- package/dist/forms/server.mjs +8 -8
- package/dist/forms/static.js +7 -7
- package/dist/forms/static.mjs +6 -6
- package/dist/images/ManagedImage.d.ts.map +1 -1
- package/dist/images/index.js +11 -11
- package/dist/images/index.mjs +4 -4
- package/dist/index.js +66 -66
- package/dist/index.mjs +12 -12
- package/dist/layout/SiteKitClientProviders.d.ts.map +1 -1
- package/dist/layout/client.d.ts.map +1 -1
- package/dist/layout/client.js +9 -8
- package/dist/layout/client.mjs +8 -7
- package/dist/layout/index.js +11 -10
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +9 -8
- package/dist/layout/index.mjs.map +1 -1
- package/dist/layout/types.d.ts +9 -3
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/llms/generateLLMsTxt.d.ts.map +1 -1
- package/dist/llms/index.js +12 -12
- package/dist/llms/index.mjs +2 -2
- package/dist/llms/types.d.ts +7 -1
- package/dist/llms/types.d.ts.map +1 -1
- package/dist/maps/index.js +5 -5
- package/dist/maps/index.mjs +3 -3
- package/dist/mcp/WebMcpTools.d.ts +5 -2
- package/dist/mcp/WebMcpTools.d.ts.map +1 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/client.mjs.map +1 -1
- package/dist/search/index.js +4 -4
- package/dist/search/index.mjs +3 -3
- package/dist/seo/LocationPageContent.d.ts +6 -5
- package/dist/seo/LocationPageContent.d.ts.map +1 -1
- package/dist/seo/api.d.ts +4 -5
- package/dist/seo/api.d.ts.map +1 -1
- package/dist/seo/client.js +6 -6
- package/dist/seo/client.mjs +5 -5
- package/dist/seo/index.js +43 -43
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +9 -9
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/routing.d.ts +9 -23
- package/dist/seo/routing.d.ts.map +1 -1
- package/dist/seo/server-api.d.ts +11 -5
- package/dist/seo/server-api.d.ts.map +1 -1
- package/dist/seo/server.js +18 -18
- package/dist/seo/server.mjs +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/{server-api-HW4PL2L2.mjs → server-api-RG3ZL3DV.mjs} +3 -3
- package/dist/{server-api-HW4PL2L2.mjs.map → server-api-RG3ZL3DV.mjs.map} +1 -1
- package/dist/{server-api-DB2SIUP4.js → server-api-RYJQAUGO.js} +21 -21
- package/dist/{server-api-DB2SIUP4.js.map → server-api-RYJQAUGO.js.map} +1 -1
- package/dist/shared/reporting-gate.d.ts +43 -0
- package/dist/shared/reporting-gate.d.ts.map +1 -0
- package/dist/shared/version.d.ts +1 -1
- package/dist/shared/visual-viewport-gap.d.ts +52 -0
- package/dist/shared/visual-viewport-gap.d.ts.map +1 -0
- package/dist/shared/visual-viewport-gap.test.d.ts +2 -0
- package/dist/shared/visual-viewport-gap.test.d.ts.map +1 -0
- package/dist/signal/index.js +11 -11
- package/dist/signal/index.mjs +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sitemap/index.mjs +1 -1
- package/dist/sync/AddToCalendar.d.ts +19 -0
- package/dist/sync/AddToCalendar.d.ts.map +1 -0
- package/dist/sync/BookingWidget.d.ts.map +1 -1
- package/dist/sync/add-to-calendar.test.d.ts +2 -0
- package/dist/sync/add-to-calendar.test.d.ts.map +1 -0
- package/dist/sync/api-errors.test.d.ts +2 -0
- package/dist/sync/api-errors.test.d.ts.map +1 -0
- package/dist/sync/api.d.ts.map +1 -1
- package/dist/sync/index.js +17 -17
- package/dist/sync/index.mjs +4 -4
- package/dist/sync/types.d.ts +14 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/skills/site-kit/SKILL.md +8 -3
- package/dist/AnalyticsProvider-2XIOMRCN.mjs +0 -11
- package/dist/AnalyticsProvider-Y2P2BPOI.js +0 -32
- package/dist/ChatWidget-2OFWPCWF.js +0 -20
- package/dist/ChatWidget-4AOGHYXQ.mjs +0 -11
- package/dist/EngageWidget-SFO2XRNG.mjs +0 -9
- package/dist/EngageWidget-T4KAAD3G.js +0 -18
- package/dist/ManagedForm-5G37EDJT.mjs +0 -14
- package/dist/ManagedForm-JCHGBBQW.js +0 -23
- package/dist/SitemapSync-3LUZWBTB.js +0 -18
- package/dist/SitemapSync-MYSTLJOM.mjs +0 -9
- package/dist/api-N5OLQXYN.js.map +0 -1
- package/dist/api-NTHZ6PAW.mjs.map +0 -1
- package/dist/chunk-2KIGFOPM.js.map +0 -1
- package/dist/chunk-3DPXOZAU.mjs.map +0 -1
- package/dist/chunk-4WQB2ORG.js.map +0 -1
- package/dist/chunk-7IPSQ5JR.js.map +0 -1
- package/dist/chunk-7U7C6XRI.mjs +0 -6
- package/dist/chunk-ACTLQ2RH.mjs.map +0 -1
- package/dist/chunk-AWFZIXCT.js.map +0 -1
- package/dist/chunk-B36PTS7B.mjs.map +0 -1
- package/dist/chunk-B4BFQSSS.mjs.map +0 -1
- package/dist/chunk-DQM5GR2P.mjs.map +0 -1
- package/dist/chunk-HMFFAUCD.js.map +0 -1
- package/dist/chunk-JJ26JKBJ.mjs.map +0 -1
- package/dist/chunk-KMGGAL2X.js.map +0 -1
- package/dist/chunk-L2LJQIM3.js.map +0 -1
- package/dist/chunk-N6AVWMIB.mjs.map +0 -1
- package/dist/chunk-NUH245XK.mjs.map +0 -1
- package/dist/chunk-NVSWTDWU.mjs +0 -25
- package/dist/chunk-NVSWTDWU.mjs.map +0 -1
- package/dist/chunk-OL2QBWAU.js +0 -29
- package/dist/chunk-OL2QBWAU.js.map +0 -1
- package/dist/chunk-OXZYP32B.js.map +0 -1
- package/dist/chunk-QWLL3B6U.js.map +0 -1
- package/dist/chunk-SJXGIUHP.mjs.map +0 -1
- package/dist/chunk-SZHKNGNR.mjs.map +0 -1
- package/dist/chunk-U53KN4SA.js.map +0 -1
- package/dist/chunk-UOLY4NXK.mjs.map +0 -1
- package/dist/chunk-UTOHMK52.js +0 -8
- package/dist/chunk-ZY5AVC4P.js.map +0 -1
- package/dist/cli/api/uptrade.d.ts.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -6,11 +6,11 @@ var chunkI7AZC5ZQ_js = require('../chunk-I7AZC5ZQ.js');
|
|
|
6
6
|
var chunk6CJP7BFM_js = require('../chunk-6CJP7BFM.js');
|
|
7
7
|
var chunkNN2YE5WT_js = require('../chunk-NN2YE5WT.js');
|
|
8
8
|
var chunkLOS5D6B3_js = require('../chunk-LOS5D6B3.js');
|
|
9
|
-
var
|
|
9
|
+
var chunkKSL3WA2I_js = require('../chunk-KSL3WA2I.js');
|
|
10
10
|
var chunkSNAQBZPT_js = require('../chunk-SNAQBZPT.js');
|
|
11
11
|
var events = require('events');
|
|
12
12
|
var childProcess = require('child_process');
|
|
13
|
-
var
|
|
13
|
+
var path12 = require('path');
|
|
14
14
|
var fs = require('fs');
|
|
15
15
|
var process2 = require('process');
|
|
16
16
|
var util = require('util');
|
|
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
var childProcess__default = /*#__PURE__*/_interopDefault(childProcess);
|
|
51
|
-
var
|
|
51
|
+
var path12__default = /*#__PURE__*/_interopDefault(path12);
|
|
52
52
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
53
53
|
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
54
54
|
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
@@ -6234,10 +6234,10 @@ var require_lib2 = chunkSNAQBZPT_js.__commonJS({
|
|
|
6234
6234
|
exports.analyse = analyse;
|
|
6235
6235
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
6236
6236
|
let fd;
|
|
6237
|
-
const
|
|
6237
|
+
const fs29 = (0, node_1.default)();
|
|
6238
6238
|
const handler = (err, buffer) => {
|
|
6239
6239
|
if (fd) {
|
|
6240
|
-
|
|
6240
|
+
fs29.closeSync(fd);
|
|
6241
6241
|
}
|
|
6242
6242
|
if (err) {
|
|
6243
6243
|
reject(err);
|
|
@@ -6249,9 +6249,9 @@ var require_lib2 = chunkSNAQBZPT_js.__commonJS({
|
|
|
6249
6249
|
};
|
|
6250
6250
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
6251
6251
|
if (sampleSize > 0) {
|
|
6252
|
-
fd =
|
|
6252
|
+
fd = fs29.openSync(filepath, "r");
|
|
6253
6253
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
6254
|
-
|
|
6254
|
+
fs29.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
6255
6255
|
if (err) {
|
|
6256
6256
|
handler(err, null);
|
|
6257
6257
|
} else {
|
|
@@ -6263,22 +6263,22 @@ var require_lib2 = chunkSNAQBZPT_js.__commonJS({
|
|
|
6263
6263
|
});
|
|
6264
6264
|
return;
|
|
6265
6265
|
}
|
|
6266
|
-
|
|
6266
|
+
fs29.readFile(filepath, handler);
|
|
6267
6267
|
});
|
|
6268
6268
|
exports.detectFile = detectFile;
|
|
6269
6269
|
var detectFileSync = (filepath, opts = {}) => {
|
|
6270
|
-
const
|
|
6270
|
+
const fs29 = (0, node_1.default)();
|
|
6271
6271
|
if (opts && opts.sampleSize) {
|
|
6272
|
-
const fd =
|
|
6272
|
+
const fd = fs29.openSync(filepath, "r");
|
|
6273
6273
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
6274
|
-
const bytesRead =
|
|
6274
|
+
const bytesRead = fs29.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
6275
6275
|
if (bytesRead < opts.sampleSize) {
|
|
6276
6276
|
sample = sample.subarray(0, bytesRead);
|
|
6277
6277
|
}
|
|
6278
|
-
|
|
6278
|
+
fs29.closeSync(fd);
|
|
6279
6279
|
return (0, exports.detect)(sample);
|
|
6280
6280
|
}
|
|
6281
|
-
return (0, exports.detect)(
|
|
6281
|
+
return (0, exports.detect)(fs29.readFileSync(filepath));
|
|
6282
6282
|
};
|
|
6283
6283
|
exports.detectFileSync = detectFileSync;
|
|
6284
6284
|
exports.default = {
|
|
@@ -10167,7 +10167,7 @@ var require_run_async = chunkSNAQBZPT_js.__commonJS({
|
|
|
10167
10167
|
});
|
|
10168
10168
|
|
|
10169
10169
|
// src/cli/index.ts
|
|
10170
|
-
var
|
|
10170
|
+
var import_dotenv2 = chunkSNAQBZPT_js.__toESM(chunkNN2YE5WT_js.require_main());
|
|
10171
10171
|
|
|
10172
10172
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
10173
10173
|
var CommanderError = class extends Error {
|
|
@@ -12296,9 +12296,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
12296
12296
|
args = args.slice();
|
|
12297
12297
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
12298
12298
|
function findFile(baseDir, baseName) {
|
|
12299
|
-
const localBin =
|
|
12299
|
+
const localBin = path12__default.default.resolve(baseDir, baseName);
|
|
12300
12300
|
if (fs__namespace.default.existsSync(localBin)) return localBin;
|
|
12301
|
-
if (sourceExt.includes(
|
|
12301
|
+
if (sourceExt.includes(path12__default.default.extname(baseName))) return void 0;
|
|
12302
12302
|
const foundExt = sourceExt.find(
|
|
12303
12303
|
(ext2) => fs__namespace.default.existsSync(`${localBin}${ext2}`)
|
|
12304
12304
|
);
|
|
@@ -12316,17 +12316,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
12316
12316
|
} catch {
|
|
12317
12317
|
resolvedScriptPath = this._scriptPath;
|
|
12318
12318
|
}
|
|
12319
|
-
executableDir =
|
|
12320
|
-
|
|
12319
|
+
executableDir = path12__default.default.resolve(
|
|
12320
|
+
path12__default.default.dirname(resolvedScriptPath),
|
|
12321
12321
|
executableDir
|
|
12322
12322
|
);
|
|
12323
12323
|
}
|
|
12324
12324
|
if (executableDir) {
|
|
12325
12325
|
let localFile = findFile(executableDir, executableFile);
|
|
12326
12326
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
12327
|
-
const legacyName =
|
|
12327
|
+
const legacyName = path12__default.default.basename(
|
|
12328
12328
|
this._scriptPath,
|
|
12329
|
-
|
|
12329
|
+
path12__default.default.extname(this._scriptPath)
|
|
12330
12330
|
);
|
|
12331
12331
|
if (legacyName !== this._name) {
|
|
12332
12332
|
localFile = findFile(
|
|
@@ -12337,7 +12337,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
12337
12337
|
}
|
|
12338
12338
|
executableFile = localFile || executableFile;
|
|
12339
12339
|
}
|
|
12340
|
-
const launchWithNode = sourceExt.includes(
|
|
12340
|
+
const launchWithNode = sourceExt.includes(path12__default.default.extname(executableFile));
|
|
12341
12341
|
let proc;
|
|
12342
12342
|
if (process2__default.default.platform !== "win32") {
|
|
12343
12343
|
if (launchWithNode) {
|
|
@@ -13254,7 +13254,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
13254
13254
|
* @return {Command}
|
|
13255
13255
|
*/
|
|
13256
13256
|
nameFromFilename(filename) {
|
|
13257
|
-
this._name =
|
|
13257
|
+
this._name = path12__default.default.basename(filename, path12__default.default.extname(filename));
|
|
13258
13258
|
return this;
|
|
13259
13259
|
}
|
|
13260
13260
|
/**
|
|
@@ -13268,9 +13268,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
13268
13268
|
* @param {string} [path]
|
|
13269
13269
|
* @return {(string|null|Command)}
|
|
13270
13270
|
*/
|
|
13271
|
-
executableDir(
|
|
13272
|
-
if (
|
|
13273
|
-
this._executableDir =
|
|
13271
|
+
executableDir(path29) {
|
|
13272
|
+
if (path29 === void 0) return this._executableDir;
|
|
13273
|
+
this._executableDir = path29;
|
|
13274
13274
|
return this;
|
|
13275
13275
|
}
|
|
13276
13276
|
/**
|
|
@@ -13543,7 +13543,7 @@ function buildEnvelope(input, nowMs = Date.now()) {
|
|
|
13543
13543
|
ok: exitCode === 0 /* OK */,
|
|
13544
13544
|
command,
|
|
13545
13545
|
schemaVersion: 1,
|
|
13546
|
-
siteKitVersion:
|
|
13546
|
+
siteKitVersion: chunkKSL3WA2I_js.SITE_KIT_VERSION,
|
|
13547
13547
|
exitCode,
|
|
13548
13548
|
status: statusForCode(exitCode),
|
|
13549
13549
|
summary,
|
|
@@ -18779,7 +18779,7 @@ function createPrompt(view) {
|
|
|
18779
18779
|
if (nextView === void 0) {
|
|
18780
18780
|
let callerFilename = callSites[1]?.getFileName();
|
|
18781
18781
|
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
18782
|
-
callerFilename =
|
|
18782
|
+
callerFilename = path12__default.default.resolve(callerFilename);
|
|
18783
18783
|
}
|
|
18784
18784
|
throw new Error(`Prompt functions must return a string.
|
|
18785
18785
|
at ${callerFilename}`);
|
|
@@ -19168,13 +19168,13 @@ var ExternalEditor = class {
|
|
|
19168
19168
|
}
|
|
19169
19169
|
createTempFile() {
|
|
19170
19170
|
try {
|
|
19171
|
-
const baseDir =
|
|
19172
|
-
this.tempDir = fs.mkdtempSync(
|
|
19171
|
+
const baseDir = path12__default.default.resolve(this.fileOptions.dir ?? os__default.default.tmpdir());
|
|
19172
|
+
this.tempDir = fs.mkdtempSync(path12__default.default.join(baseDir, "inquirer-editor-"));
|
|
19173
19173
|
const id = crypto.randomUUID();
|
|
19174
19174
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
19175
19175
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
19176
19176
|
const filename = `${prefix}${id}${postfix}`;
|
|
19177
|
-
this.tempFile =
|
|
19177
|
+
this.tempFile = path12__default.default.join(this.tempDir, filename);
|
|
19178
19178
|
const opt = { encoding: "utf8", flag: "wx" };
|
|
19179
19179
|
if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
|
|
19180
19180
|
opt.mode = this.fileOptions.mode;
|
|
@@ -20377,9 +20377,9 @@ function observableToAsyncIterable(source) {
|
|
|
20377
20377
|
|
|
20378
20378
|
// node_modules/.pnpm/inquirer@14.0.2_@types+node@26.2.0/node_modules/inquirer/dist/ui/prompt.js
|
|
20379
20379
|
var _ = {
|
|
20380
|
-
set: (obj,
|
|
20380
|
+
set: (obj, path29 = "", value) => {
|
|
20381
20381
|
let pointer = obj;
|
|
20382
|
-
|
|
20382
|
+
path29.split(".").forEach((key, index, arr) => {
|
|
20383
20383
|
if (key === "__proto__" || key === "constructor")
|
|
20384
20384
|
return;
|
|
20385
20385
|
if (index === arr.length - 1) {
|
|
@@ -20390,8 +20390,8 @@ var _ = {
|
|
|
20390
20390
|
pointer = pointer[key];
|
|
20391
20391
|
});
|
|
20392
20392
|
},
|
|
20393
|
-
get: (obj,
|
|
20394
|
-
const travel = (regexp) => String.prototype.split.call(
|
|
20393
|
+
get: (obj, path29 = "", defaultValue) => {
|
|
20394
|
+
const travel = (regexp) => String.prototype.split.call(path29, regexp).filter(Boolean).reduce(
|
|
20395
20395
|
// @ts-expect-error implicit any on res[key]
|
|
20396
20396
|
(res, key) => res == null ? res : res[key],
|
|
20397
20397
|
obj
|
|
@@ -20681,7 +20681,7 @@ async function scanCodebase(rootDir) {
|
|
|
20681
20681
|
for (const file of files) {
|
|
20682
20682
|
try {
|
|
20683
20683
|
const content = await fs3__default.default.readFile(file, "utf-8");
|
|
20684
|
-
const relPath =
|
|
20684
|
+
const relPath = path12__default.default.relative(rootDir, file);
|
|
20685
20685
|
const ast = chunkI7AZC5ZQ_js.parse(content, {
|
|
20686
20686
|
sourceType: "module",
|
|
20687
20687
|
plugins: ["jsx", "typescript"]
|
|
@@ -20730,7 +20730,7 @@ async function scanCodebase(rootDir) {
|
|
|
20730
20730
|
async function findSourceFiles(dir, files = []) {
|
|
20731
20731
|
const entries = await fs3__default.default.readdir(dir, { withFileTypes: true });
|
|
20732
20732
|
for (const entry of entries) {
|
|
20733
|
-
const fullPath =
|
|
20733
|
+
const fullPath = path12__default.default.join(dir, entry.name);
|
|
20734
20734
|
if (entry.isDirectory()) {
|
|
20735
20735
|
if (["node_modules", ".next", ".git", "dist", "build"].includes(entry.name)) {
|
|
20736
20736
|
continue;
|
|
@@ -20748,18 +20748,18 @@ function scanForForms(ast, content, filePath) {
|
|
|
20748
20748
|
const forms = [];
|
|
20749
20749
|
content.split("\n");
|
|
20750
20750
|
chunkJS75ORH7_js.traverse(ast, {
|
|
20751
|
-
JSXElement(
|
|
20752
|
-
const opening =
|
|
20751
|
+
JSXElement(path29) {
|
|
20752
|
+
const opening = path29.node.openingElement;
|
|
20753
20753
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name) && opening.name.name === "form") {
|
|
20754
|
-
const fields = extractFieldsFromForm(
|
|
20754
|
+
const fields = extractFieldsFromForm(path29);
|
|
20755
20755
|
const hasOnSubmit = opening.attributes.some(
|
|
20756
20756
|
(attr) => chunkJS75ORH7_js.isJSXAttribute(attr) && chunkJS75ORH7_js.isJSXIdentifier(attr.name) && attr.name.name === "onSubmit"
|
|
20757
20757
|
);
|
|
20758
20758
|
if (hasOnSubmit && fields.length > 0) {
|
|
20759
|
-
const startLine =
|
|
20760
|
-
const endLine =
|
|
20759
|
+
const startLine = path29.node.loc?.start.line || 0;
|
|
20760
|
+
const endLine = path29.node.loc?.end.line || 0;
|
|
20761
20761
|
let componentName = "UnknownForm";
|
|
20762
|
-
let current =
|
|
20762
|
+
let current = path29.parentPath;
|
|
20763
20763
|
while (current) {
|
|
20764
20764
|
if (chunkJS75ORH7_js.isFunctionDeclaration(current.node) && current.node.id) {
|
|
20765
20765
|
componentName = current.node.id.name;
|
|
@@ -20792,7 +20792,7 @@ function scanForForms(ast, content, filePath) {
|
|
|
20792
20792
|
}
|
|
20793
20793
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name) && opening.name.name === "Form") {
|
|
20794
20794
|
if (content.includes("Formik") || content.includes("formik")) {
|
|
20795
|
-
const fields = extractFieldsFromFormik(
|
|
20795
|
+
const fields = extractFieldsFromFormik(path29);
|
|
20796
20796
|
if (fields.length > 0) {
|
|
20797
20797
|
forms.push({
|
|
20798
20798
|
filePath,
|
|
@@ -20803,8 +20803,8 @@ function scanForForms(ast, content, filePath) {
|
|
|
20803
20803
|
submitsTo: null,
|
|
20804
20804
|
complexity: "moderate",
|
|
20805
20805
|
suggestedAction: "assisted",
|
|
20806
|
-
startLine:
|
|
20807
|
-
endLine:
|
|
20806
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
20807
|
+
endLine: path29.node.loc?.end.line || 0
|
|
20808
20808
|
});
|
|
20809
20809
|
}
|
|
20810
20810
|
}
|
|
@@ -20822,8 +20822,8 @@ function extractFieldsFromForm(formPath) {
|
|
|
20822
20822
|
const radioGroups = /* @__PURE__ */ new Map();
|
|
20823
20823
|
const checkboxGroups = /* @__PURE__ */ new Map();
|
|
20824
20824
|
formPath.traverse({
|
|
20825
|
-
JSXElement(
|
|
20826
|
-
const opening =
|
|
20825
|
+
JSXElement(path29) {
|
|
20826
|
+
const opening = path29.node.openingElement;
|
|
20827
20827
|
const tagName = chunkJS75ORH7_js.isJSXIdentifier(opening.name) ? opening.name.name : null;
|
|
20828
20828
|
if (["input", "textarea", "select"].includes(tagName || "")) {
|
|
20829
20829
|
const attrs = opening.attributes;
|
|
@@ -20870,7 +20870,7 @@ function extractFieldsFromForm(formPath) {
|
|
|
20870
20870
|
}
|
|
20871
20871
|
if (tagName === "select") {
|
|
20872
20872
|
const selectOptions = [];
|
|
20873
|
-
|
|
20873
|
+
path29.traverse({
|
|
20874
20874
|
JSXElement(optionPath) {
|
|
20875
20875
|
const optOpening = optionPath.node.openingElement;
|
|
20876
20876
|
const optTagName = chunkJS75ORH7_js.isJSXIdentifier(optOpening.name) ? optOpening.name.name : null;
|
|
@@ -20945,8 +20945,8 @@ function extractFieldsFromForm(formPath) {
|
|
|
20945
20945
|
function extractFieldsFromFormik(formPath, content) {
|
|
20946
20946
|
const fields = [];
|
|
20947
20947
|
formPath.traverse({
|
|
20948
|
-
JSXElement(
|
|
20949
|
-
const opening =
|
|
20948
|
+
JSXElement(path29) {
|
|
20949
|
+
const opening = path29.node.openingElement;
|
|
20950
20950
|
const tagName = chunkJS75ORH7_js.isJSXIdentifier(opening.name) ? opening.name.name : null;
|
|
20951
20951
|
if (tagName === "Field" || tagName === "FastField") {
|
|
20952
20952
|
const attrs = opening.attributes;
|
|
@@ -21065,11 +21065,11 @@ function scanForMetadata(ast, content, filePath) {
|
|
|
21065
21065
|
}
|
|
21066
21066
|
let hasHeadComponent = false;
|
|
21067
21067
|
chunkJS75ORH7_js.traverse(ast, {
|
|
21068
|
-
JSXElement(
|
|
21069
|
-
const opening =
|
|
21068
|
+
JSXElement(path29) {
|
|
21069
|
+
const opening = path29.node.openingElement;
|
|
21070
21070
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name) && opening.name.name === "Head") {
|
|
21071
21071
|
hasHeadComponent = true;
|
|
21072
|
-
|
|
21072
|
+
path29.stop();
|
|
21073
21073
|
}
|
|
21074
21074
|
}
|
|
21075
21075
|
});
|
|
@@ -21104,8 +21104,8 @@ function scanForWidgets(ast, content, filePath) {
|
|
|
21104
21104
|
for (const { pattern, type } of widgetPatterns) {
|
|
21105
21105
|
if (pattern.test(content)) {
|
|
21106
21106
|
chunkJS75ORH7_js.traverse(ast, {
|
|
21107
|
-
JSXElement(
|
|
21108
|
-
const opening =
|
|
21107
|
+
JSXElement(path29) {
|
|
21108
|
+
const opening = path29.node.openingElement;
|
|
21109
21109
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name) && (opening.name.name === "script" || opening.name.name === "Script")) {
|
|
21110
21110
|
const srcAttr = opening.attributes.find(
|
|
21111
21111
|
(attr) => chunkJS75ORH7_js.isJSXAttribute(attr) && chunkJS75ORH7_js.isJSXIdentifier(attr.name) && attr.name.name === "src"
|
|
@@ -21120,8 +21120,8 @@ function scanForWidgets(ast, content, filePath) {
|
|
|
21120
21120
|
filePath,
|
|
21121
21121
|
widgetType: type,
|
|
21122
21122
|
scriptTag: src,
|
|
21123
|
-
startLine:
|
|
21124
|
-
endLine:
|
|
21123
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
21124
|
+
endLine: path29.node.loc?.end.line || 0
|
|
21125
21125
|
});
|
|
21126
21126
|
}
|
|
21127
21127
|
}
|
|
@@ -21195,7 +21195,7 @@ async function scanForSitemapFiles(rootDir) {
|
|
|
21195
21195
|
"next-sitemap.config.ts"
|
|
21196
21196
|
];
|
|
21197
21197
|
for (const configPath of configPaths) {
|
|
21198
|
-
const fullPath =
|
|
21198
|
+
const fullPath = path12__default.default.join(rootDir, configPath);
|
|
21199
21199
|
try {
|
|
21200
21200
|
await fs3__default.default.access(fullPath);
|
|
21201
21201
|
const content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
@@ -21213,7 +21213,7 @@ async function scanForSitemapFiles(rootDir) {
|
|
|
21213
21213
|
} catch {
|
|
21214
21214
|
}
|
|
21215
21215
|
}
|
|
21216
|
-
const staticSitemapPath =
|
|
21216
|
+
const staticSitemapPath = path12__default.default.join(rootDir, "public", "sitemap.xml");
|
|
21217
21217
|
try {
|
|
21218
21218
|
await fs3__default.default.access(staticSitemapPath);
|
|
21219
21219
|
const content = await fs3__default.default.readFile(staticSitemapPath, "utf-8");
|
|
@@ -21236,7 +21236,7 @@ async function scanForSitemapFiles(rootDir) {
|
|
|
21236
21236
|
"out/sitemap.xml"
|
|
21237
21237
|
];
|
|
21238
21238
|
for (const genPath of generatedPaths) {
|
|
21239
|
-
const fullPath =
|
|
21239
|
+
const fullPath = path12__default.default.join(rootDir, genPath);
|
|
21240
21240
|
try {
|
|
21241
21241
|
await fs3__default.default.access(fullPath);
|
|
21242
21242
|
} catch {
|
|
@@ -21260,8 +21260,8 @@ function scanForSchemas(ast, content, filePath) {
|
|
|
21260
21260
|
return schemas;
|
|
21261
21261
|
}
|
|
21262
21262
|
chunkJS75ORH7_js.traverse(ast, {
|
|
21263
|
-
JSXElement(
|
|
21264
|
-
const opening =
|
|
21263
|
+
JSXElement(path29) {
|
|
21264
|
+
const opening = path29.node.openingElement;
|
|
21265
21265
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name) && (opening.name.name === "script" || opening.name.name === "Script")) {
|
|
21266
21266
|
const typeAttr = opening.attributes.find(
|
|
21267
21267
|
(attr) => chunkJS75ORH7_js.isJSXAttribute(attr) && chunkJS75ORH7_js.isJSXIdentifier(attr.name) && attr.name.name === "type"
|
|
@@ -21288,8 +21288,8 @@ function scanForSchemas(ast, content, filePath) {
|
|
|
21288
21288
|
filePath,
|
|
21289
21289
|
type: detectedType,
|
|
21290
21290
|
schemaType,
|
|
21291
|
-
startLine:
|
|
21292
|
-
endLine:
|
|
21291
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
21292
|
+
endLine: path29.node.loc?.end.line || 0
|
|
21293
21293
|
});
|
|
21294
21294
|
}
|
|
21295
21295
|
}
|
|
@@ -21322,8 +21322,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
21322
21322
|
/questions?\s*(?:and|&)?\s*answers?/i
|
|
21323
21323
|
];
|
|
21324
21324
|
chunkJS75ORH7_js.traverse(ast, {
|
|
21325
|
-
JSXElement(
|
|
21326
|
-
const opening =
|
|
21325
|
+
JSXElement(path29) {
|
|
21326
|
+
const opening = path29.node.openingElement;
|
|
21327
21327
|
let tagName = "";
|
|
21328
21328
|
if (chunkJS75ORH7_js.isJSXIdentifier(opening.name)) {
|
|
21329
21329
|
tagName = opening.name.name;
|
|
@@ -21336,8 +21336,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
21336
21336
|
faqs.push({
|
|
21337
21337
|
filePath,
|
|
21338
21338
|
type: "details-summary",
|
|
21339
|
-
startLine:
|
|
21340
|
-
endLine:
|
|
21339
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
21340
|
+
endLine: path29.node.loc?.end.line || 0,
|
|
21341
21341
|
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
21342
21342
|
});
|
|
21343
21343
|
return;
|
|
@@ -21345,7 +21345,7 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
21345
21345
|
for (const pattern of faqPatterns) {
|
|
21346
21346
|
if (pattern.test(tagName)) {
|
|
21347
21347
|
let itemCount = 0;
|
|
21348
|
-
|
|
21348
|
+
path29.traverse({
|
|
21349
21349
|
JSXElement(itemPath) {
|
|
21350
21350
|
const itemOpening = itemPath.node.openingElement;
|
|
21351
21351
|
if (chunkJS75ORH7_js.isJSXIdentifier(itemOpening.name)) {
|
|
@@ -21361,8 +21361,8 @@ function scanForFAQs(ast, content, filePath) {
|
|
|
21361
21361
|
type: "accordion",
|
|
21362
21362
|
componentName: tagName,
|
|
21363
21363
|
itemCount: itemCount || void 0,
|
|
21364
|
-
startLine:
|
|
21365
|
-
endLine:
|
|
21364
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
21365
|
+
endLine: path29.node.loc?.end.line || 0,
|
|
21366
21366
|
hasSchema: content.includes("FAQPage") || content.includes("application/ld+json")
|
|
21367
21367
|
});
|
|
21368
21368
|
return;
|
|
@@ -21485,8 +21485,8 @@ function scanForImages(ast, content, filePath) {
|
|
|
21485
21485
|
return images;
|
|
21486
21486
|
}
|
|
21487
21487
|
chunkJS75ORH7_js.traverse(ast, {
|
|
21488
|
-
JSXElement(
|
|
21489
|
-
const opening =
|
|
21488
|
+
JSXElement(path29) {
|
|
21489
|
+
const opening = path29.node.openingElement;
|
|
21490
21490
|
if (!chunkJS75ORH7_js.isJSXIdentifier(opening.name)) return;
|
|
21491
21491
|
const tagName = opening.name.name;
|
|
21492
21492
|
if (tagName === "img" || tagName === "Image") {
|
|
@@ -21514,8 +21514,8 @@ function scanForImages(ast, content, filePath) {
|
|
|
21514
21514
|
src: src || void 0,
|
|
21515
21515
|
alt: alt || void 0,
|
|
21516
21516
|
isLocal,
|
|
21517
|
-
startLine:
|
|
21518
|
-
endLine:
|
|
21517
|
+
startLine: path29.node.loc?.start.line || 0,
|
|
21518
|
+
endLine: path29.node.loc?.end.line || 0
|
|
21519
21519
|
});
|
|
21520
21520
|
}
|
|
21521
21521
|
}
|
|
@@ -21580,15 +21580,11 @@ function addToExistingImport(content, namedExport, modulePath) {
|
|
|
21580
21580
|
}
|
|
21581
21581
|
return content;
|
|
21582
21582
|
}
|
|
21583
|
-
function insertManagedSchemaIntoJSX(content, pagePath
|
|
21583
|
+
function insertManagedSchemaIntoJSX(content, pagePath) {
|
|
21584
21584
|
if (content.includes("<ManagedSchema")) {
|
|
21585
21585
|
return content;
|
|
21586
21586
|
}
|
|
21587
|
-
const
|
|
21588
|
-
const schemaComponent = `<ManagedSchema
|
|
21589
|
-
projectId={process.env.SONOR_PROJECT_ID${projectIdSuffix}}
|
|
21590
|
-
path="${pagePath}"
|
|
21591
|
-
/>`;
|
|
21587
|
+
const schemaComponent = `<ManagedSchema path="${pagePath}" />`;
|
|
21592
21588
|
const returnPatterns = [
|
|
21593
21589
|
// return (<> ... - fragment
|
|
21594
21590
|
/return\s*\(\s*<>/,
|
|
@@ -21724,7 +21720,7 @@ async function migrateFiles(scanResults, options) {
|
|
|
21724
21720
|
}
|
|
21725
21721
|
async function migrateForm(form, options) {
|
|
21726
21722
|
const changes = [];
|
|
21727
|
-
const fullPath =
|
|
21723
|
+
const fullPath = path12__default.default.resolve(process.cwd(), form.filePath);
|
|
21728
21724
|
const formSlug = generateSlug(form.componentName);
|
|
21729
21725
|
let formId;
|
|
21730
21726
|
if (!options.dryRun) {
|
|
@@ -21863,7 +21859,7 @@ export default ${componentName}
|
|
|
21863
21859
|
`;
|
|
21864
21860
|
}
|
|
21865
21861
|
async function createFormInUptrade(form, slug, options) {
|
|
21866
|
-
const response = await fetch("https://api.sonor.io/forms
|
|
21862
|
+
const response = await fetch(`${options.apiUrl || "https://api.sonor.io"}/forms`, {
|
|
21867
21863
|
method: "POST",
|
|
21868
21864
|
headers: {
|
|
21869
21865
|
"Content-Type": "application/json",
|
|
@@ -21898,10 +21894,10 @@ async function migrateWidget(filePath, widget, options) {
|
|
|
21898
21894
|
const changes = [];
|
|
21899
21895
|
if (options.dryRun) {
|
|
21900
21896
|
changes.push(`[DRY RUN] Would remove ${widget.widgetType} script`);
|
|
21901
|
-
changes.push("[DRY RUN]
|
|
21897
|
+
changes.push("[DRY RUN] Sonor Engage chat would come from SiteKitLayout (engage is on by default)");
|
|
21902
21898
|
return { filePath, success: true, changes };
|
|
21903
21899
|
}
|
|
21904
|
-
const fullPath =
|
|
21900
|
+
const fullPath = path12__default.default.resolve(process.cwd(), filePath);
|
|
21905
21901
|
let content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
21906
21902
|
switch (widget.widgetType) {
|
|
21907
21903
|
case "intercom":
|
|
@@ -21917,7 +21913,7 @@ async function migrateWidget(filePath, widget, options) {
|
|
|
21917
21913
|
}
|
|
21918
21914
|
await fs3__default.default.writeFile(fullPath, content, "utf-8");
|
|
21919
21915
|
changes.push(`Removed ${widget.widgetType} script`);
|
|
21920
|
-
changes.push("
|
|
21916
|
+
changes.push("SiteKitLayout adds the Sonor Engage chat widget (engage is on by default)");
|
|
21921
21917
|
return { filePath, success: true, changes };
|
|
21922
21918
|
}
|
|
21923
21919
|
function matchBalancedBraces(content, startIndex) {
|
|
@@ -21938,15 +21934,15 @@ function matchBalancedBraces(content, startIndex) {
|
|
|
21938
21934
|
}
|
|
21939
21935
|
async function migrateMetadata(filePath, metadata, options) {
|
|
21940
21936
|
const changes = [];
|
|
21941
|
-
const fullPath =
|
|
21937
|
+
const fullPath = path12__default.default.resolve(process.cwd(), filePath);
|
|
21942
21938
|
let pagePath = filePath.replace(/^app\//, "/").replace(/^src\/app\//, "/").replace(/\/page\.(tsx?|jsx?)$/, "").replace(/\/layout\.(tsx?|jsx?)$/, "").replace(/\[([^\]]+)\]/g, ":$1");
|
|
21943
21939
|
if (pagePath === "") pagePath = "/";
|
|
21944
21940
|
let content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
21945
21941
|
const isTypeScript = filePath.endsWith(".tsx") || filePath.endsWith(".ts");
|
|
21946
21942
|
const ext2 = isTypeScript ? ".tsx" : ".jsx";
|
|
21947
21943
|
if (isClientComponent(content)) {
|
|
21948
|
-
const dir =
|
|
21949
|
-
const layoutPath =
|
|
21944
|
+
const dir = path12__default.default.dirname(fullPath);
|
|
21945
|
+
const layoutPath = path12__default.default.join(dir, `layout${ext2}`);
|
|
21950
21946
|
try {
|
|
21951
21947
|
await fs3__default.default.access(layoutPath);
|
|
21952
21948
|
const layoutContent = await fs3__default.default.readFile(layoutPath, "utf-8");
|
|
@@ -21969,13 +21965,12 @@ async function migrateMetadata(filePath, metadata, options) {
|
|
|
21969
21965
|
} catch (error2) {
|
|
21970
21966
|
changes.push(`Page metadata may already exist: ${pagePath}`);
|
|
21971
21967
|
}
|
|
21972
|
-
const dirName =
|
|
21968
|
+
const dirName = path12__default.default.basename(dir).replace(/^\[\.\.\.([^\]]+)\]$/, "$1").replace(/^\[([^\]]+)\]$/, "$1");
|
|
21973
21969
|
const layoutName = dirName.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("") + "Layout";
|
|
21974
21970
|
const layoutCode = `import { getManagedMetadata, ManagedSchema } from '@sonordev/site-kit/seo'
|
|
21975
21971
|
|
|
21976
21972
|
export async function generateMetadata() {
|
|
21977
21973
|
return getManagedMetadata({
|
|
21978
|
-
projectId: process.env.SONOR_PROJECT_ID${isTypeScript ? "!" : ""},
|
|
21979
21974
|
path: '${pagePath}',
|
|
21980
21975
|
fallback: {
|
|
21981
21976
|
title: '${(metadata.title || "Page Title").replace(/'/g, "\\'")}',
|
|
@@ -21987,10 +21982,7 @@ export async function generateMetadata() {
|
|
|
21987
21982
|
export default function ${layoutName}({ children }${isTypeScript ? ": { children: React.ReactNode }" : ""}) {
|
|
21988
21983
|
return (
|
|
21989
21984
|
<>
|
|
21990
|
-
<ManagedSchema
|
|
21991
|
-
projectId={process.env.SONOR_PROJECT_ID${isTypeScript ? "!" : ""}}
|
|
21992
|
-
path="${pagePath}"
|
|
21993
|
-
/>
|
|
21985
|
+
<ManagedSchema path="${pagePath}" />
|
|
21994
21986
|
{children}
|
|
21995
21987
|
</>
|
|
21996
21988
|
)
|
|
@@ -22020,7 +22012,6 @@ export default function ${layoutName}({ children }${isTypeScript ? ": { children
|
|
|
22020
22012
|
const generateMetadataCode = `
|
|
22021
22013
|
export async function generateMetadata() {
|
|
22022
22014
|
return getManagedMetadata({
|
|
22023
|
-
projectId: process.env.SONOR_PROJECT_ID${isTypeScript ? "!" : ""},
|
|
22024
22015
|
path: '${pagePath}',
|
|
22025
22016
|
fallback: {
|
|
22026
22017
|
title: '${(metadata.title || "Page Title").replace(/'/g, "\\'")}',
|
|
@@ -22042,7 +22033,7 @@ export async function generateMetadata() {
|
|
|
22042
22033
|
content = generateMetadataCode + content;
|
|
22043
22034
|
}
|
|
22044
22035
|
}
|
|
22045
|
-
content = insertManagedSchemaIntoJSX(content, pagePath
|
|
22036
|
+
content = insertManagedSchemaIntoJSX(content, pagePath);
|
|
22046
22037
|
changes.push("Added ManagedSchema component");
|
|
22047
22038
|
await fs3__default.default.writeFile(fullPath, content, "utf-8");
|
|
22048
22039
|
changes.push("Added generateMetadata function");
|
|
@@ -22062,7 +22053,6 @@ export async function generateMetadata() {
|
|
|
22062
22053
|
}
|
|
22063
22054
|
const generateMetadataCode = `export async function generateMetadata() {
|
|
22064
22055
|
return getManagedMetadata({
|
|
22065
|
-
projectId: process.env.SONOR_PROJECT_ID${isTypeScript ? "!" : ""},
|
|
22066
22056
|
path: '${pagePath}',
|
|
22067
22057
|
fallback: {
|
|
22068
22058
|
title: '${(metadata.title || "Page Title").replace(/'/g, "\\'")}',
|
|
@@ -22072,7 +22062,7 @@ export async function generateMetadata() {
|
|
|
22072
22062
|
}`;
|
|
22073
22063
|
content = content.replace(fullMatch, generateMetadataCode);
|
|
22074
22064
|
changes.push("Replaced static metadata with getManagedMetadata");
|
|
22075
|
-
content = insertManagedSchemaIntoJSX(content, pagePath
|
|
22065
|
+
content = insertManagedSchemaIntoJSX(content, pagePath);
|
|
22076
22066
|
changes.push("Added ManagedSchema component");
|
|
22077
22067
|
}
|
|
22078
22068
|
}
|
|
@@ -22084,7 +22074,7 @@ export async function generateMetadata() {
|
|
|
22084
22074
|
return { filePath, success: true, changes };
|
|
22085
22075
|
}
|
|
22086
22076
|
async function createPageMetadata(pagePath, metadata, options) {
|
|
22087
|
-
const response = await fetch("https://api.sonor.io/seo/pages
|
|
22077
|
+
const response = await fetch(`${options.apiUrl || "https://api.sonor.io"}/seo/pages`, {
|
|
22088
22078
|
method: "POST",
|
|
22089
22079
|
headers: {
|
|
22090
22080
|
"Content-Type": "application/json",
|
|
@@ -22169,7 +22159,7 @@ async function createSchemaRecord(pagePath, schemaType, schemaJson, options) {
|
|
|
22169
22159
|
}
|
|
22170
22160
|
async function migrateSchema(filePath, schema, options) {
|
|
22171
22161
|
const changes = [];
|
|
22172
|
-
const fullPath =
|
|
22162
|
+
const fullPath = path12__default.default.resolve(process.cwd(), filePath);
|
|
22173
22163
|
let pagePath = filePath.replace(/^app\//, "/").replace(/^src\/app\//, "/").replace(/\/page\.(tsx?|jsx?)$/, "").replace(/\[([^\]]+)\]/g, ":$1");
|
|
22174
22164
|
if (pagePath === "") pagePath = "/";
|
|
22175
22165
|
let content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
@@ -22196,8 +22186,6 @@ async function migrateSchema(filePath, schema, options) {
|
|
|
22196
22186
|
}
|
|
22197
22187
|
}
|
|
22198
22188
|
const alreadyHasManagedSchema = content.includes("<ManagedSchema");
|
|
22199
|
-
const isTypeScript = filePath.endsWith(".tsx") || filePath.endsWith(".ts");
|
|
22200
|
-
const projectIdSuffix = isTypeScript ? "!" : "";
|
|
22201
22189
|
const jsonLdPattern = /<script\s+type=["']application\/ld\+json["'][^>]*>[\s\S]*?<\/script>/gi;
|
|
22202
22190
|
const scriptPattern = /<Script\s+[^>]*type=["']application\/ld\+json["'][^>]*>[\s\S]*?<\/Script>/gi;
|
|
22203
22191
|
const hasJsonLd = jsonLdPattern.test(content) || scriptPattern.test(content);
|
|
@@ -22217,14 +22205,8 @@ async function migrateSchema(filePath, schema, options) {
|
|
|
22217
22205
|
}
|
|
22218
22206
|
changes.push("Added ManagedSchema import");
|
|
22219
22207
|
}
|
|
22220
|
-
content = content.replace(jsonLdPattern, `<ManagedSchema
|
|
22221
|
-
|
|
22222
|
-
path="${pagePath}"
|
|
22223
|
-
/>`);
|
|
22224
|
-
content = content.replace(scriptPattern, `<ManagedSchema
|
|
22225
|
-
projectId={process.env.SONOR_PROJECT_ID${projectIdSuffix}}
|
|
22226
|
-
path="${pagePath}"
|
|
22227
|
-
/>`);
|
|
22208
|
+
content = content.replace(jsonLdPattern, `<ManagedSchema path="${pagePath}" />`);
|
|
22209
|
+
content = content.replace(scriptPattern, `<ManagedSchema path="${pagePath}" />`);
|
|
22228
22210
|
changes.push("Replaced JSON-LD script with ManagedSchema component");
|
|
22229
22211
|
}
|
|
22230
22212
|
}
|
|
@@ -22288,7 +22270,7 @@ async function createFAQRecord(pagePath, items, options) {
|
|
|
22288
22270
|
}
|
|
22289
22271
|
async function migrateFAQ(filePath, faq, options) {
|
|
22290
22272
|
const changes = [];
|
|
22291
|
-
const fullPath =
|
|
22273
|
+
const fullPath = path12__default.default.resolve(process.cwd(), filePath);
|
|
22292
22274
|
let pagePath = filePath.replace(/^app\//, "/").replace(/^src\/app\//, "/").replace(/\/page\.(tsx?|jsx?)$/, "").replace(/\[([^\]]+)\]/g, ":$1");
|
|
22293
22275
|
if (pagePath === "") pagePath = "/";
|
|
22294
22276
|
let content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
@@ -22328,12 +22310,7 @@ async function migrateFAQ(filePath, faq, options) {
|
|
|
22328
22310
|
}
|
|
22329
22311
|
changes.push("Added ManagedFAQ import");
|
|
22330
22312
|
}
|
|
22331
|
-
const
|
|
22332
|
-
const projectIdSuffix = isTypeScript ? "!" : "";
|
|
22333
|
-
const managedFAQComponent = `<ManagedFAQ
|
|
22334
|
-
projectId={process.env.SONOR_PROJECT_ID${projectIdSuffix}}
|
|
22335
|
-
path="${pagePath}"
|
|
22336
|
-
/>`;
|
|
22313
|
+
const managedFAQComponent = `<ManagedFAQ path="${pagePath}" />`;
|
|
22337
22314
|
if (faq.componentName) {
|
|
22338
22315
|
const componentPattern = new RegExp(`(<${faq.componentName}[^>]*>)`, "i");
|
|
22339
22316
|
if (componentPattern.test(content)) {
|
|
@@ -22361,7 +22338,7 @@ async function migrateFAQ(filePath, faq, options) {
|
|
|
22361
22338
|
}
|
|
22362
22339
|
async function migrateSitemap(filePath, sitemap, options) {
|
|
22363
22340
|
const changes = [];
|
|
22364
|
-
const fullPath =
|
|
22341
|
+
const fullPath = path12__default.default.resolve(process.cwd(), filePath);
|
|
22365
22342
|
if (options.dryRun) {
|
|
22366
22343
|
changes.push(`[DRY RUN] Would migrate ${sitemap.type} to Site-Kit sitemap`);
|
|
22367
22344
|
if (sitemap.type === "next-sitemap-config") {
|
|
@@ -22386,7 +22363,7 @@ async function migrateSitemap(filePath, sitemap, options) {
|
|
|
22386
22363
|
}
|
|
22387
22364
|
if (sitemap.type === "custom-sitemap" && filePath.includes("sitemap")) {
|
|
22388
22365
|
changes.push("Custom sitemap detected - consider using Site-Kit's createSitemap helper");
|
|
22389
|
-
changes.push("Import: import { createSitemap } from '@sonordev/site-kit/
|
|
22366
|
+
changes.push("Import: import { createSitemap } from '@sonordev/site-kit/sitemap'");
|
|
22390
22367
|
}
|
|
22391
22368
|
return { filePath, success: true, changes };
|
|
22392
22369
|
}
|
|
@@ -22394,17 +22371,17 @@ async function migrateAnalytics(filePath, analytics, options) {
|
|
|
22394
22371
|
const changes = [];
|
|
22395
22372
|
if (options.dryRun) {
|
|
22396
22373
|
changes.push(`[DRY RUN] Detected ${analytics.type}${analytics.trackingId ? ` (${analytics.trackingId})` : ""}`);
|
|
22397
|
-
changes.push("[DRY RUN] Would recommend
|
|
22374
|
+
changes.push("[DRY RUN] Would recommend Sonor analytics from SiteKitLayout (on by default)");
|
|
22398
22375
|
return { filePath, success: true, changes };
|
|
22399
22376
|
}
|
|
22400
22377
|
changes.push(`Detected ${analytics.type}${analytics.trackingId ? ` (${analytics.trackingId})` : ""}`);
|
|
22401
|
-
changes.push("
|
|
22378
|
+
changes.push("SiteKitLayout already tracks Sonor analytics (on by default)");
|
|
22402
22379
|
changes.push("Configure analytics in project settings to consolidate tracking");
|
|
22403
22380
|
return { filePath, success: true, changes };
|
|
22404
22381
|
}
|
|
22405
22382
|
async function migrateFile(filePath, options) {
|
|
22406
|
-
const fullPath =
|
|
22407
|
-
const relPath =
|
|
22383
|
+
const fullPath = path12__default.default.resolve(filePath);
|
|
22384
|
+
const relPath = path12__default.default.relative(process.cwd(), fullPath);
|
|
22408
22385
|
const content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
22409
22386
|
const hasFormTag = content.includes("<form") || content.includes("onSubmit");
|
|
22410
22387
|
const hasWidget = /intercom|crisp|drift|hubspot|zendesk/i.test(content);
|
|
@@ -22421,26 +22398,26 @@ async function migrateFile(filePath, options) {
|
|
|
22421
22398
|
return migrateWidget(relPath, {
|
|
22422
22399
|
widgetType}, options);
|
|
22423
22400
|
}
|
|
22424
|
-
const { parse:
|
|
22425
|
-
const ast =
|
|
22401
|
+
const { parse: parse3 } = await import('../lib-6HOOMENJ.js');
|
|
22402
|
+
const ast = parse3(content, {
|
|
22426
22403
|
sourceType: "module",
|
|
22427
22404
|
plugins: ["jsx", "typescript"]
|
|
22428
22405
|
});
|
|
22429
22406
|
let componentName = "Form";
|
|
22430
22407
|
const traverse2 = (await import('../lib-BGAWCSUH.js')).default;
|
|
22431
22408
|
traverse2(ast, {
|
|
22432
|
-
ExportNamedDeclaration(
|
|
22433
|
-
const decl =
|
|
22409
|
+
ExportNamedDeclaration(path29) {
|
|
22410
|
+
const decl = path29.node.declaration;
|
|
22434
22411
|
if (decl && decl.type === "FunctionDeclaration" && decl.id) {
|
|
22435
22412
|
componentName = decl.id.name;
|
|
22436
|
-
|
|
22413
|
+
path29.stop();
|
|
22437
22414
|
}
|
|
22438
22415
|
},
|
|
22439
|
-
ExportDefaultDeclaration(
|
|
22440
|
-
const decl =
|
|
22416
|
+
ExportDefaultDeclaration(path29) {
|
|
22417
|
+
const decl = path29.node.declaration;
|
|
22441
22418
|
if (decl && decl.type === "FunctionDeclaration" && decl.id) {
|
|
22442
22419
|
componentName = decl.id.name;
|
|
22443
|
-
|
|
22420
|
+
path29.stop();
|
|
22444
22421
|
}
|
|
22445
22422
|
}
|
|
22446
22423
|
});
|
|
@@ -22497,7 +22474,7 @@ function detectFormType(form) {
|
|
|
22497
22474
|
return "contact";
|
|
22498
22475
|
}
|
|
22499
22476
|
async function generateEnvFile(options) {
|
|
22500
|
-
const envPath =
|
|
22477
|
+
const envPath = path12__default.default.join(process.cwd(), ".env.local");
|
|
22501
22478
|
let existingContent = "";
|
|
22502
22479
|
try {
|
|
22503
22480
|
existingContent = await fs3__default.default.readFile(envPath, "utf-8");
|
|
@@ -22597,7 +22574,7 @@ async function findLayoutFile() {
|
|
|
22597
22574
|
"app/layout.jsx"
|
|
22598
22575
|
];
|
|
22599
22576
|
for (const relativePath of possiblePaths) {
|
|
22600
|
-
const fullPath =
|
|
22577
|
+
const fullPath = path12__default.default.join(process.cwd(), relativePath);
|
|
22601
22578
|
try {
|
|
22602
22579
|
await fs3__default.default.access(fullPath);
|
|
22603
22580
|
return fullPath;
|
|
@@ -22767,15 +22744,15 @@ var wslDefaultBrowser = async () => {
|
|
|
22767
22744
|
const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
|
|
22768
22745
|
return stdout.trim();
|
|
22769
22746
|
};
|
|
22770
|
-
var convertWslPathToWindows = async (
|
|
22771
|
-
if (/^[a-z]+:\/\//i.test(
|
|
22772
|
-
return
|
|
22747
|
+
var convertWslPathToWindows = async (path29) => {
|
|
22748
|
+
if (/^[a-z]+:\/\//i.test(path29)) {
|
|
22749
|
+
return path29;
|
|
22773
22750
|
}
|
|
22774
22751
|
try {
|
|
22775
|
-
const { stdout } = await execFile2("wslpath", ["-aw",
|
|
22752
|
+
const { stdout } = await execFile2("wslpath", ["-aw", path29], { encoding: "utf8" });
|
|
22776
22753
|
return stdout.trim();
|
|
22777
22754
|
} catch {
|
|
22778
|
-
return
|
|
22755
|
+
return path29;
|
|
22779
22756
|
}
|
|
22780
22757
|
};
|
|
22781
22758
|
|
|
@@ -22895,8 +22872,8 @@ var is_in_ssh_default = isInSsh;
|
|
|
22895
22872
|
|
|
22896
22873
|
// node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
22897
22874
|
var fallbackAttemptSymbol = /* @__PURE__ */ Symbol("fallbackAttempt");
|
|
22898
|
-
var __dirname2 = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) ?
|
|
22899
|
-
var localXdgOpenPath =
|
|
22875
|
+
var __dirname2 = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)) ? path12__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)))) : "";
|
|
22876
|
+
var localXdgOpenPath = path12__default.default.join(__dirname2, "xdg-open");
|
|
22900
22877
|
var { platform, arch } = process2__default.default;
|
|
22901
22878
|
var tryEachApp = async (apps2, opener) => {
|
|
22902
22879
|
if (apps2.length === 0) {
|
|
@@ -23174,8 +23151,37 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
23174
23151
|
darwin: "Safari"
|
|
23175
23152
|
}));
|
|
23176
23153
|
var open_default = open;
|
|
23154
|
+
var SONOR_STATE_DIR = ".sonor";
|
|
23155
|
+
var IMAGE_MANIFEST = ".sonor-images.json";
|
|
23156
|
+
var LEGACY_IMAGE_MANIFEST = ".uptrade-images.json";
|
|
23157
|
+
var LEGACY_STATE_DIR = ".uptrade";
|
|
23158
|
+
function resolveStateReadPath(relativePath, root = process.cwd()) {
|
|
23159
|
+
return preferCurrent(path12__default.default.join(root, SONOR_STATE_DIR, relativePath), path12__default.default.join(root, LEGACY_STATE_DIR, relativePath));
|
|
23160
|
+
}
|
|
23161
|
+
function resolveImageManifestReadPath(root) {
|
|
23162
|
+
return preferCurrent(path12__default.default.join(root, IMAGE_MANIFEST), path12__default.default.join(root, LEGACY_IMAGE_MANIFEST));
|
|
23163
|
+
}
|
|
23164
|
+
function preferCurrent(current, legacy) {
|
|
23165
|
+
return fs.existsSync(current) || !fs.existsSync(legacy) ? current : legacy;
|
|
23166
|
+
}
|
|
23167
|
+
async function listLocalTemplates(root = process.cwd()) {
|
|
23168
|
+
const names = /* @__PURE__ */ new Set();
|
|
23169
|
+
for (const dir of [SONOR_STATE_DIR, LEGACY_STATE_DIR]) {
|
|
23170
|
+
try {
|
|
23171
|
+
const files = await fs3__default.default.readdir(path12__default.default.join(root, dir, "templates"));
|
|
23172
|
+
for (const file of files) if (file.endsWith(".json")) names.add(file);
|
|
23173
|
+
} catch (error2) {
|
|
23174
|
+
if (error2.code !== "ENOENT") throw error2;
|
|
23175
|
+
}
|
|
23176
|
+
}
|
|
23177
|
+
return [...names].sort();
|
|
23178
|
+
}
|
|
23179
|
+
|
|
23180
|
+
// src/cli/api/sonor.ts
|
|
23177
23181
|
var PORTAL_URL = "https://app.sonor.io";
|
|
23178
|
-
|
|
23182
|
+
function getSonorApiUrl() {
|
|
23183
|
+
return (process.env.SONOR_API_URL || "https://api.sonor.io").replace(/\/+$/, "");
|
|
23184
|
+
}
|
|
23179
23185
|
async function authenticateWithSonor() {
|
|
23180
23186
|
return new Promise((resolve, reject) => {
|
|
23181
23187
|
const server = http__default.default.createServer(async (req, res) => {
|
|
@@ -23202,7 +23208,7 @@ async function authenticateWithSonor() {
|
|
|
23202
23208
|
server.close();
|
|
23203
23209
|
return;
|
|
23204
23210
|
}
|
|
23205
|
-
const tokenResponse = await fetch(`${
|
|
23211
|
+
const tokenResponse = await fetch(`${getSonorApiUrl()}/auth/cli-token`, {
|
|
23206
23212
|
method: "POST",
|
|
23207
23213
|
headers: { "Content-Type": "application/json" },
|
|
23208
23214
|
body: JSON.stringify({ code, redirect_uri: `http://localhost:${port}/callback` })
|
|
@@ -23248,32 +23254,41 @@ async function authenticateWithSonor() {
|
|
|
23248
23254
|
}, 5 * 60 * 1e3);
|
|
23249
23255
|
});
|
|
23250
23256
|
}
|
|
23251
|
-
async function authenticateWithApiKey(apiKey) {
|
|
23252
|
-
|
|
23253
|
-
|
|
23254
|
-
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
userId: "api-key-user",
|
|
23261
|
-
email: data.project?.name ? `Project: ${data.project.name}` : `API Key verified`,
|
|
23262
|
-
projectId: data.project?.id,
|
|
23263
|
-
projectName: data.project?.name,
|
|
23264
|
-
orgId: data.organization?.id,
|
|
23265
|
-
orgName: data.organization?.name,
|
|
23266
|
-
isApiKey: true
|
|
23267
|
-
};
|
|
23268
|
-
}
|
|
23257
|
+
async function authenticateWithApiKey(apiKey, apiUrl = getSonorApiUrl()) {
|
|
23258
|
+
let response;
|
|
23259
|
+
try {
|
|
23260
|
+
response = await fetch(`${apiUrl}/api/public/seo/verify-api-key`, {
|
|
23261
|
+
headers: { "X-API-Key": apiKey },
|
|
23262
|
+
signal: AbortSignal.timeout(15e3)
|
|
23263
|
+
});
|
|
23264
|
+
} catch {
|
|
23265
|
+
throw new NetworkError("PROJECT_LOOKUP_FAILED", "Could not reach the Sonor API to resolve the project. Check SONOR_API_URL and your connection.");
|
|
23269
23266
|
}
|
|
23270
|
-
if (response.
|
|
23271
|
-
throw new
|
|
23267
|
+
if (!response.ok) {
|
|
23268
|
+
throw new NetworkError("PROJECT_LOOKUP_FAILED", `Sonor API verification failed (HTTP ${response.status}). Check SONOR_API_KEY and SONOR_API_URL.`);
|
|
23269
|
+
}
|
|
23270
|
+
let data;
|
|
23271
|
+
try {
|
|
23272
|
+
data = await response.json();
|
|
23273
|
+
} catch {
|
|
23274
|
+
throw new NetworkError("INVALID_PROJECT_RESPONSE", "Sonor API returned an invalid project response.");
|
|
23275
|
+
}
|
|
23276
|
+
if (data?.valid !== true || typeof data.project?.id !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(data.project.id)) {
|
|
23277
|
+
throw new NetworkError("INVALID_PROJECT_RESPONSE", "Sonor API did not return a valid full project UUID. Check SONOR_API_KEY.");
|
|
23272
23278
|
}
|
|
23273
|
-
|
|
23279
|
+
return {
|
|
23280
|
+
accessToken: apiKey,
|
|
23281
|
+
userId: "api-key-user",
|
|
23282
|
+
email: data.project.name ? `Project: ${data.project.name}` : "API Key verified",
|
|
23283
|
+
projectId: data.project.id,
|
|
23284
|
+
projectName: data.project.name,
|
|
23285
|
+
orgId: data.organization?.id,
|
|
23286
|
+
orgName: data.organization?.name,
|
|
23287
|
+
isApiKey: true
|
|
23288
|
+
};
|
|
23274
23289
|
}
|
|
23275
23290
|
async function fetchOrganizations(accessToken) {
|
|
23276
|
-
const response = await fetch(`${
|
|
23291
|
+
const response = await fetch(`${getSonorApiUrl()}/organizations`, {
|
|
23277
23292
|
headers: { "Authorization": `Bearer ${accessToken}` }
|
|
23278
23293
|
});
|
|
23279
23294
|
if (!response.ok) {
|
|
@@ -23282,7 +23297,7 @@ async function fetchOrganizations(accessToken) {
|
|
|
23282
23297
|
return response.json();
|
|
23283
23298
|
}
|
|
23284
23299
|
async function fetchProjects(accessToken, orgId) {
|
|
23285
|
-
const response = await fetch(`${
|
|
23300
|
+
const response = await fetch(`${getSonorApiUrl()}/organizations/${orgId}/projects`, {
|
|
23286
23301
|
headers: { "Authorization": `Bearer ${accessToken}` }
|
|
23287
23302
|
});
|
|
23288
23303
|
if (!response.ok) {
|
|
@@ -23291,7 +23306,7 @@ async function fetchProjects(accessToken, orgId) {
|
|
|
23291
23306
|
return response.json();
|
|
23292
23307
|
}
|
|
23293
23308
|
async function createProject(accessToken, orgId, data) {
|
|
23294
|
-
const response = await fetch(`${
|
|
23309
|
+
const response = await fetch(`${getSonorApiUrl()}/organizations/${orgId}/projects`, {
|
|
23295
23310
|
method: "POST",
|
|
23296
23311
|
headers: {
|
|
23297
23312
|
"Authorization": `Bearer ${accessToken}`,
|
|
@@ -23305,7 +23320,7 @@ async function createProject(accessToken, orgId, data) {
|
|
|
23305
23320
|
return response.json();
|
|
23306
23321
|
}
|
|
23307
23322
|
async function generateApiKey(accessToken, projectId) {
|
|
23308
|
-
const response = await fetch(`${
|
|
23323
|
+
const response = await fetch(`${getSonorApiUrl()}/projects/${projectId}/api-keys`, {
|
|
23309
23324
|
method: "POST",
|
|
23310
23325
|
headers: {
|
|
23311
23326
|
"Authorization": `Bearer ${accessToken}`,
|
|
@@ -23509,7 +23524,7 @@ function progress(ctx, line) {
|
|
|
23509
23524
|
// src/cli/commands/init.ts
|
|
23510
23525
|
async function checkNextJsProject(cwd) {
|
|
23511
23526
|
try {
|
|
23512
|
-
const pkg = JSON.parse(await fs3__default.default.readFile(
|
|
23527
|
+
const pkg = JSON.parse(await fs3__default.default.readFile(path12__default.default.join(cwd, "package.json"), "utf-8"));
|
|
23513
23528
|
return !!(pkg.dependencies?.next || pkg.devDependencies?.next);
|
|
23514
23529
|
} catch {
|
|
23515
23530
|
return false;
|
|
@@ -23589,7 +23604,7 @@ async function run(ctx, options) {
|
|
|
23589
23604
|
]);
|
|
23590
23605
|
if (chosen === "new") {
|
|
23591
23606
|
const answers = await dist_default14.prompt([
|
|
23592
|
-
{ type: "input", name: "name", message: "Project name:", default:
|
|
23607
|
+
{ type: "input", name: "name", message: "Project name:", default: path12__default.default.basename(ctx.cwd) },
|
|
23593
23608
|
{ type: "input", name: "domain", message: "Project domain (optional):" }
|
|
23594
23609
|
]);
|
|
23595
23610
|
const project = await createProject(auth.accessToken, orgId, { name: answers.name, domain: answers.domain || "" });
|
|
@@ -23644,7 +23659,7 @@ async function run(ctx, options) {
|
|
|
23644
23659
|
};
|
|
23645
23660
|
}
|
|
23646
23661
|
async function ensureSitemapPostbuild(ctx) {
|
|
23647
|
-
const pkgPath =
|
|
23662
|
+
const pkgPath = path12__default.default.join(ctx.cwd, "package.json");
|
|
23648
23663
|
try {
|
|
23649
23664
|
const pkg = JSON.parse(await fs3__default.default.readFile(pkgPath, "utf-8"));
|
|
23650
23665
|
if (!pkg.scripts) pkg.scripts = {};
|
|
@@ -23686,7 +23701,7 @@ async function scanCommand(options) {
|
|
|
23686
23701
|
console.log("");
|
|
23687
23702
|
console.log(source_default.bold(" Scanning codebase..."));
|
|
23688
23703
|
console.log("");
|
|
23689
|
-
const targetDir =
|
|
23704
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
23690
23705
|
const spinner = ora("Looking for forms, metadata, widgets, schemas, FAQs, analytics, and images...").start();
|
|
23691
23706
|
let scanResults;
|
|
23692
23707
|
try {
|
|
@@ -23864,6 +23879,48 @@ async function scanCommand(options) {
|
|
|
23864
23879
|
process.exit(1);
|
|
23865
23880
|
}
|
|
23866
23881
|
}
|
|
23882
|
+
|
|
23883
|
+
// src/cli/config.ts
|
|
23884
|
+
var import_dotenv = chunkSNAQBZPT_js.__toESM(chunkNN2YE5WT_js.require_main());
|
|
23885
|
+
async function loadConfig({ resolveProject = false, cwd = process.cwd() } = {}) {
|
|
23886
|
+
const envFile = await readOptionalFile(path12__default.default.join(cwd, ".env.local"));
|
|
23887
|
+
const env3 = { ...(0, import_dotenv.parse)(envFile || ""), ...process.env };
|
|
23888
|
+
const configPath = resolveStateReadPath("config.json", cwd);
|
|
23889
|
+
const saved = await readOptionalFile(configPath);
|
|
23890
|
+
let stored = {};
|
|
23891
|
+
if (saved !== void 0) {
|
|
23892
|
+
try {
|
|
23893
|
+
stored = JSON.parse(saved);
|
|
23894
|
+
if (!stored || typeof stored !== "object" || Array.isArray(stored)) throw new Error();
|
|
23895
|
+
} catch {
|
|
23896
|
+
throw new ConfigError("INVALID_CONFIG", `Invalid JSON config: ${configPath}. Fix or remove it, then set SONOR_API_KEY in .env.local.`);
|
|
23897
|
+
}
|
|
23898
|
+
}
|
|
23899
|
+
const apiKey = String(env3.SONOR_API_KEY || stored.apiKey || stored.api_key || "").trim();
|
|
23900
|
+
if (!apiKey) {
|
|
23901
|
+
throw new ConfigError("MISSING_API_KEY", "Set SONOR_API_KEY in .env.local or run `sonor-setup init` first.");
|
|
23902
|
+
}
|
|
23903
|
+
if (!/^sonor_[0-9a-f]{8}_.+$/i.test(apiKey)) {
|
|
23904
|
+
throw new ConfigError("INVALID_API_KEY", "SONOR_API_KEY must be a sonor_ key from app.sonor.io.");
|
|
23905
|
+
}
|
|
23906
|
+
const config2 = {
|
|
23907
|
+
apiKey,
|
|
23908
|
+
apiUrl: (env3.SONOR_API_URL || getSonorApiUrl()).replace(/\/+$/, ""),
|
|
23909
|
+
siteUrl: env3.NEXT_PUBLIC_SITE_URL || env3.SITE_URL || stored.siteUrl || stored.site_url,
|
|
23910
|
+
businessInfo: stored.businessInfo || stored.business_info
|
|
23911
|
+
};
|
|
23912
|
+
if (!resolveProject) return config2;
|
|
23913
|
+
const auth = await authenticateWithApiKey(apiKey, config2.apiUrl);
|
|
23914
|
+
return { ...config2, projectId: auth.projectId };
|
|
23915
|
+
}
|
|
23916
|
+
async function readOptionalFile(file) {
|
|
23917
|
+
try {
|
|
23918
|
+
return await fs3__default.default.readFile(file, "utf-8");
|
|
23919
|
+
} catch (error2) {
|
|
23920
|
+
if (error2.code === "ENOENT") return void 0;
|
|
23921
|
+
throw new ConfigError("CONFIG_READ_FAILED", `Could not read ${file}. Check file permissions.`);
|
|
23922
|
+
}
|
|
23923
|
+
}
|
|
23867
23924
|
var IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".ico", ".bmp", ".avif"];
|
|
23868
23925
|
var MIME_TYPES = {
|
|
23869
23926
|
".jpg": "image/jpeg",
|
|
@@ -23886,7 +23943,7 @@ function filePathToPagePath(filePath) {
|
|
|
23886
23943
|
}
|
|
23887
23944
|
if (p.startsWith("pages/") || p.startsWith("src/pages/")) {
|
|
23888
23945
|
p = p.replace(/^pages\//, "").replace(/^src\/pages\//, "");
|
|
23889
|
-
const base =
|
|
23946
|
+
const base = path12__default.default.basename(p, path12__default.default.extname(p));
|
|
23890
23947
|
return base === "index" ? "/" : "/" + base;
|
|
23891
23948
|
}
|
|
23892
23949
|
p = p.replace(/\.[^.]+$/, "").replace(/^\.\//, "").replace(/\\/g, "/");
|
|
@@ -23929,8 +23986,8 @@ async function imagesCommand(subcommand, options) {
|
|
|
23929
23986
|
}
|
|
23930
23987
|
}
|
|
23931
23988
|
async function scanImages(options) {
|
|
23932
|
-
const targetDir =
|
|
23933
|
-
const publicDir =
|
|
23989
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
23990
|
+
const publicDir = path12__default.default.join(targetDir, "public");
|
|
23934
23991
|
try {
|
|
23935
23992
|
await fs3__default.default.access(publicDir);
|
|
23936
23993
|
} catch {
|
|
@@ -24000,7 +24057,7 @@ async function uploadImages(options) {
|
|
|
24000
24057
|
console.log("");
|
|
24001
24058
|
process.exit(1);
|
|
24002
24059
|
}
|
|
24003
|
-
const targetDir =
|
|
24060
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
24004
24061
|
const spinner = ora("Scanning for images...").start();
|
|
24005
24062
|
const results = await scanPublicImages(targetDir);
|
|
24006
24063
|
spinner.stop();
|
|
@@ -24053,7 +24110,7 @@ async function uploadImages(options) {
|
|
|
24053
24110
|
const uploadSpinner = ora(`Uploading ${img.filename}...`).start();
|
|
24054
24111
|
try {
|
|
24055
24112
|
const result = await uploadImageToPortal(
|
|
24056
|
-
|
|
24113
|
+
path12__default.default.join(targetDir, img.filePath),
|
|
24057
24114
|
img,
|
|
24058
24115
|
{ apiUrl, apiKey, category: options.category }
|
|
24059
24116
|
);
|
|
@@ -24072,7 +24129,7 @@ async function uploadImages(options) {
|
|
|
24072
24129
|
}
|
|
24073
24130
|
console.log("");
|
|
24074
24131
|
if (uploaded.length > 0) {
|
|
24075
|
-
const manifestPath =
|
|
24132
|
+
const manifestPath = path12__default.default.join(targetDir, IMAGE_MANIFEST);
|
|
24076
24133
|
await fs3__default.default.writeFile(manifestPath, JSON.stringify({
|
|
24077
24134
|
uploaded,
|
|
24078
24135
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -24085,8 +24142,8 @@ async function uploadImages(options) {
|
|
|
24085
24142
|
console.log("");
|
|
24086
24143
|
}
|
|
24087
24144
|
async function migrateImages(options) {
|
|
24088
|
-
const targetDir =
|
|
24089
|
-
const manifestPath =
|
|
24145
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
24146
|
+
const manifestPath = resolveImageManifestReadPath(targetDir);
|
|
24090
24147
|
const apiUrl = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
24091
24148
|
const apiKey = process.env.SONOR_API_KEY || "";
|
|
24092
24149
|
if (!apiKey) {
|
|
@@ -24189,9 +24246,9 @@ async function migrateImages(options) {
|
|
|
24189
24246
|
let successCount = 0;
|
|
24190
24247
|
let failCount = 0;
|
|
24191
24248
|
for (const [filePath, fileMigrations] of byFile) {
|
|
24192
|
-
const fileSpinner = ora(`Migrating ${
|
|
24249
|
+
const fileSpinner = ora(`Migrating ${path12__default.default.basename(filePath)}...`).start();
|
|
24193
24250
|
try {
|
|
24194
|
-
await migrateFileImages(
|
|
24251
|
+
await migrateFileImages(path12__default.default.join(targetDir, filePath), fileMigrations);
|
|
24195
24252
|
successCount += fileMigrations.length;
|
|
24196
24253
|
fileSpinner.succeed(`Migrated: ${filePath} (${fileMigrations.length} images)`);
|
|
24197
24254
|
} catch (error2) {
|
|
@@ -24213,7 +24270,7 @@ async function migrateImages(options) {
|
|
|
24213
24270
|
console.log("");
|
|
24214
24271
|
}
|
|
24215
24272
|
async function uploadAndMigrate(options) {
|
|
24216
|
-
const targetDir =
|
|
24273
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
24217
24274
|
const apiUrl = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
24218
24275
|
const apiKey = process.env.SONOR_API_KEY || "";
|
|
24219
24276
|
if (!apiKey) {
|
|
@@ -24280,7 +24337,7 @@ async function uploadAndMigrate(options) {
|
|
|
24280
24337
|
const uploadSpinner = ora(`Uploading ${img.filename}...`).start();
|
|
24281
24338
|
try {
|
|
24282
24339
|
const result = await uploadImageToPortal(
|
|
24283
|
-
|
|
24340
|
+
path12__default.default.join(targetDir, img.filePath),
|
|
24284
24341
|
img,
|
|
24285
24342
|
{ apiUrl, apiKey, category: options.category }
|
|
24286
24343
|
);
|
|
@@ -24352,9 +24409,9 @@ async function uploadAndMigrate(options) {
|
|
|
24352
24409
|
let successCount = 0;
|
|
24353
24410
|
let failCount = 0;
|
|
24354
24411
|
for (const [filePath, fileMigrations] of byFile) {
|
|
24355
|
-
const fileSpinner = ora(`Migrating ${
|
|
24412
|
+
const fileSpinner = ora(`Migrating ${path12__default.default.basename(filePath)}...`).start();
|
|
24356
24413
|
try {
|
|
24357
|
-
await migrateFileImages(
|
|
24414
|
+
await migrateFileImages(path12__default.default.join(targetDir, filePath), fileMigrations);
|
|
24358
24415
|
successCount += fileMigrations.length;
|
|
24359
24416
|
fileSpinner.succeed(`Migrated: ${filePath} (${fileMigrations.length} images)`);
|
|
24360
24417
|
} catch (error2) {
|
|
@@ -24362,7 +24419,7 @@ async function uploadAndMigrate(options) {
|
|
|
24362
24419
|
fileSpinner.fail(`Failed: ${filePath} - ${error2.message}`);
|
|
24363
24420
|
}
|
|
24364
24421
|
}
|
|
24365
|
-
const manifestPath =
|
|
24422
|
+
const manifestPath = path12__default.default.join(targetDir, IMAGE_MANIFEST);
|
|
24366
24423
|
await fs3__default.default.writeFile(manifestPath, JSON.stringify({
|
|
24367
24424
|
uploaded,
|
|
24368
24425
|
criticalKeptLocal: criticalImages.map((i) => i.filename),
|
|
@@ -24389,8 +24446,8 @@ async function uploadAndMigrate(options) {
|
|
|
24389
24446
|
console.log("");
|
|
24390
24447
|
}
|
|
24391
24448
|
async function replaceWithCdnUrls(options) {
|
|
24392
|
-
const targetDir =
|
|
24393
|
-
const manifestPath =
|
|
24449
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
24450
|
+
const manifestPath = resolveImageManifestReadPath(targetDir);
|
|
24394
24451
|
let manifest;
|
|
24395
24452
|
try {
|
|
24396
24453
|
const content = await fs3__default.default.readFile(manifestPath, "utf-8");
|
|
@@ -24438,7 +24495,7 @@ async function replaceWithCdnUrls(options) {
|
|
|
24438
24495
|
if (!seenFileLines.has(key)) {
|
|
24439
24496
|
seenFileLines.add(key);
|
|
24440
24497
|
replacements2.push({
|
|
24441
|
-
file:
|
|
24498
|
+
file: path12__default.default.relative(targetDir, file),
|
|
24442
24499
|
localPath: pattern,
|
|
24443
24500
|
cdnUrl: img.publicUrl,
|
|
24444
24501
|
line: i + 1
|
|
@@ -24486,9 +24543,9 @@ async function replaceWithCdnUrls(options) {
|
|
|
24486
24543
|
let successCount = 0;
|
|
24487
24544
|
let failCount = 0;
|
|
24488
24545
|
for (const [filePath, fileReplacements] of byFile) {
|
|
24489
|
-
const fileSpinner = ora(`Updating ${
|
|
24546
|
+
const fileSpinner = ora(`Updating ${path12__default.default.basename(filePath)}...`).start();
|
|
24490
24547
|
try {
|
|
24491
|
-
const fullPath =
|
|
24548
|
+
const fullPath = path12__default.default.join(targetDir, filePath);
|
|
24492
24549
|
let content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
24493
24550
|
for (const r of fileReplacements) {
|
|
24494
24551
|
const escaped = r.localPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -24516,8 +24573,8 @@ async function replaceWithCdnUrls(options) {
|
|
|
24516
24573
|
console.log("");
|
|
24517
24574
|
}
|
|
24518
24575
|
async function refreshManifest(options) {
|
|
24519
|
-
const targetDir =
|
|
24520
|
-
const manifestPath =
|
|
24576
|
+
const targetDir = path12__default.default.resolve(options.dir || ".");
|
|
24577
|
+
const manifestPath = path12__default.default.join(targetDir, IMAGE_MANIFEST);
|
|
24521
24578
|
const apiUrl = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
24522
24579
|
const apiKey = process.env.SONOR_API_KEY || "";
|
|
24523
24580
|
if (!apiKey) {
|
|
@@ -24526,7 +24583,7 @@ async function refreshManifest(options) {
|
|
|
24526
24583
|
}
|
|
24527
24584
|
let manifest;
|
|
24528
24585
|
try {
|
|
24529
|
-
const content = await fs3__default.default.readFile(
|
|
24586
|
+
const content = await fs3__default.default.readFile(resolveImageManifestReadPath(targetDir), "utf-8");
|
|
24530
24587
|
manifest = JSON.parse(content);
|
|
24531
24588
|
} catch {
|
|
24532
24589
|
console.log(source_default.yellow(" \u26A0 No upload manifest found"));
|
|
@@ -24579,12 +24636,12 @@ async function refreshManifest(options) {
|
|
|
24579
24636
|
}
|
|
24580
24637
|
async function findDataFiles(rootDir) {
|
|
24581
24638
|
const files = [];
|
|
24582
|
-
const excludeFiles = [
|
|
24639
|
+
const excludeFiles = [IMAGE_MANIFEST, LEGACY_IMAGE_MANIFEST];
|
|
24583
24640
|
async function scan(dir) {
|
|
24584
24641
|
try {
|
|
24585
24642
|
const entries = await fs3__default.default.readdir(dir, { withFileTypes: true });
|
|
24586
24643
|
for (const entry of entries) {
|
|
24587
|
-
const fullPath =
|
|
24644
|
+
const fullPath = path12__default.default.join(dir, entry.name);
|
|
24588
24645
|
if (entry.isDirectory()) {
|
|
24589
24646
|
if (["node_modules", ".next", ".git", "dist", "build"].includes(entry.name)) {
|
|
24590
24647
|
continue;
|
|
@@ -24594,7 +24651,7 @@ async function findDataFiles(rootDir) {
|
|
|
24594
24651
|
if (excludeFiles.includes(entry.name)) {
|
|
24595
24652
|
continue;
|
|
24596
24653
|
}
|
|
24597
|
-
const ext2 =
|
|
24654
|
+
const ext2 = path12__default.default.extname(entry.name).toLowerCase();
|
|
24598
24655
|
if ([".js", ".ts", ".json", ".jsx", ".tsx", ".mjs", ".cjs"].includes(ext2)) {
|
|
24599
24656
|
files.push(fullPath);
|
|
24600
24657
|
}
|
|
@@ -24607,16 +24664,16 @@ async function findDataFiles(rootDir) {
|
|
|
24607
24664
|
return files;
|
|
24608
24665
|
}
|
|
24609
24666
|
async function scanPublicImages(rootDir) {
|
|
24610
|
-
const publicDir =
|
|
24667
|
+
const publicDir = path12__default.default.join(rootDir, "public");
|
|
24611
24668
|
const images = [];
|
|
24612
24669
|
let totalSize = 0;
|
|
24613
24670
|
let usageCount = 0;
|
|
24614
24671
|
const imageFiles = await findImagesRecursive(publicDir);
|
|
24615
24672
|
const sourceFiles = await findSourceFiles2(rootDir);
|
|
24616
24673
|
for (const imagePath of imageFiles) {
|
|
24617
|
-
const relPath =
|
|
24618
|
-
const filename =
|
|
24619
|
-
const ext2 =
|
|
24674
|
+
const relPath = path12__default.default.relative(rootDir, imagePath);
|
|
24675
|
+
const filename = path12__default.default.basename(imagePath);
|
|
24676
|
+
const ext2 = path12__default.default.extname(filename).toLowerCase();
|
|
24620
24677
|
const stat = await fs3__default.default.stat(imagePath);
|
|
24621
24678
|
const category = getCategoryFromPath(relPath);
|
|
24622
24679
|
const suggestedSlotId = generateSlotId(relPath);
|
|
@@ -24642,11 +24699,11 @@ async function findImagesRecursive(dir, files = []) {
|
|
|
24642
24699
|
try {
|
|
24643
24700
|
const entries = await fs3__default.default.readdir(dir, { withFileTypes: true });
|
|
24644
24701
|
for (const entry of entries) {
|
|
24645
|
-
const fullPath =
|
|
24702
|
+
const fullPath = path12__default.default.join(dir, entry.name);
|
|
24646
24703
|
if (entry.isDirectory()) {
|
|
24647
24704
|
await findImagesRecursive(fullPath, files);
|
|
24648
24705
|
} else if (entry.isFile()) {
|
|
24649
|
-
const ext2 =
|
|
24706
|
+
const ext2 = path12__default.default.extname(entry.name).toLowerCase();
|
|
24650
24707
|
if (IMAGE_EXTENSIONS.includes(ext2)) {
|
|
24651
24708
|
files.push(fullPath);
|
|
24652
24709
|
}
|
|
@@ -24659,7 +24716,7 @@ async function findImagesRecursive(dir, files = []) {
|
|
|
24659
24716
|
async function findSourceFiles2(dir, files = []) {
|
|
24660
24717
|
const entries = await fs3__default.default.readdir(dir, { withFileTypes: true });
|
|
24661
24718
|
for (const entry of entries) {
|
|
24662
|
-
const fullPath =
|
|
24719
|
+
const fullPath = path12__default.default.join(dir, entry.name);
|
|
24663
24720
|
if (entry.isDirectory()) {
|
|
24664
24721
|
if (["node_modules", ".next", ".git", "dist", "build", "public"].includes(entry.name)) {
|
|
24665
24722
|
continue;
|
|
@@ -24675,8 +24732,8 @@ async function findSourceFiles2(dir, files = []) {
|
|
|
24675
24732
|
}
|
|
24676
24733
|
async function findImageUsages(imagePath, sourceFiles, rootDir) {
|
|
24677
24734
|
const usages = [];
|
|
24678
|
-
const filename =
|
|
24679
|
-
const relPath =
|
|
24735
|
+
const filename = path12__default.default.basename(imagePath);
|
|
24736
|
+
const relPath = path12__default.default.relative(path12__default.default.join(rootDir, "public"), imagePath);
|
|
24680
24737
|
const patterns = [
|
|
24681
24738
|
`/${relPath}`,
|
|
24682
24739
|
// /images/hero.jpg
|
|
@@ -24698,7 +24755,7 @@ async function findImageUsages(imagePath, sourceFiles, rootDir) {
|
|
|
24698
24755
|
const elementType = detectElementType(line);
|
|
24699
24756
|
const canAutoMigrate = ["img", "Image"].includes(elementType);
|
|
24700
24757
|
usages.push({
|
|
24701
|
-
filePath:
|
|
24758
|
+
filePath: path12__default.default.relative(rootDir, sourceFile),
|
|
24702
24759
|
line: i + 1,
|
|
24703
24760
|
elementType,
|
|
24704
24761
|
altText: extractAltText(line),
|
|
@@ -24770,7 +24827,7 @@ function detectCriticalImage(filename, relPath, usages, fileSize) {
|
|
|
24770
24827
|
(u) => u.filePath.includes("layout.") || u.filePath.includes("/layout/")
|
|
24771
24828
|
);
|
|
24772
24829
|
const usedInCriticalComponent = usages.some((u) => {
|
|
24773
|
-
const fileName =
|
|
24830
|
+
const fileName = path12__default.default.basename(u.filePath).toLowerCase();
|
|
24774
24831
|
return fileName.includes("header") || fileName.includes("navbar") || fileName.includes("nav.") || fileName.includes("hero") || fileName.includes("footer");
|
|
24775
24832
|
});
|
|
24776
24833
|
const isSiteLogo = SITE_LOGO_PATTERNS.some((p) => p.test(filename));
|
|
@@ -24906,7 +24963,7 @@ async function uploadAndMigrateImages(scanResults, options) {
|
|
|
24906
24963
|
for (const img of scanResults.images) {
|
|
24907
24964
|
try {
|
|
24908
24965
|
const uploadResult = await uploadImageToPortal(
|
|
24909
|
-
|
|
24966
|
+
path12__default.default.join(rootDir, img.filePath),
|
|
24910
24967
|
img,
|
|
24911
24968
|
{
|
|
24912
24969
|
apiUrl: options.apiUrl,
|
|
@@ -24934,7 +24991,7 @@ async function uploadAndMigrateImages(scanResults, options) {
|
|
|
24934
24991
|
}
|
|
24935
24992
|
for (const [filePath, migrations] of byFile) {
|
|
24936
24993
|
try {
|
|
24937
|
-
await migrateFileImages(
|
|
24994
|
+
await migrateFileImages(path12__default.default.join(rootDir, filePath), migrations);
|
|
24938
24995
|
result.migrated += migrations.length;
|
|
24939
24996
|
} catch (error2) {
|
|
24940
24997
|
result.errors.push(`Migration failed for ${filePath}: ${error2.message}`);
|
|
@@ -24948,31 +25005,25 @@ async function migrateCommand(options) {
|
|
|
24948
25005
|
console.log("");
|
|
24949
25006
|
console.log(source_default.bold(" Site-Kit Migration"));
|
|
24950
25007
|
console.log("");
|
|
24951
|
-
const apiKey =
|
|
24952
|
-
const projectId = process.env.SONOR_PROJECT_ID;
|
|
24953
|
-
if (!apiKey || !projectId) {
|
|
24954
|
-
console.log(source_default.red(" \u2717 Missing environment variables"));
|
|
24955
|
-
console.log(source_default.gray(" Run `sonor-setup init` first to configure your project."));
|
|
24956
|
-
console.log("");
|
|
24957
|
-
process.exit(1);
|
|
24958
|
-
}
|
|
25008
|
+
const { apiKey, projectId, apiUrl } = await loadConfig({ resolveProject: true });
|
|
24959
25009
|
if (options.dryRun) {
|
|
24960
25010
|
console.log(source_default.yellow(" Running in dry-run mode - no files will be modified"));
|
|
24961
25011
|
console.log("");
|
|
24962
25012
|
}
|
|
24963
25013
|
if (options.file) {
|
|
24964
|
-
const filePath =
|
|
25014
|
+
const filePath = path12__default.default.resolve(options.file);
|
|
24965
25015
|
try {
|
|
24966
25016
|
await fs3__default.default.access(filePath);
|
|
24967
25017
|
} catch {
|
|
24968
25018
|
console.log(source_default.red(` \u2717 File not found: ${filePath}`));
|
|
24969
25019
|
process.exit(1);
|
|
24970
25020
|
}
|
|
24971
|
-
const spinner = ora(`Migrating ${
|
|
25021
|
+
const spinner = ora(`Migrating ${path12__default.default.basename(filePath)}...`).start();
|
|
24972
25022
|
try {
|
|
24973
25023
|
const result = await migrateFile(filePath, {
|
|
24974
25024
|
projectId,
|
|
24975
25025
|
apiKey,
|
|
25026
|
+
apiUrl,
|
|
24976
25027
|
dryRun: options.dryRun
|
|
24977
25028
|
});
|
|
24978
25029
|
if (result.success) {
|
|
@@ -25035,6 +25086,7 @@ async function migrateCommand(options) {
|
|
|
25035
25086
|
const results = await migrateFiles(scanResults, {
|
|
25036
25087
|
projectId,
|
|
25037
25088
|
apiKey,
|
|
25089
|
+
apiUrl,
|
|
25038
25090
|
dryRun: options.dryRun
|
|
25039
25091
|
});
|
|
25040
25092
|
const successful = results.filter((r) => r.success);
|
|
@@ -25064,10 +25116,9 @@ async function migrateCommand(options) {
|
|
|
25064
25116
|
process.exit(1);
|
|
25065
25117
|
}
|
|
25066
25118
|
console.log("");
|
|
25067
|
-
await handleImageMigration(options, apiKey);
|
|
25119
|
+
await handleImageMigration(options, apiKey, apiUrl);
|
|
25068
25120
|
}
|
|
25069
|
-
async function handleImageMigration(options, apiKey,
|
|
25070
|
-
const apiUrl = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
25121
|
+
async function handleImageMigration(options, apiKey, apiUrl) {
|
|
25071
25122
|
const imageScanSpinner = ora("Scanning for images...").start();
|
|
25072
25123
|
let imageResults;
|
|
25073
25124
|
try {
|
|
@@ -25131,17 +25182,11 @@ function formatBytes2(bytes) {
|
|
|
25131
25182
|
return `${parseFloat((bytes / Math.pow(k2, i)).toFixed(1))} ${sizes[i]}`;
|
|
25132
25183
|
}
|
|
25133
25184
|
var SKIP_PROPS = ["href", "src", "className", "style", "onClick", "ref", "key", "id", "target", "rel", "type", "name", "variant", "size", "icon"];
|
|
25134
|
-
var
|
|
25135
|
-
var TEMPLATES_DIR = ".uptrade/templates";
|
|
25185
|
+
var TEMPLATES_DIR = path12__default.default.join(SONOR_STATE_DIR, "templates");
|
|
25136
25186
|
async function locationsCommand(subcommand, arg, options) {
|
|
25137
25187
|
console.log("");
|
|
25138
25188
|
console.log(source_default.bold(" \u{1F4CD} Site-Kit Location Page Manager"));
|
|
25139
25189
|
console.log("");
|
|
25140
|
-
const config2 = await loadConfig();
|
|
25141
|
-
if (!config2?.projectId) {
|
|
25142
|
-
console.log(source_default.red(" \u2717 Not configured. Run `npx sonor-setup init` first."));
|
|
25143
|
-
return;
|
|
25144
|
-
}
|
|
25145
25190
|
switch (subcommand) {
|
|
25146
25191
|
case "template":
|
|
25147
25192
|
if (!arg) {
|
|
@@ -25149,6 +25194,7 @@ async function locationsCommand(subcommand, arg, options) {
|
|
|
25149
25194
|
console.log(source_default.gray(" Example: locations template ./app/services/plumbing/page.tsx"));
|
|
25150
25195
|
return;
|
|
25151
25196
|
}
|
|
25197
|
+
await loadConfig();
|
|
25152
25198
|
await templateCommand(arg, options);
|
|
25153
25199
|
break;
|
|
25154
25200
|
case "upload":
|
|
@@ -25156,17 +25202,17 @@ async function locationsCommand(subcommand, arg, options) {
|
|
|
25156
25202
|
console.log(source_default.red(" \u2717 Usage: locations upload --template <name>"));
|
|
25157
25203
|
return;
|
|
25158
25204
|
}
|
|
25159
|
-
await uploadCommand(options.template,
|
|
25205
|
+
await uploadCommand(options.template, await loadConfig({ resolveProject: true }));
|
|
25160
25206
|
break;
|
|
25161
25207
|
case "generate":
|
|
25162
25208
|
if (!options.template) {
|
|
25163
25209
|
console.log(source_default.red(' \u2717 Usage: locations generate --template <name> --locations "City, ST" ...'));
|
|
25164
25210
|
return;
|
|
25165
25211
|
}
|
|
25166
|
-
await generateCommand(options,
|
|
25212
|
+
await generateCommand(options, await loadConfig({ resolveProject: true }));
|
|
25167
25213
|
break;
|
|
25168
25214
|
case "list":
|
|
25169
|
-
await listCommand(
|
|
25215
|
+
await listCommand(await loadConfig({ resolveProject: true }));
|
|
25170
25216
|
break;
|
|
25171
25217
|
default:
|
|
25172
25218
|
console.log(source_default.yellow(" Available subcommands:"));
|
|
@@ -25178,10 +25224,10 @@ async function locationsCommand(subcommand, arg, options) {
|
|
|
25178
25224
|
console.log("");
|
|
25179
25225
|
}
|
|
25180
25226
|
}
|
|
25181
|
-
async function templateCommand(sourcePath, options
|
|
25227
|
+
async function templateCommand(sourcePath, options) {
|
|
25182
25228
|
const spinner = ora("Analyzing source page...").start();
|
|
25183
25229
|
try {
|
|
25184
|
-
const resolvedPath =
|
|
25230
|
+
const resolvedPath = path12__default.default.resolve(sourcePath);
|
|
25185
25231
|
if (!fs.existsSync(resolvedPath)) {
|
|
25186
25232
|
spinner.fail(`File not found: ${sourcePath}`);
|
|
25187
25233
|
return;
|
|
@@ -25194,8 +25240,8 @@ async function templateCommand(sourcePath, options, config2) {
|
|
|
25194
25240
|
const slots = [];
|
|
25195
25241
|
const componentNames = [];
|
|
25196
25242
|
chunkJS75ORH7_js.traverse(ast, {
|
|
25197
|
-
JSXElement(
|
|
25198
|
-
const openingElement =
|
|
25243
|
+
JSXElement(path29) {
|
|
25244
|
+
const openingElement = path29.node.openingElement;
|
|
25199
25245
|
if (chunkJS75ORH7_js.isJSXIdentifier(openingElement.name)) {
|
|
25200
25246
|
const componentName = openingElement.name.name;
|
|
25201
25247
|
if (componentName[0] === componentName[0].toUpperCase()) {
|
|
@@ -25235,8 +25281,9 @@ async function templateCommand(sourcePath, options, config2) {
|
|
|
25235
25281
|
},
|
|
25236
25282
|
managed_components: ["schema", "faqs", "metadata"]
|
|
25237
25283
|
};
|
|
25238
|
-
|
|
25239
|
-
|
|
25284
|
+
const templatesDir = path12__default.default.join(process.cwd(), TEMPLATES_DIR);
|
|
25285
|
+
await fs3__default.default.mkdir(templatesDir, { recursive: true });
|
|
25286
|
+
const templatePath = path12__default.default.join(templatesDir, `${templateName}.json`);
|
|
25240
25287
|
await fs3__default.default.writeFile(templatePath, JSON.stringify(template, null, 2));
|
|
25241
25288
|
console.log("");
|
|
25242
25289
|
console.log(source_default.green(" \u2713 Template created:"), source_default.cyan(templatePath));
|
|
@@ -25315,7 +25362,7 @@ function inferGenerationHint(propName) {
|
|
|
25315
25362
|
return void 0;
|
|
25316
25363
|
}
|
|
25317
25364
|
function inferTemplateName(sourcePath) {
|
|
25318
|
-
const parts = sourcePath.split(
|
|
25365
|
+
const parts = sourcePath.split(path12__default.default.sep);
|
|
25319
25366
|
const pageIndex = parts.findIndex((p) => p === "page.tsx" || p === "page.jsx");
|
|
25320
25367
|
if (pageIndex > 0) {
|
|
25321
25368
|
return parts[pageIndex - 1];
|
|
@@ -25324,14 +25371,14 @@ function inferTemplateName(sourcePath) {
|
|
|
25324
25371
|
return filtered[filtered.length - 1] || "template";
|
|
25325
25372
|
}
|
|
25326
25373
|
function inferSourcePagePath(sourcePath) {
|
|
25327
|
-
const parts = sourcePath.split(
|
|
25374
|
+
const parts = sourcePath.split(path12__default.default.sep);
|
|
25328
25375
|
const appIndex = parts.findIndex((p) => p === "app" || p === "pages");
|
|
25329
25376
|
if (appIndex >= 0) {
|
|
25330
25377
|
const pathParts = parts.slice(appIndex + 1);
|
|
25331
25378
|
const filtered = pathParts.filter((p) => !["page.tsx", "page.jsx", "index.tsx", "index.jsx"].includes(p));
|
|
25332
25379
|
return "/" + filtered.join("/");
|
|
25333
25380
|
}
|
|
25334
|
-
return "/" +
|
|
25381
|
+
return "/" + path12__default.default.basename(sourcePath, path12__default.default.extname(sourcePath));
|
|
25335
25382
|
}
|
|
25336
25383
|
function toSnakeCase(str) {
|
|
25337
25384
|
return str.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
@@ -25343,22 +25390,22 @@ function truncate(str, maxLength) {
|
|
|
25343
25390
|
async function uploadCommand(templateName, config2) {
|
|
25344
25391
|
const spinner = ora("Uploading template to Portal...").start();
|
|
25345
25392
|
try {
|
|
25346
|
-
const templatePath =
|
|
25393
|
+
const templatePath = resolveStateReadPath(path12__default.default.join("templates", `${templateName}.json`));
|
|
25347
25394
|
if (!fs.existsSync(templatePath)) {
|
|
25348
25395
|
spinner.fail(`Template not found: ${templatePath}`);
|
|
25349
25396
|
console.log(source_default.gray(` Run: npx sonor-setup locations template <page> --name ${templateName}`));
|
|
25350
25397
|
return;
|
|
25351
25398
|
}
|
|
25352
25399
|
const template = JSON.parse(fs.readFileSync(templatePath, "utf-8"));
|
|
25353
|
-
const response = await fetch(`${
|
|
25400
|
+
const response = await fetch(`${config2.apiUrl}/seo/location-templates`, {
|
|
25354
25401
|
method: "POST",
|
|
25355
25402
|
headers: {
|
|
25356
25403
|
"Content-Type": "application/json",
|
|
25357
25404
|
"Authorization": `Bearer ${config2.apiKey}`
|
|
25358
25405
|
},
|
|
25359
25406
|
body: JSON.stringify({
|
|
25360
|
-
|
|
25361
|
-
|
|
25407
|
+
...template,
|
|
25408
|
+
project_id: config2.projectId
|
|
25362
25409
|
})
|
|
25363
25410
|
});
|
|
25364
25411
|
if (!response.ok) {
|
|
@@ -25366,11 +25413,11 @@ async function uploadCommand(templateName, config2) {
|
|
|
25366
25413
|
if (response.status === 409) {
|
|
25367
25414
|
spinner.text = "Template exists, updating...";
|
|
25368
25415
|
const existing = await fetch(
|
|
25369
|
-
`${
|
|
25416
|
+
`${config2.apiUrl}/seo/location-templates/by-name/${templateName}?project_id=${config2.projectId}`,
|
|
25370
25417
|
{ headers: { "Authorization": `Bearer ${config2.apiKey}` } }
|
|
25371
25418
|
);
|
|
25372
25419
|
const existingData = await existing.json();
|
|
25373
|
-
const updateResponse = await fetch(`${
|
|
25420
|
+
const updateResponse = await fetch(`${config2.apiUrl}/seo/location-templates/${existingData.id}`, {
|
|
25374
25421
|
method: "PUT",
|
|
25375
25422
|
headers: {
|
|
25376
25423
|
"Content-Type": "application/json",
|
|
@@ -25419,7 +25466,7 @@ async function generateCommand(options, config2) {
|
|
|
25419
25466
|
}
|
|
25420
25467
|
const spinner = ora(`Generating ${type || "service-location"} pages...`).start();
|
|
25421
25468
|
try {
|
|
25422
|
-
const response = await fetch(`${
|
|
25469
|
+
const response = await fetch(`${config2.apiUrl}/seo/location-pages/generate`, {
|
|
25423
25470
|
method: "POST",
|
|
25424
25471
|
headers: {
|
|
25425
25472
|
"Content-Type": "application/json",
|
|
@@ -25459,7 +25506,7 @@ async function listCommand(config2) {
|
|
|
25459
25506
|
const spinner = ora("Fetching templates...").start();
|
|
25460
25507
|
try {
|
|
25461
25508
|
const response = await fetch(
|
|
25462
|
-
`${
|
|
25509
|
+
`${config2.apiUrl}/seo/location-templates?project_id=${config2.projectId}`,
|
|
25463
25510
|
{ headers: { "Authorization": `Bearer ${config2.apiKey}` } }
|
|
25464
25511
|
);
|
|
25465
25512
|
if (!response.ok) {
|
|
@@ -25484,69 +25531,21 @@ async function listCommand(config2) {
|
|
|
25484
25531
|
});
|
|
25485
25532
|
}
|
|
25486
25533
|
console.log("");
|
|
25487
|
-
|
|
25488
|
-
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
console.log(source_default.gray(
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
});
|
|
25495
|
-
console.log("");
|
|
25496
|
-
}
|
|
25534
|
+
const localTemplates = await listLocalTemplates();
|
|
25535
|
+
if (localTemplates.length > 0) {
|
|
25536
|
+
console.log(source_default.gray(" Local (not uploaded):"));
|
|
25537
|
+
localTemplates.forEach((f) => {
|
|
25538
|
+
console.log(source_default.gray(` \u2022 ${f.replace(".json", "")}`));
|
|
25539
|
+
});
|
|
25540
|
+
console.log("");
|
|
25497
25541
|
}
|
|
25498
25542
|
} catch (error2) {
|
|
25499
25543
|
spinner.fail(`Failed to fetch templates: ${error2.message}`);
|
|
25500
25544
|
}
|
|
25501
25545
|
}
|
|
25502
|
-
async function loadConfig() {
|
|
25503
|
-
const configPath = path10__default.default.join(".uptrade", "config.json");
|
|
25504
|
-
if (fs.existsSync(configPath)) {
|
|
25505
|
-
try {
|
|
25506
|
-
const config2 = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
25507
|
-
return {
|
|
25508
|
-
projectId: config2.projectId || config2.project_id,
|
|
25509
|
-
apiKey: config2.apiKey || config2.api_key
|
|
25510
|
-
};
|
|
25511
|
-
} catch {
|
|
25512
|
-
return null;
|
|
25513
|
-
}
|
|
25514
|
-
}
|
|
25515
|
-
const projectId = process.env.SONOR_PROJECT_ID;
|
|
25516
|
-
const apiKey = process.env.SONOR_API_KEY;
|
|
25517
|
-
if (projectId && apiKey) {
|
|
25518
|
-
return { projectId, apiKey };
|
|
25519
|
-
}
|
|
25520
|
-
return null;
|
|
25521
|
-
}
|
|
25522
|
-
var API_URL3 = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
25523
|
-
async function loadConfig2() {
|
|
25524
|
-
const configPath = path10__default.default.join(".uptrade", "config.json");
|
|
25525
|
-
if (fs.existsSync(configPath)) {
|
|
25526
|
-
try {
|
|
25527
|
-
const config2 = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
25528
|
-
return {
|
|
25529
|
-
projectId: config2.projectId || config2.project_id,
|
|
25530
|
-
apiKey: config2.apiKey || config2.api_key
|
|
25531
|
-
};
|
|
25532
|
-
} catch {
|
|
25533
|
-
return null;
|
|
25534
|
-
}
|
|
25535
|
-
}
|
|
25536
|
-
const projectId = process.env.SONOR_PROJECT_ID;
|
|
25537
|
-
const apiKey = process.env.SONOR_API_KEY;
|
|
25538
|
-
if (projectId && apiKey) return { projectId, apiKey };
|
|
25539
|
-
return null;
|
|
25540
|
-
}
|
|
25541
25546
|
async function faqsCommand(subcommand, options) {
|
|
25542
25547
|
console.log("");
|
|
25543
|
-
const config2 = await
|
|
25544
|
-
if (!config2?.projectId || !config2?.apiKey) {
|
|
25545
|
-
console.log(source_default.red(" \u2717 Not configured. Run `npx sonor-setup init` first."));
|
|
25546
|
-
console.log(source_default.gray(" Set SONOR_API_KEY, or use .uptrade/config.json"));
|
|
25547
|
-
console.log("");
|
|
25548
|
-
return;
|
|
25549
|
-
}
|
|
25548
|
+
const config2 = await loadConfig({ resolveProject: true });
|
|
25550
25549
|
switch (subcommand) {
|
|
25551
25550
|
case "extract":
|
|
25552
25551
|
await extractCommand(options, config2);
|
|
@@ -25596,7 +25595,7 @@ async function extractCommand(options, config2) {
|
|
|
25596
25595
|
const faqContexts = [];
|
|
25597
25596
|
for (const faq of faqSections) {
|
|
25598
25597
|
try {
|
|
25599
|
-
const fullPath =
|
|
25598
|
+
const fullPath = path12__default.default.resolve(process.cwd(), faq.filePath);
|
|
25600
25599
|
const content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
25601
25600
|
let pagePath = faq.filePath.replace(/^app\//, "/").replace(/^src\/app\//, "/").replace(/\/page\.(tsx?|jsx?)$/, "").replace(/\[([^\]]+)\]/g, ":$1");
|
|
25602
25601
|
if (pagePath === "" || pagePath === "/page") pagePath = "/";
|
|
@@ -25611,7 +25610,7 @@ async function extractCommand(options, config2) {
|
|
|
25611
25610
|
if (importPath.startsWith("@/")) {
|
|
25612
25611
|
resolvedPath = importPath.replace("@/", "./");
|
|
25613
25612
|
} else if (importPath.startsWith(".")) {
|
|
25614
|
-
resolvedPath =
|
|
25613
|
+
resolvedPath = path12__default.default.resolve(path12__default.default.dirname(fullPath), importPath);
|
|
25615
25614
|
}
|
|
25616
25615
|
const extensions = ["", ".js", ".ts", ".jsx", ".tsx", ".json"];
|
|
25617
25616
|
for (const ext2 of extensions) {
|
|
@@ -25656,7 +25655,7 @@ async function extractCommand(options, config2) {
|
|
|
25656
25655
|
}
|
|
25657
25656
|
const extractSpinner = ora("Extracting FAQs via AI...").start();
|
|
25658
25657
|
try {
|
|
25659
|
-
const response = await fetch(`${
|
|
25658
|
+
const response = await fetch(`${config2.apiUrl}/seo/managed/faqs/extract`, {
|
|
25660
25659
|
method: "POST",
|
|
25661
25660
|
headers: {
|
|
25662
25661
|
"Content-Type": "application/json",
|
|
@@ -25691,7 +25690,7 @@ async function extractCommand(options, config2) {
|
|
|
25691
25690
|
let failed = 0;
|
|
25692
25691
|
for (const faq of extractedFaqs) {
|
|
25693
25692
|
try {
|
|
25694
|
-
const res = await fetch(`${
|
|
25693
|
+
const res = await fetch(`${config2.apiUrl}/seo/managed/faqs`, {
|
|
25695
25694
|
method: "POST",
|
|
25696
25695
|
headers: {
|
|
25697
25696
|
"Content-Type": "application/json",
|
|
@@ -25716,7 +25715,7 @@ async function extractCommand(options, config2) {
|
|
|
25716
25715
|
uploaded++;
|
|
25717
25716
|
console.log(source_default.green(` \u2713 ${faq.path}`) + source_default.gray(` (${faq.items.length} items)`));
|
|
25718
25717
|
} else if (res.status === 409 || res.status === 400) {
|
|
25719
|
-
const updateRes = await fetch(`${
|
|
25718
|
+
const updateRes = await fetch(`${config2.apiUrl}/seo/managed/faqs/by-path`, {
|
|
25720
25719
|
method: "PUT",
|
|
25721
25720
|
headers: {
|
|
25722
25721
|
"Content-Type": "application/json",
|
|
@@ -25786,7 +25785,7 @@ async function syncCommand(options, config2) {
|
|
|
25786
25785
|
if (codePaths.length === 0) {
|
|
25787
25786
|
spinner.warn("No ManagedFAQ components found");
|
|
25788
25787
|
console.log("");
|
|
25789
|
-
console.log(source_default.gray(' Add <ManagedFAQ
|
|
25788
|
+
console.log(source_default.gray(' Add <ManagedFAQ path="/your-page" /> to your pages, then run:'));
|
|
25790
25789
|
console.log(source_default.gray(" npx sonor-setup migrate (to add the component)"));
|
|
25791
25790
|
console.log(source_default.gray(" npx sonor-setup faqs sync (to register paths in Portal)"));
|
|
25792
25791
|
console.log("");
|
|
@@ -25803,7 +25802,7 @@ async function syncCommand(options, config2) {
|
|
|
25803
25802
|
const listSpinner = ora("Fetching existing FAQ sections from Portal...").start();
|
|
25804
25803
|
let existing = [];
|
|
25805
25804
|
try {
|
|
25806
|
-
const res = await fetch(`${
|
|
25805
|
+
const res = await fetch(`${config2.apiUrl}/seo/managed/faqs/project/${config2.projectId}`, {
|
|
25807
25806
|
headers: { Authorization: `Bearer ${config2.apiKey}` }
|
|
25808
25807
|
});
|
|
25809
25808
|
if (!res.ok) {
|
|
@@ -25832,7 +25831,7 @@ async function syncCommand(options, config2) {
|
|
|
25832
25831
|
let failed = 0;
|
|
25833
25832
|
for (const p of toCreate) {
|
|
25834
25833
|
try {
|
|
25835
|
-
const res = await fetch(`${
|
|
25834
|
+
const res = await fetch(`${config2.apiUrl}/seo/managed/faqs`, {
|
|
25836
25835
|
method: "POST",
|
|
25837
25836
|
headers: {
|
|
25838
25837
|
"Content-Type": "application/json",
|
|
@@ -25869,44 +25868,12 @@ async function syncCommand(options, config2) {
|
|
|
25869
25868
|
console.log(source_default.gray(" Add questions and answers there; they will appear on your site."));
|
|
25870
25869
|
console.log("");
|
|
25871
25870
|
}
|
|
25872
|
-
function getApiUrl() {
|
|
25873
|
-
return process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
25874
|
-
}
|
|
25875
|
-
async function loadConfig3() {
|
|
25876
|
-
const configPath = path10__default.default.join(".uptrade", "config.json");
|
|
25877
|
-
if (fs.existsSync(configPath)) {
|
|
25878
|
-
try {
|
|
25879
|
-
const config2 = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
25880
|
-
return {
|
|
25881
|
-
projectId: config2.projectId || config2.project_id,
|
|
25882
|
-
apiKey: config2.apiKey || config2.api_key,
|
|
25883
|
-
siteUrl: config2.siteUrl || config2.site_url,
|
|
25884
|
-
businessInfo: config2.businessInfo || config2.business_info
|
|
25885
|
-
};
|
|
25886
|
-
} catch {
|
|
25887
|
-
return null;
|
|
25888
|
-
}
|
|
25889
|
-
}
|
|
25890
|
-
const projectId = process.env.SONOR_PROJECT_ID;
|
|
25891
|
-
const apiKey = process.env.SONOR_API_KEY;
|
|
25892
|
-
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || process.env.SITE_URL;
|
|
25893
|
-
if (projectId && apiKey) {
|
|
25894
|
-
return { projectId, apiKey, siteUrl };
|
|
25895
|
-
}
|
|
25896
|
-
return null;
|
|
25897
|
-
}
|
|
25898
25871
|
async function setupCommand(options) {
|
|
25899
25872
|
console.log("");
|
|
25900
25873
|
console.log(source_default.bold.blue(" \u{1F680} Signal-Enhanced SEO Setup"));
|
|
25901
25874
|
console.log(source_default.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
25902
25875
|
console.log("");
|
|
25903
|
-
const config2 = await
|
|
25904
|
-
if (!config2?.projectId || !config2?.apiKey) {
|
|
25905
|
-
console.log(source_default.red(" \u2717 Not configured. Run `npx sonor-setup init` first."));
|
|
25906
|
-
console.log(source_default.gray(" Set SONOR_API_KEY"));
|
|
25907
|
-
console.log("");
|
|
25908
|
-
return;
|
|
25909
|
-
}
|
|
25876
|
+
const config2 = await loadConfig();
|
|
25910
25877
|
const capabilities = [];
|
|
25911
25878
|
if (options.faqsOnly) {
|
|
25912
25879
|
capabilities.push("extract_faqs");
|
|
@@ -26004,14 +25971,13 @@ async function setupCommand(options) {
|
|
|
26004
25971
|
const batch = batches[batchIndex];
|
|
26005
25972
|
const batchSpinner = ora(`Batch ${batchIndex + 1}/${batches.length}: Analyzing ${batch.length} pages...`).start();
|
|
26006
25973
|
try {
|
|
26007
|
-
const response = await fetch(`${
|
|
25974
|
+
const response = await fetch(`${config2.apiUrl}/api/public/seo/site-setup`, {
|
|
26008
25975
|
method: "POST",
|
|
26009
25976
|
headers: {
|
|
26010
25977
|
"Content-Type": "application/json",
|
|
26011
25978
|
"x-api-key": config2.apiKey
|
|
26012
25979
|
},
|
|
26013
25980
|
body: JSON.stringify({
|
|
26014
|
-
project_id: config2.projectId,
|
|
26015
25981
|
site_url: config2.siteUrl || "https://example.com",
|
|
26016
25982
|
// Only send business_info on first batch (for org schema)
|
|
26017
25983
|
business_info: batchIndex === 0 ? config2.businessInfo : void 0,
|
|
@@ -26103,10 +26069,10 @@ async function setupCommand(options) {
|
|
|
26103
26069
|
}
|
|
26104
26070
|
async function scanForPageFiles(rootDir) {
|
|
26105
26071
|
const pages = [];
|
|
26106
|
-
const appDir =
|
|
26107
|
-
const srcAppDir =
|
|
26108
|
-
const pagesDir =
|
|
26109
|
-
const srcPagesDir =
|
|
26072
|
+
const appDir = path12__default.default.join(rootDir, "app");
|
|
26073
|
+
const srcAppDir = path12__default.default.join(rootDir, "src", "app");
|
|
26074
|
+
const pagesDir = path12__default.default.join(rootDir, "pages");
|
|
26075
|
+
const srcPagesDir = path12__default.default.join(rootDir, "src", "pages");
|
|
26110
26076
|
const dirs = [appDir, srcAppDir, pagesDir, srcPagesDir];
|
|
26111
26077
|
for (const dir of dirs) {
|
|
26112
26078
|
if (fs.existsSync(dir)) {
|
|
@@ -26118,7 +26084,7 @@ async function scanForPageFiles(rootDir) {
|
|
|
26118
26084
|
async function scanDirectory(dir, baseDir, pages) {
|
|
26119
26085
|
const entries = await fs3__default.default.readdir(dir, { withFileTypes: true });
|
|
26120
26086
|
for (const entry of entries) {
|
|
26121
|
-
const fullPath =
|
|
26087
|
+
const fullPath = path12__default.default.join(dir, entry.name);
|
|
26122
26088
|
if (entry.isDirectory()) {
|
|
26123
26089
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "api") {
|
|
26124
26090
|
continue;
|
|
@@ -26129,8 +26095,8 @@ async function scanDirectory(dir, baseDir, pages) {
|
|
|
26129
26095
|
const isLegacyPage = baseDir.includes("/pages") && entry.name.match(/\.(tsx?|jsx?)$/) && !entry.name.startsWith("_");
|
|
26130
26096
|
if (isPage || isLegacyPage) {
|
|
26131
26097
|
const content = await fs3__default.default.readFile(fullPath, "utf-8");
|
|
26132
|
-
const relativePath =
|
|
26133
|
-
let pagePath = "/" +
|
|
26098
|
+
const relativePath = path12__default.default.relative(baseDir, fullPath);
|
|
26099
|
+
let pagePath = "/" + path12__default.default.dirname(relativePath).replace(/\\/g, "/").replace(/\/page$/, "");
|
|
26134
26100
|
pagePath = pagePath.replace(/\[([^\]]+)\]/g, ":$1").replace(/^\/\.$/, "/");
|
|
26135
26101
|
if (pagePath === "/.") pagePath = "/";
|
|
26136
26102
|
pages.push({
|
|
@@ -26150,10 +26116,10 @@ async function gatherImportedFiles(page, rootDir) {
|
|
|
26150
26116
|
if (importPath.toLowerCase().includes("faq") || importPath.includes("@/data") || importPath.includes("./data") || importPath.includes("../data") || importPath.includes("/constants") || importPath.includes("/content") || importPath.includes("practice-areas") || importPath.includes("subpages") || importPath.includes("pages-data")) {
|
|
26151
26117
|
let resolvedPath = importPath;
|
|
26152
26118
|
if (importPath.startsWith("@/")) {
|
|
26153
|
-
resolvedPath =
|
|
26119
|
+
resolvedPath = path12__default.default.join(rootDir, importPath.replace("@/", ""));
|
|
26154
26120
|
} else if (importPath.startsWith(".")) {
|
|
26155
|
-
const pageDir =
|
|
26156
|
-
resolvedPath =
|
|
26121
|
+
const pageDir = path12__default.default.dirname(path12__default.default.join(rootDir, "app", page.filePath));
|
|
26122
|
+
resolvedPath = path12__default.default.resolve(pageDir, importPath);
|
|
26157
26123
|
}
|
|
26158
26124
|
const extensions = ["", ".js", ".ts", ".jsx", ".tsx", ".json"];
|
|
26159
26125
|
for (const ext2 of extensions) {
|
|
@@ -26209,20 +26175,20 @@ async function expandDynamicRoutes(pages, rootDir) {
|
|
|
26209
26175
|
async function findDynamicRouteData(page, parentPath, rootDir) {
|
|
26210
26176
|
const results = [];
|
|
26211
26177
|
const dataFilePaths = [
|
|
26212
|
-
|
|
26213
|
-
|
|
26214
|
-
|
|
26215
|
-
|
|
26216
|
-
|
|
26217
|
-
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26178
|
+
path12__default.default.join(rootDir, "data", "practice-areas.js"),
|
|
26179
|
+
path12__default.default.join(rootDir, "data", "practice-areas.ts"),
|
|
26180
|
+
path12__default.default.join(rootDir, "data", "personal-injury-pages.js"),
|
|
26181
|
+
path12__default.default.join(rootDir, "data", "personal-injury-pages.ts"),
|
|
26182
|
+
path12__default.default.join(rootDir, "data", "pages.js"),
|
|
26183
|
+
path12__default.default.join(rootDir, "data", "pages.ts"),
|
|
26184
|
+
path12__default.default.join(rootDir, "data", "content.js"),
|
|
26185
|
+
path12__default.default.join(rootDir, "data", "content.ts"),
|
|
26186
|
+
path12__default.default.join(rootDir, "data", "services.js"),
|
|
26187
|
+
path12__default.default.join(rootDir, "data", "services.ts"),
|
|
26188
|
+
path12__default.default.join(rootDir, "data", "subpages.js"),
|
|
26189
|
+
path12__default.default.join(rootDir, "data", "subpages.ts"),
|
|
26190
|
+
path12__default.default.join(rootDir, "src", "data", "practice-areas.js"),
|
|
26191
|
+
path12__default.default.join(rootDir, "src", "data", "practice-areas.ts")
|
|
26226
26192
|
];
|
|
26227
26193
|
const routeSegment = parentPath.replace(/^\//, "").split("/")[0];
|
|
26228
26194
|
const routeSegmentNormalized = routeSegment.replace(/-/g, "");
|
|
@@ -26314,7 +26280,7 @@ async function uploadFaqs(pages, config2) {
|
|
|
26314
26280
|
for (const page of pages) {
|
|
26315
26281
|
if (!page.faqs?.items?.length) continue;
|
|
26316
26282
|
try {
|
|
26317
|
-
const res = await fetch(`${
|
|
26283
|
+
const res = await fetch(`${config2.apiUrl}/api/public/seo/register-faq`, {
|
|
26318
26284
|
method: "POST",
|
|
26319
26285
|
headers: {
|
|
26320
26286
|
"Content-Type": "application/json",
|
|
@@ -26349,7 +26315,7 @@ async function uploadFaqs(pages, config2) {
|
|
|
26349
26315
|
async function uploadSchemas(pages, globalSchema, config2) {
|
|
26350
26316
|
if (globalSchema) {
|
|
26351
26317
|
try {
|
|
26352
|
-
const res = await fetch(`${
|
|
26318
|
+
const res = await fetch(`${config2.apiUrl}/api/public/seo/register-schema`, {
|
|
26353
26319
|
method: "POST",
|
|
26354
26320
|
headers: {
|
|
26355
26321
|
"Content-Type": "application/json",
|
|
@@ -26375,7 +26341,7 @@ async function uploadSchemas(pages, globalSchema, config2) {
|
|
|
26375
26341
|
if (!page.schemas?.length) continue;
|
|
26376
26342
|
for (const schema of page.schemas) {
|
|
26377
26343
|
try {
|
|
26378
|
-
const res = await fetch(`${
|
|
26344
|
+
const res = await fetch(`${config2.apiUrl}/api/public/seo/register-schema`, {
|
|
26379
26345
|
method: "POST",
|
|
26380
26346
|
headers: {
|
|
26381
26347
|
"Content-Type": "application/json",
|
|
@@ -26399,7 +26365,7 @@ async function uploadSchemas(pages, globalSchema, config2) {
|
|
|
26399
26365
|
}
|
|
26400
26366
|
}
|
|
26401
26367
|
}
|
|
26402
|
-
var APP_DIRS = ["app",
|
|
26368
|
+
var APP_DIRS = ["app", path12__default.default.join("src", "app")];
|
|
26403
26369
|
var CARD_FILE = /^(opengraph-image|twitter-image)\b.*\.(png|jpe?g|gif|webp)$/i;
|
|
26404
26370
|
function safeExists(p) {
|
|
26405
26371
|
try {
|
|
@@ -26419,19 +26385,19 @@ function findPageCards(cwd) {
|
|
|
26419
26385
|
}
|
|
26420
26386
|
for (const entry of entries) {
|
|
26421
26387
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
26422
|
-
const full =
|
|
26388
|
+
const full = path12__default.default.join(dir, entry.name);
|
|
26423
26389
|
if (entry.isDirectory()) walk(full);
|
|
26424
26390
|
else if (CARD_FILE.test(entry.name)) found.push(full);
|
|
26425
26391
|
}
|
|
26426
26392
|
};
|
|
26427
|
-
for (const rel of APP_DIRS) walk(
|
|
26393
|
+
for (const rel of APP_DIRS) walk(path12__default.default.join(cwd, rel));
|
|
26428
26394
|
return found;
|
|
26429
26395
|
}
|
|
26430
26396
|
function readOgWiring(cwd) {
|
|
26431
26397
|
const siteCard = ["public/og.png", "public/og.jpg", "public/opengraph.png"].some(
|
|
26432
|
-
(rel) => safeExists(
|
|
26398
|
+
(rel) => safeExists(path12__default.default.join(cwd, rel))
|
|
26433
26399
|
);
|
|
26434
|
-
const layoutPath = ["app/layout.tsx", "src/app/layout.tsx"].map((rel) =>
|
|
26400
|
+
const layoutPath = ["app/layout.tsx", "src/app/layout.tsx"].map((rel) => path12__default.default.join(cwd, rel)).find(safeExists);
|
|
26435
26401
|
let layout = "";
|
|
26436
26402
|
if (layoutPath) {
|
|
26437
26403
|
try {
|
|
@@ -26490,8 +26456,15 @@ function checkOgWiring(cwd) {
|
|
|
26490
26456
|
return judgeOgWiring(readOgWiring(cwd));
|
|
26491
26457
|
}
|
|
26492
26458
|
|
|
26459
|
+
// src/cli/agent/ssr-bailout.ts
|
|
26460
|
+
var DEFERRED_SIBLING_SINCE = "3.0.2";
|
|
26461
|
+
var LAYOUT_ALREADY_DEFERS = `plain <SiteKitLayout>{children}</SiteKitLayout> already mounts analytics as a deferred, childless sibling on site-kit >=${DEFERRED_SIBLING_SINCE}`;
|
|
26462
|
+
var LEGACY_STOPGAP = `Only on site-kit <${DEFERRED_SIBLING_SINCE}: upgrade, or as a stopgap run SiteKitLayout with analytics={false} plus a deferred, childless analytics sibling.`;
|
|
26463
|
+
var SSR_BAILOUT_FIX = `Keep the layout: ${LAYOUT_ALREADY_DEFERS}, so it is not the cause. Find what else wraps {children}, usually a next/dynamic({ ssr: false }) component such as a site's own lazy Providers. Import it statically (a client component still server-renders; only ssr: false skips that) or mount it as a childless sibling. ${LEGACY_STOPGAP}`;
|
|
26464
|
+
var ANALYTICS_WRAPPER_FIX = `Remove the <AnalyticsProvider> wrapper: ${LAYOUT_ALREADY_DEFERS} (configure it with analytics={{ ... }}). Track custom events with trackEvent / trackConversion from @sonordev/site-kit/analytics, which need no provider, instead of useAnalytics(). ` + LEGACY_STOPGAP;
|
|
26465
|
+
|
|
26493
26466
|
// src/cli/agent/checks.ts
|
|
26494
|
-
var
|
|
26467
|
+
var API_URL = process.env.SONOR_API_URL || "https://api.sonor.io";
|
|
26495
26468
|
async function readFileOrNull(p) {
|
|
26496
26469
|
try {
|
|
26497
26470
|
return await fs3__default.default.readFile(p, "utf-8");
|
|
@@ -26501,7 +26474,7 @@ async function readFileOrNull(p) {
|
|
|
26501
26474
|
}
|
|
26502
26475
|
async function findFirst(cwd, candidates) {
|
|
26503
26476
|
for (const rel of candidates) {
|
|
26504
|
-
const full =
|
|
26477
|
+
const full = path12__default.default.join(cwd, rel);
|
|
26505
26478
|
if (await readFileOrNull(full)) return full;
|
|
26506
26479
|
}
|
|
26507
26480
|
return null;
|
|
@@ -26553,7 +26526,7 @@ function checkApiKeyEnv() {
|
|
|
26553
26526
|
};
|
|
26554
26527
|
}
|
|
26555
26528
|
async function checkPackageInstalled(cwd) {
|
|
26556
|
-
const raw = await readFileOrNull(
|
|
26529
|
+
const raw = await readFileOrNull(path12__default.default.join(cwd, "package.json"));
|
|
26557
26530
|
if (!raw) {
|
|
26558
26531
|
return {
|
|
26559
26532
|
id: "package.installed",
|
|
@@ -26617,7 +26590,7 @@ async function checkSiteKitLayout(cwd) {
|
|
|
26617
26590
|
};
|
|
26618
26591
|
}
|
|
26619
26592
|
const content = await readFileOrNull(layoutPath) || "";
|
|
26620
|
-
const rel =
|
|
26593
|
+
const rel = path12__default.default.relative(cwd, layoutPath);
|
|
26621
26594
|
if (content.includes("SiteKitLayout")) {
|
|
26622
26595
|
return {
|
|
26623
26596
|
id: "layout.sitekit",
|
|
@@ -26673,7 +26646,7 @@ async function checkSitemap(cwd) {
|
|
|
26673
26646
|
};
|
|
26674
26647
|
}
|
|
26675
26648
|
async function checkPostbuildSitemap(cwd) {
|
|
26676
|
-
const raw = await readFileOrNull(
|
|
26649
|
+
const raw = await readFileOrNull(path12__default.default.join(cwd, "package.json"));
|
|
26677
26650
|
let pkg = {};
|
|
26678
26651
|
try {
|
|
26679
26652
|
pkg = raw ? JSON.parse(raw) : {};
|
|
@@ -26710,18 +26683,18 @@ async function checkPostbuildSitemap(cwd) {
|
|
|
26710
26683
|
async function checkApiReachable(timeoutMs = 5e3) {
|
|
26711
26684
|
const key = process.env.SONOR_API_KEY;
|
|
26712
26685
|
try {
|
|
26713
|
-
const res = await fetch(`${
|
|
26686
|
+
const res = await fetch(`${API_URL}/health`, {
|
|
26714
26687
|
headers: key ? { "x-api-key": key } : {},
|
|
26715
26688
|
signal: AbortSignal.timeout(timeoutMs)
|
|
26716
26689
|
});
|
|
26717
26690
|
if (res.ok) {
|
|
26718
|
-
return { id: "api.reachable", title: "Sonor API", level: "ok", message: `Reachable (${
|
|
26691
|
+
return { id: "api.reachable", title: "Sonor API", level: "ok", message: `Reachable (${API_URL})` };
|
|
26719
26692
|
}
|
|
26720
26693
|
return {
|
|
26721
26694
|
id: "api.reachable",
|
|
26722
26695
|
title: "Sonor API",
|
|
26723
26696
|
level: "warn",
|
|
26724
|
-
message: `HTTP ${res.status} from ${
|
|
26697
|
+
message: `HTTP ${res.status} from ${API_URL}`
|
|
26725
26698
|
};
|
|
26726
26699
|
} catch (err) {
|
|
26727
26700
|
return {
|
|
@@ -26746,7 +26719,7 @@ async function checkKeyValid(timeoutMs = 8e3) {
|
|
|
26746
26719
|
};
|
|
26747
26720
|
}
|
|
26748
26721
|
try {
|
|
26749
|
-
const res = await fetch(`${
|
|
26722
|
+
const res = await fetch(`${API_URL}/api/public/seo/verify-api-key`, {
|
|
26750
26723
|
headers: { "x-api-key": key },
|
|
26751
26724
|
signal: AbortSignal.timeout(timeoutMs)
|
|
26752
26725
|
});
|
|
@@ -26849,7 +26822,7 @@ async function checkClientAuth(timeoutMs = 8e3) {
|
|
|
26849
26822
|
}
|
|
26850
26823
|
const qs2 = host ? `?host=${encodeURIComponent(host)}` : "";
|
|
26851
26824
|
try {
|
|
26852
|
-
const res = await fetch(`${
|
|
26825
|
+
const res = await fetch(`${API_URL}/api/public/site-token/status${qs2}`, {
|
|
26853
26826
|
headers: { "x-api-key": key },
|
|
26854
26827
|
signal: AbortSignal.timeout(timeoutMs)
|
|
26855
26828
|
});
|
|
@@ -26972,7 +26945,7 @@ async function checkSsrRenderFromUrl(url, timeoutMs = 12e3) {
|
|
|
26972
26945
|
level: "error",
|
|
26973
26946
|
message: "Page bailed to client rendering",
|
|
26974
26947
|
detail: `Only ${contentTags} content tags in the server HTML \u2014 the route ships an empty shell + RSC flight data.`,
|
|
26975
|
-
fix:
|
|
26948
|
+
fix: SSR_BAILOUT_FIX,
|
|
26976
26949
|
docs: "manifest#failureModes"
|
|
26977
26950
|
};
|
|
26978
26951
|
}
|
|
@@ -26994,7 +26967,7 @@ async function checkSsrRenderFromUrl(url, timeoutMs = 12e3) {
|
|
|
26994
26967
|
}
|
|
26995
26968
|
}
|
|
26996
26969
|
async function checkSsrRenderFromBuild(cwd) {
|
|
26997
|
-
const appDir =
|
|
26970
|
+
const appDir = path12__default.default.join(cwd, ".next", "server", "app");
|
|
26998
26971
|
let entries;
|
|
26999
26972
|
try {
|
|
27000
26973
|
entries = await fs3__default.default.readdir(appDir);
|
|
@@ -27017,7 +26990,7 @@ async function checkSsrRenderFromBuild(cwd) {
|
|
|
27017
26990
|
detail: "The root route may be fully dynamic. Pass --url to verify a running instance."
|
|
27018
26991
|
};
|
|
27019
26992
|
}
|
|
27020
|
-
const html = await readFileOrNull(
|
|
26993
|
+
const html = await readFileOrNull(path12__default.default.join(appDir, htmlName)) || "";
|
|
27021
26994
|
const { rendered, contentTags } = looksServerRendered(html);
|
|
27022
26995
|
if (rendered) {
|
|
27023
26996
|
return {
|
|
@@ -27032,7 +27005,7 @@ async function checkSsrRenderFromBuild(cwd) {
|
|
|
27032
27005
|
title: "Server-side rendering",
|
|
27033
27006
|
level: "error",
|
|
27034
27007
|
message: `Prerendered HTML has only ${contentTags} content tags \u2014 likely CSR bailout`,
|
|
27035
|
-
fix:
|
|
27008
|
+
fix: SSR_BAILOUT_FIX,
|
|
27036
27009
|
docs: "manifest#failureModes"
|
|
27037
27010
|
};
|
|
27038
27011
|
}
|
|
@@ -27040,7 +27013,7 @@ async function checkNetlifyMiddleware(cwd) {
|
|
|
27040
27013
|
const runtimeRe = /runtime\s*[:=]\s*['"](nodejs|edge)['"]/;
|
|
27041
27014
|
const proxyFiles = ["proxy.ts", "proxy.js", "src/proxy.ts", "src/proxy.js"];
|
|
27042
27015
|
for (const rel of proxyFiles) {
|
|
27043
|
-
const content = await readFileOrNull(
|
|
27016
|
+
const content = await readFileOrNull(path12__default.default.join(cwd, rel));
|
|
27044
27017
|
if (content === null) continue;
|
|
27045
27018
|
if (runtimeRe.test(content)) {
|
|
27046
27019
|
return {
|
|
@@ -27057,7 +27030,7 @@ async function checkNetlifyMiddleware(cwd) {
|
|
|
27057
27030
|
}
|
|
27058
27031
|
const middlewareFiles = ["middleware.ts", "middleware.js", "src/middleware.ts", "src/middleware.js"];
|
|
27059
27032
|
for (const rel of middlewareFiles) {
|
|
27060
|
-
const content = await readFileOrNull(
|
|
27033
|
+
const content = await readFileOrNull(path12__default.default.join(cwd, rel));
|
|
27061
27034
|
if (content === null) continue;
|
|
27062
27035
|
if (/runtime\s*[:=]\s*['"]nodejs['"]/.test(content)) {
|
|
27063
27036
|
return {
|
|
@@ -27084,7 +27057,7 @@ async function checkNetlifyMiddleware(cwd) {
|
|
|
27084
27057
|
}
|
|
27085
27058
|
async function checkImageDimsDrift(cwd) {
|
|
27086
27059
|
const scanRoots = ["app", "src/app", "components", "src/components"];
|
|
27087
|
-
const publicDir =
|
|
27060
|
+
const publicDir = path12__default.default.join(cwd, "public");
|
|
27088
27061
|
const files = [];
|
|
27089
27062
|
async function walk(dir, depth) {
|
|
27090
27063
|
if (depth > 4) return;
|
|
@@ -27096,19 +27069,19 @@ async function checkImageDimsDrift(cwd) {
|
|
|
27096
27069
|
}
|
|
27097
27070
|
for (const e of entries) {
|
|
27098
27071
|
if (e.name === "node_modules" || e.name.startsWith(".")) continue;
|
|
27099
|
-
const full =
|
|
27072
|
+
const full = path12__default.default.join(dir, e.name);
|
|
27100
27073
|
if (e.isDirectory()) await walk(full, depth + 1);
|
|
27101
27074
|
else if (/\.(tsx|jsx)$/.test(e.name)) files.push(full);
|
|
27102
27075
|
}
|
|
27103
27076
|
}
|
|
27104
|
-
for (const root of scanRoots) await walk(
|
|
27077
|
+
for (const root of scanRoots) await walk(path12__default.default.join(cwd, root), 0);
|
|
27105
27078
|
if (files.length === 0) {
|
|
27106
27079
|
return { id: "images.dims-drift", title: "Image dims vs SVG", level: "skip", message: "No component files found" };
|
|
27107
27080
|
}
|
|
27108
27081
|
const viewBoxCache = /* @__PURE__ */ new Map();
|
|
27109
27082
|
async function svgAspect(publicPath) {
|
|
27110
27083
|
if (viewBoxCache.has(publicPath)) return viewBoxCache.get(publicPath);
|
|
27111
|
-
const svg = await readFileOrNull(
|
|
27084
|
+
const svg = await readFileOrNull(path12__default.default.join(publicDir, publicPath.replace(/^\//, "")));
|
|
27112
27085
|
let aspect = null;
|
|
27113
27086
|
if (svg) {
|
|
27114
27087
|
const vb = svg.match(/viewBox="([\d.\s-]+)"/);
|
|
@@ -27135,7 +27108,7 @@ async function checkImageDimsDrift(cwd) {
|
|
|
27135
27108
|
const drift = Math.abs(declared - actual) / actual;
|
|
27136
27109
|
if (drift > 0.02) {
|
|
27137
27110
|
drifts.push(
|
|
27138
|
-
`${
|
|
27111
|
+
`${path12__default.default.relative(cwd, file)}: ${src} is ${actual.toFixed(2)}:1 but width/height declare ${declared.toFixed(2)}:1 (${Math.round(drift * 100)}% off)`
|
|
27139
27112
|
);
|
|
27140
27113
|
}
|
|
27141
27114
|
}
|
|
@@ -27251,8 +27224,8 @@ async function statusCommand(options) {
|
|
|
27251
27224
|
|
|
27252
27225
|
// src/og/pages.ts
|
|
27253
27226
|
var DYNAMIC = "*";
|
|
27254
|
-
function pathSegments(
|
|
27255
|
-
return
|
|
27227
|
+
function pathSegments(path29) {
|
|
27228
|
+
return path29.split("/").filter(Boolean);
|
|
27256
27229
|
}
|
|
27257
27230
|
function stripBrandSuffix(title, brand) {
|
|
27258
27231
|
const cleaned = title.replace(/\s*[|–—-]\s*[^|–—-]+$/, "").trim();
|
|
@@ -27260,13 +27233,13 @@ function stripBrandSuffix(title, brand) {
|
|
|
27260
27233
|
if (brand && cleaned.toLowerCase() === brand.toLowerCase()) return title.trim();
|
|
27261
27234
|
return cleaned;
|
|
27262
27235
|
}
|
|
27263
|
-
function titleFromPath(
|
|
27264
|
-
const last = pathSegments(
|
|
27236
|
+
function titleFromPath(path29) {
|
|
27237
|
+
const last = pathSegments(path29).filter((s) => s !== DYNAMIC).pop();
|
|
27265
27238
|
if (!last) return "Home";
|
|
27266
27239
|
return last.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()).trim();
|
|
27267
27240
|
}
|
|
27268
|
-
function kickerFromPath(
|
|
27269
|
-
const parts = pathSegments(
|
|
27241
|
+
function kickerFromPath(path29, fallback) {
|
|
27242
|
+
const parts = pathSegments(path29);
|
|
27270
27243
|
const section = parts.includes(DYNAMIC) ? parts.filter((s) => s !== DYNAMIC) : parts.slice(0, -1);
|
|
27271
27244
|
if (!section.length) return fallback;
|
|
27272
27245
|
return section.join(" / ").replace(/[-_]+/g, " ");
|
|
@@ -27290,8 +27263,8 @@ function kickerIsRedundant(kicker, title) {
|
|
|
27290
27263
|
const titleWords = new Set(t.split(" "));
|
|
27291
27264
|
return k2.split(" ").every((w) => titleWords.has(w));
|
|
27292
27265
|
}
|
|
27293
|
-
function slugForPath(
|
|
27294
|
-
const segments = pathSegments(
|
|
27266
|
+
function slugForPath(path29) {
|
|
27267
|
+
const segments = pathSegments(path29);
|
|
27295
27268
|
if (!segments.length) return "home";
|
|
27296
27269
|
return segments.map((s) => s === DYNAMIC ? "any" : s).join("-").replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
27297
27270
|
}
|
|
@@ -27345,10 +27318,10 @@ function findChrome() {
|
|
|
27345
27318
|
}
|
|
27346
27319
|
return null;
|
|
27347
27320
|
}
|
|
27348
|
-
async function
|
|
27321
|
+
async function loadConfig2(cwd) {
|
|
27349
27322
|
const candidates = ["og.config.ts", "og.config.mts", "og.config.mjs", "og.config.js"];
|
|
27350
27323
|
for (const rel of candidates) {
|
|
27351
|
-
const full =
|
|
27324
|
+
const full = path12__default.default.join(cwd, rel);
|
|
27352
27325
|
if (!fs.existsSync(full)) continue;
|
|
27353
27326
|
try {
|
|
27354
27327
|
const mod = await import(
|
|
@@ -27373,7 +27346,7 @@ async function loadConfig4(cwd) {
|
|
|
27373
27346
|
return null;
|
|
27374
27347
|
}
|
|
27375
27348
|
async function seedConfig(cwd) {
|
|
27376
|
-
let name =
|
|
27349
|
+
let name = path12__default.default.basename(cwd).replace(/-nextjs$/, "").replace(/-/g, " ");
|
|
27377
27350
|
let accent = "#111111";
|
|
27378
27351
|
let logo;
|
|
27379
27352
|
try {
|
|
@@ -27386,7 +27359,7 @@ async function seedConfig(cwd) {
|
|
|
27386
27359
|
} catch {
|
|
27387
27360
|
}
|
|
27388
27361
|
for (const candidate of ["/logo-mark.svg", "/logo.svg", "/logohorizontal.svg"]) {
|
|
27389
|
-
if (fs.existsSync(
|
|
27362
|
+
if (fs.existsSync(path12__default.default.join(cwd, "public", candidate))) {
|
|
27390
27363
|
logo = candidate;
|
|
27391
27364
|
break;
|
|
27392
27365
|
}
|
|
@@ -27400,14 +27373,14 @@ async function seedConfig(cwd) {
|
|
|
27400
27373
|
}
|
|
27401
27374
|
function inlinePublicPaths(html, cwd) {
|
|
27402
27375
|
return html.replace(/src="(\/[^"]+)"/g, (_3, p) => {
|
|
27403
|
-
const full =
|
|
27376
|
+
const full = path12__default.default.join(cwd, "public", p);
|
|
27404
27377
|
return fs.existsSync(full) ? `src="file://${full}"` : `src="${p}"`;
|
|
27405
27378
|
});
|
|
27406
27379
|
}
|
|
27407
27380
|
async function renderCard(config2, outPath, cwd, chrome, tmpSuffix) {
|
|
27408
|
-
const tmpHtml =
|
|
27381
|
+
const tmpHtml = path12__default.default.join(cwd, `.sonor-og-${tmpSuffix}.html`);
|
|
27409
27382
|
try {
|
|
27410
|
-
await fs3__default.default.mkdir(
|
|
27383
|
+
await fs3__default.default.mkdir(path12__default.default.dirname(outPath), { recursive: true });
|
|
27411
27384
|
await fs3__default.default.writeFile(tmpHtml, inlinePublicPaths(chunk6CJP7BFM_js.buildOgHtml(config2), cwd));
|
|
27412
27385
|
const { stdout } = await execFileAsync5(
|
|
27413
27386
|
chrome,
|
|
@@ -27442,7 +27415,7 @@ function parseReport(dom) {
|
|
|
27442
27415
|
}
|
|
27443
27416
|
async function compressCard(pngPath, cwd) {
|
|
27444
27417
|
try {
|
|
27445
|
-
const require_ = (await import('module')).createRequire(
|
|
27418
|
+
const require_ = (await import('module')).createRequire(path12__default.default.join(cwd, "package.json"));
|
|
27446
27419
|
const sharp = require_("sharp");
|
|
27447
27420
|
const jpgPath = pngPath.replace(/\.png$/, ".jpg");
|
|
27448
27421
|
await sharp(pngPath).jpeg({ quality: 84, mozjpeg: true }).toFile(jpgPath);
|
|
@@ -27459,13 +27432,13 @@ function discoverDynamicSegments(appDir) {
|
|
|
27459
27432
|
if (!entry.isDirectory()) continue;
|
|
27460
27433
|
if (entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
|
|
27461
27434
|
if (entry.name === "api" || entry.name === "node_modules") continue;
|
|
27462
|
-
const full =
|
|
27435
|
+
const full = path12__default.default.join(dir, entry.name);
|
|
27463
27436
|
const isGroup = entry.name.startsWith("(") && entry.name.endsWith(")");
|
|
27464
27437
|
const isDynamic = entry.name.startsWith("[") && entry.name.endsWith("]");
|
|
27465
27438
|
const nextUrl = isGroup || isDynamic ? urlSegments : [...urlSegments, entry.name];
|
|
27466
27439
|
const nextPattern = isGroup ? pattern : [...pattern, isDynamic ? DYNAMIC : entry.name];
|
|
27467
27440
|
if (isDynamic) {
|
|
27468
|
-
const hasPage = ["tsx", "jsx", "ts", "js"].some((ext2) => fs.existsSync(
|
|
27441
|
+
const hasPage = ["tsx", "jsx", "ts", "js"].some((ext2) => fs.existsSync(path12__default.default.join(full, `page.${ext2}`)));
|
|
27469
27442
|
if (hasPage) {
|
|
27470
27443
|
found.push({ dir: full, path: `/${nextPattern.join("/")}`, parent: `/${urlSegments.join("/")}` });
|
|
27471
27444
|
}
|
|
@@ -27493,7 +27466,7 @@ async function resolveRouteCopy(paths) {
|
|
|
27493
27466
|
try {
|
|
27494
27467
|
if (process.env.SONOR_API_KEY) {
|
|
27495
27468
|
;
|
|
27496
|
-
({ getSEOPageData } = await import('../api-
|
|
27469
|
+
({ getSEOPageData } = await import('../api-XR5APCH3.js'));
|
|
27497
27470
|
}
|
|
27498
27471
|
} catch {
|
|
27499
27472
|
getSEOPageData = null;
|
|
@@ -27541,7 +27514,7 @@ async function runOg(options) {
|
|
|
27541
27514
|
errors: [{ code: "chrome_missing", message: "No Chrome or Chromium binary found", fix: "Install Chrome, or set SONOR_CHROME_PATH to its path." }]
|
|
27542
27515
|
};
|
|
27543
27516
|
}
|
|
27544
|
-
let config2 = await
|
|
27517
|
+
let config2 = await loadConfig2(cwd);
|
|
27545
27518
|
let seeded = false;
|
|
27546
27519
|
if (!config2) {
|
|
27547
27520
|
config2 = await seedConfig(cwd);
|
|
@@ -27549,7 +27522,7 @@ async function runOg(options) {
|
|
|
27549
27522
|
console.log(source_default.yellow(" ! No og.config.ts \u2014 generating a seed card from Sonor brand data."));
|
|
27550
27523
|
console.log(source_default.gray(" The site owns its theme: add og.config.ts (defineOgCard) with the real palette."));
|
|
27551
27524
|
}
|
|
27552
|
-
const outPath =
|
|
27525
|
+
const outPath = path12__default.default.resolve(cwd, options.out || "public/og.png");
|
|
27553
27526
|
let clean = true;
|
|
27554
27527
|
let cardKeyFix = null;
|
|
27555
27528
|
let pageCardsWritten = 0;
|
|
@@ -27559,8 +27532,8 @@ async function runOg(options) {
|
|
|
27559
27532
|
const report = await renderCard(config2, outPath, cwd, chrome, "site");
|
|
27560
27533
|
spinner.stop();
|
|
27561
27534
|
console.log(source_default.bold(` Site card${seeded ? source_default.gray(" (seed)") : ""}`));
|
|
27562
|
-
clean = reportCard(`${
|
|
27563
|
-
checks.push(cardCheck("site card",
|
|
27535
|
+
clean = reportCard(`${path12__default.default.relative(cwd, outPath)} \u2014 1200x630`, report) && clean;
|
|
27536
|
+
checks.push(cardCheck("site card", path12__default.default.relative(cwd, outPath), report));
|
|
27564
27537
|
} catch (err) {
|
|
27565
27538
|
const message = err instanceof Error ? err.message.split("\n")[0] : String(err);
|
|
27566
27539
|
spinner.fail(`Render failed: ${message}`);
|
|
@@ -27623,16 +27596,16 @@ async function runOg(options) {
|
|
|
27623
27596
|
const pageConfig = pageCardConfig(config2, route, brand);
|
|
27624
27597
|
const dir = route.dir ?? routeOutputDir(appDir, route.path);
|
|
27625
27598
|
for (const ext2 of ["png", "jpg", "jpeg"]) {
|
|
27626
|
-
await fs3__default.default.rm(
|
|
27599
|
+
await fs3__default.default.rm(path12__default.default.join(dir, `opengraph-image.${ext2}`), { force: true });
|
|
27627
27600
|
}
|
|
27628
|
-
const png =
|
|
27601
|
+
const png = path12__default.default.join(dir, "opengraph-image.png");
|
|
27629
27602
|
const report = await renderCard(pageConfig, png, cwd, chrome, `page-${i}`);
|
|
27630
27603
|
const file = await compressCard(png, cwd);
|
|
27631
27604
|
return { route, file, report };
|
|
27632
27605
|
});
|
|
27633
27606
|
for (const { route, file, report } of reports) {
|
|
27634
|
-
clean = reportCard(`${route.path} ${source_default.gray(
|
|
27635
|
-
checks.push(cardCheck(route.path,
|
|
27607
|
+
clean = reportCard(`${route.path} ${source_default.gray(path12__default.default.relative(cwd, file))}`, report) && clean;
|
|
27608
|
+
checks.push(cardCheck(route.path, path12__default.default.relative(cwd, file), report));
|
|
27636
27609
|
}
|
|
27637
27610
|
pageCardsWritten = reports.length;
|
|
27638
27611
|
const bytes = await totalBytes(reports.map((r) => r.file));
|
|
@@ -27643,13 +27616,13 @@ async function runOg(options) {
|
|
|
27643
27616
|
}
|
|
27644
27617
|
if (options.preview !== false) {
|
|
27645
27618
|
try {
|
|
27646
|
-
const require_ = (await import('module')).createRequire(
|
|
27619
|
+
const require_ = (await import('module')).createRequire(path12__default.default.join(cwd, "package.json"));
|
|
27647
27620
|
const sharp = require_("sharp");
|
|
27648
|
-
const previewPath =
|
|
27649
|
-
await fs3__default.default.mkdir(
|
|
27621
|
+
const previewPath = path12__default.default.join(cwd, ".sonor", "og-preview.png");
|
|
27622
|
+
await fs3__default.default.mkdir(path12__default.default.dirname(previewPath), { recursive: true });
|
|
27650
27623
|
await sharp(outPath).resize(300).toFile(previewPath);
|
|
27651
27624
|
console.log("");
|
|
27652
|
-
console.log(source_default.gray(` Thumbnail check: ${
|
|
27625
|
+
console.log(source_default.gray(` Thumbnail check: ${path12__default.default.relative(cwd, previewPath)} \u2014 if text is mush there, fix the card.`));
|
|
27653
27626
|
} catch {
|
|
27654
27627
|
console.log(source_default.gray(" (sharp not resolvable \u2014 skipped the 300px preview)"));
|
|
27655
27628
|
}
|
|
@@ -27708,15 +27681,15 @@ function routeOutputDir(appDir, urlPath) {
|
|
|
27708
27681
|
const segments = urlPath.split("/").filter(Boolean);
|
|
27709
27682
|
let dir = appDir;
|
|
27710
27683
|
for (const segment of segments) {
|
|
27711
|
-
const direct =
|
|
27684
|
+
const direct = path12__default.default.join(dir, segment);
|
|
27712
27685
|
if (fs.existsSync(direct)) {
|
|
27713
27686
|
dir = direct;
|
|
27714
27687
|
continue;
|
|
27715
27688
|
}
|
|
27716
27689
|
const group = fs.existsSync(dir) ? fs.readdirSync(dir, { withFileTypes: true }).find(
|
|
27717
|
-
(e) => e.isDirectory() && e.name.startsWith("(") && e.name.endsWith(")") && fs.existsSync(
|
|
27690
|
+
(e) => e.isDirectory() && e.name.startsWith("(") && e.name.endsWith(")") && fs.existsSync(path12__default.default.join(dir, e.name, segment))
|
|
27718
27691
|
) : void 0;
|
|
27719
|
-
dir = group ?
|
|
27692
|
+
dir = group ? path12__default.default.join(dir, group.name, segment) : direct;
|
|
27720
27693
|
}
|
|
27721
27694
|
return dir;
|
|
27722
27695
|
}
|
|
@@ -27731,7 +27704,7 @@ async function totalBytes(files) {
|
|
|
27731
27704
|
return total;
|
|
27732
27705
|
}
|
|
27733
27706
|
async function siteDomain(cwd) {
|
|
27734
|
-
const envFile =
|
|
27707
|
+
const envFile = path12__default.default.join(cwd, ".env.local");
|
|
27735
27708
|
if (fs.existsSync(envFile)) {
|
|
27736
27709
|
const env3 = await fs3__default.default.readFile(envFile, "utf-8").catch(() => "");
|
|
27737
27710
|
const url = env3.match(/^NEXT_PUBLIC_SITE_URL=(.+)$/m)?.[1]?.trim();
|
|
@@ -27856,14 +27829,14 @@ var hs = new RegExp(pe, "g");
|
|
|
27856
27829
|
var as = /\\\\/g;
|
|
27857
27830
|
var ls = /\\{/g;
|
|
27858
27831
|
var cs = /\\}/g;
|
|
27859
|
-
var
|
|
27832
|
+
var fs22 = /\\,/g;
|
|
27860
27833
|
var us = /\\./g;
|
|
27861
27834
|
var ds = 1e5;
|
|
27862
27835
|
function Ht(n5) {
|
|
27863
27836
|
return isNaN(n5) ? n5.charCodeAt(0) : parseInt(n5, 10);
|
|
27864
27837
|
}
|
|
27865
27838
|
function ps(n5) {
|
|
27866
|
-
return n5.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(
|
|
27839
|
+
return n5.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs22, de).replace(us, pe);
|
|
27867
27840
|
}
|
|
27868
27841
|
function ms(n5) {
|
|
27869
27842
|
return n5.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os5, ",").replace(hs, ".");
|
|
@@ -29946,7 +29919,7 @@ var Pt = class n extends R {
|
|
|
29946
29919
|
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
29947
29920
|
}
|
|
29948
29921
|
getRootString(t) {
|
|
29949
|
-
return
|
|
29922
|
+
return path12.win32.parse(t).root;
|
|
29950
29923
|
}
|
|
29951
29924
|
getRoot(t) {
|
|
29952
29925
|
if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
|
|
@@ -30218,13 +30191,13 @@ var It = (_a8 = class {
|
|
|
30218
30191
|
var it = class extends It {
|
|
30219
30192
|
constructor(t = process.cwd(), e = {}) {
|
|
30220
30193
|
let { nocase: s = true } = e;
|
|
30221
|
-
super(t,
|
|
30194
|
+
super(t, path12.win32, "\\", { ...e, nocase: s });
|
|
30222
30195
|
chunkSNAQBZPT_js.__publicField(this, "sep", "\\");
|
|
30223
30196
|
this.nocase = s;
|
|
30224
30197
|
for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
|
|
30225
30198
|
}
|
|
30226
30199
|
parseRootPath(t) {
|
|
30227
|
-
return
|
|
30200
|
+
return path12.win32.parse(t).root.toUpperCase();
|
|
30228
30201
|
}
|
|
30229
30202
|
newRoot(t) {
|
|
30230
30203
|
return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
@@ -30236,7 +30209,7 @@ var it = class extends It {
|
|
|
30236
30209
|
var rt = class extends It {
|
|
30237
30210
|
constructor(t = process.cwd(), e = {}) {
|
|
30238
30211
|
let { nocase: s = false } = e;
|
|
30239
|
-
super(t,
|
|
30212
|
+
super(t, path12.posix, "/", { ...e, nocase: s });
|
|
30240
30213
|
chunkSNAQBZPT_js.__publicField(this, "sep", "/");
|
|
30241
30214
|
this.nocase = s;
|
|
30242
30215
|
}
|
|
@@ -30895,10 +30868,10 @@ function unifiedDiff(before, after, filePath, context = 2) {
|
|
|
30895
30868
|
return lines.join("\n");
|
|
30896
30869
|
}
|
|
30897
30870
|
function ext(filePath) {
|
|
30898
|
-
return
|
|
30871
|
+
return path12__default.default.extname(filePath).toLowerCase();
|
|
30899
30872
|
}
|
|
30900
30873
|
function basename(filePath) {
|
|
30901
|
-
return
|
|
30874
|
+
return path12__default.default.basename(filePath).toLowerCase();
|
|
30902
30875
|
}
|
|
30903
30876
|
var CODE_EXT = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
|
|
30904
30877
|
var TEXT_EXT = /* @__PURE__ */ new Set([...CODE_EXT, ".css", ".scss", ".json", ".md", ".mdx"]);
|
|
@@ -30998,18 +30971,21 @@ var analyticsSibling = {
|
|
|
30998
30971
|
appliesTo(filePath) {
|
|
30999
30972
|
return LAYOUT_FILE.test(filePath.replace(/\\/g, "/"));
|
|
31000
30973
|
},
|
|
31001
|
-
// Deliberately detect-and-flag, never auto-rewrite:
|
|
31002
|
-
//
|
|
31003
|
-
//
|
|
30974
|
+
// Deliberately detect-and-flag, never auto-rewrite: removing a wrapper from
|
|
30975
|
+
// an arbitrary layout can silently drop analytics or break the tree. We
|
|
30976
|
+
// surface the exact fix instead of guessing.
|
|
30977
|
+
//
|
|
30978
|
+
// A plain <SiteKitLayout>{children}</SiteKitLayout> is NOT flagged: it is the
|
|
30979
|
+
// blessed layout, and since 3.0.2 it mounts analytics as a deferred, childless
|
|
30980
|
+
// sibling itself (see ssr-bailout.ts). Flagging it told every correct site to
|
|
30981
|
+
// hand-roll the sibling the package already ships.
|
|
31004
30982
|
run(source) {
|
|
31005
30983
|
const flags = [];
|
|
31006
|
-
const wrapsChildren = /\{\s*children\s*\}/.test(source);
|
|
31007
|
-
const sitekitLayoutOn = /<SiteKitLayout(?![^>]*analytics\s*=\s*\{?\s*false)/.test(source) && /<SiteKitLayout[\s\S]*\{\s*children\s*\}[\s\S]*<\/SiteKitLayout>/.test(source);
|
|
31008
30984
|
const rawAnalyticsWrapper = /<AnalyticsProvider[\s\S]*\{\s*children\s*\}[\s\S]*<\/AnalyticsProvider>/.test(source);
|
|
31009
|
-
if (
|
|
30985
|
+
if (rawAnalyticsWrapper) {
|
|
31010
30986
|
flags.push({
|
|
31011
|
-
reason:
|
|
31012
|
-
fix:
|
|
30987
|
+
reason: "AnalyticsProvider wraps {children}: analytics joins the hydration path, and if the provider is lazy-loaded with next/dynamic({ ssr: false }) the whole route de-opts to client rendering (SSR bailout)",
|
|
30988
|
+
fix: ANALYTICS_WRAPPER_FIX
|
|
31013
30989
|
});
|
|
31014
30990
|
}
|
|
31015
30991
|
return { output: source, changes: [], flags };
|
|
@@ -31049,7 +31025,7 @@ var IGNORE = [
|
|
|
31049
31025
|
];
|
|
31050
31026
|
async function listFiles(cwd, onlyPath) {
|
|
31051
31027
|
if (onlyPath) {
|
|
31052
|
-
const rel =
|
|
31028
|
+
const rel = path12__default.default.isAbsolute(onlyPath) ? path12__default.default.relative(cwd, onlyPath) : onlyPath;
|
|
31053
31029
|
return [rel];
|
|
31054
31030
|
}
|
|
31055
31031
|
const matches = await Ze(SCAN_PATTERNS, { cwd, ignore: IGNORE, dot: true, nodir: true });
|
|
@@ -31061,7 +31037,7 @@ async function runCodemod(options) {
|
|
|
31061
31037
|
const files = await listFiles(cwd, onlyPath);
|
|
31062
31038
|
const changes = [];
|
|
31063
31039
|
for (const rel of files) {
|
|
31064
|
-
const full =
|
|
31040
|
+
const full = path12__default.default.join(cwd, rel);
|
|
31065
31041
|
let source;
|
|
31066
31042
|
try {
|
|
31067
31043
|
source = await fs3__default.default.readFile(full, "utf-8");
|
|
@@ -31210,9 +31186,9 @@ function findManifestPath() {
|
|
|
31210
31186
|
const baseDir = typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
31211
31187
|
let dir = baseDir;
|
|
31212
31188
|
for (let i = 0; i < 8; i++) {
|
|
31213
|
-
const candidate =
|
|
31189
|
+
const candidate = path12__default.default.join(dir, "agent-manifest.json");
|
|
31214
31190
|
if (fs__namespace.default.existsSync(candidate)) return candidate;
|
|
31215
|
-
const parent =
|
|
31191
|
+
const parent = path12__default.default.dirname(dir);
|
|
31216
31192
|
if (parent === dir) break;
|
|
31217
31193
|
dir = parent;
|
|
31218
31194
|
}
|
|
@@ -31354,8 +31330,8 @@ async function syncPagesToPortal(apiUrl, apiKey, dryRun) {
|
|
|
31354
31330
|
}
|
|
31355
31331
|
function findAppDir() {
|
|
31356
31332
|
const candidates = [
|
|
31357
|
-
|
|
31358
|
-
|
|
31333
|
+
path12__default.default.join(process.cwd(), "app"),
|
|
31334
|
+
path12__default.default.join(process.cwd(), "src", "app")
|
|
31359
31335
|
];
|
|
31360
31336
|
for (const candidate of candidates) {
|
|
31361
31337
|
if (fs.existsSync(candidate)) {
|
|
@@ -31365,7 +31341,7 @@ function findAppDir() {
|
|
|
31365
31341
|
return null;
|
|
31366
31342
|
}
|
|
31367
31343
|
function discoverPages(appDir, currentPath = "", pages = []) {
|
|
31368
|
-
const fullPath =
|
|
31344
|
+
const fullPath = path12__default.default.join(appDir, currentPath);
|
|
31369
31345
|
if (!fs.existsSync(fullPath)) {
|
|
31370
31346
|
return pages;
|
|
31371
31347
|
}
|
|
@@ -31387,7 +31363,7 @@ function discoverPages(appDir, currentPath = "", pages = []) {
|
|
|
31387
31363
|
});
|
|
31388
31364
|
}
|
|
31389
31365
|
for (const entry of entries) {
|
|
31390
|
-
const entryPath =
|
|
31366
|
+
const entryPath = path12__default.default.join(fullPath, entry);
|
|
31391
31367
|
const stat = fs.statSync(entryPath);
|
|
31392
31368
|
if (stat.isDirectory()) {
|
|
31393
31369
|
const folderName = entry.toLowerCase();
|
|
@@ -31400,21 +31376,21 @@ function discoverPages(appDir, currentPath = "", pages = []) {
|
|
|
31400
31376
|
if (entry.startsWith("_")) {
|
|
31401
31377
|
continue;
|
|
31402
31378
|
}
|
|
31403
|
-
discoverPages(appDir,
|
|
31379
|
+
discoverPages(appDir, path12__default.default.join(currentPath, entry), pages);
|
|
31404
31380
|
}
|
|
31405
31381
|
}
|
|
31406
31382
|
return pages;
|
|
31407
31383
|
}
|
|
31408
31384
|
function findNextBuildDir() {
|
|
31409
31385
|
const cwd = process.cwd();
|
|
31410
|
-
const candidate =
|
|
31386
|
+
const candidate = path12__default.default.join(cwd, ".next", "server", "app");
|
|
31411
31387
|
return fs.existsSync(candidate) ? candidate : null;
|
|
31412
31388
|
}
|
|
31413
31389
|
function extractPageContent(buildDir, pagePath) {
|
|
31414
31390
|
const baseName = pagePath === "/" ? "index" : pagePath.replace(/^\//, "");
|
|
31415
31391
|
const htmlCandidates = [
|
|
31416
|
-
|
|
31417
|
-
|
|
31392
|
+
path12__default.default.join(buildDir, `${baseName}.html`),
|
|
31393
|
+
path12__default.default.join(buildDir, baseName, "index.html")
|
|
31418
31394
|
];
|
|
31419
31395
|
let html = null;
|
|
31420
31396
|
for (const candidate of htmlCandidates) {
|
|
@@ -31428,8 +31404,8 @@ function extractPageContent(buildDir, pagePath) {
|
|
|
31428
31404
|
}
|
|
31429
31405
|
}
|
|
31430
31406
|
const rscCandidates = [
|
|
31431
|
-
|
|
31432
|
-
|
|
31407
|
+
path12__default.default.join(buildDir, `${baseName}.rsc`),
|
|
31408
|
+
path12__default.default.join(buildDir, baseName, "index.rsc")
|
|
31433
31409
|
];
|
|
31434
31410
|
let rsc = null;
|
|
31435
31411
|
for (const candidate of rscCandidates) {
|
|
@@ -31540,7 +31516,7 @@ var BLOG_EXTENSIONS = [".mdx", ".md"];
|
|
|
31540
31516
|
function findBlogDir() {
|
|
31541
31517
|
const cwd = process.cwd();
|
|
31542
31518
|
for (const dir of BLOG_DIRS) {
|
|
31543
|
-
const full =
|
|
31519
|
+
const full = path12__default.default.join(cwd, dir);
|
|
31544
31520
|
if (fs.existsSync(full)) return full;
|
|
31545
31521
|
}
|
|
31546
31522
|
return null;
|
|
@@ -31550,7 +31526,7 @@ async function discoverBlogPosts(dir) {
|
|
|
31550
31526
|
async function walk(currentDir) {
|
|
31551
31527
|
const entries = fs.readdirSync(currentDir);
|
|
31552
31528
|
for (const entry of entries) {
|
|
31553
|
-
const fullPath =
|
|
31529
|
+
const fullPath = path12__default.default.join(currentDir, entry);
|
|
31554
31530
|
const stat = fs.statSync(fullPath);
|
|
31555
31531
|
if (stat.isDirectory()) {
|
|
31556
31532
|
await walk(fullPath);
|
|
@@ -31567,7 +31543,7 @@ async function discoverBlogPosts(dir) {
|
|
|
31567
31543
|
date: frontmatter.date,
|
|
31568
31544
|
tags: frontmatter.tags,
|
|
31569
31545
|
author: frontmatter.author,
|
|
31570
|
-
filePath:
|
|
31546
|
+
filePath: path12__default.default.relative(process.cwd(), fullPath)
|
|
31571
31547
|
});
|
|
31572
31548
|
}
|
|
31573
31549
|
}
|
|
@@ -31600,7 +31576,7 @@ async function syncBlogToPortal(_apiUrl, _apiKey, _dryRun) {
|
|
|
31600
31576
|
}
|
|
31601
31577
|
const spinner = ora("Discovering blog posts...").start();
|
|
31602
31578
|
const posts = await discoverBlogPosts(blogDir);
|
|
31603
|
-
spinner.succeed(`Found ${posts.length} local markdown post(s) in ${
|
|
31579
|
+
spinner.succeed(`Found ${posts.length} local markdown post(s) in ${path12__default.default.relative(process.cwd(), blogDir)}`);
|
|
31604
31580
|
if (posts.length === 0) return;
|
|
31605
31581
|
for (const post of posts.slice(0, 10)) {
|
|
31606
31582
|
console.log(source_default.gray(` ${post.slug}: ${post.title || "(no title)"}`));
|
|
@@ -31617,11 +31593,11 @@ async function discoverSchemaUsage(appDir) {
|
|
|
31617
31593
|
async function walk(currentDir, currentPath = "") {
|
|
31618
31594
|
const entries = fs.readdirSync(currentDir);
|
|
31619
31595
|
for (const entry of entries) {
|
|
31620
|
-
const fullPath =
|
|
31596
|
+
const fullPath = path12__default.default.join(currentDir, entry);
|
|
31621
31597
|
const stat = fs.statSync(fullPath);
|
|
31622
31598
|
if (stat.isDirectory()) {
|
|
31623
31599
|
if (entry.startsWith(".") || entry === "node_modules") continue;
|
|
31624
|
-
await walk(fullPath,
|
|
31600
|
+
await walk(fullPath, path12__default.default.join(currentPath, entry));
|
|
31625
31601
|
continue;
|
|
31626
31602
|
}
|
|
31627
31603
|
if (!/\.(tsx?|jsx?)$/.test(entry)) continue;
|
|
@@ -31635,7 +31611,7 @@ async function discoverSchemaUsage(appDir) {
|
|
|
31635
31611
|
pagePath: pathMatch[1],
|
|
31636
31612
|
schemaTypes: ["managed"],
|
|
31637
31613
|
source: "ManagedSchema",
|
|
31638
|
-
filePath:
|
|
31614
|
+
filePath: path12__default.default.relative(process.cwd(), fullPath)
|
|
31639
31615
|
});
|
|
31640
31616
|
}
|
|
31641
31617
|
}
|
|
@@ -31653,7 +31629,7 @@ async function discoverSchemaUsage(appDir) {
|
|
|
31653
31629
|
pagePath,
|
|
31654
31630
|
schemaTypes: [...new Set(types)],
|
|
31655
31631
|
source: "json-ld",
|
|
31656
|
-
filePath:
|
|
31632
|
+
filePath: path12__default.default.relative(process.cwd(), fullPath)
|
|
31657
31633
|
});
|
|
31658
31634
|
}
|
|
31659
31635
|
}
|
|
@@ -31713,8 +31689,8 @@ async function apiRoutesCommand(options) {
|
|
|
31713
31689
|
console.log("");
|
|
31714
31690
|
process.exit(1);
|
|
31715
31691
|
}
|
|
31716
|
-
const routeDir =
|
|
31717
|
-
const routeFile =
|
|
31692
|
+
const routeDir = path12__default.default.join(appDir, "_uptrade", "api", "[...path]");
|
|
31693
|
+
const routeFile = path12__default.default.join(routeDir, "route.ts");
|
|
31718
31694
|
if (fs.existsSync(routeFile) && !options.force) {
|
|
31719
31695
|
console.log(source_default.yellow(" \u26A0 API routes already exist"));
|
|
31720
31696
|
console.log(source_default.gray(` ${routeFile}`));
|
|
@@ -31751,8 +31727,8 @@ async function apiRoutesCommand(options) {
|
|
|
31751
31727
|
}
|
|
31752
31728
|
function findAppDir2() {
|
|
31753
31729
|
const candidates = [
|
|
31754
|
-
|
|
31755
|
-
|
|
31730
|
+
path12__default.default.join(process.cwd(), "app"),
|
|
31731
|
+
path12__default.default.join(process.cwd(), "src", "app")
|
|
31756
31732
|
];
|
|
31757
31733
|
for (const candidate of candidates) {
|
|
31758
31734
|
if (fs.existsSync(candidate)) {
|
|
@@ -31865,12 +31841,12 @@ async function handleRequest(
|
|
|
31865
31841
|
`;
|
|
31866
31842
|
}
|
|
31867
31843
|
function detectPackageManager(cwd) {
|
|
31868
|
-
if (fs.existsSync(
|
|
31869
|
-
if (fs.existsSync(
|
|
31844
|
+
if (fs.existsSync(path12__default.default.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
31845
|
+
if (fs.existsSync(path12__default.default.join(cwd, "yarn.lock"))) return "yarn";
|
|
31870
31846
|
return "npm";
|
|
31871
31847
|
}
|
|
31872
31848
|
async function run6(ctx, options) {
|
|
31873
|
-
if (!fs.existsSync(
|
|
31849
|
+
if (!fs.existsSync(path12__default.default.join(ctx.cwd, "package.json"))) {
|
|
31874
31850
|
throw new UsageError(
|
|
31875
31851
|
"NO_PACKAGE_JSON",
|
|
31876
31852
|
"No package.json found",
|
|
@@ -31915,12 +31891,12 @@ async function installCommand(options) {
|
|
|
31915
31891
|
await runCommand(ctx, (c) => run6(c, options), renderHuman4);
|
|
31916
31892
|
}
|
|
31917
31893
|
function detectPackageManager2(cwd) {
|
|
31918
|
-
if (fs.existsSync(
|
|
31919
|
-
if (fs.existsSync(
|
|
31894
|
+
if (fs.existsSync(path12__default.default.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
31895
|
+
if (fs.existsSync(path12__default.default.join(cwd, "yarn.lock"))) return "yarn";
|
|
31920
31896
|
return "npm";
|
|
31921
31897
|
}
|
|
31922
31898
|
async function run7(ctx, options) {
|
|
31923
|
-
const pkgPath =
|
|
31899
|
+
const pkgPath = path12__default.default.join(ctx.cwd, "package.json");
|
|
31924
31900
|
if (!fs.existsSync(pkgPath)) {
|
|
31925
31901
|
throw new UsageError("NO_PACKAGE_JSON", "No package.json found", "Run this from your project root.");
|
|
31926
31902
|
}
|
|
@@ -31982,7 +31958,7 @@ async function scaffoldCommand(options) {
|
|
|
31982
31958
|
}
|
|
31983
31959
|
const files = [
|
|
31984
31960
|
{
|
|
31985
|
-
path:
|
|
31961
|
+
path: path12__default.default.join(appDir, "sitemap.ts"),
|
|
31986
31962
|
label: "Sitemap",
|
|
31987
31963
|
content: `import { createSitemap } from '@sonordev/site-kit/sitemap'
|
|
31988
31964
|
|
|
@@ -31997,7 +31973,7 @@ export default createSitemap({
|
|
|
31997
31973
|
`
|
|
31998
31974
|
},
|
|
31999
31975
|
{
|
|
32000
|
-
path:
|
|
31976
|
+
path: path12__default.default.join(appDir, "robots.txt", "route.ts"),
|
|
32001
31977
|
label: "Robots.txt",
|
|
32002
31978
|
content: `import { createRobots } from '@sonordev/site-kit/robots'
|
|
32003
31979
|
|
|
@@ -32005,7 +31981,7 @@ export const GET = createRobots({})
|
|
|
32005
31981
|
`
|
|
32006
31982
|
},
|
|
32007
31983
|
{
|
|
32008
|
-
path:
|
|
31984
|
+
path: path12__default.default.join(appDir, "llms.txt", "route.ts"),
|
|
32009
31985
|
label: "llms.txt",
|
|
32010
31986
|
content: `import { createLLMsTxtHandler } from '@sonordev/site-kit/llms'
|
|
32011
31987
|
|
|
@@ -32013,7 +31989,7 @@ export const GET = createLLMsTxtHandler({ preferStatic: true })
|
|
|
32013
31989
|
`
|
|
32014
31990
|
},
|
|
32015
31991
|
{
|
|
32016
|
-
path:
|
|
31992
|
+
path: path12__default.default.join(appDir, "llms-full.txt", "route.ts"),
|
|
32017
31993
|
label: "llms-full.txt",
|
|
32018
31994
|
content: `import { createLLMsFullTxtHandler } from '@sonordev/site-kit/llms'
|
|
32019
31995
|
|
|
@@ -32024,7 +32000,7 @@ export const GET = createLLMsFullTxtHandler({ preferStatic: true })
|
|
|
32024
32000
|
if (!options.minimal) {
|
|
32025
32001
|
files.push(
|
|
32026
32002
|
{
|
|
32027
|
-
path:
|
|
32003
|
+
path: path12__default.default.join(cwd, "proxy.ts"),
|
|
32028
32004
|
label: "Proxy (security headers; redirects resolve at the 404 boundary)",
|
|
32029
32005
|
content: `import { createProxy } from '@sonordev/site-kit/proxy'
|
|
32030
32006
|
|
|
@@ -32044,7 +32020,7 @@ export const config = {
|
|
|
32044
32020
|
`
|
|
32045
32021
|
},
|
|
32046
32022
|
{
|
|
32047
|
-
path:
|
|
32023
|
+
path: path12__default.default.join(appDir, "manifest.webmanifest", "route.ts"),
|
|
32048
32024
|
label: "PWA Manifest",
|
|
32049
32025
|
content: `import { createManifest } from '@sonordev/site-kit/manifest'
|
|
32050
32026
|
|
|
@@ -32052,7 +32028,7 @@ export const GET = createManifest()
|
|
|
32052
32028
|
`
|
|
32053
32029
|
},
|
|
32054
32030
|
{
|
|
32055
|
-
path:
|
|
32031
|
+
path: path12__default.default.join(appDir, "not-found.tsx"),
|
|
32056
32032
|
label: "404 Page (resolves managed redirects)",
|
|
32057
32033
|
content: `import { redirect, permanentRedirect } from 'next/navigation'
|
|
32058
32034
|
import { resolveManagedRedirect } from '@sonordev/site-kit/redirects/not-found'
|
|
@@ -32092,7 +32068,7 @@ export default async function NotFound() {
|
|
|
32092
32068
|
`
|
|
32093
32069
|
},
|
|
32094
32070
|
{
|
|
32095
|
-
path:
|
|
32071
|
+
path: path12__default.default.join(appDir, "error.tsx"),
|
|
32096
32072
|
label: "Error Boundary",
|
|
32097
32073
|
content: `'use client'
|
|
32098
32074
|
|
|
@@ -32132,7 +32108,7 @@ export default function Error({
|
|
|
32132
32108
|
`
|
|
32133
32109
|
},
|
|
32134
32110
|
{
|
|
32135
|
-
path:
|
|
32111
|
+
path: path12__default.default.join(cwd, "og.config.ts"),
|
|
32136
32112
|
label: "OG card config (run: sonor-setup og)",
|
|
32137
32113
|
content: `import { defineOgCard } from '@sonordev/site-kit/og'
|
|
32138
32114
|
|
|
@@ -32161,7 +32137,7 @@ export default defineOgCard({
|
|
|
32161
32137
|
// .env.local, not .env.example: one real env file per project. The
|
|
32162
32138
|
// deployer copies these values into the host's env settings. Skipped
|
|
32163
32139
|
// when the file already exists, so real keys are never touched.
|
|
32164
|
-
path:
|
|
32140
|
+
path: path12__default.default.join(cwd, ".env.local"),
|
|
32165
32141
|
label: ".env.local",
|
|
32166
32142
|
content: `# ===================================
|
|
32167
32143
|
# @sonordev/site-kit \u2014 Environment Variables
|
|
@@ -32183,7 +32159,7 @@ SONOR_API_KEY=sonor_your-project-uuid_your-secret-key
|
|
|
32183
32159
|
if (options.dryRun) {
|
|
32184
32160
|
console.log(source_default.yellow(" [DRY RUN] Would create:"));
|
|
32185
32161
|
for (const f of files) {
|
|
32186
|
-
const rel =
|
|
32162
|
+
const rel = path12__default.default.relative(cwd, f.path);
|
|
32187
32163
|
const exists = fs.existsSync(f.path);
|
|
32188
32164
|
console.log(
|
|
32189
32165
|
source_default.gray(` ${rel}`) + (exists ? source_default.yellow(" (exists, would skip)") : "")
|
|
@@ -32198,13 +32174,13 @@ SONOR_API_KEY=sonor_your-project-uuid_your-secret-key
|
|
|
32198
32174
|
for (const f of files) {
|
|
32199
32175
|
try {
|
|
32200
32176
|
if (fs.existsSync(f.path) && !options.force) {
|
|
32201
|
-
spinner.warn(`Skipped (exists): ${
|
|
32177
|
+
spinner.warn(`Skipped (exists): ${path12__default.default.relative(cwd, f.path)}`);
|
|
32202
32178
|
skipped++;
|
|
32203
32179
|
continue;
|
|
32204
32180
|
}
|
|
32205
|
-
await fs3__default.default.mkdir(
|
|
32181
|
+
await fs3__default.default.mkdir(path12__default.default.dirname(f.path), { recursive: true });
|
|
32206
32182
|
await fs3__default.default.writeFile(f.path, f.content, "utf-8");
|
|
32207
|
-
spinner.succeed(`${f.label}: ${
|
|
32183
|
+
spinner.succeed(`${f.label}: ${path12__default.default.relative(cwd, f.path)}`);
|
|
32208
32184
|
created++;
|
|
32209
32185
|
} catch (err) {
|
|
32210
32186
|
spinner.fail(`Failed: ${f.path}`);
|
|
@@ -32253,8 +32229,8 @@ SONOR_API_KEY=sonor_your-project-uuid_your-secret-key
|
|
|
32253
32229
|
async function findAppDir3() {
|
|
32254
32230
|
const cwd = process.cwd();
|
|
32255
32231
|
const candidates = [
|
|
32256
|
-
|
|
32257
|
-
|
|
32232
|
+
path12__default.default.join(cwd, "app"),
|
|
32233
|
+
path12__default.default.join(cwd, "src", "app")
|
|
32258
32234
|
];
|
|
32259
32235
|
for (const dir of candidates) {
|
|
32260
32236
|
if (fs.existsSync(dir)) return dir;
|
|
@@ -32278,17 +32254,17 @@ async function readIfExists(p) {
|
|
|
32278
32254
|
}
|
|
32279
32255
|
}
|
|
32280
32256
|
async function ensureLlmsRouteFiles(appDir, dryRun) {
|
|
32281
|
-
const llms =
|
|
32282
|
-
const llmsFull =
|
|
32257
|
+
const llms = path12__default.default.join(appDir, "llms.txt", "route.ts");
|
|
32258
|
+
const llmsFull = path12__default.default.join(appDir, "llms-full.txt", "route.ts");
|
|
32283
32259
|
let n5 = 0;
|
|
32284
32260
|
if (dryRun) return 0;
|
|
32285
32261
|
if (!fs.existsSync(llms)) {
|
|
32286
|
-
await fs3__default.default.mkdir(
|
|
32262
|
+
await fs3__default.default.mkdir(path12__default.default.dirname(llms), { recursive: true });
|
|
32287
32263
|
await fs3__default.default.writeFile(llms, LLMS_ROUTE, "utf-8");
|
|
32288
32264
|
n5++;
|
|
32289
32265
|
}
|
|
32290
32266
|
if (!fs.existsSync(llmsFull)) {
|
|
32291
|
-
await fs3__default.default.mkdir(
|
|
32267
|
+
await fs3__default.default.mkdir(path12__default.default.dirname(llmsFull), { recursive: true });
|
|
32292
32268
|
await fs3__default.default.writeFile(llmsFull, LLMS_FULL_ROUTE, "utf-8");
|
|
32293
32269
|
n5++;
|
|
32294
32270
|
}
|
|
@@ -32322,9 +32298,9 @@ async function geoCommand(options) {
|
|
|
32322
32298
|
console.log(source_default.red(" \u2717 No app directory (app/ or src/app/)"));
|
|
32323
32299
|
process.exit(1);
|
|
32324
32300
|
}
|
|
32325
|
-
const llms =
|
|
32326
|
-
const llmsFull =
|
|
32327
|
-
const sitemap =
|
|
32301
|
+
const llms = path12__default.default.join(appDir, "llms.txt", "route.ts");
|
|
32302
|
+
const llmsFull = path12__default.default.join(appDir, "llms-full.txt", "route.ts");
|
|
32303
|
+
const sitemap = path12__default.default.join(appDir, "sitemap.ts");
|
|
32328
32304
|
let allOk = true;
|
|
32329
32305
|
const row = (label, pass) => {
|
|
32330
32306
|
if (!pass) allOk = false;
|
|
@@ -32343,9 +32319,9 @@ async function geoCommand(options) {
|
|
|
32343
32319
|
row("sitemap.ts lists llms URLs", false);
|
|
32344
32320
|
}
|
|
32345
32321
|
const nextConfigs = [
|
|
32346
|
-
|
|
32347
|
-
|
|
32348
|
-
|
|
32322
|
+
path12__default.default.join(cwd, "next.config.ts"),
|
|
32323
|
+
path12__default.default.join(cwd, "next.config.mjs"),
|
|
32324
|
+
path12__default.default.join(cwd, "next.config.js")
|
|
32349
32325
|
];
|
|
32350
32326
|
let nextCfg = "";
|
|
32351
32327
|
for (const p of nextConfigs) {
|
|
@@ -32355,9 +32331,9 @@ async function geoCommand(options) {
|
|
|
32355
32331
|
}
|
|
32356
32332
|
}
|
|
32357
32333
|
const layoutCandidates = [
|
|
32358
|
-
|
|
32359
|
-
|
|
32360
|
-
|
|
32334
|
+
path12__default.default.join(appDir, "layout.tsx"),
|
|
32335
|
+
path12__default.default.join(appDir, "layout.jsx"),
|
|
32336
|
+
path12__default.default.join(appDir, "layout.js")
|
|
32361
32337
|
];
|
|
32362
32338
|
let layoutTxt = "";
|
|
32363
32339
|
for (const p of layoutCandidates) {
|
|
@@ -32417,10 +32393,10 @@ async function geoCommand(options) {
|
|
|
32417
32393
|
}
|
|
32418
32394
|
|
|
32419
32395
|
// src/cli/index.ts
|
|
32420
|
-
(0,
|
|
32421
|
-
(0,
|
|
32396
|
+
(0, import_dotenv2.config)({ path: ".env.local", quiet: true });
|
|
32397
|
+
(0, import_dotenv2.config)({ path: ".env", quiet: true });
|
|
32422
32398
|
var program2 = new Command();
|
|
32423
|
-
program2.name("sonor-setup").description("Setup + verification toolchain for @sonordev/site-kit").version(
|
|
32399
|
+
program2.name("sonor-setup").description("Setup + verification toolchain for @sonordev/site-kit").version(chunkKSL3WA2I_js.SITE_KIT_VERSION);
|
|
32424
32400
|
withAgentFlags(
|
|
32425
32401
|
program2.command("verify").description("Verify the integration actually works (health + key + SSR) \u2014 exit 0 = done").option("--url <url>", "Verify a running/deployed URL server-renders (recommended for agents)").option("--offline", "Skip the network key-validity ping").option("--strict", "Treat warnings as failures")
|
|
32426
32402
|
).action(verifyCommand);
|