remove-mangle.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. diff --git a/build/lib/compilation.js b/build/lib/compilation.js
  2. index 63ddeb2..31d2f35 100644
  3. --- a/build/lib/compilation.js
  4. +++ b/build/lib/compilation.js
  5. @@ -21,3 +21,2 @@ const File = require("vinyl");
  6. const task = require("./task");
  7. -const mangleTypeScript_1 = require("./mangleTypeScript");
  8. const watch = require('./watch');
  9. @@ -104,24 +103,3 @@ function compileTask(src, out, build, options = {}) {
  10. }
  11. - // mangle: TypeScript to TypeScript
  12. - let mangleStream = es.through();
  13. - if (build && !options.disableMangle) {
  14. - let ts2tsMangler = new mangleTypeScript_1.Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data));
  15. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  16. - mangleStream = es.through(function write(data) {
  17. - const tsNormalPath = ts.normalizePath(data.path);
  18. - const newContents = newContentsByFileName.get(tsNormalPath);
  19. - if (newContents !== undefined) {
  20. - data.contents = Buffer.from(newContents.out);
  21. - data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
  22. - }
  23. - this.push(data);
  24. - }, function end() {
  25. - this.push(null);
  26. - // free resources
  27. - newContentsByFileName.clear();
  28. - ts2tsMangler = undefined;
  29. - });
  30. - }
  31. return srcPipe
  32. - .pipe(mangleStream)
  33. .pipe(generator.stream)
  34. diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts
  35. index d5cd196..afe16d3 100644
  36. --- a/build/lib/compilation.ts
  37. +++ b/build/lib/compilation.ts
  38. @@ -19,4 +19,2 @@ import * as File from 'vinyl';
  39. import * as task from './task';
  40. -import { Mangler } from './mangleTypeScript';
  41. -import { RawSourceMap } from 'source-map';
  42. const watch = require('./watch');
  43. @@ -123,26 +121,3 @@ export function compileTask(src: string, out: string, build: boolean, options: {
  44. - // mangle: TypeScript to TypeScript
  45. - let mangleStream = es.through();
  46. - if (build && !options.disableMangle) {
  47. - let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data));
  48. - const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
  49. - mangleStream = es.through(function write(data: File & { sourceMap?: RawSourceMap }) {
  50. - type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
  51. - const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
  52. - const newContents = newContentsByFileName.get(tsNormalPath);
  53. - if (newContents !== undefined) {
  54. - data.contents = Buffer.from(newContents.out);
  55. - data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
  56. - }
  57. - this.push(data);
  58. - }, function end() {
  59. - this.push(null);
  60. - // free resources
  61. - newContentsByFileName.clear();
  62. - (<any>ts2tsMangler) = undefined;
  63. - });
  64. - }
  65. -
  66. return srcPipe
  67. - .pipe(mangleStream)
  68. .pipe(generator.stream)