@linaria/utils
Advanced tools
Comparing version 4.3.1 to 4.3.2
@@ -204,10 +204,20 @@ /* eslint @typescript-eslint/no-use-before-define: ["error", { "functions": false }] */ | ||
} | ||
function getImportTypeByInteropFunction(path) { | ||
function getImportExportTypeByInteropFunction(path) { | ||
const callee = path.get('callee'); | ||
if (!callee.isIdentifier()) { | ||
let name; | ||
if (callee.isIdentifier()) { | ||
name = callee.node.name; | ||
} | ||
if (callee.isMemberExpression()) { | ||
const property = callee.get('property'); | ||
if (property.isIdentifier()) { | ||
name = property.node.name; | ||
} | ||
} | ||
if (name === undefined) { | ||
return undefined; | ||
} | ||
const { | ||
name | ||
} = callee.node; | ||
if (name.startsWith('__exportStar')) { | ||
return 're-export:*'; | ||
} | ||
if (name.startsWith('_interopRequireDefault') || name.startsWith('__importDefault')) { | ||
@@ -217,6 +227,6 @@ return 'default'; | ||
if (name.startsWith('_interopRequireWildcard') || name.startsWith('__importStar') || name.startsWith('__toESM')) { | ||
return '*'; | ||
return 'import:*'; | ||
} | ||
if (name.startsWith('__rest') || name.startsWith('__objRest') || name.startsWith('_objectDestructuringEmpty')) { | ||
return '*'; | ||
return 'import:*'; | ||
} | ||
@@ -247,3 +257,3 @@ return undefined; | ||
// `var _atomic = _interopRequireDefault(require("@linaria/atomic"));` | ||
const imported = getImportTypeByInteropFunction(container); | ||
const imported = getImportExportTypeByInteropFunction(container); | ||
if (!imported) { | ||
@@ -255,2 +265,11 @@ // It's not a transpiled import. | ||
} | ||
if (imported === 're-export:*') { | ||
state.reexports.push({ | ||
exported: '*', | ||
imported: '*', | ||
local: path, | ||
source | ||
}); | ||
return; | ||
} | ||
let { | ||
@@ -276,5 +295,5 @@ parentPath: variableDeclarator | ||
} | ||
if (imported === '*') { | ||
if (imported === 'import:*') { | ||
const unfolded = unfoldNamespaceImport({ | ||
imported, | ||
imported: '*', | ||
local: id, | ||
@@ -281,0 +300,0 @@ source, |
@@ -214,10 +214,20 @@ "use strict"; | ||
} | ||
function getImportTypeByInteropFunction(path) { | ||
function getImportExportTypeByInteropFunction(path) { | ||
const callee = path.get('callee'); | ||
if (!callee.isIdentifier()) { | ||
let name; | ||
if (callee.isIdentifier()) { | ||
name = callee.node.name; | ||
} | ||
if (callee.isMemberExpression()) { | ||
const property = callee.get('property'); | ||
if (property.isIdentifier()) { | ||
name = property.node.name; | ||
} | ||
} | ||
if (name === undefined) { | ||
return undefined; | ||
} | ||
const { | ||
name | ||
} = callee.node; | ||
if (name.startsWith('__exportStar')) { | ||
return 're-export:*'; | ||
} | ||
if (name.startsWith('_interopRequireDefault') || name.startsWith('__importDefault')) { | ||
@@ -227,6 +237,6 @@ return 'default'; | ||
if (name.startsWith('_interopRequireWildcard') || name.startsWith('__importStar') || name.startsWith('__toESM')) { | ||
return '*'; | ||
return 'import:*'; | ||
} | ||
if (name.startsWith('__rest') || name.startsWith('__objRest') || name.startsWith('_objectDestructuringEmpty')) { | ||
return '*'; | ||
return 'import:*'; | ||
} | ||
@@ -257,3 +267,3 @@ return undefined; | ||
// `var _atomic = _interopRequireDefault(require("@linaria/atomic"));` | ||
const imported = getImportTypeByInteropFunction(container); | ||
const imported = getImportExportTypeByInteropFunction(container); | ||
if (!imported) { | ||
@@ -265,2 +275,11 @@ // It's not a transpiled import. | ||
} | ||
if (imported === 're-export:*') { | ||
state.reexports.push({ | ||
exported: '*', | ||
imported: '*', | ||
local: path, | ||
source | ||
}); | ||
return; | ||
} | ||
let { | ||
@@ -286,5 +305,5 @@ parentPath: variableDeclarator | ||
} | ||
if (imported === '*') { | ||
if (imported === 'import:*') { | ||
const unfolded = unfoldNamespaceImport({ | ||
imported, | ||
imported: '*', | ||
local: id, | ||
@@ -291,0 +310,0 @@ source, |
{ | ||
"name": "@linaria/utils", | ||
"version": "4.3.1", | ||
"version": "4.3.2", | ||
"description": "Blazing fast zero-runtime CSS in JS library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
390751
4078