Compare commits

...

38 Commits

Author SHA1 Message Date
Steve Gill
4d55fdb3e5 Set VERSION to 6.2.0 (via coho) 2017-03-28 15:24:44 -07:00
Steve Gill
b175d611bd Update JS snapshot to version 6.2.0 (via coho) 2017-03-28 15:18:35 -07:00
Steve Gill
6d084428a8 CB-12609 Updated RELEASENOTES and Version for release 6.2.0 2017-03-28 15:17:52 -07:00
Steve Gill
312efc3878 CB-12609: added missing license headers 2017-03-28 15:03:47 -07:00
Joe Bowser
301faebfcc CB-12614: Adding headers to tests 2017-03-28 14:27:57 -07:00
Steve Gill
a8af103ff4 CB-12609: checking in updated node_modules 2017-03-27 22:23:09 -07:00
Darryl Pogue
0df50c3f33 CB-8978 Prepare copy resource-files from config.xml
This closes #321
2017-03-27 22:13:13 -07:00
Alexander Sorokin
08c80f77a9 CB-12605 Fix a requirements check failure on Windows 2017-03-27 11:47:32 +03:00
Joe Bowser
ea8d65d7fc CB-12595: Remove the console.log stuff
This closes #370
2017-03-24 10:22:11 -07:00
Joe Bowser
e3198b0f6b CB-12595: Ugly code, but this should find an Android Studio installation and use the sweet gradle center found inside 2017-03-24 10:22:07 -07:00
Josh Jackson
19220de388 testMultipartPopAndEncodeAsJs under newer test system
This closes #358
2017-03-22 10:54:48 -07:00
Josh Jackson
52878d6c5b MultipartMessageTest 2017-03-22 10:54:42 -07:00
Josh Jackson
abfece70c1 Shorter method name 2017-03-22 10:54:41 -07:00
Josh Jackson
33da6e9eb8 Fix encoding of multipart messages. 2017-03-22 10:54:41 -07:00
Joe Bowser
4919a2d2a8 Bumping up the test gradle versions 2017-03-22 10:53:58 -07:00
filmaj
2f2e8a560d CB-12546: account for quotes when detecting android command error for Windows. 2017-03-20 10:09:46 -07:00
filmaj
884818934f CB-12546: on create, update the require path for certain helper modules as directory structure differs. big ol TODO dropped as it _is_ kinda weird. 2017-03-20 10:09:45 -07:00
filmaj
1d8e6f53a1 CB-12546: sort detected targets by numerical suffix when reporting most recent version of android sdk target installed. 2017-03-20 10:09:45 -07:00
filmaj
3554267adf CB-12546: more specs for android_sdk and check_reqs. added fixtures for sdk targets. refactored target listing. 2017-03-20 10:09:45 -07:00
filmaj
f7687a2567 CB-12546: use android_sdk list_targets instead of rewriting the same thing again. 2017-03-20 10:09:45 -07:00
filmaj
ebd4a02d2c CB-12546: switch to superspawn for shelling out where possible. rework android sdk module to work with new sdk. 2017-03-20 10:09:45 -07:00
filmaj
4a354bba86 CB-12546: based on android command exit code and stdout, conditionally try to invoke avdmanager to list out AVD images. tweak relevant test to match behaviour. small tweak to use exposed methods for checking platform (for easier future stubbing). 2017-03-20 10:08:36 -07:00
filmaj
d40c22441f CB-12546: move check_reqs to templates directory and update module references. 2017-03-20 10:08:36 -07:00
filmaj
6395eda0c8 CB-12546: emulator specs. 2017-03-20 10:08:36 -07:00
filmaj
eb6ada8091 CB-12546: more robust sdk location detection. ANDROID_HOME now can be set from location of either of adb, android or avdmanager commands. slightly rework logic of infering ANDROID_HOME + setting up PATH to hopefully separate the logic into clearer sections. check_reqs.check_android now validates SDK Tools 25.3.1 binaries/structure. added specs for check_reqs.check_android. move android sdk version script. expose some helper functions as module methods to help with mocking. 2017-03-20 10:08:35 -07:00
filmaj
a7ef686a27 CB-12546: leverage avdmanager if android warns it is no longer
useful, which happens in Android SDK Tools 25.3.1.
explicitly set the CWD of the spawned emulator process to workaround a recent google android sdk bug.
rename android_sdk_version.js to android_sdk.js, to better reflect its contents.
have create.js copy over the android_sdk_version batch file.
2017-03-20 10:08:35 -07:00
Alexander Sorokin
e2af492a63 CB-12587 A (not so) quick fix for get_gradle_wrapper() call 2017-03-20 15:22:37 +03:00
Joe Bowser
84de9ee0da CB-12574 - Bumping Version
This closes #368
2017-03-15 13:31:24 -07:00
Joe Bowser
e182e669f0 CB-12524: Put the script in the wrong spot, oops
This closes #367
2017-03-13 13:51:37 -07:00
Joe Bowser
a9a28d3e77 CB-12524: Workaround for obsolete gradle on integration servers 2017-03-13 13:51:37 -07:00
Joe Bowser
6a77acdbf2 CB-12524: Thwarted by JSHint again, accidentally deleted the wrong message 2017-03-13 13:51:37 -07:00
Joe Bowser
028725468a CB-12524: Removing the downgrade test, because thanks to Google's Tool Change, this will forever fail. 2017-03-13 13:51:37 -07:00
Joe Bowser
9dbffa6ee8 CB-12524: Forgot to check for the android command on the target check 2017-03-13 13:51:37 -07:00
Joe Bowser
2d3f3cae13 CB-12524: Set Gradle to always build in the project directory since our tests don't run scripts from the project directory by default 2017-03-13 13:51:36 -07:00
Joe Bowser
fb9f0f3ee8 CB-12524: I need travis to install a wrapper on this, since travis fails the gradle check 2017-03-13 13:51:36 -07:00
Joe Bowser
ab276504fd CB-12524: Windows functionality for Gradle execution 2017-03-13 13:51:36 -07:00
Joe Bowser
3cc4e5b440 CB-12524: This now fetches the template from inside of the Android Studio directory, and falls back to a locally installed Gradle instance 2017-03-13 13:51:36 -07:00
Joe Bowser
b2664bc469 CB-12524: Test distributing a wrapper in the framework directory 2017-03-13 13:51:36 -07:00
150 changed files with 5016 additions and 13190 deletions

View File

@@ -5,3 +5,4 @@ proguard-project.txt
spec
appveyor.yml
framework/build
ic_launcher.png

View File

@@ -5,6 +5,7 @@ jdk:
before_install:
- nvm install 6
- node --version
- gradle --version
install:
- npm install
- npm install -g codecov

View File

