babel-plugin-reactylon 1.0.5 → 1.0.7
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/build/ParserUtils.js +1 -1
- package/build/index.js +15 -1
- package/package.json +2 -2
package/build/ParserUtils.js
CHANGED
|
@@ -69,7 +69,7 @@ class ParserUtils {
|
|
|
69
69
|
this.scanDirectory(fullPath, exportsMap, sideEffectsMap);
|
|
70
70
|
}
|
|
71
71
|
else if (file.endsWith('.js') || file.endsWith('.mjs') || file.endsWith('.ts')) {
|
|
72
|
-
const importPath = (fullPath.replace(/\.(js|mjs|ts)$/, '')).replace(
|
|
72
|
+
const importPath = (fullPath.replace(/\.(js|mjs|ts)$/, '')).replace(/\\/g, '/').replace(/^.*?node_modules\//, '');
|
|
73
73
|
const { exports, sideEffects } = this.getExportsAndSideEffects(fullPath);
|
|
74
74
|
exports.forEach(exp => {
|
|
75
75
|
exportsMap[exp] = importPath;
|
package/build/index.js
CHANGED
|
@@ -101,12 +101,26 @@ export default declare((api) => {
|
|
|
101
101
|
// Add implicit side effects (derived from static parse of JSX Reactylon code)
|
|
102
102
|
const isMultipleCanvas = type === 'Engine' && attributes.some(attr => t.isJSXAttribute(attr) && attr.name.name === "isMultipleCanvas");
|
|
103
103
|
if (isMultipleCanvas) {
|
|
104
|
-
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Engines/AbstractEngine/abstractEngine.views')));
|
|
104
|
+
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Engines/AbstractEngine/abstractEngine.views.js')));
|
|
105
105
|
}
|
|
106
106
|
const isPhysicsEngine = type === 'Scene' && attributes.some(attr => t.isJSXAttribute(attr) && attr.name.name === "physicsOptions");
|
|
107
107
|
if (isPhysicsEngine) {
|
|
108
108
|
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Physics/physicsEngineComponent.js')));
|
|
109
109
|
}
|
|
110
|
+
const isAudio = type === 'sound';
|
|
111
|
+
if (isAudio) {
|
|
112
|
+
// Audio v1
|
|
113
|
+
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Audio/audioSceneComponent.js')));
|
|
114
|
+
// sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Audio/audioEngine.js')));
|
|
115
|
+
}
|
|
116
|
+
const isCheckCollisions = attributes.some(attr => t.isJSXAttribute(attr) && attr.name.name === "checkCollisions");
|
|
117
|
+
if (isCheckCollisions) {
|
|
118
|
+
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Collisions/collisionCoordinator.js')));
|
|
119
|
+
}
|
|
120
|
+
const isHighlightLayer = type === 'highlightLayer';
|
|
121
|
+
if (isHighlightLayer) {
|
|
122
|
+
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Layers/effectLayerSceneComponent.js')));
|
|
123
|
+
}
|
|
110
124
|
const isBoundingBox = attributes.some(attr => t.isJSXAttribute(attr) && attr.name.name === "showBoundingBox");
|
|
111
125
|
if (isBoundingBox) {
|
|
112
126
|
sideEffects.push(t.importDeclaration([], t.stringLiteral('@babylonjs/core/Rendering/boundingBoxRenderer.js')));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-reactylon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Babel plugin to enable tree-shaking of Babylon.js classes within a Reactylon application.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@babel/core": "^7.26.10",
|
|
28
28
|
"@babylonjs/core": "^7.0.0 || ^8.0.0",
|
|
29
29
|
"@babylonjs/gui": "^7.0.0 || ^8.0.0",
|
|
30
|
-
"reactylon": "
|
|
30
|
+
"reactylon": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"babel",
|