@tarojs/rn-runner 4.0.1-alpha.0 → 4.0.1
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/LICENSE +8 -8
- package/README.md +1 -1
- package/__tests__/__snapshots__/components.spec.ts.snap +120 -91
- package/__tests__/components.spec.ts +21 -17
- package/__tests__/mock/src/app.tsx +1 -1
- package/__tests__/mock/src/components/cell/index.tsx +1 -0
- package/__tests__/mock/src/components/navbar/index.tsx +1 -0
- package/__tests__/mock/src/components/svg/index.tsx +1 -0
- package/__tests__/mock/src/utils/requireLodash/index.ts +4 -4
- package/__tests__/tsconfig.json +2 -3
- package/dist/config/build-component.js +2 -5
- package/dist/config/build-component.js.map +1 -1
- package/dist/index.js +8 -15
- package/dist/index.js.map +1 -1
- package/jest.config.js +6 -0
- package/package.json +45 -48
- package/src/config/build-component.ts +2 -6
- package/src/index.ts +3 -11
- package/templates/index.js +1 -1
- package/templates/metro.config.js +7 -11
- package/tsconfig.json +0 -1
package/LICENSE
CHANGED
|
@@ -154,8 +154,15 @@ See `/LICENSE` for details of the license.
|
|
|
154
154
|
|
|
155
155
|
==================
|
|
156
156
|
|
|
157
|
+
MIT (stencil-vue2-output-target):
|
|
158
|
+
The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
|
|
159
|
+
`/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
|
|
160
|
+
See `/LICENSE` for details of the license.
|
|
161
|
+
|
|
162
|
+
==================
|
|
163
|
+
|
|
157
164
|
MIT (weui):
|
|
158
|
-
The following files embed [
|
|
165
|
+
The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
|
|
159
166
|
`/packages/taro-components/src/components/*.scss`
|
|
160
167
|
See `/LICENSE.txt` for details of the license.
|
|
161
168
|
|
|
@@ -165,10 +172,3 @@ Apache-2.0 (intersection-observer):
|
|
|
165
172
|
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
166
173
|
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
167
174
|
See `/LICENSE.txt` for details of the license.
|
|
168
|
-
|
|
169
|
-
==================
|
|
170
|
-
|
|
171
|
-
MIT (babel-plugin-jsx-dom-expressions):
|
|
172
|
-
The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
|
|
173
|
-
`/packages/babel-plugin-transform-solid-jsx/src/*`
|
|
174
|
-
See `/LICENSE` for details of the license.
|
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
暴露给 `@tarojs/cli` 的 React Native Webpack 启动器。
|
|
4
4
|
|
|
5
|
-
`@tarojs/
|
|
5
|
+
`@tarojs/mini-runner` 从 `@tarojs/cli` 接受 [Taro 编译配置](https://taro-docs.jd.com/taro/docs/config.html),把编译配置分解成 Webpack 配置,并刚启动 Webpack 把项目源码编译为适配 React Native 目录结构的代码。
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`build_components
|
|
3
|
+
exports[`build_components dynamic require 1`] = `
|
|
4
4
|
[
|
|
5
|
-
"
|
|
6
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
var reactIs$1 = {exports: {}};
|
|
5
|
+
"var reactIs$1 = {exports: {}};
|
|
10
6
|
|
|
11
7
|
var reactIs_production_min = {};
|
|
12
8
|
|
|
13
|
-
var b=Symbol.for("react.element"),
|
|
9
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u;}}case d:return u;}}}function A(a){return z(a)===m;}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l;};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k;};reactIs_production_min.isContextProvider=function(a){return z(a)===h;};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c;};reactIs_production_min.isForwardRef=function(a){return z(a)===n;};reactIs_production_min.isFragment=function(a){return z(a)===e;};reactIs_production_min.isLazy=function(a){return z(a)===t;};reactIs_production_min.isMemo=function(a){return z(a)===r;};reactIs_production_min.isPortal=function(a){return z(a)===d;};reactIs_production_min.isProfiler=function(a){return z(a)===g;};reactIs_production_min.isStrictMode=function(a){return z(a)===f;};reactIs_production_min.isSuspense=function(a){return z(a)===p;};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v);};reactIs_production_min.typeOf=z;
|
|
14
10
|
|
|
15
|
-
reactIs$1.exports=reactIs_production_min;var
|
|
11
|
+
reactIs$1.exports=reactIs_production_min;var reactIs = reactIs$1.exports;
|
|
16
12
|
|
|
17
13
|
console.log({reactIs:reactIs});
|
|
18
14
|
",
|
|
19
15
|
]
|
|
20
16
|
`;
|
|
21
17
|
|
|
22
|
-
exports[`build_components
|
|
18
|
+
exports[`build_components modify rollup config 1`] = `
|
|
23
19
|
[
|
|
24
|
-
"import
|
|
20
|
+
"import 'react';
|
|
21
|
+
import View from '@tarojs/components-rn/dist/components/View';
|
|
25
22
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
26
23
|
import taro from '@tarojs/taro-rn';
|
|
27
24
|
import { StyleSheet } from 'react-native';
|
|
@@ -54,11 +51,12 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
54
51
|
}
|
|
55
52
|
});
|
|
56
53
|
|
|
57
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
54
|
+
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]},"line-"+i));})});}function Item(_ref2){var title=_ref2.title,children=_ref2.children,style=_ref2.style;return jsxs(View,{style:_mergeEleStyles(_styleSheet["cellItem"],Object.assign({},style)),children:[jsx(Text,{style:_styleSheet["cellItem__title"],children:title}),jsx(View,{style:_styleSheet["cellItem__content"],children:children})]});}Cell.Item=Item;
|
|
58
55
|
|
|
59
56
|
export { Cell as default };
|
|
60
57
|
",
|
|
61
|
-
"import
|
|
58
|
+
"import 'react';
|
|
59
|
+
import { navigateBack } from '@tarojs/taro-rn/dist/api';
|
|
62
60
|
import View from '@tarojs/components-rn/dist/components/View';
|
|
63
61
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
64
62
|
import Image from '@tarojs/components-rn/dist/components/Image';
|
|
@@ -66,7 +64,7 @@ import { StyleSheet } from 'react-native';
|
|
|
66
64
|
import { scalePx2dp } from '@tarojs/runtime-rn';
|
|
67
65
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
68
66
|
|
|
69
|
-
var iconBack = require('../assets/icon_back-
|
|
67
|
+
var iconBack = require('../assets/icon_back-541a82be.webp');
|
|
70
68
|
|
|
71
69
|
var _indexScssStyleSheet = StyleSheet.create({
|
|
72
70
|
"navbar": {
|
|
@@ -112,9 +110,10 @@ export { Navbar as default };
|
|
|
112
110
|
]
|
|
113
111
|
`;
|
|
114
112
|
|
|
115
|
-
exports[`build_components
|
|
113
|
+
exports[`build_components multiple components 1`] = `
|
|
116
114
|
[
|
|
117
|
-
"import
|
|
115
|
+
"import 'react';
|
|
116
|
+
import View from '@tarojs/components-rn/dist/components/View';
|
|
118
117
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
119
118
|
import taro from '@tarojs/taro-rn';
|
|
120
119
|
import { StyleSheet } from 'react-native';
|
|
@@ -147,11 +146,12 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
147
146
|
}
|
|
148
147
|
});
|
|
149
148
|
|
|
150
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
149
|
+
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]},"line-"+i));})});}function Item(_ref2){var title=_ref2.title,children=_ref2.children,style=_ref2.style;return jsxs(View,{style:_mergeEleStyles(_styleSheet["cellItem"],Object.assign({},style)),children:[jsx(Text,{style:_styleSheet["cellItem__title"],children:title}),jsx(View,{style:_styleSheet["cellItem__content"],children:children})]});}Cell.Item=Item;
|
|
151
150
|
|
|
152
151
|
export { Cell as default };
|
|
153
152
|
",
|
|
154
|
-
"import
|
|
153
|
+
"import 'react';
|
|
154
|
+
import { navigateBack } from '@tarojs/taro-rn/dist/api';
|
|
155
155
|
import View from '@tarojs/components-rn/dist/components/View';
|
|
156
156
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
157
157
|
import Image from '@tarojs/components-rn/dist/components/Image';
|
|
@@ -159,7 +159,7 @@ import { StyleSheet } from 'react-native';
|
|
|
159
159
|
import { scalePx2dp } from '@tarojs/runtime-rn';
|
|
160
160
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
161
161
|
|
|
162
|
-
var iconBack = require('../../assets/icon_back-
|
|
162
|
+
var iconBack = require('../../assets/icon_back-541a82be.webp');
|
|
163
163
|
|
|
164
164
|
var _indexScssStyleSheet = StyleSheet.create({
|
|
165
165
|
"navbar": {
|
|
@@ -205,11 +205,18 @@ export { Navbar as default };
|
|
|
205
205
|
]
|
|
206
206
|
`;
|
|
207
207
|
|
|
208
|
-
exports[`build_components
|
|
208
|
+
exports[`build_components named export 1`] = `
|
|
209
209
|
[
|
|
210
|
-
"import { Platform as Platform$1,
|
|
210
|
+
"import { Platform as Platform$1, NativeModules, NativeEventEmitter } from 'react-native';
|
|
211
|
+
import 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
212
|
+
import 'react';
|
|
213
|
+
import require$$0 from 'crypto';
|
|
211
214
|
|
|
212
|
-
function
|
|
215
|
+
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
216
|
+
|
|
217
|
+
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}
|
|
218
|
+
|
|
219
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}
|
|
213
220
|
|
|
214
221
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
215
222
|
|
|
@@ -217,95 +224,99 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
217
224
|
|
|
218
225
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
219
226
|
|
|
220
|
-
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
221
|
-
|
|
222
|
-
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}
|
|
223
|
-
|
|
224
227
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
225
228
|
|
|
226
|
-
function
|
|
229
|
+
function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return (hint==="string"?String:Number)(input);}
|
|
227
230
|
|
|
228
|
-
function
|
|
231
|
+
function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}
|
|
229
232
|
|
|
230
|
-
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,
|
|
233
|
+
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}
|
|
231
234
|
|
|
232
235
|
function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else {Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}
|
|
233
236
|
|
|
234
|
-
function _defineProperty(obj,key,value){key=
|
|
235
|
-
|
|
236
|
-
function getDefaultExportFromCjs (x) {
|
|
237
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
238
|
-
}
|
|
237
|
+
function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else {obj[key]=value;}return obj;}
|
|
239
238
|
|
|
240
|
-
var
|
|
239
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
241
240
|
|
|
242
|
-
var
|
|
241
|
+
var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(format===undefined){error=new Error('Minified exception occurred; use the non-minified dev environment '+'for the full error message and additional helpful warnings.');}else {var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++];}));error.name='Invariant Violation';}error.framesToPop=1;throw error;}};var invariant_1=invariant;
|
|
243
242
|
|
|
244
|
-
function
|
|
243
|
+
var nativeEmitterSubscriptionKey='@@nativeEmitterSubscription@@';var EventEmitter=function(){function EventEmitter(nativeModule){_classCallCheck(this,EventEmitter);this._listenerCount=0;if(nativeModule.__expo_module_name__&&NativeModules.EXReactNativeEventEmitter){nativeModule.addListener=function(){var _NativeModules$EXReac;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return (_NativeModules$EXReac=NativeModules.EXReactNativeEventEmitter).addProxiedListener.apply(_NativeModules$EXReac,[nativeModule.__expo_module_name__].concat(args));};nativeModule.removeListeners=function(){var _NativeModules$EXReac2;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return (_NativeModules$EXReac2=NativeModules.EXReactNativeEventEmitter).removeProxiedListeners.apply(_NativeModules$EXReac2,[nativeModule.__expo_module_name__].concat(args));};}this._nativeModule=nativeModule;this._eventEmitter=new NativeEventEmitter(nativeModule);}_createClass(EventEmitter,[{key:"addListener",value:function addListener(eventName,listener){var _this=this,_subscription;if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.startObserving){this._nativeModule.startObserving();}this._listenerCount++;var nativeEmitterSubscription=this._eventEmitter.addListener(eventName,listener);var subscription=(_subscription={},_defineProperty(_subscription,nativeEmitterSubscriptionKey,nativeEmitterSubscription),_defineProperty(_subscription,"remove",function remove(){_this.removeSubscription(subscription);}),_subscription);return subscription;}},{key:"removeAllListeners",value:function removeAllListeners(eventName){var removedListenerCount=this._eventEmitter.listenerCount?this._eventEmitter.listenerCount(eventName):this._eventEmitter.listeners(eventName).length;this._eventEmitter.removeAllListeners(eventName);this._listenerCount-=removedListenerCount;invariant_1(this._listenerCount>=0,"EventEmitter must have a non-negative number of listeners");if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.stopObserving){this._nativeModule.stopObserving();}}},{key:"removeSubscription",value:function removeSubscription(subscription){var nativeEmitterSubscription=subscription[nativeEmitterSubscriptionKey];if(!nativeEmitterSubscription){return;}if('remove'in nativeEmitterSubscription){nativeEmitterSubscription.remove();}else if('removeSubscription'in this._eventEmitter){this._eventEmitter.removeSubscription(nativeEmitterSubscription);}this._listenerCount--;delete subscription[nativeEmitterSubscriptionKey];subscription.remove=function(){};if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.stopObserving){this._nativeModule.stopObserving();}}},{key:"emit",value:function emit(eventName){var _this$_eventEmitter;for(var _len3=arguments.length,params=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){params[_key3-1]=arguments[_key3];}(_this$_eventEmitter=this._eventEmitter).emit.apply(_this$_eventEmitter,[eventName].concat(params));}}]);return EventEmitter;}();
|
|
245
244
|
|
|
246
245
|
var NativeModulesProxy = {};
|
|
247
246
|
|
|
248
|
-
|
|
247
|
+
var isDOMAvailable=false;var canUseEventListeners=false;var canUseViewport=false;var isAsyncDebugging=false;if(__DEV__){isAsyncDebugging=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless;}
|
|
249
248
|
|
|
250
|
-
|
|
249
|
+
var Platform={OS:Platform$1.OS,select:Platform$1.select,isDOMAvailable:isDOMAvailable,canUseEventListeners:canUseEventListeners,canUseViewport:canUseViewport,isAsyncDebugging:isAsyncDebugging};
|
|
251
250
|
|
|
252
|
-
function
|
|
251
|
+
function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}
|
|
253
252
|
|
|
254
|
-
function
|
|
253
|
+
function _isNativeReflectConstruct$3(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}
|
|
255
254
|
|
|
256
|
-
function
|
|
255
|
+
function _construct(){if(_isNativeReflectConstruct$3()){_construct=Reflect.construct.bind();}else {_construct=function(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}
|
|
257
256
|
|
|
258
|
-
var
|
|
257
|
+
function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}
|
|
259
258
|
|
|
260
|
-
var
|
|
259
|
+
function _createSuper$2(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$2();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct$2(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var CodedError=function(_Error){_inherits(CodedError,_Error);var _super=_createSuper$2(CodedError);function CodedError(code,message){var _this;_classCallCheck(this,CodedError);_this=_super.call(this,message);_this.code=code;return _this;}return _createClass(CodedError);}(_wrapNativeSuper(Error));
|
|
261
260
|
|
|
262
|
-
function
|
|
261
|
+
function _createSuper$1(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$1();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct$1(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var UnavailabilityError=function(_CodedError){_inherits(UnavailabilityError,_CodedError);var _super=_createSuper$1(UnavailabilityError);function UnavailabilityError(moduleName,propertyName){_classCallCheck(this,UnavailabilityError);return _super.call(this,'ERR_UNAVAILABLE',"The method or property "+moduleName+"."+propertyName+" is not available on "+Platform.OS+", are you sure you've linked all the native dependencies properly?");}return _createClass(UnavailabilityError);}(CodedError);
|
|
263
262
|
|
|
264
263
|
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
265
264
|
|
|
266
|
-
if(__DEV__&&Platform.OS==='android'&&NativeErrorManager){var onNewException='ExpoModulesCoreErrorManager.onNewException';var
|
|
265
|
+
if(__DEV__&&Platform.OS==='android'&&NativeErrorManager){var onNewException='ExpoModulesCoreErrorManager.onNewException';var eventEmitter=new EventEmitter(NativeErrorManager);eventEmitter.addListener(onNewException,function(_ref){var message=_ref.message;console.error(message);});}global.ExpoModulesCore_CodedError=CodedError;
|
|
267
266
|
|
|
268
|
-
var
|
|
267
|
+
var compareVersions = {exports: {}};
|
|
269
268
|
|
|
270
|
-
|
|
269
|
+
(function(module){(function(root,factory){module.exports=factory();})(commonjsGlobal,function(){var semver=/^v?(?:\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+)(\\.(?:[x*]|\\d+))?(?:-[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\\.[\\da-z\\-]+)*)?)?)?$/i;function indexOrEnd(str,q){return str.indexOf(q)===-1?str.length:str.indexOf(q);}function split(v){var c=v.replace(/^v/,'').replace(/\\+.*$/,'');var patchIndex=indexOrEnd(c,'-');var arr=c.substring(0,patchIndex).split('.');arr.push(c.substring(patchIndex+1));return arr;}function tryParse(v){return isNaN(Number(v))?v:Number(v);}function validate(version){if(typeof version!=='string'){throw new TypeError('Invalid argument expected string');}if(!semver.test(version)){throw new Error('Invalid argument not valid semver (\\''+version+'\\' received)');}}function compareVersions(v1,v2){[v1,v2].forEach(validate);var s1=split(v1);var s2=split(v2);for(var i=0;i<Math.max(s1.length-1,s2.length-1);i++){var n1=parseInt(s1[i]||0,10);var n2=parseInt(s2[i]||0,10);if(n1>n2)return 1;if(n2>n1)return -1;}var sp1=s1[s1.length-1];var sp2=s2[s2.length-1];if(sp1&&sp2){var p1=sp1.split('.').map(tryParse);var p2=sp2.split('.').map(tryParse);for(i=0;i<Math.max(p1.length,p2.length);i++){if(p1[i]===undefined||typeof p2[i]==='string'&&typeof p1[i]==='number')return -1;if(p2[i]===undefined||typeof p1[i]==='string'&&typeof p2[i]==='number')return 1;if(p1[i]>p2[i])return 1;if(p2[i]>p1[i])return -1;}}else if(sp1||sp2){return sp1?-1:1;}return 0;}var allowedOperators=['>','>=','=','<','<='];var operatorResMap={'>':[1],'>=':[0,1],'=':[0],'<=':[-1,0],'<':[-1]};function validateOperator(op){if(typeof op!=='string'){throw new TypeError('Invalid operator type, expected string but got '+typeof op);}if(allowedOperators.indexOf(op)===-1){throw new TypeError('Invalid operator, expected one of '+allowedOperators.join('|'));}}compareVersions.validate=function(version){return typeof version==='string'&&semver.test(version);};compareVersions.compare=function(v1,v2,operator){validateOperator(operator);var res=compareVersions(v1,v2);return operatorResMap[operator].indexOf(res)>-1;};return compareVersions;});})(compareVersions);
|
|
271
270
|
|
|
272
|
-
var
|
|
271
|
+
var PermissionStatus;(function(PermissionStatus){PermissionStatus["GRANTED"]="granted";PermissionStatus["UNDETERMINED"]="undetermined";PermissionStatus["DENIED"]="denied";})(PermissionStatus||(PermissionStatus={}));
|
|
273
272
|
|
|
274
|
-
|
|
273
|
+
var crypto=require$$0;var rng$2=function(){return crypto.randomBytes(16);};
|
|
275
274
|
|
|
276
|
-
var
|
|
275
|
+
var byteToHex=[];for(var i=0;i<256;++i){byteToHex[i]=(i+0x100).toString(16).substr(1);}function bytesToUuid$2(buf,offset){var i=offset||0;var bth=byteToHex;return [bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],'-',bth[buf[i++]],bth[buf[i++]],'-',bth[buf[i++]],bth[buf[i++]],'-',bth[buf[i++]],bth[buf[i++]],'-',bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join('');}var bytesToUuid_1=bytesToUuid$2;
|
|
277
276
|
|
|
278
|
-
var
|
|
277
|
+
var rng$1=rng$2;var bytesToUuid$1=bytesToUuid_1;var _nodeId;var _clockseq;var _lastMSecs=0;var _lastNSecs=0;function v1$1(options,buf,offset){var i=buf&&offset||0;var b=buf||[];options=options||{};var node=options.node||_nodeId;var clockseq=options.clockseq!==undefined?options.clockseq:_clockseq;if(node==null||clockseq==null){var seedBytes=rng$1();if(node==null){node=_nodeId=[seedBytes[0]|0x01,seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]];}if(clockseq==null){clockseq=_clockseq=(seedBytes[6]<<8|seedBytes[7])&0x3fff;}}var msecs=options.msecs!==undefined?options.msecs:new Date().getTime();var nsecs=options.nsecs!==undefined?options.nsecs:_lastNSecs+1;var dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/10000;if(dt<0&&options.clockseq===undefined){clockseq=clockseq+1&0x3fff;}if((dt<0||msecs>_lastMSecs)&&options.nsecs===undefined){nsecs=0;}if(nsecs>=10000){throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');}_lastMSecs=msecs;_lastNSecs=nsecs;_clockseq=clockseq;msecs+=12219292800000;var tl=((msecs&0xfffffff)*10000+nsecs)%0x100000000;b[i++]=tl>>>24&0xff;b[i++]=tl>>>16&0xff;b[i++]=tl>>>8&0xff;b[i++]=tl&0xff;var tmh=msecs/0x100000000*10000&0xfffffff;b[i++]=tmh>>>8&0xff;b[i++]=tmh&0xff;b[i++]=tmh>>>24&0xf|0x10;b[i++]=tmh>>>16&0xff;b[i++]=clockseq>>>8|0x80;b[i++]=clockseq&0xff;for(var n=0;n<6;++n){b[i+n]=node[n];}return buf?buf:bytesToUuid$1(b);}var v1_1=v1$1;
|
|
278
|
+
|
|
279
|
+
var rng=rng$2;var bytesToUuid=bytesToUuid_1;function v4$1(options,buf,offset){var i=buf&&offset||0;if(typeof options=='string'){buf=options==='binary'?new Array(16):null;options=null;}options=options||{};var rnds=options.random||(options.rng||rng)();rnds[6]=rnds[6]&0x0f|0x40;rnds[8]=rnds[8]&0x3f|0x80;if(buf){for(var ii=0;ii<16;++ii){buf[i+ii]=rnds[ii];}}return buf||bytesToUuid(rnds);}var v4_1=v4$1;
|
|
280
|
+
|
|
281
|
+
var v1=v1_1;var v4=v4_1;var uuid=v4;uuid.v1=v1;uuid.v4=v4;var uuid_1=uuid;
|
|
282
|
+
|
|
283
|
+
var platformModule$1={get name(){return 'ExponentFileSystem';},get documentDirectory(){return null;},get cacheDirectory(){return null;},get bundledAssets(){return null;},get bundleDirectory(){return null;},addListener:function addListener(){},removeListeners:function removeListeners(){}};var ExponentFileSystemShim = platformModule$1;
|
|
284
|
+
|
|
285
|
+
var platformModule;if(NativeModulesProxy.ExponentFileSystem){platformModule=NativeModulesProxy.ExponentFileSystem;}else {platformModule=ExponentFileSystemShim;}var ExponentFileSystem = platformModule;
|
|
279
286
|
|
|
280
287
|
var FileSystemSessionType;(function(FileSystemSessionType){FileSystemSessionType[FileSystemSessionType["BACKGROUND"]=0]="BACKGROUND";FileSystemSessionType[FileSystemSessionType["FOREGROUND"]=1]="FOREGROUND";})(FileSystemSessionType||(FileSystemSessionType={}));var FileSystemUploadType;(function(FileSystemUploadType){FileSystemUploadType[FileSystemUploadType["BINARY_CONTENT"]=0]="BINARY_CONTENT";FileSystemUploadType[FileSystemUploadType["MULTIPART"]=1]="MULTIPART";})(FileSystemUploadType||(FileSystemUploadType={}));var EncodingType;(function(EncodingType){EncodingType["UTF8"]="utf8";EncodingType["Base64"]="base64";})(EncodingType||(EncodingType={}));
|
|
281
288
|
|
|
282
|
-
function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct=function _isNativeReflectConstruct(){return !!t;})();}if(!ExponentFileSystem){console.warn("No native ExponentFileSystem module found, are you sure the expo-file-system's module is linked properly?");}new EventEmitter(ExponentFileSystem);function normalizeEndingSlash(p){if(p!=null){return p.replace(/\\/*$/,'')+'/';}return null;}var documentDirectory=normalizeEndingSlash(ExponentFileSystem.documentDirectory);var cacheDirectory=normalizeEndingSlash(ExponentFileSystem.cacheDirectory);var bundleDirectory=normalizeEndingSlash(ExponentFileSystem.bundleDirectory);function getInfoAsync(){return _getInfoAsync.apply(this,arguments);}function _getInfoAsync(){_getInfoAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.getInfoAsync){throw new UnavailabilityError('expo-file-system','getInfoAsync');}return yield ExponentFileSystem.getInfoAsync(fileUri,options);});return _getInfoAsync.apply(this,arguments);}function readAsStringAsync(){return _readAsStringAsync.apply(this,arguments);}function _readAsStringAsync(){_readAsStringAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.readAsStringAsync){throw new UnavailabilityError('expo-file-system','readAsStringAsync');}return yield ExponentFileSystem.readAsStringAsync(fileUri,options);});return _readAsStringAsync.apply(this,arguments);}function getContentUriAsync(){return _getContentUriAsync.apply(this,arguments);}function _getContentUriAsync(){_getContentUriAsync=_asyncToGenerator(function*(fileUri){if(Platform$1.OS==='android'){if(!ExponentFileSystem.getContentUriAsync){throw new UnavailabilityError('expo-file-system','getContentUriAsync');}return yield ExponentFileSystem.getContentUriAsync(fileUri);}else {return fileUri;}});return _getContentUriAsync.apply(this,arguments);}function writeAsStringAsync(){return _writeAsStringAsync.apply(this,arguments);}function _writeAsStringAsync(){_writeAsStringAsync=_asyncToGenerator(function*(fileUri,contents){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.writeAsStringAsync){throw new UnavailabilityError('expo-file-system','writeAsStringAsync');}return yield ExponentFileSystem.writeAsStringAsync(fileUri,contents,options);});return _writeAsStringAsync.apply(this,arguments);}function deleteAsync(){return _deleteAsync.apply(this,arguments);}function _deleteAsync(){_deleteAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.deleteAsync){throw new UnavailabilityError('expo-file-system','deleteAsync');}return yield ExponentFileSystem.deleteAsync(fileUri,options);});return _deleteAsync.apply(this,arguments);}function deleteLegacyDocumentDirectoryAndroid(){return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function _deleteLegacyDocumentDirectoryAndroid(){_deleteLegacyDocumentDirectoryAndroid=_asyncToGenerator(function*(){if(Platform$1.OS!=='android'||documentDirectory==null){return;}return yield deleteAsync(\`\${documentDirectory}ExperienceData/\`,{idempotent:true});});return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function moveAsync(){return _moveAsync.apply(this,arguments);}function _moveAsync(){_moveAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.moveAsync){throw new UnavailabilityError('expo-file-system','moveAsync');}return yield ExponentFileSystem.moveAsync(options);});return _moveAsync.apply(this,arguments);}function copyAsync(){return _copyAsync.apply(this,arguments);}function _copyAsync(){_copyAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.copyAsync){throw new UnavailabilityError('expo-file-system','copyAsync');}return yield ExponentFileSystem.copyAsync(options);});return _copyAsync.apply(this,arguments);}function makeDirectoryAsync(){return _makeDirectoryAsync.apply(this,arguments);}function _makeDirectoryAsync(){_makeDirectoryAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.makeDirectoryAsync){throw new UnavailabilityError('expo-file-system','makeDirectoryAsync');}return yield ExponentFileSystem.makeDirectoryAsync(fileUri,options);});return _makeDirectoryAsync.apply(this,arguments);}function readDirectoryAsync(){return _readDirectoryAsync.apply(this,arguments);}function _readDirectoryAsync(){_readDirectoryAsync=_asyncToGenerator(function*(fileUri){if(!ExponentFileSystem.readDirectoryAsync){throw new UnavailabilityError('expo-file-system','readDirectoryAsync');}return yield ExponentFileSystem.readDirectoryAsync(fileUri);});return _readDirectoryAsync.apply(this,arguments);}function getFreeDiskStorageAsync(){return _getFreeDiskStorageAsync.apply(this,arguments);}function _getFreeDiskStorageAsync(){_getFreeDiskStorageAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getFreeDiskStorageAsync){throw new UnavailabilityError('expo-file-system','getFreeDiskStorageAsync');}return yield ExponentFileSystem.getFreeDiskStorageAsync();});return _getFreeDiskStorageAsync.apply(this,arguments);}function getTotalDiskCapacityAsync(){return _getTotalDiskCapacityAsync.apply(this,arguments);}function _getTotalDiskCapacityAsync(){_getTotalDiskCapacityAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getTotalDiskCapacityAsync){throw new UnavailabilityError('expo-file-system','getTotalDiskCapacityAsync');}return yield ExponentFileSystem.getTotalDiskCapacityAsync();});return _getTotalDiskCapacityAsync.apply(this,arguments);}function downloadAsync(){return _downloadAsync.apply(this,arguments);}function _downloadAsync(){_downloadAsync=_asyncToGenerator(function*(uri,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.downloadAsync){throw new UnavailabilityError('expo-file-system','downloadAsync');}return yield ExponentFileSystem.downloadAsync(uri,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND},options));});return _downloadAsync.apply(this,arguments);}function uploadAsync(){return _uploadAsync.apply(this,arguments);}function _uploadAsync(){_uploadAsync=_asyncToGenerator(function*(url,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.uploadAsync){throw new UnavailabilityError('expo-file-system','uploadAsync');}return yield ExponentFileSystem.uploadAsync(url,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:(options.httpMethod||'POST').toUpperCase()}));});return _uploadAsync.apply(this,arguments);}function createDownloadResumable(uri,fileUri,options,callback,resumeData){return new DownloadResumable(uri,fileUri,options,callback,resumeData);}function createUploadTask(url,fileUri,options,callback){return new UploadTask(url,fileUri,options,callback);}var FileSystemCancellableNetworkTask=function(){function FileSystemCancellableNetworkTask(){_classCallCheck(this,FileSystemCancellableNetworkTask);this._uuid=uuid.v4();this.taskWasCanceled=false;this.emitter=new EventEmitter(ExponentFileSystem);}return _createClass(FileSystemCancellableNetworkTask,[{key:"cancelAsync",value:function(){var _cancelAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.networkTaskCancelAsync){throw new UnavailabilityError('expo-file-system','networkTaskCancelAsync');}this.removeSubscription();this.taskWasCanceled=true;return yield ExponentFileSystem.networkTaskCancelAsync(this.uuid);});function cancelAsync(){return _cancelAsync.apply(this,arguments);}return cancelAsync;}()},{key:"isTaskCancelled",value:function isTaskCancelled(){if(this.taskWasCanceled){console.warn('This task was already canceled.');return true;}return false;}},{key:"uuid",get:function get(){return this._uuid;}},{key:"addSubscription",value:function addSubscription(){var _this=this;if(this.subscription){return;}this.subscription=this.emitter.addListener(this.getEventName(),function(event){if(event.uuid===_this.uuid){var callback=_this.getCallback();if(callback){callback(event.data);}}});}},{key:"removeSubscription",value:function removeSubscription(){if(!this.subscription){return;}this.emitter.removeSubscription(this.subscription);this.subscription=null;}}]);}();var UploadTask=function(_FileSystemCancellabl){function UploadTask(url,fileUri,options,callback){var _options$httpMethod;var _this2;_classCallCheck(this,UploadTask);_this2=_callSuper(this,UploadTask);_this2.url=url;_this2.fileUri=fileUri;_this2.callback=callback;var httpMethod=(options==null?void 0:(_options$httpMethod=options.httpMethod)==null?void 0:_options$httpMethod.toUpperCase())||'POST';_this2.options=Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:httpMethod});return _this2;}_inherits(UploadTask,_FileSystemCancellabl);return _createClass(UploadTask,[{key:"getEventName",value:function getEventName(){return 'expo-file-system.uploadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"uploadAsync",value:function(){var _uploadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.uploadTaskStartAsync){throw new UnavailabilityError('expo-file-system','uploadTaskStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();var result=yield ExponentFileSystem.uploadTaskStartAsync(this.url,this.fileUri,this.uuid,this.options);this.removeSubscription();return result;});function uploadAsync(){return _uploadAsync2.apply(this,arguments);}return uploadAsync;}()}]);}(FileSystemCancellableNetworkTask);var DownloadResumable=function(_FileSystemCancellabl2){function DownloadResumable(url,_fileUri){var _this3;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var callback=arguments.length>3?arguments[3]:undefined;var resumeData=arguments.length>4?arguments[4]:undefined;_classCallCheck(this,DownloadResumable);_this3=_callSuper(this,DownloadResumable);_this3.url=url;_this3._fileUri=_fileUri;_this3.options=options;_this3.callback=callback;_this3.resumeData=resumeData;return _this3;}_inherits(DownloadResumable,_FileSystemCancellabl2);return _createClass(DownloadResumable,[{key:"fileUri",get:function get(){return this._fileUri;}},{key:"getEventName",value:function getEventName(){return 'expo-file-system.downloadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"downloadAsync",value:(function(){var _downloadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this._fileUri,this.uuid,this.options,this.resumeData);});function downloadAsync(){return _downloadAsync2.apply(this,arguments);}return downloadAsync;}())},{key:"pauseAsync",value:(function(){var _pauseAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumablePauseAsync){throw new UnavailabilityError('expo-file-system','downloadResumablePauseAsync');}if(this.isTaskCancelled()){return {fileUri:this._fileUri,options:this.options,url:this.url};}var pauseResult=yield ExponentFileSystem.downloadResumablePauseAsync(this.uuid);this.removeSubscription();if(pauseResult){this.resumeData=pauseResult.resumeData;return this.savable();}else {throw new Error('Unable to generate a savable pause state');}});function pauseAsync(){return _pauseAsync.apply(this,arguments);}return pauseAsync;}())},{key:"resumeAsync",value:(function(){var _resumeAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this.fileUri,this.uuid,this.options,this.resumeData);});function resumeAsync(){return _resumeAsync.apply(this,arguments);}return resumeAsync;}())},{key:"savable",value:function savable(){return {url:this.url,fileUri:this.fileUri,options:this.options,resumeData:this.resumeData};}}]);}(FileSystemCancellableNetworkTask);var baseReadAsStringAsync=readAsStringAsync;var baseWriteAsStringAsync=writeAsStringAsync;var baseDeleteAsync=deleteAsync;var baseMoveAsync=moveAsync;var baseCopyAsync=copyAsync;var StorageAccessFramework;(function(StorageAccessFramework){StorageAccessFramework.getUriForDirectoryInRoot=function getUriForDirectoryInRoot(folderName){return \`content://com.android.externalstorage.documents/tree/primary:\${folderName}/document/primary:\${folderName}\`;};function requestDirectoryPermissionsAsync(){return _requestDirectoryPermissionsAsync.apply(this,arguments);}function _requestDirectoryPermissionsAsync(){_requestDirectoryPermissionsAsync=_asyncToGenerator(function*(){var initialFileUrl=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!ExponentFileSystem.requestDirectoryPermissionsAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.requestDirectoryPermissionsAsync');}return yield ExponentFileSystem.requestDirectoryPermissionsAsync(initialFileUrl);});return _requestDirectoryPermissionsAsync.apply(this,arguments);}StorageAccessFramework.requestDirectoryPermissionsAsync=requestDirectoryPermissionsAsync;function readDirectoryAsync(_x15){return _readDirectoryAsync2.apply(this,arguments);}function _readDirectoryAsync2(){_readDirectoryAsync2=_asyncToGenerator(function*(dirUri){if(!ExponentFileSystem.readSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.readDirectoryAsync');}return yield ExponentFileSystem.readSAFDirectoryAsync(dirUri);});return _readDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.readDirectoryAsync=readDirectoryAsync;function makeDirectoryAsync(_x16,_x17){return _makeDirectoryAsync2.apply(this,arguments);}function _makeDirectoryAsync2(){_makeDirectoryAsync2=_asyncToGenerator(function*(parentUri,dirName){if(!ExponentFileSystem.makeSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.makeDirectoryAsync');}return yield ExponentFileSystem.makeSAFDirectoryAsync(parentUri,dirName);});return _makeDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.makeDirectoryAsync=makeDirectoryAsync;function createFileAsync(_x18,_x19,_x20){return _createFileAsync.apply(this,arguments);}function _createFileAsync(){_createFileAsync=_asyncToGenerator(function*(parentUri,fileName,mimeType){if(!ExponentFileSystem.createSAFFileAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.createFileAsync');}return yield ExponentFileSystem.createSAFFileAsync(parentUri,fileName,mimeType);});return _createFileAsync.apply(this,arguments);}StorageAccessFramework.createFileAsync=createFileAsync;StorageAccessFramework.writeAsStringAsync=baseWriteAsStringAsync;StorageAccessFramework.readAsStringAsync=baseReadAsStringAsync;StorageAccessFramework.deleteAsync=baseDeleteAsync;StorageAccessFramework.moveAsync=baseMoveAsync;StorageAccessFramework.copyAsync=baseCopyAsync;})(StorageAccessFramework||(StorageAccessFramework={}));
|
|
289
|
+
function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}if(!ExponentFileSystem){console.warn("No native ExponentFileSystem module found, are you sure the expo-file-system's module is linked properly?");}new EventEmitter(ExponentFileSystem);function normalizeEndingSlash(p){if(p!=null){return p.replace(/\\/*$/,'')+'/';}return null;}var documentDirectory=normalizeEndingSlash(ExponentFileSystem.documentDirectory);var cacheDirectory=normalizeEndingSlash(ExponentFileSystem.cacheDirectory);var bundledAssets=ExponentFileSystem.bundledAssets,bundleDirectory=ExponentFileSystem.bundleDirectory;function getInfoAsync(){return _getInfoAsync.apply(this,arguments);}function _getInfoAsync(){_getInfoAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.getInfoAsync){throw new UnavailabilityError('expo-file-system','getInfoAsync');}return yield ExponentFileSystem.getInfoAsync(fileUri,options);});return _getInfoAsync.apply(this,arguments);}function readAsStringAsync(){return _readAsStringAsync.apply(this,arguments);}function _readAsStringAsync(){_readAsStringAsync=_asyncToGenerator(function*(fileUri,options){if(!ExponentFileSystem.readAsStringAsync){throw new UnavailabilityError('expo-file-system','readAsStringAsync');}return yield ExponentFileSystem.readAsStringAsync(fileUri,options||{});});return _readAsStringAsync.apply(this,arguments);}function getContentUriAsync(){return _getContentUriAsync.apply(this,arguments);}function _getContentUriAsync(){_getContentUriAsync=_asyncToGenerator(function*(fileUri){if(Platform$1.OS==='android'){if(!ExponentFileSystem.getContentUriAsync){throw new UnavailabilityError('expo-file-system','getContentUriAsync');}return yield ExponentFileSystem.getContentUriAsync(fileUri);}else {return new Promise(function(resolve){resolve(fileUri);});}});return _getContentUriAsync.apply(this,arguments);}function writeAsStringAsync(){return _writeAsStringAsync.apply(this,arguments);}function _writeAsStringAsync(){_writeAsStringAsync=_asyncToGenerator(function*(fileUri,contents){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.writeAsStringAsync){throw new UnavailabilityError('expo-file-system','writeAsStringAsync');}return yield ExponentFileSystem.writeAsStringAsync(fileUri,contents,options);});return _writeAsStringAsync.apply(this,arguments);}function deleteAsync(){return _deleteAsync.apply(this,arguments);}function _deleteAsync(){_deleteAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.deleteAsync){throw new UnavailabilityError('expo-file-system','deleteAsync');}return yield ExponentFileSystem.deleteAsync(fileUri,options);});return _deleteAsync.apply(this,arguments);}function deleteLegacyDocumentDirectoryAndroid(){return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function _deleteLegacyDocumentDirectoryAndroid(){_deleteLegacyDocumentDirectoryAndroid=_asyncToGenerator(function*(){if(Platform$1.OS!=='android'||documentDirectory==null){return;}return yield deleteAsync(documentDirectory+"ExperienceData/",{idempotent:true});});return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function moveAsync(){return _moveAsync.apply(this,arguments);}function _moveAsync(){_moveAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.moveAsync){throw new UnavailabilityError('expo-file-system','moveAsync');}return yield ExponentFileSystem.moveAsync(options);});return _moveAsync.apply(this,arguments);}function copyAsync(){return _copyAsync.apply(this,arguments);}function _copyAsync(){_copyAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.copyAsync){throw new UnavailabilityError('expo-file-system','copyAsync');}return yield ExponentFileSystem.copyAsync(options);});return _copyAsync.apply(this,arguments);}function makeDirectoryAsync(){return _makeDirectoryAsync.apply(this,arguments);}function _makeDirectoryAsync(){_makeDirectoryAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.makeDirectoryAsync){throw new UnavailabilityError('expo-file-system','makeDirectoryAsync');}return yield ExponentFileSystem.makeDirectoryAsync(fileUri,options);});return _makeDirectoryAsync.apply(this,arguments);}function readDirectoryAsync(){return _readDirectoryAsync.apply(this,arguments);}function _readDirectoryAsync(){_readDirectoryAsync=_asyncToGenerator(function*(fileUri){if(!ExponentFileSystem.readDirectoryAsync){throw new UnavailabilityError('expo-file-system','readDirectoryAsync');}return yield ExponentFileSystem.readDirectoryAsync(fileUri,{});});return _readDirectoryAsync.apply(this,arguments);}function getFreeDiskStorageAsync(){return _getFreeDiskStorageAsync.apply(this,arguments);}function _getFreeDiskStorageAsync(){_getFreeDiskStorageAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getFreeDiskStorageAsync){throw new UnavailabilityError('expo-file-system','getFreeDiskStorageAsync');}return yield ExponentFileSystem.getFreeDiskStorageAsync();});return _getFreeDiskStorageAsync.apply(this,arguments);}function getTotalDiskCapacityAsync(){return _getTotalDiskCapacityAsync.apply(this,arguments);}function _getTotalDiskCapacityAsync(){_getTotalDiskCapacityAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getTotalDiskCapacityAsync){throw new UnavailabilityError('expo-file-system','getTotalDiskCapacityAsync');}return yield ExponentFileSystem.getTotalDiskCapacityAsync();});return _getTotalDiskCapacityAsync.apply(this,arguments);}function downloadAsync(){return _downloadAsync.apply(this,arguments);}function _downloadAsync(){_downloadAsync=_asyncToGenerator(function*(uri,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.downloadAsync){throw new UnavailabilityError('expo-file-system','downloadAsync');}return yield ExponentFileSystem.downloadAsync(uri,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND},options));});return _downloadAsync.apply(this,arguments);}function uploadAsync(){return _uploadAsync.apply(this,arguments);}function _uploadAsync(){_uploadAsync=_asyncToGenerator(function*(url,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.uploadAsync){throw new UnavailabilityError('expo-file-system','uploadAsync');}return yield ExponentFileSystem.uploadAsync(url,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:(options.httpMethod||'POST').toUpperCase()}));});return _uploadAsync.apply(this,arguments);}function createDownloadResumable(uri,fileUri,options,callback,resumeData){return new DownloadResumable(uri,fileUri,options,callback,resumeData);}function createUploadTask(url,fileUri,options,callback){return new UploadTask(url,fileUri,options,callback);}var FileSystemCancellableNetworkTask=function(){function FileSystemCancellableNetworkTask(){_classCallCheck(this,FileSystemCancellableNetworkTask);this._uuid=uuid_1.v4();this.taskWasCanceled=false;this.emitter=new EventEmitter(ExponentFileSystem);}_createClass(FileSystemCancellableNetworkTask,[{key:"cancelAsync",value:function(){var _cancelAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.networkTaskCancelAsync){throw new UnavailabilityError('expo-file-system','networkTaskCancelAsync');}this.removeSubscription();this.taskWasCanceled=true;return yield ExponentFileSystem.networkTaskCancelAsync(this.uuid);});function cancelAsync(){return _cancelAsync.apply(this,arguments);}return cancelAsync;}()},{key:"isTaskCancelled",value:function isTaskCancelled(){if(this.taskWasCanceled){console.warn('This task was already canceled.');return true;}return false;}},{key:"uuid",get:function get(){return this._uuid;}},{key:"addSubscription",value:function addSubscription(){var _this=this;if(this.subscription){return;}this.subscription=this.emitter.addListener(this.getEventName(),function(event){if(event.uuid===_this.uuid){var callback=_this.getCallback();if(callback){callback(event.data);}}});}},{key:"removeSubscription",value:function removeSubscription(){if(!this.subscription){return;}this.emitter.removeSubscription(this.subscription);this.subscription=null;}}]);return FileSystemCancellableNetworkTask;}();var UploadTask=function(_FileSystemCancellabl){_inherits(UploadTask,_FileSystemCancellabl);var _super=_createSuper(UploadTask);function UploadTask(url,fileUri,options,callback){var _options$httpMethod;var _this2;_classCallCheck(this,UploadTask);_this2=_super.call(this);_this2.url=url;_this2.fileUri=fileUri;_this2.callback=callback;var httpMethod=(options==null?void 0:(_options$httpMethod=options.httpMethod)==null?void 0:_options$httpMethod.toUpperCase())||'POST';_this2.options=Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:httpMethod});return _this2;}_createClass(UploadTask,[{key:"getEventName",value:function getEventName(){return 'expo-file-system.uploadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"uploadAsync",value:function(){var _uploadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.uploadTaskStartAsync){throw new UnavailabilityError('expo-file-system','uploadTaskStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();var result=yield ExponentFileSystem.uploadTaskStartAsync(this.url,this.fileUri,this.uuid,this.options);this.removeSubscription();return result;});function uploadAsync(){return _uploadAsync2.apply(this,arguments);}return uploadAsync;}()}]);return UploadTask;}(FileSystemCancellableNetworkTask);var DownloadResumable=function(_FileSystemCancellabl2){_inherits(DownloadResumable,_FileSystemCancellabl2);var _super2=_createSuper(DownloadResumable);function DownloadResumable(url,_fileUri){var _this3;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var callback=arguments.length>3?arguments[3]:undefined;var resumeData=arguments.length>4?arguments[4]:undefined;_classCallCheck(this,DownloadResumable);_this3=_super2.call(this);_this3.url=url;_this3._fileUri=_fileUri;_this3.options=options;_this3.callback=callback;_this3.resumeData=resumeData;return _this3;}_createClass(DownloadResumable,[{key:"fileUri",get:function get(){return this._fileUri;}},{key:"getEventName",value:function getEventName(){return 'expo-file-system.downloadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"downloadAsync",value:function(){var _downloadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this._fileUri,this.uuid,this.options,this.resumeData);});function downloadAsync(){return _downloadAsync2.apply(this,arguments);}return downloadAsync;}()},{key:"pauseAsync",value:function(){var _pauseAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumablePauseAsync){throw new UnavailabilityError('expo-file-system','downloadResumablePauseAsync');}if(this.isTaskCancelled()){return {fileUri:this._fileUri,options:this.options,url:this.url};}var pauseResult=yield ExponentFileSystem.downloadResumablePauseAsync(this.uuid);this.removeSubscription();if(pauseResult){this.resumeData=pauseResult.resumeData;return this.savable();}else {throw new Error('Unable to generate a savable pause state');}});function pauseAsync(){return _pauseAsync.apply(this,arguments);}return pauseAsync;}()},{key:"resumeAsync",value:function(){var _resumeAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this.fileUri,this.uuid,this.options,this.resumeData);});function resumeAsync(){return _resumeAsync.apply(this,arguments);}return resumeAsync;}()},{key:"savable",value:function savable(){return {url:this.url,fileUri:this.fileUri,options:this.options,resumeData:this.resumeData};}}]);return DownloadResumable;}(FileSystemCancellableNetworkTask);var baseReadAsStringAsync=readAsStringAsync;var baseWriteAsStringAsync=writeAsStringAsync;var baseDeleteAsync=deleteAsync;var baseMoveAsync=moveAsync;var baseCopyAsync=copyAsync;var StorageAccessFramework;(function(StorageAccessFramework){StorageAccessFramework.getUriForDirectoryInRoot=function getUriForDirectoryInRoot(folderName){return "content://com.android.externalstorage.documents/tree/primary:"+folderName+"/document/primary:"+folderName;};function requestDirectoryPermissionsAsync(){return _requestDirectoryPermissionsAsync.apply(this,arguments);}function _requestDirectoryPermissionsAsync(){_requestDirectoryPermissionsAsync=_asyncToGenerator(function*(){var initialFileUrl=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!ExponentFileSystem.requestDirectoryPermissionsAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.requestDirectoryPermissionsAsync');}return yield ExponentFileSystem.requestDirectoryPermissionsAsync(initialFileUrl);});return _requestDirectoryPermissionsAsync.apply(this,arguments);}StorageAccessFramework.requestDirectoryPermissionsAsync=requestDirectoryPermissionsAsync;function readDirectoryAsync(_x16){return _readDirectoryAsync2.apply(this,arguments);}function _readDirectoryAsync2(){_readDirectoryAsync2=_asyncToGenerator(function*(dirUri){if(!ExponentFileSystem.readSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.readDirectoryAsync');}return yield ExponentFileSystem.readSAFDirectoryAsync(dirUri,{});});return _readDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.readDirectoryAsync=readDirectoryAsync;function makeDirectoryAsync(_x17,_x18){return _makeDirectoryAsync2.apply(this,arguments);}function _makeDirectoryAsync2(){_makeDirectoryAsync2=_asyncToGenerator(function*(parentUri,dirName){if(!ExponentFileSystem.makeSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.makeDirectoryAsync');}return yield ExponentFileSystem.makeSAFDirectoryAsync(parentUri,dirName);});return _makeDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.makeDirectoryAsync=makeDirectoryAsync;function createFileAsync(_x19,_x20,_x21){return _createFileAsync.apply(this,arguments);}function _createFileAsync(){_createFileAsync=_asyncToGenerator(function*(parentUri,fileName,mimeType){if(!ExponentFileSystem.createSAFFileAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.createFileAsync');}return yield ExponentFileSystem.createSAFFileAsync(parentUri,fileName,mimeType);});return _createFileAsync.apply(this,arguments);}StorageAccessFramework.createFileAsync=createFileAsync;StorageAccessFramework.writeAsStringAsync=baseWriteAsStringAsync;StorageAccessFramework.readAsStringAsync=baseReadAsStringAsync;StorageAccessFramework.deleteAsync=baseDeleteAsync;StorageAccessFramework.moveAsync=baseMoveAsync;StorageAccessFramework.copyAsync=baseCopyAsync;})(StorageAccessFramework||(StorageAccessFramework={}));
|
|
283
290
|
|
|
284
291
|
var fileBuild = /*#__PURE__*/Object.freeze({
|
|
285
292
|
__proto__: null,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
get
|
|
289
|
-
|
|
290
|
-
bundleDirectory: bundleDirectory,
|
|
293
|
+
get EncodingType () { return EncodingType; },
|
|
294
|
+
get FileSystemSessionType () { return FileSystemSessionType; },
|
|
295
|
+
get FileSystemUploadType () { return FileSystemUploadType; },
|
|
296
|
+
documentDirectory: documentDirectory,
|
|
291
297
|
cacheDirectory: cacheDirectory,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
298
|
+
bundledAssets: bundledAssets,
|
|
299
|
+
bundleDirectory: bundleDirectory,
|
|
300
|
+
getInfoAsync: getInfoAsync,
|
|
301
|
+
readAsStringAsync: readAsStringAsync,
|
|
302
|
+
getContentUriAsync: getContentUriAsync,
|
|
303
|
+
writeAsStringAsync: writeAsStringAsync,
|
|
295
304
|
deleteAsync: deleteAsync,
|
|
296
305
|
deleteLegacyDocumentDirectoryAndroid: deleteLegacyDocumentDirectoryAndroid,
|
|
297
|
-
documentDirectory: documentDirectory,
|
|
298
|
-
downloadAsync: downloadAsync,
|
|
299
|
-
getContentUriAsync: getContentUriAsync,
|
|
300
|
-
getFreeDiskStorageAsync: getFreeDiskStorageAsync,
|
|
301
|
-
getInfoAsync: getInfoAsync,
|
|
302
|
-
getTotalDiskCapacityAsync: getTotalDiskCapacityAsync,
|
|
303
|
-
makeDirectoryAsync: makeDirectoryAsync,
|
|
304
306
|
moveAsync: moveAsync,
|
|
305
|
-
|
|
307
|
+
copyAsync: copyAsync,
|
|
308
|
+
makeDirectoryAsync: makeDirectoryAsync,
|
|
306
309
|
readDirectoryAsync: readDirectoryAsync,
|
|
310
|
+
getFreeDiskStorageAsync: getFreeDiskStorageAsync,
|
|
311
|
+
getTotalDiskCapacityAsync: getTotalDiskCapacityAsync,
|
|
312
|
+
downloadAsync: downloadAsync,
|
|
307
313
|
uploadAsync: uploadAsync,
|
|
308
|
-
|
|
314
|
+
createDownloadResumable: createDownloadResumable,
|
|
315
|
+
createUploadTask: createUploadTask,
|
|
316
|
+
FileSystemCancellableNetworkTask: FileSystemCancellableNetworkTask,
|
|
317
|
+
UploadTask: UploadTask,
|
|
318
|
+
DownloadResumable: DownloadResumable,
|
|
319
|
+
get StorageAccessFramework () { return StorageAccessFramework; }
|
|
309
320
|
});
|
|
310
321
|
|
|
311
322
|
console.log({fileBuild:fileBuild});
|
|
@@ -313,9 +324,10 @@ console.log({fileBuild:fileBuild});
|
|
|
313
324
|
]
|
|
314
325
|
`;
|
|
315
326
|
|
|
316
|
-
exports[`build_components
|
|
327
|
+
exports[`build_components nativeComponents not set 1`] = `
|
|
317
328
|
[
|
|
318
|
-
"import
|
|
329
|
+
"import 'react';
|
|
330
|
+
import View from '@tarojs/components-rn/dist/components/View';
|
|
319
331
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
320
332
|
import taro from '@tarojs/taro-rn';
|
|
321
333
|
import { StyleSheet } from 'react-native';
|
|
@@ -348,31 +360,36 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
348
360
|
}
|
|
349
361
|
});
|
|
350
362
|
|
|
351
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
363
|
+
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]},"line-"+i));})});}function Item(_ref2){var title=_ref2.title,children=_ref2.children,style=_ref2.style;return jsxs(View,{style:_mergeEleStyles(_styleSheet["cellItem"],Object.assign({},style)),children:[jsx(Text,{style:_styleSheet["cellItem__title"],children:title}),jsx(View,{style:_styleSheet["cellItem__content"],children:children})]});}Cell.Item=Item;
|
|
352
364
|
|
|
353
365
|
export { Cell as default };
|
|
354
366
|
",
|
|
355
367
|
]
|
|
356
368
|
`;
|
|
357
369
|
|
|
358
|
-
exports[`build_components
|
|
370
|
+
exports[`build_components require react-native component 1`] = `
|
|
359
371
|
[
|
|
360
|
-
"import {
|
|
361
|
-
import {
|
|
372
|
+
"import { Children, Component } from 'react';
|
|
373
|
+
import { AppRegistry } from 'react-native';
|
|
374
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
362
375
|
|
|
363
376
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
364
377
|
|
|
365
|
-
function _typeof(
|
|
378
|
+
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}
|
|
366
379
|
|
|
367
|
-
function
|
|
380
|
+
function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return (hint==="string"?String:Number)(input);}
|
|
368
381
|
|
|
369
|
-
function
|
|
382
|
+
function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}
|
|
370
383
|
|
|
371
|
-
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,
|
|
384
|
+
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}
|
|
372
385
|
|
|
373
386
|
function ChildrenWrapper(props){return jsx(Fragment,{children:props.children});}
|
|
374
387
|
|
|
375
|
-
var RootControllerChanges;(function(RootControllerChanges){RootControllerChanges[RootControllerChanges["Insert"]=0]="Insert";RootControllerChanges[RootControllerChanges["Update"]=1]="Update";RootControllerChanges[RootControllerChanges["Remove"]=2]="Remove";})(RootControllerChanges||(RootControllerChanges={}));var RootController=function(){function RootController(){_classCallCheck(this,RootController);this.siblings=new Set();this.pendingActions=[];this.callback=null;}
|
|
388
|
+
var RootControllerChanges;(function(RootControllerChanges){RootControllerChanges[RootControllerChanges["Insert"]=0]="Insert";RootControllerChanges[RootControllerChanges["Update"]=1]="Update";RootControllerChanges[RootControllerChanges["Remove"]=2]="Remove";})(RootControllerChanges||(RootControllerChanges={}));var RootController=function(){function RootController(){_classCallCheck(this,RootController);this.siblings=new Set();this.pendingActions=[];this.callback=null;}_createClass(RootController,[{key:"update",value:function update(id,element,callback){if(!this.siblings.has(id)){this.emit(id,{change:RootControllerChanges.Insert,element:element,updateCallback:callback});this.siblings.add(id);}else {this.emit(id,{change:RootControllerChanges.Update,element:element,updateCallback:callback});}}},{key:"destroy",value:function destroy(id,callback){if(this.siblings.has(id)){this.emit(id,{change:RootControllerChanges.Remove,element:null,updateCallback:callback});this.siblings.delete(id);}else if(callback){callback();}}},{key:"setCallback",value:function setCallback(callback){this.callback=callback;this.pendingActions.forEach(function(_ref){var id=_ref.id,action=_ref.action;callback(id,action);});}},{key:"emit",value:function emit(id,action){if(this.callback){this.callback(id,action);}else {this.pendingActions.push({action:action,id:id});}}}]);return RootController;}();
|
|
389
|
+
|
|
390
|
+
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
391
|
+
|
|
392
|
+
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}
|
|
376
393
|
|
|
377
394
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
378
395
|
|
|
@@ -380,26 +397,23 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
380
397
|
|
|
381
398
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
382
399
|
|
|
383
|
-
function
|
|
400
|
+
function _createSuper$1(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$1();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct$1(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var _default$1=function(_Component){_inherits(_default,_Component);var _super=_createSuper$1(_default);function _default(){_classCallCheck(this,_default);return _super.apply(this,arguments);}_createClass(_default,[{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){return nextProps.shouldUpdate;}},{key:"render",value:function render(){var child=this.props.children;return child===null||child===false?null:Children.only(child);}}]);return _default;}(Component);
|
|
384
401
|
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
function _callSuper$1(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct$1()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct$1(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct$1=function _isNativeReflectConstruct(){return !!t;})();}var _default$1=function(_Component){function _default(){_classCallCheck(this,_default);return _callSuper$1(this,_default,arguments);}_inherits(_default,_Component);return _createClass(_default,[{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){return nextProps.shouldUpdate;}},{key:"render",value:function render(){var child=this.props.children;return child===null||child===false?null:Children.only(child);}}]);}(Component);
|
|
388
|
-
|
|
389
|
-
function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct=function _isNativeReflectConstruct(){return !!t;})();}var _default=function(_Component){function _default(props){var _this;_classCallCheck(this,_default);_this=_callSuper(this,_default,[props]);_this.updatedSiblings=new Set();_this.siblingsPool=[];_this.state={siblings:[]};return _this;}_inherits(_default,_Component);return _createClass(_default,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;this.props.controller.setCallback(function(id,change){setTimeout(function(){return _this2.commitChange(id,change);});});}},{key:"componentDidUpdate",value:function componentDidUpdate(){this.updatedSiblings.clear();}},{key:"render",value:function render(){return jsxs(Fragment,{children:[this.props.children,this.renderSiblings()]});}},{key:"commitChange",value:function commitChange(id,_ref){var _this3=this;var change=_ref.change,element=_ref.element,updateCallback=_ref.updateCallback;var siblings=Array.from(this.siblingsPool);var index=siblings.findIndex(function(sibling){return sibling.id===id;});if(change===RootControllerChanges.Remove){if(index>-1){siblings.splice(index,1);}else {this.invokeCallback(updateCallback);return;}}else if(change===RootControllerChanges.Update){if(index>-1){siblings.splice(index,1,{element:element,id:id});this.updatedSiblings.add(id);}else {this.invokeCallback(updateCallback);return;}}else {if(index>-1){siblings.splice(index,1);}siblings.push({element:element,id:id});this.updatedSiblings.add(id);}this.siblingsPool=siblings;this.setState({siblings:siblings},function(){return _this3.invokeCallback(updateCallback);});}},{key:"invokeCallback",value:function invokeCallback(callback){if(callback){callback();}}},{key:"renderSiblings",value:function renderSiblings(){var _this4=this;return this.state.siblings.map(function(_ref2){var id=_ref2.id,element=_ref2.element;return jsx(_default$1,{shouldUpdate:_this4.updatedSiblings.has(id),children:_this4.wrapSibling(element)},\`root-sibling-\${id}\`);});}},{key:"wrapSibling",value:function wrapSibling(element){var renderSibling=this.props.renderSibling;if(renderSibling){return renderSibling(element);}else {return element;}}}]);}(Component);
|
|
402
|
+
function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var _default=function(_Component){_inherits(_default,_Component);var _super=_createSuper(_default);function _default(props){var _this;_classCallCheck(this,_default);_this=_super.call(this,props);_this.siblingsPool=[];_this.updatedSiblings=new Set();_this.unmounted=false;_this.state={siblings:[]};return _this;}_createClass(_default,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;this.props.controller.setCallback(function(id,change){setImmediate(function(){return _this2.commitChange(id,change);});});}},{key:"componentDidUpdate",value:function componentDidUpdate(){this.updatedSiblings.clear();}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.unmounted=true;}},{key:"commitChange",value:function commitChange(id,_ref){var _this3=this;var change=_ref.change,element=_ref.element,updateCallback=_ref.updateCallback;if(this.unmounted){return;}var siblings=Array.from(this.siblingsPool);var index=siblings.findIndex(function(sibling){return sibling.id===id;});if(change===RootControllerChanges.Remove){if(index>-1){siblings.splice(index,1);}else {this.invokeCallback(updateCallback);return;}}else if(change===RootControllerChanges.Update){if(index>-1){siblings.splice(index,1,{element:element,id:id});this.updatedSiblings.add(id);}else {this.invokeCallback(updateCallback);return;}}else {if(index>-1){siblings.splice(index,1);}siblings.push({element:element,id:id});this.updatedSiblings.add(id);}this.siblingsPool=siblings;this.setState({siblings:siblings},function(){return _this3.invokeCallback(updateCallback);});}},{key:"invokeCallback",value:function invokeCallback(callback){if(callback){callback();}}},{key:"renderSiblings",value:function renderSiblings(){var _this4=this;return this.state.siblings.map(function(_ref2){var id=_ref2.id,element=_ref2.element;return jsx(_default$1,{shouldUpdate:_this4.updatedSiblings.has(id),children:_this4.wrapSibling(element)},"root-sibling-"+id);});}},{key:"wrapSibling",value:function wrapSibling(element){var renderSibling=this.props.renderSibling;if(renderSibling){return renderSibling(element);}else {return element;}}},{key:"render",value:function render(){return jsxs(Fragment,{children:[this.props.children,this.renderSiblings()]});}}]);return _default;}(Component);
|
|
390
403
|
|
|
391
404
|
function wrapRootComponent(_Root,renderSibling){var controller=new RootController();return {Root:function Root(props){return jsx(_default,{controller:controller,renderSibling:renderSibling,children:jsx(_Root,Object.assign({},props))});},manager:{update:function update(id,element,callback){controller.update(id,element,callback);},destroy:function destroy(id,callback){controller.destroy(id,callback);}}};}
|
|
392
405
|
|
|
393
|
-
var siblingWrapper=function(sibling){return sibling;};function renderSibling(sibling){return siblingWrapper(sibling);}var _wrapRootComponent=wrapRootComponent(ChildrenWrapper,renderSibling),defaultManager=_wrapRootComponent.manager;var uuid=0;var managerStack=[defaultManager];var inactiveManagers=new Set();function getActiveManager(){for(var i=managerStack.length-1;i>=0;i--){var manager=managerStack[i];if(!inactiveManagers.has(manager)){return manager;}}return defaultManager;}var RootSiblingsManager=function(){function RootSiblingsManager(element,callback){_classCallCheck(this,RootSiblingsManager);this.id
|
|
406
|
+
var siblingWrapper=function(sibling){return sibling;};function renderSibling(sibling){return siblingWrapper(sibling);}if(!global.__rootSiblingsInjected&&!global.__rootSiblingsDisabled){AppRegistry.setWrapperComponentProvider(function(){return Root;});global.__rootSiblingsInjected=true;}var _wrapRootComponent=wrapRootComponent(ChildrenWrapper,renderSibling),Root=_wrapRootComponent.Root,defaultManager=_wrapRootComponent.manager;var uuid=0;var managerStack=[defaultManager];var inactiveManagers=new Set();function getActiveManager(){for(var i=managerStack.length-1;i>=0;i--){var manager=managerStack[i];if(!inactiveManagers.has(manager)){return manager;}}return defaultManager;}var RootSiblingsManager=function(){function RootSiblingsManager(element,callback){_classCallCheck(this,RootSiblingsManager);this.id="root-sibling-"+(uuid+1);this.manager=getActiveManager();this.manager.update(this.id,element,callback);uuid++;}_createClass(RootSiblingsManager,[{key:"update",value:function update(element,callback){this.manager.update(this.id,element,callback);}},{key:"destroy",value:function destroy(callback){this.manager.destroy(this.id,callback);}}]);return RootSiblingsManager;}();
|
|
394
407
|
|
|
395
408
|
console.log({silblings:RootSiblingsManager});
|
|
396
409
|
",
|
|
397
410
|
]
|
|
398
411
|
`;
|
|
399
412
|
|
|
400
|
-
exports[`build_components
|
|
413
|
+
exports[`build_components single component 1`] = `
|
|
401
414
|
[
|
|
402
|
-
"import
|
|
415
|
+
"import 'react';
|
|
416
|
+
import View from '@tarojs/components-rn/dist/components/View';
|
|
403
417
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
404
418
|
import taro from '@tarojs/taro-rn';
|
|
405
419
|
import { StyleSheet } from 'react-native';
|
|
@@ -432,9 +446,24 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
432
446
|
}
|
|
433
447
|
});
|
|
434
448
|
|
|
435
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
449
|
+
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]},"line-"+i));})});}function Item(_ref2){var title=_ref2.title,children=_ref2.children,style=_ref2.style;return jsxs(View,{style:_mergeEleStyles(_styleSheet["cellItem"],Object.assign({},style)),children:[jsx(Text,{style:_styleSheet["cellItem__title"],children:title}),jsx(View,{style:_styleSheet["cellItem__content"],children:children})]});}Cell.Item=Item;
|
|
436
450
|
|
|
437
451
|
export { Cell as default };
|
|
438
452
|
",
|
|
439
453
|
]
|
|
440
454
|
`;
|
|
455
|
+
|
|
456
|
+
exports[`build_components svg transform 1`] = `
|
|
457
|
+
[
|
|
458
|
+
"import 'react';
|
|
459
|
+
import { jsx } from 'react/jsx-runtime';
|
|
460
|
+
|
|
461
|
+
var Logo = require('./assets/rollup-logo-a3c30bf4.svg');
|
|
462
|
+
|
|
463
|
+
function index(){return jsx(Logo,{className:"logo",width:120,height:40});}
|
|
464
|
+
|
|
465
|
+
export { index as default };
|
|
466
|
+
",
|
|
467
|
+
undefined,
|
|
468
|
+
]
|
|
469
|
+
`;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import * as path from '
|
|
1
|
+
import * as path from 'path'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { build } from '../dist/config/build-component'
|
|
6
|
-
import { default as runner } from '../dist/index'
|
|
3
|
+
import runner from '../dist/index'
|
|
4
|
+
import { build } from '../src/config/build-component'
|
|
7
5
|
import { appPath, config } from './mock/components_testdata'
|
|
8
6
|
|
|
9
7
|
const getCode = (result) => result.output.map(chunk => chunk.code)
|
|
10
8
|
|
|
11
9
|
describe.skip('build_components', () => {
|
|
12
|
-
|
|
10
|
+
const spy = jest.spyOn(process, 'cwd')
|
|
11
|
+
spy.mockReturnValue(path.resolve(__dirname, '', 'mock'))
|
|
12
|
+
// metro runServer 容易超时
|
|
13
|
+
jest.setTimeout(300000)
|
|
14
|
+
|
|
15
|
+
it('single component', async () => {
|
|
13
16
|
const result = await runner(appPath, {
|
|
14
17
|
...config,
|
|
15
18
|
nativeComponents: {
|
|
@@ -17,16 +20,17 @@ describe.skip('build_components', () => {
|
|
|
17
20
|
output: 'dist/single'
|
|
18
21
|
}
|
|
19
22
|
})
|
|
20
|
-
|
|
21
23
|
expect(getCode(result)).toMatchSnapshot()
|
|
22
24
|
})
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
const result = await runner(appPath, {
|
|
26
|
+
it('nativeComponents not set', async () => {
|
|
27
|
+
const result = await runner(appPath, {
|
|
28
|
+
...config
|
|
29
|
+
})
|
|
26
30
|
expect(getCode(result)).toMatchSnapshot()
|
|
27
31
|
})
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
it('multiple components', async () => {
|
|
30
34
|
const result = await build(config, {
|
|
31
35
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
32
36
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -37,7 +41,7 @@ describe.skip('build_components', () => {
|
|
|
37
41
|
expect(getCode(result)).toMatchSnapshot()
|
|
38
42
|
})
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
it('modify rollup config', async () => {
|
|
41
45
|
const result = await build(config, {
|
|
42
46
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
43
47
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -46,7 +50,7 @@ describe.skip('build_components', () => {
|
|
|
46
50
|
return {
|
|
47
51
|
...others,
|
|
48
52
|
input: Object.entries(input as Record<string, string>).reduce(
|
|
49
|
-
(pre, cur) => Object.assign(pre, { [cur[0].replace('components'
|
|
53
|
+
(pre, cur) => Object.assign(pre, { [cur[0].replace('components/', '')]: cur[1] }),
|
|
50
54
|
{}
|
|
51
55
|
),
|
|
52
56
|
output: { dir: path.resolve(__dirname, './mock/dist/modify-config') }
|
|
@@ -56,7 +60,7 @@ describe.skip('build_components', () => {
|
|
|
56
60
|
expect(getCode(result)).toMatchSnapshot()
|
|
57
61
|
})
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
it('svg transform', async () => {
|
|
60
64
|
const result = await build(config, {
|
|
61
65
|
input: ['components/svg/index'],
|
|
62
66
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -64,10 +68,10 @@ describe.skip('build_components', () => {
|
|
|
64
68
|
external: ['react', 'react-native', /@tarojs\/components-rn/, /@tarojs\/taro-rn/, /@babel\/runtime/],
|
|
65
69
|
externalResolve: () => {}
|
|
66
70
|
})
|
|
67
|
-
expect(getCode(result))
|
|
71
|
+
expect(getCode(result)).toMatchSnapshot()
|
|
68
72
|
})
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
it('named export', async () => {
|
|
71
75
|
const result = await build(config, {
|
|
72
76
|
input: ['utils/namedExport/index'],
|
|
73
77
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -77,7 +81,7 @@ describe.skip('build_components', () => {
|
|
|
77
81
|
expect(getCode(result)).toMatchSnapshot()
|
|
78
82
|
})
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
it('dynamic require', async () => {
|
|
81
85
|
const result = await build(config, {
|
|
82
86
|
input: ['utils/dynamicImport/index'],
|
|
83
87
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -87,7 +91,7 @@ describe.skip('build_components', () => {
|
|
|
87
91
|
expect(getCode(result)).toMatchSnapshot()
|
|
88
92
|
})
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
it('require react-native component', async () => {
|
|
91
95
|
const result = await build(config, {
|
|
92
96
|
input: ['utils/requireReactNative/index'],
|
|
93
97
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { camelCase } from 'lodash'
|
|
2
|
-
import
|
|
3
|
-
const globalAny = global
|
|
1
|
+
import { camelCase } from 'lodash';
|
|
2
|
+
import { parseUrl } from 'query-string';
|
|
3
|
+
const globalAny = global;
|
|
4
4
|
|
|
5
|
-
console.log(globalAny, camelCase,
|
|
5
|
+
console.log(globalAny, camelCase, parseUrl)
|
package/__tests__/tsconfig.json
CHANGED
|
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.build = void 0;
|
|
24
|
-
const path = require("node:path");
|
|
25
24
|
const plugin_babel_1 = require("@rollup/plugin-babel");
|
|
26
25
|
const commonjs = require("@rollup/plugin-commonjs");
|
|
27
26
|
const json = require("@rollup/plugin-json");
|
|
@@ -32,6 +31,7 @@ const rn_style_transformer_1 = require("@tarojs/rn-style-transformer");
|
|
|
32
31
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
33
32
|
const rn_transformer_1 = require("@tarojs/rn-transformer");
|
|
34
33
|
const jsx = require("acorn-jsx");
|
|
34
|
+
const path = require("path");
|
|
35
35
|
const rollup_1 = require("rollup");
|
|
36
36
|
const rollup_plugin_image_file_1 = require("rollup-plugin-image-file");
|
|
37
37
|
const DEFAULT_CONFIG = {
|
|
@@ -104,10 +104,7 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
104
104
|
}),
|
|
105
105
|
// @ts-ignore
|
|
106
106
|
pluginReplace({
|
|
107
|
-
|
|
108
|
-
values: {
|
|
109
|
-
'process.env.NODE_ENV': JSON.stringify('production')
|
|
110
|
-
}
|
|
107
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
111
108
|
}),
|
|
112
109
|
// @ts-ignore
|
|
113
110
|
commonjs(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-component.js","sourceRoot":"","sources":["../../src/config/build-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"build-component.js","sourceRoot":"","sources":["../../src/config/build-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,oDAAmD;AACnD,4CAA2C;AAC3C,qEAAqD;AACrD,wDAAuD;AACvD,2CAA+C;AAC/C,uEAAkF;AAClF,uDAAqG;AACrG,2DAAqD;AACrD,iCAAgC;AAChC,6BAA4B;AAC5B,mCAA8C;AAC9C,uEAA4C;AAgB5C,MAAM,cAAc,GAGhB;IACF,QAAQ,EAAE,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,CAAC;IACvE,MAAM,EAAE,MAAM;IACd,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE;IAC7B,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM;CACrC,CAAA;AAEM,MAAM,KAAK,GAAG,CAA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AG,gBAAgB,IAAI,EAAE,CAAA;IAEjE,MAAM,eAAe,mCAChB,gBAAgB,KACnB,KAAK,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,EAC5B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACtC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GACnD,CAAA;IAED,OAAO,IAAA,aAAK,EAAC,MAAM,EAAE,eAAe,CAAC,CAAA;AACvC,CAAC;AAdD,4BAcC"}
|
package/dist/index.js
CHANGED
|
@@ -9,18 +9,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const node_fs_1 = require("node:fs");
|
|
13
|
-
const node_path_1 = require("node:path");
|
|
14
12
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
15
13
|
const child_process_1 = require("child_process");
|
|
14
|
+
const fs_1 = require("fs");
|
|
16
15
|
const fse = require("fs-extra");
|
|
16
|
+
const path_1 = require("path");
|
|
17
17
|
const build_component_1 = require("./config/build-component");
|
|
18
18
|
// 确认根目录下 metro.config.js index.js 是否存在
|
|
19
19
|
const files = ['metro.config.js', 'index.js'];
|
|
20
20
|
function confirmFiles() {
|
|
21
21
|
files.forEach(file => {
|
|
22
|
-
const filePath = (0,
|
|
23
|
-
(0,
|
|
22
|
+
const filePath = (0, path_1.join)(process.cwd(), file);
|
|
23
|
+
(0, fs_1.copyFile)((0, path_1.join)(__dirname, '..', 'templates', file), filePath, fs_1.constants.COPYFILE_EXCL, err => {
|
|
24
24
|
if (err) {
|
|
25
25
|
if (err.code !== 'EEXIST') {
|
|
26
26
|
// 不重复生成配置文件
|
|
@@ -67,12 +67,7 @@ function build(_appPath, config) {
|
|
|
67
67
|
cliParams.push('--port', config.port);
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
|
-
(0, child_process_1.spawn)(npxCmd, [
|
|
71
|
-
'react-native',
|
|
72
|
-
'start',
|
|
73
|
-
'--custom-log-reporter-path',
|
|
74
|
-
'@tarojs/rn-supporter/TerminalReporter'
|
|
75
|
-
].concat(cliParams), {
|
|
70
|
+
(0, child_process_1.spawn)(npxCmd, ['react-native', 'start'].concat(cliParams), {
|
|
76
71
|
stdio: 'inherit'
|
|
77
72
|
});
|
|
78
73
|
if (config.qr) {
|
|
@@ -83,15 +78,14 @@ function build(_appPath, config) {
|
|
|
83
78
|
onFinish(null);
|
|
84
79
|
}
|
|
85
80
|
catch (e) {
|
|
86
|
-
console.error(e);
|
|
87
81
|
onFinish(e);
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
84
|
else {
|
|
91
|
-
const defaultOutputDir = (0,
|
|
92
|
-
const defaultBundleOutput = (0,
|
|
85
|
+
const defaultOutputDir = (0, path_1.join)(process.cwd(), config.outputRoot || 'dist');
|
|
86
|
+
const defaultBundleOutput = (0, path_1.join)(defaultOutputDir, 'index.bundle');
|
|
93
87
|
const bundleOutput = (config.bundleOutput ? config.bundleOutput : (isIos ? config.output.ios : config.output.android)) || defaultBundleOutput;
|
|
94
|
-
fse.ensureDirSync((0,
|
|
88
|
+
fse.ensureDirSync((0, path_1.dirname)(bundleOutput));
|
|
95
89
|
cliParams.push('--bundle-output', bundleOutput);
|
|
96
90
|
const sourcemapOutput = config.sourcemapOutput ? config.sourcemapOutput : (isIos ? config.output.iosSourcemapOutput : config.output.androidSourcemapOutput);
|
|
97
91
|
if (sourcemapOutput) {
|
|
@@ -133,7 +127,6 @@ function build(_appPath, config) {
|
|
|
133
127
|
onFinish(null);
|
|
134
128
|
}
|
|
135
129
|
catch (e) {
|
|
136
|
-
console.error(e);
|
|
137
130
|
onFinish(e);
|
|
138
131
|
}
|
|
139
132
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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,CAAC,IAAI,CAAC,CAAA;aACf;YAAC,OAAO,CAAC,EAAE;gBACV,QAAQ,CAAC,CAAC,CAAC,CAAA;aACZ;SACF;IACH,CAAC;CAAA;AAjGD,wBAiGC"}
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,71 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/rn-runner",
|
|
3
|
-
"version": "4.0.1
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "ReactNative build tool for taro",
|
|
5
|
-
"author": "O2Team",
|
|
6
|
-
"license": "MIT",
|
|
7
5
|
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/NervJS/taro.git"
|
|
9
|
+
},
|
|
8
10
|
"keywords": [
|
|
9
11
|
"taro"
|
|
10
12
|
],
|
|
13
|
+
"author": "luckyadam",
|
|
14
|
+
"license": "MIT",
|
|
11
15
|
"bugs": {
|
|
12
16
|
"url": "https://github.com/NervJS/taro/issues"
|
|
13
17
|
},
|
|
14
|
-
"
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/NervJS/taro.git"
|
|
17
|
-
},
|
|
18
|
+
"homepage": "https://github.com/NervJS/taro#readme",
|
|
18
19
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
20
|
+
"node": ">=12.0.0",
|
|
21
|
+
"npm": ">=6.0.0"
|
|
20
22
|
},
|
|
21
23
|
"dependencies": {
|
|
22
|
-
"@rollup/plugin-babel": "^
|
|
23
|
-
"@rollup/plugin-commonjs": "^
|
|
24
|
-
"@rollup/plugin-json": "^
|
|
25
|
-
"@rollup/plugin-node-resolve": "^
|
|
26
|
-
"@rollup/plugin-replace": "^
|
|
27
|
-
"acorn": "^8.11.3",
|
|
24
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
25
|
+
"@rollup/plugin-commonjs": "^20.0.0",
|
|
26
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
27
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
28
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
28
29
|
"acorn-jsx": "^5.3.2",
|
|
29
|
-
"fs-extra": "^
|
|
30
|
+
"fs-extra": "^8.0.1",
|
|
30
31
|
"lodash": "^4.17.21",
|
|
31
32
|
"rollup-plugin-image-file": "^1.0.2",
|
|
32
|
-
"@tarojs/
|
|
33
|
-
"@tarojs/
|
|
34
|
-
"
|
|
35
|
-
"@tarojs/rn-supporter": "4.0.1
|
|
36
|
-
"@tarojs/rn-transformer": "4.0.1-alpha.0"
|
|
33
|
+
"@tarojs/helper": "4.0.1",
|
|
34
|
+
"@tarojs/rn-style-transformer": "4.0.1",
|
|
35
|
+
"@tarojs/rn-transformer": "4.0.1",
|
|
36
|
+
"@tarojs/rn-supporter": "4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"babel-
|
|
39
|
+
"@babel/core": "^7.14.5",
|
|
40
|
+
"@babel/preset-env": "^7.14.5",
|
|
41
|
+
"acorn": "^8.0.4",
|
|
42
|
+
"babel-plugin-global-define": "1.0.3",
|
|
43
|
+
"babel-plugin-jsx-attributes-array-to-object": "0.3.0",
|
|
44
|
+
"expo": "~47.0.3",
|
|
45
|
+
"expo-file-system": "~15.1.1",
|
|
46
|
+
"jest": "^29.3.1",
|
|
47
|
+
"jest-cli": "^29.3.1",
|
|
48
|
+
"jest-environment-node": "^29.5.0",
|
|
49
|
+
"react": "18.1.0",
|
|
50
|
+
"react-is": "^16.13.0",
|
|
51
|
+
"react-native": "^0.70.5",
|
|
52
|
+
"react-native-root-siblings": "^4.1.1",
|
|
53
|
+
"react-test-renderer": "18.1.0",
|
|
54
|
+
"rollup": "^2.79.0",
|
|
55
|
+
"ts-jest": "^29.0.5",
|
|
56
|
+
"typescript": "^4.7.4",
|
|
57
|
+
"babel-plugin-transform-react-jsx-to-rn-stylesheet": "4.0.1"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
-
"prod": "pnpm run build",
|
|
61
|
-
"prebuild": "pnpm run clean",
|
|
62
|
-
"clean": "rimraf --impl=move-remove ./dist",
|
|
63
60
|
"build": "tsc",
|
|
64
|
-
"dev": "tsc
|
|
65
|
-
"lint": "eslint
|
|
66
|
-
"test": "
|
|
67
|
-
"test:ci": "
|
|
68
|
-
"test:
|
|
69
|
-
"test:
|
|
61
|
+
"dev": "tsc --watch",
|
|
62
|
+
"lint": "eslint .",
|
|
63
|
+
"test": "jest --silent",
|
|
64
|
+
"test:ci": "jest --ci -i --coverage --silent",
|
|
65
|
+
"test:coverage": "jest --coverage",
|
|
66
|
+
"test:dev": "jest --watch"
|
|
70
67
|
}
|
|
71
68
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as path from 'node:path'
|
|
2
|
-
|
|
3
1
|
import babel from '@rollup/plugin-babel'
|
|
4
2
|
import * as commonjs from '@rollup/plugin-commonjs'
|
|
5
3
|
import * as json from '@rollup/plugin-json'
|
|
@@ -10,6 +8,7 @@ import { rollupTransform as styleTransformer } from '@tarojs/rn-style-transforme
|
|
|
10
8
|
import { getBabelConfig, resolveExtFile, rollupResolver as taroResolver } from '@tarojs/rn-supporter'
|
|
11
9
|
import { getAppConfig } from '@tarojs/rn-transformer'
|
|
12
10
|
import * as jsx from 'acorn-jsx'
|
|
11
|
+
import * as path from 'path'
|
|
13
12
|
import { rollup, RollupOptions } from 'rollup'
|
|
14
13
|
import image from 'rollup-plugin-image-file'
|
|
15
14
|
|
|
@@ -109,10 +108,7 @@ export const build = async (projectConfig, componentConfig: IComponentConfig) =>
|
|
|
109
108
|
}),
|
|
110
109
|
// @ts-ignore
|
|
111
110
|
pluginReplace({
|
|
112
|
-
|
|
113
|
-
values: {
|
|
114
|
-
'process.env.NODE_ENV': JSON.stringify('production')
|
|
115
|
-
}
|
|
111
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
116
112
|
}),
|
|
117
113
|
// @ts-ignore
|
|
118
114
|
commonjs(),
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { constants, copyFile } from 'node:fs'
|
|
2
|
-
import { dirname, join } from 'node:path'
|
|
3
|
-
|
|
4
1
|
import { previewDev, previewProd } from '@tarojs/rn-supporter'
|
|
5
2
|
import { spawn } from 'child_process'
|
|
3
|
+
import { constants, copyFile } from 'fs'
|
|
6
4
|
import * as fse from 'fs-extra'
|
|
5
|
+
import { dirname, join } from 'path'
|
|
7
6
|
|
|
8
7
|
import buildComponent from './config/build-component'
|
|
9
8
|
|
|
@@ -61,12 +60,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
61
60
|
cliParams.push('--port', config.port)
|
|
62
61
|
}
|
|
63
62
|
try {
|
|
64
|
-
spawn(npxCmd, [
|
|
65
|
-
'react-native',
|
|
66
|
-
'start',
|
|
67
|
-
'--custom-log-reporter-path',
|
|
68
|
-
'@tarojs/rn-supporter/TerminalReporter'
|
|
69
|
-
].concat(cliParams), {
|
|
63
|
+
spawn(npxCmd, ['react-native', 'start'].concat(cliParams), {
|
|
70
64
|
stdio: 'inherit'
|
|
71
65
|
})
|
|
72
66
|
if (config.qr) {
|
|
@@ -76,7 +70,6 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
76
70
|
}
|
|
77
71
|
onFinish(null)
|
|
78
72
|
} catch (e) {
|
|
79
|
-
console.error(e)
|
|
80
73
|
onFinish(e)
|
|
81
74
|
}
|
|
82
75
|
} else {
|
|
@@ -128,7 +121,6 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
128
121
|
}
|
|
129
122
|
onFinish(null)
|
|
130
123
|
} catch (e) {
|
|
131
|
-
console.error(e)
|
|
132
124
|
onFinish(e)
|
|
133
125
|
}
|
|
134
126
|
}
|
package/templates/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@tarojs/rn-supporter/entry-file.js'
|
|
1
|
+
import '@tarojs/rn-supporter/entry-file.js'
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { mergeConfig } = require('metro-config')
|
|
2
2
|
const { getMetroConfig } = require('@tarojs/rn-supporter')
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Metro configuration
|
|
6
|
-
* https://facebook.github.io/metro/docs/configuration
|
|
7
|
-
*
|
|
8
|
-
* @type {import('metro-config').MetroConfig}
|
|
9
|
-
*/
|
|
10
|
-
const config = {}
|
|
11
|
-
|
|
12
4
|
module.exports = (async function () {
|
|
13
|
-
return mergeConfig(
|
|
14
|
-
|
|
5
|
+
return mergeConfig({
|
|
6
|
+
// custom your metro config here
|
|
7
|
+
// https://facebook.github.io/metro/docs/configuration
|
|
8
|
+
resolver: {}
|
|
9
|
+
}, await getMetroConfig())
|
|
10
|
+
})()
|