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


TypeScript path.posix类代码示例

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


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

示例1: function

export default function() {
  // These testcases are specific to one uncommon behaviour in path module. Few
  // of the functions in path module, treat '' strings as current working
  // directory. This test makes sure that the behaviour is intact between commits.
  // See: https://github.com/nodejs/node/pull/2106

  var pwd = process.cwd();

  // join will internally ignore all the zero-length strings and it will return
  // '.' if the joined string is a zero-length string.
  assert.equal(path.posix.join(''), '.');
  assert.equal(path.posix.join('', ''), '.');
  assert.equal(path.join(pwd), pwd);
  assert.equal(path.join(pwd, ''), pwd);

  // normalize will return '.' if the input is a zero-length string
  assert.equal(path.posix.normalize(''), '.');
  assert.equal(path.normalize(pwd), pwd);

  // Since '' is not a valid path in any of the common environments, return false
  assert.equal(path.posix.isAbsolute(''), false);

  // resolve, internally ignores all the zero-length strings and returns the
  // current working directory
  assert.equal(path.resolve(''), pwd);
  assert.equal(path.resolve('', ''), pwd);

  // relative, internally calls resolve. So, '' is actually the current directory
  assert.equal(path.relative('', pwd), '');
  assert.equal(path.relative(pwd, ''), '');
  assert.equal(path.relative(pwd, pwd), '');
};
开发者ID:diegolameira,项目名称:codesandbox-client,代码行数:32,代码来源:node-path-zero-length-strings.ts

示例2: constructor

 private constructor(
     relativeFlatIndexPath: string, readonly entryPoint: string,
     readonly moduleName: string|null) {
   this.flatIndexPath = path.posix.join(path.posix.dirname(entryPoint), relativeFlatIndexPath)
                            .replace(/\.js$/, '') +
       '.ts';
 }
开发者ID:cyrilletuzi,项目名称:angular,代码行数:7,代码来源:flat_index_generator.ts

示例3:

        .map(match => {
          const relativePath = path.posix.relative(slashedDirname, match);

          return path.posix.dirname(match) === slashedDirname
            ? `./${relativePath}`
            : relativePath;
        })
开发者ID:Volune,项目名称:jest,代码行数:7,代码来源:helpers.ts

示例4:

		return service.resolveFile(uri.file(path.join(testDir, 'index.html'))).then(source => {
			const targetParent = uri.file(path.dirname(source.resource.fsPath));
			const target = targetParent.with({ path: path.posix.join(targetParent.path, path.posix.basename(source.resource.path)) });
			return service.copyFile(source.resource, target, true).then(copied => {
				assert.equal(copied.size, source.size);
			});
		});
开发者ID:liunian,项目名称:vscode,代码行数:7,代码来源:fileService.test.ts

示例5: webcomponentsLiteToBundle

  /**
   * Checks if a path points to webcomponents-lite.js and will change it to
   * webcomponents-bundle.js if it does.
   *
   * @param filePath path to transform.
   */
  private webcomponentsLiteToBundle(filePath: string) {
    const pathObject = path.posix.parse(filePath);

    if (pathObject.base === 'webcomponents-lite.js') {
      pathObject.base = 'webcomponents-bundle.js';
    }

    return path.posix.format(pathObject);
  }
开发者ID:,项目名称:,代码行数:15,代码来源:

示例6: pathFromUrl

export function pathFromUrl(
    root: LocalFsPath,
    // TODO(usergenic): PackageRelativeUrl are not *necessarily* always just a
    // relative path from root.  Maybe subclass as PackageRelativeUrlPath or
    // something if this function doesn't disappear after
    // https://github.com/Polymer/polymer-build/issues/324 is addressed.
    url: PackageRelativeUrl): LocalFsPath {
  return path.normalize(decodeURIComponent(path.posix.join(
             posixifyPath(root), path.posix.join('/', url)))) as LocalFsPath;
}
开发者ID:MehdiRaash,项目名称:tools,代码行数:10,代码来源:path-transformers.ts

示例7: toDepNameAndPath

 toDepNameAndPath(relativePath: string): { depName: string; path: string; } {
     let depName = path.join(path.dirname(this._current.depName), relativePath);
     let depPath = path.join(path.dirname(this._current.path), relativePath);
     if (path.posix) {
         // (windows) for git cli
         // path.posix are exists after node v0.12
         depName = path.posix.join(path.dirname(this._current.depName), relativePath);
         depPath = path.posix.join(path.dirname(this._current.path), relativePath);
     }
     return {
         depName: depName,
         path: depPath,
     };
 }
开发者ID:vvakame,项目名称:packagemanager-backend,代码行数:14,代码来源:result.ts

示例8: it

 it('should list lazy routes recursively', () => {
   writeSomeRoutes();
   const {program, host, options} =
       createProgram(['src/main.ts', 'src/child.ts', 'src/child2.ts']);
   const routes = NgTools_InternalApi_NG_2.listLazyRoutes({
     program,
     host,
     angularCompilerOptions: options,
     entryModule: 'src/main#MainModule',
   });
   expect(routes).toEqual({
     './child#ChildModule': path.posix.join(testSupport.basePath, 'src/child.ts'),
     './child2#ChildModule2': path.posix.join(testSupport.basePath, 'src/child2.ts'),
   });
 });
开发者ID:Cammisuli,项目名称:angular,代码行数:15,代码来源:ngtools_api_spec.ts

示例9: Buffer

    return this._getBundles().then((bundles) => {
      let sharedDepsBundle = (this.shell)
          ? this.urlFromPath(this.shell)
          : this.sharedBundleUrl;
      let sharedDeps = bundles.get(sharedDepsBundle) || [];
      let promises = [];

      if (this.shell) {
        let shellFile = this.analyzer.getFile(this.shell);
        console.assert(shellFile != null);
        let newShellContent = this._addSharedImportsToShell(bundles);
        shellFile.contents = new Buffer(newShellContent);
      }

      for (let fragment of this.allFragments) {
        let fragmentUrl = this.urlFromPath(fragment);
        let addedImports = (fragment === this.shell && this.shell)
            ? []
            : [path.relative(path.dirname(fragmentUrl), sharedDepsBundle)];
        let excludes = (fragment === this.shell && this.shell)
            ? []
            : sharedDeps.concat(sharedDepsBundle);

        promises.push(new Promise((resolve, reject) => {
          let vulcanize = new Vulcanize({
            abspath: null,
            fsResolver: this.analyzer.resolver,
            addedImports: addedImports,
            stripExcludes: excludes,
            inlineScripts: true,
            inlineCss: true,
            inputUrl: fragmentUrl,
          });
          vulcanize.process(null, (err, doc) => {
            if (err) {
              reject(err);
            } else {
              resolve({
                url: fragment,
                contents: doc,
              });
            }
          });
        }));
      }
      // vulcanize the shared bundle
      if (!this.shell && sharedDeps && sharedDeps.length !== 0) {
        logger.info(`generating shared bundle`);
        promises.push(this._generateSharedBundle(sharedDeps));
      }
      return Promise.all(promises).then((bundles) => {
        // convert {url,contents}[] into a Map
        let contentsMap = new Map();
        for (let bundle of bundles) {
          contentsMap.set(bundle.url, bundle.contents);
        }
        return contentsMap;
      });
    });
开发者ID:honzalo,项目名称:polymer-cli,代码行数:59,代码来源:bundle.ts


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