当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript path.normalize函数代码示例

本文整理汇总了TypeScript中path.normalize函数的典型用法代码示例。如果您正苦于以下问题:TypeScript normalize函数的具体用法?TypeScript normalize怎么用?TypeScript normalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了normalize函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 newHost.fileExists = (fileName: string): boolean => {
   return path.normalize(fileName) == normalSyntheticIndexName || delegate.fileExists(fileName);
 };
开发者ID:Cammisuli,项目名称:angular,代码行数:3,代码来源:bundle_index_host.ts

示例2: formFullAppPath

function formFullAppPath(name: string) {
  const prefix = 'C:/Program Files (x86)/Google/Chrome/Application'
  return normalize(join(prefix, `${name}.exe`))
}
开发者ID:lgandecki,项目名称:cypress,代码行数:4,代码来源:index.ts

示例3: require

'use strict';

import destCopy from '../broccoli-dest-copy';
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
var renderLodashTemplate = require('broccoli-lodash');
var replace = require('broccoli-replace');
var stew = require('broccoli-stew');
var ts2dart = require('../broccoli-ts2dart');
import transpileWithTraceur from '../traceur/index';
import compileWithTypescript from '../broccoli-typescript';

var projectRootDir = path.normalize(path.join(__dirname, '..', '..', '..', '..'));


module.exports = function makeNodeTree(destinationPath) {
  // list of npm packages that this build will create
  var outputPackages = ['angular2', 'benchpress', 'rtts_assert'];

  var modulesTree = new Funnel('modules', {
    include: ['angular2/**', 'benchpress/**', 'rtts_assert/**', '**/e2e_test/**'],
    exclude: [
      // the following code and tests are not compatible with CJS/node environment
      'angular2/src/core/zone/vm_turn_zone.es6',
      'angular2/test/core/zone/**'
    ]
  });

  var nodeTree = transpileWithTraceur(modulesTree, {
    destExtension: '.js',
开发者ID:IlanFrumer,项目名称:angular,代码行数:31,代码来源:node_tree.ts

示例4: exec

 .then(() => exec(normalize('node'), 'index.js'))
开发者ID:Serdji,项目名称:angular-cli,代码行数:1,代码来源:platform-server.ts

示例5:

 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import * as path from 'path';
import * as assert from 'assert';

import { join, normalize } from 'vs/base/common/paths';
import * as platform from 'vs/base/common/platform';

import { FileWalker, Engine as FileSearchEngine } from 'vs/workbench/services/search/node/fileSearch';
import { IRawFileMatch, IFolderSearch } from 'vs/workbench/services/search/node/search';
import { getPathFromAmdModule } from 'vs/base/common/amd';

const TEST_FIXTURES = path.normalize(getPathFromAmdModule(require, './fixtures'));
const EXAMPLES_FIXTURES = path.join(TEST_FIXTURES, 'examples');
const MORE_FIXTURES = path.join(TEST_FIXTURES, 'more');
const TEST_ROOT_FOLDER: IFolderSearch = { folder: TEST_FIXTURES };
const ROOT_FOLDER_QUERY: IFolderSearch[] = [
	TEST_ROOT_FOLDER
];

const ROOT_FOLDER_QUERY_36438: IFolderSearch[] = [
	{ folder: path.normalize(getPathFromAmdModule(require, './fixtures2/36438')) }
];

const MULTIROOT_QUERIES: IFolderSearch[] = [
	{ folder: EXAMPLES_FIXTURES },
	{ folder: MORE_FIXTURES }
];
开发者ID:developers23,项目名称:vscode,代码行数:31,代码来源:search.test.ts

示例6: parseDependency

export function parseDependency (raw: string): Dependency {
  const [type, src] = splitProtocol(raw)

  // `file:path/to/file.d.ts`
  if (type === 'file') {
    const location = normalize(src)
    const filename = basename(location)
    const name = isDefinition(filename) ? pathFromDefinition(filename) : undefined

    invariant(
      filename === CONFIG_FILE || isDefinition(filename),
      `Only ".d.ts" and "${CONFIG_FILE}" files are supported`
    )

    return {
      raw,
      type,
      meta: {
        name: name,
        path: location
      },
      location
    }
  }

  // `bitbucket:org/repo/path#sha`
  if (type === 'github') {
    const meta = gitFromPath(src)
    const { org, repo, path, sha } = meta
    const location = `https://raw.githubusercontent.com/${org}/${repo}/${sha}/${path}`

    return {
      raw,
      meta,
      type,
      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
//.........这里部分代码省略.........
开发者ID:timbrown81,项目名称:core,代码行数:101,代码来源:parse.ts

示例7: catch

    {
        let str: string;
        let result: string;

        result = querystring.escape(str);
        result = querystring.unescape(str);
    }
}

////////////////////////////////////////////////////
/// path tests : http://nodejs.org/api/path.html
////////////////////////////////////////////////////

module path_tests {

    path.normalize('/foo/bar//baz/asdf/quux/..');

    path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
    // returns
    //'/foo/bar/baz/asdf'

    try {
        path.join('foo', {}, 'bar');
    }
    catch(error) {

    }

    path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile');
    //Is similar to:
    //
开发者ID:403016605,项目名称:DefinitelyTyped,代码行数:31,代码来源:node-tests.ts

示例8:

import * as path from 'path';
import {getNodeEnv} from '../utils/express-utils';

const appName       = 'dungeonCrawler';
const defaultPort   = 3000;
const rootPath      = path.normalize(__dirname + '/../../..');

let variables: any = {
  development: {
    root: rootPath,
    app: {
      name: appName
    },
    port: defaultPort,
  },

  test: {
    root: rootPath,
    app: {
      name: appName
    },
    port: defaultPort,
  },

  production: {
    root: rootPath,
    app: {
      name: appName
    },
    port: defaultPort,
  }
开发者ID:simonxca,项目名称:dungeon-crawler-v2,代码行数:31,代码来源:express-config.ts

示例9:

  // Set the __filename to the path of html file if it is file: protocol.
  if (window.location.protocol === 'file:') {
    const location = window.location
    let pathname = location.pathname

    if (process.platform === 'win32') {
      if (pathname[0] === '/') pathname = pathname.substr(1)

      const isWindowsNetworkSharePath = location.hostname.length > 0 && globalPaths[0].startsWith('\\')
      if (isWindowsNetworkSharePath) {
        pathname = `//${location.host}/${pathname}`
      }
    }

    global.__filename = path.normalize(decodeURIComponent(pathname))
    global.__dirname = path.dirname(global.__filename)

    // Set module's filename so relative require can work as expected.
    module.filename = global.__filename

    // Also search for module under the html file.
    module.paths = module.paths.concat(Module._nodeModulePaths(global.__dirname))
  } else {
    global.__filename = __filename
    global.__dirname = __dirname

    if (appPath) {
      // Search for module under the app directory
      module.paths = module.paths.concat(Module._nodeModulePaths(appPath))
    }
开发者ID:vwvww,项目名称:electron,代码行数:30,代码来源:init.ts

示例10: testFilePath

function testFilePath(filename: string): string {
    return path.normalize(path.join(here, '../..', 'test', filename));
}
开发者ID:stanionascu,项目名称:vscode-cmake-tools,代码行数:3,代码来源:extension.test.ts


注:本文中的path.normalize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。