UNPKG

kt-extendscript-builder

Version:

Vite based builder for transpile TypeScript to ExtendScript

17 lines (16 loc) 690 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.rollupRemoveExports = void 0; const rollupRemoveExports = () => ({ name: 'remove-exports', generateBundle(options, bundle) { for (const fileName of Object.keys(bundle)) { const chunk = bundle[fileName]; if (chunk.type === 'chunk') { // Modify the final file code chunk.code = chunk.code.replace(/(^|\n)\s*export\s+(default\s+)?({[^}]+}|\w+\s*(=|\([^)]*\))?.*?(;|\n|$)|class\s+\w+\s*{[\s\S]*?}|\s*function\s+\w+\s*\([^)]*\)\s*{[\s\S]*?});/g, '$1'); } } } }); exports.rollupRemoveExports = rollupRemoveExports;