mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-19 08:32:52 +08:00
chore(build): fix v5 imports (#2465)
This commit is contained in:
parent
0dfbb386ff
commit
88fda657f4
@ -19,7 +19,9 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
|
|||||||
|
|
||||||
const decoratorRegex: RegExp = /@([a-zA-Z]+)\(/g;
|
const decoratorRegex: RegExp = /@([a-zA-Z]+)\(/g;
|
||||||
|
|
||||||
const ignored: string [] = ['Plugin', 'Component'];
|
const ignored: string [] = ['Plugin', 'Component', 'Injectable'];
|
||||||
|
|
||||||
|
const keep: string [] = ['getPromise'];
|
||||||
|
|
||||||
let m;
|
let m;
|
||||||
|
|
||||||
@ -37,15 +39,18 @@ function transformImports(file: ts.SourceFile, ctx: ts.TransformationContext, ng
|
|||||||
|
|
||||||
importStatement.importClause.namedBindings.elements = [
|
importStatement.importClause.namedBindings.elements = [
|
||||||
ts.createIdentifier('IonicNativePlugin'),
|
ts.createIdentifier('IonicNativePlugin'),
|
||||||
...methods.map(m => ts.createIdentifier(m))
|
...methods.map(m => ts.createIdentifier(m)),
|
||||||
|
...importStatement.importClause.namedBindings.elements.filter(el => keep.indexOf(el.name.text) !== -1)
|
||||||
];
|
];
|
||||||
|
|
||||||
if (ngcBuild) {
|
if (ngcBuild) {
|
||||||
importStatement.importClause.namedBindings.elements = importStatement.importClause.namedBindings.elements.map(
|
importStatement.importClause.namedBindings.elements = importStatement.importClause.namedBindings.elements.map(
|
||||||
binding => {
|
binding => {
|
||||||
binding.name = {
|
if (binding.escapedText) {
|
||||||
text: binding.escapedText
|
binding.name = {
|
||||||
};
|
text: binding.escapedText
|
||||||
|
};
|
||||||
|
}
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user