UNPKG

kt-extendscript-builder

Version:

Vite based builder for transpile TypeScript to ExtendScript

20 lines (19 loc) 884 B
"use strict"; //This plugin is deprecaded, but we keep it for backward compatibility // and for the sake of the tests. It will be removed in the future. Object.defineProperty(exports, "__esModule", { value: true }); exports.rollupPluginRemoveExports = void 0; const rollupPluginRemoveExports = () => ({ 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.rollupPluginRemoveExports = rollupPluginRemoveExports; // alias: 'ponyfills',