├── .gitignore ├── .github ├── CODEOWNERS ├── .kodiak.toml └── workflows │ ├── add-to-project.yml │ ├── labeller.yml │ ├── release-please.yml │ └── pre-release.yml ├── .prettierrc ├── netlify.toml ├── demo ├── public │ ├── favicon.ico │ └── images │ │ └── frogmouth.png ├── vite.config.js ├── index.html └── handler.js ├── renovate.json ├── package.json ├── CHANGELOG.md ├── src └── index.ts ├── README.md └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .netlify -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @netlify/ecosystem-pod-frameworks 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true 4 | } -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "demo/dist" 3 | command = "npm run build && npm run build:demo" 4 | -------------------------------------------------------------------------------- /demo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/vite-plugin-netlify-edge/HEAD/demo/public/favicon.ico -------------------------------------------------------------------------------- /demo/public/images/frogmouth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netlify/vite-plugin-netlify-edge/HEAD/demo/public/images/frogmouth.png -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "local>netlify/renovate-config" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /demo/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import netlifyEdge from '../dist/index.js' 3 | 4 | export default defineConfig({ 5 | plugins: [netlifyEdge()], 6 | }) 7 | -------------------------------------------------------------------------------- /.github/.kodiak.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [merge.automerge_dependencies] 4 | versions = ["minor", "patch"] 5 | usernames = ["renovate"] 6 | 7 | [approve] 8 | auto_approve_usernames = ["renovate"] 9 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 |

Hi

