本文整理汇总了TypeScript中url.resolve函数的典型用法代码示例。如果您正苦于以下问题:TypeScript resolve函数的具体用法?TypeScript resolve怎么用?TypeScript resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
resolveReference: (ref, base = documentUrl) => {
return url.resolve(base, ref);
}
开发者ID:Microsoft,项目名称:vscode-css-languageservice,代码行数:3,代码来源:navigation.test.ts
示例2:
parentIds.forEach((parent: string) => {
if (parent) {
this.absoluteId = url.resolve(parent, this.absoluteId);
}
});
开发者ID:tycho01,项目名称:dtsgenerator,代码行数:5,代码来源:schemaid.ts
示例3: parseDependency
//.........这里部分代码省略.........
location
}
}
// `bitbucket:org/repo/path#sha`
if (type === 'bitbucket') {
const meta = gitFromPath(src)
const { org, repo, path, sha } = meta
const location = `https://bitbucket.org/${org}/${repo}/raw/${sha}/${path}`
return {
raw,
meta,
type,
location
}
}
// `npm:dependency`, `npm:@scoped/dependency`
if (type === 'npm') {
const parts = src.split('/')
const isScoped = parts.length > 0 && parts[0].charAt(0) === '@'
const hasPath = isScoped ? parts.length > 2 : parts.length > 1
if (!hasPath) {
parts.push('package.json')
}
return {
raw,
type: 'npm',
meta: {
name: isScoped ? parts.slice(0, 2).join('/') : parts[0],
path: join(...parts.slice(isScoped ? 2 : 1))
},
location: join(...parts)
}
}
// `bower:dependency`
if (type === 'bower') {
const parts = src.split('/')
if (parts.length === 1) {
parts.push('bower.json')
}
return {
raw,
type: 'bower',
meta: {
name: parts[0],
path: join(...parts.slice(1))
},
location: join(...parts)
}
}
// `http://example.com/foo.d.ts`
if (type === 'http' || type === 'https') {
return {
raw,
type,
meta: {},
location: raw
}
}
// `registry:source/module#tag`, `registry:source/module@version`
if (type === 'registry') {
const parts = /^([^\/]+)\/(.+?)(?:@(.*?)|#(.*?))?$/.exec(src)
if (parts == null) {
throw new TypeError(`Unable to parse: ${raw}`)
}
const [, source, name, version, tag] = parts
if (version != null && tag != null) {
throw new TypeError(`Unable to use tag and version together: ${raw}`)
}
const prefix = `/entries/${encodeURIComponent(source)}/${encodeURIComponent(name)}`
const path = tag ? `${prefix}/tags/${encodeURIComponent(tag)}` : `${prefix}/versions/${encodeURIComponent(version || '*')}/latest`
return {
raw,
type,
meta: {
source,
name,
version,
tag
},
location: resolveUrl(rc.registryURL, path)
}
}
throw new TypeError(`Unknown dependency: ${raw}`)
}
开发者ID:abouthiroppy,项目名称:core,代码行数:101,代码来源:parse.ts
示例4:
resolveReference: (ref, base) => {
if (base) {
documentUrl = url.resolve(documentUrl, base);
}
return url.resolve(documentUrl, ref);
}
开发者ID:tiravata,项目名称:vetur,代码行数:6,代码来源:links.test.ts
示例5: convertToWeb
public convertToWeb(path_string: string): string {
var relative = path.relative(this.webRoot, path_string);
var parts = relative.split('/');
while (parts[0] === '.' || parts[0] === '..') parts.shift();
return url.resolve(this.baseUrl, '/' + parts.join('/'));
}
开发者ID:yurydelendik,项目名称:vscode-ff-debug,代码行数:6,代码来源:ffUrlHelper.ts
示例6:
$("tr > td > a.buttonlink").each((i,el) => {
if($(el).parent().parent().hasClass("download_link_sponsored")) {return;}
streams[streams.length] = url.resolve(episode.url,$(el).attr("href"));
});
开发者ID:SwadicalRag,项目名称:node-pftv-api,代码行数:5,代码来源:tv.ts
示例7:
sourcemap.sources.map(source => urlLib.resolve(mapUrl, source));
开发者ID:Polymer,项目名称:vulcanize,代码行数:1,代码来源:source-map.ts
示例8: Promise
return new Promise((resolve) => {
const { meta } = parseDependency(expandRegistry(raw))
const path = `entries/${encodeURIComponent(meta.source)}/${encodeURIComponent(meta.name)}`
return resolve(readJsonFrom(resolveUrl(rc.registryURL, path)))
})
开发者ID:timbrown81,项目名称:core,代码行数:6,代码来源:view.ts
注:本文中的url.resolve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论