diff --git a/index.js b/index.js index e721241b..09b3f13f 100644 --- a/index.js +++ b/index.js @@ -12,4 +12,5 @@ export { default as ActionBuilder } from './src/ActionBuilder.js'; export { default as Bundler } from './src/bundler/WebpackBundler.js'; export { default as BaseConfig } from './src/BaseConfig.js'; +export { default as BaseDeployer } from './src/deploy/BaseDeployer.js'; export { default as CLI } from './src/cli.js'; diff --git a/package-lock.json b/package-lock.json index 6c2644a2..bade9a26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,14 @@ { "name": "@adobe/helix-deploy", - "version": "11.1.14", + "version": "11.1.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@adobe/helix-deploy", - "version": "11.1.14", + "version": "11.1.15", "license": "Apache-2.0", "dependencies": { - "@adobe/fastly-native-promises": "3.0.10", "@adobe/fetch": "4.1.8", "@adobe/helix-shared-process-queue": "3.0.4", "@aws-sdk/client-apigatewayv2": "3.600.0", @@ -18,7 +17,6 @@ "@aws-sdk/client-secrets-manager": "3.600.0", "@aws-sdk/client-ssm": "3.600.0", "@aws-sdk/client-sts": "3.600.0", - "@fastly/js-compute": "3.16.0", "@google-cloud/functions": "3.4.0", "@google-cloud/secret-manager": "5.6.0", "@google-cloud/storage": "7.11.2", @@ -94,20 +92,6 @@ "eslint": "^8.0.0" } }, - "node_modules/@adobe/fastly-native-promises": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@adobe/fastly-native-promises/-/fastly-native-promises-3.0.10.tgz", - "integrity": "sha512-WEFlYTS/wBaihu1mKuQOvg5LMfHU1t16TkUZN5SLafl0psQOrPlUNoDRrv4LgJXkv+V8SaPq7mqJVopAtdA+cg==", - "license": "MIT", - "dependencies": { - "@adobe/fetch": "4.1.8", - "form-data": "4.0.0", - "object-hash": "3.0.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@adobe/fetch": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/@adobe/fetch/-/fetch-4.1.8.tgz", @@ -1479,153 +1463,12 @@ "node": ">=4" } }, - "node_modules/@babel/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" - }, "node_modules/@bcoe/v8-coverage": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, - "node_modules/@bytecodealliance/jco": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.2.4.tgz", - "integrity": "sha512-uuOm9UkYqWp5uElYDNzlhjbdrAmczEvETgQdI1hFTk79h+mrmHPRV32pgRP5o1eHVwMIpuk4XQkDIhFbksurUw==", - "license": "(Apache-2.0 WITH LLVM-exception)", - "workspaces": [ - "packages/preview2-shim" - ], - "dependencies": { - "@bytecodealliance/preview2-shim": "^0.16.2", - "binaryen": "^116.0.0", - "chalk-template": "^1", - "commander": "^12", - "mkdirp": "^3", - "ora": "^8", - "terser": "^5" - }, - "bin": { - "jco": "src/jco.js" - } - }, - "node_modules/@bytecodealliance/preview2-shim": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.16.2.tgz", - "integrity": "sha512-36MwesmbLSf3Y5/OHcS85iBaF0N92CQ4gpjtDVKSbrjxmrBKCWlWVfoQ03F/cqDg8k5K7pzVaVBH0XBIbTCfTQ==", - "license": "(Apache-2.0 WITH LLVM-exception)" - }, - "node_modules/@bytecodealliance/wizer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-3.0.1.tgz", - "integrity": "sha512-f0NBiBHCNBkbFHTPRbA7aKf/t4KyNhi2KvSqw3QzCgi8wFF/uLZ0dhejj93rbiKO/iwWbmU7v9K3SVkW81mcjQ==", - "bin": { - "wizer": "wizer.js" - }, - "engines": { - "node": ">=16" - }, - "optionalDependencies": { - "@bytecodealliance/wizer-darwin-arm64": "3.0.1", - "@bytecodealliance/wizer-darwin-x64": "3.0.1", - "@bytecodealliance/wizer-linux-arm64": "3.0.1", - "@bytecodealliance/wizer-linux-s390x": "3.0.1", - "@bytecodealliance/wizer-linux-x64": "3.0.1", - "@bytecodealliance/wizer-win32-x64": "3.0.1" - } - }, - "node_modules/@bytecodealliance/wizer-darwin-arm64": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-3.0.1.tgz", - "integrity": "sha512-/8KYSajyhO9koAE3qQhYfC6belZheJw9X3XqW7hrizTpj6n4z4OJFhhqwJmiYFUUsPtC7OxcXMFFPbTuSQPBcw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "bin": { - "wizer-darwin-arm64": "wizer" - } - }, - "node_modules/@bytecodealliance/wizer-darwin-x64": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-3.0.1.tgz", - "integrity": "sha512-bMReultN/r+W/BRXV0F+28U5dZwbQT/ZO0k4icZlhUhrv5/wpQJix7Z/ZvBnVQ+/JHb0QDUpFk2/zCtgkRXP6Q==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "bin": { - "wizer-darwin-x64": "wizer" - } - }, - "node_modules/@bytecodealliance/wizer-linux-arm64": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-arm64/-/wizer-linux-arm64-3.0.1.tgz", - "integrity": "sha512-35ZhAeYxWK3bTqqgwysbBWlGlrlMNKNng3ZITQV2PAtafpE7aCeqywl7VAS4lLRG5eTb7wxNgN7zf8d3wiIFTQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "bin": { - "wizer-linux-arm64": "wizer" - } - }, - "node_modules/@bytecodealliance/wizer-linux-s390x": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-s390x/-/wizer-linux-s390x-3.0.1.tgz", - "integrity": "sha512-Smvy9mguEMtX0lupDLTPshXUzAHeOhgscr1bhGNjeCCLD1sd8rIjBvWV19Wtra0BL1zTuU2EPOHjR/4k8WoyDg==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "bin": { - "wizer-linux-s390x": "wizer" - } - }, - "node_modules/@bytecodealliance/wizer-linux-x64": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-3.0.1.tgz", - "integrity": "sha512-uUue78xl7iwndsGgTsagHLTLyLBVHhwzuywiwHt1xw8y0X0O8REKRLBoB7+LdM+pttDPdFtKJgbTFL4UPAA7Yw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "bin": { - "wizer-linux-x64": "wizer" - } - }, - "node_modules/@bytecodealliance/wizer-win32-x64": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-3.0.1.tgz", - "integrity": "sha512-ycd38sx1UTZpHZwh8IfH/4N3n0OQUB8awxkUSLXf9PolEd088YbxoPB3noHy4E+L2oYN7KZMrg9517pX0z2RhQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "bin": { - "wizer-win32-x64": "wizer" - } - }, "node_modules/@colors/colors": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", @@ -1636,336 +1479,6 @@ "node": ">=0.1.90" } }, - "node_modules/@esbuild/android-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", - "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", - "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", - "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", - "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", - "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", - "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", - "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", - "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", - "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", - "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", - "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", - "cpu": [ - "loong64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", - "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", - "cpu": [ - "mips64el" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", - "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", - "cpu": [ - "ppc64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", - "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", - "cpu": [ - "riscv64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", - "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", - "cpu": [ - "s390x" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", - "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", - "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", - "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", - "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", - "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", - "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", - "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -2022,24 +1535,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@fastly/js-compute": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/@fastly/js-compute/-/js-compute-3.16.0.tgz", - "integrity": "sha512-wziOjbzmpL0ySFZDJg2JUrDQUUpJ+WBfBpV5rbg+PatqmNLQkulGCkyjAX4zK4ZSdiy9Fv0oBza0bKyKoHQhtA==", - "license": "Apache-2.0", - "dependencies": { - "@bytecodealliance/jco": "^1.2.4", - "@bytecodealliance/wizer": "^3.0.1", - "acorn": "^8.8.2", - "acorn-walk": "^8.2.0", - "esbuild": "^0.17.18", - "magic-string": "^0.30.0", - "regexpu-core": "^5.3.2" - }, - "bin": { - "js-compute-runtime": "js-compute-runtime-cli.js" - } - }, "node_modules/@google-cloud/functions": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@google-cloud/functions/-/functions-3.4.0.tgz", @@ -4301,14 +3796,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/agent-base": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.0.tgz", @@ -4773,16 +4260,6 @@ "node": ">=8" } }, - "node_modules/binaryen": { - "version": "116.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-116.0.0.tgz", - "integrity": "sha512-Hp0dXC6Cb/rTwWEoUS2BRghObE7g/S9umKtxuTDt3f61G6fNTE/YVew/ezyy3IdHcLx3f17qfh6LwETgCfvWkQ==", - "license": "Apache-2.0", - "bin": { - "wasm-opt": "bin/wasm-opt", - "wasm2js": "bin/wasm2js" - } - }, "node_modules/bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", @@ -5112,6 +4589,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, "dependencies": { "restore-cursor": "^4.0.0" }, @@ -5276,18 +4754,6 @@ "node": ">=10" } }, - "node_modules/cli-spinners": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", - "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cli-table3": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", @@ -5469,6 +4935,7 @@ "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true, "license": "MIT", "engines": { "node": ">=18" @@ -5985,7 +5452,8 @@ "node_modules/emoji-regex": { "version": "10.3.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", - "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==" + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true }, "node_modules/emojilib": { "version": "2.4.0", @@ -6277,42 +5745,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/esbuild": { - "version": "0.17.19", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", - "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/android-arm": "0.17.19", - "@esbuild/android-arm64": "0.17.19", - "@esbuild/android-x64": "0.17.19", - "@esbuild/darwin-arm64": "0.17.19", - "@esbuild/darwin-x64": "0.17.19", - "@esbuild/freebsd-arm64": "0.17.19", - "@esbuild/freebsd-x64": "0.17.19", - "@esbuild/linux-arm": "0.17.19", - "@esbuild/linux-arm64": "0.17.19", - "@esbuild/linux-ia32": "0.17.19", - "@esbuild/linux-loong64": "0.17.19", - "@esbuild/linux-mips64el": "0.17.19", - "@esbuild/linux-ppc64": "0.17.19", - "@esbuild/linux-riscv64": "0.17.19", - "@esbuild/linux-s390x": "0.17.19", - "@esbuild/linux-x64": "0.17.19", - "@esbuild/netbsd-x64": "0.17.19", - "@esbuild/openbsd-x64": "0.17.19", - "@esbuild/sunos-x64": "0.17.19", - "@esbuild/win32-arm64": "0.17.19", - "@esbuild/win32-ia32": "0.17.19", - "@esbuild/win32-x64": "0.17.19" - } - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -7151,6 +6583,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "dev": true, "engines": { "node": ">=18" }, @@ -7976,18 +7409,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-interactive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", - "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -8333,14 +7754,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", - "bin": { - "jsesc": "bin/jsesc" - } - }, "node_modules/json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", @@ -9110,6 +8523,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { "node": ">=6" } @@ -12565,6 +11979,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -12604,96 +12019,6 @@ "node": ">= 0.8.0" } }, - "node_modules/ora": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.0.1.tgz", - "integrity": "sha512-ANIvzobt1rls2BDny5fWZ3ZVKyD6nscLvfFRpQgfWsythlcsVUC9kL0zq6j2Z5z9wwp1kd7wpsD/T9qNPVLCaQ==", - "license": "MIT", - "dependencies": { - "chalk": "^5.3.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.9.2", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^2.0.0", - "log-symbols": "^6.0.0", - "stdin-discarder": "^0.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ora/node_modules/is-unicode-supported": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", - "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/log-symbols": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-6.0.0.tgz", - "integrity": "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==", - "license": "MIT", - "dependencies": { - "chalk": "^5.3.0", - "is-unicode-supported": "^1.3.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", - "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/p-each-series": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", @@ -13344,22 +12669,6 @@ "node": ">=8.10.0" } }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==" - }, - "node_modules/regenerate-unicode-properties": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/regexp.prototype.flags": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", @@ -13377,22 +12686,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/regexpu-core": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", - "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", - "dependencies": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/registry-auth-token": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.0.2.tgz", @@ -13405,17 +12698,6 @@ "node": ">=14" } }, - "node_modules/regjsparser": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.9.1.tgz", - "integrity": "sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ==", - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -13462,6 +12744,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -14057,7 +13340,8 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/signale": { "version": "1.4.0", @@ -14283,18 +13567,6 @@ "integrity": "sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==", "dev": true }, - "node_modules/stdin-discarder": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", - "integrity": "sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stream-combiner2": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", @@ -14384,6 +13656,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz", "integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==", + "dev": true, "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", @@ -14427,6 +13700,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, "engines": { "node": ">=12" }, @@ -14438,6 +13712,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -15154,14 +14429,6 @@ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", - "engines": { - "node": ">=4" - } - }, "node_modules/unicode-emoji-modifier-base": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", @@ -15171,34 +14438,6 @@ "node": ">=4" } }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", - "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", - "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", - "engines": { - "node": ">=4" - } - }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", diff --git a/package.json b/package.json index 5a2b4e09..10cf2f54 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@adobe/helix-universal": ">=4.1.1" }, "dependencies": { - "@adobe/fastly-native-promises": "3.0.10", "@adobe/fetch": "4.1.8", "@adobe/helix-shared-process-queue": "3.0.4", "@aws-sdk/client-apigatewayv2": "3.600.0", @@ -46,7 +45,6 @@ "@aws-sdk/client-secrets-manager": "3.600.0", "@aws-sdk/client-ssm": "3.600.0", "@aws-sdk/client-sts": "3.600.0", - "@fastly/js-compute": "3.16.0", "@google-cloud/functions": "3.4.0", "@google-cloud/secret-manager": "5.6.0", "@google-cloud/storage": "7.11.2", @@ -64,7 +62,6 @@ "isomorphic-git": "1.26.1", "openwhisk": "3.21.8", "semver": "7.6.2", - "tar": "7.4.0", "webpack": "5.92.1", "yargs": "17.7.2" }, diff --git a/src/BaseConfig.js b/src/BaseConfig.js index 8ee8c188..5b83243d 100644 --- a/src/BaseConfig.js +++ b/src/BaseConfig.js @@ -597,7 +597,7 @@ export default class BaseConfig { default: '.', }) - .group(['help', 'build', 'deploy', 'test', 'test-bundle', 'update-package', 'version-link', 'delete'], 'Operation Options') + .group(['help', 'build', 'deploy', 'test', 'test-bundle', 'update-package', 'version-link', 'delete', 'plugin'], 'Operation Options') .option('build', { description: 'Build the deployment package', type: 'boolean', @@ -632,6 +632,12 @@ export default class BaseConfig { type: 'boolean', default: false, }) + .option('plugin', { + description: 'Specify bundler or deploy plugins.', + type: 'string', + array: true, + default: [], + }) .group(['minify', 'static', 'entryFile', 'externals', 'edge-externals', 'serverless-externals', 'modules', 'adapterFile', 'esm', 'bundler'], 'Build Options') .option('minify', { diff --git a/src/cli.js b/src/cli.js index 48179888..f8a446df 100755 --- a/src/cli.js +++ b/src/cli.js @@ -19,8 +19,6 @@ import OpenWhiskDeployer from './deploy/OpenWhiskDeployer.js'; import AWSDeployer from './deploy/AWSDeployer.js'; import GoogleDeployer from './deploy/GoogleDeployer.js'; import CloudflareDeployer from './deploy/CloudflareDeployer.js'; -import ComputeAtEdgeDeployer from './deploy/ComputeAtEdgeDeployer.js'; -import FastlyGateway from './gateway/FastlyGateway.js'; import ActionBuilder from './ActionBuilder.js'; const PLUGINS = [ @@ -28,14 +26,47 @@ const PLUGINS = [ AWSDeployer, GoogleDeployer, CloudflareDeployer, - ComputeAtEdgeDeployer, - FastlyGateway, ]; envConfig(); +async function loadPlugin(name) { + const names = [ + name, + `helix-deploy-${name}`, + `@adobe/helix-deploy-${name}`, + ]; + + let module; + let moduleName; + for (const n of names) { + try { + // eslint-disable-next-line no-await-in-loop + module = await import(n); + moduleName = n; + break; + } catch (e) { + if (e.code !== 'MODULE_NOT_FOUND') { + throw e; + } + } + } + if (!module) { + throw new Error(`Plugin not found: ${name}`); + } + const { plugins } = module; + if (!plugins) { + throw new Error(`Plugin ${module.name} does not export a plugins' array.`); + } + console.log('Loaded plugin:', moduleName); + for (const clazz of plugins) { + console.log('- ', clazz.name); + } + return plugins; +} + export default class CLI { - constructor() { + buildArgs(plugins) { this._yargs = yargs() .pkgConf('wsk') .env('HLX') @@ -61,14 +92,27 @@ export default class CLI { }); }); BaseConfig.yarg(this._yargs); - PLUGINS.forEach((PluginClass) => PluginClass.Config.yarg(this._yargs)); + plugins.forEach((PluginClass) => PluginClass.Config.yarg(this._yargs)); this._yargs .wrap(Math.min(120, this._yargs.terminalWidth())) .help(); } - prepare(args) { - const argv = this._yargs.parse(args); + async prepare(args) { + const pluginClasses = [...PLUGINS]; + this.buildArgs(pluginClasses); + let argv = this._yargs.parse(args); + + // if args specify plugins, load them and parse again + if (argv.plugin.length) { + for (const pluginName of argv.plugin) { + // eslint-disable-next-line no-await-in-loop + const plugins = await loadPlugin(pluginName); + pluginClasses.push(...plugins); + } + this.buildArgs(pluginClasses); + argv = this._yargs.parse(args); + } // apply '!important' args (override env). Object.entries(argv).forEach(([key, value]) => { @@ -83,7 +127,7 @@ export default class CLI { } const config = new BaseConfig().configure(argv); - const plugins = PLUGINS.map((PluginClass) => { + const plugins = pluginClasses.map((PluginClass) => { const pluginConfig = new PluginClass.Config().configure(argv); return new PluginClass(config, pluginConfig); }); diff --git a/src/deploy/ComputeAtEdgeConfig.js b/src/deploy/ComputeAtEdgeConfig.js deleted file mode 100644 index a2540784..00000000 --- a/src/deploy/ComputeAtEdgeConfig.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2021 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -export default class ComputeAtEdgeConfig { - constructor() { - Object.assign(this, {}); - } - - configure(argv) { - return this - .withServiceID(argv.computeServiceId) - .withAuth(argv.fastlyAuth) - .withCoralogixToken(argv.coralogixToken) - .withFastlyGateway(argv.fastlyGateway) - .withComputeDomain(argv.computeTestDomain) - .withCoralogixApp(argv.computeCoralogixApp); - } - - withServiceID(value) { - this.service = value; - return this; - } - - withAuth(value) { - this.auth = value; - return this; - } - - withCoralogixToken(value) { - this.coralogixToken = value; - return this; - } - - withCoralogixApp(value) { - this.coralogixApp = value; - return this; - } - - withFastlyGateway(value) { - this.fastlyGateway = value; - return this; - } - - withComputeDomain(value) { - this.testDomain = value; - return this; - } - - static yarg(yargs) { - return yargs - .group(['compute-service-id', 'compute-domain', 'fastly-auth', 'coralogix-token', 'compute-coralogix-app'], 'Fastly Compute@Edge Options') - .option('compute-service-id', { - description: 'the Fastly Service to deploy the action to', - type: 'string', - default: '', - }) - .option('compute-test-domain', { - description: 'the domain name of the Compute@Edge service (used for testing)', - type: 'string', - default: '', - }) - .option('fastly-auth', { - description: 'the Fastly token', - type: 'string', - default: '', - }) - .option('coralogix-token', { - description: 'the Coralogix token (to enable logging)', - type: 'string', - default: '', - }) - .option('fastly-gateway', { - description: 'the hostname of the Fastly gateway for package params', - type: 'string', - default: '', - }) - .option('compute-coralogix-app', { - description: 'the Application name', - type: 'string', - default: 'fastly-compute', - }); - } -} diff --git a/src/deploy/ComputeAtEdgeDeployer.js b/src/deploy/ComputeAtEdgeDeployer.js deleted file mode 100644 index fd0bf2c7..00000000 --- a/src/deploy/ComputeAtEdgeDeployer.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2021 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -import chalk from 'chalk-template'; -import path from 'path'; -import fs from 'fs/promises'; -import * as tar from 'tar'; -import Fastly from '@adobe/fastly-native-promises'; -import { compileApplicationToWasm } from '@fastly/js-compute/src/compileApplicationToWasm.js'; -import { parseInputs } from '@fastly/js-compute/src/parseInputs.js'; -import BaseDeployer from './BaseDeployer.js'; -import ComputeAtEdgeConfig from './ComputeAtEdgeConfig.js'; - -/** - * The class ComputeAtEdgeDeployer deploys to Fastly's Compute(at)Edge (WASM) runtime. - * It should be seen as a functional equivalent to the CloudflareDeployer - * and not confused with the FastlyGateway (which only routes requests, but - * does not handle them.) - */ -export default class ComputeAtEdgeDeployer extends BaseDeployer { - constructor(baseConfig, config) { - super(baseConfig); - Object.assign(this, { - id: 'c@e', - name: 'Fastly Compute@Edge', - _cfg: config, - _fastly: null, - noGatewayBackend: true, - }); - } - - ready() { - return !!this._cfg.service && !!this._cfg.auth && !!this.cfg.edgeBundle; - } - - validate() { - if (!this.ready()) { - throw new Error('Compute@Edge target needs token and service ID'); - } - } - - init() { - if (this.ready() && !this._fastly) { - this._fastly = Fastly(this._cfg.auth, this._cfg.service, 60000); - } - } - - get log() { - return this.cfg.log; - } - - /** - * - * @returns - */ - async bundle() { - const bundleDir = path.dirname(this.cfg.edgeBundle); - this.log.debug(`--: creating fastly.toml in ${bundleDir}`); - fs.writeFile(path.resolve(bundleDir, 'fastly.toml'), ` -# This file describes a Fastly Compute@Edge package. To learn more visit: -# https://developer.fastly.com/reference/fastly-toml/ - -authors = ["Helix Deploy"] -description = "${this.cfg.packageName} project generated by Helix Deploy" -language = "javascript" -manifest_version = 2 -name = "${this.cfg.packageName}" -service_id = "" - `); - - const { - input, - output, - wasmEngine, - } = await parseInputs([this.cfg.edgeBundle, path.resolve(bundleDir, 'bin', 'main.wasm')]); - - return new Promise((resolve, reject) => { - this.log.debug('--: creating WASM bundle of script and interpreter'); - compileApplicationToWasm(input, output, wasmEngine, false, false) - .then(async () => { - const file = path.resolve(bundleDir, 'fastly-bundle.tar.gz'); - this.log.debug(chalk`{green ok:} created WASM bundle of script and interpreter in ${bundleDir}/bin/main.wasm`); - await tar.c({ - gzip: true, - // sync: true, - cwd: bundleDir, - prefix: this.cfg.packageName, - file, - }, ['bin/main.wasm', 'fastly.toml']); - this.log.debug(chalk`{green ok:} created tar file in ${bundleDir}/fastly-bundle.tar.gz`); - resolve(fs.readFile(file)); - }) - // c8 ignore next 3 - .catch((err) => { - reject(err); - }); - }); - } - - async deploy() { - const buf = await this.bundle(); - this.init(); - - await this._fastly.transact(async (version) => { - this.log.debug('--: uploading package to fastly, service version', version); - await this._fastly.writePackage(version, buf); - - this.log.debug('--: creating secrets dictionary'); - await this._fastly.writeDictionary(version, 'secrets', { - name: 'secrets', - write_only: 'true', - }); - - const host = this._cfg.fastlyGateway; - const backend = { - hostname: host, - ssl_cert_hostname: host, - ssl_sni_hostname: host, - address: host, - override_host: host, - name: 'gateway', - error_threshold: 0, - first_byte_timeout: 60000, - weight: 100, - connect_timeout: 5000, - port: 443, - between_bytes_timeout: 10000, - shield: '', // 'bwi-va-us', - max_conn: 200, - use_ssl: true, - }; - if (host) { - this.log.debug(`--: updating gateway backend: ${host}`); - await this._fastly.writeBackend(version, 'gateway', backend); - } - }, true); - - await this._fastly.discard(); - } - - async updatePackage() { - this.log.info(`--: updating app (gateway) config for https://${this._cfg.fastlyGateway}/${this.cfg.packageName}/...`); - - this.init(); - - const functionparams = Object - .entries(this.cfg.params) - .map(([key, value]) => ({ - item_key: key, - item_value: value, - op: 'update', - })); - - await this._fastly.bulkUpdateDictItems(undefined, 'secrets', ...functionparams); - await this._fastly.updateDictItem(undefined, 'secrets', '_token', this.cfg.packageToken); - await this._fastly.updateDictItem(undefined, 'secrets', '_package', `https://${this._cfg.fastlyGateway}/${this.cfg.packageName}/`); - - await this._fastly.discard(); - } - - get fullFunctionName() { - return `${this.cfg.packageName}--${this.cfg.name}` - .replace(/\./g, '_') - .replace('@', '_'); - } - - async test() { - return this._cfg.testDomain - ? this.testRequest({ - url: `https://${this._cfg.testDomain}.edgecompute.app`, - retry404: 0, - }) - : undefined; - } -} - -ComputeAtEdgeDeployer.Config = ComputeAtEdgeConfig; diff --git a/src/gateway/FastlyConfig.js b/src/gateway/FastlyConfig.js deleted file mode 100644 index 94217588..00000000 --- a/src/gateway/FastlyConfig.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2020 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -export default class FastlyConfig { - constructor() { - Object.assign(this, { - service: null, - auth: null, - checkpath: '', - checkinterval: 0, - }); - } - - configure(argv) { - return this - .withServiceID(argv.fastlyServiceId) - .withAuth(argv.fastlyAuth) - .withCoralogixToken(argv.coralogixToken) - .withCoralogixApp(argv.coralogixApp) - .withCheckInterval(argv.checkInterval) - .withCheckpath(argv.checkpath); - } - - withAuth(value) { - this.auth = value; - return this; - } - - withCheckInterval(value) { - this.checkinterval = value; - return this; - } - - withServiceID(value) { - this.service = value; - return this; - } - - withCheckpath(value) { - this.checkpath = value; - return this; - } - - withCoralogixToken(value) { - this.coralogixToken = value; - return this; - } - - withCoralogixApp(value) { - this.coralogixApp = value; - return this; - } - - static yarg(yargs) { - return yargs - .group(['fastly-service-id', 'fastly-auth', 'checkpath', 'coralogix-token', 'coralogix-app'], 'Fastly Gateway Options') - .option('fastly-service-id', { - description: 'the Fastly Service to use as a gateway', - type: 'string', - default: '', - }) - .option('fastly-auth', { - description: 'the Fastly token', - type: 'string', - default: '', - }) - .option('coralogix-token', { - description: 'the Coralogix token (to enable logging)', - type: 'string', - default: '', - }) - .option('coralogix-app', { - description: 'the Application name', - type: 'string', - default: 'universal-runtime', - }) - .option('checkpath', { - description: 'the path to check as part of the Fastly health check', - type: 'string', - default: '', - }) - .option('checkinterval', { - description: 'the interval in milliseconds that each Fastly POP should perform a health check. Set to 0 to disable health checks entirely.', - type: 'number', - default: 6000000, - }); - } -} diff --git a/src/gateway/FastlyGateway.js b/src/gateway/FastlyGateway.js deleted file mode 100644 index 687663eb..00000000 --- a/src/gateway/FastlyGateway.js +++ /dev/null @@ -1,525 +0,0 @@ -/* - * Copyright 2020 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -// eslint-disable-next-line import/no-named-default -import { default as Fastly, loghelpers } from '@adobe/fastly-native-promises'; -import chalk from 'chalk-template'; -import FastlyConfig from './FastlyConfig.js'; -import BaseDeployer from '../deploy/BaseDeployer.js'; - -const { - toString, vcl, time, req, res, str, concat, -} = loghelpers; - -export default class FastlyGateway { - constructor(baseConfig, config) { - Object.assign(this, { - cfg: baseConfig, - _cfg: config, - isGateway: true, - id: 'fastly', - _fastly: null, - _deployers: [], - }); - } - - ready() { - return !!this._cfg.service && !!this._cfg.auth; - } - - canDeploy() { - return this.ready() && this._deployers.length > 0; - } - - async updateLinks(links, version) { - this.log.info(`--: updating links on the Gateway for version ${version}...`); - const fakeDeployer = new BaseDeployer({ - links, version, log: this.log, - }); - - const versionstrings = fakeDeployer - .getLinkVersions() - .map((versionstring) => `/${this.cfg.packageName}/${this.cfg.name.replace(/@.*/, '')}@${versionstring}`) - .map((key) => ({ - item_key: key, - item_value: `@${version}`, - op: 'upsert', - })); - - await this._fastly.bulkUpdateDictItems(undefined, 'aliases', ...versionstrings); - await this._fastly.discard(); - this.log.info(chalk`{green ok:} updated links on the Gateway for version ${version}.`); - } - - init() { - if ((this.ready() || this.updateable) && !this._fastly) { - this._fastly = Fastly(this._cfg.auth, this._cfg.service); - } - } - - withDeployer(value) { - this._deployers.push(value); - return this; - } - - get log() { - return this.cfg.log; - } - - async updatePackage() { - this.log.info('--: updating app (package) parameters on Fastly gateway ...'); - - const packageparams = Object - .entries(this.cfg.packageParams) - .map(([key, value]) => ({ - item_key: `${this.cfg.packageName}.${key}`, - item_value: value, - op: 'upsert', - })); - - if (packageparams.length !== 0) { - await this._fastly.bulkUpdateDictItems(undefined, 'packageparams', ...packageparams); - } - - try { - await this._fastly.updateDictItem(undefined, 'tokens', this.cfg.packageToken, `${Math.floor(Date.now() / 1000) + (365 * 24 * 3600)}`); - } catch (fe) { - if (fe.message.match('Exceeding max_dictionary_items')) { - const dictinfo = await this._fastly.readDictItems(undefined, 'tokens'); - const items = dictinfo.data; - const outdated = items - .filter((item) => parseInt(item.item_value, 10) < new Date().getTime() / 1000); - const olds = items.slice(0, 5); - // cleanup all old and outdated tokens - await Promise.all([...outdated, ...olds].map((item) => this._fastly.deleteDictItem(undefined, 'tokens', item.item_key))); - // try again - await this._fastly.updateDictItem(undefined, 'tokens', this.cfg.packageToken, `${Math.floor(Date.now() / 1000) + (365 * 24 * 3600)}`); - } - } - - this._fastly.discard(); - this.log.info(chalk`{green ok:} updating app (package) parameters on Fastly gateway.`); - } - - selectBackendVCL() { - // declare a local variable for each backend - const init = this._deployers.map((deployer) => `declare local var.${deployer.name.toLowerCase()} INTEGER;`); - - // get the desired weight for each backend - const set = this._deployers.map((deployer) => `set var.${deployer.name.toLowerCase()} = std.atoi(table.lookup(priorities, "${deployer.name.toLowerCase()}", "${Math.floor((100 / this._deployers.length))}"));`); - - // for all but the first, sum up the weights - const increment = this._deployers - .slice(1) - .map((deployer, i) => ([deployer.name, this._deployers[i].name])) - .map(([current, previous]) => `set var.${current.toLowerCase()} += var.${previous.toLowerCase()};`); - - const backendvcl = ` - declare local var.i INTEGER; - set var.i = randomint(0, 100); - - set req.http.X-Backend-Health = ${this._deployers.map((deployer) => `backend.F_${deployer.name}.healthy`).join(' + " " + ')}; - - if (false) {}`; - - const middle = this._deployers.map((deployer) => `if((var.i <= var.${deployer.name.toLowerCase()} && backend.F_${deployer.name}.healthy) && subfield(req.http.x-ow-version-lock, "env", "&") !~ ".?" || subfield(req.http.x-ow-version-lock, "env", "&") == "${deployer.name.toLowerCase()}") { - set req.backend = F_${deployer.name}; - ${this._deployers[0].customVCL} - }`); - - const fallback = `{ - set req.backend = F_${this._deployers[0].name}; - ${this._deployers[0].customVCL} - }`; - - return [...init, ...set, ...increment].join('\n') + [backendvcl, ...middle, fallback].join(' else '); - } - - /** - * Generates a VCL snippet (for each package deployed) that lists all package parameter - * names and looks up their values from the secret edge dictionary. - * @returns {string} VCL snippet to look up package parameters from edge dict - */ - listPackageParamsVCL() { - const pre = ` - if (obj.status == 600 && req.url.path ~ "^/${this.cfg.packageName}/") { - set obj.status = 200; - set obj.response = "OK"; - set obj.http.content-type = "application/json"; - synthetic "{" + `; - const post = `+ "}"; - return(deliver); -}`; - const middle = Object - .keys(this.cfg.packageParams) - .map((paramname, index) => `"%22${paramname}%22:%22" json.escape(table.lookup(packageparams, "${this.cfg.packageName}.${paramname}")) "%22${(index + 1) < Object.keys(this.cfg.packageParams).length ? ',' : ''}"`).join(' + '); - - return pre + middle + post; - } - - setURLVCL() { - const pre = ` -declare local var.package STRING; -declare local var.action STRING; -declare local var.version STRING; -declare local var._version STRING; -declare local var.atversion STRING; -declare local var.slashversion STRING; -declare local var.rest STRING; -declare local var.fullpath STRING; - -set var.version = ""; -set var.rest = ""; - -if (req.url ~ "^/([^/]+)/([^/@_]+)([@_]([^/@_?]+)+)?(.*$)") { - log "match"; - set var.package = re.group.1; - set var.action = re.group.2; - set var.version = re.group.3; - - set var.fullpath = "/" + var.package + "/" + var.action + regsub(var.version, "[@_]", "@"); - - set var.version = table.lookup(aliases, var.fullpath, var.version); - - set var.rest = re.group.5; - - // normalize version divider - set var._version = regsub(var.version, "[@_]", "_"); - set var.atversion = regsub(var.version, "[@_]", "@"); - set var.slashversion = regsub(var.version, "[@_]", "/"); -} -`; - return pre + this._deployers.map((deployer) => ` - if (req.backend == F_${deployer.name}) { - set bereq.url = ${deployer.urlVCL}; - } - `).join('\n'); - } - - async enableLogging(version) { - if (this._cfg.coralogixToken) { - this.log.info(chalk`--: Set up Gateway logging to {yellow Coralogix}`); - await this._fastly.writeHttps(version, 'helix-coralogix', { - name: 'helix-coralogix', - format: toString({ - timestamp: vcl`time.start.msec`, - subsystemName: str(vcl`req.service_id`), - severity: concat( - vcl`if(resp.status<400, "3", "")`, - vcl`if(resp.status>=400 && resp.status<500, "4", "")`, - vcl`if(resp.status>=500, "5", "")`, - ), - json: { - ow: { - environment: str(vcl`regsub(req.backend, ".*_", "")`), - actionName: str(vcl`regsub(req.url, "^/([^/]+)/([^/@_]+)([@_]([^/@_?]+)+)?(.*$)", "\\\\1/\\\\2@\\\\4")`), - activationId: str(concat( - vcl`if(resp.http.x-openwhisk-activation-id != "", resp.http.x-openwhisk-activation-id, "")`, - vcl`if(resp.http.Apigw-Requestid != "", resp.http.Apigw-Requestid, "")`, - vcl`if(resp.http.Function-Execution-Id != "", resp.http.Function-Execution-Id, "")`, - )), - transactionId: str(concat( - vcl`if(resp.http.x-request-id != "", resp.http.x-request-id, "")`, - vcl`if(resp.http.x-amazn-trace-id != "", resp.http.x-amazn-trace-id, "")`, - vcl`if(resp.http.X-Cloud-Trace-Context != "", resp.http.X-Cloud-Trace-Context, "")`, - )), - }, - time: { - start: str( - concat( - time`begin:%Y-%m-%dT%H:%M:%S`, - '.', - time`begin:msec_frac`, - time`begin:%z`, - ), - ), - start_msec: vcl`time.start.msec`, - end: str( - concat( - time`end:%Y-%m-%dT%H:%M:%S`, - '.', - time`end:msec_frac`, - time`end:%z`, - ), - ), - end_msec: vcl`time.end.msec`, - elapsed: '%D', - }, - client: { - name: str(vcl`client.as.name`), - number: vcl`client.as.number`, - location_geopoint: { - lat: vcl`client.geo.latitude`, - lon: vcl`client.geo.longitude`, - }, - city_name: str(vcl`client.geo.city.ascii`), - country_name: str(vcl`client.geo.country_name.ascii`), - connection_speed: str(vcl`client.geo.conn_speed`), - ip: str( - vcl`regsuball(req.http.x-forwarded-for, ",.*", "")`, - ), - }, - request: { - id: str(vcl`if(req.http.X-CDN-Request-ID, req.http.X-CDN-Request-ID, randomstr(8, "0123456789abcdef") + "-" + randomstr(4, "0123456789abcdef") + "-" + randomstr(4, "0123456789abcdef") + "-" + randomstr(1, "89ab") + randomstr(3, "0123456789abcdef") + "-" + randomstr(12, "0123456789abcdef"))`), - method: str('%m'), - protocol: str(vcl`if(fastly_info.is_h2, "HTTP/2", "HTTP/1.1")`), - h2: vcl`if(fastly_info.is_h2, "true", "false")`, - is_ipv6: vcl`if(req.is_ipv6, "true", "false")`, - url: str(vcl`cstr_escape(if(req.http.X-Orig-Url, req.http.X-Orig-Url, req.url))`), - referer: req`Referer`, - user_agent: req`User-Agent`, - accept_content: req`Accept`, - accept_language: req`Accept-Language`, - accept_encoding: req`Accept-Encoding`, - accept_charset: req`Accept-Charset`, - xfh: req`X-Forwarded-Host`, - via: req`Via`, - cache_control: req`Cache-Control`, - header_size: vcl`req.header_bytes_read`, - body_size: vcl`req.body_bytes_read`, - restarts: vcl`req.restarts`, - versionlock: req`X-OW-Version-Lock`, - }, - origin: { - host: str('%v'), - url: str(vcl`if(req.http.x-backend-url, req.http.x-backend-url, req.url)`), - }, - response: { - status: '%s', - error: str(vcl`resp.http.x-error`), - content_type: res`Content-Type`, - header_size: vcl`resp.header_bytes_written`, - body_size: '%B', - }, - edge: { - cache_status: str(vcl`fastly_info.state`), - datacenter: str(vcl`server.datacenter`), - ip: str('%A'), - }, - }, - applicationName: str(this._cfg.coralogixApp), - }), - url: 'https://api.coralogix.com/logs/rest/singles', - request_max_bytes: 2000000, - content_type: 'application/json', - header_name: 'private_key', - header_value: this._cfg.coralogixToken, - json_format: 1, - service_id: this._cfg.service, - }); - } - } - - async deploy() { - this.log.info(chalk`--: Set up {yellow Fastly} Gateway`); - try { - await this._fastly.transact(async (newversion) => { - await this.enableLogging(newversion); - - this.log.info('--: create condition'); - await this._fastly.writeCondition(newversion, 'false', { - name: 'false', - statement: 'false', - type: 'request', - }); - - this.log.info('--: create dictionaries'); - await this._fastly.writeDictionary(newversion, 'priorities', { - name: 'priorities', - write_only: 'false', - }); - - await this._fastly.writeDictionary(newversion, 'aliases', { - name: 'aliases', - write_only: 'false', - }); - - await this._fastly.writeDictionary(newversion, 'tokens', { - name: 'tokens', - write_only: 'false', - }); - - await this._fastly.writeDictionary(newversion, 'packageparams', { - name: 'packageparams', - write_only: 'true', - }); - - if (this._cfg.checkinterval > 0 && this._cfg.checkpath) { - this.log.info('--: setup health-check'); - // set up health checks - await Promise.all(this._deployers - .map((deployer) => ({ - check_interval: this._cfg.checkinterval, - expected_response: 200, - host: deployer.host, - http_version: '1.1', - method: 'GET', - initial: 1, - name: `${deployer.name}Check`, - path: `${deployer.basePath}${this._cfg.checkpath}`, - threshold: 2, - timeout: 5000, - window: 3, - })) - .map((healthcheck) => this._fastly - .writeHealthcheck(newversion, healthcheck.name, healthcheck))); - } - - // set up backends - await Promise.all(this._deployers - .map((deployer) => ({ - hostname: deployer.host, - ssl_cert_hostname: deployer.host, - ssl_sni_hostname: deployer.host, - address: deployer.host, - override_host: deployer.host, - name: deployer.name, - error_threshold: 0, - first_byte_timeout: 60000, - weight: 100, - connect_timeout: 5000, - port: 443, - between_bytes_timeout: 10000, - shield: '', // 'bwi-va-us', - max_conn: 200, - use_ssl: true, - request_condition: 'false', - })) - .map((backend) => { - const retval = backend; - if (this._cfg.checkinterval > 0 && this._cfg.checkpath) { - retval.healthcheck = `${backend.name}Check`; - } - return retval; - }) - .map(async (backend) => { - this.log.info(`--: create backend ${backend.name} -> ${backend.hostname}`); - try { - return await this._fastly.createBackend(newversion, backend); - } catch (e) { - return this._fastly.updateBackend(newversion, backend.name, backend); - } - })); - - this.log.info('--: write VLC snippets'); - await this._fastly.writeSnippet(newversion, 'packageparams.auth', { - name: 'packageparams.auth', - priority: 9, - dynamic: 0, - type: 'recv', - content: ` - if (req.http.Authorization) { - if(time.is_after(std.time(table.lookup(tokens, regsub(req.http.Authorization, "^Bearer ", ""), "expired"), std.integer2time(0)), time.start)) { - error 600 "Get Package Params"; - } - }`, - }); - - await this._fastly.writeSnippet(newversion, `${this.cfg.packageName}.params`, { - name: `${this.cfg.packageName}.params`, - priority: 10, - dynamic: 0, - type: 'error', - content: this.listPackageParamsVCL(), - }); - - await this._fastly.writeSnippet(newversion, 'backend', { - name: 'backend', - priority: 10, - dynamic: 0, - type: 'recv', - content: this.selectBackendVCL(), - }); - - await this._fastly.writeSnippet(newversion, 'missurl', { - name: 'missurl', - priority: 10, - dynamic: 0, - type: 'miss', - content: this.setURLVCL(), - }); - - await this._fastly.writeSnippet(newversion, 'passurl', { - name: 'passurl', - priority: 10, - dynamic: 0, - type: 'pass', - content: this.setURLVCL(), - }); - - await this._fastly.writeSnippet(newversion, 'logurl', { - name: 'logurl', - priority: 10, - dynamic: 0, - type: 'fetch', - content: `set beresp.http.X-Backend-URL = bereq.url; - set beresp.http.X-Backend-Name = req.backend; - set beresp.http.X-Backend-Health = req.http.X-Backend-Health; - set beresp.cacheable = false;`, - }); - - await this._fastly.writeSnippet(newversion, 'stashsurrogates', { - name: 'stashsurrogates', - priority: 10, - dynamic: 0, - type: 'fetch', - content: ` - set beresp.http.X-Surrogate-Key = beresp.http.Surrogate-Key; - set beresp.http.X-Surrogate-Control = beresp.http.Surrogate-Control;`, - }); - - let restartcontent = ` - # restart the request in case of flakiness - if (req.restarts < 2 && (resp.status == 503 || resp.status == 504) && (req.request == "GET" || req.request == "HEAD" || req.request == "PUT" || req.request == "DELETE")) { - restart; - } - set resp.http.x-gateway-restarts = req.restarts; - unset resp.http.Fastly-Restarts;`; - - if (this._deployers.find((deployer) => deployer.name === 'Google')) { - restartcontent += ` - # If Google can't find a function, it sends a redirect to the login page instead - # of a 404. This fixes it. - if (resp.status == 302 && req.backend == F_Google && resp.http.Location ~ "^https://accounts.google.com/ServiceLogin") { - set resp.status = 404; - } - `; - } - await this._fastly.writeSnippet(newversion, 'restart', { - name: 'restart', - priority: 10, - dynamic: 0, - type: 'deliver', - content: restartcontent, - }); - - await this._fastly.writeSnippet(newversion, 'restoresurrogates', { - name: 'restoresurrogates', - priority: 10, - dynamic: 0, - type: 'deliver', - content: ` - set resp.http.Surrogate-Key = resp.http.X-Surrogate-Key; - set resp.http.Surrogate-Control = resp.http.X-Surrogate-Control;`, - }); - }, true); - - this.log.info(chalk`{green ok}: Set up {yellow Fastly} Gateway done.`); - } catch (e) { - this.log.error(chalk`{red error}: failed to setup gateway: ${e.message}`); - throw e; - } finally { - this._fastly.discard(); - } - } -} - -FastlyGateway.Config = FastlyConfig; diff --git a/src/template/fastly-adapter.js b/src/template/fastly-adapter.js deleted file mode 100644 index 183670e5..00000000 --- a/src/template/fastly-adapter.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2021 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -/* eslint-env serviceworker */ -/* global Dictionary */ - -import { extractPathFromURL } from './adapter-utils.js'; - -export function getEnvInfo(req, env) { - const serviceVersion = env('FASTLY_SERVICE_VERSION'); - const requestId = env('FASTLY_TRACE_ID'); - const region = env('FASTLY_POP'); - const functionName = env('FASTLY_SERVICE_ID'); - const functionFQN = `${env('FASTLY_CUSTOMER_ID')}-${functionName}-${serviceVersion}`; - const txId = req.headers.get('x-transaction-id') ?? env('FASTLY_TRACE_ID'); - - console.debug('Env info sv: ', serviceVersion, ' reqId: ', requestId, ' region: ', region, ' functionName: ', functionName, ' functionFQN: ', functionFQN, ' txId: ', txId); - - return { - functionFQN, - functionName, - region, - requestId, - serviceVersion, - txId, - }; -} - -async function getEnvironmentInfo(req) { - // The fastly:env import will be available in the fastly c@e environment - /* eslint-disable-next-line import/no-unresolved */ - const mod = await import('fastly:env'); - return getEnvInfo(req, mod.env); -} - -async function handler(event) { - try { - const { request } = event; - const env = await getEnvironmentInfo(request); - - console.log('Fastly Adapter is here'); - let packageParams; - // eslint-disable-next-line import/no-unresolved,global-require - const { main } = require('./main.js'); - const context = { - resolver: null, - pathInfo: { - suffix: extractPathFromURL(request), - }, - runtime: { - name: 'compute-at-edge', - region: env.region, - }, - func: { - name: env.functionName, - package: null, - version: env.serviceVersion, - fqn: env.functionFQN, - app: null, - }, - invocation: { - id: null, - deadline: null, - transactionId: env.txId, - requestId: env.requestId, - }, - env: new Proxy(new Dictionary('secrets'), { - get: (target, prop) => { - try { - return target.get(prop); - } catch { - if (packageParams) { - console.log('Using cached params'); - return packageParams[prop]; - } - const url = target.get('_package'); - const token = target.get('_token'); - // console.log(`Getting secrets from ${url} with ${token}`); - return fetch(url, { - backend: 'gateway', - headers: { - authorization: `Bearer ${token}`, - }, - }).then((response) => { - if (response.ok) { - // console.log('response is ok...'); - return response.text().then((json) => { - // console.log('json received: ' + json); - packageParams = JSON.parse(json); - return packageParams[prop]; - }).catch((error) => { - console.error(`Unable to parse JSON: ${error.message}`); - }); - } - console.error(`HTTP status is not ok: ${response.status}`); - return undefined; - }).catch((err) => { - console.error(`Unable to fetch parames: ${err.message}`); - }); - } - }, - }), - storage: null, - }; - const response = await main(request, context); - return response; - } catch (e) { - console.log(e.message); - return new Response(`Error: ${e.message}`, { status: 500 }); - } -} - -export default function fastly() { - console.log('checking for fastly environment'); - /* eslint-disable-next-line no-undef */ - if (CacheOverride) { - return handler; - } - return false; -} diff --git a/test/fixtures/edge-action/package-lock.json b/test/fixtures/edge-action/package-lock.json deleted file mode 100644 index 355feb19..00000000 --- a/test/fixtures/edge-action/package-lock.json +++ /dev/null @@ -1,363 +0,0 @@ -{ - "name": "simple-project", - "version": "1.43", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "simple-project", - "version": "1.43", - "license": "Apache-2.0", - "devDependencies": { - "@adobe/helix-fetch": "^2.4.2" - } - }, - "node_modules/@adobe/helix-fetch": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@adobe/helix-fetch/-/helix-fetch-2.4.2.tgz", - "integrity": "sha512-tUew2pi6fcixh9nrItngqul5pFj9KNPuMmf4eqOqjKfmeAXdb9InR46yKh/pFAPqAwAw8ERCpHd+4NkFGvXSgg==", - "dev": true, - "dependencies": { - "debug": "4.3.2", - "form-data": "4.0.0", - "get-stream": "6.0.1", - "http-cache-semantics": "4.1.0", - "lru-cache": "6.0.0", - "object-sizeof": "1.6.1" - }, - "engines": { - "node": ">=12.0" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mime-db": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", - "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.32", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", - "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", - "dev": true, - "dependencies": { - "mime-db": "1.49.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/object-sizeof": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/object-sizeof/-/object-sizeof-1.6.1.tgz", - "integrity": "sha512-gNKGcRnDRXwEpAdwUY3Ef+aVZIrcQVXozSaVzHz6Pv4JxysH8vf5F+nIgsqW5T/YNwZNveh0mIW7PEH1O2MrDw==", - "dev": true, - "dependencies": { - "buffer": "^5.6.0" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - }, - "dependencies": { - "@adobe/helix-fetch": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@adobe/helix-fetch/-/helix-fetch-2.4.2.tgz", - "integrity": "sha512-tUew2pi6fcixh9nrItngqul5pFj9KNPuMmf4eqOqjKfmeAXdb9InR46yKh/pFAPqAwAw8ERCpHd+4NkFGvXSgg==", - "dev": true, - "requires": { - "debug": "4.3.2", - "form-data": "4.0.0", - "get-stream": "6.0.1", - "http-cache-semantics": "4.1.0", - "lru-cache": "6.0.0", - "object-sizeof": "1.6.1" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "mime-db": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", - "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", - "dev": true - }, - "mime-types": { - "version": "2.1.32", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", - "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", - "dev": true, - "requires": { - "mime-db": "1.49.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "object-sizeof": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/object-sizeof/-/object-sizeof-1.6.1.tgz", - "integrity": "sha512-gNKGcRnDRXwEpAdwUY3Ef+aVZIrcQVXozSaVzHz6Pv4JxysH8vf5F+nIgsqW5T/YNwZNveh0mIW7PEH1O2MrDw==", - "dev": true, - "requires": { - "buffer": "^5.6.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } -} diff --git a/test/fixtures/edge-action/package.json b/test/fixtures/edge-action/package.json deleted file mode 100644 index 2d8e6586..00000000 --- a/test/fixtures/edge-action/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "simple-project", - "version": "1.43", - "description": "Simple Test Project", - "private": true, - "license": "Apache-2.0", - "main": "index.js", - "wsk": { - "name": "simple-project", - "webExport": false, - "package": { - "name": "simple-package" - } - }, - "devDependencies": { - "@adobe/fetch": "3.1.4" - } -} diff --git a/test/fixtures/edge-action/src/index.js b/test/fixtures/edge-action/src/index.js deleted file mode 100644 index 04fa5e0c..00000000 --- a/test/fixtures/edge-action/src/index.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -const { Response, fetch } = require('@adobe/fetch'); - -module.exports.main = async function main(req, context) { - console.log(req.url, `https://httpbin.org/status/${req.url.split('/').pop()}`); - const backendresponse = await fetch(`https://httpbin.org/status/${req.url.split('/').pop()}`, { - backend: 'httpbin.org', - }); - console.log(await backendresponse.text()); - return new Response(`(${context?.func?.name}) ok: ${await context.env.HEY} ${await context.env.FOO} – ${backendresponse.status}`); -};