@linaria/shaker
Advanced tools
Comparing version 3.0.0-beta.10 to 3.0.0-beta.11
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.0.0-beta.11](https://github.com/callstack/linaria/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-08-08) | ||
### Bug Fixes | ||
* **shaker:** string literals for addressing values in imported NS ([#815](https://github.com/callstack/linaria/issues/815)) ([8adf43e](https://github.com/callstack/linaria/commit/8adf43ec56b107c8017608ccc460d0ba8794c8ef)) | ||
# [3.0.0-beta.10](https://github.com/callstack/linaria/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-07-24) | ||
@@ -8,0 +19,0 @@ |
@@ -303,7 +303,7 @@ import { types as t } from '@babel/core'; | ||
if (t.isIdentifier(node.object) && t.isIdentifier(node.property)) { | ||
// It's simple `foo.bar` expression. Is it a usage of a required library? | ||
if (t.isIdentifier(node.object) && (t.isIdentifier(node.property) && !node.computed || t.isStringLiteral(node.property))) { | ||
// It's simple `foo.bar` or `foo["bar"]` expression. Is it a usage of a required library? | ||
const declaration = this.scope.getDeclaration(node.object); | ||
if (t.isIdentifier(declaration) && this.graph.importAliases.has(declaration) && !node.computed) { | ||
if (t.isIdentifier(declaration) && this.graph.importAliases.has(declaration)) { | ||
// It is. We can remember what exactly we use from it. | ||
@@ -310,0 +310,0 @@ const source = this.graph.importAliases.get(declaration); |
@@ -107,3 +107,3 @@ import generator from '@babel/generator'; | ||
const defaultMembers = importType === 'wildcard' ? ['*'] : []; | ||
const aliveMembers = new Set(members.filter(i => alive.has(i)).map(i => i.name)); | ||
const aliveMembers = new Set(members.filter(i => alive.has(i)).map(i => i.type === 'Identifier' ? i.name : i.value)); | ||
@@ -110,0 +110,0 @@ if (importType === 'reexport') { |
@@ -316,7 +316,7 @@ "use strict"; | ||
if (_core.types.isIdentifier(node.object) && _core.types.isIdentifier(node.property)) { | ||
// It's simple `foo.bar` expression. Is it a usage of a required library? | ||
if (_core.types.isIdentifier(node.object) && (_core.types.isIdentifier(node.property) && !node.computed || _core.types.isStringLiteral(node.property))) { | ||
// It's simple `foo.bar` or `foo["bar"]` expression. Is it a usage of a required library? | ||
const declaration = this.scope.getDeclaration(node.object); | ||
if (_core.types.isIdentifier(declaration) && this.graph.importAliases.has(declaration) && !node.computed) { | ||
if (_core.types.isIdentifier(declaration) && this.graph.importAliases.has(declaration)) { | ||
// It is. We can remember what exactly we use from it. | ||
@@ -323,0 +323,0 @@ const source = this.graph.importAliases.get(declaration); |
@@ -120,3 +120,3 @@ "use strict"; | ||
const defaultMembers = importType === 'wildcard' ? ['*'] : []; | ||
const aliveMembers = new Set(members.filter(i => alive.has(i)).map(i => i.name)); | ||
const aliveMembers = new Set(members.filter(i => alive.has(i)).map(i => i.type === 'Identifier' ? i.name : i.value)); | ||
@@ -123,0 +123,0 @@ if (importType === 'reexport') { |
{ | ||
"name": "@linaria/shaker", | ||
"version": "3.0.0-beta.10", | ||
"version": "3.0.0-beta.11", | ||
"publishConfig": { | ||
@@ -59,3 +59,3 @@ "access": "public" | ||
}, | ||
"gitHead": "ff1268faf92408caf80ca272f5f87c306f75df79" | ||
"gitHead": "26cc3d4ba5d6b6c9f4d3d743127810569d818d6b" | ||
} |
@@ -5,3 +5,3 @@ import { types as t } from '@babel/core'; | ||
protected scope: ScopeManager; | ||
readonly imports: Map<string, t.Identifier[]>; | ||
readonly imports: Map<string, (t.Identifier | t.StringLiteral)[]>; | ||
readonly importAliases: Map<t.Identifier, string>; | ||
@@ -8,0 +8,0 @@ readonly importTypes: Map<string, 'wildcard' | 'default' | 'reexport'>; |
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
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
308693