diff --git a/npm/linux-x64-musl/package.json b/npm/linux-x64-musl/package.json index 7462a4e21556..6ec40a802bcd 100644 --- a/npm/linux-x64-musl/package.json +++ b/npm/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/binding-linux-x64-musl", - "version": "3.6.28", + "version": "4.0.0-beta.61", "os": [ "linux" ], @@ -13,7 +13,7 @@ ], "license": "MIT", "engines": { - "node": ">= 16" + "node": ">= 18" }, "libc": [ "musl" diff --git a/packages/taro-cli-convertor/__tests__/__snapshots__/config.test.ts.snap b/packages/taro-cli-convertor/__tests__/__snapshots__/config.test.ts.snap index feea5b4d1181..5a0b450afb99 100644 --- a/packages/taro-cli-convertor/__tests__/__snapshots__/config.test.ts.snap +++ b/packages/taro-cli-convertor/__tests__/__snapshots__/config.test.ts.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`日志 生成日志 1`] = ` -INFO [taro-cli-convertor] parseAst - 入参 +"INFO [taro-cli-convertor] parseAst - 入参 {"sourceFilePath":"/wxProject/app.js","outputFilePath":"/wxProject/taroConvert/src/app.js","importStylePath":null,"imports":[]} INFO [taro-cli-convertor] parseAst - 解析ImportDeclaration import { Block } from "@tarojs/components"; @@ -243,13 +243,13 @@ INFO [taro-cli-convertor] parseAst - 解析VariableDeclaration const { motto } = this.data; - +" `; exports[`转换报告 生成转换报告文件 1`] = ` Map { - /wxProject/taroConvert/.convert => , - /wxProject/taroConvert/.convert/convert.log => INFO [taro-cli-convertor] parseAst - 入参 + "/wxProject/taroConvert/.convert" => "", + "/wxProject/taroConvert/.convert/convert.log" => "INFO [taro-cli-convertor] parseAst - 入参 {"sourceFilePath":"/wxProject/app.js","outputFilePath":"/wxProject/taroConvert/src/app.js","importStylePath":null,"imports":[]} INFO [taro-cli-convertor] parseAst - 解析ImportDeclaration import { Block } from "@tarojs/components"; @@ -491,8 +491,8 @@ INFO [taro-cli-convertor] parseAst - 解析VariableDeclaration const { motto } = this.data; -, - /wxProject/taroConvert/src/app.js => import withWeapp, { cacheOptions } from "@tarojs/with-weapp"; +", + "/wxProject/taroConvert/src/app.js" => "import withWeapp, { cacheOptions } from "@tarojs/with-weapp"; import { Block } from "@tarojs/components"; import React from "react"; import Taro from "@tarojs/taro"; @@ -503,10 +503,10 @@ class App extends React.Component { return this.props.children; } } -export default App;, - /wxProject/taroConvert/src/app.config.js => export default { pages: ['pages/index/index'] } -, - /wxProject/taroConvert/src/pages/index/index.js => import withWeapp, { cacheOptions } from '@tarojs/with-weapp' +export default App;", + "/wxProject/taroConvert/src/app.config.js" => "export default { pages: ['pages/index/index'] } +", + "/wxProject/taroConvert/src/pages/index/index.js" => "import withWeapp, { cacheOptions } from '@tarojs/with-weapp' import { Block, View, Text } from '@tarojs/components' import React from 'react' import Taro from '@tarojs/taro' @@ -529,13 +529,13 @@ class _C extends React.Component { } } export default _C -, - /wxProject/taroConvert/src/pages/index/index.config.js => export default {} -, - /wxProject/taroConvert/report => , - /wxProject/taroConvert/report/index.html => convert report
, - /wxProject/taroConvert/report/static/js => , - /wxProject/taroConvert/report/static/js/bundle.js => /******/ (function() { / webpackBootstrap +", + "/wxProject/taroConvert/src/pages/index/index.config.js" => "export default {} +", + "/wxProject/taroConvert/report" => "", + "/wxProject/taroConvert/report/index.html" => "convert report
", + "/wxProject/taroConvert/report/static/js" => "", + "/wxProject/taroConvert/report/static/js/bundle.js" => "/******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 270: @@ -544,7 +544,7 @@ export default _C var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see - http:/jedwatson.github.io/classnames + http://jedwatson.github.io/classnames */ /* global define */ @@ -586,7 +586,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! classNames.default = classNames; module.exports = classNames; } else if (true) { - / register as 'classnames', consistent with npm package name + // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), @@ -752,7 +752,7 @@ if (true) { var aa = __webpack_require__(519), ca = __webpack_require__(514); function p(a) { - for (var b = "https:/reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) b += "&args[]=" + encodeURIComponent(arguments[c]); + for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) b += "&args[]=" + encodeURIComponent(arguments[c]); return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; } var da = new Set(), @@ -767,7 +767,7 @@ function ha(a, b) { } var ia = !("undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement), ja = Object.prototype.hasOwnProperty, - ka = /^[:A-Z_a-z/u00C0-/u00D6/u00D8-/u00F6/u00F8-/u02FF/u0370-/u037D/u037F-/u1FFF/u200C-/u200D/u2070-/u218F/u2C00-/u2FEF/u3001-/uD7FF/uF900-/uFDCF/uFDF0-/uFFFD][:A-Z_a-z/u00C0-/u00D6/u00D8-/u00F6/u00F8-/u02FF/u0370-/u037D/u037F-/u1FFF/u200C-/u200D/u2070-/u218F/u2C00-/u2FEF/u3001-/uD7FF/uF900-/uFDCF/uFDF0-/uFFFD/-.0-9/u00B7/u0300-/u036F/u203F-/u2040]*$/, + ka = /^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$/, la = {}, ma = {}; function oa(a) { @@ -846,7 +846,7 @@ var z = {}; ["rowSpan", "start"].forEach(function (a) { z[a] = new v(a, 5, !1, a.toLowerCase(), null, !1, !1); }); -var ra = /[/-:]([a-z])/g; +var ra = /[\\-:]([a-z])/g; function sa(a) { return a[1].toUpperCase(); } @@ -856,16 +856,16 @@ function sa(a) { }); "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function (a) { var b = a.replace(ra, sa); - z[b] = new v(b, 1, !1, a, "http:/www.w3.org/1999/xlink", !1, !1); + z[b] = new v(b, 1, !1, a, "http://www.w3.org/1999/xlink", !1, !1); }); ["xml:base", "xml:lang", "xml:space"].forEach(function (a) { var b = a.replace(ra, sa); - z[b] = new v(b, 1, !1, a, "http:/www.w3.org/XML/1998/namespace", !1, !1); + z[b] = new v(b, 1, !1, a, "http://www.w3.org/XML/1998/namespace", !1, !1); }); ["tabIndex", "crossOrigin"].forEach(function (a) { z[a] = new v(a, 1, !1, a.toLowerCase(), null, !1, !1); }); -z.xlinkHref = new v("xlinkHref", 1, !1, "xlink:href", "http:/www.w3.org/1999/xlink", !0, !1); +z.xlinkHref = new v("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1); ["src", "href", "action", "formAction"].forEach(function (a) { z[a] = new v(a, 1, !1, a.toLowerCase(), null, !0, !0); }); @@ -904,10 +904,10 @@ function Ma(a) { if (void 0 === La) try { throw Error(); } catch (c) { - var b = c.stack.trim().match(/n( *(at )?)/); + var b = c.stack.trim().match(/\\n( *(at )?)/); La = b && b[1] || ""; } - return "/n" + La + a; + return "\\n" + La + a; } var Na = !1; function Oa(a, b) { @@ -948,11 +948,11 @@ function Oa(a, b) { } } catch (l) { if (l && d && "string" === typeof l.stack) { - for (var e = l.stack.split("/n"), f = d.stack.split("/n"), g = e.length - 1, h = f.length - 1; 1 <= g && 0 <= h && e[g] !== f[h];) h--; + for (var e = l.stack.split("\\n"), f = d.stack.split("\\n"), g = e.length - 1, h = f.length - 1; 1 <= g && 0 <= h && e[g] !== f[h];) h--; for (; 1 <= g && 0 <= h; g--, h--) if (e[g] !== f[h]) { if (1 !== g || 1 !== h) { do if (g--, h--, 0 > h || e[g] !== f[h]) { - var k = "/n" + e[g].replace(" at new ", " at "); + var k = "\\n" + e[g].replace(" at new ", " at "); a.displayName && k.includes("") && (k = k.replace("", a.displayName)); return k; } while (1 <= g && 0 <= h); @@ -1265,15 +1265,15 @@ function jb(a) { function kb(a) { switch (a) { case "svg": - return "http:/www.w3.org/2000/svg"; + return "http://www.w3.org/2000/svg"; case "math": - return "http:/www.w3.org/1998/Math/MathML"; + return "http://www.w3.org/1998/Math/MathML"; default: - return "http:/www.w3.org/1999/xhtml"; + return "http://www.w3.org/1999/xhtml"; } } function lb(a, b) { - return null == a || "http:/www.w3.org/1999/xhtml" === a ? kb(b) : "http:/www.w3.org/2000/svg" === a && "foreignObject" === b ? "http:/www.w3.org/1999/xhtml" : a; + return null == a || "http://www.w3.org/1999/xhtml" === a ? kb(b) : "http://www.w3.org/2000/svg" === a && "foreignObject" === b ? "http://www.w3.org/1999/xhtml" : a; } var mb, nb = function (a) { @@ -1283,7 +1283,7 @@ var mb, }); } : a; }(function (a, b) { - if ("http:/www.w3.org/2000/svg" !== a.namespaceURI || "innerHTML" in a) a.innerHTML = b;else { + if ("http://www.w3.org/2000/svg" !== a.namespaceURI || "innerHTML" in a) a.innerHTML = b;else { mb = mb || document.createElement("div"); mb.innerHTML = "" + b.valueOf().toString() + ""; for (b = mb.firstChild; a.firstChild;) a.removeChild(a.firstChild); @@ -3021,10 +3021,10 @@ function wf(a, b, c, d, e) { listeners: g }); } -var xf = /r/n?/g, - yf = /u0000|/uFFFD/g; +var xf = /\\r\\n?/g, + yf = /\\u0000|\\uFFFD/g; function zf(a) { - return ("string" === typeof a ? a : "" + a).replace(xf, "/n").replace(yf, ""); + return ("string" === typeof a ? a : "" + a).replace(xf, "\\n").replace(yf, ""); } function Af(a, b, c) { b = zf(b); @@ -4627,7 +4627,7 @@ function Ki(a, b) { do c += Pa(d), d = d.return; while (d); var e = c; } catch (f) { - e = "/nError generating stack: " + f.message + "/n" + f.stack; + e = "\\nError generating stack: " + f.message + "\\n" + f.stack; } return { value: a, @@ -5396,8 +5396,8 @@ function Fj(a, b, c) { null !== d && (b.flags |= 4); } else { g = 9 === e.nodeType ? e : e.ownerDocument; - "http:/www.w3.org/1999/xhtml" === a && (a = kb(c)); - "http:/www.w3.org/1999/xhtml" === a ? "script" === c ? (a = g.createElement("div"), a.innerHTML = "
/** filePath: dist/js/app.js **/ +/*! For license information please see app.js.LICENSE.txt */ (function(modules) { function webpackJsonpCallback(data) { var chunkIds = data[0]; @@ -244,12 +260,8 @@ exports[`babel should convert do expressions 2`] = ` jsonpArray = jsonpArray.slice(); for (var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); var parentJsonpFunction = oldJsonpFunction; - return __webpack_require__(__webpack_require__.s = 9); + return __webpack_require__(__webpack_require__.s = 10); })([ function(module, __webpack_exports__, __webpack_require__) { - "use strict"; - __webpack_require__.r(__webpack_exports__); - __webpack_exports__["default"] = "react-mock"; -}, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "window", (function() { @@ -323,12 +335,17 @@ exports[`babel should convert do expressions 2`] = ` }); return Constructor; } +}, function(module, exports, __webpack_require__) { + "use strict"; + if (true) { + module.exports = __webpack_require__(11); + } else {} }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { return _toPropertyKey; })); - var esm_typeof = __webpack_require__(2); + var esm_typeof = __webpack_require__(1); function _toPrimitive(input, hint) { if (Object(esm_typeof["a"])(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; @@ -346,7 +363,7 @@ exports[`babel should convert do expressions 2`] = ` }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { - return _createSuper; + return _getPrototypeOf; })); function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { @@ -354,18 +371,12 @@ exports[`babel should convert do expressions 2`] = ` }; return _getPrototypeOf(o); } - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))); - return true; - } catch (e) { - return false; - } - } - var esm_typeof = __webpack_require__(2); +}, function(module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.d(__webpack_exports__, "a", (function() { + return _possibleConstructorReturn; + })); + var esm_typeof = __webpack_require__(1); function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); @@ -380,19 +391,6 @@ exports[`babel should convert do expressions 2`] = ` } return _assertThisInitialized(self); } - function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - return function _createSuperInternal() { - 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(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { @@ -422,15 +420,349 @@ exports[`babel should convert do expressions 2`] = ` if (superClass) _setPrototypeOf(subClass, superClass); } }, function(module, exports, __webpack_require__) { - var _require = __webpack_require__(1), hooks = _require.hooks; - var taro = __webpack_require__(11).default; + var _require = __webpack_require__(0), hooks = _require.hooks; + var taro = __webpack_require__(14).default; if (hooks.isExist("initNativeApi")) { hooks.call("initNativeApi", taro); } module.exports = taro; module.exports.default = module.exports; }, function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(12); + module.exports = __webpack_require__(15); +}, function(module, exports, __webpack_require__) { + "use strict"; + var _typeof = __webpack_require__(12).default; + var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator; + function A(a) { + if (null === a || "object" !== _typeof(a)) return null; + a = z && a[z] || a["@@iterator"]; + return "function" === typeof a ? a : null; + } + var B = { + "isMounted": function isMounted() { + return !1; + }, + "enqueueForceUpdate": function enqueueForceUpdate() {}, + "enqueueReplaceState": function enqueueReplaceState() {}, + "enqueueSetState": function enqueueSetState() {} + }, C = Object.assign, D = {}; + function E(a, b, e) { + this.props = a; + this.context = b; + this.refs = D; + this.updater = e || B; + } + E.prototype.isReactComponent = {}; + E.prototype.setState = function(a, b) { + if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); + this.updater.enqueueSetState(this, a, b, "setState"); + }; + E.prototype.forceUpdate = function(a) { + this.updater.enqueueForceUpdate(this, a, "forceUpdate"); + }; + function F() {} + F.prototype = E.prototype; + function G(a, b, e) { + this.props = a; + this.context = b; + this.refs = D; + this.updater = e || B; + } + var H = G.prototype = new F; + H.constructor = G; + C(H, E.prototype); + H.isPureReactComponent = !0; + var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { + "current": null + }, L = { + "key": !0, + "ref": !0, + "__self": !0, + "__source": !0 + }; + function M(a, b, e) { + var d, c = {}, k = null, h = null; + if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), + b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]); + var g = arguments.length - 2; + if (1 === g) c.children = e; else if (1 < g) { + for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2]; + c.children = f; + } + if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]); + return { + "$$typeof": l, + "type": a, + "key": k, + "ref": h, + "props": c, + "_owner": K.current + }; + } + function N(a, b) { + return { + "$$typeof": l, + "type": a.type, + "key": b, + "ref": a.ref, + "props": a.props, + "_owner": a._owner + }; + } + function O(a) { + return "object" === _typeof(a) && null !== a && a.$$typeof === l; + } + function escape(a) { + var b = { + "=": "=0", + ":": "=2" + }; + return "$" + a.replace(/[=:]/g, (function(a) { + return b[a]; + })); + } + var P = /\\/+/g; + function Q(a, b) { + return "object" === _typeof(a) && null !== a && null != a.key ? escape("" + a.key) : b.toString(36); + } + function R(a, b, e, d, c) { + var k = _typeof(a); + if ("undefined" === k || "boolean" === k) a = null; + var h = !1; + if (null === a) h = !0; else switch (k) { + case "string": + case "number": + h = !0; + break; + + case "object": + switch (a.$$typeof) { + case l: + case n: + h = !0; + } + } + if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", + null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", (function(a) { + return a; + }))) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), + b.push(c)), 1; + h = 0; + d = "" === d ? "." : d + ":"; + if (I(a)) for (var g = 0; g < a.length; g++) { + k = a[g]; + var f = d + Q(k, g); + h += R(k, b, e, f, c); + } else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, + f = d + Q(k, g++), h += R(k, b, e, f, c); else if ("object" === k) throw b = String(a), + Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead."); + return h; + } + function S(a, b, e) { + if (null == a) return a; + var d = [], c = 0; + R(a, d, "", "", (function(a) { + return b.call(e, a, c++); + })); + return d; + } + function T(a) { + if (-1 === a._status) { + var b = a._result; + b = b(); + b.then((function(b) { + if (0 === a._status || -1 === a._status) a._status = 1, a._result = b; + }), (function(b) { + if (0 === a._status || -1 === a._status) a._status = 2, a._result = b; + })); + -1 === a._status && (a._status = 0, a._result = b); + } + if (1 === a._status) return a._result.default; + throw a._result; + } + var U = { + "current": null + }, V = { + "transition": null + }, W = { + "ReactCurrentDispatcher": U, + "ReactCurrentBatchConfig": V, + "ReactCurrentOwner": K + }; + exports.Children = { + "map": S, + "forEach": function forEach(a, b, e) { + S(a, (function() { + b.apply(this, arguments); + }), e); + }, + "count": function count(a) { + var b = 0; + S(a, (function() { + b++; + })); + return b; + }, + "toArray": function toArray(a) { + return S(a, (function(a) { + return a; + })) || []; + }, + "only": function only(a) { + if (!O(a)) throw Error("React.Children.only expected to receive a single React element child."); + return a; + } + }; + exports.Component = E; + exports.Fragment = p; + exports.Profiler = r; + exports.PureComponent = G; + exports.StrictMode = q; + exports.Suspense = w; + exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W; + exports.cloneElement = function(a, b, e) { + if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + "."); + var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner; + if (null != b) { + void 0 !== b.ref && (k = b.ref, h = K.current); + void 0 !== b.key && (c = "" + b.key); + if (a.type && a.type.defaultProps) var g = a.type.defaultProps; + for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]); + } + var f = arguments.length - 2; + if (1 === f) d.children = e; else if (1 < f) { + g = Array(f); + for (var m = 0; m < f; m++) g[m] = arguments[m + 2]; + d.children = g; + } + return { + "$$typeof": l, + "type": a.type, + "key": c, + "ref": k, + "props": d, + "_owner": h + }; + }; + exports.createContext = function(a) { + a = { + "$$typeof": u, + "_currentValue": a, + "_currentValue2": a, + "_threadCount": 0, + "Provider": null, + "Consumer": null, + "_defaultValue": null, + "_globalName": null + }; + a.Provider = { + "$$typeof": t, + "_context": a + }; + return a.Consumer = a; + }; + exports.createElement = M; + exports.createFactory = function(a) { + var b = M.bind(null, a); + b.type = a; + return b; + }; + exports.createRef = function() { + return { + "current": null + }; + }; + exports.forwardRef = function(a) { + return { + "$$typeof": v, + "render": a + }; + }; + exports.isValidElement = O; + exports.lazy = function(a) { + return { + "$$typeof": y, + "_payload": { + "_status": -1, + "_result": a + }, + "_init": T + }; + }; + exports.memo = function(a, b) { + return { + "$$typeof": x, + "type": a, + "compare": void 0 === b ? null : b + }; + }; + exports.startTransition = function(a) { + var b = V.transition; + V.transition = {}; + try { + a(); + } finally { + V.transition = b; + } + }; + exports.unstable_act = function() { + throw Error("act(...) is not supported in production builds of React."); + }; + exports.useCallback = function(a, b) { + return U.current.useCallback(a, b); + }; + exports.useContext = function(a) { + return U.current.useContext(a); + }; + exports.useDebugValue = function() {}; + exports.useDeferredValue = function(a) { + return U.current.useDeferredValue(a); + }; + exports.useEffect = function(a, b) { + return U.current.useEffect(a, b); + }; + exports.useId = function() { + return U.current.useId(); + }; + exports.useImperativeHandle = function(a, b, e) { + return U.current.useImperativeHandle(a, b, e); + }; + exports.useInsertionEffect = function(a, b) { + return U.current.useInsertionEffect(a, b); + }; + exports.useLayoutEffect = function(a, b) { + return U.current.useLayoutEffect(a, b); + }; + exports.useMemo = function(a, b) { + return U.current.useMemo(a, b); + }; + exports.useReducer = function(a, b, e) { + return U.current.useReducer(a, b, e); + }; + exports.useRef = function(a) { + return U.current.useRef(a); + }; + exports.useState = function(a) { + return U.current.useState(a); + }; + exports.useSyncExternalStore = function(a, b, e) { + return U.current.useSyncExternalStore(a, b, e); + }; + exports.useTransition = function() { + return U.current.useTransition(); + }; + exports.version = "18.2.0"; +}, function(module, exports) { + function _typeof(obj) { + "@babel/helpers - typeof"; + return module.exports = _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; + }, module.exports.__esModule = true, module.exports["default"] = module.exports, + _typeof(obj); + } + module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; }, function(module, exports, __webpack_require__) {}, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); @@ -445,7 +777,7 @@ exports[`babel should convert do expressions 2`] = ` __webpack_require__.d(interceptors_namespaceObject, "timeoutInterceptor", (function() { return timeoutInterceptor; })); - var taro_runtime = __webpack_require__(1); + var taro_runtime = __webpack_require__(0); var ENV_TYPE = { "WEAPP": "WEAPP", "SWAN": "SWAN", @@ -486,8 +818,8 @@ exports[`babel should convert do expressions 2`] = ` return undefined || "Unknown"; } } - var classCallCheck = __webpack_require__(3); - var createClass = __webpack_require__(4); + var classCallCheck = __webpack_require__(2); + var createClass = __webpack_require__(3); var taro_shared = "taro-shared-mock"; var chain_Chain = function() { function Chain(requestParams, interceptors, index) { @@ -691,21 +1023,35 @@ exports[`babel should convert do expressions 2`] = ` }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - var taro = __webpack_require__(8); + var taro = __webpack_require__(9); function createMultiRouter() {} function createRouter() {} - var classCallCheck = __webpack_require__(3); - var createClass = __webpack_require__(4); - var inherits = __webpack_require__(7); - var createSuper = __webpack_require__(6); - var react = __webpack_require__(0); - var app = __webpack_require__(10); + var classCallCheck = __webpack_require__(2); + var createClass = __webpack_require__(3); + var possibleConstructorReturn = __webpack_require__(7); + var getPrototypeOf = __webpack_require__(6); + var inherits = __webpack_require__(8); + var react = __webpack_require__(4); + var app = __webpack_require__(13); + function _callSuper(_this, derived, args) { + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))); + } catch (e) { + return false; + } + } + derived = Object(getPrototypeOf["a"])(derived); + return Object(possibleConstructorReturn["a"])(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], Object(getPrototypeOf["a"])(_this).constructor) : derived.apply(_this, args)); + } var app_App = function(_Component) { Object(inherits["a"])(App, _Component); - var _super = Object(createSuper["a"])(App); function App() { Object(classCallCheck["a"])(this, App); - return _super.apply(this, arguments); + return _callSuper(this, App, arguments); } Object(createClass["a"])(App, [ { "key": "componentDidMount", @@ -725,10 +1071,11 @@ exports[`babel should convert do expressions 2`] = ` return App; }(react["Component"]); var src_app = app_App; - var taro_runtime = __webpack_require__(1); + var taro_runtime = __webpack_require__(0); function createReactApp() {} function createVueApp() {} function createVue3App() {} + var mocks_react = "react-mock"; var config = { "router": { "mode": "hash", @@ -759,18 +1106,18 @@ exports[`babel should convert do expressions 2`] = ` config.routes = [ Object.assign({ "path": "pages/index/index", "load": function load(context, params) { - var page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 14)); + var page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 17)); return [ page, context, params ]; } }, { "navigationBarTitleText": "首页" }) ]; - Object.assign(react["default"], { - "findDOMNode": react["findDOMNode"], - "render": react["render"], - "unstable_batchedUpdates": react["unstable_batchedUpdates"] + Object.assign(mocks_react, { + "findDOMNode": undefined, + "render": undefined, + "unstable_batchedUpdates": undefined }); - var inst = createReactApp(src_app, react, react["default"], config); + var inst = createReactApp(src_app, react, mocks_react, config); var app_config_history = undefined({ "window": taro_runtime["window"] }); @@ -788,5 +1135,17 @@ exports[`babel should convert do expressions 2`] = ` "targetUnit": undefined }); } ]); + +/** filePath: dist/js/app.js.LICENSE.txt **/ +/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + " `; diff --git a/packages/taro-webpack-runner/src/__tests__/__snapshots__/react.spec.ts.snap b/packages/taro-webpack-runner/src/__tests__/__snapshots__/react.spec.ts.snap index 77c860cafcd4..8c022795e4be 100644 --- a/packages/taro-webpack-runner/src/__tests__/__snapshots__/react.spec.ts.snap +++ b/packages/taro-webpack-runner/src/__tests__/__snapshots__/react.spec.ts.snap @@ -1,31 +1,46 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`react should build react app 1`] = `5`; +exports[`react should build react app 1`] = `6`; exports[`react should build react app 2`] = ` " /** filePath: dist/chunk/1.js **/ (window["webpackJsonp"] = window["webpackJsonp"] || []).push([ [ 1 ], { - "13": function(module, exports, __webpack_require__) {}, - "14": function(module, __webpack_exports__, __webpack_require__) { + "16": function(module, exports, __webpack_require__) {}, + "17": function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "default", (function() { return index_Index; })); - var classCallCheck = __webpack_require__(3); - var createClass = __webpack_require__(4); - var inherits = __webpack_require__(7); - var createSuper = __webpack_require__(6); - var react = __webpack_require__(0); + var classCallCheck = __webpack_require__(2); + var createClass = __webpack_require__(3); + var possibleConstructorReturn = __webpack_require__(7); + var getPrototypeOf = __webpack_require__(6); + var inherits = __webpack_require__(8); + var react = __webpack_require__(4); + var react_default = __webpack_require__.n(react); var taro_components = "taro-components-mock"; - var index = __webpack_require__(13); + var index = __webpack_require__(16); + function _callSuper(_this, derived, args) { + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))); + } catch (e) { + return false; + } + } + derived = Object(getPrototypeOf["a"])(derived); + return Object(possibleConstructorReturn["a"])(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], Object(getPrototypeOf["a"])(_this).constructor) : derived.apply(_this, args)); + } var index_Index = function(_Component) { Object(inherits["a"])(Index, _Component); - var _super = Object(createSuper["a"])(Index); function Index() { Object(classCallCheck["a"])(this, Index); - return _super.apply(this, arguments); + return _callSuper(this, Index, arguments); } Object(createClass["a"])(Index, [ { "key": "componentDidMount", @@ -42,9 +57,9 @@ exports[`react should build react app 2`] = ` }, { "key": "render", "value": function render() { - return react["default"].createElement(undefined, { + return react_default.a.createElement(undefined, { "className": "index" - }, react["default"].createElement(undefined, null, "Hello world!")); + }, react_default.a.createElement(undefined, null, "Hello world!")); } } ]); return Index; @@ -60,6 +75,7 @@ exports[`react should build react app 2`] = `
/** filePath: dist/js/app.js **/ +/*! For license information please see app.js.LICENSE.txt */ (function(modules) { function webpackJsonpCallback(data) { var chunkIds = data[0]; @@ -251,12 +267,8 @@ exports[`react should build react app 2`] = ` jsonpArray = jsonpArray.slice(); for (var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); var parentJsonpFunction = oldJsonpFunction; - return __webpack_require__(__webpack_require__.s = 9); + return __webpack_require__(__webpack_require__.s = 10); })([ function(module, __webpack_exports__, __webpack_require__) { - "use strict"; - __webpack_require__.r(__webpack_exports__); - __webpack_exports__["default"] = "react-mock"; -}, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "window", (function() { @@ -330,12 +342,17 @@ exports[`react should build react app 2`] = ` }); return Constructor; } +}, function(module, exports, __webpack_require__) { + "use strict"; + if (true) { + module.exports = __webpack_require__(11); + } else {} }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { return _toPropertyKey; })); - var esm_typeof = __webpack_require__(2); + var esm_typeof = __webpack_require__(1); function _toPrimitive(input, hint) { if (Object(esm_typeof["a"])(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; @@ -353,7 +370,7 @@ exports[`react should build react app 2`] = ` }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { - return _createSuper; + return _getPrototypeOf; })); function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { @@ -361,18 +378,12 @@ exports[`react should build react app 2`] = ` }; return _getPrototypeOf(o); } - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))); - return true; - } catch (e) { - return false; - } - } - var esm_typeof = __webpack_require__(2); +}, function(module, __webpack_exports__, __webpack_require__) { + "use strict"; + __webpack_require__.d(__webpack_exports__, "a", (function() { + return _possibleConstructorReturn; + })); + var esm_typeof = __webpack_require__(1); function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); @@ -387,19 +398,6 @@ exports[`react should build react app 2`] = ` } return _assertThisInitialized(self); } - function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - return function _createSuperInternal() { - 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(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.d(__webpack_exports__, "a", (function() { @@ -429,15 +427,349 @@ exports[`react should build react app 2`] = ` if (superClass) _setPrototypeOf(subClass, superClass); } }, function(module, exports, __webpack_require__) { - var _require = __webpack_require__(1), hooks = _require.hooks; - var taro = __webpack_require__(11).default; + var _require = __webpack_require__(0), hooks = _require.hooks; + var taro = __webpack_require__(14).default; if (hooks.isExist("initNativeApi")) { hooks.call("initNativeApi", taro); } module.exports = taro; module.exports.default = module.exports; }, function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(12); + module.exports = __webpack_require__(15); +}, function(module, exports, __webpack_require__) { + "use strict"; + var _typeof = __webpack_require__(12).default; + var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator; + function A(a) { + if (null === a || "object" !== _typeof(a)) return null; + a = z && a[z] || a["@@iterator"]; + return "function" === typeof a ? a : null; + } + var B = { + "isMounted": function isMounted() { + return !1; + }, + "enqueueForceUpdate": function enqueueForceUpdate() {}, + "enqueueReplaceState": function enqueueReplaceState() {}, + "enqueueSetState": function enqueueSetState() {} + }, C = Object.assign, D = {}; + function E(a, b, e) { + this.props = a; + this.context = b; + this.refs = D; + this.updater = e || B; + } + E.prototype.isReactComponent = {}; + E.prototype.setState = function(a, b) { + if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); + this.updater.enqueueSetState(this, a, b, "setState"); + }; + E.prototype.forceUpdate = function(a) { + this.updater.enqueueForceUpdate(this, a, "forceUpdate"); + }; + function F() {} + F.prototype = E.prototype; + function G(a, b, e) { + this.props = a; + this.context = b; + this.refs = D; + this.updater = e || B; + } + var H = G.prototype = new F; + H.constructor = G; + C(H, E.prototype); + H.isPureReactComponent = !0; + var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { + "current": null + }, L = { + "key": !0, + "ref": !0, + "__self": !0, + "__source": !0 + }; + function M(a, b, e) { + var d, c = {}, k = null, h = null; + if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), + b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]); + var g = arguments.length - 2; + if (1 === g) c.children = e; else if (1 < g) { + for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2]; + c.children = f; + } + if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]); + return { + "$$typeof": l, + "type": a, + "key": k, + "ref": h, + "props": c, + "_owner": K.current + }; + } + function N(a, b) { + return { + "$$typeof": l, + "type": a.type, + "key": b, + "ref": a.ref, + "props": a.props, + "_owner": a._owner + }; + } + function O(a) { + return "object" === _typeof(a) && null !== a && a.$$typeof === l; + } + function escape(a) { + var b = { + "=": "=0", + ":": "=2" + }; + return "$" + a.replace(/[=:]/g, (function(a) { + return b[a]; + })); + } + var P = /\\/+/g; + function Q(a, b) { + return "object" === _typeof(a) && null !== a && null != a.key ? escape("" + a.key) : b.toString(36); + } + function R(a, b, e, d, c) { + var k = _typeof(a); + if ("undefined" === k || "boolean" === k) a = null; + var h = !1; + if (null === a) h = !0; else switch (k) { + case "string": + case "number": + h = !0; + break; + + case "object": + switch (a.$$typeof) { + case l: + case n: + h = !0; + } + } + if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", + null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", (function(a) { + return a; + }))) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), + b.push(c)), 1; + h = 0; + d = "" === d ? "." : d + ":"; + if (I(a)) for (var g = 0; g < a.length; g++) { + k = a[g]; + var f = d + Q(k, g); + h += R(k, b, e, f, c); + } else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done; ) k = k.value, + f = d + Q(k, g++), h += R(k, b, e, f, c); else if ("object" === k) throw b = String(a), + Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead."); + return h; + } + function S(a, b, e) { + if (null == a) return a; + var d = [], c = 0; + R(a, d, "", "", (function(a) { + return b.call(e, a, c++); + })); + return d; + } + function T(a) { + if (-1 === a._status) { + var b = a._result; + b = b(); + b.then((function(b) { + if (0 === a._status || -1 === a._status) a._status = 1, a._result = b; + }), (function(b) { + if (0 === a._status || -1 === a._status) a._status = 2, a._result = b; + })); + -1 === a._status && (a._status = 0, a._result = b); + } + if (1 === a._status) return a._result.default; + throw a._result; + } + var U = { + "current": null + }, V = { + "transition": null + }, W = { + "ReactCurrentDispatcher": U, + "ReactCurrentBatchConfig": V, + "ReactCurrentOwner": K + }; + exports.Children = { + "map": S, + "forEach": function forEach(a, b, e) { + S(a, (function() { + b.apply(this, arguments); + }), e); + }, + "count": function count(a) { + var b = 0; + S(a, (function() { + b++; + })); + return b; + }, + "toArray": function toArray(a) { + return S(a, (function(a) { + return a; + })) || []; + }, + "only": function only(a) { + if (!O(a)) throw Error("React.Children.only expected to receive a single React element child."); + return a; + } + }; + exports.Component = E; + exports.Fragment = p; + exports.Profiler = r; + exports.PureComponent = G; + exports.StrictMode = q; + exports.Suspense = w; + exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W; + exports.cloneElement = function(a, b, e) { + if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + "."); + var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner; + if (null != b) { + void 0 !== b.ref && (k = b.ref, h = K.current); + void 0 !== b.key && (c = "" + b.key); + if (a.type && a.type.defaultProps) var g = a.type.defaultProps; + for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]); + } + var f = arguments.length - 2; + if (1 === f) d.children = e; else if (1 < f) { + g = Array(f); + for (var m = 0; m < f; m++) g[m] = arguments[m + 2]; + d.children = g; + } + return { + "$$typeof": l, + "type": a.type, + "key": c, + "ref": k, + "props": d, + "_owner": h + }; + }; + exports.createContext = function(a) { + a = { + "$$typeof": u, + "_currentValue": a, + "_currentValue2": a, + "_threadCount": 0, + "Provider": null, + "Consumer": null, + "_defaultValue": null, + "_globalName": null + }; + a.Provider = { + "$$typeof": t, + "_context": a + }; + return a.Consumer = a; + }; + exports.createElement = M; + exports.createFactory = function(a) { + var b = M.bind(null, a); + b.type = a; + return b; + }; + exports.createRef = function() { + return { + "current": null + }; + }; + exports.forwardRef = function(a) { + return { + "$$typeof": v, + "render": a + }; + }; + exports.isValidElement = O; + exports.lazy = function(a) { + return { + "$$typeof": y, + "_payload": { + "_status": -1, + "_result": a + }, + "_init": T + }; + }; + exports.memo = function(a, b) { + return { + "$$typeof": x, + "type": a, + "compare": void 0 === b ? null : b + }; + }; + exports.startTransition = function(a) { + var b = V.transition; + V.transition = {}; + try { + a(); + } finally { + V.transition = b; + } + }; + exports.unstable_act = function() { + throw Error("act(...) is not supported in production builds of React."); + }; + exports.useCallback = function(a, b) { + return U.current.useCallback(a, b); + }; + exports.useContext = function(a) { + return U.current.useContext(a); + }; + exports.useDebugValue = function() {}; + exports.useDeferredValue = function(a) { + return U.current.useDeferredValue(a); + }; + exports.useEffect = function(a, b) { + return U.current.useEffect(a, b); + }; + exports.useId = function() { + return U.current.useId(); + }; + exports.useImperativeHandle = function(a, b, e) { + return U.current.useImperativeHandle(a, b, e); + }; + exports.useInsertionEffect = function(a, b) { + return U.current.useInsertionEffect(a, b); + }; + exports.useLayoutEffect = function(a, b) { + return U.current.useLayoutEffect(a, b); + }; + exports.useMemo = function(a, b) { + return U.current.useMemo(a, b); + }; + exports.useReducer = function(a, b, e) { + return U.current.useReducer(a, b, e); + }; + exports.useRef = function(a) { + return U.current.useRef(a); + }; + exports.useState = function(a) { + return U.current.useState(a); + }; + exports.useSyncExternalStore = function(a, b, e) { + return U.current.useSyncExternalStore(a, b, e); + }; + exports.useTransition = function() { + return U.current.useTransition(); + }; + exports.version = "18.2.0"; +}, function(module, exports) { + function _typeof(obj) { + "@babel/helpers - typeof"; + return module.exports = _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; + }, module.exports.__esModule = true, module.exports["default"] = module.exports, + _typeof(obj); + } + module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; }, function(module, exports, __webpack_require__) {}, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); @@ -452,7 +784,7 @@ exports[`react should build react app 2`] = ` __webpack_require__.d(interceptors_namespaceObject, "timeoutInterceptor", (function() { return timeoutInterceptor; })); - var taro_runtime = __webpack_require__(1); + var taro_runtime = __webpack_require__(0); var ENV_TYPE = { "WEAPP": "WEAPP", "SWAN": "SWAN", @@ -493,8 +825,8 @@ exports[`react should build react app 2`] = ` return undefined || "Unknown"; } } - var classCallCheck = __webpack_require__(3); - var createClass = __webpack_require__(4); + var classCallCheck = __webpack_require__(2); + var createClass = __webpack_require__(3); var taro_shared = "taro-shared-mock"; var chain_Chain = function() { function Chain(requestParams, interceptors, index) { @@ -698,21 +1030,35 @@ exports[`react should build react app 2`] = ` }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - var taro = __webpack_require__(8); + var taro = __webpack_require__(9); function createMultiRouter() {} function createRouter() {} - var classCallCheck = __webpack_require__(3); - var createClass = __webpack_require__(4); - var inherits = __webpack_require__(7); - var createSuper = __webpack_require__(6); - var react = __webpack_require__(0); - var app = __webpack_require__(10); + var classCallCheck = __webpack_require__(2); + var createClass = __webpack_require__(3); + var possibleConstructorReturn = __webpack_require__(7); + var getPrototypeOf = __webpack_require__(6); + var inherits = __webpack_require__(8); + var react = __webpack_require__(4); + var app = __webpack_require__(13); + function _callSuper(_this, derived, args) { + function isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))); + } catch (e) { + return false; + } + } + derived = Object(getPrototypeOf["a"])(derived); + return Object(possibleConstructorReturn["a"])(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], Object(getPrototypeOf["a"])(_this).constructor) : derived.apply(_this, args)); + } var app_App = function(_Component) { Object(inherits["a"])(App, _Component); - var _super = Object(createSuper["a"])(App); function App() { Object(classCallCheck["a"])(this, App); - return _super.apply(this, arguments); + return _callSuper(this, App, arguments); } Object(createClass["a"])(App, [ { "key": "componentDidMount", @@ -732,10 +1078,11 @@ exports[`react should build react app 2`] = ` return App; }(react["Component"]); var src_app = app_App; - var taro_runtime = __webpack_require__(1); + var taro_runtime = __webpack_require__(0); function createReactApp() {} function createVueApp() {} function createVue3App() {} + var mocks_react = "react-mock"; var config = { "router": { "mode": "hash", @@ -766,18 +1113,18 @@ exports[`react should build react app 2`] = ` config.routes = [ Object.assign({ "path": "pages/index/index", "load": function load(context, params) { - var page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 14)); + var page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 17)); return [ page, context, params ]; } }, { "navigationBarTitleText": "首页" }) ]; - Object.assign(react["default"], { - "findDOMNode": react["findDOMNode"], - "render": react["render"], - "unstable_batchedUpdates": react["unstable_batchedUpdates"] + Object.assign(mocks_react, { + "findDOMNode": undefined, + "render": undefined, + "unstable_batchedUpdates": undefined }); - var inst = createReactApp(src_app, react, react["default"], config); + var inst = createReactApp(src_app, react, mocks_react, config); var app_config_history = undefined({ "window": taro_runtime["window"] }); @@ -795,5 +1142,17 @@ exports[`react should build react app 2`] = ` "targetUnit": undefined }); } ]); + +/** filePath: dist/js/app.js.LICENSE.txt **/ +/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + " `; diff --git a/packages/taro-webpack-runner/src/__tests__/__snapshots__/vue3.spec.ts.snap b/packages/taro-webpack-runner/src/__tests__/__snapshots__/vue3.spec.ts.snap index f38fa7460cd8..de76a89f12ce 100644 --- a/packages/taro-webpack-runner/src/__tests__/__snapshots__/vue3.spec.ts.snap +++ b/packages/taro-webpack-runner/src/__tests__/__snapshots__/vue3.spec.ts.snap @@ -21,8 +21,8 @@ exports[`vue3 should build vue3 app 2`] = ` render._withStripped = true; var vue = __webpack_require__(1); var indexvue_type_script_lang_js_ = { - "setup": function setup() { - var msg = Object(vue["ref"])("Hello world"); + "setup"() { + const msg = Object(vue["ref"])("Hello world"); return { "msg": msg }; @@ -263,7 +263,7 @@ exports[`vue3 should build vue3 app 2`] = ` return createPageConfig; })); __webpack_exports__["default"] = "taro-runtime-mock"; - var window = {}; + const window = {}; function createReactApp() {} function createVueApp() {} function createVue3App() {} @@ -273,8 +273,8 @@ exports[`vue3 should build vue3 app 2`] = ` "use strict"; var _unused_webpack_default_export = "vue-mock"; }, function(module, exports, __webpack_require__) { - var _require = __webpack_require__(0), hooks = _require.hooks; - var taro = __webpack_require__(5).default; + const {"hooks": hooks} = __webpack_require__(0); + const taro = __webpack_require__(5).default; if (hooks.isExist("initNativeApi")) { hooks.call("initNativeApi", taro); } @@ -297,7 +297,7 @@ exports[`vue3 should build vue3 app 2`] = ` return timeoutInterceptor; })); var taro_runtime = __webpack_require__(0); - var ENV_TYPE = { + const ENV_TYPE = { "WEAPP": "WEAPP", "SWAN": "SWAN", "ALIPAY": "ALIPAY", @@ -337,191 +337,110 @@ exports[`vue3 should build vue3 app 2`] = ` return undefined || "Unknown"; } } - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - 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); - } - function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); - } - function _toPropertyKey(arg) { - var key = _toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); - } - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - "writable": false - }); - return Constructor; - } var taro_shared = "taro-shared-mock"; - var chain_Chain = function() { - function Chain(requestParams, interceptors, index) { - _classCallCheck(this, Chain); + class chain_Chain { + "constructor"(requestParams, interceptors, index) { this.index = index || 0; this.requestParams = requestParams || {}; this.interceptors = interceptors || []; } - _createClass(Chain, [ { - "key": "proceed", - "value": function proceed() { - var requestParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - this.requestParams = requestParams; - if (this.index >= this.interceptors.length) { - throw new Error("chain 参数错误, 请勿直接修改 request.chain"); - } - var nextInterceptor = this._getNextInterceptor(); - var nextChain = this._getNextChain(); - var p = nextInterceptor(nextChain); - var res = p.catch((function(err) { - return Promise.reject(err); - })); - Object.keys(p).forEach((function(k) { - return undefined(p[k]) && (res[k] = p[k]); - })); - return res; - } - }, { - "key": "_getNextInterceptor", - "value": function _getNextInterceptor() { - return this.interceptors[this.index]; - } - }, { - "key": "_getNextChain", - "value": function _getNextChain() { - return new Chain(this.requestParams, this.interceptors, this.index + 1); + "proceed"(requestParams = {}) { + this.requestParams = requestParams; + if (this.index >= this.interceptors.length) { + throw new Error("chain 参数错误, 请勿直接修改 request.chain"); } - } ]); - return Chain; - }(); - var interceptor_Link = function() { - function Link(interceptor) { - _classCallCheck(this, Link); + const nextInterceptor = this._getNextInterceptor(); + const nextChain = this._getNextChain(); + const p = nextInterceptor(nextChain); + const res = p.catch(err => Promise.reject(err)); + Object.keys(p).forEach(k => undefined(p[k]) && (res[k] = p[k])); + return res; + } + "_getNextInterceptor"() { + return this.interceptors[this.index]; + } + "_getNextChain"() { + return new chain_Chain(this.requestParams, this.interceptors, this.index + 1); + } + } + class interceptor_Link { + "constructor"(interceptor) { this.taroInterceptor = interceptor; this.chain = new chain_Chain; } - _createClass(Link, [ { - "key": "request", - "value": function request(requestParams) { - var chain = this.chain; - var taroInterceptor = this.taroInterceptor; - chain.interceptors = chain.interceptors.filter((function(interceptor) { - return interceptor !== taroInterceptor; - })).concat(taroInterceptor); - return chain.proceed(Object.assign({}, requestParams)); - } - }, { - "key": "addInterceptor", - "value": function addInterceptor(interceptor) { - this.chain.interceptors.push(interceptor); - } - }, { - "key": "cleanInterceptors", - "value": function cleanInterceptors() { - this.chain = new chain_Chain; - } - } ]); - return Link; - }(); + "request"(requestParams) { + const chain = this.chain; + const taroInterceptor = this.taroInterceptor; + chain.interceptors = chain.interceptors.filter(interceptor => interceptor !== taroInterceptor).concat(taroInterceptor); + return chain.proceed(Object.assign({}, requestParams)); + } + "addInterceptor"(interceptor) { + this.chain.interceptors.push(interceptor); + } + "cleanInterceptors"() { + this.chain = new chain_Chain; + } + } function interceptorify(promiseifyApi) { return new interceptor_Link((function(chain) { return promiseifyApi(chain.requestParams); })); } function timeoutInterceptor(chain) { - var requestParams = chain.requestParams; - var p; - var res = new Promise((function(resolve, reject) { - var timeout = setTimeout((function() { + const requestParams = chain.requestParams; + let p; + const res = new Promise((resolve, reject) => { + const timeout = setTimeout(() => { clearTimeout(timeout); reject(new Error("网络链接超时,请稍后再试!")); - }), requestParams && requestParams.timeout || 6e4); + }, requestParams && requestParams.timeout || 6e4); p = chain.proceed(requestParams); - p.then((function(res) { + p.then(res => { if (!timeout) return; clearTimeout(timeout); resolve(res); - })).catch((function(err) { + }).catch(err => { timeout && clearTimeout(timeout); reject(err); - })); - })); + }); + }); if (!undefined(p) && undefined(p.abort)) res.abort = p.abort; return res; } function logInterceptor(chain) { - var requestParams = chain.requestParams; - var method = requestParams.method, data = requestParams.data, url = requestParams.url; - console.log("http ".concat(method || "GET", " --\\x3e ").concat(url, " data: "), data); - var p = chain.proceed(requestParams); - var res = p.then((function(res) { - console.log("http <-- ".concat(url, " result:"), res); + const requestParams = chain.requestParams; + const {"method": method, "data": data, "url": url} = requestParams; + console.log(\`http \${method || "GET"} --\\x3e \${url} data: \`, data); + const p = chain.proceed(requestParams); + const res = p.then(res => { + console.log(\`http <-- \${url} result:\`, res); return res; - })); + }); if (undefined(p.abort)) res.abort = p.abort; return res; } - 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; - } function Behavior(options) { return options; } function getPreload(current) { return function(key, val) { - current.preloadData = undefined(key) ? key : _defineProperty({}, key, val); + current.preloadData = undefined(key) ? key : { + [key]: val + }; }; } - var defaultDesignWidth = 750; - var defaultDesignRatio = { + const defaultDesignWidth = 750; + const defaultDesignRatio = { "640": 2.34 / 2, "750": 1, "828": 1.81 / 2 }; - var defaultBaseFontSize = 20; - var defaultUnitPrecision = 5; - var defaultTargetUnit = "rpx"; + const defaultBaseFontSize = 20; + const defaultUnitPrecision = 5; + const defaultTargetUnit = "rpx"; function getInitPxTransform(taro) { return function(config) { - var _config$designWidth = config.designWidth, designWidth = _config$designWidth === void 0 ? defaultDesignWidth : _config$designWidth, _config$deviceRatio = config.deviceRatio, deviceRatio = _config$deviceRatio === void 0 ? defaultDesignRatio : _config$deviceRatio, _config$baseFontSize = config.baseFontSize, baseFontSize = _config$baseFontSize === void 0 ? defaultBaseFontSize : _config$baseFontSize, _config$targetUnit = config.targetUnit, targetUnit = _config$targetUnit === void 0 ? defaultTargetUnit : _config$targetUnit, _config$unitPrecision = config.unitPrecision, unitPrecision = _config$unitPrecision === void 0 ? defaultUnitPrecision : _config$unitPrecision; + const {"designWidth": designWidth = defaultDesignWidth, "deviceRatio": deviceRatio = defaultDesignRatio, "baseFontSize": baseFontSize = defaultBaseFontSize, "targetUnit": targetUnit = defaultTargetUnit, "unitPrecision": unitPrecision = defaultUnitPrecision} = config; taro.config = taro.config || {}; taro.config.designWidth = designWidth; taro.config.deviceRatio = deviceRatio; @@ -532,20 +451,17 @@ exports[`vue3 should build vue3 app 2`] = ` } function getPxTransform(taro) { return function(size) { - var config = taro.config || {}; - var baseFontSize = config.baseFontSize; - var deviceRatio = config.deviceRatio || defaultDesignRatio; - var designWidth = function() { - var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - return undefined(config.designWidth) ? config.designWidth(input) : config.designWidth || defaultDesignWidth; - }(size); + const config = taro.config || {}; + const baseFontSize = config.baseFontSize; + const deviceRatio = config.deviceRatio || defaultDesignRatio; + const designWidth = ((input = 0) => undefined(config.designWidth) ? config.designWidth(input) : config.designWidth || defaultDesignWidth)(size); if (!(designWidth in deviceRatio)) { - throw new Error("deviceRatio 配置中不存在 ".concat(designWidth, " 的设置!")); + throw new Error(\`deviceRatio 配置中不存在 \${designWidth} 的设置!\`); } - var targetUnit = config.targetUnit || defaultTargetUnit; - var unitPrecision = config.unitPrecision || defaultUnitPrecision; - var formatSize = ~~size; - var rootValue = 1 / deviceRatio[designWidth]; + const targetUnit = config.targetUnit || defaultTargetUnit; + const unitPrecision = config.unitPrecision || defaultUnitPrecision; + const formatSize = ~~size; + let rootValue = 1 / deviceRatio[designWidth]; switch (targetUnit) { case "rem": rootValue *= baseFontSize * 2; @@ -555,14 +471,14 @@ exports[`vue3 should build vue3 app 2`] = ` rootValue *= 2; break; } - var val = formatSize / rootValue; + let val = formatSize / rootValue; if (unitPrecision >= 0 && unitPrecision <= 100) { val = Number(val.toFixed(unitPrecision)); } return val + targetUnit; }; } - var Taro = { + const Taro = { "Behavior": Behavior, "getEnv": getEnv, "ENV_TYPE": ENV_TYPE, @@ -588,8 +504,8 @@ exports[`vue3 should build vue3 app 2`] = ` function createRouter() {} var vue = __webpack_require__(1); var app = __webpack_require__(4); - var App = Object(vue["createApp"])({ - "onShow": function onShow(options) {} + const App = Object(vue["createApp"])({ + "onShow"(options) {} }); var src_app = App; var taro_runtime = __webpack_require__(0); @@ -625,8 +541,8 @@ exports[`vue3 should build vue3 app 2`] = ` } config.routes = [ Object.assign({ "path": "pages/index/index", - "load": function load(context, params) { - var page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 7)); + "load": function(context, params) { + const page = __webpack_require__.e(1).then(__webpack_require__.bind(null, 7)); return [ page, context, params ]; } }, { diff --git a/packages/taro-webpack5-runner/src/__tests__/__snapshots__/subpackages.spec.ts.snap b/packages/taro-webpack5-runner/src/__tests__/__snapshots__/subpackages.spec.ts.snap index 95632625feb3..b51a3d0309be 100644 --- a/packages/taro-webpack5-runner/src/__tests__/__snapshots__/subpackages.spec.ts.snap +++ b/packages/taro-webpack5-runner/src/__tests__/__snapshots__/subpackages.spec.ts.snap @@ -1,1917 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`subpackages should process subpackages mini 1`] = `23`; +exports[`subpackages should process subpackages mini 1`] = `3`; exports[`subpackages should process subpackages mini 2`] = ` " -/** filePath: dist/app.js **/ -"use strict"; - -require("./common"); - -require("./vendors"); - -require("./runtime"); - -(wx["webpackJsonp"] = wx["webpackJsonp"] || []).push([ [ 143 ], { - 923: function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { - function mergeReconciler() {} - function mergeInternalComponents() {} - function isArray() {} - function isFunction() {} - function isNumber() {} - function isNull() {} - function isObject() {} - function isString() {} - function isUndefined() {} - function isWebPlatform() {} - function getComponentsAlias() {} - function controlledComponent() {} - function internalComponents() {} - function toCamelCase() {} - function toDashed() {} - function processApis() {} - function singleQuote() {} - const EMPTY_OBJ = {}; - const hooks = {}; - function Events() {} - function ensure() {} - function noop() {} - function warn() {} - var taro_shared = "taro-shared-mock"; - const needPromiseApis = new Set([ "addFileToFavorites", "addVideoToFavorites", "authPrivateMessage", "checkIsAddedToMyMiniProgram", "chooseContact", "cropImage", "disableAlertBeforeUnload", "editImage", "enableAlertBeforeUnload", "getBackgroundFetchData", "getChannelsLiveInfo", "getChannelsLiveNoticeInfo", "getFuzzyLocation", "getGroupEnterInfo", "getLocalIPAddress", "getShareInfo", "getUserProfile", "getWeRunData", "join1v1Chat", "openChannelsActivity", "openChannelsEvent", "openChannelsLive", "openChannelsUserProfile", "openCustomerServiceChat", "openVideoEditor", "saveFileToDisk", "scanItem", "setEnable1v1Chat", "setWindowSize", "sendBizRedPacket", "startFacialRecognitionVerify" ]); - function initNativeApi(taro) { - processApis(taro, wx, { - needPromiseApis: needPromiseApis, - modifyApis(apis) { - apis.delete("lanDebug"); - }, - transformMeta(api, options) { - var _a; - if (api === "showShareMenu") { - options.menus = (_a = options.showShareItems) === null || _a === void 0 ? void 0 : _a.map((item => item === "wechatFriends" ? "shareAppMessage" : item === "wechatMoment" ? "shareTimeline" : item)); - } - return { - key: api, - options: options - }; - } - }); - taro.cloud = wx.cloud; - taro.getTabBar = function(pageCtx) { - var _a; - if (typeof (pageCtx === null || pageCtx === void 0 ? void 0 : pageCtx.getTabBar) === "function") { - return (_a = pageCtx.getTabBar()) === null || _a === void 0 ? void 0 : _a.$taroInstances; - } - }; - taro.getRenderer = function() { - var _a, _b, _c; - return (_c = (_b = (_a = taro.getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.page) === null || _b === void 0 ? void 0 : _b.renderer) !== null && _c !== void 0 ? _c : "webview"; - }; - } - const _true = "true"; - const _false = "false"; - const _empty = ""; - const _zero = "0"; - const components = { - Progress: { - "border-radius": _zero, - "font-size": "16", - duration: "30", - bindActiveEnd: _empty - }, - RichText: { - space: _empty, - "user-select": _false - }, - Text: { - "user-select": _false, - overflow: "visible", - "max-lines": "" - }, - Map: { - polygons: "[]", - subkey: _empty, - rotate: _zero, - skew: _zero, - "max-scale": "20", - "min-scale": "3", - "enable-3D": _false, - "show-compass": _false, - "show-scale": _false, - "enable-overlooking": _false, - "enable-auto-max-overlooking": _false, - "enable-zoom": _true, - "enable-scroll": _true, - "enable-rotate": _false, - "enable-satellite": _false, - "enable-traffic": _false, - "enable-poi": _true, - "enable-building": _true, - setting: "[]", - bindLabelTap: _empty, - bindRegionChange: _empty, - bindPoiTap: _empty, - bindPolylineTap: _empty, - bindAbilitySuccess: _empty, - bindAbilityFailed: _empty, - bindAuthSuccess: _empty, - bindInterpolatePoint: _empty, - bindError: _empty, - bindAnchorPointTap: _empty - }, - Button: { - lang: "en", - "session-from": _empty, - "send-message-title": _empty, - "send-message-path": _empty, - "send-message-img": _empty, - "app-parameter": _empty, - "show-message-card": _false, - "business-id": _empty, - bindGetUserInfo: _empty, - bindContact: _empty, - bindGetPhoneNumber: _empty, - bindGetRealTimePhoneNumber: _empty, - bindChooseAvatar: _empty, - bindError: _empty, - bindOpenSetting: _empty, - bindLaunchApp: _empty, - bindAgreePrivacyAuthorization: _empty - }, - Form: { - "report-submit-timeout": _zero - }, - Input: { - "always-embed": _false, - "adjust-position": _true, - "hold-keyboard": _false, - "safe-password-cert-path": "", - "safe-password-length": "", - "safe-password-time-stamp": "", - "safe-password-nonce": "", - "safe-password-salt": "", - "safe-password-custom-hash": "", - "auto-fill": _empty, - bindKeyboardHeightChange: _empty, - bindNicknameReview: _empty - }, - Picker: { - "header-text": _empty, - level: "region" - }, - PickerView: { - "immediate-change": _false, - bindPickStart: _empty, - bindPickEnd: _empty - }, - Slider: { - color: "'#e9e9e9'", - "selected-color": "'#1aad19'" - }, - Textarea: { - "show-confirm-bar": _true, - "adjust-position": _true, - "hold-keyboard": _false, - "disable-default-padding": _false, - "confirm-type": "'return'", - "confirm-hold": _false, - bindKeyboardHeightChange: _empty - }, - ScrollView: { - "enable-flex": _false, - "scroll-anchoring": _false, - enhanced: _false, - "using-sticky": _false, - "paging-enabled": _false, - "enable-passive": _false, - "refresher-enabled": _false, - "refresher-threshold": "45", - "refresher-default-style": "'black'", - "refresher-background": "'#FFF'", - "refresher-triggered": _false, - bounces: _true, - "show-scrollbar": _true, - "fast-deceleration": _false, - type: "'list'", - reverse: _false, - clip: _true, - "enable-back-to-top": _false, - "cache-extent": _empty, - "min-drag-distance": "18", - "scroll-into-view-within-extent": _false, - "scroll-into-view-alignment": "'start'", - padding: "[0,0,0,0]", - "refresher-two-level-enabled": _false, - "refresher-two-level-triggered": _false, - "refresher-two-level-threshold": "150", - "refresher-two-level-close-threshold": "80", - "refresher-two-level-scroll-enabled": _false, - "refresher-ballistic-refresh-enabled": _false, - "refresher-two-level-pinned": _false, - bindDragStart: _empty, - bindDragging: _empty, - bindDragEnd: _empty, - bindRefresherPulling: _empty, - bindRefresherRefresh: _empty, - bindRefresherRestore: _empty, - bindRefresherAbort: _empty, - bindScrollStart: _empty, - bindScrollEnd: _empty, - bindRefresherWillRefresh: _empty, - bindRefresherStatusChange: _empty - }, - StickySection: { - "push-pinned-header": _true, - padding: "[0, 0, 0, 0]" - }, - GridView: { - type: "'aligned'", - "cross-axis-count": "2", - "max-cross-axis-extent": _zero, - "main-axis-gap": _zero, - "cross-axis-gap": _zero, - padding: "[0, 0, 0, 0]" - }, - GridBuilder: { - type: "'aligned'", - list: "[]", - "cross-axis-count": "2", - "max-cross-axis-extent": _zero, - "main-axis-gap": _zero, - "cross-axis-gap": _zero, - padding: "[0, 0, 0, 0]", - bindItemBuild: _empty, - bindItemDispose: _empty - }, - ListView: { - padding: "[0, 0, 0, 0]" - }, - ListBuilder: { - list: "[]", - type: "static", - padding: "[0, 0, 0, 0]", - "child-count": _empty, - "child-height": _empty, - bindItemBuild: _empty, - bindItemDispose: _empty - }, - StickyHeader: { - "offset-top": "0", - padding: "[0, 0, 0, 0]" - }, - Swiper: { - "snap-to-edge": _false, - "easing-function": "'default'" - }, - SwiperItem: { - "skip-hidden-item-layout": _false - }, - Navigator: { - target: "'self'", - "app-id": _empty, - path: _empty, - "extra-data": _empty, - version: "'version'" - }, - Camera: { - mode: "'normal'", - resolution: "'medium'", - "frame-size": "'medium'", - bindInitDone: _empty, - bindScanCode: _empty - }, - Image: { - webp: _false, - "show-menu-by-longpress": _false - }, - LivePlayer: { - mode: "'live'", - "sound-mode": "'speaker'", - "auto-pause-if-navigate": _true, - "auto-pause-if-open-native": _true, - "picture-in-picture-mode": "[]", - "enable-auto-rotation": _false, - "referrer-policy": "'no-referrer'", - "enable-casting": _false, - bindstatechange: _empty, - bindfullscreenchange: _empty, - bindnetstatus: _empty, - bindAudioVolumeNotify: _empty, - bindEnterPictureInPicture: _empty, - bindLeavePictureInPicture: _empty, - bindCastingUserSelect: _empty, - bindCastingStateChange: _empty, - bindCastingInterrupt: _empty - }, - Video: { - title: _empty, - "play-btn-position": "'bottom'", - "enable-play-gesture": _false, - "auto-pause-if-navigate": _true, - "auto-pause-if-open-native": _true, - "vslide-gesture": _false, - "vslide-gesture-in-fullscreen": _true, - "show-bottom-progress": _true, - "ad-unit-id": _empty, - "poster-for-crawler": _empty, - "show-casting-button": _false, - "picture-in-picture-mode": "[]", - "enable-auto-rotation": _false, - "show-screen-lock-button": _false, - "show-snapshot-button": _false, - "show-background-playback-button": _false, - "background-poster": _empty, - "referrer-policy": "'no-referrer'", - "is-drm": _false, - "is-live": _false, - "provision-url": _empty, - "certificate-url": _empty, - "license-url": _empty, - "preferred-peak-bit-rate": _empty, - bindProgress: _empty, - bindLoadedMetadata: _empty, - bindControlsToggle: _empty, - bindEnterPictureInPicture: _empty, - bindLeavePictureInPicture: _empty, - bindSeekComplete: _empty, - bindCastingUserSelect: _empty, - bindCastingStateChange: _empty, - bindCastingInterrupt: _empty, - bindAdLoad: _empty, - bindAdError: _empty, - bindAdClose: _empty, - bindAdPlay: _empty - }, - Canvas: { - type: _empty - }, - Ad: { - "ad-type": "'banner'", - "ad-theme": "'white'" - }, - CoverView: { - "marker-id": _empty, - slot: _empty - }, - Editor: { - "read-only": _false, - placeholder: _empty, - "show-img-size": _false, - "show-img-toolbar": _false, - "show-img-resize": _false, - focus: _false, - bindReady: _empty, - bindFocus: _empty, - bindBlur: _empty, - bindInput: _empty, - bindStatusChange: _empty, - name: _empty - }, - MatchMedia: { - "min-width": _empty, - "max-width": _empty, - width: _empty, - "min-height": _empty, - "max-height": _empty, - height: _empty, - orientation: _empty - }, - FunctionalPageNavigator: { - version: "'release'", - name: _empty, - args: _empty, - bindSuccess: _empty, - bindFail: _empty, - bindCancel: _empty - }, - LivePusher: { - url: _empty, - mode: "'RTC'", - autopush: _false, - muted: _false, - "enable-camera": _true, - "auto-focus": _true, - orientation: "'vertical'", - beauty: _zero, - whiteness: _zero, - aspect: "'9:16'", - "min-bitrate": "200", - "max-bitrate": "1000", - "audio-quality": "'high'", - "waiting-image": _empty, - "waiting-image-hash": _empty, - zoom: _false, - "device-position": "'front'", - "background-mute": _false, - mirror: _false, - "remote-mirror": _false, - "local-mirror": _false, - "audio-reverb-type": _zero, - "enable-mic": _true, - "enable-agc": _false, - "enable-ans": _false, - "audio-volume-type": "'voicecall'", - "video-width": "360", - "video-height": "640", - "beauty-style": "'smooth'", - filter: "'standard'", - "picture-in-picture-mode": "[]", - animation: _empty, - bindStateChange: _empty, - bindNetStatus: _empty, - bindBgmStart: _empty, - bindBgmProgress: _empty, - bindBgmComplete: _empty, - bindAudioVolumeNotify: _empty - }, - OfficialAccount: { - bindLoad: _empty, - bindError: _empty - }, - OpenData: { - type: _empty, - "open-gid": _empty, - lang: "'en'", - "default-text": _empty, - "default-avatar": _empty, - bindError: _empty - }, - NavigationBar: { - title: _empty, - loading: _false, - "front-color": "'#000000'", - "background-color": _empty, - "color-animation-duration": _zero, - "color-animation-timing-func": "'linear'" - }, - PageMeta: { - "background-text-style": _empty, - "background-color": _empty, - "background-color-top": _empty, - "background-color-bottom": _empty, - "root-background-color": _empty, - "scroll-top": "''", - "scroll-duration": "300", - "page-style": "''", - "root-font-size": "''", - "page-orientation": "''", - bindResize: _empty, - bindScroll: _empty, - bindScrollDone: _empty - }, - VoipRoom: { - openid: _empty, - mode: "'camera'", - "device-position": "'front'", - bindError: _empty - }, - AdCustom: { - "unit-id": _empty, - "ad-intervals": _empty, - bindLoad: _empty, - bindError: _empty - }, - PageContainer: { - show: _false, - duration: "300", - "z-index": "100", - overlay: _true, - position: "'bottom'", - round: _false, - "close-on-slide-down": _false, - "overlay-style": _empty, - "custom-style": _empty, - bindBeforeEnter: _empty, - bindEnter: _empty, - bindAfterEnter: _empty, - bindBeforeLeave: _empty, - bindLeave: _empty, - bindAfterLeave: _empty, - bindClickOverlay: _empty - }, - ShareElement: { - mapkey: _empty, - transform: _false, - duration: "300", - "easing-function": "'ease-out'" - }, - KeyboardAccessory: {}, - RootPortal: { - enable: _true - }, - ChannelLive: { - "feed-id": _empty, - "finder-user-name": _empty - }, - ChannelVideo: { - "feed-id": _empty, - "finder-user-name": _empty, - "feed-token": _empty, - autoplay: _false, - loop: _false, - muted: _false, - "object-fit": "'contain'", - bindError: _empty - }, - Snapshot: { - mode: "'view'" - }, - Span: {}, - OpenContainer: { - transitionType: "'fade'", - transitionDuration: "300", - closedColor: "'white'", - closedElevation: _zero, - closeBorderRadius: _zero, - middleColor: _empty, - openColor: "'white'", - openElevation: _zero, - openBorderRadius: _zero - }, - DraggableSheet: { - initialChildSize: "0.5", - minChildSize: "0.25", - maxChildSize: "1.0", - snap: _false, - snapSizes: "[]" - }, - NestedScrollHeader: {}, - NestedScrollBody: {} - }; - const hostConfig = { - initNativeApi: initNativeApi, - getMiniLifecycle(config) { - const methods = config.page[5]; - if (methods.indexOf("onSaveExitState") === -1) { - methods.push("onSaveExitState"); - } - return config; - }, - transferHydrateData(data, element, componentsAlias) { - var _a; - if (element.isTransferElement) { - const pages = getCurrentPages(); - const page = pages[pages.length - 1]; - data["nn"] = element.dataName; - page.setData({ - [toCamelCase(data.nn)]: data - }); - return { - sid: element.sid, - ["v"]: "", - ["nn"]: ((_a = componentsAlias["#text"]) === null || _a === void 0 ? void 0 : _a._num) || "8" - }; - } - } - }; - mergeReconciler(hostConfig); - mergeInternalComponents(components); - var taro_runtime = __webpack_require__(521); - var taro = __webpack_require__(39); - var classCallCheck = __webpack_require__(517); - var createClass = __webpack_require__(872); - var inherits = __webpack_require__(557); - var createSuper = __webpack_require__(361); - var react = __webpack_require__(525); - var app_App = function(_Component) { - (0, inherits.Z)(App, _Component); - var _super = (0, createSuper.Z)(App); - function App() { - (0, classCallCheck.Z)(this, App); - return _super.apply(this, arguments); - } - (0, createClass.Z)(App, [ { - key: "componentDidMount", - value: function componentDidMount() {} - }, { - key: "componentDidShow", - value: function componentDidShow() {} - }, { - key: "componentDidHide", - value: function componentDidHide() {} - }, { - key: "render", - value: function render() { - return this.props.children; - } - } ]); - return App; - }(react.Component); - var app = app_App; - var taro_react = "taro-react-mock"; - var config = { - pages: [ "pages/index/index" ], - window: { - backgroundTextStyle: "light", - navigationBarBackgroundColor: "#fff", - navigationBarTitleText: "WeChat", - navigationBarTextStyle: "black" - }, - subpackages: [ { - root: "packageA", - pages: [ "detail/index", "my/index" ] - } ] - }; - taro_runtime.window.__taroAppConfig = config; - var inst = App((0, taro.Ox)(app, react, taro_react, config)); - (0, taro.J1)({ - designWidth: 750, - deviceRatio: { - 640: 1.17, - 750: 1, - 828: .905 - }, - baseFontSize: 20, - unitPrecision: undefined, - targetUnit: undefined - }); - } -}, function(__webpack_require__) { - var __webpack_exec__ = function(moduleId) { - return __webpack_require__(__webpack_require__.s = moduleId); - }; - __webpack_require__.O(0, [ 216, 592 ], (function() { - return __webpack_exec__(923); - })); - var __webpack_exports__ = __webpack_require__.O(); -} ]); - - - -/** filePath: dist/app.json **/ -{"pages":["pages/index/index"],"window":{"backgroundTextStyle":"light","navigationBarBackgroundColor":"#fff","navigationBarTitleText":"WeChat","navigationBarTextStyle":"black"},"subpackages":[{"root":"packageA","pages":["detail/index","my/index"]}]} - -/** filePath: dist/app.wxss **/ - -/** filePath: dist/base.wxml **/ - -