本文整理汇总了TypeScript中module._resolveFilename函数的典型用法代码示例。如果您正苦于以下问题:TypeScript _resolveFilename函数的具体用法?TypeScript _resolveFilename怎么用?TypeScript _resolveFilename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_resolveFilename函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: _retrieveLocalVersion
/**
* Retrieves the local installed AngularJS Material version form the current PWD.
*/
private static _retrieveLocalVersion(): string {
// Create a Node module which runs at the current process working directory.
let _cliModule = new NodeModule(process.cwd());
_cliModule.paths = NodeModule._nodeModulePaths(process.cwd());
// Resolve the angular-material module form the CWD module.
let resolvedModule = path.dirname(NodeModule._resolveFilename('angular-material', _cliModule));
let packageFile = path.join(resolvedModule, 'package.json');
// Load the version from the local installed AngularJS Material dependency.
return require(packageFile)['version'];
}
开发者ID:angular,项目名称:material-tools,代码行数:16,代码来源:PackageResolver.ts
示例2: loadApplicationPackage
function loadApplicationPackage (packagePath: string) {
// Add a flag indicating app is started from default app.
Object.defineProperty(process, 'defaultApp', {
configurable: false,
enumerable: true,
value: true
})
try {
// Override app name and version.
packagePath = path.resolve(packagePath)
const packageJsonPath = path.join(packagePath, 'package.json')
if (fs.existsSync(packageJsonPath)) {
let packageJson
try {
packageJson = require(packageJsonPath)
} catch (e) {
showErrorMessage(`Unable to parse ${packageJsonPath}\n\n${e.message}`)
return
}
if (packageJson.version) {
app.setVersion(packageJson.version)
}
if (packageJson.productName) {
app.setName(packageJson.productName)
} else if (packageJson.name) {
app.setName(packageJson.name)
}
app.setPath('userData', path.join(app.getPath('appData'), app.getName()))
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()))
app.setAppPath(packagePath)
}
try {
Module._resolveFilename(packagePath, module, true)
} catch (e) {
showErrorMessage(`Unable to find Electron app at ${packagePath}\n\n${e.message}`)
return
}
// Run the app.
Module._load(packagePath, module, true)
} catch (e) {
console.error('App threw an error during load')
console.error(e.stack || e)
throw e
}
}
开发者ID:malept,项目名称:electron,代码行数:49,代码来源:main.ts
示例3:
req.resolve = (request: string) => Module._resolveFilename(request, this)
开发者ID:illarionvk,项目名称:dotfiles,代码行数:1,代码来源:factory.ts
注:本文中的module._resolveFilename函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论