refactor(vue): use ts rollup plugin

This commit is contained in:
Liam DeBeasi
2023-11-01 13:16:00 -04:00
parent f6a6877044
commit 4dd069282b
4 changed files with 89 additions and 6 deletions

View File

@ -16,6 +16,7 @@
"@babel/types": "^7.18.4", "@babel/types": "^7.18.4",
"@ionic/eslint-config": "^0.3.0", "@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0", "@ionic/prettier-config": "^2.0.0",
"@rollup/plugin-typescript": "^11.1.5",
"@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2", "@typescript-eslint/parser": "^5.48.2",
"change-case": "^4.1.1", "change-case": "^4.1.1",
@ -422,6 +423,54 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@rollup/plugin-typescript": {
"version": "11.1.5",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz",
"integrity": "sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"resolve": "^1.22.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^2.14.0||^3.0.0||^4.0.0",
"tslib": "*",
"typescript": ">=3.7.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
},
"tslib": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.5.tgz",
"integrity": "sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==",
"dev": true,
"dependencies": {
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@stencil/core": { "node_modules/@stencil/core": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz", "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz",
@ -434,6 +483,12 @@
"npm": ">=7.10.0" "npm": ">=7.10.0"
} }
}, },
"node_modules/@types/estree": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz",
"integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==",
"dev": true
},
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
@ -3872,11 +3927,38 @@
"fastq": "^1.6.0" "fastq": "^1.6.0"
} }
}, },
"@rollup/plugin-typescript": {
"version": "11.1.5",
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.5.tgz",
"integrity": "sha512-rnMHrGBB0IUEv69Q8/JGRD/n4/n6b3nfpufUu26axhUcboUzv/twfZU8fIBbTOphRAe0v8EyxzeDpKXqGHfyDA==",
"dev": true,
"requires": {
"@rollup/pluginutils": "^5.0.1",
"resolve": "^1.22.1"
}
},
"@rollup/pluginutils": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.5.tgz",
"integrity": "sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==",
"dev": true,
"requires": {
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^2.3.1"
}
},
"@stencil/core": { "@stencil/core": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz", "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.6.0.tgz",
"integrity": "sha512-5Y6/fP28aspPDRB+Tz5GuB1jRVGuUEk5/rnyE8ACGcuzEOG+zR0A/IHRJSU3XmCxUlVDKfKoO6St5W84oUCVMA==" "integrity": "sha512-5Y6/fP28aspPDRB+Tz5GuB1jRVGuUEk5/rnyE8ACGcuzEOG+zR0A/IHRJSU3XmCxUlVDKfKoO6St5W84oUCVMA=="
}, },
"@types/estree": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.4.tgz",
"integrity": "sha512-2JwWnHK9H+wUZNorf2Zr6ves96WHoWDJIftkcxPKsS7Djta6Zu519LarhRNljPXkpsZR2ZMwNCPeW7omW07BJw==",
"dev": true
},
"@types/json-schema": { "@types/json-schema": {
"version": "7.0.11", "version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",

View File

@ -8,11 +8,9 @@
"lint": "npm run eslint && npm run prettier -- --write --cache", "lint": "npm run eslint && npm run prettier -- --write --cache",
"lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache", "lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache",
"test": "jest", "test": "jest",
"build": "npm run clean && npm run copy && npm run copy.overlays && npm run compile && npm run bundle && npm run build.vetur && npm run build.web-types", "build": "npm run clean && npm run copy && npm run copy.overlays && npm run bundle && npm run build.vetur && npm run build.web-types",
"bundle": "rollup --config rollup.config.js", "bundle": "rollup --config rollup.config.js",
"clean": "rimraf dist dist-transpiled", "clean": "rimraf dist dist",
"compile": "npm run tsc",
"tsc": "tsc -p .",
"build.web-types": "node ./scripts/build-web-types.js", "build.web-types": "node ./scripts/build-web-types.js",
"build.vetur": "node ./scripts/build-vetur.js", "build.vetur": "node ./scripts/build-vetur.js",
"copy": "node ./scripts/copy-css.js", "copy": "node ./scripts/copy-css.js",
@ -53,6 +51,7 @@
"@babel/types": "^7.18.4", "@babel/types": "^7.18.4",
"@ionic/eslint-config": "^0.3.0", "@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0", "@ionic/prettier-config": "^2.0.0",
"@rollup/plugin-typescript": "^11.1.5",
"@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2", "@typescript-eslint/parser": "^5.48.2",
"change-case": "^4.1.1", "change-case": "^4.1.1",

View File

@ -1,7 +1,8 @@
import typescript from '@rollup/plugin-typescript';
const external = ['vue', 'vue-router']; const external = ['vue', 'vue-router'];
export default { export default {
input: 'dist-transpiled/index.js', input: 'src/index.ts',
output: [ output: [
{ {
dir: 'dist/', dir: 'dist/',
@ -11,5 +12,6 @@ export default {
sourcemap: true sourcemap: true
}, },
], ],
plugins: [typescript()],
external: id => external.includes(id) || id.startsWith('@ionic/core') || id.startsWith('ionicons') external: id => external.includes(id) || id.startsWith('@ionic/core') || id.startsWith('ionicons')
}; };

View File

@ -13,7 +13,7 @@
"noImplicitReturns": false, "noImplicitReturns": false,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"outDir": "dist-transpiled", "outDir": "dist",
"declarationDir": "dist/types", "declarationDir": "dist/types",
"removeComments": false, "removeComments": false,
"sourceMap": true, "sourceMap": true,