@@ -20,6 +20,15 @@
-->
## Release Notes for Cordova (Android) ##
### 6.2.0 (Mar 28, 2017)
* [CB-12614](https://issues.apache.org/jira/browse/CB-12614) Adding headers to tests
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Prepare copy `resource-files` from `config.xml`
* [CB-12605](https://issues.apache.org/jira/browse/CB-12605) Fix a requirements check failure on **Windows**
* [CB-12595](https://issues.apache.org/jira/browse/CB-12595) This should find an **Android Studio** installation and use the sweet gradle center found inside
* [CB-12546](https://issues.apache.org/jira/browse/CB-12546) leverage `avdmanager` if `android` warns it is no longer useful, which happens in **Android SDK Tools 25.3.1**. Explicitly set the `CWD` of the spawned emulator process to workaround a recent google android sdk bug. Rename `android_sdk_version.js` to `android_sdk.js`, to better reflect its contents. Have `create.js` copy over the `android_sdk_version` batch file.
* [CB-12524](https://issues.apache.org/jira/browse/CB-12524) Fix for missing gradle template error. This now fetches the template from inside of the **Android Studio** directory, and falls back to a locally installed Gradle instance
* [CB-12465](https://issues.apache.org/jira/browse/CB-12465) Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
### 6.1.2 (Jan 26, 2017)
* **Security** Change to `https` by default
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated tests to work with jasmine (promise matcher tests commented out for now)

View File

@@ -1 +1 @@
6.2.0-dev
6.2.0

View File

@@ -19,10 +19,10 @@
under the License.
*/
var android_sdk_version = require('./lib/android_sdk_version');
var android_sdk = require('./templates/cordova/lib/android_sdk');
android_sdk_version.run().done(null, function(err) {
console.log(err);
android_sdk.print_newest_available_sdk_target().done(null, function(err) {
console.error(err);
process.exit(2);
});

View File

@@ -19,7 +19,7 @@
under the License.
*/
var check_reqs = require('./lib/check_reqs');
var check_reqs = require('./templates/cordova/lib/check_reqs');
check_reqs.run().done(
function success() {

View File

@@ -1,64 +0,0 @@
#!/usr/bin/env node
/*
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 child_process = require('child_process'),
Q = require('q');
var get_highest_sdk = function(results){
var reg = /\d+/;
var apiLevels = [];
for(var i=0;i<results.length;i++){
apiLevels[i] = parseInt(results[i].match(reg)[0]);
}
apiLevels.sort(function(a,b){return b-a;});
console.log(apiLevels[0]);
};
var get_sdks = function() {
var d = Q.defer();
child_process.exec('android list targets', function(err, stdout, stderr) {
if (err) d.reject(stderr);
else d.resolve(stdout);
});
return d.promise.then(function(output) {
var reg = /android-\d+/gi;
var results = output.match(reg);
if(results.length===0){
return Q.reject(new Error('No android sdks installed.'));
}else{
get_highest_sdk(results);
}
return Q();
}, function(stderr) {
if (stderr.match(/command\snot\sfound/) || stderr.match(/'android' is not recognized/)) {
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
} else {
return Q.reject(new Error('An error occurred while listing Android targets'));
}
});
};
module.exports.run = function() {
return Q.all([get_sdks()]);
};

View File

@@ -23,7 +23,7 @@ var shell = require('shelljs'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
check_reqs = require('./check_reqs'),
check_reqs = require('./../templates/cordova/lib/check_reqs'),
ROOT = path.join(__dirname, '..', '..');
var MIN_SDK_VERSION = 16;
@@ -134,20 +134,29 @@ function copyBuildRules(projectPath) {
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
shell.cp('-f', path.join(srcDir, 'wrapper.gradle'), projectPath);
}
function copyScripts(projectPath) {
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
var bin = path.join(ROOT, 'bin');
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
var destScriptsDir = path.join(projectPath, 'cordova');
// Delete old scripts directory if this is an update.
shell.rm('-rf', destScriptsDir);
// Copy in the new ones.
shell.cp('-r', srcScriptsDir, projectPath);
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version'));
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk_version.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk_version.js'));
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
var check_reqs = path.join(destScriptsDir, 'check_reqs');
var android_sdk_version = path.join(destScriptsDir, 'android_sdk_version');
// TODO: the two files being edited on-the-fly here are shared between
// platform and project-level commands. the below `sed` is updating the
// `require` path for the two libraries. if there's a better way to share
// modules across both the repo and generated projects, we should make sure
// to remove/update this.
shell.sed('-i', /templates\/cordova\//, '', android_sdk_version);
shell.sed('-i', /templates\/cordova\//, '', check_reqs);
}
/**

135
bin/templates/cordova/lib/android_sdk.js vendored Executable file
View File

@@ -0,0 +1,135 @@
/*
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 Q = require('q'),
superspawn = require('cordova-common').superspawn;
var suffix_number_regex = /(\d+)$/;
// Used for sorting Android targets, example strings to sort:
// android-19
// android-L
// Google Inc.:Google APIs:20
// Google Inc.:Glass Development Kit Preview:20
// The idea is to sort based on largest "suffix" number - meaning the bigger
// the number at the end, the more recent the target, the closer to the
// start of the array.
function sort_by_largest_numerical_suffix(a, b) {
var suffix_a = a.match(suffix_number_regex);
var suffix_b = b.match(suffix_number_regex);
if (suffix_a && suffix_b) {
// If the two targets being compared have suffixes, return less than
// zero, or greater than zero, based on which suffix is larger.
return (parseInt(suffix_a[1]) > parseInt(suffix_b[1]) ? -1 : 1);
} else {
// If no suffix numbers were detected, leave the order as-is between
// elements a and b.
return 0;
}
}
module.exports.print_newest_available_sdk_target = function() {
return module.exports.list_targets()
.then(function(targets) {
targets.sort(sort_by_largest_numerical_suffix);
console.log(targets[0]);
});
};
module.exports.version_string_to_api_level = {
'4.0': 14,
'4.0.3': 15,
'4.1': 16,
'4.2': 17,
'4.3': 18,
'4.4': 19,
'4.4W': 20,
'5.0': 21,
'5.1': 22,
'6.0': 23,
'7.0': 24,
'7.1.1': 25
};
module.exports.list_targets_with_android = function() {
return superspawn.spawn('android', ['list', 'targets'])
.then(function(stdout) {
var target_out = stdout.split('\n');
var targets = [];
for (var i = target_out.length - 1; i >= 0; i--) {
if(target_out[i].match(/id:/)) {
targets.push(target_out[i].match(/"(.+)"/)[1]);
}
}
return targets;
});
};
module.exports.list_targets_with_sdkmanager = function() {
return superspawn.spawn('sdkmanager', ['--list'])
.then(function(stdout) {
var parsing_installed_packages = false;
var lines = stdout.split('\n');
var targets = [];
for (var i = 0, l = lines.length; i < l; i++) {
var line = lines[i];
if (line.match(/Installed packages/)) {
parsing_installed_packages = true;
} else if (line.match(/Available Packages/) || line.match(/Available Updates/)) {
// we are done working through installed packages, exit
break;
}
if (parsing_installed_packages) {
// Match stock android platform
if (line.match(/platforms;android-\d+/)) {
targets.push(line.match(/(android-\d+)/)[1]);
}
// Match Google APIs
if (line.match(/addon-google_apis-google-\d+/)) {
var description = lines[i + 1];
// munge description to match output from old android sdk tooling
var api_level = description.match(/Android (\d+)/); //[1];
if (api_level) {
targets.push('Google Inc.:Google APIs:' + api_level[1]);
}
}
// TODO: match anything else?
}
}
return targets;
});
};
module.exports.list_targets = function() {
return module.exports.list_targets_with_android()
.catch(function(err) {
// there's a chance `android` no longer works.
// lets see if `sdkmanager` is available and we can figure it out
var avail_regex = /"?android"? command is no longer available/;
if (err.code && ((err.stdout && err.stdout.match(avail_regex)) || (err.stderr && err.stderr.match(avail_regex)))) {
return module.exports.list_targets_with_sdkmanager();
} else throw err;
}).then(function(targets) {
if (targets.length === 0) {
return Q.reject(new Error('No android targets (SDKs) installed!'));
}
return targets;
});
};

View File

@@ -65,6 +65,21 @@ GradleBuilder.prototype.getArgs = function(cmd, opts) {
return args;
};
/*
* This returns a promise
*/
GradleBuilder.prototype.runGradleWrapper = function(gradle_cmd) {
var gradlePath = path.join(this.root, 'gradlew');
var wrapperGradle = path.join(this.root, 'wrapper.gradle');
if(fs.existsSync(gradlePath)) {
//Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows
} else {
return spawn(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], {stdio: 'inherit'});
}
};
// Makes the project buildable, minus the gradle wrapper.
GradleBuilder.prototype.prepBuildFiles = function() {
// Update the version of build.gradle in each dependent library.
@@ -159,17 +174,15 @@ GradleBuilder.prototype.prepBuildFiles = function() {
GradleBuilder.prototype.prepEnv = function(opts) {
var self = this;
return check_reqs.check_gradle()
.then(function() {
return self.prepBuildFiles();
}).then(function() {
// Copy the gradle wrapper on each build so that:
// A) we don't require the Android SDK at project creation time, and
// B) we always use the SDK's latest version of it.
// check_reqs ensures that this is set.
/*jshint -W069 */
var sdkDir = process.env['ANDROID_HOME'];
/*jshint +W069 */
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
.then(function(gradlePath) {
return self.runGradleWrapper(gradlePath);
}).then(function() {
return self.prepBuildFiles();
}).then(function() {
// We now copy the gradle out of the framework
// This is a dirty patch to get the build working
/*
var wrapperDir = path.join(self.root, 'CordovaLib');
if (process.platform == 'win32') {
shell.rm('-f', path.join(self.root, 'gradlew.bat'));
shell.cp(path.join(wrapperDir, 'gradlew.bat'), self.root);
@@ -180,13 +193,13 @@ GradleBuilder.prototype.prepEnv = function(opts) {
shell.rm('-rf', path.join(self.root, 'gradle', 'wrapper'));
shell.mkdir('-p', path.join(self.root, 'gradle'));
shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(self.root, 'gradle'));
*/
// If the gradle distribution URL is set, make sure it points to version we want.
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
// For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/;
/*jshint -W069 */
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip';
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip';
/*jshint +W069 */
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath);

View File

@@ -26,10 +26,12 @@ var shelljs = require('shelljs'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
ROOT = path.join(__dirname, '..', '..');
os = require('os'),
REPO_ROOT = path.join(__dirname, '..', '..', '..', '..'),
PROJECT_ROOT = path.join(__dirname, '..', '..');
var CordovaError = require('cordova-common').CordovaError;
var isWindows = process.platform == 'win32';
var superspawn = require('cordova-common').superspawn;
var android_sdk = require('./android_sdk');
function forgivingWhichSync(cmd) {
try {
@@ -50,7 +52,16 @@ function tryCommand(cmd, errMsg, catchStderr) {
return d.promise;
}
// Get valid target from framework/project.properties
module.exports.isWindows = function() {
return (os.platform() == 'win32');
};
module.exports.isDarwin = function() {
return (os.platform() == 'darwin');
};
// Get valid target from framework/project.properties if run from this repo
// Otherwise get target from project.properties file within a generated cordova-android project
module.exports.get_target = function() {
function extractFromFile(filePath) {
var target = shelljs.grep(/\btarget=/, filePath);
@@ -59,38 +70,83 @@ module.exports.get_target = function() {
}
return target.split('=')[1].trim();
}
if (fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
return extractFromFile(path.join(ROOT, 'framework', 'project.properties'));
var repo_file = path.join(REPO_ROOT, 'framework', 'project.properties');
if (fs.existsSync(repo_file)) {
return extractFromFile(repo_file);
}
if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
// if no target found, we're probably in a project and project.properties is in ROOT.
return extractFromFile(path.join(ROOT, 'project.properties'));
var project_file = path.join(PROJECT_ROOT, 'project.properties');
if (fs.existsSync(project_file)) {
// if no target found, we're probably in a project and project.properties is in PROJECT_ROOT.
return extractFromFile(project_file);
}
throw new Error('Could not find android target. File missing: ' + path.join(ROOT, 'project.properties'));
throw new Error('Could not find android target in either ' + repo_file + ' nor ' + project_file);
};
// Returns a promise. Called only by build and clean commands.
module.exports.check_ant = function() {
return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.')
.then(function (output) {
return superspawn.spawn('ant', ['-version'])
.then(function(output) {
// Parse Ant version from command output
return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
}).catch(function(err) {
throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');
});
};
module.exports.get_gradle_wrapper = function() {
var androidStudioPath;
var i = 0;
var foundStudio = false;
var program_dir;
if (module.exports.isDarwin()) {
program_dir = fs.readdirSync('/Applications');
while (i < program_dir.length && !foundStudio) {
if (program_dir[i].startsWith('Android Studio')) {
//TODO: Check for a specific Android Studio version, make sure it's not Canary
androidStudioPath = path.join('/Applications', program_dir[i], 'Contents', 'gradle');
foundStudio = true;
} else { ++i; }
}
} else if (module.exports.isWindows()) {
var androidPath = path.join(process.env['ProgramFiles'], 'Android') + '/';
if (fs.existsSync(androidPath)) {
program_dir = fs.readdirSync(androidPath);
while (i < program_dir.length && !foundStudio) {
if (program_dir[i].startsWith('Android Studio')) {
foundStudio = true;
androidStudioPath = path.join(process.env['ProgramFiles'], 'Android', program_dir[i], 'gradle');
} else { ++i; }
}
}
}
if (androidStudioPath !== null && fs.existsSync(androidStudioPath)) {
var dirs = fs.readdirSync(androidStudioPath);
if(dirs[0].split('-')[0] == 'gradle') {
return path.join(androidStudioPath, dirs[0], 'bin', 'gradle');
}
} else {
//OK, let's try to check for Gradle!
return forgivingWhichSync('gradle');
}
};
// Returns a promise. Called only by build and clean commands.
module.exports.check_gradle = function() {
var sdkDir = process.env['ANDROID_HOME'];
var d = Q.defer();
if (!sdkDir)
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.'));
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
if (!fs.existsSync(wrapperDir)) {
return Q.reject(new CordovaError('Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.\n' +
'Looked here: ' + wrapperDir));
}
return Q.when();
var gradlePath = module.exports.get_gradle_wrapper();
if (gradlePath.length !== 0)
d.resolve(gradlePath);
else
d.reject(new CordovaError('Could not find an installed version of Gradle either in Android Studio,\n' +
'or on your system to install the gradle wrapper. Please include gradle \n' +
'in your path, or install Android Studio'));
return d.promise;
};
// Returns a promise.
@@ -105,12 +161,15 @@ module.exports.check_java = function() {
}
} else {
if (javacPath) {
var msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
// OS X has a command for finding JAVA_HOME.
if (fs.existsSync('/usr/libexec/java_home')) {
return tryCommand('/usr/libexec/java_home', msg)
var find_java = '/usr/libexec/java_home';
var default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting setting it manually.';
if (fs.existsSync(find_java)) {
return superspawn.spawn(find_java)
.then(function(stdout) {
process.env['JAVA_HOME'] = stdout.trim();
}).catch(function(err) {
throw new CordovaError(default_java_error_msg);
});
} else {
// See if we can derive it from javac's location.
@@ -119,10 +178,10 @@ module.exports.check_java = function() {
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
process.env['JAVA_HOME'] = maybeJavaHome;
} else {
throw new CordovaError(msg);
throw new CordovaError(default_java_error_msg);
}
}
} else if (isWindows) {
} else if (module.exports.isWindows()) {
// Try to auto-detect java in the default install paths.
var oldSilent = shelljs.config.silent;
shelljs.config.silent = true;
@@ -142,28 +201,29 @@ module.exports.check_java = function() {
}
}
}).then(function() {
var msg =
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
if (process.env['JAVA_HOME']) {
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
}
// We use tryCommand with catchStderr = true, because
// javac writes version info to stderr instead of stdout
return tryCommand('javac -version', msg, true)
.then(function (output) {
//Let's check for at least Java 8, and keep it future proof so we can support Java 10
var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output);
return match && match[1];
});
var msg =
'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
if (process.env['JAVA_HOME']) {
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
}
// We use tryCommand with catchStderr = true, because
// javac writes version info to stderr instead of stdout
return tryCommand('javac -version', msg, true)
.then(function (output) {
//Let's check for at least Java 8, and keep it future proof so we can support Java 10
var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output);
return match && match[1];
});
});
};
// Returns a promise.
module.exports.check_android = function() {
return Q().then(function() {
var androidCmdPath = forgivingWhichSync('android');
var adbInPath = !!forgivingWhichSync('adb');
var adbInPath = forgivingWhichSync('adb');
var avdmanagerInPath = forgivingWhichSync('avdmanager');
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
function maybeSetAndroidHome(value) {
if (!hasAndroidHome && fs.existsSync(value)) {
@@ -171,8 +231,10 @@ module.exports.check_android = function() {
process.env['ANDROID_HOME'] = value;
}
}
if (!hasAndroidHome && !androidCmdPath) {
if (isWindows) {
// First ensure ANDROID_HOME is set
// If we have no hints (nothing in PATH), try a few default locations
if (!hasAndroidHome && !androidCmdPath && !adbInPath && !avdmanagerInPath) {
if (module.exports.isWindows()) {
// Android Studio 1.0 installer
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'sdk'));
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'sdk'));
@@ -182,7 +244,7 @@ module.exports.check_android = function() {
// Stand-alone installer
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk'));
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk'));
} else if (process.platform == 'darwin') {
} else if (module.exports.isDarwin()) {
// Android Studio 1.0 installer
maybeSetAndroidHome(path.join(process.env['HOME'], 'Library', 'Android', 'sdk'));
// Android Studio pre-1.0 installer
@@ -197,26 +259,42 @@ module.exports.check_android = function() {
maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk'));
}
}
if (hasAndroidHome && !androidCmdPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
}
if (androidCmdPath && !hasAndroidHome) {
var parentDir = path.dirname(androidCmdPath);
var grandParentDir = path.dirname(parentDir);
if (path.basename(parentDir) == 'tools') {
process.env['ANDROID_HOME'] = path.dirname(parentDir);
hasAndroidHome = true;
} else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
process.env['ANDROID_HOME'] = grandParentDir;
hasAndroidHome = true;
} else {
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
'Try reinstall Android SDK or update your PATH to include path to valid SDK directory.');
if (!hasAndroidHome) {
// If we dont have ANDROID_HOME, but we do have some tools on the PATH, try to infer from the tooling PATH.
var parentDir, grandParentDir;
if (androidCmdPath) {
parentDir = path.dirname(androidCmdPath);
grandParentDir = path.dirname(parentDir);
if (path.basename(parentDir) == 'tools' || fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
maybeSetAndroidHome(grandParentDir);
} else {
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
'Detected \'android\' command at ' + parentDir + ' but no \'tools\' directory found near.\n' +
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools directory.');
}
}
if (adbInPath) {
parentDir = path.dirname(adbInPath);
grandParentDir = path.dirname(parentDir);
if (path.basename(parentDir) == 'platform-tools') {
maybeSetAndroidHome(grandParentDir);
} else {
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
'Detected \'adb\' command at ' + parentDir + ' but no \'platform-tools\' directory found near.\n' +
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'platform-tools directory.');
}
}
if (avdmanagerInPath) {
parentDir = path.dirname(avdmanagerInPath);
grandParentDir = path.dirname(parentDir);
if (path.basename(parentDir) == 'bin' && path.basename(grandParentDir) == 'tools') {
maybeSetAndroidHome(path.dirname(grandParentDir));
} else {
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
'Detected \'avdmanager\' command at ' + parentDir + ' but no \'tools' + path.sep + 'bin\' directory found near.\n' +
'Try reinstall Android SDK or update your PATH to include valid path to SDK' + path.sep + 'tools' + path.sep + 'bin directory.');
}
}
}
if (hasAndroidHome && !adbInPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
}
if (!process.env['ANDROID_HOME']) {
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
@@ -226,13 +304,27 @@ module.exports.check_android = function() {
throw new CordovaError('\'ANDROID_HOME\' environment variable is set to non-existent path: ' + process.env['ANDROID_HOME'] +
'\nTry update it manually to point to valid SDK directory.');
}
// Next let's make sure relevant parts of the SDK tooling is in our PATH
if (hasAndroidHome && !androidCmdPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
}
if (hasAndroidHome && !adbInPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
}
if (hasAndroidHome && !avdmanagerInPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools', 'bin');
}
return hasAndroidHome;
});
};
// TODO: is this actually needed?
module.exports.getAbsoluteAndroidCmd = function () {
var cmd = forgivingWhichSync('android');
if (process.platform === 'win32') {
if (cmd.length === 0) {
cmd = forgivingWhichSync('sdkmanager');
}
if (module.exports.isWindows()) {
return '"' + cmd + '"';
}
return cmd.replace(/(\s)/g, '\\$1');
@@ -244,20 +336,17 @@ module.exports.check_android_target = function(originalError) {
// android-L
// Google Inc.:Google APIs:20
// Google Inc.:Glass Development Kit Preview:20
var valid_target = module.exports.get_target();
var msg = 'Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.';
return tryCommand('android list targets --compact', msg)
.then(function(output) {
var targets = output.split('\n');
if (targets.indexOf(valid_target) >= 0) {
var desired_api_level = module.exports.get_target();
return android_sdk.list_targets()
.then(function(targets) {
if (targets.indexOf(desired_api_level) >= 0) {
return targets;
}
var androidCmd = module.exports.getAbsoluteAndroidCmd();
var msg = 'Please install Android target: "' + valid_target + '".\n\n' +
var msg = 'Please install Android target / API level: "' + desired_api_level + '".\n\n' +
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
'You will require:\n' +
'1. "SDK Platform" for ' + valid_target + '\n' +
'1. "SDK Platform" for API level ' + desired_api_level + '\n' +
'2. "Android SDK Platform-tools (latest)\n' +
'3. "Android SDK Build-tools" (latest)';
if (originalError) {
@@ -278,7 +367,6 @@ module.exports.run = function() {
throw new CordovaError('Requirements check failed for JDK 1.8 or greater');
}
if (!values[1]) {
throw new CordovaError('Requirements check failed for Android SDK');
}

View File

@@ -27,11 +27,15 @@ var path = require('path');
var Adb = require('./Adb');
var AndroidManifest = require('./AndroidManifest');
var events = require('cordova-common').events;
var spawn = require('cordova-common').superspawn.spawn;
var superspawn = require('cordova-common').superspawn;
var CordovaError = require('cordova-common').CordovaError;
var shelljs = require('shelljs');
var android_sdk = require('./android_sdk');
var check_reqs = require('./check_reqs');
var Q = require('q');
var os = require('os');
var fs = require('fs');
var child_process = require('child_process');
// constants
@@ -42,18 +46,77 @@ var NUM_INSTALL_RETRIES = 3;
var CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds
var EXEC_KILL_SIGNAL = 'SIGKILL';
/**
* Returns a Promise for a list of emulator images in the form of objects
* {
name : <emulator_name>,
path : <path_to_emulator_image>,
target : <api_target>,
abi : <cpu>,
skin : <skin>
}
*/
module.exports.list_images = function() {
return spawn('android', ['list', 'avds'])
function forgivingWhichSync(cmd) {
try {
return fs.realpathSync(shelljs.which(cmd));
} catch (e) {
return '';
}
}
module.exports.list_images_using_avdmanager = function () {
return superspawn.spawn('avdmanager', ['list', 'avd'])
.then(function(output) {
var response = output.split('\n');
var emulator_list = [];
for (var i = 1; i < response.length; i++) {
// To return more detailed information use img_obj
var img_obj = {};
if (response[i].match(/Name:\s/)) {
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
if (response[i + 1].match(/Device:\s/)) {
i++;
img_obj['device'] = response[i].split('Device: ')[1].replace('\r', '');
}
if (response[i + 1].match(/Path:\s/)) {
i++;
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
}
if (response[i + 1].match(/Target:\s/)) {
i++;
if (response[i + 1].match(/ABI:\s/)) {
img_obj['abi'] = response[i + 1].split('ABI: ')[1].replace('\r', '');
}
// This next conditional just aims to match the old output of `android list avd`
// We do so so that we don't have to change the logic when parsing for the
// best emulator target to spawn (see below in `best_image`)
// This allows us to transitionally support both `android` and `avdmanager` binaries,
// depending on what SDK version the user has
if (response[i + 1].match(/Based\son:\s/)) {
img_obj['target'] = response[i + 1].split('Based on:')[1];
if (img_obj['target'].match(/Tag\/ABI:\s/)) {
img_obj['target'] = img_obj['target'].split('Tag/ABI:')[0].replace('\r', '').trim();
if (img_obj['target'].indexOf('(') > -1) {
img_obj['target'] = img_obj['target'].substr(0, img_obj['target'].indexOf('(') - 1).trim();
}
}
var version_string = img_obj['target'].replace(/Android\s+/, '');
var api_level = android_sdk.version_string_to_api_level[version_string];
if (api_level) {
img_obj['target'] += ' (API level ' + api_level + ')';
}
}
}
if (response[i + 1].match(/Skin:\s/)) {
i++;
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
}
emulator_list.push(img_obj);
}
/* To just return a list of names use this
if (response[i].match(/Name:\s/)) {
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
}*/
}
return emulator_list;
});
};
module.exports.list_images_using_android = function() {
return superspawn.spawn('android', ['list', 'avds'])
.then(function(output) {
var response = output.split('\n');
var emulator_list = [];
@@ -96,6 +159,39 @@ module.exports.list_images = function() {
});
};
/**
* Returns a Promise for a list of emulator images in the form of objects
* {
name : <emulator_name>,
device : <device>,
path : <path_to_emulator_image>,
target : <api_target>,
abi : <cpu>,
skin : <skin>
}
*/
module.exports.list_images = function() {
if (forgivingWhichSync('android')) {
return module.exports.list_images_using_android()
.catch(function(err) {
// try to use `avdmanager` in case `android` reports it is no longer available.
// this likely means the target machine is using a newer version of
// the android sdk, and possibly `avdmanager` is available.
if (err.code == 1 && err.stdout.indexOf('android command is no longer available')) {
return module.exports.list_images_using_avdmanager();
} else {
throw err;
}
});
} else if (forgivingWhichSync('avdmanager')) {
return module.exports.list_images_using_avdmanager();
} else {
return Q().then(function() {
throw new CordovaError('Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?');
});
}
};
/**
* Will return the closest avd to the projects target
* or undefined if no avds exist.
@@ -109,8 +205,7 @@ module.exports.best_image = function() {
var closest = 9999;
var best = images[0];
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var project_target = require('./check_reqs').get_target().replace('android-', '');
var project_target = check_reqs.get_target().replace('android-', '');
for (var i in images) {
var target = images[i].target;
if(target) {
@@ -134,7 +229,7 @@ module.exports.list_started = function() {
// Returns a promise.
module.exports.list_targets = function() {
return spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
return superspawn.spawn('android', ['list', 'targets'], {cwd: os.tmpdir()})
.then(function(output) {
var target_out = output.split('\n');
var targets = [];
@@ -189,8 +284,7 @@ module.exports.start = function(emulator_ID, boot_timeout) {
return best.name;
}
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var androidCmd = require('./check_reqs').getAbsoluteAndroidCmd();
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
return Q.reject(new CordovaError('No emulator images (avds) found.\n' +
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
@@ -199,10 +293,13 @@ module.exports.start = function(emulator_ID, boot_timeout) {
}).then(function(emulatorId) {
return self.get_available_port()
.then(function (port) {
// Figure out the directory the emulator binary runs in, and set the cwd to that directory.
// Workaround for https://code.google.com/p/android/issues/detail?id=235461
var emulator_dir = path.dirname(shelljs.which('emulator'));
var args = ['-avd', emulatorId, '-port', port];
// Don't wait for it to finish, since the emulator will probably keep running for a long time.
child_process
.spawn('emulator', args, { stdio: 'inherit', detached: true })
.spawn('emulator', args, { stdio: 'inherit', detached: true, cwd: emulator_dir })
.unref();
// wait for emulator to start
@@ -294,7 +391,7 @@ module.exports.wait_for_boot = function(emulator_id, time_remaining) {
module.exports.create_image = function(name, target) {
console.log('Creating new avd named ' + name);
if (target) {
return spawn('android', ['create', 'avd', '--name', name, '--target', target])
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', target])
.then(null, function(error) {
console.error('ERROR : Failed to create emulator image : ');
console.error(' Do you have the latest android targets including ' + target + '?');
@@ -302,7 +399,7 @@ module.exports.create_image = function(name, target) {
});
} else {
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
return spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
return superspawn.spawn('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]])
.then(function() {
// TODO: This seems like another error case, even though it always happens.
console.error('ERROR : Unable to create an avd emulator, no targets found.');

View File

@@ -22,7 +22,7 @@
var devices = require('./device');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
devices.list().done(function(device_list) {
device_list && device_list.forEach(function(dev) {
console.log(dev);

View File

@@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_images().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu.name);

View File

@@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_started().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu);

View File

@@ -48,6 +48,7 @@ module.exports.prepare = function (cordovaProject, options) {
.then(function () {
updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
updateSplashes(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
updateFileResources(cordovaProject, path.relative(cordovaProject.root, self.locations.root));
})
.then(function () {
events.emit('verbose', 'Prepared android project successfully');
@@ -72,6 +73,7 @@ module.exports.clean = function (options) {
cleanWww(projectRoot, self.locations);
cleanIcons(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
cleanSplashes(projectRoot, projectConfig, path.relative(projectRoot, self.locations.res));
cleanFileResources(projectRoot, projectConfig, path.relative(projectRoot, self.locations.root));
});
};
@@ -401,6 +403,44 @@ function mapImageResources(rootDir, subDir, type, resourceName) {
return pathMap;
}
function updateFileResources(cordovaProject, platformDir) {
var files = cordovaProject.projectConfig.getFileResources('android');
// if there are resource-file elements in config.xml
if (files.length === 0) {
events.emit('verbose', 'This app does not have additional resource files defined');
return;
}
var resourceMap = {};
files.forEach(function(res) {
var targetPath = path.join(platformDir, res.target);
resourceMap[targetPath] = res.src;
});
events.emit('verbose', 'Updating resource files at ' + platformDir);
FileUpdater.updatePaths(
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
function cleanFileResources(projectRoot, projectConfig, platformDir) {
var files = projectConfig.getFileResources('android');
if (files.length > 0) {
events.emit('verbose', 'Cleaning resource files at ' + platformDir);
var resourceMap = {};
files.forEach(function(res) {
var filePath = path.join(platformDir, res.target);
resourceMap[filePath] = null;
});
FileUpdater.updatePaths(
resourceMap, { rootDir: projectRoot, all: true}, logFileOp);
}
}
/**
* Gets and validates 'AndroidLaunchMode' prepference from config.xml. Returns
* preference value and warns if it doesn't seems to be valid

View File

@@ -20,7 +20,7 @@
*/
// Coho updates this line:
var VERSION = "6.2.0-dev";
var VERSION = "6.2.0";
module.exports.version = VERSION;

View File

@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '6.2.0-dev';
var PLATFORM_VERSION_BUILD_LABEL = '6.2.0';
// file: src/scripts/require.js
/*jshint -W079 */

View File

@@ -0,0 +1 @@
//This file is intentionally just a comment

View File

@@ -127,9 +127,9 @@ bintray {
licenses = ['Apache-2.0']
labels = ['android', 'cordova', 'phonegap']
version {
name = '6.2.0'
name = version
released = new Date()
vcsTag = '6.2.0'
vcsTag = version
}
}
}

View File

@@ -0,0 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

View File

@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it.
*/
public interface CordovaWebView {
public static final String CORDOVA_VERSION = "6.2.0-dev";
public static final String CORDOVA_VERSION = "6.2.0";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);

View File

@@ -488,6 +488,34 @@ public class NativeToJsMessageQueue {
encodeAsMessageHelper(sb, pluginResult);
}
void buildJsMessage(StringBuilder sb) {
switch (pluginResult.getMessageType()) {
case PluginResult.MESSAGE_TYPE_MULTIPART:
int size = pluginResult.getMultipartMessagesSize();
for (int i=0; i<size; i++) {
PluginResult subresult = pluginResult.getMultipartMessage(i);
JsMessage submessage = new JsMessage(subresult, jsPayloadOrCallbackId);
submessage.buildJsMessage(sb);
if (i < (size-1)) {
sb.append(",");
}
}
break;
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
sb.append("atob('")
.append(pluginResult.getMessage())
.append("')");
break;
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
.append(pluginResult.getMessage())
.append("')");
break;
default:
sb.append(pluginResult.getMessage());
}
}
void encodeAsJsMessage(StringBuilder sb) {
if (pluginResult == null) {
sb.append(jsPayloadOrCallbackId);
@@ -495,29 +523,16 @@ public class NativeToJsMessageQueue {
int status = pluginResult.getStatus();
boolean success = (status == PluginResult.Status.OK.ordinal()) || (status == PluginResult.Status.NO_RESULT.ordinal());
sb.append("cordova.callbackFromNative('")
.append(jsPayloadOrCallbackId)
.append("',")
.append(success)
.append(",")
.append(status)
.append(",[");
switch (pluginResult.getMessageType()) {
case PluginResult.MESSAGE_TYPE_BINARYSTRING:
sb.append("atob('")
.append(pluginResult.getMessage())
.append("')");
break;
case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
sb.append("cordova.require('cordova/base64').toArrayBuffer('")
.append(pluginResult.getMessage())
.append("')");
break;
default:
sb.append(pluginResult.getMessage());
}
.append(jsPayloadOrCallbackId)
.append("',")
.append(success)
.append(",")
.append(status)
.append(",[");
buildJsMessage(sb);
sb.append("],")
.append(pluginResult.getKeepCallback())
.append(");");
.append(pluginResult.getKeepCallback())
.append(");");
}
}
}

1
node_modules/abbrev/abbrev.js generated vendored
View File

@@ -1,4 +1,3 @@
module.exports = exports = abbrev.abbrev = abbrev
abbrev.monkeyPatch = monkeyPatch

31
node_modules/abbrev/package.json generated vendored
View File

@@ -14,20 +14,19 @@
]
],
"_from": "abbrev@>=1.0.0 <2.0.0",
"_id": "abbrev@1.0.9",
"_id": "abbrev@1.1.0",
"_inCache": true,
"_installable": true,
"_location": "/abbrev",
"_nodeVersion": "4.4.4",
"_nodeVersion": "8.0.0-pre",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/abbrev-1.0.9.tgz_1466016055839_0.7825860097073019"
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/abbrev-1.1.0.tgz_1487054000015_0.9229173036292195"
},
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"_npmVersion": "3.9.1",
"_npmVersion": "4.3.0",
"_phantomChildren": {},
"_requested": {
"raw": "abbrev@1",
@@ -39,11 +38,10 @@
"type": "range"
},
"_requiredBy": [
"/istanbul",
"/nopt"
],
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz",
"_shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
"_resolved": "http://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
"_shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
"_shrinkwrap": null,
"_spec": "abbrev@1",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/nopt",
@@ -57,17 +55,17 @@
"dependencies": {},
"description": "Like ruby's abbrev module, but in js",
"devDependencies": {
"tap": "^5.7.2"
"tap": "^10.1"
},
"directories": {},
"dist": {
"shasum": "91b4792588a7738c25f35dd6f63752a2f8776135",
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz"
"shasum": "d0554c2256636e2f56e7c2e5ad183f859428d81f",
"tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz"
},
"files": [
"abbrev.js"
],
"gitHead": "c386cd9dbb1d8d7581718c54d4ba944cc9298d6f",
"gitHead": "7136d4d95449dc44115d4f78b80ec907724f64e0",
"homepage": "https://github.com/isaacs/abbrev-js#readme",
"license": "ISC",
"main": "abbrev.js",
@@ -85,7 +83,10 @@
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
},
"scripts": {
"test": "tap test.js --cov"
"postpublish": "git push origin --all; git push origin --tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap test.js --100"
},
"version": "1.0.9"
"version": "1.1.0"
}

1
node_modules/ansi/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "ansi@>=0.3.1 <0.4.0",
"_id": "ansi@0.3.1",
"_inCache": true,
"_installable": true,
"_location": "/ansi",
"_nodeVersion": "5.3.0",
"_npmUser": {

View File

@@ -16,7 +16,6 @@
"_from": "balanced-match@>=0.4.1 <0.5.0",
"_id": "balanced-match@0.4.2",
"_inCache": true,
"_installable": true,
"_location": "/balanced-match",
"_nodeVersion": "4.4.7",
"_npmOperationalInternal": {

View File

@@ -16,7 +16,6 @@
"_from": "base64-js@0.0.8",
"_id": "base64-js@0.0.8",
"_inCache": true,
"_installable": true,
"_location": "/base64-js",
"_nodeVersion": "0.10.35",
"_npmUser": {

17
node_modules/big-integer/.npmignore generated vendored
View File

@@ -1,17 +0,0 @@
/.travis.yml
/.npmignore
/.gitignore
/spec
/benchmark
/big-integer*.tgz
/my.conf.js
/node_modules
/*.csproj*
/*.sh
/*.suo
/bin
/coverage
/*.bat
/obj
/Properties
/Web.*

View File

@@ -833,6 +833,7 @@ var bigInt = (function (undefined) {
newT = lastT.subtract(q.multiply(newT));
newR = lastR.subtract(q.multiply(newR));
}
if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
if (t.compare(0) === -1) {
t = t.add(n);
}

File diff suppressed because one or more lines are too long

24
node_modules/big-integer/LICENSE generated vendored Normal file
View 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>

View File

@@ -14,14 +14,13 @@
]
],
"_from": "big-integer@>=1.6.7 <2.0.0",
"_id": "big-integer@1.6.16",
"_id": "big-integer@1.6.17",
"_inCache": true,
"_installable": true,
"_location": "/big-integer",
"_nodeVersion": "4.4.5",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/big-integer-1.6.16.tgz_1473665148825_0.5824211346916854"
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/big-integer-1.6.17.tgz_1478721202721_0.8068355675786734"
},
"_npmUser": {
"name": "peterolson",
@@ -41,8 +40,8 @@
"_requiredBy": [
"/bplist-parser"
],
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz",
"_shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.17.tgz",
"_shasum": "f0dcf5109a949e42a993ee3e8fb2070452817b51",
"_shrinkwrap": null,
"_spec": "big-integer@^1.6.7",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser",
@@ -68,13 +67,13 @@
},
"directories": {},
"dist": {
"shasum": "0ca30b58013db46b10084a09242ca1d8954724cc",
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.16.tgz"
"shasum": "f0dcf5109a949e42a993ee3e8fb2070452817b51",
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.17.tgz"
},
"engines": {
"node": ">=0.6"
},
"gitHead": "09b50ab4e701a2ec4d403fa3ecf12ae327227190",
"gitHead": "d25d0bfcd96f31001ec8572c8d01de4770d99e63",
"homepage": "https://github.com/peterolson/BigInteger.js#readme",
"keywords": [
"math",
@@ -105,5 +104,5 @@
"scripts": {
"test": "karma start my.conf.js"
},
"version": "1.6.16"
"version": "1.6.17"
}

View File

@@ -16,7 +16,6 @@
"_from": "bplist-parser@>=0.1.0 <0.2.0",
"_id": "bplist-parser@0.1.1",
"_inCache": true,
"_installable": true,
"_location": "/bplist-parser",
"_nodeVersion": "5.1.0",
"_npmUser": {

View File

@@ -16,7 +16,6 @@
"_from": "brace-expansion@>=1.0.0 <2.0.0",
"_id": "brace-expansion@1.1.6",
"_inCache": true,
"_installable": true,
"_location": "/brace-expansion",
"_nodeVersion": "4.4.7",
"_npmOperationalInternal": {

View File

@@ -16,7 +16,6 @@
"_from": "concat-map@0.0.1",
"_id": "concat-map@0.0.1",
"_inCache": true,
"_installable": true,
"_location": "/concat-map",
"_npmUser": {
"name": "substack",

View File

@@ -1,2 +1,3 @@
fixtures
coverage
jasmine.json

View File

@@ -20,6 +20,16 @@
-->
# Cordova-common Release Notes
### 2.0.1 (Mar 09, 2017)
* [CB-12557](https://issues.apache.org/jira/browse/CB-12557) add both stdout and stderr properties to the error object passed to superspawn reject handler.
### 2.0.0 (Jan 17, 2017)
* [CB-8978](https://issues.apache.org/jira/browse/CB-8978) Add `resource-file` parsing to `config.xml`
* [CB-12018](https://issues.apache.org/jira/browse/CB-12018): updated `jshint` and updated tests to work with `jasmine@2` instead of `jasmine-node`
* [CB-12163](https://issues.apache.org/jira/browse/CB-12163) Add reference attrib to `resource-file` for **Windows**
* Move windows-specific logic to `cordova-windows`
* [CB-12189](https://issues.apache.org/jira/browse/CB-12189) Add implementation attribute to framework
### 1.5.1 (Oct 12, 2016)
* [CB-12002](https://issues.apache.org/jira/browse/CB-12002) Add `getAllowIntents()` to `ConfigParser`
* [CB-11998](https://issues.apache.org/jira/browse/CB-11998) `cordova platform add` error with `cordova-common@1.5.0`

View File

@@ -2,49 +2,48 @@
"_args": [
[
{
"raw": "cordova-common@^1.5.0",
"raw": "cordova-common@^2.0.1",
"scope": null,
"escapedName": "cordova-common",
"name": "cordova-common",
"rawSpec": "^1.5.0",
"spec": ">=1.5.0 <2.0.0",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
},
"/Users/steveng/repo/cordova/cordova-android"
]
],
"_from": "cordova-common@>=1.5.0 <2.0.0",
"_id": "cordova-common@1.5.1",
"_from": "cordova-common@>=2.0.1 <3.0.0",
"_id": "cordova-common@2.0.1",
"_inCache": true,
"_installable": true,
"_location": "/cordova-common",
"_nodeVersion": "6.6.0",
"_nodeVersion": "6.9.4",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/cordova-common-1.5.1.tgz_1476725179180_0.39604957425035536"
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/cordova-common-2.0.1.tgz_1489432932737_0.5238456283695996"
},
"_npmUser": {
"name": "stevegill",
"email": "stevengill97@gmail.com"
"name": "filmaj",
"email": "maj.fil@gmail.com"
},
"_npmVersion": "3.10.3",
"_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
"raw": "cordova-common@^1.5.0",
"raw": "cordova-common@^2.0.1",
"scope": null,
"escapedName": "cordova-common",
"name": "cordova-common",
"rawSpec": "^1.5.0",
"spec": ">=1.5.0 <2.0.0",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/"
],
"_resolved": "file:cordova-dist/tools/cordova-common-1.5.1.tgz",
"_shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
"_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-2.0.1.tgz",
"_shasum": "99af318d7cb8988047cfe37bb9f25ea881d52815",
"_shrinkwrap": null,
"_spec": "cordova-common@^1.5.0",
"_spec": "cordova-common@^2.0.1",
"_where": "/Users/steveng/repo/cordova/cordova-android",
"author": {
"name": "Apache Software Foundation"
@@ -71,18 +70,17 @@
},
"description": "Apache Cordova tools and platforms shared routines",
"devDependencies": {
"istanbul": "^0.3.17",
"jasmine-node": "^1.14.5",
"istanbul": "^0.4.5",
"jasmine": "^2.5.2",
"jshint": "^2.8.0",
"promise-matchers": "^0.9.6",
"rewire": "^2.5.1"
},
"directories": {},
"dist": {
"shasum": "6770de0d6200ad6f94a1abe8939b5bd9ece139e3",
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.5.1.tgz"
"shasum": "99af318d7cb8988047cfe37bb9f25ea881d52815",
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-2.0.1.tgz"
},
"engineStrict": true,
"engines": {
"node": ">=0.9.9"
},
@@ -93,6 +91,10 @@
"name": "bowserj",
"email": "bowserj@apache.org"
},
{
"name": "filmaj",
"email": "maj.fil@gmail.com"
},
{
"name": "kotikov.vladimir",
"email": "kotikov.vladimir@gmail.com"
@@ -122,10 +124,10 @@
"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",
"cover": "istanbul cover --root src --print detail jasmine",
"jasmine": "jasmine --captureExceptions --color",
"jshint": "jshint src && jshint spec",
"test": "npm run jshint && npm run jasmine"
},
"version": "1.5.1"
"version": "2.0.1"
}

View File

@@ -1,21 +1,21 @@
/*
*
* Copyright 2013 Anis Kadri
*
* Licensed 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.
*
*/
/**
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.
*/
/*
* This module deals with shared configuration / dependency "stuff". That is:
@@ -31,11 +31,8 @@
/* jshint sub:true */
var fs = require('fs'),
path = require('path'),
var path = require('path'),
et = require('elementtree'),
semver = require('semver'),
events = require('../events'),
ConfigKeeper = require('./ConfigKeeper'),
CordovaLogger = require('../CordovaLogger');
@@ -109,18 +106,6 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
var munge = mungeutil.decrement_munge(global_munge, config_munge);
for (var file in munge.files) {
// 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 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);
self.apply_file_munge(subst, munge.files[file], true);
});
/* jshint loopfunc:false */
}
self.apply_file_munge(file, munge.files[file], /* remove = */ true);
}
@@ -250,18 +235,6 @@ function munge_helper(should_increment, self, platform_config, config_munge) {
}
for (var file in munge.files) {
// 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.windows10.appxmanifest'];
/* jshint loopfunc:true */
substs.forEach(function(subst) {
events.emit('verbose', 'Applying munge to ' + subst);
self.apply_file_munge(subst, munge.files[file]);
});
/* jshint loopfunc:false */
}
self.apply_file_munge(file, munge.files[file]);
}
@@ -333,92 +306,6 @@ function generate_plugin_config_munge(pluginInfo, vars, edit_config_changes) {
Array.prototype.push.apply(changes, edit_config_changes);
}
// Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
// Only spend the cycles if there are version-specific plugin settings
if (self.platform === 'windows' &&
changes.some(function(change) {
return ((typeof change.versions !== 'undefined') ||
(typeof change.deviceTarget !== 'undefined'));
}))
{
var manifests = {
'windows': {
'8.1.0': 'package.windows.appxmanifest',
'10.0.0': 'package.windows10.appxmanifest'
},
'phone': {
'8.1.0': 'package.phone.appxmanifest',
'10.0.0': 'package.windows10.appxmanifest'
},
'all': {
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
'10.0.0': 'package.windows10.appxmanifest'
}
};
var oldChanges = changes;
changes = [];
oldChanges.forEach(function(change, changeIndex) {
// Only support semver/device-target demux for package.appxmanifest
// Pass through in case something downstream wants to use it
if (change.target !== 'package.appxmanifest') {
changes.push(change);
return;
}
var hasVersion = (typeof change.versions !== 'undefined');
var hasTargets = (typeof change.deviceTarget !== 'undefined');
// No semver/device-target for this config-file, pass it through
if (!(hasVersion || hasTargets)) {
changes.push(change);
return;
}
var targetDeviceSet = hasTargets ? change.deviceTarget : 'all';
if (['windows', 'phone', 'all'].indexOf(targetDeviceSet) === -1) {
// target-device couldn't be resolved, fix it up here to a valid value
targetDeviceSet = 'all';
}
var knownWindowsVersionsForTargetDeviceSet = Object.keys(manifests[targetDeviceSet]);
// at this point, 'change' targets package.appxmanifest and has a version attribute
knownWindowsVersionsForTargetDeviceSet.forEach(function(winver) {
// This is a local function that creates the new replacement representing the
// mutation. Used to save code further down.
var createReplacement = function(manifestFile, originalChange) {
var replacement = {
target: manifestFile,
parent: originalChange.parent,
after: originalChange.after,
xmls: originalChange.xmls,
versions: originalChange.versions,
deviceTarget: originalChange.deviceTarget
};
return replacement;
};
// version doesn't satisfy, so skip
if (hasVersion && !semver.satisfies(winver, change.versions)) {
return;
}
var versionSpecificManifests = manifests[targetDeviceSet][winver];
if (versionSpecificManifests.constructor === Array) {
// e.g. all['8.1.0'] === ['pkg.windows.appxmanifest', 'pkg.phone.appxmanifest']
versionSpecificManifests.forEach(function(manifestFile) {
changes.push(createReplacement(manifestFile, change));
});
}
else {
// versionSpecificManifests is actually a single string
changes.push(createReplacement(versionSpecificManifests, change));
}
});
});
}
changes.forEach(function(change) {
change.xmls.forEach(function(xml) {
// 1. stringify each xml

View File

@@ -256,6 +256,30 @@ ConfigParser.prototype = {
return this.getStaticResources(platform, 'splash');
},
/**
* Returns all resource-files for a specific platform.
* @param {string} platform Platform name
* @return {Resource[]} Array of resource file objects.
*/
getFileResources: function(platform) {
var fileResources = [];
if (platform) { // platform specific resources
fileResources = this.doc.findall('platform[@name=\'' + platform + '\']/resource-file').map(function(tag) {
return {
platform: platform,
src: tag.attrib.src,
target: tag.attrib.target,
versions: tag.attrib.versions,
deviceTarget: tag.attrib['device-target'],
arch: tag.attrib.arch
};
});
}
return fileResources;
},
/**
* Returns all hook scripts for the hook type specified.
* @param {String} hook The hook type.

View File

@@ -225,7 +225,8 @@ function PluginInfo(dirname) {
target: tag.attrib.target,
versions: tag.attrib.versions,
deviceTarget: tag.attrib['device-target'],
arch: tag.attrib.arch
arch: tag.attrib.arch,
reference: tag.attrib.reference
};
});
return resourceFiles;
@@ -323,7 +324,8 @@ function PluginInfo(dirname) {
versions: el.attrib.versions,
targetDir: el.attrib['target-dir'],
deviceTarget: el.attrib['device-target'] || el.attrib.target,
arch: el.attrib.arch
arch: el.attrib.arch,
implementation: el.attrib.implementation
};
return ret;
});

View File

@@ -167,6 +167,12 @@ exports.spawn = function(cmd, args, opts) {
errMsg += ' Error output:\n' + capturedErr.trim();
}
var err = new Error(errMsg);
if (capturedErr) {
err.stderr = capturedErr;
}
if (capturedOut) {
err.stdout = capturedOut;
}
err.code = code;
d.reject(err);
}

View File

@@ -1,21 +1,21 @@
/*
*
* Copyright 2013 Brett Rudd
*
* Licensed 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.
*
*/
/**
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.
*/
// contains PLIST utility functions
var __ = require('underscore');

View File

@@ -1,21 +1,21 @@
/*
*
* Copyright 2013 Anis Kadri
*
* Licensed 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.
*
*/
/**
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.
*/
/* jshint sub:true, laxcomma:true */

View File

@@ -16,7 +16,6 @@
"_from": "cordova-registry-mapper@>=1.1.8 <2.0.0",
"_id": "cordova-registry-mapper@1.1.15",
"_inCache": true,
"_installable": true,
"_location": "/cordova-registry-mapper",
"_nodeVersion": "5.4.1",
"_npmUser": {

View File

@@ -1,7 +1,11 @@
language: node_js
sudo: false
node_js:
- 0.6
- "0.10"
- "0.11"
- "0.12"
- "iojs"
script: make test

View File

@@ -1,4 +1,4 @@
elementtree v0.1.6 (in development)
elementtree v0.1.6 - 2014-02-06
* Add support for CData elements. (#14)
[hermannpencole]

View File

@@ -14,15 +14,19 @@
]
],
"_from": "elementtree@>=0.1.6 <0.2.0",
"_id": "elementtree@0.1.6",
"_id": "elementtree@0.1.7",
"_inCache": true,
"_installable": true,
"_location": "/elementtree",
"_npmUser": {
"name": "rphillips",
"email": "ryan@trolocsis.com"
"_nodeVersion": "4.5.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/elementtree-0.1.7.tgz_1485230431723_0.19623595383018255"
},
"_npmVersion": "1.3.24",
"_npmUser": {
"name": "mburns",
"email": "michael@mirwin.net"
},
"_npmVersion": "2.15.9",
"_phantomChildren": {},
"_requested": {
"raw": "elementtree@^0.1.6",
@@ -37,8 +41,8 @@
"/",
"/cordova-common"
],
"_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz",
"_shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
"_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.7.tgz",
"_shasum": "9ac91be6e52fb6e6244c4e54a4ac3ed8ae8e29c0",
"_shrinkwrap": null,
"_spec": "elementtree@^0.1.6",
"_where": "/Users/steveng/repo/cordova/cordova-android",
@@ -59,7 +63,7 @@
}
],
"dependencies": {
"sax": "0.3.5"
"sax": "1.1.4"
},
"description": "XML Serialization and Parsing module based on Python's ElementTree.",
"devDependencies": {
@@ -69,12 +73,13 @@
"lib": "lib"
},
"dist": {
"shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
"tarball": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz"
"shasum": "9ac91be6e52fb6e6244c4e54a4ac3ed8ae8e29c0",
"tarball": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.7.tgz"
},
"engines": {
"node": ">= 0.4.0"
},
"gitHead": "1e9496379f6a1072e2b817f51a296f7cd9f07e43",
"homepage": "https://github.com/racker/node-elementtree",
"keywords": [
"xml",
@@ -83,14 +88,29 @@
"seralization",
"elementtree"
],
"licenses": [
{
"type": "Apache",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
],
"license": "Apache-2.0",
"main": "lib/elementtree.js",
"maintainers": [
{
"name": "jirwin",
"email": "justin.gallardo@gmail.com"
},
{
"name": "kami",
"email": "tomaz+npm@tomaz.me"
},
{
"name": "mburns",
"email": "michael@mirwin.net"
},
{
"name": "pquerna",
"email": "pquerna@apache.org"
},
{
"name": "rchiniquy",
"email": "robert.chiniquy@gmail.com"
},
{
"name": "rphillips",
"email": "ryan@trolocsis.com"
@@ -106,5 +126,5 @@
"scripts": {
"test": "make test"
},
"version": "0.1.6"
"version": "0.1.7"
}

17
node_modules/elementtree/tests/data/bom-xml.xml generated vendored Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<container name="test_container_1" xmlns:android="http://schemas.android.com/apk/res/android">
<object>dd
<name>test_object_1</name>
<hash>4281c348eaf83e70ddce0e07221c3d28</hash>
<bytes android:type="cool">14</bytes>
<content_type>application/octetstream</content_type>
<last_modified>2009-02-03T05:26:32.612278</last_modified>
</object>
<object>
<name>test_object_2</name>
<hash>b039efe731ad111bc1b0ef221c3849d0</hash>
<bytes android:type="lame">64</bytes>
<content_type>application/octetstream</content_type>
<last_modified>2009-02-03T05:26:32.612278</last_modified>
</object>
</container>

View File

@@ -337,3 +337,12 @@ exports['test_cdata_write'] = function(test, assert) {
test.finish();
};
exports['test_read_bom'] = function(test, assert) {
var file = readFile('bom-xml.xml');
var etree = et.parse(file);
// If parse finished, test was successful
test.finish();
};

4
node_modules/glob/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "glob@>=5.0.13 <6.0.0",
"_id": "glob@5.0.15",
"_inCache": true,
"_installable": true,
"_location": "/glob",
"_nodeVersion": "4.0.0",
"_npmUser": {
@@ -35,8 +34,7 @@
"type": "range"
},
"_requiredBy": [
"/cordova-common",
"/istanbul"
"/cordova-common"
],
"_resolved": "http://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
"_shasum": "1bc936b9e02f4a603fcc222ecf7633d30b8b93b1",

2
node_modules/inflight/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "inflight@>=1.0.4 <2.0.0",
"_id": "inflight@1.0.6",
"_inCache": true,
"_installable": true,
"_location": "/inflight",
"_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
@@ -39,7 +38,6 @@
"type": "range"
},
"_requiredBy": [
"/cli/glob",
"/glob"
],
"_resolved": "http://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",

6
node_modules/inherits/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "inherits@>=2.0.0 <3.0.0",
"_id": "inherits@2.0.3",
"_inCache": true,
"_installable": true,
"_location": "/inherits",
"_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
@@ -39,10 +38,7 @@
"type": "range"
},
"_requiredBy": [
"/cli/glob",
"/fileset/glob",
"/glob",
"/readable-stream"
"/glob"
],
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",

1
node_modules/lodash/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "lodash@>=3.5.0 <4.0.0",
"_id": "lodash@3.10.1",
"_inCache": true,
"_installable": true,
"_location": "/lodash",
"_nodeVersion": "0.12.5",
"_npmUser": {

View File

@@ -16,7 +16,6 @@
"_from": "minimatch@>=3.0.0 <4.0.0",
"_id": "minimatch@3.0.3",
"_inCache": true,
"_installable": true,
"_location": "/minimatch",
"_nodeVersion": "4.4.4",
"_npmOperationalInternal": {
@@ -39,10 +38,8 @@
"type": "range"
},
"_requiredBy": [
"/cli/glob",
"/cordova-common",
"/glob",
"/jshint"
"/glob"
],
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
"_shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774",

4
node_modules/nopt/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "nopt@>=3.0.1 <4.0.0",
"_id": "nopt@3.0.6",
"_inCache": true,
"_installable": true,
"_location": "/nopt",
"_nodeVersion": "4.2.1",
"_npmUser": {
@@ -35,8 +34,7 @@
"type": "range"
},
"_requiredBy": [
"/",
"/istanbul"
"/"
],
"_resolved": "http://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
"_shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9",

5
node_modules/once/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "once@>=1.3.0 <2.0.0",
"_id": "once@1.4.0",
"_inCache": true,
"_installable": true,
"_location": "/once",
"_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
@@ -39,10 +38,8 @@
"type": "range"
},
"_requiredBy": [
"/cli/glob",
"/glob",
"/inflight",
"/istanbul"
"/inflight"
],
"_resolved": "http://registry.npmjs.org/once/-/once-1.4.0.tgz",
"_shasum": "583b1aa775961d4b113ac17d9c50baef9dd76bd1",

View File

@@ -16,7 +16,6 @@
"_from": "os-homedir@>=1.0.0 <2.0.0",
"_id": "os-homedir@1.0.2",
"_inCache": true,
"_installable": true,
"_location": "/os-homedir",
"_nodeVersion": "6.6.0",
"_npmOperationalInternal": {

View File

@@ -16,7 +16,6 @@
"_from": "os-tmpdir@>=1.0.0 <2.0.0",
"_id": "os-tmpdir@1.0.2",
"_inCache": true,
"_installable": true,
"_location": "/os-tmpdir",
"_nodeVersion": "6.6.0",
"_npmOperationalInternal": {

27
node_modules/osenv/package.json generated vendored
View File

@@ -14,16 +14,19 @@
]
],
"_from": "osenv@>=0.1.3 <0.2.0",
"_id": "osenv@0.1.3",
"_id": "osenv@0.1.4",
"_inCache": true,
"_installable": true,
"_location": "/osenv",
"_nodeVersion": "2.2.1",
"_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/osenv-0.1.4.tgz_1481655889868_0.3980878754518926"
},
"_npmUser": {
"name": "isaacs",
"email": "isaacs@npmjs.com"
"email": "i@izs.me"
},
"_npmVersion": "3.0.0",
"_npmVersion": "3.10.9",
"_phantomChildren": {},
"_requested": {
"raw": "osenv@^0.1.3",
@@ -37,8 +40,8 @@
"_requiredBy": [
"/cordova-common"
],
"_resolved": "http://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz",
"_shasum": "83cf05c6d6458fc4d5ac6362ea325d92f2754217",
"_resolved": "http://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz",
"_shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
"_shrinkwrap": null,
"_spec": "osenv@^0.1.3",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common",
@@ -56,16 +59,16 @@
},
"description": "Look up environment settings specific to different operating systems",
"devDependencies": {
"tap": "^1.2.0"
"tap": "^8.0.1"
},
"directories": {
"test": "test"
},
"dist": {
"shasum": "83cf05c6d6458fc4d5ac6362ea325d92f2754217",
"tarball": "https://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz"
"shasum": "42fe6d5953df06c8064be6f176c3d05aaaa34644",
"tarball": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz"
},
"gitHead": "f746b3405d8f9e28054d11b97e1436f6a15016c4",
"gitHead": "ef718f0d20e38d45ec452b7faeefc692d3cd1062",
"homepage": "https://github.com/npm/osenv#readme",
"keywords": [
"environment",
@@ -106,5 +109,5 @@
"scripts": {
"test": "tap test/*.js"
},
"version": "0.1.3"
"version": "0.1.4"
}

12
node_modules/osenv/test/unix.js generated vendored
View File

@@ -2,14 +2,14 @@
// 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')
if (process.platform === 'win32') {
tap.plan(0, 'Skip unix tests, this is not unix')
process.exit(0)
}
// like unix, but funny
process.env.USER = 'sirUser'
process.env.HOME = '/home/sirUser'

View File

@@ -16,7 +16,6 @@
"_from": "path-is-absolute@>=1.0.0 <2.0.0",
"_id": "path-is-absolute@1.0.1",
"_inCache": true,
"_installable": true,
"_location": "/path-is-absolute",
"_nodeVersion": "6.6.0",
"_npmOperationalInternal": {
@@ -39,7 +38,6 @@
"type": "range"
},
"_requiredBy": [
"/cli/glob",
"/glob"
],
"_resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",

1
node_modules/plist/package.json generated vendored
View File

@@ -16,7 +16,6 @@
"_from": "plist@>=1.2.0 <2.0.0",
"_id": "plist@1.2.0",
"_inCache": true,
"_installable": true,
"_location": "/plist",
"_nodeVersion": "5.0.0",
"_npmUser": {

View File

@@ -16,7 +16,6 @@
"_from": "properties-parser@>=0.2.3 <0.3.0",
"_id": "properties-parser@0.2.3",
"_inCache": true,
"_installable": true,
"_location": "/properties-parser",
"_npmUser": {
"name": "xavi",

6
node_modules/q/CHANGES.md generated vendored
View File

@@ -1,3 +1,9 @@
## 1.5.0
- Q.any gives an error message from the last rejected promise
- Throw if callback supplied to "finally" is invalid (@grahamrhay)
- Long stack trace improvements, can now construct long stack traces
across rethrows.
## 1.4.1

2
node_modules/q/LICENSE generated vendored
View File

@@ -1,4 +1,4 @@
Copyright 20092014 Kristopher Michael Kowal. All rights reserved.
Copyright 20092017 Kristopher Michael Kowal. 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

19
node_modules/q/README.md generated vendored
View File

@@ -1,17 +1,10 @@
[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
[![Build Status](https://secure.travis-ci.org/kriskowal/q.svg?branch=master)](http://travis-ci.org/kriskowal/q)
[![CDNJS](https://img.shields.io/cdnjs/v/q.js.svg)](https://cdnjs.com/libraries/q.js)
<a href="http://promises-aplus.github.com/promises-spec">
<img src="http://kriskowal.github.io/q/q.png"
align="right" alt="Q logo" />
<img src="http://kriskowal.github.io/q/q.png" align="right" alt="Q logo" />
</a>
*This is Q version 1, from the `v1` branch in Git. This documentation applies to
the latest of both the version 1 and version 0.9 release trains. These releases
are stable. There will be no further releases of 0.9 after 0.9.7 which is nearly
equivalent to version 1.0.0. All further releases of `q@~1.0` will be backward
compatible. The version 2 release train introduces significant and
backward-incompatible changes and is experimental at this time.*
If a function cannot return a value or throw an exception without
blocking, it can return a promise instead. A promise is an object
that represents the return value or the thrown exception that the
@@ -80,7 +73,7 @@ The Q module can be loaded as:
the [q](https://npmjs.org/package/q) package
- An AMD module
- A [component](https://github.com/component/component) as ``microjs/q``
- Using [bower](http://bower.io/) as `q#1.0.1`
- Using [bower](http://bower.io/) as `q#^1.4.1`
- Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
@@ -386,7 +379,7 @@ return funcs.reduce(Q.when, Q(initialVal));
### Handling Errors
One sometimes-unintuive aspect of promises is that if you throw an
One sometimes-unintuitive aspect of promises is that if you throw an
exception in the fulfillment handler, it will not be caught by the error
handler.
@@ -876,6 +869,6 @@ You can view the results of the Q test suite [in your browser][tests]!
## License
Copyright 20092015 Kristopher Michael Kowal and contributors
Copyright 20092017 Kristopher Michael Kowal and contributors
MIT License (enclosed)

30
node_modules/q/package.json generated vendored
View File

@@ -14,16 +14,19 @@
]
],
"_from": "q@>=1.4.1 <2.0.0",
"_id": "q@1.4.1",
"_id": "q@1.5.0",
"_inCache": true,
"_installable": true,
"_location": "/q",
"_nodeVersion": "1.8.1",
"_nodeVersion": "6.9.5",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/q-1.5.0.tgz_1490148893963_0.4695124195422977"
},
"_npmUser": {
"name": "kriskowal",
"email": "kris.kowal@cixar.com"
},
"_npmVersion": "2.8.3",
"_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
"raw": "q@^1.4.1",
@@ -38,8 +41,8 @@
"/",
"/cordova-common"
],
"_resolved": "http://registry.npmjs.org/q/-/q-1.4.1.tgz",
"_shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e",
"_resolved": "http://registry.npmjs.org/q/-/q-1.5.0.tgz",
"_shasum": "dd01bac9d06d30e6f219aecb8253ee9ebdc308f1",
"_shrinkwrap": null,
"_spec": "q@^1.4.1",
"_where": "/Users/steveng/repo/cordova/cordova-android",
@@ -85,8 +88,8 @@
"test": "./spec"
},
"dist": {
"shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e",
"tarball": "https://registry.npmjs.org/q/-/q-1.4.1.tgz"
"shasum": "dd01bac9d06d30e6f219aecb8253ee9ebdc308f1",
"tarball": "https://registry.npmjs.org/q/-/q-1.5.0.tgz"
},
"engines": {
"node": ">=0.6.0",
@@ -97,7 +100,7 @@
"q.js",
"queue.js"
],
"gitHead": "d373079d3620152e3d60e82f27265a09ee0e81bd",
"gitHead": "4fecabe07ff9f3683a3d4548e7f81c2aba693326",
"homepage": "https://github.com/kriskowal/q",
"keywords": [
"q",
@@ -113,10 +116,7 @@
"browser",
"node"
],
"license": {
"type": "MIT",
"url": "http://github.com/kriskowal/q/raw/master/LICENSE"
},
"license": "MIT",
"main": "q.js",
"maintainers": [
{
@@ -148,8 +148,8 @@
"lint": "jshint q.js",
"minify": "grunt",
"prepublish": "grunt",
"test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
"test": "npm ls -s && jasmine-node spec && promises-aplus-tests spec/aplus-adapter && npm run -s lint",
"test-browser": "opener spec/q-spec.html"
},
"version": "1.4.1"
"version": "1.5.0"
}

53
node_modules/q/q.js generated vendored
View File

@@ -1,8 +1,8 @@
// vim:ts=4:sts=4:sw=4:
/*!
*
* Copyright 2009-2012 Kris Kowal under the terms of the MIT
* license found at http://github.com/kriskowal/q/raw/master/LICENSE
* Copyright 2009-2017 Kris Kowal under the terms of the MIT
* license found at https://github.com/kriskowal/q/blob/v1/LICENSE
*
* With parts by Tyler Close
* Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
@@ -190,7 +190,7 @@ var nextTick =(function () {
// `setTimeout`. In this case `setImmediate` is preferred because
// it is faster. Browserify's `process.toString()` yields
// "[object Object]", while in a real Node environment
// `process.nextTick()` yields "[object process]".
// `process.toString()` yields "[object process]".
isNodeJS = true;
requestTick = function () {
@@ -327,6 +327,11 @@ var object_create = Object.create || function (prototype) {
return new Type();
};
var object_defineProperty = Object.defineProperty || function (obj, prop, descriptor) {
obj[prop] = descriptor.value;
return obj;
};
var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
var object_keys = Object.keys || function (object) {
@@ -377,19 +382,20 @@ function makeStackTraceLong(error, promise) {
promise.stack &&
typeof error === "object" &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
error.stack
) {
var stacks = [];
for (var p = promise; !!p; p = p.source) {
if (p.stack) {
if (p.stack && (!error.__minimumStackCounter__ || error.__minimumStackCounter__ > p.stackCounter)) {
object_defineProperty(error, "__minimumStackCounter__", {value: p.stackCounter, configurable: true});
stacks.unshift(p.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
error.stack = filterStackString(concatedStacks);
var stack = filterStackString(concatedStacks);
object_defineProperty(error, "stack", {value: stack, configurable: true});
}
}
@@ -516,6 +522,14 @@ Q.nextTick = nextTick;
*/
Q.longStackSupport = false;
/**
* The counter is used to determine the stopping point for building
* long stack traces. In makeStackTraceLong we walk backwards through
* the linked list of promises, only stacks which were created before
* the rejection are concatenated.
*/
var longStackCounter = 1;
// enable long stacks if Q_DEBUG is set
if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
Q.longStackSupport = true;
@@ -588,6 +602,7 @@ function defer() {
// At the same time, cut off the first line; it's always just
// "[object Promise]\n", as per the `toString`.
promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
promise.stackCounter = longStackCounter++;
}
}
@@ -597,7 +612,12 @@ function defer() {
function become(newPromise) {
resolvedPromise = newPromise;
promise.source = newPromise;
if (Q.longStackSupport && hasStacks) {
// Only hold a reference to the new promise if long stacks
// are enabled to reduce memory usage
promise.source = newPromise;
}
array_reduce(messages, function (undefined, message) {
Q.nextTick(function () {
@@ -725,7 +745,7 @@ Promise.prototype.join = function (that) {
// TODO: "===" should be Object.is or equiv
return x;
} else {
throw new Error("Can't join: not the same: " + x + " " + y);
throw new Error("Q can't join: not the same: " + x + " " + y);
}
});
};
@@ -1622,13 +1642,12 @@ function any(promises) {
function onFulfilled(result) {
deferred.resolve(result);
}
function onRejected() {
function onRejected(err) {
pendingCount--;
if (pendingCount === 0) {
deferred.reject(new Error(
"Can't get fulfillment value from any promise, all " +
"promises were rejected."
));
err.message = ("Q can't get fulfillment value from any promise, all " +
"promises were rejected. Last error message: " + err.message);
deferred.reject(err);
}
}
function onProgress(progress) {
@@ -1752,6 +1771,9 @@ Q["finally"] = function (object, callback) {
Promise.prototype.fin = // XXX legacy
Promise.prototype["finally"] = function (callback) {
if (!callback || typeof callback.apply !== "function") {
throw new Error("Q can't apply finally callback");
}
callback = Q(callback);
return this.then(function (value) {
return callback.fcall().then(function () {
@@ -1915,6 +1937,9 @@ Promise.prototype.nfcall = function (/*...args*/) {
*/
Q.nfbind =
Q.denodeify = function (callback /*...args*/) {
if (callback === undefined) {
throw new Error("Q can't wrap an undefined function");
}
var baseArgs = array_slice(arguments, 1);
return function () {
var nodeArgs = baseArgs.concat(array_slice(arguments));

9
node_modules/sax/AUTHORS generated vendored
View File

@@ -1,9 +0,0 @@
# contributors sorted by whether or not they're me.
Isaac Z. Schlueter <i@izs.me>
Stein Martin Hustad <stein@hustad.com>
Mikeal Rogers <mikeal.rogers@gmail.com>
Laurie Harper <laurie@holoweb.net>
Jann Horn <jann@Jann-PC.fritz.box>
Elijah Insua <tmpvar@gmail.com>
Henry Rawas <henryr@schakra.com>
Justin Makeig <jmpublic@makeig.com>

58
node_modules/sax/LICENSE generated vendored
View File

@@ -1,23 +1,41 @@
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
All rights reserved.
The ISC License
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:
Copyright (c) Isaac Z. Schlueter and Contributors
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
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.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
====
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows:
Copyright Mathias Bynens <https://mathiasbynens.be/>
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.

188
node_modules/sax/LICENSE-W3C.html generated vendored Normal file
View File

@@ -0,0 +1,188 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="generator" content="HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 13), see www.w3.org" /><title>W3C Software Notice and License</title><link rel="stylesheet" href="/2008/site/css/minimum" type="text/css" media="handheld, all" /><style type="text/css" media="print, screen and (min-width: 481px)" xml:space="preserve">
@import url("/2008/site/css/advanced");
</style><link href="/2008/site/css/minimum" rel="stylesheet" type="text/css" media="handheld, only screen and (max-device-width: 480px)" /><meta name="viewport" content="width=device-width" /><link rel="stylesheet" href="/2008/site/css/print" type="text/css" media="print" /><link rel="shortcut icon" href="/2008/site/images/favicon.ico" type="image/x-icon" /></head><body id="www-w3-org" class="w3c_public"><div id="w3c_container">
<div id="w3c_mast">
<h1 class="logo">
<a tabindex="2" accesskey="1" href="/"><img src="/2008/site/images/logo-w3c-mobile-lg" width="90" height="53" alt="W3C" /></a>
<span class="alt-logo">W3C</span>
</h1>
<div id="w3c_nav">
<form action="/Help/search" method="get" enctype="application/x-www-form-urlencoded"><div class="w3c_sec_nav"><!-- --></div><ul class="main_nav"><li class="first-item">
<a href="/standards/">Standards</a>
</li><li>
<a href="/participate/">Participate</a>
</li><li>
<a href="/Consortium/membership">Membership</a>
</li><li class="last-item">
<a href="/Consortium/">About W3C</a>
</li><li class="search-item">
<div id="search-form">
<input tabindex="3" class="text" name="q" value="" title="Search" type="text" />
<button id="search-submit" name="search-submit" type="submit"><img class="submit" src="/2008/site/images/search-button" alt="Search" width="21" height="17" /></button>
</div>
</li></ul></form>
</div>
</div>
<div id="w3c_main">
<div id="w3c_logo_shadow" class="w3c_leftCol">
<img height="32" alt="" src="/2008/site/images/logo-shadow" />
</div>
<div class="w3c_leftCol"><h2 class="offscreen">Site Navigation</h2>
<h3 class="category"><span class="ribbon"><a href="/Consortium/Legal/ipr-notice.html" title="Up to Policies and Legal Information">Policies and Legal Information <img src="/2008/site/images/header-link" alt="Header link" width="13" height="13" class="header-link" /></a></span></h3>
<ul class="theme">
<li><a href="/Consortium/Legal/2008/04-testsuite-copyright.html">Licenses for W3C Test Suites</a></li>
<li><a href="/2004/10/27-testcases.html">Policies for Contribution of Test Cases to W3C</a></li>
<li><a href="/Consortium/Legal/IPR-FAQ-20000620.html">Intellectual Rights FAQ</a></li>
<li><a href="/Consortium/Legal/privacy-statement-20000612.html">W3C Privacy Statements</a></li>
<li><a href="/Consortium/Legal/2002/copyright-documents-20021231.html">W3C Document License</a></li>
<li><a href="/Consortium/Legal/2002/trademarks-20021231.html">W3C Trademarks and Generic Terms</a></li>
<li><a href="/Consortium/Legal/2002/trademark-license-20021231.html">W3C&#xAE; Trademark and Service Mark License</a></li>
<li><a class="current">W3C Software Notice and License</a></li>
<li><a href="/Consortium/Legal/2002/collaborators-agreement-20021231.html">W3C Invited Expert and Collaborators Agreement</a></li>
<li><a href="/Consortium/Persistence.html">W3C URI Persistence Policy</a></li>
<li><a href="/1999/10/21-mirroring-policy.html">Mirroring the W3C Site</a></li>
<li><a href="/Consortium/Legal/2006/08-copyright-translations.html">Translations of the Copyright Notice</a></li>
</ul>
<br /></div>
<div class="w3c_mainCol">
<div id="w3c_crumbs">
<div id="w3c_crumbs_frame">
<ul class="bct"> <!-- .bct / Breadcrumbs -->
<li class="skip"><a tabindex="1" accesskey="2" title="Skip to content (e.g., when browsing via audio)" href="#w3c_content_body">Skip</a></li>
<li><a href="/">W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/">About&#xA0;W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/facts.html">Facts&#xA0;About&#xA0;W3C</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li><a href="/Consortium/Legal/ipr-notice.html">Policies&#xA0;and&#xA0;Legal&#xA0;Information</a>&#xA0;<span class="cr">&#xBB;</span>&#xA0;</li>
<li class="current">W3C Software Notice and License</li>
</ul>
</div>
</div>
<h1 class="title">W3C Software Notice and License</h1>
<div id="w3c_content_body">
<div class="line">
<p class="intro tPadding">This work (and included software, documentation such as READMEs, or other
related items) is being provided by the copyright holders under the following
license.</p>
<h2>License</h2>
<p class="tPadding">
By obtaining, using and/or copying this work, you (the licensee)
agree that you have read, understood, and will comply with the following
terms and conditions.</p>
<p>Permission to copy, modify, and distribute this software and its
documentation, with or without modification,&#xA0;for any purpose and without
fee or royalty is hereby granted, provided that you include the following on
ALL copies of the software and documentation or portions thereof, including
modifications:</p>
<ul class="show_items"><li>The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.</li><li>Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, the <a href="copyright-software-short-notice-20021231.html">W3C Software Short
Notice</a> should be included (hypertext is preferred, text is permitted)
within the body of any redistributed or derivative code.</li><li>Notice of any changes or modifications to the files, including the date
changes were made. (We recommend you provide URIs to the location from
which the code is derived.)</li></ul>
<h2>Disclaimers</h2>
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.</p>
<p>The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to the software without specific, written
prior permission. Title to copyright in this software and any associated
documentation will at all times remain with copyright holders.</p>
<h2>Notes</h2>
<p>This version: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231</p>
<p>This formulation of W3C's notice and license became active on December 31
2002. This version removes the copyright ownership notice such that this
license can be used with materials other than those owned by the W3C,
reflects that ERCIM is now a host of the W3C, includes references to this
specific dated version of the license, and removes the ambiguous grant of
"use". Otherwise, this version is the same as the <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">previous
version</a> and is written so as to preserve the <a href="http://www.gnu.org/philosophy/license-list.html#GPLCompatibleLicenses">Free
Software Foundation's assessment of GPL compatibility</a> and <a href="http://www.opensource.org/licenses/W3C.php">OSI's certification</a>
under the <a href="http://www.opensource.org/docs/definition.php">Open Source
Definition</a>.</p>
</div>
</div>
</div>
</div>
</div><div id="w3c_footer">
<div id="w3c_footer-inner">
<h2 class="offscreen">Footer Navigation</h2>
<div class="w3c_footer-nav">
<h3>Navigation</h3>
<ul class="footer_top_nav"><li>
<a href="/">Home</a>
</li><li>
<a href="/standards/">Standards</a>
</li><li>
<a href="/participate/">Participate</a>
</li><li>
<a href="/Consortium/membership">Membership</a>
</li><li class="last-item">
<a href="/Consortium/">About W3C</a>
</li></ul>
</div>
<div class="w3c_footer-nav">
<h3>Contact W3C</h3>
<ul class="footer_bottom_nav"><li>
<a href="/Consortium/contact">Contact</a>
</li><li>
<a accesskey="0" href="/Help/">Help and FAQ</a>
</li><li>
<a href="/Consortium/sponsor/">Sponsor / Donate</a>
</li><li>
<a href="/Consortium/siteindex">Site Map</a>
</li><li>
<address id="w3c_signature">
<a href="http://lists.w3.org/Archives/Public/site-comments/">Feedback</a></address>
</li></ul>
</div>
<div class="w3c_footer-nav">
<h3>W3C Updates</h3>
<ul class="footer_follow_nav"><li>
<a href="http://twitter.com/W3C" title="Follow W3C on Twitter">
<img src="/2008/site/images/twitter-bird" alt="Twitter" width="78" height="83" class="social-icon" />
</a>
<a href="http://identi.ca/w3c" title="See W3C on Identica">
<img src="/2008/site/images/identica-logo" alt="Identica" width="91" height="83" class="social-icon" />
</a>
</li></ul>
</div>
<p class="copyright">Copyright &#xA9; 2012 W3C <sup>&#xAE;</sup> (<a href="http://www.csail.mit.edu/">
<acronym title="Massachusetts Institute of Technology">MIT</acronym>
</a>, <a href="http://www.ercim.org/">
<acronym title="European Research Consortium for Informatics and Mathematics"> ERCIM</acronym>
</a>, <a href="http://www.keio.ac.jp/">Keio</a>) <a href="/Consortium/Legal/ipr-notice">Usage policies apply</a>.</p>
</div>
</div><!-- Generated from data/scripts.php, ../../smarty/{scripts.tpl} --><!-- At the bottom for performance reasons --><div id="w3c_scripts">
<script type="text/javascript" src="/2008/site/js/main" xml:space="preserve"><!-- --></script>
</div></body></html>

99
node_modules/sax/README.md generated vendored
View File

@@ -9,7 +9,7 @@ the browser or other CommonJS implementations.
* 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
* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML
docs.
## What This Is (probably) Not
@@ -23,7 +23,7 @@ the browser or other CommonJS implementations.
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
* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic
masochism.
* A DTD-aware Thing - Fetching DTDs is a much bigger job.
@@ -41,48 +41,49 @@ through unmolested.
## Usage
var sax = require("./lib/sax"),
strict = true, // set to false for html-mode
parser = sax.parser(strict);
```javascript
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.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"))
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.createWriteStream("file-copy.xml"))
```
## Arguments
@@ -98,9 +99,13 @@ 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.
* `lowercase` - Boolean. If true, then lowercase tag names and attribute names
in loose mode, rather than uppercasing them.
* `xmlns` - Boolean. If true, then namespaces are supported.
* `position` - Boolean. If false, then don't track line/col/position.
* `strictEntities` - Boolean. If true, only parse [predefined XML
entities](http://www.w3.org/TR/REC-xml/#sec-predefined-ent)
(`&amp;`, `&apos;`, `&gt;`, `&lt;`, and `&quot;`)
## Methods
@@ -164,7 +169,7 @@ 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`
In non-strict mode, tag names are uppercased, unless the `lowercase`
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.
@@ -174,8 +179,10 @@ 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.
`attribute` - An attribute node. Argument: object with `name` and `value`.
In non-strict mode, attribute names are uppercased, unless the `lowercase`
option is set. If the `xmlns` option is set, it will also contains namespace
information.
`comment` - A comment node. Argument: the string of the comment.

File diff suppressed because it is too large Load Diff

41
node_modules/sax/examples/example.js generated vendored
View File

@@ -1,41 +0,0 @@
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();
}
});

View File

@@ -1,58 +0,0 @@
// 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)
})

View File

@@ -1,4 +0,0 @@
require("http").createServer(function (req, res) {
res.writeHead(200, {"content-type":"application/json"})
res.end(JSON.stringify({ok: true}))
}).listen(1337)

View File

@@ -1,8 +0,0 @@
<root>
something<else> blerm <slurm
attrib =
"blorg" ></else><!-- COMMENT!
--><![CDATA[processing...]]> <selfclosing tag="blr>&quot;"/> a bit down here</root>

View File

@@ -1,74 +0,0 @@
var sax = require("../lib/sax")
, printer = sax.createStream(false, {lowercasetags:true, trim:true})
, fs = require("fs")
function entity (str) {
return str.replace('"', '&quot;')
}
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)

File diff suppressed because one or more lines are too long

870
node_modules/sax/examples/strict.dtd generated vendored
View File

@@ -1,870 +0,0 @@
<!--
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 --
>

View File

@@ -1,45 +0,0 @@
#!/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/sax/examples/test.html generated vendored
View File

@@ -1,15 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>testing the parser</title>
</head>
<body>
<p>hello
<script>
</script>
</body>
</html>

1254
node_modules/sax/examples/test.xml generated vendored

File diff suppressed because it is too large Load Diff

2367
node_modules/sax/lib/sax.js generated vendored

File diff suppressed because it is too large Load Diff

65
node_modules/sax/package.json generated vendored
View File

@@ -2,47 +2,44 @@
"_args": [
[
{
"raw": "sax@0.3.5",
"raw": "sax@1.1.4",
"scope": null,
"escapedName": "sax",
"name": "sax",
"rawSpec": "0.3.5",
"spec": "0.3.5",
"rawSpec": "1.1.4",
"spec": "1.1.4",
"type": "version"
},
"/Users/steveng/repo/cordova/cordova-android/node_modules/elementtree"
]
],
"_defaultsLoaded": true,
"_engineSupported": true,
"_from": "sax@0.3.5",
"_id": "sax@0.3.5",
"_from": "sax@1.1.4",
"_id": "sax@1.1.4",
"_inCache": true,
"_installable": true,
"_location": "/sax",
"_nodeVersion": "v0.6.7-pre",
"_nodeVersion": "4.0.0",
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
"email": "isaacs@npmjs.com"
},
"_npmVersion": "1.1.0-beta-7",
"_npmVersion": "3.3.2",
"_phantomChildren": {},
"_requested": {
"raw": "sax@0.3.5",
"raw": "sax@1.1.4",
"scope": null,
"escapedName": "sax",
"name": "sax",
"rawSpec": "0.3.5",
"spec": "0.3.5",
"rawSpec": "1.1.4",
"spec": "1.1.4",
"type": "version"
},
"_requiredBy": [
"/elementtree"
],
"_resolved": "http://registry.npmjs.org/sax/-/sax-0.3.5.tgz",
"_shasum": "88fcfc1f73c0c8bbd5b7c776b6d3f3501eed073d",
"_resolved": "http://registry.npmjs.org/sax/-/sax-1.1.4.tgz",
"_shasum": "74b6d33c9ae1e001510f179a91168588f1aedaa9",
"_shrinkwrap": null,
"_spec": "sax@0.3.5",
"_spec": "sax@1.1.4",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/elementtree",
"author": {
"name": "Isaac Z. Schlueter",
@@ -84,24 +81,32 @@
{
"name": "Justin Makeig",
"email": "jmpublic@makeig.com"
},
{
"name": "Mike Schilling",
"email": "mike@emotive.com"
}
],
"dependencies": {},
"description": "An evented streaming XML parser in JavaScript",
"devDependencies": {},
"devDependencies": {
"standard": "^5.3.1",
"tap": "^2.1.1"
},
"directories": {},
"dist": {
"shasum": "88fcfc1f73c0c8bbd5b7c776b6d3f3501eed073d",
"tarball": "https://registry.npmjs.org/sax/-/sax-0.3.5.tgz"
},
"engines": {
"node": "*"
"shasum": "74b6d33c9ae1e001510f179a91168588f1aedaa9",
"tarball": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz"
},
"files": [
"lib/sax.js",
"LICENSE",
"LICENSE-W3C.html",
"README.md"
],
"gitHead": "ce6b2a2c20633482eeabb6d39cee734aef2e4da7",
"homepage": "https://github.com/isaacs/sax-js#readme",
"license": {
"type": "MIT",
"url": "https://raw.github.com/isaacs/sax-js/master/LICENSE"
},
"license": "ISC",
"main": "lib/sax.js",
"maintainers": [
{
@@ -117,7 +122,9 @@
"url": "git://github.com/isaacs/sax-js.git"
},
"scripts": {
"test": "node test/index.js"
"lint": "standard -F test/*.js lib/*.js",
"posttest": "npm run lint",
"test": "tap test/*.js"
},
"version": "0.3.5"
"version": "1.1.4"
}

View File

@@ -1,25 +0,0 @@
// 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

View File

@@ -1,11 +0,0 @@
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();

View File

@@ -1,15 +0,0 @@
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();

View File

@@ -1,28 +0,0 @@
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();

View File

@@ -1,15 +0,0 @@
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/sax/test/cdata.js generated vendored
View File

@@ -1,10 +0,0 @@
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/sax/test/index.js generated vendored
View File

@@ -1,86 +0,0 @@
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/sax/test/issue-23.js generated vendored
View File

@@ -1,43 +0,0 @@
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/sax/test/issue-30.js generated vendored
View File

@@ -1,24 +0,0 @@
// 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/sax/test/issue-35.js generated vendored
View File

@@ -1,15 +0,0 @@
// https://github.com/isaacs/sax-js/issues/35
require(__dirname).test
( { xml : "<xml>&#Xd;&#X0d;\n"+
"</xml>"
, expect :
[ [ "opentag", { name: "xml", attributes: {} } ]
, [ "text", "\r\r\n" ]
, [ "closetag", "xml" ]
]
, strict : true
, opt : {}
}
)

13
node_modules/sax/test/issue-47.js generated vendored
View File

@@ -1,13 +0,0 @@
// 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/sax/test/issue-49.js generated vendored
View File

@@ -1,31 +0,0 @@
// 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 }
}
)

View File

@@ -1,28 +0,0 @@
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 }]
]);

Some files were not shown because too many files have changed in this diff Show More