@tarojs/rn-runner 4.0.0-alpha.0 → 4.0.0-alpha.13
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 +11 -4
- package/README.md +1 -1
- package/__tests__/__snapshots__/components.spec.ts.snap +91 -101
- package/__tests__/components.spec.ts +12 -17
- package/__tests__/mock/src/app.tsx +1 -1
- package/__tests__/mock/src/components/cell/index.tsx +0 -1
- package/__tests__/mock/src/components/navbar/index.tsx +0 -1
- package/__tests__/mock/src/components/svg/index.tsx +0 -1
- package/__tests__/mock/src/utils/requireLodash/index.ts +4 -4
- package/__tests__/tsconfig.json +3 -2
- package/dist/config/build-component.js +19 -16
- package/dist/config/build-component.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +48 -46
- package/src/config/build-component.ts +9 -6
- package/src/index.ts +8 -1
- package/templates/index.js +1 -1
- package/templates/metro.config.js +12 -8
- package/tsconfig.json +1 -0
- package/jest.config.js +0 -6
package/LICENSE
CHANGED
|
@@ -154,7 +154,14 @@ See `/LICENSE` for details of the license.
|
|
|
154
154
|
|
|
155
155
|
==================
|
|
156
156
|
|
|
157
|
-
MIT (
|
|
158
|
-
The following files embed [
|
|
159
|
-
`/packages/taro-components
|
|
160
|
-
See `/LICENSE` for details of the license.
|
|
157
|
+
MIT (weui):
|
|
158
|
+
The following files embed [weui](https://github.com/Tencent/weui) MIT:
|
|
159
|
+
`/packages/taro-components/src/components/*.scss`
|
|
160
|
+
See `/LICENSE.txt` for details of the license.
|
|
161
|
+
|
|
162
|
+
==================
|
|
163
|
+
|
|
164
|
+
Apache-2.0 (intersection-observer):
|
|
165
|
+
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
166
|
+
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
167
|
+
See `/LICENSE.txt` 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/rn-runner` 从 `@tarojs/cli` 接受 [Taro 编译配置](https://taro-docs.jd.com/taro/docs/config.html),把编译配置分解成 Webpack 配置,并刚启动 Webpack 把项目源码编译为适配 React Native 目录结构的代码。
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`build_components dynamic require 1`] = `
|
|
3
|
+
exports[`build_components > dynamic require 1`] = `
|
|
4
4
|
[
|
|
5
|
-
"
|
|
5
|
+
"function getDefaultExportFromCjs (x) {
|
|
6
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
var reactIs$1 = {exports: {}};
|
|
6
10
|
|
|
7
11
|
var reactIs_production_min = {};
|
|
8
12
|
|
|
9
|
-
var b=
|
|
13
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r;}}case c:return r;}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1;};reactIs_production_min.isConcurrentMode=function(){return !1;};reactIs_production_min.isContextConsumer=function(a){return v(a)===h;};reactIs_production_min.isContextProvider=function(a){return v(a)===g;};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b;};reactIs_production_min.isForwardRef=function(a){return v(a)===l;};reactIs_production_min.isFragment=function(a){return v(a)===d;};reactIs_production_min.isLazy=function(a){return v(a)===q;};reactIs_production_min.isMemo=function(a){return v(a)===p;};reactIs_production_min.isPortal=function(a){return v(a)===c;};reactIs_production_min.isProfiler=function(a){return v(a)===f;};reactIs_production_min.isStrictMode=function(a){return v(a)===e;};reactIs_production_min.isSuspense=function(a){return v(a)===m;};reactIs_production_min.isSuspenseList=function(a){return v(a)===n;};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1;};reactIs_production_min.typeOf=v;
|
|
10
14
|
|
|
11
|
-
reactIs$1.exports=reactIs_production_min;var
|
|
15
|
+
reactIs$1.exports=reactIs_production_min;var reactIsExports=reactIs$1.exports;var reactIs = getDefaultExportFromCjs(reactIsExports);
|
|
12
16
|
|
|
13
17
|
console.log({reactIs:reactIs});
|
|
14
18
|
",
|
|
15
19
|
]
|
|
16
20
|
`;
|
|
17
21
|
|
|
18
|
-
exports[`build_components modify rollup config 1`] = `
|
|
22
|
+
exports[`build_components > modify rollup config 1`] = `
|
|
19
23
|
[
|
|
20
|
-
"import '
|
|
21
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
24
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
22
25
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
23
26
|
import taro from '@tarojs/taro-rn';
|
|
24
27
|
import { StyleSheet } from 'react-native';
|
|
@@ -51,12 +54,11 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
|
|
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"]}
|
|
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"]},\`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;
|
|
55
58
|
|
|
56
59
|
export { Cell as default };
|
|
57
60
|
",
|
|
58
|
-
"import '
|
|
59
|
-
import { navigateBack } from '@tarojs/taro-rn/dist/api';
|
|
61
|
+
"import { navigateBack } from '@tarojs/taro-rn/dist/api';
|
|
60
62
|
import View from '@tarojs/components-rn/dist/components/View';
|
|
61
63
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
62
64
|
import Image from '@tarojs/components-rn/dist/components/Image';
|
|
@@ -64,7 +66,7 @@ import { StyleSheet } from 'react-native';
|
|
|
64
66
|
import { scalePx2dp } from '@tarojs/runtime-rn';
|
|
65
67
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
66
68
|
|
|
67
|
-
var iconBack = require('../assets/icon_back-
|
|
69
|
+
var iconBack = require('../assets/icon_back-K9-Z_a7i.webp');
|
|
68
70
|
|
|
69
71
|
var _indexScssStyleSheet = StyleSheet.create({
|
|
70
72
|
"navbar": {
|
|
@@ -110,10 +112,9 @@ export { Navbar as default };
|
|
|
110
112
|
]
|
|
111
113
|
`;
|
|
112
114
|
|
|
113
|
-
exports[`build_components multiple components 1`] = `
|
|
115
|
+
exports[`build_components > multiple components 1`] = `
|
|
114
116
|
[
|
|
115
|
-
"import '
|
|
116
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
117
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
117
118
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
118
119
|
import taro from '@tarojs/taro-rn';
|
|
119
120
|
import { StyleSheet } from 'react-native';
|
|
@@ -146,12 +147,11 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
146
147
|
}
|
|
147
148
|
});
|
|
148
149
|
|
|
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"]}
|
|
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"]},\`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;
|
|
150
151
|
|
|
151
152
|
export { Cell as default };
|
|
152
153
|
",
|
|
153
|
-
"import '
|
|
154
|
-
import { navigateBack } from '@tarojs/taro-rn/dist/api';
|
|
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-K9-Z_a7i.webp');
|
|
163
163
|
|
|
164
164
|
var _indexScssStyleSheet = StyleSheet.create({
|
|
165
165
|
"navbar": {
|
|
@@ -205,17 +205,11 @@ export { Navbar as default };
|
|
|
205
205
|
]
|
|
206
206
|
`;
|
|
207
207
|
|
|
208
|
-
exports[`build_components named export 1`] = `
|
|
208
|
+
exports[`build_components > named export 1`] = `
|
|
209
209
|
[
|
|
210
|
-
"import { Platform as Platform$1,
|
|
211
|
-
import 'react';
|
|
212
|
-
import require$$0 from 'crypto';
|
|
213
|
-
|
|
214
|
-
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
215
|
-
|
|
216
|
-
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);}
|
|
210
|
+
"import { Platform as Platform$1, NativeEventEmitter, NativeModules } from 'react-native';
|
|
217
211
|
|
|
218
|
-
function _typeof(
|
|
212
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}
|
|
219
213
|
|
|
220
214
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
221
215
|
|
|
@@ -223,96 +217,95 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
223
217
|
|
|
224
218
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
225
219
|
|
|
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
|
+
|
|
226
224
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
227
225
|
|
|
228
|
-
function
|
|
226
|
+
function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r);if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return (String)(t);}
|
|
229
227
|
|
|
230
|
-
function
|
|
228
|
+
function toPropertyKey(t){var i=toPrimitive(t,"string");return "symbol"==_typeof(i)?i:i+"";}
|
|
231
229
|
|
|
232
|
-
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,
|
|
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,toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}
|
|
233
231
|
|
|
234
232
|
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);});};}
|
|
235
233
|
|
|
236
|
-
function _defineProperty(obj,key,value){key=
|
|
237
|
-
|
|
238
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
234
|
+
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
235
|
|
|
240
|
-
|
|
236
|
+
function getDefaultExportFromCjs (x) {
|
|
237
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
238
|
+
}
|
|
241
239
|
|
|
242
|
-
var
|
|
240
|
+
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;var invariant$1 = getDefaultExportFromCjs(invariant_1);
|
|
243
241
|
|
|
244
|
-
var
|
|
242
|
+
var nativeEmitterSubscriptionKey='@@nativeEmitterSubscription@@';var EventEmitter=function(){function EventEmitter(nativeModule){_classCallCheck(this,EventEmitter);this._listenerCount=0;if(nativeModule.__expo_module_name__){return nativeModule;}this._nativeModule=nativeModule;this._eventEmitter=new NativeEventEmitter(nativeModule);}return _createClass(EventEmitter,[{key:"addListener",value:function addListener(eventName,listener){var _this=this;if(!this._listenerCount&&Platform$1.OS!=='ios'&&this._nativeModule.startObserving){this._nativeModule.startObserving();}this._listenerCount++;var nativeEmitterSubscription=this._eventEmitter.addListener(eventName,listener);var subscription=_defineProperty(_defineProperty({},nativeEmitterSubscriptionKey,nativeEmitterSubscription),"remove",function remove(){_this.removeSubscription(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();}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 _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){params[_key-1]=arguments[_key];}(_this$_eventEmitter=this._eventEmitter).emit.apply(_this$_eventEmitter,[eventName].concat(params));}}]);}();
|
|
245
243
|
|
|
246
|
-
|
|
244
|
+
function ensureNativeModulesAreInstalled(){if(globalThis.expo){return;}try{if(Platform$1.OS==='web'){require('./web');}else {var _NativeModules$ExpoMo;(_NativeModules$ExpoMo=NativeModules.ExpoModulesCore)==null?void 0:_NativeModules$ExpoMo.installModules();}}catch(error){console.error(\`Unable to install Expo modules: \${error}\`);}}
|
|
247
245
|
|
|
248
|
-
var
|
|
246
|
+
var NativeModulesProxy = {};
|
|
249
247
|
|
|
250
|
-
function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}
|
|
248
|
+
function _isNativeFunction(fn){try{return Function.toString.call(fn).indexOf("[native code]")!==-1;}catch(e){return typeof fn==="function";}}
|
|
251
249
|
|
|
252
|
-
function _isNativeReflectConstruct$3(){
|
|
250
|
+
function _isNativeReflectConstruct$3(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct$3=function(){return !!t;})();}
|
|
253
251
|
|
|
254
|
-
function _construct(){if(_isNativeReflectConstruct$3())
|
|
252
|
+
function _construct(t,e,r){if(_isNativeReflectConstruct$3())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o))();return r&&_setPrototypeOf(p,r.prototype),p;}
|
|
255
253
|
|
|
256
254
|
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);}
|
|
257
255
|
|
|
258
|
-
function
|
|
256
|
+
function _callSuper$2(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct$2()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct$2(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return (_isNativeReflectConstruct$2=function _isNativeReflectConstruct(){return !!t;})();}var CodedError=function(_Error){function CodedError(code,message){var _this;_classCallCheck(this,CodedError);_this=_callSuper$2(this,CodedError,[message]);_this.code=code;return _this;}_inherits(CodedError,_Error);return _createClass(CodedError);}(_wrapNativeSuper(Error));
|
|
259
257
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
263
|
-
|
|
264
|
-
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;
|
|
258
|
+
var isDOMAvailable=false;var canUseEventListeners=false;var canUseViewport=false;var isAsyncDebugging=false;if(__DEV__){isAsyncDebugging=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless;}
|
|
265
259
|
|
|
266
|
-
var
|
|
260
|
+
var Platform={OS:Platform$1.OS,select:Platform$1.select,isDOMAvailable:isDOMAvailable,canUseEventListeners:canUseEventListeners,canUseViewport:canUseViewport,isAsyncDebugging:isAsyncDebugging};
|
|
267
261
|
|
|
268
|
-
|
|
262
|
+
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 UnavailabilityError=function(_CodedError){function UnavailabilityError(moduleName,propertyName){_classCallCheck(this,UnavailabilityError);return _callSuper$1(this,UnavailabilityError,['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?\`]);}_inherits(UnavailabilityError,_CodedError);return _createClass(UnavailabilityError);}(CodedError);
|
|
269
263
|
|
|
270
|
-
var
|
|
264
|
+
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
271
265
|
|
|
272
|
-
var
|
|
266
|
+
if(__DEV__&&Platform.OS==='android'&&NativeErrorManager){var onNewException='ExpoModulesCoreErrorManager.onNewException';var onNewWarning='ExpoModulesCoreErrorManager.onNewWarning';var eventEmitter=new EventEmitter(NativeErrorManager);eventEmitter.addListener(onNewException,function(_ref){var message=_ref.message;console.error(message);});eventEmitter.addListener(onNewWarning,function(_ref2){var message=_ref2.message;console.warn(message);});}globalThis.ExpoModulesCore_CodedError=CodedError;
|
|
273
267
|
|
|
274
|
-
var byteToHex=[];for(var i=0;i<256;++i){byteToHex[i]=(i+0x100).toString(16).substr(1);}function bytesToUuid
|
|
268
|
+
var byteToHex=[];for(var i=0;i<256;++i){byteToHex[i]=(i+0x100).toString(16).substr(1);}function bytesToUuid(buf,offset){var i=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('');}
|
|
275
269
|
|
|
276
|
-
var
|
|
270
|
+
var Uuidv5Namespace;(function(Uuidv5Namespace){Uuidv5Namespace["dns"]="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Uuidv5Namespace["url"]="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Uuidv5Namespace["oid"]="6ba7b812-9dad-11d1-80b4-00c04fd430c8";Uuidv5Namespace["x500"]="6ba7b814-9dad-11d1-80b4-00c04fd430c8";})(Uuidv5Namespace||(Uuidv5Namespace={}));
|
|
277
271
|
|
|
278
|
-
var
|
|
272
|
+
var _globalThis$expo,_globalThis$expo2;var nativeUuidv4=globalThis==null?void 0:(_globalThis$expo=globalThis.expo)==null?void 0:_globalThis$expo.uuidv4;var nativeUuidv5=globalThis==null?void 0:(_globalThis$expo2=globalThis.expo)==null?void 0:_globalThis$expo2.uuidv5;function uuidv4(){if(!nativeUuidv4){throw Error("Native UUID version 4 generator implementation wasn't found in \`expo-modules-core\`");}return nativeUuidv4();}function uuidv5(name,namespace){var parsedNamespace=Array.isArray(namespace)&&namespace.length===16?bytesToUuid(namespace):namespace;if(Array.isArray(parsedNamespace)){throw new Error('\`namespace\` must be a valid UUID string or an Array of 16 byte values');}if(!nativeUuidv5){throw Error("Native UUID type 5 generator implementation wasn't found in \`expo-modules-core\`");}return nativeUuidv5(name,parsedNamespace);}var uuid={v4:uuidv4,v5:uuidv5,namespace:Uuidv5Namespace};
|
|
279
273
|
|
|
280
|
-
|
|
274
|
+
function requireOptionalNativeModule(moduleName){var _ref,_globalThis$expo$modu,_globalThis$expo,_globalThis$expo$modu2;ensureNativeModulesAreInstalled();return (_ref=(_globalThis$expo$modu=(_globalThis$expo=globalThis.expo)==null?void 0:(_globalThis$expo$modu2=_globalThis$expo.modules)==null?void 0:_globalThis$expo$modu2[moduleName])!=null?_globalThis$expo$modu:NativeModulesProxy[moduleName])!=null?_ref:null;}
|
|
281
275
|
|
|
282
|
-
var platformModule
|
|
276
|
+
var platformModule={get name(){return 'ExponentFileSystem';},get documentDirectory(){return null;},get cacheDirectory(){return null;},get bundleDirectory(){return null;},addListener:function addListener(){},removeListeners:function removeListeners(){}};
|
|
283
277
|
|
|
284
|
-
var
|
|
278
|
+
var _requireOptionalNativ;var ExponentFileSystem = (_requireOptionalNativ=requireOptionalNativeModule('ExponentFileSystem'))!=null?_requireOptionalNativ:platformModule;
|
|
285
279
|
|
|
286
280
|
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={}));
|
|
287
281
|
|
|
288
|
-
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){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);}function isUploadProgressData(data){return 'totalBytesSent'in data;}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){if(isUploadProgressData(event.data)){var data=Object.assign({},event.data,{get totalByteSent(){console.warn('Key "totalByteSent" in File System UploadProgressData is deprecated and will be removed in SDK 49, use "totalBytesSent" instead');return this.totalBytesSent;}});return callback(data);}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(_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={}));
|
|
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
283
|
|
|
290
284
|
var fileBuild = /*#__PURE__*/Object.freeze({
|
|
291
285
|
__proto__: null,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
DownloadResumable: DownloadResumable,
|
|
287
|
+
FileSystemCancellableNetworkTask: FileSystemCancellableNetworkTask,
|
|
288
|
+
get StorageAccessFramework () { return StorageAccessFramework; },
|
|
289
|
+
UploadTask: UploadTask,
|
|
295
290
|
bundleDirectory: bundleDirectory,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
291
|
+
cacheDirectory: cacheDirectory,
|
|
292
|
+
copyAsync: copyAsync,
|
|
293
|
+
createDownloadResumable: createDownloadResumable,
|
|
294
|
+
createUploadTask: createUploadTask,
|
|
300
295
|
deleteAsync: deleteAsync,
|
|
301
296
|
deleteLegacyDocumentDirectoryAndroid: deleteLegacyDocumentDirectoryAndroid,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
readDirectoryAsync: readDirectoryAsync,
|
|
297
|
+
documentDirectory: documentDirectory,
|
|
298
|
+
downloadAsync: downloadAsync,
|
|
299
|
+
getContentUriAsync: getContentUriAsync,
|
|
306
300
|
getFreeDiskStorageAsync: getFreeDiskStorageAsync,
|
|
301
|
+
getInfoAsync: getInfoAsync,
|
|
307
302
|
getTotalDiskCapacityAsync: getTotalDiskCapacityAsync,
|
|
308
|
-
|
|
303
|
+
makeDirectoryAsync: makeDirectoryAsync,
|
|
304
|
+
moveAsync: moveAsync,
|
|
305
|
+
readAsStringAsync: readAsStringAsync,
|
|
306
|
+
readDirectoryAsync: readDirectoryAsync,
|
|
309
307
|
uploadAsync: uploadAsync,
|
|
310
|
-
|
|
311
|
-
createUploadTask: createUploadTask,
|
|
312
|
-
FileSystemCancellableNetworkTask: FileSystemCancellableNetworkTask,
|
|
313
|
-
UploadTask: UploadTask,
|
|
314
|
-
DownloadResumable: DownloadResumable,
|
|
315
|
-
get StorageAccessFramework () { return StorageAccessFramework; }
|
|
308
|
+
writeAsStringAsync: writeAsStringAsync
|
|
316
309
|
});
|
|
317
310
|
|
|
318
311
|
console.log({fileBuild:fileBuild});
|
|
@@ -320,10 +313,9 @@ console.log({fileBuild:fileBuild});
|
|
|
320
313
|
]
|
|
321
314
|
`;
|
|
322
315
|
|
|
323
|
-
exports[`build_components nativeComponents
|
|
316
|
+
exports[`build_components > nativeComponents not set 1`] = `
|
|
324
317
|
[
|
|
325
|
-
"import '
|
|
326
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
318
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
327
319
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
328
320
|
import taro from '@tarojs/taro-rn';
|
|
329
321
|
import { StyleSheet } from 'react-native';
|
|
@@ -356,36 +348,31 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
356
348
|
}
|
|
357
349
|
});
|
|
358
350
|
|
|
359
|
-
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"]}
|
|
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"]},\`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;
|
|
360
352
|
|
|
361
353
|
export { Cell as default };
|
|
362
354
|
",
|
|
363
355
|
]
|
|
364
356
|
`;
|
|
365
357
|
|
|
366
|
-
exports[`build_components require react-native component 1`] = `
|
|
358
|
+
exports[`build_components > require react-native component 1`] = `
|
|
367
359
|
[
|
|
368
|
-
"import {
|
|
369
|
-
import {
|
|
370
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
360
|
+
"import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
361
|
+
import { Children, Component } from 'react';
|
|
371
362
|
|
|
372
363
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
373
364
|
|
|
374
|
-
function _typeof(
|
|
365
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}
|
|
375
366
|
|
|
376
|
-
function
|
|
367
|
+
function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r);if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return (String)(t);}
|
|
377
368
|
|
|
378
|
-
function
|
|
369
|
+
function toPropertyKey(t){var i=toPrimitive(t,"string");return "symbol"==_typeof(i)?i:i+"";}
|
|
379
370
|
|
|
380
|
-
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,
|
|
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,toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}
|
|
381
372
|
|
|
382
373
|
function ChildrenWrapper(props){return jsx(Fragment,{children:props.children});}
|
|
383
374
|
|
|
384
|
-
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});}}}]);
|
|
385
|
-
|
|
386
|
-
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
387
|
-
|
|
388
|
-
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);}
|
|
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;}return _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});}}}]);}();
|
|
389
376
|
|
|
390
377
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
391
378
|
|
|
@@ -393,23 +380,26 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
393
380
|
|
|
394
381
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
395
382
|
|
|
396
|
-
function
|
|
383
|
+
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
397
384
|
|
|
398
|
-
function
|
|
385
|
+
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);}
|
|
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);
|
|
399
390
|
|
|
400
391
|
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);}}};}
|
|
401
392
|
|
|
402
|
-
var siblingWrapper=function(sibling){return sibling;};function renderSibling(sibling){return siblingWrapper(sibling);}
|
|
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=\`root-sibling-\${uuid+1}\`;this.manager=getActiveManager();this.manager.update(this.id,element,callback);uuid++;}return _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);}}]);}();
|
|
403
394
|
|
|
404
395
|
console.log({silblings:RootSiblingsManager});
|
|
405
396
|
",
|
|
406
397
|
]
|
|
407
398
|
`;
|
|
408
399
|
|
|
409
|
-
exports[`build_components single component 1`] = `
|
|
400
|
+
exports[`build_components > single component 1`] = `
|
|
410
401
|
[
|
|
411
|
-
"import '
|
|
412
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
402
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
413
403
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
414
404
|
import taro from '@tarojs/taro-rn';
|
|
415
405
|
import { StyleSheet } from 'react-native';
|
|
@@ -442,7 +432,7 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
442
432
|
}
|
|
443
433
|
});
|
|
444
434
|
|
|
445
|
-
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"]}
|
|
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"]},\`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;
|
|
446
436
|
|
|
447
437
|
export { Cell as default };
|
|
448
438
|
",
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import * as path from 'path'
|
|
2
|
+
import { describe, expect, test } from 'vitest'
|
|
2
3
|
|
|
3
|
-
import runner from '../dist/index'
|
|
4
4
|
import { build } from '../src/config/build-component'
|
|
5
|
+
import runner from '../src/index'
|
|
5
6
|
import { appPath, config } from './mock/components_testdata'
|
|
6
7
|
|
|
7
8
|
const getCode = (result) => result.output.map(chunk => chunk.code)
|
|
8
9
|
|
|
9
10
|
describe('build_components', () => {
|
|
10
|
-
|
|
11
|
-
spy.mockReturnValue(path.resolve(__dirname, '', 'mock'))
|
|
12
|
-
// metro runServer 容易超时
|
|
13
|
-
jest.setTimeout(300000)
|
|
14
|
-
|
|
15
|
-
it('single component', async () => {
|
|
11
|
+
test('single component', async () => {
|
|
16
12
|
const result = await runner(appPath, {
|
|
17
13
|
...config,
|
|
18
14
|
nativeComponents: {
|
|
@@ -20,17 +16,16 @@ describe('build_components', () => {
|
|
|
20
16
|
output: 'dist/single'
|
|
21
17
|
}
|
|
22
18
|
})
|
|
19
|
+
|
|
23
20
|
expect(getCode(result)).toMatchSnapshot()
|
|
24
21
|
})
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
const result = await runner(appPath, {
|
|
28
|
-
...config
|
|
29
|
-
})
|
|
23
|
+
test('nativeComponents not set', async () => {
|
|
24
|
+
const result = await runner(appPath, { ...config })
|
|
30
25
|
expect(getCode(result)).toMatchSnapshot()
|
|
31
26
|
})
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
test('multiple components', async () => {
|
|
34
29
|
const result = await build(config, {
|
|
35
30
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
36
31
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -41,7 +36,7 @@ describe('build_components', () => {
|
|
|
41
36
|
expect(getCode(result)).toMatchSnapshot()
|
|
42
37
|
})
|
|
43
38
|
|
|
44
|
-
|
|
39
|
+
test('modify rollup config', async () => {
|
|
45
40
|
const result = await build(config, {
|
|
46
41
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
47
42
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -60,7 +55,7 @@ describe('build_components', () => {
|
|
|
60
55
|
expect(getCode(result)).toMatchSnapshot()
|
|
61
56
|
})
|
|
62
57
|
|
|
63
|
-
|
|
58
|
+
test('svg transform', async () => {
|
|
64
59
|
const result = await build(config, {
|
|
65
60
|
input: ['components/svg/index'],
|
|
66
61
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -71,7 +66,7 @@ describe('build_components', () => {
|
|
|
71
66
|
expect(getCode(result))
|
|
72
67
|
})
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
test('named export', async () => {
|
|
75
70
|
const result = await build(config, {
|
|
76
71
|
input: ['utils/namedExport/index'],
|
|
77
72
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -81,7 +76,7 @@ describe('build_components', () => {
|
|
|
81
76
|
expect(getCode(result)).toMatchSnapshot()
|
|
82
77
|
})
|
|
83
78
|
|
|
84
|
-
|
|
79
|
+
test('dynamic require', async () => {
|
|
85
80
|
const result = await build(config, {
|
|
86
81
|
input: ['utils/dynamicImport/index'],
|
|
87
82
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -91,7 +86,7 @@ describe('build_components', () => {
|
|
|
91
86
|
expect(getCode(result)).toMatchSnapshot()
|
|
92
87
|
})
|
|
93
88
|
|
|
94
|
-
|
|
89
|
+
test('require react-native component', async () => {
|
|
95
90
|
const result = await build(config, {
|
|
96
91
|
input: ['utils/requireReactNative/index'],
|
|
97
92
|
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 queryString from 'query-string'
|
|
3
|
+
const globalAny = global
|
|
4
4
|
|
|
5
|
-
console.log(globalAny, camelCase,
|
|
5
|
+
console.log(globalAny, camelCase, queryString)
|
package/__tests__/tsconfig.json
CHANGED
|
@@ -22,16 +22,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.build = void 0;
|
|
24
24
|
const plugin_babel_1 = require("@rollup/plugin-babel");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const plugin_commonjs_1 = require("@rollup/plugin-commonjs");
|
|
26
|
+
const plugin_json_1 = require("@rollup/plugin-json");
|
|
27
27
|
const plugin_node_resolve_1 = require("@rollup/plugin-node-resolve");
|
|
28
|
-
const
|
|
28
|
+
const plugin_replace_1 = require("@rollup/plugin-replace");
|
|
29
29
|
const helper_1 = require("@tarojs/helper");
|
|
30
30
|
const rn_style_transformer_1 = require("@tarojs/rn-style-transformer");
|
|
31
31
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
32
32
|
const rn_transformer_1 = require("@tarojs/rn-transformer");
|
|
33
|
-
const
|
|
34
|
-
const
|
|
33
|
+
const acorn_jsx_1 = require("acorn-jsx");
|
|
34
|
+
const path_1 = 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 = {
|
|
@@ -48,11 +48,11 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
48
48
|
const components = Array.isArray(input) ? input : [input];
|
|
49
49
|
const inputOptions = components.reduce((pre, cur) => {
|
|
50
50
|
let absolutePath = cur;
|
|
51
|
-
if (!
|
|
52
|
-
absolutePath =
|
|
51
|
+
if (!path_1.default.isAbsolute(cur)) {
|
|
52
|
+
absolutePath = path_1.default.resolve(sourceRootPath, cur);
|
|
53
53
|
}
|
|
54
54
|
const realPath = (0, rn_supporter_1.resolveExtFile)({ originModulePath: absolutePath }, absolutePath, undefined, projectConfig);
|
|
55
|
-
const relativePath =
|
|
55
|
+
const relativePath = path_1.default
|
|
56
56
|
.relative(sourceRootPath, realPath)
|
|
57
57
|
.replace(/\.(js|ts|jsx|tsx)$/, '')
|
|
58
58
|
.replace(/\.{1,}\//g, '');
|
|
@@ -86,7 +86,7 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
86
86
|
},
|
|
87
87
|
external: getExternal(),
|
|
88
88
|
// @ts-ignore react native 相关的一些库中可能包含 jsx 语法
|
|
89
|
-
acornInjectPlugins: [
|
|
89
|
+
acornInjectPlugins: [(0, acorn_jsx_1.default)()],
|
|
90
90
|
plugins: [
|
|
91
91
|
// TODO: 使用 react-native-svg-transformer 处理
|
|
92
92
|
// @ts-ignore
|
|
@@ -94,7 +94,7 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
94
94
|
extensions: ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.svg', '.svgx']
|
|
95
95
|
}),
|
|
96
96
|
// @ts-ignore
|
|
97
|
-
|
|
97
|
+
(0, plugin_json_1.default)(),
|
|
98
98
|
(0, rn_supporter_1.rollupResolver)({
|
|
99
99
|
externalResolve,
|
|
100
100
|
platform: projectConfig.deviceType // ios|android
|
|
@@ -103,11 +103,14 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
103
103
|
extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx']
|
|
104
104
|
}),
|
|
105
105
|
// @ts-ignore
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
(0, plugin_replace_1.default)({
|
|
107
|
+
preventAssignment: true,
|
|
108
|
+
values: {
|
|
109
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
110
|
+
}
|
|
108
111
|
}),
|
|
109
112
|
// @ts-ignore
|
|
110
|
-
|
|
113
|
+
(0, plugin_commonjs_1.default)(),
|
|
111
114
|
(0, plugin_babel_1.default)({
|
|
112
115
|
babelHelpers: 'runtime',
|
|
113
116
|
presets: [
|
|
@@ -162,14 +165,14 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
162
165
|
});
|
|
163
166
|
exports.build = build;
|
|
164
167
|
function likeDependent(str) {
|
|
165
|
-
return !str.match(/^\.?\.\//) && !
|
|
168
|
+
return !str.match(/^\.?\.\//) && !path_1.default.isAbsolute(str);
|
|
166
169
|
}
|
|
167
170
|
function default_1(projectPath, config) {
|
|
168
171
|
const { sourceRoot, entry, nativeComponents } = config;
|
|
169
|
-
const appPath =
|
|
172
|
+
const appPath = path_1.default.join(projectPath, sourceRoot, entry);
|
|
170
173
|
const appConfig = (0, rn_transformer_1.getAppConfig)(appPath);
|
|
171
174
|
const { output = DEFAULT_CONFIG.output } = nativeComponents || {};
|
|
172
|
-
const componentConfig = Object.assign(Object.assign({}, nativeComponents), { input: appConfig === null || appConfig === void 0 ? void 0 : appConfig.components, output:
|
|
175
|
+
const componentConfig = Object.assign(Object.assign({}, nativeComponents), { input: appConfig === null || appConfig === void 0 ? void 0 : appConfig.components, output: path_1.default.join(projectPath, output), sourceRootPath: path_1.default.join(projectPath, sourceRoot) });
|
|
173
176
|
return (0, exports.build)(config, componentConfig);
|
|
174
177
|
}
|
|
175
178
|
exports.default = default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-component.js","sourceRoot":"","sources":["../../src/config/build-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"build-component.js","sourceRoot":"","sources":["../../src/config/build-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,6DAA8C;AAC9C,qDAAsC;AACtC,qEAAqD;AACrD,2DAAkD;AAClD,2CAA+C;AAC/C,uEAAkF;AAClF,uDAAqG;AACrG,2DAAqD;AACrD,yCAA2B;AAC3B,+BAAuB;AACvB,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,CAAO,aAAa,EAAE,eAAiC,EAAE,EAAE;IAC9E,MAAM,YAAY,GAAG,IAAA,uBAAc,oBAAM,cAAc,GAAI,eAAe,CAAC,CAAA;IAC3E,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAA;IAErG,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,UAAU,GAAa,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QAEnE,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAClD,I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CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;AACH,CAAC,CAAA,CAAA;AAnIY,QAAA,KAAK,SAmIjB;AAED,SAAS,aAAa,CAAE,GAAW;IACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,cAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AACxD,CAAC;AAED,mBAAyB,WAAmB,EAAE,MAAW;IACvD,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAA;IACtD,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;IACzD,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,OAAO,CAAC,CAAA;IACvC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,gBAAgB,IAAI,EAAE,CAAA;IAEjE,MAAM,eAAe,mCAChB,gBAAgB,KACnB,KAAK,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,EAC5B,MAAM,EAAE,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACtC,cAAc,EAAE,cAAI,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
|
@@ -67,7 +67,12 @@ function build(_appPath, config) {
|
|
|
67
67
|
cliParams.push('--port', config.port);
|
|
68
68
|
}
|
|
69
69
|
try {
|
|
70
|
-
(0, child_process_1.spawn)(npxCmd, [
|
|
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), {
|
|
71
76
|
stdio: 'inherit'
|
|
72
77
|
});
|
|
73
78
|
if (config.qr) {
|
|
@@ -78,6 +83,7 @@ function build(_appPath, config) {
|
|
|
78
83
|
onFinish(null);
|
|
79
84
|
}
|
|
80
85
|
catch (e) {
|
|
86
|
+
console.error(e);
|
|
81
87
|
onFinish(e);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
@@ -127,6 +133,7 @@ function build(_appPath, config) {
|
|
|
127
133
|
onFinish(null);
|
|
128
134
|
}
|
|
129
135
|
catch (e) {
|
|
136
|
+
console.error(e);
|
|
130
137
|
onFinish(e);
|
|
131
138
|
}
|
|
132
139
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uDAA8D;AAC9D,iDAAqC;AACrC,2BAAwC;AACxC,gCAA+B;AAC/B,+BAAoC;AAEpC,8DAAqD;AAErD,uCAAuC;AACvC,MAAM,KAAK,GAAG,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAA;AAC7C,SAAS,YAAY;IACnB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;QAC1C,IAAA,aAAQ,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,cAAS,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;YAC1F,IAAI,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uDAA8D;AAC9D,iDAAqC;AACrC,2BAAwC;AACxC,gCAA+B;AAC/B,+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AU,EAAE,UAAU;yBACvB,CAAC,CAAA;oBACJ,CAAC,CAAC,CAAA;gBACJ,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,CAAA;YAChB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAChB,QAAQ,CAAC,CAAC,CAAC,CAAA;YACb,CAAC;QACH,CAAC;IACH,CAAC;CAAA;AAxGD,wBAwGC"}
|
package/package.json
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/rn-runner",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.13",
|
|
4
4
|
"description": "ReactNative build tool for taro",
|
|
5
|
+
"author": "O2Team",
|
|
6
|
+
"license": "MIT",
|
|
5
7
|
"main": "index.js",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/NervJS/taro.git"
|
|
9
|
-
},
|
|
10
8
|
"keywords": [
|
|
11
9
|
"taro"
|
|
12
10
|
],
|
|
13
|
-
"author": "luckyadam",
|
|
14
|
-
"license": "MIT",
|
|
15
11
|
"bugs": {
|
|
16
12
|
"url": "https://github.com/NervJS/taro/issues"
|
|
17
13
|
},
|
|
18
|
-
"
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/NervJS/taro.git"
|
|
17
|
+
},
|
|
19
18
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
21
|
-
"npm": ">=6.0.0"
|
|
19
|
+
"node": ">= 18"
|
|
22
20
|
},
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"@rollup/plugin-babel": "^6.0.
|
|
25
|
-
"@rollup/plugin-commonjs": "^
|
|
26
|
-
"@rollup/plugin-json": "^
|
|
27
|
-
"@rollup/plugin-node-resolve": "^
|
|
28
|
-
"@rollup/plugin-replace": "^
|
|
22
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
23
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
24
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
26
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
27
|
+
"acorn": "^8.11.3",
|
|
29
28
|
"acorn-jsx": "^5.3.2",
|
|
30
|
-
"fs-extra": "^
|
|
29
|
+
"fs-extra": "^11.2.0",
|
|
31
30
|
"lodash": "^4.17.21",
|
|
32
31
|
"rollup-plugin-image-file": "^1.0.2",
|
|
33
|
-
"@tarojs/
|
|
34
|
-
"@tarojs/
|
|
35
|
-
"@tarojs/rn-
|
|
36
|
-
"@tarojs/rn-transformer": "4.0.0-alpha.
|
|
32
|
+
"@tarojs/helper": "4.0.0-alpha.13",
|
|
33
|
+
"@tarojs/rn-style-transformer": "4.0.0-alpha.13",
|
|
34
|
+
"@tarojs/rn-supporter": "4.0.0-alpha.13",
|
|
35
|
+
"@tarojs/rn-transformer": "4.0.0-alpha.13",
|
|
36
|
+
"stylelint-config-taro-rn": "4.0.0-alpha.13"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"react-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"babel-
|
|
39
|
+
"@rnx-kit/metro-resolver-symlinks": "^0.1.36",
|
|
40
|
+
"expo": "~51.0.5",
|
|
41
|
+
"expo-file-system": "~16.0.0",
|
|
42
|
+
"query-string": "^9.0.0",
|
|
43
|
+
"react": "^18.2.0",
|
|
44
|
+
"react-is": "^18.3.1",
|
|
45
|
+
"react-native": "^0.72.3",
|
|
46
|
+
"react-native-root-siblings": "^5.0.1",
|
|
47
|
+
"rollup": "^4.16.4",
|
|
48
|
+
"@tarojs/taro": "4.0.0-alpha.13",
|
|
49
|
+
"babel-preset-taro": "4.0.0-alpha.13",
|
|
50
|
+
"babel-plugin-transform-react-jsx-to-rn-stylesheet": "4.0.0-alpha.13",
|
|
51
|
+
"@tarojs/components": "4.0.0-alpha.13"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"expo": ">= 51",
|
|
55
|
+
"react": ">= 18",
|
|
56
|
+
"react-native": ">= 0.63.0",
|
|
57
|
+
"babel-preset-taro": "4.0.0-alpha.13"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
+
"prod": "pnpm run build",
|
|
61
|
+
"prebuild": "pnpm run clean",
|
|
62
|
+
"clean": "rimraf --impl=move-remove ./dist",
|
|
60
63
|
"build": "tsc",
|
|
61
|
-
"dev": "tsc
|
|
62
|
-
"lint": "eslint .",
|
|
63
|
-
"test": "
|
|
64
|
-
"test:ci": "
|
|
65
|
-
"test:
|
|
66
|
-
"test:
|
|
67
|
-
"updateSnapshot": "jest --updateSnapshot"
|
|
64
|
+
"dev": "tsc -w",
|
|
65
|
+
"lint": "eslint src templates __tests__ --ext .js,.ts",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:ci": "vitest run --coverage",
|
|
68
|
+
"test:dev": "vitest",
|
|
69
|
+
"test:update": "vitest --update"
|
|
68
70
|
}
|
|
69
71
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import babel from '@rollup/plugin-babel'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs'
|
|
3
|
+
import json from '@rollup/plugin-json'
|
|
4
4
|
import nodeResolve from '@rollup/plugin-node-resolve'
|
|
5
|
-
import
|
|
5
|
+
import pluginReplace from '@rollup/plugin-replace'
|
|
6
6
|
import { recursiveMerge } from '@tarojs/helper'
|
|
7
7
|
import { rollupTransform as styleTransformer } from '@tarojs/rn-style-transformer'
|
|
8
8
|
import { getBabelConfig, resolveExtFile, rollupResolver as taroResolver } from '@tarojs/rn-supporter'
|
|
9
9
|
import { getAppConfig } from '@tarojs/rn-transformer'
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import jsx from 'acorn-jsx'
|
|
11
|
+
import path from 'path'
|
|
12
12
|
import { rollup, RollupOptions } from 'rollup'
|
|
13
13
|
import image from 'rollup-plugin-image-file'
|
|
14
14
|
|
|
@@ -108,7 +108,10 @@ export const build = async (projectConfig, componentConfig: IComponentConfig) =>
|
|
|
108
108
|
}),
|
|
109
109
|
// @ts-ignore
|
|
110
110
|
pluginReplace({
|
|
111
|
-
|
|
111
|
+
preventAssignment: true,
|
|
112
|
+
values: {
|
|
113
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
114
|
+
}
|
|
112
115
|
}),
|
|
113
116
|
// @ts-ignore
|
|
114
117
|
commonjs(),
|
package/src/index.ts
CHANGED
|
@@ -60,7 +60,12 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
60
60
|
cliParams.push('--port', config.port)
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
|
-
spawn(npxCmd, [
|
|
63
|
+
spawn(npxCmd, [
|
|
64
|
+
'react-native',
|
|
65
|
+
'start',
|
|
66
|
+
'--custom-log-reporter-path',
|
|
67
|
+
'@tarojs/rn-supporter/TerminalReporter'
|
|
68
|
+
].concat(cliParams), {
|
|
64
69
|
stdio: 'inherit'
|
|
65
70
|
})
|
|
66
71
|
if (config.qr) {
|
|
@@ -70,6 +75,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
70
75
|
}
|
|
71
76
|
onFinish(null)
|
|
72
77
|
} catch (e) {
|
|
78
|
+
console.error(e)
|
|
73
79
|
onFinish(e)
|
|
74
80
|
}
|
|
75
81
|
} else {
|
|
@@ -121,6 +127,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
121
127
|
}
|
|
122
128
|
onFinish(null)
|
|
123
129
|
} catch (e) {
|
|
130
|
+
console.error(e)
|
|
124
131
|
onFinish(e)
|
|
125
132
|
}
|
|
126
133
|
}
|
package/templates/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import '@tarojs/rn-supporter/entry-file.js'
|
|
1
|
+
import '@tarojs/rn-supporter/entry-file.js'
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
const { mergeConfig } = require('metro-config')
|
|
1
|
+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
|
|
2
2
|
const { getMetroConfig } = require('@tarojs/rn-supporter')
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
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
|
+
module.exports = (async function () {
|
|
13
|
+
return mergeConfig(getDefaultConfig(__dirname), await getMetroConfig(), config)
|
|
14
|
+
})()
|
package/tsconfig.json
CHANGED