@dolphinweex/weex-harmony-transform 0.1.6 → 0.1.8

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.6",
3
+ "version": "0.1.8",
4
4
  "description": "weex harmony adapter",
5
5
  "main": "index.js",
6
6
  "files": [
package/src/adapter.ts CHANGED
@@ -258,6 +258,12 @@ let bridgeModule = {
258
258
  showControlPanelPage:function(options, callback, failCallback) {
259
259
  weexModule.callNative('bridgeModule.showControlPanelPage', { 'options': options }, callback, undefined, failCallback)
260
260
  },
261
+ getAuthToken:function(options, callback, failCallback) {
262
+ weexModule.callNative('bridgeModule.getAuthToken', { 'options': options }, callback, undefined, failCallback)
263
+ },
264
+ backToNative:function(options, callback, failCallback) {
265
+ weexModule.callNative('bridgeModule.backToNative', { 'options': options }, callback, undefined, failCallback)
266
+ },
261
267
  }
262
268
 
263
269
  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: {
@@ -75,8 +75,25 @@ module.exports = function({ types: t }) {
75
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
  };