@ray-js/builder-mp 1.3.0-beta.3 → 1.3.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/lib/build.rjs.js CHANGED
@@ -21,9 +21,7 @@ class RjsBuild {
21
21
  this.options = options;
22
22
  this.parent = parent;
23
23
  this.initRjsBuilder();
24
- parent.hooks.afterCompile.tap(LOG_PREFIX_RJS, () => {
25
- this.run();
26
- });
24
+ this.run();
27
25
  }
28
26
  createWebpackConfig() {
29
27
  const { cwd, output, mini, target } = this.options;
@@ -49,6 +47,21 @@ class RjsBuild {
49
47
  .options({
50
48
  configFile: path_1.default.resolve(__dirname, './babel/configs/babel.config.js'),
51
49
  });
50
+ config.module
51
+ .rule('image-sources')
52
+ .test(/\.(png|jpe?g|gif|svg)$/i)
53
+ // @ts-ignore
54
+ .type('asset')
55
+ .parser({
56
+ dataUrlCondition: {
57
+ maxSize: 8 * 1024,
58
+ },
59
+ });
60
+ config.module
61
+ .rule('font-sources')
62
+ .test(/\.(ttf|eot|woff|woff2)$/)
63
+ // @ts-ignore
64
+ .type('asset/resource');
52
65
  config.output
53
66
  .set('filename', '[name].rjs')
54
67
  .set('libraryTarget', 'commonjs2')
@@ -124,19 +137,21 @@ class RjsBuild {
124
137
  }
125
138
  run() {
126
139
  const cb = this.runOrWatch();
127
- if (this.options.watch) {
128
- if (!this.watcher) {
129
- this.watcher = this.compiler.watch({}, cb);
140
+ this.parent.hooks.afterCompile.tap(LOG_PREFIX_RJS, () => {
141
+ if (this.options.watch) {
142
+ if (!this.watcher) {
143
+ this.watcher = this.compiler.watch({}, cb);
144
+ }
145
+ else {
146
+ this.watcher.close(() => {
147
+ this.watcher = this.compiler.watch({}, cb);
148
+ });
149
+ }
130
150
  }
131
151
  else {
132
- this.watcher.close(() => {
133
- this.watcher = this.compiler.watch({}, cb);
134
- });
152
+ this.compiler.run(cb);
135
153
  }
136
- }
137
- else {
138
- this.compiler.run(cb);
139
- }
154
+ });
140
155
  return this.compiler;
141
156
  }
142
157
  }
@@ -167,7 +167,9 @@ class WorkerBuild {
167
167
  });
168
168
  }
169
169
  else {
170
- this.compiler.run(cb);
170
+ this.parent.hooks.afterCompile.tap(LOG_PREFIX_WORKER, () => {
171
+ this.compiler.run(cb);
172
+ });
171
173
  }
172
174
  return this.compiler;
173
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/builder-mp",
3
- "version": "1.3.0-beta.3",
3
+ "version": "1.3.0",
4
4
  "description": "Ray builder for mini program",
5
5
  "keywords": [
6
6
  "ray"
@@ -21,17 +21,19 @@
21
21
  "test": "jest"
22
22
  },
23
23
  "dependencies": {
24
+ "@babel/plugin-proposal-private-methods": "^7.18.6",
25
+ "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
24
26
  "@babel/template": "^7.16.0",
25
27
  "@babel/traverse": "^7.16.3",
26
28
  "@babel/types": "^7.16.0",
27
- "@ray-core/babel-preset-remax": "^0.3.0-beta.4",
28
- "@ray-core/build-store": "^0.3.0-beta.4",
29
- "@ray-core/cli": "^0.3.0-beta.4",
30
- "@ray-core/ray": "^0.3.0-beta.4",
31
- "@ray-js/adapter": "^1.3.0-beta.3",
29
+ "@ray-core/babel-preset-remax": "^0.3.0",
30
+ "@ray-core/build-store": "^0.3.0",
31
+ "@ray-core/cli": "^0.3.0",
32
+ "@ray-core/ray": "^0.3.0",
33
+ "@ray-js/adapter": "^1.3.0",
32
34
  "@ray-js/rjs-for-wechat": "^0.0.3",
33
- "@ray-js/shared": "^1.3.0-beta.3",
34
- "@ray-js/types": "^1.3.0-beta.3",
35
+ "@ray-js/shared": "^1.3.0",
36
+ "@ray-js/types": "^1.3.0",
35
37
  "babel-loader": "^8.2.3",
36
38
  "babel-plugin-minify-dead-code-elimination": "^0.5.1",
37
39
  "babel-plugin-transform-prune-unused-imports": "^1.0.1",
@@ -48,7 +50,7 @@
48
50
  "webpack-virtual-modules": "^0.4.4"
49
51
  },
50
52
  "devDependencies": {
51
- "@ray-core/types": "^0.3.0-beta.4",
53
+ "@ray-core/types": "^0.3.0",
52
54
  "@types/jest": "^27.0.2",
53
55
  "@types/node": "^16.9.1",
54
56
  "babel-plugin-tester": "^10.1.0",
@@ -62,6 +64,6 @@
62
64
  "email": "tuyafe@tuya.com"
63
65
  }
64
66
  ],
65
- "gitHead": "be72a5dad6214ebf9c6653df02956374c735c98e",
67
+ "gitHead": "f7f96c375a429a2fa94452b0a9af3f841572921a",
66
68
  "repository": {}
67
69
  }