bajo-template 1.2.5 → 2.0.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/index.js CHANGED
@@ -5,7 +5,7 @@ import path from 'path'
5
5
  async function factory (pkgName) {
6
6
  const me = this
7
7
 
8
- return class BajoTemplate extends this.lib.BajoPlugin {
8
+ return class BajoTemplate extends this.lib.Plugin {
9
9
  constructor () {
10
10
  super(pkgName, me.app)
11
11
  this.alias = 'tpl'
@@ -205,7 +205,7 @@ async function factory (pkgName) {
205
205
  const subNses = ['layout', 'template', 'partial']
206
206
  const { ns, path, subNs, subSubNs, qs } = this.app.bajo.breakNsPath(name)
207
207
  const plugin = this.app.bajo.getPlugin(ns)
208
- const dir = `${plugin.dir.pkg}/bajoTemplate`
208
+ const dir = `${plugin.dir.pkg}/extend/bajoTemplate`
209
209
  if (!subNses.includes(subNs)) throw this.error('unknownResource%s', name)
210
210
  const fullPath = subSubNs ? `${dir}/${subSubNs}/${subNs}${path}` : `${dir}/${subNs}${path}`
211
211
  return { ns, subNs, subSubNs, path, qs, fullPath }
@@ -285,27 +285,27 @@ async function factory (pkgName) {
285
285
  if (!this.config.layout.fallback) return false
286
286
  // check main: theme specific
287
287
  if (theme && !file) {
288
- const check = `${this.app.main.dir.pkg}/${this.name}/${type}/_${theme}`
288
+ const check = `${this.app.main.dir.pkg}/extend/${this.name}/${type}/_${theme}`
289
289
  file = filecheck.call(this, { dir, base, exts, check })
290
290
  }
291
291
  // check main: common
292
292
  if (!file) {
293
- const check = `${this.app.main.dir.pkg}/${this.name}/${type}`
293
+ const check = `${this.app.main.dir.pkg}/extend/${this.name}/${type}`
294
294
  file = filecheck.call(this, { dir, base, exts, check })
295
295
  }
296
296
  if (theme && !file) {
297
297
  const otheme = find(this.app.waibuMpa.themes, { name: theme })
298
- const check = `${otheme.plugin.dir.pkg}/${this.name}/extend/${this.name}/${type}`
298
+ const check = `${otheme.plugin.dir.pkg}/extend/${this.name}/extend/${this.name}/${type}`
299
299
  file = filecheck.call(this, { dir, base, exts, check })
300
300
  }
301
301
  // check fallback: common
302
302
  if (!file) {
303
- const check = `${this.app[ns].dir.pkg}/${this.name}/${subSubNs ? (subSubNs + '/') : ''}${type}`
303
+ const check = `${this.app[ns].dir.pkg}/extend/${this.name}/${subSubNs ? (subSubNs + '/') : ''}${type}`
304
304
  file = filecheck.call(this, { dir, base, exts, check })
305
305
  }
306
306
  // check general fallback
307
307
  if (!file) {
308
- const check = `${this.dir.pkg}/${this.name}/${subSubNs ? (subSubNs + '/') : ''}${type}`
308
+ const check = `${this.dir.pkg}/extend/${this.name}/${subSubNs ? (subSubNs + '/') : ''}${type}`
309
309
  file = filecheck.call(this, { dir, base, exts, check })
310
310
  }
311
311
  return file
@@ -34,30 +34,30 @@ function resolveResource (type, item = '', opts = {}, fallbackHandler) {
34
34
  let file
35
35
  // check main override: theme specific
36
36
  if (opts.theme) {
37
- const check = `${this.app.main.dir.pkg}/${this.name}/extend/${ns}/${type}/_${opts.theme}`
37
+ const check = `${this.app.main.dir.pkg}/extend/${this.name}/extend/${ns}/${type}/_${opts.theme}`
38
38
  file = filecheck.call(this, { dir, base, exts, check })
39
39
  }
40
40
  // check main override: common
41
41
  if (!file) {
42
- const check = `${this.app.main.dir.pkg}/${this.name}/extend/${ns}/${type}`
42
+ const check = `${this.app.main.dir.pkg}/extend/${this.name}/extend/${ns}/${type}`
43
43
  file = filecheck.call(this, { dir, base, exts, check })
44
44
  }
45
45
  // check override: theme specific
46
46
  if (opts.theme && !file) {
47
47
  const theme = find(this.app.waibuMpa.themes, { name: opts.theme })
48
48
  if (theme) {
49
- const check = `${theme.plugin.dir.pkg}/${this.name}/extend/${ns}/${extension}${type}`
49
+ const check = `${theme.plugin.dir.pkg}/extend/${this.name}/extend/${ns}/${extension}${type}`
50
50
  file = filecheck.call(this, { dir, base, exts, check })
51
51
  }
52
52
  }
53
53
  // check real: theme specific
54
54
  if (opts.theme && !file) {
55
- const check = `${this.app[ns].dir.pkg}/${this.name}/${extension}${type}/_${opts.theme}`
55
+ const check = `${this.app[ns].dir.pkg}/extend/${this.name}/${extension}${type}/_${opts.theme}`
56
56
  file = filecheck.call(this, { dir, base, exts, check })
57
57
  }
58
58
  // check real: common
59
59
  if (!file) {
60
- const check = `${this.app[ns].dir.pkg}/${this.name}/${extension}${type}`
60
+ const check = `${this.app[ns].dir.pkg}/extend/${this.name}/${extension}${type}`
61
61
  file = filecheck.call(this, { dir, base, exts, check })
62
62
  }
63
63
  if (fallbackHandler) file = fallbackHandler.call(this, { file, dir, base, exts, ns, subSubNs, type, theme: opts.theme })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo-template",
3
- "version": "1.2.5",
3
+ "version": "2.0.0",
4
4
  "description": "Template Renderer for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
File without changes
File without changes