remove the xmlbuilder isopack and all references to it in the code

This commit is contained in:
Brian Mulhall
2020-02-24 18:07:50 -06:00
committed by Ben Newman
parent 65799b23ae
commit c68757a52c
9 changed files with 11 additions and 237 deletions

View File

@@ -1 +0,0 @@
.build*

View File

@@ -1 +0,0 @@
node_modules

View File

@@ -1,7 +0,0 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.
You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.

View File

@@ -1,49 +0,0 @@
{
"lockfileVersion": 1,
"dependencies": {
"@oozcitak/dom": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-1.15.2.tgz",
"integrity": "sha512-HmpUeiqNZIXaV7/lvEK89w2g6VfQjqY355umhVK/pyTHZw9xINbSrfYIGBJbpli5hYmffHCFDRVVBNYhlYgPkw=="
},
"@oozcitak/infra": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-1.0.5.tgz",
"integrity": "sha512-o+zZH7M6l5e3FaAWy3ojaPIVN5eusaYPrKm6MZQt0DKNdgXa2wDYExjpP0t/zx+GoQgQKzLu7cfD8rHCLt8JrQ=="
},
"@oozcitak/url": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-1.0.0.tgz",
"integrity": "sha512-LGrMeSxeLzsdaitxq3ZmBRVOrlRRQIgNNci6L0VRnOKlJFuRIkNm4B+BObXPCJA6JT5bEJtrrwjn30jueHJYZQ==",
"dependencies": {
"@oozcitak/infra": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-1.0.3.tgz",
"integrity": "sha512-9O2wxXGnRzy76O1XUxESxDGsXT5kzETJPvYbreO4mv6bqe1+YSuux2cZTagjJ/T4UfEwFJz5ixanOqB0QgYAag==",
"dependencies": {
"@oozcitak/util": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-1.0.1.tgz",
"integrity": "sha512-dFwFqcKrQnJ2SapOmRD1nQWEZUtbtIy9Y6TyJquzsalWNJsKIPxmTI0KG6Ypyl8j7v89L2wixH9fQDNrF78hKg=="
}
}
},
"@oozcitak/util": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-1.0.2.tgz",
"integrity": "sha512-4n8B1cWlJleSOSba5gxsMcN4tO8KkkcvXhNWW+ADqvq9Xj+Lrl9uCa90GRpjekqQJyt84aUX015DG81LFpZYXA=="
}
}
},
"@oozcitak/util": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-8.0.0.tgz",
"integrity": "sha512-+9Hq6yuoq/3TRV/n/xcpydGBq2qN2/DEDMqNTG7rm95K6ZE2/YY/sPyx62+1n8QsE9O26e5M1URlXsk+AnN9Jw=="
},
"xmlbuilder2": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-1.3.0.tgz",
"integrity": "sha512-psOhoujlyalhUaIer1bgXCaDL424+tTcfZRDEGsD+Rydext6S/mlj2bNETNIUuRsOkJ8nMC72bB5idQeG/JvWg=="
}
}
}

View File

@@ -1,5 +0,0 @@
# xmlbuilder
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/xmlbuilder) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/xmlbuilder)
***
This is an internal Meteor package.

View File

@@ -1,20 +0,0 @@
Package.describe({
summary: "An XML builder for node.js similar to java-xmlbuilder.",
version: '2.5.16'
});
Npm.depends({
'xmlbuilder2': '1.3.0'
});
Package.onUse(function (api) {
api.addFiles(['xmlbuilder.js'], 'server');
api.export('XmlBuilder', 'server');
});
Package.onTest(function (api) {
api.use(['tinytest', 'xmlbuilder', 'underscore']);
api.addFiles('xmlbuilder_tests.js', 'server');
});

View File

@@ -1 +0,0 @@
XmlBuilder = Npm.require('xmlbuilder2');

View File

@@ -1,141 +0,0 @@
// this test case mimics about 80 precent of the code used to build the
// config.xml file from the following file (meteor/tools/cordova/builder.js)
// and it exercises all the funcitons used from the xmlbuilder2 api
Tinytest.add("xmlbuilder - config.xml file generation", function (test) {
const expectedResult = `<?xml version="1.0"?><widget id="com.meteor.xmlbuilder_test" version="0.0.1" android-versionCode="28" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>XmlBuilderTest</name><description>This is a Meteor test case</description><author href="http://cordova.io" email="dev@cordova.apache.org">Meteor Developer</author><preference name="webviewbounce" value="false"/><preference name="DisallowOverscroll" value="true"/><universal-links><host name="localhost:3000"/></universal-links><content src="http://localhost:3000/"/><allow-intent href="tel:*"/><allow-intent href="geo:*"/><allow-intent href="mailto:*"/><allow-intent href="sms:*"/><allow-intent href="market:*"/><allow-intent href="itms:*"/><allow-intent href="itms-apps:*"/><allow-navigation href="http://localhost"/><platform name="ios"/><platform name="android"/></widget>`;
const accessRules = {
'tel:*': { type: 'intent' },
'geo:*': { type: 'intent' },
'mailto:*': { type: 'intent' },
'sms:*': { type: 'intent' },
'market:*': { type: 'intent' },
'itms:*': { type: 'intent' },
'itms-apps:*': { type: 'intent' },
'http://localhost': { type: 'navigation' }
};
const metadata = {
id: 'com.meteor.xmlbuilder_test',
version: '0.0.1',
author: 'Meteor Developer',
contentUrl: `http://localhost:3000/`
};
const additionalConfiguration = {
global: {
'webviewbounce': false,
'DisallowOverscroll': true
},
platform: {
ios: {},
android: {}
}
};
const custom = [`<universal-links><host name="localhost:3000"/></universal-links>`];
let config = XmlBuilder.create({ version: '1.0' }).ele('widget');
// Set the root attributes
_.each({
id: metadata.id,
version: metadata.version,
'android-versionCode': '28',
'ios-CFBundleVersion': null,
xmlns: 'http://www.w3.org/ns/widgets',
'xmlns:cdv': 'http://cordova.apache.org/ns/1.0'
}, (value, key) => {
if (value) {
config.att(key, value);
}
});
// Set the metadata
config.ele('name').txt('XmlBuilderTest');
config.ele('description').txt('This is a Meteor test case');
config.ele('author', {
href: 'http://cordova.io',
email: 'dev@cordova.apache.org'
}).txt(metadata.author);
// Set the additional global configuration preferences
_.each(additionalConfiguration.global, (value, key) => {
config.ele('preference', {
name: key,
value: value.toString()
});
});
// Set custom tags into widget element
_.each(custom, elementSet => {
const tag = config.ele(elementSet);
});
config.ele('content', { src: metadata.contentUrl });
// Copy all the access rules
_.each(accessRules, (options, pattern) => {
const type = options.type;
options = _.omit(options, 'type');
if (type === 'intent') {
config.ele('allow-intent', { href: pattern });
} else if (type === 'navigation') {
config.ele('allow-navigation', _.extend({ href: pattern }, options));
} else {
config.ele('access', _.extend({ origin: pattern }, options));
}
});
const platformElement = {
ios: config.ele('platform', { name: 'ios' }),
android: config.ele('platform', { name: 'android' })
}
// Set the additional platform-specific configuration preferences
_.each(additionalConfiguration.platform, (prefs, platform) => {
_.each(prefs, (value, key) => {
platformElement[platform].ele('preference', {
name: key,
value: value.toString()
});
});
});
const formattedXmlConfig = config.end();
test.equal(formattedXmlConfig, expectedResult);
});
Tinytest.add("xmlbuilder - create() function", function (test) {
const expectedResult = '<?xml version="1.0"?><widget/>';
let widgetNode = XmlBuilder.create({ version: '1.0' }).ele('widget');
let formattedXmlConfig = widgetNode.end();
test.equal(formattedXmlConfig, expectedResult);
widgetNode = XmlBuilder.create().ele('widget');
formattedXmlConfig = widgetNode.end();
test.equal(formattedXmlConfig, expectedResult);
});
Tinytest.add("xmlbuilder - att() function", function (test) {
const expectedResult = '<?xml version="1.0"?><widget key="test"/>';
let config = XmlBuilder.create().ele('widget');
config.att({ key: 'test' });
let formattedXmlConfig = config.end();
test.equal(formattedXmlConfig, expectedResult);
});
Tinytest.add("xmlbuilder - ele() function", function (test) {
let expectedResult = '<?xml version="1.0"?><widget><name>XmlBuilderTest</name></widget>';
let config = XmlBuilder.create().ele('widget');
config.ele('name').txt('XmlBuilderTest');
const formattedXmlConfig = config.end();
test.equal(formattedXmlConfig, expectedResult);
});

View File

@@ -66,7 +66,6 @@ export const ISOPACKETS = {
// cordova-support
'boilerplate-generator',
'webapp-hashing',
'xmlbuilder',
// cordova-support, logging
'logging',
// support for childProcess.sendMessage(topic, payload)
@@ -116,13 +115,13 @@ export function loadIsopackage(packageName, isopacketName = "combined") {
if (_.has(ISOPACKETS, isopacketName)) {
throw Error("Can't load isopacket before it has been verified: "
+ isopacketName);
+ isopacketName);
}
throw Error("Unknown isopacket: " + isopacketName);
}();
if (! _.has(isopacket, packageName)) {
if (!_.has(isopacket, packageName)) {
throw new Error("Unknown isopacket dependency: " + packageName);
}
@@ -144,7 +143,7 @@ export function ensureIsopacketsLoadable() {
// If we're not running from checkout, then there's nothing to build and we
// can declare that all isopackets are loadable.
if (! files.inCheckout()) {
if (!files.inCheckout()) {
_.each(ISOPACKETS, function (packages, name) {
loadedIsopackets[name] = null;
});
@@ -167,17 +166,17 @@ export function ensureIsopacketsLoadable() {
var isopacketRoot = isopacketPath(isopacketName);
var existingBuildinfo = files.readJSONOrNull(
files.pathJoin(isopacketRoot, 'isopacket-buildinfo.json'));
var needRebuild = ! existingBuildinfo;
if (! needRebuild && existingBuildinfo.builtBy !== compiler.BUILT_BY) {
var needRebuild = !existingBuildinfo;
if (!needRebuild && existingBuildinfo.builtBy !== compiler.BUILT_BY) {
needRebuild = true;
}
if (! needRebuild) {
if (!needRebuild) {
var watchSet = watch.WatchSet.fromJSON(existingBuildinfo.watchSet);
if (! watch.isUpToDate(watchSet)) {
if (!watch.isUpToDate(watchSet)) {
needRebuild = true;
}
}
if (! needRebuild) {
if (!needRebuild) {
// Great, it's loadable without a rebuild.
loadedIsopackets[isopacketName] = null;
return;
@@ -185,7 +184,7 @@ export function ensureIsopacketsLoadable() {
// We're going to need to build! Make a catalog and loader if we haven't
// yet.
if (! isopacketBuildContext) {
if (!isopacketBuildContext) {
isopacketBuildContext = makeIsopacketBuildContext();
}
@@ -209,7 +208,7 @@ export function ensureIsopacketsLoadable() {
return;
}
var builder = new Builder({outputPath: isopacketRoot});
var builder = new Builder({ outputPath: isopacketRoot });
builder.writeJson('isopacket-buildinfo.json', {
builtBy: compiler.BUILT_BY,
watchSet: built.watchSet.toJSON()
@@ -234,7 +233,7 @@ export function ensureIsopacketsLoadable() {
// Returns a new all-local-packages catalog to be used for building isopackets.
var newIsopacketBuildingCatalog = function () {
if (! files.inCheckout()) {
if (!files.inCheckout()) {
throw Error("No need to build isopackets unless in checkout!");
}