| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| { | |||||
| "name": "threepipe-plugin-template-vite", | |||||
| "description": "Sample Threepipe plugin using vite", | |||||
| "version": "0.1.0", | |||||
| "devDependencies": { | |||||
| }, | |||||
| "dependencies": { | |||||
| "threepipe": "file:./../../src/", | |||||
| "@threepipe/plugin-tweakpane": "file:./../tweakpane/src/" | |||||
| }, | |||||
| "clean-package": { | |||||
| "remove": [ | |||||
| "clean-package", | |||||
| "scripts", | |||||
| "devDependencies", | |||||
| "//", | |||||
| "markdown-to-html" | |||||
| ], | |||||
| "replace": { | |||||
| "dependencies": { | |||||
| "threepipe": "^0.0.25", | |||||
| "@threepipe/plugin-tweakpane": "^0.2.1" | |||||
| } | |||||
| } | |||||
| }, | |||||
| "type": "module", | |||||
| "main": "dist/index.js", | |||||
| "module": "dist/index.mjs", | |||||
| "types": "dist/index.d.ts", | |||||
| "files": [ | |||||
| "dist", | |||||
| "src" | |||||
| ], | |||||
| "scripts": { | |||||
| "new:pack": "npm run prepare && clean-package && npm pack && clean-package restore", | |||||
| "new:publish": "npm run prepare && clean-package && npm publish --access public && clean-package restore", | |||||
| "prepare": "npm run build", | |||||
| "build": "rimraf dist && vite build", | |||||
| "dev": "NODE_ENV=development vite build --watch", | |||||
| "docs": "rimraf docs && npx typedoc" | |||||
| }, | |||||
| "author": "repalash <palash@shaders.app>", | |||||
| "license": "Apache-2.0", | |||||
| "keywords": [ | |||||
| "three", | |||||
| "three.js", | |||||
| "threepipe", | |||||
| "vite", | |||||
| "plugin" | |||||
| ], | |||||
| "bugs": { | |||||
| "url": "https://github.com/repalash/threepipe/issues" | |||||
| }, | |||||
| "homepage": "https://github.com/repalash/threepipe#readme", | |||||
| "repository": { | |||||
| "type": "git", | |||||
| "url": "git://github.com/repalash/threepipe.git" | |||||
| } | |||||
| } |
| html{ | |||||
| } |
| import {AViewerPluginSync, createStyles, ThreeViewer,} from 'threepipe' | |||||
| import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane' | |||||
| import styles from './SamplePlugin.css?inline' | |||||
| console.log(TweakpaneUiPlugin) | |||||
| export class SamplePlugin extends AViewerPluginSync<string> { | |||||
| public static readonly PluginType: string = 'SamplePlugin' | |||||
| enabled = true | |||||
| dependencies = [] | |||||
| constructor() { | |||||
| super() | |||||
| } | |||||
| onAdded(viewer: ThreeViewer) { | |||||
| super.onAdded(viewer) | |||||
| createStyles(styles) | |||||
| } | |||||
| } |
| declare module '*.txt' { | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| declare module '*.glsl' { | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| declare module '*.vert' { | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| declare module '*.frag' { | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| declare module '*.module.scss' { | |||||
| const content: any | |||||
| export default content | |||||
| export const stylesheet: string | |||||
| } | |||||
| declare module '*.module.css' { | |||||
| const content: any | |||||
| export default content | |||||
| export const stylesheet: string | |||||
| } | |||||
| declare module '*.css' { | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| declare module '*.css?inline' { // for vite | |||||
| const content: string | |||||
| export default content | |||||
| } | |||||
| // export {} | |||||
| // hack for typedoc | |||||
| // eslint-disable-next-line @typescript-eslint/naming-convention | |||||
| // declare type OffscreenCanvas = HTMLCanvasElement |
| export {SamplePlugin} from './SamplePlugin' |
| { | |||||
| "compilerOptions": { | |||||
| "baseUrl": "./src", | |||||
| "rootDir": "./src", | |||||
| "allowJs": true, | |||||
| "checkJs": false, | |||||
| "skipLibCheck": true, | |||||
| "allowSyntheticDefaultImports": true, | |||||
| "experimentalDecorators": true, | |||||
| "isolatedModules": true, | |||||
| "module": "es2020", | |||||
| "noImplicitAny": true, | |||||
| "declaration": true, | |||||
| "declarationMap": true, | |||||
| "declarationDir": "dist", | |||||
| "outDir": "dist", | |||||
| "noImplicitThis": true, | |||||
| "noUnusedLocals": true, | |||||
| "noUnusedParameters": true, | |||||
| "removeComments": false, | |||||
| "preserveConstEnums": true, | |||||
| "moduleResolution": "node", | |||||
| "emitDecoratorMetadata": false, | |||||
| "sourceMap": true, | |||||
| "target": "ES2021", | |||||
| "strictNullChecks": true, | |||||
| "lib": [ | |||||
| "es2020", | |||||
| "esnext", | |||||
| "dom" | |||||
| ] | |||||
| }, | |||||
| "include": [ | |||||
| "src/**/*" | |||||
| ], | |||||
| "exclude": [ | |||||
| "node_modules", | |||||
| "**/*.spec.ts", | |||||
| "dist" | |||||
| ] | |||||
| } |
| { | |||||
| "extends": [ | |||||
| "../../typedoc.json" | |||||
| ], | |||||
| "entryPoints": [ | |||||
| "src/index.ts" | |||||
| ], | |||||
| "name": "Threepipe Gaussian Splatting Plugin", | |||||
| "readme": "none" | |||||
| } |
| import {defineConfig} from 'vite' | |||||
| import json from '@rollup/plugin-json'; | |||||
| import dts from 'vite-plugin-dts' | |||||
| import packageJson from './package.json'; | |||||
| import license from 'rollup-plugin-license'; | |||||
| import replace from '@rollup/plugin-replace'; | |||||
| import glsl from 'rollup-plugin-glsl'; | |||||
| import path from 'node:path'; | |||||
| const isProd = process.env.NODE_ENV === 'production' | |||||
| const { name, version, author } = packageJson | |||||
| const {main, module, browser} = packageJson | |||||
| const globals = { | |||||
| 'three': 'threepipe', // just incase someone uses three | |||||
| 'threepipe': 'threepipe', | |||||
| '@threepipe/plugin-tweakpane': '@threepipe/plugin-tweakpane', | |||||
| } | |||||
| export default defineConfig({ | |||||
| optimizeDeps: { | |||||
| exclude: ['uiconfig.js', 'ts-browser-helpers'], | |||||
| }, | |||||
| base: '', | |||||
| // define: { | |||||
| // 'process.env': process.env | |||||
| // }, | |||||
| build: { | |||||
| sourcemap: true, | |||||
| minify: false, | |||||
| cssMinify: isProd, | |||||
| cssCodeSplit: false, | |||||
| watch: !isProd ? { | |||||
| buildDelay: 1000, | |||||
| } : null, | |||||
| lib: { | |||||
| entry: 'src/index.ts', | |||||
| formats: isProd ? ['es', 'umd'] : ['es'], | |||||
| name: name, | |||||
| fileName: (format) => (format === 'umd' ? main : module).replace('dist/', ''), | |||||
| }, | |||||
| outDir: 'dist', | |||||
| emptyOutDir: isProd, | |||||
| commonjsOptions: { | |||||
| exclude: [/uiconfig.js/, /ts-browser-helpers/], | |||||
| }, | |||||
| rollupOptions: { | |||||
| output: { | |||||
| // inlineDynamicImports: false, | |||||
| globals, | |||||
| }, | |||||
| external: Object.keys(globals), | |||||
| }, | |||||
| }, | |||||
| plugins: [ | |||||
| isProd ? dts({tsconfigPath: './tsconfig.json'}) : null, | |||||
| replace({ | |||||
| 'from \'three\'': 'from \'threepipe\'', | |||||
| delimiters: ['', ''], | |||||
| }), | |||||
| replace({ | |||||
| 'process.env.NODE_ENV': JSON.stringify(isProd ? 'production' : 'development'), | |||||
| preventAssignment: true, | |||||
| }), | |||||
| glsl({ // todo: minify glsl. | |||||
| include: 'src/**/*.glsl', | |||||
| }), | |||||
| json(), | |||||
| // postcss({ | |||||
| // modules: false, | |||||
| // autoModules: true, // todo; issues with typescript import css, because inject is false | |||||
| // inject: false, | |||||
| // minimize: isProduction, | |||||
| // // Or with custom options for `postcss-modules` | |||||
| // }), | |||||
| license({ | |||||
| banner: ` | |||||
| @license | |||||
| ${name} v${version} | |||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | |||||
| ${packageJson.license} License | |||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | |||||
| thirdParty: { | |||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | |||||
| includePrivate: true, // Default is false. | |||||
| }, | |||||
| }), | |||||
| ], | |||||
| }) |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for any bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |
| ${name} v${version} | ${name} v${version} | ||||
| Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | Copyright 2022<%= moment().format('YYYY') > 2022 ? '-' + moment().format('YYYY') : null %> ${author} | ||||
| ${packageJson.license} License | ${packageJson.license} License | ||||
| See ./dependencies.txt for bundled third-party dependencies and licenses. | |||||
| `, | `, | ||||
| thirdParty: { | thirdParty: { | ||||
| output: path.join(__dirname, 'dist', 'dependencies.txt'), | output: path.join(__dirname, 'dist', 'dependencies.txt'), |