@linaria/core
Advanced tools
Comparing version 3.0.0-beta.19 to 3.0.0-beta.20
@@ -32,3 +32,12 @@ /** | ||
}); | ||
return [...Object.values(atomicClasses), ...nonAtomicClasses].join(' '); | ||
const result = []; // eslint-disable-next-line no-restricted-syntax | ||
for (const keyHash in atomicClasses) { | ||
if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) { | ||
result.push(atomicClasses[keyHash]); | ||
} | ||
} | ||
result.push(...nonAtomicClasses); | ||
return result.join(' '); | ||
}; | ||
@@ -35,0 +44,0 @@ |
@@ -32,11 +32,5 @@ /* eslint-disable class-methods-use-this */ | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
addInterpolation(node, source) { | ||
// CSS custom properties can't be used outside components | ||
throw new Error("The CSS cannot contain JavaScript expressions when using the 'css' tag. To evaluate the expressions at build time, pass 'evaluate: true' to the babel plugin."); | ||
} | ||
} | ||
//# sourceMappingURL=BaseProcessor.js.map |
@@ -9,2 +9,8 @@ import BaseProcessor from './BaseProcessor'; | ||
} | ||
} // eslint-disable-next-line class-methods-use-this | ||
addInterpolation() { | ||
// CSS custom properties can't be used outside components | ||
throw new Error("The CSS cannot contain JavaScript expressions when using the 'css' tag. To evaluate the expressions at build time, pass 'evaluate: true' to the babel plugin."); | ||
} | ||
@@ -11,0 +17,0 @@ |
@@ -9,16 +9,16 @@ import { basename, dirname, extname, relative, sep } from 'path'; | ||
export default function getClassNameAndSlug(displayName, idx, options, context) { | ||
// Custom properties need to start with a letter, so we prefix the slug | ||
const relativeFilename = relative(context.root, context.filename); // Custom properties need to start with a letter, so we prefix the slug | ||
// Also use append the index of the class to the filename for uniqueness in the file | ||
const slug = toValidCSSIdentifier(`${displayName.charAt(0).toLowerCase()}${slugify(`${relative(context.root, context.filename)}:${idx}`)}`); // Collect some useful replacement patterns from the filename | ||
const slug = toValidCSSIdentifier(`${displayName.charAt(0).toLowerCase()}${slugify(`${relativeFilename}:${idx}`)}`); // Collect some useful replacement patterns from the filename | ||
// Available variables for the square brackets used in `classNameSlug` options | ||
const file = relative(process.cwd(), context.filename).slice(1); | ||
const ext = extname(file); | ||
const ext = extname(relativeFilename); | ||
const slugVars = { | ||
hash: slug, | ||
title: displayName, | ||
file, | ||
file: relativeFilename, | ||
ext, | ||
name: basename(file, ext), | ||
dir: dirname(file).split(sep).pop() | ||
name: basename(relativeFilename, ext), | ||
dir: dirname(relativeFilename).split(sep).pop() | ||
}; | ||
@@ -25,0 +25,0 @@ let className = options.displayName ? `${toValidCSSIdentifier(displayName)}_${slug}` : slug; // The className can be defined by the user either as fn or a string |
@@ -37,3 +37,12 @@ "use strict"; | ||
}); | ||
return [...Object.values(atomicClasses), ...nonAtomicClasses].join(' '); | ||
const result = []; // eslint-disable-next-line no-restricted-syntax | ||
for (const keyHash in atomicClasses) { | ||
if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) { | ||
result.push(atomicClasses[keyHash]); | ||
} | ||
} | ||
result.push(...nonAtomicClasses); | ||
return result.join(' '); | ||
}; | ||
@@ -40,0 +49,0 @@ |
@@ -42,10 +42,4 @@ "use strict"; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
addInterpolation(node, source) { | ||
// CSS custom properties can't be used outside components | ||
throw new Error("The CSS cannot contain JavaScript expressions when using the 'css' tag. To evaluate the expressions at build time, pass 'evaluate: true' to the babel plugin."); | ||
} | ||
} | ||
@@ -52,0 +46,0 @@ |
@@ -19,2 +19,8 @@ "use strict"; | ||
} | ||
} // eslint-disable-next-line class-methods-use-this | ||
addInterpolation() { | ||
// CSS custom properties can't be used outside components | ||
throw new Error("The CSS cannot contain JavaScript expressions when using the 'css' tag. To evaluate the expressions at build time, pass 'evaluate: true' to the babel plugin."); | ||
} | ||
@@ -21,0 +27,0 @@ |
@@ -21,16 +21,16 @@ "use strict"; | ||
function getClassNameAndSlug(displayName, idx, options, context) { | ||
// Custom properties need to start with a letter, so we prefix the slug | ||
const relativeFilename = (0, _path.relative)(context.root, context.filename); // Custom properties need to start with a letter, so we prefix the slug | ||
// Also use append the index of the class to the filename for uniqueness in the file | ||
const slug = (0, _toValidCSSIdentifier.default)(`${displayName.charAt(0).toLowerCase()}${(0, _utils.slugify)(`${(0, _path.relative)(context.root, context.filename)}:${idx}`)}`); // Collect some useful replacement patterns from the filename | ||
const slug = (0, _toValidCSSIdentifier.default)(`${displayName.charAt(0).toLowerCase()}${(0, _utils.slugify)(`${relativeFilename}:${idx}`)}`); // Collect some useful replacement patterns from the filename | ||
// Available variables for the square brackets used in `classNameSlug` options | ||
const file = (0, _path.relative)(process.cwd(), context.filename).slice(1); | ||
const ext = (0, _path.extname)(file); | ||
const ext = (0, _path.extname)(relativeFilename); | ||
const slugVars = { | ||
hash: slug, | ||
title: displayName, | ||
file, | ||
file: relativeFilename, | ||
ext, | ||
name: (0, _path.basename)(file, ext), | ||
dir: (0, _path.dirname)(file).split(_path.sep).pop() | ||
name: (0, _path.basename)(relativeFilename, ext), | ||
dir: (0, _path.dirname)(relativeFilename).split(_path.sep).pop() | ||
}; | ||
@@ -37,0 +37,0 @@ let className = options.displayName ? `${(0, _toValidCSSIdentifier.default)(displayName)}_${slug}` : slug; // The className can be defined by the user either as fn or a string |
{ | ||
"name": "@linaria/core", | ||
"version": "3.0.0-beta.19", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"description": "Blazing fast zero-runtime CSS in JS library", | ||
"sideEffects": false, | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"types/", | ||
"lib/", | ||
"esm/" | ||
], | ||
"linaria": { | ||
"tags": { | ||
"css": "./lib/processors/css.js" | ||
} | ||
}, | ||
"license": "MIT", | ||
"repository": "git@github.com:callstack/linaria.git", | ||
"engines": { | ||
"node": "^12.16.0 || >=13.7.0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/callstack/linaria/issues" | ||
}, | ||
"homepage": "https://github.com/callstack/linaria#readme", | ||
"keywords": [ | ||
"react", | ||
"linaria", | ||
"css", | ||
"css-in-js", | ||
"styled-components" | ||
], | ||
"scripts": { | ||
"build:lib": "cross-env NODE_ENV=legacy babel src --out-dir lib --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start", | ||
"build:corejs-test": "cross-env NODE_ENV=legacy babel src --out-dir lib --extensions '.js,.jsx,.ts,.tsx' --ignore \"src/processors/**/*\"", | ||
"build:esm": "babel src --out-dir esm --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start", | ||
"build": "yarn build:lib && yarn build:esm", | ||
"build:declarations": "tsc --emitDeclarationOnly --outDir types", | ||
"prepare": "yarn build && yarn build:declarations", | ||
"test": "jest --config ../../jest.config.js --rootDir .", | ||
"typecheck": "tsc --noEmit --composite false", | ||
"watch": "yarn build --watch" | ||
}, | ||
"version": "3.0.0-beta.20", | ||
"bugs": "https://github.com/callstack/linaria/issues", | ||
"dependencies": { | ||
"@linaria/logger": "^3.0.0-beta.19", | ||
"@linaria/utils": "^3.0.0-beta.19" | ||
"@linaria/logger": "^3.0.0-beta.20", | ||
"@linaria/utils": "^3.0.0-beta.20" | ||
}, | ||
"devDependencies": { | ||
"@babel/traverse": ">=7", | ||
"@babel/types": ">=7" | ||
"@babel/types": "^7.18.4", | ||
"@types/babel__core": "^7.1.19", | ||
"@types/babel__traverse": "^7.17.1", | ||
"@types/node": "^17.0.39" | ||
}, | ||
"engines": { | ||
"node": "^12.16.0 || >=13.7.0" | ||
}, | ||
"exports": { | ||
@@ -70,2 +33,29 @@ "./package.json": "./package.json", | ||
}, | ||
"files": [ | ||
"types/", | ||
"lib/", | ||
"esm/" | ||
], | ||
"homepage": "https://github.com/callstack/linaria#readme", | ||
"keywords": [ | ||
"css", | ||
"css-in-js", | ||
"linaria", | ||
"react", | ||
"styled-components" | ||
], | ||
"license": "MIT", | ||
"linaria": { | ||
"tags": { | ||
"css": "./lib/processors/css.js" | ||
} | ||
}, | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": "git@github.com:callstack/linaria.git", | ||
"sideEffects": false, | ||
"types": "types/index.d.ts", | ||
"typesVersions": { | ||
@@ -78,3 +68,12 @@ "*": { | ||
}, | ||
"gitHead": "73aab0a3908325333e452b9cbd5e438a0f1de463" | ||
} | ||
"scripts": { | ||
"build": "npm run build:lib && npm run build:esm && npm run build:declarations", | ||
"build:corejs-test": "cross-env NODE_ENV=legacy babel src --out-dir lib --extensions '.js,.jsx,.ts,.tsx' --ignore \"src/processors/**/*\"", | ||
"build:declarations": "tsc --emitDeclarationOnly --outDir types", | ||
"build:esm": "babel src --out-dir esm --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start", | ||
"build:lib": "cross-env NODE_ENV=legacy babel src --out-dir lib --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start", | ||
"test": "jest --config ../../jest.config.js --rootDir .", | ||
"typecheck": "tsc --noEmit --composite false", | ||
"watch": "npm run build --watch" | ||
} | ||
} |
@@ -27,3 +27,3 @@ import type { types as t } from '@babel/core'; | ||
*/ | ||
addInterpolation(node: Expression, source: string): string; | ||
abstract addInterpolation(node: Expression, source: string): string; | ||
abstract extractRules(valueCache: ValueCache, cssText: string, loc?: SourceLocation | null): [rules: Rules, classes: string]; | ||
@@ -30,0 +30,0 @@ /** |
@@ -7,2 +7,3 @@ import type { Expression, SourceLocation } from '@babel/types'; | ||
constructor(...args: ProcessorParams); | ||
addInterpolation(): string; | ||
extractRules(valueCache: ValueCache, cssText: string, loc?: SourceLocation | null): [Rules, string]; | ||
@@ -9,0 +10,0 @@ getRuntimeReplacement(classes: string): [Expression, boolean]; |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
539
0
64575
5
58
2