Socket
Socket
Sign inDemoInstall

@linaria/shaker

Package Overview
Dependencies
Maintainers
4
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@linaria/shaker - npm Package Compare versions

Comparing version 4.5.0 to 4.5.1

10

esm/index.js

@@ -28,8 +28,8 @@ import { buildOptions, loadBabelOptions } from '@linaria/utils';

};
const shaker = (filename, options, text, only, babel) => {
const shaker = (filename, options, code, only, babel) => {
const transformOptions = loadBabelOptions(babel, filename, buildOptions(options?.babelOptions, getShakerConfig(only)));
const transformed = babel.transformSync(text, {
...transformOptions,
filename
});
if (typeof code === 'string') {
throw new Error('shaker does not support string code');
}
const transformed = typeof code === 'string' ? babel.transformSync(code, transformOptions) : babel.transformFromAstSync(...code, transformOptions);
if (!transformed || !hasShakerMetadata(transformed.metadata)) {

@@ -36,0 +36,0 @@ throw new Error(`${filename} has no shaker metadata`);

@@ -5,4 +5,15 @@ import { join } from 'path';

import shakerPlugin, { hasShakerMetadata } from '../shaker-plugin';
const keep = only => code => {
const filename = join(__dirname, 'source.js');
const getPresets = extension => {
const presets = [];
if (extension === 'ts' || extension === 'tsx') {
presets.push(require.resolve('@babel/preset-typescript'));
}
if (extension === 'jsx' || extension === 'tsx') {
presets.push(require.resolve('@babel/preset-react'));
}
return presets;
};
const keep = (only, extension = 'js') => code => {
const presets = getPresets(extension);
const filename = join(__dirname, `source.${extension}`);
const formattedCode = dedent(code);

@@ -13,2 +24,3 @@ const transformed = transformSync(formattedCode, {

filename,
presets,
plugins: [[shakerPlugin, {

@@ -15,0 +27,0 @@ onlyExports: only

@@ -41,9 +41,9 @@ "use strict";

};
const shaker = (filename, options, text, only, babel) => {
const shaker = (filename, options, code, only, babel) => {
var _transformed$code;
const transformOptions = (0, _utils.loadBabelOptions)(babel, filename, (0, _utils.buildOptions)(options === null || options === void 0 ? void 0 : options.babelOptions, getShakerConfig(only)));
const transformed = babel.transformSync(text, {
...transformOptions,
filename
});
if (typeof code === 'string') {
throw new Error('shaker does not support string code');
}
const transformed = typeof code === 'string' ? babel.transformSync(code, transformOptions) : babel.transformFromAstSync(...code, transformOptions);
if (!transformed || !(0, _shakerPlugin.hasShakerMetadata)(transformed.metadata)) {

@@ -50,0 +50,0 @@ throw new Error(`${filename} has no shaker metadata`);

@@ -10,4 +10,15 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const keep = only => code => {
const filename = (0, _path.join)(__dirname, 'source.js');
const getPresets = extension => {
const presets = [];
if (extension === 'ts' || extension === 'tsx') {
presets.push(require.resolve('@babel/preset-typescript'));
}
if (extension === 'jsx' || extension === 'tsx') {
presets.push(require.resolve('@babel/preset-react'));
}
return presets;
};
const keep = (only, extension = 'js') => code => {
const presets = getPresets(extension);
const filename = (0, _path.join)(__dirname, `source.${extension}`);
const formattedCode = (0, _dedent.default)(code);

@@ -18,2 +29,3 @@ const transformed = (0, _core.transformSync)(formattedCode, {

filename,
presets,
plugins: [[_shakerPlugin.default, {

@@ -20,0 +32,0 @@ onlyExports: only

{
"name": "@linaria/shaker",
"version": "4.5.0",
"version": "4.5.1",
"description": "Blazing fast zero-runtime CSS in JS library",

@@ -36,3 +36,3 @@ "keywords": [

"@linaria/logger": "^4.5.0",
"@linaria/utils": "^4.5.0"
"@linaria/utils": "^4.5.1"
},

@@ -39,0 +39,0 @@ "devDependencies": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc