@zbryikt/template 2.3.29 → 2.3.33

Sign up to get free protection for your applications and to get access to all the features.
package/bin/cli.js CHANGED
@@ -5,7 +5,7 @@ t1 = Date.now();
5
5
  fs = require('fs');
6
6
  path = require('path');
7
7
  yargs = require('yargs');
8
- colors = require('colors');
8
+ colors = require('@plotdb/colors');
9
9
  srcbuild = require('@plotdb/srcbuild');
10
10
  lib = path.dirname(fs.realpathSync(__filename));
11
11
  server = require(lib + "/lib/server");
package/bin/lib/logger.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by LiveScript 1.6.0
2
2
  var colors, logger;
3
- colors = require('colors');
3
+ colors = require('@plotdb/colors');
4
4
  logger = {};
5
5
  [['debug', 'blue'], ['info', 'green'], ['warn', 'yellow'], ['error', 'red']].map(function(n){
6
6
  return logger[n[0]] = function(){
package/bin/lib/server.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var express, path, colors, i18nextHttpMiddleware, open, pug, i18n, logger, server;
3
3
  express = require('express');
4
4
  path = require('path');
5
- colors = require('colors');
5
+ colors = require('@plotdb/colors');
6
6
  i18nextHttpMiddleware = require('i18next-http-middleware');
7
7
  open = require('open');
8
8
  pug = require('@plotdb/srcbuild/dist/view/pug');
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "license": "MIT",
5
5
  "main": "bin/lib/index.js",
6
6
  "description": "simple, quick template for bootstrap a page",
7
- "version": "2.3.29",
7
+ "version": "2.3.33",
8
8
  "files": [
9
9
  "bin/**/*"
10
10
  ],
@@ -21,30 +21,24 @@
21
21
  "start": "./bin/cli.js -o true"
22
22
  },
23
23
  "dependencies": {
24
- "@loadingio/debounce.js": "0.0.1",
25
- "@plotdb/srcbuild": "^0.0.31",
24
+ "@plotdb/srcbuild": "^0.0.36",
25
+ "@plotdb/colors": "^0.0.1",
26
26
  "chokidar": "^3.0.0",
27
- "colors": "^1.3.3",
28
27
  "express": "^4.16.4",
29
28
  "fs-extra": "^8.0.0",
30
29
  "i18next": "^19.8.3",
31
30
  "i18next-fs-backend": "^1.0.7",
32
31
  "i18next-http-middleware": "^3.0.6",
33
- "js-yaml": "^3.13.1",
34
32
  "livescript": "^1.6.0",
35
- "marked": "0.7.0",
36
33
  "open": "^7.3.0",
37
- "pug": "^3.0.2",
38
34
  "require-reload": "^0.2.2",
39
- "stylus": "^0.55.0",
40
- "uglify-js": "=3.2.0",
41
- "uglifycss": "0.0.29",
42
35
  "yargs": "^16.1.0"
43
36
  },
44
37
  "bin": {
45
38
  "server": "./bin/cli.js"
46
39
  },
47
40
  "devDependencies": {
48
- "ldview": "^0.0.2"
41
+ "@loadingio/debounce.js": "^0.0.1",
42
+ "ldview": "^0.2.7"
49
43
  }
50
44
  }
package/bin/lib/view.js DELETED
@@ -1,118 +0,0 @@
1
- // Generated by LiveScript 1.6.0
2
- var fs, path, pug, stylus, livescript, reload, pugExtapi, pugCached, log, engine;
3
- fs = require('fs');
4
- path = require('path');
5
- pug = require('pug');
6
- stylus = require('stylus');
7
- livescript = require('livescript');
8
- reload = require("require-reload")(require);
9
- pugExtapi = {
10
- filters: {
11
- 'lsc': function(text, opt){
12
- return livescript.compile(text, {
13
- bare: true,
14
- header: false
15
- });
16
- },
17
- 'lson': function(text, opt){
18
- return livescript.compile(text, {
19
- bare: true,
20
- header: false,
21
- json: true
22
- });
23
- },
24
- 'stylus': function(text, opt){
25
- return stylus(text).set('filename', 'inline').define('index', function(a, b){
26
- a = (a.string || a.val).split(' ');
27
- return new stylus.nodes.Unit(a.indexOf(b.val));
28
- }).render();
29
- }
30
- }
31
- };
32
- pugCached = {};
33
- log = function(f, opt, t, type, cache){
34
- f = f.replace(opt.basedir, '');
35
- return console.log("[VIEW] " + f + " served in " + t + "ms (" + type + (cache ? ' cached' : '') + ")");
36
- };
37
- engine = function(f, opt, cb){
38
- var lc, intl, viewdir, basedir, pc, t1, mtime, cache, ret, t2, e, p;
39
- lc = {};
40
- if (opt.settings.env === 'development') {
41
- lc.dev = true;
42
- }
43
- lc.cache = true || opt.settings['view cache'];
44
- intl = opt.i18n ? path.join("intl", opt._locals.language) : '';
45
- viewdir = opt.viewdir, basedir = opt.basedir;
46
- pc = path.join(viewdir, intl, f.replace(basedir, '').replace(/\.pug$/, '.js'));
47
- try {
48
- t1 = Date.now();
49
- mtime = fs.statSync(pc).mtime;
50
- cache = false;
51
- ret = pugCached[pc] = !lc.cache || !pugCached[pc] || mtime - pugCached[pc].mtime > 0
52
- ? {
53
- js: reload(pc),
54
- mtime: mtime
55
- }
56
- : (cache = true, pugCached[pc]);
57
- if (!ret.js) {
58
- throw new Error();
59
- }
60
- ret = ret.js(opt);
61
- t2 = Date.now();
62
- if (lc.dev) {
63
- log(f, opt, t2 - t1, 'precompiled', cache);
64
- }
65
- return cb(null, ret);
66
- } catch (e$) {
67
- e = e$;
68
- t1 = Date.now();
69
- mtime = fs.statSync(f).mtime;
70
- p = !lc.cache || !pugCached[f] || (pugCached[f] && mtime - pugCached[f].mtime > 0)
71
- ? new Promise(function(res, rej){
72
- return fs.readFile(f, function(e, b){
73
- if (e) {
74
- return rej(e);
75
- } else {
76
- return res(b);
77
- }
78
- });
79
- }).then(function(buf){
80
- return pugCached[f] = {
81
- buf: buf
82
- };
83
- })
84
- : Promise.resolve(pugCached[f]);
85
- return p.then(function(obj){
86
- var cache, ret, ref$, t2;
87
- if (!(cache = obj.mtime != null && lc.cache)) {
88
- obj.mtime = mtime;
89
- }
90
- ret = pug.render(obj.buf, import$((ref$ = import$({}, opt), ref$.filename = f, ref$.cache = cache, ref$.basedir = basedir, ref$), pugExtapi));
91
- t2 = Date.now();
92
- if (lc.dev) {
93
- log(f, opt, t2 - t1, 'from pug', cache);
94
- }
95
- return cb(null, ret);
96
- })['catch'](function(){
97
- console.log("[VIEW] " + f.replace(opt.basedir, '') + " serve failed.");
98
- return cb(e, null);
99
- });
100
- }
101
- };
102
- engine.opt = function(opt){
103
- opt == null && (opt = {});
104
- if (opt.i18n) {
105
- pugExtapi.i18n = function(it){
106
- return opt.i18n.t(it);
107
- };
108
- return (pugExtapi.filters || (pugExtapi.filters = {})).i18n = function(t, o){
109
- return opt.i18n.t(t);
110
- };
111
- }
112
- };
113
- module.exports = engine;
114
- function import$(obj, src){
115
- var own = {}.hasOwnProperty;
116
- for (var key in src) if (own.call(src, key)) obj[key] = src[key];
117
- return obj;
118
- }