@tarojs/plugin-framework-react 3.4.0-beta.0
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/README.md +3 -0
- package/dist/api-loader.js +63 -0
- package/dist/api-loader.js.map +1 -0
- package/dist/index.js +246 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.js +541 -0
- package/dist/runtime.js.map +1 -0
- package/index.js +2 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function apiLoader (str) {
|
|
4
|
+
return `import {
|
|
5
|
+
useDidShow,
|
|
6
|
+
useDidHide,
|
|
7
|
+
usePullDownRefresh,
|
|
8
|
+
useReachBottom,
|
|
9
|
+
usePageScroll,
|
|
10
|
+
useResize,
|
|
11
|
+
useShareAppMessage,
|
|
12
|
+
useTabItemTap,
|
|
13
|
+
useTitleClick,
|
|
14
|
+
useOptionMenuClick,
|
|
15
|
+
usePullIntercept,
|
|
16
|
+
useShareTimeline,
|
|
17
|
+
useAddToFavorites,
|
|
18
|
+
useReady,
|
|
19
|
+
useRouter,
|
|
20
|
+
useScope
|
|
21
|
+
} from '@tarojs/plugin-framework-react/dist/runtime'
|
|
22
|
+
${str}
|
|
23
|
+
|
|
24
|
+
Taro.useDidShow = useDidShow
|
|
25
|
+
Taro.useDidHide = useDidHide
|
|
26
|
+
Taro.usePullDownRefresh = usePullDownRefresh
|
|
27
|
+
Taro.useReachBottom = useReachBottom
|
|
28
|
+
Taro.usePageScroll = usePageScroll
|
|
29
|
+
Taro.useResize = useResize
|
|
30
|
+
Taro.useShareAppMessage = useShareAppMessage
|
|
31
|
+
Taro.useTabItemTap = useTabItemTap
|
|
32
|
+
Taro.useTitleClick = useTitleClick
|
|
33
|
+
Taro.useOptionMenuClick = useOptionMenuClick
|
|
34
|
+
Taro.usePullIntercept = usePullIntercept
|
|
35
|
+
Taro.useShareTimeline = useShareTimeline
|
|
36
|
+
Taro.useAddToFavorites = useAddToFavorites
|
|
37
|
+
Taro.useReady = useReady
|
|
38
|
+
Taro.useRouter = useRouter
|
|
39
|
+
Taro.useScope = useScope
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
useDidShow,
|
|
43
|
+
useDidHide,
|
|
44
|
+
usePullDownRefresh,
|
|
45
|
+
useReachBottom,
|
|
46
|
+
usePageScroll,
|
|
47
|
+
useResize,
|
|
48
|
+
useShareAppMessage,
|
|
49
|
+
useTabItemTap,
|
|
50
|
+
useTitleClick,
|
|
51
|
+
useOptionMenuClick,
|
|
52
|
+
usePullIntercept,
|
|
53
|
+
useShareTimeline,
|
|
54
|
+
useAddToFavorites,
|
|
55
|
+
useReady,
|
|
56
|
+
useRouter,
|
|
57
|
+
useScope
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = apiLoader;
|
|
63
|
+
//# sourceMappingURL=api-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-loader.js","sources":["../src/api-loader.ts"],"sourcesContent":["export default function (str) {\n return `import {\n useDidShow,\n useDidHide,\n usePullDownRefresh,\n useReachBottom,\n usePageScroll,\n useResize,\n useShareAppMessage,\n useTabItemTap,\n useTitleClick,\n useOptionMenuClick,\n usePullIntercept,\n useShareTimeline,\n useAddToFavorites,\n useReady,\n useRouter,\n useScope\n } from '@tarojs/plugin-framework-react/dist/runtime'\n ${str}\n\n Taro.useDidShow = useDidShow\n Taro.useDidHide = useDidHide\n Taro.usePullDownRefresh = usePullDownRefresh\n Taro.useReachBottom = useReachBottom\n Taro.usePageScroll = usePageScroll\n Taro.useResize = useResize\n Taro.useShareAppMessage = useShareAppMessage\n Taro.useTabItemTap = useTabItemTap\n Taro.useTitleClick = useTitleClick\n Taro.useOptionMenuClick = useOptionMenuClick\n Taro.usePullIntercept = usePullIntercept\n Taro.useShareTimeline = useShareTimeline\n Taro.useAddToFavorites = useAddToFavorites\n Taro.useReady = useReady\n Taro.useRouter = useRouter\n Taro.useScope = useScope\n\n export {\n useDidShow,\n useDidHide,\n usePullDownRefresh,\n useReachBottom,\n usePageScroll,\n useResize,\n useShareAppMessage,\n useTabItemTap,\n useTitleClick,\n useOptionMenuClick,\n usePullIntercept,\n useShareTimeline,\n useAddToFavorites,\n useReady,\n useRouter,\n useScope\n }\n `\n}\n"],"names":[],"mappings":";;oBAAyB,GAAG;IAC1B,OAAO;;;;;;;;;;;;;;;;;;IAkBL,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCJ,CAAA;AACH;;;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var acorn = require('acorn');
|
|
6
|
+
var walk = require('acorn-walk');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return e[k];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n['default'] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
|
|
29
|
+
var walk__namespace = /*#__PURE__*/_interopNamespace(walk);
|
|
30
|
+
|
|
31
|
+
function addConfig(source) {
|
|
32
|
+
const configsMap = {
|
|
33
|
+
enableShareAppMessage: ['onShareAppMessage', 'useShareAppMessage'],
|
|
34
|
+
enableShareTimeline: ['onShareTimeline', 'useShareTimeline']
|
|
35
|
+
};
|
|
36
|
+
const ast = acorn__namespace.parse(source, {
|
|
37
|
+
ecmaVersion: 'latest',
|
|
38
|
+
sourceType: 'module'
|
|
39
|
+
});
|
|
40
|
+
const additionConfig = {};
|
|
41
|
+
function check(name) {
|
|
42
|
+
Object.keys(configsMap).forEach(configName => {
|
|
43
|
+
const apis = configsMap[configName];
|
|
44
|
+
if (apis.includes(name)) {
|
|
45
|
+
additionConfig[configName] = true;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
walk__namespace.simple(ast, {
|
|
50
|
+
FunctionExpression(node) {
|
|
51
|
+
if (!node.id || !node.id.name)
|
|
52
|
+
return;
|
|
53
|
+
check(node.id.name);
|
|
54
|
+
},
|
|
55
|
+
FunctionDeclaration(node) {
|
|
56
|
+
if (!node.id || !node.id.name)
|
|
57
|
+
return;
|
|
58
|
+
check(node.id.name);
|
|
59
|
+
},
|
|
60
|
+
CallExpression(node) {
|
|
61
|
+
const { callee } = node;
|
|
62
|
+
if (callee.type === 'Identifier') {
|
|
63
|
+
check(callee.name);
|
|
64
|
+
}
|
|
65
|
+
else if (callee.type === 'MemberExpression') {
|
|
66
|
+
if (callee.property.type === 'Identifier') {
|
|
67
|
+
check(callee.property.name);
|
|
68
|
+
}
|
|
69
|
+
else if (callee.property.type === 'Literal') {
|
|
70
|
+
check(callee.property.value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return additionConfig;
|
|
76
|
+
}
|
|
77
|
+
const frameworkMeta = {
|
|
78
|
+
nerv: {
|
|
79
|
+
importFrameworkStatement: `
|
|
80
|
+
import Nerv from 'nervjs';
|
|
81
|
+
`,
|
|
82
|
+
mockAppStatement: `
|
|
83
|
+
class App extends Nerv.Component {
|
|
84
|
+
render () {
|
|
85
|
+
return this.props.children
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
frameworkArgs: 'Nerv, Nerv, config',
|
|
90
|
+
creator: 'createReactApp',
|
|
91
|
+
creatorLocation: '@tarojs/plugin-framework-react/dist/runtime',
|
|
92
|
+
importFrameworkName: 'Nerv',
|
|
93
|
+
modifyConfig(config, source) {
|
|
94
|
+
Object.assign(config, addConfig(source));
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
react: {
|
|
98
|
+
importFrameworkStatement: `
|
|
99
|
+
import * as React from 'react'
|
|
100
|
+
import ReactDOM from 'react-dom'
|
|
101
|
+
`,
|
|
102
|
+
mockAppStatement: `
|
|
103
|
+
class App extends React.Component {
|
|
104
|
+
render () {
|
|
105
|
+
return this.props.children
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`,
|
|
109
|
+
frameworkArgs: 'React, ReactDOM, config',
|
|
110
|
+
creator: 'createReactApp',
|
|
111
|
+
creatorLocation: '@tarojs/plugin-framework-react/dist/runtime',
|
|
112
|
+
importFrameworkName: 'React',
|
|
113
|
+
compatComponentImport: 'import { PullDownRefresh } from "@tarojs/components"',
|
|
114
|
+
compatComponentExtra: 'config.PullDownRefresh = PullDownRefresh',
|
|
115
|
+
modifyConfig(config, source) {
|
|
116
|
+
Object.assign(config, addConfig(source));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function getLoaderMeta(framework) {
|
|
121
|
+
if (framework === 'preact')
|
|
122
|
+
framework = 'react';
|
|
123
|
+
return frameworkMeta[framework];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function modifyMiniWebpackChain(ctx, framework, chain) {
|
|
127
|
+
setAlias$2(ctx, framework, chain);
|
|
128
|
+
setLoader$1(framework, chain);
|
|
129
|
+
}
|
|
130
|
+
function setAlias$2(ctx, framework, chain) {
|
|
131
|
+
var _a;
|
|
132
|
+
const config = ctx.initialConfig;
|
|
133
|
+
const alias = chain.resolve.alias;
|
|
134
|
+
if (framework === 'react') {
|
|
135
|
+
alias.set('react-dom$', '@tarojs/react');
|
|
136
|
+
if (process.env.NODE_ENV !== 'production' && ((_a = config.mini) === null || _a === void 0 ? void 0 : _a.debugReact) !== true) {
|
|
137
|
+
// 不是生产环境,且没有设置 debugReact,则使用压缩版本的 react 依赖,减少体积
|
|
138
|
+
alias.set('react-reconciler$', 'react-reconciler/cjs/react-reconciler.production.min.js');
|
|
139
|
+
alias.set('react$', 'react/cjs/react.production.min.js');
|
|
140
|
+
alias.set('scheduler$', 'scheduler/cjs/scheduler.production.min.js');
|
|
141
|
+
alias.set('react/jsx-runtime$', 'react/cjs/react-jsx-runtime.production.min.js');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function setLoader$1(framework, chain) {
|
|
146
|
+
chain.plugin('miniPlugin')
|
|
147
|
+
.tap(args => {
|
|
148
|
+
args[0].loaderMeta = getLoaderMeta(framework);
|
|
149
|
+
return args;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function modifyH5WebpackChain(ctx, framework, chain) {
|
|
154
|
+
setAlias$1(ctx, chain);
|
|
155
|
+
setLoader(framework, chain);
|
|
156
|
+
setPlugin(ctx, framework, chain);
|
|
157
|
+
chain.merge({
|
|
158
|
+
module: {
|
|
159
|
+
rule: {
|
|
160
|
+
'process-import-taro': {
|
|
161
|
+
test: /taro-h5[\\/]src[\\/]index/,
|
|
162
|
+
loader: require.resolve('./api-loader')
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function setAlias$1(ctx, chain) {
|
|
169
|
+
var _a;
|
|
170
|
+
const config = ctx.initialConfig;
|
|
171
|
+
const alias = chain.resolve.alias;
|
|
172
|
+
if ((_a = config.h5) === null || _a === void 0 ? void 0 : _a.useHtmlComponents) {
|
|
173
|
+
alias.set('@tarojs/components$', '@tarojs/components-react/index');
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
alias.set('@tarojs/components$', '@tarojs/components/dist-h5/react');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function setLoader(framework, chain) {
|
|
180
|
+
chain.plugin('mainPlugin')
|
|
181
|
+
.tap(args => {
|
|
182
|
+
args[0].loaderMeta = getLoaderMeta(framework);
|
|
183
|
+
return args;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function setPlugin(ctx, framework, chain) {
|
|
187
|
+
var _a, _b;
|
|
188
|
+
const config = ctx.initialConfig;
|
|
189
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
190
|
+
((_b = (_a = config.h5) === null || _a === void 0 ? void 0 : _a.devServer) === null || _b === void 0 ? void 0 : _b.hot) !== false) {
|
|
191
|
+
// 默认开启 fast-refresh
|
|
192
|
+
if (framework === 'react') {
|
|
193
|
+
chain
|
|
194
|
+
.plugin('fastRefreshPlugin')
|
|
195
|
+
.use(require('@pmmmwh/react-refresh-webpack-plugin'));
|
|
196
|
+
}
|
|
197
|
+
else if (framework === 'preact') {
|
|
198
|
+
chain
|
|
199
|
+
.plugin('fastRefreshPlugin')
|
|
200
|
+
.use(require('@prefresh/webpack'));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var index = (ctx) => {
|
|
206
|
+
const { framework } = ctx.initialConfig;
|
|
207
|
+
if (framework !== 'react' && framework !== 'nerv' && framework !== 'preact')
|
|
208
|
+
return;
|
|
209
|
+
ctx.modifyWebpackChain(({ chain }) => {
|
|
210
|
+
// 通用
|
|
211
|
+
setAlias(framework, chain);
|
|
212
|
+
chain
|
|
213
|
+
.plugin('definePlugin')
|
|
214
|
+
.tap(args => {
|
|
215
|
+
const config = args[0];
|
|
216
|
+
config.__TARO_FRAMEWORK__ = `"${framework}"`;
|
|
217
|
+
return args;
|
|
218
|
+
});
|
|
219
|
+
if (process.env.TARO_ENV === 'h5') {
|
|
220
|
+
// H5
|
|
221
|
+
modifyH5WebpackChain(ctx, framework, chain);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
// 小程序
|
|
225
|
+
modifyMiniWebpackChain(ctx, framework, chain);
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
function setAlias(framework, chain) {
|
|
230
|
+
const alias = chain.resolve.alias;
|
|
231
|
+
switch (framework) {
|
|
232
|
+
case 'preact':
|
|
233
|
+
alias.set('react', 'preact/compat');
|
|
234
|
+
alias.set('react-dom/test-utils', 'preact/test-utils');
|
|
235
|
+
alias.set('react-dom', 'preact/compat');
|
|
236
|
+
alias.set('react/jsx-runtime', 'preact/jsx-runtime');
|
|
237
|
+
break;
|
|
238
|
+
case 'nerv':
|
|
239
|
+
alias.set('react$', 'nervjs');
|
|
240
|
+
alias.set('react-dom$', 'nervjs');
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
exports['default'] = index;
|
|
246
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/loader-meta.ts","../src/webpack.mini.ts","../src/webpack.h5.ts","../src/index.ts"],"sourcesContent":["import * as acorn from 'acorn'\nimport * as walk from 'acorn-walk'\nimport { Frameworks } from './index'\n\ninterface ILoaderMeta {\n importFrameworkStatement: string\n mockAppStatement: string\n frameworkArgs: string\n creator: string\n creatorLocation: string\n importFrameworkName: string\n isNeedRawLoader?: boolean\n extraImportForWeb?: string\n execBeforeCreateWebApp?: string\n compatComponentImport?: string\n compatComponentExtra?: string\n modifyConfig?: (config: Record<string, any>, source: string) => void\n}\n\nfunction addConfig (source) {\n const configsMap = {\n enableShareAppMessage: ['onShareAppMessage', 'useShareAppMessage'],\n enableShareTimeline: ['onShareTimeline', 'useShareTimeline']\n }\n const ast = acorn.parse(source, {\n ecmaVersion: 'latest',\n sourceType: 'module'\n })\n\n const additionConfig: Record<string, any> = {}\n\n function check (name: string) {\n Object.keys(configsMap).forEach(configName => {\n const apis: string[] = configsMap[configName]\n if (apis.includes(name)) {\n additionConfig[configName] = true\n }\n })\n }\n\n walk.simple(ast, {\n FunctionExpression (node: any) {\n if (!node.id || !node.id.name) return\n check(node.id.name)\n },\n FunctionDeclaration (node: any) {\n if (!node.id || !node.id.name) return\n check(node.id.name)\n },\n CallExpression (node: any) {\n const { callee } = node\n if (callee.type === 'Identifier') {\n check(callee.name)\n } else if (callee.type === 'MemberExpression') {\n if (callee.property.type === 'Identifier') {\n check(callee.property.name)\n } else if (callee.property.type === 'Literal') {\n check(callee.property.value)\n }\n }\n }\n })\n\n return additionConfig\n}\n\nconst frameworkMeta: Record<string, ILoaderMeta> = {\n nerv: {\n importFrameworkStatement: `\nimport Nerv from 'nervjs';\n`,\n mockAppStatement: `\nclass App extends Nerv.Component {\n render () {\n return this.props.children\n }\n}\n`,\n frameworkArgs: 'Nerv, Nerv, config',\n creator: 'createReactApp',\n creatorLocation: '@tarojs/plugin-framework-react/dist/runtime',\n importFrameworkName: 'Nerv',\n modifyConfig (config, source) {\n Object.assign(config, addConfig(source))\n }\n },\n react: {\n importFrameworkStatement: `\nimport * as React from 'react'\nimport ReactDOM from 'react-dom'\n`,\n mockAppStatement: `\nclass App extends React.Component {\n render () {\n return this.props.children\n }\n}\n`,\n frameworkArgs: 'React, ReactDOM, config',\n creator: 'createReactApp',\n creatorLocation: '@tarojs/plugin-framework-react/dist/runtime',\n importFrameworkName: 'React',\n compatComponentImport: 'import { PullDownRefresh } from \"@tarojs/components\"',\n compatComponentExtra: 'config.PullDownRefresh = PullDownRefresh',\n modifyConfig (config, source) {\n Object.assign(config, addConfig(source))\n }\n }\n}\n\nexport function getLoaderMeta (framework: Frameworks) {\n if (framework === 'preact') framework = 'react'\n return frameworkMeta[framework]\n}\n","\nimport { getLoaderMeta } from './loader-meta'\n\nimport type { IPluginContext } from '@tarojs/service'\nimport type { Frameworks } from './index'\n\nexport function modifyMiniWebpackChain (ctx: IPluginContext, framework: Frameworks, chain) {\n setAlias(ctx, framework, chain)\n setLoader(framework, chain)\n}\n\nfunction setAlias (ctx: IPluginContext, framework: Frameworks, chain) {\n const config = ctx.initialConfig\n const alias = chain.resolve.alias\n\n if (framework === 'react') {\n alias.set('react-dom$', '@tarojs/react')\n if (process.env.NODE_ENV !== 'production' && config.mini?.debugReact !== true) {\n // 不是生产环境,且没有设置 debugReact,则使用压缩版本的 react 依赖,减少体积\n alias.set('react-reconciler$', 'react-reconciler/cjs/react-reconciler.production.min.js')\n alias.set('react$', 'react/cjs/react.production.min.js')\n alias.set('scheduler$', 'scheduler/cjs/scheduler.production.min.js')\n alias.set('react/jsx-runtime$', 'react/cjs/react-jsx-runtime.production.min.js')\n }\n }\n}\n\nfunction setLoader (framework: Frameworks, chain) {\n chain.plugin('miniPlugin')\n .tap(args => {\n args[0].loaderMeta = getLoaderMeta(framework)\n return args\n })\n}\n","\nimport { getLoaderMeta } from './loader-meta'\n\nimport type { IPluginContext } from '@tarojs/service'\nimport type { Frameworks } from './index'\n\nexport function modifyH5WebpackChain (ctx: IPluginContext, framework: Frameworks, chain) {\n setAlias(ctx, chain)\n setLoader(framework, chain)\n setPlugin(ctx, framework, chain)\n\n chain.merge({\n module: {\n rule: {\n 'process-import-taro': {\n test: /taro-h5[\\\\/]src[\\\\/]index/,\n loader: require.resolve('./api-loader')\n }\n }\n }\n })\n}\n\nfunction setAlias (ctx: IPluginContext, chain) {\n const config = ctx.initialConfig\n const alias = chain.resolve.alias\n\n if (config.h5?.useHtmlComponents) {\n alias.set('@tarojs/components$', '@tarojs/components-react/index')\n } else {\n alias.set('@tarojs/components$', '@tarojs/components/dist-h5/react')\n }\n}\n\nfunction setLoader (framework: Frameworks, chain) {\n chain.plugin('mainPlugin')\n .tap(args => {\n args[0].loaderMeta = getLoaderMeta(framework)\n return args\n })\n}\n\nfunction setPlugin (ctx: IPluginContext, framework: Frameworks, chain) {\n const config = ctx.initialConfig\n\n if (\n process.env.NODE_ENV !== 'production' &&\n config.h5?.devServer?.hot !== false\n ) {\n // 默认开启 fast-refresh\n if (framework === 'react') {\n chain\n .plugin('fastRefreshPlugin')\n .use(require('@pmmmwh/react-refresh-webpack-plugin'))\n } else if (framework === 'preact') {\n chain\n .plugin('fastRefreshPlugin')\n .use(require('@prefresh/webpack'))\n }\n }\n}\n","import { modifyMiniWebpackChain } from './webpack.mini'\nimport { modifyH5WebpackChain } from './webpack.h5'\n\nimport type { IPluginContext } from '@tarojs/service'\n\nexport type Frameworks = 'react' | 'preact' | 'nerv'\n\nexport default (ctx: IPluginContext) => {\n const { framework } = ctx.initialConfig\n\n if (framework !== 'react' && framework !== 'nerv' && framework !== 'preact') return\n\n ctx.modifyWebpackChain(({ chain }) => {\n // 通用\n setAlias(framework, chain)\n chain\n .plugin('definePlugin')\n .tap(args => {\n const config = args[0]\n config.__TARO_FRAMEWORK__ = `\"${framework}\"`\n return args\n })\n\n if (process.env.TARO_ENV === 'h5') {\n // H5\n modifyH5WebpackChain(ctx, framework, chain)\n } else {\n // 小程序\n modifyMiniWebpackChain(ctx, framework, chain)\n }\n })\n}\n\nfunction setAlias (framework: Frameworks, chain) {\n const alias = chain.resolve.alias\n\n switch (framework) {\n case 'preact':\n alias.set('react', 'preact/compat')\n alias.set('react-dom/test-utils', 'preact/test-utils')\n alias.set('react-dom', 'preact/compat')\n alias.set('react/jsx-runtime', 'preact/jsx-runtime')\n break\n case 'nerv':\n alias.set('react$', 'nervjs')\n alias.set('react-dom$', 'nervjs')\n break\n }\n}\n"],"names":["acorn","walk","setAlias","setLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,SAAS,CAAE,MAAM;IACxB,MAAM,UAAU,GAAG;QACjB,qBAAqB,EAAE,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;QAClE,mBAAmB,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAC7D,CAAA;IACD,MAAM,GAAG,GAAGA,gBA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CAAA;YAC7B,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;YACjC,MAAK;KACR;AACH;;;;"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { Current, incrementId, container, SERVICE_IDENTIFIER, document, getPageInstance, injectPageInstance, safeExecute, eventHandler, addLeadingSlash } from '@tarojs/runtime';
|
|
2
|
+
import { isFunction, isArray, EMPTY_OBJ, ensure } from '@tarojs/shared';
|
|
3
|
+
|
|
4
|
+
const HOOKS_APP_ID = 'taro-app';
|
|
5
|
+
function isClassComponent(R, component) {
|
|
6
|
+
const prototype = component.prototype;
|
|
7
|
+
return (isFunction(component.render) ||
|
|
8
|
+
!!(prototype === null || prototype === void 0 ? void 0 : prototype.isReactComponent) ||
|
|
9
|
+
prototype instanceof R.Component // compat for some others react-like library
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
function ensureIsArray(item) {
|
|
13
|
+
if (isArray(item)) {
|
|
14
|
+
return item;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return item ? [item] : [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* set writable, enumerable to true
|
|
22
|
+
*/
|
|
23
|
+
function setDefaultDescriptor(obj) {
|
|
24
|
+
obj.writable = true;
|
|
25
|
+
obj.enumerable = true;
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 设置入口的路由参数
|
|
30
|
+
* @param options 小程序传入的参数
|
|
31
|
+
*/
|
|
32
|
+
function setRouterParams(options) {
|
|
33
|
+
Current.router = Object.assign({ params: options === null || options === void 0 ? void 0 : options.query }, options);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 初始值设置为 any 主要是为了过 TS 的校验
|
|
37
|
+
let PageContext = EMPTY_OBJ;
|
|
38
|
+
let R$1 = EMPTY_OBJ;
|
|
39
|
+
let h$1;
|
|
40
|
+
let ReactDOM$1;
|
|
41
|
+
const pageKeyId = incrementId();
|
|
42
|
+
const hooks$1 = container.get(SERVICE_IDENTIFIER.Hooks);
|
|
43
|
+
function setReconciler() {
|
|
44
|
+
var _a;
|
|
45
|
+
hooks$1.getLifecycle = function (instance, lifecycle) {
|
|
46
|
+
lifecycle = lifecycle.replace(/^on(Show|Hide)$/, 'componentDid$1');
|
|
47
|
+
return instance[lifecycle];
|
|
48
|
+
};
|
|
49
|
+
(_a = hooks$1.modifyMpEventImpls) === null || _a === void 0 ? void 0 : _a.push(function (event) {
|
|
50
|
+
event.type = event.type.replace(/-/g, '');
|
|
51
|
+
});
|
|
52
|
+
hooks$1.batchedEventUpdates = function (cb) {
|
|
53
|
+
ReactDOM$1.unstable_batchedUpdates(cb);
|
|
54
|
+
};
|
|
55
|
+
hooks$1.mergePageInstance = function (prev, next) {
|
|
56
|
+
if (!prev || !next)
|
|
57
|
+
return;
|
|
58
|
+
// 子组件使用 lifecycle hooks 注册了生命周期后,会存在 prev,里面是注册的生命周期回调。
|
|
59
|
+
// prev 使用 Object.create(null) 创建,H5 的 fast-refresh 可能也会导致存在 prev,要排除这些意外产生的 prev
|
|
60
|
+
if ('constructor' in prev)
|
|
61
|
+
return;
|
|
62
|
+
Object.keys(prev).forEach(item => {
|
|
63
|
+
const prevList = prev[item];
|
|
64
|
+
const nextList = ensureIsArray(next[item]);
|
|
65
|
+
next[item] = nextList.concat(prevList);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
if (process.env.TARO_ENV === 'h5') {
|
|
69
|
+
hooks$1.createPullDownComponent = (el, _, R, customWrapper) => {
|
|
70
|
+
const isReactComponent = isClassComponent(R, el);
|
|
71
|
+
return R.forwardRef((props, ref) => {
|
|
72
|
+
const newProps = Object.assign({}, props);
|
|
73
|
+
const refs = isReactComponent ? { ref: ref } : {
|
|
74
|
+
forwardedRef: ref,
|
|
75
|
+
// 兼容 react-redux 7.20.1+
|
|
76
|
+
reactReduxForwardedRef: ref
|
|
77
|
+
};
|
|
78
|
+
return h$1(customWrapper || 'taro-pull-to-refresh', null, h$1(el, Object.assign(Object.assign({}, newProps), refs)));
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
hooks$1.getDOMNode = inst => {
|
|
82
|
+
return ReactDOM$1.findDOMNode(inst);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function connectReactPage(R, id) {
|
|
87
|
+
return (Page) => {
|
|
88
|
+
// eslint-disable-next-line dot-notation
|
|
89
|
+
const isReactComponent = isClassComponent(R, Page);
|
|
90
|
+
const inject = (node) => node && injectPageInstance(node, id);
|
|
91
|
+
const refs = isReactComponent ? { ref: inject } : {
|
|
92
|
+
forwardedRef: inject,
|
|
93
|
+
// 兼容 react-redux 7.20.1+
|
|
94
|
+
reactReduxForwardedRef: inject
|
|
95
|
+
};
|
|
96
|
+
if (PageContext === EMPTY_OBJ) {
|
|
97
|
+
PageContext = R.createContext('');
|
|
98
|
+
}
|
|
99
|
+
return class PageWrapper extends R.Component {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this.state = {
|
|
103
|
+
hasError: false
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
static getDerivedStateFromError(error) {
|
|
107
|
+
process.env.NODE_ENV !== 'production' && console.warn(error);
|
|
108
|
+
return { hasError: true };
|
|
109
|
+
}
|
|
110
|
+
// React 16 uncaught error 会导致整个应用 crash,
|
|
111
|
+
// 目前把错误缩小到页面
|
|
112
|
+
componentDidCatch(error, info) {
|
|
113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
114
|
+
console.warn(error);
|
|
115
|
+
console.error(info.componentStack);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
const children = this.state.hasError
|
|
120
|
+
? []
|
|
121
|
+
: h$1(PageContext.Provider, { value: id }, h$1(Page, Object.assign(Object.assign({}, this.props), refs)));
|
|
122
|
+
if (process.env.TARO_ENV === 'h5') {
|
|
123
|
+
return h$1('div', { id, className: 'taro_page' }, children);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
return h$1('root', { id }, children);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 桥接小程序 App 构造器和 React 渲染流程
|
|
134
|
+
* @param App 用户编写的入口组件
|
|
135
|
+
* @param react 框架
|
|
136
|
+
* @param reactdom 框架渲染器
|
|
137
|
+
* @param config 入口组件配置 app.config.js 的内容
|
|
138
|
+
* @returns 传递给 App 构造器的对象 obj :App(obj)
|
|
139
|
+
*/
|
|
140
|
+
function createReactApp(App, react, reactdom, config) {
|
|
141
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
142
|
+
ensure(!!reactdom, '构建 React/Nerv 项目请把 process.env.FRAMEWORK 设置为 \'react\'/\'nerv\' ');
|
|
143
|
+
}
|
|
144
|
+
R$1 = react;
|
|
145
|
+
h$1 = react.createElement;
|
|
146
|
+
ReactDOM$1 = reactdom;
|
|
147
|
+
const appInstanceRef = react.createRef();
|
|
148
|
+
const isReactComponent = isClassComponent(R$1, App);
|
|
149
|
+
let appWrapper;
|
|
150
|
+
setReconciler();
|
|
151
|
+
function getAppInstance() {
|
|
152
|
+
return appInstanceRef.current;
|
|
153
|
+
}
|
|
154
|
+
class AppWrapper extends R$1.Component {
|
|
155
|
+
constructor() {
|
|
156
|
+
super(...arguments);
|
|
157
|
+
// run createElement() inside the render function to make sure that owner is right
|
|
158
|
+
this.pages = [];
|
|
159
|
+
this.elements = [];
|
|
160
|
+
}
|
|
161
|
+
mount(pageComponent, id, cb) {
|
|
162
|
+
const pageWrapper = connectReactPage(R$1, id)(pageComponent);
|
|
163
|
+
const key = id + pageKeyId();
|
|
164
|
+
const page = () => h$1(pageWrapper, { key, tid: id });
|
|
165
|
+
this.pages.push(page);
|
|
166
|
+
this.forceUpdate(cb);
|
|
167
|
+
}
|
|
168
|
+
unmount(id, cb) {
|
|
169
|
+
const elements = this.elements;
|
|
170
|
+
const idx = elements.findIndex(item => item.props.tid === id);
|
|
171
|
+
elements.splice(idx, 1);
|
|
172
|
+
this.forceUpdate(cb);
|
|
173
|
+
}
|
|
174
|
+
render() {
|
|
175
|
+
const { pages, elements } = this;
|
|
176
|
+
while (pages.length > 0) {
|
|
177
|
+
const page = pages.pop();
|
|
178
|
+
elements.push(page());
|
|
179
|
+
}
|
|
180
|
+
let props = null;
|
|
181
|
+
if (isReactComponent) {
|
|
182
|
+
props = { ref: appInstanceRef };
|
|
183
|
+
}
|
|
184
|
+
return h$1(App, props, process.env.TARO_ENV === 'h5' ? h$1('div', null, elements.slice()) : elements.slice());
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (process.env.TARO_ENV !== 'h5') {
|
|
188
|
+
// eslint-disable-next-line react/no-render-return-value
|
|
189
|
+
appWrapper = ReactDOM$1.render(h$1(AppWrapper), document.getElementById('app'));
|
|
190
|
+
}
|
|
191
|
+
const [ONLAUNCH, ONSHOW, ONHIDE] = hooks$1.getMiniLifecycleImpl().app;
|
|
192
|
+
const appObj = Object.create({
|
|
193
|
+
render(cb) {
|
|
194
|
+
appWrapper.forceUpdate(cb);
|
|
195
|
+
},
|
|
196
|
+
mount(component, id, cb) {
|
|
197
|
+
appWrapper.mount(component, id, cb);
|
|
198
|
+
},
|
|
199
|
+
unmount(id, cb) {
|
|
200
|
+
appWrapper.unmount(id, cb);
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
config: setDefaultDescriptor({
|
|
204
|
+
configurable: true,
|
|
205
|
+
value: config
|
|
206
|
+
}),
|
|
207
|
+
[ONLAUNCH]: setDefaultDescriptor({
|
|
208
|
+
value(options) {
|
|
209
|
+
var _a;
|
|
210
|
+
setRouterParams(options);
|
|
211
|
+
if (process.env.TARO_ENV === 'h5') {
|
|
212
|
+
// 由于 H5 路由初始化的时候会清除 app 下的 dom 元素,所以需要在路由初始化后执行 render
|
|
213
|
+
// eslint-disable-next-line react/no-render-return-value
|
|
214
|
+
appWrapper = ReactDOM$1.render(h$1(AppWrapper), document.getElementById('app'));
|
|
215
|
+
}
|
|
216
|
+
// 用户编写的入口组件实例
|
|
217
|
+
const app = getAppInstance();
|
|
218
|
+
this.$app = app;
|
|
219
|
+
if (app) {
|
|
220
|
+
// 把 App Class 上挂载的额外属性同步到全局 app 对象中
|
|
221
|
+
if (app.taroGlobalData) {
|
|
222
|
+
const globalData = app.taroGlobalData;
|
|
223
|
+
const keys = Object.keys(globalData);
|
|
224
|
+
const descriptors = Object.getOwnPropertyDescriptors(globalData);
|
|
225
|
+
keys.forEach(key => {
|
|
226
|
+
Object.defineProperty(this, key, {
|
|
227
|
+
configurable: true,
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get() {
|
|
230
|
+
return globalData[key];
|
|
231
|
+
},
|
|
232
|
+
set(value) {
|
|
233
|
+
globalData[key] = value;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
Object.defineProperties(this, descriptors);
|
|
238
|
+
}
|
|
239
|
+
(_a = app.onLaunch) === null || _a === void 0 ? void 0 : _a.call(app, options);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}),
|
|
243
|
+
[ONSHOW]: setDefaultDescriptor({
|
|
244
|
+
value(options) {
|
|
245
|
+
var _a;
|
|
246
|
+
setRouterParams(options);
|
|
247
|
+
/**
|
|
248
|
+
* trigger lifecycle
|
|
249
|
+
*/
|
|
250
|
+
const app = getAppInstance();
|
|
251
|
+
// class component, componentDidShow
|
|
252
|
+
(_a = app === null || app === void 0 ? void 0 : app.componentDidShow) === null || _a === void 0 ? void 0 : _a.call(app, options);
|
|
253
|
+
// functional component, useDidShow
|
|
254
|
+
triggerAppHook('onShow');
|
|
255
|
+
}
|
|
256
|
+
}),
|
|
257
|
+
[ONHIDE]: setDefaultDescriptor({
|
|
258
|
+
value(options) {
|
|
259
|
+
var _a;
|
|
260
|
+
/**
|
|
261
|
+
* trigger lifecycle
|
|
262
|
+
*/
|
|
263
|
+
const app = getAppInstance();
|
|
264
|
+
// class component, componentDidHide
|
|
265
|
+
(_a = app === null || app === void 0 ? void 0 : app.componentDidHide) === null || _a === void 0 ? void 0 : _a.call(app, options);
|
|
266
|
+
// functional component, useDidHide
|
|
267
|
+
triggerAppHook('onHide');
|
|
268
|
+
}
|
|
269
|
+
}),
|
|
270
|
+
onPageNotFound: setDefaultDescriptor({
|
|
271
|
+
value(res) {
|
|
272
|
+
var _a;
|
|
273
|
+
const app = getAppInstance();
|
|
274
|
+
(_a = app === null || app === void 0 ? void 0 : app.onPageNotFound) === null || _a === void 0 ? void 0 : _a.call(app, res);
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
function triggerAppHook(lifecycle) {
|
|
279
|
+
const instance = getPageInstance(HOOKS_APP_ID);
|
|
280
|
+
if (instance) {
|
|
281
|
+
const app = getAppInstance();
|
|
282
|
+
const func = hooks$1.getLifecycle(instance, lifecycle);
|
|
283
|
+
if (Array.isArray(func)) {
|
|
284
|
+
func.forEach(cb => cb.apply(app));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
Current.app = appObj;
|
|
289
|
+
return appObj;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const taroHooks = (lifecycle) => {
|
|
293
|
+
return (fn) => {
|
|
294
|
+
const id = R$1.useContext(PageContext) || HOOKS_APP_ID;
|
|
295
|
+
// hold fn ref and keep up to date
|
|
296
|
+
const fnRef = R$1.useRef(fn);
|
|
297
|
+
if (fnRef.current !== fn)
|
|
298
|
+
fnRef.current = fn;
|
|
299
|
+
R$1.useLayoutEffect(() => {
|
|
300
|
+
let inst = getPageInstance(id);
|
|
301
|
+
let first = false;
|
|
302
|
+
if (inst == null) {
|
|
303
|
+
first = true;
|
|
304
|
+
inst = Object.create(null);
|
|
305
|
+
}
|
|
306
|
+
inst = inst;
|
|
307
|
+
// callback is immutable but inner function is up to date
|
|
308
|
+
const callback = (...args) => fnRef.current(...args);
|
|
309
|
+
if (isFunction(inst[lifecycle])) {
|
|
310
|
+
inst[lifecycle] = [inst[lifecycle], callback];
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
inst[lifecycle] = [
|
|
314
|
+
...(inst[lifecycle] || []),
|
|
315
|
+
callback
|
|
316
|
+
];
|
|
317
|
+
}
|
|
318
|
+
if (first) {
|
|
319
|
+
injectPageInstance(inst, id);
|
|
320
|
+
}
|
|
321
|
+
return () => {
|
|
322
|
+
const inst = getPageInstance(id);
|
|
323
|
+
const list = inst[lifecycle];
|
|
324
|
+
if (list === callback) {
|
|
325
|
+
inst[lifecycle] = undefined;
|
|
326
|
+
}
|
|
327
|
+
else if (isArray(list)) {
|
|
328
|
+
inst[lifecycle] = list.filter(item => item !== callback);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}, []);
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
const useDidShow = taroHooks('componentDidShow');
|
|
335
|
+
const useDidHide = taroHooks('componentDidHide');
|
|
336
|
+
const usePullDownRefresh = taroHooks('onPullDownRefresh');
|
|
337
|
+
const useReachBottom = taroHooks('onReachBottom');
|
|
338
|
+
const usePageScroll = taroHooks('onPageScroll');
|
|
339
|
+
const useResize = taroHooks('onResize');
|
|
340
|
+
const useShareAppMessage = taroHooks('onShareAppMessage');
|
|
341
|
+
const useTabItemTap = taroHooks('onTabItemTap');
|
|
342
|
+
const useTitleClick = taroHooks('onTitleClick');
|
|
343
|
+
const useOptionMenuClick = taroHooks('onOptionMenuClick');
|
|
344
|
+
const usePullIntercept = taroHooks('onPullIntercept');
|
|
345
|
+
const useShareTimeline = taroHooks('onShareTimeline');
|
|
346
|
+
const useAddToFavorites = taroHooks('onAddToFavorites');
|
|
347
|
+
const useReady = taroHooks('onReady');
|
|
348
|
+
const useRouter = (dynamic = false) => {
|
|
349
|
+
return dynamic ? Current.router : R$1.useMemo(() => Current.router, []);
|
|
350
|
+
};
|
|
351
|
+
const useScope = () => undefined;
|
|
352
|
+
|
|
353
|
+
var taroHooks$1 = /*#__PURE__*/Object.freeze({
|
|
354
|
+
__proto__: null,
|
|
355
|
+
useDidShow: useDidShow,
|
|
356
|
+
useDidHide: useDidHide,
|
|
357
|
+
usePullDownRefresh: usePullDownRefresh,
|
|
358
|
+
useReachBottom: useReachBottom,
|
|
359
|
+
usePageScroll: usePageScroll,
|
|
360
|
+
useResize: useResize,
|
|
361
|
+
useShareAppMessage: useShareAppMessage,
|
|
362
|
+
useTabItemTap: useTabItemTap,
|
|
363
|
+
useTitleClick: useTitleClick,
|
|
364
|
+
useOptionMenuClick: useOptionMenuClick,
|
|
365
|
+
usePullIntercept: usePullIntercept,
|
|
366
|
+
useShareTimeline: useShareTimeline,
|
|
367
|
+
useAddToFavorites: useAddToFavorites,
|
|
368
|
+
useReady: useReady,
|
|
369
|
+
useRouter: useRouter,
|
|
370
|
+
useScope: useScope
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
const getNativeCompId = incrementId();
|
|
374
|
+
let R;
|
|
375
|
+
let h;
|
|
376
|
+
let ReactDOM;
|
|
377
|
+
function initNativeComponentEntry(R, ReactDOM) {
|
|
378
|
+
class NativeComponentWrapper extends R.Component {
|
|
379
|
+
constructor() {
|
|
380
|
+
super(...arguments);
|
|
381
|
+
this.root = R.createRef();
|
|
382
|
+
this.ctx = this.props.getCtx();
|
|
383
|
+
}
|
|
384
|
+
componentDidMount() {
|
|
385
|
+
this.ctx.component = this;
|
|
386
|
+
const rootElement = this.root.current;
|
|
387
|
+
rootElement.ctx = this.ctx;
|
|
388
|
+
rootElement.performUpdate(true);
|
|
389
|
+
}
|
|
390
|
+
render() {
|
|
391
|
+
return (h('root', {
|
|
392
|
+
ref: this.root
|
|
393
|
+
}, this.props.renderComponent(this.ctx)));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
class Entry extends R.Component {
|
|
397
|
+
constructor() {
|
|
398
|
+
super(...arguments);
|
|
399
|
+
this.state = {
|
|
400
|
+
components: []
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
componentDidMount() {
|
|
404
|
+
Current.app = this;
|
|
405
|
+
}
|
|
406
|
+
mount(Component, compId, getCtx) {
|
|
407
|
+
const isReactComponent = isClassComponent(R, Component);
|
|
408
|
+
const inject = (node) => node && injectPageInstance(node, compId);
|
|
409
|
+
const refs = isReactComponent ? { ref: inject } : {
|
|
410
|
+
forwardedRef: inject,
|
|
411
|
+
reactReduxForwardedRef: inject
|
|
412
|
+
};
|
|
413
|
+
const item = {
|
|
414
|
+
compId,
|
|
415
|
+
element: h(NativeComponentWrapper, {
|
|
416
|
+
key: compId,
|
|
417
|
+
getCtx,
|
|
418
|
+
renderComponent(ctx) {
|
|
419
|
+
return h(Component, Object.assign(Object.assign({}, (ctx.data || (ctx.data = {})).props), refs));
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
};
|
|
423
|
+
this.setState({
|
|
424
|
+
components: [...this.state.components, item]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
unmount(compId) {
|
|
428
|
+
const components = this.state.components;
|
|
429
|
+
const index = components.findIndex(item => item.compId === compId);
|
|
430
|
+
const next = [...components.slice(0, index), ...components.slice(index + 1)];
|
|
431
|
+
this.setState({
|
|
432
|
+
components: next
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
render() {
|
|
436
|
+
const components = this.state.components;
|
|
437
|
+
return (components.map(({ element }) => element));
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
setReconciler();
|
|
441
|
+
const app = document.getElementById('app');
|
|
442
|
+
ReactDOM.render(h(Entry, {}), app);
|
|
443
|
+
}
|
|
444
|
+
function createNativeComponentConfig(Component, react, reactdom, componentConfig) {
|
|
445
|
+
R = react;
|
|
446
|
+
h = react.createElement;
|
|
447
|
+
ReactDOM = reactdom;
|
|
448
|
+
setReconciler();
|
|
449
|
+
const componentObj = {
|
|
450
|
+
properties: {
|
|
451
|
+
props: {
|
|
452
|
+
type: null,
|
|
453
|
+
value: null,
|
|
454
|
+
observer(_newVal, oldVal) {
|
|
455
|
+
oldVal && this.component.forceUpdate();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
created() {
|
|
460
|
+
if (!Current.app) {
|
|
461
|
+
initNativeComponentEntry(R, ReactDOM);
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
attached() {
|
|
465
|
+
setCurrent();
|
|
466
|
+
this.compId = getNativeCompId();
|
|
467
|
+
this.config = componentConfig;
|
|
468
|
+
Current.app.mount(Component, this.compId, () => this);
|
|
469
|
+
},
|
|
470
|
+
ready() {
|
|
471
|
+
safeExecute(this.compId, 'onReady');
|
|
472
|
+
},
|
|
473
|
+
detached() {
|
|
474
|
+
Current.app.unmount(this.compId);
|
|
475
|
+
},
|
|
476
|
+
pageLifetimes: {
|
|
477
|
+
show() {
|
|
478
|
+
safeExecute(this.compId, 'onShow');
|
|
479
|
+
},
|
|
480
|
+
hide() {
|
|
481
|
+
safeExecute(this.compId, 'onHide');
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
methods: {
|
|
485
|
+
eh: eventHandler
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
function setCurrent() {
|
|
489
|
+
const pages = getCurrentPages();
|
|
490
|
+
const currentPage = pages[pages.length - 1];
|
|
491
|
+
if (Current.page === currentPage)
|
|
492
|
+
return;
|
|
493
|
+
Current.page = currentPage;
|
|
494
|
+
const route = currentPage.route || currentPage.__route__;
|
|
495
|
+
const router = {
|
|
496
|
+
params: currentPage.options || {},
|
|
497
|
+
path: addLeadingSlash(route),
|
|
498
|
+
onReady: '',
|
|
499
|
+
onHide: '',
|
|
500
|
+
onShow: ''
|
|
501
|
+
};
|
|
502
|
+
Current.router = router;
|
|
503
|
+
if (!currentPage.options) {
|
|
504
|
+
// 例如在微信小程序中,页面 options 的设置时机比组件 attached 慢
|
|
505
|
+
Object.defineProperty(currentPage, 'options', {
|
|
506
|
+
enumerable: true,
|
|
507
|
+
configurable: true,
|
|
508
|
+
get() {
|
|
509
|
+
return this._optionsValue;
|
|
510
|
+
},
|
|
511
|
+
set(value) {
|
|
512
|
+
router.params = value;
|
|
513
|
+
this._optionsValue = value;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return componentObj;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
var _a, _b;
|
|
522
|
+
const hooks = container.get(SERVICE_IDENTIFIER.Hooks);
|
|
523
|
+
hooks.initNativeApiImpls || (hooks.initNativeApiImpls = []);
|
|
524
|
+
hooks.initNativeApiImpls.push(function (taro) {
|
|
525
|
+
for (const hook in taroHooks$1) {
|
|
526
|
+
taro[hook] = taroHooks$1[hook];
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
if (__TARO_FRAMEWORK__ === 'preact') {
|
|
530
|
+
(_a = hooks.modifyMpEventImpls) === null || _a === void 0 ? void 0 : _a.push(e => {
|
|
531
|
+
if (e.type === 'tap')
|
|
532
|
+
e.type = 'click';
|
|
533
|
+
});
|
|
534
|
+
(_b = hooks.modifyDispatchEventImpls) === null || _b === void 0 ? void 0 : _b.push(e => {
|
|
535
|
+
const type = e.type;
|
|
536
|
+
e.type = type[0].toUpperCase() + type.slice(1);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export { PageContext, R$1 as R, connectReactPage, createNativeComponentConfig, createReactApp, setReconciler, useAddToFavorites, useDidHide, useDidShow, useOptionMenuClick, usePageScroll, usePullDownRefresh, usePullIntercept, useReachBottom, useReady, useResize, useRouter, useScope, useShareAppMessage, useShareTimeline, useTabItemTap, useTitleClick };
|
|
541
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../src/runtime/utils.ts","../src/runtime/connect.ts","../src/runtime/hooks.ts","../src/runtime/connect-native.ts","../src/runtime/index.ts"],"sourcesContent":["import { isArray, isFunction } from '@tarojs/shared'\nimport { Current } from '@tarojs/runtime'\n\nimport type * as React from 'react'\n\nexport const HOOKS_APP_ID = 'taro-app'\n\nexport function isClassComponent (R: typeof React, component): boolean {\n const prototype = component.prototype\n\n return (\n isFunction(component.render) ||\n !!prototype?.isReactComponent ||\n prototype instanceof R.Component // compat for some others react-like library\n )\n}\n\nexport function ensureIsArray<T> (item: T | T[]): T[] {\n if (isArray(item)) {\n return item\n } else {\n return item ? [item] : []\n }\n}\n\n/**\n * set writable, enumerable to true\n */\nexport function setDefaultDescriptor (obj: Record<string, any>) {\n obj.writable = true\n obj.enumerable = true\n return obj\n}\n\n/**\n * 设置入口的路由参数\n * @param options 小程序传入的参数\n */\nexport function setRouterParams (options) {\n Current.router = {\n params: options?.query,\n ...options\n }\n}\n","import { ensure, EMPTY_OBJ } from '@tarojs/shared'\nimport {\n container,\n SERVICE_IDENTIFIER,\n Current,\n document,\n getPageInstance,\n injectPageInstance,\n incrementId\n} from '@tarojs/runtime'\nimport { isClassComponent, ensureIsArray, setDefaultDescriptor, setRouterParams, HOOKS_APP_ID } from './utils'\n\nimport type * as React from 'react'\nimport type { AppConfig } from '@tarojs/taro'\nimport type {\n IHooks,\n AppInstance,\n Instance,\n ReactAppInstance,\n ReactPageComponent,\n PageProps\n} from '@tarojs/runtime'\n\ntype PageComponent = React.CElement<PageProps, React.Component<PageProps, any, any>>\n\n// 初始值设置为 any 主要是为了过 TS 的校验\nexport let PageContext: React.Context<string> = EMPTY_OBJ\nexport let R: typeof React = EMPTY_OBJ\nlet h: typeof React.createElement\nlet ReactDOM\n\nconst pageKeyId = incrementId()\nconst hooks = container.get<IHooks>(SERVICE_IDENTIFIER.Hooks)\n\nexport function setReconciler () {\n hooks.getLifecycle = function (instance, lifecycle: string) {\n lifecycle = lifecycle.replace(/^on(Show|Hide)$/, 'componentDid$1')\n return instance[lifecycle]\n }\n\n hooks.modifyMpEventImpls?.push(function (event) {\n event.type = event.type.replace(/-/g, '')\n })\n\n hooks.batchedEventUpdates = function (cb) {\n ReactDOM.unstable_batchedUpdates(cb)\n }\n\n hooks.mergePageInstance = function (prev, next) {\n if (!prev || !next) return\n\n // 子组件使用 lifecycle hooks 注册了生命周期后,会存在 prev,里面是注册的生命周期回调。\n\n // prev 使用 Object.create(null) 创建,H5 的 fast-refresh 可能也会导致存在 prev,要排除这些意外产生的 prev\n if ('constructor' in prev) return\n\n Object.keys(prev).forEach(item => {\n const prevList = prev[item]\n const nextList = ensureIsArray<() => any>(next[item])\n next[item] = nextList.concat(prevList)\n })\n }\n\n if (process.env.TARO_ENV === 'h5') {\n hooks.createPullDownComponent = (\n el: React.FunctionComponent<PageProps> | React.ComponentClass<PageProps>,\n _,\n R: typeof React,\n customWrapper\n ) => {\n const isReactComponent = isClassComponent(R, el)\n\n return R.forwardRef((props, ref) => {\n const newProps: React.Props<any> = { ...props }\n const refs = isReactComponent ? { ref: ref } : {\n forwardedRef: ref,\n // 兼容 react-redux 7.20.1+\n reactReduxForwardedRef: ref\n }\n\n return h(\n customWrapper || 'taro-pull-to-refresh',\n null,\n h(el, {\n ...newProps,\n ...refs\n })\n )\n })\n }\n\n hooks.getDOMNode = inst => {\n return ReactDOM.findDOMNode(inst)\n }\n }\n}\n\nexport function connectReactPage (\n R: typeof React,\n id: string\n) {\n return (Page: ReactPageComponent): React.ComponentClass<PageProps> => {\n // eslint-disable-next-line dot-notation\n const isReactComponent = isClassComponent(R, Page)\n const inject = (node?: Instance) => node && injectPageInstance(node, id)\n const refs = isReactComponent ? { ref: inject } : {\n forwardedRef: inject,\n // 兼容 react-redux 7.20.1+\n reactReduxForwardedRef: inject\n }\n\n if (PageContext === EMPTY_OBJ) {\n PageContext = R.createContext('')\n }\n\n return class PageWrapper extends R.Component<PageProps, { hasError: boolean }> {\n state = {\n hasError: false\n }\n\n static getDerivedStateFromError (error: Error) {\n process.env.NODE_ENV !== 'production' && console.warn(error)\n return { hasError: true }\n }\n\n // React 16 uncaught error 会导致整个应用 crash,\n // 目前把错误缩小到页面\n componentDidCatch (error: Error, info: React.ErrorInfo) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(error)\n console.error(info.componentStack)\n }\n }\n\n render () {\n const children = this.state.hasError\n ? []\n : h(PageContext.Provider, { value: id }, h(Page, {\n ...this.props,\n ...refs\n }))\n\n if (process.env.TARO_ENV === 'h5') {\n return h(\n 'div',\n { id, className: 'taro_page' },\n children\n )\n } else {\n return h(\n 'root',\n { id },\n children\n )\n }\n }\n }\n }\n}\n\n/**\n * 桥接小程序 App 构造器和 React 渲染流程\n * @param App 用户编写的入口组件\n * @param react 框架\n * @param reactdom 框架渲染器\n * @param config 入口组件配置 app.config.js 的内容\n * @returns 传递给 App 构造器的对象 obj :App(obj)\n */\nexport function createReactApp (\n App: React.ComponentClass,\n react: typeof React,\n reactdom,\n config: AppConfig\n) {\n if (process.env.NODE_ENV !== 'production') {\n ensure(!!reactdom, '构建 React/Nerv 项目请把 process.env.FRAMEWORK 设置为 \\'react\\'/\\'nerv\\' ')\n }\n\n R = react\n h = react.createElement\n ReactDOM = reactdom\n const appInstanceRef = react.createRef<ReactAppInstance>()\n const isReactComponent = isClassComponent(R, App)\n let appWrapper: AppWrapper\n\n setReconciler()\n\n function getAppInstance (): ReactAppInstance | null {\n return appInstanceRef.current\n }\n\n class AppWrapper extends R.Component {\n // run createElement() inside the render function to make sure that owner is right\n private pages: Array<() => PageComponent> = []\n private elements: Array<PageComponent> = []\n\n public mount (pageComponent: ReactPageComponent, id: string, cb: () => void) {\n const pageWrapper = connectReactPage(R, id)(pageComponent)\n const key = id + pageKeyId()\n const page = () => h(pageWrapper, { key, tid: id })\n this.pages.push(page)\n this.forceUpdate(cb)\n }\n\n public unmount (id: string, cb: () => void) {\n const elements = this.elements\n const idx = elements.findIndex(item => item.props.tid === id)\n elements.splice(idx, 1)\n this.forceUpdate(cb)\n }\n\n public render () {\n const { pages, elements } = this\n\n while (pages.length > 0) {\n const page = pages.pop()!\n elements.push(page())\n }\n\n let props: React.Props<any> | null = null\n\n if (isReactComponent) {\n props = { ref: appInstanceRef }\n }\n\n return h(\n App,\n props,\n process.env.TARO_ENV === 'h5' ? h('div', null, elements.slice()) : elements.slice()\n )\n }\n }\n\n if (process.env.TARO_ENV !== 'h5') {\n // eslint-disable-next-line react/no-render-return-value\n appWrapper = ReactDOM.render(h(AppWrapper), document.getElementById('app'))\n }\n\n const [ONLAUNCH, ONSHOW, ONHIDE] = hooks.getMiniLifecycleImpl().app\n\n const appObj: AppInstance = Object.create({\n render (cb: () => void) {\n appWrapper.forceUpdate(cb)\n },\n\n mount (component: ReactPageComponent, id: string, cb: () => void) {\n appWrapper.mount(component, id, cb)\n },\n\n unmount (id: string, cb: () => void) {\n appWrapper.unmount(id, cb)\n }\n }, {\n config: setDefaultDescriptor({\n configurable: true,\n value: config\n }),\n\n [ONLAUNCH]: setDefaultDescriptor({\n value (options) {\n setRouterParams(options)\n\n if (process.env.TARO_ENV === 'h5') {\n // 由于 H5 路由初始化的时候会清除 app 下的 dom 元素,所以需要在路由初始化后执行 render\n // eslint-disable-next-line react/no-render-return-value\n appWrapper = ReactDOM.render(h(AppWrapper), document.getElementById('app'))\n }\n\n // 用户编写的入口组件实例\n const app = getAppInstance()\n this.$app = app\n\n if (app) {\n // 把 App Class 上挂载的额外属性同步到全局 app 对象中\n if (app.taroGlobalData) {\n const globalData = app.taroGlobalData\n const keys = Object.keys(globalData)\n const descriptors = Object.getOwnPropertyDescriptors(globalData)\n keys.forEach(key => {\n Object.defineProperty(this, key, {\n configurable: true,\n enumerable: true,\n get () {\n return globalData[key]\n },\n set (value) {\n globalData[key] = value\n }\n })\n })\n Object.defineProperties(this, descriptors)\n }\n\n app.onLaunch?.(options)\n }\n }\n }),\n\n [ONSHOW]: setDefaultDescriptor({\n value (options) {\n setRouterParams(options)\n\n /**\n * trigger lifecycle\n */\n const app = getAppInstance()\n // class component, componentDidShow\n app?.componentDidShow?.(options)\n // functional component, useDidShow\n triggerAppHook('onShow')\n }\n }),\n\n [ONHIDE]: setDefaultDescriptor({\n value (options: unknown) {\n /**\n * trigger lifecycle\n */\n const app = getAppInstance()\n // class component, componentDidHide\n app?.componentDidHide?.(options)\n // functional component, useDidHide\n triggerAppHook('onHide')\n }\n }),\n\n onPageNotFound: setDefaultDescriptor({\n value (res: unknown) {\n const app = getAppInstance()\n app?.onPageNotFound?.(res)\n }\n })\n })\n\n function triggerAppHook (lifecycle) {\n const instance = getPageInstance(HOOKS_APP_ID)\n if (instance) {\n const app = getAppInstance()\n const func = hooks.getLifecycle(instance, lifecycle)\n if (Array.isArray(func)) {\n func.forEach(cb => cb.apply(app))\n }\n }\n }\n\n Current.app = appObj\n return appObj\n}\n","import { isFunction, isArray } from '@tarojs/shared'\nimport {\n Current,\n getPageInstance,\n injectPageInstance\n} from '@tarojs/runtime'\nimport { PageContext, R as React } from './connect'\nimport { HOOKS_APP_ID } from './utils'\n\nimport type { Func, PageLifeCycle } from '@tarojs/runtime'\n\nconst taroHooks = (lifecycle: keyof PageLifeCycle) => {\n return (fn: Func) => {\n const id = React.useContext(PageContext) || HOOKS_APP_ID\n\n // hold fn ref and keep up to date\n const fnRef = React.useRef(fn)\n if (fnRef.current !== fn) fnRef.current = fn\n\n React.useLayoutEffect(() => {\n let inst = getPageInstance(id)\n let first = false\n if (inst == null) {\n first = true\n inst = Object.create(null)\n }\n\n inst = inst!\n\n // callback is immutable but inner function is up to date\n const callback = (...args: any) => fnRef.current(...args)\n\n if (isFunction(inst[lifecycle])) {\n (inst[lifecycle] as any) = [inst[lifecycle], callback]\n } else {\n (inst[lifecycle] as any) = [\n ...((inst[lifecycle] as any) || []),\n callback\n ]\n }\n\n if (first) {\n injectPageInstance(inst!, id)\n }\n return () => {\n const inst = getPageInstance(id)\n const list = inst![lifecycle]\n if (list === callback) {\n (inst![lifecycle] as any) = undefined\n } else if (isArray(list)) {\n (inst![lifecycle] as any) = list.filter(item => item !== callback)\n }\n }\n }, [])\n }\n}\n\nexport const useDidShow = taroHooks('componentDidShow')\n\nexport const useDidHide = taroHooks('componentDidHide')\n\nexport const usePullDownRefresh = taroHooks('onPullDownRefresh')\n\nexport const useReachBottom = taroHooks('onReachBottom')\n\nexport const usePageScroll = taroHooks('onPageScroll')\n\nexport const useResize = taroHooks('onResize')\n\nexport const useShareAppMessage = taroHooks('onShareAppMessage')\n\nexport const useTabItemTap = taroHooks('onTabItemTap')\n\nexport const useTitleClick = taroHooks('onTitleClick')\n\nexport const useOptionMenuClick = taroHooks('onOptionMenuClick')\n\nexport const usePullIntercept = taroHooks('onPullIntercept')\n\nexport const useShareTimeline = taroHooks('onShareTimeline')\n\nexport const useAddToFavorites = taroHooks('onAddToFavorites')\n\nexport const useReady = taroHooks('onReady')\n\nexport const useRouter = (dynamic = false) => {\n return dynamic ? Current.router : React.useMemo(() => Current.router, [])\n}\n\nexport const useScope = () => undefined\n","import {\n Current,\n document,\n injectPageInstance,\n safeExecute,\n addLeadingSlash,\n incrementId,\n eventHandler\n} from '@tarojs/runtime'\nimport { isClassComponent } from './utils'\nimport { setReconciler } from './connect'\n\nimport type * as React from 'react'\nimport type { PageInstance } from '@tarojs/taro'\nimport type {\n TaroRootElement,\n Instance\n} from '@tarojs/runtime'\n\ndeclare const getCurrentPages: () => PageInstance[]\n\nconst getNativeCompId = incrementId()\nlet R: typeof React\nlet h: typeof React.createElement\nlet ReactDOM\n\nfunction initNativeComponentEntry (R: typeof React, ReactDOM) {\n interface IEntryState {\n components: {\n compId: string\n element: React.ReactElement\n }[]\n }\n\n interface IWrapperProps {\n getCtx: () => any\n renderComponent: (ctx: any) => React.ReactElement\n }\n\n class NativeComponentWrapper extends R.Component<IWrapperProps, Record<any, any>> {\n root = R.createRef<TaroRootElement>()\n ctx = this.props.getCtx()\n\n componentDidMount () {\n this.ctx.component = this\n const rootElement = this.root.current!\n rootElement.ctx = this.ctx\n rootElement.performUpdate(true)\n }\n\n render () {\n return (\n h(\n 'root',\n {\n ref: this.root\n },\n this.props.renderComponent(this.ctx)\n )\n )\n }\n }\n\n class Entry extends R.Component<Record<any, any>, IEntryState> {\n state: IEntryState = {\n components: []\n }\n\n componentDidMount () {\n Current.app = this\n }\n\n mount (Component, compId, getCtx) {\n const isReactComponent = isClassComponent(R, Component)\n const inject = (node?: Instance) => node && injectPageInstance(node, compId)\n const refs = isReactComponent ? { ref: inject } : {\n forwardedRef: inject,\n reactReduxForwardedRef: inject\n }\n const item = {\n compId,\n element: h(NativeComponentWrapper, {\n key: compId,\n getCtx,\n renderComponent (ctx) {\n return h(Component, { ...(ctx.data ||= {}).props, ...refs })\n }\n })\n }\n this.setState({\n components: [...this.state.components, item]\n })\n }\n\n unmount (compId) {\n const components = this.state.components\n const index = components.findIndex(item => item.compId === compId)\n const next = [...components.slice(0, index), ...components.slice(index + 1)]\n this.setState({\n components: next\n })\n }\n\n render () {\n const components = this.state.components\n return (\n components.map(({ element }) => element)\n )\n }\n }\n\n setReconciler()\n\n const app = document.getElementById('app')\n\n ReactDOM.render(\n h(Entry, {}),\n app\n )\n}\n\nexport function createNativeComponentConfig (Component, react: typeof React, reactdom, componentConfig) {\n R = react\n h = react.createElement\n ReactDOM = reactdom\n\n setReconciler()\n\n const componentObj = {\n properties: {\n props: {\n type: null,\n value: null,\n observer (_newVal, oldVal) {\n oldVal && this.component.forceUpdate()\n }\n }\n },\n created () {\n if (!Current.app) {\n initNativeComponentEntry(R, ReactDOM)\n }\n },\n attached () {\n setCurrent()\n this.compId = getNativeCompId()\n this.config = componentConfig\n Current.app!.mount!(Component, this.compId, () => this)\n },\n ready () {\n safeExecute(this.compId, 'onReady')\n },\n detached () {\n Current.app!.unmount!(this.compId)\n },\n pageLifetimes: {\n show () {\n safeExecute(this.compId, 'onShow')\n },\n hide () {\n safeExecute(this.compId, 'onHide')\n }\n },\n methods: {\n eh: eventHandler\n }\n }\n\n function setCurrent () {\n const pages = getCurrentPages()\n const currentPage = pages[pages.length - 1]\n if (Current.page === currentPage) return\n\n Current.page = currentPage\n\n const route = (currentPage as any).route || (currentPage as any).__route__\n const router = {\n params: currentPage.options || {},\n path: addLeadingSlash(route),\n onReady: '',\n onHide: '',\n onShow: ''\n }\n Current.router = router\n\n if (!currentPage.options) {\n // 例如在微信小程序中,页面 options 的设置时机比组件 attached 慢\n Object.defineProperty(currentPage, 'options', {\n enumerable: true,\n configurable: true,\n get () {\n return this._optionsValue\n },\n set (value) {\n router.params = value\n this._optionsValue = value\n }\n })\n }\n }\n\n return componentObj\n}\n","import {\n container,\n SERVICE_IDENTIFIER\n} from '@tarojs/runtime'\nimport * as taroHooks from './hooks'\n\nimport type { IHooks } from '@tarojs/runtime'\n\ndeclare const __TARO_FRAMEWORK__: string\n\nconst hooks = container.get<IHooks>(SERVICE_IDENTIFIER.Hooks)\n\nhooks.initNativeApiImpls ||= []\nhooks.initNativeApiImpls.push(function (taro) {\n for (const hook in taroHooks) {\n taro[hook] = taroHooks[hook]\n }\n})\n\nif (__TARO_FRAMEWORK__ === 'preact') {\n hooks.modifyMpEventImpls?.push(e => {\n if (e.type === 'tap') e.type = 'click'\n })\n hooks.modifyDispatchEventImpls?.push(e => {\n const type = e.type\n e.type = type[0].toUpperCase() + type.slice(1)\n })\n}\n\nexport * from './hooks'\nexport * from './connect'\nexport * from './connect-native'\n"],"names":["R","h","ReactDOM","hooks","React","taroHooks"],"mappings":";;;AAKO,MAAM,YAAY,GAAG,UAAU,CAAA;SAEtB,gBAAgB,CAAE,CAAe,EAAE,SAAS;IAC1D,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAA;IAErC,QACE,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC;QAC5B,CAAC,EAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,gBAAgB,CAAA;QAC7B,SAAS,YAAY,CAAC,CAAC,SAAS;MACjC;AACH,CAAC;SAEe,aAAa,CAAK,IAAa;IAC7C,IAAI,OAAO,CAAC,IAA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AAC,CAAA;SACH;KACF;IAED,OAAO,YAAY,CAAA;AACrB;;;AChMA,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAS,kBAAkB,CAAC,KAAK,CAAC,CAAA;AAE7D,KAAK,CAAC,kBAAkB,KAAxB,KAAK,CAAC,kBAAkB,GAAK,EAAE,EAAA;AAC/B,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,IAAI;IAC1C,KAAK,MAAM,IAAI,IAAIC,WAAS,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,GAAGA,WAAS,CAAC,IAAI,CAAC,CAAA;KAC7B;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,kBAAkB,KAAK,QAAQ,EAAE;IACnC,MAAA,KAAK,CAAC,kBAAkB,0CAAE,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK;YAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAAA;KACvC,CAAC,CAAA;IACF,MAAA,KAAK,CAAC,wBAAwB,0CAAE,IAAI,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAA;QACnB,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KAC/C,CAAC,CAAA;;;;;"}
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tarojs/plugin-framework-react",
|
|
3
|
+
"version": "3.4.0-beta.0",
|
|
4
|
+
"description": "React/Preact/Nerv 框架插件",
|
|
5
|
+
"author": "drchan",
|
|
6
|
+
"homepage": "https://github.com/nervjs/taro",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"taro"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js",
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/NervJS/taro.git"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rollup -c",
|
|
22
|
+
"dev": "rollup -c -w"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/NervJS/taro/issues"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
|
|
29
|
+
"@prefresh/webpack": "^3.2.3",
|
|
30
|
+
"@tarojs/runtime": "3.4.0-beta.0",
|
|
31
|
+
"@tarojs/shared": "3.4.0-beta.0",
|
|
32
|
+
"acorn": "^8.0.4",
|
|
33
|
+
"acorn-walk": "^8.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@tarojs/service": "3.4.0-beta.0",
|
|
37
|
+
"@tarojs/taro": "3.4.0-beta.0"
|
|
38
|
+
}
|
|
39
|
+
}
|