plist 0.4.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jshintrc +4 -0
- package/.travis.yml +34 -0
- package/History.md +122 -0
- package/LICENSE +3 -1
- package/Makefile +76 -0
- package/README.md +83 -32
- package/dist/plist-build.js +3982 -0
- package/dist/plist-parse.js +4055 -0
- package/dist/plist.js +7987 -0
- package/examples/browser/index.html +14 -0
- package/lib/build.js +138 -0
- package/lib/node.js +49 -0
- package/lib/parse.js +200 -0
- package/lib/plist.js +16 -294
- package/package.json +16 -13
- package/.npmignore +0 -2
- package/tests/Cordova.plist +0 -87
- package/tests/Xcode-Info.plist +0 -49
- package/tests/Xcode-PhoneGap.plist +0 -55
- package/tests/airplay.xml +0 -38
- package/tests/iTunes-BIG.xml +0 -299484
- package/tests/iTunes-small.xml +0 -1704
- package/tests/sample1.plist +0 -35
- package/tests/sample2.plist +0 -45
- package/tests/test-base64.js +0 -28
- package/tests/test-big-xml.js +0 -28
- package/tests/test-build.js +0 -171
- package/tests/test-parseFile.js +0 -52
- package/tests/test-parseString.js +0 -45
- package/tests/utf8data.xml +0 -10
package/.jshintrc
ADDED
package/.travis.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
language: node_js
|
|
2
|
+
node_js:
|
|
3
|
+
- '0.10'
|
|
4
|
+
- '0.11'
|
|
5
|
+
- '4.0'
|
|
6
|
+
- '4.1'
|
|
7
|
+
env:
|
|
8
|
+
global:
|
|
9
|
+
- secure: xlLmWO7akYQjmDgrv6/b/ZMGILF8FReD+k6A/u8pYRD2JW29hhwvRwIQGcKp9+zmJdn4i5M4D1/qJkCeI3pdhAYBDHvzHOHSEwLJz1ESB2Crv6fa69CtpIufQkWvIxmZoU49tCaLpMBaIroGihJ4DAXdIVOIz6Ur9vXLDhGsE4c=
|
|
10
|
+
- secure: aQ46RdxL10xR5ZJJTMUKdH5k4tdrzgZ87nlwHC+pTr6bfRw3UKYC+6Rm7yQpg9wq0Io9O9dYCP007gQGSWstbjr1+jXNu/ubtNG+q5cpWBQZZZ013VHh9QJTf1MnetsZxbv8Yhrjg590s6vruT0oqesOnB2CizO/BsKxnY37Nos=
|
|
11
|
+
matrix:
|
|
12
|
+
include:
|
|
13
|
+
- node_js: '0.10'
|
|
14
|
+
env: BROWSER_NAME=chrome BROWSER_VERSION=latest
|
|
15
|
+
- node_js: '0.10'
|
|
16
|
+
env: BROWSER_NAME=chrome BROWSER_VERSION=29
|
|
17
|
+
- node_js: '0.10'
|
|
18
|
+
env: BROWSER_NAME=firefox BROWSER_VERSION=latest
|
|
19
|
+
- node_js: '0.10'
|
|
20
|
+
env: BROWSER_NAME=opera BROWSER_VERSION=latest
|
|
21
|
+
- node_js: '0.10'
|
|
22
|
+
env: BROWSER_NAME=safari BROWSER_VERSION=latest
|
|
23
|
+
- node_js: '0.10'
|
|
24
|
+
env: BROWSER_NAME=safari BROWSER_VERSION=7
|
|
25
|
+
- node_js: '0.10'
|
|
26
|
+
env: BROWSER_NAME=safari BROWSER_VERSION=6
|
|
27
|
+
- node_js: '0.10'
|
|
28
|
+
env: BROWSER_NAME=safari BROWSER_VERSION=5
|
|
29
|
+
- node_js: '0.10'
|
|
30
|
+
env: BROWSER_NAME=ie BROWSER_VERSION=11
|
|
31
|
+
- node_js: '0.10'
|
|
32
|
+
env: BROWSER_NAME=ie BROWSER_VERSION=10
|
|
33
|
+
- node_js: '0.10'
|
|
34
|
+
env: BROWSER_NAME=ie BROWSER_VERSION=9
|
package/History.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
1.2.0 / 2015-11-10
|
|
2
|
+
|
|
3
|
+
* package: update "browserify" to v12.0.1
|
|
4
|
+
* package: update "zuul" to v3.7.2
|
|
5
|
+
* package: update "xmlbuilder" to v4.0.0
|
|
6
|
+
* package: update "util-deprecate" to v1.0.2
|
|
7
|
+
* package: update "mocha" to v2.3.3
|
|
8
|
+
* package: update "base64-js" to v0.0.8
|
|
9
|
+
* build: omit undefined values
|
|
10
|
+
* travis: add node 4.0 and 4.1 to test matrix
|
|
11
|
+
|
|
12
|
+
1.1.0 / 2014-08-27
|
|
13
|
+
==================
|
|
14
|
+
|
|
15
|
+
* package: update "browserify" to v5.10.1
|
|
16
|
+
* package: update "zuul" to v1.10.2
|
|
17
|
+
* README: add "Sauce Test Status" build badge
|
|
18
|
+
* travis: use new "plistjs" sauce credentials
|
|
19
|
+
* travis: set up zuul saucelabs automated testing
|
|
20
|
+
|
|
21
|
+
1.0.1 / 2014-06-25
|
|
22
|
+
==================
|
|
23
|
+
|
|
24
|
+
* add .zuul.yml file for browser testing
|
|
25
|
+
* remove Testling stuff
|
|
26
|
+
* build: fix global variable `val` leak
|
|
27
|
+
* package: use --check-leaks when running mocha tests
|
|
28
|
+
* README: update examples to use preferred API
|
|
29
|
+
* package: add "browser" keyword
|
|
30
|
+
|
|
31
|
+
1.0.0 / 2014-05-20
|
|
32
|
+
==================
|
|
33
|
+
|
|
34
|
+
* package: remove "android-browser"
|
|
35
|
+
* test: add <dict> build() test
|
|
36
|
+
* test: re-add the empty string build() test
|
|
37
|
+
* test: remove "fixtures" and legacy "tests" dir
|
|
38
|
+
* test: add some more build() tests
|
|
39
|
+
* test: add a parse() CDATA test
|
|
40
|
+
* test: starting on build() tests
|
|
41
|
+
* test: more parse() tests
|
|
42
|
+
* package: attempt to fix "android-browser" testling
|
|
43
|
+
* parse: better <data> with newline handling
|
|
44
|
+
* README: add Testling badge
|
|
45
|
+
* test: add <data> node tests
|
|
46
|
+
* test: add a <date> parse() test
|
|
47
|
+
* travis: don't test node v0.6 or v0.8
|
|
48
|
+
* test: some more parse() tests
|
|
49
|
+
* test: add simple <string> parsing test
|
|
50
|
+
* build: add support for an optional "opts" object
|
|
51
|
+
* package: test mobile devices
|
|
52
|
+
* test: use multiline to inline the XML
|
|
53
|
+
* package: beautify
|
|
54
|
+
* package: fix "mocha" harness
|
|
55
|
+
* package: more testling browsers
|
|
56
|
+
* build: add the "version=1.0" attribute
|
|
57
|
+
* beginnings of "mocha" tests
|
|
58
|
+
* build: more JSDocs
|
|
59
|
+
* tests: add test that ensures that empty string conversion works
|
|
60
|
+
* build: update "xmlbuilder" to v2.2.1
|
|
61
|
+
* parse: ignore comment and cdata nodes
|
|
62
|
+
* tests: make the "Newlines" test actually contain a newline
|
|
63
|
+
* parse: lint
|
|
64
|
+
* test travis
|
|
65
|
+
* README: add Travis CI badge
|
|
66
|
+
* add .travis.yml file
|
|
67
|
+
* build: updated DTD to reflect name change
|
|
68
|
+
* parse: return falsey values in an Array plist
|
|
69
|
+
* build: fix encoding a typed array in the browser
|
|
70
|
+
* build: add support for Typed Arrays and ArrayBuffers
|
|
71
|
+
* build: more lint
|
|
72
|
+
* build: slight cleanup and optimizations
|
|
73
|
+
* build: use .txt() for the "date" value
|
|
74
|
+
* parse: always return a Buffer for <data> nodes
|
|
75
|
+
* build: don't interpret Strings as base64
|
|
76
|
+
* dist: commit prebuilt plist*.js files
|
|
77
|
+
* parse: fix typo in deprecate message
|
|
78
|
+
* parse: fix parse() return value
|
|
79
|
+
* parse: add jsdoc comments for the deprecated APIs
|
|
80
|
+
* parse: add `parse()` function
|
|
81
|
+
* node, parse: use `util-deprecate` module
|
|
82
|
+
* re-implemented parseFile to be asynchronous
|
|
83
|
+
* node: fix jsdoc comment
|
|
84
|
+
* Makefile: fix "node" require stubbing
|
|
85
|
+
* examples: add "browser" example
|
|
86
|
+
* package: tweak "main"
|
|
87
|
+
* package: remove "engines" field
|
|
88
|
+
* Makefile: fix --exclude command for browserify
|
|
89
|
+
* package: update "description"
|
|
90
|
+
* lib: more styling
|
|
91
|
+
* Makefile: add -build.js and -parse.js dist files
|
|
92
|
+
* lib: separate out the parse and build logic into their own files
|
|
93
|
+
* Makefile: add makefile with browserify build rules
|
|
94
|
+
* package: add "browserify" as a dev dependency
|
|
95
|
+
* plist: tabs to spaces (again)
|
|
96
|
+
* add a .jshintrc file
|
|
97
|
+
* LICENSE: update
|
|
98
|
+
* node-webkit support
|
|
99
|
+
* Ignore tests/ in .npmignore file
|
|
100
|
+
* Remove duplicate devDependencies key
|
|
101
|
+
* Remove trailing whitespace
|
|
102
|
+
* adding recent contributors. Bumping npm package number (patch release)
|
|
103
|
+
* Fixed node.js string handling
|
|
104
|
+
* bumping version number
|
|
105
|
+
* Fixed global variable plist leak
|
|
106
|
+
* patch release 0.4.1
|
|
107
|
+
* removed temporary debug output file
|
|
108
|
+
* flipping the cases for writing data and string elements in build(). removed the 125 length check. Added validation of base64 encoding for data fields when parsing. added unit tests.
|
|
109
|
+
* fixed syntax errors in README examples (issue #20)
|
|
110
|
+
* added Sync versions of calls. added deprecation warnings for old method calls. updated documentation. If the resulting object from parseStringSync is an array with 1 element, return just the element. If a plist string or file doesnt have a <plist> tag as the document root element, fail noisily (issue #15)
|
|
111
|
+
* incrementing package version
|
|
112
|
+
* added cross platform base64 encode/decode for data elements (issue #17.) Comments and hygiene.
|
|
113
|
+
* refactored the code to use a DOM parser instead of SAX. closes issues #5 and #16
|
|
114
|
+
* rolling up package version
|
|
115
|
+
* updated base64 detection regexp. updated README. hygiene.
|
|
116
|
+
* refactored the build function. Fixes issue #14
|
|
117
|
+
* refactored tests. Modified tests from issue #9. thanks @sylvinus
|
|
118
|
+
* upgrade xmlbuilder package version. this is why .end() was needed in last commit; breaking change to xmlbuilder lib. :/
|
|
119
|
+
* bug fix in build function, forgot to call .end() Refactored tests to use nodeunit
|
|
120
|
+
* Implemented support for real, identity tests
|
|
121
|
+
* Refactored base64 detection - still sloppy, fixed date building. Passing tests OK.
|
|
122
|
+
* Implemented basic plist builder that turns an existing JS object into plist XML. date, real and data types still need to be implemented.
|
package/LICENSE
CHANGED
package/Makefile
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
|
3
|
+
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
4
|
+
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
|
5
|
+
|
|
6
|
+
# BIN directory
|
|
7
|
+
BIN := $(THIS_DIR)/node_modules/.bin
|
|
8
|
+
|
|
9
|
+
# applications
|
|
10
|
+
NODE ?= node
|
|
11
|
+
NPM ?= $(NODE) $(shell which npm)
|
|
12
|
+
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
|
13
|
+
MOCHA ?= $(NODE) $(BIN)/mocha
|
|
14
|
+
ZUUL ?= $(NODE) $(BIN)/zuul
|
|
15
|
+
|
|
16
|
+
REPORTER ?= spec
|
|
17
|
+
|
|
18
|
+
all: dist/plist.js dist/plist-build.js dist/plist-parse.js
|
|
19
|
+
|
|
20
|
+
install: node_modules
|
|
21
|
+
|
|
22
|
+
clean:
|
|
23
|
+
@rm -rf node_modules dist
|
|
24
|
+
|
|
25
|
+
dist:
|
|
26
|
+
@mkdir -p $@
|
|
27
|
+
|
|
28
|
+
dist/plist-build.js: node_modules lib/build.js dist
|
|
29
|
+
@$(BROWSERIFY) \
|
|
30
|
+
--standalone plist \
|
|
31
|
+
lib/build.js > $@
|
|
32
|
+
|
|
33
|
+
dist/plist-parse.js: node_modules lib/parse.js dist
|
|
34
|
+
@$(BROWSERIFY) \
|
|
35
|
+
--standalone plist \
|
|
36
|
+
lib/parse.js > $@
|
|
37
|
+
|
|
38
|
+
dist/plist.js: node_modules lib/*.js dist
|
|
39
|
+
@$(BROWSERIFY) \
|
|
40
|
+
--standalone plist \
|
|
41
|
+
--ignore lib/node.js \
|
|
42
|
+
lib/plist.js > $@
|
|
43
|
+
|
|
44
|
+
node_modules: package.json
|
|
45
|
+
@NODE_ENV= $(NPM) install
|
|
46
|
+
@touch node_modules
|
|
47
|
+
|
|
48
|
+
test:
|
|
49
|
+
@if [ "x$(BROWSER_NAME)" = "x" ]; then \
|
|
50
|
+
$(MAKE) test-node; \
|
|
51
|
+
else \
|
|
52
|
+
$(MAKE) test-zuul; \
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
test-node:
|
|
56
|
+
@$(MOCHA) \
|
|
57
|
+
--reporter $(REPORTER) \
|
|
58
|
+
test/*.js
|
|
59
|
+
|
|
60
|
+
test-zuul:
|
|
61
|
+
@if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \
|
|
62
|
+
$(ZUUL) \
|
|
63
|
+
--ui mocha-bdd \
|
|
64
|
+
--browser-name $(BROWSER_NAME) \
|
|
65
|
+
--browser-version $(BROWSER_VERSION) \
|
|
66
|
+
test/*.js; \
|
|
67
|
+
else \
|
|
68
|
+
$(ZUUL) \
|
|
69
|
+
--ui mocha-bdd \
|
|
70
|
+
--browser-name $(BROWSER_NAME) \
|
|
71
|
+
--browser-version $(BROWSER_VERSION) \
|
|
72
|
+
--browser-platform "$(BROWSER_PLATFORM)" \
|
|
73
|
+
test/*.js; \
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
.PHONY: all install clean test test-node test-zuul
|
package/README.md
CHANGED
|
@@ -1,62 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
plist.js
|
|
2
|
+
========
|
|
3
|
+
### Mac OS X Plist parser/builder for Node.js and browsers
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
[](https://saucelabs.com/u/plistjs)
|
|
6
|
+
|
|
7
|
+
[](https://travis-ci.org/TooTallNate/plist.js)
|
|
8
|
+
|
|
9
|
+
Provides facilities for reading and writing Mac OS X Plist (property list)
|
|
10
|
+
files. These are often used in programming OS X and iOS applications, as
|
|
11
|
+
well as the iTunes configuration XML file.
|
|
5
12
|
|
|
6
13
|
Plist files represent stored programming "object"s. They are very similar
|
|
7
|
-
to JSON. A valid Plist file is representable as a native JavaScript Object
|
|
14
|
+
to JSON. A valid Plist file is representable as a native JavaScript Object
|
|
15
|
+
and vice-versa.
|
|
8
16
|
|
|
9
|
-
## Tests
|
|
10
|
-
`npm test`
|
|
11
17
|
|
|
12
18
|
## Usage
|
|
13
|
-
Parsing a plist from filename
|
|
14
|
-
``` javascript
|
|
15
|
-
var plist = require('plist');
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
### Node.js
|
|
21
|
+
|
|
22
|
+
Install using `npm`:
|
|
23
|
+
|
|
24
|
+
``` bash
|
|
25
|
+
$ npm install --save plist
|
|
19
26
|
```
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
Then `require()` the _plist_ module in your file:
|
|
29
|
+
|
|
30
|
+
``` js
|
|
23
31
|
var plist = require('plist');
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
// now use the `parse()` and `build()` functions
|
|
34
|
+
var val = plist.parse('<plist><string>Hello World!</string></plist>');
|
|
35
|
+
console.log(val); // "Hello World!"
|
|
27
36
|
```
|
|
28
37
|
|
|
29
|
-
Given an existing JavaScript Object, you can turn it into an XML document that complies with the plist DTD
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
var plist = require('plist');
|
|
39
|
+
### Browser
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
Include the `dist/plist.js` in a `<script>` tag in your HTML file:
|
|
42
|
+
|
|
43
|
+
``` html
|
|
44
|
+
<script src="plist.js"></script>
|
|
45
|
+
<script>
|
|
46
|
+
// now use the `parse()` and `build()` functions
|
|
47
|
+
var val = plist.parse('<plist><string>Hello World!</string></plist>');
|
|
48
|
+
console.log(val); // "Hello World!"
|
|
49
|
+
</script>
|
|
35
50
|
```
|
|
36
51
|
|
|
37
52
|
|
|
53
|
+
## API
|
|
54
|
+
|
|
55
|
+
### Parsing
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
These functions work, but may be removed in a future release. version 0.4.x added Sync versions of these functions.
|
|
57
|
+
Parsing a plist from filename:
|
|
41
58
|
|
|
42
|
-
Parsing a plist from filename
|
|
43
59
|
``` javascript
|
|
60
|
+
var fs = require('fs');
|
|
44
61
|
var plist = require('plist');
|
|
45
62
|
|
|
46
|
-
plist.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
console.log(JSON.stringify(obj));
|
|
50
|
-
});
|
|
63
|
+
var obj = plist.parse(fs.readFileSync('myPlist.plist', 'utf8'));
|
|
64
|
+
console.log(JSON.stringify(obj));
|
|
51
65
|
```
|
|
52
66
|
|
|
53
|
-
Parsing a plist from string payload
|
|
67
|
+
Parsing a plist from string payload:
|
|
68
|
+
|
|
54
69
|
``` javascript
|
|
55
70
|
var plist = require('plist');
|
|
56
71
|
|
|
57
|
-
plist.
|
|
58
|
-
|
|
72
|
+
var obj = plist.parse('<plist><string>Hello World!</string></plist>');
|
|
73
|
+
console.log(obj); // Hello World!
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Building
|
|
77
|
+
|
|
78
|
+
Given an existing JavaScript Object, you can turn it into an XML document
|
|
79
|
+
that complies with the plist DTD:
|
|
80
|
+
|
|
81
|
+
``` javascript
|
|
82
|
+
var plist = require('plist');
|
|
59
83
|
|
|
60
|
-
|
|
61
|
-
});
|
|
84
|
+
console.log(plist.build({ foo: 'bar' }));
|
|
62
85
|
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
(The MIT License)
|
|
91
|
+
|
|
92
|
+
Copyright (c) 2010-2014 Nathan Rajlich <nathan@tootallnate.net>
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person
|
|
95
|
+
obtaining a copy of this software and associated documentation
|
|
96
|
+
files (the "Software"), to deal in the Software without
|
|
97
|
+
restriction, including without limitation the rights to use,
|
|
98
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
99
|
+
copies of the Software, and to permit persons to whom the
|
|
100
|
+
Software is furnished to do so, subject to the following
|
|
101
|
+
conditions:
|
|
102
|
+
|
|
103
|
+
The above copyright notice and this permission notice shall be
|
|
104
|
+
included in all copies or substantial portions of the Software.
|
|
105
|
+
|
|
106
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
107
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
108
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
109
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
110
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
111
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
112
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
113
|
+
OTHER DEALINGS IN THE SOFTWARE.
|