This repository has been archived by the owner on May 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(optimizations): make optimizations work on windows and mac
make optimizations work on windows and mac
- Loading branch information
1 parent
0c81ce6
commit 5fe21f3
Showing
3 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
import { Logger } from '../logger/logger'; | ||
import * as Constants from '../util/constants'; | ||
|
||
export function purgeDecorators(filePath: string, fileContent: string) { | ||
return purgeDecoratorStatementsImpl(filePath, fileContent, ['ionic-angular/index.js']); | ||
return purgeIndexDecorator(filePath, fileContent); | ||
} | ||
|
||
export function purgeDecoratorStatementsImpl(filePath: string, fileContent: string, inclusions: string[]) { | ||
const include = shouldInclude(filePath, inclusions); | ||
if (include) { | ||
export function purgeIndexDecorator(filePath: string, fileContent: string) { | ||
if (process.env[Constants.ENV_VAR_IONIC_ANGULAR_ENTRY_POINT] === filePath) { | ||
Logger.debug(`Purging decorators for ${filePath}`); | ||
return fileContent.replace(DECORATORS_REGEX, ''); | ||
} | ||
return fileContent; | ||
} | ||
|
||
function shouldInclude(filePath: string, inclusions: string[]) { | ||
// TODO - make this more robust | ||
for (const inclusion of inclusions) { | ||
|
||
if (filePath.includes(inclusion)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
const DECORATORS_REGEX = /IonicModule.decorators.=[\s\S\n]*?([\s\S\n]*?)];/igm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters