本文整理汇总了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);
}
开发者ID:atmajs,项目名称:app-bundler,代码行数:8,代码来源:ModuleTree.ts
示例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;
}
开发者ID:atmajs,项目名称:atma-io,代码行数:13,代码来源:path.ts
示例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)
}
}
开发者ID:atmajs,项目名称:app-bundler,代码行数:35,代码来源:ModuleTree.ts
示例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);
}
开发者ID:tenbits,项目名称:postmask,代码行数:26,代码来源:plugins.ts
示例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;
})
开发者ID:atmajs,项目名称:app-bundler,代码行数:18,代码来源:GlobalJsBuilder.ts
示例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);
}
开发者ID:atmajs,项目名称:atma-io,代码行数:22,代码来源:path.ts
示例7: toDir
function toDir(path) {
return class_Uri.combine(normalizePath(path), '/');
}
开发者ID:atmajs,项目名称:atma-io,代码行数:3,代码来源:Env.ts
示例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), '/');
开发者ID:atmajs,项目名称:atma-io,代码行数:31,代码来源:Env.ts
示例9: class_Uri
.forEach(path => {
let uri = new class_Uri(path);
let local = uri.toLocalFile();
modules[local] = local;
});
开发者ID:atmajs,项目名称:app-bundler,代码行数:5,代码来源:ModuleTree.ts
注:本文中的atma-utils.class_Uri类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论