-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
91 lines (69 loc) · 1.96 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use strict';
global.feather = module.exports = require('fis3');
if(!('EventEmitter' in process)){
process.EventEmitter = require('events');
}
//feather default config
feather.config.merge({
namespace: '',
component: {
ext: ['.js', '.css'],
dir: 'components'
},
project: {
fileType: {
text: 'phtml',
js: [],
css: ['less']
},
charset: 'utf-8',
ignore: ['node_modules/**', 'output/**', '.git/**']
},
template: {
suffix: 'html',
mustache: false
},
autoPack: {
type: false, //可选 combo, 关闭 false
options: {
syntax: ['??', ','],
onlyUnPackFile: true,
maxUrlLength: 2000
}
},
require: {
config: {}
},
statics: '/static',
preprocessor: ['label-analyse'],
postprocessor: [require('feather2-postprocessor-analyse')],
prepackager: [require('feather2-prepackager-framework')],
packager: [require('feather2-packager-map')],
postpackager: ['loader'],
server: {
type: 'node',
clean: true
}
});
feather.media('dev').set('project.domain', '');
require('./lib/util.js');
//require cli.js overwrite fis-cli.js
require('./cli.js');
feather.compile = require('./lib/compile.js');
//lookup查找规则 如果是非/|.开头的文件,查找时,优先按照相对路径处理,找不到,按照相对于根目录处理
//以便统一所有情况
var lookup = feather.project.lookup;
feather.project.lookup = function(path, file){
var info = lookup(path, file);
if((!info.file || !info.file.isFile()) && file && !/^[./]/.test(info.rest) && !/:\/\//.test(info.rest)){
return lookup(path);
}
return info;
};
feather.cache.clean = function(name){
name = name || '';
var path = fis.project.getCachePath(name);
if (fis.util.exists(path)) {
feather.util.delAsync(path);
}
};