remove-mangle.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts
  2. index 948c6b4..66ecdd3 100644
  3. --- a/build/lib/compilation.ts
  4. +++ b/build/lib/compilation.ts
  5. @@ -131,27 +131,3 @@ export function compileTask(src: string, out: string, build: boolean, options: {
  6. - // mangle: TypeScript to TypeScript
  7. - let mangleStream = es.through();
  8. - if (build && !options.disableMangle) {
  9. - let ts2tsMangler: Mangler | undefined = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
  10. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  11. - mangleStream = es.through(async function write(data: File & { sourceMap?: RawSourceMap }) {
  12. - type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
  13. - const tsNormalPath = (ts as TypeScriptExt).normalizePath(data.path);
  14. - const newContents = (await newContentsByFileName).get(tsNormalPath);
  15. - if (newContents !== undefined) {
  16. - data.contents = Buffer.from(newContents.out);
  17. - data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
  18. - }
  19. - this.push(data);
  20. - }, async function end() {
  21. - // free resources
  22. - (await newContentsByFileName).clear();
  23. -
  24. - this.push(null);
  25. - ts2tsMangler = undefined;
  26. - });
  27. - }
  28. -
  29. return srcPipe
  30. - .pipe(mangleStream)
  31. .pipe(generator.stream)