waibu-mpa 2.6.1 → 2.6.3
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/extend/waibuMpa/route/wmpa.js +5 -2
- package/lib/apply-format.js +3 -2
- package/package.json +1 -1
- package/wiki/CHANGES.md +8 -0
|
@@ -2,7 +2,7 @@ const wmpa = {
|
|
|
2
2
|
url: '/wmpa.js',
|
|
3
3
|
method: 'GET',
|
|
4
4
|
handler: async function (req, reply) {
|
|
5
|
-
const { get, trim } = this.app.lib._
|
|
5
|
+
const { get, trim, cloneDeep } = this.app.lib._
|
|
6
6
|
const { getPluginPrefix } = this.app.waibu
|
|
7
7
|
const { importModule } = this.app.bajo
|
|
8
8
|
const { types: formatTypes, formats } = await importModule('bajo:/lib/formats.js', { asDefaultImport: false })
|
|
@@ -27,7 +27,10 @@ const wmpa = {
|
|
|
27
27
|
rateLimitRetry: 2
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const formatOpts = this.app.bajo.config.intl.format
|
|
30
|
+
const formatOpts = cloneDeep(this.app.bajo.config.intl.format)
|
|
31
|
+
formatOpts.datetime.timeZone = get(req, 'site.setting.sumba.timeZone', 'UTC')
|
|
32
|
+
formatOpts.date.timeZone = get(req, 'site.setting.sumba.timeZone', 'UTC')
|
|
33
|
+
formatOpts.time.timeZone = get(req, 'site.setting.sumba.timeZone', 'UTC')
|
|
31
34
|
const params = { prefix, accessTokenUrl, renderUrl, api, formatOpts, formatTypes, formats }
|
|
32
35
|
return await reply.view('waibuMpa.template:/wmpa.js', params)
|
|
33
36
|
}
|
package/lib/apply-format.js
CHANGED
|
@@ -6,13 +6,14 @@ import buildPage from './build-page.js'
|
|
|
6
6
|
async function applyFormat ({ text, locals = {}, opts = {} } = {}) {
|
|
7
7
|
const { without } = this.app.lib._
|
|
8
8
|
const { ext } = opts
|
|
9
|
+
const isDev = this.app.bajo.config.env === 'dev'
|
|
9
10
|
const viewEngine = this.getViewEngine(ext)
|
|
10
11
|
const exts = without(['.html', ...viewEngine.fileExts], '.js', '.css')
|
|
11
12
|
|
|
12
13
|
if (this.config.emoji && exts.includes(ext)) text = emoji.emojify(text)
|
|
13
14
|
if (exts.includes(ext)) text = await buildPage.call(this, { text, locals, opts })
|
|
14
|
-
if (!opts.partial && this.config.prettier && exts.includes(ext)) text = await prettier.format(text, this.config.prettier)
|
|
15
|
-
if (!opts.partial && this.config.minifier && ['.js', '.css', ...exts].includes(ext)) text = minify(text, this.config.minifier)
|
|
15
|
+
if (!isDev && !opts.partial && this.config.prettier && exts.includes(ext)) text = await prettier.format(text, this.config.prettier)
|
|
16
|
+
if (!isDev && !opts.partial && this.config.minifier && ['.js', '.css', ...exts].includes(ext)) text = minify(text, this.config.minifier)
|
|
16
17
|
return text
|
|
17
18
|
}
|
|
18
19
|
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-02
|
|
4
|
+
|
|
5
|
+
- [2.6.3] Bug fix on ```applyFormat()```. In ```dev``` environment, prettier & minifier should be disabled
|
|
6
|
+
|
|
7
|
+
## 2026-02-22
|
|
8
|
+
|
|
9
|
+
- [2.6.2] Bug fix on frontend's timezone
|
|
10
|
+
|
|
3
11
|
## 2026-02-21
|
|
4
12
|
|
|
5
13
|
- [2.6.1] Bug fix on ```errorHandler```
|