remove-mangle.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. diff --git a/build/lib/compilation.js b/build/lib/compilation.js
  2. index 2270e05..1bd7b90 100644
  3. --- a/build/lib/compilation.js
  4. +++ b/build/lib/compilation.js
  5. @@ -104,24 +104,3 @@ function compileTask(src, out, build, options = {}) {
  6. }
  7. - // mangle: TypeScript to TypeScript
  8. - let mangleStream = es.through();
  9. - if (build && !options.disableMangle) {
  10. - let ts2tsMangler = new index_1.Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
  11. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  12. - mangleStream = es.through(async function write(data) {
  13. - const tsNormalPath = ts.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. - this.push(null);
  24. - ts2tsMangler = undefined;
  25. - });
  26. - }
  27. return srcPipe
  28. - .pipe(mangleStream)
  29. .pipe(generator.stream)
  30. diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts
  31. index d5da3f1..fa46962 100644
  32. --- a/build/lib/compilation.ts
  33. +++ b/build/lib/compilation.ts
  34. @@ -123,27 +123,3 @@ export function compileTask(src: string, out: string, build: boolean, options: {
  35. - // mangle: TypeScript to TypeScript
  36. - let mangleStream = es.through();
  37. - if (build && !options.disableMangle) {
  38. - let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
  39. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  40. - mangleStream = es.through(async function write(data: File & { sourceMap?: RawSourceMap }) {
  41. - type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
  42. - const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
  43. - const newContents = (await newContentsByFileName).get(tsNormalPath);
  44. - if (newContents !== undefined) {
  45. - data.contents = Buffer.from(newContents.out);
  46. - data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
  47. - }
  48. - this.push(data);
  49. - }, async function end() {
  50. - // free resources
  51. - (await newContentsByFileName).clear();
  52. -
  53. - this.push(null);
  54. - (<any>ts2tsMangler) = undefined;
  55. - });
  56. - }
  57. -
  58. return srcPipe
  59. - .pipe(mangleStream)
  60. .pipe(generator.stream)