@cssxjs/babel-plugin-rn-stylename-inline 0.2.12 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/index.js +9 -8
  3. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.2.13 (Sat Nov 08 2025)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - fix(babel-plugin-rn-stylename-to-style): more strict check for compilers used in the file ([@cray0000](https://github.com/cray0000))
6
+
7
+ #### Authors: 1
8
+
9
+ - Pavel Zhukov ([@cray0000](https://github.com/cray0000))
10
+
11
+ ---
12
+
1
13
  # v0.2.12 (Fri Nov 07 2025)
2
14
 
3
15
  #### 🚀 Enhancement
package/index.js CHANGED
@@ -28,9 +28,9 @@ const getVisitor = ({ $program, usedCompilers }) => ({
28
28
  if (!shouldProcess($this, usedCompilers)) return
29
29
 
30
30
  // I. validate template
31
- validateTemplate($this, usedCompilers)
31
+ validateTemplate($this)
32
32
 
33
- const compiler = usedCompilers[$this.node.tag.name]
33
+ const compiler = usedCompilers.get($this.node.tag.name)
34
34
 
35
35
  // II. compile template
36
36
  const source = $this.node.quasi.quasis[0]?.value?.raw || ''
@@ -90,13 +90,13 @@ function insertAfterImports ($program, expressionStatement) {
90
90
  }
91
91
  }
92
92
 
93
- function shouldProcess ($template, usedCompilers = {}) {
93
+ function shouldProcess ($template, usedCompilers) {
94
94
  if (!$template.get('tag').isIdentifier()) return
95
- if (!usedCompilers[$template.node.tag.name]) return
95
+ if (!usedCompilers.has($template.node.tag.name)) return
96
96
  return true
97
97
  }
98
98
 
99
- function validateTemplate ($template, usedCompilers = {}) {
99
+ function validateTemplate ($template) {
100
100
  const { node: { quasi } } = $template
101
101
 
102
102
  if (quasi.expressions.length > 0) {
@@ -107,7 +107,7 @@ function validateTemplate ($template, usedCompilers = {}) {
107
107
  }
108
108
 
109
109
  function getUsedCompilers ($program, state) {
110
- const res = {}
110
+ const res = new Map()
111
111
  const magicImports = state.opts.magicImports || DEFAULT_MAGIC_IMPORTS
112
112
  for (const $import of $program.get('body')) {
113
113
  if (!$import.isImportDeclaration()) continue
@@ -115,8 +115,9 @@ function getUsedCompilers ($program, state) {
115
115
  for (const $specifier of $import.get('specifiers')) {
116
116
  if (!$specifier.isImportSpecifier()) continue
117
117
  const { local, imported } = $specifier.node
118
- if (compilers[imported.name]) {
119
- res[local.name] = compilers[imported.name]
118
+ // it's important to use hasOwnProperty here to avoid prototype pollution issues, like 'toString'
119
+ if (Object.prototype.hasOwnProperty.call(compilers, imported.name)) {
120
+ res.set(local.name, compilers[imported.name])
120
121
  }
121
122
  }
122
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cssxjs/babel-plugin-rn-stylename-inline",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,13 +26,13 @@
26
26
  "@babel/parser": "^7.0.0",
27
27
  "@babel/template": "^7.4.0",
28
28
  "@babel/types": "^7.0.0",
29
- "@cssxjs/loaders": "^0.2.12",
30
- "@cssxjs/runtime": "^0.2.12"
29
+ "@cssxjs/loaders": "^0.2.14",
30
+ "@cssxjs/runtime": "^0.2.14"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/plugin-syntax-jsx": "^7.0.0",
34
34
  "babel-plugin-tester": "^9.1.0",
35
35
  "jest": "^30.0.4"
36
36
  },
37
- "gitHead": "353563eb72be74e2911d1343adcda32eceba43e5"
37
+ "gitHead": "72b2f3d63ebe86ab75b398036ff27f8abe99f1d4"
38
38
  }