diff --git a/History.txt b/History.txt deleted file mode 100644 index 00e03519b..000000000 --- a/History.txt +++ /dev/null @@ -1,288 +0,0 @@ -Changelog -=============================================================================== - -v0.8 (combines changes from 0.7.6 that weren't released as an actual build - outside of the github repo) - - Support for AMD, and general reliance on the module pattern. - An assembly maps to a module (named by its ScriptAssembly attribute). - Its references map to dependencies. The ssloader.js provides a - small/compact loader that supports declarative configuration, local - storage integration, auto/pre-loading of scripts and the core - AMD constructs - define and require. - - Script generation optimizations leveraging module patterns, more - efficient constructs (eg. anonymous method generation, locally scoped - functions for type definitions etc.), smaller minimized identifiers in - some cases - - Optimize mscorlib.js (now renamed ss.js) in terms of size, more - streamlined type system, as well as removal of all global extensions - to existing script objects. - - Removed .debug and .release generated scripts. Debug build produces - Foo.js and minimized Foo.min.js (of the debug flavor), and release - build also produces Foo.js and corresponding minimized Foo.min.js. - - Leverage AjaxMin tool to perform minimization (better minimization - as a result) - - NodeJS support - - Removed metadata attributes - . ScriptNamespaceAttribute - . AlternateSignatureAttribute is gone ... just extern suffices - . ScriptQualifier - - Replace/renamed metadata attributes - . PreserveCase is now a property on ScriptName - . PreserveName is now a property on ScriptName - . Imported is now ScriptImport - . IgnoreNamespace is now ScriptIgnoreNamespace - . IntrinsicProperty in now ScriptField (was temporarily ScriptProperty) - . Resources is now ScriptResources - . NamedValues and NumericValues combined into ScriptConstants - . GlobalMethods is gone, and Mixin replaced with ScriptExtension - . NonScriptable is now ScriptIgnore - - New metadata attributes - . ScriptTemplate (to provide a template for script generation - instead of a template file within the project) - . ScriptModule - . ScriptMethod - . ScriptEvent - . ScriptDependency - - Removed Record base class. Use ScriptObject attribute instead. - - Runtime - . Added Stack/Queue implementations - . Various changes in mscorlib classes - Removed: - Array.Clone, Index, GroupBy - Format and LocaleFormat methods on numeric types (use String.Format) - Date.Empty, IsEmpty (use null) - Delegate.ClearExport, DeleteExport (use Detach/Dispose on new Export object) - String.CompareTo, Equals (use String.Compare) - String.HtmlEncode/Decode, IndexOfAny, LastIndexOfAny - - Replaced: - Array.Extract -> GetRange - Delegate.CreateExport -> Export (returns Export object instead of string) - String.LocaleFormat -> use overload that takes in CultureInfo - - Added: - Script.Global, Undefined - Script.Require - - MSBuild changes: - . Added support for a CrunchScripts property in your csproj to control - whether crunching happens for the .min.js script is produced. - . Added support for a ScriptDocumentation property in your csproj to - control whether doc-comments are added to generated scripts (replaces - old SuppressDocumentation property) - . Removed generation of doc-comments into script - - Misc metadata changes - . Knockout - Rename DependentObservable -> ComputedObservable to - match Knockout API changes - . jQuery - Added Unique - . Rename RegularExpression to RegExp (to match shorter script name) - - Bug fixes - [git #223] Special case generation of date equality checks to make - them work as expected - - -v0.7.6 - - Removed script loading APIs from Script class in mscorlib - (moved them to Loader class in Script.Web) - - Removed script startup functionality from mscorlib.js ... all script - loading is now in ssloader.js (and included into the Runtime nuget - package) - - Removed Script.Alert/Confirm/Prompt from mscorlib and moved them to - Window in Script.Web - - Moved SetTimeout, SetInterval and ClearTimeout, ClearInterval from - Window object to Script object in mscorlib. - - Removed some methods from Type as part of cleanup (AddHandler, - GetProperty, RemoveHandler, SetProperty, IsEnum, IsFlags, IsNamespace, - GetInterfaces, Parse) - - Removed window dependency in mscorlib.js - - Debug class now maps directly to console - - Moved GetField, HasField, DeleteField, HasMethod, InvokeMethod, - CreateInstance, GetScriptType off Type and onto Script while - HasProperty, GetProperty, SetProperty, AddHandler, RemoveHandler are gone - - Optimize generation of static ctors to use a function scope only when - static ctors have a local variable reference. - Should help optimize generation of jQuery scripts, by reducing one extra - function scope. - - Removed Aggregate method from Array, ArrayList and List. Use Reduce instead. - Removed the corresponding custom implementation from mscorlib.js. - - [git #131] Correctly detect member references within array initializers - - [git #161] Add Slice, Splice, Shift, Unshift, Reduce, ReduceRight to - Array, ArrayList and List. - - [git #228] Restore ability to generate public resource classes - (Change Custom Tool property of resx file to - ResxPublicScriptGenerator) - - [git #230] Add String.IsNullOrWhitespace - - [git #234] Knockout API update - added CompareResult status enum - -v0.7.5.0 - - DOM metadata update (readyState property on Document, - plugins on Navigator) - - jQuery API update (on/off methods) - - Knockout API updates for missing APIs - - Addition of support for jQuery validation plugin - - jQueryUI added! - - [git #130] ReadyState property on Document - - [git #132] DOM metadata for plugins - - [git #139] jQuery on/off APIs - - [git #141] Bing maps metadata missing APIs - - [git #145] Knockout additions - - [git #152] Knockout additions - - [git #155] ReadyState property on Document - - [git #156] Changed projects (incl. templates) to target .net framework v2.0 - - [git #166] Fix generic Deffered API on jQuery - - [git #169] Missing jQuery API overload added - - [git #170] Fix bing maps metadata bug - - [git #173] Fix StringBuilder and appending empty string/isEmpty interaction - - [git #178] Issues with string extensions - - [git #180] Added workaround: Better error message for namespace-qualified name gotcha - - [git #183] Various DOM metadata additions (eg. ClassList) - - [git #187] Support for writing 'new Image()' - - [git #189] Fixed jQuery.when metadata - - [git #201] Strongly typed some Knockout API (KnockoutMapping) - - Nuget packages for compiler, and individual import libraries - - VSIX-based approach for getting script# and associated templates - - Breaking changes: - - In a csproj, the TemplateFile property has been changed to ScriptTemplate - - When creating a project there is no prompt to setup a DeploymentPath - ... but for now, msbuild support continues to exist (via manual edit) - ... will potentially be replaced eventually. - - No more support for WebAppParitioning. If you were compiling multiple script - files out of a single c# project, this feature is gone. You can switch your - msbuild scripts to use the ScriptCompilerExecTask, instead of ScriptCompilerTask - and invoke the compiler multiple times for each script file, passing in exactly - the right set of sources for each script file to be generated. - - Removed Script.Windows.dll and gadget project - -v0.7.4.0 - - Fix/update bing maps metadata bug - - Fix observable bug where access to an observed property without an observer - registration would drop existing observers. - - Remove /copyRefs flag from ssc.exe (script references are no longer copied to output folder) - Same applies to ScriptCompilerExec task. The normal ScriptCompilerTask continues to provide - this capability. - - Added Sharpen.dom.js - a minimal set of helper APIs on top of HTML5 DOM APIs. - - Some enum related changes: - ToString/Enum parsing support removed (it didn't work for internal enums anyway) - ToString on named enums (and on strings) skipped as it is redundant - Inline enum values in generated script - Skip generating internal enum types - - [git #25] Importing multi-dimensional arrays - - [git #56] Switch statement when used with more then 6 cases will generate a compile error - - [git #62] Compile error due to assembly name sort order (with generic types being - imported, assembly load order starts to matter) - - [git #66] Support Nullable.GetValueOrDefault which is needed for ?? operator on - nullables. - - [git #67] BREAKING CHANGE: DateTime -> Date. Date is also no longer a value type. - (partially fixes #67, and also makes Date more representative of script semantics - which are not that of a value type) - - [git #84] Raise error for code which calls Type.CreateInstance with the results of a method - call/property access directly. - - [git #92] Don't generate internal consts since their values have been inlined - even in debug builds (for symmetry with release builds) - Also, at the same type skip generating types for internal enums marked - as Named/NumericValues, since their values have been inlined as well. - Also fixes [git #42] indirectly. - - [git #93] Error compiling cross-referenced projects in 0.7.3 - Fix by requiring explicit references, and reporting failure on not doing so - instead of silent failure (this is temporary ... there must be a better - msbuild way of including transitive closure of assemblies, but even - referencing indirect references in the targets file raises an error to - include explicit references). - - [git #94] Raise error for code which calls Type.CreateInstance with the results of a method - call/property access directly. - - [git #96] Handle '+' unary operator - - [git #97] Unable to generate code for projects that don't reference Script.Web.dll. - - [git #103] Fix generation of custom delegates to use "Function" as generated script name - - [git #107] ScriptAlias is not respected on types defined in the current assembly - - [git #114] Window.ApplicationCache.Status.ToString() generates invalid JavaScript - -v0.7.3.0 [8/14/2011] - - [git #71] Fix formatting of GMT dates - - [git #70] Support for const decimal - - [git #69] Fix LocaleFormat typo - - [git #76] Compiler crash in 0.7.2 defining decimal type with non-integer value - - [git #75] Defining a local variable 'ss' hides the Script# ss global - - [git #60] List constructor with params for creating literal array - - [git #74] Fix date formatting to make it more in sync with .net - - [git #63] Fix internal partial class generation - - [git #65] Calling ToString() on a constant breaks minified script - - [git #73] Creating Record objects from another library - - [git #80] The decimal type is missing the Parse method - - [git #84] if( is ) not compiled properly when is a delegate. - - Enable creating derived jQueryEvent objects - - Knockout API updates (ability to create binding handlers for example) - - Propagate ScriptNamespace to generic instance class - - DOM API metadata updates - - Separate out msbuild tasks into ScriptSharp.Build.dll and Visual Studio generators - into ScriptSharp.VisualStudio.dll - -v0.7.2.0 [5/22/2011] - - Revert null equality check to non-falsey check - - Switch String.empty references to in generated script to string literal - - Fix delegate optimization bug involving Type.InvokeMember with first parameter being null - - Remove hack in metadata importer to try import generic types first - (instead design imported apis carefully so type don't have instance of generic type - as return type of a member) - - To fix above bug: - - jQueryXmlHttpRequest replaced with jQueryDataHttpRequest - and jQueryXmlHttpRequest is now non-generic - - Added non-generic versions of various jQuery ajax callbacks - - Improve jQuery deferred APIs - - jQuery 1.6.1 APIs and other missing APIs added - - [git #36] Misc jQuery apis added - - [git #50] Fix GeoLocation API: WatchCurrentPosition -> WatchPosition - - Added AudioElement - - Added Tuple, Callback, various component model interfaces - - FxCop rules for CSS Selector validation, Script.Literal usage and public fields - - [git #45] Apply [PreserveName] semantics in debug builds as well - - [git #52] DocumentFragment related API updates - - [git #54] DateTime metadata update - -v0.7.1.0 [5/2/2011] - - [git #19] Add CssFloat to Style - - [git #22] Fix issue with importing generic delegates - generic types were getting - created before their members were being imported. - - [git #20] If/While/For statements can have an no body statement when compiling in release - mode, and the only statement in source code is a debug-conditional statement. - - [git #27] Optimize generated script for checking equality against null, 0, true/false, empty - string by generating a check that works against false-y values - - [git #28] Fix jQueryAjaxOptions metadata - - [git #29] Add Select() to InputElement - - Added Observable and mscorlib infrastructure for observables, and change notification - - Added ObservableCollection and ObservableCollection along with mscorlib implementation - - Added Script.IsValue (equivalent of !Script.IsNullOrUndefined) - - Added Nullable and T? syntax support; .HasValue -> Script.IsValue, .Value is a no-op at runtime - - Added ElementQuery, ElementListQuery, and ElementReference helper classes for emitting script - expressions when using AddScriptlet - -v0.7.0.2 - - [git #7] Add missing jQueryObject.Html overload - - Add Document.ElementFromPoint - - DOM events API added - - [git #3] Fixed anonymous delegation creation by detecting use of 'this' context for - variable declaration - - [git #9] String literal optimization - - [git #11] Added SCRIPTSHARP to the defines list in the project template - - Remove Script.Windows.js and move the functionality into gadget project template. - - Add ss.init/ss.ready to mscorlib.js as well, in case page is not using ssloader.js. - -v0.7.0.1 - - [git #4] Fixed typo in mscorlib.js - - Fix typo in web.config in nuget package - - Fix bug with jQuery.InArray signature - -v0.7.0.0 [4/13/2011] - - Added basic generic support - ability to consume some generic types such as List, Dictionary, - Action, Func etc. - - Fix bug with NamedValues enum not working with [ScriptName] - - New script loader - - New asp.net mvc integration - - Updates to project templates to match new script loader - - Various metadata updates - eg. Canvas, Image, Document etc. - - Replace ContextualCallback with Action - - Replace CancelEventHandler with EventHandler - - Replace Delegate.Null -> Delegate.Empty - - ScriptCompilerTask msbuild task removes "DEBUG" define for release build even when building - in Debug mode from an msbuild perspective. - - Some namespace changes (eg. System.Globalization) - - Nuget package - - Replace XmlDocumentParser class with parseXml method diff --git a/Readme.md b/Readme.md index 3140c065d..72f0fcfd5 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # Script# Project # -Script# is a development tool that generates JavaScript by compiling C# source code. It is especially interesting for scripting-in-the-large scenarios that is commonplace in the current generation of HTML5 and script-based Web applications. +Script# is a development tool that generates JavaScript by compiling C# source code. It is especially interesting for scripting-in-the-large scenarios that is commonplace in the current generation of HTML5, node.js and script-based Web applications. The driving principle behind Script# is that JavaScript is the "assembly language of the Web" ... the idea isn't to dislike JavaScript, but rather appreciate it for its flexibility and ubiquity, while bringing the productivity and familiarity of C# when building large scale (large codebase, large team or project over a longer period) application where stronger tools, more maintainable codebases are of utmost importance. You might have heard of this described as "application scale". @@ -23,8 +23,9 @@ The [Script# Wiki](https://github.com/nikhilk/scriptsharp/wiki/Wiki) contains th * [Repository Contents](https://github.com/nikhilk/scriptsharp/wiki/Repository) * [Status](https://github.com/nikhilk/scriptsharp/wiki/Status), including roadmap and some thoughts about areas of contribution -* [Building and testing](https://github.com/nikhilk/scriptsharp/wiki/Building-and-Testing) the sources, and information on using private as well as incremental pre-release builds +* [Building, installing and testing](https://github.com/nikhilk/scriptsharp/wiki/Building,-Installing-and-Testing) the sources, and information on using private as well as incremental pre-release builds * [Coding guidelines](https://github.com/nikhilk/scriptsharp/wiki/Coding-Guidelines) +* [Release notes](https://github.com/nikhilk/scriptsharp/wiki/Release-Notes) for a changelog and any version to version migration details. ### Credits ### diff --git a/fx/Sharpen/Core/Core.csproj b/fx/Sharpen/Core/Core.csproj index 8821e2983..f3a597658 100644 --- a/fx/Sharpen/Core/Core.csproj +++ b/fx/Sharpen/Core/Core.csproj @@ -14,7 +14,6 @@ True True True - True True diff --git a/samples/AroundMe/AroundMe/AroundMe.csproj b/samples/AroundMe/AroundMe/AroundMe.csproj index 63bc2ee8d..2566f91a7 100644 --- a/samples/AroundMe/AroundMe/AroundMe.csproj +++ b/samples/AroundMe/AroundMe/AroundMe.csproj @@ -15,9 +15,7 @@ True True true - ..\AroundMeWeb\Scripts True - True bin\Debug\ diff --git a/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj b/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj index 090a954b8..eba29ac4d 100644 --- a/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj +++ b/samples/AroundMe/AroundMeWeb/AroundMeWeb.csproj @@ -19,6 +19,7 @@ + true true @@ -92,11 +93,16 @@ - + + + {c1aff814-2c3a-4d04-88a4-5cf10d07aa56} + AroundMe + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) @@ -122,6 +128,8 @@ + + @@ -12,6 +12,7 @@ Copyright (C) 2012. Script# Project. All rights reserved. + true true pdbonly false @@ -31,19 +32,18 @@ Copyright (C) 2012. Script# Project. All rights reserved. - + diff --git a/src/Core/Build/Tasks/ScriptCompilerTask.cs b/src/Core/Build/Tasks/ScriptCompilerTask.cs index e598bd776..ae7634a09 100644 --- a/src/Core/Build/Tasks/ScriptCompilerTask.cs +++ b/src/Core/Build/Tasks/ScriptCompilerTask.cs @@ -9,6 +9,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; +using System.Linq; using Microsoft.Build; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -28,62 +29,50 @@ public sealed class ScriptCompilerTask : Task, IErrorHandler, IStreamSourceResol private ITaskItem[] _references; private ITaskItem[] _sources; private ITaskItem[] _resources; - private ITaskItem _csharpAssembly; + private ITaskItem _assembly; private string _defines; private bool _minimize; - private bool _crunch; private bool _copyReferences; - private bool _localeSubfolders; - private string _referencesPath; + private string _copyReferencesPath; private string _outputPath; - private string _deploymentPath; + private string _scriptName; private List _scripts; private bool _hasErrors; public ScriptCompilerTask() { _copyReferences = true; - _crunch = true; } - public bool CopyReferences { - get { - return _copyReferences; - } - set { - _copyReferences = value; - } - } - - public string CopyReferencesPath { + [Required] + public ITaskItem Assembly { get { - if (_referencesPath == null) { - return String.Empty; - } - return _referencesPath; + return _assembly; } set { - _referencesPath = value; + _assembly = value; } } - public bool Crunch { + public bool CopyReferences { get { - return _crunch; + return _copyReferences; } set { - _crunch = value; + _copyReferences = value; } } - [Required] - public ITaskItem CSharpAssembly { + public string CopyReferencesPath { get { - return _csharpAssembly; + if (_copyReferencesPath == null) { + return String.Empty; + } + return _copyReferencesPath; } set { - _csharpAssembly = value; + _copyReferencesPath = value; } } @@ -99,27 +88,6 @@ public string Defines { } } - public string DeploymentPath { - get { - if (_deploymentPath == null) { - return String.Empty; - } - return _deploymentPath; - } - set { - _deploymentPath = value; - } - } - - public bool LocaleSubfolders { - get { - return _localeSubfolders; - } - set { - _localeSubfolders = value; - } - } - public bool Minimize { get { return _minimize; @@ -142,6 +110,7 @@ public string OutputPath { } } + [Required] public string ProjectPath { get { return _projectPath; @@ -170,6 +139,15 @@ public ITaskItem[] Resources { } } + public string ScriptName { + get { + return _scriptName; + } + set { + _scriptName = value; + } + } + [Output] public ITaskItem[] Scripts { get { @@ -237,15 +215,12 @@ private bool Compile(IEnumerable sourceItems, IEnumerable if (_minimize) { CompilerOptions minimizeOptions = CreateOptions(sourceItems, resourceItems, locale, - /* includeTests */ false, /* minimize */ true, - out scriptTaskItem); + /* includeTests */ false, /* minimize */ true, + out scriptTaskItem); ScriptCompiler minimizingCompiler = new ScriptCompiler(this); minimizingCompiler.Compile(minimizeOptions); if (_hasErrors == false) { - if (Crunch) { - ExecuteCruncher(scriptTaskItem); - } - + ExecuteCruncher(scriptTaskItem); OnScriptFileGenerated(scriptTaskItem, minimizeOptions, /* copyReferences */ false); } else { @@ -303,6 +278,7 @@ private bool ExecuteCore(IEnumerable sources, IEnumerable } } + GenerateDeploymentFile(); return true; } @@ -327,6 +303,24 @@ private void ExecuteCruncher(ITaskItem scriptItem) { File.WriteAllText(scriptItem.ItemSpec, crunchedScript); } + private void GenerateDeploymentFile() { + try { + string assemblyFile = Path.GetFileName(_assembly.ItemSpec); + string scriptsFilePath = Path.Combine(OutputPath, Path.ChangeExtension(assemblyFile, "scripts")); + + Uri scriptsUri = new Uri(Path.GetFullPath(scriptsFilePath), UriKind.Absolute); + IEnumerable scripts = + _scripts.Select(s => { + Uri fileUri = new Uri(s.ItemSpec, UriKind.Absolute); + return Uri.UnescapeDataString(scriptsUri.MakeRelativeUri(fileUri).ToString()); + }); + File.WriteAllLines(scriptsFilePath, scripts); + } + catch (Exception e) { + Log.LogError(e.ToString()); + } + } + private ICollection GetDefines() { if (Defines.Length == 0) { return new string[0]; @@ -396,36 +390,21 @@ private ICollection GetResources(IEnumerable allResour } private string GetScriptFilePath(string locale, bool minimize, bool includeTests) { - if ((_csharpAssembly != null) && (OutputPath.Length != 0)) { - string assemblyPath = _csharpAssembly.ItemSpec; - string assemblyFile = Path.GetFileName(assemblyPath); - string outputPath = OutputPath; - - if ((assemblyFile.Length > 7) && assemblyFile.StartsWith("Script.", StringComparison.OrdinalIgnoreCase)) { - // Resulting script files don't need a "Script." prefix, since that - // is mostly a naming convention used to separate out script# managed binaries. - - assemblyFile = assemblyFile.Substring(7); - } - - string extension = includeTests ? "test.js" : (minimize ? "min.js" : "js"); - if (String.IsNullOrEmpty(locale) == false) { - if (LocaleSubfolders) { - outputPath = Path.Combine(outputPath, locale); - } - else { - extension = locale + "." + extension; - } - } + string scriptName = ScriptName; + if (String.IsNullOrEmpty(scriptName)) { + scriptName = Path.GetFileName(_assembly.ItemSpec); + } - if (Directory.Exists(outputPath) == false) { - Directory.CreateDirectory(outputPath); - } + string extension = includeTests ? "test.js" : (minimize ? "min.js" : "js"); + if (String.IsNullOrEmpty(locale) == false) { + extension = locale + "." + extension; + } - return Path.Combine(outputPath, Path.ChangeExtension(assemblyFile, extension)); + if (Directory.Exists(OutputPath) == false) { + Directory.CreateDirectory(OutputPath); } - return null; + return Path.GetFullPath(Path.Combine(OutputPath, Path.ChangeExtension(scriptName, extension))); } private ICollection GetSources(IEnumerable sourceItems) { @@ -450,8 +429,6 @@ private ICollection GetSources(IEnumerable sourceItems } private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options, bool copyReferences) { - _scripts.Add(scriptItem); - Func getScriptFile = delegate(string reference, bool minimized) { string scriptFile = Path.ChangeExtension(reference, minimized ? ".min.js" : ".js"); @@ -496,6 +473,8 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options // Copy the file, and then make sure it is not read-only (for example, if the // source file for a referenced script is read-only). File.SetAttributes(targetFilePath, FileAttributes.Normal); + + _scripts.Add(new TaskItem(targetFilePath)); } catch (Exception e) { Log.LogError("Unable to copy referenced script '" + sourceFilePath + "' as '" + targetFilePath + "' (" + e.Message + ")"); @@ -503,7 +482,7 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options } }; - string projectName = (_projectPath != null) ? Path.GetFileNameWithoutExtension(_projectPath) : String.Empty; + string projectName = Path.GetFileNameWithoutExtension(_projectPath); string scriptFileName = Path.GetFileName(scriptItem.ItemSpec); string scriptPath = Path.GetFullPath(scriptItem.ItemSpec); string scriptFolder = Path.GetDirectoryName(scriptItem.ItemSpec); @@ -518,39 +497,15 @@ private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options safeCopyFile(scriptFile, path); } - if (_minimize) { - string minScriptFile = getScriptFile(reference, /* minimized */ true); - if (minScriptFile != null) { - string path = Path.Combine(scriptFolder, CopyReferencesPath, Path.GetFileName(minScriptFile)); - safeCopyFile(minScriptFile, path); - } + string minScriptFile = getScriptFile(reference, /* minimized */ true); + if (minScriptFile != null) { + string path = Path.Combine(scriptFolder, CopyReferencesPath, Path.GetFileName(minScriptFile)); + safeCopyFile(minScriptFile, path); } } } - string deploymentPath = DeploymentPath; - if (DeploymentPath.Length != 0) { - string deployedScriptPath = Path.Combine(deploymentPath, scriptFileName); - safeCopyFile(scriptPath, deployedScriptPath); - - if (copyReferences) { - foreach (string reference in options.References) { - string scriptFile = getScriptFile(reference, /* minimized */ false); - if (scriptFile != null) { - string path = Path.Combine(deploymentPath, CopyReferencesPath, Path.GetFileName(scriptFile)); - safeCopyFile(scriptFile, path); - } - - if (_minimize) { - string minScriptFile = getScriptFile(reference, /* minimized */ true); - if (minScriptFile != null) { - string path = Path.Combine(deploymentPath, CopyReferencesPath, Path.GetFileName(minScriptFile)); - safeCopyFile(minScriptFile, path); - } - } - } - } - } + _scripts.Add(scriptItem); } #region Implementation of IErrorHandler diff --git a/src/Core/Compiler/Compiler/ExpressionBuilder.cs b/src/Core/Compiler/Compiler/ExpressionBuilder.cs index 9d1d38c46..7faed834a 100644 --- a/src/Core/Compiler/Compiler/ExpressionBuilder.cs +++ b/src/Core/Compiler/Compiler/ExpressionBuilder.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using ScriptSharp; using ScriptSharp.CodeModel; @@ -317,13 +318,27 @@ private Expression ProcessBinaryExpressionNode(BinaryExpressionNode node) { if (leftExpression.Type == ExpressionType.Member) { leftExpression = TransformMemberExpression((MemberExpression)leftExpression, - /* getOrAdd */ (node.Operator != TokenType.Equal)); + /* getOrAdd */ (node.Operator != TokenType.Equal)); } if (rightExpression.Type == ExpressionType.Member) { rightExpression = TransformMemberExpression((MemberExpression)rightExpression); } + if (node.Operator == TokenType.Coalesce) { + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + MethodSymbol valueMethod = (MethodSymbol)scriptType.GetMember("Value"); + + TypeExpression scriptExpression = new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers); + MethodExpression valueExpression = new MethodExpression(scriptExpression, valueMethod); + + valueExpression.AddParameterValue(leftExpression); + valueExpression.AddParameterValue(rightExpression); + valueExpression.Reevaluate(rightExpression.EvaluatedType); + + return valueExpression; + } + TypeSymbol resultType = null; Operator operatorType = OperatorConverter.OperatorFromToken(node.Operator); @@ -540,12 +555,7 @@ private Expression ProcessDotExpressionNode(BinaryExpressionNode node, SymbolFil } if (objectExpression is LiteralExpression) { - object literalValue = ((LiteralExpression)objectExpression).Value; - if (!((literalValue is Boolean) || (literalValue is String))) { - // Numeric literals need to be paranthesized in script when followed by a - // dot member access. - objectExpression.AddParenthesisHint(); - } + objectExpression.AddParenthesisHint(); } Debug.Assert(objectExpression.EvaluatedType is ISymbolTable); @@ -1105,6 +1115,19 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { return new InlineScriptExpression("", objectType); } + if (args.Count > 1) { + // Check whether the script is a valid string format string + try { + object[] argValues = new object[args.Count - 1]; + String.Format(CultureInfo.InvariantCulture, script, argValues); + } + catch { + _errorHandler.ReportError("The argument to Script.Literal must be a valid String.Format string.", + argNodes.Expressions[0].Token.Location); + return new InlineScriptExpression("", objectType); + } + } + InlineScriptExpression scriptExpression = new InlineScriptExpression(script, objectType); for (int i = 1; i < args.Count; i++) { scriptExpression.AddParameterValue(args[i]); @@ -1115,9 +1138,22 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { else if (method.Name.Equals("Boolean", StringComparison.Ordinal)) { Debug.Assert(args.Count == 1); + args[0].AddParenthesisHint(); return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); } - else if (method.Name.Equals("Value", StringComparison.Ordinal)) { + else if (method.Name.Equals("IsTruthy", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); + + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); + } + else if (method.Name.Equals("IsFalsey", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); + + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, args[0]); + } + else if (method.Name.Equals("Or", StringComparison.Ordinal)) { Debug.Assert(args.Count >= 2); Expression expr = args[0]; diff --git a/src/Core/Compiler/Compiler/MetadataBuilder.cs b/src/Core/Compiler/Compiler/MetadataBuilder.cs index 6a5c0456a..d846598f0 100644 --- a/src/Core/Compiler/Compiler/MetadataBuilder.cs +++ b/src/Core/Compiler/Compiler/MetadataBuilder.cs @@ -890,6 +890,10 @@ private void BuildType(TypeSymbol typeSymbol, UserTypeNode typeNode) { if (moduleAttribute != null) { ((ClassSymbol)typeSymbol).SetModuleClass(); } + + if ((typeNode.Modifiers & Modifiers.Static) != 0) { + ((ClassSymbol)typeSymbol).SetStaticClass(); + } } if (typeNode.Type == TokenType.Enum) { diff --git a/src/Core/Compiler/Generator/ExpressionGenerator.cs b/src/Core/Compiler/Generator/ExpressionGenerator.cs index fe6e5ac3d..f05d70f36 100644 --- a/src/Core/Compiler/Generator/ExpressionGenerator.cs +++ b/src/Core/Compiler/Generator/ExpressionGenerator.cs @@ -43,11 +43,10 @@ private static void GenerateBinaryExpression(ScriptGenerator generator, MemberSy Debug.Assert(propExpression.Type == ExpressionType.PropertySet); if (propExpression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'set_"); + writer.Write(((BaseExpression)propExpression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.set_"); writer.Write(propExpression.Property.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpression(generator, symbol, expression.RightOperand); @@ -71,11 +70,10 @@ private static void GenerateBinaryExpression(ScriptGenerator generator, MemberSy Debug.Assert(indexExpression.Type == ExpressionType.Indexer); if (indexExpression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'set_"); + writer.Write(((BaseExpression)indexExpression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.set_"); writer.Write(indexExpression.Indexer.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpressionList(generator, symbol, indexExpression.Indices); @@ -478,11 +476,10 @@ private static void GenerateIndexerExpression(ScriptGenerator generator, MemberS writer.Write("]"); } else if (expression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'get_"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.get_"); writer.Write(expression.Indexer.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpressionList(generator, symbol, expression.Indices); @@ -525,7 +522,7 @@ private static void GenerateInlineScriptExpression(ScriptGenerator generator, Me } } - script = String.Format(script, parameterScripts); + script = String.Format(CultureInfo.InvariantCulture, script, parameterScripts); } writer.Write(script); @@ -707,11 +704,10 @@ private static void GenerateMethodExpression(ScriptGenerator generator, MemberSy if (expression.ObjectReference is BaseExpression) { Debug.Assert(expression.Method.IsExtension == false); - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", '"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype."); writer.Write(expression.Method.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) { writer.Write(", "); @@ -860,13 +856,7 @@ private static void GeneratePropertyExpression(ScriptGenerator generator, Member Debug.Assert(baseClass != null); writer.Write(baseClass.FullGeneratedName); - if (baseClass.IsApplicationType) { - writer.Write("$."); - } - else { - writer.Write(".prototype."); - } - writer.Write("get_"); + writer.Write(".prototype.get_"); writer.Write(expression.Property.GeneratedName); writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); diff --git a/src/Core/Compiler/Generator/MemberGenerator.cs b/src/Core/Compiler/Generator/MemberGenerator.cs index 4f4bf8fb2..78eadaf2a 100644 --- a/src/Core/Compiler/Generator/MemberGenerator.cs +++ b/src/Core/Compiler/Generator/MemberGenerator.cs @@ -79,7 +79,7 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("}"); if (instanceMember == false) { - writer.WriteLine(); + writer.WriteLine(";"); } if (instanceMember) { @@ -121,7 +121,7 @@ private static void GenerateEvent(ScriptGenerator generator, string typeName, Ev writer.Write("}"); if (instanceMember == false) { - writer.WriteLine(); + writer.WriteLine(";"); } } @@ -154,25 +154,13 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, return; } - ScriptTextWriter writer = generator.Writer; + Debug.Assert((indexerSymbol.Visibility & MemberVisibility.Static) == 0); - bool instanceMember = true; - if ((indexerSymbol.Visibility & MemberVisibility.Static) != 0) { - instanceMember = false; - writer.Write(typeName); - writer.Write("."); - } + ScriptTextWriter writer = generator.Writer; writer.Write("get_"); writer.Write(indexerSymbol.GeneratedName); - if (instanceMember) { - writer.Write(": "); - } - else { - writer.Write(" = "); - } - - writer.Write("function("); + writer.Write(": function("); for (int i = 0; i < indexerSymbol.Parameters.Count - 1; i++) { ParameterSymbol parameterSymbol = indexerSymbol.Parameters[i]; @@ -193,28 +181,12 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, writer.Indent--; writer.Write("}"); - if (instanceMember == false) { - writer.WriteLine(); - } - if (indexerSymbol.IsReadOnly == false) { - if (instanceMember) { - writer.WriteLine(","); - } - else { - writer.Write(typeName); - writer.Write("."); - } + writer.WriteLine(","); writer.Write("set_"); writer.Write(indexerSymbol.GeneratedName); - if (instanceMember) { - writer.Write(": "); - } - else { - writer.Write(" = "); - } - writer.Write("function("); + writer.Write(": function("); for (int i = 0; i < indexerSymbol.Parameters.Count; i++) { ParameterSymbol parameterSymbol = indexerSymbol.Parameters[i]; if (i > 0) { @@ -235,10 +207,6 @@ private static void GenerateIndexer(ScriptGenerator generator, string typeName, writer.WriteLine(";"); writer.Indent--; writer.Write("}"); - - if (instanceMember == false) { - writer.WriteLine(); - } } } @@ -301,7 +269,7 @@ private static void GenerateMethod(ScriptGenerator generator, string typeName, M writer.Write("}"); if (instanceMember == false) { - writer.WriteLine(); + writer.WriteLine(";"); } } @@ -339,7 +307,7 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("}"); if (instanceMember == false) { - writer.WriteLine(); + writer.WriteLine(";"); } if (propertySymbol.IsReadOnly == false) { @@ -378,7 +346,7 @@ private static void GenerateProperty(ScriptGenerator generator, string typeName, writer.Write("}"); if (instanceMember == false) { - writer.WriteLine(); + writer.WriteLine(";"); } } } diff --git a/src/Core/Compiler/Generator/ScriptGenerator.cs b/src/Core/Compiler/Generator/ScriptGenerator.cs index a23f826cd..0841df52b 100644 --- a/src/Core/Compiler/Generator/ScriptGenerator.cs +++ b/src/Core/Compiler/Generator/ScriptGenerator.cs @@ -9,6 +9,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; +using System.Linq; using ScriptSharp; using ScriptSharp.ScriptModel; @@ -106,9 +107,9 @@ public void GenerateScript(SymbolSet symbolSet) { // Sort the types, so similar types of types are grouped, and parent classes // come before derived classes. IComparer typeComparer = new TypeComparer(); - types.Sort(typeComparer); - publicTypes.Sort(typeComparer); - internalTypes.Sort(typeComparer); + types = types.OrderBy(t => t, typeComparer).ToList(); + publicTypes = publicTypes.OrderBy(t => t, typeComparer).ToList(); + internalTypes = internalTypes.OrderBy(t => t, typeComparer).ToList(); bool initialIndent = false; if (String.IsNullOrEmpty(_options.ScriptInfo.Template) == false) { diff --git a/src/Core/Compiler/Generator/TypeGenerator.cs b/src/Core/Compiler/Generator/TypeGenerator.cs index 9bad6b18b..22ba64c38 100644 --- a/src/Core/Compiler/Generator/TypeGenerator.cs +++ b/src/Core/Compiler/Generator/TypeGenerator.cs @@ -69,44 +69,46 @@ private static void GenerateClass(ScriptGenerator generator, ClassSymbol classSy } } - writer.Write("var "); - writer.Write(name); - writer.WriteLine("$ = {"); - writer.Indent++; + if (classSymbol.IsStaticClass == false) { + writer.Write("var "); + writer.Write(name); + writer.WriteLine("$ = {"); + writer.Indent++; - bool firstMember = true; - foreach (MemberSymbol memberSymbol in classSymbol.Members) { - if ((memberSymbol.Visibility & MemberVisibility.Static) == 0) { - if (memberSymbol.Type == SymbolType.Field) { - continue; - } + bool firstMember = true; + foreach (MemberSymbol memberSymbol in classSymbol.Members) { + if ((memberSymbol.Visibility & MemberVisibility.Static) == 0) { + if (memberSymbol.Type == SymbolType.Field) { + continue; + } - if ((memberSymbol is CodeMemberSymbol) && - ((CodeMemberSymbol)memberSymbol).IsAbstract) { - continue; + if ((memberSymbol is CodeMemberSymbol) && + ((CodeMemberSymbol)memberSymbol).IsAbstract) { + continue; + } + + if (firstMember == false) { + writer.WriteLine(","); + } + + MemberGenerator.GenerateScript(generator, memberSymbol); + firstMember = false; } + } + if (classSymbol.Indexer != null) { if (firstMember == false) { writer.WriteLine(","); } - MemberGenerator.GenerateScript(generator, memberSymbol); - firstMember = false; - } - } - - if (classSymbol.Indexer != null) { - if (firstMember == false) { - writer.WriteLine(","); + MemberGenerator.GenerateScript(generator, classSymbol.Indexer); } - MemberGenerator.GenerateScript(generator, classSymbol.Indexer); + writer.Indent--; + writer.WriteLine(); + writer.Write("};"); + writer.WriteLine(); } - - writer.Indent--; - writer.WriteLine(); - writer.Write("};"); - writer.WriteLine(); } private static void GenerateEnumeration(ScriptGenerator generator, EnumerationSymbol enumSymbol) { @@ -260,8 +262,13 @@ public static void GenerateRegistrationScript(ScriptGenerator generator, TypeSym writer.Write("[ "); writer.Write(typeSymbol.FullGeneratedName); writer.Write(", "); - writer.Write(typeSymbol.FullGeneratedName); - writer.Write("$, "); + if (((ClassSymbol)typeSymbol).IsStaticClass == false) { + writer.Write(typeSymbol.FullGeneratedName); + writer.Write("$, "); + } + else { + writer.Write("null, "); + } if ((classSymbol.BaseClass == null) || classSymbol.IsTestClass) { // TODO: We need to introduce the notion of a base class that only exists in the metadata // and not at runtime. At that point this check of IsTestClass can be generalized. diff --git a/src/Core/Compiler/ScriptCompiler.cs b/src/Core/Compiler/ScriptCompiler.cs index d6f25e48c..b2700fbb4 100644 --- a/src/Core/Compiler/ScriptCompiler.cs +++ b/src/Core/Compiler/ScriptCompiler.cs @@ -108,6 +108,10 @@ private void BuildMetadata() { continue; } + // TODO: We could allow conflicting types as long as both aren't public + // since they won't be on the exported types list. Internal types that + // conflict could be generated using full name. + string name = appType.GeneratedName; if (types.ContainsKey(name)) { string error = "The type '" + appType.FullName + "' conflicts with with '" + types[name].FullName + "' as they have the same name."; @@ -310,11 +314,20 @@ private string GenerateScriptWithTemplate() { depLookupBuilder.Append(",\r\n "); } + string name = dependency.Name; + if (name == "ss") { + // TODO: This is a hack... to make generated node.js scripts + // be able to reference the 'scriptsharp' node module. + // Fix this in a better/1st class manner by allowing + // script assemblies to declare such things. + name = "scriptsharp"; + } + requiresBuilder.Append("'" + dependency.Path + "'"); dependenciesBuilder.Append(dependency.Identifier); depLookupBuilder.Append(dependency.Identifier); - depLookupBuilder.Append(" = require('" + dependency.Name + "')"); + depLookupBuilder.Append(" = require('" + name + "')"); firstDependency = false; } diff --git a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs index 26baf48d7..0df7088b5 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs @@ -23,6 +23,9 @@ public LiteralExpression(TypeSymbol valueType, object value) protected override bool IsParenthesisRedundant { get { + // Numeric literals need to be paranthesized in script when followed by a + // dot member access, so it is not redundant for numbers. + if ((_value is String) || (_value is Boolean)) { return true; } diff --git a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs index d6620bab4..ff9fdffe6 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs @@ -48,7 +48,6 @@ public static Operator OperatorFromToken(TokenType token) { case TokenType.LogAnd: return Operator.LogicalAnd; case TokenType.LogOr: - case TokenType.Coalesce: return Operator.LogicalOr; case TokenType.EqualEqual: return Operator.EqualEqualEqual; diff --git a/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs index 5db1ecd27..ad5d8392b 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/ClassSymbol.cs @@ -26,6 +26,7 @@ internal class ClassSymbol : TypeSymbol { private string _extendee; private bool _testClass; private bool _moduleClass; + private bool _staticClass; private ClassSymbol _primaryPartialClass; @@ -124,6 +125,15 @@ public bool IsModuleClass { } } + public bool IsStaticClass { + get { + if (_primaryPartialClass != null) { + return _primaryPartialClass.IsStaticClass; + } + return _staticClass; + } + } + public bool IsTestClass { get { if (_primaryPartialClass != null) { @@ -303,6 +313,15 @@ public void SetPrimaryPartialClass(ClassSymbol primaryPartialClass) { _primaryPartialClass = primaryPartialClass; } + public void SetStaticClass() { + if (_primaryPartialClass != null) { + _primaryPartialClass.SetStaticClass(); + return; + } + + _staticClass = true; + } + public void SetTestClass() { if (_primaryPartialClass != null) { _primaryPartialClass.SetTestClass(); diff --git a/src/Core/Compiler/ScriptModel/Symbols/TypeSymbol.cs b/src/Core/Compiler/ScriptModel/Symbols/TypeSymbol.cs index 1c956a876..5a42280cf 100644 --- a/src/Core/Compiler/ScriptModel/Symbols/TypeSymbol.cs +++ b/src/Core/Compiler/ScriptModel/Symbols/TypeSymbol.cs @@ -69,17 +69,13 @@ public override string DocumentationID { public string FullGeneratedName { get { - if (_ignoreNamespace == false) { + if ((IsApplicationType == false) && (_ignoreNamespace == false)) { string namespaceName = GeneratedNamespace; if (namespaceName.Length != 0) { - if (IsApplicationType) { - return namespaceName + "$" + GeneratedName; - } - else { - return namespaceName + "." + GeneratedName; - } + return namespaceName + "." + GeneratedName; } } + return GeneratedName; } } diff --git a/src/Core/CoreLib/Date.cs b/src/Core/CoreLib/Date.cs index d1c03fd4a..f4e5b6cef 100644 --- a/src/Core/CoreLib/Date.cs +++ b/src/Core/CoreLib/Date.cs @@ -183,7 +183,7 @@ public int GetUTCSeconds() { return 0; } - [ScriptName("parseDate")] + [ScriptAlias("ss.date")] public static Date Parse(string value) { return null; } diff --git a/src/Core/CoreLib/Runtime.cs b/src/Core/CoreLib/Runtime.cs index 0293a8f29..63c298b1f 100644 --- a/src/Core/CoreLib/Runtime.cs +++ b/src/Core/CoreLib/Runtime.cs @@ -544,9 +544,66 @@ public decimal Value { namespace System.Runtime.InteropServices { + [AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ScriptIgnore] - public class OutAttribute { + public sealed class OutAttribute : Attribute { + } +} + +namespace System.Runtime.Serialization { + + [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class DataContractAttribute : Attribute { + + public bool IsReference { + get; + set; + } + + public string Name { + get; + set; + } + + public string Namespace { + get; + set; + } + } + + [AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class DataMemberAttribute : Attribute { + + public bool EmitDefaultValue { + get; + set; + } + + public bool IsReference { + get; + set; + } + + public string Name { + get; + set; + } + + public int Order { + get; + set; + } + } + + [AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field, Inherited = false, AllowMultiple = false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [ScriptIgnore] + public sealed class IgnoreDataMemberAttribute : Attribute { } } diff --git a/src/Core/CoreLib/Script.cs b/src/Core/CoreLib/Script.cs index 43f84b8bd..3e25f586a 100644 --- a/src/Core/CoreLib/Script.cs +++ b/src/Core/CoreLib/Script.cs @@ -131,6 +131,26 @@ public static T InvokeMethod(Type type, string name, params object[] args) { return default(T); } + /// + /// Checks if the specified object has a falsey value, i.e. it is null or + /// undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a falsey value; false otherwise. + public static bool IsFalsey(object o) { + return false; + } + + [ScriptAlias("isFinite")] + public static bool IsFinite(object o) { + return false; + } + + [ScriptAlias("isNaN")] + public static bool IsNaN(object o) { + return false; + } + /// /// Checks if the specified object is null. /// @@ -176,6 +196,16 @@ public static bool IsValue(object o) { return false; } + /// + /// Checks if the specified object has a truthy value, i.e. it is not + /// null or undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a truthy value; false otherwise. + public static bool IsTruthy(object o) { + return false; + } + /// /// Enables you to generate an arbitrary (literal) script expression. /// The script can contain simple String.Format style tokens (such as @@ -188,6 +218,18 @@ public static object Literal(string script, params object[] args) { return null; } + /// + /// Gets the first truthy (true, non-null, non-undefined, non-empty, non-zero) value. + /// + /// The type of the value. + /// The value to check for validity. + /// The alternate value to use if the first is invalid. + /// Additional alternative values to use if the first is invalid. + /// The first valid value. + public static TValue Or(TValue value, TValue alternateValue, params TValue[] alternateValues) { + return default(TValue); + } + public static void SetField(object instance, string name, object value) { } @@ -245,13 +287,14 @@ public static int SetTimeout(Delegate d, int milliseconds, params object[] args) } /// - /// Gets the first valid (non-null, non-undefined, non-empty) value. + /// Gets the first non-null and non-undefined value. /// /// The type of the value. /// The value to check for validity. /// The alternate value to use if the first is invalid. /// Additional alternative values to use if the first is invalid. /// The first valid value. + [ScriptAlias("ss.value")] public static TValue Value(TValue value, TValue alternateValue, params TValue[] alternateValues) { return default(TValue); } diff --git a/src/Core/CoreLib/String.cs b/src/Core/CoreLib/String.cs index 6939d8088..e445f6acc 100644 --- a/src/Core/CoreLib/String.cs +++ b/src/Core/CoreLib/String.cs @@ -379,20 +379,36 @@ public string ToUpperCase() { return null; } + [ScriptAlias("ss.trim")] public string Trim() { return null; } + [ScriptAlias("ss.trim")] + public string Trim(char[] trimCharacters) { + return null; + } + [ScriptAlias("ss.trimEnd")] public string TrimEnd() { return null; } + [ScriptAlias("ss.trimEnd")] + public string TrimEnd(char[] trimCharacters) { + return null; + } + [ScriptAlias("ss.trimStart")] public string TrimStart() { return null; } + [ScriptAlias("ss.trimStart")] + public string TrimStart(char[] trimCharacters) { + return null; + } + /// /// Decodes a string by replacing escaped parts with their equivalent textual representation. /// diff --git a/src/Core/CoreLib/Threading/Task.cs b/src/Core/CoreLib/Threading/Task.cs index 14e0080e7..2ab3bce7f 100644 --- a/src/Core/CoreLib/Threading/Task.cs +++ b/src/Core/CoreLib/Threading/Task.cs @@ -50,6 +50,10 @@ public static Task Any(int timeout, params Task[] tasks) { return null; } + public Task ChangeWith(Func continuation) { + return null; + } + public Task ContinueWith(Action continuation) { return null; } @@ -85,6 +89,10 @@ public T Result { } } + public Task ChangeWith(Func, TResult> continuation) { + return null; + } + public Task ContinueWith(Action> continuation) { return null; } diff --git a/src/Core/Scripts/Loader.js b/src/Core/Scripts/Loader.js index 2ca2f0886..324da6236 100644 --- a/src/Core/Scripts/Loader.js +++ b/src/Core/Scripts/Loader.js @@ -391,7 +391,7 @@ if (document.addEventListener) { var rs = document.readyState; rs == 'complete' || rs == 'interactive' ? - _startup() : + setTimeout(_startup, 0) : document.addEventListener('DOMContentLoaded', _startup, false); } else if (global.attachEvent) { diff --git a/src/Core/Scripts/Package/package.json b/src/Core/Scripts/Package/package.json new file mode 100644 index 000000000..80826f7d6 --- /dev/null +++ b/src/Core/Scripts/Package/package.json @@ -0,0 +1,17 @@ +{ + "name": "scriptsharp", + "version": "0.8.0", + "description": "Script# Runtime", + "keywords": [ "scriptsharp", "script#" ], + "author": "Nikhil Kothari", + "license": "Apache 2.0", + "repository": { + "type": "git", + "url": "https://github.com/nikhilk/scriptsharp" + }, + "main": "ss.js", + "dependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/src/Core/Scripts/Package/readme.md b/src/Core/Scripts/Package/readme.md new file mode 100644 index 000000000..b71dace71 --- /dev/null +++ b/src/Core/Scripts/Package/readme.md @@ -0,0 +1,4 @@ +Script# Runtime + +This packages the script# runtime as a node module for node.js applications written using c# and compiled into javascript using the script# compiler. +More information is at [http://scriptsharp.com](http://scriptsharp.com). diff --git a/src/Core/Scripts/Runtime.js b/src/Core/Scripts/Runtime.js index b4cf92324..beba55767 100644 --- a/src/Core/Scripts/Runtime.js +++ b/src/Core/Scripts/Runtime.js @@ -44,6 +44,7 @@ version: '0.8', isValue: isValue, + value: value, extend: extend, keys: keys, keyCount: keyCount, @@ -55,6 +56,7 @@ boolean: parseBoolean, regexp: parseRegExp, number: parseNumber, + date: parseDate, truncate: truncate, now: now, today: today, @@ -69,6 +71,7 @@ endsWith: endsWith, padLeft: padLeft, padRight: padRight, + trim: trim, trimStart: trimStart, trimEnd: trimEnd, insertString: insertString, @@ -92,7 +95,6 @@ safeCast: safeCast, canAssign: canAssign, instanceOf: instanceOf, - base: base, culture: { neutral: neutralCulture, diff --git a/src/Core/Scripts/Runtime/Misc.js b/src/Core/Scripts/Runtime/Misc.js index 481e0ca68..9275e4d8b 100644 --- a/src/Core/Scripts/Runtime/Misc.js +++ b/src/Core/Scripts/Runtime/Misc.js @@ -7,6 +7,18 @@ function isValue(o) { return (o !== null) && (o !== undefined); } +function _value(args) { + for (var i = 2, l = args.length; i < l; i++) { + if (isValue(args[i])) { + return args[i]; + } + } + return null; +} +function value(a, b) { + return isValue(a) ? a : isValue(b) ? b : _value(arguments); +} + function extend(o, items) { for (var n in items) { o[n] = items[n]; @@ -36,12 +48,17 @@ function parseNumber(s) { return 0; } if ((s.indexOf('.') >= 0) || (s.indexOf('e') >= 0) || - s.endsWith('f') || s.endsWith('F')) { + endsWith(s, 'f') || endsWith(s, 'F')) { return parseFloat(s); } return parseInt(s, 10); } +function parseDate(s) { + var t = Date.parse(s); + return isNaN(t) ? undefined : new Date(t); +} + function truncate(n) { return (n >= 0) ? Math.floor(n) : Math.ceil(n); } @@ -107,7 +124,7 @@ function error(message, errorInfo, innerException) { function fail(message) { console.assert(false, message); - if (global.navigator && (global.navigator.userAgent.indexOf('MSIE') > 0)) { + if (global.navigator) { eval('debugger;'); } } diff --git a/src/Core/Scripts/Runtime/String.js b/src/Core/Scripts/Runtime/String.js index ca3467230..6b864a922 100644 --- a/src/Core/Scripts/Runtime/String.js +++ b/src/Core/Scripts/Runtime/String.js @@ -58,11 +58,21 @@ function format(cultureOrFormat) { }); } -function trimStart(s) { - return s.replace(/^\s*/, ''); +function trim(s, tc) { + if (tc || !String.prototype.trim) { + tc = tc ? tc.join('') : null; + var r = tc ? new RegExp('^[' + tc + ']+|[' + tc + ']+$', 'g') : /^\s+|\s+$/g; + return s.replace(r, ''); + } + return s.trim(); +} +function trimStart(s, tc) { + var r = tc ? new RegExp('^[' + tc.join('') + ']+') : /^\s+/; + return s.replace(r, ''); } -function trimEnd(s) { - return s.replace(/\s*$/, ''); +function trimEnd(s, tc) { + var r = tc ? new RegExp('[' + tc.join('') + ']+$') : /\s+$/; + return s.replace(r, ''); } function startsWith(s, prefix) { if (emptyString(prefix)) { diff --git a/src/Core/Scripts/Runtime/Task.js b/src/Core/Scripts/Runtime/Task.js index c308d00d6..40dd9f3b3 100644 --- a/src/Core/Scripts/Runtime/Task.js +++ b/src/Core/Scripts/Runtime/Task.js @@ -1,7 +1,7 @@ // Task function Task(result) { - this._continuations = isValue(result) ? + this._continuations = result !== undefined ? (this.status = 'done', null) : (this.status = 'pending', []); this.result = result; @@ -11,6 +11,23 @@ var Task$ = { get_completed: function() { return this.status != 'pending'; }, + changeWith: function(continuation) { + var task = new Task(); + this.continueWith(function(t) { + var error = t.error; + var result; + if (!error) { + try { + result = continuation(t); + } + catch (e) { + error = e; + } + } + _updateTask(task, result, error); + }); + return task; + }, continueWith: function(continuation) { if (this._continuations) { this._continuations.push(continuation); @@ -73,6 +90,10 @@ function _joinTasks(tasks, any) { tasks = tasks.slice(1); count--; } + if (Array.isArray(tasks[0])) { + tasks = tasks[0]; + count = tasks.length; + } var joinTask = new Task(); var seen = 0; diff --git a/src/Core/Scripts/Runtime/TypeSystem.js b/src/Core/Scripts/Runtime/TypeSystem.js index c478b92ff..5bf79bcfc 100644 --- a/src/Core/Scripts/Runtime/TypeSystem.js +++ b/src/Core/Scripts/Runtime/TypeSystem.js @@ -153,12 +153,6 @@ function safeCast(instance, type) { return instanceOf(type, instance) ? instance : null; } -function base(instanceOrType, method) { - var baseType = instanceOrType.constructor.$base || instanceOrType.$base; - var m = baseType.prototype[method]; - return m !== instanceOrType[method] ? m : base(baseType, method); -} - function module(name, implementation, exports) { var registry = _modules[name] = { $name: name }; diff --git a/src/Core/Scripts/Scripts.csproj b/src/Core/Scripts/Scripts.csproj index e8894387f..a9323d886 100644 --- a/src/Core/Scripts/Scripts.csproj +++ b/src/Core/Scripts/Scripts.csproj @@ -32,11 +32,17 @@ + + + + + + diff --git a/src/Libraries/Node/Node.Azure/Azure.cs b/src/Libraries/Node/Node.Azure/Azure.cs new file mode 100644 index 000000000..7b6a58b4d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Azure.cs @@ -0,0 +1,53 @@ +// Azure.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.WindowsAzure.Runtime; +using NodeApi.WindowsAzure.Storage; + +namespace NodeApi.WindowsAzure { + + /// + /// The root Azure services API. + /// + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure")] + public static class Azure { + + [ScriptField] + [ScriptName(PreserveCase = true)] + public static RoleEnvironment RoleEnvironment { + get { + return null; + } + } + + public static CloudBlobService CreateBlobService() { + return null; + } + + public static CloudBlobService CreateBlobService(string storageAccount, string accessKey) { + return null; + } + + public static CloudQueueService CreateQueueService() { + return null; + } + + public static CloudQueueService CreateQueueService(string storageAccount, string accessKey) { + return null; + } + + public static CloudTableService CreateTableService() { + return null; + } + + public static CloudTableService CreateTableService(string storageAccount, string accessKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Node.Azure.csproj b/src/Libraries/Node/Node.Azure/Node.Azure.csproj new file mode 100644 index 000000000..a9296cadd --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Node.Azure.csproj @@ -0,0 +1,88 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} + Library + Properties + NodeApi.WindowsAzure + Script.Node.Azure + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..653672513 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node.Azure")] +[assembly: AssemblyDescription("Script# NodeJS Azure Module API")] +[assembly: ScriptAssembly("azure")] diff --git a/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt new file mode 100644 index 000000000..a0e3513f9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Azure Module +=============================================================================== + +This assembly provides access to Azure Cloud APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against Azure APIs. + +More information is on http://www.windowsazure.com/en-us/develop/nodejs/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Azure/Runtime/Role.cs b/src/Libraries/Node/Node.Azure/Runtime/Role.cs new file mode 100644 index 000000000..2841fc2c5 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/Role.cs @@ -0,0 +1,18 @@ +// Role.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Role { + + private Role() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs new file mode 100644 index 000000000..87e1320c8 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs @@ -0,0 +1,63 @@ +// RoleEnvironment.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEnvironment { + + private RoleEnvironment() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Changed { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Changing { + add { + } + remove { + } + } + + public void ClearStatus(AsyncCallback callback) { + } + + public void GetConfigurationSettings(AsyncResultCallback> callback) { + } + + public void GetCurrentRoleInstance(AsyncResultCallback callback) { + } + + [ScriptName("getDeploymentId")] + public void GetDeploymentID(AsyncResultCallback callback) { + } + + public void GetRoles(AsyncResultCallback callback) { + } + + public void IsAvailable(AsyncResultCallback callback) { + } + + public void IsEmulated(AsyncResultCallback callback) { + } + + public void RequestRecycle(AsyncCallback callback) { + } + + public void SetStatus(RoleStatus status, Date expirationDate, AsyncCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs new file mode 100644 index 000000000..ac2834823 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs @@ -0,0 +1,32 @@ +// RoleEvent.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEvent { + + private RoleEvent() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + + [ScriptField] + public RoleEventType Type { + get { + return RoleEventType.ConfigurationSettingChange; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs new file mode 100644 index 000000000..e7403960e --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs @@ -0,0 +1,20 @@ +// RoleEventType.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleEventType { + + TopologyChange = 0, + + ConfigurationSettingChange = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs new file mode 100644 index 000000000..272d094e9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs @@ -0,0 +1,18 @@ +// RoleInstance.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleInstance { + + private RoleInstance() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs new file mode 100644 index 000000000..47f37368d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs @@ -0,0 +1,20 @@ +// RoleStatus.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleStatus { + + Busy = 0, + + Ready = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs new file mode 100644 index 000000000..35caef469 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs @@ -0,0 +1,26 @@ +// CloudBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlob { + + internal CloudBlob() { + } + + [ScriptField] + [ScriptName("blob")] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs new file mode 100644 index 000000000..374a1cd31 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs @@ -0,0 +1,25 @@ +// CloudBlobContainer.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainer { + + private CloudBlobContainer() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs new file mode 100644 index 000000000..3bec7f8c9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobContainerListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainerListContinuation { + + private CloudBlobContainerListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs new file mode 100644 index 000000000..725507961 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs @@ -0,0 +1,25 @@ +// CloudBlobLease.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlobLease { + + internal CloudBlobLease() { + } + + [ScriptField] + public string ID { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs new file mode 100644 index 000000000..31065d9db --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobListContinuation { + + private CloudBlobListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs new file mode 100644 index 000000000..04ad65b8b --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs @@ -0,0 +1,145 @@ +// CloudBlobService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: ACLs + // TODO: Page blobs + // TODO: Shared access signatures + // TODO: Metadata/properties + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobService { + + private CloudBlobService() { + } + + public void AcquireLease(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void AcquireLease(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void CreateContainer(string containerName, AsyncCallback callback) { + } + + public void CreateContainer(string containerName, object options, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, object options, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, object options, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, object options, AsyncCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, object options, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListContainers(AsyncResultCallback> callback) { + } + + public void ListContainers(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ListContainers(object options, AsyncResultCallback> callback) { + } + + public void ListContainers(object options, AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs new file mode 100644 index 000000000..b7457ae05 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs @@ -0,0 +1,18 @@ +// CloudBlockBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlockBlob : CloudBlob { + + private CloudBlockBlob() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs new file mode 100644 index 000000000..949eede12 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs @@ -0,0 +1,26 @@ +// CloudQueue.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueue { + + private CloudQueue() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs new file mode 100644 index 000000000..2d32e5418 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs @@ -0,0 +1,33 @@ +// CloudQueueListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueListContinuation { + + private CloudQueueListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudQueueListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs new file mode 100644 index 000000000..42d075201 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs @@ -0,0 +1,42 @@ +// CloudQueueMessage.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueMessage { + + private CloudQueueMessage() { + } + + [ScriptField] + [ScriptName("messageid")] + public string MessageID { + get { + return null; + } + } + + [ScriptField] + [ScriptName("messagetext")] + public string MessageText { + get { + return null; + } + } + + [ScriptField] + [ScriptName("popreceipt")] + public string PopReceipt { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs new file mode 100644 index 000000000..f3826a8d3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs @@ -0,0 +1,82 @@ +// CloudQueueService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueService { + + private CloudQueueService() { + } + + public void ClearMessages(string queueName, AsyncCallback callback) { + } + + public void ClearMessages(string queueName, object options, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, object options, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, object options, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, object options, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, object options, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, object options, AsyncCallback callback) { + } + + public void GetMessages(string queueName, AsyncResultCallback> callback) { + } + + public void GetMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void ListQueues(AsyncResultCallback> callback) { + } + + public void ListQueues(object options, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, AsyncResultCallback callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs new file mode 100644 index 000000000..0c83c1f85 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs @@ -0,0 +1,26 @@ +// CloudTable.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTable { + + private CloudTable() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string TableName { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs new file mode 100644 index 000000000..536c61764 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs @@ -0,0 +1,60 @@ +// CloudTableEntity.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class CloudTableEntity { + + public CloudTableEntity() { + } + + public CloudTableEntity(params object[] nameValuePairs) { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string PartitionKey { + get { + return null; + } + set { + } + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string RowKey { + get { + return null; + } + set { + } + } + + [ScriptField] + public object this[string key] { + get { + return null; + } + set { + } + } + + public static implicit operator Dictionary(CloudTableEntity entity) { + return null; + } + + public static implicit operator CloudTableEntity(Dictionary data) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs new file mode 100644 index 000000000..10214c048 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs @@ -0,0 +1,33 @@ +// CloudTableListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableListContinuation { + + private CloudTableListContinuation() { + } + + [ScriptField] + public string NextTableName { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs new file mode 100644 index 000000000..a54c06903 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs @@ -0,0 +1,57 @@ +// CloudTableQuery.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure.TableQuery")] + public sealed class CloudTableQuery { + + public CloudTableQuery And(string filter, object[] values) { + return null; + } + + public CloudTableQuery From(string tableName) { + return null; + } + + public CloudTableQuery Or(string filter, object[] values) { + return null; + } + + public CloudTableQuery Select() { + return null; + } + + public CloudTableQuery Select(string[] fields) { + return null; + } + + public CloudTableQuery Top(int count) { + return null; + } + + public CloudTableQuery Where(string filter, string value) { + return null; + } + + public CloudTableQuery Where(string filter, object[] values) { + return null; + } + + public CloudTableQuery WhereKeys(string partitionKey, string rowKey) { + return null; + } + + public CloudTableQuery WhereNextKeys(string partitionKey, string rowKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs new file mode 100644 index 000000000..9c613bac3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs @@ -0,0 +1,40 @@ +// CloudTableQueryContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableQueryContinuation { + + private CloudTableQueryContinuation() { + } + + [ScriptField] + public string NextPartitionKey { + get { + return null; + } + } + + [ScriptField] + public string NextRowKey { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs new file mode 100644 index 000000000..1360191c6 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs @@ -0,0 +1,130 @@ +// CloudTableService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableService { + + private CloudTableService() { + } + + public void BeginBatch() { + } + + public void CommitBatch(AsyncCallback callback) { + } + + public void CommitBatch(object options, AsyncCallback callback) { + } + + public void CreateTable(string tableName, AsyncCallback callback) { + } + + public void CreateTable(string tableName, object options, AsyncCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, AsyncResultCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, object options, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, object options, AsyncResultCallback callback) { + } + + public bool HasOperations() { + return false; + } + + public void InsertEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public bool IsInBatch() { + return false; + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, AsyncResultCallback callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, object options, AsyncResultCallback callback) { + } + + public void Rollback() { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs b/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs index 6e966c33f..6d7d02672 100644 --- a/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs +++ b/src/Libraries/Node/Node.Core/Compute/ChildProcess.cs @@ -5,6 +5,7 @@ using System; using System.Runtime.CompilerServices; +using NodeApi.IO; namespace NodeApi.Compute { @@ -16,5 +17,77 @@ public sealed class ChildProcess : IEventEmitter { private ChildProcess() { } + + [ScriptName("pid")] + [ScriptField] + public int ProcessID { + get { + return 0; + } + } + + [ScriptName("stderr")] + [ScriptField] + public ReadableStream StandardError { + get { + return null; + } + } + + [ScriptName("stdin")] + [ScriptField] + public WritableStream StandardInput { + get { + return null; + } + } + + [ScriptName("stdout")] + [ScriptField] + public ReadableStream StandardOutput { + get { + return null; + } + } + + public void Disconnect() { + } + + public static ChildProcess Exec(string command, AsyncResultCallback callback) { + return null; + } + + public static ChildProcess Exec(string command, object options, AsyncResultCallback callback) { + return null; + } + + public static ChildProcess ExecFile(string command, string[] args, object options, AsyncResultCallback callback) { + return null; + } + + public void Kill() { + } + + public void Kill(string signal) { + } + + public static ChildProcess Fork(string command, string[] args, object options) { + return null; + } + + public void Send(object message) { + } + + public static ChildProcess Spawn(string command) { + return null; + } + + public static ChildProcess Spawn(string command, string[] args) { + return null; + } + + public static ChildProcess Spawn(string command, string[] args, object options) { + return null; + } } } diff --git a/src/Libraries/Node/Node.Core/Compute/OS.cs b/src/Libraries/Node/Node.Core/Compute/OS.cs index 7553bee99..7aaa40b57 100644 --- a/src/Libraries/Node/Node.Core/Compute/OS.cs +++ b/src/Libraries/Node/Node.Core/Compute/OS.cs @@ -13,5 +13,68 @@ namespace NodeApi.Compute { [ScriptDependency("os")] [ScriptName("os")] public static class OS { + + [ScriptName("EOL")] + public static int EndOfLine = 0; + + [ScriptName("arch")] + public static string GetArchitecture() { + return null; + } + + [ScriptName("loadavg")] + public static int[] GetAverageLoad() { + return null; + } + + [ScriptName("cpus")] + public static object[] GetCPUs() { + return null; + } + + [ScriptName("freemem")] + public static int GetFreeMemory() { + return 0; + } + + [ScriptName("hostname")] + public static string GetHostName() { + return null; + } + + [ScriptName("type")] + public static string GetName() { + return null; + } + + [ScriptName("networkInterfaces")] + public static object[] GetNetworkInterfaces() { + return null; + } + + [ScriptName("platform")] + public static string GetPlatform() { + return null; + } + + [ScriptName("release")] + public static string GetRelease() { + return null; + } + + [ScriptName("tmpDir")] + public static string GetTempDirectory() { + return null; + } + + [ScriptName("totalmem")] + public static int GetTotalMemory() { + return 0; + } + + [ScriptName("uptime")] + public static int GetUptime() { + return 0; + } } } diff --git a/src/Libraries/Node/Node.Core/Compute/Process.cs b/src/Libraries/Node/Node.Core/Compute/Process.cs index 7f5112c53..c91b335a0 100644 --- a/src/Libraries/Node/Node.Core/Compute/Process.cs +++ b/src/Libraries/Node/Node.Core/Compute/Process.cs @@ -109,6 +109,14 @@ public event Action Exit { } } + [ScriptEvent("on", "removeListener")] + public event Action Message { + add { + } + remove { + } + } + [ScriptEvent("on", "removeListener")] public event Action UncaughtException { add { @@ -124,6 +132,9 @@ public void ChangeDirectory(string directory) { public void Abort() { } + public void Disconnect() { + } + [ScriptName("exit")] public void ExitProcess() { } diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs b/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs new file mode 100644 index 000000000..df8c9d871 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptContext.cs @@ -0,0 +1,18 @@ +// ScriptContext.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ScriptContext { + + private ScriptContext() { + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs b/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs new file mode 100644 index 000000000..d0fc344c6 --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptEngine.cs @@ -0,0 +1,61 @@ +// ScriptEngine.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("vm")] + [ScriptName("vm")] + public static class ScriptEngine { + + public static ScriptContext CreateContext() { + return null; + } + + public static ScriptContext CreateContext(object global) { + return null; + } + + public static ScriptInstance CreateScript(string code) { + return null; + } + + public static ScriptInstance CreateScript(string code, string fileName) { + return null; + } + + public static object RunInContext(string code, ScriptContext context) { + return null; + } + + public static object RunInContext(string code, ScriptContext context, string fileName) { + return null; + } + + public static object RunInNewContext(string code) { + return null; + } + + public static object RunInNewContext(string code, object global) { + return null; + } + + public static object RunInNewContext(string code, object global, string fileName) { + return null; + } + + public static object RunInThisContext(string code) { + return null; + } + + public static object RunInThisContext(string code, string fileName) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs b/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs new file mode 100644 index 000000000..8a228105a --- /dev/null +++ b/src/Libraries/Node/Node.Core/Compute/ScriptInstance.cs @@ -0,0 +1,30 @@ +// ScriptInstance.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Compute { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class ScriptInstance { + + private ScriptInstance() { + } + + public object RunInNewContext() { + return null; + } + + public object RunInNewContext(object global) { + return null; + } + + public object RunInThisContext() { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Buffer.cs b/src/Libraries/Node/Node.Core/IO/Buffer.cs index b7109cb77..3b8c1de6a 100644 --- a/src/Libraries/Node/Node.Core/IO/Buffer.cs +++ b/src/Libraries/Node/Node.Core/IO/Buffer.cs @@ -11,5 +11,221 @@ namespace NodeApi.IO { [ScriptImport] [ScriptIgnoreNamespace] public sealed class Buffer { + + public Buffer(int size) { + } + + public Buffer(int[] data) { + } + + public Buffer(string data) { + } + + public Buffer(string data, Encoding encoding) { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + public int this[int index] { + get { + return 0; + } + set { + } + } + + public static Buffer Concat(Buffer[] buffers) { + return null; + } + + public static Buffer Concat(Buffer[] buffers, int count) { + return null; + } + + public void Copy(Buffer targetBuffer) { + } + + public void Copy(Buffer targetBuffer, int targetStart) { + } + + public void Copy(Buffer targetBuffer, int targetStart, int sourceStart) { + } + + public void Copy(Buffer targetBuffer, int targetStart, int sourceStart, int sourceLength) { + } + + public void Fill(int i) { + } + + public void Fill(int i, int offset) { + } + + public void Fill(int i, int offset, int end) { + } + + [ScriptName("byteLength")] + public static int GetByteLength(string s) { + return 0; + } + + [ScriptName("byteLength")] + public static int GetByteLength(string s, Encoding encoding) { + return 0; + } + + public static bool IsBuffer(object o) { + return false; + } + + [ScriptName("readInt8")] + public byte ReadByte(int offset) { + return 0; + } + + public double ReadDoubleBE(int offset) { + return 0; + } + + public double ReadDoubleLE(int offset) { + return 0; + } + + [ScriptName("readFloatBE")] + public float ReadSingleBE(int offset) { + return 0; + } + + [ScriptName("readFloatLE")] + public float ReadSingleLE(int offset) { + return 0; + } + + [ScriptName("readUInt8")] + public byte ReadUByte(int offset) { + return 0; + } + + public short ReadInt16BE(int offset) { + return 0; + } + + public short ReadInt16LE(int offset) { + return 0; + } + + public int ReadInt32BE(int offset) { + return 0; + } + + public int ReadInt32LE(int offset) { + return 0; + } + + public short ReadUInt16BE(int offset) { + return 0; + } + + public short ReadUInt16LE(int offset) { + return 0; + } + + public int ReadUInt32BE(int offset) { + return 0; + } + + public int ReadUInt32LE(int offset) { + return 0; + } + + public Buffer Slice() { + return null; + } + + public Buffer Slice(int start) { + return null; + } + + public Buffer Slice(int start, int end) { + return null; + } + + public string ToString(Encoding encoding) { + return null; + } + + public string ToString(Encoding encoding, int start) { + return null; + } + + public string ToString(Encoding encoding, int start, int end) { + return null; + } + + public int Write(string s) { + return 0; + } + + public int Write(string s, int offset) { + return 0; + } + + public int Write(string s, int offset, int length) { + return 0; + } + + public int Write(string s, int offset, int length, Encoding encoding) { + return 0; + } + + [ScriptName("writeInt8")] + public void WriteByte(byte b, int offset) { + } + + public void WriteDoubleBE(double value, int offset) { + } + + public void WriteDoubleLE(double value, int offset) { + } + + public void WriteInt16BE(short value, int offset) { + } + + public void WriteInt16LE(short value, int offset) { + } + + public void WriteInt32BE(int value, int offset) { + } + + public void WriteInt32LE(int value, int offset) { + } + + [ScriptName("writeFloatBE")] + public void WriteSingleBE(float value, int offset) { + } + + [ScriptName("writeFloatLE")] + public void WriteSingleLE(float value, int offset) { + } + + [ScriptName("writeUInt8")] + public void WriteUByte(byte b, int offset) { + } + + public void WriteUInt16BE(short value, int offset) { + } + + public void WriteUInt16LE(short value, int offset) { + } + + public void WriteUInt32BE(int value, int offset) { + } + + public void WriteUInt32LE(int value, int offset) { + } } } diff --git a/src/Libraries/Node/Node.Core/IO/Console.cs b/src/Libraries/Node/Node.Core/IO/Console.cs new file mode 100644 index 000000000..ba2737a25 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Console.cs @@ -0,0 +1,47 @@ +// Console.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("console")] + public static class Console { + + public static void Error(string message) { + } + + public static void Error(string messageFormat, params object[] args) { + } + + public static void Log(string message) { + } + + [ScriptName("dir")] + public static void Log(string messageFormat, params object[] args) { + } + + [ScriptName("dir")] + public static void LogObject(object o) { + } + + [ScriptName("timeEnd")] + public static void LogTimeEnd(string label) { + } + + [ScriptName("time")] + public static void LogTimeStart(string label) { + } + + public static void Warn(string message) { + } + + public static void Warn(string messageFormat, params object[] args) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Encoding.cs b/src/Libraries/Node/Node.Core/IO/Encoding.cs index bd3752679..2a103af97 100644 --- a/src/Libraries/Node/Node.Core/IO/Encoding.cs +++ b/src/Libraries/Node/Node.Core/IO/Encoding.cs @@ -16,6 +16,9 @@ public enum Encoding { [ScriptName("ascii")] Ascii, + [ScriptName("base64")] + Base64, + [ScriptName("hex")] Hex, diff --git a/src/Libraries/Node/Node.Core/IO/FileSystem.cs b/src/Libraries/Node/Node.Core/IO/FileSystem.cs index af2d4eeff..ec90c58a7 100644 --- a/src/Libraries/Node/Node.Core/IO/FileSystem.cs +++ b/src/Libraries/Node/Node.Core/IO/FileSystem.cs @@ -118,10 +118,6 @@ public static string[] ReadDirectorySync(string path) { public static void ReadFile(string fileName, AsyncResultCallback callback) { } - [ScriptName("readFile")] - public static void ReadFileText(string fileName, AsyncResultCallback callback) { - } - [ScriptName("readFile")] public static void ReadFileText(string fileName, Encoding encoding, AsyncResultCallback callback) { } @@ -130,12 +126,7 @@ public static Buffer ReadFileSync(string fileName) { return null; } - [ScriptName("readFile")] - public static string ReadFileTextSync(string fileName) { - return null; - } - - [ScriptName("readFile")] + [ScriptName("readFileSync")] public static string ReadFileTextSync(string fileName, Encoding encoding) { return null; } diff --git a/src/Libraries/Node/Node.Core/IO/LineReader.cs b/src/Libraries/Node/Node.Core/IO/LineReader.cs new file mode 100644 index 000000000..afff778fb --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/LineReader.cs @@ -0,0 +1,91 @@ +// LineReader.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("readline")] + public sealed class LineReader : IEventEmitter { + + private LineReader() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Close { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + [ScriptName("SIGINT")] + public event Action Interrupt { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Line { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Pause { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Resume { + add { + } + remove { + } + } + + public static LineReader CreateInterface(LineReaderOptions options) { + return null; + } + + [ScriptName("close")] + public void CloseReader() { + } + + [ScriptName("pause")] + public void PauseReader() { + } + + public void Prompt() { + } + + public void Prompt(bool preserveCursor) { + } + + [ScriptName("resume")] + public void ResumeReader() { + } + + public void Question(string query, Action callback) { + } + + public void SetPrompt(string prompt, int length) { + } + + public void Write(string data) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs b/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs new file mode 100644 index 000000000..3cb578e0a --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/LineReaderOptions.cs @@ -0,0 +1,40 @@ +// LineReaderOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class LineReaderOptions { + + public LineReaderOptions() { + } + + public LineReaderOptions(params object[] nameValuePairs) { + } + + [ScriptField] + public ReadableStream Input { + get { + return null; + } + set { + } + } + + [ScriptField] + public WritableStream Output { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Path.cs b/src/Libraries/Node/Node.Core/IO/Path.cs new file mode 100644 index 000000000..725e7052b --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/Path.cs @@ -0,0 +1,57 @@ +// Path.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("path")] + [ScriptName("path")] + public static class Path { + + [ScriptName("sep")] + public static string PathSeparator = null; + + [ScriptName("dirname")] + public static string GetDirectoryName(string path) { + return null; + } + + [ScriptName("extname")] + public static string GetExtension(string path) { + return null; + } + + [ScriptName("basename")] + public static string GetName(string path) { + return null; + } + + [ScriptName("basename")] + public static string GetName(string path, string extensionToStrip) { + return null; + } + + public static string Join(params string[] pathParts) { + return null; + } + + [ScriptName("relative")] + public static string MakeRelative(string from, string to) { + return null; + } + + public static string Normalize(string path) { + return null; + } + + public static string Resolve(string from, string to) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/REPL.cs b/src/Libraries/Node/Node.Core/IO/REPL.cs new file mode 100644 index 000000000..b46d7a79b --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPL.cs @@ -0,0 +1,32 @@ +// REPL.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptDependency("repl")] + [ScriptName("repl")] + public sealed class REPL { + + private REPL() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Exit { + add { + } + remove { + } + } + + public static REPL Start(object options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs b/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs new file mode 100644 index 000000000..a8ca7f0c5 --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPLEvaluator.cs @@ -0,0 +1,14 @@ +// REPLEvaluator.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void REPLEvaluator(string command, object context, string fileName, AsyncResultCallback callback); +} diff --git a/src/Libraries/Node/Node.Core/IO/REPLOptions.cs b/src/Libraries/Node/Node.Core/IO/REPLOptions.cs new file mode 100644 index 000000000..8724a572c --- /dev/null +++ b/src/Libraries/Node/Node.Core/IO/REPLOptions.cs @@ -0,0 +1,58 @@ +// REPLOptions.cs +// Script#/Libraries/Node/Core +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.IO { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class REPLOptions { + + public REPLOptions() { + } + + public REPLOptions(params object[] nameValuePairs) { + } + + [ScriptField] + public REPLEvaluator Eval { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Prompt { + get { + return null; + } + set { + } + } + + [ScriptField] + public ReadableStream Input { + get { + return null; + } + set { + } + } + + [ScriptField] + public WritableStream Output { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs b/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs index 831564ab3..d19d94068 100644 --- a/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs +++ b/src/Libraries/Node/Node.Core/Network/HttpClientOptions.cs @@ -4,6 +4,7 @@ // using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; namespace NodeApi.Network { @@ -19,6 +20,60 @@ public HttpClientOptions() { public HttpClientOptions(object[] nameValuePairs) { } - // TODO + [ScriptField] + [ScriptName("auth")] + public string Credentials { + get { + return null; + } + set { + } + } + + [ScriptField] + public Dictionary Headers { + get { + return null; + } + set { + } + } + + [ScriptField] + [ScriptName("hostname")] + public string HostName { + get { + return null; + } + set { + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + set { + } + } + + [ScriptField] + public string Path { + get { + return null; + } + set { + } + } + + [ScriptField] + public int Port { + get { + return 0; + } + set { + } + } } } diff --git a/src/Libraries/Node/Node.Core/Network/HttpVerb.cs b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs index 01198d564..b7d9c3a44 100644 --- a/src/Libraries/Node/Node.Core/Network/HttpVerb.cs +++ b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs @@ -23,6 +23,8 @@ public enum HttpVerb { HEAD, - OPTIONS + OPTIONS, + + PATCH } } diff --git a/src/Libraries/Node/Node.Core/Network/Url.cs b/src/Libraries/Node/Node.Core/Network/Url.cs index 3d005d49b..42e005363 100644 --- a/src/Libraries/Node/Node.Core/Network/Url.cs +++ b/src/Libraries/Node/Node.Core/Network/Url.cs @@ -11,7 +11,7 @@ namespace NodeApi.Network { [ScriptImport] [ScriptIgnoreNamespace] [ScriptDependency("url")] - [ScriptName("URL")] + [ScriptName("url")] public static class Url { public static string Format(UrlData urlData) { diff --git a/src/Libraries/Node/Node.Core/Network/UrlData.cs b/src/Libraries/Node/Node.Core/Network/UrlData.cs index 19f856479..f2c03902e 100644 --- a/src/Libraries/Node/Node.Core/Network/UrlData.cs +++ b/src/Libraries/Node/Node.Core/Network/UrlData.cs @@ -39,6 +39,7 @@ public string Host { } [ScriptField] + [ScriptName("hostname")] public string HostName { get; set; diff --git a/src/Libraries/Node/Node.Core/Node.Core.csproj b/src/Libraries/Node/Node.Core/Node.Core.csproj index 96a845461..a564e9590 100644 --- a/src/Libraries/Node/Node.Core/Node.Core.csproj +++ b/src/Libraries/Node/Node.Core/Node.Core.csproj @@ -41,9 +41,19 @@ + + + + + + + + + + diff --git a/src/Libraries/Node/Node.Express/Express.cs b/src/Libraries/Node/Node.Express/Express.cs index 4baea2251..720b95845 100644 --- a/src/Libraries/Node/Node.Express/Express.cs +++ b/src/Libraries/Node/Node.Express/Express.cs @@ -85,6 +85,10 @@ public static ExpressMiddleware Static(string path) { return null; } + public static ExpressMiddleware Static(string path, object options) { + return null; + } + [ScriptName("urlencoded")] public static ExpressMiddleware UrlEncoded() { return null; diff --git a/src/Libraries/Node/Node.Mongo/MongoConnector.cs b/src/Libraries/Node/Node.Mongo/MongoConnector.cs new file mode 100644 index 000000000..18bd3ef23 --- /dev/null +++ b/src/Libraries/Node/Node.Mongo/MongoConnector.cs @@ -0,0 +1,24 @@ +// MongoConnector.cs +// Script#/Libraries/Node/Mongo +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.MongoDB { + + [ScriptImport] + [ScriptName("Db")] + public sealed class MongoConnector { + + public MongoConnector(string name, MongoServer server) { + } + + public MongoConnector(string name, MongoServer server, object options) { + } + + public void Open(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Mongo/MongoDatabase.cs b/src/Libraries/Node/Node.Mongo/MongoDatabase.cs index 83a52f053..7a4f0a74a 100644 --- a/src/Libraries/Node/Node.Mongo/MongoDatabase.cs +++ b/src/Libraries/Node/Node.Mongo/MongoDatabase.cs @@ -18,6 +18,9 @@ public MongoDatabase(string name, MongoServer server) { public MongoDatabase(string name, MongoServer server, object options) { } + public void Authenticate(string userName, string password, AsyncResultCallback successCallback) { + } + public void Close() { } diff --git a/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj b/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj index 2fbd6c480..3cb4428b9 100644 --- a/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj +++ b/src/Libraries/Node/Node.Mongo/Node.Mongo.csproj @@ -40,6 +40,7 @@ true + diff --git a/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs b/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs new file mode 100644 index 000000000..291d43934 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphDatabase.cs @@ -0,0 +1,186 @@ +// GraphDatabase.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j graph database. Start here. + /// + [ScriptImport] + public class GraphDatabase { + + /// + /// Construct a new client for the Neo4j graph database available at the given (root) URL. + /// + /// The root URL where the Neo4j graph database is available, e.g. 'http://localhost:7474/'. This URL should include HTTP Basic Authentication info if needed, e.g. 'http://user:password@example.com/'. + /// Graph db = new Graph("http://localhost:7474"); + public GraphDatabase(string url) { + } + + /// + /// Construct a new client for the Neo4j graph database available at the given (root) URL. + /// + /// + /// url: The root URL where the Neo4j graph database is available, e.g. 'http://localhost:7474/'. This URL should include HTTP Basic Authentication info if needed, e.g. 'http://user:password@example.com/'. + /// proxy: An optional proxy URL for all requests. + /// + /// Graph db = new Graph(new Dictionary("url", "http://localhost:7474")); + public GraphDatabase(Dictionary opts) { + } + + /// + /// Create and immediately return a new, unsaved node with the given properties. + /// Note: This node will not be persisted to the database until and unless its save() method is called. + /// + /// The properties this new node should have. + /// Node + public GraphNode CreateNode(Dictionary data) { + return null; + } + + /// + /// Execute and "return" (via callback) the results of the given Gremlin script, optionally passing along the given script parameters + /// (recommended to avoid Gremlin injection security vulnerabilities). Any values in the returned results that represent nodes, relationships + /// or paths are returned as , or instances. + /// + /// The Gremlin script. Can be multi-line. + /// A map of parameters for the Gremlin script. + /// Returns List<object> + /// + /// + /// var script = "g.v(userId).out('likes')"; + /// + /// var params = { + /// userId: currentUser.id + /// }; + /// + /// db.execute(script, params, function (err, likes) { + /// if (err) throw err; + /// likes.forEach(function (node) { + /// // ... + /// }); + /// }); + /// + /// + public void Execute(string script, Dictionary parameters, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the node indexed under the given property and value in the given index. If none exists, returns undefined. + /// Note: With this method, at most one node is returned. See for returning multiple nodes. + /// + /// The name of the index, e.g. 'node_auto_index'. + /// The name of the property, e.g. 'username'. + /// The value of the property, e.g. 'aseemk'. + /// Returns Node + public void GetIndexedNode(string index, string property, object value, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes indexed under the given property and value in the given index. If no such nodes exist, an empty array is returned. + /// Note: This method will return multiple nodes if there are multiple hits. See #getIndexedNode for returning at most one node. + /// + /// The name of the index, e.g. 'node_auto_index'. + /// The name of the property, e.g. 'platform'. + /// The value of the property, e.g. 'xbox'. + /// Returns List<Node> + public void GetIndexedNodes(string index, string property, object value, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the relationship indexed under the given property and value in the given index. If none exists, returns undefined. + /// Note: With this method, at most one relationship is returned. See for returning multiple relationships. + /// + /// The name of the index, e.g. 'relationship_auto_index'. + /// The name of the property, e.g. 'created'. + /// The value of the property, e.g. 1346713658393. + /// Returns Relationship + public void GetIndexedRelationship(string index, string property, object value, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships indexed under the given property and value in the given index. If no such + /// relationships exist, an empty array is returned. + /// Note: This method will return multiple relationships if there are multiple hits. See for returning at most one relationship. + /// + /// The name of the index, e.g. 'relationship_auto_index'. + /// The name of the property, e.g. 'favorite'. + /// The value of the property, e.g. true. + /// Returns List<Relationship> + public void GetIndexedRelationships(string index, string property, object value, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the node with the given Neo4j ID. + /// + /// The integer ID of the node: 1234 + /// Returns Node + /// If no node exists with this ID. + public void GetNodeById(int id, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationship with the given Neo4j ID. + /// + /// The integer ID of the relationship, e.g. 1234. + /// Returns Relationship + public void GetRelationshipById(int id, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the Neo4j version as a float. + /// + /// Returns Number + public void GetVersion(AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the results of the given Cypher query, optionally passing along the given query parameters + /// (recommended to avoid Cypher injection security vulnerabilities). The returned results are an array of "rows" (matches), + /// where each row is a map from key name (as given in the query) to value. Any values that represent nodes, relationships or + /// paths are returned as , or instances. + /// + /// The Cypher query. Can be multi-line. + /// A map of parameters for the Cypher query. + /// Returns List<object> + /// + /// + /// var query = [ + /// 'START user=node({userId})', + /// 'MATCH (user) -[:likes]-> (other)', + /// 'RETURN other' + /// ].join('\n'); + /// + /// var params = { + /// userId: currentUser.id + /// }; + /// + /// db.query(query, params, function (err, results) { + /// if (err) throw err; + /// var likes = results.map(function (result) { + /// return result['other']; + /// }); + /// // ... + /// }); + /// + /// + public void Query(string query, Dictionary parameters, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes matching the given query (in Lucene syntax) from the given index. If no such nodes exist, an empty array is returned. + /// + /// The name of the index, e.g. node_auto_index. + /// The Lucene query, e.g. foo:bar AND hello:world. + /// Returns List<Node> + public void QueryNodeIndex(string index, string query, AsyncResultCallback> callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphNode.cs b/src/Libraries/Node/Node.Neo4j/GraphNode.cs new file mode 100644 index 000000000..b07764906 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphNode.cs @@ -0,0 +1,125 @@ +// GraphNode.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j node. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Node")] + public sealed class GraphNode : GraphPropertyContainer { + + private GraphNode() { + } + + /// + /// Persist or update this node in the database. + /// + /// Returns (via callback) this same Node instance after the save. + public void Save(AsyncResultCallback callback) { + } + + /// + /// Delete this node from the database. This will throw an error if this node has any relationships on it, unless the + /// force flag is passed in, in which case those relationships are also deleted. + /// + /// + /// If this node has any relationships on it, whether those relationships should be deleted as well. Note: For safety, it's recommended to not pass the force flag and instead manually and explicitly delete known relationships beforehand. + public void Delete(AsyncResultCallback callback, bool force) { + } + + /// + /// Add this node to the given index under the given key-value pair. + /// + /// The name of the index, e.g. 'users'. + /// The key to index under, e.g. 'username' + /// The value to index under, e.g. 'aseemk'. + /// + public void Index(string index, string key, object value, AsyncResultCallback callback) { + } + + /// + /// Create and "return" (via callback) a relationship of the given type and with the given properties from this node to another node. + /// + /// Node to create a relationship to + /// Type of relationship + /// The properties this relationship should have. + /// Returns a Relationship + public void CreateRelationshipTo(GraphNode otherNode, string type, Dictionary data, AsyncResultCallback callback) { + } + + /// + /// Create and "return" (via callback) a relationship of the given type and with the given properties from another node to this node. + /// + /// Node to create a relationship to + /// Type of relationship + /// The properties this relationship should have. + /// Returns a Relationship + /// + public void CreateRelationshipFrom(GraphNode otherNode, string type, Dictionary data, AsyncResultCallback callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships of the given type or types from or to this node. + /// + /// The types of Relationships to return + /// Returns a list of Relationships + /// + public void GetRelationships(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the relationships of the given type or types from this node. + /// + /// The types of outgoing Relationships + /// Returns a list of Relationships + /// + public void Outgoing(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the Relationships of the given type or types to this node. + /// + /// The types of incoming Relationships + /// Returns a list of Relationships + /// + public void Incoming(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the Relationships of the given type or types from or to this node. + /// + /// The types of incoming or outgoing Relationships + /// Returns a list of Relationships + public void All(List types, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the nodes adjacent to this one following only relationships of the given type(s) and/or direction(s). + /// + /// It can be an array of string types, e.g. ['likes', 'loves']. + /// Returns a list of Nodes + public void GetRelationshipNodes(List rels, AsyncResultCallback> callback) { + } + + /// + /// Fetch and "return" (via callback) the shortest path, if there is one, from this node to the given node. Returns null if no path exists. + /// + /// Destination node to find the shortest path to + /// The type of relationship to follow. + /// One of 'in', 'out', or 'all'. + /// The maximum number of relationships to follow when searching for paths. The default is 1. + /// This needs to be 'shortestPath' for now. + /// Returns a + public void Path(GraphNode to, string type, string direction, Int32 maxDepth, string algorithm, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphPath.cs b/src/Libraries/Node/Node.Neo4j/GraphPath.cs new file mode 100644 index 000000000..45aa7b1d6 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphPath.cs @@ -0,0 +1,73 @@ +// GraphPath.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j path. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Path")] + public sealed class GraphPath { + + private GraphPath() { + } + + /// + /// The node that this path ends at. + /// + [ScriptField] + public GraphNode End { + get { + return null; + } + } + + /// + /// The length of this path + /// + [ScriptField] + public int Length { + get { + return -1; + } + } + + /// + /// The nodes that make up this path. + /// + [ScriptField] + public List Nodes { + get { + return null; + } + } + + /// + /// The relationships that make up this path. + /// + [ScriptField] + public List Relationships { + get { + return null; + } + } + + /// + /// The node that this path starts at. + /// + [ScriptField] + public GraphNode Start { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs b/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs new file mode 100644 index 000000000..b6e10a3b0 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphPropertyContainer.cs @@ -0,0 +1,80 @@ +// GraphPropertyContainer.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The abstract class corresponding to a Neo4j property container. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("PropertyContainer")] + public abstract class GraphPropertyContainer { + + internal GraphPropertyContainer() { + } + + /// + /// Whether this property container exists in (has been persisted to) the Neo4j database. + /// + [ScriptField] + public bool Exists { + get { + return false; + } + } + + /// + /// This property container's properties. This is a map of key-value pairs. + /// + [ScriptField] + public Dictionary Data { + get { + return null; + } + } + + /// + /// If this property container exists, its Neo4j integer ID. + /// + [ScriptField] + public int Id { + get { + return -1; + } + } + + /// + /// The URL of this property container. + /// + [ScriptField] + public string Self { + get { + return string.Empty; + } + } + + /// + /// Delete this property container from the database. + /// + /// Callback function to execute when the delete operation is complete + [ScriptName("del")] + public void Delete(AsyncResultCallback callback) { + } + + /// + /// Test whether the given object represents the same property container as this one. They can be separate instances with separate data. + /// + /// Object to compare for equality + /// True if equal + public bool Equals(object other) { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs b/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs new file mode 100644 index 000000000..92fa57af3 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/GraphRelationship.cs @@ -0,0 +1,69 @@ +// GraphRelationship.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Neo4j { + + /// + /// The class corresponding to a Neo4j relationship. + /// + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Relationship")] + public sealed class GraphRelationship : GraphPropertyContainer { + + private GraphRelationship() { + } + + /// + /// The node this relationship goes to. + /// + [ScriptField] + public GraphNode End { + get { + return null; + } + } + + /// + /// The node this relationship goes from. + /// + [ScriptField] + public GraphNode Start { + get { + return null; + } + } + + /// + /// This relationship's type. + /// + [ScriptField] + public string Type { + get { + return String.Empty; + } + } + + /// + /// Add this relationship to the given relationship index under the given property key and value. + /// + /// The name of the index, e.g. 'likes'. + /// The property key to index under, e.g. 'created'. + /// The property value to index under, e.g. 1346713658393. + /// + public void Index(string index, string key, object value, AsyncResultCallback callback) { + } + + /// + /// Persist or update this relationship in the database. "Returns" (via callback) this same instance after the save. + /// + /// Returns a Relationship + public void Save(AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj b/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj new file mode 100644 index 000000000..100c4afe5 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Node.Neo4J.csproj @@ -0,0 +1,64 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {232445FF-22AA-46F7-BA12-4590C670F2B1} + Library + 512 + Properties + Node.Neo4j + Script.Node.Neo4j + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + DEBUG + prompt + 4 + 1591, 0661, 0660, 1684 + ..\..\..\..\bin\Debug\Script.Node.Neo4j.xml + + + ..\..\..\..\bin\Release\ + + + prompt + 4 + 1591, 0661, 0660, 1684 + ..\..\..\..\bin\Release\Script.Node.Neo4j.xml + + + + + Properties\ScriptSharp.cs + + + + + + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..29314fa45 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Neo4J +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Script.Node.Neo4J")] +[assembly: AssemblyDescription("Script# NodeJS Neo4j Client Library API")] +[assembly: ScriptAssembly("neo4j")] diff --git a/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt new file mode 100644 index 000000000..e55f8bc14 --- /dev/null +++ b/src/Libraries/Node/Node.Neo4j/Properties/ScriptInfo.txt @@ -0,0 +1,14 @@ +Node-Neo4J Client Library +=============================================================================== + +This assembly provides access to the Neo4j Graph Database APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against the Node-Neo4j APIs. + +You must install the neo4j package for runtime functionality and install the Neo4j database. + +More info on Node-Neo4j is on https://github.com/thingdom/node-neo4j + +More info on Neo4j is on http://www.neo4j.org/ + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Restify/Node.Restify.csproj b/src/Libraries/Node/Node.Restify/Node.Restify.csproj new file mode 100644 index 000000000..fbfbea917 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Node.Restify.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} + Library + Properties + NodeApi.Restify + Script.Node.Restify + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + + {36d4b098-a21c-4725-acd3-400922885f38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d1497e2e9 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Script.Node.Restify")] +[assembly: AssemblyDescription("Script# NodeJS Restify Module API")] +[assembly: ScriptAssembly("restify")] diff --git a/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt new file mode 100644 index 000000000..afd792f38 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Restify Module +=============================================================================== + +This assembly provides access to Restify Module APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against restify APIs. + +More information is on http://mcavage.github.com/node-restify/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Restify/RestifyApplication.cs b/src/Libraries/Node/Node.Restify/RestifyApplication.cs new file mode 100644 index 000000000..101757d08 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyApplication.cs @@ -0,0 +1,80 @@ +// Restify.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("restify")] + public static class RestifyApplication { + + public static RestifyChainedHandler[] AcceptParser(string[] serverAcceptable) { + return null; + } + + public static RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public static RestifyChainedHandler[] BodyParser() { + return null; + } + + public static RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public static RestifyHttpClient CreateHttpClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient(RestifyJsonClientOptions options) { + return null; + } + + public static RestifyServer CreateServer() { + return null; + } + + public static RestifyServer CreateServer(RestifyServerOptions rs) { + return null; + } + + public static RestifyStringClient CreateStringClient() { + return null; + } + + public static RestifyChainedHandler[] DateParser() { + return null; + } + + public static RestifyChainedHandler[] GZipResponse() { + return null; + } + + public static RestifyChainedHandler[] JsonBodyParser() { + return null; + } + + public static RestifyChainedHandler[] Jsonp() { + return null; + } + + public static RestifyChainedHandler QueryParser() { + return null; + } + + public static RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyCallback.cs b/src/Libraries/Node/Node.Restify/RestifyCallback.cs new file mode 100644 index 000000000..5bc17aadd --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyCallback.cs @@ -0,0 +1,9 @@ +// RestifyCallback.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +namespace NodeApi.Restify { + + public delegate void RestifyCallback(RestifyError error, RestifyRequest request, RestifyResponse response, object content); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyChain.cs b/src/Libraries/Node/Node.Restify/RestifyChain.cs new file mode 100644 index 000000000..0c61351ad --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyChain.cs @@ -0,0 +1,26 @@ +// RestifyChain.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyChain { + + private RestifyChain() { + } + + [ScriptSkip] + public void Continue() { + } + + [ScriptSkip] + public void Error(Exception error) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyError.cs b/src/Libraries/Node/Node.Restify/RestifyError.cs new file mode 100644 index 000000000..6d5f6cec5 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyError.cs @@ -0,0 +1,17 @@ +// RestifyError.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyError { + + internal RestifyError() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHandler.cs b/src/Libraries/Node/Node.Restify/RestifyHandler.cs new file mode 100644 index 000000000..111182019 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHandler.cs @@ -0,0 +1,18 @@ +// RestifyHandler.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void RestifyHandler(RestifyRequest request, RestifyResponse response); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate RestifyChainedHandler RestifyChainedHandler(RestifyRequest request, RestifyResponse response, Func next); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs new file mode 100644 index 000000000..6e71a5b40 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs @@ -0,0 +1,17 @@ +// RestifyHttpClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyHttpClient : RestifyStringClient { + + private RestifyHttpClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs new file mode 100644 index 000000000..f97c0f957 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs @@ -0,0 +1,21 @@ +// RestifyJsonClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + /// + /// sends and expects application/json + /// + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyJsonClient : RestifyStringClient { + + private RestifyJsonClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs new file mode 100644 index 000000000..082f1e5ba --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs @@ -0,0 +1,78 @@ +// RestifyJsonClientOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyJsonClientOptions { + + public RestifyJsonClientOptions() { + } + + public RestifyJsonClientOptions(params object[] nameValuePairs) { + } + + /// + /// Accept header to send + /// + public string Accept; + + /// + /// Amount of time to wait for a socket + /// + public int ConnectTimeout; + + /// + /// node-dtrace-provider handle + /// + [ScriptName("dtrace")] + public object DTrace; + + /// + /// Will compress data when sent using content-encoding: gzip + /// + public object Gzip; + + /// + /// HTTP headers to set in all requests + /// + public object Headers; + + /// + /// bunyan instance + /// + public object Log; + + /// + /// options to provide to node-retry; defaults to 3 retries + /// + public object Retry; + + /// + /// synchronous callback for interposing headers before request is sent + /// + public Action SignRequest; + + /// + /// Fully-qualified URL to connect to + /// + public string Url; + + /// + /// user-agent string to use; restify inserts one, but you can override it + /// + public string UserAgent; + + /// + /// semver string to set the accept-version + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyLogger.cs b/src/Libraries/Node/Node.Restify/RestifyLogger.cs new file mode 100644 index 000000000..f98dc8245 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyLogger.cs @@ -0,0 +1,23 @@ +// BunyanLogger.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyLogger { + + private RestifyLogger() { + } + + public void Debug(object options, string format, params string[] formatArguments) { + } + } +} \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/RestifyRequest.cs b/src/Libraries/Node/Node.Restify/RestifyRequest.cs new file mode 100644 index 000000000..a982abe2f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRequest.cs @@ -0,0 +1,210 @@ +// RestifyRequest.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRequest { + + private RestifyRequest() { + } + + [ScriptField] + public Socket Connection { + get { + return null; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + [ScriptField] + public object Headers { + get { + return null; + } + } + + /// + /// url.parse(req.url) href + /// + [ScriptField] + public string Href { + get { + return String.Empty; + } + } + + [ScriptField] + public string HttpVersion { + get { + return null; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + /// + /// bunyan logger you can piggyback on + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + } + + [ScriptField] + [ScriptName("params")] + public Dictionary Parameters { + get { + return null; + } + } + + /// + /// cleaned up URL path + /// + [ScriptField] + public string Path { + get { + return String.Empty; + } + } + + /// + /// the query string only + /// + [ScriptField] + public string Query { + get { + return String.Empty; + } + } + + /// + /// Whether this was an SSL request + /// + [ScriptField] + public bool Secure { + get { + return true; + } + } + + /// + /// the time when this request arrived (ms since epoch) + /// + [ScriptField] + [ScriptName("time")] + public int TimeInMilliseconds { + get { + return 0; + } + } + + [ScriptField] + public object Trailers { + get { + return null; + } + } + + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// Check if the Accept header is present, and includes the given type. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string type) { + return true; + } + + /// + /// Check if the Accept header is present, and includes the given types. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string[] types) { + return true; + } + + [ScriptName("header")] + public string GetHeader(string name) { + return String.Empty; + } + + [ScriptName("header")] + public string GetHeader(string key, string defaultValue) { + return String.Empty; + } + + /// + /// Shorthand to grab a new bunyan instance that is a child component of the one restify has: + /// + /// + /// + public RestifyLogger GetLogger(string name) { + return null; + } + + /// + /// Check if the incoming request contains the Content-Type header field, and it contains the give mime type. + /// + /// + /// + [ScriptName("is")] + public bool IsContentType(string type) { + return true; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyResponse.cs b/src/Libraries/Node/Node.Restify/RestifyResponse.cs new file mode 100644 index 000000000..ddb2bb85b --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyResponse.cs @@ -0,0 +1,159 @@ +// RestifyResponse.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyResponse { + + private RestifyResponse() { + } + + /// + /// In conjunction with contentType, you can explicitly set the charSet to be written in the content-type header + /// + [ScriptField] + public string CharSet { + get { + return String.Empty; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + /// + /// response headers + /// + [ScriptField] + public Dictionary Headers { + get { + return null; + } + } + + /// + /// HTTP status code + /// + [ScriptName("code")] + [ScriptField] + public int HttpStatusCode { + get { + return 0; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + [ScriptField] + public int StatusCode { + get; + set; + } + + public void AddTrailers(Dictionary headers) { + } + + public string GetHeader(string name) { + return null; + } + + /// + /// Short-hand for: + /// res.contentType = 'json'; + /// res.send({hello: 'world'}); + /// + /// Status code + /// content + public void Json(HttpStatusCode code, object body) { + } + + public void RemoveHeader(string name) { + } + + + public void Send(object message) { + } + + public void Send(int errorCode, RestifyError message) { + } + + public void SendDate() { + } + + /// + /// Sets the cache-control header. + /// + /// type defaults to _public_ + /// options currently only takes maxAge. + public void SetCache(string type, Dictionary options) { + } + + public void SetHeader(string name, string value) { + } + + /// + /// Sets the response statusCode. + /// + /// Status code + public void Status(HttpStatusCode code) { + } + + /// + /// You can use send() to wrap up all the usual writeHead(), write(), end() calls on the HTTP API of node. + /// When you call send(), restify figures out how to format the response (see content-negotiation, above), and does that. + /// + /// Status Code + /// body can be an Object, a Buffer, or an Error. + public void Status(HttpStatusCode code, object body) { + } + + public void WriteContinue() { + } + + public void WriteHead(HttpStatusCode statusCode) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase) { + } + + public void WriteHead(HttpStatusCode statusCode, Dictionary headers) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase, Dictionary headers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyRoute.cs b/src/Libraries/Node/Node.Restify/RestifyRoute.cs new file mode 100644 index 000000000..7b28b1e03 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRoute.cs @@ -0,0 +1,17 @@ +// RestifyRoute.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRoute { + + private RestifyRoute() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServer.cs b/src/Libraries/Node/Node.Restify/RestifyServer.cs new file mode 100644 index 000000000..f7043678f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServer.cs @@ -0,0 +1,315 @@ + // RestifyServer.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyServer { + + private RestifyServer() { + } + + /// + /// list of content-types this server can respond with + /// + [ScriptField] + public String[] Acceptable { + get { + return null; + } + } + + /// + /// bunyan instance + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + /// + /// name of the server + /// + [ScriptField] + public string Name { + get { + return null; + } + } + + /// + /// Once listen() is called, this will be filled in with where the server is running + /// + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// default version to use in all routes + /// + [ScriptField] + public string Version { + get { + return null; + } + } + + /// + /// Emitted after a route has finished all the handlers you registered. + /// You can use this to write audit logs, etc. The route parameter will be the Route object that ran. + /// Note that when you are using the default 404/405/BadVersion handlers, this event will still be fired, + /// but route will be null. If you have registered your own listeners for those, this event will not be fired + /// unless you invoke the cb argument that is provided with them. + /// + [ScriptEvent("on", "removeListener")] + public event Action After { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does exist, but you have not registered a route for that HTTP verb, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 405 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("MethodNotAllowed")] + public event Action MethodNotAllowed { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does not exist, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 404 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("NotFound")] + public event Action NotFound { + add { + } + remove { + } + } + + /// + /// Emitted when some handler throws an uncaughtException somewhere in the chain. + /// The default behavior is to just call res.send(error), and let the built-ins in restify handle transforming, + /// but you can override to whatever you want here. + /// + [ScriptEvent("on", "removeListener")] + public event Action UncaughtException { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exist, but has a content-type mismatch, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 415 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("UnsupportedMediaType")] + public event Action UnsupportedMediaType { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exists, but does not match the version(s) on those routes, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 400 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("VersionNotAllowed")] + public event Action VersionNotAllowed { + add { + } + remove { + } + } + + public RestifyChainedHandler[] AcceptParser(string[] acceptable) { + return null; + } + + public Dictionary Address() { + return null; + } + + public RestifyChainedHandler[] AuditLogger(object options) { + return null; + } + + public RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public RestifyChainedHandler[] BodyParser() { + return null; + } + + public void Close(Action callback) { + } + + public RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public RestifyServer CreateServer() { + return null; + } + + public RestifyServer CreateServer(object options) { + return null; + } + + public RestifyServer CreateServer(RestifyServerOptions options) { + return null; + } + + public RestifyChainedHandler[] DateParser() { + return null; + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler[] handlers) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(string path, RestifyChainedHandler handler) { + } + + public void Get(string path, RestifyChainedHandler[] handlers) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler handler) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler[] handlers) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(object options, RestifyChainedHandler handler) { + } + + public void Get(object options, RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] GzipResponse() { + return null; + } + + public void Head(string path, RestifyChainedHandler handler) { + } + + public void Head(string path, RestifyChainedHandler[] handlers) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Listen(int port, Action callback) { + } + + public void Listen(object handle, Action callback) { + } + + public void Listen(string path, Action callback) { + } + + public void Post(string path, RestifyChainedHandler handler) { + } + + public void Post(string path, RestifyChainedHandler[] handlers) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Pre(RestifyChainedHandler handler) { + } + + public void Pre(RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] QueryParser() { + return null; + } + + public RestifyChainedHandler[] RequestLogger() { + return null; + } + + public RestifyChainedHandler[] RequestLogger(object options) { + return null; + } + + public RestifyChainedHandler[] ServeStatic(object options) { + return null; + } + + public RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + + public RestifyChainedHandler[] Throttle(Dictionary options) { + return null; + } + + /// + /// Restify runs handlers in the order they are registered on a server, + /// so if you want some common handlers to run before any of your routes, + /// issue calls to use() before defining routes. + /// + public void Use(RestifyChainedHandler handlers) { + } + + public void Use(RestifyChainedHandler[] handlers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs new file mode 100644 index 000000000..70f4edbf2 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs @@ -0,0 +1,26 @@ +// RestifyServerGetOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyServerGetOptions { + + public RestifyServerGetOptions() { + } + + public RestifyServerGetOptions(params object[] nameValuePairs) { + } + + public string Path; + + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs new file mode 100644 index 000000000..e25086916 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs @@ -0,0 +1,79 @@ +// RestifyServerOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyServerOptions { + + public RestifyServerOptions() { + } + + public RestifyServerOptions(params object[] nameValuePairs) { + } + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Certificate; + + /// + /// Custom response formatters for res.send() + /// + public object Formatters; + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Key; + + /// + /// You can optionally pass in a bunyan (https://github.com/trentm/node-bunyan) instance; not required + /// + public object Log; + + /// + /// By default, this will be set in the Server response header, default is restify + /// + public string Name; + + /// + /// Any options accepted by node-spdy (https://github.com/indutny/node-spdy) + /// + public string Spdy; + + /// + /// Allows you to apply formatting to the value of the header. + /// The duration is passed as an argument in number of milliseconds to execute. + /// + /// + /// + /// app = module.exports = restify.createServer({ + /// name: 'restify', + /// version: '1.0.0', + /// responseTimeHeader: 'X-Runtime', + /// responseTimeFormatter: function(durationInMilliseconds) { + /// return durationInMilliseconds / 1000; + /// } + /// }); + /// + public Func ResponseTimeFormatter; + + /// + /// By default, this will be X-Response-Time + /// + public string ResponseTimeHeader; + + /// + /// A default version to set for all routes + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyStringClient.cs b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs new file mode 100644 index 000000000..94c687b64 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs @@ -0,0 +1,57 @@ +// RestifyStringClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public class RestifyStringClient { + + protected RestifyStringClient() { + } + + public void BasicAuth(string login, string password) { + } + + /// + /// del doesn't take content, since you know, it should't: + /// + public void Del(string path, object content, RestifyCallback callback) { + } + + /// + /// Performs an HTTP get; if no payload was returned, obj defaults to {} for you (so you don't get a bunch of null pointer errors). + /// + /// + /// + public void Get(string path, RestifyCallback callback) { + } + + /// + /// Just like get, but without obj: + /// + /// + /// + public void Head(string path, RestifyCallback callback) { + } + + /// + /// Takes a complete object to serialize and send to the server. + /// + /// + /// + /// + public void Post(string path, object content, RestifyCallback callback) { + } + + /// + /// Just like post: + /// + public void Put(string path, object content, RestifyCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs new file mode 100644 index 000000000..5d312cb7c --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs @@ -0,0 +1,91 @@ +// RestifyThrottleOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyThrottleOptions { + + public RestifyThrottleOptions() { + } + + public RestifyThrottleOptions(params object[] nameValuePairs) { + } + + /// + /// If available, the amount of requests to burst to + /// + [ScriptField] + public int Burst { + set { + } + } + + /// + /// Do throttling on a /32 (source IP) + /// + [ScriptField] + public bool Ip { + set { + } + } + + /// + /// If using the built-in storage table, the maximum distinct throttling keys to allow at a time + /// + [ScriptField] + public int MaxKeys { + set { + } + } + + /// + /// Per "key" overrides + /// + [ScriptField] + public object Overrides { + set { + } + } + + [ScriptField] + public int Rate { + set { + } + } + + /// + /// Storage engine; must support put/get + /// + [ScriptField] + public object TokensTable { + set { + } + } + + /// + /// Do throttling on req.username + /// + [ScriptField] + public bool Username { + set { + } + } + + /// + /// Do throttling on a /32 (X-Forwarded-For) + /// + [ScriptField] + public bool Xff { + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/Blob.cs b/src/Libraries/Web/Html/Data/Files/Blob.cs new file mode 100644 index 000000000..36fa5ed9d --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/Blob.cs @@ -0,0 +1,54 @@ +// Blob.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class Blob { + + public Blob() { + } + + public Blob(object blobParts) { + } + + public Blob(object blobParts, object options) { + } + + [CLSCompliant(false)] + [ScriptField] + public ulong Size { + get { + return 0; + } + } + + [ScriptField] + public string Type { + get { + return String.Empty; + } + } + + public Blob Slice() { + return null; + } + + public Blob Slice(long start) { + return null; + } + + public Blob Slice(long start, long end) { + return null; + } + + public Blob Slice(long start, long end, string contentType) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/File.cs b/src/Libraries/Web/Html/Data/Files/File.cs new file mode 100644 index 000000000..2814a2da2 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/File.cs @@ -0,0 +1,31 @@ +// File.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class File : Blob { + + private File() { + } + + [ScriptField] + public Date LastModifiedDate { + get { + return Date.Now; + } + } + + [ScriptField] + public String Name { + get { + return String.Empty; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileError.cs b/src/Libraries/Web/Html/Data/Files/FileError.cs new file mode 100644 index 000000000..02537c9d3 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileError.cs @@ -0,0 +1,24 @@ +// FileError.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileError { + + private FileError() { + } + + [ScriptField] + public string Name { + get { + return String.Empty; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileList.cs b/src/Libraries/Web/Html/Data/Files/FileList.cs new file mode 100644 index 000000000..0e0915c49 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileList.cs @@ -0,0 +1,31 @@ +// FileList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileList { + + private FileList() { + } + + [ScriptField] + public long Length { + get { + return 0; + } + } + + [ScriptField] + public File this[int index] { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs b/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs new file mode 100644 index 000000000..3a66b2e59 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileProgressEvent.cs @@ -0,0 +1,28 @@ +// FileProgressEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileProgressEvent : ElementEvent { + + private FileProgressEvent() { + } + + public bool Bubbles; + public bool Cancelable; + public bool DefaultPrevented; + public bool LengthComputable; + + public int EventPhase; + public int Loaded; + public int Total; + + public object ClipboardData; + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReader.cs b/src/Libraries/Web/Html/Data/Files/FileReader.cs new file mode 100644 index 000000000..c012d073c --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReader.cs @@ -0,0 +1,151 @@ +// FileReader.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileReader { + + [ScriptField] + public FileError Error { + get { + return null; + } + } + + /// + /// Indicates the state of the FileReader. This will be one of the State constants. Read only. + /// + [ScriptField] + public int ReadyState { + get { + return (int)FileReadyState.Empty; + } + } + + // File or Blob data + [ScriptField] + public object Result { + get { + return null; + } + } + + [ScriptName("onabort")] + public Action OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + public Action OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onload")] + public Action OnLoad { + get { + return null; + } + set { + } + } + + [ScriptName("onloadend")] + public Action OnLoadEnd { + get { + return null; + } + set { + } + } + + [ScriptName("onloadstart")] + public Action OnLoadStart { + get { + return null; + } + set { + } + } + + [ScriptName("onprogress")] + public Action OnProgress { + get { + return null; + } + set { + } + } + + public void Abort() { + } + + /// + /// Adds a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The listener to be invoked in response to the event. + /// Whether the listener wants to initiate capturing the event. + public void AddEventListener(string eventName, ElementEventListener listener, bool useCapture) { + } + + /// + /// Adds a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The handler to be invoked in response to the event. + /// Whether the handler wants to initiate capturing the event. + public void AddEventListener(string eventName, IElementEventHandler handler, bool useCapture) { + } + + public bool DispatchEvent(MutableEvent eventObject) { + return false; + } + + public void ReadAsArrayBuffer(Blob blob) { + } + + public void ReadAsBinaryString(Blob blob) { + } + + public void ReadAsDataURL(Blob blob) { + } + + public void ReadAsText(Blob blob) { + } + + public void ReadAsText(Blob blob, string encoding) { + } + + /// + /// Removes a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The listener to be invoked in response to the event. + /// Whether the listener wants to initiate capturing the event. + public void RemoveEventListener(string eventName, ElementEventListener listener, bool useCapture) { + } + + /// + /// Removes a listener for the specified event. + /// + /// The name of the event such as 'load'. + /// The handler to be invoked in response to the event. + /// Whether the handler wants to initiate capturing the event. + public void RemoveEventListener(string eventName, IElementEventHandler handler, bool useCapture) { + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs b/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs new file mode 100644 index 000000000..51620d6ba --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReaderSync.cs @@ -0,0 +1,30 @@ +// FileReader.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileReaderSync { + + public object ReadAsArrayBuffer(Blob blob) { + return null; + } + + public string ReadAsDataURL(Blob blob) { + return null; + } + + public string ReadAsText(Blob blob) { + return null; + } + + public string ReadAsText(Blob blob, string encoding) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/Files/FileReadyState.cs b/src/Libraries/Web/Html/Data/Files/FileReadyState.cs new file mode 100644 index 000000000..d8cbf97a1 --- /dev/null +++ b/src/Libraries/Web/Html/Data/Files/FileReadyState.cs @@ -0,0 +1,21 @@ +// FileReadyState.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace System.Html.Data.Files { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] + public enum FileReadyState { + + Empty = 0, + + Loading = 1, + + Done = 2 + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs new file mode 100644 index 000000000..e42200aa6 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBCursor.cs @@ -0,0 +1,63 @@ +// DBCursor.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBCursor { + + internal DBCursor() { + } + + [ScriptField] + public string Direction { + get { + return null; + } + } + + [ScriptField] + public object Key { + get { + return null; + } + } + + [ScriptField] + public object PrimaryKey { + get { + return null; + } + } + + [ScriptField] + public object Source { + get { + return null; + } + } + + public void Advance(long count) { + } + + public void Continue() { + } + + public void Continue(object key) { + } + + public DBRequest Delete(object value) { + return null; + } + + public DBRequest Update(object value) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs new file mode 100644 index 000000000..1f7620c7e --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBCursorWithValue.cs @@ -0,0 +1,25 @@ +// DBCursorWithValue.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBCursorWithValue : DBCursor { + + private DBCursorWithValue() { + } + + [ScriptField] + public object Value { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs new file mode 100644 index 000000000..bbdd4bcb9 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBDatabase.cs @@ -0,0 +1,99 @@ +// DBDatabase.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBDatabase : DBEventTarget { + + private DBDatabase() { + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public string[] ObjectStoreNames { + get { + return default(string[]); + } + } + + [ScriptName("onabort")] + [ScriptField] + public DBDatabaseCallback OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBDatabaseCallback OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onversionchange")] + [ScriptField] + public DBDatabaseVersionChangeCallback OnVersionChange { + get { + return null; + } + set { + } + } + + [ScriptField] + public long Version { + get { + return default(long); + } + } + + public void Close() { + } + + public DBObjectStore CreateObjectStore(string name) { + return default(DBObjectStore); + } + + public DBObjectStore CreateObjectStore(string name, DBObjectStoreParameters optionalParameters) { + return default(DBObjectStore); + } + + public void DeleteObjectStore(string name) { + } + + public DBTransaction Transaction(string[] storenames) { + return default(DBTransaction); + } + + public DBTransaction Transaction(string[] storenames, string mode) { + return default(DBTransaction); + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBDatabaseCallback(DBEvent e); + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBDatabaseVersionChangeCallback(DBVersionChangeEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs new file mode 100644 index 000000000..f329cba0d --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBEvent.cs @@ -0,0 +1,32 @@ +// DBEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBEvent { + + internal DBEvent() { + } + + [ScriptField] + public T Target { + get { + return default(T); + } + } + + [ScriptField] + public string Type { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs new file mode 100644 index 000000000..de2ad05e2 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBEventTarget.cs @@ -0,0 +1,30 @@ +// DBEventTarget.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public abstract class DBEventTarget { + + internal DBEventTarget() { + } + + public void AddEventListener(string type, Action listener) { + } + + public void AddEventListener(string type, Action listener, bool useCapture) { + } + + public void RemoveEventListener(string type, Action listener) { + } + + public void RemoveEventListener(string type, Action listener, bool useCapture) { + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs new file mode 100644 index 000000000..84ce1c6f3 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBFactory.cs @@ -0,0 +1,35 @@ +// DBFactory.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBFactory { + + private DBFactory() { + } + + [ScriptName("cmp")] + public int Compare(object first, object last) { + return default(short); + } + + public DBOpenDBRequest DeleteDatabase(string name) { + return null; + } + + public DBOpenDBRequest Open(string name) { + return null; + } + + public DBOpenDBRequest Open(string name, long version) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs new file mode 100644 index 000000000..f26854ce5 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBIndex.cs @@ -0,0 +1,93 @@ +// DBIndex.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBIndex { + + private DBIndex() { + } + + [ScriptField] + public string KeyPath { + get { + return default(string); + } + } + + [ScriptField] + public bool MultiEntry { + get { + return default(bool); + } + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public DBObjectStore ObjectStore { + get { + return default(DBObjectStore); + } + } + + [ScriptField] + public bool Unique { + get { + return default(bool); + } + } + + public DBRequest Count() { + return null; + } + + public DBRequest Count(object key) { + return null; + } + + public DBRequest Get(object key) { + return null; + } + + public DBRequest GetKey(object key) { + return null; + } + + public DBRequest OpenCursor() { + return null; + } + + public DBRequest OpenCursor(object range) { + return null; + } + + public DBRequest OpenCursor(object range, string direction) { + return null; + } + + public DBRequest OpenKeyCursor() { + return null; + } + + public DBRequest OpenKeyCursor(object range) { + return null; + } + + public DBRequest OpenKeyCursor(object range, string direction) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs new file mode 100644 index 000000000..799c652ce --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBIndexParameters.cs @@ -0,0 +1,34 @@ +// DBIndexParameters.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class DBIndexParameters { + + [ScriptField] + public bool MultiEntry { + get { + return false; + } + set { + } + } + + [ScriptField] + public bool Unique { + get { + return false; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs new file mode 100644 index 000000000..abca44cc5 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStore.cs @@ -0,0 +1,116 @@ +// DBObjectStore.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBObjectStore { + + private DBObjectStore() { + } + + [ScriptField] + public bool AutoIncremenent { + get { + return default(bool); + } + } + + [ScriptField] + public string[] IndexNames { + get { + return default(string[]); + } + } + + [ScriptField] + public string KeyPath { + get { + return default(string); + } + } + + [ScriptField] + public string Name { + get { + return default(string); + } + } + + [ScriptField] + public DBTransaction Transaction { + get { + return default(DBTransaction); + } + } + + public DBRequest Add(object value) { + return null; + } + + public DBRequest Add(object value, object key) { + return null; + } + + public DBRequest Clear() { + return null; + } + + public DBRequest Count() { + return null; + } + + public DBRequest Count(object key) { + return null; + } + + public DBIndex CreateIndex(string name, object keyPath) { + return default(DBIndex); + } + + public DBIndex CreateIndex(string name, object keyPath, DBIndexParameters optionalParameters) { + return default(DBIndex); + } + + public DBRequest Delete(object key) { + return null; + } + + public void DeleteIndex(string indexName) { + } + + public DBRequest Get(object key) { + return null; + } + + public DBIndex Index(string name) { + return default(DBIndex); + } + + public DBRequest OpenCursor() { + return null; + } + + public DBRequest OpenCursor(object range) { + return null; + } + + public DBRequest OpenCursor(object range, string direction) { + return null; + } + + public DBRequest Put(object value) { + return null; + } + + public DBRequest Put(object value, object key) { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs new file mode 100644 index 000000000..5f5cb5259 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBObjectStoreParameters.cs @@ -0,0 +1,35 @@ +// DBObjectStoreParameters.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class DBObjectStoreParameters { + + [ScriptField] + public bool AutoIncrement { + get { + return false; + } + set { + } + } + + [ScriptField] + public string KeyPath { + get { + return null; + } + set { + } + } + } +} + diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs new file mode 100644 index 000000000..6adc6b78b --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBOpenDBRequest.cs @@ -0,0 +1,46 @@ +// DBOpenDBRequest.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBOpenDBRequest : DBRequest { + + private DBOpenDBRequest() { + } + + [ScriptName("onblocked")] + [ScriptField] + public DBOpenDBRequestCallback OnBlocked { + get { + return null; + } + set { + } + } + + [ScriptName("onupgradeneeded")] + [ScriptField] + public DBOpenDBRequestVersionChangeCallback OnUpgradeNeeded { + get { + return null; + } + set { + } + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBOpenDBRequestCallback(DBEvent e); + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBOpenDBRequestVersionChangeCallback(DBVersionChangeEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs new file mode 100644 index 000000000..0743ee701 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBRequest.cs @@ -0,0 +1,77 @@ +// DBRequest.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public class DBRequest : DBEventTarget { + + internal DBRequest() { + } + + [ScriptField] + public object Error { + get { + return null; + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBRequestCallback OnError { + get { + return null; + } + set { + } + } + + [ScriptName("onsuccess")] + [ScriptField] + public DBRequestCallback OnSuccess { + get { + return null; + } + set { + } + } + + [ScriptField] + public string ReadyState { + get { + return null; + } + } + + [ScriptField] + public object Result { + get { + return null; + } + } + + [ScriptField] + public object Source { + get { + return null; + } + } + + [ScriptField] + public DBTransaction Transaction { + get { + return null; + } + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBRequestCallback(DBEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs new file mode 100644 index 000000000..5d393bcc6 --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBTransaction.cs @@ -0,0 +1,81 @@ +// DBTransaction.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBTransaction : DBEventTarget { + + private DBTransaction() { + } + + [ScriptField] + [ScriptName("db")] + public DBDatabase Database { + get { + return null; + } + } + + [ScriptField] + public object Error { + get { + return null; + } + } + + [ScriptField] + public string Mode { + get { + return null; + } + } + + [ScriptName("onabort")] + [ScriptField] + public DBTransactionCallback OnAbort { + get { + return null; + } + set { + } + } + + [ScriptName("oncomplete")] + [ScriptField] + public DBTransactionCallback OnComplete { + get { + return null; + } + set { + } + } + + [ScriptName("onerror")] + [ScriptField] + public DBTransactionCallback OnError { + get { + return null; + } + set { + } + } + + public void Abort() { + } + + public DBObjectStore ObjectStore(string name) { + return null; + } + } + + [ScriptIgnoreNamespace] + [ScriptImport] + public delegate void DBTransactionCallback(DBEvent e); +} diff --git a/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs b/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs new file mode 100644 index 000000000..2ba7e578f --- /dev/null +++ b/src/Libraries/Web/Html/Data/IndexedDB/DBVersionChangeEvent.cs @@ -0,0 +1,32 @@ +// DBVersionChangeEvent.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.Data.IndexedDB { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class DBVersionChangeEvent : DBEvent { + + private DBVersionChangeEvent() { + } + + [ScriptField] + public long NewVersion { + get { + return default(long); + } + } + + [ScriptField] + public long OldVersion { + get { + return default(long); + } + } + } +} diff --git a/src/Libraries/Web/Html/Data/SqlDatabase.cs b/src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs similarity index 96% rename from src/Libraries/Web/Html/Data/SqlDatabase.cs rename to src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs index 9e6ca8981..c5c57b276 100644 --- a/src/Libraries/Web/Html/Data/SqlDatabase.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlDatabase.cs @@ -6,9 +6,7 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { - - public delegate bool SqlDatabaseCallback(SqlDatabase db); +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] @@ -33,4 +31,6 @@ public void ReadTransaction(SqlTransactionCallback callback, SqlErrorCallback er public void Transaction(SqlTransactionCallback callback, SqlErrorCallback errorCallback, Action successCallback) { } } + + public delegate bool SqlDatabaseCallback(SqlDatabase db); } diff --git a/src/Libraries/Web/Html/Data/SqlError.cs b/src/Libraries/Web/Html/Data/Sql/SqlError.cs similarity index 94% rename from src/Libraries/Web/Html/Data/SqlError.cs rename to src/Libraries/Web/Html/Data/Sql/SqlError.cs index a04259a21..88ecef06d 100644 --- a/src/Libraries/Web/Html/Data/SqlError.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlError.cs @@ -6,9 +6,7 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { - - public delegate bool SqlErrorCallback(SqlError error); +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] @@ -31,4 +29,6 @@ public string Message { } } } + + public delegate bool SqlErrorCallback(SqlError error); } diff --git a/src/Libraries/Web/Html/Data/SqlResultSet.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs similarity index 95% rename from src/Libraries/Web/Html/Data/SqlResultSet.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs index 12c40ee59..c4e713c87 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSet.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSet.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] diff --git a/src/Libraries/Web/Html/Data/SqlResultSetRow.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs similarity index 93% rename from src/Libraries/Web/Html/Data/SqlResultSetRow.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs index 25de3ea63..dff90378c 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSetRow.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRow.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] diff --git a/src/Libraries/Web/Html/Data/SqlResultSetRowList.cs b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs similarity index 94% rename from src/Libraries/Web/Html/Data/SqlResultSetRowList.cs rename to src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs index 7ca197739..017d4d11a 100644 --- a/src/Libraries/Web/Html/Data/SqlResultSetRowList.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlResultSetRowList.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Collections; -namespace System.Html.Data { +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] diff --git a/src/Libraries/Web/Html/Data/SqlTransaction.cs b/src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs similarity index 95% rename from src/Libraries/Web/Html/Data/SqlTransaction.cs rename to src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs index 9b21e9210..ebbb66240 100644 --- a/src/Libraries/Web/Html/Data/SqlTransaction.cs +++ b/src/Libraries/Web/Html/Data/Sql/SqlTransaction.cs @@ -6,13 +6,7 @@ using System; using System.Runtime.CompilerServices; -namespace System.Html.Data { - - public delegate bool SqlTransactionCallback(SqlTransaction transaction); - - public delegate bool SqlStatementCallback(SqlTransaction transaction, SqlResultSet resultSet); - - public delegate bool SqlStatementErrorCallback(SqlTransaction transaction, SqlError error); +namespace System.Html.Data.Sql { [ScriptIgnoreNamespace] [ScriptImport] @@ -24,4 +18,10 @@ private SqlTransaction() { public void ExecuteSql(string sql, object[] arguments, SqlStatementCallback callback, SqlStatementErrorCallback errorCallback) { } } + + public delegate bool SqlTransactionCallback(SqlTransaction transaction); + + public delegate bool SqlStatementCallback(SqlTransaction transaction, SqlResultSet resultSet); + + public delegate bool SqlStatementErrorCallback(SqlTransaction transaction, SqlError error); } diff --git a/src/Libraries/Web/Html/Document.cs b/src/Libraries/Web/Html/Document.cs index 43c8cbe93..957266017 100644 --- a/src/Libraries/Web/Html/Document.cs +++ b/src/Libraries/Web/Html/Document.cs @@ -5,6 +5,7 @@ using System; using System.Runtime.CompilerServices; +using System.Html.StyleSheets; using System.Html.Editing; namespace System.Html { @@ -89,7 +90,7 @@ public static string ReadyState { return null; } } - + [ScriptField] public static string Referrer { get { @@ -104,6 +105,13 @@ public static Selection Selection { } } + [ScriptField] + public static StyleSheetList StyleSheets { + get { + return null; + } + } + [ScriptField] public static string Title { get { @@ -140,18 +148,53 @@ public static void AddEventListener(string eventName, ElementEventListener liste public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Creates an Attr of the given name. Note that the Attr instance can then be set on an + /// Element using the setAttributeNode method. To create an attribute with a qualified name + /// and namespace URI, use the CreateAttributeNS method. + /// + /// The name of the attribute. + /// A new Attr object with the nodeName attribute set to name, and localName, prefix, + /// and namespaceURI set to null. The value of the attribute is the empty string. public static ElementAttribute CreateAttribute(string name) { return null; } + /// + /// Creates an attribute of the given qualified name and namespace URI. + /// + /// The namespace URI of the attribute to create. + /// The qualified name of the attribute to instantiate. + /// A new Attr object with the given namespace and qualified name. + public static ElementAttribute CreateAttributeNS(string namespaceURI, string qualifiedName) { + return null; + } + public static DocumentFragment CreateDocumentFragment() { return null; } + /// + /// Creates an element of the type specified. + /// To create an element with a qualified name and namespace URI, use the CreateElementNS method. + /// + /// The name of the element type to instantiate. + /// A new Element object with the nodeName attribute set to tagName, and localName, + /// prefix, and namespaceURI set to null. public static Element CreateElement(string tagName) { return null; } + /// + /// Creates an element of the given qualified name and namespace URI. + /// + /// The namespace URI of the element to create. + /// The qualified name of the element type to instantiate. + /// A new Element object with the given namespace and qualified name. + public static Element CreateElementNS(string namespaceURI, string qualifiedName) { + return null; + } + public static MutableEvent CreateEvent(string eventType) { return null; } @@ -160,6 +203,10 @@ public static Element CreateTextNode(string data) { return null; } + public static Element ImportNode(Element imporedNode, bool deep) { + return null; + } + public static void DetachEvent(string eventName, ElementEventHandler handler) { } @@ -198,6 +245,16 @@ public static ElementCollection GetElementsByTagName(string tagName) { return null; } + /// + /// Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. + /// + /// The namespace URI of the elements to match on. The special value "*" matches all namespaces. + /// The local name of the elements to match on. The special value "*" matches all local names. + /// A new NodeList object containing all the matched Elements. + public static ElementCollection GetElementsByTagNameNS(string namespaceURI, string localName) { + return null; + } + public static bool HasFocus() { return false; } diff --git a/src/Libraries/Web/Html/ElementEvent.cs b/src/Libraries/Web/Html/ElementEvent.cs index 68dd09c33..71bcf9384 100644 --- a/src/Libraries/Web/Html/ElementEvent.cs +++ b/src/Libraries/Web/Html/ElementEvent.cs @@ -38,6 +38,20 @@ public bool CancelBubble { } } + [ScriptField] + public int ClientX { + get { + return 0; + } + } + + [ScriptField] + public int ClientY { + get { + return 0; + } + } + [ScriptField] public bool CtrlKey { get { @@ -101,6 +115,20 @@ public int OffsetY { } } + [ScriptField] + public int PageX { + get { + return 0; + } + } + + [ScriptField] + public int PageY { + get { + return 0; + } + } + [ScriptField] public bool ReturnValue { get { @@ -110,6 +138,20 @@ public bool ReturnValue { } } + [ScriptField] + public int ScreenX { + get { + return 0; + } + } + + [ScriptField] + public int ScreenY { + get { + return 0; + } + } + [ScriptField] public bool ShiftKey { get { diff --git a/src/Libraries/Web/Html/FileInputElement.cs b/src/Libraries/Web/Html/FileInputElement.cs new file mode 100644 index 000000000..9ae1a4b1a --- /dev/null +++ b/src/Libraries/Web/Html/FileInputElement.cs @@ -0,0 +1,25 @@ +// FileInputElement.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Html.Data.Files; +using System.Runtime.CompilerServices; + +namespace System.Html { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class FileInputElement : InputElement { + + private FileInputElement() { + } + + [ScriptField] + public FileList Files { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/LinkElement.cs b/src/Libraries/Web/Html/LinkElement.cs new file mode 100644 index 000000000..8f6d20d75 --- /dev/null +++ b/src/Libraries/Web/Html/LinkElement.cs @@ -0,0 +1,45 @@ +// LinkElement.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class LinkElement : Element { + + private LinkElement() { + } + + [ScriptField] + public string Href { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Media { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Rel { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/messageevent.cs b/src/Libraries/Web/Html/MessageEvent.cs similarity index 100% rename from src/Libraries/Web/Html/messageevent.cs rename to src/Libraries/Web/Html/MessageEvent.cs diff --git a/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs new file mode 100644 index 000000000..70e1a841e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleCSSRule.cs @@ -0,0 +1,34 @@ +// StyleCSSRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleCSSRule : StyleRule { + + private StyleCSSRule() { + } + + [ScriptField] + public string SelectorText { + get { + return null; + } + set { + } + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs new file mode 100644 index 000000000..d7a2bf944 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleCharsetRule.cs @@ -0,0 +1,27 @@ +// StyleCharsetRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleCharsetRule : StyleRule { + + private StyleCharsetRule() { + } + + [ScriptField] + public string Encoding { + get { + return null; + } + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs new file mode 100644 index 000000000..a78dba32e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleFontFaceRule.cs @@ -0,0 +1,25 @@ +// StyleFontFaceRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleFontFaceRule : StyleRule { + + private StyleFontFaceRule() { + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs new file mode 100644 index 000000000..b3c89b8b9 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleImportRule.cs @@ -0,0 +1,39 @@ +// StyleImportRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleImportRule : StyleRule { + + private StyleImportRule() { + } + + [ScriptField] + public string Href { + get { + return null; + } + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + public StyleSheet StyleSheet { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs b/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs new file mode 100644 index 000000000..3fb660a0e --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleMediaList.cs @@ -0,0 +1,55 @@ +// StyleMediaList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleMediaList : IEnumerable { + + private StyleMediaList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public string MediaText { + get { + return null; + } + set { + } + } + + [ScriptField] + public string this[int index] { + get { + return null; + } + } + + public void AppendMedium(string newMedium) { + } + + public void DeleteMedium(string oldMedium) { + } + + public static implicit operator string[](StyleMediaList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs new file mode 100644 index 000000000..ad49c96a5 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleMediaRule.cs @@ -0,0 +1,40 @@ +// StyleMediaRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleMediaRule : StyleRule { + + private StyleMediaRule() { + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + [ScriptName("cssRules")] + public StyleRuleList StyleRules { + get { + return null; + } + } + + public void DeleteRule(int index) { + } + + public int InsertRule(string rule, int index) { + return 0; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs b/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs new file mode 100644 index 000000000..383e966ed --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StylePageRule.cs @@ -0,0 +1,34 @@ +// StylePageRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StylePageRule : StyleRule { + + private StylePageRule() { + } + + [ScriptField] + public string SelectorText { + get { + return null; + } + set { + } + } + + [ScriptField] + public Style Style { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRule.cs b/src/Libraries/Web/Html/StyleSheets/StyleRule.cs new file mode 100644 index 000000000..20a3e0240 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRule.cs @@ -0,0 +1,49 @@ +// StyleRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public abstract class StyleRule { + + internal StyleRule() { + } + + [ScriptField] + [ScriptName("cssText")] + public string CSSText { + get { + return null; + } + set { + } + } + + [ScriptField] + public StyleRule ParentRule { + get { + return null; + } + } + + [ScriptField] + public StyleSheet ParentStyleSheet { + get { + return null; + } + } + + [ScriptField] + public StyleRuleType Type { + get { + return StyleRuleType.Unknown; + } + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs b/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs new file mode 100644 index 000000000..9193048ae --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRuleList.cs @@ -0,0 +1,40 @@ +// StyleRuleList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleRuleList : IEnumerable { + + private StyleRuleList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public StyleRule this[int index] { + get { + return null; + } + } + + public static implicit operator StyleRule[](StyleRuleList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs b/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs new file mode 100644 index 000000000..f7c4186b1 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleRuleType.cs @@ -0,0 +1,31 @@ +// StyleRule.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptConstants] + public enum StyleRuleType { + + Unknown = 0, + + Style = 1, + + Charset = 2, + + Import = 3, + + Media = 4, + + FontFace = 5, + + Page = 6, + + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs b/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs new file mode 100644 index 000000000..68bff5112 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleSheet.cs @@ -0,0 +1,102 @@ +// StyleSheet.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleSheet { + + private StyleSheet() { + } + + [ScriptField] + [ScriptName("cssRules")] + public StyleRuleList StyleRules { + get { + return null; + } + } + + [ScriptField] + public bool Disabled { + get { + return false; + } + set { + } + } + + [ScriptField] + public string Href { + get { + return null; + } + set { + } + } + + [ScriptField] + public string Id { + get { + return null; + } + set { + } + } + + [ScriptField] + public StyleMediaList Media { + get { + return null; + } + } + + [ScriptField] + public Element OwnerNode { + get { + return null; + } + } + + [ScriptField] + public StyleRule OwnerRule { + get { + return null; + } + } + + [ScriptField] + public StyleSheet ParentStyleSheet { + get { + return null; + } + } + + [ScriptField] + public string Title { + get { + return null; + } + } + + [ScriptField] + public string Type { + get { + return null; + } + } + + public void DeleteRule(int index) { + } + + public int InsertRule(string rule, int index) { + return 0; + } + } +} diff --git a/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs b/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs new file mode 100644 index 000000000..4286fa8a6 --- /dev/null +++ b/src/Libraries/Web/Html/StyleSheets/StyleSheetList.cs @@ -0,0 +1,40 @@ +// StyleSheetList.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace System.Html.StyleSheets { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class StyleSheetList : IEnumerable { + + private StyleSheetList() { + } + + [ScriptField] + public int Length { + get { + return 0; + } + } + + [ScriptField] + public StyleSheet this[int index] { + get { + return null; + } + } + + public static implicit operator StyleSheet[](StyleSheetList list) { + return null; + } + + IEnumerator IEnumerable.GetEnumerator() { + return null; + } + } +} diff --git a/src/Libraries/Web/Html/Window.cs b/src/Libraries/Web/Html/Window.cs index 6362d7af1..6fab1367e 100644 --- a/src/Libraries/Web/Html/Window.cs +++ b/src/Libraries/Web/Html/Window.cs @@ -5,6 +5,9 @@ using System; using System.Html.Data; +using System.Html.Data.Files; +using System.Html.Data.IndexedDB; +using System.Html.Data.Sql; using System.Runtime.CompilerServices; namespace System.Html { @@ -28,6 +31,13 @@ public static ApplicationCache ApplicationCache { } } + [ScriptField] + public static Blob Blob { + get { + return null; + } + } + /// /// IE only. /// @@ -78,6 +88,27 @@ public static ElementEvent Event { } } + [ScriptField] + public static File File { + get { + return null; + } + } + + [ScriptField] + public static FileList FileList { + get { + return null; + } + } + + [ScriptField] + public static FileReader FileReader { + get { + return null; + } + } + [ScriptField] public static IFrameElement FrameElement { get { @@ -293,6 +324,28 @@ public static void Alert(object o) { public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Decodes a string of data which has been encoded using base-64 encoding. + /// For use with Unicode or UTF-8 strings. + /// + /// Base64 encoded string + /// String of Binary data + [ScriptName("atob")] + public static string Base64ToBinary(string base64EncodedData) { + return null; + } + + /// + /// Creates a base-64 encoded ASCII string from a "string" of binary data. + /// Please note that this is not suitable for raw Unicode strings! + /// + /// String of binary data + /// Base64 string + [ScriptName("btoa")] + public static string BinaryToBase64(string stringToEncode) { + return null; + } + public static void Close() { } @@ -410,6 +463,14 @@ public static SqlDatabase OpenDatabase(string name, string version, string displ return null; } + [ScriptField] + public static DBFactory IndexedDB { + get { + return null; + } + } + + public static void PostMessage(string message, string targetOrigin) { } diff --git a/src/Libraries/Web/Web.csproj b/src/Libraries/Web/Web.csproj index 317cb4c29..792b45c68 100644 --- a/src/Libraries/Web/Web.csproj +++ b/src/Libraries/Web/Web.csproj @@ -48,7 +48,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -56,18 +91,19 @@ + - - - - - - + + + + + + @@ -144,6 +180,7 @@ Properties\ScriptSharp.cs + diff --git a/src/Libraries/Web/Xml/XmlDocument.cs b/src/Libraries/Web/Xml/XmlDocument.cs index d196825f3..2629072e9 100644 --- a/src/Libraries/Web/Xml/XmlDocument.cs +++ b/src/Libraries/Web/Xml/XmlDocument.cs @@ -59,5 +59,9 @@ public XmlNode CreateProcessingInstruction(string target, string data) { public XmlText CreateTextNode(string text) { return null; } + + public XmlNode ImportNode(XmlNode externalNode, bool deep) { + return null; + } } } diff --git a/src/Libraries/Web/Xml/XmlNode.cs b/src/Libraries/Web/Xml/XmlNode.cs index ed6189b80..e1fb1a90e 100644 --- a/src/Libraries/Web/Xml/XmlNode.cs +++ b/src/Libraries/Web/Xml/XmlNode.cs @@ -137,31 +137,31 @@ public XmlNodeList GetElementsByTagName(string tagName) { return null; } - public bool HasChildNodes() { + public bool HasAttributes() { return false; } - public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { - return null; + public bool HasChildNodes() { + return false; } - public XmlNode RemoveChild(XmlNode child) { + public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { return null; } - public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { + public XmlNode QuerySelector(string selector) { return null; } - public XmlNodeList SelectNodes(string xpath) { + public XmlNodeList QuerySelectorAll(string selector) { return null; } - public XmlNode SelectSingleNode(string xpath) { + public XmlNode RemoveChild(XmlNode child) { return null; } - public string TransformNode(XmlDocument stylesheet) { + public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { return null; } } diff --git a/src/Libraries/Web/Xml/XmlSerializer.cs b/src/Libraries/Web/Xml/XmlSerializer.cs new file mode 100644 index 000000000..58e2c8178 --- /dev/null +++ b/src/Libraries/Web/Xml/XmlSerializer.cs @@ -0,0 +1,21 @@ +// XmlSerializer.cs +// Script#/Libraries/Web +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace System.Xml { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("XMLSerializer")] + public sealed class XmlSerializer { + + [ScriptName("serializeToString")] + public string Serialize(XmlDocument xml) { + return null; + } + } +} diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs b/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs index 08bd48bf9..ae0d7d431 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryEvent.cs @@ -89,6 +89,13 @@ public Dictionary Data { } } + [ScriptField] + public bool MetaKey { + get { + return false; + } + } + /// /// Gets the namespace specified when the event was triggered. /// diff --git a/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs b/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs index 7d8a93766..24d084f60 100644 --- a/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs +++ b/src/Libraries/jQuery/jQuery.Core/jQueryPosition.cs @@ -14,9 +14,13 @@ namespace jQueryApi { /// [ScriptImport] [ScriptIgnoreNamespace] + [ScriptName("Object")] public sealed class jQueryPosition { - private jQueryPosition() { + public jQueryPosition() { + } + + public jQueryPosition(params object[] nameValuePairs) { } /// @@ -27,6 +31,8 @@ public int Left { get { return 0; } + set { + } } /// @@ -37,6 +43,8 @@ public int Top { get { return 0; } + set { + } } public static implicit operator Dictionary(jQueryPosition position) { diff --git a/src/ScriptSharp.sln b/src/ScriptSharp.sln index 030d92e9b..fef45edef 100644 --- a/src/ScriptSharp.sln +++ b/src/ScriptSharp.sln @@ -36,6 +36,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipX", "ZipX\ZipX.csproj", {9600C55B-E14E-45EA-92C6-F453B19F5D7F} = {9600C55B-E14E-45EA-92C6-F453B19F5D7F} {DCA0235F-88C1-43A0-A8DB-FF765D344E06} = {DCA0235F-88C1-43A0-A8DB-FF765D344E06} {9F14036F-673F-418E-B817-7E2289D7F3F6} = {9F14036F-673F-418E-B817-7E2289D7F3F6} + {9D59077D-1A05-4D6C-A1A4-FB748D200578} = {9D59077D-1A05-4D6C-A1A4-FB748D200578} {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {1772A38C-7204-42DC-B81D-6C74D17A4F66} {36D4B098-A21C-4725-ACD3-400922885F38} = {36D4B098-A21C-4725-ACD3-400922885F38} {3681A9A8-FC40-4125-B842-7775713C8DCE} = {3681A9A8-FC40-4125-B842-7775713C8DCE} @@ -43,8 +44,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipX", "ZipX\ZipX.csproj", {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} = {967A6FD7-E14B-4DB0-81D9-86E0DC12291A} {4A9F7CE0-5A45-4B28-AD01-05528709B6E4} = {4A9F7CE0-5A45-4B28-AD01-05528709B6E4} {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} = {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} + {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} = {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} + {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} = {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} {824C1FEC-2455-4183-AFC6-891EDB88213A} = {824C1FEC-2455-4183-AFC6-891EDB88213A} {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} = {2E5D9DFC-97BD-4652-B09A-B88E6ECDEF43} + {232445FF-22AA-46F7-BA12-4590C670F2B1} = {232445FF-22AA-46F7-BA12-4590C670F2B1} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jQuery.Validation", "Libraries\jQuery\jQuery.Validation\jQuery.Validation.csproj", "{967A6FD7-E14B-4DB0-81D9-86E0DC12291A}" @@ -65,6 +69,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Express", "Libraries\N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Mongo", "Libraries\Node\Node.Mongo\Node.Mongo.csproj", "{4A9F7CE9-5B45-4B28-AD01-05529709B6E4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Neo4j", "Libraries\Node\Node.Neo4j\Node.Neo4j.csproj", "{232445FF-22AA-46F7-BA12-4590C670F2B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deployment", "Tools\Deployment\Deployment.csproj", "{9D59077D-1A05-4D6C-A1A4-FB748D200578}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Restify", "Libraries\Node\Node.Restify\Node.Restify.csproj", "{1ECC689C-2542-4EE8-8A86-7627E63F44F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Azure", "Libraries\Node\Node.Azure\Node.Azure.csproj", "{4A9F7CE9-5B55-4B28-AD01-05528709B6E4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -304,6 +316,54 @@ Global {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU {4A9F7CE9-5B45-4B28-AD01-05529709B6E4}.Release|x86.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|.NET.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Debug|x86.ActiveCfg = Debug|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|.NET.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Any CPU.Build.0 = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {232445FF-22AA-46F7-BA12-4590C670F2B1}.Release|x86.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|.NET.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|.NET.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Any CPU.Build.0 = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|x86.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|.NET.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|x86.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|.NET.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -320,6 +380,9 @@ Global {4A9F7CE9-5A45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {232445FF-22AA-46F7-BA12-4590C670F2B1} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {36D4B098-A21C-4725-ACD3-400922885F38} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} @@ -327,6 +390,7 @@ Global {8780581F-7C26-4B64-9236-BA1C458DF36E} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {31456150-1093-407F-9231-58D0F663945D} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} {B87E403B-354D-47A1-9876-14C618A80A41} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} + {9D59077D-1A05-4D6C-A1A4-FB748D200578} = {37239BB8-2FA4-4831-A7EA-AF89D74EA10E} {4123C976-739E-42A2-87FB-E04D163BC99C} = {BB2DB888-0F52-4CB5-9625-9D99A33DCE4F} EndGlobalSection EndGlobal diff --git a/src/Tools/Deployment/Deployment.csproj b/src/Tools/Deployment/Deployment.csproj new file mode 100644 index 000000000..6d7a332df --- /dev/null +++ b/src/Tools/Deployment/Deployment.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {9D59077D-1A05-4D6C-A1A4-FB748D200578} + Library + Properties + ScriptSharp + ScriptSharp.Deployment + true + ..\..\ScriptSharp.snk + false + v4.0 + 512 + + + true + full + false + ..\..\..\bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/src/Tools/Deployment/Properties/AssemblyInfo.cs b/src/Tools/Deployment/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..db773d527 --- /dev/null +++ b/src/Tools/Deployment/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +// AssemblyInfo.cs +// Script#/Common +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("ScriptSharp.Deployment")] +[assembly: AssemblyDescription("Script# Web Application Integration")] diff --git a/src/Tools/Deployment/ScriptDeployTask.cs b/src/Tools/Deployment/ScriptDeployTask.cs new file mode 100644 index 000000000..1c23feb45 --- /dev/null +++ b/src/Tools/Deployment/ScriptDeployTask.cs @@ -0,0 +1,185 @@ +// ScriptDeployTask.cs +// Script#/Core/Build +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace ScriptSharp.Tasks { + + public sealed class ScriptDeployTask : Task { + + private string _projectPath; + private string _scriptsPath; + private ITaskItem[] _references; + + private HashSet _scriptSet; + private List _scripts; + + [Required] + public string ProjectPath { + get { + return _projectPath; + } + set { + _projectPath = value; + } + } + + [Required] + public ITaskItem[] References { + get { + return _references; + } + set { + _references = value; + } + } + + [Output] + public ITaskItem[] Scripts { + get { + if (_scripts == null) { + return new ITaskItem[0]; + } + return _scripts.ToArray(); + } + } + + public string ScriptsPath { + get { + if (String.IsNullOrEmpty(_scriptsPath)) { + return "Scripts"; + } + return _scriptsPath; + } + set { + _scriptsPath = value; + } + } + + private void CopyFile(string sourceFilePath, string targetFilePath) { + if (File.Exists(targetFilePath)) { + // If the file already exists, make sure it is not read-only, so + // it can be overrwritten. + File.SetAttributes(targetFilePath, FileAttributes.Normal); + } + + File.Copy(sourceFilePath, targetFilePath, /* overwrite */ true); + + // Copy the file, and then make sure it is not read-only (for example, if the + // source file for a referenced script is read-only). + File.SetAttributes(targetFilePath, FileAttributes.Normal); + } + + private void DeployScripts(string projectName, string scriptsFile, string projectPath, string scriptsTargetPath) { + string sourceDirectory = Path.GetDirectoryName(scriptsFile); + string[] scripts = File.ReadAllLines(scriptsFile); + + scripts = scripts.Select(s => Path.Combine(sourceDirectory, s)).ToArray(); + + Log.LogMessage("Deploying scripts from {0} project:", projectName); + foreach (string scriptPath in scripts) { + string scriptFile = Path.GetFileName(scriptPath); + if (scriptFile.Equals("ss.js", StringComparison.OrdinalIgnoreCase) || + scriptFile.Equals("ss.min.js", StringComparison.OrdinalIgnoreCase)) { + continue; + } + + string targetScriptPath = Path.Combine(scriptsTargetPath, scriptFile); + if (_scriptSet.Add(targetScriptPath)) { + CopyFile(scriptPath, targetScriptPath); + + Uri baseUri = new Uri(projectPath, UriKind.Absolute); + Uri targetUri = new Uri(targetScriptPath, UriKind.Absolute); + string relativePath = Uri.UnescapeDataString(baseUri.MakeRelativeUri(targetUri).ToString()).Replace("/", "\\"); + + Log.LogMessage("-> " + relativePath); + _scripts.Add(new TaskItem(relativePath)); + } + } + } + + public override bool Execute() { + _scriptSet = new HashSet(StringComparer.OrdinalIgnoreCase); + _scripts = new List(); + + string projectDirectory = Path.GetDirectoryName(_projectPath); + string scriptsDirectory = Path.Combine(projectDirectory, ScriptsPath); + if (Directory.Exists(scriptsDirectory) == false) { + Directory.CreateDirectory(scriptsDirectory); + } + + foreach (ITaskItem reference in _references) { + string referencePath = Path.GetFullPath(reference.ItemSpec); + string referenceName = Path.GetFileNameWithoutExtension(referencePath); + + Project project = GetReferencedProject(referencePath); + if (project == null) { + Log.LogError("Unable to load project {0}.", referenceName); + return false; + } + + if (IsScriptSharpProject(project) == false) { + continue; + } + + string scriptsFile = GetScriptsFile(project, referencePath); + if (String.IsNullOrEmpty(scriptsFile)) { + Log.LogError("Unable to find scripts list for project {0}.", referenceName); + return false; + } + + try { + DeployScripts(referenceName, scriptsFile, _projectPath, scriptsDirectory); + } + catch (Exception e) { + Log.LogError("Error deploying scripts from project {0}.\r\n{1}", referenceName, e.ToString()); + return false; + } + } + + return true; + } + + private string GetScriptsFile(Project project, string projectPath) { + string outputPath = project.GetProperty("OutputPath").EvaluatedValue; + string assemblyName = project.GetProperty("AssemblyName").EvaluatedValue; + + string scriptsFilePath = Path.Combine(Path.GetDirectoryName(projectPath), outputPath, assemblyName + ".scripts"); + if (File.Exists(scriptsFilePath) == false) { + return null; + } + + return scriptsFilePath; + } + + private Project GetReferencedProject(string projectPath) { + ProjectCollection projects = ProjectCollection.GlobalProjectCollection; + ICollection loadedProjects = projects.GetLoadedProjects(projectPath); + + Project project = loadedProjects.FirstOrDefault(); + if (project == null) { + project = new Project(projectPath); + } + + return project; + } + + private bool IsScriptSharpProject(Project project) { + ProjectProperty scriptSharpProperty = project.GetProperty("ScriptSharp"); + if ((scriptSharpProperty != null) && + scriptSharpProperty.EvaluatedValue.Equals("true", StringComparison.OrdinalIgnoreCase)) { + return true; + } + + return false; + } + } +} diff --git a/src/Tools/Deployment/ScriptSharpWeb.targets b/src/Tools/Deployment/ScriptSharpWeb.targets new file mode 100644 index 000000000..4264b3a96 --- /dev/null +++ b/src/Tools/Deployment/ScriptSharpWeb.targets @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + $(CompileDependsOn);CopyReferencedScripts + + diff --git a/src/Tools/Testing/WebBrowser.cs b/src/Tools/Testing/WebBrowser.cs index 5bbcb5f77..76f556d09 100644 --- a/src/Tools/Testing/WebBrowser.cs +++ b/src/Tools/Testing/WebBrowser.cs @@ -47,9 +47,19 @@ public string Name { private static string GetChromeExecutablePath() { string path = null; - RegistryKey chromeKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\"); + RegistryKey chromeKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\"); if (chromeKey != null) { - path = Path.Combine((string)chromeKey.GetValue("InstallLocation"), "chrome.exe"); + path = (string)chromeKey.GetValue("Path"); + } + else { + chromeKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome\"); + if (chromeKey != null) { + path = (string)chromeKey.GetValue("InstallLocation"); + } + } + + if (path != null) { + path = Path.Combine(path, "chrome.exe"); if (!File.Exists(path)) { path = null; } diff --git a/src/ZipX/Packages/Lib.Node.Azure.nuspec b/src/ZipX/Packages/Lib.Node.Azure.nuspec new file mode 100644 index 000000000..ee7cee95b --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Azure.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Azure + 0.8 + Script# Azure for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Azure APIs in node.js Script# projects. + + This package contains contains the Script.Node.Azure assembly that allows you to reference and program against the Windows Azure APIs when creating Node.js based applications and modules with Script#. + + script azure windowsazure node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Neo4j.nuspec b/src/ZipX/Packages/Lib.Node.Neo4j.nuspec new file mode 100644 index 000000000..880393b9e --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Neo4j.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Neo4j + 0.8 + Script# Neo4j for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Neo4j APIs in node.js Script# projects. + + This package contains contains the Script.Node.Neo4j assembly that allows you to reference and program against the Neo4j APIs when creating Node.js based applications and modules with Script#. + + script neo4j graph node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Restify.nuspec b/src/ZipX/Packages/Lib.Node.Restify.nuspec new file mode 100644 index 000000000..d62e0c784 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Restify.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Restify + 0.8 + Script# Restify for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Restify APIs in node.js Script# projects. + + This package contains contains the Script.Node.Restify assembly that allows you to reference and program against the Restify APIs when creating Node.js based applications and modules with Script#. + + script restify node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Runtime.nuspec b/src/ZipX/Packages/Runtime.nuspec index de194e309..06bb2a6fa 100644 --- a/src/ZipX/Packages/Runtime.nuspec +++ b/src/ZipX/Packages/Runtime.nuspec @@ -3,15 +3,15 @@ ScriptSharp.Runtime 0.8 - Script# Runtime Scripts + Script# Runtime and Script Deployment Support Nikhil Kothari Copyright (c) 2012, Nikhil Kothari http://scriptsharp.com http://scriptsharp.com/nuget/Package.png http://scriptsharp.com/nuget/License.txt - Provides the core javascript runtime for Script#-based scripts for use in Web projects. + Provides the core javascript runtime (ss.js) for Script#-based scripts and script deployment functionality into Web application projects. - This package contains scripts like mscorlib.js which provides the runtime script implementations of a type system and core APIs available to scripts generated using Script# for deployment within web applications (such as asp.net mvc projects). + This package contains ss.js and related scripts used by script# generated scripts at runtime. It also adds script deployment functionality, to copy generated scripts from referenced script# projects into Web applications. script scriptsharp javascript html aspnet mvc thescriptsharp en-US @@ -22,5 +22,10 @@ + + + + + diff --git a/src/ZipX/Packages/Runtime/Install.ps1 b/src/ZipX/Packages/Runtime/Install.ps1 new file mode 100644 index 000000000..f477b16eb --- /dev/null +++ b/src/ZipX/Packages/Runtime/Install.ps1 @@ -0,0 +1,29 @@ +param($installPath, $toolsPath, $package, $project) + +Import-Module (Join-Path $toolsPath "Reset.psm1") + +function Compute-RelativePath ($basePath, $referencePath) { + $baseUri = New-Object -typename System.Uri -argumentlist $basePath + $referenceUri = New-Object -typename System.Uri -argumentlist $referencePath + + $relativeUri = $baseUri.MakeRelativeUri($referenceUri) + $relativePath = [System.Uri]::UnescapeDataString($relativeUri.ToString()).Replace('/', '\') + return $relativePath +} + +# Get the msbuild object associated with the project +Add-Type -AssemblyName "Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" +$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 + +# first remove any existing import reference +Reset-Project $msbuild + +# get a relative reference to the targets file in the package's tools directory +# and add it to the project +$targetsAbsolutePath = Join-Path $toolsPath "ScriptSharpWeb.targets" +$targetsRelativePath = Compute-RelativePath $project.FullName $targetsAbsolutePath +$import = $msbuild.Xml.AddImport($targetsRelativePath) +$import.Condition = "Exists('" + $targetsRelativePath + "')" + +# finally save the project +$project.Save() diff --git a/src/ZipX/Packages/Runtime/Reset.psm1 b/src/ZipX/Packages/Runtime/Reset.psm1 new file mode 100644 index 000000000..7d8ca8798 --- /dev/null +++ b/src/ZipX/Packages/Runtime/Reset.psm1 @@ -0,0 +1,11 @@ +function Reset-Project($msbuild) { + $imports = $msbuild.Xml.Imports + + if ($imports.Count -gt 0) { + foreach ($import in $imports) { + if ($import.Project.IndexOf("ScriptSharpWeb.targets") -gt 0) { + $msbuild.Xml.RemoveChild($import) + } + } + } +} diff --git a/src/ZipX/Packages/Runtime/Uninstall.ps1 b/src/ZipX/Packages/Runtime/Uninstall.ps1 new file mode 100644 index 000000000..4453cf626 --- /dev/null +++ b/src/ZipX/Packages/Runtime/Uninstall.ps1 @@ -0,0 +1,13 @@ +param($installPath, $toolsPath, $package, $project) + +Import-Module (Join-Path $toolsPath "Reset.psm1") + +# Get the msbuild object associated with the project and add an import +Add-Type -AssemblyName "Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" +$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName)[0] + +# remove import reference +Reset-Project $msbuild + +# and then save the project +$project.Save() diff --git a/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj b/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj index 2374528f9..bcb3b6168 100644 --- a/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj +++ b/src/ZipX/ProjectTemplates/HTMLApplication/Application.csproj @@ -13,7 +13,6 @@ True True True - True True diff --git a/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj b/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj index 95df62bb5..39490e368 100644 --- a/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj +++ b/src/ZipX/ProjectTemplates/HTMLModule/Module.csproj @@ -13,7 +13,6 @@ True True True - True True diff --git a/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj b/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj index ebec60948..7233aa44d 100644 --- a/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj +++ b/src/ZipX/ProjectTemplates/NodeApplication/Application.csproj @@ -13,7 +13,6 @@ True True False - False True node_modules diff --git a/src/ZipX/ProjectTemplates/NodeModule/Module.csproj b/src/ZipX/ProjectTemplates/NodeModule/Module.csproj index ebec60948..7233aa44d 100644 --- a/src/ZipX/ProjectTemplates/NodeModule/Module.csproj +++ b/src/ZipX/ProjectTemplates/NodeModule/Module.csproj @@ -13,7 +13,6 @@ True True False - False True node_modules diff --git a/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj b/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj index 2374528f9..bcb3b6168 100644 --- a/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj +++ b/src/ZipX/ProjectTemplates/jQueryApplication/Application.csproj @@ -13,7 +13,6 @@ True True True - True True diff --git a/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj index b72322e3f..8cecbeee7 100644 --- a/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj +++ b/src/ZipX/ProjectTemplates/jQueryPlugin/Plugin.csproj @@ -13,7 +13,6 @@ True True True - True True diff --git a/src/ZipX/VSIX/Extension.vsixmanifest b/src/ZipX/VSIX/Extension.vsixmanifest index d8ed80ae0..459fd8d27 100644 --- a/src/ZipX/VSIX/Extension.vsixmanifest +++ b/src/ZipX/VSIX/Extension.vsixmanifest @@ -29,6 +29,13 @@ VCSExpress VWDExpress + + Ultimate + Premium + Pro + VCSExpress + VWDExpress + diff --git a/src/ZipX/ZipX.csproj b/src/ZipX/ZipX.csproj index 9020249b3..faa70ac0b 100644 --- a/src/ZipX/ZipX.csproj +++ b/src/ZipX/ZipX.csproj @@ -28,7 +28,10 @@ + + + @@ -80,7 +83,10 @@ + + + diff --git a/tests/Core/BrowserTest.cs b/tests/Core/BrowserTest.cs index 5b450750a..2dc75d4ab 100644 --- a/tests/Core/BrowserTest.cs +++ b/tests/Core/BrowserTest.cs @@ -22,6 +22,7 @@ public abstract class BrowserTest { private static readonly string[] _codeFiles = new string[] { "OOP.cs" }; + private static string _compilationFailures; private const int _port = 3976; @@ -40,16 +41,24 @@ static BrowserTest() { File.Copy(Path.Combine(binDirectory, script), Path.Combine(scriptsDirectory, script), overwrite: true); } + List codeFailures = new List(); + string mscorlibPath = Path.Combine(binDirectory, "mscorlib.dll"); foreach (string codeFile in _codeFiles) { string script = Path.GetFileNameWithoutExtension(codeFile) + Path.ChangeExtension(".cs", ".js"); SimpleCompilation compilation = new SimpleCompilation(Path.Combine(scriptsDirectory, script)); - compilation.AddReference(mscorlibPath) - .AddSource(Path.Combine(codeDirectory, codeFile)) - .Execute(); + bool result = compilation.AddReference(mscorlibPath) + .AddSource(Path.Combine(codeDirectory, codeFile)) + .Execute(); + + if (result == false) { + codeFailures.Add(codeFile); + } } + _compilationFailures = (codeFailures.Count == 0) ? null : String.Join(", ", codeFailures); + _webTest = new WebTest(); _webTest.StartWebServer(_port, webRoot); } @@ -64,6 +73,11 @@ public TestContext TestContext { } protected void RunTest(string url) { + if (_compilationFailures != null) { + Assert.Fail("Could not run test due to compilation failure of " + _compilationFailures + "."); + return; + } + Uri testUri = _webTest.GetTestUri(url); WebTestResult result = _webTest.RunTest(testUri, WebBrowser.Chrome); diff --git a/tests/ScriptTests.cs b/tests/ScriptTests.cs index e64325083..6ea00bfb1 100644 --- a/tests/ScriptTests.cs +++ b/tests/ScriptTests.cs @@ -22,6 +22,11 @@ public void TestTypeSystem() { RunTest("/TypeSystem.htm"); } + [TestMethod] + public void TestBases() { + RunTest("/Bases.htm"); + } + #region Loader Tests [TestMethod] public void TestLoader() { diff --git a/tests/TestCases/Basic/Conditionals/DebugBaseline.txt b/tests/TestCases/Basic/Conditionals/DebugBaseline.txt index b300d442e..6adf248c7 100644 --- a/tests/TestCases/Basic/Conditionals/DebugBaseline.txt +++ b/tests/TestCases/Basic/Conditionals/DebugBaseline.txt @@ -5,24 +5,21 @@ define('test', ['ss'], function(ss) { // BasicTests.MyDebug - function BasicTests$MyDebug() { + function MyDebug() { } - BasicTests$MyDebug.showInfo = function() { - } - BasicTests$MyDebug.traceInfo = function() { - } - BasicTests$MyDebug.logInfo = function() { - } - var BasicTests$MyDebug$ = { - + MyDebug.showInfo = function() { + }; + MyDebug.traceInfo = function() { + }; + MyDebug.logInfo = function() { }; // BasicTests.App - function BasicTests$App(i) { + function App(i) { console.assert(false); - BasicTests$MyDebug.showInfo(); + MyDebug.showInfo(); while (true) { console.assert(false); } @@ -44,15 +41,15 @@ define('test', ['ss'], function(ss) { console.log('.'); } } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - MyDebug: [ BasicTests$MyDebug, BasicTests$MyDebug$, null ], - App: [ BasicTests$App, BasicTests$App$, null ] + MyDebug: [ MyDebug, null, null ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Conditionals/TraceBaseline.txt b/tests/TestCases/Basic/Conditionals/TraceBaseline.txt index 5118f3ae2..314a855f3 100644 --- a/tests/TestCases/Basic/Conditionals/TraceBaseline.txt +++ b/tests/TestCases/Basic/Conditionals/TraceBaseline.txt @@ -5,22 +5,19 @@ define('test', ['ss'], function(ss) { // BasicTests.MyDebug - function BasicTests$MyDebug() { + function MyDebug() { } - BasicTests$MyDebug.showInfo = function() { - } - BasicTests$MyDebug.traceInfo = function() { - } - BasicTests$MyDebug.logInfo = function() { - } - var BasicTests$MyDebug$ = { - + MyDebug.showInfo = function() { + }; + MyDebug.traceInfo = function() { + }; + MyDebug.logInfo = function() { }; // BasicTests.App - function BasicTests$App(i) { + function App(i) { while (true) { } switch (i) { @@ -28,17 +25,17 @@ define('test', ['ss'], function(ss) { break; } i++; - BasicTests$MyDebug.traceInfo(); + MyDebug.traceInfo(); } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - MyDebug: [ BasicTests$MyDebug, BasicTests$MyDebug$, null ], - App: [ BasicTests$App, BasicTests$App$, null ] + MyDebug: [ MyDebug, null, null ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Dependencies/Code1Baseline.txt b/tests/TestCases/Basic/Dependencies/Code1Baseline.txt index 5df95612f..9098c97f5 100644 --- a/tests/TestCases/Basic/Dependencies/Code1Baseline.txt +++ b/tests/TestCases/Basic/Dependencies/Code1Baseline.txt @@ -5,18 +5,18 @@ define('test', ['ss', 'lib1'], function(ss, lib1) { // BasicTests.App - function BasicTests$App() { + function App() { var c1 = new lib1.Component1(); var c2 = new Component2(); } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - App: [ BasicTests$App, BasicTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Dependencies/Code2Baseline.txt b/tests/TestCases/Basic/Dependencies/Code2Baseline.txt index 30e7ab2db..8eb615e24 100644 --- a/tests/TestCases/Basic/Dependencies/Code2Baseline.txt +++ b/tests/TestCases/Basic/Dependencies/Code2Baseline.txt @@ -5,20 +5,20 @@ define('test', ['ss', 'lib1', 'comp3', 'comp4'], function(ss, lib1, comp3, comp4 // BasicTests.App - function BasicTests$App() { + function App() { var c1 = new lib1.Component1(); var c2 = new Component2(); var c3 = new comp3.Component3(); var c4 = new Component4(); } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - App: [ BasicTests$App, BasicTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Dependencies/Code3Baseline.txt b/tests/TestCases/Basic/Dependencies/Code3Baseline.txt index aee0e987d..bb32d1c67 100644 --- a/tests/TestCases/Basic/Dependencies/Code3Baseline.txt +++ b/tests/TestCases/Basic/Dependencies/Code3Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss', 'lib1', '/lib/comp3'], function(ss, lib1, comp3) { // BasicTests.App - function BasicTests$App() { + function App() { var c1 = new lib1.Component1(); var c2 = new Component2(); var c3 = new comp3.Component3(); @@ -13,14 +13,14 @@ define('test', ['ss', 'lib1', '/lib/comp3'], function(ss, lib1, comp3) { var c4 = new Component4(); }); } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - App: [ BasicTests$App, BasicTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Dependencies/Code4Baseline.txt b/tests/TestCases/Basic/Dependencies/Code4Baseline.txt index 43fc4152c..8fa573502 100644 --- a/tests/TestCases/Basic/Dependencies/Code4Baseline.txt +++ b/tests/TestCases/Basic/Dependencies/Code4Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss', 'lib1', '/lib/comp3', 'text!data.html'], function(ss, lib1 // BasicTests.App - function BasicTests$App() { + function App() { var c1 = new lib1.Component1(); var c2 = new Component2(); var c3 = new comp3.Component3(); @@ -14,14 +14,14 @@ define('test', ['ss', 'lib1', '/lib/comp3', 'text!data.html'], function(ss, lib1 }); alert(dataTemplate); } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - App: [ BasicTests$App, BasicTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/DocComments/Baseline.txt b/tests/TestCases/Basic/DocComments/Baseline.txt index ce66bee49..bd7a0aa61 100644 --- a/tests/TestCases/Basic/DocComments/Baseline.txt +++ b/tests/TestCases/Basic/DocComments/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // BasicTests.Suit - var BasicTests$Suit = { + var Suit = { heart: 0, spade: 1, club: 2, @@ -15,12 +15,12 @@ define('test', ['ss'], function(ss) { // BasicTests.IInterface - function BasicTests$IInterface() { } + function IInterface() { } // BasicTests.RecordClass - function BasicTests$RecordClass(count) { + function RecordClass(count) { var $o = {}; return $o; } @@ -28,7 +28,7 @@ define('test', ['ss'], function(ss) { // BasicTests.BaseClass - function BasicTests$BaseClass(domElement, name, count) { + function BaseClass(domElement, name, count) { /// /// Represents a base class. /// @@ -58,22 +58,22 @@ define('test', ['ss'], function(ss) { this.instanceField = 0; this._domElement = domElement; } - BasicTests$BaseClass.get_totalCount = function() { + BaseClass.get_totalCount = function() { /// /// Gets the total count. /// /// return 0; - } - BasicTests$BaseClass.staticMethod = function(length) { + }; + BaseClass.staticMethod = function(length) { /// /// A static method. /// /// /// The length. /// - } - var BasicTests$BaseClass$ = { + }; + var BaseClass$ = { get_name: function() { /// /// Gets or sets the name. @@ -195,21 +195,21 @@ define('test', ['ss'], function(ss) { // BasicTests.InternalClass - function BasicTests$InternalClass() { + function InternalClass() { /// /// An internal class. /// } - var BasicTests$InternalClass$ = { + var InternalClass$ = { }; // BasicTests.InternalClassWithNoComments - function BasicTests$InternalClassWithNoComments() { + function InternalClassWithNoComments() { } - var BasicTests$InternalClassWithNoComments$ = { + var InternalClassWithNoComments$ = { }; @@ -220,18 +220,18 @@ define('test', ['ss'], function(ss) { /// /// Runs. /// - } + }; // BasicTests.DerivedClass - function BasicTests$DerivedClass() { + function DerivedClass() { /// /// Represents a derived class. /// - BasicTests$BaseClass.call(this, null, null, 0); + BaseClass.call(this, null, null, 0); } - var BasicTests$DerivedClass$ = { + var DerivedClass$ = { method3: function(first, last) { /// /// Overriden method with params. @@ -248,18 +248,18 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', { - InternalClass: [ BasicTests$InternalClass, BasicTests$InternalClass$, null ], - InternalClassWithNoComments: [ BasicTests$InternalClassWithNoComments, BasicTests$InternalClassWithNoComments$, null ] + InternalClass: [ InternalClass, InternalClass$, null ], + InternalClassWithNoComments: [ InternalClassWithNoComments, InternalClassWithNoComments$, null ] }, { - Suit: BasicTests$Suit, - IInterface: [ BasicTests$IInterface ], - RecordClass: BasicTests$RecordClass, - BaseClass: [ BasicTests$BaseClass, BasicTests$BaseClass$, null ], - DerivedClass: [ BasicTests$DerivedClass, BasicTests$DerivedClass$, BasicTests$BaseClass ] + Suit: Suit, + IInterface: [ IInterface ], + RecordClass: RecordClass, + BaseClass: [ BaseClass, BaseClass$, null ], + DerivedClass: [ DerivedClass, DerivedClass$, BaseClass ] }); - BasicTests$BaseClass.constantField = 3; + BaseClass.constantField = 3; return $exports; }); diff --git a/tests/TestCases/Basic/Flags/Baseline.txt b/tests/TestCases/Basic/Flags/Baseline.txt index b57b027f7..faa3eb6b4 100644 --- a/tests/TestCases/Basic/Flags/Baseline.txt +++ b/tests/TestCases/Basic/Flags/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // BasicTests.App - function BasicTests$App() { + function App() { } - var BasicTests$App$ = { + var App$ = { method1: function(i) { var j = i; var x = j++; @@ -21,7 +21,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ BasicTests$App, BasicTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt b/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt index 054bc9401..920451184 100644 --- a/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt +++ b/tests/TestCases/Basic/Includes/MultipleIncBaseline.txt @@ -6,16 +6,16 @@ // Basic.App - function Basic$App() { + function App() { } - var Basic$App$ = { + var App$ = { }; var $exports = ss.module('basic', null, { - App: [ Basic$App, Basic$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Includes/SingleIncBaseline.txt b/tests/TestCases/Basic/Includes/SingleIncBaseline.txt index 4e0297385..299a56c9b 100644 --- a/tests/TestCases/Basic/Includes/SingleIncBaseline.txt +++ b/tests/TestCases/Basic/Includes/SingleIncBaseline.txt @@ -5,16 +5,16 @@ // Basic.App -function Basic$App() { +function App() { } -var Basic$App$ = { +var App$ = { }; var $exports = ss.module('basic', null, { - App: [ Basic$App, Basic$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt b/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt index 46ab10816..29a53f0a1 100644 --- a/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt +++ b/tests/TestCases/Basic/Includes/ZeroIncBaseline.txt @@ -4,16 +4,16 @@ {include:pre.js} // Basic.App -function Basic$App() { +function App() { } -var Basic$App$ = { +var App$ = { }; var $exports = ss.module('basic', null, { - App: [ Basic$App, Basic$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Metadata/Baseline.txt b/tests/TestCases/Basic/Metadata/Baseline.txt index f64abef15..dac4adc20 100644 --- a/tests/TestCases/Basic/Metadata/Baseline.txt +++ b/tests/TestCases/Basic/Metadata/Baseline.txt @@ -609,7 +609,7 @@ Types: Method: Parse AssociatedType: Date Visibility: Public, Static - Generated Name: parseDate + Generated Name: ss.date Abstract: False Method: SetDate AssociatedType: Void @@ -1513,6 +1513,21 @@ Types: Visibility: Public, Static Generated Name: invokeMethod Abstract: False + Method: IsFalsey + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isFalsey + Abstract: False + Method: IsFinite + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isFinite + Abstract: False + Method: IsNaN + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isNaN + Abstract: False Method: IsNull AssociatedType: Boolean Visibility: Public, Static @@ -1533,11 +1548,21 @@ Types: Visibility: Public, Static Generated Name: ss.isValue Abstract: False + Method: IsTruthy + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isTruthy + Abstract: False Method: Literal AssociatedType: Object Visibility: Public, Static Generated Name: literal Abstract: False + Method: Or + AssociatedType: TValue + Visibility: Public, Static + Generated Name: or + Abstract: False Method: SetField AssociatedType: Void Visibility: Public, Static @@ -1556,7 +1581,7 @@ Types: Method: Value AssociatedType: TValue Visibility: Public, Static - Generated Name: value + Generated Name: ss.value Abstract: False Method: Enumerate AssociatedType: Object @@ -1811,7 +1836,7 @@ Types: Method: Trim AssociatedType: String Visibility: Public - Generated Name: trim + Generated Name: ss.trim Abstract: False Method: TrimEnd AssociatedType: String @@ -3644,6 +3669,11 @@ Types: Visibility: Public, Static Generated Name: any Abstract: False + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith AssociatedType: Task Visibility: Public @@ -3681,6 +3711,11 @@ Types: AssociatedType: T Visibility: Public Generated Name: result + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith AssociatedType: Task`1 Visibility: Public @@ -3725,7 +3760,7 @@ define('test', ['ss'], function(ss) { // BasicTests.AppFlags - var BasicTests$AppFlags = { + var AppFlags = { AAA: 1, BBB: 2 }; @@ -3733,7 +3768,7 @@ define('test', ['ss'], function(ss) { // BasicTests.Mode - var BasicTests$Mode = { + var Mode = { mode1: 0, mode2: 1 }; @@ -3741,17 +3776,17 @@ define('test', ['ss'], function(ss) { // BasicTests.IFoo - function BasicTests$IFoo() { } + function IFoo() { } // BasicTests.IApp - function BasicTests$IApp() { } + function IApp() { } // BasicTests.Point - function BasicTests$Point(x, y) { + function Point(x, y) { var $o = {}; $o.x = x; $o.y = y; @@ -3761,9 +3796,9 @@ define('test', ['ss'], function(ss) { // BasicTests.App - function BasicTests$App() { + function App() { } - var BasicTests$App$ = { + var App$ = { add_event1: function(value) { this.__event1 = ss.bindAdd(this.__event1, value); }, @@ -3783,9 +3818,9 @@ define('test', ['ss'], function(ss) { // BasicTests.AppHelper - function BasicTests$AppHelper() { + function AppHelper() { } - var BasicTests$AppHelper$ = { + var AppHelper$ = { get_prop1: function() { return 0; }, @@ -3806,20 +3841,20 @@ define('test', ['ss'], function(ss) { // BasicTests.Util $global.showHelp = function() { - } + }; var $exports = ss.module('test', { - IFoo: [ BasicTests$IFoo ], - Point: BasicTests$Point, - AppHelper: [ BasicTests$AppHelper, BasicTests$AppHelper$, null ] + IFoo: [ IFoo ], + Point: Point, + AppHelper: [ AppHelper, AppHelper$, null ] }, { - AppFlags: BasicTests$AppFlags, - Mode: BasicTests$Mode, - IApp: [ BasicTests$IApp ], - App: [ BasicTests$App, BasicTests$App$, null, BasicTests$IApp ] + AppFlags: AppFlags, + Mode: Mode, + IApp: [ IApp ], + App: [ App, App$, null, IApp ] }); diff --git a/tests/TestCases/Basic/Minimization/Baseline.txt b/tests/TestCases/Basic/Minimization/Baseline.txt index f041c5ecf..daf9da6f6 100644 --- a/tests/TestCases/Basic/Minimization/Baseline.txt +++ b/tests/TestCases/Basic/Minimization/Baseline.txt @@ -43,7 +43,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.AppFlags - var BasicTests$AppFlags = { + var AppFlags = { AAA: 0, BBB: 1 }; @@ -51,12 +51,12 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.IApp - function BasicTests$IApp() { } + function IApp() { } // BasicTests.MyData - function BasicTests$MyData(a, b) { + function MyData(a, b) { var $o = {}; $o.$0 = a; $o.$1 = b; @@ -67,34 +67,40 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.GlobalMethodsClass $global.run = function() { - } + }; - // BasicTests.BaseBaseClass + // BasicTests.App - function BasicTests$BaseBaseClass() { + function App() { + var helper = new AppHelper(); + helper.$0(); } - var BasicTests$BaseBaseClass$ = { + var App$ = { + run: function() { + }, $0: function() { + }, + $1: function() { } }; - // BasicTests.ABC + // BasicTests.AppHelper - function BasicTests$ABC() { - var d = { }; + function AppHelper() { } - var BasicTests$ABC$ = { - + var AppHelper$ = { + $0: function() { + } }; // BasicTests.Bar - function BasicTests$Bar() { + function Bar() { } - var BasicTests$Bar$ = { + var Bar$ = { $0: function() { }, toString: function() { @@ -105,76 +111,70 @@ define('test', ['ss', 'lib'], function(ss, lib) { }; - // BasicTests.AppHelper + // BasicTests.BaseBaseClass - function BasicTests$AppHelper() { + function BaseBaseClass() { } - var BasicTests$AppHelper$ = { + var BaseBaseClass$ = { $0: function() { } }; - // BasicTests.App + // BasicTests.ABC - function BasicTests$App() { - var helper = new BasicTests$AppHelper(); - helper.$0(); + function ABC() { + var d = { }; } - var BasicTests$App$ = { - run: function() { - }, - $0: function() { - }, - $1: function() { - } + var ABC$ = { + }; - // BasicTests.BaseClass + // BasicTests.Bar2 - function BasicTests$BaseClass() { - BasicTests$BaseBaseClass.call(this); + function Bar2() { + Bar.call(this); } - var BasicTests$BaseClass$ = { - $1: function() { - } + var Bar2$ = { + }; - // BasicTests.Bar2 + // BasicTests.BarCustom - function BasicTests$Bar2() { - BasicTests$Bar.call(this); + function BarCustom() { + Bar.call(this); } - var BasicTests$Bar2$ = { + var BarCustom$ = { }; - // BasicTests.BarCustom + // BasicTests.BaseClass - function BasicTests$BarCustom() { - BasicTests$Bar.call(this); + function BaseClass() { + BaseBaseClass.call(this); } - var BasicTests$BarCustom$ = { - + var BaseClass$ = { + $1: function() { + } }; // BasicTests.BarEx - function BasicTests$BarEx() { - BasicTests$Bar2.call(this); + function BarEx() { + Bar2.call(this); } - var BasicTests$BarEx$ = { + var BarEx$ = { $2: function() { var mode = 1; }, $0: function() { this.$2(); - ss.base(this, '$0').call(this); - var d = BasicTests$MyData('a', 'b'); + Bar2.prototype.$0.call(this); + var d = MyData('a', 'b'); d.$0 = d.$1; }, $3: function(blah) { @@ -238,10 +238,10 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.BarCustom2 - function BasicTests$BarCustom2() { - BasicTests$BarCustom.call(this); + function BarCustom2() { + BarCustom.call(this); } - var BasicTests$BarCustom2$ = { + var BarCustom2$ = { $2: function() { return 0; }, @@ -255,7 +255,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.FooBehavior - function BasicTests$FooBehavior(e, i) { + function FooBehavior(e, i) { this.c$0 = 0; this.c$1 = 0; this.c$2 = 0; @@ -264,7 +264,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { this.c$1 = i * 2; this.c$2 = i * 4; } - var BasicTests$FooBehavior$ = { + var FooBehavior$ = { add_c$4: function(value) { this.c$5 = ss.bindAdd(this.c$5, value); }, @@ -273,7 +273,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { }, dispose: function() { this.c$0 = 0; - ss.base(this, 'dispose').call(this); + lib.Behavior.prototype.dispose.call(this); }, c$6: function() { }, @@ -288,10 +288,10 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.DerivedClass - function BasicTests$DerivedClass() { - BasicTests$BaseClass.call(this); + function DerivedClass() { + BaseClass.call(this); } - var BasicTests$DerivedClass$ = { + var DerivedClass$ = { $2: function() { } }; @@ -299,10 +299,10 @@ define('test', ['ss', 'lib'], function(ss, lib) { // BasicTests.MaskTextBox - function BasicTests$MaskTextBox(e) { + function MaskTextBox(e) { lib.TextBox.call(this, e); } - var BasicTests$MaskTextBox$ = { + var MaskTextBox$ = { e$0: function() { }, e$1: function() { @@ -312,24 +312,24 @@ define('test', ['ss', 'lib'], function(ss, lib) { var $exports = ss.module('test', { - IApp: [ BasicTests$IApp ], - MyData: BasicTests$MyData, - AppHelper: [ BasicTests$AppHelper, BasicTests$AppHelper$, null ], - Bar: [ BasicTests$Bar, BasicTests$Bar$, null ], - BaseBaseClass: [ BasicTests$BaseBaseClass, BasicTests$BaseBaseClass$, null ], - ABC: [ BasicTests$ABC, BasicTests$ABC$, null ], - Bar2: [ BasicTests$Bar2, BasicTests$Bar2$, BasicTests$Bar ], - BarCustom: [ BasicTests$BarCustom, BasicTests$BarCustom$, BasicTests$Bar ], - BaseClass: [ BasicTests$BaseClass, BasicTests$BaseClass$, BasicTests$BaseBaseClass ], - BarEx: [ BasicTests$BarEx, BasicTests$BarEx$, BasicTests$Bar2 ], - BarCustom2: [ BasicTests$BarCustom2, BasicTests$BarCustom2$, BasicTests$BarCustom ], - DerivedClass: [ BasicTests$DerivedClass, BasicTests$DerivedClass$, BasicTests$BaseClass ], - MaskTextBox: [ BasicTests$MaskTextBox, BasicTests$MaskTextBox$, lib.TextBox ] + IApp: [ IApp ], + MyData: MyData, + AppHelper: [ AppHelper, AppHelper$, null ], + Bar: [ Bar, Bar$, null ], + BaseBaseClass: [ BaseBaseClass, BaseBaseClass$, null ], + ABC: [ ABC, ABC$, null ], + Bar2: [ Bar2, Bar2$, Bar ], + BarCustom: [ BarCustom, BarCustom$, Bar ], + BaseClass: [ BaseClass, BaseClass$, BaseBaseClass ], + BarEx: [ BarEx, BarEx$, Bar2 ], + BarCustom2: [ BarCustom2, BarCustom2$, BarCustom ], + DerivedClass: [ DerivedClass, DerivedClass$, BaseClass ], + MaskTextBox: [ MaskTextBox, MaskTextBox$, lib.TextBox ] }, { - AppFlags: BasicTests$AppFlags, - App: [ BasicTests$App, BasicTests$App$, null ], - FooBehavior: [ BasicTests$FooBehavior, BasicTests$FooBehavior$, lib.Behavior ] + AppFlags: AppFlags, + App: [ App, App$, null ], + FooBehavior: [ FooBehavior, FooBehavior$, lib.Behavior ] }); diff --git a/tests/TestCases/Basic/Resources/Baseline.txt b/tests/TestCases/Basic/Resources/Baseline.txt index f73ea881f..12a991b13 100644 --- a/tests/TestCases/Basic/Resources/Baseline.txt +++ b/tests/TestCases/Basic/Resources/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // Resources.Strings1 - var Resources$Strings1 = { + var Strings1 = { string1: 'neutral: aaa', string2: 'fr: bbb', string3: 'fr-FR: ccc' @@ -14,7 +14,7 @@ define('test', ['ss'], function(ss) { // Resources.Strings2 - var Resources$Strings2 = { + var Strings2 = { string1: 's2', string2: '1234' }; @@ -22,21 +22,21 @@ define('test', ['ss'], function(ss) { // BasicTests.App - function BasicTests$App() { - var s1 = Resources$Strings1.string1; + function App() { + var s1 = Strings1.string1; } - var BasicTests$App$ = { + var App$ = { }; var $exports = ss.module('test', { - Strings1: Resources$Strings1 + Strings1: Strings1 }, { - Strings2: Resources$Strings2, - App: [ BasicTests$App, BasicTests$App$, null ] + Strings2: Strings2, + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Basic/Simple/AMDBaseline.txt b/tests/TestCases/Basic/Simple/AMDBaseline.txt index 90bd5f354..fffbdfb6c 100644 --- a/tests/TestCases/Basic/Simple/AMDBaseline.txt +++ b/tests/TestCases/Basic/Simple/AMDBaseline.txt @@ -10,19 +10,19 @@ define('basic', ['ss'], function(ss) { // Basic.EventArgs - function Basic$EventArgs() { + function EventArgs() { } - var Basic$EventArgs$ = { + var EventArgs$ = { }; // Basic.Button - function Basic$Button(text) { + function Button(text) { this._text = text; } - var Basic$Button$ = { + var Button$ = { add_click: function(value) { this.__click = ss.bindAdd(this.__click, value); }, @@ -34,7 +34,7 @@ define('basic', ['ss'], function(ss) { }, performClick: function() { if (this.__click != null) { - this.__click(this, Basic$EventArgs.Empty); + this.__click(this, EventArgs.Empty); } } }; @@ -42,19 +42,19 @@ define('basic', ['ss'], function(ss) { // Basic.App - function Basic$App() { - this._btn1 = new Basic$Button('OK'); + function App() { + this._btn1 = new Button('OK'); this._btn1.add_click(ss.bind('_onClickButton', this)); this._btn1.add_click(ss.bind('_onClickButtonDup', this)); - this._btn2 = new Basic$Button('Cancel'); + this._btn2 = new Button('Cancel'); this._btn2.add_click(ss.bind('_onClickButton', this)); } - Basic$App.main = function(args) { - var theApp = new Basic$App(); + App.main = function(args) { + var theApp = new App(); theApp._btn1.performClick(); theApp._btn2.performClick(); - } - var Basic$App$ = { + }; + var App$ = { _echo: function(s) { }, _onClickButton: function(sender, e) { @@ -68,12 +68,12 @@ define('basic', ['ss'], function(ss) { var $exports = ss.module('basic', null, { - EventArgs: [ Basic$EventArgs, Basic$EventArgs$, null ], - Button: [ Basic$Button, Basic$Button$, null ], - App: [ Basic$App, Basic$App$, null ] + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] }); - Basic$EventArgs.Empty = new Basic$EventArgs(); + EventArgs.Empty = new EventArgs(); return $exports; }); diff --git a/tests/TestCases/Basic/Simple/DefaultBaseline.txt b/tests/TestCases/Basic/Simple/DefaultBaseline.txt index a25866946..ab0d33b05 100644 --- a/tests/TestCases/Basic/Simple/DefaultBaseline.txt +++ b/tests/TestCases/Basic/Simple/DefaultBaseline.txt @@ -5,19 +5,19 @@ define('basic', ['ss'], function(ss) { // Basic.EventArgs - function Basic$EventArgs() { + function EventArgs() { } - var Basic$EventArgs$ = { + var EventArgs$ = { }; // Basic.Button - function Basic$Button(text) { + function Button(text) { this._text = text; } - var Basic$Button$ = { + var Button$ = { add_click: function(value) { this.__click = ss.bindAdd(this.__click, value); }, @@ -29,7 +29,7 @@ define('basic', ['ss'], function(ss) { }, performClick: function() { if (this.__click != null) { - this.__click(this, Basic$EventArgs.Empty); + this.__click(this, EventArgs.Empty); } } }; @@ -37,19 +37,19 @@ define('basic', ['ss'], function(ss) { // Basic.App - function Basic$App() { - this._btn1 = new Basic$Button('OK'); + function App() { + this._btn1 = new Button('OK'); this._btn1.add_click(ss.bind('_onClickButton', this)); this._btn1.add_click(ss.bind('_onClickButtonDup', this)); - this._btn2 = new Basic$Button('Cancel'); + this._btn2 = new Button('Cancel'); this._btn2.add_click(ss.bind('_onClickButton', this)); } - Basic$App.main = function(args) { - var theApp = new Basic$App(); + App.main = function(args) { + var theApp = new App(); theApp._btn1.performClick(); theApp._btn2.performClick(); - } - var Basic$App$ = { + }; + var App$ = { _echo: function(s) { }, _onClickButton: function(sender, e) { @@ -63,12 +63,12 @@ define('basic', ['ss'], function(ss) { var $exports = ss.module('basic', null, { - EventArgs: [ Basic$EventArgs, Basic$EventArgs$, null ], - Button: [ Basic$Button, Basic$Button$, null ], - App: [ Basic$App, Basic$App$, null ] + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] }); - Basic$EventArgs.Empty = new Basic$EventArgs(); + EventArgs.Empty = new EventArgs(); return $exports; }); diff --git a/tests/TestCases/Basic/Simple/SimpleBaseline.txt b/tests/TestCases/Basic/Simple/SimpleBaseline.txt index 3fbd2ca8d..68ee0124f 100644 --- a/tests/TestCases/Basic/Simple/SimpleBaseline.txt +++ b/tests/TestCases/Basic/Simple/SimpleBaseline.txt @@ -3,23 +3,23 @@ "use strict"; (function($global) { - var ss = require('ss'); + var ss = require('scriptsharp'); // Basic.EventArgs - function Basic$EventArgs() { + function EventArgs() { } - var Basic$EventArgs$ = { + var EventArgs$ = { }; // Basic.Button - function Basic$Button(text) { + function Button(text) { this._text = text; } - var Basic$Button$ = { + var Button$ = { add_click: function(value) { this.__click = ss.bindAdd(this.__click, value); }, @@ -31,7 +31,7 @@ }, performClick: function() { if (this.__click != null) { - this.__click(this, Basic$EventArgs.Empty); + this.__click(this, EventArgs.Empty); } } }; @@ -39,19 +39,19 @@ // Basic.App - function Basic$App() { - this._btn1 = new Basic$Button('OK'); + function App() { + this._btn1 = new Button('OK'); this._btn1.add_click(ss.bind('_onClickButton', this)); this._btn1.add_click(ss.bind('_onClickButtonDup', this)); - this._btn2 = new Basic$Button('Cancel'); + this._btn2 = new Button('Cancel'); this._btn2.add_click(ss.bind('_onClickButton', this)); } - Basic$App.main = function(args) { - var theApp = new Basic$App(); + App.main = function(args) { + var theApp = new App(); theApp._btn1.performClick(); theApp._btn2.performClick(); - } - var Basic$App$ = { + }; + var App$ = { _echo: function(s) { }, _onClickButton: function(sender, e) { @@ -65,12 +65,12 @@ var $exports = ss.module('basic', null, { - EventArgs: [ Basic$EventArgs, Basic$EventArgs$, null ], - Button: [ Basic$Button, Basic$Button$, null ], - App: [ Basic$App, Basic$App$, null ] + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ], + App: [ App, App$, null ] }); - Basic$EventArgs.Empty = new Basic$EventArgs(); + EventArgs.Empty = new EventArgs(); return $exports; })(this); diff --git a/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt b/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt index 6252f54ad..08a4dbc1a 100644 --- a/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt +++ b/tests/TestCases/Basic/UnitTest/NonTestBaseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // BasicTests.PublicClass - function BasicTests$PublicClass() { + function PublicClass() { } - var BasicTests$PublicClass$ = { + var PublicClass$ = { format: function(i) { return '0'; }, @@ -19,9 +19,9 @@ define('test', ['ss'], function(ss) { // BasicTests.InternalClass - function BasicTests$InternalClass() { + function InternalClass() { } - var BasicTests$InternalClass$ = { + var InternalClass$ = { format: function(i) { return null; }, @@ -33,10 +33,10 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', { - InternalClass: [ BasicTests$InternalClass, BasicTests$InternalClass$, null ] + InternalClass: [ InternalClass, InternalClass$, null ] }, { - PublicClass: [ BasicTests$PublicClass, BasicTests$PublicClass$, null ] + PublicClass: [ PublicClass, PublicClass$, null ] }); diff --git a/tests/TestCases/Basic/UnitTest/TestBaseline.txt b/tests/TestCases/Basic/UnitTest/TestBaseline.txt index 5171f2e11..62aa4ea5f 100644 --- a/tests/TestCases/Basic/UnitTest/TestBaseline.txt +++ b/tests/TestCases/Basic/UnitTest/TestBaseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // BasicTests.PublicClass - function BasicTests$PublicClass() { + function PublicClass() { } - var BasicTests$PublicClass$ = { + var PublicClass$ = { format: function(i) { return '0'; }, @@ -19,9 +19,9 @@ define('test', ['ss'], function(ss) { // BasicTests.InternalClass - function BasicTests$InternalClass() { + function InternalClass() { } - var BasicTests$InternalClass$ = { + var InternalClass$ = { format: function(i) { return null; }, @@ -33,21 +33,21 @@ define('test', ['ss'], function(ss) { // BasicTests.Tests.Helpers.Foo - function BasicTests$Tests$Helpers$Foo() { + function Foo() { } - var BasicTests$Tests$Helpers$Foo$ = { + var Foo$ = { }; // BasicTests.Tests.PublicTests - function BasicTests$Tests$PublicTests() { + function PublicTests() { } - var BasicTests$Tests$PublicTests$ = { + var PublicTests$ = { testFormat: function() { QUnit.expect(1); - var testee = new BasicTests$PublicClass(); + var testee = new PublicClass(); var s = testee.format(0); QUnit.equal(s, '0', "Expected '0' for result."); } @@ -56,18 +56,18 @@ define('test', ['ss'], function(ss) { // BasicTests.Tests.InternalTests - function BasicTests$Tests$InternalTests() { + function InternalTests() { } - var BasicTests$Tests$InternalTests$ = { + var InternalTests$ = { testFormat: function() { QUnit.expect(1); - var testee = new BasicTests$InternalClass(); + var testee = new InternalClass(); var s = testee.format(0); QUnit.equal(s, '0', "Expected '0' for result."); }, testParse: function() { QUnit.expect(1); - var testee = new BasicTests$InternalClass(); + var testee = new InternalClass(); var i = testee.parse('0'); QUnit.equal(i, 0, 'Expected 0 for result.'); }, @@ -82,19 +82,19 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', { - InternalClass: [ BasicTests$InternalClass, BasicTests$InternalClass$, null ], - Foo: [ BasicTests$Tests$Helpers$Foo, BasicTests$Tests$Helpers$Foo$, null ], - PublicTests: [ BasicTests$Tests$PublicTests, BasicTests$Tests$PublicTests$, null ], - InternalTests: [ BasicTests$Tests$InternalTests, BasicTests$Tests$InternalTests$, null ] + InternalClass: [ InternalClass, InternalClass$, null ], + Foo: [ Foo, Foo$, null ], + PublicTests: [ PublicTests, PublicTests$, null ], + InternalTests: [ InternalTests, InternalTests$, null ] }, { - PublicClass: [ BasicTests$PublicClass, BasicTests$PublicClass$, null ] + PublicClass: [ PublicClass, PublicClass$, null ] }); module('PublicTests', { setup: function() { - this.instance = new BasicTests$Tests$PublicTests(); + this.instance = new PublicTests(); }, teardown: function() { delete this.instance; @@ -107,7 +107,7 @@ define('test', ['ss'], function(ss) { module('InternalTests', { setup: function() { - this.instance = new BasicTests$Tests$InternalTests(); + this.instance = new InternalTests(); this.instance.setup(); }, teardown: function() { diff --git a/tests/TestCases/Expression/AnonymousMethods/Baseline.txt b/tests/TestCases/Expression/AnonymousMethods/Baseline.txt index 9fd11df1b..479781c8d 100644 --- a/tests/TestCases/Expression/AnonymousMethods/Baseline.txt +++ b/tests/TestCases/Expression/AnonymousMethods/Baseline.txt @@ -5,31 +5,31 @@ define('test', ['ss'], function(ss) { // ExpressionTests.SomeClass - function ExpressionTests$SomeClass(cb) { + function SomeClass(cb) { } - var ExpressionTests$SomeClass$ = { + var SomeClass$ = { }; // ExpressionTests.Test - function ExpressionTests$Test() { + function Test() { this._n = 0; } - ExpressionTests$Test.main = function(args) { + Test.main = function(args) { var o = {}; var name; - ExpressionTests$Test.doStuffStatic(o, function(i, s, b) { + Test.doStuffStatic(o, function(i, s, b) { name = s; }); - } - ExpressionTests$Test.doStuffStatic = function(o, callback) { - var s = new ExpressionTests$SomeClass(function() { + }; + Test.doStuffStatic = function(o, callback) { + var s = new SomeClass(function() { var temp = o; }); - } - var ExpressionTests$Test$ = { + }; + var Test$ = { AAA: function() { var $this = this; @@ -37,7 +37,7 @@ define('test', ['ss'], function(ss) { this.doStuff(o, function(i, s, b) { $this._n = i; }); - var s = new ExpressionTests$SomeClass(function() { + var s = new SomeClass(function() { }); for (var i = 0; i < 10; i++) { var foo; @@ -47,17 +47,17 @@ define('test', ['ss'], function(ss) { this.doStuff(o, function(i, s, b) { $this._n += i; }); - ExpressionTests$Test.doStuffStatic(o, function() { + Test.doStuffStatic(o, function() { }); - ExpressionTests$Test.doStuffStatic(o, function() { + Test.doStuffStatic(o, function() { $this._n++; }); } - var s2 = new ExpressionTests$SomeClass(function() { + var s2 = new SomeClass(function() { var numbers = [ $this._n ]; }); - var s3 = new ExpressionTests$SomeClass(function() { - var s4 = new ExpressionTests$SomeClass(function() { + var s3 = new SomeClass(function() { + var s4 = new SomeClass(function() { var numbers = [ $this._n * 2 ]; }); }); @@ -84,15 +84,15 @@ define('test', ['ss'], function(ss) { })(3); }, BBB: function(o) { - var s = new ExpressionTests$SomeClass(function() { + var s = new SomeClass(function() { var temp = o; }); }, CCC: function(o) { var $this = this; - var s = new ExpressionTests$SomeClass(function() { - var s = new ExpressionTests$SomeClass(function() { + var s = new SomeClass(function() { + var s = new SomeClass(function() { var numbers = [ $this._n * 2 ]; }); }); @@ -104,8 +104,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - SomeClass: [ ExpressionTests$SomeClass, ExpressionTests$SomeClass$, null ], - Test: [ ExpressionTests$Test, ExpressionTests$Test$, null ] + SomeClass: [ SomeClass, SomeClass$, null ], + Test: [ Test, Test$, null ] }); diff --git a/tests/TestCases/Expression/Arguments/Baseline.txt b/tests/TestCases/Expression/Arguments/Baseline.txt index e01f17958..81da848c6 100644 --- a/tests/TestCases/Expression/Arguments/Baseline.txt +++ b/tests/TestCases/Expression/Arguments/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var count = arguments.length; var value = arguments[0]; @@ -18,7 +18,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Array/Baseline.txt b/tests/TestCases/Expression/Array/Baseline.txt index f9c354c38..cdf86987e 100644 --- a/tests/TestCases/Expression/Array/Baseline.txt +++ b/tests/TestCases/Expression/Array/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var items = []; items.push(1); @@ -44,7 +44,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Base/Baseline.txt b/tests/TestCases/Expression/Base/Baseline.txt index f1368ffbf..8c8ee0fd1 100644 --- a/tests/TestCases/Expression/Base/Baseline.txt +++ b/tests/TestCases/Expression/Base/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Foo - function ExpressionTests$Foo(i, j) { + function Foo(i, j) { } - var ExpressionTests$Foo$ = { + var Foo$ = { toString: function() { return 'Foo'; }, @@ -19,23 +19,23 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Bar - function ExpressionTests$Bar(i, j, f) { - ExpressionTests$Foo.call(this, i, j); + function Bar(i, j, f) { + Foo.call(this, i, j); } - var ExpressionTests$Bar$ = { + var Bar$ = { sum: function() { - return ss.base(this, 'sum').call(this, 1) + 1; + return Foo.prototype.sum.call(this, 1) + 1; }, toString: function() { - return ss.base(this, 'toString').call(this) + ' -> Bar'; + return Foo.prototype.toString.call(this) + ' -> Bar'; } }; var $exports = ss.module('test', null, { - Foo: [ ExpressionTests$Foo, ExpressionTests$Foo$, null ], - Bar: [ ExpressionTests$Bar, ExpressionTests$Bar$, ExpressionTests$Foo ] + Foo: [ Foo, Foo$, null ], + Bar: [ Bar, Bar$, Foo ] }); diff --git a/tests/TestCases/Expression/Binary/Baseline.txt b/tests/TestCases/Expression/Binary/Baseline.txt index c9f09e729..262b6ad85 100644 --- a/tests/TestCases/Expression/Binary/Baseline.txt +++ b/tests/TestCases/Expression/Binary/Baseline.txt @@ -5,10 +5,10 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Data - function ExpressionTests$Data() { + function Data() { this._value = 0; } - var ExpressionTests$Data$ = { + var Data$ = { get_value: function() { return this._value; }, @@ -27,9 +27,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { get__foo: function() { return 0; }, @@ -43,7 +43,7 @@ define('test', ['ss'], function(ss) { return value; }, get_data: function() { - return new ExpressionTests$Data(); + return new Data(); }, set_data: function(value) { return value; @@ -52,7 +52,7 @@ define('test', ['ss'], function(ss) { return this.get_data().get_flag(); }, get_flag2: function() { - return ExpressionTests$Data.staticFlag; + return Data.staticFlag; }, test: function(arg1, arg2) { var sum = arg1 + arg2; @@ -82,10 +82,10 @@ define('test', ['ss'], function(ss) { abc = xyz >>> 2; abc <<= 1; xyz >>>= 1; - var d = new ExpressionTests$Data(); + var d = new Data(); d.set_value(d.get_value() + 5); d.set_flag((d.get_flag() | true) === 1); - var o1 = null || {}; + var o1 = ss.value(null, {}); var s2 = (10).toString(); s2 = (100).toString(); s2 = true.toString(); @@ -100,7 +100,7 @@ define('test', ['ss'], function(ss) { b = (b | true) === 1; c = (c ^ true) === 1; a = (a | (a || a)) === 1; - var d = new ExpressionTests$Data(); + var d = new Data(); d.set_flag((d.get_flag() & true) === 1); d.set_flag((d.get_flag() | true) === 1); d.set_flag((d.get_flag() ^ true) === 1); @@ -110,11 +110,11 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Data: [ ExpressionTests$Data, ExpressionTests$Data$, null ], - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + Data: [ Data, Data$, null ], + App: [ App, App$, null ] }); - ExpressionTests$Data.staticFlag = false; + Data.staticFlag = false; return $exports; }); diff --git a/tests/TestCases/Expression/Cast/Baseline.txt b/tests/TestCases/Expression/Cast/Baseline.txt index 1cb790639..db2245d2e 100644 --- a/tests/TestCases/Expression/Cast/Baseline.txt +++ b/tests/TestCases/Expression/Cast/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var f = arg / 2; var d = 0.25; @@ -37,7 +37,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Conditional/Baseline.txt b/tests/TestCases/Expression/Conditional/Baseline.txt index 81077fbbf..e98010881 100644 --- a/tests/TestCases/Expression/Conditional/Baseline.txt +++ b/tests/TestCases/Expression/Conditional/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var b = (!arg) ? true : false; b = (!arg) ? true : false; @@ -21,7 +21,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Date/Baseline.txt b/tests/TestCases/Expression/Date/Baseline.txt index 3274221d2..b05e61462 100644 --- a/tests/TestCases/Expression/Date/Baseline.txt +++ b/tests/TestCases/Expression/Date/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { equality: function() { var d1 = null; var d2 = null; @@ -30,7 +30,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Delegates/Baseline.txt b/tests/TestCases/Expression/Delegates/Baseline.txt index 4cc63b3a1..e9a027e26 100644 --- a/tests/TestCases/Expression/Delegates/Baseline.txt +++ b/tests/TestCases/Expression/Delegates/Baseline.txt @@ -5,35 +5,35 @@ define('test', ['ss'], function(ss) { // ExpressionTests.EventArgs - function ExpressionTests$EventArgs() { + function EventArgs() { } - var ExpressionTests$EventArgs$ = { + var EventArgs$ = { }; // ExpressionTests.SomeClass - function ExpressionTests$SomeClass(handler) { + function SomeClass(handler) { } - var ExpressionTests$SomeClass$ = { + var SomeClass$ = { }; // ExpressionTests.Test - function ExpressionTests$Test() { + function Test() { this._handler = ss.bind('onEvent', this); this._handler = ss.bind('onEvent', this); this._handler = ss.bind('onEvent', this); - this._handler = ExpressionTests$Test2.onGlobalEvent; - var s1 = new ExpressionTests$SomeClass(ss.bind('onEvent', this)); - var s2 = new ExpressionTests$SomeClass(this._handler); + this._handler = Test2.onGlobalEvent; + var s1 = new SomeClass(ss.bind('onEvent', this)); + var s2 = new SomeClass(this._handler); var e = ss.bindExport(this._handler); e.dispose(); } - var ExpressionTests$Test$ = { + var Test$ = { doStuff: function() { if (this._handler != null) { this._handler(this, null); @@ -46,21 +46,21 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Test2 - function ExpressionTests$Test2() { + function Test2() { } - ExpressionTests$Test2.onGlobalEvent = function(sender, e) { - } - var ExpressionTests$Test2$ = { + Test2.onGlobalEvent = function(sender, e) { + }; + var Test2$ = { }; var $exports = ss.module('test', null, { - EventArgs: [ ExpressionTests$EventArgs, ExpressionTests$EventArgs$, null ], - SomeClass: [ ExpressionTests$SomeClass, ExpressionTests$SomeClass$, null ], - Test: [ ExpressionTests$Test, ExpressionTests$Test$, null ], - Test2: [ ExpressionTests$Test2, ExpressionTests$Test2$, null ] + EventArgs: [ EventArgs, EventArgs$, null ], + SomeClass: [ SomeClass, SomeClass$, null ], + Test: [ Test, Test$, null ], + Test2: [ Test2, Test2$, null ] }); diff --git a/tests/TestCases/Expression/Dictionary/Baseline.txt b/tests/TestCases/Expression/Dictionary/Baseline.txt index 62d1ec8e7..905b18c97 100644 --- a/tests/TestCases/Expression/Dictionary/Baseline.txt +++ b/tests/TestCases/Expression/Dictionary/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { getData: function() { return null; }, @@ -16,7 +16,7 @@ define('test', ['ss'], function(ss) { }, test: function(arg) { var dictionary1 = {}; - var dictionary2 = { xyz: 1, abc: new ExpressionTests$App(), 'delete': 2, 'test.': 3, '\t': 4 }; + var dictionary2 = { xyz: 1, abc: new App(), 'delete': 2, 'test.': 3, '\t': 4 }; }, test2: function(arg) { var dictionary1 = { aaa: 123, xyz: true }; @@ -53,7 +53,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/EnumToString/MinBaseline.txt b/tests/TestCases/Expression/EnumToString/MinBaseline.txt index 8bb25d9ca..834d6f228 100644 --- a/tests/TestCases/Expression/EnumToString/MinBaseline.txt +++ b/tests/TestCases/Expression/EnumToString/MinBaseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var s1 = (0).toString(); var s2 = (2).toString(); @@ -25,7 +25,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/EnumToString/NormalBaseline.txt b/tests/TestCases/Expression/EnumToString/NormalBaseline.txt index 6d1f6e14f..b6e25ae0a 100644 --- a/tests/TestCases/Expression/EnumToString/NormalBaseline.txt +++ b/tests/TestCases/Expression/EnumToString/NormalBaseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Color - var ExpressionTests$Color = { + var Color = { red: 1, green: 2, blue: 3 @@ -14,7 +14,7 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Types - var ExpressionTests$Types = { + var Types = { none: 0, type1: 1, type2: 2, @@ -24,9 +24,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var s1 = (0).toString(); var s2 = (2).toString(); @@ -44,9 +44,9 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Color: ExpressionTests$Color, - Types: ExpressionTests$Types, - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + Color: Color, + Types: Types, + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Events/Baseline.txt b/tests/TestCases/Expression/Events/Baseline.txt index 30c40ea09..e80702901 100644 --- a/tests/TestCases/Expression/Events/Baseline.txt +++ b/tests/TestCases/Expression/Events/Baseline.txt @@ -5,15 +5,15 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Button - function ExpressionTests$Button() { + function Button() { } - ExpressionTests$Button.add_test = function(value) { - ExpressionTests$Button.__test = ss.bindAdd(ExpressionTests$Button.__test, value); - } - ExpressionTests$Button.remove_test = function(value) { - ExpressionTests$Button.__test = ss.bindSub(ExpressionTests$Button.__test, value); - } - var ExpressionTests$Button$ = { + Button.add_test = function(value) { + Button.__test = ss.bindAdd(Button.__test, value); + }; + Button.remove_test = function(value) { + Button.__test = ss.bindSub(Button.__test, value); + }; + var Button$ = { add_click: function(value) { this.__click = ss.bindAdd(this.__click, value); }, @@ -47,19 +47,19 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { this._btn.add_click(ss.bind('_onClickButton', this)); this._btn.add_click(ss.bind('_onClickButton', this)); this._btn.add_click(ss.bind('_onClickButton', this)); this._btn.remove_click(ss.bind('_onClickButton', this)); this._btn.remove_click(ss.bind('_onClickButton', this)); this._btn.remove_click(ss.bind('_onClickButton', this)); - ExpressionTests$Button.add_test(ExpressionTests$App._onTestButton); - ExpressionTests$Button.add_test(ExpressionTests$App._onTestButton); - ExpressionTests$Button.add_test(ExpressionTests$App._onTestButton); - ExpressionTests$Button.remove_test(ExpressionTests$App._onTestButton); - ExpressionTests$Button.remove_test(ExpressionTests$App._onTestButton); - ExpressionTests$Button.remove_test(ExpressionTests$App._onTestButton); + Button.add_test(App._onTestButton); + Button.add_test(App._onTestButton); + Button.add_test(App._onTestButton); + Button.remove_test(App._onTestButton); + Button.remove_test(App._onTestButton); + Button.remove_test(App._onTestButton); this._btn.add_aaa(ss.bind('_onAAAButton', this)); this._btn.add_aaa(ss.bind('_onAAAButton', this)); this._btn.add_aaa(ss.bind('_onAAAButton', this)); @@ -67,9 +67,9 @@ define('test', ['ss'], function(ss) { this._btn.remove_aaa(ss.bind('_onAAAButton', this)); this._btn.remove_aaa(ss.bind('_onAAAButton', this)); } - ExpressionTests$App._onTestButton = function(sender, e) { - } - var ExpressionTests$App$ = { + App._onTestButton = function(sender, e) { + }; + var App$ = { _onAAAButton: function(sender, e) { }, _onClickButton: function(sender, e) { @@ -79,19 +79,19 @@ define('test', ['ss'], function(ss) { // ExpressionTests.FooEventArgs - function ExpressionTests$FooEventArgs() { + function FooEventArgs() { ss.EventArgs.call(this); } - var ExpressionTests$FooEventArgs$ = { + var FooEventArgs$ = { }; var $exports = ss.module('test', null, { - Button: [ ExpressionTests$Button, ExpressionTests$Button$, null ], - App: [ ExpressionTests$App, ExpressionTests$App$, null ], - FooEventArgs: [ ExpressionTests$FooEventArgs, ExpressionTests$FooEventArgs$, ss.EventArgs ] + Button: [ Button, Button$, null ], + App: [ App, App$, null ], + FooEventArgs: [ FooEventArgs, FooEventArgs$, ss.EventArgs ] }); diff --git a/tests/TestCases/Expression/ExtensionMethods/Baseline.txt b/tests/TestCases/Expression/ExtensionMethods/Baseline.txt index bb4416b76..b0bb72f1a 100644 --- a/tests/TestCases/Expression/ExtensionMethods/Baseline.txt +++ b/tests/TestCases/Expression/ExtensionMethods/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { eval('[ 1, 2 ]'); $global.foo(); @@ -19,12 +19,12 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Util $global.foo = function() { - } + }; var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Generics/Baseline.txt b/tests/TestCases/Expression/Generics/Baseline.txt index 267daa987..a4864a0d8 100644 --- a/tests/TestCases/Expression/Generics/Baseline.txt +++ b/tests/TestCases/Expression/Generics/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { // ExpressionTests.Foo - function ExpressionTests$Foo() { + function Foo() { this._numbers = []; var s = this._numbers[10].toString(10); var s2 = ss.enumerate(this._numbers).current.toString(10); @@ -14,7 +14,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { }, 0).toString(10); var s4 = encodeURIComponent(this._func(10)); var f2 = this._func; - f2(11).trim(); + ss.trim(f2(11)); var d = {}; var s5 = $.extend(d, d)['abc'].toString(10); var keys = ss.keyCount(d); @@ -30,7 +30,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { var f = JSON.parse(json).setup().run().cleanup(); var name = document.getElementById('nameTB').value; } - var ExpressionTests$Foo$ = { + var Foo$ = { cleanup: function() { return this; }, @@ -45,7 +45,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { var $exports = ss.module('test', null, { - Foo: [ ExpressionTests$Foo, ExpressionTests$Foo$, null ] + Foo: [ Foo, Foo$, null ] }); diff --git a/tests/TestCases/Expression/GetType/Baseline.txt b/tests/TestCases/Expression/GetType/Baseline.txt index bfc16997e..0336236bf 100644 --- a/tests/TestCases/Expression/GetType/Baseline.txt +++ b/tests/TestCases/Expression/GetType/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { get__foo: function() { return 0; }, @@ -17,12 +17,12 @@ define('test', ['ss'], function(ss) { var t3 = ss.typeOf(this.get__foo()); var t4 = ss.type('String'); var t5 = ss.type('test.Foo'); - var b1 = ss.canAssign((Object), ExpressionTests$App); - var b2 = ss.canAssign((ss.IDisposable), ExpressionTests$App); - var b3 = ss.canAssign(t, ExpressionTests$App); - var b4 = ss.instanceOf((ExpressionTests$App), new ExpressionTests$App()); - var b5 = ss.instanceOf((ss.IDisposable), new ExpressionTests$App()); - var b6 = ss.instanceOf(t, new ExpressionTests$App()); + var b1 = ss.canAssign((Object), App); + var b2 = ss.canAssign((ss.IDisposable), App); + var b3 = ss.canAssign(t, App); + var b4 = ss.instanceOf((App), new App()); + var b5 = ss.instanceOf((ss.IDisposable), new App()); + var b6 = ss.instanceOf(t, new App()); var b7 = ss.isInterface(t) || ss.isClass(t); var n = ss.typeName(t); } @@ -31,7 +31,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/InlineScript/Baseline.txt b/tests/TestCases/Expression/InlineScript/Baseline.txt index 2fd9dc196..937b0d70c 100644 --- a/tests/TestCases/Expression/InlineScript/Baseline.txt +++ b/tests/TestCases/Expression/InlineScript/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { arg + 1; var i = arg + 1; @@ -21,7 +21,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/LateBound/Baseline.txt b/tests/TestCases/Expression/LateBound/Baseline.txt index b3f1c88d2..7269be60d 100644 --- a/tests/TestCases/Expression/LateBound/Baseline.txt +++ b/tests/TestCases/Expression/LateBound/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var o; var b; @@ -44,7 +44,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Literals/Baseline.txt b/tests/TestCases/Expression/Literals/Baseline.txt index 65dcc58cd..4b322f9e4 100644 --- a/tests/TestCases/Expression/Literals/Baseline.txt +++ b/tests/TestCases/Expression/Literals/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var i = 0; i = -1; @@ -29,7 +29,7 @@ define('test', ['ss'], function(ss) { var s5 = 'abc\u00a9'; var s6 = "abc'xyz"; var s7 = 'abc"xyz'; - var t = ExpressionTests$App; + var t = App; var t2 = Number; var t3 = Number; var t4 = Object; @@ -40,7 +40,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Locals/Baseline.txt b/tests/TestCases/Expression/Locals/Baseline.txt index f7fb50c21..978796200 100644 --- a/tests/TestCases/Expression/Locals/Baseline.txt +++ b/tests/TestCases/Expression/Locals/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var x; var i = x.length; @@ -30,7 +30,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Members/Baseline.txt b/tests/TestCases/Expression/Members/Baseline.txt index 32b423cd9..322c8d28e 100644 --- a/tests/TestCases/Expression/Members/Baseline.txt +++ b/tests/TestCases/Expression/Members/Baseline.txt @@ -5,26 +5,26 @@ define('test', ['ss'], function(ss) { // ExpressionTests.IFoo - function ExpressionTests$IFoo() { } + function IFoo() { } // ExpressionTests.BApp - function ExpressionTests$BApp() { + function BApp() { } - var ExpressionTests$BApp$ = { + var BApp$ = { }; // ExpressionTests.App - function ExpressionTests$App() { + function App() { this._value$1 = 0; this._value2 = 0; - ExpressionTests$BApp.call(this); + BApp.call(this); } - var ExpressionTests$App$ = { + var App$ = { get_XYZ: function() { return 1; }, @@ -47,8 +47,8 @@ define('test', ['ss'], function(ss) { n = this._value$1; this._value$1 = n; this._value$1 = n; - n = ExpressionTests$App._myDefault$1; - n = ExpressionTests$App._myDefault$1; + n = App._myDefault$1; + n = App._myDefault$1; n = 3; n = 3; n = 3; @@ -60,22 +60,22 @@ define('test', ['ss'], function(ss) { // ExpressionTests.DApp - function ExpressionTests$DApp() { - ExpressionTests$App.call(this); + function DApp() { + App.call(this); } - var ExpressionTests$DApp$ = { + var DApp$ = { test2: function() { var n = this.get_XYZ(); n = this.get_XYZ(); - n = ExpressionTests$App$.get_XYZ.call(this); + n = App.prototype.get_XYZ.call(this); this.set_XYZ(n); this.set_XYZ(n); - ss.base(this, 'set_XYZ').call(this, n); + App.prototype.set_XYZ.call(this, n); this._value2 = n; this._value2 = n; this._value2 = n; - n = ExpressionTests$App.myDefault2; - n = ExpressionTests$App.myDefault2; + n = App.myDefault2; + n = App.myDefault2; n = 3; n = 3; n = 3; @@ -97,16 +97,16 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - IFoo: [ ExpressionTests$IFoo ], - BApp: [ ExpressionTests$BApp, ExpressionTests$BApp$, null ], - App: [ ExpressionTests$App, ExpressionTests$App$, ExpressionTests$BApp ], - DApp: [ ExpressionTests$DApp, ExpressionTests$DApp$, ExpressionTests$App ] + IFoo: [ IFoo ], + BApp: [ BApp, BApp$, null ], + App: [ App, App$, BApp ], + DApp: [ DApp, DApp$, App ] }); - ExpressionTests$BApp.myConstant = 3; - ExpressionTests$App.myConstant2 = 3; - ExpressionTests$App._myDefault$1 = 1; - ExpressionTests$App.myDefault2 = 2; + BApp.myConstant = 3; + App.myConstant2 = 3; + App._myDefault$1 = 1; + App.myDefault2 = 2; return $exports; }); diff --git a/tests/TestCases/Expression/New/Baseline.txt b/tests/TestCases/Expression/New/Baseline.txt index c0dd2d246..5cb1a5607 100644 --- a/tests/TestCases/Expression/New/Baseline.txt +++ b/tests/TestCases/Expression/New/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Point - function ExpressionTests$Point(x, y) { + function Point(x, y) { var $o = {}; $o._x = x; $o._y = y; @@ -15,30 +15,30 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Foo - function ExpressionTests$Foo(i, j) { + function Foo(i, j) { } - var ExpressionTests$Foo$ = { + var Foo$ = { }; // ExpressionTests.Bar - function ExpressionTests$Bar(i, j, f) { + function Bar(i, j, f) { } - var ExpressionTests$Bar$ = { + var Bar$ = { }; // ExpressionTests.Test - function ExpressionTests$Test() { + function Test() { } - ExpressionTests$Test.main = function() { - var f = new ExpressionTests$Foo(0, 1); - var b = new ExpressionTests$Bar(0, 1, new ExpressionTests$Foo(0, 1)); - var t = new ExpressionTests$Test(); + Test.main = function() { + var f = new Foo(0, 1); + var b = new Bar(0, 1, new Foo(0, 1)); + var t = new Test(); var d = new Date('3/9/1976'); var items = []; var items2 = [ 1, 2 ]; @@ -49,28 +49,28 @@ define('test', ['ss'], function(ss) { var list3 = ['abc', 'def', 'ghi']; var list4 = [1, 2, 3]; var dates = [ new Date('1/1/2006'), new Date('1/1/2005') ]; - var p = ExpressionTests$Point(0, 0); + var p = Point(0, 0); var cd = {}; var cd2 = { abc: 123, def: true }; - var o1 = new ExpressionTests$Test(); - var type1 = ExpressionTests$Foo; + var o1 = new Test(); + var type1 = Foo; var o2 = new type1(1, 2); - var o3 = new ExpressionTests$Bar(1, 2, o2); + var o3 = new Bar(1, 2, o2); var f1 = new Function("alert('hello');"); var f2 = new Function('s', 'alert(s);'); var f3 = new Function('greeting', 'name', "alert(greeting + ' ' + name + '!');"); - } - var ExpressionTests$Test$ = { + }; + var Test$ = { }; var $exports = ss.module('test', null, { - Point: ExpressionTests$Point, - Foo: [ ExpressionTests$Foo, ExpressionTests$Foo$, null ], - Bar: [ ExpressionTests$Bar, ExpressionTests$Bar$, null ], - Test: [ ExpressionTests$Test, ExpressionTests$Test$, null ] + Point: Point, + Foo: [ Foo, Foo$, null ], + Bar: [ Bar, Bar$, null ], + Test: [ Test, Test$, null ] }); diff --git a/tests/TestCases/Expression/Number/Baseline.txt b/tests/TestCases/Expression/Number/Baseline.txt index fcba4cfec..08cbeb142 100644 --- a/tests/TestCases/Expression/Number/Baseline.txt +++ b/tests/TestCases/Expression/Number/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var i = parseInt('5'); var f = parseFloat('5.3'); @@ -19,7 +19,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Script/Baseline.txt b/tests/TestCases/Expression/Script/Baseline.txt index 5508d0084..05f51928e 100644 --- a/tests/TestCases/Expression/Script/Baseline.txt +++ b/tests/TestCases/Expression/Script/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { arg = (arg || 10); arg = (arg || 10 || 100); @@ -25,6 +25,13 @@ define('test', ['ss'], function(ss) { b = (i === null); b = (i === undefined); b = ss.isValue(i); + b = isNaN(0); + b = isFinite(3); + b = !!(0); + b = !!b; + b = !!(b && b); + b = !(1); + b = !(b && b); var addition = eval('2 + 2'); addition = 2 + 2; addition = 2 + 3; @@ -37,7 +44,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Script/Code.cs b/tests/TestCases/Expression/Script/Code.cs index 330846ace..6e7ca1502 100644 --- a/tests/TestCases/Expression/Script/Code.cs +++ b/tests/TestCases/Expression/Script/Code.cs @@ -8,9 +8,9 @@ namespace ExpressionTests { public class App { public void Test(int arg) { - arg = Script.Value(arg, 10); - arg = Script.Value(arg, 10, 100); - string s = Script.Value(arg, 10).ToString(10); + arg = Script.Or(arg, 10); + arg = Script.Or(arg, 10, 100); + string s = Script.Or(arg, 10).ToString(10); bool b = Script.Boolean(arg); StringBuilder sb = (StringBuilder)Script.CreateInstance(typeof(StringBuilder)); @@ -27,6 +27,13 @@ public void Test(int arg) { b = Script.IsNull(i); b = Script.IsUndefined(i); b = Script.IsValue(i); + b = Script.IsNaN(0); + b = Script.IsFinite(3); + b = Script.IsTruthy(0); + b = Script.IsTruthy(b); + b = Script.IsTruthy(b && b); + b = Script.IsFalsey(1); + b = Script.IsFalsey(b && b); int addition = (int)Script.Eval("2 + 2"); diff --git a/tests/TestCases/Expression/String/Baseline.txt b/tests/TestCases/Expression/String/Baseline.txt index 5a69d64d9..33c486c21 100644 --- a/tests/TestCases/Expression/String/Baseline.txt +++ b/tests/TestCases/Expression/String/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var s = 'Hello'; var s2; @@ -23,7 +23,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Tasks/Baseline.txt b/tests/TestCases/Expression/Tasks/Baseline.txt index beac50856..2fe114b6c 100644 --- a/tests/TestCases/Expression/Tasks/Baseline.txt +++ b/tests/TestCases/Expression/Tasks/Baseline.txt @@ -5,20 +5,20 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Test - function ExpressionTests$Test() { + function Test() { var deferredObject = ss.deferred(); var deferredNumber = ss.deferred(); var availabledNumber = ss.deferred(10); deferredNumber.reject(); } - var ExpressionTests$Test$ = { + var Test$ = { }; var $exports = ss.module('test', null, { - Test: [ ExpressionTests$Test, ExpressionTests$Test$, null ] + Test: [ Test, Test$, null ] }); diff --git a/tests/TestCases/Expression/Truthy/Baseline.txt b/tests/TestCases/Expression/Truthy/Baseline.txt index 46b3e8d4e..64c50fda3 100644 --- a/tests/TestCases/Expression/Truthy/Baseline.txt +++ b/tests/TestCases/Expression/Truthy/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var i; var j; @@ -64,7 +64,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Tuples/Baseline.txt b/tests/TestCases/Expression/Tuples/Baseline.txt index 2a2d930a4..6bd5cdd9f 100644 --- a/tests/TestCases/Expression/Tuples/Baseline.txt +++ b/tests/TestCases/Expression/Tuples/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var t1 = { }; var t2 = { item1: 1, item2: 2 }; @@ -19,7 +19,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Expression/Unary/Baseline.txt b/tests/TestCases/Expression/Unary/Baseline.txt index 289c716a0..d79bb4404 100644 --- a/tests/TestCases/Expression/Unary/Baseline.txt +++ b/tests/TestCases/Expression/Unary/Baseline.txt @@ -5,10 +5,10 @@ define('test', ['ss'], function(ss) { // ExpressionTests.Data - function ExpressionTests$Data() { + function Data() { this._value = 0; } - var ExpressionTests$Data$ = { + var Data$ = { get_value: function() { return this._value; }, @@ -21,9 +21,9 @@ define('test', ['ss'], function(ss) { // ExpressionTests.App - function ExpressionTests$App() { + function App() { } - var ExpressionTests$App$ = { + var App$ = { test: function(arg) { var xyz = ~arg; var f = (!arg); @@ -40,7 +40,7 @@ define('test', ['ss'], function(ss) { var s = (!f).toString(); var num = 1.01; s = (~num).toExponential(); - var d = new ExpressionTests$Data(); + var d = new Data(); d.set_value(d.get_value() + 1) - 1; d.set_value(d.get_value() + 1); } @@ -49,8 +49,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Data: [ ExpressionTests$Data, ExpressionTests$Data$, null ], - App: [ ExpressionTests$App, ExpressionTests$App$, null ] + Data: [ Data, Data$, null ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Library/Node/Baseline.txt b/tests/TestCases/Library/Node/Baseline.txt index e2be2db2b..f53bbd167 100644 --- a/tests/TestCases/Library/Node/Baseline.txt +++ b/tests/TestCases/Library/Node/Baseline.txt @@ -1,7 +1,7 @@ // app.js // -var ss = require('ss'), +var ss = require('scriptsharp'), http = require('http'); var $global = this; diff --git a/tests/TestCases/Library/Node/Code.cs b/tests/TestCases/Library/Node/Code.cs index 635421889..3a1b8641a 100644 --- a/tests/TestCases/Library/Node/Code.cs +++ b/tests/TestCases/Library/Node/Code.cs @@ -23,6 +23,6 @@ static App() { response.WriteHead(HttpStatusCode.OK, new Dictionary("Content-Type", "text/html")); response.End("Hello Node World, from Script#!"); - }).Listen(Script.Value(Node.Process.Environment["port"], 8888)); + }).Listen(Script.Or(Node.Process.Environment["port"], 8888)); } } diff --git a/tests/TestCases/Library/jQuery/Baseline.txt b/tests/TestCases/Library/jQuery/Baseline.txt index 3ddb0a5a6..76ddc570f 100644 --- a/tests/TestCases/Library/jQuery/Baseline.txt +++ b/tests/TestCases/Library/jQuery/Baseline.txt @@ -15,10 +15,10 @@ define('test', ['ss', 'jquery'], function(ss, $) { }, error: function(xhr, textData, e) { console.log(xhr.status); } }); - } + }; MyApp.postData = function(url, data, succesCallback, errorCallback, returnType, requestType) { - returnType = returnType || 'text'; - requestType = requestType || 'POST'; + returnType = (returnType || 'text'); + requestType = (requestType || 'POST'); $.ajax({ cache: false, data: data, dataType: returnType, error: function(req, textStatus, error) { if (ss.isValue(errorCallback)) { errorCallback(req, textStatus, error); @@ -31,7 +31,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { succesCallback(dataSuccess, textStatus, request); } }, type: requestType, url: url }); - } + }; var MyApp$ = { }; diff --git a/tests/TestCases/Library/jQuery/Code.cs b/tests/TestCases/Library/jQuery/Code.cs index e64103c26..46395d620 100644 --- a/tests/TestCases/Library/jQuery/Code.cs +++ b/tests/TestCases/Library/jQuery/Code.cs @@ -43,8 +43,8 @@ private static void AlertData(string url) { } public static void PostData(string url, object data, AjaxRequestCallback succesCallback, AjaxErrorCallback errorCallback, string returnType, string requestType) { - returnType = returnType ?? "text"; - requestType = requestType ?? "POST"; + returnType = Script.Or(returnType, "text"); + requestType = Script.Or(requestType, "POST"); jQuery.Ajax(new jQueryAjaxOptions( "cache", false, diff --git a/tests/TestCases/Member/Constructors/Baseline.txt b/tests/TestCases/Member/Constructors/Baseline.txt index 765295b1d..caeefae8c 100644 --- a/tests/TestCases/Member/Constructors/Baseline.txt +++ b/tests/TestCases/Member/Constructors/Baseline.txt @@ -5,53 +5,53 @@ define('test', ['ss'], function(ss) { // MemberTests.MyClass - function MemberTests$MyClass() { + function MyClass() { this._value = 0; this._value = 1; } - var MemberTests$MyClass$ = { + var MyClass$ = { }; // MemberTests.MyClass2 - function MemberTests$MyClass2() { + function MyClass2() { } - var MemberTests$MyClass2$ = { + var MyClass2$ = { }; // MemberTests.MyClass3 - function MemberTests$MyClass3(arg, arg2) { + function MyClass3(arg, arg2) { } - var MemberTests$MyClass3$ = { + var MyClass3$ = { }; // MemberTests.MyClass4 - function MemberTests$MyClass4(arg, arg2, arg3) { - MemberTests$MyClass3.call(this, arg, arg2); + function MyClass4(arg, arg2, arg3) { + MyClass3.call(this, arg, arg2); } - var MemberTests$MyClass4$ = { + var MyClass4$ = { }; var $exports = ss.module('test', null, { - MyClass: [ MemberTests$MyClass, MemberTests$MyClass$, null ], - MyClass2: [ MemberTests$MyClass2, MemberTests$MyClass2$, null ], - MyClass3: [ MemberTests$MyClass3, MemberTests$MyClass3$, null ], - MyClass4: [ MemberTests$MyClass4, MemberTests$MyClass4$, MemberTests$MyClass3 ] + MyClass: [ MyClass, MyClass$, null ], + MyClass2: [ MyClass2, MyClass2$, null ], + MyClass3: [ MyClass3, MyClass3$, null ], + MyClass4: [ MyClass4, MyClass4$, MyClass3 ] }); - MemberTests$MyClass2._x = 'Hello'; - MemberTests$MyClass3.c = new MemberTests$MyClass(); + MyClass2._x = 'Hello'; + MyClass3.c = new MyClass(); return $exports; }); diff --git a/tests/TestCases/Member/Events/Baseline.txt b/tests/TestCases/Member/Events/Baseline.txt index 8c73d020a..90f8c7329 100644 --- a/tests/TestCases/Member/Events/Baseline.txt +++ b/tests/TestCases/Member/Events/Baseline.txt @@ -5,24 +5,24 @@ define('test', ['ss'], function(ss) { // MemberTests.EventArgs - function MemberTests$EventArgs() { + function EventArgs() { } - var MemberTests$EventArgs$ = { + var EventArgs$ = { }; // MemberTests.Button - function MemberTests$Button() { + function Button() { } - MemberTests$Button.add_test = function(value) { - MemberTests$Button.__test = ss.bindAdd(MemberTests$Button.__test, value); - } - MemberTests$Button.remove_test = function(value) { - MemberTests$Button.__test = ss.bindSub(MemberTests$Button.__test, value); - } - var MemberTests$Button$ = { + Button.add_test = function(value) { + Button.__test = ss.bindAdd(Button.__test, value); + }; + Button.remove_test = function(value) { + Button.__test = ss.bindSub(Button.__test, value); + }; + var Button$ = { add_click: function(value) { this.__click = ss.bindAdd(this.__click, value); }, @@ -42,7 +42,7 @@ define('test', ['ss'], function(ss) { }, performClick: function() { if (this.__click != null) { - this.__click(this, new MemberTests$EventArgs()); + this.__click(this, new EventArgs()); } } }; @@ -50,8 +50,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - EventArgs: [ MemberTests$EventArgs, MemberTests$EventArgs$, null ], - Button: [ MemberTests$Button, MemberTests$Button$, null ] + EventArgs: [ EventArgs, EventArgs$, null ], + Button: [ Button, Button$, null ] }); diff --git a/tests/TestCases/Member/Fields/Baseline.txt b/tests/TestCases/Member/Fields/Baseline.txt index e792b7f4f..9dc6fefcf 100644 --- a/tests/TestCases/Member/Fields/Baseline.txt +++ b/tests/TestCases/Member/Fields/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // MemberTests.Mode - var MemberTests$Mode = { + var Mode = { a: 0, b: 1 }; @@ -13,7 +13,7 @@ define('test', ['ss'], function(ss) { // MemberTests.Point - function MemberTests$Point(x, y) { + function Point(x, y) { var $o = {}; $o.x = x; $o.y = y; @@ -23,7 +23,7 @@ define('test', ['ss'], function(ss) { // MemberTests.Test - function MemberTests$Test() { + function Test() { this._value = 0; this._uintValue = 0; this._dblValue = 0; @@ -34,24 +34,24 @@ define('test', ['ss'], function(ss) { this.s = 'bbb'; this.s = 'aaa'; } - var MemberTests$Test$ = { + var Test$ = { }; // MemberTests.App - function MemberTests$App() { - this._t = new MemberTests$Test(); + function App() { + this._t = new Test(); this._i = 5; } - var MemberTests$App$ = { + var App$ = { doTest: function() { - var t = new MemberTests$Test(); + var t = new Test(); t.s = 'World'; var i = 1; - MemberTests$Test.done = true; - var p = MemberTests$Point(1, 10); + Test.done = true; + var p = Point(1, 10); p.x = p.y; } }; @@ -59,20 +59,20 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', { - Point: MemberTests$Point + Point: Point }, { - Mode: MemberTests$Mode, - Test: [ MemberTests$Test, MemberTests$Test$, null ], - App: [ MemberTests$App, MemberTests$App$, null ] + Mode: Mode, + Test: [ Test, Test$, null ], + App: [ App, App$, null ] }); - MemberTests$Test.greeting = 'Hello!'; - MemberTests$Test.myNumber = 1; - MemberTests$Test.defaultValue = 'aaa'; - MemberTests$Test.done = false; - MemberTests$Test.XYZ = 1; - MemberTests$Test._key = {}; + Test.greeting = 'Hello!'; + Test.myNumber = 1; + Test.defaultValue = 'aaa'; + Test.done = false; + Test.XYZ = 1; + Test._key = {}; return $exports; }); diff --git a/tests/TestCases/Member/Indexers/Baseline.txt b/tests/TestCases/Member/Indexers/Baseline.txt index 97e744d4f..3c2065171 100644 --- a/tests/TestCases/Member/Indexers/Baseline.txt +++ b/tests/TestCases/Member/Indexers/Baseline.txt @@ -5,17 +5,17 @@ define('test', ['ss'], function(ss) { // MemberTests.IIndexable - function MemberTests$IIndexable() { } + function IIndexable() { } // MemberTests.Normal - function MemberTests$Normal() { + function Normal() { this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); } - var MemberTests$Normal$ = { + var Normal$ = { get_item: function(name) { return this._n; }, @@ -28,11 +28,11 @@ define('test', ['ss'], function(ss) { // MemberTests.GetterOnly - function MemberTests$GetterOnly() { + function GetterOnly() { this._n = 0; var i = this.get_item('name'); } - var MemberTests$GetterOnly$ = { + var GetterOnly$ = { get_item: function(name) { return this._n; } @@ -41,12 +41,12 @@ define('test', ['ss'], function(ss) { // MemberTests.VirtualIndexer - function MemberTests$VirtualIndexer() { + function VirtualIndexer() { this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); } - var MemberTests$VirtualIndexer$ = { + var VirtualIndexer$ = { get_item: function(name) { return this._n; }, @@ -59,24 +59,24 @@ define('test', ['ss'], function(ss) { // MemberTests.AbstractIndexer - function MemberTests$AbstractIndexer() { + function AbstractIndexer() { this._n = 0; var i = this.get_item('name'); this.set_item('name', i + 1); } - var MemberTests$AbstractIndexer$ = { + var AbstractIndexer$ = { }; // MemberTests.MultipleArgs - function MemberTests$MultipleArgs() { + function MultipleArgs() { this._n = 0; var i = this.get_item('name', 'name2', 'name3'); this.set_item('name', 'name2', 'name3', i + 1); } - var MemberTests$MultipleArgs$ = { + var MultipleArgs$ = { get_item: function(first, middle, last) { var value = first + middle + last; return value.length; @@ -90,9 +90,9 @@ define('test', ['ss'], function(ss) { // MemberTests.ImplementedIndexer2 - function MemberTests$ImplementedIndexer2() { + function ImplementedIndexer2() { } - var MemberTests$ImplementedIndexer2$ = { + var ImplementedIndexer2$ = { get_item: function(index) { return 0; } @@ -101,26 +101,26 @@ define('test', ['ss'], function(ss) { // MemberTests.Test - function MemberTests$Test() { - var ma = new MemberTests$MultipleArgs(); + function Test() { + var ma = new MultipleArgs(); ma.set_item('1', '2', '3', ma.get_item('3', '2', '1')); - var ii = new MemberTests$ImplementedIndexer(); + var ii = new ImplementedIndexer(); ii.set_item('big', ii.get_item('small')); var ai = ii; ai.set_item('small', ai.get_item('big')); - var indexable = new MemberTests$ImplementedIndexer2(); + var indexable = new ImplementedIndexer2(); var o = indexable.get_item(0); } - var MemberTests$Test$ = { + var Test$ = { }; // MemberTests.A - function MemberTests$A() { + function A() { } - var MemberTests$A$ = { + var A$ = { get_item: function(name) { return name; } @@ -129,19 +129,19 @@ define('test', ['ss'], function(ss) { // MemberTests.OverriddenIndexer - function MemberTests$OverriddenIndexer() { - MemberTests$VirtualIndexer.call(this); + function OverriddenIndexer() { + VirtualIndexer.call(this); var i = this.get_item('name'); this.set_item('name', i + 1); - var j = ss.base(this, 'get_item').call(this, 'name'); - ss.base(this, 'set_item').call(this, 'name', 43); + var j = VirtualIndexer.prototype.get_item.call(this, 'name'); + VirtualIndexer.prototype.set_item.call(this, 'name', 43); } - var MemberTests$OverriddenIndexer$ = { + var OverriddenIndexer$ = { get_item: function(name) { - return ss.base(this, 'get_item').call(this, name) + 1; + return VirtualIndexer.prototype.get_item.call(this, name) + 1; }, set_item: function(name, value) { - ss.base(this, 'set_item').call(this, name, value - 1); + VirtualIndexer.prototype.set_item.call(this, name, value - 1); return value; } }; @@ -149,39 +149,39 @@ define('test', ['ss'], function(ss) { // MemberTests.ImplementedIndexer - function MemberTests$ImplementedIndexer() { + function ImplementedIndexer() { this._n$1 = 0; - MemberTests$AbstractIndexer.call(this); + AbstractIndexer.call(this); var i = this.get_item('name'); this.set_item('name', i + 1); } - var MemberTests$ImplementedIndexer$ = { + var ImplementedIndexer$ = { }; // MemberTests.B - function MemberTests$B() { - MemberTests$A.call(this); + function B() { + A.call(this); } - var MemberTests$B$ = { + var B$ = { }; // MemberTests.C - function MemberTests$C() { - MemberTests$B.call(this); + function C() { + B.call(this); } - MemberTests$C.main = function() { - var c = new MemberTests$C(); + C.main = function() { + var c = new C(); c.set_item('a', c.get_item('b')); var a = c; a.set_item('b', a.get_item('c')); - } - var MemberTests$C$ = { + }; + var C$ = { get_item: function(name) { return name; } @@ -190,19 +190,19 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - IIndexable: [ MemberTests$IIndexable ], - Normal: [ MemberTests$Normal, MemberTests$Normal$, null ], - GetterOnly: [ MemberTests$GetterOnly, MemberTests$GetterOnly$, null ], - VirtualIndexer: [ MemberTests$VirtualIndexer, MemberTests$VirtualIndexer$, null ], - AbstractIndexer: [ MemberTests$AbstractIndexer, MemberTests$AbstractIndexer$, null ], - MultipleArgs: [ MemberTests$MultipleArgs, MemberTests$MultipleArgs$, null ], - ImplementedIndexer2: [ MemberTests$ImplementedIndexer2, MemberTests$ImplementedIndexer2$, null, MemberTests$IIndexable ], - Test: [ MemberTests$Test, MemberTests$Test$, null ], - A: [ MemberTests$A, MemberTests$A$, null ], - OverriddenIndexer: [ MemberTests$OverriddenIndexer, MemberTests$OverriddenIndexer$, MemberTests$VirtualIndexer ], - ImplementedIndexer: [ MemberTests$ImplementedIndexer, MemberTests$ImplementedIndexer$, MemberTests$AbstractIndexer ], - B: [ MemberTests$B, MemberTests$B$, MemberTests$A ], - C: [ MemberTests$C, MemberTests$C$, MemberTests$B ] + IIndexable: [ IIndexable ], + Normal: [ Normal, Normal$, null ], + GetterOnly: [ GetterOnly, GetterOnly$, null ], + VirtualIndexer: [ VirtualIndexer, VirtualIndexer$, null ], + AbstractIndexer: [ AbstractIndexer, AbstractIndexer$, null ], + MultipleArgs: [ MultipleArgs, MultipleArgs$, null ], + ImplementedIndexer2: [ ImplementedIndexer2, ImplementedIndexer2$, null, IIndexable ], + Test: [ Test, Test$, null ], + A: [ A, A$, null ], + OverriddenIndexer: [ OverriddenIndexer, OverriddenIndexer$, VirtualIndexer ], + ImplementedIndexer: [ ImplementedIndexer, ImplementedIndexer$, AbstractIndexer ], + B: [ B, B$, A ], + C: [ C, C$, B ] }); diff --git a/tests/TestCases/Member/Methods/Baseline.txt b/tests/TestCases/Member/Methods/Baseline.txt index 43eb908d7..667984ff6 100644 --- a/tests/TestCases/Member/Methods/Baseline.txt +++ b/tests/TestCases/Member/Methods/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // MemberTests.Test - function MemberTests$Test() { + function Test() { } - var MemberTests$Test$ = { + var Test$ = { do1: function() { }, do2: function() { @@ -25,7 +25,7 @@ define('test', ['ss'], function(ss) { }, toString: function() { window.m1(); - var x = new MemberTests$X(); + var x = new X(); $.fn.extend(x, 10); return null; } @@ -35,22 +35,22 @@ define('test', ['ss'], function(ss) { // MemberTests.Foo $global.doStuff = function() { - } + }; // MemberTests.Bar window.m1 = function() { - } + }; window.m2 = function() { - } + }; // MemberTests.X - function MemberTests$X() { + function X() { } - var MemberTests$X$ = { + var X$ = { update: function(i) { } }; @@ -61,13 +61,13 @@ define('test', ['ss'], function(ss) { $.fn.extend = function(x, i) { x.update(i); return x; - } + }; var $exports = ss.module('test', null, { - Test: [ MemberTests$Test, MemberTests$Test$, null ], - X: [ MemberTests$X, MemberTests$X$, null ] + Test: [ Test, Test$, null ], + X: [ X, X$, null ] }); diff --git a/tests/TestCases/Member/Overloads/Baseline.txt b/tests/TestCases/Member/Overloads/Baseline.txt index e57d214cb..801c322a0 100644 --- a/tests/TestCases/Member/Overloads/Baseline.txt +++ b/tests/TestCases/Member/Overloads/Baseline.txt @@ -5,11 +5,11 @@ define('test', ['ss'], function(ss) { // MemberTests.Test - function MemberTests$Test(name) { + function Test(name) { } - MemberTests$Test.doSomething = function(o) { - } - var MemberTests$Test$ = { + Test.doSomething = function(o) { + }; + var Test$ = { invoke: function(successCallback, errorCallback, context) { } }; @@ -17,26 +17,26 @@ define('test', ['ss'], function(ss) { // MemberTests.App - function MemberTests$App() { - MemberTests$Test.doSomething(); - MemberTests$Test.doSomething(null); - var t1 = new MemberTests$Test(); - var t2 = new MemberTests$Test('test'); + function App() { + Test.doSomething(); + Test.doSomething(null); + var t1 = new Test(); + var t2 = new Test('test'); var cb1 = null; var cb2 = null; t1.invoke(cb1); t1.invoke(cb1, cb2); t2.invoke(cb1, cb2, t1); } - var MemberTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - Test: [ MemberTests$Test, MemberTests$Test$, null ], - App: [ MemberTests$App, MemberTests$App$, null ] + Test: [ Test, Test$, null ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Member/Properties/Baseline.txt b/tests/TestCases/Member/Properties/Baseline.txt index 14f2c28b3..88c797959 100644 --- a/tests/TestCases/Member/Properties/Baseline.txt +++ b/tests/TestCases/Member/Properties/Baseline.txt @@ -5,20 +5,20 @@ define('test', ['ss'], function(ss) { // MemberTests.Test - function MemberTests$Test() { + function Test() { this.set_XYZ(1); this.set_XYZ(this.get_name().length); this.set_XYZ(this.get_name().length); - var v = MemberTests$Test.get_staticProp(); - v = MemberTests$Test.get_staticProp(); + var v = Test.get_staticProp(); + v = Test.get_staticProp(); } - MemberTests$Test.get_staticProp = function() { + Test.get_staticProp = function() { return 2006; - } - MemberTests$Test.set_staticProp = function(value) { + }; + Test.set_staticProp = function(value) { return value; - } - var MemberTests$Test$ = { + }; + var Test$ = { get_XYZ: function() { return 0; }, @@ -39,24 +39,24 @@ define('test', ['ss'], function(ss) { // MemberTests.Test2 - function MemberTests$Test2() { - MemberTests$Test.call(this); - var n = MemberTests$Test$.get_XYZ.call(this); + function Test2() { + Test.call(this); + var n = Test.prototype.get_XYZ.call(this); if (n === this.get_XYZ()) { } if (this.get_XYZ() === n) { } - n = MemberTests$Test.get_staticProp(); + n = Test.get_staticProp(); } - var MemberTests$Test2$ = { + var Test2$ = { }; var $exports = ss.module('test', null, { - Test: [ MemberTests$Test, MemberTests$Test$, null ], - Test2: [ MemberTests$Test2, MemberTests$Test2$, MemberTests$Test ] + Test: [ Test, Test$, null ], + Test2: [ Test2, Test2$, Test ] }); diff --git a/tests/TestCases/Member/StaticConstructors/Baseline.txt b/tests/TestCases/Member/StaticConstructors/Baseline.txt index 3d48811ee..913abdd21 100644 --- a/tests/TestCases/Member/StaticConstructors/Baseline.txt +++ b/tests/TestCases/Member/StaticConstructors/Baseline.txt @@ -5,70 +5,70 @@ define('test', ['ss'], function(ss) { // MemberTests.Behavior - function MemberTests$Behavior(e, name) { + function Behavior(e, name) { } - var MemberTests$Behavior$ = { + var Behavior$ = { }; // MemberTests.MyClass - function MemberTests$MyClass(d) { + function MyClass(d) { } - var MemberTests$MyClass$ = { + var MyClass$ = { }; // MemberTests.MyClassEmpty - function MemberTests$MyClassEmpty() { + function MyClassEmpty() { } - var MemberTests$MyClassEmpty$ = { + var MyClassEmpty$ = { }; // MemberTests.MyClassSimple - function MemberTests$MyClassSimple() { + function MyClassSimple() { } - var MemberTests$MyClassSimple$ = { + var MyClassSimple$ = { }; // MemberTests.MyClassSimpleMulti - function MemberTests$MyClassSimpleMulti() { + function MyClassSimpleMulti() { } - var MemberTests$MyClassSimpleMulti$ = { + var MyClassSimpleMulti$ = { }; // MemberTests.MyBehavior - function MemberTests$MyBehavior(element) { - MemberTests$Behavior.call(this, element, 'myBehavior'); + function MyBehavior(element) { + Behavior.call(this, element, 'myBehavior'); } - var MemberTests$MyBehavior$ = { + var MyBehavior$ = { }; var $exports = ss.module('test', null, { - Behavior: [ MemberTests$Behavior, MemberTests$Behavior$, null ], - MyClass: [ MemberTests$MyClass, MemberTests$MyClass$, null ], - MyClassEmpty: [ MemberTests$MyClassEmpty, MemberTests$MyClassEmpty$, null ], - MyClassSimple: [ MemberTests$MyClassSimple, MemberTests$MyClassSimple$, null ], - MyClassSimpleMulti: [ MemberTests$MyClassSimpleMulti, MemberTests$MyClassSimpleMulti$, null ], - MyBehavior: [ MemberTests$MyBehavior, MemberTests$MyBehavior$, MemberTests$Behavior ] + Behavior: [ Behavior, Behavior$, null ], + MyClass: [ MyClass, MyClass$, null ], + MyClassEmpty: [ MyClassEmpty, MyClassEmpty$, null ], + MyClassSimple: [ MyClassSimple, MyClassSimple$, null ], + MyClassSimpleMulti: [ MyClassSimpleMulti, MyClassSimpleMulti$, null ], + MyBehavior: [ MyBehavior, MyBehavior$, Behavior ] }); - MemberTests$MyClass.instance = new MemberTests$MyClass(ss.now()); + MyClass.instance = new MyClass(ss.now()); alert('simple static ctor'); alert('simple static ctor with multiple statements'); document.getElementById('foo').innerHTML = '...'; @@ -78,7 +78,7 @@ define('test', ['ss'], function(ss) { if (!b) { return; } - new MemberTests$MyBehavior(e); + new MyBehavior(e); })(); return $exports; diff --git a/tests/TestCases/Statement/Exceptions/Baseline.txt b/tests/TestCases/Statement/Exceptions/Baseline.txt index 10685d97d..5759e75c4 100644 --- a/tests/TestCases/Statement/Exceptions/Baseline.txt +++ b/tests/TestCases/Statement/Exceptions/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg) { if (arg == null) { throw new Error('null'); @@ -42,7 +42,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/Expression/Baseline.txt b/tests/TestCases/Statement/Expression/Baseline.txt index 35a6e7f03..88a508977 100644 --- a/tests/TestCases/Statement/Expression/Baseline.txt +++ b/tests/TestCases/Statement/Expression/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg) { var x; arg = x.length; @@ -19,7 +19,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/For/Baseline.txt b/tests/TestCases/Statement/For/Baseline.txt index d5bc3a858..d482246b1 100644 --- a/tests/TestCases/Statement/For/Baseline.txt +++ b/tests/TestCases/Statement/For/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg) { for (var i = 0; i < 10; i++) { } @@ -32,7 +32,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/Foreach/Baseline.txt b/tests/TestCases/Statement/Foreach/Baseline.txt index 9dd89ea51..05132b714 100644 --- a/tests/TestCases/Statement/Foreach/Baseline.txt +++ b/tests/TestCases/Statement/Foreach/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.Set - function StatementTests$Set() { + function Set() { } - var StatementTests$Set$ = { + var Set$ = { getEnumerator: function() { return ss.enumerate(this._items); } @@ -16,9 +16,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg) { var items = [ 1, 2, 3 ]; var sum = 0; @@ -32,7 +32,7 @@ define('test', ['ss'], function(ss) { var entry = { key: $key2, value: d[$key2] }; var s = entry.key + ' = ' + entry.value; } - var s = new StatementTests$Set(); + var s = new Set(); var $enum3 = ss.enumerate(s); while ($enum3.moveNext()) { var o = $enum3.current; @@ -57,8 +57,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Set: [ StatementTests$Set, StatementTests$Set$, null, ss.IEnumerable ], - App: [ StatementTests$App, StatementTests$App$, null ] + Set: [ Set, Set$, null, ss.IEnumerable ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/IfElse/Baseline.txt b/tests/TestCases/Statement/IfElse/Baseline.txt index 3a15f6be1..c700a814d 100644 --- a/tests/TestCases/Statement/IfElse/Baseline.txt +++ b/tests/TestCases/Statement/IfElse/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { testMethod: function(boolValue, numValue) { if (boolValue) { } @@ -34,7 +34,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/Return/Baseline.txt b/tests/TestCases/Statement/Return/Baseline.txt index 6d84dc2fa..65deb254d 100644 --- a/tests/TestCases/Statement/Return/Baseline.txt +++ b/tests/TestCases/Statement/Return/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test1: function(arg) { return 0; }, @@ -32,7 +32,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/Switch/Baseline.txt b/tests/TestCases/Statement/Switch/Baseline.txt index 7f14c07fb..f5808b93a 100644 --- a/tests/TestCases/Statement/Switch/Baseline.txt +++ b/tests/TestCases/Statement/Switch/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // StatementTests.Mode - var StatementTests$Mode = { + var Mode = { foo: 0, bar: 1 }; @@ -13,9 +13,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg, m) { var i; switch (i) { @@ -56,8 +56,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Mode: StatementTests$Mode, - App: [ StatementTests$App, StatementTests$App$, null ] + Mode: Mode, + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/Variables/Baseline.txt b/tests/TestCases/Statement/Variables/Baseline.txt index 69b6ec1c9..b43fc3187 100644 --- a/tests/TestCases/Statement/Variables/Baseline.txt +++ b/tests/TestCases/Statement/Variables/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function() { var i = 0; var b = true; @@ -35,7 +35,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Statement/While/Baseline.txt b/tests/TestCases/Statement/While/Baseline.txt index 61a8aa9e6..4abb1ea5c 100644 --- a/tests/TestCases/Statement/While/Baseline.txt +++ b/tests/TestCases/Statement/While/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // StatementTests.App - function StatementTests$App() { + function App() { } - var StatementTests$App$ = { + var App$ = { test: function(arg) { var i; while (i < arg) { @@ -29,7 +29,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ StatementTests$App, StatementTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Type/Classes/Baseline.txt b/tests/TestCases/Type/Classes/Baseline.txt index fd0d4b5c0..5117bc4c6 100644 --- a/tests/TestCases/Type/Classes/Baseline.txt +++ b/tests/TestCases/Type/Classes/Baseline.txt @@ -5,59 +5,66 @@ define('test', ['ss'], function(ss) { // TypeTests.Foo - function TypeTests$FooBarBaz() { + function FooBarBaz() { } - var TypeTests$FooBarBaz$ = { + var FooBarBaz$ = { }; // TypeTests.MyClass - function TypeTests$MyClass() { - var f = new TypeTests$FooBarBaz(); + function MyClass() { + var f = new FooBarBaz(); } - var TypeTests$MyClass$ = { + var MyClass$ = { }; // TypeTests.MyClass3 - function TypeTests$MyClass3() { + function MyClass3() { } - var TypeTests$MyClass3$ = { + var MyClass3$ = { }; + // TypeTests.StaticClass + + function StaticClass() { + } + + // TypeTests.MyClass2 - function TypeTests$MyClass2() { - TypeTests$MyClass.call(this); + function MyClass2() { + MyClass.call(this); } - var TypeTests$MyClass2$ = { + var MyClass2$ = { }; // TypeTests.MyClass4 - function TypeTests$MyClass4() { - TypeTests$MyClass.call(this); + function MyClass4() { + MyClass.call(this); } - var TypeTests$MyClass4$ = { + var MyClass4$ = { }; var $exports = ss.module('test', null, { - FooBarBaz: [ TypeTests$FooBarBaz, TypeTests$FooBarBaz$, null ], - MyClass: [ TypeTests$MyClass, TypeTests$MyClass$, null ], - MyClass3: [ TypeTests$MyClass3, TypeTests$MyClass3$, null, ss.IDisposable ], - MyClass2: [ TypeTests$MyClass2, TypeTests$MyClass2$, TypeTests$MyClass ], - MyClass4: [ TypeTests$MyClass4, TypeTests$MyClass4$, TypeTests$MyClass, ss.IDisposable ] + FooBarBaz: [ FooBarBaz, FooBarBaz$, null ], + MyClass: [ MyClass, MyClass$, null ], + MyClass3: [ MyClass3, MyClass3$, null, ss.IDisposable ], + StaticClass: [ StaticClass, null, null ], + MyClass2: [ MyClass2, MyClass2$, MyClass ], + MyClass4: [ MyClass4, MyClass4$, MyClass, ss.IDisposable ] }); diff --git a/tests/TestCases/Type/Classes/Code.cs b/tests/TestCases/Type/Classes/Code.cs index 8fb84036d..dc53ab7aa 100644 --- a/tests/TestCases/Type/Classes/Code.cs +++ b/tests/TestCases/Type/Classes/Code.cs @@ -21,4 +21,7 @@ public class MyClass3 : IDisposable { public class MyClass4 : MyClass, IDisposable { } + + public static class StaticClass { + } } diff --git a/tests/TestCases/Type/Delegates/Baseline.txt b/tests/TestCases/Type/Delegates/Baseline.txt index 8dccc3979..126e195e7 100644 --- a/tests/TestCases/Type/Delegates/Baseline.txt +++ b/tests/TestCases/Type/Delegates/Baseline.txt @@ -5,16 +5,16 @@ define('test', ['ss'], function(ss) { // TypeTests.EventArgs - function TypeTests$EventArgs() { + function EventArgs() { } - var TypeTests$EventArgs$ = { + var EventArgs$ = { }; var $exports = ss.module('test', null, { - EventArgs: [ TypeTests$EventArgs, TypeTests$EventArgs$, null ] + EventArgs: [ EventArgs, EventArgs$, null ] }); diff --git a/tests/TestCases/Type/Enumerator/Baseline.txt b/tests/TestCases/Type/Enumerator/Baseline.txt index 24415225e..3e8a15e0f 100644 --- a/tests/TestCases/Type/Enumerator/Baseline.txt +++ b/tests/TestCases/Type/Enumerator/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // TypeTests.App1 - function TypeTests$App1() { + function App1() { } - var TypeTests$App1$ = { + var App1$ = { getEnumerator: function() { return null; } @@ -16,9 +16,9 @@ define('test', ['ss'], function(ss) { // TypeTests.App - function TypeTests$App() { + function App() { } - var TypeTests$App$ = { + var App$ = { test1: function(arg) { }, test: function(arg) { @@ -45,8 +45,8 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App1: [ TypeTests$App1, TypeTests$App1$, null, ss.IEnumerable ], - App: [ TypeTests$App, TypeTests$App$, null ] + App1: [ App1, App1$, null, ss.IEnumerable ], + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Type/Enums/Baseline.txt b/tests/TestCases/Type/Enums/Baseline.txt index 8087e07c0..8735225fd 100644 --- a/tests/TestCases/Type/Enums/Baseline.txt +++ b/tests/TestCases/Type/Enums/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // TypeTests.Colors - var TypeTests$Colors = { + var Colors = { red: 0, green: 1, blue: 2 @@ -14,7 +14,7 @@ define('test', ['ss'], function(ss) { // TypeTests.Sequence - var TypeTests$Sequence = { + var Sequence = { item1: 1, item2: 2, item3: 3, @@ -24,7 +24,7 @@ define('test', ['ss'], function(ss) { // TypeTests.Mode - var TypeTests$Mode = { + var Mode = { Public: 1, Protected: 2, Private: 4 @@ -33,7 +33,7 @@ define('test', ['ss'], function(ss) { // TypeTests.UInt32Mask - var TypeTests$UInt32Mask = { + var UInt32Mask = { v: 4026531840, a: 4278190080 }; @@ -41,7 +41,7 @@ define('test', ['ss'], function(ss) { // TypeTests.ShortMask - var TypeTests$ShortMask = { + var ShortMask = { v: 1, a: 4096 }; @@ -49,7 +49,7 @@ define('test', ['ss'], function(ss) { // TypeTests.Errors - var TypeTests$Errors = { + var Errors = { S_OK: 0, S_FALSE: 1, E_FAIL: -1 @@ -58,23 +58,23 @@ define('test', ['ss'], function(ss) { // TypeTests.App - function TypeTests$App() { + function App() { } - TypeTests$App.main = function() { + App.main = function() { var m = 1; m = 1 | 4; var c = 0; - } - var TypeTests$App$ = { + }; + var App$ = { }; // TypeTests.App2 - function TypeTests$App2() { + function App2() { } - var TypeTests$App2$ = { + var App2$ = { run: function() { var method = 'POST'; this.run1('GET'); @@ -95,14 +95,14 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - Colors: TypeTests$Colors, - Sequence: TypeTests$Sequence, - Mode: TypeTests$Mode, - UInt32Mask: TypeTests$UInt32Mask, - ShortMask: TypeTests$ShortMask, - Errors: TypeTests$Errors, - App: [ TypeTests$App, TypeTests$App$, null ], - App2: [ TypeTests$App2, TypeTests$App2$, null ] + Colors: Colors, + Sequence: Sequence, + Mode: Mode, + UInt32Mask: UInt32Mask, + ShortMask: ShortMask, + Errors: Errors, + App: [ App, App$, null ], + App2: [ App2, App2$, null ] }); diff --git a/tests/TestCases/Type/Globals/Baseline.txt b/tests/TestCases/Type/Globals/Baseline.txt index f572d9e99..3a47937f6 100644 --- a/tests/TestCases/Type/Globals/Baseline.txt +++ b/tests/TestCases/Type/Globals/Baseline.txt @@ -39,9 +39,9 @@ define('test', ['ss'], function(ss) { // Foo.MyClassF - function Foo$MyClassF() { + function MyClassF() { } - var Foo$MyClassF$ = { + var MyClassF$ = { }; @@ -77,7 +77,7 @@ define('test', ['ss'], function(ss) { MyRecord: MyRecord, MyClass: [ MyClass, MyClass$, null ], MyClass3: [ MyClass3, MyClass3$, null, ss.IDisposable ], - MyClassF: [ Foo$MyClassF, Foo$MyClassF$, null ], + MyClassF: [ MyClassF, MyClassF$, null ], MyClass2: [ MyClass2, MyClass2$, MyClass ], MyClass4: [ MyClass4, MyClass4$, MyClass, ss.IDisposable ] }); diff --git a/tests/TestCases/Type/Imported/Baseline.txt b/tests/TestCases/Type/Imported/Baseline.txt index c8eaaf777..5ba93744b 100644 --- a/tests/TestCases/Type/Imported/Baseline.txt +++ b/tests/TestCases/Type/Imported/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // TypeTests.App - function TypeTests$App() { + function App() { var elem = document.getElementById('foo'); var s = elem.myString; elem.do('foo'); @@ -14,20 +14,20 @@ define('test', ['ss'], function(ss) { var n = ss.truncate(5.5); var parser = new DOMParser(); var doc = parser.parseFromString('', 'text/xml'); - var d = Date.parseDate('1/1/2010'); + var d = ss.date('1/1/2010'); var eventHandler = function() { }; elem.addEventListener('click', eventHandler); elem.removeEventListener('click', eventHandler); } - var TypeTests$App$ = { + var App$ = { }; var $exports = ss.module('test', null, { - App: [ TypeTests$App, TypeTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Type/Interfaces/Baseline.txt b/tests/TestCases/Type/Interfaces/Baseline.txt index ecdc1e80d..6291d1c62 100644 --- a/tests/TestCases/Type/Interfaces/Baseline.txt +++ b/tests/TestCases/Type/Interfaces/Baseline.txt @@ -5,24 +5,24 @@ define('test', ['ss'], function(ss) { // TypeTests.IMarker - function TypeTests$IMarker() { } + function IMarker() { } // TypeTests.ISerializable - function TypeTests$ISerializable() { } + function ISerializable() { } // TypeTests.IRunnable - function TypeTests$IRunnable() { } + function IRunnable() { } // TypeTests.MyObject - function TypeTests$MyObject() { + function MyObject() { } - var TypeTests$MyObject$ = { + var MyObject$ = { dispose: function() { } }; @@ -30,9 +30,9 @@ define('test', ['ss'], function(ss) { // TypeTests.Foo - function TypeTests$Foo() { + function Foo() { } - var TypeTests$Foo$ = { + var Foo$ = { get_canRun: function() { return true; }, @@ -46,10 +46,10 @@ define('test', ['ss'], function(ss) { // TypeTests.MyObject2 - function TypeTests$MyObject2() { - TypeTests$MyObject.call(this); + function MyObject2() { + MyObject.call(this); } - var TypeTests$MyObject2$ = { + var MyObject2$ = { get_canRun: function() { return true; }, @@ -60,12 +60,12 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - IMarker: [ TypeTests$IMarker ], - ISerializable: [ TypeTests$ISerializable ], - IRunnable: [ TypeTests$IRunnable ], - MyObject: [ TypeTests$MyObject, TypeTests$MyObject$, null, ss.IDisposable ], - Foo: [ TypeTests$Foo, TypeTests$Foo$, null, TypeTests$IMarker, TypeTests$ISerializable, TypeTests$IRunnable ], - MyObject2: [ TypeTests$MyObject2, TypeTests$MyObject2$, TypeTests$MyObject, TypeTests$IRunnable ] + IMarker: [ IMarker ], + ISerializable: [ ISerializable ], + IRunnable: [ IRunnable ], + MyObject: [ MyObject, MyObject$, null, ss.IDisposable ], + Foo: [ Foo, Foo$, null, IMarker, ISerializable, IRunnable ], + MyObject2: [ MyObject2, MyObject2$, MyObject, IRunnable ] }); diff --git a/tests/TestCases/Type/Modules/Baseline.txt b/tests/TestCases/Type/Modules/Baseline.txt index 8f652508d..8d957f368 100644 --- a/tests/TestCases/Type/Modules/Baseline.txt +++ b/tests/TestCases/Type/Modules/Baseline.txt @@ -5,16 +5,16 @@ define('test', ['ss'], function(ss) { // App.Dummy - function App$Dummy() { + function Dummy() { } - var App$Dummy$ = { + var Dummy$ = { }; var $exports = ss.module('test', null, { - Dummy: [ App$Dummy, App$Dummy$, null ] + Dummy: [ Dummy, Dummy$, null ] }); alert('Hello Startup'); diff --git a/tests/TestCases/Type/Namespaces/Baseline.txt b/tests/TestCases/Type/Namespaces/Baseline.txt index 9e826017c..7461b53b9 100644 --- a/tests/TestCases/Type/Namespaces/Baseline.txt +++ b/tests/TestCases/Type/Namespaces/Baseline.txt @@ -5,20 +5,20 @@ define('test', ['ss'], function(ss) { // TypeTests.Sub1.Sub2.MyClass - function TypeTests$Sub1$Sub2$MyClass() { - var yc = new TypeTests$Sub1$YourClass(); + function MyClass() { + var yc = new YourClass(); yc.run(); } - var TypeTests$Sub1$Sub2$MyClass$ = { + var MyClass$ = { }; // TypeTests.Sub1.YourClass - function TypeTests$Sub1$YourClass() { + function YourClass() { } - var TypeTests$Sub1$YourClass$ = { + var YourClass$ = { run: function() { } }; @@ -26,37 +26,37 @@ define('test', ['ss'], function(ss) { // TypeTests.YourClass1 - function TypeTests$YourClass1() { + function YourClass1() { } - var TypeTests$YourClass1$ = { + var YourClass1$ = { }; // MyApp.Foo.MyClassF - function MyApp$Foo$MyClassF() { + function MyClassF() { } - var MyApp$Foo$MyClassF$ = { + var MyClassF$ = { }; // MyApp.Test - function MyApp$Test() { - var c = new TypeTests$Sub1$Sub2$MyClass(); + function Test() { + var c = new MyClass(); } - var MyApp$Test$ = { + var Test$ = { }; // MyCompany.Utility - function MyCompany$Utility() { + function Utility() { } - var MyCompany$Utility$ = { + var Utility$ = { run: function() { } }; @@ -64,34 +64,34 @@ define('test', ['ss'], function(ss) { // MyCompany.MyProduct.UtilityP - function MyCompany$MyProduct$UtilityP() { + function UtilityP() { } - var MyCompany$MyProduct$UtilityP$ = { + var UtilityP$ = { }; // MyCompany.MyProduct.MyComponent.Component - function MyCompany$MyProduct$MyComponent$Component() { - var u = new MyCompany$Utility(); + function Component() { + var u = new Utility(); u.run(); } - var MyCompany$MyProduct$MyComponent$Component$ = { + var Component$ = { }; var $exports = ss.module('test', null, { - MyClass: [ TypeTests$Sub1$Sub2$MyClass, TypeTests$Sub1$Sub2$MyClass$, null ], - YourClass: [ TypeTests$Sub1$YourClass, TypeTests$Sub1$YourClass$, null ], - YourClass1: [ TypeTests$YourClass1, TypeTests$YourClass1$, null ], - MyClassF: [ MyApp$Foo$MyClassF, MyApp$Foo$MyClassF$, null ], - Test: [ MyApp$Test, MyApp$Test$, null ], - Utility: [ MyCompany$Utility, MyCompany$Utility$, null ], - UtilityP: [ MyCompany$MyProduct$UtilityP, MyCompany$MyProduct$UtilityP$, null ], - Component: [ MyCompany$MyProduct$MyComponent$Component, MyCompany$MyProduct$MyComponent$Component$, null ] + MyClass: [ MyClass, MyClass$, null ], + YourClass: [ YourClass, YourClass$, null ], + YourClass1: [ YourClass1, YourClass1$, null ], + MyClassF: [ MyClassF, MyClassF$, null ], + Test: [ Test, Test$, null ], + Utility: [ Utility, Utility$, null ], + UtilityP: [ UtilityP, UtilityP$, null ], + Component: [ Component, Component$, null ] }); diff --git a/tests/TestCases/Type/Nullable/Baseline.txt b/tests/TestCases/Type/Nullable/Baseline.txt index b78d83aa2..139768a83 100644 --- a/tests/TestCases/Type/Nullable/Baseline.txt +++ b/tests/TestCases/Type/Nullable/Baseline.txt @@ -5,9 +5,9 @@ define('test', ['ss'], function(ss) { // TypeTests.App - function TypeTests$App() { + function App() { } - var TypeTests$App$ = { + var App$ = { method: function() { var i = 10; var b = true; @@ -32,7 +32,7 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', null, { - App: [ TypeTests$App, TypeTests$App$, null ] + App: [ App, App$, null ] }); diff --git a/tests/TestCases/Type/Partials/Baseline.txt b/tests/TestCases/Type/Partials/Baseline.txt index f6c537bcb..11d256e6c 100644 --- a/tests/TestCases/Type/Partials/Baseline.txt +++ b/tests/TestCases/Type/Partials/Baseline.txt @@ -5,23 +5,23 @@ define('test', ['ss'], function(ss) { // TypeTests.IMyInterface - function TypeTests$IMyInterface() { } + function IMyInterface() { } // TypeTests.EmptyClass - function TypeTests$EmptyClass() { + function EmptyClass() { } - var TypeTests$EmptyClass$ = { + var EmptyClass$ = { }; // TypeTests.SingleMemberClass - function TypeTests$SingleMemberClass() { + function SingleMemberClass() { } - var TypeTests$SingleMemberClass$ = { + var SingleMemberClass$ = { run: function() { } }; @@ -29,10 +29,10 @@ define('test', ['ss'], function(ss) { // TypeTests.MergedMembersClass - function TypeTests$MergedMembersClass() { + function MergedMembersClass() { this.foo = false; } - var TypeTests$MergedMembersClass$ = { + var MergedMembersClass$ = { testMethod: function() { return null; } @@ -41,9 +41,9 @@ define('test', ['ss'], function(ss) { // TypeTests.MyClass - function TypeTests$MyClass() { + function MyClass() { } - var TypeTests$MyClass$ = { + var MyClass$ = { start: function() { }, Stop: function() { @@ -55,9 +55,9 @@ define('test', ['ss'], function(ss) { // TypeTests.SomeClass - function TypeTests$SomeClass() { + function SomeClass() { } - var TypeTests$SomeClass$ = { + var SomeClass$ = { close: function() { }, _cancel: function() { @@ -69,7 +69,7 @@ define('test', ['ss'], function(ss) { // TypeTests.App - function TypeTests$App() { + function App() { var s; s.run(); var d; @@ -80,28 +80,28 @@ define('test', ['ss'], function(ss) { mc.Stop(); mc.resume(); } - var TypeTests$App$ = { + var App$ = { }; // TypeTests.DerivedMemberClass - function TypeTests$DerivedMemberClass() { - TypeTests$SingleMemberClass.call(this); + function DerivedMemberClass() { + SingleMemberClass.call(this); } - var TypeTests$DerivedMemberClass$ = { + var DerivedMemberClass$ = { }; // TypeTests.DerivedMergedMembersClass - function TypeTests$DerivedMergedMembersClass() { - TypeTests$MergedMembersClass.call(this); + function DerivedMergedMembersClass() { + MergedMembersClass.call(this); this.name = this.bar + this.bar + 'Name'; } - var TypeTests$DerivedMergedMembersClass$ = { + var DerivedMergedMembersClass$ = { testMethod: function() { return null; }, @@ -112,7 +112,7 @@ define('test', ['ss'], function(ss) { var e1 = document.getElementById(this.bar); var e2 = document.getElementById(this.name); var e3 = document.getElementById(this.bar); - var s = this.testMethod() + ss.base(this, 'testMethod').call(this); + var s = this.testMethod() + MergedMembersClass.prototype.testMethod.call(this); }, get_item: function(s) { return s; @@ -122,17 +122,17 @@ define('test', ['ss'], function(ss) { var $exports = ss.module('test', { - SingleMemberClass: [ TypeTests$SingleMemberClass, TypeTests$SingleMemberClass$, null ], - SomeClass: [ TypeTests$SomeClass, TypeTests$SomeClass$, null ] + SingleMemberClass: [ SingleMemberClass, SingleMemberClass$, null ], + SomeClass: [ SomeClass, SomeClass$, null ] }, { - IMyInterface: [ TypeTests$IMyInterface ], - EmptyClass: [ TypeTests$EmptyClass, TypeTests$EmptyClass$, null ], - MergedMembersClass: [ TypeTests$MergedMembersClass, TypeTests$MergedMembersClass$, null ], - MyClass: [ TypeTests$MyClass, TypeTests$MyClass$, null, TypeTests$IMyInterface ], - App: [ TypeTests$App, TypeTests$App$, null ], - DerivedMemberClass: [ TypeTests$DerivedMemberClass, TypeTests$DerivedMemberClass$, TypeTests$SingleMemberClass ], - DerivedMergedMembersClass: [ TypeTests$DerivedMergedMembersClass, TypeTests$DerivedMergedMembersClass$, TypeTests$MergedMembersClass ] + IMyInterface: [ IMyInterface ], + EmptyClass: [ EmptyClass, EmptyClass$, null ], + MergedMembersClass: [ MergedMembersClass, MergedMembersClass$, null ], + MyClass: [ MyClass, MyClass$, null, IMyInterface ], + App: [ App, App$, null ], + DerivedMemberClass: [ DerivedMemberClass, DerivedMemberClass$, SingleMemberClass ], + DerivedMergedMembersClass: [ DerivedMergedMembersClass, DerivedMergedMembersClass$, MergedMembersClass ] }); diff --git a/tests/TestCases/Type/Records/Baseline.txt b/tests/TestCases/Type/Records/Baseline.txt index 97af8a9bc..102a2ba16 100644 --- a/tests/TestCases/Type/Records/Baseline.txt +++ b/tests/TestCases/Type/Records/Baseline.txt @@ -5,7 +5,7 @@ define('test', ['ss'], function(ss) { // TypeTests.Point - function TypeTests$Point(x, y) { + function Point(x, y) { var $o = {}; $o.x = x; $o.y = y; @@ -15,13 +15,13 @@ define('test', ['ss'], function(ss) { // TypeTests.Pair - function TypeTests$Pair() { return {}; } + function Pair() { return {}; } var $exports = ss.module('test', null, { - Point: TypeTests$Point, - Pair: TypeTests$Pair + Point: Point, + Pair: Pair }); diff --git a/tests/TestCases/Type/UsingAlias/Baseline.txt b/tests/TestCases/Type/UsingAlias/Baseline.txt index cc42a864f..4ad21c1b2 100644 --- a/tests/TestCases/Type/UsingAlias/Baseline.txt +++ b/tests/TestCases/Type/UsingAlias/Baseline.txt @@ -5,19 +5,19 @@ define('test', ['ss'], function(ss) { // TypeTests.MyClass - function TypeTests$MyClass() { + function MyClass() { var body = document.body; var head = document.getElementsByTagName('head')[0]; head.appendChild(body); } - var TypeTests$MyClass$ = { + var MyClass$ = { }; var $exports = ss.module('test', null, { - MyClass: [ TypeTests$MyClass, TypeTests$MyClass$, null ] + MyClass: [ MyClass, MyClass$, null ] }); diff --git a/tests/TestCases/Validation/InlineScript/Code.cs b/tests/TestCases/Validation/InlineScript/Code.cs index 28de5655f..5ee3257a6 100644 --- a/tests/TestCases/Validation/InlineScript/Code.cs +++ b/tests/TestCases/Validation/InlineScript/Code.cs @@ -13,6 +13,7 @@ public void Test(int arg) { string scriptTemplate = "alert({0} + {1})"; Script.Literal(scriptTemplate, a, a); + Script.Literal("alert({name:{0}})", "aaa"); } } } diff --git a/tests/TestSite/Bases.htm b/tests/TestSite/Bases.htm new file mode 100644 index 000000000..a90ed09b5 --- /dev/null +++ b/tests/TestSite/Bases.htm @@ -0,0 +1,45 @@ + + + + Bases + + + + + +

Test Results

+

+

+
    +
    + + + + + + + + + diff --git a/tests/TestSite/Code/OOP.cs b/tests/TestSite/Code/OOP.cs index 1b5d7b415..7891e84ef 100644 --- a/tests/TestSite/Code/OOP.cs +++ b/tests/TestSite/Code/OOP.cs @@ -121,3 +121,140 @@ public interface IObject { public class Zoo { } } + + +namespace Test.Bases { + + // A series of classes with different combinations of overrides at different + // levels in the class hierarchy. Tests issues #379, #384 as applied to properties, + // methods, and index operators. + + public class C1 { + private string _valueA = "A"; + + public virtual string PropertyA { + get { + return _valueA + "-PC1"; + } + set { + _valueA = value + "+PC1"; + } + } + + public virtual string MethodA() { + return _valueA + "-MC1"; + } + + public virtual string this[int key] { + get { + return _valueA + "-" + key.ToString() + "IC1"; + } + set { + _valueA = value + "+" + key.ToString() + "IC1"; + } + } + } + + public class C2 : C1 { + public override string PropertyA { + get { + return base.PropertyA + "-PC2"; + } + set { + base.PropertyA = value + "+PC2"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC2"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC2"; + } + set { + base[key] = value + "+" + key.ToString() + "IC2"; + } + } + } + + public class C3 : C2 { + public override string PropertyA { + get { + return base.PropertyA + "-PC3"; + } + set { + base.PropertyA = value + "+PC3"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC3"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC3"; + } + set { + base[key] = value + "+" + key.ToString() + "IC3"; + } + } + } + + public class C4 : C3 { + // intentionally skip this generation of overrides + } + + public class C5 : C4 { + public override string PropertyA { + get { + return base.PropertyA + "-PC5"; + } + set { + base.PropertyA = value + "+PC5"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC5"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC5"; + } + set { + base[key] = value + "+" + key.ToString() + "IC5"; + } + } + } + + public class TestCase { + + public static string RunTest(C1 x) { + string output = ""; + string delim = ","; + + // Test getter, method, and index (should accumulate outward through bases) + output = x.PropertyA + + delim + x.MethodA() + + delim + x[99]; + + // Test property setter (should accumulate inward and outward through bases) + + x.PropertyA = "X"; + output += delim + x.PropertyA; + + // Test index setter (should accumulate inward and outward through bases) + + x[88] = "Y"; + output += delim + x[99]; + + return output; + } + + } + +} diff --git a/tests/TestSite/String.htm b/tests/TestSite/String.htm index dc0422059..7adba8c55 100644 --- a/tests/TestSite/String.htm +++ b/tests/TestSite/String.htm @@ -22,11 +22,32 @@

    test('trim', function() { QUnit.equal(ss.trimStart('Hello'), 'Hello'); QUnit.equal(ss.trimStart(' Hello'), 'Hello'); - QUnit.equal(ss.trimEnd(' Hello'), ' Hello'); + QUnit.equal(ss.trimStart(' Hello '), 'Hello '); + + QUnit.equal(ss.trimEnd('Hello'), 'Hello'); QUnit.equal(ss.trimEnd('Hello '), 'Hello'); - QUnit.equal(ss.trimStart('Hello'), 'Hello'); + QUnit.equal(ss.trimEnd(' Hello '), ' Hello'); + QUnit.equal(ss.trimEnd(ss.trimStart(' Hello ')), 'Hello'); QUnit.equal(ss.trimEnd(ss.trimStart('\tHello ')), 'Hello'); + + QUnit.equal(ss.trim('Hello'), 'Hello'); + QUnit.equal(ss.trim(' Hello '), 'Hello'); + QUnit.equal(ss.trim('\tHello '), 'Hello'); + QUnit.equal(ss.trim('\t Hello World '), 'Hello World'); + + QUnit.equal(ss.trimStart('00word00', ['0']), 'word00'); + QUnit.equal(ss.trimStart('10word01', ['0', '1']), 'word01'); + QUnit.equal(ss.trimStart('10 0word0 01', ['0', '1']), ' 0word0 01'); + + QUnit.equal(ss.trimEnd('00word00', ['0']), '00word'); + QUnit.equal(ss.trimEnd('10word01', ['0', '1']), '10word'); + QUnit.equal(ss.trimEnd('10 0word0 01', ['0', '1']), '10 0word0 '); + + QUnit.equal(ss.trim('00word00', ['0']), 'word'); + QUnit.equal(ss.trim('10word01', ['0', '1']), 'word'); + QUnit.equal(ss.trim('10 0word0 01', ['0', '1']), ' 0word0 '); + QUnit.equal(ss.trim(' word ', []), 'word'); }); test('padLeft', function() { diff --git a/tests/ValidationTests.cs b/tests/ValidationTests.cs index ff598d290..1d608b69e 100644 --- a/tests/ValidationTests.cs +++ b/tests/ValidationTests.cs @@ -114,7 +114,8 @@ public void TestImplicitEnums() { [TestMethod] public void TestInlineScript() { string expectedErrors = - "The argument to Script.Literal must be a constant string. Code.cs(15, 28)"; + "The argument to Script.Literal must be a constant string. Code.cs(15, 28)" + Environment.NewLine + + "The argument to Script.Literal must be a valid String.Format string. Code.cs(16, 28)"; Compilation compilation = CreateCompilation(); compilation.AddSource("Code.cs");