@ray-js/ray 1.3.1-beta.6 → 1.3.1-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ray",
3
- "version": "1.3.1-beta.6",
3
+ "version": "1.3.1-beta.7",
4
4
  "description": "ray",
5
5
  "keywords": [
6
6
  "ray"
@@ -25,10 +25,10 @@
25
25
  "dependencies": {
26
26
  "@ray-core/html2mini-plugin": "0.0.6",
27
27
  "@ray-core/macro": "^0.3.0-beta.6",
28
- "@ray-js/api": "^1.3.1-beta.6",
29
- "@ray-js/capability": "^1.3.1-beta.6",
30
- "@ray-js/components": "^1.3.1-beta.6",
31
- "@ray-js/framework": "^1.3.1-beta.6"
28
+ "@ray-js/api": "^1.3.1-beta.7",
29
+ "@ray-js/capability": "^1.3.1-beta.7",
30
+ "@ray-js/components": "^1.3.1-beta.7",
31
+ "@ray-js/framework": "^1.3.1-beta.7"
32
32
  },
33
33
  "maintainers": [
34
34
  {
@@ -36,6 +36,6 @@
36
36
  "ezmail": "tuyafe@tuya.com"
37
37
  }
38
38
  ],
39
- "gitHead": "f21b81340f5c4b6d9ad576147d5f5857c758a896",
39
+ "gitHead": "3d68284d96ae18ddf2eaffa46f5d3607a51d60f8",
40
40
  "repository": {}
41
41
  }
@@ -15,6 +15,20 @@ const { requireJSFile } = require('@ray-js/shared')
15
15
  const exts = ['json', 'js', 'ts']
16
16
  const names = exts.map((ext) => `strings.${ext}`).concat(exts.map((ext) => `index.${ext}`))
17
17
 
18
+ class I18nPlugin {
19
+ constructor({ i18n, locales }) {
20
+ this.i18n = i18n
21
+ this.locales = locales
22
+ }
23
+
24
+ apply(compiler) {
25
+ compiler.hooks.assetEmitted.tap(pluginName, () => {
26
+ this.i18n.i18nPkgBuilder()
27
+ this.locales.i18nPkgBuilder()
28
+ })
29
+ }
30
+ }
31
+
18
32
  const throttle = function (fn, timeout) {
19
33
  let id
20
34
  return function (...args) {
@@ -134,12 +148,17 @@ module.exports = (ctx) => {
134
148
  return {
135
149
  name: pluginName,
136
150
  setup() {
137
- i18n.i18nPkgBuilder()
138
- locales.i18nPkgBuilder()
139
151
  if (watch) {
152
+ i18n.i18nPkgBuilder()
153
+ locales.i18nPkgBuilder()
140
154
  i18n.i18nWatcherHandle()
141
155
  locales.i18nWatcherHandle()
142
156
  }
143
157
  },
158
+ configWebpack({ config }) {
159
+ if (!watch) {
160
+ config.plugin(pluginName).use(I18nPlugin, [{ i18n, locales }])
161
+ }
162
+ },
144
163
  }
145
164
  }