ability to specify client-side imports

This commit is contained in:
Peli de Halleux 2015-04-07 15:27:10 -07:00
Родитель 3df04bec36
Коммит df8b4ee107
3 изменённых файлов: 12 добавлений и 2 удалений

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

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

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

@ -1632,6 +1632,8 @@ module TDev.AST
this.importCordova(t, plugin, v); break; this.importCordova(t, plugin, v); break;
case "bower": case "bower":
this.importBower(t, plugin, v); break; this.importBower(t, plugin, v); break;
case "client":
this.importClientScript(t, plugin, v); break;
case "pip": case "pip":
if (!this.topApp.canUseCapability(PlatformCapability.Npm)) if (!this.topApp.canUseCapability(PlatformCapability.Npm))
this.unsupportedCapability(plugin, PlatformCapability.Npm); this.unsupportedCapability(plugin, PlatformCapability.Npm);
@ -1685,6 +1687,13 @@ module TDev.AST
} }
} }
private importClientScript(t: Call, mod: string, v: string) {
if (mod && v != null) {
var imports = this.topApp.clientScripts;
imports[mod] = v;
}
}
private importBower(t: Call, mod: string, v: string) { private importBower(t: Call, mod: string, v: string) {
if (mod && v != null) { if (mod && v != null) {
var imports = this.topApp.bowerModules var imports = this.topApp.bowerModules

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

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