Skip to content

Commit 8323203

Browse files
committed
Merge pull request #6 from bdrazhzhov/master
Using local TS node module
2 parents 9cd0a28 + 8d14241 commit 8323203

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+97962
-144233
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.4.1.3 2015-06-29 21:37:00+0300
2+
* Updated Typescript to v1.4.1
3+
* Added option `use_external_tsc` (boolean). It could be helpful if you have locally installed Typescript node.js module and want to use it.
14

25
## v1.0.1.2 2014-08-09 08:37:08+0900
36

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ Or install it yourself as:
2121
```ruby
2222
require 'typescript-src'
2323

24+
TypeScript::Src.use_external_tsc = true # if you want to use tsc from installed node.js module.
25+
# false by default (it uses built-in tsc)
26+
2427
p TypeScript::Src.tsc_path # => #<Pathname:/path/to/tsc>
2528
p TypeScript::Src.js_path # => #<Pathname:/path/to/typescript.js>
26-
p TypeScript::Src.version # => "1.0.1"
29+
p TypeScript::Src.version # => "1.4.1.3"
2730
```
2831

2932
## Contributing

lib/typescript-src.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@
55
module TypeScript
66
module Src
77
class << self
8+
attr_accessor :use_external_tsc
9+
810
# @return [Pathname]
911
def typescript_path
10-
@typescript_path ||= ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript')
12+
unless @typescript_path
13+
if self.use_external_tsc
14+
@typescript_path = ::Pathname.new(`npm root -g`.strip! + '/typescript')
15+
else
16+
@typescript_path = ::Pathname.new(File.dirname(__FILE__)).join('typescript-src/support/typescript')
17+
end
18+
end
19+
20+
@typescript_path
1121
end
1222

1323
# @return [Pathname]
@@ -17,7 +27,7 @@ def tsc_path
1727

1828
# @return [Pathname]
1929
def js_path
20-
typescript_path.join('bin/typescript.js')
30+
typescript_path.join('bin/tsc.js')
2131
end
2232

