From d4cff2333dad90ba6a2ef483f843b4000a13e00c Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Mon, 28 Mar 2022 10:05:55 -0300 Subject: [PATCH 01/20] Basic Filesystem API --- .gitignore | 1 + packages/integrations/vercel/README.md | 44 +++ packages/integrations/vercel/package.json | 33 ++ packages/integrations/vercel/src/index.ts | 51 ++++ packages/integrations/vercel/tsconfig.json | 10 + pnpm-lock.yaml | 336 ++++++++++++++++++--- 6 files changed, 435 insertions(+), 40 deletions(-) create mode 100644 packages/integrations/vercel/README.md create mode 100644 packages/integrations/vercel/package.json create mode 100644 packages/integrations/vercel/src/index.ts create mode 100644 packages/integrations/vercel/tsconfig.json diff --git a/.gitignore b/.gitignore index 2185b7f84559..6a837da1d3ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules/ dist/ +.output/ *.tsbuildinfo .DS_Store .vercel diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md new file mode 100644 index 000000000000..24fdb51877af --- /dev/null +++ b/packages/integrations/vercel/README.md @@ -0,0 +1,44 @@ +# @astrojs/netlify + +Deploy your server-side rendered (SSR) Astro app to [Netlify](https://www.netlify.com/). + +Use this adapter in your Astro configuration file: + +```js +import { defineConfig } from 'astro/config'; +import netlify from '@astrojs/netlify/functions'; + +export default defineConfig({ + adapter: netlify() +}); +``` + +After you build your site the `netlify/` folder will contain [Netlify Functions](https://docs.netlify.com/functions/overview/) in the `netlify/functions/` folder. + +Now you can deploy! + +```shell +netlify deploy +``` + +## Configuration + +The output folder is configuration with the `dist` property when creating the adapter. + +```js +import { defineConfig } from 'astro/config'; +import netlify from '@astrojs/netlify/functions'; + +export default defineConfig({ + adapter: netlify({ + dist: new URL('./dist/', import.meta.url) + }) +}); +``` + +And then point to the dist in your `netlify.toml`: + +```toml +[functions] + directory = "dist/functions" +``` diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json new file mode 100644 index 000000000000..31a07bc037b4 --- /dev/null +++ b/packages/integrations/vercel/package.json @@ -0,0 +1,33 @@ +{ + "name": "@astrojs/vercel", + "description": "Deploy your site to Vercel", + "version": "0.0.1", + "type": "module", + "types": "./dist/index.d.ts", + "author": "withastro", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/withastro/astro.git", + "directory": "packages/integrations/vercel" + }, + "bugs": "https://github.com/withastro/astro/issues", + "homepage": "https://astro.build", + "exports": { + ".": "./dist/index.js", + "./package.json": "./package.json" + }, + "scripts": { + "build": "astro-scripts build \"src/**/*.ts\" && tsc", + "dev": "astro-scripts dev \"src/**/*.ts\"" + }, + "dependencies": { + "@astrojs/webapi": "^0.11.0", + "@vercel/nft": "^0.18.0", + "@vercel/node": "^1.14.0" + }, + "devDependencies": { + "astro": "workspace:*", + "astro-scripts": "workspace:*" + } +} diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts new file mode 100644 index 000000000000..ab35b9e554cd --- /dev/null +++ b/packages/integrations/vercel/src/index.ts @@ -0,0 +1,51 @@ +import type { AstroIntegration, AstroConfig } from 'astro'; +import fs from 'fs/promises'; +import type { PathLike } from 'fs'; + +export type { VercelApiHandler, VercelRequest, VercelRequestBody, VercelRequestCookies, VercelRequestQuery, VercelResponse } from '@vercel/node'; + +const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); + +export function vercelFunctions(): AstroIntegration { + let _config: AstroConfig; + let output: URL; + return { + name: '@astrojs/vercel', + hooks: { + 'astro:config:setup': ({ config }) => { + output = new URL('./.output/', config.projectRoot); + config.dist = new URL('./static/', output); + config.buildOptions.pageUrlFormat = 'directory'; + }, + 'astro:config:done': async ({ config, setAdapter }) => { + // setAdapter(getAdapter(config.buildOptions.site)); + _config = config; + }, + 'astro:build:start': async () => { + await fs.rm(output, { recursive: true }); + }, + 'astro:build:done': async ({ pages }) => { + await Promise.all( + pages.map(async ({ pathname }) => { + const origin = new URL(`./static/${pathname}index.html`, output); + const finalDir = new URL(`./server/pages/${pathname}`, output); + + await fs.mkdir(finalDir, { recursive: true }); + await fs.copyFile(origin, new URL(`./index.html`, finalDir)); + await fs.rm(origin); + }) + ); + + // Routes Manifest + // https://vercel.com/docs/file-system-api#configuration/routes + await writeJson(new URL(`./routes-manifest.json`, output), { + version: 3, + basePath: '/', + pages404: false, + }); + }, + }, + }; +} + +export default vercelFunctions; diff --git a/packages/integrations/vercel/tsconfig.json b/packages/integrations/vercel/tsconfig.json new file mode 100644 index 000000000000..44baf375c882 --- /dev/null +++ b/packages/integrations/vercel/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.base.json", + "include": ["src"], + "compilerOptions": { + "allowJs": true, + "module": "ES2020", + "outDir": "./dist", + "target": "ES2020" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 87511babcc3c..45555380a723 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1335,6 +1335,21 @@ importers: astro: link:../../astro astro-scripts: link:../../../scripts + packages/integrations/vercel: + specifiers: + '@astrojs/webapi': ^0.11.0 + '@vercel/nft': ^0.18.0 + '@vercel/node': ^1.14.0 + astro: workspace:* + astro-scripts: workspace:* + dependencies: + '@astrojs/webapi': link:../../webapi + '@vercel/nft': 0.18.0 + '@vercel/node': 1.14.0 + devDependencies: + astro: link:../../astro + astro-scripts: link:../../../scripts + packages/integrations/vue: specifiers: '@vitejs/plugin-vue': ^2.2.4 @@ -3416,6 +3431,24 @@ packages: read-yaml-file: 1.1.0 dev: true + /@mapbox/node-pre-gyp/1.0.8: + resolution: {integrity: sha512-CMGKi28CF+qlbXh26hDe6NxCd7amqeAzEqnS6IHeO6LoaKyM/n+Xw3HT1COdq8cuioOdlKdqn/hCmqPUOMOywg==} + hasBin: true + dependencies: + detect-libc: 1.0.3 + https-proxy-agent: 5.0.0 + make-dir: 3.1.0 + node-fetch: 2.6.7 + nopt: 5.0.0 + npmlog: 5.0.1 + rimraf: 3.0.2 + semver: 7.3.5 + tar: 6.1.11 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + /@nanostores/preact/0.1.3_nanostores@0.5.12+preact@10.6.6: resolution: {integrity: sha512-uiX1ned0LrzASot+sPUjyJzr8Js3pX075omazgsSdLf0zPp4ss8xwTiuNh5FSKigTSQEVqZFiS+W8CnHIrX62A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -4275,6 +4308,39 @@ packages: '@unocss/scope': 0.15.6 dev: true + /@vercel/nft/0.18.0: + resolution: {integrity: sha512-FFzpmYC4hu/nnh3bm+dVWRYq59jN7ogW8hcuzKeWnXjDqtWDawn9oGnOgMFsKdqtI40RJuscPko/kzFh62ukOw==} + hasBin: true + dependencies: + '@mapbox/node-pre-gyp': 1.0.8 + acorn: 8.7.0 + bindings: 1.5.0 + estree-walker: 2.0.2 + glob: 7.2.0 + graceful-fs: 4.2.9 + micromatch: 4.0.5 + node-gyp-build: 4.3.0 + node-pre-gyp: 0.13.0 + resolve-from: 5.0.0 + rollup-pluginutils: 2.8.2 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + + /@vercel/node-bridge/2.2.0: + resolution: {integrity: sha512-ydYlZyIQfsuriF6qTt/F4vaAt+nb4ZKhLEl2o5AQFa5ED7LoPS5w01Xbujy+25pqS1ODu8/bsqOCUSX8y/+tSQ==} + dev: false + + /@vercel/node/1.14.0: + resolution: {integrity: sha512-UAb1qQMeTkSXz95yljJpz0MyTzcj++B/1XR0vKFZOs2CEfSkBO1DjzX6BkaKriaihBdbGM/X9UoMJfWfUBBn8Q==} + dependencies: + '@types/node': 17.0.23 + '@vercel/node-bridge': 2.2.0 + ts-node: 8.9.1_typescript@4.3.4 + typescript: 4.3.4 + dev: false + /@vitejs/plugin-vue/2.2.4_vite@2.8.6+vue@3.2.31: resolution: {integrity: sha512-ev9AOlp0ljCaDkFZF3JwC/pD2N4Hh+r5srl5JHM6BKg5+99jiiK0rE/XaRs3pVm1wzyKkjUy/StBSoXX5fFzcw==} engines: {node: '>=12.0.0'} @@ -4398,6 +4464,10 @@ packages: resolution: {integrity: sha512-ry84Vft6xtRBbd4M/ptRodbOLodV5AD15TYhyRghCRgIcJJKmYmJ2v2BaaWxygENwh6Uq3zTfGPmlckKT/GXsQ==} dev: false + /abbrev/1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + dev: false + /abort-controller/3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -4438,7 +4508,6 @@ packages: resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==} engines: {node: '>=0.4.0'} hasBin: true - dev: true /adm-zip/0.5.9: resolution: {integrity: sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==} @@ -4452,7 +4521,6 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color - dev: true /aggregate-error/3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} @@ -4513,7 +4581,6 @@ packages: /ansi-regex/2.1.1: resolution: {integrity: sha1-w7M6te42DYbg5ijwRorn7yfWVN8=} engines: {node: '>=0.10.0'} - dev: true /ansi-regex/5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} @@ -4550,14 +4617,24 @@ packages: /aproba/1.2.0: resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} - dev: true /are-we-there-yet/1.1.7: resolution: {integrity: sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==} dependencies: delegates: 1.0.0 readable-stream: 2.3.7 - dev: true + + /are-we-there-yet/2.0.0: + resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} + engines: {node: '>=10'} + dependencies: + delegates: 1.0.0 + readable-stream: 3.6.0 + dev: false + + /arg/4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: false /arg/5.0.1: resolution: {integrity: sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==} @@ -4736,6 +4813,12 @@ packages: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} + /bindings/1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + dependencies: + file-uri-to-path: 1.0.0 + dev: false + /bl/4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: @@ -4808,7 +4891,6 @@ packages: /buffer-from/1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - dev: true /buffer/5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} @@ -4986,7 +5068,6 @@ packages: /chownr/1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} - dev: true /chownr/2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} @@ -5041,7 +5122,6 @@ packages: /code-point-at/1.1.0: resolution: {integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=} engines: {node: '>=0.10.0'} - dev: true /color-convert/1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -5067,6 +5147,11 @@ packages: simple-swizzle: 0.2.2 dev: true + /color-support/1.1.3: + resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} + hasBin: true + dev: false + /color/4.2.1: resolution: {integrity: sha512-MFJr0uY4RvTQUKvPq7dh9grVOTYSFeXja2mBXioCGjnjJoXrAp9jJ1NQTDR73c9nwBSAQiNKloKl5zq9WB9UPw==} engines: {node: '>=12.5.0'} @@ -5119,7 +5204,6 @@ packages: /console-control-strings/1.1.0: resolution: {integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=} - dev: true /convert-source-map/1.8.0: resolution: {integrity: sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==} @@ -5135,7 +5219,6 @@ packages: /core-util-is/1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - dev: true /cosmiconfig/7.0.1: resolution: {integrity: sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==} @@ -5238,6 +5321,12 @@ packages: engines: {node: '>=0.11'} dev: true + /debug/3.2.7: + resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + dependencies: + ms: 2.1.3 + dev: false + /debug/4.3.3_supports-color@8.1.1: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} engines: {node: '>=6.0'} @@ -5307,7 +5396,6 @@ packages: /deep-extend/0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} - dev: true /deep-is/0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -5367,7 +5455,6 @@ packages: /delegates/1.0.0: resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} - dev: true /depd/2.0.0: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} @@ -5390,7 +5477,6 @@ packages: resolution: {integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=} engines: {node: '>=0.10'} hasBin: true - dev: true /detect-libc/2.0.1: resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==} @@ -5409,6 +5495,11 @@ packages: /didyoumean/1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} + /diff/4.0.2: + resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} + engines: {node: '>=0.3.1'} + dev: false + /diff/5.0.0: resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} engines: {node: '>=0.3.1'} @@ -6150,6 +6241,10 @@ packages: '@types/unist': 2.0.6 dev: false + /estree-walker/0.6.1: + resolution: {integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==} + dev: false + /estree-walker/1.0.1: resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} dev: true @@ -6285,6 +6380,10 @@ packages: flat-cache: 3.0.4 dev: true + /file-uri-to-path/1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + dev: false + /file-uri-to-path/2.0.0: resolution: {integrity: sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==} engines: {node: '>= 6'} @@ -6384,6 +6483,12 @@ packages: universalify: 2.0.0 dev: true + /fs-minipass/1.2.7: + resolution: {integrity: sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==} + dependencies: + minipass: 2.9.0 + dev: false + /fs-minipass/2.1.0: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} @@ -6427,7 +6532,21 @@ packages: string-width: 1.0.2 strip-ansi: 3.0.1 wide-align: 1.1.5 - dev: true + + /gauge/3.0.2: + resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} + engines: {node: '>=10'} + dependencies: + aproba: 1.2.0 + color-support: 1.1.3 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.7 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wide-align: 1.1.5 + dev: false /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} @@ -6613,7 +6732,6 @@ packages: /has-unicode/2.0.1: resolution: {integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=} - dev: true /has/1.0.3: resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} @@ -6815,7 +6933,6 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color - dev: true /human-id/1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} @@ -6835,7 +6952,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: safer-buffer: 2.1.2 - dev: true /idb/6.1.5: resolution: {integrity: sha512-IJtugpKkiVXQn5Y+LteyBCNk1N8xpGV3wWZk9EVtZWH8DYkjBn0bX1XnGP9RkyZF0sAcywa6unHqSWKe7q4LGw==} @@ -6844,6 +6960,12 @@ packages: /ieee754/1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + /ignore-walk/3.0.4: + resolution: {integrity: sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==} + dependencies: + minimatch: 3.1.2 + dev: false + /ignore/5.2.0: resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} engines: {node: '>= 4'} @@ -6886,7 +7008,6 @@ packages: /ini/1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} - dev: true /inline-style-parser/0.1.1: resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==} @@ -6992,7 +7113,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: number-is-nan: 1.0.1 - dev: true /is-fullwidth-code-point/3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} @@ -7164,7 +7284,6 @@ packages: /isarray/1.0.0: resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} - dev: true /isexe/2.0.0: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} @@ -7456,6 +7575,17 @@ packages: sourcemap-codec: 1.4.8 dev: false + /make-dir/3.1.0: + resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} + engines: {node: '>=8'} + dependencies: + semver: 6.3.0 + dev: false + + /make-error/1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: false + /map-obj/1.0.1: resolution: {integrity: sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=} engines: {node: '>=0.10.0'} @@ -8001,6 +8131,13 @@ packages: /minimist/1.2.6: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} + /minipass/2.9.0: + resolution: {integrity: sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==} + dependencies: + safe-buffer: 5.2.1 + yallist: 3.1.1 + dev: false + /minipass/3.1.6: resolution: {integrity: sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==} engines: {node: '>=8'} @@ -8008,6 +8145,12 @@ packages: yallist: 4.0.0 dev: false + /minizlib/1.3.3: + resolution: {integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==} + dependencies: + minipass: 2.9.0 + dev: false + /minizlib/2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -8082,7 +8225,6 @@ packages: /ms/2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - dev: true /nanoid/3.3.1: resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} @@ -8102,6 +8244,16 @@ packages: resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=} dev: true + /needle/2.9.1: + resolution: {integrity: sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==} + engines: {node: '>= 4.4.x'} + hasBin: true + dependencies: + debug: 3.2.7 + iconv-lite: 0.4.24 + sax: 1.2.4 + dev: false + /netmask/2.0.2: resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} engines: {node: '>= 0.4.0'} @@ -8158,9 +8310,47 @@ packages: fetch-blob: 3.1.5 formdata-polyfill: 4.0.10 + /node-gyp-build/4.3.0: + resolution: {integrity: sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==} + hasBin: true + dev: false + + /node-pre-gyp/0.13.0: + resolution: {integrity: sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==} + deprecated: 'Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future' + hasBin: true + dependencies: + detect-libc: 1.0.3 + mkdirp: 0.5.6 + needle: 2.9.1 + nopt: 4.0.3 + npm-packlist: 1.4.8 + npmlog: 4.1.2 + rc: 1.2.8 + rimraf: 2.7.1 + semver: 5.7.1 + tar: 4.4.19 + dev: false + /node-releases/2.0.2: resolution: {integrity: sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==} + /nopt/4.0.3: + resolution: {integrity: sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==} + hasBin: true + dependencies: + abbrev: 1.1.1 + osenv: 0.1.5 + dev: false + + /nopt/5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + dependencies: + abbrev: 1.1.1 + dev: false + /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -8181,6 +8371,24 @@ packages: /not/0.1.0: resolution: {integrity: sha1-yWkcF0bFXc++VMvYvU/wQbwrUZ0=} + /npm-bundled/1.1.2: + resolution: {integrity: sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==} + dependencies: + npm-normalize-package-bin: 1.0.1 + dev: false + + /npm-normalize-package-bin/1.0.1: + resolution: {integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==} + dev: false + + /npm-packlist/1.4.8: + resolution: {integrity: sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==} + dependencies: + ignore-walk: 3.0.4 + npm-bundled: 1.1.2 + npm-normalize-package-bin: 1.0.1 + dev: false + /npm-run-path/4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -8201,7 +8409,15 @@ packages: console-control-strings: 1.1.0 gauge: 2.7.4 set-blocking: 2.0.0 - dev: true + + /npmlog/5.0.1: + resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} + dependencies: + are-we-there-yet: 2.0.0 + console-control-strings: 1.1.0 + gauge: 3.0.2 + set-blocking: 2.0.0 + dev: false /nth-check/2.0.1: resolution: {integrity: sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==} @@ -8211,7 +8427,6 @@ packages: /number-is-nan/1.0.1: resolution: {integrity: sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=} engines: {node: '>=0.10.0'} - dev: true /object-assign/4.1.1: resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} @@ -8301,10 +8516,21 @@ packages: wcwidth: 1.0.1 dev: false + /os-homedir/1.0.2: + resolution: {integrity: sha1-/7xJiDNuDoM94MFox+8VISGqf7M=} + engines: {node: '>=0.10.0'} + dev: false + /os-tmpdir/1.0.2: resolution: {integrity: sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=} engines: {node: '>=0.10.0'} - dev: true + + /osenv/0.1.5: + resolution: {integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==} + dependencies: + os-homedir: 1.0.2 + os-tmpdir: 1.0.2 + dev: false /outdent/0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} @@ -8625,7 +8851,6 @@ packages: /process-nextick-args/2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - dev: true /prompts/2.4.2: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} @@ -8709,7 +8934,6 @@ packages: ini: 1.3.8 minimist: 1.2.6 strip-json-comments: 2.0.1 - dev: true /react-dom/17.0.2_react@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} @@ -8776,7 +9000,6 @@ packages: safe-buffer: 5.1.2 string_decoder: 1.1.1 util-deprecate: 1.0.2 - dev: true /readable-stream/3.6.0: resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} @@ -8969,7 +9192,6 @@ packages: /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} - dev: true /resolve/1.22.0: resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==} @@ -9038,7 +9260,6 @@ packages: hasBin: true dependencies: glob: 7.2.0 - dev: true /rollup-plugin-terser/7.0.2_rollup@2.70.1: resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} @@ -9052,6 +9273,12 @@ packages: terser: 5.12.1 dev: true + /rollup-pluginutils/2.8.2: + resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} + dependencies: + estree-walker: 0.6.1 + dev: false + /rollup/2.70.1: resolution: {integrity: sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==} engines: {node: '>=10.0.0'} @@ -9085,7 +9312,6 @@ packages: /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - dev: true /sander/0.5.1: resolution: {integrity: sha1-dB4kXiMfB8r7b98PEzrfohalAq0=} @@ -9126,7 +9352,6 @@ packages: /semver/5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} hasBin: true - dev: true /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} @@ -9157,7 +9382,6 @@ packages: /set-blocking/2.0.0: resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=} - dev: true /setprototypeof/1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -9348,7 +9572,6 @@ packages: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 - dev: true /source-map/0.5.7: resolution: {integrity: sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=} @@ -9434,7 +9657,6 @@ packages: code-point-at: 1.1.0 is-fullwidth-code-point: 1.0.0 strip-ansi: 3.0.1 - dev: true /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} @@ -9486,7 +9708,6 @@ packages: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} dependencies: safe-buffer: 5.1.2 - dev: true /string_decoder/1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} @@ -9514,7 +9735,6 @@ packages: engines: {node: '>=0.10.0'} dependencies: ansi-regex: 2.1.1 - dev: true /strip-ansi/6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -9566,7 +9786,6 @@ packages: /strip-json-comments/2.0.1: resolution: {integrity: sha1-PFMZQukIwml8DsNEhYwobHygpgo=} engines: {node: '>=0.10.0'} - dev: true /strip-json-comments/3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} @@ -9792,6 +10011,19 @@ packages: readable-stream: 3.6.0 dev: true + /tar/4.4.19: + resolution: {integrity: sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==} + engines: {node: '>=4.5'} + dependencies: + chownr: 1.1.4 + fs-minipass: 1.2.7 + minipass: 2.9.0 + minizlib: 1.3.3 + mkdirp: 0.5.6 + safe-buffer: 5.2.1 + yallist: 3.1.1 + dev: false + /tar/6.1.11: resolution: {integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==} engines: {node: '>= 10'} @@ -9900,6 +10132,21 @@ packages: /trough/2.1.0: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} + /ts-node/8.9.1_typescript@4.3.4: + resolution: {integrity: sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==} + engines: {node: '>=6.0.0'} + hasBin: true + peerDependencies: + typescript: '>=2.7' + dependencies: + arg: 4.1.3 + diff: 4.0.2 + make-error: 1.3.6 + source-map-support: 0.5.21 + typescript: 4.3.4 + yn: 3.1.1 + dev: false + /tsconfig-resolver/3.0.1: resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} dependencies: @@ -10122,6 +10369,12 @@ packages: engines: {node: '>=12.20'} dev: false + /typescript/4.3.4: + resolution: {integrity: sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: false + /typescript/4.6.3: resolution: {integrity: sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==} engines: {node: '>=4.2.0'} @@ -10633,8 +10886,7 @@ packages: /wide-align/1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: - string-width: 1.0.2 - dev: true + string-width: 4.2.3 /widest-line/4.0.1: resolution: {integrity: sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==} @@ -10851,7 +11103,6 @@ packages: /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - dev: true /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} @@ -10918,6 +11169,11 @@ packages: yargs-parser: 20.2.4 dev: true + /yn/3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + dev: false + /yocto-queue/0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} From f946687bea7102e36ec453419351fd450b6139ca Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Mon, 28 Mar 2022 15:13:14 -0300 Subject: [PATCH 02/20] Build API Routes --- packages/astro/package.json | 5 +- packages/astro/src/@types/astro.ts | 2 + packages/astro/src/core/build/index.ts | 2 +- packages/astro/src/core/config.ts | 2 +- .../astro/src/core/routing/manifest/create.ts | 6 + packages/astro/src/integrations/index.ts | 3 + packages/integrations/vercel/package.json | 5 +- packages/integrations/vercel/src/index.ts | 29 +- pnpm-lock.yaml | 288 ++++-------------- 9 files changed, 102 insertions(+), 240 deletions(-) diff --git a/packages/astro/package.json b/packages/astro/package.json index 83e49b902c1c..a6f507326857 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -102,6 +102,7 @@ "htmlparser2": "^7.2.0", "kleur": "^4.1.4", "magic-string": "^0.25.9", + "micromatch": "^4.0.5", "micromorph": "^0.1.2", "mime": "^3.0.0", "ora": "^6.1.0", @@ -143,6 +144,7 @@ "@types/diff": "^5.0.2", "@types/estree": "^0.0.51", "@types/html-escaper": "^3.0.0", + "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", "@types/mocha": "^9.1.0", "@types/parse5": "^6.0.3", @@ -155,7 +157,8 @@ "chai": "^4.3.6", "cheerio": "^1.0.0-rc.10", "mocha": "^9.2.2", - "sass": "^1.49.9" + "sass": "^1.49.9", + "type-fest": "^2.12.1" }, "engines": { "node": "^14.15.0 || >=16.0.0", diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 70969f7ec330..c3425cbf6f49 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -495,6 +495,7 @@ export interface AstroConfig extends z.output { adapter: AstroAdapter | undefined; renderers: AstroRenderer[]; scripts: { stage: InjectedScriptStage; content: string }[]; + ignoredPages: string[]; }; } @@ -671,6 +672,7 @@ export interface AstroIntegration { updateConfig: (newConfig: Record) => void; addRenderer: (renderer: AstroRenderer) => void; injectScript: (stage: InjectedScriptStage, content: string) => void; + ignorePages: (glob: string) => void; // TODO: Add support for `injectElement()` for full HTML element injection, not just scripts. // This may require some refactoring of `scripts`, `styles`, and `links` into something // more generalized. Consider the SSR use-case as well. diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 7a360b01e318..5446e211dd15 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -24,6 +24,7 @@ export interface BuildOptions { /** `astro build` */ export default async function build(config: AstroConfig, options: BuildOptions = { logging: defaultLogOptions }): Promise { + config = await runHookConfigSetup({ config, command: 'build' }); const builder = new AstroBuilder(config, options); await builder.build(); } @@ -61,7 +62,6 @@ class AstroBuilder { const timer: Record = {}; timer.init = performance.now(); timer.viteStart = performance.now(); - this.config = await runHookConfigSetup({ config: this.config, command: 'build' }); const viteConfig = await createVite( { mode: this.mode, diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index a675252f1e5c..f2d3b6d91970 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -206,7 +206,7 @@ export async function validateConfig(userConfig: any, root: string): Promise int.name.startsWith('@astrojs/'))) { diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 1e0a6f3bc063..8e0bdb7365c0 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -4,6 +4,7 @@ import type { LogOptions } from '../../logger'; import fs from 'fs'; import path from 'path'; import { compile } from 'path-to-regexp'; +import micromatch from 'micromatch'; import slash from 'slash'; import { fileURLToPath } from 'url'; import { warn } from '../../logger.js'; @@ -178,11 +179,16 @@ export function createRouteManifest({ config, cwd }: { config: AstroConfig; cwd? fs.readdirSync(dir).forEach((basename) => { const resolved = path.join(dir, basename); const file = slash(path.relative(cwd || fileURLToPath(config.projectRoot), resolved)); + const pagePath = slash(path.relative(fileURLToPath(config.pages), resolved)); const isDir = fs.statSync(resolved).isDirectory(); const ext = path.extname(basename); const name = ext ? basename.slice(0, -ext.length) : basename; + if ((config._ctx?.ignoredPages || []).length > 0 && micromatch.isMatch(pagePath, config._ctx.ignoredPages)) { + return; + } + if (name[0] === '_') { return; } diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index b04caeaf1710..5805527754e6 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -24,6 +24,9 @@ export async function runHookConfigSetup({ config: _config, command }: { config: updateConfig: (newConfig) => { updatedConfig = mergeConfig(updatedConfig, newConfig) as AstroConfig; }, + ignorePages: (glob: string) => { + updatedConfig._ctx.ignoredPages.push(glob); + }, }); } } diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 31a07bc037b4..e93639b60d76 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -23,8 +23,9 @@ }, "dependencies": { "@astrojs/webapi": "^0.11.0", - "@vercel/nft": "^0.18.0", - "@vercel/node": "^1.14.0" + "@vercel/node": "^1.14.0", + "esbuild": "0.14.25", + "globby": "^12.2.0" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index ab35b9e554cd..c89435ece341 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -1,30 +1,37 @@ import type { AstroIntegration, AstroConfig } from 'astro'; import fs from 'fs/promises'; import type { PathLike } from 'fs'; +import { fileURLToPath } from 'url'; +import { globby } from 'globby'; +import esbuild from 'esbuild'; export type { VercelApiHandler, VercelRequest, VercelRequestBody, VercelRequestCookies, VercelRequestQuery, VercelResponse } from '@vercel/node'; const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); +const ENDPOINT_GLOB = 'api/**/*.{js,ts,tsx}'; + export function vercelFunctions(): AstroIntegration { let _config: AstroConfig; let output: URL; + return { name: '@astrojs/vercel', hooks: { - 'astro:config:setup': ({ config }) => { + 'astro:config:setup': ({ config, ignorePages }) => { output = new URL('./.output/', config.projectRoot); config.dist = new URL('./static/', output); config.buildOptions.pageUrlFormat = 'directory'; + ignorePages(ENDPOINT_GLOB); }, - 'astro:config:done': async ({ config, setAdapter }) => { - // setAdapter(getAdapter(config.buildOptions.site)); + 'astro:config:done': async ({ config }) => { _config = config; }, 'astro:build:start': async () => { - await fs.rm(output, { recursive: true }); + await fs.rm(output, { recursive: true, force: true }); }, 'astro:build:done': async ({ pages }) => { + // Split pages from the rest of files await Promise.all( pages.map(async ({ pathname }) => { const origin = new URL(`./static/${pathname}index.html`, output); @@ -43,6 +50,20 @@ export function vercelFunctions(): AstroIntegration { basePath: '/', pages404: false, }); + + const endpoints = await globby([ENDPOINT_GLOB, '!_*'], { onlyFiles: true, cwd: _config.pages }); + + if (endpoints.length === 0) return; + + await esbuild.build({ + entryPoints: endpoints.map((endpoint) => new URL(endpoint, _config.pages)).map(fileURLToPath), + outdir: fileURLToPath(new URL('./server/pages/api/', output)), + outbase: fileURLToPath(new URL('./api/', _config.pages)), + bundle: true, + target: 'node14', + platform: 'node', + format: 'cjs', + }); }, }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45555380a723..bc3892d796e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -464,6 +464,7 @@ importers: '@types/diff': ^5.0.2 '@types/estree': ^0.0.51 '@types/html-escaper': ^3.0.0 + '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 '@types/mocha': ^9.1.0 '@types/parse5': ^6.0.3 @@ -493,6 +494,7 @@ importers: htmlparser2: ^7.2.0 kleur: ^4.1.4 magic-string: ^0.25.9 + micromatch: ^4.0.5 micromorph: ^0.1.2 mime: ^3.0.0 mocha: ^9.2.2 @@ -520,6 +522,7 @@ importers: strip-ansi: ^7.0.1 supports-esm: ^1.0.0 tsconfig-resolver: ^3.0.1 + type-fest: ^2.12.1 vite: ^2.8.6 yargs-parser: ^21.0.1 zod: ^3.14.2 @@ -553,6 +556,7 @@ importers: htmlparser2: 7.2.0 kleur: 4.1.4 magic-string: 0.25.9 + micromatch: 4.0.5 micromorph: 0.1.2 mime: 3.0.0 ora: 6.1.0 @@ -593,6 +597,7 @@ importers: '@types/diff': 5.0.2 '@types/estree': 0.0.51 '@types/html-escaper': 3.0.0 + '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 '@types/mocha': 9.1.0 '@types/parse5': 6.0.3 @@ -606,6 +611,7 @@ importers: cheerio: 1.0.0-rc.10 mocha: 9.2.2 sass: 1.49.9 + type-fest: 2.12.1 packages/astro-prism: specifiers: @@ -1338,14 +1344,16 @@ importers: packages/integrations/vercel: specifiers: '@astrojs/webapi': ^0.11.0 - '@vercel/nft': ^0.18.0 '@vercel/node': ^1.14.0 astro: workspace:* astro-scripts: workspace:* + esbuild: 0.14.25 + globby: ^12.2.0 dependencies: '@astrojs/webapi': link:../../webapi - '@vercel/nft': 0.18.0 '@vercel/node': 1.14.0 + esbuild: 0.14.25 + globby: 12.2.0 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts @@ -3431,24 +3439,6 @@ packages: read-yaml-file: 1.1.0 dev: true - /@mapbox/node-pre-gyp/1.0.8: - resolution: {integrity: sha512-CMGKi28CF+qlbXh26hDe6NxCd7amqeAzEqnS6IHeO6LoaKyM/n+Xw3HT1COdq8cuioOdlKdqn/hCmqPUOMOywg==} - hasBin: true - dependencies: - detect-libc: 1.0.3 - https-proxy-agent: 5.0.0 - make-dir: 3.1.0 - node-fetch: 2.6.7 - nopt: 5.0.0 - npmlog: 5.0.1 - rimraf: 3.0.2 - semver: 7.3.5 - tar: 6.1.11 - transitivePeerDependencies: - - encoding - - supports-color - dev: false - /@nanostores/preact/0.1.3_nanostores@0.5.12+preact@10.6.6: resolution: {integrity: sha512-uiX1ned0LrzASot+sPUjyJzr8Js3pX075omazgsSdLf0zPp4ss8xwTiuNh5FSKigTSQEVqZFiS+W8CnHIrX62A==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -3851,6 +3841,10 @@ packages: '@babel/types': 7.17.0 dev: true + /@types/braces/3.0.1: + resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==} + dev: true + /@types/chai/4.3.0: resolution: {integrity: sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==} dev: true @@ -3939,6 +3933,12 @@ packages: resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==} dev: false + /@types/micromatch/4.0.2: + resolution: {integrity: sha512-oqXqVb0ci19GtH0vOA/U2TmHTcRY9kuZl4mqUxe0QmJAlIW13kzhuK5pi1i9+ngav8FjpSb9FVS/GE00GLX1VA==} + dependencies: + '@types/braces': 3.0.1 + dev: true + /@types/mime/1.3.2: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: true @@ -4308,26 +4308,6 @@ packages: '@unocss/scope': 0.15.6 dev: true - /@vercel/nft/0.18.0: - resolution: {integrity: sha512-FFzpmYC4hu/nnh3bm+dVWRYq59jN7ogW8hcuzKeWnXjDqtWDawn9oGnOgMFsKdqtI40RJuscPko/kzFh62ukOw==} - hasBin: true - dependencies: - '@mapbox/node-pre-gyp': 1.0.8 - acorn: 8.7.0 - bindings: 1.5.0 - estree-walker: 2.0.2 - glob: 7.2.0 - graceful-fs: 4.2.9 - micromatch: 4.0.5 - node-gyp-build: 4.3.0 - node-pre-gyp: 0.13.0 - resolve-from: 5.0.0 - rollup-pluginutils: 2.8.2 - transitivePeerDependencies: - - encoding - - supports-color - dev: false - /@vercel/node-bridge/2.2.0: resolution: {integrity: sha512-ydYlZyIQfsuriF6qTt/F4vaAt+nb4ZKhLEl2o5AQFa5ED7LoPS5w01Xbujy+25pqS1ODu8/bsqOCUSX8y/+tSQ==} dev: false @@ -4464,10 +4444,6 @@ packages: resolution: {integrity: sha512-ry84Vft6xtRBbd4M/ptRodbOLodV5AD15TYhyRghCRgIcJJKmYmJ2v2BaaWxygENwh6Uq3zTfGPmlckKT/GXsQ==} dev: false - /abbrev/1.1.1: - resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} - dev: false - /abort-controller/3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -4508,6 +4484,7 @@ packages: resolution: {integrity: sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==} engines: {node: '>=0.4.0'} hasBin: true + dev: true /adm-zip/0.5.9: resolution: {integrity: sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==} @@ -4521,6 +4498,7 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color + dev: true /aggregate-error/3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} @@ -4581,6 +4559,7 @@ packages: /ansi-regex/2.1.1: resolution: {integrity: sha1-w7M6te42DYbg5ijwRorn7yfWVN8=} engines: {node: '>=0.10.0'} + dev: true /ansi-regex/5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} @@ -4617,20 +4596,14 @@ packages: /aproba/1.2.0: resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} + dev: true /are-we-there-yet/1.1.7: resolution: {integrity: sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==} dependencies: delegates: 1.0.0 readable-stream: 2.3.7 - - /are-we-there-yet/2.0.0: - resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} - engines: {node: '>=10'} - dependencies: - delegates: 1.0.0 - readable-stream: 3.6.0 - dev: false + dev: true /arg/4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} @@ -4813,12 +4786,6 @@ packages: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} engines: {node: '>=8'} - /bindings/1.5.0: - resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} - dependencies: - file-uri-to-path: 1.0.0 - dev: false - /bl/4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} dependencies: @@ -5068,6 +5035,7 @@ packages: /chownr/1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + dev: true /chownr/2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} @@ -5122,6 +5090,7 @@ packages: /code-point-at/1.1.0: resolution: {integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=} engines: {node: '>=0.10.0'} + dev: true /color-convert/1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -5147,11 +5116,6 @@ packages: simple-swizzle: 0.2.2 dev: true - /color-support/1.1.3: - resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} - hasBin: true - dev: false - /color/4.2.1: resolution: {integrity: sha512-MFJr0uY4RvTQUKvPq7dh9grVOTYSFeXja2mBXioCGjnjJoXrAp9jJ1NQTDR73c9nwBSAQiNKloKl5zq9WB9UPw==} engines: {node: '>=12.5.0'} @@ -5204,6 +5168,7 @@ packages: /console-control-strings/1.1.0: resolution: {integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=} + dev: true /convert-source-map/1.8.0: resolution: {integrity: sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==} @@ -5219,6 +5184,7 @@ packages: /core-util-is/1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + dev: true /cosmiconfig/7.0.1: resolution: {integrity: sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==} @@ -5321,12 +5287,6 @@ packages: engines: {node: '>=0.11'} dev: true - /debug/3.2.7: - resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} - dependencies: - ms: 2.1.3 - dev: false - /debug/4.3.3_supports-color@8.1.1: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} engines: {node: '>=6.0'} @@ -5396,6 +5356,7 @@ packages: /deep-extend/0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} + dev: true /deep-is/0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -5455,6 +5416,7 @@ packages: /delegates/1.0.0: resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} + dev: true /depd/2.0.0: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} @@ -5477,6 +5439,7 @@ packages: resolution: {integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=} engines: {node: '>=0.10'} hasBin: true + dev: true /detect-libc/2.0.1: resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==} @@ -6241,10 +6204,6 @@ packages: '@types/unist': 2.0.6 dev: false - /estree-walker/0.6.1: - resolution: {integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==} - dev: false - /estree-walker/1.0.1: resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} dev: true @@ -6380,10 +6339,6 @@ packages: flat-cache: 3.0.4 dev: true - /file-uri-to-path/1.0.0: - resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} - dev: false - /file-uri-to-path/2.0.0: resolution: {integrity: sha512-hjPFI8oE/2iQPVe4gbrJ73Pp+Xfub2+WI2LlXDbsaJBwT5wuMh35WNWVYYTpnz895shtwfyutMFLFywpQAFdLg==} engines: {node: '>= 6'} @@ -6483,12 +6438,6 @@ packages: universalify: 2.0.0 dev: true - /fs-minipass/1.2.7: - resolution: {integrity: sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==} - dependencies: - minipass: 2.9.0 - dev: false - /fs-minipass/2.1.0: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} @@ -6532,21 +6481,7 @@ packages: string-width: 1.0.2 strip-ansi: 3.0.1 wide-align: 1.1.5 - - /gauge/3.0.2: - resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} - engines: {node: '>=10'} - dependencies: - aproba: 1.2.0 - color-support: 1.1.3 - console-control-strings: 1.1.0 - has-unicode: 2.0.1 - object-assign: 4.1.1 - signal-exit: 3.0.7 - string-width: 4.2.3 - strip-ansi: 6.0.1 - wide-align: 1.1.5 - dev: false + dev: true /gensync/1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} @@ -6732,6 +6667,7 @@ packages: /has-unicode/2.0.1: resolution: {integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=} + dev: true /has/1.0.3: resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} @@ -6933,6 +6869,7 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color + dev: true /human-id/1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} @@ -6952,6 +6889,7 @@ packages: engines: {node: '>=0.10.0'} dependencies: safer-buffer: 2.1.2 + dev: true /idb/6.1.5: resolution: {integrity: sha512-IJtugpKkiVXQn5Y+LteyBCNk1N8xpGV3wWZk9EVtZWH8DYkjBn0bX1XnGP9RkyZF0sAcywa6unHqSWKe7q4LGw==} @@ -6960,12 +6898,6 @@ packages: /ieee754/1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - /ignore-walk/3.0.4: - resolution: {integrity: sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==} - dependencies: - minimatch: 3.1.2 - dev: false - /ignore/5.2.0: resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} engines: {node: '>= 4'} @@ -7008,6 +6940,7 @@ packages: /ini/1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + dev: true /inline-style-parser/0.1.1: resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==} @@ -7113,6 +7046,7 @@ packages: engines: {node: '>=0.10.0'} dependencies: number-is-nan: 1.0.1 + dev: true /is-fullwidth-code-point/3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} @@ -7284,6 +7218,7 @@ packages: /isarray/1.0.0: resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} + dev: true /isexe/2.0.0: resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} @@ -7575,13 +7510,6 @@ packages: sourcemap-codec: 1.4.8 dev: false - /make-dir/3.1.0: - resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} - engines: {node: '>=8'} - dependencies: - semver: 6.3.0 - dev: false - /make-error/1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: false @@ -8131,13 +8059,6 @@ packages: /minimist/1.2.6: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} - /minipass/2.9.0: - resolution: {integrity: sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==} - dependencies: - safe-buffer: 5.2.1 - yallist: 3.1.1 - dev: false - /minipass/3.1.6: resolution: {integrity: sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==} engines: {node: '>=8'} @@ -8145,12 +8066,6 @@ packages: yallist: 4.0.0 dev: false - /minizlib/1.3.3: - resolution: {integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==} - dependencies: - minipass: 2.9.0 - dev: false - /minizlib/2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -8225,6 +8140,7 @@ packages: /ms/2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: true /nanoid/3.3.1: resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} @@ -8244,16 +8160,6 @@ packages: resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=} dev: true - /needle/2.9.1: - resolution: {integrity: sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==} - engines: {node: '>= 4.4.x'} - hasBin: true - dependencies: - debug: 3.2.7 - iconv-lite: 0.4.24 - sax: 1.2.4 - dev: false - /netmask/2.0.2: resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} engines: {node: '>= 0.4.0'} @@ -8310,47 +8216,9 @@ packages: fetch-blob: 3.1.5 formdata-polyfill: 4.0.10 - /node-gyp-build/4.3.0: - resolution: {integrity: sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==} - hasBin: true - dev: false - - /node-pre-gyp/0.13.0: - resolution: {integrity: sha512-Md1D3xnEne8b/HGVQkZZwV27WUi1ZRuZBij24TNaZwUPU3ZAFtvT6xxJGaUVillfmMKnn5oD1HoGsp2Ftik7SQ==} - deprecated: 'Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future' - hasBin: true - dependencies: - detect-libc: 1.0.3 - mkdirp: 0.5.6 - needle: 2.9.1 - nopt: 4.0.3 - npm-packlist: 1.4.8 - npmlog: 4.1.2 - rc: 1.2.8 - rimraf: 2.7.1 - semver: 5.7.1 - tar: 4.4.19 - dev: false - /node-releases/2.0.2: resolution: {integrity: sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==} - /nopt/4.0.3: - resolution: {integrity: sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==} - hasBin: true - dependencies: - abbrev: 1.1.1 - osenv: 0.1.5 - dev: false - - /nopt/5.0.0: - resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} - engines: {node: '>=6'} - hasBin: true - dependencies: - abbrev: 1.1.1 - dev: false - /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -8371,24 +8239,6 @@ packages: /not/0.1.0: resolution: {integrity: sha1-yWkcF0bFXc++VMvYvU/wQbwrUZ0=} - /npm-bundled/1.1.2: - resolution: {integrity: sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==} - dependencies: - npm-normalize-package-bin: 1.0.1 - dev: false - - /npm-normalize-package-bin/1.0.1: - resolution: {integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==} - dev: false - - /npm-packlist/1.4.8: - resolution: {integrity: sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==} - dependencies: - ignore-walk: 3.0.4 - npm-bundled: 1.1.2 - npm-normalize-package-bin: 1.0.1 - dev: false - /npm-run-path/4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -8409,15 +8259,7 @@ packages: console-control-strings: 1.1.0 gauge: 2.7.4 set-blocking: 2.0.0 - - /npmlog/5.0.1: - resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} - dependencies: - are-we-there-yet: 2.0.0 - console-control-strings: 1.1.0 - gauge: 3.0.2 - set-blocking: 2.0.0 - dev: false + dev: true /nth-check/2.0.1: resolution: {integrity: sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==} @@ -8427,6 +8269,7 @@ packages: /number-is-nan/1.0.1: resolution: {integrity: sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=} engines: {node: '>=0.10.0'} + dev: true /object-assign/4.1.1: resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} @@ -8516,21 +8359,10 @@ packages: wcwidth: 1.0.1 dev: false - /os-homedir/1.0.2: - resolution: {integrity: sha1-/7xJiDNuDoM94MFox+8VISGqf7M=} - engines: {node: '>=0.10.0'} - dev: false - /os-tmpdir/1.0.2: resolution: {integrity: sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=} engines: {node: '>=0.10.0'} - - /osenv/0.1.5: - resolution: {integrity: sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==} - dependencies: - os-homedir: 1.0.2 - os-tmpdir: 1.0.2 - dev: false + dev: true /outdent/0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} @@ -8851,6 +8683,7 @@ packages: /process-nextick-args/2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + dev: true /prompts/2.4.2: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} @@ -8934,6 +8767,7 @@ packages: ini: 1.3.8 minimist: 1.2.6 strip-json-comments: 2.0.1 + dev: true /react-dom/17.0.2_react@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} @@ -9000,6 +8834,7 @@ packages: safe-buffer: 5.1.2 string_decoder: 1.1.1 util-deprecate: 1.0.2 + dev: true /readable-stream/3.6.0: resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} @@ -9192,6 +9027,7 @@ packages: /resolve-from/5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + dev: true /resolve/1.22.0: resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==} @@ -9260,6 +9096,7 @@ packages: hasBin: true dependencies: glob: 7.2.0 + dev: true /rollup-plugin-terser/7.0.2_rollup@2.70.1: resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} @@ -9273,12 +9110,6 @@ packages: terser: 5.12.1 dev: true - /rollup-pluginutils/2.8.2: - resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} - dependencies: - estree-walker: 0.6.1 - dev: false - /rollup/2.70.1: resolution: {integrity: sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==} engines: {node: '>=10.0.0'} @@ -9312,6 +9143,7 @@ packages: /safer-buffer/2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + dev: true /sander/0.5.1: resolution: {integrity: sha1-dB4kXiMfB8r7b98PEzrfohalAq0=} @@ -9352,6 +9184,7 @@ packages: /semver/5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} hasBin: true + dev: true /semver/6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} @@ -9382,6 +9215,7 @@ packages: /set-blocking/2.0.0: resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=} + dev: true /setprototypeof/1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -9657,6 +9491,7 @@ packages: code-point-at: 1.1.0 is-fullwidth-code-point: 1.0.0 strip-ansi: 3.0.1 + dev: true /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} @@ -9708,6 +9543,7 @@ packages: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} dependencies: safe-buffer: 5.1.2 + dev: true /string_decoder/1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} @@ -9735,6 +9571,7 @@ packages: engines: {node: '>=0.10.0'} dependencies: ansi-regex: 2.1.1 + dev: true /strip-ansi/6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -9786,6 +9623,7 @@ packages: /strip-json-comments/2.0.1: resolution: {integrity: sha1-PFMZQukIwml8DsNEhYwobHygpgo=} engines: {node: '>=0.10.0'} + dev: true /strip-json-comments/3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} @@ -10011,19 +9849,6 @@ packages: readable-stream: 3.6.0 dev: true - /tar/4.4.19: - resolution: {integrity: sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==} - engines: {node: '>=4.5'} - dependencies: - chownr: 1.1.4 - fs-minipass: 1.2.7 - minipass: 2.9.0 - minizlib: 1.3.3 - mkdirp: 0.5.6 - safe-buffer: 5.2.1 - yallist: 3.1.1 - dev: false - /tar/6.1.11: resolution: {integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==} engines: {node: '>= 10'} @@ -10367,7 +10192,6 @@ packages: /type-fest/2.12.1: resolution: {integrity: sha512-AiknQSEqKVGDDjtZqeKrUoTlcj7FKhupmnVUgz6KoOKtvMwRGE6hUNJ/nVear+h7fnUPO1q/htSkYKb1pyntkQ==} engines: {node: '>=12.20'} - dev: false /typescript/4.3.4: resolution: {integrity: sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==} @@ -10887,6 +10711,7 @@ packages: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: string-width: 4.2.3 + dev: true /widest-line/4.0.1: resolution: {integrity: sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==} @@ -11103,6 +10928,7 @@ packages: /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true /yallist/4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} From a878a5cb77ee95159302546abbc4ac03bec7123d Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Mon, 28 Mar 2022 17:55:03 -0300 Subject: [PATCH 03/20] Updated some types + added webapi --- packages/integrations/vercel/package.json | 1 - packages/integrations/vercel/src/index.ts | 13 ++++-- packages/integrations/vercel/src/shims.ts | 5 ++ pnpm-lock.yaml | 56 +---------------------- 4 files changed, 17 insertions(+), 58 deletions(-) create mode 100644 packages/integrations/vercel/src/shims.ts diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index e93639b60d76..d7713183c832 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -23,7 +23,6 @@ }, "dependencies": { "@astrojs/webapi": "^0.11.0", - "@vercel/node": "^1.14.0", "esbuild": "0.14.25", "globby": "^12.2.0" }, diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index c89435ece341..5d6794206591 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -1,17 +1,21 @@ import type { AstroIntegration, AstroConfig } from 'astro'; -import fs from 'fs/promises'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { PathLike } from 'fs'; + +import fs from 'fs/promises'; import { fileURLToPath } from 'url'; import { globby } from 'globby'; import esbuild from 'esbuild'; -export type { VercelApiHandler, VercelRequest, VercelRequestBody, VercelRequestCookies, VercelRequestQuery, VercelResponse } from '@vercel/node'; +export type VercelRequest = IncomingMessage; +export type VercelResponse = ServerResponse; +export type VercelHandler = (request: VercelRequest, response: VercelResponse) => void | Promise; const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); const ENDPOINT_GLOB = 'api/**/*.{js,ts,tsx}'; -export function vercelFunctions(): AstroIntegration { +function vercelFunctions(): AstroIntegration { let _config: AstroConfig; let output: URL; @@ -59,11 +63,14 @@ export function vercelFunctions(): AstroIntegration { entryPoints: endpoints.map((endpoint) => new URL(endpoint, _config.pages)).map(fileURLToPath), outdir: fileURLToPath(new URL('./server/pages/api/', output)), outbase: fileURLToPath(new URL('./api/', _config.pages)), + inject: [fileURLToPath(new URL('./shims.js', import.meta.url))], bundle: true, target: 'node14', platform: 'node', format: 'cjs', }); + + await writeJson(new URL(`./package.json`, output), { type: 'commonjs' }); }, }, }; diff --git a/packages/integrations/vercel/src/shims.ts b/packages/integrations/vercel/src/shims.ts new file mode 100644 index 000000000000..01f7b39bffc1 --- /dev/null +++ b/packages/integrations/vercel/src/shims.ts @@ -0,0 +1,5 @@ +import { polyfill } from '@astrojs/webapi'; + +polyfill(globalThis, { + exclude: 'window document', +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc3892d796e1..8fbf184ef436 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1344,14 +1344,12 @@ importers: packages/integrations/vercel: specifiers: '@astrojs/webapi': ^0.11.0 - '@vercel/node': ^1.14.0 astro: workspace:* astro-scripts: workspace:* esbuild: 0.14.25 globby: ^12.2.0 dependencies: '@astrojs/webapi': link:../../webapi - '@vercel/node': 1.14.0 esbuild: 0.14.25 globby: 12.2.0 devDependencies: @@ -4308,19 +4306,6 @@ packages: '@unocss/scope': 0.15.6 dev: true - /@vercel/node-bridge/2.2.0: - resolution: {integrity: sha512-ydYlZyIQfsuriF6qTt/F4vaAt+nb4ZKhLEl2o5AQFa5ED7LoPS5w01Xbujy+25pqS1ODu8/bsqOCUSX8y/+tSQ==} - dev: false - - /@vercel/node/1.14.0: - resolution: {integrity: sha512-UAb1qQMeTkSXz95yljJpz0MyTzcj++B/1XR0vKFZOs2CEfSkBO1DjzX6BkaKriaihBdbGM/X9UoMJfWfUBBn8Q==} - dependencies: - '@types/node': 17.0.23 - '@vercel/node-bridge': 2.2.0 - ts-node: 8.9.1_typescript@4.3.4 - typescript: 4.3.4 - dev: false - /@vitejs/plugin-vue/2.2.4_vite@2.8.6+vue@3.2.31: resolution: {integrity: sha512-ev9AOlp0ljCaDkFZF3JwC/pD2N4Hh+r5srl5JHM6BKg5+99jiiK0rE/XaRs3pVm1wzyKkjUy/StBSoXX5fFzcw==} engines: {node: '>=12.0.0'} @@ -4605,10 +4590,6 @@ packages: readable-stream: 2.3.7 dev: true - /arg/4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: false - /arg/5.0.1: resolution: {integrity: sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==} @@ -4858,6 +4839,7 @@ packages: /buffer-from/1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true /buffer/5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} @@ -5458,11 +5440,6 @@ packages: /didyoumean/1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} - /diff/4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dev: false - /diff/5.0.0: resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} engines: {node: '>=0.3.1'} @@ -7510,10 +7487,6 @@ packages: sourcemap-codec: 1.4.8 dev: false - /make-error/1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: false - /map-obj/1.0.1: resolution: {integrity: sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=} engines: {node: '>=0.10.0'} @@ -9406,6 +9379,7 @@ packages: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 + dev: true /source-map/0.5.7: resolution: {integrity: sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=} @@ -9957,21 +9931,6 @@ packages: /trough/2.1.0: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} - /ts-node/8.9.1_typescript@4.3.4: - resolution: {integrity: sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==} - engines: {node: '>=6.0.0'} - hasBin: true - peerDependencies: - typescript: '>=2.7' - dependencies: - arg: 4.1.3 - diff: 4.0.2 - make-error: 1.3.6 - source-map-support: 0.5.21 - typescript: 4.3.4 - yn: 3.1.1 - dev: false - /tsconfig-resolver/3.0.1: resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} dependencies: @@ -10193,12 +10152,6 @@ packages: resolution: {integrity: sha512-AiknQSEqKVGDDjtZqeKrUoTlcj7FKhupmnVUgz6KoOKtvMwRGE6hUNJ/nVear+h7fnUPO1q/htSkYKb1pyntkQ==} engines: {node: '>=12.20'} - /typescript/4.3.4: - resolution: {integrity: sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==} - engines: {node: '>=4.2.0'} - hasBin: true - dev: false - /typescript/4.6.3: resolution: {integrity: sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==} engines: {node: '>=4.2.0'} @@ -10995,11 +10948,6 @@ packages: yargs-parser: 20.2.4 dev: true - /yn/3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: false - /yocto-queue/0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} From 1278d39b8694aa76598428014ee59b16e1338246 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 19:02:56 -0300 Subject: [PATCH 04/20] Added readonly config to more hooks --- packages/astro/src/@types/astro.ts | 10 +++++----- packages/astro/src/integrations/index.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 47c783e0d1e4..489a5ee38abc 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -679,11 +679,11 @@ export interface AstroIntegration { // injectElement: (stage: vite.HtmlTagDescriptor, element: string) => void; }) => void; 'astro:config:done'?: (options: { config: AstroConfig; setAdapter: (adapter: AstroAdapter) => void }) => void | Promise; - 'astro:server:setup'?: (options: { server: vite.ViteDevServer }) => void | Promise; - 'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise; - 'astro:server:done'?: () => void | Promise; - 'astro:build:start'?: (options: { buildConfig: BuildConfig }) => void | Promise; - 'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise; + 'astro:server:setup'?: (options: { config: Readonly; server: vite.ViteDevServer }) => void | Promise; + 'astro:server:start'?: (options: { config: Readonly; address: AddressInfo }) => void | Promise; + 'astro:server:done'?: (options: { config: Readonly }) => void | Promise; + 'astro:build:start'?: (options: { config: Readonly; buildConfig: BuildConfig }) => void | Promise; + 'astro:build:done'?: (options: { config: Readonly; pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise; }; } diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 5805527754e6..85d117986d45 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -65,7 +65,7 @@ export async function runHookConfigDone({ config }: { config: AstroConfig }) { export async function runHookServerSetup({ config, server }: { config: AstroConfig; server: ViteDevServer }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:setup']) { - await integration.hooks['astro:server:setup']({ server }); + await integration.hooks['astro:server:setup']({ config, server }); } } } @@ -73,7 +73,7 @@ export async function runHookServerSetup({ config, server }: { config: AstroConf export async function runHookServerStart({ config, address }: { config: AstroConfig; address: AddressInfo }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:start']) { - await integration.hooks['astro:server:start']({ address }); + await integration.hooks['astro:server:start']({ config, address }); } } } @@ -81,7 +81,7 @@ export async function runHookServerStart({ config, address }: { config: AstroCon export async function runHookServerDone({ config }: { config: AstroConfig }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:done']) { - await integration.hooks['astro:server:done'](); + await integration.hooks['astro:server:done']({ config }); } } } @@ -89,7 +89,7 @@ export async function runHookServerDone({ config }: { config: AstroConfig }) { export async function runHookBuildStart({ config, buildConfig }: { config: AstroConfig; buildConfig: BuildConfig }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:start']) { - await integration.hooks['astro:build:start']({ buildConfig }); + await integration.hooks['astro:build:start']({ config, buildConfig }); } } } @@ -97,7 +97,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro export async function runHookBuildDone({ config, pages, routes }: { config: AstroConfig; pages: string[]; routes: RouteData[] }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:done']) { - await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes }); + await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes, config }); } } } From 697ff4dfb4412fd6fa62d1ee3d8631489c7dfeb2 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:01:37 -0300 Subject: [PATCH 05/20] Rework - now it's all SSR --- .../astro/src/core/build/vite-plugin-ssr.ts | 1 + packages/integrations/vercel/package.json | 5 +- packages/integrations/vercel/src/index.ts | 89 ++++++++--------- .../vercel/src/request-transform.ts | 95 +++++++++++++++++++ .../vercel/src/server-entrypoint.ts | 34 +++++++ packages/integrations/vercel/src/shims.ts | 5 - pnpm-lock.yaml | 4 - 7 files changed, 169 insertions(+), 64 deletions(-) create mode 100644 packages/integrations/vercel/src/request-transform.ts create mode 100644 packages/integrations/vercel/src/server-entrypoint.ts delete mode 100644 packages/integrations/vercel/src/shims.ts diff --git a/packages/astro/src/core/build/vite-plugin-ssr.ts b/packages/astro/src/core/build/vite-plugin-ssr.ts index f057dc2ceb42..d565432320aa 100644 --- a/packages/astro/src/core/build/vite-plugin-ssr.ts +++ b/packages/astro/src/core/build/vite-plugin-ssr.ts @@ -42,6 +42,7 @@ ${ adapter.exports ? `const _exports = adapter.createExports(_manifest, _args); ${adapter.exports.map((name) => `export const ${name} = _exports['${name}'];`).join('\n')} +${adapter.exports.includes('_default') ? `export default _default` : ''} ` : '' } diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index d7713183c832..53dc7327bf0b 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -15,6 +15,7 @@ "homepage": "https://astro.build", "exports": { ".": "./dist/index.js", + "./server-entrypoint": "./dist/server-entrypoint.js", "./package.json": "./package.json" }, "scripts": { @@ -22,9 +23,7 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@astrojs/webapi": "^0.11.0", - "esbuild": "0.14.25", - "globby": "^12.2.0" + "@astrojs/webapi": "^0.11.0" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 5d6794206591..648f624b0c72 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -1,79 +1,64 @@ -import type { AstroIntegration, AstroConfig } from 'astro'; -import type { IncomingMessage, ServerResponse } from 'http'; +import type { AstroAdapter, AstroIntegration } from 'astro'; import type { PathLike } from 'fs'; - import fs from 'fs/promises'; -import { fileURLToPath } from 'url'; -import { globby } from 'globby'; -import esbuild from 'esbuild'; - -export type VercelRequest = IncomingMessage; -export type VercelResponse = ServerResponse; -export type VercelHandler = (request: VercelRequest, response: VercelResponse) => void | Promise; const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); -const ENDPOINT_GLOB = 'api/**/*.{js,ts,tsx}'; +export function getAdapter(): AstroAdapter { + return { + name: '@astrojs/vercel', + serverEntrypoint: '@astrojs/vercel/server-entrypoint', + exports: ['_default'], + }; +} -function vercelFunctions(): AstroIntegration { - let _config: AstroConfig; - let output: URL; +export default function vercel(): AstroIntegration { + let entryFile: string; return { name: '@astrojs/vercel', hooks: { - 'astro:config:setup': ({ config, ignorePages }) => { - output = new URL('./.output/', config.projectRoot); - config.dist = new URL('./static/', output); + 'astro:config:setup': ({ config }) => { + config.dist = new URL('./.output/', config.projectRoot); config.buildOptions.pageUrlFormat = 'directory'; - ignorePages(ENDPOINT_GLOB); }, - 'astro:config:done': async ({ config }) => { - _config = config; + 'astro:config:done': ({ setAdapter }) => { + setAdapter(getAdapter()); }, - 'astro:build:start': async () => { - await fs.rm(output, { recursive: true, force: true }); + 'astro:build:start': async ({ buildConfig, config }) => { + entryFile = buildConfig.serverEntry; + buildConfig.client = new URL('./static/', config.dist); + buildConfig.server = new URL('./functions/', config.dist); }, - 'astro:build:done': async ({ pages }) => { - // Split pages from the rest of files - await Promise.all( - pages.map(async ({ pathname }) => { - const origin = new URL(`./static/${pathname}index.html`, output); - const finalDir = new URL(`./server/pages/${pathname}`, output); - - await fs.mkdir(finalDir, { recursive: true }); - await fs.copyFile(origin, new URL(`./index.html`, finalDir)); - await fs.rm(origin); - }) - ); + 'astro:build:done': async ({ dir, routes }) => { + await writeJson(new URL(`./functions/package.json`, dir), { + type: 'commonjs', + }); // Routes Manifest // https://vercel.com/docs/file-system-api#configuration/routes - await writeJson(new URL(`./routes-manifest.json`, output), { + await writeJson(new URL(`./routes-manifest.json`, dir), { version: 3, basePath: '/', pages404: false, + rewrites: routes.map((route) => ({ + source: route.pathname, + destination: '/__astro_entry', + })), }); - const endpoints = await globby([ENDPOINT_GLOB, '!_*'], { onlyFiles: true, cwd: _config.pages }); - - if (endpoints.length === 0) return; - - await esbuild.build({ - entryPoints: endpoints.map((endpoint) => new URL(endpoint, _config.pages)).map(fileURLToPath), - outdir: fileURLToPath(new URL('./server/pages/api/', output)), - outbase: fileURLToPath(new URL('./api/', _config.pages)), - inject: [fileURLToPath(new URL('./shims.js', import.meta.url))], - bundle: true, - target: 'node14', - platform: 'node', - format: 'cjs', + // Functions Manifest + // https://vercel.com/docs/file-system-api#configuration/functions + await writeJson(new URL(`./functions-manifest.json`, dir), { + version: 1, + pages: { + __astro_entry: { + runtime: 'nodejs14', + handler: `functions/${entryFile}`, + }, + }, }); - - await writeJson(new URL(`./package.json`, output), { type: 'commonjs' }); }, }, }; } - -export default vercelFunctions; diff --git a/packages/integrations/vercel/src/request-transform.ts b/packages/integrations/vercel/src/request-transform.ts new file mode 100644 index 000000000000..0a87ca6427dc --- /dev/null +++ b/packages/integrations/vercel/src/request-transform.ts @@ -0,0 +1,95 @@ +import { Readable } from 'stream'; +import type { IncomingMessage, ServerResponse } from 'http'; + +/* + Credits to the SvelteKit team + https://github.com/sveltejs/kit/blob/69913e9fda054fa6a62a80e2bb4ee7dca1005796/packages/kit/src/node.js +*/ + +function get_raw_body(req: IncomingMessage) { + return new Promise((fulfil, reject) => { + const h = req.headers; + + if (!h['content-type']) { + return fulfil(null); + } + + req.on('error', reject); + + const length = Number(h['content-length']); + + // https://github.com/jshttp/type-is/blob/c1f4388c71c8a01f79934e68f630ca4a15fffcd6/index.js#L81-L95 + if (isNaN(length) && h['transfer-encoding'] == null) { + return fulfil(null); + } + + let data = new Uint8Array(length || 0); + + if (length > 0) { + let offset = 0; + req.on('data', (chunk) => { + const new_len = offset + Buffer.byteLength(chunk); + + if (new_len > length) { + return reject({ + status: 413, + reason: 'Exceeded "Content-Length" limit', + }); + } + + data.set(chunk, offset); + offset = new_len; + }); + } else { + req.on('data', (chunk) => { + const new_data = new Uint8Array(data.length + chunk.length); + new_data.set(data, 0); + new_data.set(chunk, data.length); + data = new_data; + }); + } + + req.on('end', () => { + fulfil(data); + }); + }); +} + +export async function getRequest(base: string, req: IncomingMessage): Promise { + let headers = req.headers as Record; + if (req.httpVersionMajor === 2) { + // we need to strip out the HTTP/2 pseudo-headers because node-fetch's + // Request implementation doesn't like them + headers = Object.assign({}, headers); + delete headers[':method']; + delete headers[':path']; + delete headers[':authority']; + delete headers[':scheme']; + } + return new Request(base + req.url, { + method: req.method, + headers, + body: await get_raw_body(req), // TODO stream rather than buffer + }); +} + +export async function setResponse(res: ServerResponse, response: Response): Promise { + const headers = Object.fromEntries(response.headers); + + if (response.headers.has('set-cookie')) { + // @ts-expect-error (headers.raw() is non-standard) + headers['set-cookie'] = response.headers.raw()['set-cookie']; + } + + res.writeHead(response.status, headers); + + if (response.body instanceof Readable) { + response.body.pipe(res); + } else { + if (response.body) { + res.write(await response.arrayBuffer()); + } + + res.end(); + } +} diff --git a/packages/integrations/vercel/src/server-entrypoint.ts b/packages/integrations/vercel/src/server-entrypoint.ts new file mode 100644 index 000000000000..df01fe32a3dc --- /dev/null +++ b/packages/integrations/vercel/src/server-entrypoint.ts @@ -0,0 +1,34 @@ +import type { SSRManifest } from 'astro'; +import { App } from 'astro/app'; +import { polyfill } from '@astrojs/webapi'; +import type { IncomingMessage, ServerResponse } from 'http'; + +import { getRequest, setResponse } from './request-transform.js'; + +polyfill(globalThis, { + exclude: 'window document', +}); + +export const createExports = (manifest: SSRManifest) => { + const app = new App(manifest); + + const _default = async (req: IncomingMessage, res: ServerResponse) => { + let request: Request; + + try { + request = await getRequest(`https://${req.headers.host}`, req); + } catch (err: any) { + res.statusCode = err.status || 400; + return res.end(err.reason || 'Invalid request body'); + } + + if (!app.match(request)) { + res.statusCode = 404; + return res.end('Not found'); + } + + await setResponse(res, await app.render(request)); + }; + + return { _default }; +}; diff --git a/packages/integrations/vercel/src/shims.ts b/packages/integrations/vercel/src/shims.ts deleted file mode 100644 index 01f7b39bffc1..000000000000 --- a/packages/integrations/vercel/src/shims.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { polyfill } from '@astrojs/webapi'; - -polyfill(globalThis, { - exclude: 'window document', -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 997848edcaa0..efa7ac934bfb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1350,12 +1350,8 @@ importers: '@astrojs/webapi': ^0.11.0 astro: workspace:* astro-scripts: workspace:* - esbuild: 0.14.25 - globby: ^12.2.0 dependencies: '@astrojs/webapi': link:../../webapi - esbuild: 0.14.25 - globby: 12.2.0 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts From 0555099619be81aa1844ed5e887fcf850a048247 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:04:53 -0300 Subject: [PATCH 06/20] Removed changes no longer necessary --- packages/astro/package.json | 5 +---- packages/astro/src/@types/astro.ts | 2 -- packages/astro/src/core/config.ts | 2 +- .../astro/src/core/routing/manifest/create.ts | 6 ------ packages/astro/src/integrations/index.ts | 3 --- packages/integrations/vercel/src/index.ts | 8 ++++++++ pnpm-lock.yaml | 17 +---------------- 7 files changed, 11 insertions(+), 32 deletions(-) diff --git a/packages/astro/package.json b/packages/astro/package.json index d475244bb34b..70d26a3d2bcb 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -103,7 +103,6 @@ "htmlparser2": "^7.2.0", "kleur": "^4.1.4", "magic-string": "^0.25.9", - "micromatch": "^4.0.5", "micromorph": "^0.1.2", "mime": "^3.0.0", "ora": "^6.1.0", @@ -146,7 +145,6 @@ "@types/diff": "^5.0.2", "@types/estree": "^0.0.51", "@types/html-escaper": "^3.0.0", - "@types/micromatch": "^4.0.2", "@types/mime": "^2.0.3", "@types/mocha": "^9.1.0", "@types/parse5": "^6.0.3", @@ -159,8 +157,7 @@ "chai": "^4.3.6", "cheerio": "^1.0.0-rc.10", "mocha": "^9.2.2", - "sass": "^1.49.9", - "type-fest": "^2.12.1" + "sass": "^1.49.9" }, "engines": { "node": "^14.15.0 || >=16.0.0", diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 489a5ee38abc..f3108d3900f9 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -502,7 +502,6 @@ export interface AstroConfig extends z.output { adapter: AstroAdapter | undefined; renderers: AstroRenderer[]; scripts: { stage: InjectedScriptStage; content: string }[]; - ignoredPages: string[]; }; } @@ -672,7 +671,6 @@ export interface AstroIntegration { updateConfig: (newConfig: Record) => void; addRenderer: (renderer: AstroRenderer) => void; injectScript: (stage: InjectedScriptStage, content: string) => void; - ignorePages: (glob: string) => void; // TODO: Add support for `injectElement()` for full HTML element injection, not just scripts. // This may require some refactoring of `scripts`, `styles`, and `links` into something // more generalized. Consider the SSR use-case as well. diff --git a/packages/astro/src/core/config.ts b/packages/astro/src/core/config.ts index 8e4547d0a72f..394c1c42dbe8 100644 --- a/packages/astro/src/core/config.ts +++ b/packages/astro/src/core/config.ts @@ -206,7 +206,7 @@ export async function validateConfig(userConfig: any, root: string): Promise int.name.startsWith('@astrojs/'))) { diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts index 8e0bdb7365c0..1e0a6f3bc063 100644 --- a/packages/astro/src/core/routing/manifest/create.ts +++ b/packages/astro/src/core/routing/manifest/create.ts @@ -4,7 +4,6 @@ import type { LogOptions } from '../../logger'; import fs from 'fs'; import path from 'path'; import { compile } from 'path-to-regexp'; -import micromatch from 'micromatch'; import slash from 'slash'; import { fileURLToPath } from 'url'; import { warn } from '../../logger.js'; @@ -179,16 +178,11 @@ export function createRouteManifest({ config, cwd }: { config: AstroConfig; cwd? fs.readdirSync(dir).forEach((basename) => { const resolved = path.join(dir, basename); const file = slash(path.relative(cwd || fileURLToPath(config.projectRoot), resolved)); - const pagePath = slash(path.relative(fileURLToPath(config.pages), resolved)); const isDir = fs.statSync(resolved).isDirectory(); const ext = path.extname(basename); const name = ext ? basename.slice(0, -ext.length) : basename; - if ((config._ctx?.ignoredPages || []).length > 0 && micromatch.isMatch(pagePath, config._ctx.ignoredPages)) { - return; - } - if (name[0] === '_') { return; } diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 85d117986d45..e1dc53a36ed0 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -24,9 +24,6 @@ export async function runHookConfigSetup({ config: _config, command }: { config: updateConfig: (newConfig) => { updatedConfig = mergeConfig(updatedConfig, newConfig) as AstroConfig; }, - ignorePages: (glob: string) => { - updatedConfig._ctx.ignoredPages.push(glob); - }, }); } } diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 648f624b0c72..0df7b9485f6a 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -41,6 +41,14 @@ export default function vercel(): AstroIntegration { version: 3, basePath: '/', pages404: false, + // redirects: [ + // { + // source: '/nice/', + // destination: '/stuff', + // statusCode: 308, + // regex: '^/nice.*$', + // }, + // ], rewrites: routes.map((route) => ({ source: route.pathname, destination: '/__astro_entry', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index efa7ac934bfb..68eaf52c942e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -464,7 +464,6 @@ importers: '@types/diff': ^5.0.2 '@types/estree': ^0.0.51 '@types/html-escaper': ^3.0.0 - '@types/micromatch': ^4.0.2 '@types/mime': ^2.0.3 '@types/mocha': ^9.1.0 '@types/parse5': ^6.0.3 @@ -495,7 +494,6 @@ importers: htmlparser2: ^7.2.0 kleur: ^4.1.4 magic-string: ^0.25.9 - micromatch: ^4.0.5 micromorph: ^0.1.2 mime: ^3.0.0 mocha: ^9.2.2 @@ -524,7 +522,6 @@ importers: strip-ansi: ^7.0.1 supports-esm: ^1.0.0 tsconfig-resolver: ^3.0.1 - type-fest: ^2.12.1 vite: ^2.8.6 yargs-parser: ^21.0.1 zod: ^3.14.3 @@ -559,7 +556,6 @@ importers: htmlparser2: 7.2.0 kleur: 4.1.4 magic-string: 0.25.9 - micromatch: 4.0.5 micromorph: 0.1.2 mime: 3.0.0 ora: 6.1.0 @@ -601,7 +597,6 @@ importers: '@types/diff': 5.0.2 '@types/estree': 0.0.51 '@types/html-escaper': 3.0.0 - '@types/micromatch': 4.0.2 '@types/mime': 2.0.3 '@types/mocha': 9.1.0 '@types/parse5': 6.0.3 @@ -615,7 +610,6 @@ importers: cheerio: 1.0.0-rc.10 mocha: 9.2.2 sass: 1.49.9 - type-fest: 2.12.1 packages/astro-prism: specifiers: @@ -3844,10 +3838,6 @@ packages: '@babel/types': 7.17.0 dev: true - /@types/braces/3.0.1: - resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==} - dev: true - /@types/chai/4.3.0: resolution: {integrity: sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==} dev: true @@ -3936,12 +3926,6 @@ packages: resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==} dev: false - /@types/micromatch/4.0.2: - resolution: {integrity: sha512-oqXqVb0ci19GtH0vOA/U2TmHTcRY9kuZl4mqUxe0QmJAlIW13kzhuK5pi1i9+ngav8FjpSb9FVS/GE00GLX1VA==} - dependencies: - '@types/braces': 3.0.1 - dev: true - /@types/mime/1.3.2: resolution: {integrity: sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==} dev: true @@ -10203,6 +10187,7 @@ packages: /type-fest/2.12.1: resolution: {integrity: sha512-AiknQSEqKVGDDjtZqeKrUoTlcj7FKhupmnVUgz6KoOKtvMwRGE6hUNJ/nVear+h7fnUPO1q/htSkYKb1pyntkQ==} engines: {node: '>=12.20'} + dev: false /typescript/4.6.3: resolution: {integrity: sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==} From fc2dc973f28ceebc6e1016c6360ddaa497f9acce Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:06:06 -0300 Subject: [PATCH 07/20] Reverted changes in core/build --- packages/astro/src/core/build/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 1800c2636e8f..4962ce1c7f16 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -26,7 +26,7 @@ export interface BuildOptions { /** `astro build` */ export default async function build(config: AstroConfig, options: BuildOptions = { logging: defaultLogOptions }): Promise { - config = await runHookConfigSetup({ config, command: 'build' }); + applyPolyfill(); const builder = new AstroBuilder(config, options); await builder.run(); } @@ -62,6 +62,7 @@ class AstroBuilder { const { logging } = this; this.timer.init = performance.now(); this.timer.viteStart = performance.now(); + this.config = await runHookConfigSetup({ config: this.config, command: 'build' }); const viteConfig = await createVite( { mode: this.mode, From ff67cb4849bc706da4f7ecd028063aca3305551a Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:07:56 -0300 Subject: [PATCH 08/20] Reverted unwanted change in pnpm-lock --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 68eaf52c942e..1427808518f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10700,7 +10700,7 @@ packages: /wide-align/1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} dependencies: - string-width: 4.2.3 + string-width: 1.0.2 dev: true /widest-line/4.0.1: From 8c65f133272c6ce9f211d8acd2b92fd652e7e53c Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:11:27 -0300 Subject: [PATCH 09/20] Updated readme --- packages/integrations/vercel/README.md | 36 +++++--------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 24fdb51877af..876db86d3c70 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -1,44 +1,22 @@ -# @astrojs/netlify +# @astrojs/vercel -Deploy your server-side rendered (SSR) Astro app to [Netlify](https://www.netlify.com/). +Deploy your server-side rendered (SSR) Astro app to [Vercel](https://www.vercel.com/). -Use this adapter in your Astro configuration file: +Use this integration in your Astro configuration file: ```js import { defineConfig } from 'astro/config'; -import netlify from '@astrojs/netlify/functions'; +import vercel from '@astrojs/vercel'; export default defineConfig({ - adapter: netlify() + integrations: [netlify()] }); ``` -After you build your site the `netlify/` folder will contain [Netlify Functions](https://docs.netlify.com/functions/overview/) in the `netlify/functions/` folder. +After you build your site the `.output/` folder will contain your server-side rendered app. Since this feature is still in beta, you'll **need to add this Enviroment Variable to your Vercel project**: `ENABLE_FILE_SYSTEM_API=1` Now you can deploy! ```shell -netlify deploy -``` - -## Configuration - -The output folder is configuration with the `dist` property when creating the adapter. - -```js -import { defineConfig } from 'astro/config'; -import netlify from '@astrojs/netlify/functions'; - -export default defineConfig({ - adapter: netlify({ - dist: new URL('./dist/', import.meta.url) - }) -}); -``` - -And then point to the dist in your `netlify.toml`: - -```toml -[functions] - directory = "dist/functions" +vercel ``` From cf70978c417247ebd597f7759c314d8dd291b036 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Tue, 29 Mar 2022 23:17:46 -0300 Subject: [PATCH 10/20] Updated gitignores --- examples/blog-multiple-authors/.gitignore | 3 ++- examples/blog/.gitignore | 3 ++- examples/component/.gitignore | 3 ++- examples/docs/.gitignore | 3 ++- examples/env-vars/.gitignore | 3 ++- examples/framework-alpine/.gitignore | 3 ++- examples/framework-lit/.gitignore | 3 ++- examples/framework-multiple/.gitignore | 3 ++- examples/framework-preact/.gitignore | 3 ++- examples/framework-react/.gitignore | 3 ++- examples/framework-solid/.gitignore | 3 ++- examples/framework-svelte/.gitignore | 3 ++- examples/framework-vue/.gitignore | 3 ++- examples/integrations-playground/.gitignore | 3 ++- examples/minimal/.gitignore | 3 ++- examples/non-html-pages/.gitignore | 3 ++- examples/portfolio/.gitignore | 3 ++- examples/starter/.gitignore | 3 ++- examples/subpath/.gitignore | 3 ++- examples/with-markdown-plugins/.gitignore | 3 ++- examples/with-markdown-shiki/.gitignore | 3 ++- examples/with-markdown/.gitignore | 3 ++- examples/with-nanostores/.gitignore | 3 ++- examples/with-tailwindcss/.gitignore | 3 ++- examples/with-vite-plugin-pwa/.gitignore | 3 ++- 25 files changed, 50 insertions(+), 25 deletions(-) diff --git a/examples/blog-multiple-authors/.gitignore b/examples/blog-multiple-authors/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/blog-multiple-authors/.gitignore +++ b/examples/blog-multiple-authors/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/blog/.gitignore b/examples/blog/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/blog/.gitignore +++ b/examples/blog/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/component/.gitignore b/examples/component/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/component/.gitignore +++ b/examples/component/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/docs/.gitignore b/examples/docs/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/docs/.gitignore +++ b/examples/docs/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/env-vars/.gitignore b/examples/env-vars/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/env-vars/.gitignore +++ b/examples/env-vars/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-alpine/.gitignore b/examples/framework-alpine/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-alpine/.gitignore +++ b/examples/framework-alpine/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-lit/.gitignore b/examples/framework-lit/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-lit/.gitignore +++ b/examples/framework-lit/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-multiple/.gitignore b/examples/framework-multiple/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-multiple/.gitignore +++ b/examples/framework-multiple/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-preact/.gitignore b/examples/framework-preact/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-preact/.gitignore +++ b/examples/framework-preact/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-react/.gitignore b/examples/framework-react/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-react/.gitignore +++ b/examples/framework-react/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-solid/.gitignore b/examples/framework-solid/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-solid/.gitignore +++ b/examples/framework-solid/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-svelte/.gitignore b/examples/framework-svelte/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-svelte/.gitignore +++ b/examples/framework-svelte/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/framework-vue/.gitignore b/examples/framework-vue/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/framework-vue/.gitignore +++ b/examples/framework-vue/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/integrations-playground/.gitignore b/examples/integrations-playground/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/integrations-playground/.gitignore +++ b/examples/integrations-playground/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/minimal/.gitignore b/examples/minimal/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/minimal/.gitignore +++ b/examples/minimal/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/non-html-pages/.gitignore b/examples/non-html-pages/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/non-html-pages/.gitignore +++ b/examples/non-html-pages/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/portfolio/.gitignore b/examples/portfolio/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/portfolio/.gitignore +++ b/examples/portfolio/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/starter/.gitignore b/examples/starter/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/starter/.gitignore +++ b/examples/starter/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/subpath/.gitignore b/examples/subpath/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/subpath/.gitignore +++ b/examples/subpath/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-markdown-plugins/.gitignore b/examples/with-markdown-plugins/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-markdown-plugins/.gitignore +++ b/examples/with-markdown-plugins/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-markdown-shiki/.gitignore b/examples/with-markdown-shiki/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-markdown-shiki/.gitignore +++ b/examples/with-markdown-shiki/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-markdown/.gitignore b/examples/with-markdown/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-markdown/.gitignore +++ b/examples/with-markdown/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-nanostores/.gitignore b/examples/with-nanostores/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-nanostores/.gitignore +++ b/examples/with-nanostores/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-tailwindcss/.gitignore b/examples/with-tailwindcss/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-tailwindcss/.gitignore +++ b/examples/with-tailwindcss/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ diff --git a/examples/with-vite-plugin-pwa/.gitignore b/examples/with-vite-plugin-pwa/.gitignore index c82467453074..c7de34ef2126 100644 --- a/examples/with-vite-plugin-pwa/.gitignore +++ b/examples/with-vite-plugin-pwa/.gitignore @@ -1,5 +1,6 @@ # build output -dist +dist/ +.output/ # dependencies node_modules/ From 09e8b8e50209a419a7411fe3ec59c4c998a4922f Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Wed, 30 Mar 2022 21:51:37 -0300 Subject: [PATCH 11/20] Updated hooks --- packages/astro/src/@types/astro.ts | 2 +- packages/astro/src/integrations/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 013a6f366f1f..00a268b8fde2 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -679,7 +679,7 @@ export interface AstroIntegration { 'astro:config:done'?: (options: { config: AstroConfig; setAdapter: (adapter: AstroAdapter) => void }) => void | Promise; 'astro:server:setup'?: (options: { config: Readonly; server: vite.ViteDevServer }) => void | Promise; 'astro:server:start'?: (options: { config: Readonly; address: AddressInfo }) => void | Promise; - 'astro:server:done'?: (options: {config: Readonly;}) => void | Promise; + 'astro:server:done'?: (options: { config: Readonly }) => void | Promise; 'astro:build:start'?: (options: { config: Readonly; buildConfig: BuildConfig }) => void | Promise; 'astro:build:setup'?: (options: { config: Readonly; vite: ViteConfigWithSSR; target: 'client' | 'server' }) => void; 'astro:build:done'?: (options: { config: Readonly; pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise; diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 0746b05ca312..51a3e517f4f1 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -95,7 +95,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro export async function runHookBuildSetup({ config, vite, target }: { config: AstroConfig; vite: ViteConfigWithSSR; target: 'server' | 'client' }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:setup']) { - await integration.hooks['astro:build:setup']({ vite, target }); + await integration.hooks['astro:build:setup']({ config, vite, target }); } } } From e890b528c4c3045d4dc04fb74fc1a739d4f8f618 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Wed, 30 Mar 2022 23:08:39 -0300 Subject: [PATCH 12/20] Build to CommonJS --- packages/integrations/vercel/package.json | 3 +- packages/integrations/vercel/src/index.ts | 41 ++++++++++++----------- pnpm-lock.yaml | 2 ++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/packages/integrations/vercel/package.json b/packages/integrations/vercel/package.json index 53dc7327bf0b..229a48b8ec75 100644 --- a/packages/integrations/vercel/package.json +++ b/packages/integrations/vercel/package.json @@ -23,7 +23,8 @@ "dev": "astro-scripts dev \"src/**/*.ts\"" }, "dependencies": { - "@astrojs/webapi": "^0.11.0" + "@astrojs/webapi": "^0.11.0", + "esbuild": "0.14.25" }, "devDependencies": { "astro": "workspace:*", diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 0df7b9485f6a..3521dfc8d3cb 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -1,9 +1,13 @@ import type { AstroAdapter, AstroIntegration } from 'astro'; import type { PathLike } from 'fs'; import fs from 'fs/promises'; +import esbuild from 'esbuild'; +import { fileURLToPath } from 'url'; const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); +const ENTRYFILE = '__astro_entry'; + export function getAdapter(): AstroAdapter { return { name: '@astrojs/vercel', @@ -13,8 +17,6 @@ export function getAdapter(): AstroAdapter { } export default function vercel(): AstroIntegration { - let entryFile: string; - return { name: '@astrojs/vercel', hooks: { @@ -26,15 +28,28 @@ export default function vercel(): AstroIntegration { setAdapter(getAdapter()); }, 'astro:build:start': async ({ buildConfig, config }) => { - entryFile = buildConfig.serverEntry; + buildConfig.serverEntry = `${ENTRYFILE}.mjs`; buildConfig.client = new URL('./static/', config.dist); - buildConfig.server = new URL('./functions/', config.dist); + buildConfig.server = new URL('./server/pages/', config.dist); }, 'astro:build:done': async ({ dir, routes }) => { - await writeJson(new URL(`./functions/package.json`, dir), { - type: 'commonjs', + const pagesDir = new URL('./server/pages/', dir); + + // FIX: Remove these two line before merging + await fs.mkdir(pagesDir, { recursive: true }); + await fs.rename(new URL(`./${ENTRYFILE}.mjs`, dir), new URL(`./${ENTRYFILE}.mjs`, pagesDir)); + + await esbuild.build({ + entryPoints: [fileURLToPath(new URL(`./${ENTRYFILE}.mjs`, pagesDir))], + outfile: fileURLToPath(new URL(`./${ENTRYFILE}.js`, pagesDir)), + bundle: true, + format: 'cjs', + platform: 'node', + target: 'node14', }); + await fs.rm(new URL(`./${ENTRYFILE}.mjs`, pagesDir)); + // Routes Manifest // https://vercel.com/docs/file-system-api#configuration/routes await writeJson(new URL(`./routes-manifest.json`, dir), { @@ -51,21 +66,9 @@ export default function vercel(): AstroIntegration { // ], rewrites: routes.map((route) => ({ source: route.pathname, - destination: '/__astro_entry', + destination: `/${ENTRYFILE}`, })), }); - - // Functions Manifest - // https://vercel.com/docs/file-system-api#configuration/functions - await writeJson(new URL(`./functions-manifest.json`, dir), { - version: 1, - pages: { - __astro_entry: { - runtime: 'nodejs14', - handler: `functions/${entryFile}`, - }, - }, - }); }, }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b973649e5f8a..72b3b48ba624 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1364,8 +1364,10 @@ importers: '@astrojs/webapi': ^0.11.0 astro: workspace:* astro-scripts: workspace:* + esbuild: 0.14.25 dependencies: '@astrojs/webapi': link:../../webapi + esbuild: 0.14.25 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts From 437e08e5caa7f6540d34691ffedfddf2b6f2cdf1 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 15:12:43 -0300 Subject: [PATCH 13/20] Updated readme --- packages/integrations/vercel/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 876db86d3c70..7b8aae035f0a 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -9,7 +9,7 @@ import { defineConfig } from 'astro/config'; import vercel from '@astrojs/vercel'; export default defineConfig({ - integrations: [netlify()] + adapter: vercel() }); ``` From c2f4dd44e37fcd5f3af42b359af0f65095be9cbd Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 15:14:04 -0300 Subject: [PATCH 14/20] Removed extra code --- packages/integrations/vercel/src/index.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 3521dfc8d3cb..e1433bb9d5e8 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -35,10 +35,6 @@ export default function vercel(): AstroIntegration { 'astro:build:done': async ({ dir, routes }) => { const pagesDir = new URL('./server/pages/', dir); - // FIX: Remove these two line before merging - await fs.mkdir(pagesDir, { recursive: true }); - await fs.rename(new URL(`./${ENTRYFILE}.mjs`, dir), new URL(`./${ENTRYFILE}.mjs`, pagesDir)); - await esbuild.build({ entryPoints: [fileURLToPath(new URL(`./${ENTRYFILE}.mjs`, pagesDir))], outfile: fileURLToPath(new URL(`./${ENTRYFILE}.js`, pagesDir)), @@ -56,14 +52,6 @@ export default function vercel(): AstroIntegration { version: 3, basePath: '/', pages404: false, - // redirects: [ - // { - // source: '/nice/', - // destination: '/stuff', - // statusCode: 308, - // regex: '^/nice.*$', - // }, - // ], rewrites: routes.map((route) => ({ source: route.pathname, destination: `/${ENTRYFILE}`, From 56cb78bd40a0e0ebe2d22685d5783d0b8de83b97 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 15:31:56 -0300 Subject: [PATCH 15/20] Reverted config hook changes --- packages/astro/src/@types/astro.ts | 12 ++++++------ packages/astro/src/integrations/index.ts | 12 ++++++------ packages/integrations/vercel/src/index.ts | 12 +++++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index e2de159f235c..0f1e48e13b94 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -678,12 +678,12 @@ export interface AstroIntegration { // injectElement: (stage: vite.HtmlTagDescriptor, element: string) => void; }) => void; 'astro:config:done'?: (options: { config: AstroConfig; setAdapter: (adapter: AstroAdapter) => void }) => void | Promise; - 'astro:server:setup'?: (options: { config: Readonly; server: vite.ViteDevServer }) => void | Promise; - 'astro:server:start'?: (options: { config: Readonly; address: AddressInfo }) => void | Promise; - 'astro:server:done'?: (options: { config: Readonly }) => void | Promise; - 'astro:build:start'?: (options: { config: Readonly; buildConfig: BuildConfig }) => void | Promise; - 'astro:build:setup'?: (options: { config: Readonly; vite: ViteConfigWithSSR; target: 'client' | 'server' }) => void; - 'astro:build:done'?: (options: { config: Readonly; pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise; + 'astro:server:setup'?: (options: { server: vite.ViteDevServer }) => void | Promise; + 'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise; + 'astro:server:done'?: () => void | Promise; + 'astro:build:start'?: (options: { buildConfig: BuildConfig }) => void | Promise; + 'astro:build:setup'?: (options: { vite: ViteConfigWithSSR; target: 'client' | 'server' }) => void; + 'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise; }; } diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 51a3e517f4f1..93176a6bfbeb 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -63,7 +63,7 @@ export async function runHookConfigDone({ config }: { config: AstroConfig }) { export async function runHookServerSetup({ config, server }: { config: AstroConfig; server: ViteDevServer }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:setup']) { - await integration.hooks['astro:server:setup']({ config, server }); + await integration.hooks['astro:server:setup']({ server }); } } } @@ -71,7 +71,7 @@ export async function runHookServerSetup({ config, server }: { config: AstroConf export async function runHookServerStart({ config, address }: { config: AstroConfig; address: AddressInfo }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:start']) { - await integration.hooks['astro:server:start']({ config, address }); + await integration.hooks['astro:server:start']({ address }); } } } @@ -79,7 +79,7 @@ export async function runHookServerStart({ config, address }: { config: AstroCon export async function runHookServerDone({ config }: { config: AstroConfig }) { for (const integration of config.integrations) { if (integration.hooks['astro:server:done']) { - await integration.hooks['astro:server:done']({ config }); + await integration.hooks['astro:server:done'](); } } } @@ -87,7 +87,7 @@ export async function runHookServerDone({ config }: { config: AstroConfig }) { export async function runHookBuildStart({ config, buildConfig }: { config: AstroConfig; buildConfig: BuildConfig }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:start']) { - await integration.hooks['astro:build:start']({ config, buildConfig }); + await integration.hooks['astro:build:start']({ buildConfig }); } } } @@ -95,7 +95,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro export async function runHookBuildSetup({ config, vite, target }: { config: AstroConfig; vite: ViteConfigWithSSR; target: 'server' | 'client' }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:setup']) { - await integration.hooks['astro:build:setup']({ config, vite, target }); + await integration.hooks['astro:build:setup']({ vite, target }); } } } @@ -103,7 +103,7 @@ export async function runHookBuildSetup({ config, vite, target }: { config: Astr export async function runHookBuildDone({ config, pages, routes }: { config: AstroConfig; pages: string[]; routes: RouteData[] }) { for (const integration of config.integrations) { if (integration.hooks['astro:build:done']) { - await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes, config }); + await integration.hooks['astro:build:done']({ pages: pages.map((p) => ({ pathname: p })), dir: config.dist, routes }); } } } diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index e1433bb9d5e8..ac3a4f9f05c2 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -1,4 +1,4 @@ -import type { AstroAdapter, AstroIntegration } from 'astro'; +import type { AstroAdapter, AstroConfig, AstroIntegration } from 'astro'; import type { PathLike } from 'fs'; import fs from 'fs/promises'; import esbuild from 'esbuild'; @@ -17,6 +17,7 @@ export function getAdapter(): AstroAdapter { } export default function vercel(): AstroIntegration { + let _config: AstroConfig; return { name: '@astrojs/vercel', hooks: { @@ -24,13 +25,14 @@ export default function vercel(): AstroIntegration { config.dist = new URL('./.output/', config.projectRoot); config.buildOptions.pageUrlFormat = 'directory'; }, - 'astro:config:done': ({ setAdapter }) => { + 'astro:config:done': ({ setAdapter, config }) => { setAdapter(getAdapter()); + _config = config; }, - 'astro:build:start': async ({ buildConfig, config }) => { + 'astro:build:start': async ({ buildConfig }) => { buildConfig.serverEntry = `${ENTRYFILE}.mjs`; - buildConfig.client = new URL('./static/', config.dist); - buildConfig.server = new URL('./server/pages/', config.dist); + buildConfig.client = new URL('./static/', _config.dist); + buildConfig.server = new URL('./server/pages/', _config.dist); }, 'astro:build:done': async ({ dir, routes }) => { const pagesDir = new URL('./server/pages/', dir); From 60c5823ae12952c0f707a13a361edd9ec1646ab0 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 15:37:33 -0300 Subject: [PATCH 16/20] Added some comments --- packages/integrations/vercel/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index ac3a4f9f05c2..8834d36626a1 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -37,6 +37,7 @@ export default function vercel(): AstroIntegration { 'astro:build:done': async ({ dir, routes }) => { const pagesDir = new URL('./server/pages/', dir); + // Convert server entry to CommonJS await esbuild.build({ entryPoints: [fileURLToPath(new URL(`./${ENTRYFILE}.mjs`, pagesDir))], outfile: fileURLToPath(new URL(`./${ENTRYFILE}.js`, pagesDir)), @@ -45,7 +46,6 @@ export default function vercel(): AstroIntegration { platform: 'node', target: 'node14', }); - await fs.rm(new URL(`./${ENTRYFILE}.mjs`, pagesDir)); // Routes Manifest From 286dff2daef15cbeb73a0d1893560331ed368aa8 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 16:45:00 -0300 Subject: [PATCH 17/20] Added .output to prettierignore --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 7b6398b3e22d..7c89fbaf5aef 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,6 +4,7 @@ # Deep Directories **/dist +**/.output **/smoke **/node_modules **/fixtures From e30aa4dfef2bbe874e2fe7f07232bf8a3c092317 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Thu, 31 Mar 2022 20:44:15 -0300 Subject: [PATCH 18/20] Added changeset --- .changeset/twelve-parrots-report.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/twelve-parrots-report.md diff --git a/.changeset/twelve-parrots-report.md b/.changeset/twelve-parrots-report.md new file mode 100644 index 000000000000..6531e60b48c9 --- /dev/null +++ b/.changeset/twelve-parrots-report.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Add a Vercel adapter for SSR From ccce433994f5c64165d07ece104f647178345384 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Sat, 2 Apr 2022 18:56:13 -0300 Subject: [PATCH 19/20] Formatted --- packages/integrations/vercel/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 8834d36626a1..894c77be7ea4 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -4,7 +4,8 @@ import fs from 'fs/promises'; import esbuild from 'esbuild'; import { fileURLToPath } from 'url'; -const writeJson = (path: PathLike, data: any) => fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); +const writeJson = (path: PathLike, data: any) => + fs.writeFile(path, JSON.stringify(data), { encoding: 'utf-8' }); const ENTRYFILE = '__astro_entry'; From bf2199e1dff76e684c371f974a1044bb13338300 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Sat, 2 Apr 2022 18:59:03 -0300 Subject: [PATCH 20/20] New astro config --- packages/integrations/vercel/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 894c77be7ea4..49a924b2d763 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -23,8 +23,8 @@ export default function vercel(): AstroIntegration { name: '@astrojs/vercel', hooks: { 'astro:config:setup': ({ config }) => { - config.dist = new URL('./.output/', config.projectRoot); - config.buildOptions.pageUrlFormat = 'directory'; + config.outDir = new URL('./.output/', config.outDir); + config.build.format = 'directory'; }, 'astro:config:done': ({ setAdapter, config }) => { setAdapter(getAdapter()); @@ -32,8 +32,8 @@ export default function vercel(): AstroIntegration { }, 'astro:build:start': async ({ buildConfig }) => { buildConfig.serverEntry = `${ENTRYFILE}.mjs`; - buildConfig.client = new URL('./static/', _config.dist); - buildConfig.server = new URL('./server/pages/', _config.dist); + buildConfig.client = new URL('./static/', _config.outDir); + buildConfig.server = new URL('./server/pages/', _config.outDir); }, 'astro:build:done': async ({ dir, routes }) => { const pagesDir = new URL('./server/pages/', dir);