@linaria/utils
Advanced tools
Comparing version 4.3.0 to 4.3.1
@@ -428,2 +428,4 @@ /* eslint @typescript-eslint/no-use-before-define: ["error", { "functions": false }] */ | ||
if (name === '__esModule') { | ||
// eslint-disable-next-line no-param-reassign | ||
state.isEsModule = true; | ||
return; | ||
@@ -440,18 +442,23 @@ } | ||
const [obj, prop, descriptor] = path.parentPath.get('arguments'); | ||
if (obj?.isIdentifier(path.node) && prop?.isStringLiteral() && prop.node.value !== '__esModule' && descriptor?.isObjectExpression()) { | ||
/** | ||
* Object.defineProperty(exports, "token", { | ||
* enumerable: true, | ||
* get: function get() { | ||
* return _unknownPackage.token; | ||
* } | ||
* }); | ||
*/ | ||
const exported = prop.node.value; | ||
const local = getGetterValueFromDescriptor(descriptor); | ||
if (local) { | ||
state.exports.push({ | ||
exported, | ||
local | ||
}); | ||
if (obj?.isIdentifier(path.node) && prop?.isStringLiteral() && descriptor?.isObjectExpression()) { | ||
if (prop.node.value === '__esModule') { | ||
// eslint-disable-next-line no-param-reassign | ||
state.isEsModule = true; | ||
} else { | ||
/** | ||
* Object.defineProperty(exports, "token", { | ||
* enumerable: true, | ||
* get: function get() { | ||
* return _unknownPackage.token; | ||
* } | ||
* }); | ||
*/ | ||
const exported = prop.node.value; | ||
const local = getGetterValueFromDescriptor(descriptor); | ||
if (local) { | ||
state.exports.push({ | ||
exported, | ||
local | ||
}); | ||
} | ||
} | ||
@@ -778,3 +785,4 @@ } else if (obj?.isIdentifier(path.node) && prop?.isIdentifier() && descriptor?.isObjectExpression()) { | ||
imports: [], | ||
reexports: [] | ||
reexports: [], | ||
isEsModule: false | ||
}; | ||
@@ -781,0 +789,0 @@ if (!force && cache.has(path)) { |
@@ -246,2 +246,3 @@ /* eslint-disable no-restricted-syntax */ | ||
let referencedIdentifiers = findIdentifiers(affectedPaths, 'referenced'); | ||
referencedIdentifiers.sort((a, b) => a.node?.name.localeCompare(b.node?.name)); | ||
const referencesOfBinding = findIdentifiers(affectedPaths, 'binding').map(i => (i.node && getScope(i).getBinding(i.node.name)) ?? null).filter(isNotNull).reduce((acc, i) => [...acc, ...i.referencePaths.filter(nonType)], []); | ||
@@ -259,3 +260,2 @@ actions.forEach(action => { | ||
removeWithRelated(referencesOfBinding); | ||
referencedIdentifiers.sort((a, b) => a.node?.name.localeCompare(b.node?.name)); | ||
let clean = false; | ||
@@ -262,0 +262,0 @@ while (!clean && referencedIdentifiers.length > 0) { |
@@ -439,2 +439,4 @@ "use strict"; | ||
if (name === '__esModule') { | ||
// eslint-disable-next-line no-param-reassign | ||
state.isEsModule = true; | ||
return; | ||
@@ -451,18 +453,23 @@ } | ||
const [obj, prop, descriptor] = path.parentPath.get('arguments'); | ||
if (obj !== null && obj !== void 0 && obj.isIdentifier(path.node) && prop !== null && prop !== void 0 && prop.isStringLiteral() && prop.node.value !== '__esModule' && descriptor !== null && descriptor !== void 0 && descriptor.isObjectExpression()) { | ||
/** | ||
* Object.defineProperty(exports, "token", { | ||
* enumerable: true, | ||
* get: function get() { | ||
* return _unknownPackage.token; | ||
* } | ||
* }); | ||
*/ | ||
const exported = prop.node.value; | ||
const local = getGetterValueFromDescriptor(descriptor); | ||
if (local) { | ||
state.exports.push({ | ||
exported, | ||
local | ||
}); | ||
if (obj !== null && obj !== void 0 && obj.isIdentifier(path.node) && prop !== null && prop !== void 0 && prop.isStringLiteral() && descriptor !== null && descriptor !== void 0 && descriptor.isObjectExpression()) { | ||
if (prop.node.value === '__esModule') { | ||
// eslint-disable-next-line no-param-reassign | ||
state.isEsModule = true; | ||
} else { | ||
/** | ||
* Object.defineProperty(exports, "token", { | ||
* enumerable: true, | ||
* get: function get() { | ||
* return _unknownPackage.token; | ||
* } | ||
* }); | ||
*/ | ||
const exported = prop.node.value; | ||
const local = getGetterValueFromDescriptor(descriptor); | ||
if (local) { | ||
state.exports.push({ | ||
exported, | ||
local | ||
}); | ||
} | ||
} | ||
@@ -795,3 +802,4 @@ } else if (obj !== null && obj !== void 0 && obj.isIdentifier(path.node) && prop !== null && prop !== void 0 && prop.isIdentifier() && descriptor !== null && descriptor !== void 0 && descriptor.isObjectExpression()) { | ||
imports: [], | ||
reexports: [] | ||
reexports: [], | ||
isEsModule: false | ||
}; | ||
@@ -798,0 +806,0 @@ if (!force && cache.has(path)) { |
@@ -263,2 +263,6 @@ "use strict"; | ||
let referencedIdentifiers = (0, _findIdentifiers.default)(affectedPaths, 'referenced'); | ||
referencedIdentifiers.sort((a, b) => { | ||
var _a$node2, _b$node2; | ||
return (_a$node2 = a.node) === null || _a$node2 === void 0 ? void 0 : _a$node2.name.localeCompare((_b$node2 = b.node) === null || _b$node2 === void 0 ? void 0 : _b$node2.name); | ||
}); | ||
const referencesOfBinding = (0, _findIdentifiers.default)(affectedPaths, 'binding').map(i => { | ||
@@ -279,6 +283,2 @@ var _ref; | ||
removeWithRelated(referencesOfBinding); | ||
referencedIdentifiers.sort((a, b) => { | ||
var _a$node2, _b$node2; | ||
return (_a$node2 = a.node) === null || _a$node2 === void 0 ? void 0 : _a$node2.name.localeCompare((_b$node2 = b.node) === null || _b$node2 === void 0 ? void 0 : _b$node2.name); | ||
}); | ||
let clean = false; | ||
@@ -285,0 +285,0 @@ while (!clean && referencedIdentifiers.length > 0) { |
{ | ||
"name": "@linaria/utils", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "Blazing fast zero-runtime CSS in JS library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -29,2 +29,3 @@ import type { NodePath } from '@babel/traverse'; | ||
reexports: IReexport[]; | ||
isEsModule: boolean; | ||
} | ||
@@ -31,0 +32,0 @@ export declare const sideEffectImport: (item: IImport | ISideEffectImport) => item is ISideEffectImport; |
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
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
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
387571
4040