From e050453dff63fbb142bc2b71c1184a2e63272b09 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 24 Sep 2024 00:43:30 +0100 Subject: [PATCH] feat: use `nuxt/scripts` to load cal script (#1454) --- app/middleware/cal.global.ts | 34 ---- app/plugins/cal.ts | 53 ++++++ budget.json | 2 +- nuxt.config.ts | 25 ++- package.json | 1 + pnpm-lock.yaml | 335 +++++++++++++++++++++++++++++++++++ test/unit/bundle.spec.ts | 7 +- 7 files changed, 418 insertions(+), 39 deletions(-) delete mode 100644 app/middleware/cal.global.ts create mode 100644 app/plugins/cal.ts diff --git a/app/middleware/cal.global.ts b/app/middleware/cal.global.ts deleted file mode 100644 index 262a1cbe..00000000 --- a/app/middleware/cal.global.ts +++ /dev/null @@ -1,34 +0,0 @@ -const initConfig = { - origin: 'https://app.cal.com', -} -const styleConfig = { - cssVarsPerTheme: { - light: { - 'cal-bg-muted': '#e5e7eb', - 'cal-bg-emphasis': '#f3f4f6', - }, - dark: { - 'cal-bg-muted': '#1f2937', - 'cal-bg-emphasis': '#374151', - }, - }, - hideEventTypeDetails: false, - layout: 'month_view', -} - -export default defineNuxtRouteMiddleware(to => { - if (to.path === '/blog/open-invitation' || to.path === '/blog/funding') { - useHead({ - script: [ - { - key: 'cal', - innerHTML: /* javascript */ ` -(function (C, A, L) { let p = function (a, ar) { a.q.push(ar); }; let d = C.document; C.Cal = C.Cal || function () { let cal = C.Cal; let ar = arguments; if (!cal.loaded) { cal.ns = {}; cal.q = cal.q || []; d.head.appendChild(d.createElement("script")).src = A; cal.loaded = true; } if (ar[0] === L) { const api = function () { p(api, arguments); }; const namespace = ar[1]; api.q = api.q || []; typeof namespace === "string" ? (cal.ns[namespace] = api) && p(api, ar) : p(cal, ar); return; } p(cal, ar); }; })(window, "https://app.cal.com/embed/embed.js", "init"); -Cal("init", ${JSON.stringify(initConfig)}); -Cal("ui", ${JSON.stringify(styleConfig)}); -`, - }, - ], - }) - } -}) diff --git a/app/plugins/cal.ts b/app/plugins/cal.ts new file mode 100644 index 00000000..4954f2cd --- /dev/null +++ b/app/plugins/cal.ts @@ -0,0 +1,53 @@ +export default defineNuxtPlugin(() => { + onPrehydrate(() => { + const cal = Object.assign( + function (...args: unknown[]) { + cal.q.push(args) + }, + { + ns: {}, + q: [] as unknown[][], + loaded: false, + }, + ) + window.Cal = cal + }) + + const $script = useScript('https://app.cal.com/embed/embed.js', { + trigger: 'manual', + }) + $script.onLoaded(() => { + window.Cal.loaded = true + window.Cal('init', { + origin: 'https://app.cal.com', + }) + window.Cal('ui', { + cssVarsPerTheme: { + light: { + 'cal-bg-muted': '#e5e7eb', + 'cal-bg-emphasis': '#f3f4f6', + }, + dark: { + 'cal-bg-muted': '#1f2937', + 'cal-bg-emphasis': '#374151', + }, + }, + hideEventTypeDetails: false, + layout: 'month_view', + }) + }) + useRouter().beforeEach(to => { + if (to.path === '/blog/open-invitation' || to.path === '/blog/funding') { + $script.load() + } + }) +}) + +declare global { + interface Window { + Cal: ((...args: unknown[]) => void) & { + loaded: boolean + q: unknown[][] + } + } +} diff --git a/budget.json b/budget.json index d5e44ec2..bfdc4ddc 100644 --- a/budget.json +++ b/budget.json @@ -8,7 +8,7 @@ }, { "resourceType": "script", - "budget": 71.7 + "budget": 73.4 }, { "resourceType": "stylesheet", diff --git a/nuxt.config.ts b/nuxt.config.ts index 6564bda0..c45de3e2 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -17,6 +17,13 @@ export default defineNuxtConfig({ experimental: { componentIslands: true, }, + modules: [ + function (_options, nuxt) { + nuxt.hook('vite:extendConfig', config => { + config.plugins = config.plugins?.filter(p => !p || !('name' in p) || p.name !== 'nuxt:scripts:bundler-transformer') + }) + }, + ], }, future: { @@ -89,6 +96,15 @@ export default defineNuxtConfig({ }, }, + security: { + headers: { + crossOriginEmbedderPolicy: false, + contentSecurityPolicy: { + 'script-src-attr': ['\'self\'', '\'unsafe-inline\''], + }, + }, + }, + devTo: { enabled: !!process.env.SYNC_DEV_TO, }, @@ -206,6 +222,12 @@ export default defineNuxtConfig({ }, }, + scripts: { + defaultScriptOptions: { + bundle: true, + }, + }, + htmlValidator: { failOnError: true, options: { @@ -250,7 +272,8 @@ export default defineNuxtConfig({ '@nuxt/content', '@nuxtjs/plausible', '@nuxt/fonts', - function (options, nuxt) { + '@nuxt/scripts', + function (_options, nuxt) { nuxt.hook('vite:extendConfig', config => { const deps = ['slugify', 'remark-gfm', 'remark-emoji', 'remark-mdc', 'remark-rehype', 'rehype-raw', 'parse5', 'unist-util-visit', 'unified', 'debug'] config.optimizeDeps!.include = config.optimizeDeps!.include?.map(d => deps.includes(d) ? `@nuxt/content > ${d}` : d) diff --git a/package.json b/package.json index bc1740cd..52511c18 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@nuxt/eslint": "0.5.7", "@nuxt/fonts": "0.8.0", "@nuxt/image": "1.8.0", + "@nuxt/scripts": "^0.9.3", "@nuxtjs/color-mode": "3.5.1", "@nuxtjs/html-validator": "1.8.2", "@nuxtjs/plausible": "1.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8da2acc8..f0bb3ca2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,6 +42,9 @@ importers: '@nuxt/image': specifier: 1.8.0 version: 1.8.0(ioredis@5.4.1)(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) + '@nuxt/scripts': + specifier: ^0.9.3 + version: 0.9.3(@nuxt/devtools@1.4.2(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3))(@unocss/webpack@0.62.4(rollup@4.22.2)(webpack@5.94.0(esbuild@0.23.1)))(@vue/compiler-core@3.5.6)(ioredis@5.4.1)(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(postcss@8.4.47)(rollup@4.22.2)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)(webpack@5.94.0(esbuild@0.23.1)) '@nuxtjs/color-mode': specifier: 3.5.1 version: 3.5.1(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) @@ -1031,6 +1034,12 @@ packages: resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} engines: {node: '>=18.18'} + '@iconify-json/carbon@1.2.1': + resolution: {integrity: sha512-dIMY6OOY9LnwR3kOqAtfz4phGFG+KNfESEwSL6muCprBelSlSPpRXtdqvEEO/qWhkf5AJ9hWrOV3Egi5Z2IuKA==} + + '@iconify-json/logos@1.2.0': + resolution: {integrity: sha512-VkU9QSqeZR2guWbecdqkcoZEAJfgJJTUm6QAsypuZQ7Cve6zy39wOXDjp2H31I8QyQy4O3Cz96+pNji6UQFg4w==} + '@iconify-json/ri@1.2.0': resolution: {integrity: sha512-br8It3uRHylNhEH72aU9VF6gIdL4BAi6JMdcxsCaVbAyWBJ0jd4RxfmsYnil6TmEfP5wxihiCKbtbQmIHZdqKg==} @@ -1137,6 +1146,16 @@ packages: peerDependencies: vite: '*' + '@nuxt/devtools-kit@1.5.1': + resolution: {integrity: sha512-s2dpN1vCOgua2pSYG7/xUMjf7CyLTBeEK2IRqeOeiNpiElft4ygDddlg6P3ot0Hpp+GvWTz0uPGot/vI73uk4w==} + peerDependencies: + vite: '*' + + '@nuxt/devtools-ui-kit@1.5.1': + resolution: {integrity: sha512-/1B2AYXuuPePWVuoHd/UGIKR3z3vO2bW73UAEszpHVLc/OwLA19K9f5o91sgyamAi2Qb5NymAMc/UZL0ijN8uA==} + peerDependencies: + '@nuxt/devtools': 1.5.1 + '@nuxt/devtools-wizard@1.4.2': resolution: {integrity: sha512-TyhmPBg/xJKPOdnwR3DAh8KMUt6/0dUNABCxGVeY7PYbIiXt4msIGVJkBc4y+WwIJHOYPrSRClmZVsXQfRlB4A==} hasBin: true @@ -1184,6 +1203,9 @@ packages: resolution: {integrity: sha512-CCZgpm+MkqtOMDEgF9SWgGPBXlQ01hV/6+2reDEpJuqFPGzV8HYKPBcIFvn7/z5ahtgutHLzjP71Na+hYcqSpw==} engines: {node: ^14.18.0 || >=16.10.0} + '@nuxt/scripts@0.9.3': + resolution: {integrity: sha512-CbXo2QyMgnwgDpbrH9W7jQOyL+qjZMXJDFh0eq7dGdKQImnhcXxjKlj9nR9KQd/JW+65EtYsT5yNjogEJGaV1g==} + '@nuxt/telemetry@2.6.0': resolution: {integrity: sha512-h4YJ1d32cU7tDKjjhjtIIEck4WF/w3DTQBT348E9Pz85YLttnLqktLM0Ez9Xc2LzCeUgBDQv1el7Ob/zT3KUqg==} hasBin: true @@ -1659,6 +1681,9 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/google.maps@3.58.1': + resolution: {integrity: sha512-X9QTSvGJ0nCfMzYOnaVs/k6/4L+7F5uCS+4iUmkLEls6J9S/Phv+m/i3mDeyc49ZBgwab3EFO1HEoBY7k98EGQ==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -1683,15 +1708,24 @@ packages: '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} + '@types/stripe-v3@3.1.33': + resolution: {integrity: sha512-fIE7F7alypCrnIMsk4naprHf8kXEvPM2Q9FGdL/3TDeGM0xlHohdVWkwuaEZ2tKzXB9QQKoS8k+ocLkPjZajwQ==} + '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} + '@types/vimeo__player@2.18.3': + resolution: {integrity: sha512-IzSzb6doT4I4uAnBHa+mBCiNtK7iAllEJjtpkX0sKY6/s1Vi+aX1134IAiPgiyFlMvFab/oZQpSeccK4r0/T2A==} + '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} + '@types/youtube@0.1.0': + resolution: {integrity: sha512-Pg33m3X2mFgdmhtvzOlAfUfgOa3341N3/2JCrVY/mXVxb4hagcqqEG6w4vGCfB64StQNWHSj/T8Eotb1Rko/FQ==} + '@typescript-eslint/eslint-plugin@8.6.0': resolution: {integrity: sha512-UOaz/wFowmoh2G6Mr9gw60B1mm0MzUtm6Ic8G2yM1Le6gyj5Loi/N+O5mocugRGY+8OeeKmkMmbxNqUCq3B4Sg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -2006,22 +2040,77 @@ packages: '@vueuse/core@10.11.1': resolution: {integrity: sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww==} + '@vueuse/core@11.1.0': + resolution: {integrity: sha512-P6dk79QYA6sKQnghrUz/1tHi0n9mrb/iO1WTMk/ElLmTyNqgDeSZ3wcDf6fRBGzRJbeG1dxzEOvLENMjr+E3fg==} + '@vueuse/head@2.0.0': resolution: {integrity: sha512-ykdOxTGs95xjD4WXE4na/umxZea2Itl0GWBILas+O4oqS7eXIods38INvk3XkJKjqMdWPcpCyLX/DioLQxU1KA==} peerDependencies: vue: '>=2.7 || >=3' + '@vueuse/integrations@11.1.0': + resolution: {integrity: sha512-O2ZgrAGPy0qAjpoI2YR3egNgyEqwG85fxfwmA9BshRIGjV4G6yu6CfOPpMHAOoCD+UfsIl7Vb1bXJ6ifrHYDDA==} + peerDependencies: + async-validator: ^4 + axios: ^1 + change-case: ^5 + drauu: ^0.4 + focus-trap: ^7 + fuse.js: ^7 + idb-keyval: ^6 + jwt-decode: ^4 + nprogress: ^0.2 + qrcode: ^1.5 + sortablejs: ^1 + universal-cookie: ^7 + peerDependenciesMeta: + async-validator: + optional: true + axios: + optional: true + change-case: + optional: true + drauu: + optional: true + focus-trap: + optional: true + fuse.js: + optional: true + idb-keyval: + optional: true + jwt-decode: + optional: true + nprogress: + optional: true + qrcode: + optional: true + sortablejs: + optional: true + universal-cookie: + optional: true + '@vueuse/metadata@10.11.1': resolution: {integrity: sha512-IGa5FXd003Ug1qAZmyE8wF3sJ81xGLSqTqtQ6jaVfkeZ4i5kS2mwQF61yhVqojRnenVew5PldLyRgvdl4YYuSw==} + '@vueuse/metadata@11.1.0': + resolution: {integrity: sha512-l9Q502TBTaPYGanl1G+hPgd3QX5s4CGnpXriVBR5fEZ/goI6fvDaVmIl3Td8oKFurOxTmbXvBPSsgrd6eu6HYg==} + '@vueuse/nuxt@10.11.1': resolution: {integrity: sha512-UiaYSIwOkmUVn8Gl1AqtLWYR12flO+8sEu9X0Y1fNjSR7EWy9jMuiCvOGqwtoeTsqfHrivl0d5HfMzr11GFnMA==} peerDependencies: nuxt: ^3.0.0 + '@vueuse/nuxt@11.1.0': + resolution: {integrity: sha512-ZPYigcqgPPe9vk9nBHLF8p0zshX8qvWV/ox1Y4GdV4k2flPiw7+2THNTpU2NZDBXSOXlhB2sao+paGCsvJm/Qw==} + peerDependencies: + nuxt: ^3.0.0 + '@vueuse/shared@10.11.1': resolution: {integrity: sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA==} + '@vueuse/shared@11.1.0': + resolution: {integrity: sha512-YUtIpY122q7osj+zsNMFAfMTubGz0sn5QzE5gPzAIiCmtt2ha3uQUY1+JPyL4gRCTsLPX82Y9brNbo/aqlA91w==} + '@webassemblyjs/ast@1.12.1': resolution: {integrity: sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==} @@ -3270,6 +3359,9 @@ packages: flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} + focus-trap@7.6.0: + resolution: {integrity: sha512-1td0l3pMkWJLFipobUcGaf+5DTY4PLDDrcqoSaKP8ediO/CoWCCYk/fT/Y2A4e6TNB+Sh6clRJCjOPPnKoNHnQ==} + fontaine@0.5.0: resolution: {integrity: sha512-vPDSWKhVAfTx4hRKT777+N6Szh2pAosAuzLpbppZ6O3UdD/1m6OlHjNcC3vIbgkRTIcLjzySLHXzPeLO2rE8cA==} @@ -4515,6 +4607,9 @@ packages: ofetch@1.3.4: resolution: {integrity: sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==} + ofetch@1.4.0: + resolution: {integrity: sha512-MuHgsEhU6zGeX+EMh+8mSMrYTnsqJQQrpM00Q6QHMKNqQ0bKy0B43tk8tL1wg+CnsSTy1kg4Ir2T5Ig6rD+dfQ==} + ohash@1.1.4: resolution: {integrity: sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==} @@ -5385,6 +5480,9 @@ packages: resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} engines: {node: '>= 10.x'} + splitpanes@3.1.5: + resolution: {integrity: sha512-r3Mq2ITFQ5a2VXLOy4/Sb2Ptp7OfEO8YIbhVJqJXoFc9hc5nTXXkCvtVDjIGbvC0vdE7tse+xTM9BMjsszP6bw==} + sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -5558,6 +5656,9 @@ packages: resolution: {integrity: sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==} engines: {node: '>=18'} + tabbable@6.2.0: + resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} + table@6.8.2: resolution: {integrity: sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==} engines: {node: '>=10.0.0'} @@ -5614,6 +5715,9 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + third-party-capital@2.3.0: + resolution: {integrity: sha512-p4rGOF4JCkI18HH3a1Vfd89Mg37TLlAsGmePBt20MA52frviYSBE6ToGOmTpqRC4EIlS5/4Owv6TpegFJUSkOg==} + through@2.3.8: resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} @@ -5918,6 +6022,19 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + v-lazy-show@0.2.4: + resolution: {integrity: sha512-Lx9Str2i+HTh+zGzs9O3YyhGAZOAAfU+6MUUPcQPPiPxQO1sHBEv9sH3MO9bPc4T09gsjsS2+sbaCWQ1MdhpJQ==} + peerDependencies: + '@vue/compiler-core': ^3.3 + + valibot@0.42.1: + resolution: {integrity: sha512-3keXV29Ar5b//Hqi4MbSdV7lfVp6zuYLZuA9V1PvQUsXqogr+u5lvLPLk3A4f74VUXDnf/JfWMN6sB+koJ/FFw==} + peerDependencies: + typescript: '>=5' + peerDependenciesMeta: + typescript: + optional: true + validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -7032,6 +7149,14 @@ snapshots: '@humanwhocodes/retry@0.3.0': {} + '@iconify-json/carbon@1.2.1': + dependencies: + '@iconify/types': 2.0.0 + + '@iconify-json/logos@1.2.0': + dependencies: + '@iconify/types': 2.0.0 + '@iconify-json/ri@1.2.0': dependencies: '@iconify/types': 2.0.0 @@ -7224,6 +7349,66 @@ snapshots: - supports-color - webpack-sources + '@nuxt/devtools-kit@1.5.1(magicast@0.3.5)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(webpack-sources@3.2.3)': + dependencies: + '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) + '@nuxt/schema': 3.13.2(rollup@4.22.2)(webpack-sources@3.2.3) + execa: 7.2.0 + vite: 5.4.6(@types/node@22.5.5)(terser@5.33.0) + transitivePeerDependencies: + - magicast + - rollup + - supports-color + - webpack-sources + + '@nuxt/devtools-ui-kit@1.5.1(@nuxt/devtools@1.4.2(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3))(@unocss/webpack@0.62.4(rollup@4.22.2)(webpack@5.94.0(esbuild@0.23.1)))(@vue/compiler-core@3.5.6)(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(postcss@8.4.47)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)(webpack@5.94.0(esbuild@0.23.1))': + dependencies: + '@iconify-json/carbon': 1.2.1 + '@iconify-json/logos': 1.2.0 + '@iconify-json/ri': 1.2.0 + '@iconify-json/tabler': 1.2.3 + '@nuxt/devtools': 1.4.2(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3) + '@nuxt/devtools-kit': 1.5.1(magicast@0.3.5)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(webpack-sources@3.2.3) + '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) + '@unocss/core': 0.62.4 + '@unocss/nuxt': 0.62.4(magicast@0.3.5)(postcss@8.4.47)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(webpack-sources@3.2.3)(webpack@5.94.0(esbuild@0.23.1)) + '@unocss/preset-attributify': 0.62.4 + '@unocss/preset-icons': 0.62.4 + '@unocss/preset-mini': 0.62.4 + '@unocss/reset': 0.62.4 + '@vueuse/core': 11.1.0(vue@3.5.6(typescript@5.6.2)) + '@vueuse/integrations': 11.1.0(focus-trap@7.6.0)(vue@3.5.6(typescript@5.6.2)) + '@vueuse/nuxt': 11.1.0(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(rollup@4.22.2)(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3) + defu: 6.1.4 + focus-trap: 7.6.0 + splitpanes: 3.1.5 + unocss: 0.62.4(@unocss/webpack@0.62.4(rollup@4.22.2)(webpack@5.94.0(esbuild@0.23.1)))(postcss@8.4.47)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0)) + v-lazy-show: 0.2.4(@vue/compiler-core@3.5.6) + transitivePeerDependencies: + - '@unocss/webpack' + - '@vue/compiler-core' + - '@vue/composition-api' + - async-validator + - axios + - change-case + - drauu + - fuse.js + - idb-keyval + - jwt-decode + - magicast + - nprogress + - nuxt + - postcss + - qrcode + - rollup + - sortablejs + - supports-color + - universal-cookie + - vite + - vue + - webpack + - webpack-sources + '@nuxt/devtools-wizard@1.4.2': dependencies: consola: 3.2.3 @@ -7468,6 +7653,76 @@ snapshots: - supports-color - webpack-sources + '@nuxt/scripts@0.9.3(@nuxt/devtools@1.4.2(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3))(@unocss/webpack@0.62.4(rollup@4.22.2)(webpack@5.94.0(esbuild@0.23.1)))(@vue/compiler-core@3.5.6)(ioredis@5.4.1)(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(postcss@8.4.47)(rollup@4.22.2)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)(webpack@5.94.0(esbuild@0.23.1))': + dependencies: + '@nuxt/devtools-kit': 1.5.1(magicast@0.3.5)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(webpack-sources@3.2.3) + '@nuxt/devtools-ui-kit': 1.5.1(@nuxt/devtools@1.4.2(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3))(@unocss/webpack@0.62.4(rollup@4.22.2)(webpack@5.94.0(esbuild@0.23.1)))(@vue/compiler-core@3.5.6)(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(postcss@8.4.47)(rollup@4.22.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)(webpack@5.94.0(esbuild@0.23.1)) + '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) + '@types/google.maps': 3.58.1 + '@types/stripe-v3': 3.1.33 + '@types/vimeo__player': 2.18.3 + '@types/youtube': 0.1.0 + '@unhead/vue': 1.11.6(vue@3.5.6(typescript@5.6.2)) + '@vueuse/core': 11.1.0(vue@3.5.6(typescript@5.6.2)) + consola: 3.2.3 + defu: 6.1.4 + h3: 1.12.0 + magic-string: 0.30.11 + mlly: 1.7.1 + ofetch: 1.4.0 + ohash: 1.1.4 + pathe: 1.1.2 + pkg-types: 1.2.0 + semver: 7.6.3 + shiki: 1.18.0 + sirv: 2.0.4 + std-env: 3.7.0 + third-party-capital: 2.3.0 + ufo: 1.5.4 + unimport: 3.12.0(rollup@4.22.2)(webpack-sources@3.2.3) + unplugin: 1.14.1(webpack-sources@3.2.3) + unstorage: 1.12.0(ioredis@5.4.1) + valibot: 0.42.1(typescript@5.6.2) + transitivePeerDependencies: + - '@azure/app-configuration' + - '@azure/cosmos' + - '@azure/data-tables' + - '@azure/identity' + - '@azure/keyvault-secrets' + - '@azure/storage-blob' + - '@capacitor/preferences' + - '@netlify/blobs' + - '@nuxt/devtools' + - '@planetscale/database' + - '@unocss/webpack' + - '@upstash/redis' + - '@vercel/kv' + - '@vue/compiler-core' + - '@vue/composition-api' + - async-validator + - axios + - change-case + - drauu + - fuse.js + - idb-keyval + - ioredis + - jwt-decode + - magicast + - nprogress + - nuxt + - postcss + - qrcode + - rollup + - sortablejs + - supports-color + - typescript + - uWebSockets.js + - universal-cookie + - vite + - vue + - webpack + - webpack-sources + '@nuxt/telemetry@2.6.0(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3)': dependencies: '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) @@ -8022,6 +8277,8 @@ snapshots: '@types/estree@1.0.6': {} + '@types/google.maps@3.58.1': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -8046,12 +8303,18 @@ snapshots: '@types/resolve@1.20.2': {} + '@types/stripe-v3@3.1.33': {} + '@types/unist@2.0.11': {} '@types/unist@3.0.3': {} + '@types/vimeo__player@2.18.3': {} + '@types/web-bluetooth@0.0.20': {} + '@types/youtube@0.1.0': {} + '@typescript-eslint/eslint-plugin@8.6.0(@typescript-eslint/parser@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2))(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 @@ -8598,6 +8861,16 @@ snapshots: - '@vue/composition-api' - vue + '@vueuse/core@11.1.0(vue@3.5.6(typescript@5.6.2))': + dependencies: + '@types/web-bluetooth': 0.0.20 + '@vueuse/metadata': 11.1.0 + '@vueuse/shared': 11.1.0(vue@3.5.6(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.6(typescript@5.6.2)) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + '@vueuse/head@2.0.0(vue@3.5.6(typescript@5.6.2))': dependencies: '@unhead/dom': 1.11.6 @@ -8606,8 +8879,21 @@ snapshots: '@unhead/vue': 1.11.6(vue@3.5.6(typescript@5.6.2)) vue: 3.5.6(typescript@5.6.2) + '@vueuse/integrations@11.1.0(focus-trap@7.6.0)(vue@3.5.6(typescript@5.6.2))': + dependencies: + '@vueuse/core': 11.1.0(vue@3.5.6(typescript@5.6.2)) + '@vueuse/shared': 11.1.0(vue@3.5.6(typescript@5.6.2)) + vue-demi: 0.14.10(vue@3.5.6(typescript@5.6.2)) + optionalDependencies: + focus-trap: 7.6.0 + transitivePeerDependencies: + - '@vue/composition-api' + - vue + '@vueuse/metadata@10.11.1': {} + '@vueuse/metadata@11.1.0': {} + '@vueuse/nuxt@10.11.1(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(rollup@4.22.2)(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)': dependencies: '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) @@ -8624,6 +8910,22 @@ snapshots: - vue - webpack-sources + '@vueuse/nuxt@11.1.0(magicast@0.3.5)(nuxt@3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3))(rollup@4.22.2)(vue@3.5.6(typescript@5.6.2))(webpack-sources@3.2.3)': + dependencies: + '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.22.2)(webpack-sources@3.2.3) + '@vueuse/core': 11.1.0(vue@3.5.6(typescript@5.6.2)) + '@vueuse/metadata': 11.1.0 + local-pkg: 0.5.0 + nuxt: 3.13.2(@parcel/watcher@2.4.1)(@types/node@22.5.5)(eslint@9.11.0(jiti@1.21.6))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.22.2)(stylelint@16.9.0(typescript@5.6.2))(terser@5.33.0)(typescript@5.6.2)(vite@5.4.6(@types/node@22.5.5)(terser@5.33.0))(vue-tsc@2.1.6(typescript@5.6.2))(webpack-sources@3.2.3) + vue-demi: 0.14.10(vue@3.5.6(typescript@5.6.2)) + transitivePeerDependencies: + - '@vue/composition-api' + - magicast + - rollup + - supports-color + - vue + - webpack-sources + '@vueuse/shared@10.11.1(vue@3.5.6(typescript@5.6.2))': dependencies: vue-demi: 0.14.10(vue@3.5.6(typescript@5.6.2)) @@ -8631,6 +8933,13 @@ snapshots: - '@vue/composition-api' - vue + '@vueuse/shared@11.1.0(vue@3.5.6(typescript@5.6.2))': + dependencies: + vue-demi: 0.14.10(vue@3.5.6(typescript@5.6.2)) + transitivePeerDependencies: + - '@vue/composition-api' + - vue + '@webassemblyjs/ast@1.12.1': dependencies: '@webassemblyjs/helper-numbers': 1.11.6 @@ -10046,6 +10355,10 @@ snapshots: flatted@3.3.1: {} + focus-trap@7.6.0: + dependencies: + tabbable: 6.2.0 + fontaine@0.5.0(webpack-sources@3.2.3): dependencies: '@capsizecss/metrics': 2.2.0 @@ -11823,6 +12136,12 @@ snapshots: node-fetch-native: 1.6.4 ufo: 1.5.4 + ofetch@1.4.0: + dependencies: + destr: 2.0.3 + node-fetch-native: 1.6.4 + ufo: 1.5.4 + ohash@1.1.4: {} on-finished@2.4.1: @@ -12838,6 +13157,8 @@ snapshots: split2@4.2.0: {} + splitpanes@3.1.5: {} + sprintf-js@1.0.3: {} stable-hash@0.0.4: {} @@ -13044,6 +13365,8 @@ snapshots: system-architecture@0.1.0: {} + tabbable@6.2.0: {} + table@6.8.2: dependencies: ajv: 8.17.1 @@ -13121,6 +13444,10 @@ snapshots: text-table@0.2.0: {} + third-party-capital@2.3.0: + dependencies: + semver: 7.6.3 + through@2.3.8: {} tiny-inflate@1.0.3: {} @@ -13463,6 +13790,14 @@ snapshots: util-deprecate@1.0.2: {} + v-lazy-show@0.2.4(@vue/compiler-core@3.5.6): + dependencies: + '@vue/compiler-core': 3.5.6 + + valibot@0.42.1(typescript@5.6.2): + optionalDependencies: + typescript: 5.6.2 + validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 diff --git a/test/unit/bundle.spec.ts b/test/unit/bundle.spec.ts index 8a4b80d6..65a9911e 100644 --- a/test/unit/bundle.spec.ts +++ b/test/unit/bundle.spec.ts @@ -36,8 +36,8 @@ describe('project sizes', () => { stats.client = await analyzeSizes('**/*.js', publicDir) expect .soft(roundToKilobytes(stats.client.totalBytes)) - .toMatchInlineSnapshot(`"230k"`) - expect.soft(stats.client.files.map(f => f.replace(/\..*\.js/, '.js'))) + .toMatchInlineSnapshot(`"266k"`) + expect.soft(stats.client.files.map(f => f.replace(/\..*\.js/, '.js').replace(/_scripts\/.*\.js/, '_scripts/script.js')).sort()) .toMatchInlineSnapshot(` [ "_nuxt/CalSchedule.js", @@ -71,6 +71,7 @@ describe('project sizes', () => { "_nuxt/ProseUl.js", "_nuxt/SocialPost.js", "_nuxt/entry.js", + "_scripts/script.js", ] `) }) @@ -79,7 +80,7 @@ describe('project sizes', () => { stats.server = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) expect .soft(roundToKilobytes(stats.server.totalBytes)) - .toMatchInlineSnapshot(`"421k"`) + .toMatchInlineSnapshot(`"422k"`) const modules = await analyzeSizes('node_modules/**/*', serverDir) expect -- 2.51.2