本文整理汇总了TypeScript中require-from-string.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: loadSync
})
configLoader.addLoader({
test: /\.[jt]s$/,
loadSync(id) {
const content = require('@babel/core').transform(
fs.readFileSync(id, 'utf8'),
{
babelrc: false,
configFile: false,
filename: id,
presets: [
[
require('@babel/preset-env'),
{
targets: {
node: 'current'
}
}
],
id.endsWith('.ts') && require('@babel/preset-typescript')
].filter(Boolean)
}
)
const m = requireFromString(content && content.code ? content.code : '', id)
return m.default || m
}
})
export default configLoader
开发者ID:egoist,项目名称:bubleup,代码行数:30,代码来源:config-loader.ts
示例2: createDSL
public createDSL(expression){
var treeVisitor = di.getInstance("TreeVisitor");
var _self = this;
var input = expression;
var chars = new antlr4.InputStream(input);
var lexer = new RealSocialableGrammarLexer(chars);
var tokens = new antlr4.CommonTokenStream(lexer);
var parser = new RealSocialableGrammarParser(tokens);
parser.buildParseTrees = true;
var tree = parser.prog();// 'block' is the start rule
treeVisitor.visitProg(tree);
var codeString = treeVisitor.getClassString();
var virtualModule = requireFromString(codeString);
let rsDSLObj:RSDSLModel = new RSDSLModel();
rsDSLObj.name = treeVisitor.className;
rsDSLObj.definition = codeString;
rsDSLObj.expression = input;
return _self.rsDSLRepository.post(rsDSLObj);
// .then((result:RSDSLModel)=>{
// let DSLAssignmentObj : AssignmentModel = new AssignmentModel();
// DSLAssignmentObj.dsl = result;
// DSLAssignmentObj.model = "rsICPerson";
// DSLAssignmentObj.modelId= "578622d85c2fbc1027ca507e" ;
// return _self.dslAssignmentRepository.post(DSLAssignmentObj);
// });
//content = user expression, code string is dsl output, for the integration model is rsperson, modelid is person id
//save dsl in the dsl
//assign to all the person (lets have 5 person in the table)
}
开发者ID:abhishek1191,项目名称:demo-sample,代码行数:32,代码来源:dslService.ts
示例3: createDslObject
createDslObject(embeddedDslObj, mainDslContent, level)
{
let _self=this;
var dicList = {};
for(var i = 0; i< embeddedDslObj.length ; i++){
var name = embeddedDslObj[i].getName()
var variableName = name +"_" + level + "_"+ "_00_" + i;
var find = '"%' + name + '%"';
var replace = 'dslDictionary["' + variableName + '"]';
mainDslContent = _self.replaceAll(mainDslContent, find, replace)
//console.log(mainDslContent);
dicList[variableName] = embeddedDslObj[i];
}
_self.purgeCache('./executionService.js');
//for(var i= 0; i< require.cache[require.resolve('./executor.js')].children.length;)
var dslClass = requireFromString(mainDslContent);
var dslObject = new dslClass();
for (var prop in dicList) {
if (dicList.hasOwnProperty(prop)) {
dslObject.addDslMapping(prop, dicList[prop]);
}
}
return dslObject;
}
开发者ID:abhishek1191,项目名称:demo-sample,代码行数:25,代码来源:executionService.ts
示例4: requireFromString
_self.rsDSLRepository.findByField("name",dslName).then((childRsDsl) => {
var input = childRsDsl.definition;
var virtualModule = requireFromString(input);
var obj = new virtualModule();
_self.purgeCache("./executionService.js");
if(obj.embeddedDsls().length > 0){
var promises = [];
obj.embeddedDsls().forEach(function(dsl) {
promises.push(_self.dslChain(dsl, level + 1));
});
q.all(promises).then(function(data){
var dslObject = _self.createDslObject(data, input, level)
defer.resolve(dslObject);
});
}
else{
defer.resolve(obj);
}
});
开发者ID:abhishek1191,项目名称:demo-sample,代码行数:19,代码来源:executionService.ts
注:本文中的require-from-string.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论