what-compiler 0.4.2 → 0.5.0
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.
- package/package.json +2 -2
- package/src/babel-plugin.js +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "what-compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "JSX compiler for What Framework - transforms JSX to optimized DOM operations",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@babel/core": "^7.0.0",
|
|
26
|
-
"what-core": "^0.
|
|
26
|
+
"what-core": "^0.5.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src"
|
package/src/babel-plugin.js
CHANGED
|
@@ -1101,7 +1101,19 @@ export default function whatBabelPlugin({ types: t }) {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
|
-
if (
|
|
1104
|
+
if (existingRenderImport) {
|
|
1105
|
+
const existingNames = new Set(
|
|
1106
|
+
existingRenderImport.specifiers
|
|
1107
|
+
.filter(s => t.isImportSpecifier(s))
|
|
1108
|
+
.map(s => s.imported.name)
|
|
1109
|
+
);
|
|
1110
|
+
|
|
1111
|
+
for (const spec of fgSpecifiers) {
|
|
1112
|
+
if (!existingNames.has(spec.imported.name)) {
|
|
1113
|
+
existingRenderImport.specifiers.push(spec);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
} else {
|
|
1105
1117
|
path.unshiftContainer('body',
|
|
1106
1118
|
t.importDeclaration(fgSpecifiers, t.stringLiteral('what-framework/render'))
|
|
1107
1119
|
);
|