@plotdb/srcbuild 0.0.32 → 0.0.36
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/README.md +4 -0
- package/dist/ext/bundle.js +17 -1
- package/dist/ext/pug.js +2 -2
- package/dist/lib.pug +10 -8
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -97,6 +97,10 @@ Except common options, each builder may support different options:
|
|
|
97
97
|
- *NOTE* this is an experiment feature and may be removed ( move to standalone builder ) in the future.
|
|
98
98
|
- `bundle`: bundle options. includes:
|
|
99
99
|
- `configFile`: json file storing bundle configuration. optional.
|
|
100
|
+
- `relativePath`: use relative path for paths in config file. default false. possible values:
|
|
101
|
+
- `false`: all files in `configFile` are relative to current working directory.
|
|
102
|
+
- `true`: all files in `configFile` are relative to the directory containing `bundle.json`
|
|
103
|
+
- or, specific a path as the relative root.
|
|
100
104
|
- `config`: bundle configuration in following format:
|
|
101
105
|
{
|
|
102
106
|
"css": {
|
package/dist/ext/bundle.js
CHANGED
|
@@ -16,6 +16,11 @@ bundlebuild = function(opt){
|
|
|
16
16
|
js: {}
|
|
17
17
|
};
|
|
18
18
|
this.configFile = opt.configFile || null;
|
|
19
|
+
this._relativePath = !(opt.relativePath != null)
|
|
20
|
+
? false
|
|
21
|
+
: typeof opt.relativePath === 'string'
|
|
22
|
+
? opt.relativePath
|
|
23
|
+
: this.configFile ? path.dirname(this.configFile) : false;
|
|
19
24
|
this.prepareConfig();
|
|
20
25
|
return this.init(import$({
|
|
21
26
|
srcdir: 'static',
|
|
@@ -24,10 +29,18 @@ bundlebuild = function(opt){
|
|
|
24
29
|
};
|
|
25
30
|
bundlebuild.prototype = import$(Object.create(base.prototype), {
|
|
26
31
|
prepareConfig: function(){
|
|
27
|
-
var type, name, ref$, list, i$, len$, f;
|
|
32
|
+
var type, name, ref$, list, i$, len$, f, this$ = this;
|
|
28
33
|
if (this.configFile && fs.existsSync(this.configFile)) {
|
|
29
34
|
this.config = JSON.parse(fs.readFileSync(this.configFile).toString());
|
|
30
35
|
}
|
|
36
|
+
if (typeof this._relativePath === 'string') {
|
|
37
|
+
for (type in this.config) {
|
|
38
|
+
for (name in ref$ = this.config[type]) {
|
|
39
|
+
list = ref$[name];
|
|
40
|
+
this.config[type][name] = list.map(fn$);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
this.fileList = new Set();
|
|
32
45
|
this.fileMap = {};
|
|
33
46
|
for (type in this.config) {
|
|
@@ -44,6 +57,9 @@ bundlebuild.prototype = import$(Object.create(base.prototype), {
|
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
return this.fileList.add(this.configFile);
|
|
60
|
+
function fn$(f){
|
|
61
|
+
return path.join(this$._relativePath, f);
|
|
62
|
+
}
|
|
47
63
|
},
|
|
48
64
|
getDependencies: function(file){
|
|
49
65
|
return file === this.configFile
|
package/dist/ext/pug.js
CHANGED
|
@@ -109,13 +109,13 @@ pugbuild.prototype = import$(Object.create(base.prototype), {
|
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
111
|
'md': function(text, opt){
|
|
112
|
-
return marked(text);
|
|
112
|
+
return marked.parse(text);
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
json: function(it){
|
|
116
116
|
return JSON.parse(fs.readFileSync(it));
|
|
117
117
|
},
|
|
118
|
-
md: marked,
|
|
118
|
+
md: marked.parse,
|
|
119
119
|
yaml: function(it){
|
|
120
120
|
return jsYaml.load(fs.readFileSync(it));
|
|
121
121
|
},
|
package/dist/lib.pug
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
libLoader = {
|
|
5
5
|
js: {url: {}},
|
|
6
6
|
css: {url: {}},
|
|
7
|
-
root: function(r) {
|
|
7
|
+
root: function(r) { libLoader._r = r; },
|
|
8
8
|
_r: "/assets/lib",
|
|
9
9
|
_v: "",
|
|
10
10
|
version: function(v) { libLoader._v = (v ? "?v=" + v : ""); }
|
|
@@ -12,28 +12,30 @@
|
|
|
12
12
|
if(version) { libLoader.version(version); }
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
mixin script(os)
|
|
15
|
+
mixin script(os,cfg)
|
|
16
16
|
-
|
|
17
17
|
if(!Array.isArray(os)) { os = [os]; }
|
|
18
18
|
each o in os
|
|
19
19
|
-
|
|
20
|
-
|
|
20
|
+
c = o;
|
|
21
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
21
22
|
else if(o.url) { url = o.url; }
|
|
22
23
|
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.js"); }
|
|
23
24
|
if !libLoader.js.url[url]
|
|
24
25
|
- libLoader.js.url[url] = true;
|
|
25
|
-
- defer = (typeof(
|
|
26
|
+
- defer = (typeof(c.defer) == "undefined" ? true : !!c.defer);
|
|
26
27
|
if /^https?:\/\/./.exec(url)
|
|
27
|
-
script(type="text/javascript",src=url, defer=defer, async=!!
|
|
28
|
+
script(type="text/javascript",src=url, defer=defer, async=!!c.async)
|
|
28
29
|
else
|
|
29
|
-
script(type="text/javascript",src=url + libLoader._v, defer=defer, async=!!
|
|
30
|
+
script(type="text/javascript",src=url + libLoader._v, defer=defer, async=!!c.async)
|
|
30
31
|
|
|
31
|
-
mixin css(os)
|
|
32
|
+
mixin css(os,cfg)
|
|
32
33
|
-
|
|
33
34
|
if(!Array.isArray(os)) { os = [os]; }
|
|
34
35
|
each o in os
|
|
35
36
|
-
|
|
36
|
-
|
|
37
|
+
c = o;
|
|
38
|
+
if(typeof(o) == "string") { url = o; c = cfg || {};}
|
|
37
39
|
else if(o.url) { url = o.url; }
|
|
38
40
|
else { url = libLoader._r + "/" + o.name + "/" + (o.version || 'main') + "/" + (o.path || "index.min.css"); }
|
|
39
41
|
if !libLoader.css.url[url]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "zbryikt",
|
|
3
3
|
"name": "@plotdb/srcbuild",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.36",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"files": [
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"srcbuild-pug": "./dist/pug-cli"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"
|
|
15
|
+
"prepare": "mkdir -p ./node_modules/@plotdb/srcbuild/dist; cp dist/lib.pug ./node_modules/@plotdb/srcbuild/dist/",
|
|
16
|
+
"start": "./node_modules/.bin/lsc watch.ls"
|
|
16
17
|
},
|
|
17
18
|
"license": "MIT",
|
|
18
19
|
"homepage": "https://github.com/plotdb/srcbuild",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"anymatch": "^3.1.2",
|
|
30
31
|
"browserify": "^17.0.0",
|
|
31
32
|
"chokidar": "^3.5.1",
|
|
32
|
-
"colors": "^
|
|
33
|
+
"@plotdb/colors": "^0.0.1",
|
|
33
34
|
"fs-extra": "^9.1.0",
|
|
34
35
|
"glslify": "^7.1.1",
|
|
35
36
|
"i18next": "^19.9.2",
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"i18next-http-middleware": "^3.1.0",
|
|
38
39
|
"js-yaml": "^4.0.0",
|
|
39
40
|
"livescript": "^1.6.0",
|
|
40
|
-
"marked": "^
|
|
41
|
+
"marked": "^4.0.10",
|
|
41
42
|
"pug": "^3.0.2",
|
|
42
43
|
"require-reload": "^0.2.2",
|
|
43
44
|
"stylus": "^0.55.0",
|