Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-react-jsx-to-rn-stylesheet-vnmf

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-react-jsx-to-rn-stylesheet-vnmf - npm Package Compare versions

Comparing version 3.5.65 to 3.5.66

30

dist/index.js

@@ -44,3 +44,3 @@ "use strict";

};
// 样式文件带有 .module./.linaria. 若开启 css module 则走 css module 逻辑
// Style file with .module./.linaria. If you open css module Go away css module logic
const isModuleSource = value => value.indexOf('.module.') > -1 || value.indexOf('.linaria.') > -1;

@@ -56,3 +56,3 @@ const string2Object = str => {

});
// css 转换报错时,使用原来的值
// css When the conversion is wrong ,Use the original value
try {

@@ -205,4 +205,4 @@ const cssObject = (0, vnmf_css_to_react_native_1.transformCSS)(entries);

existStyleImport = true;
// 在 Program 最开始处理 import 样式
// 防止有些插件在入口对 import 进行处理,比如 @babel/plugin-transform-typescript 会进行删除
// exist Program Initial processing import style
// Prevent some plug -in to the entrance import Processed ,for example @babel/plugin-transform-typescript Will delete
importDeclaration(stmt, state, t);

@@ -219,3 +219,3 @@ }

let expression;
// only one css file,由于样式文件合并,永远只有一个
// only one css file,Due to style file mergers ,There is only one forever
if (allStyleSheetIdentifiers.length === 1 && styleSheetIdentifiers.length === 1) {

@@ -241,3 +241,3 @@ expression = `var ${STYLE_SHEET_NAME} = ${allStyleSheetIdentifiers[0].styleSheetName};\n`;

const cssModuleStylesheets = file.get('cssModuleStylesheets') || [];
// 从最后一个import 开始插入表达式,后续插入的表达式追加在后面
// From the last one import Start inserting expression ,Subsequent exponential expression is added behind
let lastImportIndex = findLastImportIndex(node.body);

@@ -254,3 +254,3 @@ if (injectGetStyle) {

}
// 将 styleSheet 转为 {[classname]: classname}
// Will styleSheet Turn to {[classname]: classname}
if (cssModuleStylesheets.length) {

@@ -291,3 +291,3 @@ // @ts-ignore

}
// 以className结尾的时候
// by classNameAt the end
if (attrNameString.match(classNameMathRule)) {

@@ -328,3 +328,3 @@ const prefix = attrNameString.replace(classNameMathRule, '') || DEFAULT_STYLE_KEY;

let expression;
// 支持 行内 style 转成oject:style="width:100;height:100;" => style={{width:'100',height:'100'}}
// support Inside style transform oject:style="width:100;height:100;" => style={{width:'100',height:'100'}}
if (t.isStringLiteral(styleAttribute.value)) {

@@ -339,3 +339,3 @@ const cssObject = string2Object(styleAttribute.value.value);

let _arrayExpression;
// 非rn场景,style不支持数组,因此需要将数组转换为对象
// No rnScenes ,styleNo array ,Therefore, the array needs to be converted to the object
// style={[styles.a, styles.b]} ArrayExpression

@@ -370,3 +370,3 @@ if (expressionType === 'ArrayExpression') {

exports.default = default_1;
// 由于目前 js 引入的文件样式默认会全部合并,故进插入一个就好,其余的全部 remove
// Due to the current js The introduction of the files introduced by the default will be merged ,So just insert one ,All of the rest remove
function importDeclaration(astPath, state, t) {

@@ -382,5 +382,5 @@ var _a;

const enableCSSModule = (_a = state.opts) === null || _a === void 0 ? void 0 : _a.enableCSSModule;
// 是样式文件但不是 css module
// It's style file but not css module
if (isStyle(sourceValue)) {
// 导入的样式赋值
// Imported style assignment
let styleSheetName = '';

@@ -395,3 +395,3 @@ // `import styles from './foo.css'` kind

specifiers[0].local.name = moduleStyleSheetName;
// 保留原始引用的 name
// Retain the original quotation name
cssModuleStylesheets.push({

@@ -406,3 +406,3 @@ styleSheetName: moduleStyleSheetName,

const cssFileBaseName = path.basename(cssFileName, ext);
// 引入样式对应的变量名
// Introduce variable names corresponding to styles
const styleSheetSource = sourceValue;

@@ -409,0 +409,0 @@ let styleSheetIdentifierName;

{
"name": "babel-plugin-transform-react-jsx-to-rn-stylesheet-vnmf",
"version": "3.5.65",
"version": "3.5.66",
"description": "Transform stylesheet selector to style in JSX Elements.",

@@ -27,4 +27,4 @@ "license": "MIT",

"camelize": "^1.0.0",
"vnmf-css-to-react-native": "3.5.65"
"vnmf-css-to-react-native": "3.5.66"
}
}

@@ -23,3 +23,3 @@ import { PluginObj, template as Template, types as Types } from 'babel__core'

// 样式文件带有 .module./.linaria. 若开启 css module 则走 css module 逻辑
// Style file with .module./.linaria. If you open css module Go away css module logic
const isModuleSource = value => value.indexOf('.module.') > -1 || value.indexOf('.linaria.') > -1

@@ -35,3 +35,3 @@

})
// css 转换报错时,使用原来的值
// css When the conversion is wrong ,Use the original value
try {

@@ -201,4 +201,4 @@ const cssObject = transformCSS(entries)

existStyleImport = true
// 在 Program 最开始处理 import 样式
// 防止有些插件在入口对 import 进行处理,比如 @babel/plugin-transform-typescript 会进行删除
// exist Program Initial processing import style
// Prevent some plug -in to the entrance import Processed ,for example @babel/plugin-transform-typescript Will delete
importDeclaration(stmt, state, t)

@@ -215,3 +215,3 @@ }

let expression
// only one css file,由于样式文件合并,永远只有一个
// only one css file,Due to style file mergers ,There is only one forever
if (allStyleSheetIdentifiers.length === 1 && styleSheetIdentifiers.length === 1) {

@@ -235,3 +235,3 @@ expression = `var ${STYLE_SHEET_NAME} = ${allStyleSheetIdentifiers[0].styleSheetName};\n`

const cssModuleStylesheets = file.get('cssModuleStylesheets') || []
// 从最后一个import 开始插入表达式,后续插入的表达式追加在后面
// From the last one import Start inserting expression ,Subsequent exponential expression is added behind
let lastImportIndex = findLastImportIndex(node.body)

@@ -248,3 +248,3 @@ if (injectGetStyle) {

}
// 将 styleSheet 转为 {[classname]: classname}
// Will styleSheet Turn to {[classname]: classname}
if (cssModuleStylesheets.length) {

@@ -286,3 +286,3 @@ // @ts-ignore

// 以className结尾的时候
// by classNameAt the end
if (attrNameString.match(classNameMathRule)) {

@@ -331,3 +331,3 @@ const prefix = attrNameString.replace(classNameMathRule, '') || DEFAULT_STYLE_KEY

let expression
// 支持 行内 style 转成oject:style="width:100;height:100;" => style={{width:'100',height:'100'}}
// support Inside style transform oject:style="width:100;height:100;" => style={{width:'100',height:'100'}}
if (t.isStringLiteral(styleAttribute.value)) {

@@ -342,3 +342,3 @@ const cssObject = string2Object(styleAttribute.value.value)

let _arrayExpression
// 非rn场景,style不支持数组,因此需要将数组转换为对象
// No rnScenes ,styleNo array ,Therefore, the array needs to be converted to the object
// style={[styles.a, styles.b]} ArrayExpression

@@ -371,3 +371,3 @@ if (expressionType === 'ArrayExpression') {

// 由于目前 js 引入的文件样式默认会全部合并,故进插入一个就好,其余的全部 remove
// Due to the current js The introduction of the files introduced by the default will be merged ,So just insert one ,All of the rest remove
function importDeclaration (astPath, state, t) {

@@ -383,5 +383,5 @@ const { file } = state

// 是样式文件但不是 css module
// It's style file but not css module
if (isStyle(sourceValue)) {
// 导入的样式赋值
// Imported style assignment
let styleSheetName = ''

@@ -397,3 +397,3 @@ // `import styles from './foo.css'` kind

specifiers[0].local.name = moduleStyleSheetName
// 保留原始引用的 name
// Retain the original quotation name
cssModuleStylesheets.push({

@@ -407,3 +407,3 @@ styleSheetName: moduleStyleSheetName,

const cssFileBaseName = path.basename(cssFileName, ext)
// 引入样式对应的变量名
// Introduce variable names corresponding to styles
const styleSheetSource = sourceValue

@@ -410,0 +410,0 @@ let styleSheetIdentifierName

@@ -5,3 +5,3 @@ import { PluginPass } from 'babel__core'

enableCSSModule?: boolean
/* 是否开启多类名转换 */
/* Whether to turn on multiple types of name conversion */
enableMultipleClassName?: boolean

@@ -8,0 +8,0 @@ }

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