Ejemplo n.º 1
0
 newHost.fileExists = (fileName: string): boolean => {
   return path.normalize(fileName) == normalSyntheticIndexName || delegate.fileExists(fileName);
 };
Ejemplo n.º 2
0
function formFullAppPath(name: string) {
  const prefix = 'C:/Program Files (x86)/Google/Chrome/Application'
  return normalize(join(prefix, `${name}.exe`))
}
Ejemplo n.º 3
0
'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',
Ejemplo n.º 4
0
 .then(() => exec(normalize('node'), 'index.js'))
Ejemplo n.º 5
0
 *  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 }
];
Ejemplo n.º 6
0
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
    }
  }

  // `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}`)
    }

    let path = `/entries/${encodeURIComponent(source)}/${encodeURIComponent(name)}`

    // Select the best API to get the registry version.
    if (tag) {
      path += `/tags/${encodeURIComponent(tag)}`
    } else if (version) {
      path += `/versions/${encodeURIComponent(version)}/latest`
    } else {
      path += '/versions/latest'
    }

    return {
      raw,
      type,
      meta: {
        source,
        name,
        version,
        tag
      },
      location: resolveUrl(rc.registryURL, path)
    }
  }

  throw new TypeError(`Unknown dependency: ${raw}`)
}
Ejemplo n.º 7
0
    {
        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:
    //
Ejemplo n.º 8
0
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,
  }
Ejemplo n.º 9
0
  // 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))
    }
function testFilePath(filename: string): string {
    return path.normalize(path.join(here, '../..', 'test', filename));
}