first implementation
This commit is contained in:
21
frontend/node_modules/@vue/tsconfig/LICENSE
generated
vendored
Normal file
21
frontend/node_modules/@vue/tsconfig/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022-present vuejs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
100
frontend/node_modules/@vue/tsconfig/README.md
generated
vendored
Normal file
100
frontend/node_modules/@vue/tsconfig/README.md
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
# `@vue/tsconfig`
|
||||
|
||||
TSConfigs for Vue projects to extend.
|
||||
|
||||
Requires TypeScript >= 5.0. For TypeScript v4.5 to v4.9, please use [v0.1.x](https://www.npmjs.com/package/@vue/tsconfig/v/0.1.3).
|
||||
|
||||
[See below for the changes in v0.3.x.](#migrating-from-typescript--50)
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm add -D @vue/tsconfig
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add one of the available configurations to your `tsconfig.json`:
|
||||
|
||||
### The Base Configuration (Runtime-agnostic)
|
||||
|
||||
```json
|
||||
"extends": "@vue/tsconfig/tsconfig.json"
|
||||
```
|
||||
|
||||
### Configuration for Browser Environment
|
||||
|
||||
```json
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json"
|
||||
```
|
||||
|
||||
### Configuration for Node Environments
|
||||
|
||||
First install the base tsconfig and types for the Node.js version you are targeting, for example:
|
||||
|
||||
```sh
|
||||
npm add -D @tsconfig/node18 @types/node@18
|
||||
```
|
||||
|
||||
If you are not using any bundlers, the Node.js code doesn't rely on any Vue/Vite-specific features, then these would be enough, you may not need to extend the Vue TSConfig:
|
||||
|
||||
```json
|
||||
"extends": "@tsconfig/node18/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
}
|
||||
```
|
||||
|
||||
Otherwise, if you are trying to use Vue components in Node.js environments (e.g. Server Side Rendering, Vitest, etc.), you will need to extend the Vue TSConfig along with the Node.js TSConfig:
|
||||
|
||||
```json
|
||||
"extends": [
|
||||
"@tsconfig/node18/tsconfig.json",
|
||||
"@vue/tsconfig/tsconfig.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to place `@vue/tsconfig/tsconfig.json` *after* `@tsconfig/node18/tsconfig.json` so that it takes precedence.
|
||||
|
||||
## Emitting Declaration Files
|
||||
|
||||
As most Vue projects are built with bundlers, the default Vue TSConfig does not emit declaration files. If you are building a library or a component library, you can enable declaration file emitting by also extending `@vue/tsconfig/tsconfig.lib.json` in your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"extends": [
|
||||
"@vue/tsconfig/tsconfig.dom.json",
|
||||
"@vue/tsconfig/tsconfig.lib.json"
|
||||
]
|
||||
```
|
||||
|
||||
## Migrating from TypeScript < 5.0
|
||||
|
||||
- The usage of base `tsconfig.json` is unchanged.
|
||||
- `tsconfig.web.json` is now renamed to `tsconfig.dom.json`, to align with `@vue/runtime-dom` and `@vue/compiler-dom`.
|
||||
- `tsconfig.node.json` is removed, please read the [Node.js section](#configuration-for-node-environments) above for Node.js usage.
|
||||
|
||||
Some configurations have been updated, which might affect your projects:
|
||||
|
||||
- `moduleResolution` changed from `node` to [`bundler`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#moduleresolution-bundler). This aligns more closely to the actual resolution rules in modern bundlers like Vite. However, some existing code may be broken under this new mode
|
||||
- Most notably, it implies [`"resolvePackageJsonExports": true`](https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports) by default, so it prefers the [`exports` field of `package.json` files](https://nodejs.org/api/packages.html#exports) when resolving a third party module.
|
||||
- Some third party packages may not have this field set up correctly, but the bugs were previously hidden by the `node` mode.
|
||||
- Some notable packages include `vue-i18n@9.2.2`, `vuetify@3.2.3`, `v-calendar@3.0.3`, etc.
|
||||
- While `vue-i18n` [has fixed this issue in v9.3 beta](https://github.com/intlify/vue-i18n-next/issues/1327#issuecomment-1539491735), and vuetify [will solve the issue in v3.3](https://github.com/vuetifyjs/vuetify/commit/5e08832fabe80ddc839907d13c7279a091ddfee5), other packages may not be so quick to fix. In that case, you can override the `compilerOptions.resolvePackageJsonExports` option to `false` in your `tsconfig.json` to temporarily work around the issue.
|
||||
- But we encourage you to submit PRs to these packages to fix the bugs, so that we can all move forward to the new resolution mode. You can use tools like [`publint`](https://publint.dev/) and [Are the types wrong?](https://arethetypeswrong.github.io/) to help you find and debug the issues.
|
||||
- Another small breaking change is that `--moduleResolution bundler` does not support resolution of `require` calls. In TypeScript files, this means the `import mod = require("foo”)` syntax is forbidden.
|
||||
- The `lib` option in `tsconfig.dom.json` now includes `ES2020` by default.
|
||||
- Previously it was ES2016, which was the lowest ES version that Vue 3 supports.
|
||||
- Vite 4 transpiles down to ES2020 by default, this new default is to align with the build tool.
|
||||
- This change won't throw any new errors on your existing code, but if you are targeting old browsers and want TypeScript to throw errors on newer features used, you can override the `lib` option in your `tsconfig.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2016", "DOM", "DOM.Iterable"]
|
||||
}
|
||||
}
|
||||
```
|
||||
26
frontend/node_modules/@vue/tsconfig/package.json
generated
vendored
Normal file
26
frontend/node_modules/@vue/tsconfig/package.json
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@vue/tsconfig",
|
||||
"version": "0.5.1",
|
||||
"description": "A base TSConfig for working with Vue.js",
|
||||
"main": "tsconfig.json",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/tsconfig.git"
|
||||
},
|
||||
"keywords": [
|
||||
"vue",
|
||||
"tsconfig"
|
||||
],
|
||||
"author": "Haoqun Jiang <npm@haoqun.me>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/tsconfig/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/tsconfig#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
}
|
||||
}
|
||||
22
frontend/node_modules/@vue/tsconfig/tsconfig.dom.json
generated
vendored
Normal file
22
frontend/node_modules/@vue/tsconfig/tsconfig.dom.json
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
// Target ES2020 to align with Vite.
|
||||
// <https://vitejs.dev/config/build-options.html#build-target>
|
||||
// Support for newer versions of language built-ins are
|
||||
// left for the users to include, because that would require:
|
||||
// - either the project doesn't need to support older versions of browsers;
|
||||
// - or the project has properly included the necessary polyfills.
|
||||
"ES2020",
|
||||
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
|
||||
// No `ScriptHost` because Vue 3 dropped support for IE
|
||||
],
|
||||
|
||||
// Set to empty to avoid accidental inclusion of unwanted types
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
68
frontend/node_modules/@vue/tsconfig/tsconfig.json
generated
vendored
Normal file
68
frontend/node_modules/@vue/tsconfig/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Most non-library projects don't need to emit declarations.
|
||||
// So we add this option by default to make the config more friendly to most users.
|
||||
"noEmit": true,
|
||||
// When type-checking with solution-style tsconfigs, though with `noEmit: true`, there won't
|
||||
// be any `.d.ts` files emitted, but tsc still writes a `.tsbuildinfo` file to the `outDir`
|
||||
// for each project. If we don't explicitly set the `outDir`, it will be in the same folder
|
||||
// as the `tsconfig.json` file, which would look messy.
|
||||
// Setting it to `./dist/` isn't ideal either, because it would pollute the `dist` folder.
|
||||
// So we set it to a hidden folder in `node_modules` to avoid polluting the project root.
|
||||
// FIXME:
|
||||
// This caused a regression: https://github.com/vuejs/tsconfig/issues/27
|
||||
// Need to find a better solution.
|
||||
// "outDir": "./node_modules/.cache/vue-tsbuildinfo",
|
||||
|
||||
// As long as you are using a build tool, we recommend you to author and ship in ES modules.
|
||||
// Even if you are targeting Node.js, because
|
||||
// - `CommonJS` is too outdated
|
||||
// - the ecosystem hasn't fully caught up with `Node16`/`NodeNext`
|
||||
// This recommendation includes environments like Vitest, Vite Config File, Vite SSR, etc.
|
||||
"module": "ESNext",
|
||||
|
||||
// We expect users to use bundlers.
|
||||
// So here we enable some resolution features that are only available in bundlers.
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
// `allowImportingTsExtensions` can only be used when `noEmit` or `emitDeclarationOnly` is set.
|
||||
// But `noEmit` may cause problems with solution-style tsconfigs:
|
||||
// <https://github.com/microsoft/TypeScript/issues/49844>
|
||||
// And `emitDeclarationOnly` is not always wanted.
|
||||
// Considering it's not likely to be commonly used in Vue codebases, we don't enable it here.
|
||||
|
||||
// Required in Vue projects
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "vue",
|
||||
|
||||
// `"noImplicitThis": true` is part of `strict`
|
||||
// Added again here in case some users decide to disable `strict`.
|
||||
// This enables stricter inference for data properties on `this`.
|
||||
"noImplicitThis": true,
|
||||
"strict": true,
|
||||
|
||||
// <https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#verbatimmodulesyntax>
|
||||
// Any imports or exports without a type modifier are left around. This is important for `<script setup>`.
|
||||
// Anything that uses the type modifier is dropped entirely.
|
||||
"verbatimModuleSyntax": true,
|
||||
|
||||
// A few notes:
|
||||
// - Vue 3 supports ES2016+
|
||||
// - For Vite, the actual compilation target is determined by the
|
||||
// `build.target` option in the Vite config.
|
||||
// So don't change the `target` field here. It has to be
|
||||
// at least `ES2020` for dynamic `import()`s and `import.meta` to work correctly.
|
||||
// - If you are not using Vite, feel free to overwrite the `target` field.
|
||||
"target": "ESNext",
|
||||
// For spec compilance.
|
||||
// `true` by default if the `target` is `ES2020` or higher.
|
||||
// Explicitly set it to `true` here in case some users want to overwrite the `target`.
|
||||
"useDefineForClassFields": true,
|
||||
|
||||
// Recommended
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
// See <https://github.com/vuejs/vue-cli/pull/5688>
|
||||
"skipLibCheck": true,
|
||||
}
|
||||
}
|
||||
7
frontend/node_modules/@vue/tsconfig/tsconfig.lib.json
generated
vendored
Normal file
7
frontend/node_modules/@vue/tsconfig/tsconfig.lib.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user