@ray-js/builder-mp 0.5.10 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/lib/build.js CHANGED
@@ -62,7 +62,12 @@ function build(options, context) {
62
62
  if (debug) {
63
63
  process.env.REMAX_DEBUG = 'true'; // ray 运行时日志
64
64
  }
65
- const outputPath = (0, shared_1.resolvePath)([output, target], { cwd });
65
+ let outputTarget = target;
66
+ // 适配
67
+ if (target === 'thing') {
68
+ outputTarget = 'tuya';
69
+ }
70
+ const outputPath = (0, shared_1.resolvePath)([output, outputTarget], { cwd });
66
71
  shared_1.log.info(LOG_PREFIX, '@ray-core/cli:'.green, `v${package_json_1.default.version}`);
67
72
  shared_1.log.info(LOG_PREFIX, 'cwd:'.green, cwd.underline);
68
73
  shared_1.log.info(LOG_PREFIX, 'outputDir:'.green, outputPath.underline);
@@ -156,35 +161,35 @@ function build(options, context) {
156
161
  .use('env-loader')
157
162
  .loader(require.resolve('@ray-js/env-loader'))
158
163
  .options({ platform: target })
164
+ .end()
165
+ .end()
166
+ // context
167
+ .rule('ray-context')
168
+ .test(moduleMatcher)
169
+ .include.add(path_1.default.join(builder_1.builder.options.cwd, builder_1.builder.options.source))
170
+ .end()
171
+ .exclude.add((m) => /\.rjs/i.test(m))
172
+ .end()
173
+ .pre()
174
+ .use('context-loader')
175
+ .loader(require.resolve('babel-loader'))
176
+ .options({
177
+ babelrc: false,
178
+ presets: ['@babel/preset-typescript'],
179
+ plugins: [
180
+ // 对项目下的文件进行 context 实例的包裹 透传如 pageConfig appConfig
181
+ [require.resolve('./babel/plugins/ray-page-context/index')],
182
+ '@babel/plugin-syntax-jsx',
183
+ [
184
+ '@babel/plugin-proposal-decorators',
185
+ {
186
+ legacy: true,
187
+ },
188
+ ],
189
+ ],
190
+ })
159
191
  .end()
160
192
  .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()
188
193
  config.module
189
194
  .rule('rjs')
190
195
  .test(/\.rjs$/)
@@ -211,9 +216,9 @@ function build(options, context) {
211
216
  // FIXME: ray 支持注册其他平台适配器
212
217
  remaxApi.registerAdapterPlugins = function (target) {
213
218
  // @ts-ignore
214
- if (target === 'tuya') {
219
+ if (target === 'thing') {
215
220
  this.adapter.target = target;
216
- this.adapter.packageName = '@ray-js/remax-tuya';
221
+ this.adapter.packageName = '@ray-js/adapter';
217
222
  const packagePath = this.adapter.packageName + '/node';
218
223
  let plugin = require(packagePath).default || require(packagePath);
219
224
  plugin = typeof plugin === 'function' ? plugin() : plugin;
@@ -1,7 +1,7 @@
1
1
  import Config from 'webpack-chain';
2
- declare const _default: (config: Config) => void;
3
2
  /**
4
3
  * 小程序框架启动, 在文件顶部增加 .ray/main.mini 的适配
5
4
  * 读取 TabBar 信息,注册页面到 router 上。实现 web 路由的跳转
6
5
  */
6
+ declare const _default: (config: Config) => void;
7
7
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/builder-mp",
3
- "version": "0.5.10",
3
+ "version": "0.6.0",
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/remax-tuya": "^0.5.10",
32
- "@ray-js/shared": "^0.5.10",
33
- "@ray-js/types": "^0.5.10",
31
+ "@ray-js/adapter": "^0.6.0",
32
+ "@ray-js/shared": "^0.6.0",
33
+ "@ray-js/types": "^0.6.0",
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": "955dd59a037cbfbafd76f6f8f82d74d447e6a152",
64
+ "gitHead": "d7e74c750c02eda67af6e54da93aad14d001acb3",
65
65
  "repository": {}
66
66
  }