當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript atma-utils.class_Uri類代碼示例

本文整理匯總了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;未經允許,請勿轉載。