本文整理汇总了TypeScript中enhanced-resolve/lib/getInnerRequest.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: callback
return (request, callback) => {
let innerRequest = getInnerRequest(resolver, request);
if (!innerRequest) {
return callback();
}
let match = innerRequest.match(mapping.aliasPattern);
if (!match) {
return callback();
}
let newRequestStr = mapping.target;
if (!mapping.onlyModule) {
newRequestStr = newRequestStr.replace('*', match[1]);
}
if (newRequestStr[0] === '.') {
newRequestStr = path.resolve(this.absoluteBaseUrl, newRequestStr);
}
let newRequest = _.extend({}, request, {
request: newRequestStr
}) as Request;
return resolver.doResolve(
this.target,
newRequest,
"aliased with mapping '" + innerRequest + "': '" + mapping.alias + "' to '" + newRequestStr + "'",
createInnerCallback(
function(err, result) {
if (arguments.length > 0) {
return callback(err, result);
}
// don't allow other aliasing or raw request
callback(null, null);
},
callback
)
);
};
开发者ID:Sagars09,项目名称:to-do-list-React-Typescript,代码行数:41,代码来源:paths-plugin.ts
示例2: async
async (request: NormalModuleFactoryRequest, resolveContext: {}) => {
if (!request || request.typescriptPathMapped) {
return;
}
const originalRequest = getInnerRequest(resolver, request);
if (!originalRequest) {
return;
}
// Only work on Javascript/TypeScript issuers.
if (!request.context.issuer || !request.context.issuer.match(/\.[jt]sx?$/)) {
return;
}
// Relative or absolute requests are not mapped
if (originalRequest.startsWith('.') || originalRequest.startsWith('/')) {
return;
}
// Amd requests are not mapped
if (originalRequest.startsWith('!!webpack amd')) {
return;
}
const replacements = findReplacements(originalRequest, this._options.paths || {});
for (const potential of replacements) {
const potentialRequest = {
...request,
request: path.resolve(this._options.baseUrl || '', potential),
typescriptPathMapped: true,
};
const result = await resolveAsync(potentialRequest, resolveContext);
if (result) {
return result;
}
}
},
开发者ID:baconwaffles,项目名称:angular-cli,代码行数:39,代码来源:paths-plugin.ts
注:本文中的enhanced-resolve/lib/getInnerRequest.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论