@dolphinweex/weex-harmony-transform 0.1.5 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolphinweex/weex-harmony-transform",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/adapter.ts CHANGED
@@ -255,6 +255,9 @@ let bridgeModule = {
255
255
  setIdleTimerDisabled:function(options, callback){
256
256
  weexModule.callNative('bridgeModule.setIdleTimerDisabled',{ 'options': options }, callback)
257
257
  },
258
+ showControlPanelPage:function(options, callback, failCallback) {
259
+ weexModule.callNative('bridgeModule.showControlPanelPage', { 'options': options }, callback, undefined, failCallback)
260
+ },
258
261
  }
259
262
 
260
263
  let deviceInfo = {
package/weexTransform.js CHANGED
@@ -5,7 +5,7 @@ function isNeedWeexExtProxy(module) {
5
5
  return (weexExtModules.indexOf(module) === -1) ? false : true;
6
6
  }
7
7
 
8
- module.exports = function({ types: t }) {
8
+ module.exports = function ({ types: t }) {
9
9
  return {
10
10
  name: "weexTransform",
11
11
  visitor: {
@@ -25,7 +25,7 @@ module.exports = function({ types: t }) {
25
25
  callee.object.name === 'weex'
26
26
  ) {
27
27
  if (process.env.ISHARMONY === 'true') {
28
- console.log('Transform harmony process.env.ISHARMONY:' + process.env.ISHARMONY);
28
+ // console.log('Transform harmony process.env.ISHARMONY:' + process.env.ISHARMONY);
29
29
  // callee.object = t.identifier('weexExt')
30
30
 
31
31
  const parentPath = astPath.parentPath?.parentPath
@@ -72,11 +72,28 @@ module.exports = function({ types: t }) {
72
72
  }
73
73
  }
74
74
  } else {
75
- console.log('Transform not harmony process.env.ISHARMONY:' + process.env.ISHARMONY);
75
+ // console.log('Transform not harmony process.env.ISHARMONY:' + process.env.ISHARMONY);
76
76
  }
77
77
  }
78
+ } else if (t.isIdentifier(callee) && callee.name === 'require') {
79
+ const arguments = astPath.node.arguments
80
+ if (arguments && arguments.length > 0 && arguments[0].value) {
81
+ const oldPath = arguments[0].value;
82
+ if (oldPath === 'weex-bindingx') {
83
+ // 构建新的路径节点
84
+ const newPathNode = t.stringLiteral('@dolphinweex/weex-bindingx');
85
+ // 替换原来的路径节点
86
+ astPath.node.arguments[0] = newPathNode;
87
+ }
88
+ }
89
+ }
90
+ },
91
+ ImportDeclaration(path) {
92
+ const importPath = path.node.source.value;
93
+ if (importPath === 'weex-bindingx') {
94
+ path.node.source.value = "@dolphinweex/weex-bindingx"
78
95
  }
79
- }
96
+ }
80
97
  }
81
98
  };
82
99
  };