Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
makers.forEach(maker => {
let target = maker.getTarget();
let out = path.normalize("/" + target.getOutputDir());
app.use(out, express.static(target.getOutputDir()));
appsData.push({
target: {
type: target.getType(),
outputDir: out
},
apps: maker.getApplications()
.filter(app => app.getStandalone())
.map(app => ({
isBrowser: app.isBrowserApp(),
name: app.getName(),
type: app.getType(),
title: app.getTitle() || app.getName(),
appClass: app.getClassName(),
description: app.getDescription(),
outputPath: target.getProjectDir(app) // no trailing slash or link will break
.forEach((file: string) => {
let controller = uRequire(file);
assert(
isSubClass(controller, BaseContext),
`[controller must export a subclass of Daruk.BaseController in path: ${file}`
);
let RoutePath = file.replace(normalize(path), '').replace(JsTsReg, '');
// 验证类名必须是首字母大写的驼峰形式,并且和路由 path 匹配
const validClassName = RoutePath
// 斜线后面的字母大写, RoutePath 定会有 / 开头
.replace(/\/([a-z])/g, (matches: string, capture: string) => {
return capture.toLocaleUpperCase();
})
// 去除所有斜线
.replace(/\//g, '');
assert(
validClassName === controller.name,
`controller class name should be '${validClassName}' ( CamelCase style and match route path ) in path: ${file}`
);
// 认为 index 文件名对应的路由是 /
RoutePath = RoutePath.replace(/\/index$/g, '/');
routePath2ControllerMap[RoutePath] = controller;
_.forEach(list, function (_name, index) {
var _tempIndex = index;
var _fullPath = upath.normalize(folder + _name);
_localPath.push(_fullPath)
if ( _.isUndefined(assets[_fullPath]) ) {
_errorList.push({
name: _name,
path: _fullPath
})
}
if (_tempIndex === _listSize) {
_count++
}
if (index === _listSize && _count === _folderSize) {
var _omit = _.omit(assets, _localPath);
var _omitSize = _.size(_omit) - 1;
[webpackDist, parcelDist, rollupDist] = dists.map(dist =>
upath.normalize(path.join(dirname, 'electronUserData', dist, 'package.json'))
);
.on('add', (filename) => createFile(path.normalize(filename)))
.on('change', (filename) => updateFile(path.normalize(filename)))
module.exports = function (...arv) {
return upath.normalize(relative(...arv)).replace(/^src\//, '').replace(/node_modules\//g, 'modules/')
}
module.exports = function(document, getFtpSync, skipOnSaveCheck) {
if (document.uri.fsPath.indexOf(ftpconfig.rootPath().fsPath) < 0) return;
var config = ftpconfig.getConfig();
//Should we bother to check for generated file uploads? (also check if the generated files path is set otherwise skip)
if (config.generatedFiles.extensionsToInclude.length > 0) {
//If it's not an auto uploaded generated file it won't start with that directory
if (
!upath.normalize(path.dirname(document.uri.fsPath)).startsWith(
getFtpSync()
.getConfig()
.getGeneratedDir()
)
)
return;
//It's an auto upload generated file
else {
//Let's see if it's an extension we will be supporting!
var extensionCheck = config.generatedFiles.extensionsToInclude.some(
function(str) {
return document.uri.fsPath.endsWith(str);
}
);
if (!extensionCheck) return;
ignored = ignored.map(function (path) {
if (typeof path !== 'string') return path;
return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path));
});
}
ignored = ignored.map(function (path) {
if (typeof path !== 'string') return path;
return upath.normalize(isAbsolute(path) ? path : sysPath.join(cwd, path));
});
}