@ray-js/builder-mp 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/lib/build.js +29 -3
  2. package/package.json +5 -5
package/lib/build.js CHANGED
@@ -95,6 +95,7 @@ function build(options, context) {
95
95
  });
96
96
  (0, app_entry_1.default)(config);
97
97
  // 删除 clean-webpack-plugin 插件
98
+ config.plugins.delete('clean-webpack-plugin');
98
99
  // 修改 mini-css-extract-plugin 的配置
99
100
  config
100
101
  .plugin('mini-css-extract-plugin')
@@ -113,6 +114,31 @@ function build(options, context) {
113
114
  .use('babel')
114
115
  .tap((options) => {
115
116
  return Object.assign(Object.assign({}, options), { configFile: babelConfigFile });
117
+ })
118
+ .end()
119
+ .end()
120
+ // hooks
121
+ .rule('ray-hooks')
122
+ .test(moduleMatcher)
123
+ .exclude.add((m) => /\.rjs/i.test(m) || /node_modules\/(react|react-reconciler|react-dom)/.test(m))
124
+ .end()
125
+ .pre()
126
+ .use('hooks-loader')
127
+ .loader(require.resolve('babel-loader'))
128
+ .options({
129
+ babelrc: false,
130
+ presets: ['@babel/preset-typescript'],
131
+ plugins: [
132
+ // 替换 usePageEvent useAppEvent hooks api 模块名
133
+ [require.resolve('./babel/plugins/ray-hooks/index')],
134
+ '@babel/plugin-syntax-jsx',
135
+ [
136
+ '@babel/plugin-proposal-decorators',
137
+ {
138
+ legacy: true,
139
+ },
140
+ ],
141
+ ],
116
142
  })
117
143
  .end()
118
144
  .end()
@@ -129,7 +155,8 @@ function build(options, context) {
129
155
  .options({ platform: target })
130
156
  .end()
131
157
  .end()
132
- .rule('ray-context-hooks')
158
+ // context
159
+ .rule('ray-context')
133
160
  .test(moduleMatcher)
134
161
  .include.add(path_1.default.join(builder_1.builder.options.cwd, builder_1.builder.options.source))
135
162
  .end()
@@ -144,8 +171,6 @@ function build(options, context) {
144
171
  plugins: [
145
172
  // 对项目下的文件进行 context 实例的包裹 透传如 pageConfig appConfig
146
173
  [require.resolve('./babel/plugins/ray-page-context/index')],
147
- // 替换 usePageEvent useAppEvent hooks api 模块名
148
- [require.resolve('./babel/plugins/ray-hooks/index')],
149
174
  '@babel/plugin-syntax-jsx',
150
175
  [
151
176
  '@babel/plugin-proposal-decorators',
@@ -155,6 +180,7 @@ function build(options, context) {
155
180
  ],
156
181
  ],
157
182
  })
183
+ .end()
158
184
  .end();
159
185
  config.module
160
186
  .rule('rjs')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/builder-mp",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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.4",
29
29
  "@ray-core/cli": "^0.0.4",
30
30
  "@ray-core/ray": "^0.0.4",
31
- "@ray-js/remax-tuya": "^0.5.0",
32
- "@ray-js/shared": "^0.5.0",
33
- "@ray-js/types": "^0.5.0",
31
+ "@ray-js/remax-tuya": "^0.5.1",
32
+ "@ray-js/shared": "^0.5.1",
33
+ "@ray-js/types": "^0.5.1",
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": "5f49ac5a276532472d10aa60ec21c9a5f0b28ce8",
64
+ "gitHead": "d6cf331f1dd9e36dd7df0007e70dd601429c95d5",
65
65
  "repository": {}
66
66
  }