mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
added missing node_modules
This commit is contained in:
parent
320558a782
commit
44421bbc79
3
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.gitconfig
generated
vendored
Normal file
3
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.gitconfig
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[remote "github"]
|
||||
push = +refs/heads/master:refs/heads/gh-pages
|
||||
push = +refs/heads/master:refs/heads/master
|
8
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.zuul.yml
generated
vendored
Normal file
8
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.zuul.yml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
ui: jasmine2
|
||||
browsers:
|
||||
- name: chrome
|
||||
version: 27
|
||||
- name: ie
|
||||
version: latest
|
||||
- name: iphone
|
||||
version: 6.1
|
2
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.zuulrc
generated
vendored
Normal file
2
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/.zuulrc
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
sauce_username: peterolson
|
||||
sauce_key: 3553a315-10c0-4661-9d8e-7150d87064c7
|
1181
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/BigInteger.js
generated
vendored
Normal file
1181
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/BigInteger.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/BigInteger.min.js
generated
vendored
Normal file
1
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/BigInteger.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/LICENSE
generated
vendored
Normal file
24
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
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 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.
|
||||
|
||||
For more information, please refer to <http://unlicense.org>
|
506
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/README.md
generated
vendored
Normal file
506
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/README.md
generated
vendored
Normal file
@ -0,0 +1,506 @@
|
||||
# BigInteger.js [![Build Status][travis-img]][travis-url] [![Coverage Status][coveralls-img]][coveralls-url] [![Monthly Downloads][downloads-img]][downloads-url]
|
||||
|
||||
[travis-url]: https://travis-ci.org/peterolson/BigInteger.js
|
||||
[travis-img]: https://travis-ci.org/peterolson/BigInteger.js.svg?branch=master
|
||||
[coveralls-url]: https://coveralls.io/github/peterolson/BigInteger.js?branch=master
|
||||
[coveralls-img]: https://coveralls.io/repos/peterolson/BigInteger.js/badge.svg?branch=master&service=github
|
||||
[downloads-url]: https://www.npmjs.com/package/big-integer
|
||||
[downloads-img]: https://img.shields.io/npm/dm/big-integer.svg
|
||||
|
||||
**BigInteger.js** is an arbitrary-length integer library for Javascript, allowing arithmetic operations on integers of unlimited size, notwithstanding memory and time limitations.
|
||||
|
||||
## Installation
|
||||
|
||||
If you are using a browser, you can download [BigInteger.js from GitHub](http://peterolson.github.com/BigInteger.js/BigInteger.min.js) or just hotlink to it:
|
||||
|
||||
<script src="http://peterolson.github.com/BigInteger.js/BigInteger.min.js"></script>
|
||||
|
||||
If you are using node, you can install BigInteger with [npm](https://npmjs.org/).
|
||||
|
||||
npm install big-integer
|
||||
|
||||
Then you can include it in your code:
|
||||
|
||||
var bigInt = require("big-integer");
|
||||
|
||||
|
||||
## Usage
|
||||
### `bigInt(number, [base])`
|
||||
|
||||
You can create a bigInt by calling the `bigInt` function. You can pass in
|
||||
|
||||
- a string, which it will parse as an bigInt and throw an `"Invalid integer"` error if the parsing fails.
|
||||
- a Javascript number, which it will parse as an bigInt and throw an `"Invalid integer"` error if the parsing fails.
|
||||
- another bigInt.
|
||||
- nothing, and it will return `bigInt.zero`.
|
||||
|
||||
If you provide a second parameter, then it will parse `number` as a number in base `base`. Note that `base` can be any bigInt (even negative or zero). The letters "a-z" and "A-Z" will be interpreted as the numbers 10 to 35. Higher digits can be specified in angle brackets (`<` and `>`).
|
||||
|
||||
Examples:
|
||||
|
||||
var zero = bigInt();
|
||||
var ninetyThree = bigInt(93);
|
||||
var largeNumber = bigInt("75643564363473453456342378564387956906736546456235345");
|
||||
var googol = bigInt("1e100");
|
||||
var bigNumber = bigInt(largeNumber);
|
||||
|
||||
var maximumByte = bigInt("FF", 16);
|
||||
var fiftyFiveGoogol = bigInt("<55>0", googol);
|
||||
|
||||
Note that Javascript numbers larger than `9007199254740992` and smaller than `-9007199254740992` are not precisely represented numbers and will not produce exact results. If you are dealing with numbers outside that range, it is better to pass in strings.
|
||||
|
||||
### Method Chaining
|
||||
|
||||
Note that bigInt operations return bigInts, which allows you to chain methods, for example:
|
||||
|
||||
var salary = bigInt(dollarsPerHour).times(hoursWorked).plus(randomBonuses)
|
||||
|
||||
### Constants
|
||||
|
||||
There are three named constants already stored that you do not have to construct with the `bigInt` function yourself:
|
||||
|
||||
- `bigInt.one`, equivalent to `bigInt(1)`
|
||||
- `bigInt.zero`, equivalent to `bigInt(0)`
|
||||
- `bigInt.minusOne`, equivalent to `bigInt(-1)`
|
||||
|
||||
The numbers from -999 to 999 are also already prestored and can be accessed using `bigInt[index]`, for example:
|
||||
|
||||
- `bigInt[-999]`, equivalent to `bigInt(-999)`
|
||||
- `bigInt[256]`, equivalent to `bigInt(256)`
|
||||
|
||||
### Methods
|
||||
|
||||
#### `abs()`
|
||||
|
||||
Returns the absolute value of a bigInt.
|
||||
|
||||
- `bigInt(-45).abs()` => `45`
|
||||
- `bigInt(45).abs()` => `45`
|
||||
|
||||
#### `add(number)`
|
||||
|
||||
Performs addition.
|
||||
|
||||
- `bigInt(5).add(7)` => `12`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Addition)
|
||||
|
||||
#### `and(number)`
|
||||
|
||||
Performs the bitwise AND operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
|
||||
|
||||
- `bigInt(6).and(3)` => `2`
|
||||
- `bigInt(6).and(-3)` => `4`
|
||||
|
||||
#### `compare(number)`
|
||||
|
||||
Performs a comparison between two numbers. If the numbers are equal, it returns `0`. If the first number is greater, it returns `1`. If the first number is lesser, it returns `-1`.
|
||||
|
||||
- `bigInt(5).compare(5)` => `0`
|
||||
- `bigInt(5).compare(4)` => `1`
|
||||
- `bigInt(4).compare(5)` => `-1`
|
||||
|
||||
#### `compareAbs(number)`
|
||||
|
||||
Performs a comparison between the absolute value of two numbers.
|
||||
|
||||
- `bigInt(5).compareAbs(-5)` => `0`
|
||||
- `bigInt(5).compareAbs(4)` => `1`
|
||||
- `bigInt(4).compareAbs(-5)` => `-1`
|
||||
|
||||
#### `compareTo(number)`
|
||||
|
||||
Alias for the `compare` method.
|
||||
|
||||
#### `divide(number)`
|
||||
|
||||
Performs integer division, disregarding the remainder.
|
||||
|
||||
- `bigInt(59).divide(5)` => `11`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `divmod(number)`
|
||||
|
||||
Performs division and returns an object with two properties: `quotient` and `remainder`. The sign of the remainder will match the sign of the dividend.
|
||||
|
||||
- `bigInt(59).divmod(5)` => `{quotient: bigInt(11), remainder: bigInt(4) }`
|
||||
- `bigInt(-5).divmod(2)` => `{quotient: bigInt(-2), remainder: bigInt(-1) }`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `eq(number)`
|
||||
|
||||
Alias for the `equals` method.
|
||||
|
||||
#### `equals(number)`
|
||||
|
||||
Checks if two numbers are equal.
|
||||
|
||||
- `bigInt(5).equals(5)` => `true`
|
||||
- `bigInt(4).equals(7)` => `false`
|
||||
|
||||
#### `geq(number)`
|
||||
|
||||
Alias for the `greaterOrEquals` method.
|
||||
|
||||
|
||||
#### `greater(number)`
|
||||
|
||||
Checks if the first number is greater than the second.
|
||||
|
||||
- `bigInt(5).greater(6)` => `false`
|
||||
- `bigInt(5).greater(5)` => `false`
|
||||
- `bigInt(5).greater(4)` => `true`
|
||||
|
||||
#### `greaterOrEquals(number)`
|
||||
|
||||
Checks if the first number is greater than or equal to the second.
|
||||
|
||||
- `bigInt(5).greaterOrEquals(6)` => `false`
|
||||
- `bigInt(5).greaterOrEquals(5)` => `true`
|
||||
- `bigInt(5).greaterOrEquals(4)` => `true`
|
||||
|
||||
#### `gt(number)`
|
||||
|
||||
Alias for the `greater` method.
|
||||
|
||||
#### `isDivisibleBy(number)`
|
||||
|
||||
Returns `true` if the first number is divisible by the second number, `false` otherwise.
|
||||
|
||||
- `bigInt(999).isDivisibleBy(333)` => `true`
|
||||
- `bigInt(99).isDivisibleBy(5)` => `false`
|
||||
|
||||
#### `isEven()`
|
||||
|
||||
Returns `true` if the number is even, `false` otherwise.
|
||||
|
||||
- `bigInt(6).isEven()` => `true`
|
||||
- `bigInt(3).isEven()` => `false`
|
||||
|
||||
#### `isNegative()`
|
||||
|
||||
Returns `true` if the number is negative, `false` otherwise.
|
||||
Returns `false` for `0` and `-0`.
|
||||
|
||||
- `bigInt(-23).isNegative()` => `true`
|
||||
- `bigInt(50).isNegative()` => `false`
|
||||
|
||||
#### `isOdd()`
|
||||
|
||||
Returns `true` if the number is odd, `false` otherwise.
|
||||
|
||||
- `bigInt(13).isOdd()` => `true`
|
||||
- `bigInt(40).isOdd()` => `false`
|
||||
|
||||
#### `isPositive()`
|
||||
|
||||
Return `true` if the number is positive, `false` otherwise.
|
||||
Returns `false` for `0` and `-0`.
|
||||
|
||||
- `bigInt(54).isPositive()` => `true`
|
||||
- `bigInt(-1).isPositive()` => `false`
|
||||
|
||||
#### `isPrime()`
|
||||
|
||||
Returns `true` if the number is prime, `false` otherwise.
|
||||
|
||||
- `bigInt(5).isPrime()` => `true`
|
||||
- `bigInt(6).isPrime()` => `false`
|
||||
|
||||
#### `isProbablePrime([iterations])`
|
||||
|
||||
Returns `true` if the number is very likely to be positive, `false` otherwise.
|
||||
Argument is optional and determines the amount of iterations of the test (default: `5`). The more iterations, the lower chance of getting a false positive.
|
||||
This uses the [Fermat primality test](https://en.wikipedia.org/wiki/Fermat_primality_test).
|
||||
|
||||
- `bigInt(5).isProbablePrime()` => `true`
|
||||
- `bigInt(49).isProbablePrime()` => `false`
|
||||
- `bigInt(1729).isProbablePrime(50)` => `false`
|
||||
|
||||
Note that this function is not deterministic, since it relies on random sampling of factors, so the result for some numbers is not always the same. [Carmichael numbers](https://en.wikipedia.org/wiki/Carmichael_number) are particularly prone to give unreliable results.
|
||||
|
||||
For example, `bigInt(1729).isProbablePrime()` returns `false` about 76% of the time and `true` about 24% of the time. The correct result is `false`.
|
||||
|
||||
#### `isUnit()`
|
||||
|
||||
Returns `true` if the number is `1` or `-1`, `false` otherwise.
|
||||
|
||||
- `bigInt.one.isUnit()` => `true`
|
||||
- `bigInt.minusOne.isUnit()` => `true`
|
||||
- `bigInt(5).isUnit()` => `false`
|
||||
|
||||
#### `isZero()`
|
||||
|
||||
Return `true` if the number is `0` or `-0`, `false` otherwise.
|
||||
|
||||
- `bigInt.zero.isZero()` => `true`
|
||||
- `bigInt("-0").isZero()` => `true`
|
||||
- `bigInt(50).isZero()` => `false`
|
||||
|
||||
#### `leq(number)`
|
||||
|
||||
Alias for the `lesserOrEquals` method.
|
||||
|
||||
#### `lesser(number)`
|
||||
|
||||
Checks if the first number is lesser than the second.
|
||||
|
||||
- `bigInt(5).lesser(6)` => `true`
|
||||
- `bigInt(5).lesser(5)` => `false`
|
||||
- `bigInt(5).lesser(4)` => `false`
|
||||
|
||||
#### `lesserOrEquals(number)`
|
||||
|
||||
Checks if the first number is less than or equal to the second.
|
||||
|
||||
- `bigInt(5).lesserOrEquals(6)` => `true`
|
||||
- `bigInt(5).lesserOrEquals(5)` => `true`
|
||||
- `bigInt(5).lesserOrEquals(4)` => `false`
|
||||
|
||||
#### `lt(number)`
|
||||
|
||||
Alias for the `lesser` method.
|
||||
|
||||
#### `minus(number)`
|
||||
|
||||
Alias for the `subtract` method.
|
||||
|
||||
- `bigInt(3).minus(5)` => `-2`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Subtraction)
|
||||
|
||||
#### `mod(number)`
|
||||
|
||||
Performs division and returns the remainder, disregarding the quotient. The sign of the remainder will match the sign of the dividend.
|
||||
|
||||
- `bigInt(59).mod(5)` => `4`
|
||||
- `bigInt(-5).mod(2)` => `-1`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `modPow(exp, mod)`
|
||||
|
||||
Takes the number to the power `exp` modulo `mod`.
|
||||
|
||||
- `bigInt(10).modPow(3, 30)` => `10`
|
||||
|
||||
#### `multiply(number)`
|
||||
|
||||
Performs multiplication.
|
||||
|
||||
- `bigInt(111).multiply(111)` => `12321`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Multiplication)
|
||||
|
||||
#### `neq(number)`
|
||||
|
||||
Alias for the `notEquals` method.
|
||||
|
||||
#### `next()`
|
||||
|
||||
Adds one to the number.
|
||||
|
||||
- `bigInt(6).next()` => `7`
|
||||
|
||||
#### `not()`
|
||||
|
||||
Performs the bitwise NOT operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
|
||||
|
||||
- `bigInt(10).not()` => `-11`
|
||||
- `bigInt(0).not()` => `-1`
|
||||
|
||||
#### `notEquals(number)`
|
||||
|
||||
Checks if two numbers are not equal.
|
||||
|
||||
- `bigInt(5).notEquals(5)` => `false`
|
||||
- `bigInt(4).notEquals(7)` => `true`
|
||||
|
||||
#### `or(number)`
|
||||
|
||||
Performs the bitwise OR operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
|
||||
|
||||
- `bigInt(13).or(10)` => `15`
|
||||
- `bigInt(13).or(-8)` => `-3`
|
||||
|
||||
#### `over(number)`
|
||||
|
||||
Alias for the `divide` method.
|
||||
|
||||
- `bigInt(59).over(5)` => `11`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `plus(number)`
|
||||
|
||||
Alias for the `add` method.
|
||||
|
||||
- `bigInt(5).plus(7)` => `12`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Addition)
|
||||
|
||||
#### `pow(number)`
|
||||
|
||||
Performs exponentiation. If the exponent is less than `0`, `pow` returns `0`. `bigInt.zero.pow(0)` returns `1`.
|
||||
|
||||
- `bigInt(16).pow(16)` => `18446744073709551616`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Exponentiation)
|
||||
|
||||
#### `prev(number)`
|
||||
|
||||
Subtracts one from the number.
|
||||
|
||||
- `bigInt(6).prev()` => `5`
|
||||
|
||||
#### `remainder(number)`
|
||||
|
||||
Alias for the `mod` method.
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Division)
|
||||
|
||||
#### `shiftLeft(n)`
|
||||
|
||||
Shifts the number left by `n` places in its binary representation. If a negative number is provided, it will shift right. Throws an error if `n` is outside of the range `[-9007199254740992, 9007199254740992]`.
|
||||
|
||||
- `bigInt(8).shiftLeft(2)` => `32`
|
||||
- `bigInt(8).shiftLeft(-2)` => `2`
|
||||
|
||||
#### `shiftRight(n)`
|
||||
|
||||
Shifts the number right by `n` places in its binary representation. If a negative number is provided, it will shift left. Throws an error if `n` is outside of the range `[-9007199254740992, 9007199254740992]`.
|
||||
|
||||
- `bigInt(8).shiftRight(2)` => `2`
|
||||
- `bigInt(8).shiftRight(-2)` => `32`
|
||||
|
||||
#### `square()`
|
||||
|
||||
Squares the number
|
||||
|
||||
- `bigInt(3).square()` => `9`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Squaring)
|
||||
|
||||
#### `subtract(number)`
|
||||
|
||||
Performs subtraction.
|
||||
|
||||
- `bigInt(3).subtract(5)` => `-2`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Subtraction)
|
||||
|
||||
#### `times(number)`
|
||||
|
||||
Alias for the `multiply` method.
|
||||
|
||||
- `bigInt(111).times(111)` => `12321`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#Multiplication)
|
||||
|
||||
#### `toJSNumber()`
|
||||
|
||||
Converts a bigInt into a native Javascript number. Loses precision for numbers outside the range `[-9007199254740992, 9007199254740992]`.
|
||||
|
||||
- `bigInt("18446744073709551616").toJSNumber()` => `18446744073709552000`
|
||||
|
||||
#### `xor(number)`
|
||||
|
||||
Performs the bitwise XOR operation. The operands are treated as if they were represented using [two's complement representation](http://en.wikipedia.org/wiki/Two%27s_complement).
|
||||
|
||||
- `bigInt(12).xor(5)` => `9`
|
||||
- `bigInt(12).xor(-5)` => `-9`
|
||||
|
||||
### Static Methods
|
||||
|
||||
#### `gcd(a, b)`
|
||||
|
||||
Finds the greatest common denominator of `a` and `b`.
|
||||
|
||||
- `bigInt.gcd(42,56)` => `14`
|
||||
|
||||
#### `isInstance(x)`
|
||||
|
||||
Returns `true` if `x` is a BigInteger, `false` otherwise.
|
||||
|
||||
- `bigInt.isInstance(bigInt(14))` => `true`
|
||||
- `bigInt.isInstance(14)` => `false`
|
||||
|
||||
#### `lcm(a,b)`
|
||||
|
||||
Finds the least common multiple of `a` and `b`.
|
||||
|
||||
- `bigInt.lcm(21, 6)` => `42`
|
||||
|
||||
#### `max(a,b)`
|
||||
|
||||
Returns the largest of `a` and `b`.
|
||||
|
||||
- `bigInt.max(77, 432)` => `432`
|
||||
|
||||
#### `min(a,b)`
|
||||
|
||||
Returns the smallest of `a` and `b`.
|
||||
|
||||
- `bigInt.min(77, 432)` => `77`
|
||||
|
||||
#### `randBetween(min, max)`
|
||||
|
||||
Returns a random number between `min` and `max`.
|
||||
|
||||
- `bigInt.randBetween("-1e100", "1e100")` => (for example) `8494907165436643479673097939554427056789510374838494147955756275846226209006506706784609314471378745`
|
||||
|
||||
|
||||
### Override Methods
|
||||
|
||||
#### `toString(radix = 10)`
|
||||
|
||||
Converts a bigInt to a string. There is an optional radix parameter (which defaults to 10) that converts the number to the given radix. Digits in the range `10-35` will use the letters `a-z`.
|
||||
|
||||
- `bigInt("1e9").toString()` => `"1000000000"`
|
||||
- `bigInt("1e9").toString(16)` => `"3b9aca00"`
|
||||
|
||||
**Note that arithmetical operators will trigger the `valueOf` function rather than the `toString` function.** When converting a bigInteger to a string, you should use the `toString` method or the `String` function instead of adding the empty string.
|
||||
|
||||
- `bigInt("999999999999999999").toString()` => `"999999999999999999"`
|
||||
- `String(bigInt("999999999999999999"))` => `"999999999999999999"`
|
||||
- `bigInt("999999999999999999") + ""` => `1000000000000000000`
|
||||
|
||||
Bases larger than 36 are supported. If a digit is greater than or equal to 36, it will be enclosed in angle brackets.
|
||||
|
||||
- `bigInt(567890).toString(100)` => `"<56><78><90>"`
|
||||
|
||||
Negative bases are also supported.
|
||||
|
||||
- `bigInt(12345).toString(-10)` => `"28465"`
|
||||
|
||||
Base 1 and base -1 are also supported.
|
||||
|
||||
- `bigInt(-15).toString(1)` => `"-111111111111111"`
|
||||
- `bigInt(-15).toString(-1)` => `"101010101010101010101010101010"`
|
||||
|
||||
Base 0 is only allowed for the number zero.
|
||||
|
||||
- `bigInt(0).toString(0)` => `0`
|
||||
- `bigInt(1).toString(0)` => `Error: Cannot convert nonzero numbers to base 0.`
|
||||
|
||||
[View benchmarks for this method](http://peterolson.github.io/BigInteger.js/benchmark/#toString)
|
||||
|
||||
#### `valueOf()`
|
||||
|
||||
Converts a bigInt to a native Javascript number. This override allows you to use native arithmetic operators without explicit conversion:
|
||||
|
||||
- `bigInt("100") + bigInt("200") === 300; //true`
|
||||
|
||||
## Contributors
|
||||
|
||||
To contribute, just fork the project, make some changes, and submit a pull request. Please verify that the unit tests pass before submitting.
|
||||
|
||||
The unit tests are contained in the `spec/spec.js` file. You can run them locally by opening the `spec/SpecRunner.html` or file or running `npm test`. You can also [run the tests online from GitHub](http://peterolson.github.io/BigInteger.js/spec/SpecRunner.html).
|
||||
|
||||
There are performance benchmarks that can be viewed from the `benchmarks/index.html` page. You can [run them online from GitHub](http://peterolson.github.io/BigInteger.js/benchmark/).
|
||||
|
||||
## License
|
||||
|
||||
This project is public domain. For more details, read about the [Unlicense](http://unlicense.org/).
|
70
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/package.json
generated
vendored
Normal file
70
node_modules/cordova-common/node_modules/bplist-parser/node_modules/big-integer/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"name": "big-integer",
|
||||
"version": "1.6.10",
|
||||
"author": {
|
||||
"name": "Peter Olson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
},
|
||||
"description": "An arbitrary length integer library for Javascript",
|
||||
"contributors": [],
|
||||
"bin": {},
|
||||
"scripts": {
|
||||
"test": "karma start my.conf.js"
|
||||
},
|
||||
"main": "./BigInteger",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/peterolson/BigInteger.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"math",
|
||||
"big",
|
||||
"bignum",
|
||||
"bigint",
|
||||
"biginteger",
|
||||
"integer",
|
||||
"arbitrary",
|
||||
"precision",
|
||||
"arithmetic"
|
||||
],
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"jasmine": "2.1.x",
|
||||
"jasmine-core": "^2.3.4",
|
||||
"karma": "^0.13.3",
|
||||
"karma-coverage": "^0.4.2",
|
||||
"karma-jasmine": "^0.3.6",
|
||||
"karma-phantomjs-launcher": "~0.1"
|
||||
},
|
||||
"license": "Unlicense",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"gitHead": "e9a739fa1a15fe3da4eb302ea7072112ec91e318",
|
||||
"bugs": {
|
||||
"url": "https://github.com/peterolson/BigInteger.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/peterolson/BigInteger.js#readme",
|
||||
"_id": "big-integer@1.6.10",
|
||||
"_shasum": "0f05dcce24278bc33bd8eb9297f4858acacb1fea",
|
||||
"_from": "big-integer@>=1.6.7 <2.0.0",
|
||||
"_npmVersion": "2.9.1",
|
||||
"_nodeVersion": "0.12.3",
|
||||
"_npmUser": {
|
||||
"name": "peterolson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "peterolson",
|
||||
"email": "peter.e.c.olson+npm@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "0f05dcce24278bc33bd8eb9297f4858acacb1fea",
|
||||
"tarball": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.10.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.10.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/airplay.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/iTunes-small.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/int64.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/int64.bplist
generated
vendored
Normal file
Binary file not shown.
10
node_modules/cordova-common/node_modules/bplist-parser/test/int64.xml
generated
vendored
Normal file
10
node_modules/cordova-common/node_modules/bplist-parser/test/int64.xml
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>zero</key>
|
||||
<integer>0</integer>
|
||||
<key>int64item</key>
|
||||
<integer>12345678901234567890</integer>
|
||||
</dict>
|
||||
</plist>
|
159
node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js
generated
vendored
Normal file
159
node_modules/cordova-common/node_modules/bplist-parser/test/parseTest.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
|
||||
// tests are adapted from https://github.com/TooTallNate/node-plist
|
||||
|
||||
var path = require('path');
|
||||
var nodeunit = require('nodeunit');
|
||||
var bplist = require('../');
|
||||
|
||||
module.exports = {
|
||||
'iTunes Small': function (test) {
|
||||
var file = path.join(__dirname, "iTunes-small.bplist");
|
||||
var startTime1 = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime1) + 'ms');
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['Application Version'], "9.0.3");
|
||||
test.equal(dict['Library Persistent ID'], "6F81D37F95101437");
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'sample1': function (test) {
|
||||
var file = path.join(__dirname, "sample1.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['CFBundleIdentifier'], 'com.apple.dictionary.MySample');
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'sample2': function (test) {
|
||||
var file = path.join(__dirname, "sample2.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['PopupMenu'][2]['Key'], "\n #import <Cocoa/Cocoa.h>\n\n#import <MacRuby/MacRuby.h>\n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n");
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'airplay': function (test) {
|
||||
var file = path.join(__dirname, "airplay.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['duration'], 5555.0495000000001);
|
||||
test.equal(dict['position'], 4.6269989039999997);
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'utf16': function (test) {
|
||||
var file = path.join(__dirname, "utf16.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['CFBundleName'], 'sellStuff');
|
||||
test.equal(dict['CFBundleShortVersionString'], '2.6.1');
|
||||
test.equal(dict['NSHumanReadableCopyright'], '©2008-2012, sellStuff, Inc.');
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'utf16chinese': function (test) {
|
||||
var file = path.join(__dirname, "utf16_chinese.plist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['CFBundleName'], '天翼阅读');
|
||||
test.equal(dict['CFBundleDisplayName'], '天翼阅读');
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
'uid': function (test) {
|
||||
var file = path.join(__dirname, "uid.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
|
||||
var dict = dicts[0];
|
||||
test.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]);
|
||||
test.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]);
|
||||
test.deepEqual(dict['$top']['root'], {UID:1});
|
||||
test.done();
|
||||
});
|
||||
},
|
||||
|
||||
'int64': function (test) {
|
||||
var file = path.join(__dirname, "int64.bplist");
|
||||
var startTime = new Date();
|
||||
|
||||
bplist.parseFile(file, function (err, dicts) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
var endTime = new Date();
|
||||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
|
||||
var dict = dicts[0];
|
||||
test.equal(dict['zero'], '0');
|
||||
test.equal(dict['int64item'], '12345678901234567890');
|
||||
test.done();
|
||||
});
|
||||
}
|
||||
};
|
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/sample1.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/sample2.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/uid.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist
generated
vendored
Normal file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/utf16.bplist
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist
generated
vendored
Executable file
BIN
node_modules/cordova-common/node_modules/bplist-parser/test/utf16_chinese.plist
generated
vendored
Executable file
Binary file not shown.
11
node_modules/cordova-common/node_modules/cordova-registry-mapper/tests/test.js
generated
vendored
Normal file
11
node_modules/cordova-common/node_modules/cordova-registry-mapper/tests/test.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
var test = require('tape');
|
||||
var oldToNew = require('../index').oldToNew;
|
||||
var newToOld = require('../index').newToOld;
|
||||
|
||||
test('plugin mappings exist', function(t) {
|
||||
t.plan(2);
|
||||
|
||||
t.equal('cordova-plugin-device', oldToNew['org.apache.cordova.device']);
|
||||
|
||||
t.equal('org.apache.cordova.device', newToOld['cordova-plugin-device']);
|
||||
})
|
21
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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.
|
@ -0,0 +1,84 @@
|
||||
var test = require('tape');
|
||||
var balanced = require('..');
|
||||
|
||||
test('balanced', function(t) {
|
||||
t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), {
|
||||
start: 3,
|
||||
end: 12,
|
||||
pre: 'pre',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: '{{{{{{{{',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body{in}post'), {
|
||||
start: 8,
|
||||
end: 11,
|
||||
pre: 'pre{body',
|
||||
body: 'in',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), {
|
||||
start: 4,
|
||||
end: 13,
|
||||
pre: 'pre}',
|
||||
body: 'in{nest}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'body',
|
||||
post: 'between{body2}post'
|
||||
});
|
||||
t.notOk(balanced('{', '}', 'nope'), 'should be notOk');
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre<b>in<b>nest</b></b>post'), {
|
||||
start: 3,
|
||||
end: 19,
|
||||
pre: 'pre',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('<b>', '</b>', 'pre</b><b>in<b>nest</b></b>post'), {
|
||||
start: 7,
|
||||
end: 23,
|
||||
pre: 'pre</b>',
|
||||
body: 'in<b>nest</b>',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: '{in}',
|
||||
post: 'post'
|
||||
});
|
||||
t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), {
|
||||
start: 3,
|
||||
end: 8,
|
||||
pre: 'pre',
|
||||
body: 'in',
|
||||
post: '}post'
|
||||
});
|
||||
t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), {
|
||||
start: 4,
|
||||
end: 10,
|
||||
pre: 'pre{',
|
||||
body: 'first',
|
||||
post: 'in{second}post'
|
||||
});
|
||||
t.deepEqual(balanced('<?', '?>', 'pre<?>post'), {
|
||||
start: 3,
|
||||
end: 4,
|
||||
pre: 'pre',
|
||||
body: '',
|
||||
post: 'post'
|
||||
});
|
||||
t.end();
|
||||
});
|
@ -0,0 +1,6 @@
|
||||
var concatMap = require('../');
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
console.dir(ys);
|
39
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js
generated
vendored
Normal file
39
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
var concatMap = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('empty or not', function (t) {
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ixes = [];
|
||||
var ys = concatMap(xs, function (x, ix) {
|
||||
ixes.push(ix);
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
||||
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('always something', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('scalars', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('undefs', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function () {});
|
||||
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
||||
t.end();
|
||||
});
|
71
node_modules/cordova-common/node_modules/osenv/test/unix.js
generated
vendored
Normal file
71
node_modules/cordova-common/node_modules/osenv/test/unix.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
// only run this test on windows
|
||||
// pretending to be another platform is too hacky, since it breaks
|
||||
// how the underlying system looks up module paths and runs
|
||||
// child processes, and all that stuff is cached.
|
||||
if (process.platform === 'win32') {
|
||||
console.log('TAP Version 13\n' +
|
||||
'1..0\n' +
|
||||
'# Skip unix tests, this is not unix\n')
|
||||
return
|
||||
}
|
||||
var tap = require('tap')
|
||||
|
||||
// like unix, but funny
|
||||
process.env.USER = 'sirUser'
|
||||
process.env.HOME = '/home/sirUser'
|
||||
process.env.HOSTNAME = 'my-machine'
|
||||
process.env.TMPDIR = '/tmpdir'
|
||||
process.env.TMP = '/tmp'
|
||||
process.env.TEMP = '/temp'
|
||||
process.env.PATH = '/opt/local/bin:/usr/local/bin:/usr/bin/:bin'
|
||||
process.env.PS1 = '(o_o) $ '
|
||||
process.env.EDITOR = 'edit'
|
||||
process.env.VISUAL = 'visualedit'
|
||||
process.env.SHELL = 'zsh'
|
||||
|
||||
tap.test('basic unix sanity test', function (t) {
|
||||
var osenv = require('../osenv.js')
|
||||
|
||||
t.equal(osenv.user(), process.env.USER)
|
||||
t.equal(osenv.home(), process.env.HOME)
|
||||
t.equal(osenv.hostname(), process.env.HOSTNAME)
|
||||
t.same(osenv.path(), process.env.PATH.split(':'))
|
||||
t.equal(osenv.prompt(), process.env.PS1)
|
||||
t.equal(osenv.tmpdir(), process.env.TMPDIR)
|
||||
|
||||
// mildly evil, but it's for a test.
|
||||
process.env.TMPDIR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TMP)
|
||||
|
||||
process.env.TMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TEMP)
|
||||
|
||||
process.env.TEMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
osenv.home = function () { return null }
|
||||
t.equal(osenv.tmpdir(), '/tmp')
|
||||
|
||||
t.equal(osenv.editor(), 'edit')
|
||||
process.env.EDITOR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'visualedit')
|
||||
|
||||
process.env.VISUAL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'vi')
|
||||
|
||||
t.equal(osenv.shell(), 'zsh')
|
||||
process.env.SHELL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.shell(), 'bash')
|
||||
|
||||
t.end()
|
||||
})
|
74
node_modules/cordova-common/node_modules/osenv/test/windows.js
generated
vendored
Normal file
74
node_modules/cordova-common/node_modules/osenv/test/windows.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
// only run this test on windows
|
||||
// pretending to be another platform is too hacky, since it breaks
|
||||
// how the underlying system looks up module paths and runs
|
||||
// child processes, and all that stuff is cached.
|
||||
if (process.platform !== 'win32') {
|
||||
console.log('TAP version 13\n' +
|
||||
'1..0 # Skip windows tests, this is not windows\n')
|
||||
return
|
||||
}
|
||||
|
||||
// load this before clubbing the platform name.
|
||||
var tap = require('tap')
|
||||
|
||||
process.env.windir = 'c:\\windows'
|
||||
process.env.USERDOMAIN = 'some-domain'
|
||||
process.env.USERNAME = 'sirUser'
|
||||
process.env.USERPROFILE = 'C:\\Users\\sirUser'
|
||||
process.env.COMPUTERNAME = 'my-machine'
|
||||
process.env.TMPDIR = 'C:\\tmpdir'
|
||||
process.env.TMP = 'C:\\tmp'
|
||||
process.env.TEMP = 'C:\\temp'
|
||||
process.env.Path = 'C:\\Program Files\\;C:\\Binary Stuff\\bin'
|
||||
process.env.PROMPT = '(o_o) $ '
|
||||
process.env.EDITOR = 'edit'
|
||||
process.env.VISUAL = 'visualedit'
|
||||
process.env.ComSpec = 'some-com'
|
||||
|
||||
tap.test('basic windows sanity test', function (t) {
|
||||
var osenv = require('../osenv.js')
|
||||
|
||||
t.equal(osenv.user(),
|
||||
process.env.USERDOMAIN + '\\' + process.env.USERNAME)
|
||||
t.equal(osenv.home(), process.env.USERPROFILE)
|
||||
t.equal(osenv.hostname(), process.env.COMPUTERNAME)
|
||||
t.same(osenv.path(), process.env.Path.split(';'))
|
||||
t.equal(osenv.prompt(), process.env.PROMPT)
|
||||
t.equal(osenv.tmpdir(), process.env.TMPDIR)
|
||||
|
||||
// mildly evil, but it's for a test.
|
||||
process.env.TMPDIR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TMP)
|
||||
|
||||
process.env.TMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.tmpdir(), process.env.TEMP)
|
||||
|
||||
process.env.TEMP = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
osenv.home = function () { return null }
|
||||
t.equal(osenv.tmpdir(), 'c:\\windows\\temp')
|
||||
|
||||
t.equal(osenv.editor(), 'edit')
|
||||
process.env.EDITOR = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'visualedit')
|
||||
|
||||
process.env.VISUAL = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.editor(), 'notepad.exe')
|
||||
|
||||
t.equal(osenv.shell(), 'some-com')
|
||||
process.env.ComSpec = ''
|
||||
delete require.cache[require.resolve('../osenv.js')]
|
||||
var osenv = require('../osenv.js')
|
||||
t.equal(osenv.shell(), 'cmd')
|
||||
|
||||
t.end()
|
||||
})
|
18
node_modules/cordova-common/node_modules/plist/node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
18
node_modules/cordova-common/node_modules/plist/node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
var test = require('tape'),
|
||||
b64 = require('../lib/b64');
|
||||
|
||||
test('decode url-safe style base64 strings', function (t) {
|
||||
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff];
|
||||
|
||||
var actual = b64.toByteArray('//++/++/++//');
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
actual = b64.toByteArray('__--_--_--__');
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.end();
|
||||
});
|
133
node_modules/cordova-common/node_modules/semver/bin/semver
generated
vendored
Executable file
133
node_modules/cordova-common/node_modules/semver/bin/semver
generated
vendored
Executable file
@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
, versions = []
|
||||
, range = []
|
||||
, gt = []
|
||||
, lt = []
|
||||
, eq = []
|
||||
, inc = null
|
||||
, version = require("../package.json").version
|
||||
, loose = false
|
||||
, identifier = undefined
|
||||
, semver = require("../semver")
|
||||
, reverse = false
|
||||
|
||||
main()
|
||||
|
||||
function main () {
|
||||
if (!argv.length) return help()
|
||||
while (argv.length) {
|
||||
var a = argv.shift()
|
||||
var i = a.indexOf('=')
|
||||
if (i !== -1) {
|
||||
a = a.slice(0, i)
|
||||
argv.unshift(a.slice(i + 1))
|
||||
}
|
||||
switch (a) {
|
||||
case "-rv": case "-rev": case "--rev": case "--reverse":
|
||||
reverse = true
|
||||
break
|
||||
case "-l": case "--loose":
|
||||
loose = true
|
||||
break
|
||||
case "-v": case "--version":
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case "-i": case "--inc": case "--increment":
|
||||
switch (argv[0]) {
|
||||
case "major": case "minor": case "patch": case "prerelease":
|
||||
case "premajor": case "preminor": case "prepatch":
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = "patch"
|
||||
break
|
||||
}
|
||||
break
|
||||
case "--preid":
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case "-r": case "--range":
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case "-h": case "--help": case "-?":
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.valid(v, loose)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
if (inc && (versions.length !== 1 || range.length))
|
||||
return failInc()
|
||||
|
||||
for (var i = 0, l = range.length; i < l ; i ++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], loose)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
return success(versions)
|
||||
}
|
||||
|
||||
function failInc () {
|
||||
console.error("--inc can only be used on a single version with no range")
|
||||
fail()
|
||||
}
|
||||
|
||||
function fail () { process.exit(1) }
|
||||
|
||||
function success () {
|
||||
var compare = reverse ? "rcompare" : "compare"
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, loose)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, loose)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||
}).forEach(function (v,i,_) { console.log(v) })
|
||||
}
|
||||
|
||||
function help () {
|
||||
console.log(["SemVer " + version
|
||||
,""
|
||||
,"A JavaScript implementation of the http://semver.org/ specification"
|
||||
,"Copyright Isaac Z. Schlueter"
|
||||
,""
|
||||
,"Usage: semver [options] <version> [<version> [...]]"
|
||||
,"Prints valid versions sorted by SemVer precedence"
|
||||
,""
|
||||
,"Options:"
|
||||
,"-r --range <range>"
|
||||
," Print versions that match the specified range."
|
||||
,""
|
||||
,"-i --increment [<level>]"
|
||||
," Increment a version by the specified level. Level can"
|
||||
," be one of: major, minor, patch, premajor, preminor,"
|
||||
," prepatch, or prerelease. Default level is 'patch'."
|
||||
," Only one version may be specified."
|
||||
,""
|
||||
,"--preid <identifier>"
|
||||
," Identifier to be used to prefix premajor, preminor,"
|
||||
," prepatch or prerelease version increments."
|
||||
,""
|
||||
,"-l --loose"
|
||||
," Interpret versions and ranges loosely"
|
||||
,""
|
||||
,"Program exits successfully if any valid version satisfies"
|
||||
,"all supplied ranges, and prints all satisfying versions."
|
||||
,""
|
||||
,"If no satisfying versions are found, then exits failure."
|
||||
,""
|
||||
,"Versions are printed in ascending order, so supplying"
|
||||
,"multiple versions to the utility will just sort them."
|
||||
].join("\n"))
|
||||
}
|
16
node_modules/cordova-common/node_modules/semver/range.bnf
generated
vendored
Normal file
16
node_modules/cordova-common/node_modules/semver/range.bnf
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9']['0'-'9']+
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
31
node_modules/cordova-common/node_modules/semver/test/big-numbers.js
generated
vendored
Normal file
31
node_modules/cordova-common/node_modules/semver/test/big-numbers.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
var test = require('tap').test
|
||||
var semver = require('../')
|
||||
|
||||
test('long version is too long', function (t) {
|
||||
var v = '1.2.' + new Array(256).join('1')
|
||||
t.throws(function () {
|
||||
new semver.SemVer(v)
|
||||
})
|
||||
t.equal(semver.valid(v, false), null)
|
||||
t.equal(semver.valid(v, true), null)
|
||||
t.equal(semver.inc(v, 'patch'), null)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('big number is like too long version', function (t) {
|
||||
var v = '1.2.' + new Array(100).join('1')
|
||||
t.throws(function () {
|
||||
new semver.SemVer(v)
|
||||
})
|
||||
t.equal(semver.valid(v, false), null)
|
||||
t.equal(semver.valid(v, true), null)
|
||||
t.equal(semver.inc(v, 'patch'), null)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('parsing null does not throw', function (t) {
|
||||
t.equal(semver.parse(null), null)
|
||||
t.equal(semver.parse({}), null)
|
||||
t.equal(semver.parse(new semver.SemVer('1.2.3')).version, '1.2.3')
|
||||
t.end()
|
||||
})
|
29
node_modules/cordova-common/node_modules/semver/test/clean.js
generated
vendored
Normal file
29
node_modules/cordova-common/node_modules/semver/test/clean.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var clean = semver.clean;
|
||||
|
||||
test('\nclean tests', function(t) {
|
||||
// [range, version]
|
||||
// Version should be detectable despite extra characters
|
||||
[
|
||||
['1.2.3', '1.2.3'],
|
||||
[' 1.2.3 ', '1.2.3'],
|
||||
[' 1.2.3-4 ', '1.2.3-4'],
|
||||
[' 1.2.3-pre ', '1.2.3-pre'],
|
||||
[' =v1.2.3 ', '1.2.3'],
|
||||
['v1.2.3', '1.2.3'],
|
||||
[' v1.2.3 ', '1.2.3'],
|
||||
['\t1.2.3', '1.2.3'],
|
||||
['>1.2.3', null],
|
||||
['~1.2.3', null],
|
||||
['<=1.2.3', null],
|
||||
['1.2.x', null]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var msg = 'clean(' + range + ') = ' + version;
|
||||
t.equal(clean(range), version, msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
173
node_modules/cordova-common/node_modules/semver/test/gtr.js
generated
vendored
Normal file
173
node_modules/cordova-common/node_modules/semver/test/gtr.js
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var gtr = semver.gtr;
|
||||
|
||||
test('\ngtr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should be greater than range
|
||||
[
|
||||
['~1.2.2', '1.3.0'],
|
||||
['~0.6.1-1', '0.7.1-1'],
|
||||
['1.0.0 - 2.0.0', '2.0.1'],
|
||||
['1.0.0', '1.0.1-beta1'],
|
||||
['1.0.0', '2.0.0'],
|
||||
['<=2.0.0', '2.1.1'],
|
||||
['<=2.0.0', '3.2.9'],
|
||||
['<2.0.0', '2.0.0'],
|
||||
['0.1.20 || 1.2.4', '1.2.5'],
|
||||
['2.x.x', '3.0.0'],
|
||||
['1.2.x', '1.3.0'],
|
||||
['1.2.x || 2.x', '3.0.0'],
|
||||
['2.*.*', '5.0.1'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '4.0.0'],
|
||||
['2', '3.0.0'],
|
||||
['2.3', '2.4.2'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.5.5'],
|
||||
['~>3.2.1', '3.3.0'], // >=3.2.1 <3.3.0
|
||||
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.4'],
|
||||
['~> 1', '3.2.3'],
|
||||
['~1.0', '1.1.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '1.1.0'],
|
||||
['<1.2', '1.2.0'],
|
||||
['< 1.2', '1.2.1'],
|
||||
['1', '2.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.6.0'],
|
||||
['~v0.5.4-pre', '0.6.1-pre'],
|
||||
['=0.7.x', '0.8.0'],
|
||||
['=0.7.x', '0.8.0-asdf'],
|
||||
['<0.7.x', '0.7.0'],
|
||||
['~1.2.2', '1.3.0'],
|
||||
['1.0.0 - 2.0.0', '2.2.3'],
|
||||
['1.0.0', '1.0.1'],
|
||||
['<=2.0.0', '3.0.0'],
|
||||
['<=2.0.0', '2.9999.9999'],
|
||||
['<=2.0.0', '2.2.9'],
|
||||
['<2.0.0', '2.9999.9999'],
|
||||
['<2.0.0', '2.2.9'],
|
||||
['2.x.x', '3.1.3'],
|
||||
['1.2.x', '1.3.3'],
|
||||
['1.2.x || 2.x', '3.1.3'],
|
||||
['2.*.*', '3.1.3'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '3.1.3'],
|
||||
['2', '3.1.2'],
|
||||
['2.3', '2.4.1'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '2.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.3'],
|
||||
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
||||
['<1', '1.0.0'],
|
||||
['1', '2.0.0beta', true],
|
||||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['<0.7.x', '0.7.2']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'gtr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.ok(gtr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nnegative gtr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should NOT be greater than range
|
||||
[
|
||||
['~0.6.1-1', '0.6.1-1'],
|
||||
['1.0.0 - 2.0.0', '1.2.3'],
|
||||
['1.0.0 - 2.0.0', '0.9.9'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0', true],
|
||||
['*', '1.2.3'],
|
||||
['*', 'v1.2.3-foo'],
|
||||
['>=1.0.0', '1.0.0'],
|
||||
['>=1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '1.1.0'],
|
||||
['>1.0.0', '1.0.1'],
|
||||
['>1.0.0', '1.1.0'],
|
||||
['<=2.0.0', '2.0.0'],
|
||||
['<=2.0.0', '1.9999.9999'],
|
||||
['<=2.0.0', '0.2.9'],
|
||||
['<2.0.0', '1.9999.9999'],
|
||||
['<2.0.0', '0.2.9'],
|
||||
['>= 1.0.0', '1.0.0'],
|
||||
['>= 1.0.0', '1.0.1'],
|
||||
['>= 1.0.0', '1.1.0'],
|
||||
['> 1.0.0', '1.0.1'],
|
||||
['> 1.0.0', '1.1.0'],
|
||||
['<= 2.0.0', '2.0.0'],
|
||||
['<= 2.0.0', '1.9999.9999'],
|
||||
['<= 2.0.0', '0.2.9'],
|
||||
['< 2.0.0', '1.9999.9999'],
|
||||
['<\t2.0.0', '0.2.9'],
|
||||
['>=0.1.97', 'v0.1.97'],
|
||||
['>=0.1.97', '0.1.97'],
|
||||
['0.1.20 || 1.2.4', '1.2.4'],
|
||||
['0.1.20 || >1.2.4', '1.2.4'],
|
||||
['0.1.20 || 1.2.4', '1.2.3'],
|
||||
['0.1.20 || 1.2.4', '0.1.20'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.0'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.4'],
|
||||
['||', '1.3.4'],
|
||||
['2.x.x', '2.1.3'],
|
||||
['1.2.x', '1.2.3'],
|
||||
['1.2.x || 2.x', '2.1.3'],
|
||||
['1.2.x || 2.x', '1.2.3'],
|
||||
['x', '1.2.3'],
|
||||
['2.*.*', '2.1.3'],
|
||||
['1.2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '2.1.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['*', '1.2.3'],
|
||||
['2', '2.1.2'],
|
||||
['2.3', '2.3.1'],
|
||||
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.4.5'],
|
||||
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '1.2.3'],
|
||||
['~> 1', '1.2.3'],
|
||||
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '1.0.2'],
|
||||
['>=1', '1.0.0'],
|
||||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['1', '1.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['>=0.7.x', '0.7.2'],
|
||||
['=0.7.x', '0.7.0-asdf'],
|
||||
['>=0.7.x', '0.7.0-asdf'],
|
||||
['<=0.7.x', '0.6.2'],
|
||||
['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'],
|
||||
['>=0.2.3 <=0.2.4', '0.2.4'],
|
||||
['1.0.0 - 2.0.0', '2.0.0'],
|
||||
['^1', '0.0.0-0'],
|
||||
['^3.0.0', '2.0.0'],
|
||||
['^1.0.0 || ~2.0.1', '2.0.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
|
||||
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = '!gtr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.notOk(gtr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
698
node_modules/cordova-common/node_modules/semver/test/index.js
generated
vendored
Normal file
698
node_modules/cordova-common/node_modules/semver/test/index.js
generated
vendored
Normal file
@ -0,0 +1,698 @@
|
||||
'use strict';
|
||||
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var eq = semver.eq;
|
||||
var gt = semver.gt;
|
||||
var lt = semver.lt;
|
||||
var neq = semver.neq;
|
||||
var cmp = semver.cmp;
|
||||
var gte = semver.gte;
|
||||
var lte = semver.lte;
|
||||
var satisfies = semver.satisfies;
|
||||
var validRange = semver.validRange;
|
||||
var inc = semver.inc;
|
||||
var diff = semver.diff;
|
||||
var replaceStars = semver.replaceStars;
|
||||
var toComparators = semver.toComparators;
|
||||
var SemVer = semver.SemVer;
|
||||
var Range = semver.Range;
|
||||
|
||||
test('\ncomparison tests', function(t) {
|
||||
// [version1, version2]
|
||||
// version1 should be greater than version2
|
||||
[['0.0.0', '0.0.0-foo'],
|
||||
['0.0.1', '0.0.0'],
|
||||
['1.0.0', '0.9.9'],
|
||||
['0.10.0', '0.9.0'],
|
||||
['0.99.0', '0.10.0'],
|
||||
['2.0.0', '1.2.3'],
|
||||
['v0.0.0', '0.0.0-foo', true],
|
||||
['v0.0.1', '0.0.0', true],
|
||||
['v1.0.0', '0.9.9', true],
|
||||
['v0.10.0', '0.9.0', true],
|
||||
['v0.99.0', '0.10.0', true],
|
||||
['v2.0.0', '1.2.3', true],
|
||||
['0.0.0', 'v0.0.0-foo', true],
|
||||
['0.0.1', 'v0.0.0', true],
|
||||
['1.0.0', 'v0.9.9', true],
|
||||
['0.10.0', 'v0.9.0', true],
|
||||
['0.99.0', 'v0.10.0', true],
|
||||
['2.0.0', 'v1.2.3', true],
|
||||
['1.2.3', '1.2.3-asdf'],
|
||||
['1.2.3', '1.2.3-4'],
|
||||
['1.2.3', '1.2.3-4-foo'],
|
||||
['1.2.3-5-foo', '1.2.3-5'],
|
||||
['1.2.3-5', '1.2.3-4'],
|
||||
['1.2.3-5-foo', '1.2.3-5-Foo'],
|
||||
['3.0.0', '2.7.2+asdf'],
|
||||
['1.2.3-a.10', '1.2.3-a.5'],
|
||||
['1.2.3-a.b', '1.2.3-a.5'],
|
||||
['1.2.3-a.b', '1.2.3-a'],
|
||||
['1.2.3-a.b.c.10.d.5', '1.2.3-a.b.c.5.d.100'],
|
||||
['1.2.3-r2', '1.2.3-r100'],
|
||||
['1.2.3-r100', '1.2.3-R2']
|
||||
].forEach(function(v) {
|
||||
var v0 = v[0];
|
||||
var v1 = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(gt(v0, v1, loose), "gt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(lt(v1, v0, loose), "lt('" + v1 + "', '" + v0 + "')");
|
||||
t.ok(!gt(v1, v0, loose), "!gt('" + v1 + "', '" + v0 + "')");
|
||||
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(eq(v0, v0, loose), "eq('" + v0 + "', '" + v0 + "')");
|
||||
t.ok(eq(v1, v1, loose), "eq('" + v1 + "', '" + v1 + "')");
|
||||
t.ok(neq(v0, v1, loose), "neq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(cmp(v1, '==', v1, loose), "cmp('" + v1 + "' == '" + v1 + "')");
|
||||
t.ok(cmp(v0, '>=', v1, loose), "cmp('" + v0 + "' >= '" + v1 + "')");
|
||||
t.ok(cmp(v1, '<=', v0, loose), "cmp('" + v1 + "' <= '" + v0 + "')");
|
||||
t.ok(cmp(v0, '!=', v1, loose), "cmp('" + v0 + "' != '" + v1 + "')");
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nequality tests', function(t) {
|
||||
// [version1, version2]
|
||||
// version1 should be equivalent to version2
|
||||
[['1.2.3', 'v1.2.3', true],
|
||||
['1.2.3', '=1.2.3', true],
|
||||
['1.2.3', 'v 1.2.3', true],
|
||||
['1.2.3', '= 1.2.3', true],
|
||||
['1.2.3', ' v1.2.3', true],
|
||||
['1.2.3', ' =1.2.3', true],
|
||||
['1.2.3', ' v 1.2.3', true],
|
||||
['1.2.3', ' = 1.2.3', true],
|
||||
['1.2.3-0', 'v1.2.3-0', true],
|
||||
['1.2.3-0', '=1.2.3-0', true],
|
||||
['1.2.3-0', 'v 1.2.3-0', true],
|
||||
['1.2.3-0', '= 1.2.3-0', true],
|
||||
['1.2.3-0', ' v1.2.3-0', true],
|
||||
['1.2.3-0', ' =1.2.3-0', true],
|
||||
['1.2.3-0', ' v 1.2.3-0', true],
|
||||
['1.2.3-0', ' = 1.2.3-0', true],
|
||||
['1.2.3-1', 'v1.2.3-1', true],
|
||||
['1.2.3-1', '=1.2.3-1', true],
|
||||
['1.2.3-1', 'v 1.2.3-1', true],
|
||||
['1.2.3-1', '= 1.2.3-1', true],
|
||||
['1.2.3-1', ' v1.2.3-1', true],
|
||||
['1.2.3-1', ' =1.2.3-1', true],
|
||||
['1.2.3-1', ' v 1.2.3-1', true],
|
||||
['1.2.3-1', ' = 1.2.3-1', true],
|
||||
['1.2.3-beta', 'v1.2.3-beta', true],
|
||||
['1.2.3-beta', '=1.2.3-beta', true],
|
||||
['1.2.3-beta', 'v 1.2.3-beta', true],
|
||||
['1.2.3-beta', '= 1.2.3-beta', true],
|
||||
['1.2.3-beta', ' v1.2.3-beta', true],
|
||||
['1.2.3-beta', ' =1.2.3-beta', true],
|
||||
['1.2.3-beta', ' v 1.2.3-beta', true],
|
||||
['1.2.3-beta', ' = 1.2.3-beta', true],
|
||||
['1.2.3-beta+build', ' = 1.2.3-beta+otherbuild', true],
|
||||
['1.2.3+build', ' = 1.2.3+otherbuild', true],
|
||||
['1.2.3-beta+build', '1.2.3-beta+otherbuild'],
|
||||
['1.2.3+build', '1.2.3+otherbuild'],
|
||||
[' v1.2.3+build', '1.2.3+otherbuild']
|
||||
].forEach(function(v) {
|
||||
var v0 = v[0];
|
||||
var v1 = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(eq(v0, v1, loose), "eq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(!neq(v0, v1, loose), "!neq('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(cmp(v0, '==', v1, loose), 'cmp(' + v0 + '==' + v1 + ')');
|
||||
t.ok(!cmp(v0, '!=', v1, loose), '!cmp(' + v0 + '!=' + v1 + ')');
|
||||
t.ok(!cmp(v0, '===', v1, loose), '!cmp(' + v0 + '===' + v1 + ')');
|
||||
t.ok(cmp(v0, '!==', v1, loose), 'cmp(' + v0 + '!==' + v1 + ')');
|
||||
t.ok(!gt(v0, v1, loose), "!gt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(gte(v0, v1, loose), "gte('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(!lt(v0, v1, loose), "!lt('" + v0 + "', '" + v1 + "')");
|
||||
t.ok(lte(v0, v1, loose), "lte('" + v0 + "', '" + v1 + "')");
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('\nrange tests', function(t) {
|
||||
// [range, version]
|
||||
// version should be included by range
|
||||
[['1.0.0 - 2.0.0', '1.2.3'],
|
||||
['^1.2.3+build', '1.2.3'],
|
||||
['^1.2.3+build', '1.3.0'],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3'],
|
||||
['1.2.3pre+asdf - 2.4.3-pre+asdf', '1.2.3', true],
|
||||
['1.2.3-pre+asdf - 2.4.3pre+asdf', '1.2.3', true],
|
||||
['1.2.3pre+asdf - 2.4.3pre+asdf', '1.2.3', true],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '1.2.3-pre.2'],
|
||||
['1.2.3-pre+asdf - 2.4.3-pre+asdf', '2.4.3-alpha'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0'],
|
||||
['*', '1.2.3'],
|
||||
['*', 'v1.2.3', true],
|
||||
['>=1.0.0', '1.0.0'],
|
||||
['>=1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '1.1.0'],
|
||||
['>1.0.0', '1.0.1'],
|
||||
['>1.0.0', '1.1.0'],
|
||||
['<=2.0.0', '2.0.0'],
|
||||
['<=2.0.0', '1.9999.9999'],
|
||||
['<=2.0.0', '0.2.9'],
|
||||
['<2.0.0', '1.9999.9999'],
|
||||
['<2.0.0', '0.2.9'],
|
||||
['>= 1.0.0', '1.0.0'],
|
||||
['>= 1.0.0', '1.0.1'],
|
||||
['>= 1.0.0', '1.1.0'],
|
||||
['> 1.0.0', '1.0.1'],
|
||||
['> 1.0.0', '1.1.0'],
|
||||
['<= 2.0.0', '2.0.0'],
|
||||
['<= 2.0.0', '1.9999.9999'],
|
||||
['<= 2.0.0', '0.2.9'],
|
||||
['< 2.0.0', '1.9999.9999'],
|
||||
['<\t2.0.0', '0.2.9'],
|
||||
['>=0.1.97', 'v0.1.97', true],
|
||||
['>=0.1.97', '0.1.97'],
|
||||
['0.1.20 || 1.2.4', '1.2.4'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.0'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.4'],
|
||||
['||', '1.3.4'],
|
||||
['2.x.x', '2.1.3'],
|
||||
['1.2.x', '1.2.3'],
|
||||
['1.2.x || 2.x', '2.1.3'],
|
||||
['1.2.x || 2.x', '1.2.3'],
|
||||
['x', '1.2.3'],
|
||||
['2.*.*', '2.1.3'],
|
||||
['1.2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '2.1.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['*', '1.2.3'],
|
||||
['2', '2.1.2'],
|
||||
['2.3', '2.3.1'],
|
||||
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.4.5'],
|
||||
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0,
|
||||
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '1.2.3'],
|
||||
['~> 1', '1.2.3'],
|
||||
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0,
|
||||
['~ 1.0', '1.0.2'],
|
||||
['~ 1.0.3', '1.0.12'],
|
||||
['>=1', '1.0.0'],
|
||||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.7.2'],
|
||||
['>=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.6.2'],
|
||||
['~1.2.1 >=1.2.3', '1.2.3'],
|
||||
['~1.2.1 =1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3', '1.2.3'],
|
||||
['~1.2.1 >=1.2.3 1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3 >=1.2.3', '1.2.3'],
|
||||
['~1.2.1 1.2.3', '1.2.3'],
|
||||
['>=1.2.1 1.2.3', '1.2.3'],
|
||||
['1.2.3 >=1.2.1', '1.2.3'],
|
||||
['>=1.2.3 >=1.2.1', '1.2.3'],
|
||||
['>=1.2.1 >=1.2.3', '1.2.3'],
|
||||
['>=1.2', '1.2.8'],
|
||||
['^1.2.3', '1.8.1'],
|
||||
['^0.1.2', '0.1.2'],
|
||||
['^0.1', '0.1.2'],
|
||||
['^1.2', '1.4.2'],
|
||||
['^1.2 ^1', '1.4.2'],
|
||||
['^1.2.3-alpha', '1.2.3-pre'],
|
||||
['^1.2.0-alpha', '1.2.0-pre'],
|
||||
['^0.0.1-alpha', '0.0.1-beta']
|
||||
].forEach(function(v) {
|
||||
var range = v[0];
|
||||
var ver = v[1];
|
||||
var loose = v[2];
|
||||
t.ok(satisfies(ver, range, loose), range + ' satisfied by ' + ver);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nnegative range tests', function(t) {
|
||||
// [range, version]
|
||||
// version should not be included by range
|
||||
[['1.0.0 - 2.0.0', '2.2.3'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '1.2.3-pre.2'],
|
||||
['1.2.3+asdf - 2.4.3+asdf', '2.4.3-alpha'],
|
||||
['^1.2.3+build', '2.0.0'],
|
||||
['^1.2.3+build', '1.2.0'],
|
||||
['^1.2.3', '1.2.3-pre'],
|
||||
['^1.2', '1.2.0-pre'],
|
||||
['>1.2', '1.3.0-beta'],
|
||||
['<=1.2.3', '1.2.3-beta'],
|
||||
['^1.2.3', '1.2.3-beta'],
|
||||
['=0.7.x', '0.7.0-asdf'],
|
||||
['>=0.7.x', '0.7.0-asdf'],
|
||||
['1', '1.0.0beta', true],
|
||||
['<1', '1.0.0beta', true],
|
||||
['< 1', '1.0.0beta', true],
|
||||
['1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '0.0.0'],
|
||||
['>=1.0.0', '0.0.1'],
|
||||
['>=1.0.0', '0.1.0'],
|
||||
['>1.0.0', '0.0.1'],
|
||||
['>1.0.0', '0.1.0'],
|
||||
['<=2.0.0', '3.0.0'],
|
||||
['<=2.0.0', '2.9999.9999'],
|
||||
['<=2.0.0', '2.2.9'],
|
||||
['<2.0.0', '2.9999.9999'],
|
||||
['<2.0.0', '2.2.9'],
|
||||
['>=0.1.97', 'v0.1.93', true],
|
||||
['>=0.1.97', '0.1.93'],
|
||||
['0.1.20 || 1.2.4', '1.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.2'],
|
||||
['2.x.x', '1.1.3'],
|
||||
['2.x.x', '3.1.3'],
|
||||
['1.2.x', '1.3.3'],
|
||||
['1.2.x || 2.x', '3.1.3'],
|
||||
['1.2.x || 2.x', '1.1.3'],
|
||||
['2.*.*', '1.1.3'],
|
||||
['2.*.*', '3.1.3'],
|
||||
['1.2.*', '1.3.3'],
|
||||
['1.2.* || 2.*', '3.1.3'],
|
||||
['1.2.* || 2.*', '1.1.3'],
|
||||
['2', '1.1.2'],
|
||||
['2.3', '2.4.1'],
|
||||
['~2.4', '2.5.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.3.9'],
|
||||
['~>3.2.1', '3.3.2'], // >=3.2.1 <3.3.0
|
||||
['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0
|
||||
['~1', '0.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '2.2.3'],
|
||||
['~1.0', '1.1.0'], // >=1.0.0 <1.1.0
|
||||
['<1', '1.0.0'],
|
||||
['>=1.2', '1.1.1'],
|
||||
['1', '2.0.0beta', true],
|
||||
['~v0.5.4-beta', '0.5.4-alpha'],
|
||||
['=0.7.x', '0.8.2'],
|
||||
['>=0.7.x', '0.6.2'],
|
||||
['<0.7.x', '0.7.2'],
|
||||
['<1.2.3', '1.2.3-beta'],
|
||||
['=1.2.3', '1.2.3-beta'],
|
||||
['>1.2', '1.2.8'],
|
||||
['^1.2.3', '2.0.0-alpha'],
|
||||
['^1.2.3', '1.2.2'],
|
||||
['^1.2', '1.1.9'],
|
||||
['*', 'v1.2.3-foo', true],
|
||||
// invalid ranges never satisfied!
|
||||
['blerg', '1.2.3'],
|
||||
['git+https://user:password0123@github.com/foo', '123.0.0', true],
|
||||
['^1.2.3', '2.0.0-pre']
|
||||
].forEach(function(v) {
|
||||
var range = v[0];
|
||||
var ver = v[1];
|
||||
var loose = v[2];
|
||||
var found = satisfies(ver, range, loose);
|
||||
t.ok(!found, ver + ' not satisfied by ' + range);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nincrement versions test', function(t) {
|
||||
// [version, inc, result, identifier]
|
||||
// inc(version, inc) -> result
|
||||
[['1.2.3', 'major', '2.0.0'],
|
||||
['1.2.3', 'minor', '1.3.0'],
|
||||
['1.2.3', 'patch', '1.2.4'],
|
||||
['1.2.3tag', 'major', '2.0.0', true],
|
||||
['1.2.3-tag', 'major', '2.0.0'],
|
||||
['1.2.3', 'fake', null],
|
||||
['1.2.0-0', 'patch', '1.2.0'],
|
||||
['fake', 'major', null],
|
||||
['1.2.3-4', 'major', '2.0.0'],
|
||||
['1.2.3-4', 'minor', '1.3.0'],
|
||||
['1.2.3-4', 'patch', '1.2.3'],
|
||||
['1.2.3-alpha.0.beta', 'major', '2.0.0'],
|
||||
['1.2.3-alpha.0.beta', 'minor', '1.3.0'],
|
||||
['1.2.3-alpha.0.beta', 'patch', '1.2.3'],
|
||||
['1.2.4', 'prerelease', '1.2.5-0'],
|
||||
['1.2.3-0', 'prerelease', '1.2.3-1'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'],
|
||||
['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'],
|
||||
['1.2.3-alpha.2', 'prerelease', '1.2.3-alpha.3'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta'],
|
||||
['1.2.3-alpha.1.beta', 'prerelease', '1.2.3-alpha.2.beta'],
|
||||
['1.2.3-alpha.2.beta', 'prerelease', '1.2.3-alpha.3.beta'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta'],
|
||||
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta'],
|
||||
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1'],
|
||||
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2'],
|
||||
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'],
|
||||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'],
|
||||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'],
|
||||
['1.2.0', 'prepatch', '1.2.1-0'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-0'],
|
||||
['1.2.0', 'preminor', '1.3.0-0'],
|
||||
['1.2.3-1', 'preminor', '1.3.0-0'],
|
||||
['1.2.0', 'premajor', '2.0.0-0'],
|
||||
['1.2.3-1', 'premajor', '2.0.0-0'],
|
||||
['1.2.0-1', 'minor', '1.2.0'],
|
||||
['1.0.0-1', 'major', '1.0.0'],
|
||||
|
||||
['1.2.3', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3', 'patch', '1.2.4', false, 'dev'],
|
||||
['1.2.3tag', 'major', '2.0.0', true, 'dev'],
|
||||
['1.2.3-tag', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3', 'fake', null, false, 'dev'],
|
||||
['1.2.0-0', 'patch', '1.2.0', false, 'dev'],
|
||||
['fake', 'major', null, false, 'dev'],
|
||||
['1.2.3-4', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-4', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-4', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'major', '2.0.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'minor', '1.3.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'patch', '1.2.3', false, 'dev'],
|
||||
['1.2.4', 'prerelease', '1.2.5-dev.0', false, 'dev'],
|
||||
['1.2.3-0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1', false, 'alpha'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.0.beta', 'prerelease', '1.2.3-alpha.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.0.beta', 'prerelease', '1.2.3-alpha.10.1.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.1.beta', 'prerelease', '1.2.3-alpha.10.2.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.2.beta', 'prerelease', '1.2.3-alpha.10.3.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.10.beta.0', 'prerelease', '1.2.3-alpha.10.beta.1', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.1', 'prerelease', '1.2.3-alpha.10.beta.2', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3', false, 'alpha'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-dev.0', false, 'dev'],
|
||||
['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta', false, 'alpha'],
|
||||
['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta', false, 'alpha'],
|
||||
['1.2.0', 'prepatch', '1.2.1-dev.0', false, 'dev'],
|
||||
['1.2.0-1', 'prepatch', '1.2.1-dev.0', false, 'dev'],
|
||||
['1.2.0', 'preminor', '1.3.0-dev.0', false, 'dev'],
|
||||
['1.2.3-1', 'preminor', '1.3.0-dev.0', false, 'dev'],
|
||||
['1.2.0', 'premajor', '2.0.0-dev.0', false, 'dev'],
|
||||
['1.2.3-1', 'premajor', '2.0.0-dev.0', false, 'dev'],
|
||||
['1.2.0-1', 'minor', '1.2.0', false, 'dev'],
|
||||
['1.0.0-1', 'major', '1.0.0', false, 'dev'],
|
||||
['1.2.3-dev.bar', 'prerelease', '1.2.3-dev.0', false, 'dev']
|
||||
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var what = v[1];
|
||||
var wanted = v[2];
|
||||
var loose = v[3];
|
||||
var id = v[4];
|
||||
var found = inc(pre, what, loose, id);
|
||||
var cmd = 'inc(' + pre + ', ' + what + ', ' + id + ')';
|
||||
t.equal(found, wanted, cmd + ' === ' + wanted);
|
||||
|
||||
var parsed = semver.parse(pre, loose);
|
||||
if (wanted) {
|
||||
parsed.inc(what, id);
|
||||
t.equal(parsed.version, wanted, cmd + ' object version updated');
|
||||
t.equal(parsed.raw, wanted, cmd + ' object raw field updated');
|
||||
} else if (parsed) {
|
||||
t.throws(function () {
|
||||
parsed.inc(what, id)
|
||||
})
|
||||
} else {
|
||||
t.equal(parsed, null)
|
||||
}
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ndiff versions test', function(t) {
|
||||
// [version1, version2, result]
|
||||
// diff(version1, version2) -> result
|
||||
[['1.2.3', '0.2.3', 'major'],
|
||||
['1.4.5', '0.2.3', 'major'],
|
||||
['1.2.3', '2.0.0-pre', 'premajor'],
|
||||
['1.2.3', '1.3.3', 'minor'],
|
||||
['1.0.1', '1.1.0-pre', 'preminor'],
|
||||
['1.2.3', '1.2.4', 'patch'],
|
||||
['1.2.3', '1.2.4-pre', 'prepatch'],
|
||||
['0.0.1', '0.0.1-pre', 'prerelease'],
|
||||
['0.0.1', '0.0.1-pre-2', 'prerelease'],
|
||||
['1.1.0', '1.1.0-pre', 'prerelease'],
|
||||
['1.1.0-pre-1', '1.1.0-pre-2', 'prerelease'],
|
||||
['1.0.0', '1.0.0', null]
|
||||
|
||||
].forEach(function(v) {
|
||||
var version1 = v[0];
|
||||
var version2 = v[1];
|
||||
var wanted = v[2];
|
||||
var found = diff(version1, version2);
|
||||
var cmd = 'diff(' + version1 + ', ' + version2 + ')';
|
||||
t.equal(found, wanted, cmd + ' === ' + wanted);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nvalid range test', function(t) {
|
||||
// [range, result]
|
||||
// validRange(range) -> result
|
||||
// translate ranges into their canonical form
|
||||
[['1.0.0 - 2.0.0', '>=1.0.0 <=2.0.0'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '*'],
|
||||
['', '*'],
|
||||
['*', '*'],
|
||||
['*', '*'],
|
||||
['>=1.0.0', '>=1.0.0'],
|
||||
['>1.0.0', '>1.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['1', '>=1.0.0 <2.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['<=2.0.0', '<=2.0.0'],
|
||||
['<2.0.0', '<2.0.0'],
|
||||
['<2.0.0', '<2.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['>= 1.0.0', '>=1.0.0'],
|
||||
['> 1.0.0', '>1.0.0'],
|
||||
['> 1.0.0', '>1.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['<= 2.0.0', '<=2.0.0'],
|
||||
['< 2.0.0', '<2.0.0'],
|
||||
['< 2.0.0', '<2.0.0'],
|
||||
['>=0.1.97', '>=0.1.97'],
|
||||
['>=0.1.97', '>=0.1.97'],
|
||||
['0.1.20 || 1.2.4', '0.1.20||1.2.4'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['>=0.2.3 || <0.0.1', '>=0.2.3||<0.0.1'],
|
||||
['||', '||'],
|
||||
['2.x.x', '>=2.0.0 <3.0.0'],
|
||||
['1.2.x', '>=1.2.0 <1.3.0'],
|
||||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['1.2.x || 2.x', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['x', '*'],
|
||||
['2.*.*', '>=2.0.0 <3.0.0'],
|
||||
['1.2.*', '>=1.2.0 <1.3.0'],
|
||||
['1.2.* || 2.*', '>=1.2.0 <1.3.0||>=2.0.0 <3.0.0'],
|
||||
['*', '*'],
|
||||
['2', '>=2.0.0 <3.0.0'],
|
||||
['2.3', '>=2.3.0 <2.4.0'],
|
||||
['~2.4', '>=2.4.0 <2.5.0'],
|
||||
['~2.4', '>=2.4.0 <2.5.0'],
|
||||
['~>3.2.1', '>=3.2.1 <3.3.0'],
|
||||
['~1', '>=1.0.0 <2.0.0'],
|
||||
['~>1', '>=1.0.0 <2.0.0'],
|
||||
['~> 1', '>=1.0.0 <2.0.0'],
|
||||
['~1.0', '>=1.0.0 <1.1.0'],
|
||||
['~ 1.0', '>=1.0.0 <1.1.0'],
|
||||
['^0', '>=0.0.0 <1.0.0'],
|
||||
['^ 1', '>=1.0.0 <2.0.0'],
|
||||
['^0.1', '>=0.1.0 <0.2.0'],
|
||||
['^1.0', '>=1.0.0 <2.0.0'],
|
||||
['^1.2', '>=1.2.0 <2.0.0'],
|
||||
['^0.0.1', '>=0.0.1 <0.0.2'],
|
||||
['^0.0.1-beta', '>=0.0.1-beta <0.0.2'],
|
||||
['^0.1.2', '>=0.1.2 <0.2.0'],
|
||||
['^1.2.3', '>=1.2.3 <2.0.0'],
|
||||
['^1.2.3-beta.4', '>=1.2.3-beta.4 <2.0.0'],
|
||||
['<1', '<1.0.0'],
|
||||
['< 1', '<1.0.0'],
|
||||
['>=1', '>=1.0.0'],
|
||||
['>= 1', '>=1.0.0'],
|
||||
['<1.2', '<1.2.0'],
|
||||
['< 1.2', '<1.2.0'],
|
||||
['1', '>=1.0.0 <2.0.0'],
|
||||
['>01.02.03', '>1.2.3', true],
|
||||
['>01.02.03', null],
|
||||
['~1.2.3beta', '>=1.2.3-beta <1.3.0', true],
|
||||
['~1.2.3beta', null],
|
||||
['^ 1.2 ^ 1', '>=1.2.0 <2.0.0 >=1.0.0 <2.0.0']
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
var loose = v[2];
|
||||
var found = validRange(pre, loose);
|
||||
|
||||
t.equal(found, wanted, 'validRange(' + pre + ') === ' + wanted);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ncomparators test', function(t) {
|
||||
// [range, comparators]
|
||||
// turn range into a set of individual comparators
|
||||
[['1.0.0 - 2.0.0', [['>=1.0.0', '<=2.0.0']]],
|
||||
['1.0.0', [['1.0.0']]],
|
||||
['>=*', [['']]],
|
||||
['', [['']]],
|
||||
['*', [['']]],
|
||||
['*', [['']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>=1.0.0', [['>=1.0.0']]],
|
||||
['>1.0.0', [['>1.0.0']]],
|
||||
['>1.0.0', [['>1.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['1', [['>=1.0.0', '<2.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['<=2.0.0', [['<=2.0.0']]],
|
||||
['<2.0.0', [['<2.0.0']]],
|
||||
['<2.0.0', [['<2.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['>= 1.0.0', [['>=1.0.0']]],
|
||||
['> 1.0.0', [['>1.0.0']]],
|
||||
['> 1.0.0', [['>1.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['<= 2.0.0', [['<=2.0.0']]],
|
||||
['< 2.0.0', [['<2.0.0']]],
|
||||
['<\t2.0.0', [['<2.0.0']]],
|
||||
['>=0.1.97', [['>=0.1.97']]],
|
||||
['>=0.1.97', [['>=0.1.97']]],
|
||||
['0.1.20 || 1.2.4', [['0.1.20'], ['1.2.4']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['>=0.2.3 || <0.0.1', [['>=0.2.3'], ['<0.0.1']]],
|
||||
['||', [[''], ['']]],
|
||||
['2.x.x', [['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.x', [['>=1.2.0', '<1.3.0']]],
|
||||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.x || 2.x', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['x', [['']]],
|
||||
['2.*.*', [['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.*', [['>=1.2.0', '<1.3.0']]],
|
||||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['1.2.* || 2.*', [['>=1.2.0', '<1.3.0'], ['>=2.0.0', '<3.0.0']]],
|
||||
['*', [['']]],
|
||||
['2', [['>=2.0.0', '<3.0.0']]],
|
||||
['2.3', [['>=2.3.0', '<2.4.0']]],
|
||||
['~2.4', [['>=2.4.0', '<2.5.0']]],
|
||||
['~2.4', [['>=2.4.0', '<2.5.0']]],
|
||||
['~>3.2.1', [['>=3.2.1', '<3.3.0']]],
|
||||
['~1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~>1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~> 1', [['>=1.0.0', '<2.0.0']]],
|
||||
['~1.0', [['>=1.0.0', '<1.1.0']]],
|
||||
['~ 1.0', [['>=1.0.0', '<1.1.0']]],
|
||||
['~ 1.0.3', [['>=1.0.3', '<1.1.0']]],
|
||||
['~> 1.0.3', [['>=1.0.3', '<1.1.0']]],
|
||||
['<1', [['<1.0.0']]],
|
||||
['< 1', [['<1.0.0']]],
|
||||
['>=1', [['>=1.0.0']]],
|
||||
['>= 1', [['>=1.0.0']]],
|
||||
['<1.2', [['<1.2.0']]],
|
||||
['< 1.2', [['<1.2.0']]],
|
||||
['1', [['>=1.0.0', '<2.0.0']]],
|
||||
['1 2', [['>=1.0.0', '<2.0.0', '>=2.0.0', '<3.0.0']]],
|
||||
['1.2 - 3.4.5', [['>=1.2.0', '<=3.4.5']]],
|
||||
['1.2.3 - 3.4', [['>=1.2.3', '<3.5.0']]],
|
||||
['1.2.3 - 3', [['>=1.2.3', '<4.0.0']]],
|
||||
['>*', [['<0.0.0']]],
|
||||
['<*', [['<0.0.0']]]
|
||||
].forEach(function(v) {
|
||||
var pre = v[0];
|
||||
var wanted = v[1];
|
||||
var found = toComparators(v[0]);
|
||||
var jw = JSON.stringify(wanted);
|
||||
t.equivalent(found, wanted, 'toComparators(' + pre + ') === ' + jw);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\ninvalid version numbers', function(t) {
|
||||
['1.2.3.4',
|
||||
'NOT VALID',
|
||||
1.2,
|
||||
null,
|
||||
'Infinity.NaN.Infinity'
|
||||
].forEach(function(v) {
|
||||
t.throws(function() {
|
||||
new SemVer(v);
|
||||
}, {name:'TypeError', message:'Invalid Version: ' + v});
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nstrict vs loose version numbers', function(t) {
|
||||
[['=1.2.3', '1.2.3'],
|
||||
['01.02.03', '1.2.3'],
|
||||
['1.2.3-beta.01', '1.2.3-beta.1'],
|
||||
[' =1.2.3', '1.2.3'],
|
||||
['1.2.3foo', '1.2.3-foo']
|
||||
].forEach(function(v) {
|
||||
var loose = v[0];
|
||||
var strict = v[1];
|
||||
t.throws(function() {
|
||||
new SemVer(loose);
|
||||
});
|
||||
var lv = new SemVer(loose, true);
|
||||
t.equal(lv.version, strict);
|
||||
t.ok(eq(loose, strict, true));
|
||||
t.throws(function() {
|
||||
eq(loose, strict);
|
||||
});
|
||||
t.throws(function() {
|
||||
new SemVer(strict).compare(loose);
|
||||
});
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nstrict vs loose ranges', function(t) {
|
||||
[['>=01.02.03', '>=1.2.3'],
|
||||
['~1.02.03beta', '>=1.2.3-beta <1.3.0']
|
||||
].forEach(function(v) {
|
||||
var loose = v[0];
|
||||
var comps = v[1];
|
||||
t.throws(function() {
|
||||
new Range(loose);
|
||||
});
|
||||
t.equal(new Range(loose, true).range, comps);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nmax satisfying', function(t) {
|
||||
[[['1.2.3', '1.2.4'], '1.2', '1.2.4'],
|
||||
[['1.2.4', '1.2.3'], '1.2', '1.2.4'],
|
||||
[['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~1.2.3', '1.2.6'],
|
||||
[['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', '2.0.0b3', '2.0.0', '2.1.0'], '~2.0.0', '2.0.0', true]
|
||||
].forEach(function(v) {
|
||||
var versions = v[0];
|
||||
var range = v[1];
|
||||
var expect = v[2];
|
||||
var loose = v[3];
|
||||
var actual = semver.maxSatisfying(versions, range, loose);
|
||||
t.equal(actual, expect);
|
||||
});
|
||||
t.end();
|
||||
});
|
181
node_modules/cordova-common/node_modules/semver/test/ltr.js
generated
vendored
Normal file
181
node_modules/cordova-common/node_modules/semver/test/ltr.js
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
var ltr = semver.ltr;
|
||||
|
||||
test('\nltr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should be less than range
|
||||
[
|
||||
['~1.2.2', '1.2.1'],
|
||||
['~0.6.1-1', '0.6.1-0'],
|
||||
['1.0.0 - 2.0.0', '0.0.1'],
|
||||
['1.0.0-beta.2', '1.0.0-beta.1'],
|
||||
['1.0.0', '0.0.0'],
|
||||
['>=2.0.0', '1.1.1'],
|
||||
['>=2.0.0', '1.2.9'],
|
||||
['>2.0.0', '2.0.0'],
|
||||
['0.1.20 || 1.2.4', '0.1.5'],
|
||||
['2.x.x', '1.0.0'],
|
||||
['1.2.x', '1.1.0'],
|
||||
['1.2.x || 2.x', '1.0.0'],
|
||||
['2.*.*', '1.0.1'],
|
||||
['1.2.*', '1.1.3'],
|
||||
['1.2.* || 2.*', '1.1.9999'],
|
||||
['2', '1.0.0'],
|
||||
['2.3', '2.2.2'],
|
||||
['~2.4', '2.3.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.3.5'],
|
||||
['~>3.2.1', '3.2.0'], // >=3.2.1 <3.3.0
|
||||
['~1', '0.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '0.2.4'],
|
||||
['~> 1', '0.2.3'],
|
||||
['~1.0', '0.1.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '0.1.0'],
|
||||
['>1.2', '1.2.0'],
|
||||
['> 1.2', '1.2.1'],
|
||||
['1', '0.0.0beta', true],
|
||||
['~v0.5.4-pre', '0.5.4-alpha'],
|
||||
['~v0.5.4-pre', '0.5.4-alpha'],
|
||||
['=0.7.x', '0.6.0'],
|
||||
['=0.7.x', '0.6.0-asdf'],
|
||||
['>=0.7.x', '0.6.0'],
|
||||
['~1.2.2', '1.2.1'],
|
||||
['1.0.0 - 2.0.0', '0.2.3'],
|
||||
['1.0.0', '0.0.1'],
|
||||
['>=2.0.0', '1.0.0'],
|
||||
['>=2.0.0', '1.9999.9999'],
|
||||
['>=2.0.0', '1.2.9'],
|
||||
['>2.0.0', '2.0.0'],
|
||||
['>2.0.0', '1.2.9'],
|
||||
['2.x.x', '1.1.3'],
|
||||
['1.2.x', '1.1.3'],
|
||||
['1.2.x || 2.x', '1.1.3'],
|
||||
['2.*.*', '1.1.3'],
|
||||
['1.2.*', '1.1.3'],
|
||||
['1.2.* || 2.*', '1.1.3'],
|
||||
['2', '1.9999.9999'],
|
||||
['2.3', '2.2.1'],
|
||||
['~2.4', '2.3.0'], // >=2.4.0 <2.5.0
|
||||
['~>3.2.1', '2.3.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '0.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '0.2.3'],
|
||||
['~1.0', '0.0.0'], // >=1.0.0 <1.1.0
|
||||
['>1', '1.0.0'],
|
||||
['2', '1.0.0beta', true],
|
||||
['>1', '1.0.0beta', true],
|
||||
['> 1', '1.0.0beta', true],
|
||||
['=0.7.x', '0.6.2'],
|
||||
['=0.7.x', '0.7.0-asdf'],
|
||||
['^1', '1.0.0-0'],
|
||||
['>=0.7.x', '0.7.0-asdf'],
|
||||
['1', '1.0.0beta', true],
|
||||
['>=0.7.x', '0.6.2'],
|
||||
['>1.2.3', '1.3.0-alpha']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'ltr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.ok(ltr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nnegative ltr tests', function(t) {
|
||||
// [range, version, loose]
|
||||
// Version should NOT be less than range
|
||||
[
|
||||
['~ 1.0', '1.1.0'],
|
||||
['~0.6.1-1', '0.6.1-1'],
|
||||
['1.0.0 - 2.0.0', '1.2.3'],
|
||||
['1.0.0 - 2.0.0', '2.9.9'],
|
||||
['1.0.0', '1.0.0'],
|
||||
['>=*', '0.2.4'],
|
||||
['', '1.0.0', true],
|
||||
['*', '1.2.3'],
|
||||
['>=1.0.0', '1.0.0'],
|
||||
['>=1.0.0', '1.0.1'],
|
||||
['>=1.0.0', '1.1.0'],
|
||||
['>1.0.0', '1.0.1'],
|
||||
['>1.0.0', '1.1.0'],
|
||||
['<=2.0.0', '2.0.0'],
|
||||
['<=2.0.0', '1.9999.9999'],
|
||||
['<=2.0.0', '0.2.9'],
|
||||
['<2.0.0', '1.9999.9999'],
|
||||
['<2.0.0', '0.2.9'],
|
||||
['>= 1.0.0', '1.0.0'],
|
||||
['>= 1.0.0', '1.0.1'],
|
||||
['>= 1.0.0', '1.1.0'],
|
||||
['> 1.0.0', '1.0.1'],
|
||||
['> 1.0.0', '1.1.0'],
|
||||
['<= 2.0.0', '2.0.0'],
|
||||
['<= 2.0.0', '1.9999.9999'],
|
||||
['<= 2.0.0', '0.2.9'],
|
||||
['< 2.0.0', '1.9999.9999'],
|
||||
['<\t2.0.0', '0.2.9'],
|
||||
['>=0.1.97', 'v0.1.97'],
|
||||
['>=0.1.97', '0.1.97'],
|
||||
['0.1.20 || 1.2.4', '1.2.4'],
|
||||
['0.1.20 || >1.2.4', '1.2.4'],
|
||||
['0.1.20 || 1.2.4', '1.2.3'],
|
||||
['0.1.20 || 1.2.4', '0.1.20'],
|
||||
['>=0.2.3 || <0.0.1', '0.0.0'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.3'],
|
||||
['>=0.2.3 || <0.0.1', '0.2.4'],
|
||||
['||', '1.3.4'],
|
||||
['2.x.x', '2.1.3'],
|
||||
['1.2.x', '1.2.3'],
|
||||
['1.2.x || 2.x', '2.1.3'],
|
||||
['1.2.x || 2.x', '1.2.3'],
|
||||
['x', '1.2.3'],
|
||||
['2.*.*', '2.1.3'],
|
||||
['1.2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '2.1.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['1.2.* || 2.*', '1.2.3'],
|
||||
['*', '1.2.3'],
|
||||
['2', '2.1.2'],
|
||||
['2.3', '2.3.1'],
|
||||
['~2.4', '2.4.0'], // >=2.4.0 <2.5.0
|
||||
['~2.4', '2.4.5'],
|
||||
['~>3.2.1', '3.2.2'], // >=3.2.1 <3.3.0
|
||||
['~1', '1.2.3'], // >=1.0.0 <2.0.0
|
||||
['~>1', '1.2.3'],
|
||||
['~> 1', '1.2.3'],
|
||||
['~1.0', '1.0.2'], // >=1.0.0 <1.1.0
|
||||
['~ 1.0', '1.0.2'],
|
||||
['>=1', '1.0.0'],
|
||||
['>= 1', '1.0.0'],
|
||||
['<1.2', '1.1.1'],
|
||||
['< 1.2', '1.1.1'],
|
||||
['~v0.5.4-pre', '0.5.5'],
|
||||
['~v0.5.4-pre', '0.5.4'],
|
||||
['=0.7.x', '0.7.2'],
|
||||
['>=0.7.x', '0.7.2'],
|
||||
['<=0.7.x', '0.6.2'],
|
||||
['>0.2.3 >0.2.4 <=0.2.5', '0.2.5'],
|
||||
['>=0.2.3 <=0.2.4', '0.2.4'],
|
||||
['1.0.0 - 2.0.0', '2.0.0'],
|
||||
['^3.0.0', '4.0.0'],
|
||||
['^1.0.0 || ~2.0.1', '2.0.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
|
||||
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
|
||||
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'],
|
||||
['^1.0.0alpha', '1.0.0beta', true],
|
||||
['~1.0.0alpha', '1.0.0beta', true],
|
||||
['^1.0.0-alpha', '1.0.0beta', true],
|
||||
['~1.0.0-alpha', '1.0.0beta', true],
|
||||
['^1.0.0-alpha', '1.0.0-beta'],
|
||||
['~1.0.0-alpha', '1.0.0-beta'],
|
||||
['=0.1.0', '1.0.0']
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = '!ltr(' + version + ', ' + range + ', ' + loose + ')';
|
||||
t.notOk(ltr(version, range, loose), msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
72
node_modules/cordova-common/node_modules/semver/test/major-minor-patch.js
generated
vendored
Normal file
72
node_modules/cordova-common/node_modules/semver/test/major-minor-patch.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
var tap = require('tap');
|
||||
var test = tap.test;
|
||||
var semver = require('../semver.js');
|
||||
|
||||
test('\nmajor tests', function(t) {
|
||||
// [range, version]
|
||||
// Version should be detectable despite extra characters
|
||||
[
|
||||
['1.2.3', 1],
|
||||
[' 1.2.3 ', 1],
|
||||
[' 2.2.3-4 ', 2],
|
||||
[' 3.2.3-pre ', 3],
|
||||
['v5.2.3', 5],
|
||||
[' v8.2.3 ', 8],
|
||||
['\t13.2.3', 13],
|
||||
['=21.2.3', 21, true],
|
||||
['v=34.2.3', 34, true]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'major(' + range + ') = ' + version;
|
||||
t.equal(semver.major(range, loose), version, msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\nminor tests', function(t) {
|
||||
// [range, version]
|
||||
// Version should be detectable despite extra characters
|
||||
[
|
||||
['1.1.3', 1],
|
||||
[' 1.1.3 ', 1],
|
||||
[' 1.2.3-4 ', 2],
|
||||
[' 1.3.3-pre ', 3],
|
||||
['v1.5.3', 5],
|
||||
[' v1.8.3 ', 8],
|
||||
['\t1.13.3', 13],
|
||||
['=1.21.3', 21, true],
|
||||
['v=1.34.3', 34, true]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'minor(' + range + ') = ' + version;
|
||||
t.equal(semver.minor(range, loose), version, msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('\npatch tests', function(t) {
|
||||
// [range, version]
|
||||
// Version should be detectable despite extra characters
|
||||
[
|
||||
['1.2.1', 1],
|
||||
[' 1.2.1 ', 1],
|
||||
[' 1.2.2-4 ', 2],
|
||||
[' 1.2.3-pre ', 3],
|
||||
['v1.2.5', 5],
|
||||
[' v1.2.8 ', 8],
|
||||
['\t1.2.13', 13],
|
||||
['=1.2.21', 21, true],
|
||||
['v=1.2.34', 34, true]
|
||||
].forEach(function(tuple) {
|
||||
var range = tuple[0];
|
||||
var version = tuple[1];
|
||||
var loose = tuple[2] || false;
|
||||
var msg = 'patch(' + range + ') = ' + version;
|
||||
t.equal(semver.patch(range, loose), version, msg);
|
||||
});
|
||||
t.end();
|
||||
});
|
8002
node_modules/elementtree/node_modules/sax/examples/big-not-pretty.xml
generated
vendored
Normal file
8002
node_modules/elementtree/node_modules/sax/examples/big-not-pretty.xml
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
node_modules/elementtree/node_modules/sax/examples/example.js
generated
vendored
Normal file
41
node_modules/elementtree/node_modules/sax/examples/example.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
var fs = require("fs"),
|
||||
sys = require("sys"),
|
||||
path = require("path"),
|
||||
xml = fs.cat(path.join(__dirname, "test.xml")),
|
||||
sax = require("../lib/sax"),
|
||||
strict = sax.parser(true),
|
||||
loose = sax.parser(false, {trim:true}),
|
||||
inspector = function (ev) { return function (data) {
|
||||
// sys.error("");
|
||||
// sys.error(ev+": "+sys.inspect(data));
|
||||
// for (var i in data) sys.error(i+ " "+sys.inspect(data[i]));
|
||||
// sys.error(this.line+":"+this.column);
|
||||
}};
|
||||
|
||||
xml.addCallback(function (xml) {
|
||||
// strict.write(xml);
|
||||
|
||||
sax.EVENTS.forEach(function (ev) {
|
||||
loose["on"+ev] = inspector(ev);
|
||||
});
|
||||
loose.onend = function () {
|
||||
// sys.error("end");
|
||||
// sys.error(sys.inspect(loose));
|
||||
};
|
||||
|
||||
// do this one char at a time to verify that it works.
|
||||
// (function () {
|
||||
// if (xml) {
|
||||
// loose.write(xml.substr(0,1000));
|
||||
// xml = xml.substr(1000);
|
||||
// process.nextTick(arguments.callee);
|
||||
// } else loose.close();
|
||||
// })();
|
||||
|
||||
for (var i = 0; i < 1000; i ++) {
|
||||
loose.write(xml);
|
||||
loose.close();
|
||||
}
|
||||
|
||||
});
|
58
node_modules/elementtree/node_modules/sax/examples/get-products.js
generated
vendored
Normal file
58
node_modules/elementtree/node_modules/sax/examples/get-products.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
// pull out /GeneralSearchResponse/categories/category/items/product tags
|
||||
// the rest we don't care about.
|
||||
|
||||
var sax = require("../lib/sax.js")
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var xmlFile = path.resolve(__dirname, "shopping.xml")
|
||||
var util = require("util")
|
||||
var http = require("http")
|
||||
|
||||
fs.readFile(xmlFile, function (er, d) {
|
||||
http.createServer(function (req, res) {
|
||||
if (er) throw er
|
||||
var xmlstr = d.toString("utf8")
|
||||
|
||||
var parser = sax.parser(true)
|
||||
var products = []
|
||||
var product = null
|
||||
var currentTag = null
|
||||
|
||||
parser.onclosetag = function (tagName) {
|
||||
if (tagName === "product") {
|
||||
products.push(product)
|
||||
currentTag = product = null
|
||||
return
|
||||
}
|
||||
if (currentTag && currentTag.parent) {
|
||||
var p = currentTag.parent
|
||||
delete currentTag.parent
|
||||
currentTag = p
|
||||
}
|
||||
}
|
||||
|
||||
parser.onopentag = function (tag) {
|
||||
if (tag.name !== "product" && !product) return
|
||||
if (tag.name === "product") {
|
||||
product = tag
|
||||
}
|
||||
tag.parent = currentTag
|
||||
tag.children = []
|
||||
tag.parent && tag.parent.children.push(tag)
|
||||
currentTag = tag
|
||||
}
|
||||
|
||||
parser.ontext = function (text) {
|
||||
if (currentTag) currentTag.children.push(text)
|
||||
}
|
||||
|
||||
parser.onend = function () {
|
||||
var out = util.inspect(products, false, 3, true)
|
||||
res.writeHead(200, {"content-type":"application/json"})
|
||||
res.end("{\"ok\":true}")
|
||||
// res.end(JSON.stringify(products))
|
||||
}
|
||||
|
||||
parser.write(xmlstr).end()
|
||||
}).listen(1337)
|
||||
})
|
4
node_modules/elementtree/node_modules/sax/examples/hello-world.js
generated
vendored
Normal file
4
node_modules/elementtree/node_modules/sax/examples/hello-world.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
require("http").createServer(function (req, res) {
|
||||
res.writeHead(200, {"content-type":"application/json"})
|
||||
res.end(JSON.stringify({ok: true}))
|
||||
}).listen(1337)
|
8
node_modules/elementtree/node_modules/sax/examples/not-pretty.xml
generated
vendored
Normal file
8
node_modules/elementtree/node_modules/sax/examples/not-pretty.xml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<root>
|
||||
something<else> blerm <slurm
|
||||
|
||||
|
||||
attrib =
|
||||
"blorg" ></else><!-- COMMENT!
|
||||
|
||||
--><![CDATA[processing...]]> <selfclosing tag="blr>""/> a bit down here</root>
|
74
node_modules/elementtree/node_modules/sax/examples/pretty-print.js
generated
vendored
Normal file
74
node_modules/elementtree/node_modules/sax/examples/pretty-print.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
var sax = require("../lib/sax")
|
||||
, printer = sax.createStream(false, {lowercasetags:true, trim:true})
|
||||
, fs = require("fs")
|
||||
|
||||
function entity (str) {
|
||||
return str.replace('"', '"')
|
||||
}
|
||||
|
||||
printer.tabstop = 2
|
||||
printer.level = 0
|
||||
printer.indent = function () {
|
||||
print("\n")
|
||||
for (var i = this.level; i > 0; i --) {
|
||||
for (var j = this.tabstop; j > 0; j --) {
|
||||
print(" ")
|
||||
}
|
||||
}
|
||||
}
|
||||
printer.on("opentag", function (tag) {
|
||||
this.indent()
|
||||
this.level ++
|
||||
print("<"+tag.name)
|
||||
for (var i in tag.attributes) {
|
||||
print(" "+i+"=\""+entity(tag.attributes[i])+"\"")
|
||||
}
|
||||
print(">")
|
||||
})
|
||||
|
||||
printer.on("text", ontext)
|
||||
printer.on("doctype", ontext)
|
||||
function ontext (text) {
|
||||
this.indent()
|
||||
print(text)
|
||||
}
|
||||
|
||||
printer.on("closetag", function (tag) {
|
||||
this.level --
|
||||
this.indent()
|
||||
print("</"+tag+">")
|
||||
})
|
||||
|
||||
printer.on("cdata", function (data) {
|
||||
this.indent()
|
||||
print("<![CDATA["+data+"]]>")
|
||||
})
|
||||
|
||||
printer.on("comment", function (comment) {
|
||||
this.indent()
|
||||
print("<!--"+comment+"-->")
|
||||
})
|
||||
|
||||
printer.on("error", function (error) {
|
||||
console.error(error)
|
||||
throw error
|
||||
})
|
||||
|
||||
if (!process.argv[2]) {
|
||||
throw new Error("Please provide an xml file to prettify\n"+
|
||||
"TODO: read from stdin or take a file")
|
||||
}
|
||||
var xmlfile = require("path").join(process.cwd(), process.argv[2])
|
||||
var fstr = fs.createReadStream(xmlfile, { encoding: "utf8" })
|
||||
|
||||
function print (c) {
|
||||
if (!process.stdout.write(c)) {
|
||||
fstr.pause()
|
||||
}
|
||||
}
|
||||
|
||||
process.stdout.on("drain", function () {
|
||||
fstr.resume()
|
||||
})
|
||||
|
||||
fstr.pipe(printer)
|
2
node_modules/elementtree/node_modules/sax/examples/shopping.xml
generated
vendored
Normal file
2
node_modules/elementtree/node_modules/sax/examples/shopping.xml
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
870
node_modules/elementtree/node_modules/sax/examples/strict.dtd
generated
vendored
Normal file
870
node_modules/elementtree/node_modules/sax/examples/strict.dtd
generated
vendored
Normal file
@ -0,0 +1,870 @@
|
||||
<!--
|
||||
This is HTML 4.01 Strict DTD, which excludes the presentation
|
||||
attributes and elements that W3C expects to phase out as
|
||||
support for style sheets matures. Authors should use the Strict
|
||||
DTD when possible, but may use the Transitional DTD when support
|
||||
for presentation attribute and elements is required.
|
||||
|
||||
HTML 4 includes mechanisms for style sheets, scripting,
|
||||
embedding objects, improved support for right to left and mixed
|
||||
direction text, and enhancements to forms for improved
|
||||
accessibility for people with disabilities.
|
||||
|
||||
Draft: $Date: 1999/12/24 23:37:48 $
|
||||
|
||||
Authors:
|
||||
Dave Raggett <dsr@w3.org>
|
||||
Arnaud Le Hors <lehors@w3.org>
|
||||
Ian Jacobs <ij@w3.org>
|
||||
|
||||
Further information about HTML 4.01 is available at:
|
||||
|
||||
http://www.w3.org/TR/1999/REC-html401-19991224
|
||||
|
||||
|
||||
The HTML 4.01 specification includes additional
|
||||
syntactic constraints that cannot be expressed within
|
||||
the DTDs.
|
||||
|
||||
-->
|
||||
<!--
|
||||
Typical usage:
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
...
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
</body>
|
||||
</html>
|
||||
|
||||
The URI used as a system identifier with the public identifier allows
|
||||
the user agent to download the DTD and entity sets as needed.
|
||||
|
||||
The FPI for the Transitional HTML 4.01 DTD is:
|
||||
|
||||
"-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
|
||||
This version of the transitional DTD is:
|
||||
|
||||
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd
|
||||
|
||||
If you are writing a document that includes frames, use
|
||||
the following FPI:
|
||||
|
||||
"-//W3C//DTD HTML 4.01 Frameset//EN"
|
||||
|
||||
This version of the frameset DTD is:
|
||||
|
||||
http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd
|
||||
|
||||
Use the following (relative) URIs to refer to
|
||||
the DTDs and entity definitions of this specification:
|
||||
|
||||
"strict.dtd"
|
||||
"loose.dtd"
|
||||
"frameset.dtd"
|
||||
"HTMLlat1.ent"
|
||||
"HTMLsymbol.ent"
|
||||
"HTMLspecial.ent"
|
||||
|
||||
-->
|
||||
|
||||
<!--================== Imported Names ====================================-->
|
||||
<!-- Feature Switch for frameset documents -->
|
||||
<!ENTITY % HTML.Frameset "IGNORE">
|
||||
|
||||
<!ENTITY % ContentType "CDATA"
|
||||
-- media type, as per [RFC2045]
|
||||
-->
|
||||
|
||||
<!ENTITY % ContentTypes "CDATA"
|
||||
-- comma-separated list of media types, as per [RFC2045]
|
||||
-->
|
||||
|
||||
<!ENTITY % Charset "CDATA"
|
||||
-- a character encoding, as per [RFC2045]
|
||||
-->
|
||||
|
||||
<!ENTITY % Charsets "CDATA"
|
||||
-- a space-separated list of character encodings, as per [RFC2045]
|
||||
-->
|
||||
|
||||
<!ENTITY % LanguageCode "NAME"
|
||||
-- a language code, as per [RFC1766]
|
||||
-->
|
||||
|
||||
<!ENTITY % Character "CDATA"
|
||||
-- a single character from [ISO10646]
|
||||
-->
|
||||
|
||||
<!ENTITY % LinkTypes "CDATA"
|
||||
-- space-separated list of link types
|
||||
-->
|
||||
|
||||
<!ENTITY % MediaDesc "CDATA"
|
||||
-- single or comma-separated list of media descriptors
|
||||
-->
|
||||
|
||||
<!ENTITY % URI "CDATA"
|
||||
-- a Uniform Resource Identifier,
|
||||
see [URI]
|
||||
-->
|
||||
|
||||
<!ENTITY % Datetime "CDATA" -- date and time information. ISO date format -->
|
||||
|
||||
|
||||
<!ENTITY % Script "CDATA" -- script expression -->
|
||||
|
||||
<!ENTITY % StyleSheet "CDATA" -- style sheet data -->
|
||||
|
||||
|
||||
|
||||
<!ENTITY % Text "CDATA">
|
||||
|
||||
|
||||
<!-- Parameter Entities -->
|
||||
|
||||
<!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT" -- repeatable head elements -->
|
||||
|
||||
<!ENTITY % heading "H1|H2|H3|H4|H5|H6">
|
||||
|
||||
<!ENTITY % list "UL | OL">
|
||||
|
||||
<!ENTITY % preformatted "PRE">
|
||||
|
||||
|
||||
<!--================ Character mnemonic entities =========================-->
|
||||
|
||||
<!ENTITY % HTMLlat1 PUBLIC
|
||||
"-//W3C//ENTITIES Latin1//EN//HTML"
|
||||
"HTMLlat1.ent">
|
||||
%HTMLlat1;
|
||||
|
||||
<!ENTITY % HTMLsymbol PUBLIC
|
||||
"-//W3C//ENTITIES Symbols//EN//HTML"
|
||||
"HTMLsymbol.ent">
|
||||
%HTMLsymbol;
|
||||
|
||||
<!ENTITY % HTMLspecial PUBLIC
|
||||
"-//W3C//ENTITIES Special//EN//HTML"
|
||||
"HTMLspecial.ent">
|
||||
%HTMLspecial;
|
||||
<!--=================== Generic Attributes ===============================-->
|
||||
|
||||
<!ENTITY % coreattrs
|
||||
"id ID #IMPLIED -- document-wide unique id --
|
||||
class CDATA #IMPLIED -- space-separated list of classes --
|
||||
style %StyleSheet; #IMPLIED -- associated style info --
|
||||
title %Text; #IMPLIED -- advisory title --"
|
||||
>
|
||||
|
||||
<!ENTITY % i18n
|
||||
"lang %LanguageCode; #IMPLIED -- language code --
|
||||
dir (ltr|rtl) #IMPLIED -- direction for weak/neutral text --"
|
||||
>
|
||||
|
||||
<!ENTITY % events
|
||||
"onclick %Script; #IMPLIED -- a pointer button was clicked --
|
||||
ondblclick %Script; #IMPLIED -- a pointer button was double clicked--
|
||||
onmousedown %Script; #IMPLIED -- a pointer button was pressed down --
|
||||
onmouseup %Script; #IMPLIED -- a pointer button was released --
|
||||
onmouseover %Script; #IMPLIED -- a pointer was moved onto --
|
||||
onmousemove %Script; #IMPLIED -- a pointer was moved within --
|
||||
onmouseout %Script; #IMPLIED -- a pointer was moved away --
|
||||
onkeypress %Script; #IMPLIED -- a key was pressed and released --
|
||||
onkeydown %Script; #IMPLIED -- a key was pressed down --
|
||||
onkeyup %Script; #IMPLIED -- a key was released --"
|
||||
>
|
||||
|
||||
<!-- Reserved Feature Switch -->
|
||||
<!ENTITY % HTML.Reserved "IGNORE">
|
||||
|
||||
<!-- The following attributes are reserved for possible future use -->
|
||||
<![ %HTML.Reserved; [
|
||||
<!ENTITY % reserved
|
||||
"datasrc %URI; #IMPLIED -- a single or tabular Data Source --
|
||||
datafld CDATA #IMPLIED -- the property or column name --
|
||||
dataformatas (plaintext|html) plaintext -- text or html --"
|
||||
>
|
||||
]]>
|
||||
|
||||
<!ENTITY % reserved "">
|
||||
|
||||
<!ENTITY % attrs "%coreattrs; %i18n; %events;">
|
||||
|
||||
|
||||
<!--=================== Text Markup ======================================-->
|
||||
|
||||
<!ENTITY % fontstyle
|
||||
"TT | I | B | BIG | SMALL">
|
||||
|
||||
<!ENTITY % phrase "EM | STRONG | DFN | CODE |
|
||||
SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
|
||||
|
||||
<!ENTITY % special
|
||||
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
|
||||
|
||||
<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">
|
||||
|
||||
<!-- %inline; covers inline or "text-level" elements -->
|
||||
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
|
||||
|
||||
<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*>
|
||||
<!ATTLIST (%fontstyle;|%phrase;)
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!ELEMENT (SUB|SUP) - - (%inline;)* -- subscript, superscript -->
|
||||
<!ATTLIST (SUB|SUP)
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!ELEMENT SPAN - - (%inline;)* -- generic language/style container -->
|
||||
<!ATTLIST SPAN
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!ELEMENT BDO - - (%inline;)* -- I18N BiDi over-ride -->
|
||||
<!ATTLIST BDO
|
||||
%coreattrs; -- id, class, style, title --
|
||||
lang %LanguageCode; #IMPLIED -- language code --
|
||||
dir (ltr|rtl) #REQUIRED -- directionality --
|
||||
>
|
||||
|
||||
|
||||
<!ELEMENT BR - O EMPTY -- forced line break -->
|
||||
<!ATTLIST BR
|
||||
%coreattrs; -- id, class, style, title --
|
||||
>
|
||||
|
||||
<!--================== HTML content models ===============================-->
|
||||
|
||||
<!--
|
||||
HTML has two basic content models:
|
||||
|
||||
%inline; character level elements and text strings
|
||||
%block; block-like elements e.g. paragraphs and lists
|
||||
-->
|
||||
|
||||
<!ENTITY % block
|
||||
"P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
|
||||
BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
|
||||
|
||||
<!ENTITY % flow "%block; | %inline;">
|
||||
|
||||
<!--=================== Document Body ====================================-->
|
||||
|
||||
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
|
||||
<!ATTLIST BODY
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
onload %Script; #IMPLIED -- the document has been loaded --
|
||||
onunload %Script; #IMPLIED -- the document has been removed --
|
||||
>
|
||||
|
||||
<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
|
||||
<!ATTLIST ADDRESS
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!ELEMENT DIV - - (%flow;)* -- generic language/style container -->
|
||||
<!ATTLIST DIV
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
|
||||
<!--================== The Anchor Element ================================-->
|
||||
|
||||
<!ENTITY % Shape "(rect|circle|poly|default)">
|
||||
<!ENTITY % Coords "CDATA" -- comma-separated list of lengths -->
|
||||
|
||||
<!ELEMENT A - - (%inline;)* -(A) -- anchor -->
|
||||
<!ATTLIST A
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
||||
type %ContentType; #IMPLIED -- advisory content type --
|
||||
name CDATA #IMPLIED -- named link end --
|
||||
href %URI; #IMPLIED -- URI for linked resource --
|
||||
hreflang %LanguageCode; #IMPLIED -- language code --
|
||||
rel %LinkTypes; #IMPLIED -- forward link types --
|
||||
rev %LinkTypes; #IMPLIED -- reverse link types --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
shape %Shape; rect -- for use with client-side image maps --
|
||||
coords %Coords; #IMPLIED -- for use with client-side image maps --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
>
|
||||
|
||||
<!--================== Client-side image maps ============================-->
|
||||
|
||||
<!-- These can be placed in the same document or grouped in a
|
||||
separate document although this isn't yet widely supported -->
|
||||
|
||||
<!ELEMENT MAP - - ((%block;) | AREA)+ -- client-side image map -->
|
||||
<!ATTLIST MAP
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
name CDATA #REQUIRED -- for reference by usemap --
|
||||
>
|
||||
|
||||
<!ELEMENT AREA - O EMPTY -- client-side image map area -->
|
||||
<!ATTLIST AREA
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
shape %Shape; rect -- controls interpretation of coords --
|
||||
coords %Coords; #IMPLIED -- comma-separated list of lengths --
|
||||
href %URI; #IMPLIED -- URI for linked resource --
|
||||
nohref (nohref) #IMPLIED -- this region has no action --
|
||||
alt %Text; #REQUIRED -- short description --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
>
|
||||
|
||||
<!--================== The LINK Element ==================================-->
|
||||
|
||||
<!--
|
||||
Relationship values can be used in principle:
|
||||
|
||||
a) for document specific toolbars/menus when used
|
||||
with the LINK element in document head e.g.
|
||||
start, contents, previous, next, index, end, help
|
||||
b) to link to a separate style sheet (rel=stylesheet)
|
||||
c) to make a link to a script (rel=script)
|
||||
d) by stylesheets to control how collections of
|
||||
html nodes are rendered into printed documents
|
||||
e) to make a link to a printable version of this document
|
||||
e.g. a postscript or pdf version (rel=alternate media=print)
|
||||
-->
|
||||
|
||||
<!ELEMENT LINK - O EMPTY -- a media-independent link -->
|
||||
<!ATTLIST LINK
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
||||
href %URI; #IMPLIED -- URI for linked resource --
|
||||
hreflang %LanguageCode; #IMPLIED -- language code --
|
||||
type %ContentType; #IMPLIED -- advisory content type --
|
||||
rel %LinkTypes; #IMPLIED -- forward link types --
|
||||
rev %LinkTypes; #IMPLIED -- reverse link types --
|
||||
media %MediaDesc; #IMPLIED -- for rendering on these media --
|
||||
>
|
||||
|
||||
<!--=================== Images ===========================================-->
|
||||
|
||||
<!-- Length defined in strict DTD for cellpadding/cellspacing -->
|
||||
<!ENTITY % Length "CDATA" -- nn for pixels or nn% for percentage length -->
|
||||
<!ENTITY % MultiLength "CDATA" -- pixel, percentage, or relative -->
|
||||
|
||||
<![ %HTML.Frameset; [
|
||||
<!ENTITY % MultiLengths "CDATA" -- comma-separated list of MultiLength -->
|
||||
]]>
|
||||
|
||||
<!ENTITY % Pixels "CDATA" -- integer representing length in pixels -->
|
||||
|
||||
|
||||
<!-- To avoid problems with text-only UAs as well as
|
||||
to make image content understandable and navigable
|
||||
to users of non-visual UAs, you need to provide
|
||||
a description with ALT, and avoid server-side image maps -->
|
||||
<!ELEMENT IMG - O EMPTY -- Embedded image -->
|
||||
<!ATTLIST IMG
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
src %URI; #REQUIRED -- URI of image to embed --
|
||||
alt %Text; #REQUIRED -- short description --
|
||||
longdesc %URI; #IMPLIED -- link to long description
|
||||
(complements alt) --
|
||||
name CDATA #IMPLIED -- name of image for scripting --
|
||||
height %Length; #IMPLIED -- override height --
|
||||
width %Length; #IMPLIED -- override width --
|
||||
usemap %URI; #IMPLIED -- use client-side image map --
|
||||
ismap (ismap) #IMPLIED -- use server-side image map --
|
||||
>
|
||||
|
||||
<!-- USEMAP points to a MAP element which may be in this document
|
||||
or an external document, although the latter is not widely supported -->
|
||||
|
||||
<!--==================== OBJECT ======================================-->
|
||||
<!--
|
||||
OBJECT is used to embed objects as part of HTML pages
|
||||
PARAM elements should precede other content. SGML mixed content
|
||||
model technicality precludes specifying this formally ...
|
||||
-->
|
||||
|
||||
<!ELEMENT OBJECT - - (PARAM | %flow;)*
|
||||
-- generic embedded object -->
|
||||
<!ATTLIST OBJECT
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
declare (declare) #IMPLIED -- declare but don't instantiate flag --
|
||||
classid %URI; #IMPLIED -- identifies an implementation --
|
||||
codebase %URI; #IMPLIED -- base URI for classid, data, archive--
|
||||
data %URI; #IMPLIED -- reference to object's data --
|
||||
type %ContentType; #IMPLIED -- content type for data --
|
||||
codetype %ContentType; #IMPLIED -- content type for code --
|
||||
archive CDATA #IMPLIED -- space-separated list of URIs --
|
||||
standby %Text; #IMPLIED -- message to show while loading --
|
||||
height %Length; #IMPLIED -- override height --
|
||||
width %Length; #IMPLIED -- override width --
|
||||
usemap %URI; #IMPLIED -- use client-side image map --
|
||||
name CDATA #IMPLIED -- submit as part of form --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!ELEMENT PARAM - O EMPTY -- named property value -->
|
||||
<!ATTLIST PARAM
|
||||
id ID #IMPLIED -- document-wide unique id --
|
||||
name CDATA #REQUIRED -- property name --
|
||||
value CDATA #IMPLIED -- property value --
|
||||
valuetype (DATA|REF|OBJECT) DATA -- How to interpret value --
|
||||
type %ContentType; #IMPLIED -- content type for value
|
||||
when valuetype=ref --
|
||||
>
|
||||
|
||||
|
||||
<!--=================== Horizontal Rule ==================================-->
|
||||
|
||||
<!ELEMENT HR - O EMPTY -- horizontal rule -->
|
||||
<!ATTLIST HR
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--=================== Paragraphs =======================================-->
|
||||
|
||||
<!ELEMENT P - O (%inline;)* -- paragraph -->
|
||||
<!ATTLIST P
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--=================== Headings =========================================-->
|
||||
|
||||
<!--
|
||||
There are six levels of headings from H1 (the most important)
|
||||
to H6 (the least important).
|
||||
-->
|
||||
|
||||
<!ELEMENT (%heading;) - - (%inline;)* -- heading -->
|
||||
<!ATTLIST (%heading;)
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--=================== Preformatted Text ================================-->
|
||||
|
||||
<!-- excludes markup for images and changes in font size -->
|
||||
<!ENTITY % pre.exclusion "IMG|OBJECT|BIG|SMALL|SUB|SUP">
|
||||
|
||||
<!ELEMENT PRE - - (%inline;)* -(%pre.exclusion;) -- preformatted text -->
|
||||
<!ATTLIST PRE
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--===================== Inline Quotes ==================================-->
|
||||
|
||||
<!ELEMENT Q - - (%inline;)* -- short inline quotation -->
|
||||
<!ATTLIST Q
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
cite %URI; #IMPLIED -- URI for source document or msg --
|
||||
>
|
||||
|
||||
<!--=================== Block-like Quotes ================================-->
|
||||
|
||||
<!ELEMENT BLOCKQUOTE - - (%block;|SCRIPT)+ -- long quotation -->
|
||||
<!ATTLIST BLOCKQUOTE
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
cite %URI; #IMPLIED -- URI for source document or msg --
|
||||
>
|
||||
|
||||
<!--=================== Inserted/Deleted Text ============================-->
|
||||
|
||||
|
||||
<!-- INS/DEL are handled by inclusion on BODY -->
|
||||
<!ELEMENT (INS|DEL) - - (%flow;)* -- inserted text, deleted text -->
|
||||
<!ATTLIST (INS|DEL)
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
cite %URI; #IMPLIED -- info on reason for change --
|
||||
datetime %Datetime; #IMPLIED -- date and time of change --
|
||||
>
|
||||
|
||||
<!--=================== Lists ============================================-->
|
||||
|
||||
<!-- definition lists - DT for term, DD for its definition -->
|
||||
|
||||
<!ELEMENT DL - - (DT|DD)+ -- definition list -->
|
||||
<!ATTLIST DL
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!ELEMENT DT - O (%inline;)* -- definition term -->
|
||||
<!ELEMENT DD - O (%flow;)* -- definition description -->
|
||||
<!ATTLIST (DT|DD)
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
|
||||
<!ELEMENT OL - - (LI)+ -- ordered list -->
|
||||
<!ATTLIST OL
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!-- Unordered Lists (UL) bullet styles -->
|
||||
<!ELEMENT UL - - (LI)+ -- unordered list -->
|
||||
<!ATTLIST UL
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
|
||||
|
||||
<!ELEMENT LI - O (%flow;)* -- list item -->
|
||||
<!ATTLIST LI
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--================ Forms ===============================================-->
|
||||
<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
|
||||
<!ATTLIST FORM
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
action %URI; #REQUIRED -- server-side form handler --
|
||||
method (GET|POST) GET -- HTTP method used to submit the form--
|
||||
enctype %ContentType; "application/x-www-form-urlencoded"
|
||||
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload --
|
||||
name CDATA #IMPLIED -- name of form for scripting --
|
||||
onsubmit %Script; #IMPLIED -- the form was submitted --
|
||||
onreset %Script; #IMPLIED -- the form was reset --
|
||||
accept-charset %Charsets; #IMPLIED -- list of supported charsets --
|
||||
>
|
||||
|
||||
<!-- Each label must not contain more than ONE field -->
|
||||
<!ELEMENT LABEL - - (%inline;)* -(LABEL) -- form field label text -->
|
||||
<!ATTLIST LABEL
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
for IDREF #IMPLIED -- matches field ID value --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
>
|
||||
|
||||
<!ENTITY % InputType
|
||||
"(TEXT | PASSWORD | CHECKBOX |
|
||||
RADIO | SUBMIT | RESET |
|
||||
FILE | HIDDEN | IMAGE | BUTTON)"
|
||||
>
|
||||
|
||||
<!-- attribute name required for all but submit and reset -->
|
||||
<!ELEMENT INPUT - O EMPTY -- form control -->
|
||||
<!ATTLIST INPUT
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
type %InputType; TEXT -- what kind of widget is needed --
|
||||
name CDATA #IMPLIED -- submit as part of form --
|
||||
value CDATA #IMPLIED -- Specify for radio buttons and checkboxes --
|
||||
checked (checked) #IMPLIED -- for radio buttons and check boxes --
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
readonly (readonly) #IMPLIED -- for text and passwd --
|
||||
size CDATA #IMPLIED -- specific to each type of field --
|
||||
maxlength NUMBER #IMPLIED -- max chars for text fields --
|
||||
src %URI; #IMPLIED -- for fields with images --
|
||||
alt CDATA #IMPLIED -- short description --
|
||||
usemap %URI; #IMPLIED -- use client-side image map --
|
||||
ismap (ismap) #IMPLIED -- use server-side image map --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
onselect %Script; #IMPLIED -- some text was selected --
|
||||
onchange %Script; #IMPLIED -- the element value was changed --
|
||||
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector -->
|
||||
<!ATTLIST SELECT
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
name CDATA #IMPLIED -- field name --
|
||||
size NUMBER #IMPLIED -- rows visible --
|
||||
multiple (multiple) #IMPLIED -- default is single selection --
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
onchange %Script; #IMPLIED -- the element value was changed --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!ELEMENT OPTGROUP - - (OPTION)+ -- option group -->
|
||||
<!ATTLIST OPTGROUP
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
label %Text; #REQUIRED -- for use in hierarchical menus --
|
||||
>
|
||||
|
||||
<!ELEMENT OPTION - O (#PCDATA) -- selectable choice -->
|
||||
<!ATTLIST OPTION
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
selected (selected) #IMPLIED
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
label %Text; #IMPLIED -- for use in hierarchical menus --
|
||||
value CDATA #IMPLIED -- defaults to element content --
|
||||
>
|
||||
|
||||
<!ELEMENT TEXTAREA - - (#PCDATA) -- multi-line text field -->
|
||||
<!ATTLIST TEXTAREA
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
name CDATA #IMPLIED
|
||||
rows NUMBER #REQUIRED
|
||||
cols NUMBER #REQUIRED
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
readonly (readonly) #IMPLIED
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
onselect %Script; #IMPLIED -- some text was selected --
|
||||
onchange %Script; #IMPLIED -- the element value was changed --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!--
|
||||
#PCDATA is to solve the mixed content problem,
|
||||
per specification only whitespace is allowed there!
|
||||
-->
|
||||
<!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
|
||||
<!ATTLIST FIELDSET
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!ELEMENT LEGEND - - (%inline;)* -- fieldset legend -->
|
||||
|
||||
<!ATTLIST LEGEND
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
>
|
||||
|
||||
<!ELEMENT BUTTON - -
|
||||
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
|
||||
-- push button -->
|
||||
<!ATTLIST BUTTON
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
name CDATA #IMPLIED
|
||||
value CDATA #IMPLIED -- sent to server when submitted --
|
||||
type (button|submit|reset) submit -- for use as form button --
|
||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
||||
%reserved; -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!--======================= Tables =======================================-->
|
||||
|
||||
<!-- IETF HTML table standard, see [RFC1942] -->
|
||||
|
||||
<!--
|
||||
The BORDER attribute sets the thickness of the frame around the
|
||||
table. The default units are screen pixels.
|
||||
|
||||
The FRAME attribute specifies which parts of the frame around
|
||||
the table should be rendered. The values are not the same as
|
||||
CALS to avoid a name clash with the VALIGN attribute.
|
||||
|
||||
The value "border" is included for backwards compatibility with
|
||||
<TABLE BORDER> which yields frame=border and border=implied
|
||||
For <TABLE BORDER=1> you get border=1 and frame=implied. In this
|
||||
case, it is appropriate to treat this as frame=border for backwards
|
||||
compatibility with deployed browsers.
|
||||
-->
|
||||
<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
|
||||
|
||||
<!--
|
||||
The RULES attribute defines which rules to draw between cells:
|
||||
|
||||
If RULES is absent then assume:
|
||||
"none" if BORDER is absent or BORDER=0 otherwise "all"
|
||||
-->
|
||||
|
||||
<!ENTITY % TRules "(none | groups | rows | cols | all)">
|
||||
|
||||
<!-- horizontal placement of table relative to document -->
|
||||
<!ENTITY % TAlign "(left|center|right)">
|
||||
|
||||
<!-- horizontal alignment attributes for cell contents -->
|
||||
<!ENTITY % cellhalign
|
||||
"align (left|center|right|justify|char) #IMPLIED
|
||||
char %Character; #IMPLIED -- alignment char, e.g. char=':' --
|
||||
charoff %Length; #IMPLIED -- offset for alignment char --"
|
||||
>
|
||||
|
||||
<!-- vertical alignment attributes for cell contents -->
|
||||
<!ENTITY % cellvalign
|
||||
"valign (top|middle|bottom|baseline) #IMPLIED"
|
||||
>
|
||||
|
||||
<!ELEMENT TABLE - -
|
||||
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
|
||||
<!ELEMENT CAPTION - - (%inline;)* -- table caption -->
|
||||
<!ELEMENT THEAD - O (TR)+ -- table header -->
|
||||
<!ELEMENT TFOOT - O (TR)+ -- table footer -->
|
||||
<!ELEMENT TBODY O O (TR)+ -- table body -->
|
||||
<!ELEMENT COLGROUP - O (COL)* -- table column group -->
|
||||
<!ELEMENT COL - O EMPTY -- table column -->
|
||||
<!ELEMENT TR - O (TH|TD)+ -- table row -->
|
||||
<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell-->
|
||||
|
||||
<!ATTLIST TABLE -- table element --
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
summary %Text; #IMPLIED -- purpose/structure for speech output--
|
||||
width %Length; #IMPLIED -- table width --
|
||||
border %Pixels; #IMPLIED -- controls frame width around table --
|
||||
frame %TFrame; #IMPLIED -- which parts of frame to render --
|
||||
rules %TRules; #IMPLIED -- rulings between rows and cols --
|
||||
cellspacing %Length; #IMPLIED -- spacing between cells --
|
||||
cellpadding %Length; #IMPLIED -- spacing within cells --
|
||||
%reserved; -- reserved for possible future use --
|
||||
datapagesize CDATA #IMPLIED -- reserved for possible future use --
|
||||
>
|
||||
|
||||
|
||||
<!ATTLIST CAPTION
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--
|
||||
COLGROUP groups a set of COL elements. It allows you to group
|
||||
several semantically related columns together.
|
||||
-->
|
||||
<!ATTLIST COLGROUP
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
span NUMBER 1 -- default number of columns in group --
|
||||
width %MultiLength; #IMPLIED -- default width for enclosed COLs --
|
||||
%cellhalign; -- horizontal alignment in cells --
|
||||
%cellvalign; -- vertical alignment in cells --
|
||||
>
|
||||
|
||||
<!--
|
||||
COL elements define the alignment properties for cells in
|
||||
one or more columns.
|
||||
|
||||
The WIDTH attribute specifies the width of the columns, e.g.
|
||||
|
||||
width=64 width in screen pixels
|
||||
width=0.5* relative width of 0.5
|
||||
|
||||
The SPAN attribute causes the attributes of one
|
||||
COL element to apply to more than one column.
|
||||
-->
|
||||
<!ATTLIST COL -- column groups and properties --
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
span NUMBER 1 -- COL attributes affect N columns --
|
||||
width %MultiLength; #IMPLIED -- column width specification --
|
||||
%cellhalign; -- horizontal alignment in cells --
|
||||
%cellvalign; -- vertical alignment in cells --
|
||||
>
|
||||
|
||||
<!--
|
||||
Use THEAD to duplicate headers when breaking table
|
||||
across page boundaries, or for static headers when
|
||||
TBODY sections are rendered in scrolling panel.
|
||||
|
||||
Use TFOOT to duplicate footers when breaking table
|
||||
across page boundaries, or for static footers when
|
||||
TBODY sections are rendered in scrolling panel.
|
||||
|
||||
Use multiple TBODY sections when rules are needed
|
||||
between groups of table rows.
|
||||
-->
|
||||
<!ATTLIST (THEAD|TBODY|TFOOT) -- table section --
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
%cellhalign; -- horizontal alignment in cells --
|
||||
%cellvalign; -- vertical alignment in cells --
|
||||
>
|
||||
|
||||
<!ATTLIST TR -- table row --
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
%cellhalign; -- horizontal alignment in cells --
|
||||
%cellvalign; -- vertical alignment in cells --
|
||||
>
|
||||
|
||||
|
||||
<!-- Scope is simpler than headers attribute for common tables -->
|
||||
<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
|
||||
|
||||
<!-- TH is for headers, TD for data, but for cells acting as both use TD -->
|
||||
<!ATTLIST (TH|TD) -- header or data cell --
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
abbr %Text; #IMPLIED -- abbreviation for header cell --
|
||||
axis CDATA #IMPLIED -- comma-separated list of related headers--
|
||||
headers IDREFS #IMPLIED -- list of id's for header cells --
|
||||
scope %Scope; #IMPLIED -- scope covered by header cells --
|
||||
rowspan NUMBER 1 -- number of rows spanned by cell --
|
||||
colspan NUMBER 1 -- number of cols spanned by cell --
|
||||
%cellhalign; -- horizontal alignment in cells --
|
||||
%cellvalign; -- vertical alignment in cells --
|
||||
>
|
||||
|
||||
|
||||
<!--================ Document Head =======================================-->
|
||||
<!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" -->
|
||||
<!ENTITY % head.content "TITLE & BASE?">
|
||||
|
||||
<!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head -->
|
||||
<!ATTLIST HEAD
|
||||
%i18n; -- lang, dir --
|
||||
profile %URI; #IMPLIED -- named dictionary of meta info --
|
||||
>
|
||||
|
||||
<!-- The TITLE element is not considered part of the flow of text.
|
||||
It should be displayed, for example as the page header or
|
||||
window title. Exactly one title is required per document.
|
||||
-->
|
||||
<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title -->
|
||||
<!ATTLIST TITLE %i18n>
|
||||
|
||||
|
||||
<!ELEMENT BASE - O EMPTY -- document base URI -->
|
||||
<!ATTLIST BASE
|
||||
href %URI; #REQUIRED -- URI that acts as base URI --
|
||||
>
|
||||
|
||||
<!ELEMENT META - O EMPTY -- generic metainformation -->
|
||||
<!ATTLIST META
|
||||
%i18n; -- lang, dir, for use with content --
|
||||
http-equiv NAME #IMPLIED -- HTTP response header name --
|
||||
name NAME #IMPLIED -- metainformation name --
|
||||
content CDATA #REQUIRED -- associated information --
|
||||
scheme CDATA #IMPLIED -- select form of content --
|
||||
>
|
||||
|
||||
<!ELEMENT STYLE - - %StyleSheet -- style info -->
|
||||
<!ATTLIST STYLE
|
||||
%i18n; -- lang, dir, for use with title --
|
||||
type %ContentType; #REQUIRED -- content type of style language --
|
||||
media %MediaDesc; #IMPLIED -- designed for use with these media --
|
||||
title %Text; #IMPLIED -- advisory title --
|
||||
>
|
||||
|
||||
<!ELEMENT SCRIPT - - %Script; -- script statements -->
|
||||
<!ATTLIST SCRIPT
|
||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
||||
type %ContentType; #REQUIRED -- content type of script language --
|
||||
src %URI; #IMPLIED -- URI for an external script --
|
||||
defer (defer) #IMPLIED -- UA may defer execution of script --
|
||||
event CDATA #IMPLIED -- reserved for possible future use --
|
||||
for %URI; #IMPLIED -- reserved for possible future use --
|
||||
>
|
||||
|
||||
<!ELEMENT NOSCRIPT - - (%block;)+
|
||||
-- alternate content container for non script-based rendering -->
|
||||
<!ATTLIST NOSCRIPT
|
||||
%attrs; -- %coreattrs, %i18n, %events --
|
||||
>
|
||||
|
||||
<!--================ Document Structure ==================================-->
|
||||
<!ENTITY % html.content "HEAD, BODY">
|
||||
|
||||
<!ELEMENT HTML O O (%html.content;) -- document root element -->
|
||||
<!ATTLIST HTML
|
||||
%i18n; -- lang, dir --
|
||||
>
|
45
node_modules/elementtree/node_modules/sax/examples/switch-bench.js
generated
vendored
Executable file
45
node_modules/elementtree/node_modules/sax/examples/switch-bench.js
generated
vendored
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/local/bin/node-bench
|
||||
|
||||
var Promise = require("events").Promise;
|
||||
|
||||
var xml = require("posix").cat("test.xml").wait(),
|
||||
path = require("path"),
|
||||
sax = require("../lib/sax"),
|
||||
saxT = require("../lib/sax-trampoline"),
|
||||
|
||||
parser = sax.parser(false, {trim:true}),
|
||||
parserT = saxT.parser(false, {trim:true}),
|
||||
|
||||
sys = require("sys");
|
||||
|
||||
|
||||
var count = exports.stepsPerLap = 500,
|
||||
l = xml.length,
|
||||
runs = 0;
|
||||
exports.countPerLap = 1000;
|
||||
exports.compare = {
|
||||
"switch" : function () {
|
||||
// sys.debug("switch runs: "+runs++);
|
||||
// for (var x = 0; x < l; x += 1000) {
|
||||
// parser.write(xml.substr(x, 1000))
|
||||
// }
|
||||
// for (var i = 0; i < count; i ++) {
|
||||
parser.write(xml);
|
||||
parser.close();
|
||||
// }
|
||||
// done();
|
||||
},
|
||||
trampoline : function () {
|
||||
// sys.debug("trampoline runs: "+runs++);
|
||||
// for (var x = 0; x < l; x += 1000) {
|
||||
// parserT.write(xml.substr(x, 1000))
|
||||
// }
|
||||
// for (var i = 0; i < count; i ++) {
|
||||
parserT.write(xml);
|
||||
parserT.close();
|
||||
// }
|
||||
// done();
|
||||
},
|
||||
};
|
||||
|
||||
sys.debug("rock and roll...");
|
15
node_modules/elementtree/node_modules/sax/examples/test.html
generated
vendored
Normal file
15
node_modules/elementtree/node_modules/sax/examples/test.html
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>testing the parser</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>hello
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
1254
node_modules/elementtree/node_modules/sax/examples/test.xml
generated
vendored
Normal file
1254
node_modules/elementtree/node_modules/sax/examples/test.xml
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25
node_modules/elementtree/node_modules/sax/test/buffer-overrun.js
generated
vendored
Normal file
25
node_modules/elementtree/node_modules/sax/test/buffer-overrun.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// set this really low so that I don't have to put 64 MB of xml in here.
|
||||
var sax = require("../lib/sax")
|
||||
var bl = sax.MAX_BUFFER_LENGTH
|
||||
sax.MAX_BUFFER_LENGTH = 5;
|
||||
|
||||
require(__dirname).test({
|
||||
expect : [
|
||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 15\nChar: "],
|
||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 30\nChar: "],
|
||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 45\nChar: "],
|
||||
["opentag", {
|
||||
"name": "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"attributes": {}
|
||||
}],
|
||||
["text", "yo"],
|
||||
["closetag", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
||||
]
|
||||
}).write("<abcdefghijklmn")
|
||||
.write("opqrstuvwxyzABC")
|
||||
.write("DEFGHIJKLMNOPQR")
|
||||
.write("STUVWXYZ>")
|
||||
.write("yo")
|
||||
.write("</abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>")
|
||||
.close();
|
||||
sax.MAX_BUFFER_LENGTH = bl
|
11
node_modules/elementtree/node_modules/sax/test/cdata-chunked.js
generated
vendored
Normal file
11
node_modules/elementtree/node_modules/sax/test/cdata-chunked.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
require(__dirname).test({
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", " this is character data "],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
}).write("<r><![CDATA[ this is ").write("character data ").write("]]></r>").close();
|
||||
|
15
node_modules/elementtree/node_modules/sax/test/cdata-end-split.js
generated
vendored
Normal file
15
node_modules/elementtree/node_modules/sax/test/cdata-end-split.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
require(__dirname).test({
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", " this is "],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
})
|
||||
.write("<r><![CDATA[ this is ]")
|
||||
.write("]>")
|
||||
.write("</r>")
|
||||
.close();
|
||||
|
28
node_modules/elementtree/node_modules/sax/test/cdata-fake-end.js
generated
vendored
Normal file
28
node_modules/elementtree/node_modules/sax/test/cdata-fake-end.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
var p = require(__dirname).test({
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", "[[[[[[[[]]]]]]]]"],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
})
|
||||
var x = "<r><![CDATA[[[[[[[[[]]]]]]]]]]></r>"
|
||||
for (var i = 0; i < x.length ; i ++) {
|
||||
p.write(x.charAt(i))
|
||||
}
|
||||
p.close();
|
||||
|
||||
|
||||
var p2 = require(__dirname).test({
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", "[[[[[[[[]]]]]]]]"],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
})
|
||||
var x = "<r><![CDATA[[[[[[[[[]]]]]]]]]]></r>"
|
||||
p2.write(x).close();
|
15
node_modules/elementtree/node_modules/sax/test/cdata-multiple.js
generated
vendored
Normal file
15
node_modules/elementtree/node_modules/sax/test/cdata-multiple.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
require(__dirname).test({
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", " this is "],
|
||||
["closecdata", undefined],
|
||||
["opencdata", undefined],
|
||||
["cdata", "character data "],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
}).write("<r><![CDATA[ this is ]]>").write("<![CDA").write("T").write("A[")
|
||||
.write("character data ").write("]]></r>").close();
|
||||
|
10
node_modules/elementtree/node_modules/sax/test/cdata.js
generated
vendored
Normal file
10
node_modules/elementtree/node_modules/sax/test/cdata.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
require(__dirname).test({
|
||||
xml : "<r><![CDATA[ this is character data ]]></r>",
|
||||
expect : [
|
||||
["opentag", {"name": "R","attributes": {}}],
|
||||
["opencdata", undefined],
|
||||
["cdata", " this is character data "],
|
||||
["closecdata", undefined],
|
||||
["closetag", "R"]
|
||||
]
|
||||
});
|
86
node_modules/elementtree/node_modules/sax/test/index.js
generated
vendored
Normal file
86
node_modules/elementtree/node_modules/sax/test/index.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
var globalsBefore = JSON.stringify(Object.keys(global))
|
||||
, util = require("util")
|
||||
, assert = require("assert")
|
||||
, fs = require("fs")
|
||||
, path = require("path")
|
||||
, sax = require("../lib/sax")
|
||||
|
||||
exports.sax = sax
|
||||
|
||||
// handy way to do simple unit tests
|
||||
// if the options contains an xml string, it'll be written and the parser closed.
|
||||
// otherwise, it's assumed that the test will write and close.
|
||||
exports.test = function test (options) {
|
||||
var xml = options.xml
|
||||
, parser = sax.parser(options.strict, options.opt)
|
||||
, expect = options.expect
|
||||
, e = 0
|
||||
sax.EVENTS.forEach(function (ev) {
|
||||
parser["on" + ev] = function (n) {
|
||||
if (process.env.DEBUG) {
|
||||
console.error({ expect: expect[e]
|
||||
, actual: [ev, n] })
|
||||
}
|
||||
if (e >= expect.length && (ev === "end" || ev === "ready")) return
|
||||
assert.ok( e < expect.length,
|
||||
"expectation #"+e+" "+util.inspect(expect[e])+"\n"+
|
||||
"Unexpected event: "+ev+" "+(n ? util.inspect(n) : ""))
|
||||
var inspected = n instanceof Error ? "\n"+ n.message : util.inspect(n)
|
||||
assert.equal(ev, expect[e][0],
|
||||
"expectation #"+e+"\n"+
|
||||
"Didn't get expected event\n"+
|
||||
"expect: "+expect[e][0] + " " +util.inspect(expect[e][1])+"\n"+
|
||||
"actual: "+ev+" "+inspected+"\n")
|
||||
if (ev === "error") assert.equal(n.message, expect[e][1])
|
||||
else assert.deepEqual(n, expect[e][1],
|
||||
"expectation #"+e+"\n"+
|
||||
"Didn't get expected argument\n"+
|
||||
"expect: "+expect[e][0] + " " +util.inspect(expect[e][1])+"\n"+
|
||||
"actual: "+ev+" "+inspected+"\n")
|
||||
e++
|
||||
if (ev === "error") parser.resume()
|
||||
}
|
||||
})
|
||||
if (xml) parser.write(xml).close()
|
||||
return parser
|
||||
}
|
||||
|
||||
if (module === require.main) {
|
||||
var running = true
|
||||
, failures = 0
|
||||
|
||||
function fail (file, er) {
|
||||
util.error("Failed: "+file)
|
||||
util.error(er.stack || er.message)
|
||||
failures ++
|
||||
}
|
||||
|
||||
fs.readdir(__dirname, function (error, files) {
|
||||
files = files.filter(function (file) {
|
||||
return (/\.js$/.exec(file) && file !== 'index.js')
|
||||
})
|
||||
var n = files.length
|
||||
, i = 0
|
||||
console.log("0.." + n)
|
||||
files.forEach(function (file) {
|
||||
// run this test.
|
||||
try {
|
||||
require(path.resolve(__dirname, file))
|
||||
var globalsAfter = JSON.stringify(Object.keys(global))
|
||||
if (globalsAfter !== globalsBefore) {
|
||||
var er = new Error("new globals introduced\n"+
|
||||
"expected: "+globalsBefore+"\n"+
|
||||
"actual: "+globalsAfter)
|
||||
globalsBefore = globalsAfter
|
||||
throw er
|
||||
}
|
||||
console.log("ok " + (++i) + " - " + file)
|
||||
} catch (er) {
|
||||
console.log("not ok "+ (++i) + " - " + file)
|
||||
fail(file, er)
|
||||
}
|
||||
})
|
||||
if (!failures) return console.log("#all pass")
|
||||
else return console.error(failures + " failure" + (failures > 1 ? "s" : ""))
|
||||
})
|
||||
}
|
43
node_modules/elementtree/node_modules/sax/test/issue-23.js
generated
vendored
Normal file
43
node_modules/elementtree/node_modules/sax/test/issue-23.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
require(__dirname).test
|
||||
( { xml :
|
||||
"<compileClassesResponse>"+
|
||||
"<result>"+
|
||||
"<bodyCrc>653724009</bodyCrc>"+
|
||||
"<column>-1</column>"+
|
||||
"<id>01pG0000002KoSUIA0</id>"+
|
||||
"<line>-1</line>"+
|
||||
"<name>CalendarController</name>"+
|
||||
"<success>true</success>"+
|
||||
"</result>"+
|
||||
"</compileClassesResponse>"
|
||||
|
||||
, expect :
|
||||
[ [ "opentag", { name: "COMPILECLASSESRESPONSE", attributes: {} } ]
|
||||
, [ "opentag", { name : "RESULT", attributes: {} } ]
|
||||
, [ "opentag", { name: "BODYCRC", attributes: {} } ]
|
||||
, [ "text", "653724009" ]
|
||||
, [ "closetag", "BODYCRC" ]
|
||||
, [ "opentag", { name: "COLUMN", attributes: {} } ]
|
||||
, [ "text", "-1" ]
|
||||
, [ "closetag", "COLUMN" ]
|
||||
, [ "opentag", { name: "ID", attributes: {} } ]
|
||||
, [ "text", "01pG0000002KoSUIA0" ]
|
||||
, [ "closetag", "ID" ]
|
||||
, [ "opentag", {name: "LINE", attributes: {} } ]
|
||||
, [ "text", "-1" ]
|
||||
, [ "closetag", "LINE" ]
|
||||
, [ "opentag", {name: "NAME", attributes: {} } ]
|
||||
, [ "text", "CalendarController" ]
|
||||
, [ "closetag", "NAME" ]
|
||||
, [ "opentag", {name: "SUCCESS", attributes: {} } ]
|
||||
, [ "text", "true" ]
|
||||
, [ "closetag", "SUCCESS" ]
|
||||
, [ "closetag", "RESULT" ]
|
||||
, [ "closetag", "COMPILECLASSESRESPONSE" ]
|
||||
]
|
||||
, strict : false
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
24
node_modules/elementtree/node_modules/sax/test/issue-30.js
generated
vendored
Normal file
24
node_modules/elementtree/node_modules/sax/test/issue-30.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// https://github.com/isaacs/sax-js/issues/33
|
||||
require(__dirname).test
|
||||
( { xml : "<xml>\n"+
|
||||
"<!-- \n"+
|
||||
" comment with a single dash- in it\n"+
|
||||
"-->\n"+
|
||||
"<data/>\n"+
|
||||
"</xml>"
|
||||
|
||||
, expect :
|
||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
||||
, [ "text", "\n" ]
|
||||
, [ "comment", " \n comment with a single dash- in it\n" ]
|
||||
, [ "text", "\n" ]
|
||||
, [ "opentag", { name: "data", attributes: {} } ]
|
||||
, [ "closetag", "data" ]
|
||||
, [ "text", "\n" ]
|
||||
, [ "closetag", "xml" ]
|
||||
]
|
||||
, strict : true
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
15
node_modules/elementtree/node_modules/sax/test/issue-35.js
generated
vendored
Normal file
15
node_modules/elementtree/node_modules/sax/test/issue-35.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// https://github.com/isaacs/sax-js/issues/35
|
||||
require(__dirname).test
|
||||
( { xml : "<xml>

\n"+
|
||||
"</xml>"
|
||||
|
||||
, expect :
|
||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
||||
, [ "text", "\r\r\n" ]
|
||||
, [ "closetag", "xml" ]
|
||||
]
|
||||
, strict : true
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
13
node_modules/elementtree/node_modules/sax/test/issue-47.js
generated
vendored
Normal file
13
node_modules/elementtree/node_modules/sax/test/issue-47.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// https://github.com/isaacs/sax-js/issues/47
|
||||
require(__dirname).test
|
||||
( { xml : '<a href="query.svc?x=1&y=2&z=3"/>'
|
||||
, expect : [
|
||||
[ "attribute", { name:'href', value:"query.svc?x=1&y=2&z=3"} ],
|
||||
[ "opentag", { name: "a", attributes: { href:"query.svc?x=1&y=2&z=3"} } ],
|
||||
[ "closetag", "a" ]
|
||||
]
|
||||
, strict : true
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
31
node_modules/elementtree/node_modules/sax/test/issue-49.js
generated
vendored
Normal file
31
node_modules/elementtree/node_modules/sax/test/issue-49.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// https://github.com/isaacs/sax-js/issues/49
|
||||
require(__dirname).test
|
||||
( { xml : "<xml><script>hello world</script></xml>"
|
||||
, expect :
|
||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
||||
, [ "opentag", { name: "script", attributes: {} } ]
|
||||
, [ "text", "hello world" ]
|
||||
, [ "closetag", "script" ]
|
||||
, [ "closetag", "xml" ]
|
||||
]
|
||||
, strict : false
|
||||
, opt : { lowercasetags: true, noscript: true }
|
||||
}
|
||||
)
|
||||
|
||||
require(__dirname).test
|
||||
( { xml : "<xml><script><![CDATA[hello world]]></script></xml>"
|
||||
, expect :
|
||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
||||
, [ "opentag", { name: "script", attributes: {} } ]
|
||||
, [ "opencdata", undefined ]
|
||||
, [ "cdata", "hello world" ]
|
||||
, [ "closecdata", undefined ]
|
||||
, [ "closetag", "script" ]
|
||||
, [ "closetag", "xml" ]
|
||||
]
|
||||
, strict : false
|
||||
, opt : { lowercasetags: true, noscript: true }
|
||||
}
|
||||
)
|
||||
|
28
node_modules/elementtree/node_modules/sax/test/parser-position.js
generated
vendored
Normal file
28
node_modules/elementtree/node_modules/sax/test/parser-position.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
var sax = require("../lib/sax"),
|
||||
assert = require("assert")
|
||||
|
||||
function testPosition(chunks, expectedEvents) {
|
||||
var parser = sax.parser();
|
||||
expectedEvents.forEach(function(expectation) {
|
||||
parser['on' + expectation[0]] = function() {
|
||||
for (var prop in expectation[1]) {
|
||||
assert.equal(parser[prop], expectation[1][prop]);
|
||||
}
|
||||
}
|
||||
});
|
||||
chunks.forEach(function(chunk) {
|
||||
parser.write(chunk);
|
||||
});
|
||||
};
|
||||
|
||||
testPosition(['<div>abcdefgh</div>'],
|
||||
[ ['opentag', { position: 5, startTagPosition: 1 }]
|
||||
, ['text', { position: 19, startTagPosition: 14 }]
|
||||
, ['closetag', { position: 19, startTagPosition: 14 }]
|
||||
]);
|
||||
|
||||
testPosition(['<div>abcde','fgh</div>'],
|
||||
[ ['opentag', { position: 5, startTagPosition: 1 }]
|
||||
, ['text', { position: 19, startTagPosition: 14 }]
|
||||
, ['closetag', { position: 19, startTagPosition: 14 }]
|
||||
]);
|
12
node_modules/elementtree/node_modules/sax/test/script.js
generated
vendored
Normal file
12
node_modules/elementtree/node_modules/sax/test/script.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
require(__dirname).test({
|
||||
xml : "<html><head><script>if (1 < 0) { console.log('elo there'); }</script></head></html>",
|
||||
expect : [
|
||||
["opentag", {"name": "HTML","attributes": {}}],
|
||||
["opentag", {"name": "HEAD","attributes": {}}],
|
||||
["opentag", {"name": "SCRIPT","attributes": {}}],
|
||||
["script", "if (1 < 0) { console.log('elo there'); }"],
|
||||
["closetag", "SCRIPT"],
|
||||
["closetag", "HEAD"],
|
||||
["closetag", "HTML"]
|
||||
]
|
||||
});
|
40
node_modules/elementtree/node_modules/sax/test/self-closing-child-strict.js
generated
vendored
Normal file
40
node_modules/elementtree/node_modules/sax/test/self-closing-child-strict.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
require(__dirname).test({
|
||||
xml :
|
||||
"<root>"+
|
||||
"<child>" +
|
||||
"<haha />" +
|
||||
"</child>" +
|
||||
"<monkey>" +
|
||||
"=(|)" +
|
||||
"</monkey>" +
|
||||
"</root>",
|
||||
expect : [
|
||||
["opentag", {
|
||||
"name": "root",
|
||||
"attributes": {}
|
||||
}],
|
||||
["opentag", {
|
||||
"name": "child",
|
||||
"attributes": {}
|
||||
}],
|
||||
["opentag", {
|
||||
"name": "haha",
|
||||
"attributes": {}
|
||||
}],
|
||||
["closetag", "haha"],
|
||||
["closetag", "child"],
|
||||
["opentag", {
|
||||
"name": "monkey",
|
||||
"attributes": {}
|
||||
}],
|
||||
["text", "=(|)"],
|
||||
["closetag", "monkey"],
|
||||
["closetag", "root"],
|
||||
["end"],
|
||||
["ready"]
|
||||
],
|
||||
strict : true,
|
||||
opt : {}
|
||||
});
|
||||
|
40
node_modules/elementtree/node_modules/sax/test/self-closing-child.js
generated
vendored
Normal file
40
node_modules/elementtree/node_modules/sax/test/self-closing-child.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
require(__dirname).test({
|
||||
xml :
|
||||
"<root>"+
|
||||
"<child>" +
|
||||
"<haha />" +
|
||||
"</child>" +
|
||||
"<monkey>" +
|
||||
"=(|)" +
|
||||
"</monkey>" +
|
||||
"</root>",
|
||||
expect : [
|
||||
["opentag", {
|
||||
"name": "ROOT",
|
||||
"attributes": {}
|
||||
}],
|
||||
["opentag", {
|
||||
"name": "CHILD",
|
||||
"attributes": {}
|
||||
}],
|
||||
["opentag", {
|
||||
"name": "HAHA",
|
||||
"attributes": {}
|
||||
}],
|
||||
["closetag", "HAHA"],
|
||||
["closetag", "CHILD"],
|
||||
["opentag", {
|
||||
"name": "MONKEY",
|
||||
"attributes": {}
|
||||
}],
|
||||
["text", "=(|)"],
|
||||
["closetag", "MONKEY"],
|
||||
["closetag", "ROOT"],
|
||||
["end"],
|
||||
["ready"]
|
||||
],
|
||||
strict : false,
|
||||
opt : {}
|
||||
});
|
||||
|
25
node_modules/elementtree/node_modules/sax/test/self-closing-tag.js
generated
vendored
Normal file
25
node_modules/elementtree/node_modules/sax/test/self-closing-tag.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
require(__dirname).test({
|
||||
xml :
|
||||
"<root> "+
|
||||
"<haha /> "+
|
||||
"<haha/> "+
|
||||
"<monkey> "+
|
||||
"=(|) "+
|
||||
"</monkey>"+
|
||||
"</root> ",
|
||||
expect : [
|
||||
["opentag", {name:"ROOT", attributes:{}}],
|
||||
["opentag", {name:"HAHA", attributes:{}}],
|
||||
["closetag", "HAHA"],
|
||||
["opentag", {name:"HAHA", attributes:{}}],
|
||||
["closetag", "HAHA"],
|
||||
// ["opentag", {name:"HAHA", attributes:{}}],
|
||||
// ["closetag", "HAHA"],
|
||||
["opentag", {name:"MONKEY", attributes:{}}],
|
||||
["text", "=(|)"],
|
||||
["closetag", "MONKEY"],
|
||||
["closetag", "ROOT"]
|
||||
],
|
||||
opt : { trim : true }
|
||||
});
|
17
node_modules/elementtree/node_modules/sax/test/stray-ending.js
generated
vendored
Normal file
17
node_modules/elementtree/node_modules/sax/test/stray-ending.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// stray ending tags should just be ignored in non-strict mode.
|
||||
// https://github.com/isaacs/sax-js/issues/32
|
||||
require(__dirname).test
|
||||
( { xml :
|
||||
"<a><b></c></b></a>"
|
||||
, expect :
|
||||
[ [ "opentag", { name: "A", attributes: {} } ]
|
||||
, [ "opentag", { name: "B", attributes: {} } ]
|
||||
, [ "text", "</c>" ]
|
||||
, [ "closetag", "B" ]
|
||||
, [ "closetag", "A" ]
|
||||
]
|
||||
, strict : false
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
17
node_modules/elementtree/node_modules/sax/test/trailing-non-whitespace.js
generated
vendored
Normal file
17
node_modules/elementtree/node_modules/sax/test/trailing-non-whitespace.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
require(__dirname).test({
|
||||
xml : "<span>Welcome,</span> to monkey land",
|
||||
expect : [
|
||||
["opentag", {
|
||||
"name": "SPAN",
|
||||
"attributes": {}
|
||||
}],
|
||||
["text", "Welcome,"],
|
||||
["closetag", "SPAN"],
|
||||
["text", " to monkey land"],
|
||||
["end"],
|
||||
["ready"]
|
||||
],
|
||||
strict : false,
|
||||
opt : {}
|
||||
});
|
17
node_modules/elementtree/node_modules/sax/test/unquoted.js
generated
vendored
Normal file
17
node_modules/elementtree/node_modules/sax/test/unquoted.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// unquoted attributes should be ok in non-strict mode
|
||||
// https://github.com/isaacs/sax-js/issues/31
|
||||
require(__dirname).test
|
||||
( { xml :
|
||||
"<span class=test hello=world></span>"
|
||||
, expect :
|
||||
[ [ "attribute", { name: "class", value: "test" } ]
|
||||
, [ "attribute", { name: "hello", value: "world" } ]
|
||||
, [ "opentag", { name: "SPAN",
|
||||
attributes: { class: "test", hello: "world" } } ]
|
||||
, [ "closetag", "SPAN" ]
|
||||
]
|
||||
, strict : false
|
||||
, opt : {}
|
||||
}
|
||||
)
|
||||
|
67
node_modules/elementtree/node_modules/sax/test/xmlns-issue-41.js
generated
vendored
Normal file
67
node_modules/elementtree/node_modules/sax/test/xmlns-issue-41.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
var t = require(__dirname)
|
||||
|
||||
, xmls = // should be the same both ways.
|
||||
[ "<parent xmlns:a='http://ATTRIBUTE' a:attr='value' />"
|
||||
, "<parent a:attr='value' xmlns:a='http://ATTRIBUTE' />" ]
|
||||
|
||||
, ex1 =
|
||||
[ [ "opennamespace"
|
||||
, { prefix: "a"
|
||||
, uri: "http://ATTRIBUTE"
|
||||
}
|
||||
]
|
||||
, [ "attribute"
|
||||
, { name: "xmlns:a"
|
||||
, value: "http://ATTRIBUTE"
|
||||
, prefix: "xmlns"
|
||||
, local: "a"
|
||||
, uri: "http://www.w3.org/2000/xmlns/"
|
||||
}
|
||||
]
|
||||
, [ "attribute"
|
||||
, { name: "a:attr"
|
||||
, local: "attr"
|
||||
, prefix: "a"
|
||||
, uri: "http://ATTRIBUTE"
|
||||
, value: "value"
|
||||
}
|
||||
]
|
||||
, [ "opentag"
|
||||
, { name: "parent"
|
||||
, uri: ""
|
||||
, prefix: ""
|
||||
, local: "parent"
|
||||
, attributes:
|
||||
{ "a:attr":
|
||||
{ name: "a:attr"
|
||||
, local: "attr"
|
||||
, prefix: "a"
|
||||
, uri: "http://ATTRIBUTE"
|
||||
, value: "value"
|
||||
}
|
||||
, "xmlns:a":
|
||||
{ name: "xmlns:a"
|
||||
, local: "a"
|
||||
, prefix: "xmlns"
|
||||
, uri: "http://www.w3.org/2000/xmlns/"
|
||||
, value: "http://ATTRIBUTE"
|
||||
}
|
||||
}
|
||||
, ns: {"a": "http://ATTRIBUTE"}
|
||||
}
|
||||
]
|
||||
, ["closetag", "parent"]
|
||||
, ["closenamespace", { prefix: "a", uri: "http://ATTRIBUTE" }]
|
||||
]
|
||||
|
||||
// swap the order of elements 2 and 1
|
||||
, ex2 = [ex1[0], ex1[2], ex1[1]].concat(ex1.slice(3))
|
||||
, expected = [ex1, ex2]
|
||||
|
||||
xmls.forEach(function (x, i) {
|
||||
t.test({ xml: x
|
||||
, expect: expected[i]
|
||||
, strict: true
|
||||
, opt: { xmlns: true }
|
||||
})
|
||||
})
|
59
node_modules/elementtree/node_modules/sax/test/xmlns-rebinding.js
generated
vendored
Normal file
59
node_modules/elementtree/node_modules/sax/test/xmlns-rebinding.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
require(__dirname).test
|
||||
( { xml :
|
||||
"<root xmlns:x='x1' xmlns:y='y1' x:a='x1' y:a='y1'>"+
|
||||
"<rebind xmlns:x='x2'>"+
|
||||
"<check x:a='x2' y:a='y1'/>"+
|
||||
"</rebind>"+
|
||||
"<check x:a='x1' y:a='y1'/>"+
|
||||
"</root>"
|
||||
|
||||
, expect :
|
||||
[ [ "opennamespace", { prefix: "x", uri: "x1" } ]
|
||||
, [ "opennamespace", { prefix: "y", uri: "y1" } ]
|
||||
, [ "attribute", { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
|
||||
, [ "attribute", { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" } ]
|
||||
, [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
|
||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
||||
, [ "opentag", { name: "root", uri: "", prefix: "", local: "root",
|
||||
attributes: { "xmlns:x": { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" }
|
||||
, "xmlns:y": { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" }
|
||||
, "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
|
||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
||||
ns: { x: 'x1', y: 'y1' } } ]
|
||||
|
||||
, [ "opennamespace", { prefix: "x", uri: "x2" } ]
|
||||
, [ "attribute", { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
|
||||
, [ "opentag", { name: "rebind", uri: "", prefix: "", local: "rebind",
|
||||
attributes: { "xmlns:x": { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } },
|
||||
ns: { x: 'x2' } } ]
|
||||
|
||||
, [ "attribute", { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" } ]
|
||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
||||
, [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
|
||||
attributes: { "x:a": { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" }
|
||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
||||
ns: { x: 'x2' } } ]
|
||||
|
||||
, [ "closetag", "check" ]
|
||||
|
||||
, [ "closetag", "rebind" ]
|
||||
, [ "closenamespace", { prefix: "x", uri: "x2" } ]
|
||||
|
||||
, [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
|
||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
||||
, [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
|
||||
attributes: { "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
|
||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
||||
ns: { x: 'x1', y: 'y1' } } ]
|
||||
, [ "closetag", "check" ]
|
||||
|
||||
, [ "closetag", "root" ]
|
||||
, [ "closenamespace", { prefix: "x", uri: "x1" } ]
|
||||
, [ "closenamespace", { prefix: "y", uri: "y1" } ]
|
||||
]
|
||||
, strict : true
|
||||
, opt : { xmlns: true }
|
||||
}
|
||||
)
|
||||
|
71
node_modules/elementtree/node_modules/sax/test/xmlns-strict.js
generated
vendored
Normal file
71
node_modules/elementtree/node_modules/sax/test/xmlns-strict.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
require(__dirname).test
|
||||
( { xml :
|
||||
"<root>"+
|
||||
"<plain attr='normal'/>"+
|
||||
"<ns1 xmlns='uri:default'>"+
|
||||
"<plain attr='normal'/>"+
|
||||
"</ns1>"+
|
||||
"<ns2 xmlns:a='uri:nsa'>"+
|
||||
"<plain attr='normal'/>"+
|
||||
"<a:ns a:attr='namespaced'/>"+
|
||||
"</ns2>"+
|
||||
"</root>"
|
||||
|
||||
, expect :
|
||||
[ [ "opentag", { name: "root", prefix: "", local: "root", uri: "",
|
||||
attributes: {}, ns: {} } ]
|
||||
|
||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ]
|
||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "",
|
||||
attributes: { "attr": { name: "attr", value: "normal", uri: "", prefix: "", local: "attr", uri: "" } },
|
||||
ns: {} } ]
|
||||
, [ "closetag", "plain" ]
|
||||
|
||||
, [ "opennamespace", { prefix: "", uri: "uri:default" } ]
|
||||
|
||||
, [ "attribute", { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } ]
|
||||
, [ "opentag", { name: "ns1", prefix: "", local: "ns1", uri: "uri:default",
|
||||
attributes: { "xmlns": { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } },
|
||||
ns: { "": "uri:default" } } ]
|
||||
|
||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "uri:default" } ]
|
||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "uri:default", ns: { '': 'uri:default' },
|
||||
attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "uri:default" } } } ]
|
||||
, [ "closetag", "plain" ]
|
||||
|
||||
, [ "closetag", "ns1" ]
|
||||
|
||||
, [ "closenamespace", { prefix: "", uri: "uri:default" } ]
|
||||
|
||||
, [ "opennamespace", { prefix: "a", uri: "uri:nsa" } ]
|
||||
|
||||
, [ "attribute", { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } ]
|
||||
|
||||
, [ "opentag", { name: "ns2", prefix: "", local: "ns2", uri: "",
|
||||
attributes: { "xmlns:a": { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } },
|
||||
ns: { a: "uri:nsa" } } ]
|
||||
|
||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ]
|
||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "",
|
||||
attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } },
|
||||
ns: { a: 'uri:nsa' } } ]
|
||||
, [ "closetag", "plain" ]
|
||||
|
||||
, [ "attribute", { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } ]
|
||||
, [ "opentag", { name: "a:ns", prefix: "a", local: "ns", uri: "uri:nsa",
|
||||
attributes: { "a:attr": { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } },
|
||||
ns: { a: 'uri:nsa' } } ]
|
||||
, [ "closetag", "a:ns" ]
|
||||
|
||||
, [ "closetag", "ns2" ]
|
||||
|
||||
, [ "closenamespace", { prefix: "a", uri: "uri:nsa" } ]
|
||||
|
||||
, [ "closetag", "root" ]
|
||||
]
|
||||
, strict : true
|
||||
, opt : { xmlns: true }
|
||||
}
|
||||
)
|
||||
|
15
node_modules/elementtree/node_modules/sax/test/xmlns-unbound.js
generated
vendored
Normal file
15
node_modules/elementtree/node_modules/sax/test/xmlns-unbound.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
require(__dirname).test(
|
||||
{ strict : true
|
||||
, opt : { xmlns: true }
|
||||
, expect :
|
||||
[ ["error", "Unbound namespace prefix: \"unbound\"\nLine: 0\nColumn: 28\nChar: >"]
|
||||
|
||||
, [ "attribute", { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } ]
|
||||
, [ "opentag", { name: "root", uri: "", prefix: "", local: "root",
|
||||
attributes: { "unbound:attr": { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } },
|
||||
ns: {} } ]
|
||||
, [ "closetag", "root" ]
|
||||
]
|
||||
}
|
||||
).write("<root unbound:attr='value'/>")
|
35
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js
generated
vendored
Normal file
35
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
require(__dirname).test(
|
||||
{ xml : "<root xml:lang='en'/>"
|
||||
, expect :
|
||||
[ [ "attribute"
|
||||
, { name: "xml:lang"
|
||||
, local: "lang"
|
||||
, prefix: "xml"
|
||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
||||
, value: "en"
|
||||
}
|
||||
]
|
||||
, [ "opentag"
|
||||
, { name: "root"
|
||||
, uri: ""
|
||||
, prefix: ""
|
||||
, local: "root"
|
||||
, attributes:
|
||||
{ "xml:lang":
|
||||
{ name: "xml:lang"
|
||||
, local: "lang"
|
||||
, prefix: "xml"
|
||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
||||
, value: "en"
|
||||
}
|
||||
}
|
||||
, ns: {}
|
||||
}
|
||||
]
|
||||
, ["closetag", "root"]
|
||||
]
|
||||
, strict : true
|
||||
, opt : { xmlns: true }
|
||||
}
|
||||
)
|
||||
|
20
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-prefix.js
generated
vendored
Normal file
20
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-prefix.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
require(__dirname).test(
|
||||
{ xml : "<xml:root/>"
|
||||
, expect :
|
||||
[
|
||||
[ "opentag"
|
||||
, { name: "xml:root"
|
||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
||||
, prefix: "xml"
|
||||
, local: "root"
|
||||
, attributes: {}
|
||||
, ns: {}
|
||||
}
|
||||
]
|
||||
, ["closetag", "xml:root"]
|
||||
]
|
||||
, strict : true
|
||||
, opt : { xmlns: true }
|
||||
}
|
||||
)
|
||||
|
40
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-redefine.js
generated
vendored
Normal file
40
node_modules/elementtree/node_modules/sax/test/xmlns-xml-default-redefine.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
require(__dirname).test(
|
||||
{ xml : "<xml:root xmlns:xml='ERROR'/>"
|
||||
, expect :
|
||||
[ ["error"
|
||||
, "xml: prefix must be bound to http://www.w3.org/XML/1998/namespace\n"
|
||||
+ "Actual: ERROR\n"
|
||||
+ "Line: 0\nColumn: 27\nChar: '"
|
||||
]
|
||||
, [ "attribute"
|
||||
, { name: "xmlns:xml"
|
||||
, local: "xml"
|
||||
, prefix: "xmlns"
|
||||
, uri: "http://www.w3.org/2000/xmlns/"
|
||||
, value: "ERROR"
|
||||
}
|
||||
]
|
||||
, [ "opentag"
|
||||
, { name: "xml:root"
|
||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
||||
, prefix: "xml"
|
||||
, local: "root"
|
||||
, attributes:
|
||||
{ "xmlns:xml":
|
||||
{ name: "xmlns:xml"
|
||||
, local: "xml"
|
||||
, prefix: "xmlns"
|
||||
, uri: "http://www.w3.org/2000/xmlns/"
|
||||
, value: "ERROR"
|
||||
}
|
||||
}
|
||||
, ns: {}
|
||||
}
|
||||
]
|
||||
, ["closetag", "xml:root"]
|
||||
]
|
||||
, strict : true
|
||||
, opt : { xmlns: true }
|
||||
}
|
||||
)
|
||||
|
17
node_modules/properties-parser/play-ground.js
generated
vendored
Normal file
17
node_modules/properties-parser/play-ground.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
var parser = require("./");
|
||||
var editor = parser.createEditor();
|
||||
|
||||
editor.set("ok", "hi");
|
||||
editor.set("hi", "ok");
|
||||
|
||||
console.log(editor.toString());
|
||||
|
||||
editor.unset("hi");
|
||||
|
||||
console.log("===================");
|
||||
console.log(editor.toString());
|
||||
|
||||
editor.unset("ok");
|
||||
|
||||
console.log("===================");
|
||||
console.log(editor.toString());
|
BIN
node_modules/properties-parser/test/ReadProperties.class
generated
vendored
Executable file
BIN
node_modules/properties-parser/test/ReadProperties.class
generated
vendored
Executable file
Binary file not shown.
61
node_modules/properties-parser/test/ReadProperties.java
generated
vendored
Normal file
61
node_modules/properties-parser/test/ReadProperties.java
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class ReadProperties {
|
||||
public static void main(String[] args) throws IOException {
|
||||
if(args.length <= 0) { System.out.println("No file provided."); return; }
|
||||
|
||||
File f = new File(args[0]);
|
||||
|
||||
if(!f.exists()) { System.out.println("File not found: " + args[0]); return; }
|
||||
|
||||
Properties prop = new Properties();
|
||||
prop.load(new FileInputStream(f));
|
||||
|
||||
boolean isFirst = true; // I fucking hate java, why don't they have a native string join function?
|
||||
System.out.print("{");
|
||||
for (Map.Entry<Object, Object> item : prop.entrySet()) {
|
||||
String key = (String) item.getKey();
|
||||
String value = (String) item.getValue();
|
||||
|
||||
if(isFirst) { isFirst = false; }
|
||||
else { System.out.print(","); }
|
||||
|
||||
System.out.print("\"" + escape(key) + "\":\"" + escape(value) + "\"");
|
||||
}
|
||||
System.out.print("}");
|
||||
}
|
||||
|
||||
static String escape(String s) { // Taken from http://code.google.com/p/json-simple/
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for(int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch(ch) {
|
||||
case '"': sb.append("\\\""); break;
|
||||
case '\\': sb.append("\\\\"); break;
|
||||
case '\b': sb.append("\\b"); break;
|
||||
case '\f': sb.append("\\f"); break;
|
||||
case '\n': sb.append("\\n"); break;
|
||||
case '\r': sb.append("\\r"); break;
|
||||
case '\t': sb.append("\\t"); break;
|
||||
case '/': sb.append("\\/"); break;
|
||||
default:
|
||||
//Reference: http://www.unicode.org/versions/Unicode5.1.0/
|
||||
if (('\u0000' <= ch && ch <= '\u001F')
|
||||
|| ('\u007F' <= ch && ch <= '\u009F')
|
||||
|| ('\u2000' <= ch && ch <= '\u20FF')) {
|
||||
String ss = Integer.toHexString(ch);
|
||||
sb.append("\\u");
|
||||
for(int k = ss.length(); k < 4; k++) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(ss.toUpperCase());
|
||||
} else {
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
16
node_modules/properties-parser/test/test-cases-copy.properties
generated
vendored
Normal file
16
node_modules/properties-parser/test/test-cases-copy.properties
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
lala=whatever
|
||||
website = whatever
|
||||
language = whatever
|
||||
# The backslash below tells the application to continue reading
|
||||
# the value onto the next line.
|
||||
message = whatever
|
||||
# Add spaces to the key
|
||||
key\ with\ spaces = whatever
|
||||
# Unicode
|
||||
tab : whatever
|
||||
long-unicode : whatever
|
||||
space\ separator key val \n three
|
||||
another-test :whatever
|
||||
null-prop
|
18
node_modules/properties-parser/test/test-cases.properties
generated
vendored
Normal file
18
node_modules/properties-parser/test/test-cases.properties
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
lala=\u210A the foo foo \
|
||||
lalala;
|
||||
website = http://en.wikipedia.org/
|
||||
language = English
|
||||
# The backslash below tells the application to continue reading
|
||||
# the value onto the next line.
|
||||
message = Welcome to \
|
||||
Wikipedia!
|
||||
# Add spaces to the key
|
||||
key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
|
||||
# Unicode
|
||||
tab : \u0009
|
||||
long-unicode : \u00000009
|
||||
space\ separator key val \n three
|
||||
another-test ::: hihi
|
||||
null-prop
|
123
node_modules/properties-parser/test/test.js
generated
vendored
Normal file
123
node_modules/properties-parser/test/test.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
var fs = require("fs");
|
||||
var assert = require("assert");
|
||||
var prop = require("../index.js");
|
||||
|
||||
var syncData = prop.read("./test-cases.properties");
|
||||
prop.read("./test-cases.properties", function(err, data) {
|
||||
assert.deepEqual(data, syncData);
|
||||
assert.equal(data["lala"], 'ℊ the foo foo lalala;');
|
||||
assert.equal(data["website"], 'http://en.wikipedia.org/');
|
||||
assert.equal(data["language"], 'English');
|
||||
assert.equal(data["message"], 'Welcome to Wikipedia!');
|
||||
assert.equal(data["key with spaces"], 'This is the value that could be looked up with the key "key with spaces".');
|
||||
assert.equal(data["tab"], '\t');
|
||||
assert.equal(data["long-unicode"], '\u00000009');
|
||||
assert.equal(data["space separator"], 'key val \n three');
|
||||
assert.equal(data["another-test"], ':: hihi');
|
||||
assert.equal(data["null-prop"], '');
|
||||
assert.ok(data["valueOf"] == null, "Properties are set that shouldn't be (valueOf)");
|
||||
assert.ok(data["toString"] == null, "Properties are set that shouldn't be (toString)");
|
||||
|
||||
console.log("Tests all passed...");
|
||||
|
||||
if(process.argv[2] === "repl") {
|
||||
var repl = require("repl").start("test-repl> ");
|
||||
repl.context.data = data;
|
||||
repl.context.prop = prop;
|
||||
}
|
||||
});
|
||||
|
||||
var editor1 = prop.createEditor();
|
||||
editor1.set("basic", "prop1");
|
||||
assert.equal(editor1.toString(), "basic=prop1");
|
||||
editor1.set("basic", "prop2", "A comment\nmulti-line1");
|
||||
assert.equal(editor1.toString(), "# A comment\n# multi-line1\nbasic=prop2");
|
||||
editor1.set("basic", "prop3", "A comment\nmulti-line2");
|
||||
assert.equal(editor1.toString(), "# A comment\n# multi-line2\nbasic=prop3");
|
||||
editor1.set("basic", "prop4");
|
||||
assert.equal(editor1.toString(), "# A comment\n# multi-line2\nbasic=prop4");
|
||||
editor1.set("basic", "prop5", null); // Delete's comment
|
||||
assert.equal(editor1.toString(), "basic=prop5");
|
||||
editor1.set("basic1", "prop6");
|
||||
assert.equal(editor1.toString(), "basic=prop5\nbasic1=prop6");
|
||||
editor1.addHeadComment("Head Comment");
|
||||
assert.equal(editor1.toString(), "# Head Comment\nbasic=prop5\nbasic1=prop6");
|
||||
assert.ok(editor1.get("valueOf") == null);
|
||||
assert.ok(editor1.get("toString") == null);
|
||||
|
||||
var editor2 = prop.createEditor("./test-cases.properties");
|
||||
assert.equal(fs.readFileSync("./test-cases.properties").toString(), editor2.toString());
|
||||
editor2.set("lala", "prop1");
|
||||
assert.ok(editor2.toString().indexOf("lala=prop1") > -1);
|
||||
editor2.set("lala", "prop2", "A comment\nmulti-line1");
|
||||
assert.ok(editor2.toString().indexOf("# A comment\n# multi-line1\nlala=prop2") > -1);
|
||||
editor2.set("lala", "prop3", "A comment\nmulti-line2");
|
||||
assert.ok(editor2.toString().indexOf("# A comment\n# multi-line2\nlala=prop3") > -1);
|
||||
editor2.set("lala", "prop4");
|
||||
assert.ok(editor2.toString().indexOf("# A comment\n# multi-line2\nlala=prop4") > -1);
|
||||
editor2.set("lala", "prop5", null); // Delete's comment
|
||||
assert.ok(editor2.toString().indexOf("! The exclamation mark can also mark text as comments.\nlala=prop5") > -1);
|
||||
editor2.set("basic-non-existing", "prop6");
|
||||
assert.ok(editor2.toString().indexOf("\nbasic-non-existing=prop6") > -1);
|
||||
editor2.addHeadComment("Head Comment");
|
||||
assert.equal(editor2.toString().indexOf("# Head Comment\n"), 0);
|
||||
assert.ok(editor2.get("valueOf") == null);
|
||||
assert.ok(editor2.get("toString") == null);
|
||||
|
||||
var editor3 = prop.createEditor();
|
||||
editor3.set("stay", "ok");
|
||||
|
||||
editor3.unset("key");
|
||||
editor3.unset("key", null);
|
||||
editor3.unset("key", undefined);
|
||||
assert.equal(editor3.toString().trim(), "stay=ok");
|
||||
|
||||
editor3.set("key", "val");
|
||||
editor3.unset("key");
|
||||
assert.equal(editor3.toString().trim(), "stay=ok");
|
||||
|
||||
editor3.set("key", "val");
|
||||
editor3.set("key", null);
|
||||
assert.equal(editor3.toString().trim(), "stay=ok");
|
||||
|
||||
editor3.set("key", "val");
|
||||
editor3.set("key", undefined);
|
||||
assert.equal(editor3.toString().trim(), "stay=ok");
|
||||
|
||||
prop.createEditor("./test-cases.properties", function(err, editor) {
|
||||
var properties = {};
|
||||
properties.lala = 'whatever';
|
||||
properties.website = 'whatever';
|
||||
properties.language = 'whatever';
|
||||
properties.message = 'whatever';
|
||||
properties['key with spaces'] = 'whatever';
|
||||
properties.tab = 'whatever';
|
||||
properties['long-unicode'] = 'whatever';
|
||||
properties['another-test'] = 'whatever';
|
||||
for (var item in properties) {
|
||||
editor.set(item, properties[item]);
|
||||
}
|
||||
|
||||
assert.equal(
|
||||
editor.toString(),
|
||||
'# You are reading the ".properties" entry.\n' +
|
||||
'! The exclamation mark can also mark text as comments.\n' +
|
||||
'lala=whatever\n' +
|
||||
'website = whatever\n' +
|
||||
'language = whatever\n' +
|
||||
'# The backslash below tells the application to continue reading\n' +
|
||||
'# the value onto the next line.\n' +
|
||||
'message = whatever\n' +
|
||||
'# Add spaces to the key\n' +
|
||||
'key\\ with\\ spaces = whatever\n' +
|
||||
'# Unicode\n' +
|
||||
'tab : whatever\n' +
|
||||
'long-unicode : whatever\n' +
|
||||
'space\\ separator key val \\n three\n' +
|
||||
'another-test :whatever\n' +
|
||||
' null-prop'
|
||||
);
|
||||
});
|
||||
|
||||
// java ReadProperties test-cases.properties
|
||||
// javac ReadProperties.java
|
Loading…
Reference in New Issue
Block a user