added ability to deplacre bower dependencies

This commit is contained in:
Peli de Halleux 2015-04-06 17:06:16 -07:00
Родитель be46866ab1
Коммит b55fc72e4e
4 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -138,7 +138,7 @@ module TDev.AST.Apps {
var isCloud = options.compileServer && (options.skipClient || app.isCloud);
var opts:CompilerOptions = {
packaging: true,
javascript: isCloud || !!options.cordova,
javascript: true, // always on for compiled web apps
scriptId: options.scriptId,
authorId: options.userId,
scriptGuid: app.localGuid,

Просмотреть файл

@ -2066,6 +2066,7 @@ module TDev.AST {
public syntheticIds:StringMap<boolean> = {};
public diffRemovedThings:Decl[];
public npmModules: StringMap<string> = {};
public bowerModules: StringMap<string> = {};
public cordovaPlugins: StringMap<string> = {};
public pipPackages: StringMap<string> = {};
public touchDevelopPlugins: StringMap<string> = {};

Просмотреть файл

@ -2,7 +2,7 @@
// TODO events and async
// Next available error: TD197:
// Next available error: TD198:
module TDev.AST
{
@ -1630,6 +1630,8 @@ module TDev.AST
if (!this.topApp.canUseCapability(PlatformCapability.Cordova))
this.unsupportedCapability(plugin, PlatformCapability.Cordova);
this.importCordova(t, plugin, v); break;
case "bower":
this.importBower(t, plugin, v); break;
case "pip":
if (!this.topApp.canUseCapability(PlatformCapability.Npm))
this.unsupportedCapability(plugin, PlatformCapability.Npm);
@ -1683,6 +1685,21 @@ module TDev.AST
}
}
private importBower(t: Call, mod: string, v: string) {
if (mod && v != null) {
var imports = this.topApp.bowerModules
if (imports.hasOwnProperty(mod)) {
if (imports[mod] == "error") return;
var newOne = TypeChecker.combineNpmVersions(imports[mod], v)
if (newOne == "error")
this.markError(t, lf("TD197: bower module '{0}' versions '{1}' and '{2}' conflict", mod, imports[mod], v))
imports[mod] = newOne;
}
else
imports[mod] = v
}
}
private importNpm(t: Call, mod: string, v: string) {
if (mod && v != null) {
var imports = this.topApp.npmModules

Просмотреть файл

@ -610,8 +610,8 @@ module TDev.RT {
r.resume()
}
//? Imports a dependent package which may be versioned. Package managers may be Node.JS npm, Apache cordova, Python Pip and TouchDevelop plugins.
//@ name("import") [manager].deflStrings("npm", "cordova", "touchdevelop", "pip") [version].defl("*")
//? Imports a dependent package which may be versioned. Package managers may be Node.JS npm, Bower, Apache cordova, Python Pip and TouchDevelop plugins. Bower packages are not available within the touchdevelop.com domain.
//@ name("import") [manager].deflStrings("npm", "cordova", "bower", "touchdevelop", "pip") [version].defl("*")
export function import_(manager : string, module: string, version: string): void {
}