2333
# @return [Pathname]
@@ -47,6 +57,8 @@ def version
4757
package_info['version']
4858
end
4959
end
60+
61+
self.use_external_tsc = false
5062
end
5163
end
5264

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
built
22
doc
3-
samples
43
src
54
tests
6-
typings
7-
bin/winjs.d.ts
8-
bin/winrt.d.ts
9-
bin/*.bat
10-
bin/jquery.d.ts
11-
bin/typescriptServices.js
125
Jakefile
6+
.travis.yml
7+
scripts/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## Contributing bug fixes
2+
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
3+
4+
## Contributing features
5+
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
6+
7+
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
8+
9+
## Legal
10+
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
11+
12+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features.
13+
14+
## Housekeeping
15+
Your pull request should:
16+
17+
* Include a description of what your change intends to do
18+
* Be a child commit of a reasonably recent commit in the **master** branch
19+
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
20+
* It is desirable, but not necessary, for the tests to pass at each commit
21+
* Have clear commit messages
22+
* e.g. "Refactor feature", "Fix issue", "Add tests for issue"
23+
* Include adequate tests
24+
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
25+
* Tests should include reasonable permutations of the target fix/change
26+
* Include baseline changes with your change
27+
* All changed code must have 100% code coverage
28+
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
29+
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
30+
31+
## Running the Tests
32+
To run all tests, invoke the runtests target using jake:
33+
34+
`jake runtests`
35+
36+
This run will all tests; to run only a specific subset of tests, use:
37+
38+
`jake runtests tests=<regex>`
39+
40+
e.g. to run all compiler baseline tests:
41+
42+
`jake runtests tests=compiler`
43+
44+
or to run specifc test:tests\cases\compiler\2dArrays.ts
45+
46+
`jake runtests tests=2dArrays`
47+
48+
## Adding a Test
49+
To add a new testcase, simply place a .ts file in tests\cases\compiler containing code that exemplifies the bugfix or change you are making.
50+
51+
These files support metadata tags in the format // @name: value . The supported names and values are:
52+
53+
* comments, sourcemap, noimplicitany, declaration: true or false (corresponds to the compiler command-line options of the same name)
54+
* target: ES3 or ES5 (same as compiler)
55+
* out, outDir: path (same as compiler)
56+
* module: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
57+
58+
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in tests\cases\conformance in an appropriately-named subfolder.
59+
**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
60+
61+
## Managing the Baselines
62+
Compiler testcases generate baselines that track the emitted .js, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output.
63+
64+
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
65+
66+
`jake diff`
67+
68+
After verifying that the changes in the baselines are correct, run
69+
70+
`jake baseline-accept`
71+
72+
to establish the new baselines as the desired behavior. This will change the files in tests\baselines\reference, which should be included as part of your commit. It's important to carefully validate changes in the baselines.
73+
74+
**Note** that baseline-accept should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2+
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript)
3+
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript)
4+
5+
# TypeScript
6+
7+
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
8+
9+
10+
## Contribute
11+
12+
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
13+
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
14+
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
15+
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
16+
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
17+
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
18+
* Read the language specification ([docx](http://go.microsoft.com/fwlink/?LinkId=267121), [pdf](http://go.microsoft.com/fwlink/?LinkId=267238)).
19+
20+
21+
## Documentation
22+
23+
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
24+
* [Programming handbook](http://www.typescriptlang.org/Handbook)
25+
* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)
26+
* [Homepage](http://www.typescriptlang.org/)
27+
28+
## Building
29+
30+
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed.
31+
32+
Clone a copy of the repo:
33+
34+
```
35+
git clone https://github.com/Microsoft/TypeScript.git
36+
```
37+
38+
Change to the TypeScript directory:
39+
40+
```
41+
cd TypeScript
42+
```
43+
44+
Install Jake tools and dev dependencies:
45+
46+
```
47+
npm install -g jake
48+
npm install
49+
```
50+
51+
Use one of the following to build and test:
52+
53+
```
54+
jake local # Build the compiler into built/local
55+
jake clean # Delete the built compiler
56+
jake LKG # Replace the last known good with the built one.
57+
# Bootstrapping step to be executed when the built compiler reaches a stable state.
58+
jake tests # Build the test infrastructure using the built compiler.
59+
jake runtests # Run tests using the built compiler and test infrastructure.
60+
# You can override the host or specify a test for this command.
61+
# Use host=<hostName> or tests=<testPath>.
62+
jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional
63+
parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.
64+
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
65+
jake -T # List the above commands.
66+
```
67+
68+
69+
## Usage
70+
71+
```shell
72+
node built/local/tsc.js hello.ts
73+
```
74+
75+
76+
## Roadmap
77+
78+
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).

lib/typescript-src/support/typescript/README.txt

-27
This file was deleted.

lib/typescript-src/support/typescript/ThirdPartyNoticeText.txt

+10-60
Original file line numberDiff line numberDiff line change
@@ -19,67 +19,17 @@ limitations under the License.
1919
---------------------------------------------
2020
Third Party Code Components
2121
--------------------------------------------
22-
---- Mozilla Developer Code---------
23-
The following Mozilla Developer Code is under Public Domain as updated after Aug. 20, 2012, see, https://developer.mozilla.org/en-US/docs/Project:Copyrights
24-
1. Array filter Compatibility Method,
25-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
26-
Any copyright is dedicated to the Public Domain.
2722

28-
2. Array forEach Compatibility Method,
29-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
30-
Any copyright is dedicated to the Public Domain.
31-
32-
3. Array indexOf Compatibility Method,
33-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
34-
Any copyright is dedicated to the Public Domain.
35-
36-
4. Array map Compatibility Method,
37-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map
38-
Any copyright is dedicated to the Public Domain.
39-
40-
5. Array Reduce Compatibility Method,
41-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce
42-
Any copyright is dedicated to the Public Domain.
43-
44-
6. String Trim Compatibility Method,
45-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
46-
Any copyright is dedicated to the Public Domain.
47-
48-
7. Date now Compatibility Method,
49-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now
50-
Any copyright is dedicated to the Public Domain.
51-
52-
------------JSON2 Script------------------------
53-
json2.js 2012-10-08
54-
Public Domain.
55-
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
56-
See, http://www.JSON.org/js.html
57-
58-
--------------r.js----------------------
59-
Copyright (c) 2010-2011 Dojo Foundation. All Rights Reserved.
60-
Originally License under MIT License
61-
-------------------------------------------------------------------------
23+
------------------- DefinitelyTyped --------------------
24+
This file is based on or incorporates material from the projects listed below (collectively ?Third Party Code?). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
25+
DefinitelyTyped
26+
This project is licensed under the MIT license.
27+
Copyrights are respective of each contributor listed at the beginning of each definition file.
6228
Provided for Informational Purposes Only
63-
MIT License
64-
65-
Permission is hereby granted, free of charge, to any person obtaining
66-
a copy of this software and associated documentation files (the
67-
"Software"), to deal in the Software without restriction, including
68-
without limitation the rights to use, copy, modify, merge, publish,
69-
distribute, sublicense, and/or sell copies of the Software, and to
70-
permit persons to whom the Software is furnished to do so, subject to
71-
the following conditions:
72-
73-
The above copyright notice and this permission notice shall be
74-
included in all copies or substantial portions of the Software.
75-
76-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
77-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
78-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
79-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
80-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
81-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
82-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29+
30+
MIT License
31+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
32+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
33+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8334
--------------------------------------------------------------------------------------
84-
8535
------------- End of ThirdPartyNotices --------------------------------------------------- */

0 commit comments

Comments
 (0)