@ray-js/builder-mp 0.5.8-beta-1 → 0.5.10
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/lib/build.js +57 -59
- package/package.json +5 -5
package/lib/build.js
CHANGED
@@ -62,12 +62,7 @@ function build(options, context) {
|
|
62
62
|
if (debug) {
|
63
63
|
process.env.REMAX_DEBUG = 'true'; // ray 运行时日志
|
64
64
|
}
|
65
|
-
|
66
|
-
// 适配
|
67
|
-
if (target === 'thing') {
|
68
|
-
outputTarget = 'tuya';
|
69
|
-
}
|
70
|
-
const outputPath = (0, shared_1.resolvePath)([output, outputTarget], { cwd });
|
65
|
+
const outputPath = (0, shared_1.resolvePath)([output, target], { cwd });
|
71
66
|
shared_1.log.info(LOG_PREFIX, '@ray-core/cli:'.green, `v${package_json_1.default.version}`);
|
72
67
|
shared_1.log.info(LOG_PREFIX, 'cwd:'.green, cwd.underline);
|
73
68
|
shared_1.log.info(LOG_PREFIX, 'outputDir:'.green, outputPath.underline);
|
@@ -123,30 +118,33 @@ function build(options, context) {
|
|
123
118
|
.end()
|
124
119
|
.end()
|
125
120
|
// hooks
|
126
|
-
.rule('ray-hooks')
|
127
|
-
.test(moduleMatcher)
|
128
|
-
.exclude.add(
|
129
|
-
|
130
|
-
.
|
131
|
-
|
132
|
-
.
|
133
|
-
.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
121
|
+
// .rule('ray-hooks')
|
122
|
+
// .test(moduleMatcher)
|
123
|
+
// .exclude.add(
|
124
|
+
// (m: string) =>
|
125
|
+
// /\.rjs/i.test(m) || /node_modules\/(react|react-reconciler|react-dom)/.test(m)
|
126
|
+
// )
|
127
|
+
// .end()
|
128
|
+
// .pre()
|
129
|
+
// .use('hooks-loader')
|
130
|
+
// .loader(require.resolve('babel-loader'))
|
131
|
+
// .options({
|
132
|
+
// babelrc: false,
|
133
|
+
// presets: ['@babel/preset-typescript'],
|
134
|
+
// plugins: [
|
135
|
+
// // 替换 usePageEvent useAppEvent hooks api 模块名
|
136
|
+
// [require.resolve('./babel/plugins/ray-hooks/index')],
|
137
|
+
// '@babel/plugin-syntax-jsx',
|
138
|
+
// [
|
139
|
+
// '@babel/plugin-proposal-decorators',
|
140
|
+
// {
|
141
|
+
// legacy: true,
|
142
|
+
// },
|
143
|
+
// ],
|
144
|
+
// ],
|
145
|
+
// })
|
146
|
+
// .end()
|
147
|
+
// .end()
|
150
148
|
// env-loader 将 isTuya 根据platform 转成 var isTuya = true 或 false
|
151
149
|
.rule('env-loader')
|
152
150
|
.test(moduleMatcher)
|
@@ -158,35 +156,35 @@ function build(options, context) {
|
|
158
156
|
.use('env-loader')
|
159
157
|
.loader(require.resolve('@ray-js/env-loader'))
|
160
158
|
.options({ platform: target })
|
161
|
-
.end()
|
162
|
-
.end()
|
163
|
-
// context
|
164
|
-
.rule('ray-context')
|
165
|
-
.test(moduleMatcher)
|
166
|
-
.include.add(path_1.default.join(builder_1.builder.options.cwd, builder_1.builder.options.source))
|
167
|
-
.end()
|
168
|
-
.exclude.add((m) => /\.rjs/i.test(m))
|
169
|
-
.end()
|
170
|
-
.pre()
|
171
|
-
.use('context-loader')
|
172
|
-
.loader(require.resolve('babel-loader'))
|
173
|
-
.options({
|
174
|
-
babelrc: false,
|
175
|
-
presets: ['@babel/preset-typescript'],
|
176
|
-
plugins: [
|
177
|
-
// 对项目下的文件进行 context 实例的包裹 透传如 pageConfig appConfig
|
178
|
-
[require.resolve('./babel/plugins/ray-page-context/index')],
|
179
|
-
'@babel/plugin-syntax-jsx',
|
180
|
-
[
|
181
|
-
'@babel/plugin-proposal-decorators',
|
182
|
-
{
|
183
|
-
legacy: true,
|
184
|
-
},
|
185
|
-
],
|
186
|
-
],
|
187
|
-
})
|
188
159
|
.end()
|
189
160
|
.end();
|
161
|
+
// context
|
162
|
+
// .rule('ray-context')
|
163
|
+
// .test(moduleMatcher)
|
164
|
+
// .include.add(path.join(builder.options.cwd!, builder.options.source!))
|
165
|
+
// .end()
|
166
|
+
// .exclude.add((m: string) => /\.rjs/i.test(m))
|
167
|
+
// .end()
|
168
|
+
// .pre()
|
169
|
+
// .use('context-loader')
|
170
|
+
// .loader(require.resolve('babel-loader'))
|
171
|
+
// .options({
|
172
|
+
// babelrc: false,
|
173
|
+
// presets: ['@babel/preset-typescript'],
|
174
|
+
// plugins: [
|
175
|
+
// // 对项目下的文件进行 context 实例的包裹 透传如 pageConfig appConfig
|
176
|
+
// [require.resolve('./babel/plugins/ray-page-context/index')],
|
177
|
+
// '@babel/plugin-syntax-jsx',
|
178
|
+
// [
|
179
|
+
// '@babel/plugin-proposal-decorators',
|
180
|
+
// {
|
181
|
+
// legacy: true,
|
182
|
+
// },
|
183
|
+
// ],
|
184
|
+
// ],
|
185
|
+
// })
|
186
|
+
// .end()
|
187
|
+
// .end()
|
190
188
|
config.module
|
191
189
|
.rule('rjs')
|
192
190
|
.test(/\.rjs$/)
|
@@ -213,9 +211,9 @@ function build(options, context) {
|
|
213
211
|
// FIXME: ray 支持注册其他平台适配器
|
214
212
|
remaxApi.registerAdapterPlugins = function (target) {
|
215
213
|
// @ts-ignore
|
216
|
-
if (target === '
|
214
|
+
if (target === 'tuya') {
|
217
215
|
this.adapter.target = target;
|
218
|
-
this.adapter.packageName = '@ray-js/
|
216
|
+
this.adapter.packageName = '@ray-js/remax-tuya';
|
219
217
|
const packagePath = this.adapter.packageName + '/node';
|
220
218
|
let plugin = require(packagePath).default || require(packagePath);
|
221
219
|
plugin = typeof plugin === 'function' ? plugin() : plugin;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/builder-mp",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.10",
|
4
4
|
"description": "Ray builder for mini program",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -28,9 +28,9 @@
|
|
28
28
|
"@ray-core/build-store": "^0.0.x",
|
29
29
|
"@ray-core/cli": "^0.0.x",
|
30
30
|
"@ray-core/ray": "^0.0.x",
|
31
|
-
"@ray-js/
|
32
|
-
"@ray-js/shared": "^0.5.
|
33
|
-
"@ray-js/types": "^0.5.
|
31
|
+
"@ray-js/remax-tuya": "^0.5.10",
|
32
|
+
"@ray-js/shared": "^0.5.10",
|
33
|
+
"@ray-js/types": "^0.5.10",
|
34
34
|
"babel-loader": "^8.2.3",
|
35
35
|
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
|
36
36
|
"babel-plugin-transform-prune-unused-imports": "^1.0.1",
|
@@ -61,6 +61,6 @@
|
|
61
61
|
"email": "tuyafe@tuya.com"
|
62
62
|
}
|
63
63
|
],
|
64
|
-
"gitHead": "
|
64
|
+
"gitHead": "955dd59a037cbfbafd76f6f8f82d74d447e6a152",
|
65
65
|
"repository": {}
|
66
66
|
}
|