remove-mangle.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. diff --git a/build/lib/compilation.js b/build/lib/compilation.js
  2. index 841dbe1..7cf692a 100644
  3. --- a/build/lib/compilation.js
  4. +++ b/build/lib/compilation.js
  5. @@ -148,24 +148,3 @@ function compileTask(src, out, build, options = {}) {
  6. }
  7. - // mangle: TypeScript to TypeScript
  8. - let mangleStream = event_stream_1.default.through();
  9. - if (build && !options.disableMangle) {
  10. - let ts2tsMangler = new index_1.Mangler(compile.projectPath, (...data) => (0, fancy_log_1.default)(ansi_colors_1.default.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
  11. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  12. - mangleStream = event_stream_1.default.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 6e1fcab..4e45106 100644
  32. --- a/build/lib/compilation.ts
  33. +++ b/build/lib/compilation.ts
  34. @@ -18,4 +18,2 @@ import File from 'vinyl';
  35. import * as task from './task';
  36. -import { Mangler } from './mangle/index';
  37. -import { RawSourceMap } from 'source-map';
  38. import { gulpPostcss } from './postcss';
  39. @@ -138,27 +136,3 @@ export function compileTask(src: string, out: string, build: boolean, options: {
  40. - // mangle: TypeScript to TypeScript
  41. - let mangleStream = es.through();
  42. - if (build && !options.disableMangle) {
  43. - let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
  44. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  45. - mangleStream = es.through(async function write(data: File & { sourceMap?: RawSourceMap }) {
  46. - type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
  47. - const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
  48. - const newContents = (await newContentsByFileName).get(tsNormalPath);
  49. - if (newContents !== undefined) {
  50. - data.contents = Buffer.from(newContents.out);
  51. - data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
  52. - }
  53. - this.push(data);
  54. - }, async function end() {
  55. - // free resources
  56. - (await newContentsByFileName).clear();
  57. -
  58. - this.push(null);
  59. - (<any>ts2tsMangler) = undefined;
  60. - });
  61. - }
  62. -
  63. return srcPipe
  64. - .pipe(mangleStream)
  65. .pipe(generator.stream)