本文整理匯總了TypeScript中atma-utils.class_Uri類的典型用法代碼示例。如果您正苦於以下問題:TypeScript class_Uri類的具體用法?TypeScript class_Uri怎麽用?TypeScript class_Uri使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了class_Uri類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: secondIsSubPath
function secondIsSubPath(a: string, b: string) {
let uriA = new class_Uri(a);
let uriB = new class_Uri(b);
a = uriA.toLocalDir();
b = uriB.toLocalFile();
return b.includes(a);
}
示例2: path_resolveUri
export function path_resolveUri(url, parentLocation, base) {
if (url[0] === '/'){
parentLocation = base;
url = url.substring(1);
}
var uri = new class_Uri(url);
return uri.isRelative()
? (new class_Uri(parentLocation)).combine(uri as any)
: uri;
}
示例3: secondHasCommonExports
function secondHasCommonExports(a: string, b: string): { exportPath: string, isSubPath: boolean } {
const FILE = 'exports.ts';
if (b.endsWith(FILE)) {
return null;
}
let uriA = new class_Uri(a);
let uriB = new class_Uri(b);
let uriExports = null;
let dir = new class_Uri(uriB.toLocalDir());
let prev = dir.toLocalDir();
while (uriExports == null) {
let exp = dir.combine(FILE);
if (io.File.exists(exp)) {
uriExports = exp;
break;
}
dir = dir.cdUp();
if (dir.toLocalDir() === prev) {
break;
}
prev = dir.toLocalDir();
}
if (uriExports == null) {
return null;
}
let local = uriExports.toLocalFile();
if (local in modules === false) {
return null;
}
return {
exportPath: local,
isSubPath: secondIsSubPath(local, a)
}
}
示例4: prepare
export function prepare (path: string, options: IOptions) {
if (lastOptions === options) {
return;
}
lastOptions = options;
var base = options.base;
if (base[0] === '/') {
base = class_Uri.combine(process.cwd(), base);
}
options.plugins.map(function(name){
if (name[0] === '.' || name[0] === '/') {
name = pathUtils.join(base, name);
}
let plugin: IPlugin = require(name);
let config = options.configs && options.configs[name];
if (config) {
mask.cfg(name, config);
}
plugin.initialize(optimizer, config, mask, io);
plugins.push(plugin);
});
configurate(lastConfiguration);
}
示例5: path_isRelative
dependencies && dependencies.filter(x => x.pos != null && path_isRelative(x.url)).forEach(dep => {
let resUrl = new class_Uri(resource.url);
let resDep = new class_Uri(dep.url);
let url = resUrl.combine(resDep as any).toLocalFile();
let start = dep.pos + offset + 1;
let c = content[start - 1];
let end = content.indexOf(c, start);
let oldLength = end - start;
let newLength = url.length;
content = content.substring(0, start) + url + content.substring(end);
offset += newLength - oldLength;
})
示例6: path_getUri
export function path_getUri(path: string | class_Uri, base?: string){
if (typeof path !== 'string') {
path = path.toString();
}
path = path_normalize(path);
if (path[0] === '/') {
path = path.substring(1);
}
let uri = new class_Uri(path);
if (uri.isRelative() === false) {
return uri;
}
if (base) {
return new class_Uri(base).combine(uri as any);
}
if (io.env) {
return io.env.currentDir.combine(uri as any);
}
return new class_Uri('file://' + process.cwd() + '/')
.combine(uri as any);
}
示例7: toDir
function toDir(path) {
return class_Uri.combine(normalizePath(path), '/');
}
示例8: class_Uri
break;
default:
path = process.env.HOME;
break;
}
if (path == null) {
logger.error('<io.env> Unknown AppData Dir');
Object.defineProperty(this, 'appdataDir', {
value: this.applicationDir
});
return this.applicationDir;
}
path = new class_Uri(toDir(path));
if (platform === 'darwin')
path = path.combine('Library/Application Support/');
path = path.combine('.' + mainFile.file + '/');
Object.defineProperty(this, 'appdataDir', {
value: path
});
return path;
}
};
function toDir(path) {
return class_Uri.combine(normalizePath(path), '/');
示例9: class_Uri
.forEach(path => {
let uri = new class_Uri(path);
let local = uri.toLocalFile();
modules[local] = local;
});