@tarojs/rn-runner 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -8
- package/README.md +1 -1
- package/__tests__/__snapshots__/components.spec.ts.snap +91 -120
- package/__tests__/components.spec.ts +17 -21
- 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 +5 -2
- package/dist/config/build-component.js.map +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +48 -45
- package/src/config/build-component.ts +6 -2
- package/src/index.ts +11 -3
- package/templates/index.js +1 -1
- package/templates/metro.config.js +11 -7
- package/tsconfig.json +1 -0
- package/jest.config.js +0 -6
package/LICENSE
CHANGED
|
@@ -154,15 +154,8 @@ See `/LICENSE` for details of the license.
|
|
|
154
154
|
|
|
155
155
|
==================
|
|
156
156
|
|
|
157
|
-
MIT (stencil-vue2-output-target):
|
|
158
|
-
The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
|
|
159
|
-
`/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
|
|
160
|
-
See `/LICENSE` for details of the license.
|
|
161
|
-
|
|
162
|
-
==================
|
|
163
|
-
|
|
164
157
|
MIT (weui):
|
|
165
|
-
The following files embed [
|
|
158
|
+
The following files embed [weui](https://github.com/Tencent/weui) MIT:
|
|
166
159
|
`/packages/taro-components/src/components/*.scss`
|
|
167
160
|
See `/LICENSE.txt` for details of the license.
|
|
168
161
|
|
|
@@ -172,3 +165,10 @@ Apache-2.0 (intersection-observer):
|
|
|
172
165
|
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
173
166
|
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
174
167
|
See `/LICENSE.txt` for details of the license.
|
|
168
|
+
|
|
169
|
+
==================
|
|
170
|
+
|
|
171
|
+
MIT (babel-plugin-jsx-dom-expressions):
|
|
172
|
+
The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
|
|
173
|
+
`/packages/babel-plugin-transform-solid-jsx/src/*`
|
|
174
|
+
See `/LICENSE` for details of the license.
|
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
暴露给 `@tarojs/cli` 的 React Native Webpack 启动器。
|
|
4
4
|
|
|
5
|
-
`@tarojs/
|
|
5
|
+
`@tarojs/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,18 +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-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
212
|
-
import 'react';
|
|
213
|
-
import require$$0 from 'crypto';
|
|
210
|
+
"import { Platform as Platform$1, NativeEventEmitter, NativeModules } from 'react-native';
|
|
214
211
|
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}
|
|
218
|
-
|
|
219
|
-
function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}
|
|
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);}
|
|
220
213
|
|
|
221
214
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
222
215
|
|
|
@@ -224,99 +217,95 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
224
217
|
|
|
225
218
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
226
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
|
+
|
|
227
224
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
228
225
|
|
|
229
|
-
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);}
|
|
230
227
|
|
|
231
|
-
function
|
|
228
|
+
function toPropertyKey(t){var i=toPrimitive(t,"string");return "symbol"==_typeof(i)?i:i+"";}
|
|
232
229
|
|
|
233
|
-
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,
|
|
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;}
|
|
234
231
|
|
|
235
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);});};}
|
|
236
233
|
|
|
237
|
-
function _defineProperty(obj,key,value){key=
|
|
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;}
|
|
238
235
|
|
|
239
|
-
|
|
236
|
+
function getDefaultExportFromCjs (x) {
|
|
237
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
238
|
+
}
|
|
240
239
|
|
|
241
|
-
var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(format===undefined){error=new Error('Minified exception occurred; use the non-minified dev environment '+'for the full error message and additional helpful warnings.');}else {var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++];}));error.name='Invariant Violation';}error.framesToPop=1;throw error;}};var invariant_1=invariant;
|
|
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);
|
|
242
241
|
|
|
243
|
-
var nativeEmitterSubscriptionKey='@@nativeEmitterSubscription@@';var EventEmitter=function(){function EventEmitter(nativeModule){_classCallCheck(this,EventEmitter);this._listenerCount=0;if(nativeModule.__expo_module_name__
|
|
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));}}]);}();
|
|
244
243
|
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
var isDOMAvailable=false;var canUseEventListeners=false;var canUseViewport=false;var isAsyncDebugging=false;if(__DEV__){isAsyncDebugging=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless;}
|
|
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}\`);}}
|
|
248
245
|
|
|
249
|
-
var
|
|
246
|
+
var NativeModulesProxy = {};
|
|
250
247
|
|
|
251
|
-
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";}}
|
|
252
249
|
|
|
253
|
-
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;})();}
|
|
254
251
|
|
|
255
|
-
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;}
|
|
256
253
|
|
|
257
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);}
|
|
258
255
|
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
function _createSuper$1(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct$1();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct$1(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var UnavailabilityError=function(_CodedError){_inherits(UnavailabilityError,_CodedError);var _super=_createSuper$1(UnavailabilityError);function UnavailabilityError(moduleName,propertyName){_classCallCheck(this,UnavailabilityError);return _super.call(this,'ERR_UNAVAILABLE',"The method or property "+moduleName+"."+propertyName+" is not available on "+Platform.OS+", are you sure you've linked all the native dependencies properly?");}return _createClass(UnavailabilityError);}(CodedError);
|
|
262
|
-
|
|
263
|
-
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
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));
|
|
264
257
|
|
|
265
|
-
|
|
258
|
+
var isDOMAvailable=false;var canUseEventListeners=false;var canUseViewport=false;var isAsyncDebugging=false;if(__DEV__){isAsyncDebugging=!global.nativeExtensions&&!global.nativeCallSyncHook&&!global.RN$Bridgeless;}
|
|
266
259
|
|
|
267
|
-
var
|
|
260
|
+
var Platform={OS:Platform$1.OS,select:Platform$1.select,isDOMAvailable:isDOMAvailable,canUseEventListeners:canUseEventListeners,canUseViewport:canUseViewport,isAsyncDebugging:isAsyncDebugging};
|
|
268
261
|
|
|
269
|
-
|
|
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);
|
|
270
263
|
|
|
271
|
-
var
|
|
264
|
+
var NativeErrorManager = NativeModulesProxy.ExpoModulesCoreErrorManager;
|
|
272
265
|
|
|
273
|
-
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;
|
|
274
267
|
|
|
275
|
-
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('');}
|
|
276
269
|
|
|
277
|
-
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={}));
|
|
278
271
|
|
|
279
|
-
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};
|
|
280
273
|
|
|
281
|
-
|
|
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;}
|
|
282
275
|
|
|
283
|
-
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(){}};
|
|
284
277
|
|
|
285
|
-
var
|
|
278
|
+
var _requireOptionalNativ;var ExponentFileSystem = (_requireOptionalNativ=requireOptionalNativeModule('ExponentFileSystem'))!=null?_requireOptionalNativ:platformModule;
|
|
286
279
|
|
|
287
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={}));
|
|
288
281
|
|
|
289
|
-
function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else {result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}if(!ExponentFileSystem){console.warn("No native ExponentFileSystem module found, are you sure the expo-file-system's module is linked properly?");}new EventEmitter(ExponentFileSystem);function normalizeEndingSlash(p){if(p!=null){return p.replace(/\\/*$/,'')+'/';}return null;}var documentDirectory=normalizeEndingSlash(ExponentFileSystem.documentDirectory);var cacheDirectory=normalizeEndingSlash(ExponentFileSystem.cacheDirectory);var bundledAssets=ExponentFileSystem.bundledAssets,bundleDirectory=ExponentFileSystem.bundleDirectory;function getInfoAsync(){return _getInfoAsync.apply(this,arguments);}function _getInfoAsync(){_getInfoAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.getInfoAsync){throw new UnavailabilityError('expo-file-system','getInfoAsync');}return yield ExponentFileSystem.getInfoAsync(fileUri,options);});return _getInfoAsync.apply(this,arguments);}function readAsStringAsync(){return _readAsStringAsync.apply(this,arguments);}function _readAsStringAsync(){_readAsStringAsync=_asyncToGenerator(function*(fileUri,options){if(!ExponentFileSystem.readAsStringAsync){throw new UnavailabilityError('expo-file-system','readAsStringAsync');}return yield ExponentFileSystem.readAsStringAsync(fileUri,options||{});});return _readAsStringAsync.apply(this,arguments);}function getContentUriAsync(){return _getContentUriAsync.apply(this,arguments);}function _getContentUriAsync(){_getContentUriAsync=_asyncToGenerator(function*(fileUri){if(Platform$1.OS==='android'){if(!ExponentFileSystem.getContentUriAsync){throw new UnavailabilityError('expo-file-system','getContentUriAsync');}return yield ExponentFileSystem.getContentUriAsync(fileUri);}else {return new Promise(function(resolve){resolve(fileUri);});}});return _getContentUriAsync.apply(this,arguments);}function writeAsStringAsync(){return _writeAsStringAsync.apply(this,arguments);}function _writeAsStringAsync(){_writeAsStringAsync=_asyncToGenerator(function*(fileUri,contents){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.writeAsStringAsync){throw new UnavailabilityError('expo-file-system','writeAsStringAsync');}return yield ExponentFileSystem.writeAsStringAsync(fileUri,contents,options);});return _writeAsStringAsync.apply(this,arguments);}function deleteAsync(){return _deleteAsync.apply(this,arguments);}function _deleteAsync(){_deleteAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.deleteAsync){throw new UnavailabilityError('expo-file-system','deleteAsync');}return yield ExponentFileSystem.deleteAsync(fileUri,options);});return _deleteAsync.apply(this,arguments);}function deleteLegacyDocumentDirectoryAndroid(){return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function _deleteLegacyDocumentDirectoryAndroid(){_deleteLegacyDocumentDirectoryAndroid=_asyncToGenerator(function*(){if(Platform$1.OS!=='android'||documentDirectory==null){return;}return yield deleteAsync(documentDirectory+"ExperienceData/",{idempotent:true});});return _deleteLegacyDocumentDirectoryAndroid.apply(this,arguments);}function moveAsync(){return _moveAsync.apply(this,arguments);}function _moveAsync(){_moveAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.moveAsync){throw new UnavailabilityError('expo-file-system','moveAsync');}return yield ExponentFileSystem.moveAsync(options);});return _moveAsync.apply(this,arguments);}function copyAsync(){return _copyAsync.apply(this,arguments);}function _copyAsync(){_copyAsync=_asyncToGenerator(function*(options){if(!ExponentFileSystem.copyAsync){throw new UnavailabilityError('expo-file-system','copyAsync');}return yield ExponentFileSystem.copyAsync(options);});return _copyAsync.apply(this,arguments);}function makeDirectoryAsync(){return _makeDirectoryAsync.apply(this,arguments);}function _makeDirectoryAsync(){_makeDirectoryAsync=_asyncToGenerator(function*(fileUri){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!ExponentFileSystem.makeDirectoryAsync){throw new UnavailabilityError('expo-file-system','makeDirectoryAsync');}return yield ExponentFileSystem.makeDirectoryAsync(fileUri,options);});return _makeDirectoryAsync.apply(this,arguments);}function readDirectoryAsync(){return _readDirectoryAsync.apply(this,arguments);}function _readDirectoryAsync(){_readDirectoryAsync=_asyncToGenerator(function*(fileUri){if(!ExponentFileSystem.readDirectoryAsync){throw new UnavailabilityError('expo-file-system','readDirectoryAsync');}return yield ExponentFileSystem.readDirectoryAsync(fileUri,{});});return _readDirectoryAsync.apply(this,arguments);}function getFreeDiskStorageAsync(){return _getFreeDiskStorageAsync.apply(this,arguments);}function _getFreeDiskStorageAsync(){_getFreeDiskStorageAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getFreeDiskStorageAsync){throw new UnavailabilityError('expo-file-system','getFreeDiskStorageAsync');}return yield ExponentFileSystem.getFreeDiskStorageAsync();});return _getFreeDiskStorageAsync.apply(this,arguments);}function getTotalDiskCapacityAsync(){return _getTotalDiskCapacityAsync.apply(this,arguments);}function _getTotalDiskCapacityAsync(){_getTotalDiskCapacityAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.getTotalDiskCapacityAsync){throw new UnavailabilityError('expo-file-system','getTotalDiskCapacityAsync');}return yield ExponentFileSystem.getTotalDiskCapacityAsync();});return _getTotalDiskCapacityAsync.apply(this,arguments);}function downloadAsync(){return _downloadAsync.apply(this,arguments);}function _downloadAsync(){_downloadAsync=_asyncToGenerator(function*(uri,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.downloadAsync){throw new UnavailabilityError('expo-file-system','downloadAsync');}return yield ExponentFileSystem.downloadAsync(uri,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND},options));});return _downloadAsync.apply(this,arguments);}function uploadAsync(){return _uploadAsync.apply(this,arguments);}function _uploadAsync(){_uploadAsync=_asyncToGenerator(function*(url,fileUri){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(!ExponentFileSystem.uploadAsync){throw new UnavailabilityError('expo-file-system','uploadAsync');}return yield ExponentFileSystem.uploadAsync(url,fileUri,Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:(options.httpMethod||'POST').toUpperCase()}));});return _uploadAsync.apply(this,arguments);}function createDownloadResumable(uri,fileUri,options,callback,resumeData){return new DownloadResumable(uri,fileUri,options,callback,resumeData);}function createUploadTask(url,fileUri,options,callback){return new UploadTask(url,fileUri,options,callback);}var FileSystemCancellableNetworkTask=function(){function FileSystemCancellableNetworkTask(){_classCallCheck(this,FileSystemCancellableNetworkTask);this._uuid=uuid_1.v4();this.taskWasCanceled=false;this.emitter=new EventEmitter(ExponentFileSystem);}_createClass(FileSystemCancellableNetworkTask,[{key:"cancelAsync",value:function(){var _cancelAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.networkTaskCancelAsync){throw new UnavailabilityError('expo-file-system','networkTaskCancelAsync');}this.removeSubscription();this.taskWasCanceled=true;return yield ExponentFileSystem.networkTaskCancelAsync(this.uuid);});function cancelAsync(){return _cancelAsync.apply(this,arguments);}return cancelAsync;}()},{key:"isTaskCancelled",value:function isTaskCancelled(){if(this.taskWasCanceled){console.warn('This task was already canceled.');return true;}return false;}},{key:"uuid",get:function get(){return this._uuid;}},{key:"addSubscription",value:function addSubscription(){var _this=this;if(this.subscription){return;}this.subscription=this.emitter.addListener(this.getEventName(),function(event){if(event.uuid===_this.uuid){var callback=_this.getCallback();if(callback){callback(event.data);}}});}},{key:"removeSubscription",value:function removeSubscription(){if(!this.subscription){return;}this.emitter.removeSubscription(this.subscription);this.subscription=null;}}]);return FileSystemCancellableNetworkTask;}();var UploadTask=function(_FileSystemCancellabl){_inherits(UploadTask,_FileSystemCancellabl);var _super=_createSuper(UploadTask);function UploadTask(url,fileUri,options,callback){var _options$httpMethod;var _this2;_classCallCheck(this,UploadTask);_this2=_super.call(this);_this2.url=url;_this2.fileUri=fileUri;_this2.callback=callback;var httpMethod=(options==null?void 0:(_options$httpMethod=options.httpMethod)==null?void 0:_options$httpMethod.toUpperCase())||'POST';_this2.options=Object.assign({sessionType:FileSystemSessionType.BACKGROUND,uploadType:FileSystemUploadType.BINARY_CONTENT},options,{httpMethod:httpMethod});return _this2;}_createClass(UploadTask,[{key:"getEventName",value:function getEventName(){return 'expo-file-system.uploadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"uploadAsync",value:function(){var _uploadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.uploadTaskStartAsync){throw new UnavailabilityError('expo-file-system','uploadTaskStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();var result=yield ExponentFileSystem.uploadTaskStartAsync(this.url,this.fileUri,this.uuid,this.options);this.removeSubscription();return result;});function uploadAsync(){return _uploadAsync2.apply(this,arguments);}return uploadAsync;}()}]);return UploadTask;}(FileSystemCancellableNetworkTask);var DownloadResumable=function(_FileSystemCancellabl2){_inherits(DownloadResumable,_FileSystemCancellabl2);var _super2=_createSuper(DownloadResumable);function DownloadResumable(url,_fileUri){var _this3;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var callback=arguments.length>3?arguments[3]:undefined;var resumeData=arguments.length>4?arguments[4]:undefined;_classCallCheck(this,DownloadResumable);_this3=_super2.call(this);_this3.url=url;_this3._fileUri=_fileUri;_this3.options=options;_this3.callback=callback;_this3.resumeData=resumeData;return _this3;}_createClass(DownloadResumable,[{key:"fileUri",get:function get(){return this._fileUri;}},{key:"getEventName",value:function getEventName(){return 'expo-file-system.downloadProgress';}},{key:"getCallback",value:function getCallback(){return this.callback;}},{key:"downloadAsync",value:function(){var _downloadAsync2=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this._fileUri,this.uuid,this.options,this.resumeData);});function downloadAsync(){return _downloadAsync2.apply(this,arguments);}return downloadAsync;}()},{key:"pauseAsync",value:function(){var _pauseAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumablePauseAsync){throw new UnavailabilityError('expo-file-system','downloadResumablePauseAsync');}if(this.isTaskCancelled()){return {fileUri:this._fileUri,options:this.options,url:this.url};}var pauseResult=yield ExponentFileSystem.downloadResumablePauseAsync(this.uuid);this.removeSubscription();if(pauseResult){this.resumeData=pauseResult.resumeData;return this.savable();}else {throw new Error('Unable to generate a savable pause state');}});function pauseAsync(){return _pauseAsync.apply(this,arguments);}return pauseAsync;}()},{key:"resumeAsync",value:function(){var _resumeAsync=_asyncToGenerator(function*(){if(!ExponentFileSystem.downloadResumableStartAsync){throw new UnavailabilityError('expo-file-system','downloadResumableStartAsync');}if(this.isTaskCancelled()){return;}this.addSubscription();return yield ExponentFileSystem.downloadResumableStartAsync(this.url,this.fileUri,this.uuid,this.options,this.resumeData);});function resumeAsync(){return _resumeAsync.apply(this,arguments);}return resumeAsync;}()},{key:"savable",value:function savable(){return {url:this.url,fileUri:this.fileUri,options:this.options,resumeData:this.resumeData};}}]);return DownloadResumable;}(FileSystemCancellableNetworkTask);var baseReadAsStringAsync=readAsStringAsync;var baseWriteAsStringAsync=writeAsStringAsync;var baseDeleteAsync=deleteAsync;var baseMoveAsync=moveAsync;var baseCopyAsync=copyAsync;var StorageAccessFramework;(function(StorageAccessFramework){StorageAccessFramework.getUriForDirectoryInRoot=function getUriForDirectoryInRoot(folderName){return "content://com.android.externalstorage.documents/tree/primary:"+folderName+"/document/primary:"+folderName;};function requestDirectoryPermissionsAsync(){return _requestDirectoryPermissionsAsync.apply(this,arguments);}function _requestDirectoryPermissionsAsync(){_requestDirectoryPermissionsAsync=_asyncToGenerator(function*(){var initialFileUrl=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!ExponentFileSystem.requestDirectoryPermissionsAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.requestDirectoryPermissionsAsync');}return yield ExponentFileSystem.requestDirectoryPermissionsAsync(initialFileUrl);});return _requestDirectoryPermissionsAsync.apply(this,arguments);}StorageAccessFramework.requestDirectoryPermissionsAsync=requestDirectoryPermissionsAsync;function readDirectoryAsync(_x16){return _readDirectoryAsync2.apply(this,arguments);}function _readDirectoryAsync2(){_readDirectoryAsync2=_asyncToGenerator(function*(dirUri){if(!ExponentFileSystem.readSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.readDirectoryAsync');}return yield ExponentFileSystem.readSAFDirectoryAsync(dirUri,{});});return _readDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.readDirectoryAsync=readDirectoryAsync;function makeDirectoryAsync(_x17,_x18){return _makeDirectoryAsync2.apply(this,arguments);}function _makeDirectoryAsync2(){_makeDirectoryAsync2=_asyncToGenerator(function*(parentUri,dirName){if(!ExponentFileSystem.makeSAFDirectoryAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.makeDirectoryAsync');}return yield ExponentFileSystem.makeSAFDirectoryAsync(parentUri,dirName);});return _makeDirectoryAsync2.apply(this,arguments);}StorageAccessFramework.makeDirectoryAsync=makeDirectoryAsync;function createFileAsync(_x19,_x20,_x21){return _createFileAsync.apply(this,arguments);}function _createFileAsync(){_createFileAsync=_asyncToGenerator(function*(parentUri,fileName,mimeType){if(!ExponentFileSystem.createSAFFileAsync){throw new UnavailabilityError('expo-file-system','StorageAccessFramework.createFileAsync');}return yield ExponentFileSystem.createSAFFileAsync(parentUri,fileName,mimeType);});return _createFileAsync.apply(this,arguments);}StorageAccessFramework.createFileAsync=createFileAsync;StorageAccessFramework.writeAsStringAsync=baseWriteAsStringAsync;StorageAccessFramework.readAsStringAsync=baseReadAsStringAsync;StorageAccessFramework.deleteAsync=baseDeleteAsync;StorageAccessFramework.moveAsync=baseMoveAsync;StorageAccessFramework.copyAsync=baseCopyAsync;})(StorageAccessFramework||(StorageAccessFramework={}));
|
|
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={}));
|
|
290
283
|
|
|
291
284
|
var fileBuild = /*#__PURE__*/Object.freeze({
|
|
292
285
|
__proto__: null,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
get
|
|
296
|
-
|
|
297
|
-
cacheDirectory: cacheDirectory,
|
|
298
|
-
bundledAssets: bundledAssets,
|
|
286
|
+
DownloadResumable: DownloadResumable,
|
|
287
|
+
FileSystemCancellableNetworkTask: FileSystemCancellableNetworkTask,
|
|
288
|
+
get StorageAccessFramework () { return StorageAccessFramework; },
|
|
289
|
+
UploadTask: UploadTask,
|
|
299
290
|
bundleDirectory: bundleDirectory,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
291
|
+
cacheDirectory: cacheDirectory,
|
|
292
|
+
copyAsync: copyAsync,
|
|
293
|
+
createDownloadResumable: createDownloadResumable,
|
|
294
|
+
createUploadTask: createUploadTask,
|
|
304
295
|
deleteAsync: deleteAsync,
|
|
305
296
|
deleteLegacyDocumentDirectoryAndroid: deleteLegacyDocumentDirectoryAndroid,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
readDirectoryAsync: readDirectoryAsync,
|
|
297
|
+
documentDirectory: documentDirectory,
|
|
298
|
+
downloadAsync: downloadAsync,
|
|
299
|
+
getContentUriAsync: getContentUriAsync,
|
|
310
300
|
getFreeDiskStorageAsync: getFreeDiskStorageAsync,
|
|
301
|
+
getInfoAsync: getInfoAsync,
|
|
311
302
|
getTotalDiskCapacityAsync: getTotalDiskCapacityAsync,
|
|
312
|
-
|
|
303
|
+
makeDirectoryAsync: makeDirectoryAsync,
|
|
304
|
+
moveAsync: moveAsync,
|
|
305
|
+
readAsStringAsync: readAsStringAsync,
|
|
306
|
+
readDirectoryAsync: readDirectoryAsync,
|
|
313
307
|
uploadAsync: uploadAsync,
|
|
314
|
-
|
|
315
|
-
createUploadTask: createUploadTask,
|
|
316
|
-
FileSystemCancellableNetworkTask: FileSystemCancellableNetworkTask,
|
|
317
|
-
UploadTask: UploadTask,
|
|
318
|
-
DownloadResumable: DownloadResumable,
|
|
319
|
-
get StorageAccessFramework () { return StorageAccessFramework; }
|
|
308
|
+
writeAsStringAsync: writeAsStringAsync
|
|
320
309
|
});
|
|
321
310
|
|
|
322
311
|
console.log({fileBuild:fileBuild});
|
|
@@ -324,10 +313,9 @@ console.log({fileBuild:fileBuild});
|
|
|
324
313
|
]
|
|
325
314
|
`;
|
|
326
315
|
|
|
327
|
-
exports[`build_components nativeComponents
|
|
316
|
+
exports[`build_components > nativeComponents not set 1`] = `
|
|
328
317
|
[
|
|
329
|
-
"import '
|
|
330
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
318
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
331
319
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
332
320
|
import taro from '@tarojs/taro-rn';
|
|
333
321
|
import { StyleSheet } from 'react-native';
|
|
@@ -360,36 +348,31 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
360
348
|
}
|
|
361
349
|
});
|
|
362
350
|
|
|
363
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
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;
|
|
364
352
|
|
|
365
353
|
export { Cell as default };
|
|
366
354
|
",
|
|
367
355
|
]
|
|
368
356
|
`;
|
|
369
357
|
|
|
370
|
-
exports[`build_components require react-native component 1`] = `
|
|
358
|
+
exports[`build_components > require react-native component 1`] = `
|
|
371
359
|
[
|
|
372
|
-
"import {
|
|
373
|
-
import {
|
|
374
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
360
|
+
"import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
361
|
+
import { Children, Component } from 'react';
|
|
375
362
|
|
|
376
363
|
function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
|
377
364
|
|
|
378
|
-
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);}
|
|
379
366
|
|
|
380
|
-
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);}
|
|
381
368
|
|
|
382
|
-
function
|
|
369
|
+
function toPropertyKey(t){var i=toPrimitive(t,"string");return "symbol"==_typeof(i)?i:i+"";}
|
|
383
370
|
|
|
384
|
-
function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,
|
|
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;}
|
|
385
372
|
|
|
386
373
|
function ChildrenWrapper(props){return jsx(Fragment,{children:props.children});}
|
|
387
374
|
|
|
388
|
-
var RootControllerChanges;(function(RootControllerChanges){RootControllerChanges[RootControllerChanges["Insert"]=0]="Insert";RootControllerChanges[RootControllerChanges["Update"]=1]="Update";RootControllerChanges[RootControllerChanges["Remove"]=2]="Remove";})(RootControllerChanges||(RootControllerChanges={}));var RootController=function(){function RootController(){_classCallCheck(this,RootController);this.siblings=new Set();this.pendingActions=[];this.callback=null;}_createClass(RootController,[{key:"update",value:function update(id,element,callback){if(!this.siblings.has(id)){this.emit(id,{change:RootControllerChanges.Insert,element:element,updateCallback:callback});this.siblings.add(id);}else {this.emit(id,{change:RootControllerChanges.Update,element:element,updateCallback:callback});}}},{key:"destroy",value:function destroy(id,callback){if(this.siblings.has(id)){this.emit(id,{change:RootControllerChanges.Remove,element:null,updateCallback:callback});this.siblings.delete(id);}else if(callback){callback();}}},{key:"setCallback",value:function setCallback(callback){this.callback=callback;this.pendingActions.forEach(function(_ref){var id=_ref.id,action=_ref.action;callback(id,action);});}},{key:"emit",value:function emit(id,action){if(this.callback){this.callback(id,action);}else {this.pendingActions.push({action:action,id:id});}}}]);
|
|
389
|
-
|
|
390
|
-
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
391
|
-
|
|
392
|
-
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}
|
|
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});}}}]);}();
|
|
393
376
|
|
|
394
377
|
function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}
|
|
395
378
|
|
|
@@ -397,23 +380,26 @@ function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object
|
|
|
397
380
|
|
|
398
381
|
function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}
|
|
399
382
|
|
|
400
|
-
function
|
|
383
|
+
function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}
|
|
401
384
|
|
|
402
|
-
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);
|
|
403
390
|
|
|
404
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);}}};}
|
|
405
392
|
|
|
406
|
-
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);}}]);}();
|
|
407
394
|
|
|
408
395
|
console.log({silblings:RootSiblingsManager});
|
|
409
396
|
",
|
|
410
397
|
]
|
|
411
398
|
`;
|
|
412
399
|
|
|
413
|
-
exports[`build_components single component 1`] = `
|
|
400
|
+
exports[`build_components > single component 1`] = `
|
|
414
401
|
[
|
|
415
|
-
"import '
|
|
416
|
-
import View from '@tarojs/components-rn/dist/components/View';
|
|
402
|
+
"import View from '@tarojs/components-rn/dist/components/View';
|
|
417
403
|
import Text from '@tarojs/components-rn/dist/components/Text';
|
|
418
404
|
import taro from '@tarojs/taro-rn';
|
|
419
405
|
import { StyleSheet } from 'react-native';
|
|
@@ -446,24 +432,9 @@ var _indexScssStyleSheet = StyleSheet.create({
|
|
|
446
432
|
}
|
|
447
433
|
});
|
|
448
434
|
|
|
449
|
-
function _mergeEleStyles(){return [].concat.apply([],arguments).reduce((pre,cur)=>Object.assign(pre,cur),{});}var _styleSheet=_indexScssStyleSheet;console.log({taro:taro});function Cell(_ref){var children=_ref.children,style=_ref.style;var childs=Array.isArray(children)?children:[children];return jsx(View,{style:_mergeEleStyles(_styleSheet["cellGroup"],Object.assign({},style)),children:childs.map(function(it,i){return [it].concat(i===children.length-1?[]:jsx(View,{style:_styleSheet["cellItem__line"]}
|
|
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;
|
|
450
436
|
|
|
451
437
|
export { Cell as default };
|
|
452
438
|
",
|
|
453
439
|
]
|
|
454
440
|
`;
|
|
455
|
-
|
|
456
|
-
exports[`build_components svg transform 1`] = `
|
|
457
|
-
[
|
|
458
|
-
"import 'react';
|
|
459
|
-
import { jsx } from 'react/jsx-runtime';
|
|
460
|
-
|
|
461
|
-
var Logo = require('./assets/rollup-logo-a3c30bf4.svg');
|
|
462
|
-
|
|
463
|
-
function index(){return jsx(Logo,{className:"logo",width:120,height:40});}
|
|
464
|
-
|
|
465
|
-
export { index as default };
|
|
466
|
-
",
|
|
467
|
-
undefined,
|
|
468
|
-
]
|
|
469
|
-
`;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import * as path from 'path'
|
|
1
|
+
import * as path from 'node:path'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { describe, expect, test } from 'vitest'
|
|
4
|
+
|
|
5
|
+
import { build } from '../dist/config/build-component'
|
|
6
|
+
import { default as runner } from '../dist/index'
|
|
5
7
|
import { appPath, config } from './mock/components_testdata'
|
|
6
8
|
|
|
7
9
|
const getCode = (result) => result.output.map(chunk => chunk.code)
|
|
8
10
|
|
|
9
11
|
describe.skip('build_components', () => {
|
|
10
|
-
|
|
11
|
-
spy.mockReturnValue(path.resolve(__dirname, '', 'mock'))
|
|
12
|
-
// metro runServer 容易超时
|
|
13
|
-
jest.setTimeout(300000)
|
|
14
|
-
|
|
15
|
-
it('single component', async () => {
|
|
12
|
+
test('single component', async () => {
|
|
16
13
|
const result = await runner(appPath, {
|
|
17
14
|
...config,
|
|
18
15
|
nativeComponents: {
|
|
@@ -20,17 +17,16 @@ describe.skip('build_components', () => {
|
|
|
20
17
|
output: 'dist/single'
|
|
21
18
|
}
|
|
22
19
|
})
|
|
20
|
+
|
|
23
21
|
expect(getCode(result)).toMatchSnapshot()
|
|
24
22
|
})
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
const result = await runner(appPath, {
|
|
28
|
-
...config
|
|
29
|
-
})
|
|
24
|
+
test('nativeComponents not set', async () => {
|
|
25
|
+
const result = await runner(appPath, { ...config })
|
|
30
26
|
expect(getCode(result)).toMatchSnapshot()
|
|
31
27
|
})
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
test('multiple components', async () => {
|
|
34
30
|
const result = await build(config, {
|
|
35
31
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
36
32
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -41,7 +37,7 @@ describe.skip('build_components', () => {
|
|
|
41
37
|
expect(getCode(result)).toMatchSnapshot()
|
|
42
38
|
})
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
test('modify rollup config', async () => {
|
|
45
41
|
const result = await build(config, {
|
|
46
42
|
input: ['components/cell/index', 'components/navbar/index'],
|
|
47
43
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -50,7 +46,7 @@ describe.skip('build_components', () => {
|
|
|
50
46
|
return {
|
|
51
47
|
...others,
|
|
52
48
|
input: Object.entries(input as Record<string, string>).reduce(
|
|
53
|
-
(pre, cur) => Object.assign(pre, { [cur[0].replace('components
|
|
49
|
+
(pre, cur) => Object.assign(pre, { [cur[0].replace('components' + path.sep, '')]: cur[1] }),
|
|
54
50
|
{}
|
|
55
51
|
),
|
|
56
52
|
output: { dir: path.resolve(__dirname, './mock/dist/modify-config') }
|
|
@@ -60,7 +56,7 @@ describe.skip('build_components', () => {
|
|
|
60
56
|
expect(getCode(result)).toMatchSnapshot()
|
|
61
57
|
})
|
|
62
58
|
|
|
63
|
-
|
|
59
|
+
test('svg transform', async () => {
|
|
64
60
|
const result = await build(config, {
|
|
65
61
|
input: ['components/svg/index'],
|
|
66
62
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -68,10 +64,10 @@ describe.skip('build_components', () => {
|
|
|
68
64
|
external: ['react', 'react-native', /@tarojs\/components-rn/, /@tarojs\/taro-rn/, /@babel\/runtime/],
|
|
69
65
|
externalResolve: () => {}
|
|
70
66
|
})
|
|
71
|
-
expect(getCode(result))
|
|
67
|
+
expect(getCode(result))
|
|
72
68
|
})
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
test('named export', async () => {
|
|
75
71
|
const result = await build(config, {
|
|
76
72
|
input: ['utils/namedExport/index'],
|
|
77
73
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -81,7 +77,7 @@ describe.skip('build_components', () => {
|
|
|
81
77
|
expect(getCode(result)).toMatchSnapshot()
|
|
82
78
|
})
|
|
83
79
|
|
|
84
|
-
|
|
80
|
+
test('dynamic require', async () => {
|
|
85
81
|
const result = await build(config, {
|
|
86
82
|
input: ['utils/dynamicImport/index'],
|
|
87
83
|
sourceRootPath: path.resolve(__dirname, './mock/src'),
|
|
@@ -91,7 +87,7 @@ describe.skip('build_components', () => {
|
|
|
91
87
|
expect(getCode(result)).toMatchSnapshot()
|
|
92
88
|
})
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
test('require react-native component', async () => {
|
|
95
91
|
const result = await build(config, {
|
|
96
92
|
input: ['utils/requireReactNative/index'],
|
|
97
93
|
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
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.build = void 0;
|
|
24
|
+
const path = require("node:path");
|
|
24
25
|
const plugin_babel_1 = require("@rollup/plugin-babel");
|
|
25
26
|
const commonjs = require("@rollup/plugin-commonjs");
|
|
26
27
|
const json = require("@rollup/plugin-json");
|
|
@@ -31,7 +32,6 @@ const rn_style_transformer_1 = require("@tarojs/rn-style-transformer");
|
|
|
31
32
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
32
33
|
const rn_transformer_1 = require("@tarojs/rn-transformer");
|
|
33
34
|
const jsx = require("acorn-jsx");
|
|
34
|
-
const path = require("path");
|
|
35
35
|
const rollup_1 = require("rollup");
|
|
36
36
|
const rollup_plugin_image_file_1 = require("rollup-plugin-image-file");
|
|
37
37
|
const DEFAULT_CONFIG = {
|
|
@@ -104,7 +104,10 @@ const build = (projectConfig, componentConfig) => __awaiter(void 0, void 0, void
|
|
|
104
104
|
}),
|
|
105
105
|
// @ts-ignore
|
|
106
106
|
pluginReplace({
|
|
107
|
-
|
|
107
|
+
preventAssignment: true,
|
|
108
|
+
values: {
|
|
109
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
110
|
+
}
|
|
108
111
|
}),
|
|
109
112
|
// @ts-ignore
|
|
110
113
|
commonjs(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-component.js","sourceRoot":"","sources":["../../src/config/build-component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,oDAAmD;AACnD,4CAA2C;AAC3C,qEAAqD;AACrD,wDAAuD;AACvD,2CAA+C;AAC/C,uEAAkF;AAClF,uDAAqG;AACrG,2DAAqD;AACrD,iCAAgC;AAChC,
|
|
1
|
+
{"version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ter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const node_fs_1 = require("node:fs");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
12
14
|
const rn_supporter_1 = require("@tarojs/rn-supporter");
|
|
13
15
|
const child_process_1 = require("child_process");
|
|
14
|
-
const fs_1 = require("fs");
|
|
15
16
|
const fse = require("fs-extra");
|
|
16
|
-
const path_1 = require("path");
|
|
17
17
|
const build_component_1 = require("./config/build-component");
|
|
18
18
|
// 确认根目录下 metro.config.js index.js 是否存在
|
|
19
19
|
const files = ['metro.config.js', 'index.js'];
|
|
20
20
|
function confirmFiles() {
|
|
21
21
|
files.forEach(file => {
|
|
22
|
-
const filePath = (0,
|
|
23
|
-
(0,
|
|
22
|
+
const filePath = (0, node_path_1.join)(process.cwd(), file);
|
|
23
|
+
(0, node_fs_1.copyFile)((0, node_path_1.join)(__dirname, '..', 'templates', file), filePath, node_fs_1.constants.COPYFILE_EXCL, err => {
|
|
24
24
|
if (err) {
|
|
25
25
|
if (err.code !== 'EEXIST') {
|
|
26
26
|
// 不重复生成配置文件
|
|
@@ -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,14 +83,15 @@ 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
|
}
|
|
84
90
|
else {
|
|
85
|
-
const defaultOutputDir = (0,
|
|
86
|
-
const defaultBundleOutput = (0,
|
|
91
|
+
const defaultOutputDir = (0, node_path_1.join)(process.cwd(), config.outputRoot || 'dist');
|
|
92
|
+
const defaultBundleOutput = (0, node_path_1.join)(defaultOutputDir, 'index.bundle');
|
|
87
93
|
const bundleOutput = (config.bundleOutput ? config.bundleOutput : (isIos ? config.output.ios : config.output.android)) || defaultBundleOutput;
|
|
88
|
-
fse.ensureDirSync((0,
|
|
94
|
+
fse.ensureDirSync((0, node_path_1.dirname)(bundleOutput));
|
|
89
95
|
cliParams.push('--bundle-output', bundleOutput);
|
|
90
96
|
const sourcemapOutput = config.sourcemapOutput ? config.sourcemapOutput : (isIos ? config.output.iosSourcemapOutput : config.output.androidSourcemapOutput);
|
|
91
97
|
if (sourcemapOutput) {
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAA6C;AAC7C,yCAAyC;AAEzC,uDAA8D;AAC9D,iDAAqC;AACrC,gCAA+B;AAE/B,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,G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AC,CAAC,CAAC,CAAA;gBAChB,QAAQ,CAAC,CAAC,CAAC,CAAA;YACb,CAAC;QACH,CAAC;IACH,CAAC;CAAA;AAxGD,wBAwGC"}
|
package/package.json
CHANGED
|
@@ -1,68 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/rn-runner",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
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": "^
|
|
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/helper": "4.0.
|
|
34
|
-
"@tarojs/rn-style-transformer": "4.0.
|
|
35
|
-
"@tarojs/rn-
|
|
36
|
-
"@tarojs/rn-
|
|
32
|
+
"@tarojs/helper": "4.0.2",
|
|
33
|
+
"@tarojs/rn-style-transformer": "4.0.2",
|
|
34
|
+
"@tarojs/rn-supporter": "4.0.2",
|
|
35
|
+
"@tarojs/rn-transformer": "4.0.2",
|
|
36
|
+
"stylelint-config-taro-rn": "4.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"react-
|
|
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/components": "4.0.2",
|
|
49
|
+
"@tarojs/taro": "4.0.2",
|
|
50
|
+
"babel-preset-taro": "4.0.2",
|
|
51
|
+
"babel-plugin-transform-react-jsx-to-rn-stylesheet": "4.0.2"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"expo": ">= 51",
|
|
55
|
+
"react": ">= 18",
|
|
56
|
+
"react-native": ">= 0.63.0",
|
|
57
|
+
"babel-preset-taro": "4.0.2"
|
|
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:
|
|
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"
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as path from 'node:path'
|
|
2
|
+
|
|
1
3
|
import babel from '@rollup/plugin-babel'
|
|
2
4
|
import * as commonjs from '@rollup/plugin-commonjs'
|
|
3
5
|
import * as json from '@rollup/plugin-json'
|
|
@@ -8,7 +10,6 @@ import { rollupTransform as styleTransformer } from '@tarojs/rn-style-transforme
|
|
|
8
10
|
import { getBabelConfig, resolveExtFile, rollupResolver as taroResolver } from '@tarojs/rn-supporter'
|
|
9
11
|
import { getAppConfig } from '@tarojs/rn-transformer'
|
|
10
12
|
import * as jsx from 'acorn-jsx'
|
|
11
|
-
import * as path from 'path'
|
|
12
13
|
import { rollup, RollupOptions } from 'rollup'
|
|
13
14
|
import image from 'rollup-plugin-image-file'
|
|
14
15
|
|
|
@@ -108,7 +109,10 @@ export const build = async (projectConfig, componentConfig: IComponentConfig) =>
|
|
|
108
109
|
}),
|
|
109
110
|
// @ts-ignore
|
|
110
111
|
pluginReplace({
|
|
111
|
-
|
|
112
|
+
preventAssignment: true,
|
|
113
|
+
values: {
|
|
114
|
+
'process.env.NODE_ENV': JSON.stringify('production')
|
|
115
|
+
}
|
|
112
116
|
}),
|
|
113
117
|
// @ts-ignore
|
|
114
118
|
commonjs(),
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { constants, copyFile } from 'node:fs'
|
|
2
|
+
import { dirname, join } from 'node:path'
|
|
3
|
+
|
|
1
4
|
import { previewDev, previewProd } from '@tarojs/rn-supporter'
|
|
2
5
|
import { spawn } from 'child_process'
|
|
3
|
-
import { constants, copyFile } from 'fs'
|
|
4
6
|
import * as fse from 'fs-extra'
|
|
5
|
-
import { dirname, join } from 'path'
|
|
6
7
|
|
|
7
8
|
import buildComponent from './config/build-component'
|
|
8
9
|
|
|
@@ -60,7 +61,12 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
60
61
|
cliParams.push('--port', config.port)
|
|
61
62
|
}
|
|
62
63
|
try {
|
|
63
|
-
spawn(npxCmd, [
|
|
64
|
+
spawn(npxCmd, [
|
|
65
|
+
'react-native',
|
|
66
|
+
'start',
|
|
67
|
+
'--custom-log-reporter-path',
|
|
68
|
+
'@tarojs/rn-supporter/TerminalReporter'
|
|
69
|
+
].concat(cliParams), {
|
|
64
70
|
stdio: 'inherit'
|
|
65
71
|
})
|
|
66
72
|
if (config.qr) {
|
|
@@ -70,6 +76,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
70
76
|
}
|
|
71
77
|
onFinish(null)
|
|
72
78
|
} catch (e) {
|
|
79
|
+
console.error(e)
|
|
73
80
|
onFinish(e)
|
|
74
81
|
}
|
|
75
82
|
} else {
|
|
@@ -121,6 +128,7 @@ export default async function build (_appPath: string, config: any): Promise<any
|
|
|
121
128
|
}
|
|
122
129
|
onFinish(null)
|
|
123
130
|
} catch (e) {
|
|
131
|
+
console.error(e)
|
|
124
132
|
onFinish(e)
|
|
125
133
|
}
|
|
126
134
|
}
|
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
|
+
* Metro configuration
|
|
6
|
+
* https://facebook.github.io/metro/docs/configuration
|
|
7
|
+
*
|
|
8
|
+
* @type {import('metro-config').MetroConfig}
|
|
9
|
+
*/
|
|
10
|
+
const config = {}
|
|
11
|
+
|
|
4
12
|
module.exports = (async function () {
|
|
5
|
-
return mergeConfig(
|
|
6
|
-
|
|
7
|
-
// https://facebook.github.io/metro/docs/configuration
|
|
8
|
-
resolver: {}
|
|
9
|
-
}, await getMetroConfig())
|
|
10
|
-
})()
|
|
13
|
+
return mergeConfig(getDefaultConfig(__dirname), await getMetroConfig(), config)
|
|
14
|
+
})()
|
package/tsconfig.json
CHANGED