🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

metro-transform-plugins

Package Overview
Dependencies
Maintainers
2
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-transform-plugins - npm Package Compare versions

Comparing version
0.86.0
to
0.87.0
+2
-2
package.json
{
"name": "metro-transform-plugins",
"version": "0.86.0",
"version": "0.87.0",
"description": "🚇 Transform plugins for Metro.",

@@ -36,3 +36,3 @@ "main": "src/index.js",

"babel-plugin-tester": "^6.0.1",
"metro": "0.86.0"
"metro": "0.87.0"
},

@@ -39,0 +39,0 @@ "engines": {

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -9,3 +9,3 @@ * This source code is licensed under the MIT license found in the

* @oncall react_native
* @generated SignedSource<<abccab72cbf3143d690c0cea72fcede8>>
* @generated SignedSource<<587cbe7792cfd21ce4abb4bfb5bac2f8>>
*

@@ -12,0 +12,0 @@ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js

@@ -62,6 +62,20 @@ "use strict";

ExportAllDeclaration(path, state) {
const loc = path.node.loc;
const file = path.node.source;
state.exportAll.push({
file: path.node.source.value,
loc: path.node.loc,
file: file.value,
loc,
});
withLocation(
exportAllTemplate({
FILE: resolvePath(t.cloneNode(file), state.opts.resolve),
REQUIRED: path.scope.generateUidIdentifier(file.value),
KEY: path.scope.generateUidIdentifier("key"),
}),
loc,
).forEach((node) =>
state.imports.push({
node,
}),
);
path.remove();

@@ -101,41 +115,9 @@ },

if (isVariableDeclaration(declaration)) {
declaration.declarations.forEach((d) => {
switch (d.id.type) {
case "ObjectPattern":
{
const properties = d.id.properties;
properties.forEach((p) => {
const name = p.key.name;
state.exportNamed.push({
local: name,
remote: name,
loc,
});
});
}
break;
case "ArrayPattern":
{
const elements = d.id.elements;
elements.forEach((e) => {
const name = e.name;
state.exportNamed.push({
local: name,
remote: name,
loc,
});
});
}
break;
default:
{
const name = d.id.name;
state.exportNamed.push({
local: name,
remote: name,
loc,
});
}
break;
}
const bindings = t.getBindingIdentifiers(declaration);
Object.keys(bindings).forEach((name) => {
state.exportNamed.push({
local: name,
remote: name,
loc,
});
});

@@ -157,3 +139,2 @@ } else {

specifiers.forEach((s) => {
const local = s.local;
const remote = s.exported;

@@ -165,7 +146,28 @@ if (remote.type === "StringLiteral") {

}
if (s.type === "ExportNamespaceSpecifier") {
const source = (0, _nullthrows.default)(path.node.source);
const temp = path.scope.generateUidIdentifier(remote.name);
state.imports.push({
node: withLocation(
importTemplate({
IMPORT: t.cloneNode(state.importAll),
FILE: resolvePath(t.cloneNode(source), state.opts.resolve),
LOCAL: temp,
}),
loc,
),
});
state.exportNamed.push({
local: temp.name,
remote: remote.name,
loc,
});
return;
}
const local = s.local;
if (path.node.source) {
const temp = path.scope.generateUidIdentifier(local.name);
if (local.name === "default") {
path.insertBefore(
withLocation(
state.imports.push({
node: withLocation(
importTemplate({

@@ -181,3 +183,3 @@ IMPORT: t.cloneNode(state.importDefault),

),
);
});
state.exportNamed.push({

@@ -189,4 +191,4 @@ local: temp.name,

} else if (remote.name === "default") {
path.insertBefore(
withLocation(
state.imports.push({
node: withLocation(
importNamedTemplate({

@@ -202,3 +204,3 @@ FILE: resolvePath(

),
);
});
state.exportDefault.push({

@@ -209,4 +211,4 @@ local: temp.name,

} else {
path.insertBefore(
withLocation(
state.imports.push({
node: withLocation(
importNamedTemplate({

@@ -222,3 +224,3 @@ FILE: resolvePath(

),
);
});
state.exportNamed.push({

@@ -388,3 +390,3 @@ local: temp.name,

});
state.exportDefault.forEach((e) => {
state.exportNamed.forEach((e) => {
body.push(

@@ -394,3 +396,3 @@ withLocation(

LOCAL: t.identifier(e.local),
REMOTE: t.identifier("default"),
REMOTE: t.identifier(e.remote),
}),

@@ -401,23 +403,8 @@ e.loc,

});
state.exportAll.forEach((e) => {
state.exportDefault.forEach((e) => {
body.push(
...withLocation(
exportAllTemplate({
FILE: resolvePath(
t.stringLiteral(e.file),
state.opts.resolve,
),
REQUIRED: path.scope.generateUidIdentifier(e.file),
KEY: path.scope.generateUidIdentifier("key"),
}),
e.loc,
),
);
});
state.exportNamed.forEach((e) => {
body.push(
withLocation(
exportTemplate({
LOCAL: t.identifier(e.local),
REMOTE: t.identifier(e.remote),
REMOTE: t.identifier("default"),
}),

@@ -424,0 +411,0 @@ e.loc,

Sorry, the diff of this file is not supported yet