61 lines
2.8 KiB
Diff
61 lines
2.8 KiB
Diff
diff --git a/build/lib/compilation.js b/build/lib/compilation.js
|
|
index 2270e05..1bd7b90 100644
|
|
--- a/build/lib/compilation.js
|
|
+++ b/build/lib/compilation.js
|
|
@@ -104,24 +104,3 @@ function compileTask(src, out, build, options = {}) {
|
|
}
|
|
- // mangle: TypeScript to TypeScript
|
|
- let mangleStream = es.through();
|
|
- if (build && !options.disableMangle) {
|
|
- let ts2tsMangler = new index_1.Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
|
|
- const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
|
|
- mangleStream = es.through(async function write(data) {
|
|
- const tsNormalPath = ts.normalizePath(data.path);
|
|
- const newContents = (await newContentsByFileName).get(tsNormalPath);
|
|
- if (newContents !== undefined) {
|
|
- data.contents = Buffer.from(newContents.out);
|
|
- data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
|
|
- }
|
|
- this.push(data);
|
|
- }, async function end() {
|
|
- // free resources
|
|
- (await newContentsByFileName).clear();
|
|
- this.push(null);
|
|
- ts2tsMangler = undefined;
|
|
- });
|
|
- }
|
|
return srcPipe
|
|
- .pipe(mangleStream)
|
|
.pipe(generator.stream)
|
|
diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts
|
|
index d5da3f1..fa46962 100644
|
|
--- a/build/lib/compilation.ts
|
|
+++ b/build/lib/compilation.ts
|
|
@@ -123,27 +123,3 @@ export function compileTask(src: string, out: string, build: boolean, options: {
|
|
|
|
- // mangle: TypeScript to TypeScript
|
|
- let mangleStream = es.through();
|
|
- if (build && !options.disableMangle) {
|
|
- let ts2tsMangler = new Mangler(compile.projectPath, (...data) => fancyLog(ansiColors.blue('[mangler]'), ...data), { mangleExports: true, manglePrivateFields: true });
|
|
- const newContentsByFileName = ts2tsMangler.computeNewFileContents(new Set(['saveState']));
|
|
- mangleStream = es.through(async function write(data: File & { sourceMap?: RawSourceMap }) {
|
|
- type TypeScriptExt = typeof ts & { normalizePath(path: string): string };
|
|
- const tsNormalPath = (<TypeScriptExt>ts).normalizePath(data.path);
|
|
- const newContents = (await newContentsByFileName).get(tsNormalPath);
|
|
- if (newContents !== undefined) {
|
|
- data.contents = Buffer.from(newContents.out);
|
|
- data.sourceMap = newContents.sourceMap && JSON.parse(newContents.sourceMap);
|
|
- }
|
|
- this.push(data);
|
|
- }, async function end() {
|
|
- // free resources
|
|
- (await newContentsByFileName).clear();
|
|
-
|
|
- this.push(null);
|
|
- (<any>ts2tsMangler) = undefined;
|
|
- });
|
|
- }
|
|
-
|
|
return srcPipe
|
|
- .pipe(mangleStream)
|
|
.pipe(generator.stream)
|