13 | Baby tawny frogmouth looking surly 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /demo/handler.js: -------------------------------------------------------------------------------- 1 | import staticFiles from '@static-manifest' 2 | 3 | export const handler = async (request, { next }) => { 4 | // Handle static files 5 | 6 | const { pathname } = new URL(request.url) 7 | 8 | // If your framework generates client assets in a subdirectory, you can add these too 9 | if (staticFiles.includes(pathname) || pathname.startsWith('assets/')) { 10 | return next() 11 | } 12 | 13 | return new Response('Hello World!') 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/add-to-project.yml: -------------------------------------------------------------------------------- 1 | name: Add new issue to project 2 | on: 3 | issues: 4 | types: 5 | - opened 6 | jobs: 7 | track_pr: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Generate token 11 | id: generate_token 12 | uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1.9.0 13 | with: 14 | app_id: ${{ secrets.TOKENS_APP_ID }} 15 | private_key: ${{ secrets.TOKENS_PRIVATE_KEY }} 16 | - name: Add issue to Project 17 | uses: actions/add-to-project@v0.6.1 18 | with: 19 | project-url: https://github.com/orgs/netlify/projects/199 20 | github-token: ${{ steps.generate_token.outputs.token }} 21 | -------------------------------------------------------------------------------- /.github/workflows/labeller.yml: -------------------------------------------------------------------------------- 1 | name: Label PR 2 | on: 3 | pull_request: 4 | types: [opened, edited] 5 | 6 | jobs: 7 | label-pr: 8 | if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | pr: 13 | [ 14 | { prefix: 'fix', type: 'bug' }, 15 | { prefix: 'chore', type: 'chore' }, 16 | { prefix: 'test', type: 'chore' }, 17 | { prefix: 'ci', type: 'chore' }, 18 | { prefix: 'feat', type: 'feature' }, 19 | { prefix: 'security', type: 'security' }, 20 | ] 21 | steps: 22 | - uses: netlify/pr-labeler-action@v1.1.0 23 | if: startsWith(github.event.pull_request.title, matrix.pr.prefix) 24 | with: 25 | token: '${{ secrets.GITHUB_TOKEN }}' 26 | label: 'type: ${{ matrix.pr.type }}' 27 | -------------------------------------------------------------------------------- /.github/workflows/release-please.yml: -------------------------------------------------------------------------------- 1 | name: release-please 2 | on: 3 | push: 4 | branches: 5 | - main 6 | jobs: 7 | release-please: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: navikt/github-app-token-generator@a8ae52448279d468cfbca5cd899f2457f0b1f643 11 | id: get-token 12 | with: 13 | private-key: ${{ secrets.TOKENS_PRIVATE_KEY }} 14 | app-id: ${{ secrets.TOKENS_APP_ID }} 15 | - uses: GoogleCloudPlatform/release-please-action@v3 16 | id: release 17 | with: 18 | token: ${{ steps.get-token.outputs.token }} 19 | release-type: node 20 | package-name: '@netlify/plugin-nextjs' 21 | - uses: actions/checkout@v3 22 | if: ${{ steps.release.outputs.release_created }} 23 | - uses: actions/setup-node@v3 24 | with: 25 | node-version: '*' 26 | cache: 'npm' 27 | check-latest: true 28 | registry-url: 'https://registry.npmjs.org' 29 | if: ${{ steps.release.outputs.release_created }} 30 | - name: Install dependencies 31 | run: npm ci 32 | if: ${{ steps.release.outputs.release_created }} 33 | - run: npm publish 34 | if: ${{ steps.release.outputs.release_created }} 35 | env: 36 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 37 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@netlify/vite-plugin-netlify-edge", 3 | "version": "1.1.3", 4 | "description": "Vite support for Netlify Edge Function", 5 | "main": "./dist/index.js", 6 | "module": "./dist/index.mjs", 7 | "types": "./dist/index.d.ts", 8 | "exports": { 9 | ".": { 10 | "import": "./dist/index.mjs", 11 | "require": "./dist/index.js" 12 | } 13 | }, 14 | "author": "Matt Kane ", 15 | "license": "MIT", 16 | "scripts": { 17 | "build": "tsup src/index.ts --format esm,cjs --dts ", 18 | "prepublishOnly": "npm run build", 19 | "build:demo": "npm run build:client && npm run build:ssr", 20 | "build:client": "vite build demo", 21 | "build:ssr": "vite build demo --ssr handler.js" 22 | }, 23 | "files": [ 24 | "dist" 25 | ], 26 | "devDependencies": { 27 | "@types/node": "^18.0.0", 28 | "tsup": "^5.12.4", 29 | "typescript": "^4.6.3", 30 | "vite": "^2.9.1" 31 | }, 32 | "dependencies": { 33 | "fast-glob": "^3.2.11" 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "git+ssh://git@github.com/netlify/vite-plugin-netlify-edge.git" 38 | }, 39 | "bugs": { 40 | "url": "https://github.com/netlify/vite-plugin-netlify-edge/issues" 41 | }, 42 | "homepage": "https://github.com/netlify/vite-plugin-netlify-edge#readme", 43 | "keywords": [ 44 | "vite-plugin", 45 | "vite" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /.github/workflows/pre-release.yml: -------------------------------------------------------------------------------- 1 | name: prerelease 2 | on: 3 | push: 4 | branches: 5 | # releases// 6 | - releases/*/* 7 | jobs: 8 | prerelease: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: '*' 15 | cache: 'npm' 16 | check-latest: true 17 | registry-url: 'https://registry.npmjs.org' 18 | - name: Install core dependencies 19 | run: npm ci --no-audit 20 | - name: Extract tag and version 21 | id: extract 22 | run: |- 23 | ref=${{ github.ref }} 24 | branch=${ref:11} 25 | tag_version=${branch:9} 26 | tag=${tag_version%/*} 27 | version=${tag_version##*/} 28 | echo "tag=${tag}" >> $GITHUB_OUTPUT 29 | echo "version=${version}" >> $GITHUB_OUTPUT 30 | - name: Log versions 31 | run: |- 32 | echo tag=${{ steps.extract.outputs.tag }} 33 | echo version=${{ steps.extract.outputs.version }} 34 | - name: Setup git user 35 | run: git config --global user.name github-actions 36 | - name: Setup git email 37 | run: git config --global user.email github-actions@github.com 38 | - name: Run npm version 39 | run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} --allow-same-version 40 | - name: Push changes 41 | run: git push --follow-tags 42 | - name: Run npm publish 43 | run: npm publish --tag=${{ steps.extract.outputs.tag }} 44 | env: 45 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 46 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.3](https://github.com/netlify/vite-plugin-netlify-edge/compare/v1.1.2...v1.1.3) (2023-10-09) 4 | 5 | 6 | ### Bug Fixes 7 | 8 | * **deps:** update dependency fast-glob to v3.3.0 ([ac9456f](https://github.com/netlify/vite-plugin-netlify-edge/commit/ac9456ff178d552f69f1922ad154a81800c865bd)) 9 | * **deps:** update dependency fast-glob to v3.3.1 ([861b6c4](https://github.com/netlify/vite-plugin-netlify-edge/commit/861b6c4f89001db7ca36196db9dbf8b7d050d503)) 10 | 11 | ## [1.1.2](https://github.com/netlify/vite-plugin-netlify-edge/compare/v1.1.1...v1.1.2) (2023-01-13) 12 | 13 | 14 | ### Bug Fixes 15 | 16 | * remove uri encoding from manifest ([9af3fbd](https://github.com/netlify/vite-plugin-netlify-edge/commit/9af3fbdab99bf10114f7a99e3b963f6bf907cf35)) 17 | 18 | ## [1.1.1](https://github.com/netlify/vite-plugin-netlify-edge/compare/v1.1.0...v1.1.1) (2022-10-03) 19 | 20 | 21 | ### Bug Fixes 22 | 23 | * **deps:** update dependency fast-glob to v3.2.12 ([c653804](https://github.com/netlify/vite-plugin-netlify-edge/commit/c653804e4a1e20f451061a9b3c184ded766f9d15)) 24 | 25 | ## [1.1.0](https://github.com/netlify/vite-plugin-netlify-edge/compare/v1.0.0...v1.1.0) (2022-05-11) 26 | 27 | 28 | ### Features 29 | 30 | * allow custom function name ([c3beb84](https://github.com/netlify/vite-plugin-netlify-edge/commit/c3beb84fba5d7f33115d987c153e6e5dc9b8fc31)) 31 | 32 | ## 1.0.0 (2022-05-09) 33 | 34 | 35 | ### Bug Fixes 36 | 37 | * add demo and use base path ([c6b5e6f](https://github.com/netlify/vite-plugin-netlify-edge/commit/c6b5e6fbdf1dff5e59a8c40b7d64c35a2845435f)) 38 | * correct publish config ([5b0ce34](https://github.com/netlify/vite-plugin-netlify-edge/commit/5b0ce34193bd9433332d3d0bd1808cd8bae9c0a5)) 39 | * publish config ([83806dc](https://github.com/netlify/vite-plugin-netlify-edge/commit/83806dc13674d1056d6b6ba11b81982540008513)) 40 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import type { Plugin, ResolvedConfig } from 'vite' 2 | 3 | import fs from 'fs' 4 | import path from 'path' 5 | import glob from 'fast-glob' 6 | 7 | export interface NetlifyEdgePluginOptions { 8 | generateStaticManifest?: boolean 9 | generateEdgeFunctionsManifest?: boolean 10 | additionalStaticPaths?: Array 11 | functionName?: string 12 | } 13 | 14 | const staticManifestModuleId = '@static-manifest' 15 | const resolvedStaticManifestModuleId = '\0' + staticManifestModuleId 16 | const edgeFunctionsDir = '.netlify/edge-functions' 17 | const DEFAULT_FUNCTION_NAME = 'handler' 18 | 19 | const netlifyEdge = ({ 20 | generateStaticManifest = true, 21 | generateEdgeFunctionsManifest = true, 22 | additionalStaticPaths = [], 23 | functionName = DEFAULT_FUNCTION_NAME, 24 | }: NetlifyEdgePluginOptions = {}): Plugin => { 25 | let resolvedConfig: ResolvedConfig 26 | let originalPublicDir: string 27 | 28 | return { 29 | name: 'vite-plugin-netlify-edge', 30 | config(config) { 31 | if (config.build?.ssr) { 32 | originalPublicDir = config.publicDir || 'public' 33 | config.build.outDir ||= path.join(edgeFunctionsDir, functionName) 34 | return { 35 | publicDir: false, 36 | // The types for `ssr` are omitted because it's marked as alpha, but it's still used 37 | ssr: { 38 | target: 'webworker', 39 | noExternal: true, 40 | }, 41 | build: { 42 | rollupOptions: { 43 | output: { 44 | format: 'es', 45 | }, 46 | }, 47 | }, 48 | } 49 | } 50 | }, 51 | configResolved(config) { 52 | resolvedConfig = config 53 | }, 54 | resolveId(id) { 55 | if (generateStaticManifest && id === staticManifestModuleId) { 56 | return resolvedStaticManifestModuleId 57 | } 58 | }, 59 | load(id) { 60 | if (generateStaticManifest && id === resolvedStaticManifestModuleId) { 61 | const files = glob 62 | .sync('**/*', { 63 | cwd: path.resolve(resolvedConfig.root, originalPublicDir), 64 | }) 65 | .map((file) => `${resolvedConfig.base}${file}`) 66 | 67 | return `export default new Set(${JSON.stringify([ 68 | ...files, 69 | ...additionalStaticPaths, 70 | ])})` 71 | } 72 | }, 73 | writeBundle(options) { 74 | // If we're writing to the internal edge functions dir we need to write a manifest 75 | if ( 76 | generateEdgeFunctionsManifest && 77 | resolvedConfig.build.ssr && 78 | // Edge Functions can either be in a subdirectory or directly in the edge functions dir 79 | (options.dir?.endsWith(edgeFunctionsDir) || 80 | options.dir?.endsWith(path.join(edgeFunctionsDir, functionName))) 81 | ) { 82 | const manifest = { 83 | functions: [{ function: functionName, path: '/*' }], 84 | version: 1, 85 | } 86 | // Write the manifest to the edge functions directory 87 | fs.writeFileSync( 88 | path.join(resolvedConfig.root, edgeFunctionsDir, 'manifest.json'), 89 | JSON.stringify(manifest), 90 | 'utf-8' 91 | ) 92 | } 93 | }, 94 | } 95 | } 96 | 97 | export default netlifyEdge 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vite-plugin-netlify-edge 2 | 3 | This plugin helps add support for generating Netlify Edge Functions. This is mostly intended for frameworks that need to generate a catch-all Edge Function to serve all requests. 4 | 5 | # Usage 6 | 7 | Install the plugin: 8 | 9 | ```shell 10 | npm i -D @netlify/vite-plugin-netlify-edge 11 | ``` 12 | 13 | Then add the following to your `.vite.config.js`: 14 | 15 | ```js 16 | // vite.config.js 17 | import { defineConfig } from 'vite' 18 | import netlifyEdge from '@netlify/vite-plugin-netlify-edge' 19 | 20 | export default defineConfig({ 21 | plugins: [netlifyEdge()], 22 | }) 23 | ``` 24 | 25 | By default, it sets `outDir` to `.netlify/edge-functions/handler`, and generates an Edge Functions manifest that defines the `handler` function for all requests. 26 | Passing a value to `functionName` will override this. This will affect the generated manifest and the base directory for the output, but it will not affect the names of the generated bundles. For this reason you should ensure that your entrypoint file is named the same as the function name. 27 | 28 | ```js 29 | // vite.config.js 30 | 31 | // ... 32 | export default defineConfig({ 33 | plugins: [netlifyEdge({ functionName: 'server' })], 34 | }) 35 | ``` 36 | 37 | This generates the file inside `.netlify/edge-functions/server`, and creates a manifest pointing to the `server` function. 38 | 39 | ### Static file handling 40 | 41 | To help with handling static files, it registers a virtual module called `@static-manifest` that exports a `Set` that includes the paths of all files in `publicDir`. This can be used in the handler to identify requests for static files. 42 | 43 | You can disable any of this feature by passing options to the `netlifyEdge()` function: 44 | 45 | ```js 46 | // vite.config.js 47 | 48 | // ... 49 | export default defineConfig({ 50 | plugins: [netlifyEdge({ generateEdgeFunctionsManifest: false })], 51 | }) 52 | ``` 53 | 54 | You can pass additional static paths to the plugin, so that they are also included. They are paths not filenames, so should include a leading slash and be URL-encoded. 55 | 56 | ```js 57 | // vite.config.js 58 | import { defineConfig } from 'vite' 59 | import netlifyEdge from '@netlify/vite-plugin-netlify-edge' 60 | import glob from 'fast-glob' 61 | 62 | export default defineConfig({ 63 | plugins: [ 64 | netlifyEdge({ 65 | additionalStaticPaths: glob 66 | .sync('**/*.{js,css}', { cwd: 'dist/client' }) 67 | .map((path) => `/${encodeURI(path)}`), 68 | }), 69 | ], 70 | }) 71 | ``` 72 | 73 | If you need to add all paths under a directory then it is likely to be more efficient to check the prefix instead of adding all files individually. See the example below, where every path under `/assets/` is served from the CDN. 74 | 75 | In order to use this plugin to create Edge Functions you must define an SSR entrypoint: 76 | 77 | ```js 78 | // handler.js 79 | import { handleRequest } from 'my-framework' 80 | import staticFiles from '@static-manifest' 81 | 82 | export const handler = async (request, { next }) => { 83 | // Handle static files 84 | 85 | const { pathname } = new URL(request.url) 86 | 87 | // If your framework generates client assets in a subdirectory, you can add these too 88 | if (staticFiles.includes(pathname) || pathname.startsWith('assets/')) { 89 | return 90 | } 91 | 92 | // "handleRequest" is defined by your framework 93 | try { 94 | return await handleRequest(request) 95 | } catch (err) { 96 | return new Response(err.message || 'Internal Server Error', { 97 | status: err.status || 500, 98 | }) 99 | } 100 | } 101 | ``` 102 | 103 | You can then build it using the vite CLI: 104 | 105 | ```shell 106 | vite build --ssr handler.js 107 | ``` 108 | 109 | This will generate the Edge Function `.netlify/edge-functions/handler/handler.js` and a manifest file `.netlify/edge-functions/manifest.json` that defines the `handler` function. 110 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig.json to read more about this file */ 4 | /* Projects */ 5 | // "incremental": true, /* Enable incremental compilation */ 6 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 7 | // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ 8 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ 9 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 10 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 11 | /* Language and Environment */ 12 | "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 13 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 14 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 15 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 16 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 17 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ 18 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 19 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ 20 | // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ 21 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 22 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 23 | /* Modules */ 24 | "module": "ES2020", /* Specify what module code is generated. */ 25 | // "rootDir": "./", /* Specify the root folder within your source files. */ 26 | "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 27 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 28 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 29 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 30 | // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ 31 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 32 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 33 | // "resolveJsonModule": true, /* Enable importing .json files */ 34 | // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ 35 | /* JavaScript Support */ 36 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ 37 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 38 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ 39 | /* Emit */ 40 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 41 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 42 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 43 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 44 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ 45 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 46 | // "removeComments": true, /* Disable emitting comments. */ 47 | // "noEmit": true, /* Disable emitting files from a compilation. */ 48 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 49 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ 50 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 51 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 52 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 53 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 54 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 55 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 56 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 57 | // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ 58 | // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ 59 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 60 | // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ 61 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 62 | /* Interop Constraints */ 63 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 64 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 65 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ 66 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 67 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 68 | /* Type Checking */ 69 | "strict": true, /* Enable all strict type-checking options. */ 70 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ 71 | // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ 72 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 73 | // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ 74 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 75 | // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ 76 | // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ 77 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 78 | // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ 79 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ 80 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 81 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 82 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 83 | // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ 84 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 85 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ 86 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 87 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 88 | /* Completeness */ 89 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 90 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 91 | }, 92 | "include": [ 93 | "src/**/*.ts" 94 | ], 95 | } --------------------------------------------------------------------------------