code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
getRegistryByType(key) {
switch (key) {
case 'china':
return 'https://registry.npmmirror.com';
case 'npm':
return 'https://registry.npmjs.org';
default: {
if (/^https?:/.test(key)) {
return key.replace(/\/$/, '');
}
// support .npmrc
const ... | get registryUrl by short name
@param {String} key - short name, support `china / npm / npmrc`, default to read from .npmrc
@return {String} registryUrl | getRegistryByType | javascript | cabloy/cabloy | packages/egg-born-bin/lib/cmd/test-update.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-bin/lib/cmd/test-update.js | MIT |
get() {
const loginInfo = Vue.prototype.$meta.store.getState('auth/loginInfo');
const loginConfig = loginInfo && loginInfo.config;
if (!loginConfig) return config;
return Vue.prototype.$utils.extend({}, config, loginConfig);
} | front base config
@todo welcome to pr
@name config
@property {object} base
@property {string} base.locale='en-us'
@property {boolean} base.jwt=false
@property {object} nprogress
@property {number} nprogress.debounce=500
@property {object} api
@property {string} api.baseURL=''
@property {boolean} api.debounce=200 | get | javascript | cabloy/cabloy | packages/egg-born-front/src/base/mixin/config.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/base/mixin/config.js | MIT |
beforeCreate = function (ctx) {
Object.defineProperty(ctx, '$config', {
get() {
const moduleInfo = ctx.$module.info;
return Vue.prototype.$meta.config.modules[moduleInfo.relativeName];
},
});
} | front base config
@todo welcome to pr
@name config
@property {object} base
@property {string} base.locale='en-us'
@property {boolean} base.jwt=false
@property {object} nprogress
@property {number} nprogress.debounce=500
@property {object} api
@property {string} api.baseURL=''
@property {boolean} api.debounce=200 | beforeCreate | javascript | cabloy/cabloy | packages/egg-born-front/src/base/mixin/config.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/base/mixin/config.js | MIT |
beforeCreate = function (ctx) {
Object.defineProperty(ctx, '$config', {
get() {
const moduleInfo = ctx.$module.info;
return Vue.prototype.$meta.config.modules[moduleInfo.relativeName];
},
});
} | front base config
@todo welcome to pr
@name config
@property {object} base
@property {string} base.locale='en-us'
@property {boolean} base.jwt=false
@property {object} nprogress
@property {number} nprogress.debounce=500
@property {object} api
@property {string} api.baseURL=''
@property {boolean} api.debounce=200 | beforeCreate | javascript | cabloy/cabloy | packages/egg-born-front/src/base/mixin/config.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/base/mixin/config.js | MIT |
get() {
const moduleInfo = ctx.$module.info;
return Vue.prototype.$meta.config.modules[moduleInfo.relativeName];
} | front base config
@todo welcome to pr
@name config
@property {object} base
@property {string} base.locale='en-us'
@property {boolean} base.jwt=false
@property {object} nprogress
@property {number} nprogress.debounce=500
@property {object} api
@property {string} api.baseURL=''
@property {boolean} api.debounce=200 | get | javascript | cabloy/cabloy | packages/egg-born-front/src/base/mixin/config.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/base/mixin/config.js | MIT |
function each(ary, func) {
if (ary) {
var i;
for (i = 0; i < ary.length; i += 1) {
if (ary[i] && func(ary[i], i, ary)) {
break;
}
}
}
} | Helper function for iterating over an array. If the func returns
a true value, it will break out of the loop. | each | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function eachReverse(ary, func) {
if (ary) {
var i;
for (i = ary.length - 1; i > -1; i -= 1) {
if (ary[i] && func(ary[i], i, ary)) {
break;
}
}
}
} | Helper function for iterating over an array backwards. If the func
returns a true value, it will break out of the loop. | eachReverse | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function hasProp(obj, prop) {
return hasOwn.call(obj, prop);
} | Helper function for iterating over an array backwards. If the func
returns a true value, it will break out of the loop. | hasProp | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function getOwn(obj, prop) {
return hasProp(obj, prop) && obj[prop];
} | Helper function for iterating over an array backwards. If the func
returns a true value, it will break out of the loop. | getOwn | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function eachProp(obj, func) {
var prop;
for (prop in obj) {
if (hasProp(obj, prop)) {
if (func(obj[prop], prop)) {
break;
}
}
}
} | Cycles over properties in an object and calls a function for each
property value. If the function returns a truthy value, then the
iteration is stopped. | eachProp | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function mixin(target, source, force, deepStringMixin) {
if (source) {
eachProp(source, function (value, prop) {
if (force || !hasProp(target, prop)) {
if (
deepStringMixin &&
typeof value === 'object' &&
value &&
!isArray(value) &&
... | Simple function to mix in properties from source into target,
but only if target does not already have a property of the same name. | mixin | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function bind(obj, fn) {
return function () {
return fn.apply(obj, arguments);
};
} | Simple function to mix in properties from source into target,
but only if target does not already have a property of the same name. | bind | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function scripts() {
return document.getElementsByTagName('script');
} | Simple function to mix in properties from source into target,
but only if target does not already have a property of the same name. | scripts | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function defaultOnError(err) {
throw err;
} | Simple function to mix in properties from source into target,
but only if target does not already have a property of the same name. | defaultOnError | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function getGlobal(value) {
if (!value) {
return value;
}
var g = global;
each(value.split('.'), function (part) {
g = g[part];
});
return g;
} | Simple function to mix in properties from source into target,
but only if target does not already have a property of the same name. | getGlobal | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function makeError(id, msg, err, requireModules) {
var e = new Error(msg + '\nhttps://requirejs.org/docs/errors.html#' + id);
e.requireType = id;
e.requireModules = requireModules;
if (err) {
e.originalError = err;
}
return e;
} | Constructs an error with a pointer to an URL with more information.
@param {String} id the error ID that maps to an ID on a web page.
@param {String} message human readable error.
@param {Error} [err] the original error, if there is one.
@returns {Error} | makeError | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function newContext(contextName) {
var inCheckLoaded,
Module,
context,
handlers,
checkLoadedTimeoutId,
config = {
//Defaults. Do not set a default for map
//config to speed up normalize(), which
//will run faster if there is no default.
waitSeconds: 7,
... | Constructs an error with a pointer to an URL with more information.
@param {String} id the error ID that maps to an ID on a web page.
@param {String} message human readable error.
@param {Error} [err] the original error, if there is one.
@returns {Error} | newContext | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function trimDots(ary) {
var i, part;
for (i = 0; i < ary.length; i++) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
i -= 1;
} else if (part === '..') {
// If at the start, or previous value is still ..,
// keep them so that when conve... | Trims the . and .. from an array of path segments.
It will keep a leading path segment if a .. will become
the first path segment, to help with module name lookups,
which act like paths, but can be remapped. But the end result,
all paths that use this function should look normalized.
NOTE: this method MODIFIES the inpu... | trimDots | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function normalize(name, baseName, applyMap) {
var pkgMain,
mapValue,
nameParts,
i,
j,
nameSegment,
lastIndex,
foundMap,
foundI,
foundStarMap,
starI,
normalizedBaseParts,
baseParts = baseName && baseName.split('/'),
... | Given a relative module name, like ./something, normalize it to
a real name that can be mapped to a path.
@param {String} name the relative name
@param {String} baseName a real name that the name arg is relative
to.
@param {Boolean} applyMap apply the map config to the value. Should
only be done if this normalization i... | normalize | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function removeScript(name) {
if (isBrowser) {
each(scripts(), function (scriptNode) {
if (
scriptNode.getAttribute('data-requiremodule') === name &&
scriptNode.getAttribute('data-requirecontext') === context.contextName
) {
scriptNode.parentNode.rem... | Given a relative module name, like ./something, normalize it to
a real name that can be mapped to a path.
@param {String} name the relative name
@param {String} baseName a real name that the name arg is relative
to.
@param {Boolean} applyMap apply the map config to the value. Should
only be done if this normalization i... | removeScript | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function hasPathFallback(id) {
var pathConfig = getOwn(config.paths, id);
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
//Pop off the first array value, since it failed, and
//retry
pathConfig.shift();
context.require.undef(id);
//Custom require t... | Given a relative module name, like ./something, normalize it to
a real name that can be mapped to a path.
@param {String} name the relative name
@param {String} baseName a real name that the name arg is relative
to.
@param {Boolean} applyMap apply the map config to the value. Should
only be done if this normalization i... | hasPathFallback | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function splitPrefix(name) {
var prefix,
index = name ? name.indexOf('!') : -1;
if (index > -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
return [prefix, name];
} | Given a relative module name, like ./something, normalize it to
a real name that can be mapped to a path.
@param {String} name the relative name
@param {String} baseName a real name that the name arg is relative
to.
@param {Boolean} applyMap apply the map config to the value. Should
only be done if this normalization i... | splitPrefix | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
var url,
pluginModule,
suffix,
nameParts,
prefix = null,
parentName = parentModuleMap ? parentModuleMap.name : null,
originalName = name,
isDefine = true,
normalizedName = '';
... | Creates a module mapping that includes plugin prefix, module
name, and path. If parentModuleMap is provided it will
also normalize the name via require.normalize()
@param {String} name the module name
@param {String} [parentModuleMap] parent module map
for the module name, used to resolve relative names.
@param {Boole... | makeModuleMap | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function getModule(depMap) {
var id = depMap.id,
mod = getOwn(registry, id);
if (!mod) {
mod = registry[id] = new context.Module(depMap);
}
return mod;
} | Creates a module mapping that includes plugin prefix, module
name, and path. If parentModuleMap is provided it will
also normalize the name via require.normalize()
@param {String} name the module name
@param {String} [parentModuleMap] parent module map
for the module name, used to resolve relative names.
@param {Boole... | getModule | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function on(depMap, name, fn) {
var id = depMap.id,
mod = getOwn(registry, id);
if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) {
if (name === 'defined') {
fn(defined[id]);
}
} else {
mod = getModule(depMap);
if (mod.error && name === 'e... | Creates a module mapping that includes plugin prefix, module
name, and path. If parentModuleMap is provided it will
also normalize the name via require.normalize()
@param {String} name the module name
@param {String} [parentModuleMap] parent module map
for the module name, used to resolve relative names.
@param {Boole... | on | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function onError(err, errback) {
var ids = err.requireModules,
notified = false;
if (errback) {
errback(err);
} else {
each(ids, function (id) {
var mod = getOwn(registry, id);
if (mod) {
//Set error on module, so it skips timeout checks.
... | Creates a module mapping that includes plugin prefix, module
name, and path. If parentModuleMap is provided it will
also normalize the name via require.normalize()
@param {String} name the module name
@param {String} [parentModuleMap] parent module map
for the module name, used to resolve relative names.
@param {Boole... | onError | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function takeGlobalQueue() {
//Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) {
each(globalDefQueue, function (queueItem) {
var id = queueItem[0];
if (typeof id === 'string') {
context.defQueueMap[id] = true;
}
... | Internal method to transfer globalQueue items to this context's
defQueue. | takeGlobalQueue | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function cleanRegistry(id) {
//Clean up machinery used for waiting modules.
delete registry[id];
delete enabledRegistry[id];
} | Internal method to transfer globalQueue items to this context's
defQueue. | cleanRegistry | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function breakCycle(mod, traced, processed) {
var id = mod.map.id;
if (mod.error) {
mod.emit('error', mod.error);
} else {
traced[id] = true;
each(mod.depMaps, function (depMap, i) {
var depId = depMap.id,
dep = getOwn(registry, depId);
//Only ... | Internal method to transfer globalQueue items to this context's
defQueue. | breakCycle | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function checkLoaded() {
var err,
usingPathFallback,
waitInterval = config.waitSeconds * 1000,
//It is possible to disable the wait interval by using waitSeconds of 0.
expired = waitInterval && context.startTime + waitInterval < new Date().getTime(),
noLoads = [],
r... | Internal method to transfer globalQueue items to this context's
defQueue. | checkLoaded | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function callGetModule(args) {
//Skip modules already defined.
if (!hasProp(defined, args[0])) {
getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
}
} | Checks if the module is ready to define itself, and if so,
define it. | callGetModule | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function removeListener(node, func, name, ieName) {
//Favor detachEvent because of IE9
//issue, see attachEvent/addEventListener comment elsewhere
//in this file.
if (node.detachEvent && !isOpera) {
//Probably IE. If not it will throw an error, which will be
//useful to know.
... | Checks if the module is ready to define itself, and if so,
define it. | removeListener | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function getScriptData(evt) {
//Using currentTarget instead of target for Firefox 2.0's sake. Not
//all old browsers will be supported, but this one was easy enough
//to support and still makes sense.
var node = evt.currentTarget || evt.srcElement;
//Remove the listeners once here.
... | Given an event from a script node, get the requirejs info from it,
and then removes the event listeners on the node.
@param {Event} evt
@returns {Object} | getScriptData | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function intakeDefines() {
var args;
//Any defined modules in the global queue, intake them now.
takeGlobalQueue();
//Make sure any remaining defQueue items get properly processed.
while (defQueue.length) {
args = defQueue.shift();
if (args[0] === null) {
return... | Given an event from a script node, get the requirejs info from it,
and then removes the event listeners on the node.
@param {Event} evt
@returns {Object} | intakeDefines | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function fn() {
var ret;
if (value.init) {
ret = value.init.apply(global, arguments);
}
return ret || (value.exports && getGlobal(value.exports));
} | Set a configuration for the context.
@param {Object} cfg config object to integrate. | fn | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function localRequire(deps, callback, errback) {
var id, map, requireMod;
if (options.enableBuildCallback && callback && isFunction(callback)) {
callback.__requireJsBuild = true;
}
if (typeof deps === 'string') {
if (isFunction(callback)) {
... | Set a configuration for the context.
@param {Object} cfg config object to integrate. | localRequire | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function getInteractiveScript() {
if (interactiveScript && interactiveScript.readyState === 'interactive') {
return interactiveScript;
}
eachReverse(scripts(), function (script) {
if (script.readyState === 'interactive') {
return (interactiveScript = script);
}
});
return ... | Does the request to load a module for the browser case.
Make this a separate function to allow other environments
to override it.
@param {Object} context the require context to find state.
@param {String} moduleName the name of the module.
@param {Object} url the URL to the module. | getInteractiveScript | javascript | cabloy/cabloy | packages/egg-born-front/src/vendors/requirejs/require.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-front/src/vendors/requirejs/require.js | MIT |
function tryStringify(arg) {
try {
return JSON.stringify(arg);
} catch (err) {
// Populate the circular error message lazily
if (!CIRCULAR_ERROR_MESSAGE) {
try {
const a = {};
a.a = a;
JSON.stringify(a);
} catch (err) {
CIRCULAR_ERROR_MESSAGE = err.message;
... | based on nodejs util.js
https://github.com/koajs/locales/blob/master/index.js | tryStringify | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
function format(f) {
if (arguments.length === 1) return f;
let str = '';
let a = 1;
let lastPos = 0;
for (let i = 0; i < f.length; ) {
if (f.charCodeAt(i) === 37 /* '%'*/ && i + 1 < f.length) {
if (f.charCodeAt(i + 1) !== 37 /* '%'*/ && a >= arguments.length) {
++i;
continue;
... | based on nodejs util.js
https://github.com/koajs/locales/blob/master/index.js | format | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
function getText(text, value) {
if (arguments.length === 0) return '';
if (!text) return '';
if (arguments.length === 1) {
return text;
}
if (arguments.length === 2) {
if (isObject(value)) {
return formatWithObject(text, value);
}
if (Array.isArray(value)) {
return formatWithArr... | based on koa-locales
https://github.com/koajs/locales/blob/master/index.js | getText | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
} | based on koa-locales
https://github.com/koajs/locales/blob/master/index.js | isObject | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
function formatWithArray(text, values) {
return text.replace(ARRAY_INDEX_RE, function (orignal, matched) {
const index = parseInt(matched);
if (index < values.length) {
return values[index];
}
// not match index, return orignal text
return orignal;
});
} | based on koa-locales
https://github.com/koajs/locales/blob/master/index.js | formatWithArray | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
function formatWithObject(text, values) {
return text.replace(Object_INDEX_RE, function (orignal, matched) {
const value = values[matched];
if (value) {
return value;
}
// not match index, return orignal text
return orignal;
});
} | based on koa-locales
https://github.com/koajs/locales/blob/master/index.js | formatWithObject | javascript | cabloy/cabloy | packages/egg-born-localeutil/src/main.js | https://github.com/cabloy/cabloy/blob/master/packages/egg-born-localeutil/src/main.js | MIT |
async _renderFile({ fileSrc, fileDest, fileDestAlt, data }) {
// site
const site = data.site;
// language
const language = site.language && site.language.current;
// src
const pathIntermediate = await this.getPathIntermediate(language);
const fileName = path.join(pathIntermediate, fileSrc);
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _renderFile | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _socketioPublish({ hotloadFile, article }) {
const message = {
userIdTo: -1,
content: {
mtime: new Date(),
article,
},
};
await this.ctx.bean.io.publish({
path: `/a/cms/hotloadFile/${hotloadFile}`,
message,
messageClass: {
module: 'a-cms',
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _socketioPublish | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
_checkIfPluginEnable({ site, moduleName }) {
const config = site.plugins[moduleName];
return !config || !config.disabled;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _checkIfPluginEnable | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _loadPluginIncludes({ site, language }) {
// if exists
if (site._pluginIncludes) return site._pluginIncludes;
// modulesArray
let pluginIncludes = '';
for (const module of this.app.meta.modulesArray) {
const plugin = this.ctx.bean.util.getProperty(module, 'package.eggBornModule.cms.plugi... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _loadPluginIncludes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _renderCSSJSes({ data, content }) {
data.js('plugins/cms-pluginbase/assets/js/lib/require.min.js');
data.js('plugins/cms-pluginbase/assets/js/lib/regenerator-runtime/runtime.js');
content = await this._renderCSSJS({ data, content, type: 'CSS', items: data._csses });
content = await this._renderCSS... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _renderCSSJSes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _renderCSSJS({ data, content, type, items }) {
if (items.length === 0) return content;
// site
const site = data.site;
// cache
if (!site._cache) site._cache = {};
if (!site._cache[type]) site._cache[type] = {};
const cacheSha = shajs('sha256').update(items.join(',')).digest('hex');
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _renderCSSJS | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _renderEnvs({ data, content }) {
// site
const site = data.site;
// env
const _env = {};
for (const name of Object.keys(data._envs)) {
let value;
const keys = name.split('.');
for (let index = keys.length - 1; index >= 0; index--) {
const key = keys[index];
va... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _renderEnvs | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
resolvePath(pathRoot, fileCurrent, fileName) {
if (!fileName) return pathRoot;
if (fileName.charAt(0) === '.') return path.join(path.dirname(fileCurrent), fileName); // not use path.resolve
return path.join(pathRoot, fileName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | resolvePath | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
getOptions() {
return {
async: true,
cache: true,
compileDebug: this.ctx.app.meta.isTest || this.ctx.app.meta.isLocal,
outputFunctionName: 'echo',
rmWhitespace: true,
};
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getOptions | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
getCurrentLocale({ site }) {
return site.language ? site.language.current : this.ctx.app.config.i18n.defaultLocale;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getCurrentLocale | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
createUtilTime({ site }) {
const self = this;
const _textLocale = this.getCurrentLocale({ site });
return {
now(fmt, locale) {
return self.ctx.bean.util.now(fmt, locale || _textLocale);
},
today(fmt, locale) {
return self.ctx.bean.util.today(fmt, locale || _textLocale);
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | createUtilTime | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
now(fmt, locale) {
return self.ctx.bean.util.now(fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | now | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
today(fmt, locale) {
return self.ctx.bean.util.today(fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | today | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
formatDateTime(date, fmt, locale) {
return self.ctx.bean.util.formatDateTime(date, fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | formatDateTime | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
formatDate(date, sep, locale) {
return self.ctx.bean.util.formatDate(date, sep, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | formatDate | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
formatTime(date, sep, locale) {
return self.ctx.bean.util.formatTime(date, sep, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | formatTime | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async getData({ site }) {
// data
const self = this;
const _csses = [];
const _jses = [];
const _envs = {};
let _pathIntermediate = await this.getPathIntermediate(site.language && site.language.current);
_pathIntermediate = path.join(_pathIntermediate, '/');
const _textLocale = this.getC... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getData | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
require(fileName) {
const _path = self.resolvePath('', this._filename, fileName);
return self.ctx.app.meta.util.requireDynamic(_path);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | require | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
url(fileName, language) {
if (fileName && (fileName.indexOf('http://') === 0 || fileName.indexOf('https://') === 0)) {
return self.ctx.bean.util.escapeURL(fileName);
}
let _path = self.resolvePath('', path.relative(_pathIntermediate, this._filename), fileName);
_path = _path.re... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | url | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
css(fileName) {
_csses.push(self.resolvePath(_pathIntermediate, this._filename, fileName));
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | css | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
js(fileName) {
_jses.push(self.resolvePath(_pathIntermediate, this._filename, fileName));
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | js | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
env(name, value) {
_envs[name] = value;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | env | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
text(...args) {
return self.ctx.text.locale(_textLocale, ...args);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | text | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
formatDateTime(date) {
return this.time.formatDateTime(date, `${site.env.format.date} ${site.env.format.time}`);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | formatDateTime | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
safeHtml(str) {
return self.ctx.helper.shtml(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | safeHtml | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
escapeHtml(str) {
return self.ctx.bean.util.escapeHtml(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | escapeHtml | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
escapeURL(str) {
return self.ctx.bean.util.escapeURL(str);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | escapeURL | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async buildLanguages({ progressId, progressNo = 0 }) {
try {
// time start
const timeStart = new Date();
// site
const site = await this.combineSiteBase();
const languages = site.language ? site.language.items.split(',') : [null];
// progress
const progress0_Total = langua... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | buildLanguages | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async buildLanguage({ language, progressId, progressNo = 0 }) {
try {
// time start
const timeStart = new Date();
// progress
const progress0_Total = 2;
let progress0_progress = 0;
// progress: initialize
if (progressId) {
await this.ctx.bean.progress.update({
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | buildLanguage | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async registerWatchers() {
// info
const watcherInfos = [];
// site
const site = await this.combineSiteBase();
const languages = site.language ? site.language.items.split(',') : [null];
// loop languages
for (const language of languages) {
// info
const watcherInfo = await this._... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | registerWatchers | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async registerWatcher({ language }) {
// info
const watcherInfo = await this._collectWatcher({ language });
// register
this.app.meta['a-cms:watcher'].register(watcherInfo);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | registerWatcher | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _collectWatcher({ language }) {
// site
const site = await this.getSite({ language });
// watcher
site._watchers = [];
// / files
// / plugins<theme<custom
// plugins
for (const relativeName in this.app.meta.modules) {
const module = this.app.meta.modules[relativeName];
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _collectWatcher | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async createSitemapIndex({ site }) {
// content
const urlRawRoot = this.getUrlRawRoot(site);
let items = '';
const languages = site.language ? site.language.items.split(',') : [null];
for (const language of languages) {
items += ` <sitemap>
<loc>${urlRawRoot}${!site.language || language =... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | createSitemapIndex | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async createRobots({ site }) {
// content
const urlRawRoot = this.getUrlRawRoot(site);
const content = `User-agent: *
Allow: /
Sitemap: ${urlRawRoot}/sitemapindex.xml
`;
// write
const pathRawDist = await this.getPathRawDist(site);
await fse.outputFile(`${pathRawDist}/robots.txt`, content);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | createRobots | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async copyThemes(pathIntermediate, themeModuleName) {
await this._copyThemes(pathIntermediate, themeModuleName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | copyThemes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _copyThemes(pathIntermediate, themeModuleName) {
// module
const module = this.app.meta.modules[themeModuleName];
if (!module) this.ctx.throw.module(moduleInfo.relativeName, 1003, themeModuleName);
// extend
const moduleExtend = this.ctx.bean.util.getProperty(module, 'package.eggBornModule.cms... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _copyThemes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
watcherThemes(site, themeModuleName) {
this._watcherThemes(site, themeModuleName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | watcherThemes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
_watcherThemes(site, themeModuleName) {
// module
const module = this.app.meta.modules[themeModuleName];
if (!module) this.ctx.throw.module(moduleInfo.relativeName, 1003, themeModuleName);
// extend
const moduleExtend = this.ctx.bean.util.getProperty(module, 'package.eggBornModule.cms.extend');
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _watcherThemes | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _checkIfSiteBuilt({ site, force }) {
// check if build site first
const pathIntermediate = await this.getPathIntermediate(site.language && site.language.current);
const fileName = path.join(pathIntermediate, 'main/article.ejs');
const exists = await fse.pathExists(fileName);
if (exists || !for... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | _checkIfSiteBuilt | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async getArticleUrl({ key, options }) {
// options
const returnPhysicalPath = options && options.returnPhysicalPath;
const returnWaitingPath = options && options.returnWaitingPath;
// article
const article = await this.ctx.bean.cms.render.getArticle({ key, inner: true });
if (!article) this.ctx.... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getArticleUrl | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
getAtomClassFullName(atomClass) {
return `${atomClass.module}:${atomClass.atomClassName}`;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getAtomClassFullName | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async getFrontEnvs({ language }) {
const envs = {};
for (const module of this.ctx.app.meta.modulesArray) {
// may be more atoms
const atoms = this.ctx.bean.util.getProperty(module, 'main.meta.base.atoms');
if (!atoms) continue;
for (const key in atoms) {
if (atoms[key].info.cms !... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') === -1) {
... | getFrontEnvs | javascript | cabloy/cabloy | src/module-system/a-cms/backend/src/bean/local.build.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/backend/src/bean/local.build.js | MIT |
async _renderFile({ fileSrc, fileDest, fileDestAlt, data }) {
// site
const site = data.site;
// language
const language = site.language && site.language.current;
// src
const pathIntermediate = await this.getPathIntermediate(language);
const fileName = path.join(pathIntermedia... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _renderFile | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _socketioPublish({ hotloadFile, article }) {
const message = {
userIdTo: -1,
content: {
mtime: new Date(),
article,
},
};
await this.ctx.bean.io.publish({
path: `/a/cms/hotloadFile/${hotloadFile}`,
message,
messageClass: {
... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _socketioPublish | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
_checkIfPluginEnable({ site, moduleName }) {
const config = site.plugins[moduleName];
return !config || !config.disabled;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _checkIfPluginEnable | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _loadPluginIncludes({ site, language }) {
// if exists
if (site._pluginIncludes) return site._pluginIncludes;
// modulesArray
let pluginIncludes = '';
for (const module of this.app.meta.modulesArray) {
const plugin = this.ctx.bean.util.getProperty(module, 'package.eggBornModu... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _loadPluginIncludes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _renderCSSJSes({ data, content }) {
data.js('plugins/cms-pluginbase/assets/js/lib/require.min.js');
data.js('plugins/cms-pluginbase/assets/js/lib/regenerator-runtime/runtime.js');
content = await this._renderCSSJS({ data, content, type: 'CSS', items: data._csses });
content = await this._r... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _renderCSSJSes | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _renderCSSJS({ data, content, type, items }) {
if (items.length === 0) return content;
// site
const site = data.site;
// cache
if (!site._cache) site._cache = {};
if (!site._cache[type]) site._cache[type] = {};
const cacheSha = shajs('sha256').update(items.join(',')).dig... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _renderCSSJS | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
async _renderEnvs({ data, content }) {
// site
const site = data.site;
// env
const _env = {};
for (const name of Object.keys(data._envs)) {
let value;
const keys = name.split('.');
for (let index = keys.length - 1; index >= 0; index--) {
const key = keys[... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | _renderEnvs | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
resolvePath(pathRoot, fileCurrent, fileName) {
if (!fileName) return pathRoot;
if (fileName.charAt(0) === '.') return path.join(path.dirname(fileCurrent), fileName); // not use path.resolve
return path.join(pathRoot, fileName);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | resolvePath | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
getOptions() {
return {
async: true,
cache: true,
compileDebug: this.ctx.app.meta.isTest || this.ctx.app.meta.isLocal,
outputFunctionName: 'echo',
rmWhitespace: true,
};
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getOptions | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
getCurrentLocale({ site }) {
return site.language ? site.language.current : this.ctx.app.config.i18n.defaultLocale;
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | getCurrentLocale | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
createUtilTime({ site }) {
const self = this;
const _textLocale = this.getCurrentLocale({ site });
return {
now(fmt, locale) {
return self.ctx.bean.util.now(fmt, locale || _textLocale);
},
today(fmt, locale) {
return self.ctx.bean.util.today(fmt, locale || _... | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | createUtilTime | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
now(fmt, locale) {
return self.ctx.bean.util.now(fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | now | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
today(fmt, locale) {
return self.ctx.bean.util.today(fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | today | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
formatDateTime(date, fmt, locale) {
return self.ctx.bean.util.formatDateTime(date, fmt, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | formatDateTime | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
formatDate(date, sep, locale) {
return self.ctx.bean.util.formatDate(date, sep, locale || _textLocale);
} | /*.ejs`);
for (const item of indexFiles) {
// data
const data = await this.getData({ site });
// path
const _fileSrc = item.substr(pathIntermediate.length + 1);
let _fileDest = _fileSrc.substr('main/index/'.length).replace('.ejs', '');
if (_fileDest.indexOf('.') ===... | formatDate | javascript | cabloy/cabloy | src/module-system/a-cms/dist/backend.js | https://github.com/cabloy/cabloy/blob/master/src/module-system/a-cms/dist/backend.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.