diff --git a/ast/apps.ts b/ast/apps.ts index fe75676b..00db3fd5 100644 --- a/ast/apps.ts +++ b/ast/apps.ts @@ -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, diff --git a/ast/ast.ts b/ast/ast.ts index fcffe71d..f8bd1fa5 100644 --- a/ast/ast.ts +++ b/ast/ast.ts @@ -2066,6 +2066,7 @@ module TDev.AST { public syntheticIds:StringMap = {}; public diffRemovedThings:Decl[]; public npmModules: StringMap = {}; + public bowerModules: StringMap = {}; public cordovaPlugins: StringMap = {}; public pipPackages: StringMap = {}; public touchDevelopPlugins: StringMap = {}; diff --git a/ast/typeChecker.ts b/ast/typeChecker.ts index 6ebdd846..825080bb 100644 --- a/ast/typeChecker.ts +++ b/ast/typeChecker.ts @@ -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 diff --git a/lib/App.ts b/lib/App.ts index 76ebdf5c..a9ab1feb 100644 --- a/lib/App.ts +++ b/lib/App.ts @@ -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 { }