@linaria/utils
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -775,7 +775,6 @@ /* eslint @typescript-eslint/no-use-before-define: ["error", { "functions": false }] */ | ||
export default function collectExportsAndImports(path, filename, force = false) { | ||
export default function collectExportsAndImports(path, force = false) { | ||
const state = { | ||
exportRefs: new Map(), | ||
exports: [], | ||
filename, | ||
imports: [], | ||
@@ -782,0 +781,0 @@ reexports: [] |
@@ -11,2 +11,3 @@ export { default as asyncResolveFallback, syncResolve } from './asyncResolveFallback'; | ||
export { default as isTypedNode } from './isTypedNode'; | ||
export { default as isUnnecessaryReactCall } from './isUnnecessaryReactCall'; | ||
export * from './options'; | ||
@@ -13,0 +14,0 @@ export * from './scopeHelpers'; |
@@ -1,5 +0,4 @@ | ||
import * as babel from '@babel/core'; | ||
const cache = new WeakMap(); | ||
const empty = {}; | ||
export default function loadBabelOptions(filename, overrides = empty) { | ||
export default function loadBabelOptions(babel, filename, overrides = empty) { | ||
const fileCache = cache.get(overrides) ?? new Map(); | ||
@@ -6,0 +5,0 @@ |
@@ -109,2 +109,12 @@ /* eslint-disable no-restricted-syntax */ | ||
if (parent.isTemplateLiteral()) { | ||
mutate(path, p => { | ||
p.replaceWith({ | ||
type: 'StringLiteral', | ||
value: '' | ||
}); | ||
}); | ||
return null; | ||
} | ||
if (parent.isAssignmentExpression()) { | ||
@@ -126,3 +136,3 @@ return findParentForDelete(parent); | ||
body: path.node | ||
}) || parent.isObjectMethod() || parent.isClassMethod()) { | ||
}) || parent.isFunctionDeclaration() || parent.isObjectMethod() || parent.isClassMethod()) { | ||
return findParentForDelete(parent); | ||
@@ -129,0 +139,0 @@ } |
@@ -805,7 +805,6 @@ "use strict"; | ||
function collectExportsAndImports(path, filename, force = false) { | ||
function collectExportsAndImports(path, force = false) { | ||
const state = { | ||
exportRefs: new Map(), | ||
exports: [], | ||
filename, | ||
imports: [], | ||
@@ -812,0 +811,0 @@ reexports: [] |
@@ -17,2 +17,3 @@ "use strict"; | ||
isTypedNode: true, | ||
isUnnecessaryReactCall: true, | ||
slugify: true, | ||
@@ -81,2 +82,8 @@ JSXElementsRemover: true | ||
}); | ||
Object.defineProperty(exports, "isUnnecessaryReactCall", { | ||
enumerable: true, | ||
get: function () { | ||
return _isUnnecessaryReactCall.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "slugify", { | ||
@@ -125,2 +132,4 @@ enumerable: true, | ||
var _isUnnecessaryReactCall = _interopRequireDefault(require("./isUnnecessaryReactCall")); | ||
var _options = require("./options"); | ||
@@ -127,0 +136,0 @@ |
@@ -7,13 +7,6 @@ "use strict"; | ||
exports.default = loadBabelOptions; | ||
var babel = _interopRequireWildcard(require("@babel/core")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const cache = new WeakMap(); | ||
const empty = {}; | ||
function loadBabelOptions(filename, overrides = empty) { | ||
function loadBabelOptions(babel, filename, overrides = empty) { | ||
var _cache$get, _babel$loadOptions; | ||
@@ -20,0 +13,0 @@ |
@@ -131,2 +131,12 @@ "use strict"; | ||
if (parent.isTemplateLiteral()) { | ||
mutate(path, p => { | ||
p.replaceWith({ | ||
type: 'StringLiteral', | ||
value: '' | ||
}); | ||
}); | ||
return null; | ||
} | ||
if (parent.isAssignmentExpression()) { | ||
@@ -148,3 +158,3 @@ return findParentForDelete(parent); | ||
body: path.node | ||
}) || parent.isObjectMethod() || parent.isClassMethod()) { | ||
}) || parent.isFunctionDeclaration() || parent.isObjectMethod() || parent.isClassMethod()) { | ||
return findParentForDelete(parent); | ||
@@ -151,0 +161,0 @@ } |
{ | ||
"name": "@linaria/utils", | ||
"description": "Blazing fast zero-runtime CSS in JS library", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"bugs": "https://github.com/callstack/linaria/issues", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -26,3 +26,2 @@ import type { NodePath } from '@babel/traverse'; | ||
exports: IExport[]; | ||
filename: string | null | undefined; | ||
imports: (IImport | ISideEffectImport)[]; | ||
@@ -33,2 +32,2 @@ reexports: IReexport[]; | ||
export declare const explicitImport: (item: IImport | ISideEffectImport) => item is IImport; | ||
export default function collectExportsAndImports(path: NodePath, filename: string | null | undefined, force?: boolean): IState; | ||
export default function collectExportsAndImports(path: NodePath, force?: boolean): IState; |
@@ -11,2 +11,3 @@ export { default as asyncResolveFallback, syncResolve, } from './asyncResolveFallback'; | ||
export { default as isTypedNode } from './isTypedNode'; | ||
export { default as isUnnecessaryReactCall } from './isUnnecessaryReactCall'; | ||
export * from './options'; | ||
@@ -13,0 +14,0 @@ export * from './scopeHelpers'; |
@@ -1,3 +0,3 @@ | ||
import * as babel from '@babel/core'; | ||
import type { TransformOptions } from '@babel/core'; | ||
export default function loadBabelOptions(filename: string, overrides?: TransformOptions): babel.TransformOptions; | ||
import type { Core } from '../babel'; | ||
export default function loadBabelOptions(babel: Core, filename: string, overrides?: TransformOptions): TransformOptions; |
import type { TransformOptions } from '@babel/core'; | ||
import type { Core } from '../babel'; | ||
export declare type ClassNameSlugVars = { | ||
@@ -11,3 +12,3 @@ dir: string; | ||
export declare type ClassNameFn = (hash: string, title: string, args: ClassNameSlugVars) => string; | ||
export declare type Evaluator = (filename: string, options: StrictOptions, text: string, only: string[] | null) => [string, Map<string, string[]> | null]; | ||
export declare type Evaluator = (filename: string, options: StrictOptions, text: string, only: string[] | null, babel: Core) => [string, Map<string, string[]> | null]; | ||
export declare type EvalRule = { | ||
@@ -14,0 +15,0 @@ action: Evaluator | 'ignore' | string; |
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
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
347181
107
3603