2023-01-29 19:42:40 +03:00
|
|
|
diff --git a/build/lib/compilation.js b/build/lib/compilation.js
|
2023-03-03 01:40:15 +03:00
|
|
|
index cfd735b..d5179ac 100644
|
2023-01-29 19:42:40 +03:00
|
|
|
--- a/build/lib/compilation.js
|
|
|
|
+++ b/build/lib/compilation.js
|
2023-03-03 01:23:03 +03:00
|
|
|
@@ -21,3 +21,2 @@ const File = require("vinyl");
|
2023-01-31 16:33:29 +03:00
|
|
|
const task = require("./task");
|
|
|
|
-const mangleTypeScript_1 = require("./mangleTypeScript");
|
|
|
|
const watch = require('./watch');
|
2023-03-03 01:23:03 +03:00
|
|
|
@@ -104,24 +103,3 @@ function compileTask(src, out, build) {
|
2023-01-29 19:42:40 +03:00
|
|
|
}
|
|
|
|
- // mangle: TypeScript to TypeScript
|
|
|
|
- let mangleStream = es.through();
|
|
|
|
- if (build) {
|
|
|
|
- let ts2tsMangler = new mangleTypeScript_1.Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data));
|
2023-03-03 01:40:15 +03:00
|
|
|
- const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
|
2023-01-29 19:42:40 +03:00
|
|
|
- mangleStream = es.through(function write(data) {
|
2023-03-03 01:23:03 +03:00
|
|
|
- const tsNormalPath = ts.normalizePath(data.path);
|
|
|
|
- const newContents = newContentsByFileName.get(tsNormalPath);
|
2023-01-29 19:42:40 +03:00
|
|
|
- if (newContents !== undefined) {
|
|
|
|
- data.contents = Buffer.from(newContents.out);
|
|
|
|
- data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
|
|
|
|
- }
|
|
|
|
- this.push(data);
|
|
|
|
- }, function end() {
|
|
|
|
- this.push(null);
|
|
|
|
- // free resources
|
|
|
|
- newContentsByFileName.clear();
|
|
|
|
- ts2tsMangler = undefined;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
return srcPipe
|
|
|
|
- .pipe(mangleStream)
|
|
|
|
.pipe(generator.stream)
|
|
|
|
diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts
|
2023-03-03 01:40:15 +03:00
|
|
|
index 4f890b8..27ea44c 100644
|
2023-01-29 19:42:40 +03:00
|
|
|
--- a/build/lib/compilation.ts
|
|
|
|
+++ b/build/lib/compilation.ts
|
2023-01-31 16:33:29 +03:00
|
|
|
@@ -19,4 +19,2 @@ import * as File from 'vinyl';
|
|
|
|
import * as task from './task';
|
|
|
|
-import { Mangler } from './mangleTypeScript';
|
|
|
|
-import { RawSourceMap } from 'source-map';
|
|
|
|
const watch = require('./watch');
|
2023-03-03 01:23:03 +03:00
|
|
|
@@ -123,26 +121,3 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
|
2023-01-29 19:42:40 +03:00
|
|
|
|
|
|
|
- // mangle: TypeScript to TypeScript
|
|
|
|
- let mangleStream = es.through();
|
|
|
|
- if (build) {
|
|
|
|
- let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data));
|
2023-03-03 01:40:15 +03:00
|
|
|
- const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
|
2023-01-29 19:42:40 +03:00
|
|
|
- mangleStream = es.through(function write(data: File & { sourceMap?: RawSourceMap }) {
|
2023-03-03 01:23:03 +03:00
|
|
|
- type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
|
|
|
|
- const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
|
|
|
|
- const newContents = newContentsByFileName.get(tsNormalPath);
|
2023-01-29 19:42:40 +03:00
|
|
|
- if (newContents !== undefined) {
|
|
|
|
- data.contents = Buffer.from(newContents.out);
|
|
|
|
- data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
|
|
|
|
- }
|
|
|
|
- this.push(data);
|
|
|
|
- }, function end() {
|
|
|
|
- this.push(null);
|
|
|
|
- // free resources
|
|
|
|
- newContentsByFileName.clear();
|
|
|
|
- (<any>ts2tsMangler) = undefined;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return srcPipe
|
|
|
|
- .pipe(mangleStream)
|
|
|
|
.pipe(generator.stream)
|