bajo-template 1.1.5 → 1.1.6

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.
@@ -16,8 +16,7 @@ export function filecheck ({ check, dir, base, exts }) {
16
16
  }
17
17
 
18
18
  function resolveResource (type, item = '', opts = {}, fallbackHandler) {
19
- const { getPluginDataDir } = this.app.bajo
20
- const { trim, uniq } = this.lib._
19
+ const { trim, uniq, find } = this.lib._
21
20
  const env = this.app.bajo.config.env
22
21
  if (env !== 'dev' && cache[item]) return cache[item]
23
22
 
@@ -32,18 +31,8 @@ function resolveResource (type, item = '', opts = {}, fallbackHandler) {
32
31
 
33
32
  const extension = subSubNs ? `extend/${subSubNs}/` : ''
34
33
  let file
35
- // check override: theme specific
36
- if (opts.theme) {
37
- const check = `${getPluginDataDir(ns)}/${this.name}/${extension}${type}/_${opts.theme}`
38
- file = filecheck.call(this, { dir, base, exts, check })
39
- }
40
- // check override: common
41
- if (!file) {
42
- const check = `${getPluginDataDir(ns)}/${this.name}/${extension}${type}`
43
- file = filecheck.call(this, { dir, base, exts, check })
44
- }
45
34
  // check main override: theme specific
46
- if (opts.theme && !file) {
35
+ if (opts.theme) {
47
36
  const check = `${this.app.main.dir.pkg}/${this.name}/extend/${ns}/${type}/_${opts.theme}`
48
37
  file = filecheck.call(this, { dir, base, exts, check })
49
38
  }
@@ -52,6 +41,14 @@ function resolveResource (type, item = '', opts = {}, fallbackHandler) {
52
41
  const check = `${this.app.main.dir.pkg}/${this.name}/extend/${ns}/${type}`
53
42
  file = filecheck.call(this, { dir, base, exts, check })
54
43
  }
44
+ // check override: theme specific
45
+ if (opts.theme && !file) {
46
+ const theme = find(this.app.waibuMpa.themes, { name: opts.theme })
47
+ if (theme) {
48
+ const check = `${theme.plugin.dir.pkg}/${this.name}/extend/${ns}/${extension}${type}`
49
+ file = filecheck.call(this, { dir, base, exts, check })
50
+ }
51
+ }
55
52
  // check real: theme specific
56
53
  if (opts.theme && !file) {
57
54
  const check = `${this.app[ns].dir.pkg}/${this.name}/${extension}${type}/_${opts.theme}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo-template",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Template Renderer for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin/factory.js CHANGED
@@ -65,7 +65,10 @@ async function factory (pkgName) {
65
65
  const { last } = this.lib._
66
66
  if (opts.groupId) {
67
67
  if (this.loopDetector[opts.groupId]) {
68
- if (last(this.loopDetector[opts.groupId].file) === file && path.basename(file)[0] !== '~') throw this.error('loopDetected%s%s', tpl, file)
68
+ if (last(this.loopDetector[opts.groupId].file) === file && path.basename(file)[0] !== '~') {
69
+ // console.log(opts.groupId, this.loopDetector)
70
+ throw this.error('loopDetected%s%s', tpl, file)
71
+ }
69
72
  this.loopDetector[opts.groupId].file.push(file)
70
73
  } else {
71
74
  this.loopDetector[opts.groupId] = {