metro-transform-plugins
Advanced tools
Comparing version 0.60.0 to 0.61.0
{ | ||
"name": "metro-transform-plugins", | ||
"version": "0.60.0", | ||
"version": "0.61.0", | ||
"description": "🚇 Transform plugins for Metro", | ||
@@ -25,4 +25,4 @@ "main": "src/index.js", | ||
"@babel/plugin-transform-flow-strip-types": "^7.0.0", | ||
"metro": "0.60.0" | ||
"metro": "0.61.0" | ||
} | ||
} |
@@ -14,3 +14,2 @@ /** | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
@@ -24,3 +23,2 @@ var symbols = Object.getOwnPropertySymbols(object); | ||
} | ||
return keys; | ||
@@ -32,3 +30,2 @@ } | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
@@ -50,3 +47,2 @@ ownKeys(Object(source), true).forEach(function(key) { | ||
} | ||
return target; | ||
@@ -66,3 +62,2 @@ } | ||
} | ||
return obj; | ||
@@ -69,0 +64,0 @@ } |
@@ -48,5 +48,3 @@ /** | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
@@ -57,3 +55,2 @@ } | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
@@ -67,3 +64,2 @@ var symbols = Object.getOwnPropertySymbols(object); | ||
} | ||
return keys; | ||
@@ -75,3 +71,2 @@ } | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
@@ -93,3 +88,2 @@ ownKeys(Object(source), true).forEach(function(key) { | ||
} | ||
return target; | ||
@@ -109,3 +103,2 @@ } | ||
} | ||
return obj; | ||
@@ -118,2 +111,3 @@ } | ||
expression = _require.expression; | ||
/** | ||
@@ -124,3 +118,2 @@ * Produces a Babel template that transforms an "import * as x from ..." or an | ||
*/ | ||
const importTemplate = template(` | ||
@@ -192,4 +185,5 @@ var LOCAL = IMPORT(FILE); | ||
}); | ||
} // eslint-disable-next-line no-redeclare | ||
} | ||
// eslint-disable-next-line no-redeclare | ||
function withLocation(node, loc) { | ||
@@ -409,8 +403,7 @@ if (Array.isArray(node)) { | ||
const specifiers = path.get("specifiers"); | ||
const anchor = path.scope.path.get("body.0"); | ||
const loc = path.node.loc; | ||
if (!specifiers.length) { | ||
anchor.insertBefore( | ||
withLocation( | ||
state.imports.push({ | ||
node: withLocation( | ||
importSideEffectTemplate({ | ||
@@ -421,3 +414,3 @@ FILE: resolvePath(file, state.opts.resolve) | ||
) | ||
); | ||
}); | ||
} else { | ||
@@ -453,4 +446,4 @@ let sharedModuleImport = null; | ||
case "ImportNamespaceSpecifier": | ||
anchor.insertBefore( | ||
withLocation( | ||
state.imports.push({ | ||
node: withLocation( | ||
importTemplate({ | ||
@@ -463,8 +456,8 @@ IMPORT: state.importAll, | ||
) | ||
); | ||
}); | ||
break; | ||
case "ImportDefaultSpecifier": | ||
anchor.insertBefore( | ||
withLocation( | ||
state.imports.push({ | ||
node: withLocation( | ||
importTemplate({ | ||
@@ -477,3 +470,3 @@ IMPORT: state.importDefault, | ||
) | ||
); | ||
}); | ||
break; | ||
@@ -483,4 +476,4 @@ | ||
if (imported.name === "default") { | ||
anchor.insertBefore( | ||
withLocation( | ||
state.imports.push({ | ||
node: withLocation( | ||
importTemplate({ | ||
@@ -493,3 +486,3 @@ IMPORT: state.importDefault, | ||
) | ||
); | ||
}); | ||
} else if (sharedModuleImport != null) { | ||
@@ -504,4 +497,4 @@ path.scope.push({ | ||
} else { | ||
anchor.insertBefore( | ||
withLocation( | ||
state.imports.push({ | ||
node: withLocation( | ||
importNamedTemplate({ | ||
@@ -514,3 +507,3 @@ FILE: resolvePath(file, state.opts.resolve), | ||
) | ||
); | ||
}); | ||
} | ||
@@ -534,2 +527,3 @@ | ||
state.exportNamed = []; | ||
state.imports = []; | ||
state.importAll = t.identifier(state.opts.importAll); | ||
@@ -540,3 +534,8 @@ state.importDefault = t.identifier(state.opts.importDefault); | ||
exit(path, state) { | ||
const body = path.node.body; | ||
const body = path.node.body; // state.imports = [node1, node2, node3, ...nodeN] | ||
state.imports.reverse().forEach(e => { | ||
// import nodes are added to the top of the program body | ||
body.unshift(e.node); | ||
}); | ||
state.exportDefault.forEach(e => { | ||
@@ -543,0 +542,0 @@ body.push( |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
66309
1092