mirror of
https://github.com/troisjs/trois.git
synced 2024-11-23 20:02:32 +08:00
update ts conf
This commit is contained in:
parent
0bfac37f53
commit
79f1512a1e
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"volar.tsPlugin": true
|
||||||
|
}
|
13
api-extractor.json
Normal file
13
api-extractor.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"mainEntryPointFilePath": "./types/export.d.ts",
|
||||||
|
"apiReport": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"docModel": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
"dtsRollup": {
|
||||||
|
"enabled": true,
|
||||||
|
"publicTrimmedFilePath": "./dist/trois.d.ts"
|
||||||
|
}
|
||||||
|
}
|
@ -7,9 +7,9 @@
|
|||||||
"rollup": "rollup -c"
|
"rollup": "rollup -c"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@microsoft/api-extractor": "^7.14.0",
|
||||||
"@rollup/plugin-buble": "^0.21.3",
|
"@rollup/plugin-buble": "^0.21.3",
|
||||||
"@rollup/plugin-replace": "^2.3.3",
|
"@rollup/plugin-replace": "^2.3.3",
|
||||||
"@rollup/plugin-typescript": "^8.2.1",
|
|
||||||
"@types/three": "^0.127.1",
|
"@types/three": "^0.127.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||||
"@typescript-eslint/parser": "^4.22.0",
|
"@typescript-eslint/parser": "^4.22.0",
|
||||||
@ -26,17 +26,20 @@
|
|||||||
"eslint-plugin-vue": "^7.9.0",
|
"eslint-plugin-vue": "^7.9.0",
|
||||||
"gsap": "^3.5.1",
|
"gsap": "^3.5.1",
|
||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
|
"rollup-plugin-typescript2": "^0.30.0",
|
||||||
"rollup-plugin-vue": "^6.0.0-beta.11",
|
"rollup-plugin-vue": "^6.0.0-beta.11",
|
||||||
"stats.js": "0.17.0",
|
"stats.js": "0.17.0",
|
||||||
"three": "^0.127",
|
"three": "^0.127",
|
||||||
"typescript": "^4.1.3",
|
"tslib": "^2.2.0",
|
||||||
|
"typescript": "^4.1.5",
|
||||||
"vite": "^2.1.5",
|
"vite": "^2.1.5",
|
||||||
"vue": "^3.0.11",
|
"vue": "^3.0.11",
|
||||||
"vue-eslint-parser": "^7.6.0",
|
"vue-eslint-parser": "^7.6.0",
|
||||||
"vue-tsc": "^0.0.24"
|
"vue-tsc": "^0.0.25"
|
||||||
},
|
},
|
||||||
"main": "build/trois.js",
|
"main": "build/trois.js",
|
||||||
"module": "build/trois.module.js",
|
"module": "build/trois.module.js",
|
||||||
|
"typings": "build/trois.d.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/troisjs/trois.git"
|
"url": "git+https://github.com/troisjs/trois.git"
|
||||||
|
117
rollup.config.js
117
rollup.config.js
@ -1,11 +1,14 @@
|
|||||||
// import commonjs from '@rollup/plugin-commonjs';
|
import path from 'path'
|
||||||
import vue from 'rollup-plugin-vue'
|
import vue from 'rollup-plugin-vue'
|
||||||
// import buble from '@rollup/plugin-buble';
|
import typescript from 'rollup-plugin-typescript2'
|
||||||
import { terser } from "rollup-plugin-terser"
|
|
||||||
import replace from '@rollup/plugin-replace'
|
import replace from '@rollup/plugin-replace'
|
||||||
import typescript from '@rollup/plugin-typescript'
|
import { terser } from "rollup-plugin-terser"
|
||||||
|
|
||||||
|
// ensure TS checks only once for each build
|
||||||
|
let hasTSChecked = false
|
||||||
|
|
||||||
const input = 'src/export.ts'
|
const input = 'src/export.ts'
|
||||||
|
|
||||||
const external = [
|
const external = [
|
||||||
'three',
|
'three',
|
||||||
'three/examples/jsm/controls/OrbitControls.js',
|
'three/examples/jsm/controls/OrbitControls.js',
|
||||||
@ -37,78 +40,42 @@ const cdnReplaces = {
|
|||||||
delimiters: ['', ''],
|
delimiters: ['', ''],
|
||||||
}
|
}
|
||||||
|
|
||||||
const plugins = [
|
function createConfig(format, output, plugins = []) {
|
||||||
typescript(),
|
const tsPlugin = typescript({
|
||||||
|
check: false, // !hasTSChecked,
|
||||||
|
cacheRoot: path.resolve(__dirname, 'node_modules/.tscache'),
|
||||||
|
tsconfigOverride: {
|
||||||
|
compilerOptions: {
|
||||||
|
sourceMap: false, // !hasTSChecked,
|
||||||
|
declaration: false, // !hasTSChecked,
|
||||||
|
declarationMap: false, // !hasTSChecked,
|
||||||
|
},
|
||||||
|
include: [input],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
hasTSChecked = true
|
||||||
|
|
||||||
|
return {
|
||||||
|
input,
|
||||||
|
external,
|
||||||
|
output: {
|
||||||
|
format,
|
||||||
|
...output,
|
||||||
|
// exports: 'named',
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
tsPlugin,
|
||||||
vue(),
|
vue(),
|
||||||
// buble({
|
...plugins,
|
||||||
// transforms: { asyncAwait: false, forOf: false },
|
],
|
||||||
// objectAssign: 'Object.assign',
|
}
|
||||||
// }),
|
}
|
||||||
]
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
createConfig('es', { file: 'build/trois.module.cdn.js' }, [replace(cdnReplaces)]),
|
||||||
input,
|
createConfig('es', { file: 'build/trois.module.cdn.min.js' }, [replace(cdnReplaces), terser()]),
|
||||||
external,
|
createConfig('es', { file: 'build/trois.module.js' }),
|
||||||
output: {
|
createConfig('es', { file: 'build/trois.module.min.js' }, [terser()]),
|
||||||
format: 'es',
|
createConfig('cjs', { file: 'build/trois.js' }),
|
||||||
exports: 'named',
|
|
||||||
file: 'build/trois.module.cdn.js',
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
replace(cdnReplaces),
|
|
||||||
...plugins,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
external,
|
|
||||||
output: {
|
|
||||||
format: 'es',
|
|
||||||
exports: 'named',
|
|
||||||
file: 'build/trois.module.cdn.min.js',
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
replace(cdnReplaces),
|
|
||||||
...plugins,
|
|
||||||
terser(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
external,
|
|
||||||
output: {
|
|
||||||
format: 'es',
|
|
||||||
exports: 'named',
|
|
||||||
file: 'build/trois.module.js',
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
external,
|
|
||||||
output: {
|
|
||||||
format: 'es',
|
|
||||||
exports: 'named',
|
|
||||||
file: 'build/trois.module.min.js',
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
...plugins,
|
|
||||||
terser(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
input,
|
|
||||||
external,
|
|
||||||
output: {
|
|
||||||
format: 'cjs',
|
|
||||||
file: 'build/trois.js',
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins,
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
@ -5,8 +5,17 @@
|
|||||||
// this enables stricter inference for data properties on `this`
|
// this enables stricter inference for data properties on `this`
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
|
||||||
|
// "esModuleInterop": true,
|
||||||
|
// "lib": ["esnext", "dom"],
|
||||||
|
// "types": ["vite/client"],
|
||||||
|
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"outDir": "types",
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.vue"],
|
"include": ["src/**/*.ts", "src/**/*.vue"],
|
||||||
"exclude": ["node_modules", "src/App.vue"]
|
// "include": ["src/export.ts"],
|
||||||
|
// "exclude": ["src/App.vue", "src/main.ts"],
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user