|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / dev / tools / grunt / tools / |
Filename | /home/dev2.destoffenstraat.com/dev/tools/grunt/tools/files-router.js |
Size | 1.84 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 28-Jan-2025 06:45 |
Last accessed | 22-Aug-2025 02:07 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
'use strict';
var defaultConfig = {},
/**
* Generates full path to file.
*
* @param {String} path - relative path to file.
*
* @returns {String} Full path to file
*/
getFullPath = function (path) {
return process.cwd() + '/' + path;
},
/**
* Returns file.
*
* @param {String} path - relative path to file.
*
* @returns {Object|Null} File or NULL
*/
getFile = function (path) {
try {
return require(getFullPath(path));
} catch (error) {
return null;
}
},
/**
* Immediately invoked function.
* Loads user config file.
*/
userConfig = (function () {
try {
return require(process.cwd() + '/grunt-config');
} catch (error) {
return null;
}
})();
module.exports = {
/**
* Loads file.
* Load priority:
* From user config;
* From default config with ".loc" suffix ;
* From default config;
*
* @param {String} alias
*
* @returns {Object} themes file or error
*/
get: function (alias) {
var tmp;
if (userConfig && userConfig[alias]) {
return require(getFullPath(userConfig[alias]));
} else if (tmp = getFile(defaultConfig[alias] + '.loc') || getFile(defaultConfig[alias])) {
return tmp;
} else {
throw new Error('Cannot find file. Alias "' + alias + '" not set. ' +
'Use "filesRouter.set" method to set it.').stack;
}
},
/**
* Sets file alias.
*
* @param {String} alias
* @param {String} path
*/
set: function (alias, path) {
defaultConfig[alias] = path;
}
};
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
'use strict';
var defaultConfig = {},
/**
* Generates full path to file.
*
* @param {String} path - relative path to file.
*
* @returns {String} Full path to file
*/
getFullPath = function (path) {
return process.cwd() + '/' + path;
},
/**
* Returns file.
*
* @param {String} path - relative path to file.
*
* @returns {Object|Null} File or NULL
*/
getFile = function (path) {
try {
return require(getFullPath(path));
} catch (error) {
return null;
}
},
/**
* Immediately invoked function.
* Loads user config file.
*/
userConfig = (function () {
try {
return require(process.cwd() + '/grunt-config');
} catch (error) {
return null;
}
})();
module.exports = {
/**
* Loads file.
* Load priority:
* From user config;
* From default config with ".loc" suffix ;
* From default config;
*
* @param {String} alias
*
* @returns {Object} themes file or error
*/
get: function (alias) {
var tmp;
if (userConfig && userConfig[alias]) {
return require(getFullPath(userConfig[alias]));
} else if (tmp = getFile(defaultConfig[alias] + '.loc') || getFile(defaultConfig[alias])) {
return tmp;
} else {
throw new Error('Cannot find file. Alias "' + alias + '" not set. ' +
'Use "filesRouter.set" method to set it.').stack;
}
},
/**
* Sets file alias.
*
* @param {String} alias
* @param {String} path
*/
set: function (alias, path) {
defaultConfig[alias] = path;
}
};