http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/node_modules/unorm/package.json ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/node_modules/unorm/package.json b/node_modules/cordova-common/node_modules/unorm/package.json deleted file mode 100644 index a978cb1..0000000 --- a/node_modules/cordova-common/node_modules/unorm/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "unorm", - "version": "1.4.1", - "description": "JavaScript Unicode 8.0 Normalization - NFC, NFD, NFKC, NFKD. Read <http://unicode.org/reports/tr15/> UAX #15 Unicode Normalization Forms.", - "author": { - "name": "Bjarke Walling", - "email": "[email protected]" - }, - "license": "MIT or GPL-2.0", - "contributors": [ - { - "name": "Bjarke Walling", - "email": "[email protected]" - }, - { - "name": "Oleg Grenrus", - "email": "[email protected]" - }, - { - "name": "Matsuza", - "email": "[email protected]" - } - ], - "repository": { - "type": "git", - "url": "git+ssh://[email protected]/walling/unorm.git" - }, - "main": "./lib/unorm.js", - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "test": "grunt test" - }, - "devDependencies": { - "benchmark": "~1.0.0", - "unorm": "1.4.1", - "grunt-contrib-jshint": "~0.8.0", - "grunt-contrib-watch": "~0.5.0", - "grunt-simple-mocha": "~0.4.0", - "grunt": "~0.4.1" - }, - "gitHead": "e802d0d7844cf74b03742bce1147a82ace218396", - "bugs": { - "url": "https://github.com/walling/unorm/issues" - }, - "homepage": "https://github.com/walling/unorm", - "_id": "[email protected]", - "_shasum": "364200d5f13646ca8bcd44490271335614792300", - "_from": "unorm@>=1.3.3 <2.0.0", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "walling", - "email": "[email protected]" - }, - "maintainers": [ - { - "name": "walling", - "email": "[email protected]" - } - ], - "dist": { - "shasum": "364200d5f13646ca8bcd44490271335614792300", - "tarball": "http://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz" - }, - "directories": {}, - "_resolved": "http://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz", - "readme": "ERROR: No README data found!" -}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/package.json ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/package.json b/node_modules/cordova-common/package.json index 6c4d7e8..4bd1675 100644 --- a/node_modules/cordova-common/package.json +++ b/node_modules/cordova-common/package.json @@ -1,63 +1,81 @@ { - "author": { - "name": "Apache Software Foundation" + "_args": [ + [ + "cordova-common@^1.1.0", + "/Users/steveng/repo/cordova/cordova-android" + ] + ], + "_from": "cordova-common@>=1.1.0 <2.0.0", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/cordova-common", + "_nodeVersion": "4.2.3", + "_npmOperationalInternal": { + "host": "packages-5-east.internal.npmjs.com", + "tmp": "tmp/cordova-common-1.1.0.tgz_1455781889491_0.6937742941081524" }, - "name": "cordova-common", - "description": "Apache Cordova tools and platforms shared routines", - "license": "Apache-2.0", - "version": "1.0.0", - "repository": { - "type": "git", - "url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git" + "_npmUser": { + "email": "[email protected]", + "name": "kotikov.vladimir" }, - "bugs": { - "url": "https://issues.apache.org/jira/browse/CB", - "email": "[email protected]" + "_npmVersion": "2.14.7", + "_phantomChildren": {}, + "_requested": { + "name": "cordova-common", + "raw": "cordova-common@^1.1.0", + "rawSpec": "^1.1.0", + "scope": null, + "spec": ">=1.1.0 <2.0.0", + "type": "range" }, - "main": "cordova-common.js", - "engines": { - "node": ">=0.9.9" + "_requiredBy": [ + "/" + ], + "_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.1.0.tgz", + "_shasum": "8682721466ee354747ec6241f34f412b7e0ef636", + "_shrinkwrap": null, + "_spec": "cordova-common@^1.1.0", + "_where": "/Users/steveng/repo/cordova/cordova-android", + "author": { + "name": "Apache Software Foundation" }, - "scripts": { - "test": "npm run jshint && npm run jasmine", - "jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec", - "jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec", - "cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec" + "bugs": { + "email": "[email protected]", + "url": "https://issues.apache.org/jira/browse/CB" }, - "engineStrict": true, + "contributors": [], "dependencies": { + "ansi": "^0.3.1", "bplist-parser": "^0.1.0", "cordova-registry-mapper": "^1.1.8", "elementtree": "^0.1.6", "glob": "^5.0.13", "osenv": "^0.1.3", - "plist": "^1.1.0", + "plist": "^1.2.0", "q": "^1.4.1", "semver": "^5.0.1", "shelljs": "^0.5.1", "underscore": "^1.8.3", "unorm": "^1.3.3" }, + "description": "Apache Cordova tools and platforms shared routines", "devDependencies": { "istanbul": "^0.3.17", "jasmine-node": "^1.14.5", "jshint": "^2.8.0" }, - "contributors": [], - "_id": "[email protected]", - "_shasum": "b21947e89a4a89292ec563abf9ee6ccb2b9f3aef", - "_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.0.0.tgz", - "_from": "cordova-common@>=1.0.0 <1.1.0", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "kotikov.vladimir", - "email": "[email protected]" - }, + "directories": {}, "dist": { - "shasum": "b21947e89a4a89292ec563abf9ee6ccb2b9f3aef", - "tarball": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.0.0.tgz" + "shasum": "8682721466ee354747ec6241f34f412b7e0ef636", + "tarball": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.1.0.tgz" + }, + "engineStrict": true, + "engines": { + "node": ">=0.9.9" }, + "license": "Apache-2.0", + "main": "cordova-common.js", "maintainers": [ { "name": "bowserj", @@ -84,6 +102,18 @@ "email": "[email protected]" } ], - "directories": {}, - "readme": "ERROR: No README data found!" + "name": "cordova-common", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git" + }, + "scripts": { + "cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec", + "jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec", + "jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec", + "test": "npm run jshint && npm run jasmine" + }, + "version": "1.1.0" } http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js index a38fca6..a914fc8 100644 --- a/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js +++ b/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js @@ -106,8 +106,8 @@ function remove_plugin_changes(pluginInfo, is_top_level) { // CB-6976 Windows Universal Apps. Compatibility fix for existing plugins. if (self.platform == 'windows' && file == 'package.appxmanifest' && !fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) { - // New windows template separate manifest files for Windows8, Windows8.1 and WP8.1 - var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest']; + // New windows template separate manifest files for Windows10, Windows8.1 and WP8.1 + var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest']; /* jshint loopfunc:true */ substs.forEach(function(subst) { events.emit('verbose', 'Applying munge to ' + subst); @@ -149,7 +149,7 @@ function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increm // CB-6976 Windows Universal Apps. Compatibility fix for existing plugins. if (self.platform == 'windows' && file == 'package.appxmanifest' && !fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) { - var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest']; + var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest']; /* jshint loopfunc:true */ substs.forEach(function(subst) { events.emit('verbose', 'Applying munge to ' + subst); @@ -203,7 +203,6 @@ function generate_plugin_config_munge(pluginInfo, vars) { { var manifests = { 'windows': { - '8.0.0': 'package.windows80.appxmanifest', '8.1.0': 'package.windows.appxmanifest', '10.0.0': 'package.windows10.appxmanifest' }, @@ -212,7 +211,6 @@ function generate_plugin_config_munge(pluginInfo, vars) { '10.0.0': 'package.windows10.appxmanifest' }, 'all': { - '8.0.0': 'package.windows80.appxmanifest', '8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'], '10.0.0': 'package.windows10.appxmanifest' } http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/src/CordovaLogger.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/src/CordovaLogger.js b/node_modules/cordova-common/src/CordovaLogger.js new file mode 100644 index 0000000..06dbcf3 --- /dev/null +++ b/node_modules/cordova-common/src/CordovaLogger.js @@ -0,0 +1,203 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +var ansi = require('ansi'); +var EventEmitter = require('events').EventEmitter; +var CordovaError = require('./CordovaError/CordovaError'); +var EOL = require('os').EOL; + +var INSTANCE; + +/** + * @class CordovaLogger + * + * Implements logging facility that anybody could use. Should not be + * instantiated directly, `CordovaLogger.get()` method should be used instead + * to acquire logger instance + */ +function CordovaLogger () { + this.levels = {}; + this.colors = {}; + this.stdout = process.stdout; + this.stderr = process.stderr; + + this.stdoutCursor = ansi(this.stdout); + this.stderrCursor = ansi(this.stderr); + + this.addLevel('verbose', 1000, 'grey'); + this.addLevel('normal' , 2000); + this.addLevel('warn' , 2000, 'yellow'); + this.addLevel('info' , 3000, 'blue'); + this.addLevel('error' , 5000, 'red'); + this.addLevel('results' , 10000); + + this.setLevel('normal'); +} + +/** + * Static method to create new or acquire existing instance. + * + * @return {CordovaLogger} Logger instance + */ +CordovaLogger.get = function () { + return INSTANCE || (INSTANCE = new CordovaLogger()); +}; + +CordovaLogger.VERBOSE = 'verbose'; +CordovaLogger.NORMAL = 'normal'; +CordovaLogger.WARN = 'warn'; +CordovaLogger.INFO = 'info'; +CordovaLogger.ERROR = 'error'; +CordovaLogger.RESULTS = 'results'; + +/** + * Emits log message to process' stdout/stderr depending on message's severity + * and current log level. If severity is less than current logger's level, + * then the message is ignored. + * + * @param {String} logLevel The message's log level. The logger should have + * corresponding level added (via logger.addLevel), otherwise + * `CordovaLogger.NORMAL` level will be used. + * @param {String} message The message, that should be logged to process' + * stdio + * + * @return {CordovaLogger} Current instance, to allow calls chaining. + */ +CordovaLogger.prototype.log = function (logLevel, message) { + // if there is no such logLevel defined, or provided level has + // less severity than active level, then just ignore this call and return + if (!this.levels[logLevel] || this.levels[logLevel] < this.levels[this.logLevel]) + // return instance to allow to chain calls + return this; + + var isVerbose = this.logLevel === 'verbose'; + var cursor = this.stdoutCursor; + + if(message instanceof Error || logLevel === CordovaLogger.ERROR) { + message = formatError(message, isVerbose); + cursor = this.stderrCursor; + } + + var color = this.colors[logLevel]; + if (color) { + cursor.bold().fg[color](); + } + + cursor.write(message).reset().write(EOL); + + return this; +}; + +/** + * Adds a new level to logger instance. This method also creates a shortcut + * method to log events with the level provided (i.e. after adding new level + * 'debug', the method `debug(message)`, equal to logger.log('debug', message), + * will be added to logger instance) + * + * @param {String} level A log level name. The levels with the following + * names added by default to every instance: 'verbose', 'normal', 'warn', + * 'info', 'error', 'results' + * @param {Number} severity A number that represents level's severity. + * @param {String} color A valid color name, that will be used to log + * messages with this level. Any CSS color code or RGB value is allowed + * (according to ansi documentation: + * https://github.com/TooTallNate/ansi.js#features) + * + * @return {CordovaLogger} Current instance, to allow calls chaining. + */ +CordovaLogger.prototype.addLevel = function (level, severity, color) { + + this.levels[level] = severity; + + if (color) { + this.colors[level] = color; + } + + // Define own method with corresponding name + if (!this[level]) { + this[level] = this.log.bind(this, level); + } + + return this; +}; + +/** + * Sets the current logger level to provided value. If logger doesn't have level + * with this name, `CordovaLogger.NORMAL` will be used. + * + * @param {String} logLevel Level name. The level with this name should be + * added to logger before. + * + * @return {CordovaLogger} Current instance, to allow calls chaining. + */ +CordovaLogger.prototype.setLevel = function (logLevel) { + this.logLevel = this.levels[logLevel] ? logLevel : CordovaLogger.NORMAL; + + return this; +}; + +/** + * Attaches logger to EventEmitter instance provided. + * + * @param {EventEmitter} eventEmitter An EventEmitter instance to attach + * logger to. + * + * @return {CordovaLogger} Current instance, to allow calls chaining. + */ +CordovaLogger.prototype.subscribe = function (eventEmitter) { + + if (!(eventEmitter instanceof EventEmitter)) + throw new Error('Subscribe method only accepts an EventEmitter instance as argument'); + + eventEmitter.on('verbose', this.verbose) + .on('log', this.normal) + .on('info', this.info) + .on('warn', this.warn) + .on('warning', this.warn) + // Set up event handlers for logging and results emitted as events. + .on('results', this.results); + + return this; +}; + +function formatError(error, isVerbose) { + var message = ''; + + if(error instanceof CordovaError) { + message = error.toString(isVerbose); + } else if(error instanceof Error) { + if(isVerbose) { + message = error.stack; + } else { + message = error.message; + } + } else { + // Plain text error message + message = error; + } + + if(message.toUpperCase().indexOf('ERROR:') !== 0) { + // Needed for backward compatibility with external tools + message = 'Error: ' + message; + } + + return message; +} + +module.exports = CordovaLogger; http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/src/PluginInfo/PluginInfo.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/src/PluginInfo/PluginInfo.js b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js index 073f3f9..2554a3c 100644 --- a/node_modules/cordova-common/src/PluginInfo/PluginInfo.js +++ b/node_modules/cordova-common/src/PluginInfo/PluginInfo.js @@ -376,9 +376,6 @@ function addCordova(someArray) { // applied to each element. function _getTags(pelem, tag, platform, transform) { var platformTag = pelem.find('./platform[@name="' + platform + '"]'); - if (platform == 'windows' && !platformTag) { - platformTag = pelem.find('platform[@name="' + 'windows8' + '"]'); - } var tagsInRoot = pelem.findall(tag); tagsInRoot = tagsInRoot || []; var tagsInPlatform = platformTag ? platformTag.findall(tag) : []; @@ -392,9 +389,6 @@ function _getTags(pelem, tag, platform, transform) { // Same as _getTags() but only looks inside a platfrom section. function _getTagsInPlatform(pelem, tag, platform, transform) { var platformTag = pelem.find('./platform[@name="' + platform + '"]'); - if (platform == 'windows' && !platformTag) { - platformTag = pelem.find('platform[@name="' + 'windows8' + '"]'); - } var tags = platformTag ? platformTag.findall(tag) : []; if ( typeof transform === 'function' ) { tags = tags.map(transform); http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/src/events.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/src/events.js b/node_modules/cordova-common/src/events.js index a6ec340..868d363 100644 --- a/node_modules/cordova-common/src/events.js +++ b/node_modules/cordova-common/src/events.js @@ -16,4 +16,50 @@ specific language governing permissions and limitations under the License. */ -module.exports = new (require('events').EventEmitter)(); + +var EventEmitter = require('events').EventEmitter; + +var INSTANCE = new EventEmitter(); +var EVENTS_RECEIVER; + +module.exports = INSTANCE; + +/** + * Sets up current instance to forward emitted events to another EventEmitter + * instance. + * + * @param {EventEmitter} [eventEmitter] The emitter instance to forward + * events to. Falsy value, when passed, disables forwarding. + */ +module.exports.forwardEventsTo = function (eventEmitter) { + + // If no argument is specified disable events forwarding + if (!eventEmitter) { + EVENTS_RECEIVER = undefined; + return; + } + + if (!(eventEmitter instanceof EventEmitter)) + throw new Error('Cordova events could be redirected to another EventEmitter instance only'); + + EVENTS_RECEIVER = eventEmitter; +}; + +var emit = INSTANCE.emit; + +/** + * This method replaces original 'emit' method to allow events forwarding. + * + * @return {eventEmitter} Current instance to allow calls chaining, as + * original 'emit' does + */ +module.exports.emit = function () { + + var args = Array.prototype.slice.call(arguments); + + if (EVENTS_RECEIVER) { + EVENTS_RECEIVER.emit.apply(EVENTS_RECEIVER, args); + } + + return emit.apply(this, args); +}; http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-common/src/superspawn.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-common/src/superspawn.js b/node_modules/cordova-common/src/superspawn.js index b4129ec..a3f1431 100644 --- a/node_modules/cordova-common/src/superspawn.js +++ b/node_modules/cordova-common/src/superspawn.js @@ -28,7 +28,7 @@ var iswin32 = process.platform == 'win32'; // On Windows, spawn() for batch files requires absolute path & having the extension. function resolveWindowsExe(cmd) { - var winExtensions = ['.exe', '.cmd', '.bat', '.js', '.vbs']; + var winExtensions = ['.exe', '.bat', '.cmd', '.js', '.vbs']; function isValidExe(c) { return winExtensions.indexOf(path.extname(c)) !== -1 && fs.existsSync(c); } @@ -52,15 +52,39 @@ function maybeQuote(a) { return a; } -// opts: -// printCommand: Whether to log the command (default: false) -// stdio: 'default' is to capture output and returning it as a string to success (same as exec) -// 'ignore' means don't bother capturing it -// 'inherit' means pipe the input & output. This is required for anything that prompts. -// env: Map of extra environment variables. -// cwd: Working directory for the command. -// chmod: If truthy, will attempt to set the execute bit before executing on non-Windows platforms. -// Returns a promise that succeeds only for return code = 0. +/** + * A special implementation for child_process.spawn that handles + * Windows-specific issues with batch files and spaces in paths. Returns a + * promise that succeeds only for return code 0. It is also possible to + * subscribe on spawned process' stdout and stderr streams using progress + * handler for resultant promise. + * + * @example spawn('mycommand', [], {stdio: 'pipe'}) .progress(function (stdio){ + * if (stdio.stderr) { console.error(stdio.stderr); } }) + * .then(function(result){ // do other stuff }) + * + * @param {String} cmd A command to spawn + * @param {String[]} [args=[]] An array of arguments, passed to spawned + * process + * @param {Object} [opts={}] A configuration object + * @param {String|String[]|Object} opts.stdio Property that configures how + * spawned process' stdio will behave. Has the same meaning and possible + * values as 'stdio' options for child_process.spawn method + * (https://nodejs.org/api/child_process.html#child_process_options_stdio). + * @param {Object} [env={}] A map of extra environment variables + * @param {String} [cwd=process.cwd()] Working directory for the command + * @param {Boolean} [chmod=false] If truthy, will attempt to set the execute + * bit before executing on non-Windows platforms + * + * @return {Promise} A promise that is either fulfilled if the spawned + * process is exited with zero error code or rejected otherwise. If the + * 'stdio' option set to 'default' or 'pipe', the promise also emits progress + * messages with the following contents: + * { + * 'stdout': ..., + * 'stderr': ... + * } + */ exports.spawn = function(cmd, args, opts) { args = args || []; opts = opts || {}; @@ -83,17 +107,19 @@ exports.spawn = function(cmd, args, opts) { } } - if (opts.stdio == 'ignore') { - spawnOpts.stdio = 'ignore'; - } else if (opts.stdio == 'inherit') { - spawnOpts.stdio = 'inherit'; + if (opts.stdio !== 'default') { + // Ignore 'default' value for stdio because it corresponds to child_process's default 'pipe' option + spawnOpts.stdio = opts.stdio; } + if (opts.cwd) { spawnOpts.cwd = opts.cwd; } + if (opts.env) { spawnOpts.env = _.extend(_.extend({}, process.env), opts.env); } + if (opts.chmod && !iswin32) { try { // This fails when module is installed in a system directory (e.g. via sudo npm install) @@ -113,11 +139,15 @@ exports.spawn = function(cmd, args, opts) { child.stdout.setEncoding('utf8'); child.stdout.on('data', function(data) { capturedOut += data; + d.notify({'stdout': data}); }); + } + if (child.stderr) { child.stderr.setEncoding('utf8'); child.stderr.on('data', function(data) { capturedErr += data; + d.notify({'stderr': data}); }); } http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/.npmignore ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/.npmignore b/node_modules/cordova-registry-mapper/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/cordova-registry-mapper/.npmignore @@ -0,0 +1 @@ +node_modules http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/.travis.yml ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/.travis.yml b/node_modules/cordova-registry-mapper/.travis.yml new file mode 100644 index 0000000..ae381fc --- /dev/null +++ b/node_modules/cordova-registry-mapper/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +sudo: false +node_js: + - "0.10" +install: npm install +script: + - npm test http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/README.md ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/README.md b/node_modules/cordova-registry-mapper/README.md new file mode 100644 index 0000000..3b93e5f --- /dev/null +++ b/node_modules/cordova-registry-mapper/README.md @@ -0,0 +1,14 @@ +[](https://travis-ci.org/stevengill/cordova-registry-mapper) + +#Cordova Registry Mapper + +This module is used to map Cordova plugin ids to package names and vice versa. + +When Cordova users add plugins to their projects using ids +(e.g. `cordova plugin add org.apache.cordova.device`), +this module will map that id to the corresponding package name so `cordova-lib` knows what to fetch from **npm**. + +This module was created so the Apache Cordova project could migrate its plugins from +the [Cordova Registry](http://registry.cordova.io/) +to [npm](https://registry.npmjs.com/) +instead of having to maintain a registry. http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/index.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/index.js b/node_modules/cordova-registry-mapper/index.js new file mode 100644 index 0000000..4550774 --- /dev/null +++ b/node_modules/cordova-registry-mapper/index.js @@ -0,0 +1,204 @@ +var map = { + 'org.apache.cordova.battery-status':'cordova-plugin-battery-status', + 'org.apache.cordova.camera':'cordova-plugin-camera', + 'org.apache.cordova.console':'cordova-plugin-console', + 'org.apache.cordova.contacts':'cordova-plugin-contacts', + 'org.apache.cordova.device':'cordova-plugin-device', + 'org.apache.cordova.device-motion':'cordova-plugin-device-motion', + 'org.apache.cordova.device-orientation':'cordova-plugin-device-orientation', + 'org.apache.cordova.dialogs':'cordova-plugin-dialogs', + 'org.apache.cordova.file':'cordova-plugin-file', + 'org.apache.cordova.file-transfer':'cordova-plugin-file-transfer', + 'org.apache.cordova.geolocation':'cordova-plugin-geolocation', + 'org.apache.cordova.globalization':'cordova-plugin-globalization', + 'org.apache.cordova.inappbrowser':'cordova-plugin-inappbrowser', + 'org.apache.cordova.media':'cordova-plugin-media', + 'org.apache.cordova.media-capture':'cordova-plugin-media-capture', + 'org.apache.cordova.network-information':'cordova-plugin-network-information', + 'org.apache.cordova.splashscreen':'cordova-plugin-splashscreen', + 'org.apache.cordova.statusbar':'cordova-plugin-statusbar', + 'org.apache.cordova.vibration':'cordova-plugin-vibration', + 'org.apache.cordova.test-framework':'cordova-plugin-test-framework', + 'com.msopentech.websql' : 'cordova-plugin-websql', + 'com.msopentech.indexeddb' : 'cordova-plugin-indexeddb', + 'com.microsoft.aad.adal' : 'cordova-plugin-ms-adal', + 'com.microsoft.capptain' : 'capptain-cordova', + 'com.microsoft.services.aadgraph' : 'cordova-plugin-ms-aad-graph', + 'com.microsoft.services.files' : 'cordova-plugin-ms-files', + 'om.microsoft.services.outlook' : 'cordova-plugin-ms-outlook', + 'com.pbakondy.sim' : 'cordova-plugin-sim', + 'android.support.v4' : 'cordova-plugin-android-support-v4', + 'android.support.v7-appcompat' : 'cordova-plugin-android-support-v7-appcompat', + 'com.google.playservices' : 'cordova-plugin-googleplayservices', + 'com.google.cordova.admob' : 'cordova-plugin-admobpro', + 'com.rjfun.cordova.extension' : 'cordova-plugin-extension', + 'com.rjfun.cordova.plugin.admob' : 'cordova-plugin-admob', + 'com.rjfun.cordova.flurryads' : 'cordova-plugin-flurry', + 'com.rjfun.cordova.facebookads' : 'cordova-plugin-facebookads', + 'com.rjfun.cordova.httpd' : 'cordova-plugin-httpd', + 'com.rjfun.cordova.iad' : 'cordova-plugin-iad', + 'com.rjfun.cordova.iflyspeech' : 'cordova-plugin-iflyspeech', + 'com.rjfun.cordova.lianlianpay' : 'cordova-plugin-lianlianpay', + 'com.rjfun.cordova.mobfox' : 'cordova-plugin-mobfox', + 'com.rjfun.cordova.mopub' : 'cordova-plugin-mopub', + 'com.rjfun.cordova.mmedia' : 'cordova-plugin-mmedia', + 'com.rjfun.cordova.nativeaudio' : 'cordova-plugin-nativeaudio', + 'com.rjfun.cordova.plugin.paypalmpl' : 'cordova-plugin-paypalmpl', + 'com.rjfun.cordova.smartadserver' : 'cordova-plugin-smartadserver', + 'com.rjfun.cordova.sms' : 'cordova-plugin-sms', + 'com.rjfun.cordova.wifi' : 'cordova-plugin-wifi', + 'com.ohh2ahh.plugins.appavailability' : 'cordova-plugin-appavailability', + 'org.adapt-it.cordova.fonts' : 'cordova-plugin-fonts', + 'de.martinreinhardt.cordova.plugins.barcodeScanner' : 'cordova-plugin-barcodescanner', + 'de.martinreinhardt.cordova.plugins.urlhandler' : 'cordova-plugin-urlhandler', + 'de.martinreinhardt.cordova.plugins.email' : 'cordova-plugin-email', + 'de.martinreinhardt.cordova.plugins.certificates' : 'cordova-plugin-certificates', + 'de.martinreinhardt.cordova.plugins.sqlite' : 'cordova-plugin-sqlite', + 'fr.smile.cordova.fileopener' : 'cordova-plugin-fileopener', + 'org.smile.websqldatabase.initializer' : 'cordova-plugin-websqldatabase-initializer', + 'org.smile.websqldatabase.wpdb' : 'cordova-plugin-websqldatabase', + 'org.jboss.aerogear.cordova.push' : 'aerogear-cordova-push', + 'org.jboss.aerogear.cordova.oauth2' : 'aerogear-cordova-oauth2', + 'org.jboss.aerogear.cordova.geo' : 'aerogear-cordova-geo', + 'org.jboss.aerogear.cordova.crypto' : 'aerogear-cordova-crypto', + 'org.jboss.aerogaer.cordova.otp' : 'aerogear-cordova-otp', + 'uk.co.ilee.applewatch' : 'cordova-plugin-apple-watch', + 'uk.co.ilee.directions' : 'cordova-plugin-directions', + 'uk.co.ilee.gamecenter' : 'cordova-plugin-game-center', + 'uk.co.ilee.jailbreakdetection' : 'cordova-plugin-jailbreak-detection', + 'uk.co.ilee.nativetransitions' : 'cordova-plugin-native-transitions', + 'uk.co.ilee.pedometer' : 'cordova-plugin-pedometer', + 'uk.co.ilee.shake' : 'cordova-plugin-shake', + 'uk.co.ilee.touchid' : 'cordova-plugin-touchid', + 'com.knowledgecode.cordova.websocket' : 'cordova-plugin-websocket', + 'com.elixel.plugins.settings' : 'cordova-plugin-settings', + 'com.cowbell.cordova.geofence' : 'cordova-plugin-geofence', + 'com.blackberry.community.preventsleep' : 'cordova-plugin-preventsleep', + 'com.blackberry.community.gamepad' : 'cordova-plugin-gamepad', + 'com.blackberry.community.led' : 'cordova-plugin-led', + 'com.blackberry.community.thumbnail' : 'cordova-plugin-thumbnail', + 'com.blackberry.community.mediakeys' : 'cordova-plugin-mediakeys', + 'com.blackberry.community.simplebtlehrplugin' : 'cordova-plugin-bluetoothheartmonitor', + 'com.blackberry.community.simplebeaconplugin' : 'cordova-plugin-bluetoothibeacon', + 'com.blackberry.community.simplebtsppplugin' : 'cordova-plugin-bluetoothspp', + 'com.blackberry.community.clipboard' : 'cordova-plugin-clipboard', + 'com.blackberry.community.curl' : 'cordova-plugin-curl', + 'com.blackberry.community.qt' : 'cordova-plugin-qtbridge', + 'com.blackberry.community.upnp' : 'cordova-plugin-upnp', + 'com.blackberry.community.PasswordCrypto' : 'cordova-plugin-password-crypto', + 'com.blackberry.community.deviceinfoplugin' : 'cordova-plugin-deviceinfo', + 'com.blackberry.community.gsecrypto' : 'cordova-plugin-bb-crypto', + 'com.blackberry.community.mongoose' : 'cordova-plugin-mongoose', + 'com.blackberry.community.sysdialog' : 'cordova-plugin-bb-sysdialog', + 'com.blackberry.community.screendisplay' : 'cordova-plugin-screendisplay', + 'com.blackberry.community.messageplugin' : 'cordova-plugin-bb-messageretrieve', + 'com.blackberry.community.emailsenderplugin' : 'cordova-plugin-emailsender', + 'com.blackberry.community.audiometadata' : 'cordova-plugin-audiometadata', + 'com.blackberry.community.deviceemails' : 'cordova-plugin-deviceemails', + 'com.blackberry.community.audiorecorder' : 'cordova-plugin-audiorecorder', + 'com.blackberry.community.vibration' : 'cordova-plugin-vibrate-intense', + 'com.blackberry.community.SMSPlugin' : 'cordova-plugin-bb-sms', + 'com.blackberry.community.extractZipFile' : 'cordova-plugin-bb-zip', + 'com.blackberry.community.lowlatencyaudio' : 'cordova-plugin-bb-nativeaudio', + 'com.blackberry.community.barcodescanner' : 'phonegap-plugin-barcodescanner', + 'com.blackberry.app' : 'cordova-plugin-bb-app', + 'com.blackberry.bbm.platform' : 'cordova-plugin-bbm', + 'com.blackberry.connection' : 'cordova-plugin-bb-connection', + 'com.blackberry.identity' : 'cordova-plugin-bb-identity', + 'com.blackberry.invoke.card' : 'cordova-plugin-bb-card', + 'com.blackberry.invoke' : 'cordova-plugin-bb-invoke', + 'com.blackberry.invoked' : 'cordova-plugin-bb-invoked', + 'com.blackberry.io.filetransfer' : 'cordova-plugin-bb-filetransfer', + 'com.blackberry.io' : 'cordova-plugin-bb-io', + 'com.blackberry.notification' : 'cordova-plugin-bb-notification', + 'com.blackberry.payment' : 'cordova-plugin-bb-payment', + 'com.blackberry.pim.calendar' : 'cordova-plugin-bb-calendar', + 'com.blackberry.pim.contacts' : 'cordova-plugin-bb-contacts', + 'com.blackberry.pim.lib' : 'cordova-plugin-bb-pimlib', + 'com.blackberry.push' : 'cordova-plugin-bb-push', + 'com.blackberry.screenshot' : 'cordova-plugin-screenshot', + 'com.blackberry.sensors' : 'cordova-plugin-bb-sensors', + 'com.blackberry.system' : 'cordova-plugin-bb-system', + 'com.blackberry.ui.contextmenu' : 'cordova-plugin-bb-ctxmenu', + 'com.blackberry.ui.cover' : 'cordova-plugin-bb-cover', + 'com.blackberry.ui.dialog' : 'cordova-plugin-bb-dialog', + 'com.blackberry.ui.input' : 'cordova-plugin-touch-keyboard', + 'com.blackberry.ui.toast' : 'cordova-plugin-toast', + 'com.blackberry.user.identity' : 'cordova-plugin-bb-idservice', + 'com.blackberry.utils' : 'cordova-plugin-bb-utils', + 'net.yoik.cordova.plugins.screenorientation' : 'cordova-plugin-screen-orientation', + 'com.phonegap.plugins.barcodescanner' : 'phonegap-plugin-barcodescanner', + 'com.manifoldjs.hostedwebapp' : 'cordova-plugin-hostedwebapp', + 'com.initialxy.cordova.themeablebrowser' : 'cordova-plugin-themeablebrowser', + 'gr.denton.photosphere' : 'cordova-plugin-panoramaviewer', + 'nl.x-services.plugins.actionsheet' : 'cordova-plugin-actionsheet', + 'nl.x-services.plugins.socialsharing' : 'cordova-plugin-x-socialsharing', + 'nl.x-services.plugins.googleplus' : 'cordova-plugin-googleplus', + 'nl.x-services.plugins.insomnia' : 'cordova-plugin-insomnia', + 'nl.x-services.plugins.toast' : 'cordova-plugin-x-toast', + 'nl.x-services.plugins.calendar' : 'cordova-plugin-calendar', + 'nl.x-services.plugins.launchmyapp' : 'cordova-plugin-customurlscheme', + 'nl.x-services.plugins.flashlight' : 'cordova-plugin-flashlight', + 'nl.x-services.plugins.sslcertificatechecker' : 'cordova-plugin-sslcertificatechecker', + 'com.bridge.open' : 'cordova-open', + 'com.bridge.safe' : 'cordova-safe', + 'com.disusered.open' : 'cordova-open', + 'com.disusered.safe' : 'cordova-safe', + 'me.apla.cordova.app-preferences' : 'cordova-plugin-app-preferences', + 'com.konotor.cordova' : 'cordova-plugin-konotor', + 'io.intercom.cordova' : 'cordova-plugin-intercom', + 'com.onesignal.plugins.onesignal' : 'onesignal-cordova-plugin', + 'com.danjarvis.document-contract': 'cordova-plugin-document-contract', + 'com.eface2face.iosrtc' : 'cordova-plugin-iosrtc', + 'com.mobileapptracking.matplugin' : 'cordova-plugin-tune', + 'com.marianhello.cordova.background-geolocation' : 'cordova-plugin-mauron85-background-geolocation', + 'fr.louisbl.cordova.locationservices' : 'cordova-plugin-locationservices', + 'fr.louisbl.cordova.gpslocation' : 'cordova-plugin-gpslocation', + 'com.hiliaox.weibo' : 'cordova-plugin-weibo', + 'com.uxcam.cordova.plugin' : 'cordova-uxcam', + 'de.fastr.phonegap.plugins.downloader' : 'cordova-plugin-fastrde-downloader', + 'de.fastr.phonegap.plugins.injectView' : 'cordova-plugin-fastrde-injectview', + 'de.fastr.phonegap.plugins.CheckGPS' : 'cordova-plugin-fastrde-checkgps', + 'de.fastr.phonegap.plugins.md5chksum' : 'cordova-plugin-fastrde-md5', + 'io.repro.cordova' : 'cordova-plugin-repro', + 're.notifica.cordova': 'cordova-plugin-notificare-push', + 'com.megster.cordova.ble': 'cordova-plugin-ble-central', + 'com.megster.cordova.bluetoothserial': 'cordova-plugin-bluetooth-serial', + 'com.megster.cordova.rfduino': 'cordova-plugin-rfduino', + 'cz.velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback', + 'cz.Velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback', + 'org.scriptotek.appinfo': 'cordova-plugin-appinfo', + 'com.yezhiming.cordova.appinfo': 'cordova-plugin-appinfo', + 'pl.makingwaves.estimotebeacons': 'cordova-plugin-estimote', + 'com.evothings.ble': 'cordova-plugin-ble', + 'com.appsee.plugin' : 'cordova-plugin-appsee', + 'am.armsoft.plugins.listpicker': 'cordova-plugin-listpicker', + 'com.pushbots.push': 'pushbots-cordova-plugin', + 'com.admob.google': 'cordova-admob', + 'admob.ads.google': 'cordova-admob-ads', + 'admob.google.plugin': 'admob-google', + 'com.admob.admobads': 'admob-ads', + 'com.connectivity.monitor': 'cordova-connectivity-monitor', + 'com.ios.libgoogleadmobads': 'cordova-libgoogleadmobads', + 'com.google.play.services': 'cordova-google-play-services', + 'android.support.v13': 'cordova-android-support-v13', + 'android.support.v4': 'cordova-android-support-v4', // Duplicated key ;) + 'com.analytics.google': 'cordova-plugin-analytics', + 'com.analytics.adid.google': 'cordova-plugin-analytics-adid', + 'com.chariotsolutions.nfc.plugin': 'phonegap-nfc', + 'com.samz.mixpanel': 'cordova-plugin-mixpanel', + 'de.appplant.cordova.common.RegisterUserNotificationSettings': 'cordova-plugin-registerusernotificationsettings', + 'plugin.google.maps': 'cordova-plugin-googlemaps', + 'xu.li.cordova.wechat': 'cordova-plugin-wechat', + 'es.keensoft.fullscreenimage': 'cordova-plugin-fullscreenimage', + 'com.arcoirislabs.plugin.mqtt' : 'cordova-plugin-mqtt' +}; + +module.exports.oldToNew = map; + +var reverseMap = {}; +Object.keys(map).forEach(function(elem){ + reverseMap[map[elem]] = elem; +}); + +module.exports.newToOld = reverseMap; http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/package.json ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/package.json b/node_modules/cordova-registry-mapper/package.json new file mode 100644 index 0000000..989efad --- /dev/null +++ b/node_modules/cordova-registry-mapper/package.json @@ -0,0 +1,77 @@ +{ + "_args": [ + [ + "cordova-registry-mapper@^1.1.8", + "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common" + ] + ], + "_from": "cordova-registry-mapper@>=1.1.8 <2.0.0", + "_id": "[email protected]", + "_inCache": true, + "_installable": true, + "_location": "/cordova-registry-mapper", + "_nodeVersion": "5.4.1", + "_npmUser": { + "email": "[email protected]", + "name": "stevegill" + }, + "_npmVersion": "3.5.3", + "_phantomChildren": {}, + "_requested": { + "name": "cordova-registry-mapper", + "raw": "cordova-registry-mapper@^1.1.8", + "rawSpec": "^1.1.8", + "scope": null, + "spec": ">=1.1.8 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/cordova-common" + ], + "_resolved": "http://registry.npmjs.org/cordova-registry-mapper/-/cordova-registry-mapper-1.1.15.tgz", + "_shasum": "e244b9185b8175473bff6079324905115f83dc7c", + "_shrinkwrap": null, + "_spec": "cordova-registry-mapper@^1.1.8", + "_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common", + "author": { + "name": "Steve Gill" + }, + "bugs": { + "url": "https://github.com/stevengill/cordova-registry-mapper/issues" + }, + "dependencies": {}, + "description": "Maps old plugin ids to new plugin names for fetching from npm", + "devDependencies": { + "tape": "^3.5.0" + }, + "directories": {}, + "dist": { + "shasum": "e244b9185b8175473bff6079324905115f83dc7c", + "tarball": "http://registry.npmjs.org/cordova-registry-mapper/-/cordova-registry-mapper-1.1.15.tgz" + }, + "gitHead": "00af0f028ec94154a364eeabe38b8e22320647bd", + "homepage": "https://github.com/stevengill/cordova-registry-mapper#readme", + "keywords": [ + "cordova", + "plugins" + ], + "license": "Apache version 2.0", + "main": "index.js", + "maintainers": [ + { + "name": "stevegill", + "email": "[email protected]" + } + ], + "name": "cordova-registry-mapper", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/stevengill/cordova-registry-mapper.git" + }, + "scripts": { + "test": "node tests/test.js" + }, + "version": "1.1.15" +} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/cordova-registry-mapper/tests/test.js ---------------------------------------------------------------------- diff --git a/node_modules/cordova-registry-mapper/tests/test.js b/node_modules/cordova-registry-mapper/tests/test.js new file mode 100644 index 0000000..35343be --- /dev/null +++ b/node_modules/cordova-registry-mapper/tests/test.js @@ -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']); +}) http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/AUTHORS ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/AUTHORS b/node_modules/elementtree/node_modules/sax/AUTHORS deleted file mode 100644 index 26d8659..0000000 --- a/node_modules/elementtree/node_modules/sax/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -# contributors sorted by whether or not they're me. -Isaac Z. Schlueter <[email protected]> -Stein Martin Hustad <[email protected]> -Mikeal Rogers <[email protected]> -Laurie Harper <[email protected]> -Jann Horn <[email protected]> -Elijah Insua <[email protected]> -Henry Rawas <[email protected]> -Justin Makeig <[email protected]> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/LICENSE ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/LICENSE b/node_modules/elementtree/node_modules/sax/LICENSE deleted file mode 100644 index 05a4010..0000000 --- a/node_modules/elementtree/node_modules/sax/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. - -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. http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/README.md ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/README.md b/node_modules/elementtree/node_modules/sax/README.md deleted file mode 100644 index 9c63dc4..0000000 --- a/node_modules/elementtree/node_modules/sax/README.md +++ /dev/null @@ -1,213 +0,0 @@ -# sax js - -A sax-style parser for XML and HTML. - -Designed with [node](http://nodejs.org/) in mind, but should work fine in -the browser or other CommonJS implementations. - -## What This Is - -* A very simple tool to parse through an XML string. -* A stepping stone to a streaming HTML parser. -* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML - docs. - -## What This Is (probably) Not - -* An HTML Parser - That's a fine goal, but this isn't it. It's just - XML. -* A DOM Builder - You can use it to build an object model out of XML, - but it doesn't do that out of the box. -* XSLT - No DOM = no querying. -* 100% Compliant with (some other SAX implementation) - Most SAX - implementations are in Java and do a lot more than this does. -* An XML Validator - It does a little validation when in strict mode, but - not much. -* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic - masochism. -* A DTD-aware Thing - Fetching DTDs is a much bigger job. - -## Regarding `<!DOCTYPE`s and `<!ENTITY`s - -The parser will handle the basic XML entities in text nodes and attribute -values: `& < > ' "`. It's possible to define additional -entities in XML by putting them in the DTD. This parser doesn't do anything -with that. If you want to listen to the `ondoctype` event, and then fetch -the doctypes, and read the entities and add them to `parser.ENTITIES`, then -be my guest. - -Unknown entities will fail in strict mode, and in loose mode, will pass -through unmolested. - -## Usage - - var sax = require("./lib/sax"), - strict = true, // set to false for html-mode - parser = sax.parser(strict); - - parser.onerror = function (e) { - // an error happened. - }; - parser.ontext = function (t) { - // got some text. t is the string of text. - }; - parser.onopentag = function (node) { - // opened a tag. node has "name" and "attributes" - }; - parser.onattribute = function (attr) { - // an attribute. attr has "name" and "value" - }; - parser.onend = function () { - // parser stream is done, and ready to have more stuff written to it. - }; - - parser.write('<xml>Hello, <who name="world">world</who>!</xml>').close(); - - // stream usage - // takes the same options as the parser - var saxStream = require("sax").createStream(strict, options) - saxStream.on("error", function (e) { - // unhandled errors will throw, since this is a proper node - // event emitter. - console.error("error!", e) - // clear the error - this._parser.error = null - this._parser.resume() - }) - saxStream.on("opentag", function (node) { - // same object as above - }) - // pipe is supported, and it's readable/writable - // same chunks coming in also go out. - fs.createReadStream("file.xml") - .pipe(saxStream) - .pipe(fs.createReadStream("file-copy.xml")) - - - -## Arguments - -Pass the following arguments to the parser function. All are optional. - -`strict` - Boolean. Whether or not to be a jerk. Default: `false`. - -`opt` - Object bag of settings regarding string formatting. All default to `false`. - -Settings supported: - -* `trim` - Boolean. Whether or not to trim text and comment nodes. -* `normalize` - Boolean. If true, then turn any whitespace into a single - space. -* `lowercasetags` - Boolean. If true, then lowercase tags in loose mode, - rather than uppercasing them. -* `xmlns` - Boolean. If true, then namespaces are supported. - -## Methods - -`write` - Write bytes onto the stream. You don't have to do this all at -once. You can keep writing as much as you want. - -`close` - Close the stream. Once closed, no more data may be written until -it is done processing the buffer, which is signaled by the `end` event. - -`resume` - To gracefully handle errors, assign a listener to the `error` -event. Then, when the error is taken care of, you can call `resume` to -continue parsing. Otherwise, the parser will not continue while in an error -state. - -## Members - -At all times, the parser object will have the following members: - -`line`, `column`, `position` - Indications of the position in the XML -document where the parser currently is looking. - -`startTagPosition` - Indicates the position where the current tag starts. - -`closed` - Boolean indicating whether or not the parser can be written to. -If it's `true`, then wait for the `ready` event to write again. - -`strict` - Boolean indicating whether or not the parser is a jerk. - -`opt` - Any options passed into the constructor. - -`tag` - The current tag being dealt with. - -And a bunch of other stuff that you probably shouldn't touch. - -## Events - -All events emit with a single argument. To listen to an event, assign a -function to `on<eventname>`. Functions get executed in the this-context of -the parser object. The list of supported events are also in the exported -`EVENTS` array. - -When using the stream interface, assign handlers using the EventEmitter -`on` function in the normal fashion. - -`error` - Indication that something bad happened. The error will be hanging -out on `parser.error`, and must be deleted before parsing can continue. By -listening to this event, you can keep an eye on that kind of stuff. Note: -this happens *much* more in strict mode. Argument: instance of `Error`. - -`text` - Text node. Argument: string of text. - -`doctype` - The `<!DOCTYPE` declaration. Argument: doctype string. - -`processinginstruction` - Stuff like `<?xml foo="blerg" ?>`. Argument: -object with `name` and `body` members. Attributes are not parsed, as -processing instructions have implementation dependent semantics. - -`sgmldeclaration` - Random SGML declarations. Stuff like `<!ENTITY p>` -would trigger this kind of event. This is a weird thing to support, so it -might go away at some point. SAX isn't intended to be used to parse SGML, -after all. - -`opentag` - An opening tag. Argument: object with `name` and `attributes`. -In non-strict mode, tag names are uppercased, unless the `lowercasetags` -option is set. If the `xmlns` option is set, then it will contain -namespace binding information on the `ns` member, and will have a -`local`, `prefix`, and `uri` member. - -`closetag` - A closing tag. In loose mode, tags are auto-closed if their -parent closes. In strict mode, well-formedness is enforced. Note that -self-closing tags will have `closeTag` emitted immediately after `openTag`. -Argument: tag name. - -`attribute` - An attribute node. Argument: object with `name` and `value`, -and also namespace information if the `xmlns` option flag is set. - -`comment` - A comment node. Argument: the string of the comment. - -`opencdata` - The opening tag of a `<![CDATA[` block. - -`cdata` - The text of a `<![CDATA[` block. Since `<![CDATA[` blocks can get -quite large, this event may fire multiple times for a single block, if it -is broken up into multiple `write()`s. Argument: the string of random -character data. - -`closecdata` - The closing tag (`]]>`) of a `<![CDATA[` block. - -`opennamespace` - If the `xmlns` option is set, then this event will -signal the start of a new namespace binding. - -`closenamespace` - If the `xmlns` option is set, then this event will -signal the end of a namespace binding. - -`end` - Indication that the closed stream has ended. - -`ready` - Indication that the stream has reset, and is ready to be written -to. - -`noscript` - In non-strict mode, `<script>` tags trigger a `"script"` -event, and their contents are not checked for special xml characters. -If you pass `noscript: true`, then this behavior is suppressed. - -## Reporting Problems - -It's best to write a failing test if you find an issue. I will always -accept pull requests with failing tests if they demonstrate intended -behavior, but it is very hard to figure out what issue you're describing -without a test. Writing a test is also the best way for you yourself -to figure out if you really understand the issue you think you have with -sax-js. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
