Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@journeyapps/core-xml

Package Overview
Dependencies
Maintainers
2
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@journeyapps/core-xml - npm Package Compare versions

Comparing version 0.0.0-dev.916fc5f.5f75e8a to 0.0.0-dev.960310e

./dist/src/index.js

5

dist/src/domparser.js

@@ -10,6 +10,7 @@ "use strict";

// and @journeyapps/domparser for parsing.
//@ts-ignore
const implementation = document.implementation;
const parser = new domparser_1.DOMParser({ implementation });
const serializer = new XMLSerializer();
xml_1.configureParser({
(0, xml_1.configureParser)({
implementation,

@@ -28,3 +29,3 @@ parser,

const serializer = new xmldom.XMLSerializer();
xml_1.configureParser({
(0, xml_1.configureParser)({
implementation,

@@ -31,0 +32,0 @@ parser,

28

dist/src/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./xml"));
__export(require("./utils"));
__export(require("./OrderedIncrementalUpdater"));
__export(require("./UnorderedIncrementalUpdater"));
__export(require("./pretty"));
__exportStar(require("./xml"), exports);
__exportStar(require("./utils"), exports);
__exportStar(require("./OrderedIncrementalUpdater"), exports);
__exportStar(require("./UnorderedIncrementalUpdater"), exports);
__exportStar(require("./pretty"), exports);
__exportStar(require("./ElementBuilder"), exports);
//# sourceMappingURL=index.js.map
"use strict";
// This is the default import for NodeJS.
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
// Export the same values as for browsers.
__export(require("./index"));
__exportStar(require("./index"), exports);
// Auto-configure the parser
require("./domparser");
//# sourceMappingURL=node.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrderedIncrementalUpdater = void 0;
const index_1 = require("./index");

@@ -77,7 +78,7 @@ /**

}
else if (index_1.isElement(child) && this.tagMap[child.tagName]) {
else if ((0, index_1.isElement)(child) && this.tagMap[child.tagName]) {
// A known element that isn't inserted already.
// Skip it.
}
else if (index_1.isText(child) && this.textContent !== undefined) {
else if ((0, index_1.isText)(child) && this.textContent !== undefined) {
// Skip any nodes after the first one.

@@ -84,0 +85,0 @@ if (!seenSourceText) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripWhitespace = exports.serializeToString = exports.prettyText = exports.pretty = void 0;
const types_1 = require("@journeyapps/domparser/types");

@@ -16,3 +17,3 @@ const utils_1 = require("./utils");

const child = document.childNodes.item(i);
if (utils_1.isText(child)) {
if ((0, utils_1.isText)(child)) {
// workaround for xmldom that has text nodes in the document

@@ -60,3 +61,3 @@ continue;

const child = children[i];
if (utils_1.isText(child)) {
if ((0, utils_1.isText)(child)) {
// Workaround for xmldom inserting extra newlines

@@ -106,3 +107,3 @@ continue;

let newNode = node.cloneNode(false);
if (utils_1.isText(node)) {
if ((0, utils_1.isText)(node)) {
const trimmedText = node.nodeValue.trim();

@@ -125,3 +126,3 @@ const newLines = node.nodeValue.split('\n').length - 1;

}
else if (utils_1.isElement(node)) {
else if ((0, utils_1.isElement)(node)) {
let filteredChildren = [];

@@ -133,3 +134,3 @@ for (let i = 0; i < node.childNodes.length; i++) {

filteredChildren = filteredChildren.filter((node) => node != null);
if (filteredChildren.length == 1 && utils_1.isText(filteredChildren[0])) {
if (filteredChildren.length == 1 && (0, utils_1.isText)(filteredChildren[0])) {
// Text on its own. Preserve whitespace.

@@ -160,3 +161,3 @@ newNode.appendChild(filteredChildren[0]);

else {
if (utils_1.isText(child)) {
if ((0, utils_1.isText)(child)) {
// Text in mixed-mode.

@@ -163,0 +164,0 @@ // We currently preserve whitespace _before_ the text element, but not _after_.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serialize = exports.serializer = void 0;
const types_1 = require("@journeyapps/domparser/types");

@@ -58,3 +59,3 @@ const utils_1 = require("./utils");

}
if (utils_1.isElement(node)) {
if ((0, utils_1.isElement)(node)) {
if (!visibleNamespaces) {

@@ -120,12 +121,12 @@ visibleNamespaces = [];

}
else if (utils_1.isAttribute(node)) {
else if ((0, utils_1.isAttribute)(node)) {
buf.push(' ', node.name, '="', node.value.replace(/[<&"]/g, _xmlEncoder), '"');
}
else if (utils_1.isText(node)) {
else if ((0, utils_1.isText)(node)) {
buf.push(node.data.replace(/[<&]/g, _xmlEncoder));
}
else if (utils_1.isCdataNode(node)) {
else if ((0, utils_1.isCdataNode)(node)) {
buf.push('<![CDATA[', node.data, ']]>');
}
else if (utils_1.isCommentNode(node)) {
else if ((0, utils_1.isCommentNode)(node)) {
buf.push('<!--', node.data, '-->');

@@ -132,0 +133,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnorderedIncrementalUpdater = void 0;
const index_1 = require("./index");

@@ -61,4 +62,4 @@ /**

// Copy existing children
for (let child of index_1.iter(this.sourceElement.childNodes)) {
if (index_1.isElement(child) && child.tagName in this.sourceElements) {
for (let child of (0, index_1.iter)(this.sourceElement.childNodes)) {
if ((0, index_1.isElement)(child) && child.tagName in this.sourceElements) {
if (this.sourceElements[child.tagName].has(child)) {

@@ -65,0 +66,0 @@ // Present - update!

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.iter = exports.setAttributes = exports.isCommentNode = exports.isCdataNode = exports.isText = exports.isElement = exports.isAttribute = exports.DOCUMENT_NODE = exports.TEXT_NODE = exports.ATTRIBUTE_NODE = exports.ELEMENT_NODE = void 0;
const types_1 = require("@journeyapps/domparser/types");

@@ -4,0 +5,0 @@ // From: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.childContent = exports.childNode = exports.documentToText = exports.createDocument = exports.parse = exports.configureParser = exports.getParser = exports.validateChildren = exports.children = exports.attribute = exports.parseElement = exports.warning = exports.error = exports.attributeNode = exports.elementTextPosition = exports.attributeValuePosition = exports.getPosition = exports.getAttribute = void 0;
const utils_1 = require("./utils");

@@ -48,3 +49,3 @@ let configuredParser = null;

var owner;
if (utils_1.isAttribute(node)) {
if ((0, utils_1.isAttribute)(node)) {
owner = node.ownerElement.ownerDocument;

@@ -61,3 +62,3 @@ }

}
else if (utils_1.isElement(node) && node.openStart != null && node.nameEnd != null) {
else if ((0, utils_1.isElement)(node) && node.openStart != null && node.nameEnd != null) {
// This is an element

@@ -67,3 +68,3 @@ position.start = locator.position(node.openStart + 1);

}
else if (utils_1.isAttribute(node)) {
else if ((0, utils_1.isAttribute)(node)) {
// This is an attribute

@@ -199,3 +200,4 @@ var attrPosition = node.ownerElement.attributePositions == null ? null : node.ownerElement.attributePositions[node.name];

};
if (type == null) {
// The specific tag exclusions if for the specs
if (type == null && tag != 'context-menu' && tag != 'button') {
result.type = null;

@@ -289,19 +291,31 @@ result.errors.push(warning(element, "Invalid element '" + tag + "'"));

return function (valuesString, element) {
var values = valuesString.split(',');
var invalidValues = [];
Array.prototype.forEach.call(values, function (value) {
if (options.indexOf(value) == -1) {
invalidValues.push(value);
}
});
if (invalidValues.length === 0) {
return validateMultiOptions(valuesString, element, options, customMessage);
};
};
exports.attribute.multiOptionListWithFunctions = function multiOptionList(options, functionPrefix, customMessage) {
return function (valuesString, element) {
if (valuesString.indexOf(functionPrefix) === 0) {
// function token expression, therefore allow
return valuesString;
}
else {
var message = 'Invalid values: ' + invalidValues + '. ';
var extraMessage = customMessage == null ? element.name + ' values must be from ' + options : customMessage;
throw new Error(message + extraMessage);
}
return validateMultiOptions(valuesString, element, options, customMessage);
};
};
function validateMultiOptions(valuesString, element, options, customMessage) {
var values = valuesString.split(',');
var invalidValues = [];
values.forEach((value) => {
if (options.indexOf(value) == -1) {
invalidValues.push(value);
}
});
if (invalidValues.length === 0) {
return valuesString;
}
else {
var message = 'Invalid values: ' + invalidValues + '. ';
var extraMessage = customMessage == null ? element.name + ' values must be from ' + options : customMessage;
throw new Error(message + extraMessage);
}
}
// filter can be an array of strings, or a comma-separated list

@@ -326,3 +340,3 @@ function children(element, filter) {

var child = all[i];
if (utils_1.isElement(child) &&
if ((0, utils_1.isElement)(child) &&
child.tagName != null &&

@@ -340,3 +354,3 @@ (allowedNames == null || allowedNames.indexOf(child.tagName) != -1)) {

Array.prototype.forEach.call(element.childNodes, function (child) {
if (utils_1.isElement(child)) {
if ((0, utils_1.isElement)(child)) {
var tag = child.tagName;

@@ -374,3 +388,5 @@ var order = tagNames[tag];

configureParser({
//@ts-ignore
implementation: document.implementation,
//@ts-ignore
parser: new DOMParser(),

@@ -409,3 +425,3 @@ serializer: new XMLSerializer()

var child = element.childNodes[i];
if (utils_1.isElement(child) && child.tagName == childName) {
if ((0, utils_1.isElement)(child) && child.tagName == childName) {
return child;

@@ -412,0 +428,0 @@ }

{
"name": "@journeyapps/core-xml",
"version": "0.0.0-dev.916fc5f.5f75e8a",
"description": "Journey JS library",
"version": "0.0.0-dev.960310e",
"description": "Journey XML library",
"main": "./dist/src/node.js",
"browser": "./dist/src/index.js",
"typings": "./dist/@types/src/index",
"scripts": {
"build": "../node_modules/.bin/tsc --build",
"test": "yarn build && yarn test:node && yarn test:browser",
"test:browser": "karma start karma.conf.js --single-run",
"test:node": "jasmine dist/test/unit/all.js"
},
"dependencies": {
"@journeyapps/domparser": "^0.3.0"
"@journeyapps/domparser": "^0.4.1",
"xmldom": "^0.6.0"
},
"devDependencies": {
"@journeyapps/core-test-helpers": "0.0.0-dev.916fc5f.5f75e8a"
"@journeyapps/core-test-helpers": "^0.0.0-dev.960310e"
},

@@ -25,3 +20,8 @@ "files": [

],
"gitHead": "7efac88e5b97e0b1eeb78090f697f17dfbea0b66"
}
"scripts": {
"build": "../node_modules/.bin/tsc --build",
"test": "pnpm build && pnpm test:node && pnpm test:browser",
"test:browser": "karma start karma.conf.js --single-run",
"test:node": "jasmine dist/test/unit/all.js"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc