├── .gitignore ├── examples ├── graphql │ ├── .gitignore │ ├── fastly.toml │ ├── package.json │ ├── webpack.config.js │ ├── src │ │ ├── index.js │ │ └── schema.js │ └── package-lock.json ├── ab-testing │ ├── .gitignore │ ├── fastly.toml │ ├── package.json │ ├── webpack.config.js │ └── src │ │ └── index.js ├── middleware │ ├── .gitignore │ ├── fastly.toml │ ├── src │ │ └── index.js │ ├── package.json │ └── webpack.config.js ├── templating │ ├── .gitignore │ ├── fastly.toml │ ├── src │ │ ├── templates │ │ │ ├── about.html │ │ │ └── home.html │ │ └── index.js │ ├── package.json │ └── webpack.config.js ├── ab-testing-proxy │ ├── .gitignore │ ├── fastly.toml │ ├── package.json │ ├── webpack.config.js │ └── src │ │ └── index.js ├── basic-routing │ ├── .gitignore │ ├── fastly.toml │ ├── package.json │ ├── webpack.config.js │ └── src │ │ └── index.js ├── content-stitching │ ├── .gitignore │ ├── fastly.toml │ ├── src │ │ └── index.js │ ├── package.json │ └── webpack.config.js ├── jwt-authentication │ ├── .gitignore │ ├── local-dict-config.json │ ├── fastly.toml │ ├── webpack.config.js │ ├── package.json │ └── src │ │ └── index.js ├── typescript-example │ ├── .gitignore │ ├── fastly.toml │ ├── tsconfig.json │ ├── webpack.config.js │ ├── package.json │ └── src │ │ └── index.ts └── content-stitching-with-ab-testing │ ├── .gitignore │ ├── fastly.toml │ ├── package.json │ ├── webpack.config.js │ └── src │ └── index.js ├── src ├── index.ts └── lib │ ├── routing │ ├── route.ts │ ├── middleware.ts │ ├── request.ts │ ├── response.ts │ └── router.ts │ └── utilities │ └── fetcher.ts ├── tsconfig.json ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /examples/graphql/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/ab-testing/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/middleware/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/templating/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/ab-testing-proxy/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/basic-routing/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/content-stitching/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/jwt-authentication/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/typescript-example/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/content-stitching-with-ab-testing/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /bin 3 | /pkg 4 | -------------------------------------------------------------------------------- /examples/jwt-authentication/local-dict-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "secret": "this is my super secret jwt signing key" 3 | } -------------------------------------------------------------------------------- /examples/graphql/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "graphql-example" 9 | service_id = "" 10 | -------------------------------------------------------------------------------- /examples/ab-testing/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "ab-testing-example" 9 | service_id = "" 10 | -------------------------------------------------------------------------------- /examples/middleware/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "middleware-example" 9 | service_id = "" 10 | -------------------------------------------------------------------------------- /examples/templating/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "middleware-example" 9 | service_id = "" 10 | -------------------------------------------------------------------------------- /examples/templating/src/templates/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{title}} 4 | 5 | 6 | 7 |

{{title}}

8 |
9 | {{#segments}} 10 |

{{name}}

11 |

{{description}}

12 | {{/segments}} 13 |
14 |

15 | Current time: {{time}} 16 |

17 | 18 | 19 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "./lib/routing/router"; 2 | import { Fetcher } from "./lib/utilities/fetcher"; 3 | import FPRequest from "./lib/routing/request"; 4 | import FPResponse from "./lib/routing/response"; 5 | import { MiddlewareCallback, Middleware } from "./lib/routing/middleware"; 6 | 7 | export { 8 | Router, 9 | Fetcher, 10 | FPRequest, 11 | FPResponse, 12 | MiddlewareCallback, 13 | Middleware, 14 | }; 15 | -------------------------------------------------------------------------------- /examples/jwt-authentication/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "basic-routing" 9 | service_id = "" 10 | 11 | [local_server.dictionaries.config] 12 | file = "./local-dict-config.json" 13 | format = "json" -------------------------------------------------------------------------------- /examples/basic-routing/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "basic-routing" 9 | service_id = "" 10 | 11 | 12 | [local_server.backends] 13 | [local_server.backends.my-origin] 14 | url = "https://fastly.com" -------------------------------------------------------------------------------- /examples/typescript-example/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "basic-routing" 9 | service_id = "" 10 | 11 | 12 | [local_server.backends] 13 | [local_server.backends.my-origin] 14 | url = "https://fastly.com" -------------------------------------------------------------------------------- /examples/ab-testing-proxy/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "ab-testing-proxy" 9 | service_id = "" 10 | 11 | 12 | [local_server.backends] 13 | [local_server.backends.main_origin] 14 | url = "https://httpbin.org" -------------------------------------------------------------------------------- /examples/typescript-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./bin/", 4 | "rootDir": ".", 5 | "sourceMap": false, 6 | "noImplicitAny": false, 7 | "module": "es6", 8 | "target": "es2019", 9 | "esModuleInterop": true, 10 | "allowJs": true, 11 | "moduleResolution": "node", 12 | "typeRoots": ["./node_modules/@fastly"], 13 | "forceConsistentCasingInFileNames": true, 14 | "declaration": true, 15 | }, 16 | "exclude": ["dist/", "examples/"] 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist/", 4 | "rootDir": "./src", 5 | "sourceMap": false, 6 | "noImplicitAny": false, 7 | "module": "es6", 8 | "target": "es2019", 9 | "esModuleInterop": true, 10 | "allowJs": true, 11 | "moduleResolution": "node", 12 | "typeRoots": ["./node_modules/@fastly", "./node_modules/@types"], 13 | "forceConsistentCasingInFileNames": true, 14 | "declaration": true, 15 | }, 16 | "exclude": ["dist/", "examples/"] 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/routing/route.ts: -------------------------------------------------------------------------------- 1 | import FPRequest from "./request"; 2 | import FPResponse from "./response"; 3 | 4 | export type RequestHandlerCallback = ( 5 | req: FPRequest, 6 | res: FPResponse 7 | ) => Promise; 8 | 9 | export class Route { 10 | constructor( 11 | private matchFn: Function, 12 | private callback: RequestHandlerCallback 13 | ) {} 14 | 15 | public check(event: FPRequest): boolean { 16 | return this.matchFn(event); 17 | } 18 | 19 | public async run(req: FPRequest, res: FPResponse): Promise { 20 | await this.callback(req, res); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/templating/src/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{title}} 4 | 5 | 6 | 7 |

{{title}}

8 |

9 | {{#bold}}Lorem, ipsum{{/bold}} dolor sit amet consectetur adipisicing elit. Unde recusandae, 10 | explicabo vero voluptatem impedit iusto adipisci autem veritatis. Voluptas 11 | quaerat dignissimos eligendi incidunt. Mollitia ad at nam aspernatur 12 | dolorum eaque? 13 |

14 |
15 |

This page is powered by {{framework}}

16 | 17 | 18 | -------------------------------------------------------------------------------- /examples/content-stitching/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "content-stitching" 9 | service_id = "" 10 | 11 | 12 | [local_server.backends] 13 | [local_server.backends.header_service] 14 | url = "https://content-stitching-header.edgecompute.app/" 15 | [local_server.backends.page_service] 16 | url = "https://content-stitching-page.edgecompute.app/" -------------------------------------------------------------------------------- /examples/content-stitching-with-ab-testing/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | authors = ["oss@fastly.com"] 5 | description = "Compute example app" 6 | language = "javascript" 7 | manifest_version = 2 8 | name = "content-stitching" 9 | service_id = "" 10 | 11 | 12 | [local_server.backends] 13 | [local_server.backends.header_service] 14 | url = "https://content-stitching-header.edgecompute.app/" 15 | [local_server.backends.page_service] 16 | url = "https://content-stitching-page.edgecompute.app/" -------------------------------------------------------------------------------- /src/lib/routing/middleware.ts: -------------------------------------------------------------------------------- 1 | import FPRequest from "./request"; 2 | import FPResponse from "./response"; 3 | 4 | export type MiddlewareCallback = ( 5 | req: FPRequest, 6 | res: FPResponse, 7 | next?: () => void 8 | ) => Promise; 9 | 10 | export class Middleware { 11 | constructor( 12 | private matchFn: Function, 13 | private callback: MiddlewareCallback 14 | ) {} 15 | 16 | public check(event: FPRequest): boolean { 17 | return this.matchFn(event); 18 | } 19 | 20 | public async run(req: FPRequest, res: FPResponse): Promise { 21 | // Supply an empty callback which would normally be next() in express 22 | await this.callback(req, res, () => {}); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/typescript-example/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | stats: { errorDetails: true }, 5 | target: "webworker", 6 | output: { 7 | path: path.join(process.cwd(), "bin"), 8 | filename: "index.js", 9 | }, 10 | // mode: 'production', 11 | mode: "production", 12 | devtool: "cheap-module-source-map", 13 | optimization: { 14 | sideEffects: true, 15 | minimize: false 16 | }, 17 | resolve: { 18 | extensions: [".ts", ".js", ".json"], 19 | fallback: { 20 | url: require.resolve("core-js/"), 21 | }, 22 | }, 23 | module: { 24 | rules: [ 25 | { 26 | test: /\.ts?$/, 27 | use: "ts-loader", 28 | exclude: "/node_modules/", 29 | }, 30 | ], 31 | }, 32 | }; 33 | -------------------------------------------------------------------------------- /examples/middleware/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | 3 | const router = new Router(); 4 | 5 | /** 6 | * Add an x-powered-by header to every request 7 | */ 8 | router.use((req, res) => { 9 | res.setHeader("x-powered-by", "FlightPath"); 10 | }); 11 | 12 | /** 13 | * incremement the "visitiedcount" cookie on every request 14 | */ 15 | router.use("/cookies", (req, res) => { 16 | res.cookie("visitcount", (Number(req.cookies.visitcount) + 1) | 0, { 17 | maxAge: 60 * 60 * 24 * 7, // 1 week 18 | }); 19 | 20 | res.cookie("hello", "world"); 21 | }); 22 | 23 | router.use("*", (req, res) => { 24 | res.end("This content is served from middleware") 25 | }); 26 | 27 | router.route("GET", "/", (req, res) => { 28 | return res.send("This is never show as the middleware above calls `end`"); 29 | }); 30 | 31 | router.listen(); 32 | -------------------------------------------------------------------------------- /examples/content-stitching/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router, Fetcher } from "../../../dist/index.js"; 2 | 3 | const router = new Router(); 4 | 5 | router.get("*", async (req, res) => { 6 | const fetcher = new Fetcher({ 7 | header: { 8 | url: "https://content-stitching-header.edgecompute.app/", 9 | backend: "header_service" 10 | }, 11 | page: { 12 | url: "https://content-stitching-page.edgecompute.app/", 13 | backend: "page_service" 14 | } 15 | }) 16 | 17 | let data = await fetcher.fetch(); 18 | 19 | res.send(` 20 | 21 | 22 | Content Stitching 23 | 24 | 25 | 26 | ${data.header.data} 27 |
28 | ${data.page.data} 29 | 30 | 31 | `) 32 | }); 33 | 34 | // Listen for requests 35 | router.listen(); 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flight-path", 3 | "version": "1.0.13", 4 | "description": "Express style router for Fastly Compute@Edge", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/williamoverton/FlightPath" 10 | }, 11 | "scripts": { 12 | "build": "tsc", 13 | "prepublish": "tsc", 14 | "dev": "nodemon --exec \"tsc\"" 15 | }, 16 | "keywords": [ 17 | "fastly", 18 | "c@e", 19 | "compute", 20 | "edge", 21 | "router" 22 | ], 23 | "author": "", 24 | "license": "ISC", 25 | "devDependencies": { 26 | "@types/node": "^17.0.10", 27 | "nodemon": "^2.0.14", 28 | "ts-loader": "^9.2.6", 29 | "typescript": "^4.4.4", 30 | "webpack": "^5.65.0", 31 | "webpack-cli": "^4.9.1" 32 | }, 33 | "dependencies": { 34 | "@fastly/js-compute": "^0.2.0", 35 | "cookie": "^0.4.1", 36 | "core-js": "^3.19.0", 37 | "mustache": "^4.2.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/jwt-authentication/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | const NodePolyfillPlugin = require("node-polyfill-webpack-plugin") 4 | 5 | module.exports = { 6 | entry: "./src/index.js", 7 | mode: "production", 8 | optimization: { 9 | minimize: false, 10 | }, 11 | target: "webworker", 12 | output: { 13 | filename: "index.js", 14 | path: path.resolve(__dirname, "bin"), 15 | libraryTarget: "this", 16 | }, 17 | module: { 18 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 19 | // without additional configuration or dependencies. 20 | rules: [ 21 | // asset/source exports the source code of the asset. 22 | // Usage: e.g., import notFoundPage from "./page_404.html" 23 | { 24 | test: /\.(txt|html)/, 25 | type: "asset/source", 26 | }, 27 | ], 28 | }, 29 | plugins: [ 30 | new NodePolyfillPlugin({ 31 | excludeAliases: ["console"] 32 | }) 33 | ] 34 | }; 35 | -------------------------------------------------------------------------------- /examples/ab-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/middleware/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/templating/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/basic-routing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/ab-testing-proxy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/content-stitching/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/content-stitching-with-ab-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0" 23 | }, 24 | "scripts": { 25 | "prebuild": "webpack", 26 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 27 | "deploy": "npm run build && fastly compute deploy", 28 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/graphql/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | }, 21 | "dependencies": { 22 | "@fastly/js-compute": "^0.2.0", 23 | "graphql-helix": "^1.9.1" 24 | }, 25 | "scripts": { 26 | "prebuild": "webpack", 27 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 28 | "deploy": "npm run build && fastly compute deploy", 29 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/graphql/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/ab-testing/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/basic-routing/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/middleware/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/templating/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/ab-testing-proxy/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/content-stitching/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/content-stitching-with-ab-testing/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | 4 | module.exports = { 5 | entry: "./src/index.js", 6 | mode: "production", 7 | optimization: { 8 | minimize: false 9 | }, 10 | target: "webworker", 11 | output: { 12 | filename: "index.js", 13 | path: path.resolve(__dirname, "bin"), 14 | libraryTarget: "this", 15 | }, 16 | module: { 17 | // Asset modules are modules that allow the use asset files (fonts, icons, etc) 18 | // without additional configuration or dependencies. 19 | rules: [ 20 | // asset/source exports the source code of the asset. 21 | // Usage: e.g., import notFoundPage from "./page_404.html" 22 | { 23 | test: /\.(txt|html)/, 24 | type: "asset/source", 25 | }, 26 | ], 27 | }, 28 | plugins: [ 29 | // Polyfills go here. 30 | // Used for, e.g., any cross-platform WHATWG, 31 | // or core nodejs modules needed for your application. 32 | new webpack.ProvidePlugin({ 33 | URL: "core-js/web/url", 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /examples/typescript-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "ts-loader": "^9.2.6", 19 | "typescript": "^4.5.2", 20 | "webpack": "^5.65.0", 21 | "webpack-cli": "^4.9.1" 22 | }, 23 | "dependencies": { 24 | "@fastly/js-compute": "^0.2.1" 25 | }, 26 | "scripts": { 27 | "prebuild": "webpack", 28 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 29 | "deploy": "npm run build && fastly compute deploy", 30 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/jwt-authentication/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "main": "src/index.js", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/fastly/compute-starter-kit-js-proto.git" 8 | }, 9 | "author": "oss@fastly.com", 10 | "license": "MIT", 11 | "bugs": { 12 | "url": "https://github.com/fastly/compute-starter-kit-js-proto/issues" 13 | }, 14 | "homepage": "https://developer.fastly.com/solutions/starters/compute-starter-kit-javascript-default", 15 | "devDependencies": { 16 | "buffer": "^6.0.3", 17 | "core-js": "^3.19.3", 18 | "jws": "^4.0.0", 19 | "node-polyfill-webpack-plugin": "^1.1.4", 20 | "nodemon": "^2.0.14", 21 | "webpack": "^5.10.0", 22 | "webpack-cli": "^4.2.0" 23 | }, 24 | "dependencies": { 25 | "@fastly/js-compute": "^0.2.0" 26 | }, 27 | "scripts": { 28 | "prebuild": "webpack", 29 | "build": "js-compute-runtime --skip-pkg bin/index.js bin/main.wasm", 30 | "deploy": "npm run build && fastly compute deploy", 31 | "dev": "nodemon --exec \"npm run build && fastly compute serve --skip-build\"" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/templating/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | 3 | const router = new Router({ 4 | templatesDir: "templates", 5 | }); 6 | 7 | /** 8 | * Add an x-powered-by header to every request 9 | */ 10 | router.use((req, res) => { 11 | res.setHeader("x-powered-by", "FlightPath"); 12 | }); 13 | 14 | /** 15 | * Render index page using Mustache (https://github.com/janl/mustache.js) 16 | */ 17 | router.route("GET", "/", (req, res) => { 18 | return res.render("home", { 19 | title: "Home Page!", 20 | framework: "FlightPath", 21 | bold: function () { 22 | return function (text, render) { 23 | return "" + render(text) + ""; 24 | }; 25 | }, 26 | }); 27 | }); 28 | 29 | /** 30 | * Render about page 31 | */ 32 | router.route("GET", "/about", (req, res) => { 33 | return res.render("about", { 34 | title: "About Page", 35 | segments: [ 36 | { 37 | name: "First Thing", 38 | description: "This is the first thing", 39 | }, 40 | { 41 | name: "Second Thing", 42 | description: "This is the second thing", 43 | }, 44 | ], 45 | time: () => { 46 | return new Date().toISOString(); 47 | }, 48 | }); 49 | }); 50 | 51 | router.listen(); 52 | -------------------------------------------------------------------------------- /src/lib/utilities/fetcher.ts: -------------------------------------------------------------------------------- 1 | export class Fetcher { 2 | constructor(private sources: FetchSourceMap) {} 3 | 4 | public async fetch(): Promise { 5 | let results: FetchResultMap = {}; 6 | 7 | await Promise.all( 8 | Object.keys(this.sources).map(async (sourceName) => { 9 | results[sourceName] = await this.getSourceData( 10 | this.sources[sourceName] 11 | ); 12 | }) 13 | ); 14 | 15 | return results; 16 | } 17 | 18 | private async getSourceData(source: FetchSource): Promise { 19 | let request = await fetch(source.url, { 20 | backend: source.backend, 21 | method: source.method, 22 | body: source.body, 23 | headers: source.headers, 24 | cacheOverride: source.cache, 25 | }); 26 | 27 | return { 28 | source: source, 29 | data: await request.text(), 30 | }; 31 | } 32 | } 33 | 34 | type FetchSourceMap = { [key: string]: FetchSource }; 35 | 36 | type FetchResultMap = { [key: string]: FetchResult }; 37 | 38 | type FetchResult = { 39 | source: FetchSource; 40 | data: string; 41 | }; 42 | 43 | type FetchSource = { 44 | url: string; 45 | backend: string; 46 | method?: string; 47 | body?: string; 48 | headers?: Headers; 49 | cache?: CacheOverride; 50 | }; 51 | -------------------------------------------------------------------------------- /examples/ab-testing/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | 3 | const router = new Router(); 4 | 5 | router.use((req, res) => { 6 | 7 | // Check if cookie is set for test 8 | if(!req.cookies.hasOwnProperty("abDarkMode") || req.cookies.abDarkMode === "") { 9 | const value = `${Math.random() > 0.5}`; 10 | 11 | // Set cookie on request object so it is available for this request 12 | req.cookies.abDarkMode = value; 13 | 14 | // Set cookie in browser 15 | res.cookie("abDarkMode", value, { 16 | maxAge: 60 * 60 // Keep cookie for 1 hour 17 | }); 18 | } 19 | }) 20 | 21 | router.get("/", (req, res) => { 22 | const classes = req.cookies.abDarkMode == "true" ? "text-white bg-dark" : ""; 23 | 24 | res.send(` 25 | 26 | 27 | Flight Path 28 | 29 | 30 | 31 |

Hello World!

32 |
33 |

This is a basic example of A/B testing at the edge.

34 |

Dark mode test: ${req.cookies.abDarkMode}

35 |
36 |
37 | 38 |
39 | 40 | 41 | `); 42 | }); 43 | 44 | router.post("/clear-ab-test", (req, res) => { 45 | res.cookie("abDarkMode", ""); 46 | res.redirect("/"); 47 | }) 48 | 49 | router.listen(); -------------------------------------------------------------------------------- /examples/graphql/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | import { 3 | getGraphQLParameters, 4 | processRequest, 5 | renderGraphiQL, 6 | shouldRenderGraphiQL, 7 | sendResult, 8 | } from "graphql-helix"; 9 | import { schema } from "./schema"; 10 | import FPRequest from "../../../dist/lib/routing/request.js"; 11 | 12 | const router = new Router(); 13 | 14 | router.use("*", async (req, res) => { 15 | let body = {}; 16 | 17 | try { 18 | body = await req.json(); 19 | } catch (e) {} 20 | 21 | // Create a generic Request object that can be consumed by Graphql Helix's API 22 | const request = { 23 | body: body, 24 | headers: req.headers, 25 | method: req.method, 26 | query: req.query, 27 | }; 28 | 29 | // Determine whether we should render GraphiQL instead of returning an API response 30 | if (shouldRenderGraphiQL(request)) { 31 | res.send(renderGraphiQL()); 32 | } else { 33 | // Extract the Graphql parameters from the request 34 | const { operationName, query, variables } = getGraphQLParameters(request); 35 | 36 | // Validate and execute the query 37 | const result = await processRequest({ 38 | operationName, 39 | query, 40 | variables, 41 | request, 42 | schema, 43 | }); 44 | 45 | // processRequest returns one of three types of results depending on how the server should respond 46 | // 1) RESPONSE: a regular JSON payload 47 | // 2) MULTIPART RESPONSE: a multipart response (when @stream or @defer directives are used) 48 | // 3) PUSH: a stream of events to push back down the client for a subscription 49 | // The "sendResult" is a NodeJS-only shortcut for handling all possible types of Graphql responses, 50 | // See "Advanced Usage" below for more details and customizations available on that layer. 51 | sendResult(result, res); 52 | } 53 | }); 54 | 55 | router.listen(); 56 | -------------------------------------------------------------------------------- /examples/graphql/src/schema.js: -------------------------------------------------------------------------------- 1 | import { 2 | GraphQLInt, 3 | GraphQLList, 4 | GraphQLObjectType, 5 | GraphQLSchema, 6 | GraphQLString, 7 | } from "graphql"; 8 | 9 | export const schema = new GraphQLSchema({ 10 | mutation: new GraphQLObjectType({ 11 | name: "Mutation", 12 | fields: () => ({ 13 | echo: { 14 | args: { 15 | text: { 16 | type: GraphQLString, 17 | }, 18 | }, 19 | type: GraphQLString, 20 | resolve: (_root, args) => { 21 | return args.text; 22 | }, 23 | }, 24 | }), 25 | }), 26 | query: new GraphQLObjectType({ 27 | name: "Query", 28 | fields: () => ({ 29 | alphabet: { 30 | type: new GraphQLList(GraphQLString), 31 | resolve: () => { 32 | return [ 33 | "a", 34 | "b", 35 | "c", 36 | "d", 37 | "e", 38 | "f", 39 | "g", 40 | "h", 41 | "i", 42 | "j", 43 | "k", 44 | "l", 45 | "m", 46 | "n", 47 | "o", 48 | "p", 49 | "q", 50 | "r", 51 | "s", 52 | "t", 53 | "u", 54 | "v", 55 | "w", 56 | "x", 57 | "y", 58 | "z", 59 | ]; 60 | }, 61 | }, 62 | song: { 63 | type: new GraphQLObjectType({ 64 | name: "Song", 65 | fields: () => ({ 66 | firstVerse: { 67 | type: GraphQLString, 68 | resolve: () => "Now I know my ABC's.", 69 | }, 70 | secondVerse: { 71 | type: GraphQLString, 72 | resolve: () => "Next time won't you sing with me?", 73 | }, 74 | }), 75 | }), 76 | resolve: () => ({}), 77 | }, 78 | }), 79 | }), 80 | }); 81 | -------------------------------------------------------------------------------- /src/lib/routing/request.ts: -------------------------------------------------------------------------------- 1 | import cookie from "cookie"; 2 | 3 | export default class FPRequest { 4 | readonly clientInfo: {} = {}; 5 | private _headers: Headers; 6 | readonly method: string; 7 | url: URL; 8 | params: { [key: string]: string } = {}; 9 | query: { [key: string]: string }; 10 | private _cookies: {} = {}; 11 | cookies: any = {}; 12 | 13 | constructor(private config: any, private event: FetchEvent) { 14 | this.clientInfo = event.client; 15 | this._headers = event.request.headers; 16 | this.method = event.request.method; 17 | this.url = new URL(event.request.url); 18 | this.query = Object.fromEntries(this.url.searchParams.entries()); 19 | 20 | if(config.parseCookies && this._headers.has("cookie")){ 21 | this._cookies = cookie.parse(this._headers.get("cookie")); 22 | } 23 | 24 | // If a cookie is set on the req object, we need to re-serialize the `cookie` header incase the req is forwarded to an origin 25 | this.cookies = new Proxy(this._cookies, { 26 | get: (target, key) => { 27 | return target[key]; 28 | }, 29 | set: (target, key, value) => { 30 | target[key] = value; 31 | this.reSerializeCookies(); 32 | return true; 33 | } 34 | }); 35 | } 36 | 37 | private reSerializeCookies() { 38 | console.log("reSerializeCookies") 39 | this._headers.set("cookie", Object.entries(this._cookies).map(([key, value]) => `${key}=${value}`).join("; ")); 40 | } 41 | 42 | get headers() { 43 | return Object.fromEntries(this._headers.entries()) 44 | } 45 | 46 | setHeader(key: string, value: string): void { 47 | this._headers.set(key, value); 48 | } 49 | 50 | async json() { 51 | return await this.event.request.json(); 52 | } 53 | 54 | async text() { 55 | return await this.event.request.text(); 56 | } 57 | 58 | async arrayBuffer() { 59 | return await this.event.request.arrayBuffer(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/ab-testing-proxy/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | 3 | /** 4 | * In this demo we proxy requests to another origin but add cookies for AB testing. 5 | * You can add tests into the `tests` object below and they will be added via cookies. 6 | * 7 | * This can be very useful for ab testing either on the client or server side. 8 | */ 9 | 10 | const router = new Router(); 11 | 12 | const tests = [ 13 | { 14 | name: "A/B Test 1", 15 | cookieName: "ab-test-1", 16 | percentage: 50, 17 | activeValue: "A", 18 | inactiveValue: "B", 19 | cookieOpts: { 20 | path: "/", 21 | }, 22 | }, 23 | { 24 | name: "A/B Test 2", 25 | cookieName: "ab-test-2", 26 | percentage: 20, 27 | activeValue: "A", 28 | inactiveValue: "B", 29 | cookieOpts: { 30 | maxAge: 60 * 60 * 24, // 1 day 31 | path: "/", 32 | }, 33 | }, 34 | ]; 35 | 36 | // On every request we make sure the user is a part of all tests 37 | router.use((req, res) => { 38 | tests.map((test) => { 39 | // Only set cookie if it is not already set 40 | if (!(test.cookieName in req.cookies)) { 41 | let selectedValue = 42 | Math.random() < test.percentage / 100 43 | ? test.activeValue 44 | : test.inactiveValue; 45 | 46 | req.cookies[test.cookieName] = selectedValue; 47 | res.cookie(test.cookieName, selectedValue, test.cookieOpts); 48 | } 49 | }); 50 | }); 51 | 52 | const originHostname = "httpbin.org"; 53 | 54 | router.all("*", async (req, res) => { 55 | // Change the hostname of the url to our origin 56 | req.url.host = originHostname; 57 | 58 | // remove port, defaulting to 443 or 80 depending on protocol. 59 | req.url.port = ""; 60 | 61 | // Change Host header to the correct one for our origin 62 | req.setHeader("host", originHostname); 63 | 64 | // Make a request to the origin 65 | let originRequest = await fetch(req.url.toString(), { 66 | backend: "main_origin", 67 | headers: req.headers, 68 | method: req.method, 69 | body: await req.text(), 70 | }); 71 | 72 | // Send response 73 | res.send(originRequest); 74 | }); 75 | 76 | router.listen(); 77 | -------------------------------------------------------------------------------- /examples/content-stitching-with-ab-testing/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router, Fetcher } from "../../../dist/index.js"; 2 | 3 | // Create router object for binding routes to. 4 | const router = new Router(); 5 | 6 | // Add middleware for all routes 7 | router.use((req, res) => { 8 | 9 | // Add a header to the response 10 | res.setHeader("x-powered-by", "Fastly C@E - Flight Path"); 11 | 12 | // Set abtest cookie if it isn not already set 13 | if(!("abtest" in req.cookies)) { 14 | let value = Math.random() > 0.5 ? "a" : "b"; // 50% chance of being "a" or "b" 15 | res.cookie("abtest", value); 16 | req.cookies.abtest = value; 17 | } 18 | }); 19 | 20 | // Bind to GET requests on / 21 | router.get("/", async (req,res) => { 22 | 23 | // Fetch data from our micro frontends 24 | const fetcher = new Fetcher({ 25 | header: { 26 | url: "https://content-stitching-header.edgecompute.app/", 27 | backend: "header_service" // Backends configured in fastly.toml 28 | }, 29 | body: { 30 | url: "https://content-stitching-page.edgecompute.app/", 31 | backend: "page_service", // Backends configured in fastly.toml 32 | cache: new CacheOverride("override", { 33 | ttl: 60 34 | }) 35 | } 36 | }) 37 | 38 | // Wait for fetch to complete 39 | let content = await fetcher.fetch(); 40 | 41 | // Pick classes based on abtest cookie 42 | // This this test we are using the abtest cookie to determine if the user is in "Dark Mode" or not. 43 | let classes = req.cookies.abtest == "b" ? "bg-dark text-white" : ""; 44 | 45 | res.setHeader("Content-Type", "text/html"); 46 | 47 | // Render HTML 48 | res.send(` 49 | 50 | 51 | 52 | 53 | 54 | ${content.header.data} 55 |
56 | ${content.body.data} 57 | 58 | 59 | `) 60 | }); 61 | 62 | // Finally, have Flight Path handle requests by calling .listen() on the router. 63 | router.listen(); -------------------------------------------------------------------------------- /examples/basic-routing/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | 3 | const router = new Router(); 4 | 5 | router.route("GET", "/", (req, res) => { 6 | return res.send("Home"); 7 | }); 8 | 9 | router.get("/puppies", (req, res) => { 10 | return res.send("You're at the puppy page!"); 11 | }); 12 | 13 | /** 14 | * Embed parameters in the path e.g. `:name` and access them in `req.params` 15 | */ 16 | router.post("/profile/:name", (req, res) => { 17 | return res.send(`Hello ${req.params.name}!`); 18 | }); 19 | 20 | /** 21 | * Match any path starting /assets/ 22 | * ✅ /assets/logo.png 23 | * ✅ /assets/static/main.css 24 | * ❌ /assets 25 | * ❌ /static/assets/logo.png 26 | */ 27 | router.get("/assets/*", async (req, res) => { 28 | res.send("This is where assets are!"); 29 | }); 30 | 31 | /** 32 | * Match on "/page" and use the "id" search parameter 33 | * /page?id=42 -> "You are on page 42" 34 | * /page?id=-1337 -> "You are on page -1337" 35 | * /page -> "You are on page 0" 36 | */ 37 | router.get("/page", async (req, res) => { 38 | let pageId = Number(req.query.id) | 0; 39 | res.json({ message: `You are on page ${pageId}` }); 40 | }); 41 | 42 | /** 43 | * Redirect requests to a specific url 44 | */ 45 | router.get("/redirect", async (req, res) => { 46 | res.redirect("https://fastly.com"); 47 | }); 48 | 49 | /** 50 | * Get content from origin 51 | */ 52 | router.get("/origin", async (req, res) => { 53 | const originRequest = await fetch( 54 | "https://www.fastly.com/products/edge-compute/serverless", 55 | { 56 | backend: "my-origin", 57 | } 58 | ); 59 | 60 | res.send(originRequest); 61 | }); 62 | 63 | /** 64 | * Read post data 65 | */ 66 | router.post("/post", async (req, res) => { 67 | let body = {}; 68 | 69 | try { 70 | await req.json(); 71 | } catch (e) { 72 | body = { 73 | error: "Invalid JSON!" 74 | } 75 | } 76 | 77 | res.json(body); 78 | }); 79 | 80 | /** 81 | * Match everything 82 | * For router.route(METHOD, PATH) you can pass a * for the method and path to match all possible requests 83 | * this works great as a 404 handler 84 | */ 85 | router.route("*", "*", (req, res) => { 86 | res.status = 404; 87 | return res.send("Page not found!"); 88 | }); 89 | 90 | // Listen for requests 91 | router.listen(); 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FlightPath 2 | Express style router for Fastly Compute@Edge 3 | 4 | ### Check the examples directory for examples 5 | 6 | This project is designed to offer an express style router for Fastly's C@E platform 7 | 8 | 9 | ## Usage 10 | 11 | [Check out the docs](https://flight-path.edgecompute.app/) 12 | 13 | Create a router object with `const router = new Router();`, this is the main object of FlightPath which all routes and middleware will be added to. 14 | 15 | Once all routes and middleware are added, you need to call `router.listen();` to bind the router to the `fetch` event which is called on each request. 16 | 17 | A basic app would look like this: 18 | 19 | ```javascript 20 | const router = new Router(); 21 | 22 | router.get("/", async (req, res) => { 23 | return res.send("Hello World!"); 24 | }); 25 | 26 | router.listen(); 27 | ``` 28 | 29 | ### Methods 30 | 31 | The router object has functions for each HTTP method such as `router.get` and `router.post` which can be called with a path and a callback: 32 | 33 | ```javascript 34 | router.get("/", async (req, res) => { 35 | return res.send("Hello World!"); 36 | }); 37 | ``` 38 | 39 | There is also a `router.route` function which works the same as the specific method functions but allows you to pass the method as a string: 40 | ```javascript 41 | router.route("GET", "/", (req, res) => { 42 | return res.send("Home"); 43 | }); 44 | ``` 45 | 46 | If you wanted to bind to all methods you can use `router.route` and pass an `*` as the method to bind to all methods: 47 | ```javascript 48 | router.route("*", "/", (req, res) => { 49 | return res.send("All methods!"); 50 | }); 51 | ``` 52 | 53 | ### Paths and Parameters 54 | 55 | The path passed into a route can be either a `pathname` as specified in the [URL specification](https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname) or a path with parameter matching such as this: 56 | 57 | ```javascript 58 | // Capture the word after /greeting/ as a variable called name 59 | // Reply to the path "/greeting/world" with "Hello world!" 60 | router.get("/greeting/:name", async (req, res) => { 61 | return res.send(`Hello ${req.params.name}!`); 62 | }); 63 | ``` 64 | 65 | Paths may also contain `*` to include anything such as this: 66 | ```javascript 67 | // Return this message for any path starting with `/assets/` 68 | router.get("/assets/*", async (req, res) => { 69 | return res.send("This is where the assets would be!"); 70 | }); 71 | 72 | ``` 73 | -------------------------------------------------------------------------------- /examples/typescript-example/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | import FPRequest from "../../../dist/lib/routing/request.js"; 3 | import FPResponse from "../../../dist/lib/routing/response.js"; 4 | const router = new Router(); 5 | 6 | router.route("GET", "/", (req: FPRequest, res: FPResponse): any => { 7 | return res.send("Home"); 8 | }); 9 | 10 | router.get("/puppies", (req: FPRequest, res: FPResponse): any => { 11 | return res.send("You're at the puppy page!"); 12 | }); 13 | 14 | /** 15 | * Embed parameters in the path e.g. `:name` and access them in `req.params` 16 | */ 17 | router.post("/profile/:name", (req: FPRequest, res: FPResponse): any => { 18 | return res.send(`Hello ${req.params.name}!`); 19 | }); 20 | 21 | /** 22 | * Match any path starting /assets/ 23 | * ✅ /assets/logo.png 24 | * ✅ /assets/static/main.css 25 | * ❌ /assets 26 | * ❌ /static/assets/logo.png 27 | */ 28 | router.get("/assets/*", async (req: FPRequest, res: FPResponse): Promise => { 29 | res.send("This is where assets are!"); 30 | }); 31 | 32 | /** 33 | * Match on "/page" and use the "id" search parameter 34 | * /page?id=42 -> "You are on page 42" 35 | * /page?id=-1337 -> "You are on page -1337" 36 | * /page -> "You are on page 0" 37 | */ 38 | router.get("/page", async (req: FPRequest, res: FPResponse): Promise => { 39 | let pageId = Number(req.query.id) | 0; 40 | res.json({ message: `You are on page ${pageId}` }); 41 | }); 42 | 43 | /** 44 | * Redirect requests to a specific url 45 | */ 46 | router.get("/redirect", async (req: FPRequest, res: FPResponse): Promise => { 47 | res.redirect("https://fastly.com"); 48 | }); 49 | 50 | /** 51 | * Get content from origin 52 | */ 53 | router.get("/origin", async (req: FPRequest, res: FPResponse): Promise => { 54 | const originRequest = await fetch( 55 | "https://www.fastly.com/products/edge-compute/serverless", 56 | { 57 | backend: "my-origin", 58 | } 59 | ); 60 | 61 | res.send(originRequest); 62 | }); 63 | 64 | /** 65 | * Read post data 66 | */ 67 | router.post("/post", async (req: FPRequest, res: FPResponse): Promise => { 68 | let body = {}; 69 | 70 | try { 71 | await req.json(); 72 | } catch (e) { 73 | body = { 74 | error: "Invalid JSON!" 75 | } 76 | } 77 | 78 | res.json(body); 79 | }); 80 | 81 | /** 82 | * Match everything 83 | * For router.route(METHOD, PATH) you can pass a * for the method and path to match all possible requests 84 | * this works great as a 404 handler 85 | */ 86 | router.route("*", "*", (req: FPRequest, res: FPResponse): any => { 87 | res.status = 404; 88 | return res.send("Page not found!"); 89 | }); 90 | 91 | // Listen for requests 92 | router.listen(); 93 | -------------------------------------------------------------------------------- /src/lib/routing/response.ts: -------------------------------------------------------------------------------- 1 | import cookie from "cookie"; 2 | import Mustache from "mustache"; 3 | 4 | export default class FPResponse { 5 | _headers: Headers = new Headers(); 6 | private _body: BodyInit = null; 7 | status: number = 0; 8 | _cookies: Map = new Map(); 9 | private _hasEnded: boolean = false; 10 | 11 | constructor(private config: any) {} 12 | 13 | send(response: BodyInit | Response) { 14 | if (this.hasEnded) return; 15 | 16 | if (response instanceof Response) { 17 | this._body = response.body; 18 | this.useHeaders(response.headers); 19 | this.status = response.status; 20 | } else { 21 | this._body = response; 22 | } 23 | } 24 | 25 | // For better express support 26 | end(body: BodyInit) { 27 | if (this.hasEnded) return; 28 | 29 | this.send(body); 30 | this._hasEnded = true; 31 | } 32 | 33 | json(data: any) { 34 | if (this.hasEnded) return; 35 | 36 | this.setHeader("Content-Type", "application/json"); 37 | this.send(JSON.stringify(data)); 38 | } 39 | 40 | writeHead(statusCode: number, headers: {}) { 41 | if (this.hasEnded) return; 42 | 43 | this.status = statusCode; 44 | 45 | Object.keys(headers).map((k) => { 46 | this.setHeader(k, headers[k]); 47 | }); 48 | } 49 | 50 | get headers() { 51 | return Object.fromEntries(this._headers.entries()); 52 | } 53 | 54 | setHeader(key: string, value: string): void { 55 | if (this.hasEnded) return; 56 | 57 | this._headers.set(key, value); 58 | } 59 | 60 | useHeaders(headers: Headers) { 61 | if (this.hasEnded) return; 62 | 63 | headers.forEach((value, key) => { 64 | this.setHeader(key, value); 65 | }); 66 | } 67 | 68 | appendHeader(key: string, value: string): void { 69 | if (this.hasEnded) return; 70 | 71 | this._headers.append(key, value); 72 | } 73 | 74 | cookie(key: string, value: string, options: {} = {}): void { 75 | if (this.hasEnded) return; 76 | 77 | this._cookies.set(key, cookie.serialize(key, value, options)); 78 | } 79 | 80 | get body() { 81 | return this._body; 82 | } 83 | 84 | get hasEnded() { 85 | return this._hasEnded; 86 | } 87 | 88 | redirect(url: string) { 89 | if (this.hasEnded) return; 90 | 91 | this.writeHead(301, { 92 | Location: url, 93 | }); 94 | 95 | this.end(`Redirecting you to: ${url}`); 96 | } 97 | 98 | render(templateName, view) { 99 | const template = require(`/src/${this.config.templatesDir}/${templateName}.html`); 100 | this.send(Mustache.render(template, view)); 101 | } 102 | 103 | // Set sensible values if things are not set, such as 200 status code if the user doesnt set a status code. 104 | setDefaults() { 105 | if (this.status == 0) { 106 | if (this.body == null) { 107 | this.status = 404; 108 | this._body = "Not Found"; 109 | } else { 110 | this.status = 200; 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /examples/jwt-authentication/src/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from "../../../dist/index.js"; 2 | import * as jws from "jws"; 3 | 4 | const router = new Router(); 5 | 6 | let secret = null; 7 | const getJwtSecret = () => { 8 | if(secret !== null) { 9 | return secret; 10 | } 11 | 12 | const dict = new Dictionary("config"); 13 | secret = dict.get("secret"); 14 | return secret; 15 | } 16 | 17 | /** 18 | * JWT authentication middleware 19 | */ 20 | router.use(async (req, res) => { 21 | 22 | // Get JWT token from cookie 23 | let jwt = req.cookies.jwt; 24 | 25 | // If the user is not on the login page, check if the user is logged in 26 | if (req.url.pathname !== "/login") { 27 | if (!jwt) { 28 | res.redirect("/login"); 29 | return; 30 | } 31 | 32 | // Validate JWT token 33 | let isValid = await jws.verify(jwt, "HS256", getJwtSecret()); 34 | 35 | // If the token is not valid, redirect to login page 36 | if(!isValid){ 37 | console.log("Got invalid jwt!"); 38 | res.redirect("/login"); 39 | return; 40 | } 41 | 42 | // If the token is valid, set the session on the request 43 | try { 44 | req.session = JSON.parse((await jws.decode(jwt, "HS256", getJwtSecret())).payload); 45 | } catch (e) { 46 | console.log("Got invalid jwt!"); 47 | res.redirect("/login"); 48 | return; 49 | } 50 | } 51 | }); 52 | 53 | router.route("GET", "/login", (req, res) => { 54 | return res.send("Welcome to the login page"); 55 | }); 56 | 57 | /** 58 | * Login endpoint 59 | * Creates the JWT token and stores it in the cookie 60 | * and then redirects to the home page 61 | */ 62 | router.route("POST", "/login", async (req, res) => { 63 | /** 64 | * Read post body for username 65 | */ 66 | let body = null; 67 | 68 | try { 69 | body = JSON.parse(await req.text()); 70 | }catch(e){ 71 | res.status = 400; 72 | return res.send("Invalid JSON in login post body"); 73 | } 74 | 75 | // If the username is not set correctly, return an error 76 | if(typeof body !== "object" || !body.hasOwnProperty("username") || typeof body.username !== "string") { 77 | res.status = 400; 78 | return res.send("your must include a 'username' property in the login post body"); 79 | } 80 | 81 | const username = body.username; 82 | 83 | // Create JWT token 84 | const token = jws.sign({ 85 | header: { alg: "HS256" }, 86 | payload: { 87 | name: username, 88 | }, 89 | secret: getJwtSecret(), 90 | }); 91 | 92 | // Set the cookie 93 | res.cookie("jwt", token); 94 | 95 | // Redirect to home page now we are logged in 96 | return res.redirect("/"); 97 | }); 98 | 99 | /** 100 | * This route is only accessible if the user is logged in 101 | * because the middleware above will redirect to the login page 102 | * if the user is not logged in 103 | */ 104 | router.all("*", async (req, res) => { 105 | console.log(JSON.stringify(req.session)); 106 | res.send(`Welcome! You are authenticated ${req.session.name}!`); 107 | }); 108 | 109 | // Listen for requests 110 | router.listen(); 111 | -------------------------------------------------------------------------------- /src/lib/routing/router.ts: -------------------------------------------------------------------------------- 1 | import { Route, RequestHandlerCallback } from "./route"; 2 | import FPRequest from "./request"; 3 | import FPResponse from "./response"; 4 | import {Middleware, MiddlewareCallback } from "./middleware"; 5 | 6 | export class Router { 7 | routes: Route[] = []; 8 | middlewares: Middleware[] = []; 9 | config: {} = { 10 | templatesDir: "templates", 11 | parseCookies: true, 12 | }; 13 | 14 | constructor(config: {}){ 15 | this.config = { 16 | ...this.config, 17 | ...config 18 | } 19 | } 20 | 21 | public listen(): void { 22 | addEventListener("fetch", (event) => 23 | event.respondWith(this.handler(event)) 24 | ); 25 | } 26 | 27 | private async handler(event: FetchEvent): Promise { 28 | try { 29 | const req = new FPRequest(this.config, event); 30 | const res = new FPResponse(this.config); 31 | 32 | await this.runMiddlewares(req, res); 33 | 34 | if (!res.hasEnded) { 35 | await this.runRoutes(req, res); 36 | } 37 | 38 | return serializeResponse(res); 39 | } catch (e) { 40 | console.log(e); 41 | } 42 | } 43 | 44 | private async runMiddlewares(req: FPRequest, res: FPResponse): Promise { 45 | for (let m of this.middlewares) { 46 | if (m.check(req)) { 47 | await m.run(req, res); 48 | } 49 | } 50 | } 51 | 52 | private async runRoutes(req: FPRequest, res: FPResponse): Promise { 53 | const matchedRoute = this.routes.find((route): boolean => route.check(req)); 54 | 55 | if (matchedRoute) { 56 | await matchedRoute.run(req, res); 57 | } 58 | } 59 | 60 | public use( 61 | path: string | MiddlewareCallback, 62 | callback?: MiddlewareCallback 63 | ): void { 64 | if (path instanceof Function) { 65 | this.middlewares.push( 66 | new Middleware(() => true, path as MiddlewareCallback) 67 | ); 68 | } else { 69 | this.middlewares.push( 70 | new Middleware(basicRouteMatcher("*", path as string, false), callback) 71 | ); 72 | } 73 | } 74 | 75 | public route( 76 | method: string, 77 | pattern: string, 78 | callback: RequestHandlerCallback 79 | ): void { 80 | this.routes.push(new Route(basicRouteMatcher(method, pattern), callback)); 81 | } 82 | 83 | public all(pattern: string, callback: RequestHandlerCallback): void { 84 | this.route("*", pattern, callback); 85 | } 86 | 87 | public get(pattern: string, callback: RequestHandlerCallback): void { 88 | this.route("GET", pattern, callback); 89 | } 90 | 91 | public post(pattern: string, callback: RequestHandlerCallback): void { 92 | this.route("POST", pattern, callback); 93 | } 94 | 95 | public put(pattern: string, callback: RequestHandlerCallback): void { 96 | this.route("PUT", pattern, callback); 97 | } 98 | 99 | public delete(pattern: string, callback: RequestHandlerCallback): void { 100 | this.route("DELETE", pattern, callback); 101 | } 102 | 103 | public head(pattern: string, callback: RequestHandlerCallback): void { 104 | this.route("HEAD", pattern, callback); 105 | } 106 | 107 | public options(pattern: string, callback: RequestHandlerCallback): void { 108 | this.route("OPTIONS", pattern, callback); 109 | } 110 | 111 | public patch(pattern: string, callback: RequestHandlerCallback): void { 112 | this.route("PATCH", pattern, callback); 113 | } 114 | } 115 | 116 | function serializeResponse(res: FPResponse): Response { 117 | res.setDefaults(); 118 | 119 | let response = new Response(res.body, { 120 | headers: res._headers, 121 | status: res.status, 122 | }); 123 | 124 | // Looping cookie headers manually to work around this bug: https://github.com/fastly/js-compute-runtime/issues/47 125 | for (let [_, c] of res._cookies) { 126 | response.headers.append("Set-Cookie", c); 127 | } 128 | 129 | return response; 130 | } 131 | 132 | /** 133 | * This function creates another function which will be used to check if a request matches the route. 134 | * e.g. does the method and the pattern match? 135 | * @param method the HTTP method, GET, POST etc 136 | * @param pattern Express style path 137 | * @returns A function which returns a boolean, true = "matched, run this route" 138 | */ 139 | export function basicRouteMatcher( 140 | method: string, 141 | pattern: string, 142 | extractParams: boolean = true 143 | ): Function { 144 | const isRegexMatch = 145 | (pattern.indexOf("*") !== -1 || pattern.indexOf(":") !== -1) && 146 | pattern.length > 1; 147 | 148 | function simpleMatch(req: FPRequest): boolean { 149 | if (req.method.toUpperCase() != method.toUpperCase() && method != "*") 150 | return false; 151 | 152 | return pattern == "*" || req.url.pathname == pattern; 153 | } 154 | 155 | let checkFunction = isRegexMatch 156 | ? makeRegexMatch(pattern, extractParams) 157 | : simpleMatch; 158 | 159 | return (req: FPRequest): boolean => { 160 | return checkFunction(req); 161 | }; 162 | } 163 | 164 | /** 165 | * Take the path of a route which can include parameters such as ":id" and turn those into regex matches 166 | * @param pattern Express style path pattern, e.g "/user/:userid/profile" 167 | * @returns 168 | */ 169 | function makeRegexMatch( 170 | pattern: string, 171 | extractParams: boolean = true 172 | ): Function { 173 | pattern = pattern 174 | .replace(/\$/g, "$") 175 | .replace(/\^/g, "^") 176 | .replace(/\*/g, "(.*)") 177 | .replace(/\//g, "\\/") 178 | .replace(/((?<=\:)[a-zA-Z0-9]+)/g, "(?<$&>[a-zA-Z0-9_-]+)") 179 | .replace(/\:/g, ""); 180 | 181 | // Above regex does this: 182 | // '/user/:userid/profile' -> '\\/user\\/(?[a-zA-Z0-9_-]+)\\/profile' 183 | 184 | // Importantly, we are making this at compile time and not runtime 185 | const matchRegexp = new RegExp(`^${pattern}$`, "i"); 186 | 187 | // Not sure how required this is, but use the regex to verify it is actually compiled. 188 | matchRegexp.test("Make sure RegExp is compiled at build time."); 189 | 190 | return (req: FPRequest): boolean => { 191 | let matches; 192 | 193 | if ((matches = matchRegexp.exec(req.url.pathname)) !== null) { 194 | // Take matches and put in req.params 195 | if (matches.groups) { 196 | let matchKeys = Object.keys(matches.groups); 197 | 198 | matchKeys.map((k) => { 199 | req.params[k] = matches.groups[k]; 200 | }); 201 | } 202 | 203 | return true; 204 | } 205 | 206 | return false; 207 | }; 208 | } 209 | -------------------------------------------------------------------------------- /examples/graphql/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compute-starter-kit-javascript-default", 3 | "version": "0.2.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "compute-starter-kit-javascript-default", 9 | "version": "0.2.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@fastly/js-compute": "^0.2.0", 13 | "graphql-helix": "^1.9.1" 14 | }, 15 | "devDependencies": { 16 | "core-js": "^3.19.0", 17 | "nodemon": "^2.0.14", 18 | "webpack": "^5.10.0", 19 | "webpack-cli": "^4.2.0" 20 | } 21 | }, 22 | "node_modules/@discoveryjs/json-ext": { 23 | "version": "0.5.3", 24 | "dev": true, 25 | "license": "MIT", 26 | "engines": { 27 | "node": ">=10.0.0" 28 | } 29 | }, 30 | "node_modules/@fastly/js-compute": { 31 | "version": "0.2.0", 32 | "license": "SEE LICENSE IN LICENSE", 33 | "bin": { 34 | "js-compute-runtime": "js-compute-runtime-cli.js" 35 | } 36 | }, 37 | "node_modules/@types/eslint": { 38 | "version": "7.28.0", 39 | "dev": true, 40 | "license": "MIT", 41 | "dependencies": { 42 | "@types/estree": "*", 43 | "@types/json-schema": "*" 44 | } 45 | }, 46 | "node_modules/@types/eslint-scope": { 47 | "version": "3.7.1", 48 | "dev": true, 49 | "license": "MIT", 50 | "dependencies": { 51 | "@types/eslint": "*", 52 | "@types/estree": "*" 53 | } 54 | }, 55 | "node_modules/@types/estree": { 56 | "version": "0.0.50", 57 | "dev": true, 58 | "license": "MIT" 59 | }, 60 | "node_modules/@types/json-schema": { 61 | "version": "7.0.9", 62 | "dev": true, 63 | "license": "MIT" 64 | }, 65 | "node_modules/@types/node": { 66 | "version": "16.7.10", 67 | "dev": true, 68 | "license": "MIT" 69 | }, 70 | "node_modules/@webassemblyjs/ast": { 71 | "version": "1.11.1", 72 | "dev": true, 73 | "license": "MIT", 74 | "dependencies": { 75 | "@webassemblyjs/helper-numbers": "1.11.1", 76 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1" 77 | } 78 | }, 79 | "node_modules/@webassemblyjs/floating-point-hex-parser": { 80 | "version": "1.11.1", 81 | "dev": true, 82 | "license": "MIT" 83 | }, 84 | "node_modules/@webassemblyjs/helper-api-error": { 85 | "version": "1.11.1", 86 | "dev": true, 87 | "license": "MIT" 88 | }, 89 | "node_modules/@webassemblyjs/helper-buffer": { 90 | "version": "1.11.1", 91 | "dev": true, 92 | "license": "MIT" 93 | }, 94 | "node_modules/@webassemblyjs/helper-numbers": { 95 | "version": "1.11.1", 96 | "dev": true, 97 | "license": "MIT", 98 | "dependencies": { 99 | "@webassemblyjs/floating-point-hex-parser": "1.11.1", 100 | "@webassemblyjs/helper-api-error": "1.11.1", 101 | "@xtuc/long": "4.2.2" 102 | } 103 | }, 104 | "node_modules/@webassemblyjs/helper-wasm-bytecode": { 105 | "version": "1.11.1", 106 | "dev": true, 107 | "license": "MIT" 108 | }, 109 | "node_modules/@webassemblyjs/helper-wasm-section": { 110 | "version": "1.11.1", 111 | "dev": true, 112 | "license": "MIT", 113 | "dependencies": { 114 | "@webassemblyjs/ast": "1.11.1", 115 | "@webassemblyjs/helper-buffer": "1.11.1", 116 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 117 | "@webassemblyjs/wasm-gen": "1.11.1" 118 | } 119 | }, 120 | "node_modules/@webassemblyjs/ieee754": { 121 | "version": "1.11.1", 122 | "dev": true, 123 | "license": "MIT", 124 | "dependencies": { 125 | "@xtuc/ieee754": "^1.2.0" 126 | } 127 | }, 128 | "node_modules/@webassemblyjs/leb128": { 129 | "version": "1.11.1", 130 | "dev": true, 131 | "license": "Apache-2.0", 132 | "dependencies": { 133 | "@xtuc/long": "4.2.2" 134 | } 135 | }, 136 | "node_modules/@webassemblyjs/utf8": { 137 | "version": "1.11.1", 138 | "dev": true, 139 | "license": "MIT" 140 | }, 141 | "node_modules/@webassemblyjs/wasm-edit": { 142 | "version": "1.11.1", 143 | "dev": true, 144 | "license": "MIT", 145 | "dependencies": { 146 | "@webassemblyjs/ast": "1.11.1", 147 | "@webassemblyjs/helper-buffer": "1.11.1", 148 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 149 | "@webassemblyjs/helper-wasm-section": "1.11.1", 150 | "@webassemblyjs/wasm-gen": "1.11.1", 151 | "@webassemblyjs/wasm-opt": "1.11.1", 152 | "@webassemblyjs/wasm-parser": "1.11.1", 153 | "@webassemblyjs/wast-printer": "1.11.1" 154 | } 155 | }, 156 | "node_modules/@webassemblyjs/wasm-gen": { 157 | "version": "1.11.1", 158 | "dev": true, 159 | "license": "MIT", 160 | "dependencies": { 161 | "@webassemblyjs/ast": "1.11.1", 162 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 163 | "@webassemblyjs/ieee754": "1.11.1", 164 | "@webassemblyjs/leb128": "1.11.1", 165 | "@webassemblyjs/utf8": "1.11.1" 166 | } 167 | }, 168 | "node_modules/@webassemblyjs/wasm-opt": { 169 | "version": "1.11.1", 170 | "dev": true, 171 | "license": "MIT", 172 | "dependencies": { 173 | "@webassemblyjs/ast": "1.11.1", 174 | "@webassemblyjs/helper-buffer": "1.11.1", 175 | "@webassemblyjs/wasm-gen": "1.11.1", 176 | "@webassemblyjs/wasm-parser": "1.11.1" 177 | } 178 | }, 179 | "node_modules/@webassemblyjs/wasm-parser": { 180 | "version": "1.11.1", 181 | "dev": true, 182 | "license": "MIT", 183 | "dependencies": { 184 | "@webassemblyjs/ast": "1.11.1", 185 | "@webassemblyjs/helper-api-error": "1.11.1", 186 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 187 | "@webassemblyjs/ieee754": "1.11.1", 188 | "@webassemblyjs/leb128": "1.11.1", 189 | "@webassemblyjs/utf8": "1.11.1" 190 | } 191 | }, 192 | "node_modules/@webassemblyjs/wast-printer": { 193 | "version": "1.11.1", 194 | "dev": true, 195 | "license": "MIT", 196 | "dependencies": { 197 | "@webassemblyjs/ast": "1.11.1", 198 | "@xtuc/long": "4.2.2" 199 | } 200 | }, 201 | "node_modules/@webpack-cli/configtest": { 202 | "version": "1.1.0", 203 | "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz", 204 | "integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==", 205 | "dev": true, 206 | "peerDependencies": { 207 | "webpack": "4.x.x || 5.x.x", 208 | "webpack-cli": "4.x.x" 209 | } 210 | }, 211 | "node_modules/@webpack-cli/info": { 212 | "version": "1.4.0", 213 | "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz", 214 | "integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==", 215 | "dev": true, 216 | "dependencies": { 217 | "envinfo": "^7.7.3" 218 | }, 219 | "peerDependencies": { 220 | "webpack-cli": "4.x.x" 221 | } 222 | }, 223 | "node_modules/@webpack-cli/serve": { 224 | "version": "1.6.0", 225 | "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz", 226 | "integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==", 227 | "dev": true, 228 | "peerDependencies": { 229 | "webpack-cli": "4.x.x" 230 | }, 231 | "peerDependenciesMeta": { 232 | "webpack-dev-server": { 233 | "optional": true 234 | } 235 | } 236 | }, 237 | "node_modules/@xtuc/ieee754": { 238 | "version": "1.2.0", 239 | "dev": true, 240 | "license": "BSD-3-Clause" 241 | }, 242 | "node_modules/@xtuc/long": { 243 | "version": "4.2.2", 244 | "dev": true, 245 | "license": "Apache-2.0" 246 | }, 247 | "node_modules/acorn": { 248 | "version": "8.4.1", 249 | "dev": true, 250 | "license": "MIT", 251 | "bin": { 252 | "acorn": "bin/acorn" 253 | }, 254 | "engines": { 255 | "node": ">=0.4.0" 256 | } 257 | }, 258 | "node_modules/acorn-import-assertions": { 259 | "version": "1.7.6", 260 | "dev": true, 261 | "license": "MIT", 262 | "peerDependencies": { 263 | "acorn": "^8" 264 | } 265 | }, 266 | "node_modules/ajv": { 267 | "version": "6.12.6", 268 | "dev": true, 269 | "license": "MIT", 270 | "dependencies": { 271 | "fast-deep-equal": "^3.1.1", 272 | "fast-json-stable-stringify": "^2.0.0", 273 | "json-schema-traverse": "^0.4.1", 274 | "uri-js": "^4.2.2" 275 | }, 276 | "funding": { 277 | "type": "github", 278 | "url": "https://github.com/sponsors/epoberezkin" 279 | } 280 | }, 281 | "node_modules/ajv-keywords": { 282 | "version": "3.5.2", 283 | "dev": true, 284 | "license": "MIT", 285 | "peerDependencies": { 286 | "ajv": "^6.9.1" 287 | } 288 | }, 289 | "node_modules/anymatch": { 290 | "version": "3.1.2", 291 | "dev": true, 292 | "license": "ISC", 293 | "dependencies": { 294 | "normalize-path": "^3.0.0", 295 | "picomatch": "^2.0.4" 296 | }, 297 | "engines": { 298 | "node": ">= 8" 299 | } 300 | }, 301 | "node_modules/balanced-match": { 302 | "version": "1.0.2", 303 | "dev": true, 304 | "license": "MIT" 305 | }, 306 | "node_modules/binary-extensions": { 307 | "version": "2.2.0", 308 | "dev": true, 309 | "license": "MIT", 310 | "engines": { 311 | "node": ">=8" 312 | } 313 | }, 314 | "node_modules/brace-expansion": { 315 | "version": "1.1.11", 316 | "dev": true, 317 | "license": "MIT", 318 | "dependencies": { 319 | "balanced-match": "^1.0.0", 320 | "concat-map": "0.0.1" 321 | } 322 | }, 323 | "node_modules/braces": { 324 | "version": "3.0.2", 325 | "dev": true, 326 | "license": "MIT", 327 | "dependencies": { 328 | "fill-range": "^7.0.1" 329 | }, 330 | "engines": { 331 | "node": ">=8" 332 | } 333 | }, 334 | "node_modules/browserslist": { 335 | "version": "4.16.8", 336 | "dev": true, 337 | "license": "MIT", 338 | "dependencies": { 339 | "caniuse-lite": "^1.0.30001251", 340 | "colorette": "^1.3.0", 341 | "electron-to-chromium": "^1.3.811", 342 | "escalade": "^3.1.1", 343 | "node-releases": "^1.1.75" 344 | }, 345 | "bin": { 346 | "browserslist": "cli.js" 347 | }, 348 | "engines": { 349 | "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" 350 | }, 351 | "funding": { 352 | "type": "opencollective", 353 | "url": "https://opencollective.com/browserslist" 354 | } 355 | }, 356 | "node_modules/buffer-from": { 357 | "version": "1.1.2", 358 | "dev": true, 359 | "license": "MIT" 360 | }, 361 | "node_modules/caniuse-lite": { 362 | "version": "1.0.30001252", 363 | "dev": true, 364 | "license": "CC-BY-4.0", 365 | "funding": { 366 | "type": "opencollective", 367 | "url": "https://opencollective.com/browserslist" 368 | } 369 | }, 370 | "node_modules/chokidar": { 371 | "version": "3.5.2", 372 | "dev": true, 373 | "license": "MIT", 374 | "dependencies": { 375 | "anymatch": "~3.1.2", 376 | "braces": "~3.0.2", 377 | "glob-parent": "~5.1.2", 378 | "is-binary-path": "~2.1.0", 379 | "is-glob": "~4.0.1", 380 | "normalize-path": "~3.0.0", 381 | "readdirp": "~3.6.0" 382 | }, 383 | "engines": { 384 | "node": ">= 8.10.0" 385 | }, 386 | "optionalDependencies": { 387 | "fsevents": "~2.3.2" 388 | } 389 | }, 390 | "node_modules/chrome-trace-event": { 391 | "version": "1.0.3", 392 | "dev": true, 393 | "license": "MIT", 394 | "engines": { 395 | "node": ">=6.0" 396 | } 397 | }, 398 | "node_modules/clone-deep": { 399 | "version": "4.0.1", 400 | "dev": true, 401 | "license": "MIT", 402 | "dependencies": { 403 | "is-plain-object": "^2.0.4", 404 | "kind-of": "^6.0.2", 405 | "shallow-clone": "^3.0.0" 406 | }, 407 | "engines": { 408 | "node": ">=6" 409 | } 410 | }, 411 | "node_modules/colorette": { 412 | "version": "1.3.0", 413 | "dev": true, 414 | "license": "MIT" 415 | }, 416 | "node_modules/commander": { 417 | "version": "2.20.3", 418 | "dev": true, 419 | "license": "MIT" 420 | }, 421 | "node_modules/concat-map": { 422 | "version": "0.0.1", 423 | "dev": true, 424 | "license": "MIT" 425 | }, 426 | "node_modules/core-js": { 427 | "version": "3.19.0", 428 | "dev": true, 429 | "hasInstallScript": true, 430 | "license": "MIT", 431 | "funding": { 432 | "type": "opencollective", 433 | "url": "https://opencollective.com/core-js" 434 | } 435 | }, 436 | "node_modules/cross-spawn": { 437 | "version": "7.0.3", 438 | "dev": true, 439 | "license": "MIT", 440 | "dependencies": { 441 | "path-key": "^3.1.0", 442 | "shebang-command": "^2.0.0", 443 | "which": "^2.0.1" 444 | }, 445 | "engines": { 446 | "node": ">= 8" 447 | } 448 | }, 449 | "node_modules/debug": { 450 | "version": "3.2.7", 451 | "dev": true, 452 | "license": "MIT", 453 | "dependencies": { 454 | "ms": "^2.1.1" 455 | } 456 | }, 457 | "node_modules/electron-to-chromium": { 458 | "version": "1.3.826", 459 | "dev": true, 460 | "license": "ISC" 461 | }, 462 | "node_modules/enhanced-resolve": { 463 | "version": "5.8.3", 464 | "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", 465 | "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", 466 | "dev": true, 467 | "dependencies": { 468 | "graceful-fs": "^4.2.4", 469 | "tapable": "^2.2.0" 470 | }, 471 | "engines": { 472 | "node": ">=10.13.0" 473 | } 474 | }, 475 | "node_modules/envinfo": { 476 | "version": "7.8.1", 477 | "dev": true, 478 | "license": "MIT", 479 | "bin": { 480 | "envinfo": "dist/cli.js" 481 | }, 482 | "engines": { 483 | "node": ">=4" 484 | } 485 | }, 486 | "node_modules/es-module-lexer": { 487 | "version": "0.9.3", 488 | "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", 489 | "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", 490 | "dev": true 491 | }, 492 | "node_modules/escalade": { 493 | "version": "3.1.1", 494 | "dev": true, 495 | "license": "MIT", 496 | "engines": { 497 | "node": ">=6" 498 | } 499 | }, 500 | "node_modules/eslint-scope": { 501 | "version": "5.1.1", 502 | "dev": true, 503 | "license": "BSD-2-Clause", 504 | "dependencies": { 505 | "esrecurse": "^4.3.0", 506 | "estraverse": "^4.1.1" 507 | }, 508 | "engines": { 509 | "node": ">=8.0.0" 510 | } 511 | }, 512 | "node_modules/esrecurse": { 513 | "version": "4.3.0", 514 | "dev": true, 515 | "license": "BSD-2-Clause", 516 | "dependencies": { 517 | "estraverse": "^5.2.0" 518 | }, 519 | "engines": { 520 | "node": ">=4.0" 521 | } 522 | }, 523 | "node_modules/esrecurse/node_modules/estraverse": { 524 | "version": "5.2.0", 525 | "dev": true, 526 | "license": "BSD-2-Clause", 527 | "engines": { 528 | "node": ">=4.0" 529 | } 530 | }, 531 | "node_modules/estraverse": { 532 | "version": "4.3.0", 533 | "dev": true, 534 | "license": "BSD-2-Clause", 535 | "engines": { 536 | "node": ">=4.0" 537 | } 538 | }, 539 | "node_modules/events": { 540 | "version": "3.3.0", 541 | "dev": true, 542 | "license": "MIT", 543 | "engines": { 544 | "node": ">=0.8.x" 545 | } 546 | }, 547 | "node_modules/execa": { 548 | "version": "5.1.1", 549 | "dev": true, 550 | "license": "MIT", 551 | "dependencies": { 552 | "cross-spawn": "^7.0.3", 553 | "get-stream": "^6.0.0", 554 | "human-signals": "^2.1.0", 555 | "is-stream": "^2.0.0", 556 | "merge-stream": "^2.0.0", 557 | "npm-run-path": "^4.0.1", 558 | "onetime": "^5.1.2", 559 | "signal-exit": "^3.0.3", 560 | "strip-final-newline": "^2.0.0" 561 | }, 562 | "engines": { 563 | "node": ">=10" 564 | }, 565 | "funding": { 566 | "url": "https://github.com/sindresorhus/execa?sponsor=1" 567 | } 568 | }, 569 | "node_modules/fast-deep-equal": { 570 | "version": "3.1.3", 571 | "dev": true, 572 | "license": "MIT" 573 | }, 574 | "node_modules/fast-json-stable-stringify": { 575 | "version": "2.1.0", 576 | "dev": true, 577 | "license": "MIT" 578 | }, 579 | "node_modules/fastest-levenshtein": { 580 | "version": "1.0.12", 581 | "dev": true, 582 | "license": "MIT" 583 | }, 584 | "node_modules/fill-range": { 585 | "version": "7.0.1", 586 | "dev": true, 587 | "license": "MIT", 588 | "dependencies": { 589 | "to-regex-range": "^5.0.1" 590 | }, 591 | "engines": { 592 | "node": ">=8" 593 | } 594 | }, 595 | "node_modules/find-up": { 596 | "version": "4.1.0", 597 | "dev": true, 598 | "license": "MIT", 599 | "dependencies": { 600 | "locate-path": "^5.0.0", 601 | "path-exists": "^4.0.0" 602 | }, 603 | "engines": { 604 | "node": ">=8" 605 | } 606 | }, 607 | "node_modules/fsevents": { 608 | "version": "2.3.2", 609 | "dev": true, 610 | "license": "MIT", 611 | "optional": true, 612 | "os": [ 613 | "darwin" 614 | ], 615 | "engines": { 616 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 617 | } 618 | }, 619 | "node_modules/function-bind": { 620 | "version": "1.1.1", 621 | "dev": true, 622 | "license": "MIT" 623 | }, 624 | "node_modules/get-stream": { 625 | "version": "6.0.1", 626 | "dev": true, 627 | "license": "MIT", 628 | "engines": { 629 | "node": ">=10" 630 | }, 631 | "funding": { 632 | "url": "https://github.com/sponsors/sindresorhus" 633 | } 634 | }, 635 | "node_modules/glob-parent": { 636 | "version": "5.1.2", 637 | "dev": true, 638 | "license": "ISC", 639 | "dependencies": { 640 | "is-glob": "^4.0.1" 641 | }, 642 | "engines": { 643 | "node": ">= 6" 644 | } 645 | }, 646 | "node_modules/glob-to-regexp": { 647 | "version": "0.4.1", 648 | "dev": true, 649 | "license": "BSD-2-Clause" 650 | }, 651 | "node_modules/graceful-fs": { 652 | "version": "4.2.8", 653 | "dev": true, 654 | "license": "ISC" 655 | }, 656 | "node_modules/graphql": { 657 | "version": "15.7.1", 658 | "license": "MIT", 659 | "peer": true, 660 | "engines": { 661 | "node": ">= 10.x" 662 | } 663 | }, 664 | "node_modules/graphql-helix": { 665 | "version": "1.9.1", 666 | "resolved": "https://registry.npmjs.org/graphql-helix/-/graphql-helix-1.9.1.tgz", 667 | "integrity": "sha512-Of4iMFy+lesAF52RsgTlSUtgAlogWNQt8xp817fcgdJtGNO1bo4RPR4yXD5vZYHbw01Vm2fmaPOCUps5BJJSXw==", 668 | "peerDependencies": { 669 | "graphql": "^15.3.0 || ^16.0.0" 670 | } 671 | }, 672 | "node_modules/has": { 673 | "version": "1.0.3", 674 | "dev": true, 675 | "license": "MIT", 676 | "dependencies": { 677 | "function-bind": "^1.1.1" 678 | }, 679 | "engines": { 680 | "node": ">= 0.4.0" 681 | } 682 | }, 683 | "node_modules/has-flag": { 684 | "version": "4.0.0", 685 | "dev": true, 686 | "license": "MIT", 687 | "engines": { 688 | "node": ">=8" 689 | } 690 | }, 691 | "node_modules/human-signals": { 692 | "version": "2.1.0", 693 | "dev": true, 694 | "license": "Apache-2.0", 695 | "engines": { 696 | "node": ">=10.17.0" 697 | } 698 | }, 699 | "node_modules/ignore-by-default": { 700 | "version": "1.0.1", 701 | "dev": true, 702 | "license": "ISC" 703 | }, 704 | "node_modules/import-local": { 705 | "version": "3.0.2", 706 | "dev": true, 707 | "license": "MIT", 708 | "dependencies": { 709 | "pkg-dir": "^4.2.0", 710 | "resolve-cwd": "^3.0.0" 711 | }, 712 | "bin": { 713 | "import-local-fixture": "fixtures/cli.js" 714 | }, 715 | "engines": { 716 | "node": ">=8" 717 | } 718 | }, 719 | "node_modules/interpret": { 720 | "version": "2.2.0", 721 | "dev": true, 722 | "license": "MIT", 723 | "engines": { 724 | "node": ">= 0.10" 725 | } 726 | }, 727 | "node_modules/is-binary-path": { 728 | "version": "2.1.0", 729 | "dev": true, 730 | "license": "MIT", 731 | "dependencies": { 732 | "binary-extensions": "^2.0.0" 733 | }, 734 | "engines": { 735 | "node": ">=8" 736 | } 737 | }, 738 | "node_modules/is-core-module": { 739 | "version": "2.6.0", 740 | "dev": true, 741 | "license": "MIT", 742 | "dependencies": { 743 | "has": "^1.0.3" 744 | }, 745 | "funding": { 746 | "url": "https://github.com/sponsors/ljharb" 747 | } 748 | }, 749 | "node_modules/is-extglob": { 750 | "version": "2.1.1", 751 | "dev": true, 752 | "license": "MIT", 753 | "engines": { 754 | "node": ">=0.10.0" 755 | } 756 | }, 757 | "node_modules/is-glob": { 758 | "version": "4.0.3", 759 | "dev": true, 760 | "license": "MIT", 761 | "dependencies": { 762 | "is-extglob": "^2.1.1" 763 | }, 764 | "engines": { 765 | "node": ">=0.10.0" 766 | } 767 | }, 768 | "node_modules/is-plain-object": { 769 | "version": "2.0.4", 770 | "dev": true, 771 | "license": "MIT", 772 | "dependencies": { 773 | "isobject": "^3.0.1" 774 | }, 775 | "engines": { 776 | "node": ">=0.10.0" 777 | } 778 | }, 779 | "node_modules/is-stream": { 780 | "version": "2.0.1", 781 | "dev": true, 782 | "license": "MIT", 783 | "engines": { 784 | "node": ">=8" 785 | }, 786 | "funding": { 787 | "url": "https://github.com/sponsors/sindresorhus" 788 | } 789 | }, 790 | "node_modules/isobject": { 791 | "version": "3.0.1", 792 | "dev": true, 793 | "license": "MIT", 794 | "engines": { 795 | "node": ">=0.10.0" 796 | } 797 | }, 798 | "node_modules/jest-worker": { 799 | "version": "27.1.0", 800 | "dev": true, 801 | "license": "MIT", 802 | "dependencies": { 803 | "@types/node": "*", 804 | "merge-stream": "^2.0.0", 805 | "supports-color": "^8.0.0" 806 | }, 807 | "engines": { 808 | "node": ">= 10.13.0" 809 | } 810 | }, 811 | "node_modules/json-parse-better-errors": { 812 | "version": "1.0.2", 813 | "dev": true, 814 | "license": "MIT" 815 | }, 816 | "node_modules/json-schema-traverse": { 817 | "version": "0.4.1", 818 | "dev": true, 819 | "license": "MIT" 820 | }, 821 | "node_modules/kind-of": { 822 | "version": "6.0.3", 823 | "dev": true, 824 | "license": "MIT", 825 | "engines": { 826 | "node": ">=0.10.0" 827 | } 828 | }, 829 | "node_modules/loader-runner": { 830 | "version": "4.2.0", 831 | "dev": true, 832 | "license": "MIT", 833 | "engines": { 834 | "node": ">=6.11.5" 835 | } 836 | }, 837 | "node_modules/locate-path": { 838 | "version": "5.0.0", 839 | "dev": true, 840 | "license": "MIT", 841 | "dependencies": { 842 | "p-locate": "^4.1.0" 843 | }, 844 | "engines": { 845 | "node": ">=8" 846 | } 847 | }, 848 | "node_modules/merge-stream": { 849 | "version": "2.0.0", 850 | "dev": true, 851 | "license": "MIT" 852 | }, 853 | "node_modules/mime-db": { 854 | "version": "1.49.0", 855 | "dev": true, 856 | "license": "MIT", 857 | "engines": { 858 | "node": ">= 0.6" 859 | } 860 | }, 861 | "node_modules/mime-types": { 862 | "version": "2.1.32", 863 | "dev": true, 864 | "license": "MIT", 865 | "dependencies": { 866 | "mime-db": "1.49.0" 867 | }, 868 | "engines": { 869 | "node": ">= 0.6" 870 | } 871 | }, 872 | "node_modules/mimic-fn": { 873 | "version": "2.1.0", 874 | "dev": true, 875 | "license": "MIT", 876 | "engines": { 877 | "node": ">=6" 878 | } 879 | }, 880 | "node_modules/minimatch": { 881 | "version": "3.0.4", 882 | "dev": true, 883 | "license": "ISC", 884 | "dependencies": { 885 | "brace-expansion": "^1.1.7" 886 | }, 887 | "engines": { 888 | "node": "*" 889 | } 890 | }, 891 | "node_modules/ms": { 892 | "version": "2.1.3", 893 | "dev": true, 894 | "license": "MIT" 895 | }, 896 | "node_modules/neo-async": { 897 | "version": "2.6.2", 898 | "dev": true, 899 | "license": "MIT" 900 | }, 901 | "node_modules/node-releases": { 902 | "version": "1.1.75", 903 | "dev": true, 904 | "license": "MIT" 905 | }, 906 | "node_modules/nodemon": { 907 | "version": "2.0.14", 908 | "dev": true, 909 | "hasInstallScript": true, 910 | "license": "MIT", 911 | "dependencies": { 912 | "chokidar": "^3.2.2", 913 | "debug": "^3.2.6", 914 | "ignore-by-default": "^1.0.1", 915 | "minimatch": "^3.0.4", 916 | "pstree.remy": "^1.1.7", 917 | "semver": "^5.7.1", 918 | "supports-color": "^5.5.0", 919 | "touch": "^3.1.0", 920 | "undefsafe": "^2.0.3", 921 | "update-notifier": "^5.1.0" 922 | }, 923 | "bin": { 924 | "nodemon": "bin/nodemon.js" 925 | }, 926 | "engines": { 927 | "node": ">=8.10.0" 928 | }, 929 | "funding": { 930 | "type": "opencollective", 931 | "url": "https://opencollective.com/nodemon" 932 | } 933 | }, 934 | "node_modules/nodemon/node_modules/has-flag": { 935 | "version": "3.0.0", 936 | "dev": true, 937 | "license": "MIT", 938 | "engines": { 939 | "node": ">=4" 940 | } 941 | }, 942 | "node_modules/nodemon/node_modules/supports-color": { 943 | "version": "5.5.0", 944 | "dev": true, 945 | "license": "MIT", 946 | "dependencies": { 947 | "has-flag": "^3.0.0" 948 | }, 949 | "engines": { 950 | "node": ">=4" 951 | } 952 | }, 953 | "node_modules/normalize-path": { 954 | "version": "3.0.0", 955 | "dev": true, 956 | "license": "MIT", 957 | "engines": { 958 | "node": ">=0.10.0" 959 | } 960 | }, 961 | "node_modules/npm-run-path": { 962 | "version": "4.0.1", 963 | "dev": true, 964 | "license": "MIT", 965 | "dependencies": { 966 | "path-key": "^3.0.0" 967 | }, 968 | "engines": { 969 | "node": ">=8" 970 | } 971 | }, 972 | "node_modules/onetime": { 973 | "version": "5.1.2", 974 | "dev": true, 975 | "license": "MIT", 976 | "dependencies": { 977 | "mimic-fn": "^2.1.0" 978 | }, 979 | "engines": { 980 | "node": ">=6" 981 | }, 982 | "funding": { 983 | "url": "https://github.com/sponsors/sindresorhus" 984 | } 985 | }, 986 | "node_modules/p-locate": { 987 | "version": "4.1.0", 988 | "dev": true, 989 | "license": "MIT", 990 | "dependencies": { 991 | "p-limit": "^2.2.0" 992 | }, 993 | "engines": { 994 | "node": ">=8" 995 | } 996 | }, 997 | "node_modules/p-locate/node_modules/p-limit": { 998 | "version": "2.3.0", 999 | "dev": true, 1000 | "license": "MIT", 1001 | "dependencies": { 1002 | "p-try": "^2.0.0" 1003 | }, 1004 | "engines": { 1005 | "node": ">=6" 1006 | }, 1007 | "funding": { 1008 | "url": "https://github.com/sponsors/sindresorhus" 1009 | } 1010 | }, 1011 | "node_modules/p-try": { 1012 | "version": "2.2.0", 1013 | "dev": true, 1014 | "license": "MIT", 1015 | "engines": { 1016 | "node": ">=6" 1017 | } 1018 | }, 1019 | "node_modules/path-exists": { 1020 | "version": "4.0.0", 1021 | "dev": true, 1022 | "license": "MIT", 1023 | "engines": { 1024 | "node": ">=8" 1025 | } 1026 | }, 1027 | "node_modules/path-key": { 1028 | "version": "3.1.1", 1029 | "dev": true, 1030 | "license": "MIT", 1031 | "engines": { 1032 | "node": ">=8" 1033 | } 1034 | }, 1035 | "node_modules/path-parse": { 1036 | "version": "1.0.7", 1037 | "dev": true, 1038 | "license": "MIT" 1039 | }, 1040 | "node_modules/picomatch": { 1041 | "version": "2.3.0", 1042 | "dev": true, 1043 | "license": "MIT", 1044 | "engines": { 1045 | "node": ">=8.6" 1046 | }, 1047 | "funding": { 1048 | "url": "https://github.com/sponsors/jonschlinkert" 1049 | } 1050 | }, 1051 | "node_modules/pkg-dir": { 1052 | "version": "4.2.0", 1053 | "dev": true, 1054 | "license": "MIT", 1055 | "dependencies": { 1056 | "find-up": "^4.0.0" 1057 | }, 1058 | "engines": { 1059 | "node": ">=8" 1060 | } 1061 | }, 1062 | "node_modules/pstree.remy": { 1063 | "version": "1.1.8", 1064 | "dev": true, 1065 | "license": "MIT" 1066 | }, 1067 | "node_modules/randombytes": { 1068 | "version": "2.1.0", 1069 | "dev": true, 1070 | "license": "MIT", 1071 | "dependencies": { 1072 | "safe-buffer": "^5.1.0" 1073 | } 1074 | }, 1075 | "node_modules/readdirp": { 1076 | "version": "3.6.0", 1077 | "dev": true, 1078 | "license": "MIT", 1079 | "dependencies": { 1080 | "picomatch": "^2.2.1" 1081 | }, 1082 | "engines": { 1083 | "node": ">=8.10.0" 1084 | } 1085 | }, 1086 | "node_modules/rechoir": { 1087 | "version": "0.7.1", 1088 | "dev": true, 1089 | "license": "MIT", 1090 | "dependencies": { 1091 | "resolve": "^1.9.0" 1092 | }, 1093 | "engines": { 1094 | "node": ">= 0.10" 1095 | } 1096 | }, 1097 | "node_modules/resolve": { 1098 | "version": "1.20.0", 1099 | "dev": true, 1100 | "license": "MIT", 1101 | "dependencies": { 1102 | "is-core-module": "^2.2.0", 1103 | "path-parse": "^1.0.6" 1104 | }, 1105 | "funding": { 1106 | "url": "https://github.com/sponsors/ljharb" 1107 | } 1108 | }, 1109 | "node_modules/resolve-cwd": { 1110 | "version": "3.0.0", 1111 | "dev": true, 1112 | "license": "MIT", 1113 | "dependencies": { 1114 | "resolve-from": "^5.0.0" 1115 | }, 1116 | "engines": { 1117 | "node": ">=8" 1118 | } 1119 | }, 1120 | "node_modules/resolve-from": { 1121 | "version": "5.0.0", 1122 | "dev": true, 1123 | "license": "MIT", 1124 | "engines": { 1125 | "node": ">=8" 1126 | } 1127 | }, 1128 | "node_modules/safe-buffer": { 1129 | "version": "5.2.1", 1130 | "dev": true, 1131 | "funding": [ 1132 | { 1133 | "type": "github", 1134 | "url": "https://github.com/sponsors/feross" 1135 | }, 1136 | { 1137 | "type": "patreon", 1138 | "url": "https://www.patreon.com/feross" 1139 | }, 1140 | { 1141 | "type": "consulting", 1142 | "url": "https://feross.org/support" 1143 | } 1144 | ], 1145 | "license": "MIT" 1146 | }, 1147 | "node_modules/schema-utils": { 1148 | "version": "3.1.1", 1149 | "dev": true, 1150 | "license": "MIT", 1151 | "dependencies": { 1152 | "@types/json-schema": "^7.0.8", 1153 | "ajv": "^6.12.5", 1154 | "ajv-keywords": "^3.5.2" 1155 | }, 1156 | "engines": { 1157 | "node": ">= 10.13.0" 1158 | }, 1159 | "funding": { 1160 | "type": "opencollective", 1161 | "url": "https://opencollective.com/webpack" 1162 | } 1163 | }, 1164 | "node_modules/semver": { 1165 | "version": "5.7.1", 1166 | "dev": true, 1167 | "license": "ISC", 1168 | "bin": { 1169 | "semver": "bin/semver" 1170 | } 1171 | }, 1172 | "node_modules/serialize-javascript": { 1173 | "version": "6.0.0", 1174 | "dev": true, 1175 | "license": "BSD-3-Clause", 1176 | "dependencies": { 1177 | "randombytes": "^2.1.0" 1178 | } 1179 | }, 1180 | "node_modules/shallow-clone": { 1181 | "version": "3.0.1", 1182 | "dev": true, 1183 | "license": "MIT", 1184 | "dependencies": { 1185 | "kind-of": "^6.0.2" 1186 | }, 1187 | "engines": { 1188 | "node": ">=8" 1189 | } 1190 | }, 1191 | "node_modules/shebang-command": { 1192 | "version": "2.0.0", 1193 | "dev": true, 1194 | "license": "MIT", 1195 | "dependencies": { 1196 | "shebang-regex": "^3.0.0" 1197 | }, 1198 | "engines": { 1199 | "node": ">=8" 1200 | } 1201 | }, 1202 | "node_modules/shebang-regex": { 1203 | "version": "3.0.0", 1204 | "dev": true, 1205 | "license": "MIT", 1206 | "engines": { 1207 | "node": ">=8" 1208 | } 1209 | }, 1210 | "node_modules/signal-exit": { 1211 | "version": "3.0.3", 1212 | "dev": true, 1213 | "license": "ISC" 1214 | }, 1215 | "node_modules/source-map": { 1216 | "version": "0.6.1", 1217 | "dev": true, 1218 | "license": "BSD-3-Clause", 1219 | "engines": { 1220 | "node": ">=0.10.0" 1221 | } 1222 | }, 1223 | "node_modules/source-map-support": { 1224 | "version": "0.5.20", 1225 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", 1226 | "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", 1227 | "dev": true, 1228 | "dependencies": { 1229 | "buffer-from": "^1.0.0", 1230 | "source-map": "^0.6.0" 1231 | } 1232 | }, 1233 | "node_modules/strip-final-newline": { 1234 | "version": "2.0.0", 1235 | "dev": true, 1236 | "license": "MIT", 1237 | "engines": { 1238 | "node": ">=6" 1239 | } 1240 | }, 1241 | "node_modules/supports-color": { 1242 | "version": "8.1.1", 1243 | "dev": true, 1244 | "license": "MIT", 1245 | "dependencies": { 1246 | "has-flag": "^4.0.0" 1247 | }, 1248 | "engines": { 1249 | "node": ">=10" 1250 | }, 1251 | "funding": { 1252 | "url": "https://github.com/chalk/supports-color?sponsor=1" 1253 | } 1254 | }, 1255 | "node_modules/tapable": { 1256 | "version": "2.2.0", 1257 | "dev": true, 1258 | "license": "MIT", 1259 | "engines": { 1260 | "node": ">=6" 1261 | } 1262 | }, 1263 | "node_modules/terser-webpack-plugin": { 1264 | "version": "5.2.5", 1265 | "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz", 1266 | "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==", 1267 | "dev": true, 1268 | "dependencies": { 1269 | "jest-worker": "^27.0.6", 1270 | "schema-utils": "^3.1.1", 1271 | "serialize-javascript": "^6.0.0", 1272 | "source-map": "^0.6.1", 1273 | "terser": "^5.7.2" 1274 | }, 1275 | "engines": { 1276 | "node": ">= 10.13.0" 1277 | }, 1278 | "funding": { 1279 | "type": "opencollective", 1280 | "url": "https://opencollective.com/webpack" 1281 | }, 1282 | "peerDependencies": { 1283 | "webpack": "^5.1.0" 1284 | }, 1285 | "peerDependenciesMeta": { 1286 | "@swc/core": { 1287 | "optional": true 1288 | }, 1289 | "esbuild": { 1290 | "optional": true 1291 | }, 1292 | "uglify-js": { 1293 | "optional": true 1294 | } 1295 | } 1296 | }, 1297 | "node_modules/terser-webpack-plugin/node_modules/terser": { 1298 | "version": "5.9.0", 1299 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz", 1300 | "integrity": "sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ==", 1301 | "dev": true, 1302 | "dependencies": { 1303 | "commander": "^2.20.0", 1304 | "source-map": "~0.7.2", 1305 | "source-map-support": "~0.5.20" 1306 | }, 1307 | "bin": { 1308 | "terser": "bin/terser" 1309 | }, 1310 | "engines": { 1311 | "node": ">=10" 1312 | } 1313 | }, 1314 | "node_modules/terser-webpack-plugin/node_modules/terser/node_modules/source-map": { 1315 | "version": "0.7.3", 1316 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", 1317 | "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", 1318 | "dev": true, 1319 | "engines": { 1320 | "node": ">= 8" 1321 | } 1322 | }, 1323 | "node_modules/watchpack": { 1324 | "version": "2.2.0", 1325 | "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz", 1326 | "integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==", 1327 | "dev": true, 1328 | "dependencies": { 1329 | "glob-to-regexp": "^0.4.1", 1330 | "graceful-fs": "^4.1.2" 1331 | }, 1332 | "engines": { 1333 | "node": ">=10.13.0" 1334 | } 1335 | }, 1336 | "node_modules/webpack": { 1337 | "version": "5.63.0", 1338 | "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.63.0.tgz", 1339 | "integrity": "sha512-HYrw6bkj/MDmphAXvqLEvn2fVoDZsYu6O638WjK6lSNgIpjb5jl/KtOrqJyU9EC/ZV9mLUmZW5h4mASB+CVA4A==", 1340 | "dev": true, 1341 | "dependencies": { 1342 | "@types/eslint-scope": "^3.7.0", 1343 | "@types/estree": "^0.0.50", 1344 | "@webassemblyjs/ast": "1.11.1", 1345 | "@webassemblyjs/wasm-edit": "1.11.1", 1346 | "@webassemblyjs/wasm-parser": "1.11.1", 1347 | "acorn": "^8.4.1", 1348 | "acorn-import-assertions": "^1.7.6", 1349 | "browserslist": "^4.14.5", 1350 | "chrome-trace-event": "^1.0.2", 1351 | "enhanced-resolve": "^5.8.3", 1352 | "es-module-lexer": "^0.9.0", 1353 | "eslint-scope": "5.1.1", 1354 | "events": "^3.2.0", 1355 | "glob-to-regexp": "^0.4.1", 1356 | "graceful-fs": "^4.2.4", 1357 | "json-parse-better-errors": "^1.0.2", 1358 | "loader-runner": "^4.2.0", 1359 | "mime-types": "^2.1.27", 1360 | "neo-async": "^2.6.2", 1361 | "schema-utils": "^3.1.0", 1362 | "tapable": "^2.1.1", 1363 | "terser-webpack-plugin": "^5.1.3", 1364 | "watchpack": "^2.2.0", 1365 | "webpack-sources": "^3.2.0" 1366 | }, 1367 | "bin": { 1368 | "webpack": "bin/webpack.js" 1369 | }, 1370 | "engines": { 1371 | "node": ">=10.13.0" 1372 | }, 1373 | "funding": { 1374 | "type": "opencollective", 1375 | "url": "https://opencollective.com/webpack" 1376 | }, 1377 | "peerDependenciesMeta": { 1378 | "webpack-cli": { 1379 | "optional": true 1380 | } 1381 | } 1382 | }, 1383 | "node_modules/webpack-cli": { 1384 | "version": "4.9.1", 1385 | "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", 1386 | "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==", 1387 | "dev": true, 1388 | "dependencies": { 1389 | "@discoveryjs/json-ext": "^0.5.0", 1390 | "@webpack-cli/configtest": "^1.1.0", 1391 | "@webpack-cli/info": "^1.4.0", 1392 | "@webpack-cli/serve": "^1.6.0", 1393 | "colorette": "^2.0.14", 1394 | "commander": "^7.0.0", 1395 | "execa": "^5.0.0", 1396 | "fastest-levenshtein": "^1.0.12", 1397 | "import-local": "^3.0.2", 1398 | "interpret": "^2.2.0", 1399 | "rechoir": "^0.7.0", 1400 | "webpack-merge": "^5.7.3" 1401 | }, 1402 | "bin": { 1403 | "webpack-cli": "bin/cli.js" 1404 | }, 1405 | "engines": { 1406 | "node": ">=10.13.0" 1407 | }, 1408 | "peerDependencies": { 1409 | "webpack": "4.x.x || 5.x.x" 1410 | }, 1411 | "peerDependenciesMeta": { 1412 | "@webpack-cli/generators": { 1413 | "optional": true 1414 | }, 1415 | "@webpack-cli/migrate": { 1416 | "optional": true 1417 | }, 1418 | "webpack-bundle-analyzer": { 1419 | "optional": true 1420 | }, 1421 | "webpack-dev-server": { 1422 | "optional": true 1423 | } 1424 | } 1425 | }, 1426 | "node_modules/webpack-cli/node_modules/colorette": { 1427 | "version": "2.0.16", 1428 | "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", 1429 | "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==", 1430 | "dev": true 1431 | }, 1432 | "node_modules/webpack-cli/node_modules/commander": { 1433 | "version": "7.2.0", 1434 | "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", 1435 | "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", 1436 | "dev": true, 1437 | "engines": { 1438 | "node": ">= 10" 1439 | } 1440 | }, 1441 | "node_modules/webpack-merge": { 1442 | "version": "5.8.0", 1443 | "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", 1444 | "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", 1445 | "dev": true, 1446 | "dependencies": { 1447 | "clone-deep": "^4.0.1", 1448 | "wildcard": "^2.0.0" 1449 | }, 1450 | "engines": { 1451 | "node": ">=10.0.0" 1452 | } 1453 | }, 1454 | "node_modules/webpack-sources": { 1455 | "version": "3.2.1", 1456 | "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.1.tgz", 1457 | "integrity": "sha512-t6BMVLQ0AkjBOoRTZgqrWm7xbXMBzD+XDq2EZ96+vMfn3qKgsvdXZhbPZ4ElUOpdv4u+iiGe+w3+J75iy/bYGA==", 1458 | "dev": true, 1459 | "engines": { 1460 | "node": ">=10.13.0" 1461 | } 1462 | }, 1463 | "node_modules/wildcard": { 1464 | "version": "2.0.0", 1465 | "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", 1466 | "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", 1467 | "dev": true 1468 | } 1469 | }, 1470 | "dependencies": { 1471 | "@discoveryjs/json-ext": { 1472 | "version": "0.5.3", 1473 | "dev": true 1474 | }, 1475 | "@fastly/js-compute": { 1476 | "version": "0.2.0" 1477 | }, 1478 | "@types/eslint": { 1479 | "version": "7.28.0", 1480 | "dev": true, 1481 | "requires": { 1482 | "@types/estree": "*", 1483 | "@types/json-schema": "*" 1484 | } 1485 | }, 1486 | "@types/eslint-scope": { 1487 | "version": "3.7.1", 1488 | "dev": true, 1489 | "requires": { 1490 | "@types/eslint": "*", 1491 | "@types/estree": "*" 1492 | } 1493 | }, 1494 | "@types/estree": { 1495 | "version": "0.0.50", 1496 | "dev": true 1497 | }, 1498 | "@types/json-schema": { 1499 | "version": "7.0.9", 1500 | "dev": true 1501 | }, 1502 | "@types/node": { 1503 | "version": "16.7.10", 1504 | "dev": true 1505 | }, 1506 | "@webassemblyjs/ast": { 1507 | "version": "1.11.1", 1508 | "dev": true, 1509 | "requires": { 1510 | "@webassemblyjs/helper-numbers": "1.11.1", 1511 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1" 1512 | } 1513 | }, 1514 | "@webassemblyjs/floating-point-hex-parser": { 1515 | "version": "1.11.1", 1516 | "dev": true 1517 | }, 1518 | "@webassemblyjs/helper-api-error": { 1519 | "version": "1.11.1", 1520 | "dev": true 1521 | }, 1522 | "@webassemblyjs/helper-buffer": { 1523 | "version": "1.11.1", 1524 | "dev": true 1525 | }, 1526 | "@webassemblyjs/helper-numbers": { 1527 | "version": "1.11.1", 1528 | "dev": true, 1529 | "requires": { 1530 | "@webassemblyjs/floating-point-hex-parser": "1.11.1", 1531 | "@webassemblyjs/helper-api-error": "1.11.1", 1532 | "@xtuc/long": "4.2.2" 1533 | } 1534 | }, 1535 | "@webassemblyjs/helper-wasm-bytecode": { 1536 | "version": "1.11.1", 1537 | "dev": true 1538 | }, 1539 | "@webassemblyjs/helper-wasm-section": { 1540 | "version": "1.11.1", 1541 | "dev": true, 1542 | "requires": { 1543 | "@webassemblyjs/ast": "1.11.1", 1544 | "@webassemblyjs/helper-buffer": "1.11.1", 1545 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 1546 | "@webassemblyjs/wasm-gen": "1.11.1" 1547 | } 1548 | }, 1549 | "@webassemblyjs/ieee754": { 1550 | "version": "1.11.1", 1551 | "dev": true, 1552 | "requires": { 1553 | "@xtuc/ieee754": "^1.2.0" 1554 | } 1555 | }, 1556 | "@webassemblyjs/leb128": { 1557 | "version": "1.11.1", 1558 | "dev": true, 1559 | "requires": { 1560 | "@xtuc/long": "4.2.2" 1561 | } 1562 | }, 1563 | "@webassemblyjs/utf8": { 1564 | "version": "1.11.1", 1565 | "dev": true 1566 | }, 1567 | "@webassemblyjs/wasm-edit": { 1568 | "version": "1.11.1", 1569 | "dev": true, 1570 | "requires": { 1571 | "@webassemblyjs/ast": "1.11.1", 1572 | "@webassemblyjs/helper-buffer": "1.11.1", 1573 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 1574 | "@webassemblyjs/helper-wasm-section": "1.11.1", 1575 | "@webassemblyjs/wasm-gen": "1.11.1", 1576 | "@webassemblyjs/wasm-opt": "1.11.1", 1577 | "@webassemblyjs/wasm-parser": "1.11.1", 1578 | "@webassemblyjs/wast-printer": "1.11.1" 1579 | } 1580 | }, 1581 | "@webassemblyjs/wasm-gen": { 1582 | "version": "1.11.1", 1583 | "dev": true, 1584 | "requires": { 1585 | "@webassemblyjs/ast": "1.11.1", 1586 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 1587 | "@webassemblyjs/ieee754": "1.11.1", 1588 | "@webassemblyjs/leb128": "1.11.1", 1589 | "@webassemblyjs/utf8": "1.11.1" 1590 | } 1591 | }, 1592 | "@webassemblyjs/wasm-opt": { 1593 | "version": "1.11.1", 1594 | "dev": true, 1595 | "requires": { 1596 | "@webassemblyjs/ast": "1.11.1", 1597 | "@webassemblyjs/helper-buffer": "1.11.1", 1598 | "@webassemblyjs/wasm-gen": "1.11.1", 1599 | "@webassemblyjs/wasm-parser": "1.11.1" 1600 | } 1601 | }, 1602 | "@webassemblyjs/wasm-parser": { 1603 | "version": "1.11.1", 1604 | "dev": true, 1605 | "requires": { 1606 | "@webassemblyjs/ast": "1.11.1", 1607 | "@webassemblyjs/helper-api-error": "1.11.1", 1608 | "@webassemblyjs/helper-wasm-bytecode": "1.11.1", 1609 | "@webassemblyjs/ieee754": "1.11.1", 1610 | "@webassemblyjs/leb128": "1.11.1", 1611 | "@webassemblyjs/utf8": "1.11.1" 1612 | } 1613 | }, 1614 | "@webassemblyjs/wast-printer": { 1615 | "version": "1.11.1", 1616 | "dev": true, 1617 | "requires": { 1618 | "@webassemblyjs/ast": "1.11.1", 1619 | "@xtuc/long": "4.2.2" 1620 | } 1621 | }, 1622 | "@webpack-cli/configtest": { 1623 | "version": "1.1.0", 1624 | "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz", 1625 | "integrity": "sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg==", 1626 | "dev": true, 1627 | "requires": {} 1628 | }, 1629 | "@webpack-cli/info": { 1630 | "version": "1.4.0", 1631 | "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz", 1632 | "integrity": "sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw==", 1633 | "dev": true, 1634 | "requires": { 1635 | "envinfo": "^7.7.3" 1636 | } 1637 | }, 1638 | "@webpack-cli/serve": { 1639 | "version": "1.6.0", 1640 | "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz", 1641 | "integrity": "sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA==", 1642 | "dev": true, 1643 | "requires": {} 1644 | }, 1645 | "@xtuc/ieee754": { 1646 | "version": "1.2.0", 1647 | "dev": true 1648 | }, 1649 | "@xtuc/long": { 1650 | "version": "4.2.2", 1651 | "dev": true 1652 | }, 1653 | "acorn": { 1654 | "version": "8.4.1", 1655 | "dev": true 1656 | }, 1657 | "acorn-import-assertions": { 1658 | "version": "1.7.6", 1659 | "dev": true, 1660 | "requires": {} 1661 | }, 1662 | "ajv": { 1663 | "version": "6.12.6", 1664 | "dev": true, 1665 | "requires": { 1666 | "fast-deep-equal": "^3.1.1", 1667 | "fast-json-stable-stringify": "^2.0.0", 1668 | "json-schema-traverse": "^0.4.1", 1669 | "uri-js": "^4.2.2" 1670 | } 1671 | }, 1672 | "ajv-keywords": { 1673 | "version": "3.5.2", 1674 | "dev": true, 1675 | "requires": {} 1676 | }, 1677 | "anymatch": { 1678 | "version": "3.1.2", 1679 | "dev": true, 1680 | "requires": { 1681 | "normalize-path": "^3.0.0", 1682 | "picomatch": "^2.0.4" 1683 | } 1684 | }, 1685 | "balanced-match": { 1686 | "version": "1.0.2", 1687 | "dev": true 1688 | }, 1689 | "binary-extensions": { 1690 | "version": "2.2.0", 1691 | "dev": true 1692 | }, 1693 | "brace-expansion": { 1694 | "version": "1.1.11", 1695 | "dev": true, 1696 | "requires": { 1697 | "balanced-match": "^1.0.0", 1698 | "concat-map": "0.0.1" 1699 | } 1700 | }, 1701 | "braces": { 1702 | "version": "3.0.2", 1703 | "dev": true, 1704 | "requires": { 1705 | "fill-range": "^7.0.1" 1706 | } 1707 | }, 1708 | "browserslist": { 1709 | "version": "4.16.8", 1710 | "dev": true, 1711 | "requires": { 1712 | "caniuse-lite": "^1.0.30001251", 1713 | "colorette": "^1.3.0", 1714 | "electron-to-chromium": "^1.3.811", 1715 | "escalade": "^3.1.1", 1716 | "node-releases": "^1.1.75" 1717 | } 1718 | }, 1719 | "buffer-from": { 1720 | "version": "1.1.2", 1721 | "dev": true 1722 | }, 1723 | "caniuse-lite": { 1724 | "version": "1.0.30001252", 1725 | "dev": true 1726 | }, 1727 | "chokidar": { 1728 | "version": "3.5.2", 1729 | "dev": true, 1730 | "requires": { 1731 | "anymatch": "~3.1.2", 1732 | "braces": "~3.0.2", 1733 | "fsevents": "~2.3.2", 1734 | "glob-parent": "~5.1.2", 1735 | "is-binary-path": "~2.1.0", 1736 | "is-glob": "~4.0.1", 1737 | "normalize-path": "~3.0.0", 1738 | "readdirp": "~3.6.0" 1739 | } 1740 | }, 1741 | "chrome-trace-event": { 1742 | "version": "1.0.3", 1743 | "dev": true 1744 | }, 1745 | "clone-deep": { 1746 | "version": "4.0.1", 1747 | "dev": true, 1748 | "requires": { 1749 | "is-plain-object": "^2.0.4", 1750 | "kind-of": "^6.0.2", 1751 | "shallow-clone": "^3.0.0" 1752 | } 1753 | }, 1754 | "colorette": { 1755 | "version": "1.3.0", 1756 | "dev": true 1757 | }, 1758 | "commander": { 1759 | "version": "2.20.3", 1760 | "dev": true 1761 | }, 1762 | "concat-map": { 1763 | "version": "0.0.1", 1764 | "dev": true 1765 | }, 1766 | "core-js": { 1767 | "version": "3.19.0", 1768 | "dev": true 1769 | }, 1770 | "cross-spawn": { 1771 | "version": "7.0.3", 1772 | "dev": true, 1773 | "requires": { 1774 | "path-key": "^3.1.0", 1775 | "shebang-command": "^2.0.0", 1776 | "which": "^2.0.1" 1777 | } 1778 | }, 1779 | "debug": { 1780 | "version": "3.2.7", 1781 | "dev": true, 1782 | "requires": { 1783 | "ms": "^2.1.1" 1784 | } 1785 | }, 1786 | "electron-to-chromium": { 1787 | "version": "1.3.826", 1788 | "dev": true 1789 | }, 1790 | "enhanced-resolve": { 1791 | "version": "5.8.3", 1792 | "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz", 1793 | "integrity": "sha512-EGAbGvH7j7Xt2nc0E7D99La1OiEs8LnyimkRgwExpUMScN6O+3x9tIWs7PLQZVNx4YD+00skHXPXi1yQHpAmZA==", 1794 | "dev": true, 1795 | "requires": { 1796 | "graceful-fs": "^4.2.4", 1797 | "tapable": "^2.2.0" 1798 | } 1799 | }, 1800 | "envinfo": { 1801 | "version": "7.8.1", 1802 | "dev": true 1803 | }, 1804 | "es-module-lexer": { 1805 | "version": "0.9.3", 1806 | "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", 1807 | "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", 1808 | "dev": true 1809 | }, 1810 | "escalade": { 1811 | "version": "3.1.1", 1812 | "dev": true 1813 | }, 1814 | "eslint-scope": { 1815 | "version": "5.1.1", 1816 | "dev": true, 1817 | "requires": { 1818 | "esrecurse": "^4.3.0", 1819 | "estraverse": "^4.1.1" 1820 | } 1821 | }, 1822 | "esrecurse": { 1823 | "version": "4.3.0", 1824 | "dev": true, 1825 | "requires": { 1826 | "estraverse": "^5.2.0" 1827 | }, 1828 | "dependencies": { 1829 | "estraverse": { 1830 | "version": "5.2.0", 1831 | "dev": true 1832 | } 1833 | } 1834 | }, 1835 | "estraverse": { 1836 | "version": "4.3.0", 1837 | "dev": true 1838 | }, 1839 | "events": { 1840 | "version": "3.3.0", 1841 | "dev": true 1842 | }, 1843 | "execa": { 1844 | "version": "5.1.1", 1845 | "dev": true, 1846 | "requires": { 1847 | "cross-spawn": "^7.0.3", 1848 | "get-stream": "^6.0.0", 1849 | "human-signals": "^2.1.0", 1850 | "is-stream": "^2.0.0", 1851 | "merge-stream": "^2.0.0", 1852 | "npm-run-path": "^4.0.1", 1853 | "onetime": "^5.1.2", 1854 | "signal-exit": "^3.0.3", 1855 | "strip-final-newline": "^2.0.0" 1856 | } 1857 | }, 1858 | "fast-deep-equal": { 1859 | "version": "3.1.3", 1860 | "dev": true 1861 | }, 1862 | "fast-json-stable-stringify": { 1863 | "version": "2.1.0", 1864 | "dev": true 1865 | }, 1866 | "fastest-levenshtein": { 1867 | "version": "1.0.12", 1868 | "dev": true 1869 | }, 1870 | "fill-range": { 1871 | "version": "7.0.1", 1872 | "dev": true, 1873 | "requires": { 1874 | "to-regex-range": "^5.0.1" 1875 | } 1876 | }, 1877 | "find-up": { 1878 | "version": "4.1.0", 1879 | "dev": true, 1880 | "requires": { 1881 | "locate-path": "^5.0.0", 1882 | "path-exists": "^4.0.0" 1883 | } 1884 | }, 1885 | "fsevents": { 1886 | "version": "2.3.2", 1887 | "dev": true, 1888 | "optional": true 1889 | }, 1890 | "function-bind": { 1891 | "version": "1.1.1", 1892 | "dev": true 1893 | }, 1894 | "get-stream": { 1895 | "version": "6.0.1", 1896 | "dev": true 1897 | }, 1898 | "glob-parent": { 1899 | "version": "5.1.2", 1900 | "dev": true, 1901 | "requires": { 1902 | "is-glob": "^4.0.1" 1903 | } 1904 | }, 1905 | "glob-to-regexp": { 1906 | "version": "0.4.1", 1907 | "dev": true 1908 | }, 1909 | "graceful-fs": { 1910 | "version": "4.2.8", 1911 | "dev": true 1912 | }, 1913 | "graphql": { 1914 | "version": "15.7.1", 1915 | "peer": true 1916 | }, 1917 | "graphql-helix": { 1918 | "version": "1.9.1", 1919 | "resolved": "https://registry.npmjs.org/graphql-helix/-/graphql-helix-1.9.1.tgz", 1920 | "integrity": "sha512-Of4iMFy+lesAF52RsgTlSUtgAlogWNQt8xp817fcgdJtGNO1bo4RPR4yXD5vZYHbw01Vm2fmaPOCUps5BJJSXw==", 1921 | "requires": {} 1922 | }, 1923 | "has": { 1924 | "version": "1.0.3", 1925 | "dev": true, 1926 | "requires": { 1927 | "function-bind": "^1.1.1" 1928 | } 1929 | }, 1930 | "has-flag": { 1931 | "version": "4.0.0", 1932 | "dev": true 1933 | }, 1934 | "human-signals": { 1935 | "version": "2.1.0", 1936 | "dev": true 1937 | }, 1938 | "ignore-by-default": { 1939 | "version": "1.0.1", 1940 | "dev": true 1941 | }, 1942 | "import-local": { 1943 | "version": "3.0.2", 1944 | "dev": true, 1945 | "requires": { 1946 | "pkg-dir": "^4.2.0", 1947 | "resolve-cwd": "^3.0.0" 1948 | } 1949 | }, 1950 | "interpret": { 1951 | "version": "2.2.0", 1952 | "dev": true 1953 | }, 1954 | "is-binary-path": { 1955 | "version": "2.1.0", 1956 | "dev": true, 1957 | "requires": { 1958 | "binary-extensions": "^2.0.0" 1959 | } 1960 | }, 1961 | "is-core-module": { 1962 | "version": "2.6.0", 1963 | "dev": true, 1964 | "requires": { 1965 | "has": "^1.0.3" 1966 | } 1967 | }, 1968 | "is-extglob": { 1969 | "version": "2.1.1", 1970 | "dev": true 1971 | }, 1972 | "is-glob": { 1973 | "version": "4.0.3", 1974 | "dev": true, 1975 | "requires": { 1976 | "is-extglob": "^2.1.1" 1977 | } 1978 | }, 1979 | "is-plain-object": { 1980 | "version": "2.0.4", 1981 | "dev": true, 1982 | "requires": { 1983 | "isobject": "^3.0.1" 1984 | } 1985 | }, 1986 | "is-stream": { 1987 | "version": "2.0.1", 1988 | "dev": true 1989 | }, 1990 | "isobject": { 1991 | "version": "3.0.1", 1992 | "dev": true 1993 | }, 1994 | "jest-worker": { 1995 | "version": "27.1.0", 1996 | "dev": true, 1997 | "requires": { 1998 | "@types/node": "*", 1999 | "merge-stream": "^2.0.0", 2000 | "supports-color": "^8.0.0" 2001 | } 2002 | }, 2003 | "json-parse-better-errors": { 2004 | "version": "1.0.2", 2005 | "dev": true 2006 | }, 2007 | "json-schema-traverse": { 2008 | "version": "0.4.1", 2009 | "dev": true 2010 | }, 2011 | "kind-of": { 2012 | "version": "6.0.3", 2013 | "dev": true 2014 | }, 2015 | "loader-runner": { 2016 | "version": "4.2.0", 2017 | "dev": true 2018 | }, 2019 | "locate-path": { 2020 | "version": "5.0.0", 2021 | "dev": true, 2022 | "requires": { 2023 | "p-locate": "^4.1.0" 2024 | } 2025 | }, 2026 | "merge-stream": { 2027 | "version": "2.0.0", 2028 | "dev": true 2029 | }, 2030 | "mime-db": { 2031 | "version": "1.49.0", 2032 | "dev": true 2033 | }, 2034 | "mime-types": { 2035 | "version": "2.1.32", 2036 | "dev": true, 2037 | "requires": { 2038 | "mime-db": "1.49.0" 2039 | } 2040 | }, 2041 | "mimic-fn": { 2042 | "version": "2.1.0", 2043 | "dev": true 2044 | }, 2045 | "minimatch": { 2046 | "version": "3.0.4", 2047 | "dev": true, 2048 | "requires": { 2049 | "brace-expansion": "^1.1.7" 2050 | } 2051 | }, 2052 | "ms": { 2053 | "version": "2.1.3", 2054 | "dev": true 2055 | }, 2056 | "neo-async": { 2057 | "version": "2.6.2", 2058 | "dev": true 2059 | }, 2060 | "node-releases": { 2061 | "version": "1.1.75", 2062 | "dev": true 2063 | }, 2064 | "nodemon": { 2065 | "version": "2.0.14", 2066 | "dev": true, 2067 | "requires": { 2068 | "chokidar": "^3.2.2", 2069 | "debug": "^3.2.6", 2070 | "ignore-by-default": "^1.0.1", 2071 | "minimatch": "^3.0.4", 2072 | "pstree.remy": "^1.1.7", 2073 | "semver": "^5.7.1", 2074 | "supports-color": "^5.5.0", 2075 | "touch": "^3.1.0", 2076 | "undefsafe": "^2.0.3", 2077 | "update-notifier": "^5.1.0" 2078 | }, 2079 | "dependencies": { 2080 | "has-flag": { 2081 | "version": "3.0.0", 2082 | "dev": true 2083 | }, 2084 | "supports-color": { 2085 | "version": "5.5.0", 2086 | "dev": true, 2087 | "requires": { 2088 | "has-flag": "^3.0.0" 2089 | } 2090 | } 2091 | } 2092 | }, 2093 | "normalize-path": { 2094 | "version": "3.0.0", 2095 | "dev": true 2096 | }, 2097 | "npm-run-path": { 2098 | "version": "4.0.1", 2099 | "dev": true, 2100 | "requires": { 2101 | "path-key": "^3.0.0" 2102 | } 2103 | }, 2104 | "onetime": { 2105 | "version": "5.1.2", 2106 | "dev": true, 2107 | "requires": { 2108 | "mimic-fn": "^2.1.0" 2109 | } 2110 | }, 2111 | "p-locate": { 2112 | "version": "4.1.0", 2113 | "dev": true, 2114 | "requires": { 2115 | "p-limit": "^2.2.0" 2116 | }, 2117 | "dependencies": { 2118 | "p-limit": { 2119 | "version": "2.3.0", 2120 | "dev": true, 2121 | "requires": { 2122 | "p-try": "^2.0.0" 2123 | } 2124 | } 2125 | } 2126 | }, 2127 | "p-try": { 2128 | "version": "2.2.0", 2129 | "dev": true 2130 | }, 2131 | "path-exists": { 2132 | "version": "4.0.0", 2133 | "dev": true 2134 | }, 2135 | "path-key": { 2136 | "version": "3.1.1", 2137 | "dev": true 2138 | }, 2139 | "path-parse": { 2140 | "version": "1.0.7", 2141 | "dev": true 2142 | }, 2143 | "picomatch": { 2144 | "version": "2.3.0", 2145 | "dev": true 2146 | }, 2147 | "pkg-dir": { 2148 | "version": "4.2.0", 2149 | "dev": true, 2150 | "requires": { 2151 | "find-up": "^4.0.0" 2152 | } 2153 | }, 2154 | "pstree.remy": { 2155 | "version": "1.1.8", 2156 | "dev": true 2157 | }, 2158 | "randombytes": { 2159 | "version": "2.1.0", 2160 | "dev": true, 2161 | "requires": { 2162 | "safe-buffer": "^5.1.0" 2163 | } 2164 | }, 2165 | "readdirp": { 2166 | "version": "3.6.0", 2167 | "dev": true, 2168 | "requires": { 2169 | "picomatch": "^2.2.1" 2170 | } 2171 | }, 2172 | "rechoir": { 2173 | "version": "0.7.1", 2174 | "dev": true, 2175 | "requires": { 2176 | "resolve": "^1.9.0" 2177 | } 2178 | }, 2179 | "resolve": { 2180 | "version": "1.20.0", 2181 | "dev": true, 2182 | "requires": { 2183 | "is-core-module": "^2.2.0", 2184 | "path-parse": "^1.0.6" 2185 | } 2186 | }, 2187 | "resolve-cwd": { 2188 | "version": "3.0.0", 2189 | "dev": true, 2190 | "requires": { 2191 | "resolve-from": "^5.0.0" 2192 | } 2193 | }, 2194 | "resolve-from": { 2195 | "version": "5.0.0", 2196 | "dev": true 2197 | }, 2198 | "safe-buffer": { 2199 | "version": "5.2.1", 2200 | "dev": true 2201 | }, 2202 | "schema-utils": { 2203 | "version": "3.1.1", 2204 | "dev": true, 2205 | "requires": { 2206 | "@types/json-schema": "^7.0.8", 2207 | "ajv": "^6.12.5", 2208 | "ajv-keywords": "^3.5.2" 2209 | } 2210 | }, 2211 | "semver": { 2212 | "version": "5.7.1", 2213 | "dev": true 2214 | }, 2215 | "serialize-javascript": { 2216 | "version": "6.0.0", 2217 | "dev": true, 2218 | "requires": { 2219 | "randombytes": "^2.1.0" 2220 | } 2221 | }, 2222 | "shallow-clone": { 2223 | "version": "3.0.1", 2224 | "dev": true, 2225 | "requires": { 2226 | "kind-of": "^6.0.2" 2227 | } 2228 | }, 2229 | "shebang-command": { 2230 | "version": "2.0.0", 2231 | "dev": true, 2232 | "requires": { 2233 | "shebang-regex": "^3.0.0" 2234 | } 2235 | }, 2236 | "shebang-regex": { 2237 | "version": "3.0.0", 2238 | "dev": true 2239 | }, 2240 | "signal-exit": { 2241 | "version": "3.0.3", 2242 | "dev": true 2243 | }, 2244 | "source-map": { 2245 | "version": "0.6.1", 2246 | "dev": true 2247 | }, 2248 | "source-map-support": { 2249 | "version": "0.5.20", 2250 | "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", 2251 | "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", 2252 | "dev": true, 2253 | "requires": { 2254 | "buffer-from": "^1.0.0", 2255 | "source-map": "^0.6.0" 2256 | } 2257 | }, 2258 | "strip-final-newline": { 2259 | "version": "2.0.0", 2260 | "dev": true 2261 | }, 2262 | "supports-color": { 2263 | "version": "8.1.1", 2264 | "dev": true, 2265 | "requires": { 2266 | "has-flag": "^4.0.0" 2267 | } 2268 | }, 2269 | "tapable": { 2270 | "version": "2.2.0", 2271 | "dev": true 2272 | }, 2273 | "terser-webpack-plugin": { 2274 | "version": "5.2.5", 2275 | "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz", 2276 | "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==", 2277 | "dev": true, 2278 | "requires": { 2279 | "jest-worker": "^27.0.6", 2280 | "schema-utils": "^3.1.1", 2281 | "serialize-javascript": "^6.0.0", 2282 | "source-map": "^0.6.1", 2283 | "terser": "^5.7.2" 2284 | }, 2285 | "dependencies": { 2286 | "terser": { 2287 | "version": "5.9.0", 2288 | "resolved": "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz", 2289 | "integrity": "sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ==", 2290 | "dev": true, 2291 | "requires": { 2292 | "commander": "^2.20.0", 2293 | "source-map": "~0.7.2", 2294 | "source-map-support": "~0.5.20" 2295 | }, 2296 | "dependencies": { 2297 | "source-map": { 2298 | "version": "0.7.3", 2299 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", 2300 | "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", 2301 | "dev": true 2302 | } 2303 | } 2304 | } 2305 | } 2306 | }, 2307 | "watchpack": { 2308 | "version": "2.2.0", 2309 | "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz", 2310 | "integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==", 2311 | "dev": true, 2312 | "requires": { 2313 | "glob-to-regexp": "^0.4.1", 2314 | "graceful-fs": "^4.1.2" 2315 | } 2316 | }, 2317 | "webpack": { 2318 | "version": "5.63.0", 2319 | "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.63.0.tgz", 2320 | "integrity": "sha512-HYrw6bkj/MDmphAXvqLEvn2fVoDZsYu6O638WjK6lSNgIpjb5jl/KtOrqJyU9EC/ZV9mLUmZW5h4mASB+CVA4A==", 2321 | "dev": true, 2322 | "requires": { 2323 | "@types/eslint-scope": "^3.7.0", 2324 | "@types/estree": "^0.0.50", 2325 | "@webassemblyjs/ast": "1.11.1", 2326 | "@webassemblyjs/wasm-edit": "1.11.1", 2327 | "@webassemblyjs/wasm-parser": "1.11.1", 2328 | "acorn": "^8.4.1", 2329 | "acorn-import-assertions": "^1.7.6", 2330 | "browserslist": "^4.14.5", 2331 | "chrome-trace-event": "^1.0.2", 2332 | "enhanced-resolve": "^5.8.3", 2333 | "es-module-lexer": "^0.9.0", 2334 | "eslint-scope": "5.1.1", 2335 | "events": "^3.2.0", 2336 | "glob-to-regexp": "^0.4.1", 2337 | "graceful-fs": "^4.2.4", 2338 | "json-parse-better-errors": "^1.0.2", 2339 | "loader-runner": "^4.2.0", 2340 | "mime-types": "^2.1.27", 2341 | "neo-async": "^2.6.2", 2342 | "schema-utils": "^3.1.0", 2343 | "tapable": "^2.1.1", 2344 | "terser-webpack-plugin": "^5.1.3", 2345 | "watchpack": "^2.2.0", 2346 | "webpack-sources": "^3.2.0" 2347 | } 2348 | }, 2349 | "webpack-cli": { 2350 | "version": "4.9.1", 2351 | "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", 2352 | "integrity": "sha512-JYRFVuyFpzDxMDB+v/nanUdQYcZtqFPGzmlW4s+UkPMFhSpfRNmf1z4AwYcHJVdvEFAM7FFCQdNTpsBYhDLusQ==", 2353 | "dev": true, 2354 | "requires": { 2355 | "@discoveryjs/json-ext": "^0.5.0", 2356 | "@webpack-cli/configtest": "^1.1.0", 2357 | "@webpack-cli/info": "^1.4.0", 2358 | "@webpack-cli/serve": "^1.6.0", 2359 | "colorette": "^2.0.14", 2360 | "commander": "^7.0.0", 2361 | "execa": "^5.0.0", 2362 | "fastest-levenshtein": "^1.0.12", 2363 | "import-local": "^3.0.2", 2364 | "interpret": "^2.2.0", 2365 | "rechoir": "^0.7.0", 2366 | "webpack-merge": "^5.7.3" 2367 | }, 2368 | "dependencies": { 2369 | "colorette": { 2370 | "version": "2.0.16", 2371 | "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", 2372 | "integrity": "sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==", 2373 | "dev": true 2374 | }, 2375 | "commander": { 2376 | "version": "7.2.0", 2377 | "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", 2378 | "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", 2379 | "dev": true 2380 | } 2381 | } 2382 | }, 2383 | "webpack-merge": { 2384 | "version": "5.8.0", 2385 | "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", 2386 | "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", 2387 | "dev": true, 2388 | "requires": { 2389 | "clone-deep": "^4.0.1", 2390 | "wildcard": "^2.0.0" 2391 | } 2392 | }, 2393 | "webpack-sources": { 2394 | "version": "3.2.1", 2395 | "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.1.tgz", 2396 | "integrity": "sha512-t6BMVLQ0AkjBOoRTZgqrWm7xbXMBzD+XDq2EZ96+vMfn3qKgsvdXZhbPZ4ElUOpdv4u+iiGe+w3+J75iy/bYGA==", 2397 | "dev": true 2398 | }, 2399 | "wildcard": { 2400 | "version": "2.0.0", 2401 | "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", 2402 | "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", 2403 | "dev": true 2404 | } 2405 | } 2406 | } 2407 | --------------------------------------------------------------------------------