Add JSON DTS plugin

This commit is contained in:
thepaperpilot 2022-10-14 07:57:18 -05:00
parent 30b1e87bd5
commit 1c1944a83d
7 changed files with 77 additions and 4 deletions

2
.gitignore vendored
View file

@ -21,3 +21,5 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?
**/*.json.d.ts

68
package-lock.json generated
View file

@ -48,6 +48,7 @@
"jsdom": "^20.0.0",
"prettier": "^2.5.1",
"typescript": "^4.7.4",
"unplugin-json-dts": "^1.2.0",
"vitest": "^0.17.1",
"vue-tsc": "^0.38.1"
},
@ -6558,6 +6559,43 @@
"node": ">= 4.0.0"
}
},
"node_modules/unplugin": {
"version": "0.2.21",
"resolved": "https://registry.npmjs.org/unplugin/-/unplugin-0.2.21.tgz",
"integrity": "sha512-IJ15/L5XbhnV7J09Zjk0FT5HEkBjkXucWAXQWRsmEtUxmmxwh23yavrmDbCF6ZPxWiVB28+wnKIHePTRRpQPbQ==",
"dev": true,
"dependencies": {
"webpack-virtual-modules": "^0.4.3"
},
"peerDependencies": {
"rollup": "^2.50.0",
"vite": "^2.3.0",
"webpack": "4 || 5"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
},
"vite": {
"optional": true
},
"webpack": {
"optional": true
}
}
},
"node_modules/unplugin-json-dts": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/unplugin-json-dts/-/unplugin-json-dts-1.2.0.tgz",
"integrity": "sha512-IDw1l9RV61CCK5khlayGaSUMti1NpPmhmdP2OiyvAZ+XxnJ1xOj8hGQRAJibSOh+emx2j9ahbFdP6KZ5iczwPA==",
"dev": true,
"dependencies": {
"unplugin": "^0.2.19"
},
"engines": {
"node": ">=14.16"
}
},
"node_modules/upath": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
@ -6935,6 +6973,12 @@
"node": ">=12"
}
},
"node_modules/webpack-virtual-modules": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.4.4.tgz",
"integrity": "sha512-h9atBP/bsZohWpHnr+2sic8Iecb60GxftXsWNLLLSqewgIsGzByd2gcIID4nXcG+3tNe4GQG3dLcff3kXupdRA==",
"dev": true
},
"node_modules/whatwg-encoding": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
@ -11878,6 +11922,24 @@
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
"dev": true
},
"unplugin": {
"version": "0.2.21",
"resolved": "https://registry.npmjs.org/unplugin/-/unplugin-0.2.21.tgz",
"integrity": "sha512-IJ15/L5XbhnV7J09Zjk0FT5HEkBjkXucWAXQWRsmEtUxmmxwh23yavrmDbCF6ZPxWiVB28+wnKIHePTRRpQPbQ==",
"dev": true,
"requires": {
"webpack-virtual-modules": "^0.4.3"
}
},
"unplugin-json-dts": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/unplugin-json-dts/-/unplugin-json-dts-1.2.0.tgz",
"integrity": "sha512-IDw1l9RV61CCK5khlayGaSUMti1NpPmhmdP2OiyvAZ+XxnJ1xOj8hGQRAJibSOh+emx2j9ahbFdP6KZ5iczwPA==",
"dev": true,
"requires": {
"unplugin": "^0.2.19"
}
},
"upath": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz",
@ -12135,6 +12197,12 @@
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"dev": true
},
"webpack-virtual-modules": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.4.4.tgz",
"integrity": "sha512-h9atBP/bsZohWpHnr+2sic8Iecb60GxftXsWNLLLSqewgIsGzByd2gcIID4nXcG+3tNe4GQG3dLcff3kXupdRA==",
"dev": true
},
"whatwg-encoding": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",

View file

@ -5,7 +5,7 @@
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"build": "vite build",
"preview": "vite preview",
"test": "vitest run",
"testw": "vitest",
@ -52,6 +52,7 @@
"jsdom": "^20.0.0",
"prettier": "^2.5.1",
"typescript": "^4.7.4",
"unplugin-json-dts": "^1.2.0",
"vitest": "^0.17.1",
"vue-tsc": "^0.38.1"
},

@ -1 +1 @@
Subproject commit 5ff958fd80fbfc486d7fcf82540b364af02a80da
Subproject commit 5124699656d63321b761f074d2024a51f3481f1f

View file

@ -202,7 +202,7 @@ function exportSave(id: string) {
} else {
saveToExport = JSON.stringify(saves.value[id]);
}
switch (projInfo.exportEncoding) {
switch (projInfo.exportEncoding as string) {
default:
console.warn(`Unknown save encoding: ${projInfo.exportEncoding}. Defaulting to lz`);
case "lz":

View file

@ -25,7 +25,7 @@ declare global {
document.title = projInfo.title;
window.projInfo = projInfo;
if (projInfo.id === "") {
if ((projInfo.id as string) === "") {
throw "Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json";
}

View file

@ -4,6 +4,7 @@ import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import tsconfigPaths from "vite-tsconfig-paths";
import projInfo from "./src/data/projInfo.json";
import jsonDts from "unplugin-json-dts/vite";
// https://vitejs.dev/config/
export default defineConfig({
@ -29,6 +30,7 @@ export default defineConfig({
vueJsx({
// options are passed on to @vue/babel-plugin-jsx
}),
jsonDts(),
tsconfigPaths(),
VitePWA({
includeAssets: ["Logo.svg", "favicon.ico", "robots.txt", "apple-touch-icon.png"],