Add capacitorjs runtime

This commit is contained in:
olcxja 2026-05-03 17:09:55 +02:00
commit f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions

219
node_modules/@prettier/plugin-xml/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,219 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [2.2.0] - 2022-05-12
### Added
- Better error messages in the case of a syntax error.
## [2.1.0] - 2022-04-16
### Added
- Support for the `singleAttributePerLine` option.
## [2.0.1] - 2022-03-22
### Added
- Better idempotency when printing long strings of text content within elements with ignored whitespace.
## [2.0.0] - 2022-03-22
### Changed
- Require prettier `2.4.0` for the `bracketSameLine` option.
## [1.2.0] - 2021-12-23
### Added
- Support formatting `.xsl` files.
## [1.1.0] - 2021-09-26
### Added
- Bring back the `xmlSelfClosingSpace` option.
## [1.0.2] - 2021-07-17
### Changed
- Removed duplicated inner comments when `xmlWhitespaceSensitivity` is set to `"strict"`.
## [1.0.1] - 2021-07-14
### Changed
- Fix the export to work in non-TypeScript environments.
## [1.0.0] - 2021-07-14
### Added
- Support for the `bracketSameLine` option to mirror the core option.
### Removed
- The `xmlSelfClosingSpace` option is now removed to make it easier to maintain.
## [0.13.1] - 2021-03-03
### Changed
- Fixed a bug with newlines when there is empty content.
## [0.13.0] - 2021-01-22
### Added
- Maintain newlines if there are some in the original source.
## [0.12.0] - 2020-08-31
### Added
- Allow embedded parsers to handle content if element tags contain only text content and the tag name matches the name of an existing parser. For example:
```xml
<style type="text/css">
.box {
height: 100px;
width: 100px;
}
</style>
```
- Additionally support `.inx` files.
## [0.11.0] - 2020-08-14
### Changed
- Support for a whole wide variety of file types, as per linguist.
## [0.10.0] - 2020-07-24
### Changed
- Some better support for indenting mixed content when whitespace is set to ignore.
## [0.9.0] - 2020-07-21
### Added
- Ignored print ranges using the special `<!-- prettier-ignore-start -->` and `<!-- prettier-ignore-end -->` comments. For example, you can now do:
```xml
<foo>
<!-- prettier-ignore-start -->
< this-content-will-not-be-formatted />
<!-- prettier-ignore-end -->
</foo>
```
and it will maintain your formatting.
## [0.8.0] - 2020-07-03
### Added
- Support `.wsdl` files.
## [0.7.2] - 2020-02-12
### Changed
- Bump dependency on `@xml-tools/parser` to `v1.0.2`.
## [0.7.1] - 2020-02-10
### Changed
- Require `prettier/doc` instead of `prettier` to load less code in standalone mode.
## [0.7.0] - 2020-01-29
### Added
- Handle processing instructions inside elements.
- Properly handle mult-line CData tags.
## [0.6.0] - 2020-01-27
### Added
- The `xmlWhitespaceSensitivity` option, with current valid values of `"strict"` and `"ignore"`. `"strict"` behavior maintains the current behavior, while `"ignore"` allows the plugin more freedom in where to place nodes.
## [0.5.0] - 2020-01-21
### Added
- Support for DOCTYPE nodes.
## [0.4.0] - 2020-01-19
### Added
- A dependency on the `@xml-tools/parser` package to handle parsing.
- We now register as supporting `.svg` and `.xsd` files.
- The `xmlSelfClosingSpace` option for specifying whether or not to add spaces before self-closing element tags.
## [0.3.0] - 2019-11-14
### Added
- Support for cdata tags.
- Support for the `locStart` and `locEnd` functions by tracking node metadata in the new parser.
- Support for comment nodes.
- Support for `<?xml ... ?>` and `<?xml-model ... ?>` tags.
### Changed
- Dropped the dependency on `fast-xml-parser` in favor of writing our own for better control over comments and node location.
## [0.2.0] - 2019-11-12
### Changed
- Renamed package to `@prettier/plugin-xml`.
## [0.1.0] - 2019-11-12
### Added
- Initial release 🎉
[unreleased]: https://github.com/prettier/plugin-xml/compare/v2.2.0...HEAD
[2.2.0]: https://github.com/prettier/plugin-xml/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/prettier/plugin-xml/compare/v2.0.1...v2.1.0
[2.0.1]: https://github.com/prettier/plugin-xml/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/prettier/plugin-xml/compare/v1.2.0...v2.0.0
[1.2.0]: https://github.com/prettier/plugin-xml/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/prettier/plugin-xml/compare/v1.0.2...v1.1.0
[1.0.2]: https://github.com/prettier/plugin-xml/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/prettier/plugin-xml/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/prettier/plugin-xml/compare/v0.13.1...v1.0.0
[0.13.1]: https://github.com/prettier/plugin-xml/compare/v0.13.0...v0.13.1
[0.13.0]: https://github.com/prettier/plugin-xml/compare/v0.12.0...v0.13.0
[0.12.0]: https://github.com/prettier/plugin-xml/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/prettier/plugin-xml/compare/v0.10.0...v0.11.0
[0.10.0]: https://github.com/prettier/plugin-xml/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/prettier/plugin-xml/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/prettier/plugin-xml/compare/v0.7.2...v0.8.0
[0.7.2]: https://github.com/prettier/plugin-xml/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/prettier/plugin-xml/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/prettier/plugin-xml/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/prettier/plugin-xml/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/prettier/plugin-xml/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/prettier/plugin-xml/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/prettier/plugin-xml/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/prettier/plugin-xml/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/prettier/plugin-xml/compare/289f2a...v0.1.0

21
node_modules/@prettier/plugin-xml/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019-present Kevin Newton
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.

97
node_modules/@prettier/plugin-xml/README.md generated vendored Normal file
View file

@ -0,0 +1,97 @@
<h1 align="center">Prettier for XML</h1>
<p align="center">
<a href="https://gitter.im/jlongster/prettier">
<img alt="Gitter" src="https://img.shields.io/gitter/room/jlongster/prettier.svg?style=flat-square">
</a>
<a href="https://github.com/prettier/plugin-xml/actions">
<img alt="GitHub Actions" src="https://img.shields.io/github/workflow/status/prettier/plugin-xml/Main?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/@prettier/plugin-xml">
<img alt="NPM Version" src="https://img.shields.io/npm/v/@prettier/plugin-xml.svg?style=flat-square">
</a>
<a href="#badge">
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square">
</a>
<a href="https://twitter.com/PrettierCode">
<img alt="Follow+Prettier+on+Twitter" src="https://img.shields.io/twitter/follow/prettiercode.svg?label=follow+prettier&style=flat-square">
</a>
</p>
`@prettier/plugin-xml` is a [prettier](https://prettier.io/) plugin for XML. `prettier` is an opinionated code formatter that supports multiple languages and integrates with most editors. The idea is to eliminate discussions of style in code review and allow developers to get back to thinking about code design instead.
## Getting started
To run `prettier` with the XML plugin, you're going to need [`node`](https://nodejs.org/en/download/).
If you're using the `npm` CLI, then add the plugin by:
```bash
npm install --save-dev prettier @prettier/plugin-xml
```
Or if you're using `yarn`, then add the plugin by:
```bash
yarn add --dev prettier @prettier/plugin-xml
```
The `prettier` executable is now installed and ready for use:
```bash
./node_modules/.bin/prettier --write '**/*.xml'
```
## Configuration
Below are the options (from [`src/plugin.ts`](src/plugin.ts)) that `@prettier/plugin-xml` currently supports:
| API Option | CLI Option | Default | Description |
| -------------------------- | ------------------------------ | :--------: | ------------------------------------------------------------------------------------------------------------- |
| `bracketSameLine` | `--bracket-same-line` | `true` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#bracket-same-line)) |
| `printWidth` | `--print-width` | `80` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)). |
| `singleAttributePerLine` | `--single-attribute-per-line` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line)) |
| `tabWidth` | `--tab-width` | `2` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)). |
| `xmlSelfClosingSpace` | `--xml-self-closing-space` | `true` | Adds a space before self-closing tags. |
| `xmlWhitespaceSensitivity` | `--xml-whitespace-sensitivity` | `"strict"` | Options are `"strict"` and `"ignore"`. You may want `"ignore"`, [see below](#whitespace). |
Any of these can be added to your existing [prettier configuration
file](https://prettier.io/docs/en/configuration.html). For example:
```json
{
"tabWidth": 4
}
```
Or, they can be passed to `prettier` as arguments:
```bash
prettier --tab-width 4 --write '**/*.xml'
```
### Whitespace
In XML, by default, all whitespace inside elements has semantic meaning. For prettier to maintain its contract of not changing the semantic meaning of your program, this means the default for `xmlWhitespaceSensitivity` is `"strict"`. When running in this mode, prettier's ability to rearrange your markup is somewhat limited, as it has to maintain the exact amount of whitespace that you input within elements.
If you're sure that the XML files that you're formatting do not require whitespace sensitivity, you can use the `"ignore"` option, as this will produce a standardized amount of whitespace. This will fix any indentation issues, and collapse excess blank lines (max of 1 blank line). For most folks most of the time, this is probably the option that you want.
### Ignore ranges
You can use two special comments to get prettier to ignore formatting a specific piece of the document, as in the following example:
```xml
<foo>
<!-- prettier-ignore-start -->
<this-content-will-not-be-formatted />
<!-- prettier-ignore-end -->
</foo>
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/prettier/plugin-xml.
## License
The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

102
node_modules/@prettier/plugin-xml/dist/embed.js generated vendored Normal file
View file

@ -0,0 +1,102 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const doc_1 = require("prettier/doc");
const { dedentToRoot, group, hardline, indent, join, line, literalline, softline } = doc_1.builders;
// Replace the string content newlines within a doc tree with literallines so
// that all of the indentation lines up appropriately
function replaceNewlines(doc) {
return doc_1.utils.mapDoc(doc, (currentDoc) => typeof currentDoc === "string" && currentDoc.includes("\n")
? currentDoc.split(/(\n)/g).map((v, i) => (i % 2 === 0 ? v : literalline))
: currentDoc);
}
// Get the start and end element tags from the current node on the tree
function getElementTags(path, opts, print) {
const node = path.getValue();
const { OPEN, Name, attribute, START_CLOSE, SLASH_OPEN, END_NAME, END } = node.children;
const parts = [OPEN[0].image, Name[0].image];
if (attribute) {
parts.push(indent([line, join(line, path.map(print, "children", "attribute"))]));
}
if (!opts.bracketSameLine) {
parts.push(softline);
}
return {
openTag: group([...parts, START_CLOSE[0].image]),
closeTag: group([SLASH_OPEN[0].image, END_NAME[0].image, END[0].image])
};
}
// Get the name of the parser that is represented by the given element node,
// return null if a matching parser cannot be found
function getParser(node, opts) {
const { Name, attribute } = node.children;
const parser = Name[0].image.toLowerCase();
// We don't want to deal with some weird recursive parser situation, so we
// need to explicitly call out the XML parser here and just return null
if (parser === "xml") {
return null;
}
// If this is a style tag with a text/css type, then we can skip straight to
// saying that this needs a CSS parser
if (parser === "style" &&
attribute &&
attribute.some((attr) => attr.children.Name[0].image === "type" &&
attr.children.STRING[0].image === '"text/css"')) {
return "css";
}
// If there is a plugin that has a parser that matches the name of this
// element, then we're going to assume that's correct for embedding and go
// ahead and switch to that parser
if (opts.plugins.some((plugin) => typeof plugin !== "string" &&
plugin.parsers &&
Object.prototype.hasOwnProperty.call(plugin.parsers, parser))) {
return parser;
}
return null;
}
// Get the source string that will be passed into the embedded parser from the
// content of the inside of the element node
function getSource(content) {
return content.chardata
.map((node) => {
const { SEA_WS, TEXT } = node.children;
const [{ image }] = SEA_WS || TEXT;
return {
offset: node.location.startOffset,
printed: image
};
})
.sort(({ offset }) => offset)
.map(({ printed }) => printed)
.join("");
}
const embed = (path, print, textToDoc, opts) => {
const node = path.getValue();
// If the node isn't an element node, then skip
if (node.name !== "element") {
return null;
}
// If the name of the node does not correspond to the name of a parser that
// prettier knows about, then skip
const parser = getParser(node, opts);
if (!parser) {
return null;
}
// If the node does not actually contain content, or it contains any content
// that is not just plain text, then skip
const content = node.children.content[0].children;
if (Object.keys(content).length !== 1 || !content.chardata) {
return null;
}
// Get the open and close tags of this element, then return the properly
// formatted content enclosed within them
const nodePath = path;
const { openTag, closeTag } = getElementTags(nodePath, opts, print);
return group([
openTag,
literalline,
dedentToRoot(replaceNewlines(doc_1.utils.stripTrailingHardline(textToDoc(getSource(content), { ...opts, parser })))),
hardline,
closeTag
]);
};
exports.default = embed;

39
node_modules/@prettier/plugin-xml/dist/parser.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const parser_1 = require("@xml-tools/parser");
const parser = {
parse(text) {
const { lexErrors, parseErrors, cst } = (0, parser_1.parse)(text);
// If there are any lexical errors, throw the first of them as an error.
if (lexErrors.length > 0) {
const lexError = lexErrors[0];
const error = new Error(lexError.message);
error.loc = {
start: { line: lexError.line, column: lexError.column },
end: { line: lexError.line, column: lexError.column + lexError.length }
};
throw error;
}
// If there are any parse errors, throw the first of them as an error.
if (parseErrors.length > 0) {
const parseError = parseErrors[0];
const error = new Error(parseError.message);
const { token } = parseError;
error.loc = {
start: { line: token.startLine, column: token.startColumn },
end: { line: token.endLine, column: token.endColumn }
};
throw error;
}
// Otherwise return the CST.
return cst;
},
astFormat: "xml",
locStart(node) {
return node.location.startOffset;
},
locEnd(node) {
return node.location.endOffset;
}
};
exports.default = parser;

175
node_modules/@prettier/plugin-xml/dist/plugin.js generated vendored Normal file
View file

@ -0,0 +1,175 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const parser_1 = __importDefault(require("./parser"));
const printer_1 = __importDefault(require("./printer"));
const plugin = {
languages: [
{
name: "XML",
parsers: ["xml"],
aliases: ["rss", "xsd", "wsdl"],
extensions: [
".xml",
".adml",
".admx",
".ant",
".axml",
".builds",
".ccproj",
".ccxml",
".clixml",
".cproject",
".cscfg",
".csdef",
".csl",
".csproj",
".ct",
".depproj",
".dita",
".ditamap",
".ditaval",
".dll.config",
".dotsettings",
".filters",
".fsproj",
".fxml",
".glade",
".gml",
".gmx",
".grxml",
".iml",
".inx",
".ivy",
".jelly",
".jsproj",
".kml",
".launch",
".mdpolicy",
".mjml",
".mm",
".mod",
".mxml",
".natvis",
".ncl",
".ndproj",
".nproj",
".nuspec",
".odd",
".osm",
".pkgproj",
".pluginspec",
".proj",
".props",
".ps1xml",
".psc1",
".pt",
".rdf",
".resx",
".rss",
".runsettings",
".sch",
".scxml",
".sfproj",
".shproj",
".srdf",
".storyboard",
".sublime-snippet",
".targets",
".tml",
".ts",
".tsx",
".ui",
".urdf",
".ux",
".vbproj",
".vcxproj",
".vsixmanifest",
".vssettings",
".vstemplate",
".vxml",
".wixproj",
".workflow",
".wsdl",
".wsf",
".wxi",
".wxl",
".wxs",
".x3d",
".xacro",
".xaml",
".xib",
".xlf",
".xliff",
".xmi",
".xml.dist",
".xproj",
".xsd",
".xsl",
".xslt",
".xspec",
".xul",
".zcml"
],
filenames: [
".classpath",
".cproject",
".project",
"App.config",
"NuGet.config",
"Settings.StyleCop",
"Web.Debug.config",
"Web.Release.config",
"Web.config",
"packages.config"
],
vscodeLanguageIds: ["xml", "forcesourcemanifest"],
linguistLanguageId: 399
},
{
name: "SVG",
parsers: ["xml"],
extensions: [".svg"],
vscodeLanguageIds: ["svg"],
linguistLanguageId: 337
}
],
parsers: {
xml: parser_1.default
},
printers: {
xml: printer_1.default
},
options: {
xmlSelfClosingSpace: {
type: "boolean",
category: "XML",
default: true,
description: "Adds a space before self-closing tags.",
since: "1.1.0"
},
xmlWhitespaceSensitivity: {
type: "choice",
category: "XML",
default: "strict",
description: "How to handle whitespaces in XML.",
choices: [
{
value: "strict",
description: "Whitespaces are considered sensitive in all elements."
},
{
value: "ignore",
description: "Whitespaces are considered insensitive in all elements."
}
],
since: "0.6.0"
}
},
defaultOptions: {
printWidth: 80,
tabWidth: 2
}
};
module.exports = plugin;

326
node_modules/@prettier/plugin-xml/dist/printer.js generated vendored Normal file
View file

@ -0,0 +1,326 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const doc_1 = require("prettier/doc");
const embed_1 = __importDefault(require("./embed"));
const { fill, group, hardline, indent, join, line, literalline, softline } = doc_1.builders;
const ignoreStartComment = "<!-- prettier-ignore-start -->";
const ignoreEndComment = "<!-- prettier-ignore-end -->";
function hasIgnoreRanges(comments) {
if (!comments || comments.length === 0) {
return false;
}
comments.sort((left, right) => left.startOffset - right.startOffset);
let startFound = false;
for (let idx = 0; idx < comments.length; idx += 1) {
if (comments[idx].image === ignoreStartComment) {
startFound = true;
}
else if (startFound && comments[idx].image === ignoreEndComment) {
return true;
}
}
return false;
}
function isWhitespaceIgnorable(node) {
const { CData, Comment, reference } = node.children;
return !CData && !reference && !hasIgnoreRanges(Comment);
}
function printIToken(path) {
const node = path.getValue();
return {
offset: node.startOffset,
startLine: node.startLine,
endLine: node.endLine,
printed: node.image
};
}
function replaceNewlinesWithLiteralLines(content) {
return content
.split(/(\n)/g)
.map((value, idx) => (idx % 2 === 0 ? value : literalline));
}
const printer = {
embed: embed_1.default,
print(path, opts, print) {
const node = path.getValue();
switch (node.name) {
case "attribute": {
const { Name, EQUALS, STRING } = node.children;
return [Name[0].image, EQUALS[0].image, STRING[0].image];
}
case "chardata": {
const { SEA_WS, TEXT } = node.children;
const [{ image }] = SEA_WS || TEXT;
return image
.split(/(\n)/g)
.map((value, index) => (index % 2 === 0 ? value : literalline));
}
case "content": {
const nodePath = path;
let fragments = nodePath.call((childrenPath) => {
let response = [];
const children = childrenPath.getValue();
if (children.CData) {
response = response.concat(childrenPath.map(printIToken, "CData"));
}
if (children.Comment) {
response = response.concat(childrenPath.map(printIToken, "Comment"));
}
if (children.chardata) {
response = response.concat(childrenPath.map((charDataPath) => ({
offset: charDataPath.getValue().location.startOffset,
printed: print(charDataPath)
}), "chardata"));
}
if (children.element) {
response = response.concat(childrenPath.map((elementPath) => ({
offset: elementPath.getValue().location.startOffset,
printed: print(elementPath)
}), "element"));
}
if (children.PROCESSING_INSTRUCTION) {
response = response.concat(childrenPath.map(printIToken, "PROCESSING_INSTRUCTION"));
}
if (children.reference) {
response = response.concat(childrenPath.map((referencePath) => {
const referenceNode = referencePath.getValue();
return {
offset: referenceNode.location.startOffset,
printed: (referenceNode.children.CharRef ||
referenceNode.children.EntityRef)[0].image
};
}, "reference"));
}
return response;
}, "children");
const { Comment } = node.children;
if (hasIgnoreRanges(Comment)) {
Comment.sort((left, right) => left.startOffset - right.startOffset);
const ignoreRanges = [];
let ignoreStart = null;
// Build up a list of ignored ranges from the original text based on the
// special prettier-ignore-* comments
Comment.forEach((comment) => {
if (comment.image === ignoreStartComment) {
ignoreStart = comment;
}
else if (ignoreStart && comment.image === ignoreEndComment) {
ignoreRanges.push({
start: ignoreStart.startOffset,
end: comment.endOffset
});
ignoreStart = null;
}
});
// Filter the printed children to only include the ones that are outside
// of each of the ignored ranges
fragments = fragments.filter((fragment) => ignoreRanges.every(({ start, end }) => fragment.offset < start || fragment.offset > end));
// Push each of the ignored ranges into the child list as its own element
// so that the original content is still included
ignoreRanges.forEach(({ start, end }) => {
const content = opts.originalText.slice(start, end + 1);
fragments.push({
offset: start,
printed: replaceNewlinesWithLiteralLines(content)
});
});
}
fragments.sort((left, right) => left.offset - right.offset);
return group(fragments.map(({ printed }) => printed));
}
case "docTypeDecl": {
const { DocType, Name, externalID, CLOSE } = node.children;
const parts = [DocType[0].image, " ", Name[0].image];
if (externalID) {
parts.push(" ", path.call(print, "children", "externalID", 0));
}
return group([...parts, CLOSE[0].image]);
}
case "document": {
const { docTypeDecl, element, misc, prolog } = node.children;
const fragments = [];
if (docTypeDecl) {
fragments.push({
offset: docTypeDecl[0].location.startOffset,
printed: path.call(print, "children", "docTypeDecl", 0)
});
}
if (prolog) {
fragments.push({
offset: prolog[0].location.startOffset,
printed: path.call(print, "children", "prolog", 0)
});
}
if (misc) {
misc.forEach((node) => {
if (node.children.PROCESSING_INSTRUCTION) {
fragments.push({
offset: node.location.startOffset,
printed: node.children.PROCESSING_INSTRUCTION[0].image
});
}
else if (node.children.Comment) {
fragments.push({
offset: node.location.startOffset,
printed: node.children.Comment[0].image
});
}
});
}
if (element) {
fragments.push({
offset: element[0].location.startOffset,
printed: path.call(print, "children", "element", 0)
});
}
fragments.sort((left, right) => left.offset - right.offset);
return [
join(hardline, fragments.map(({ printed }) => printed)),
hardline
];
}
case "element": {
const { OPEN, Name, attribute, START_CLOSE, content, SLASH_OPEN, END_NAME, END, SLASH_CLOSE } = node.children;
const parts = [OPEN[0].image, Name[0].image];
if (attribute) {
const separator = opts.singleAttributePerLine ? hardline : line;
parts.push(indent([
line,
join(separator, path.map(print, "children", "attribute"))
]));
}
// Determine the value that will go between the <, name, and attributes
// of an element and the /> of an element.
const space = opts.xmlSelfClosingSpace ? line : softline;
if (SLASH_CLOSE) {
return group([...parts, space, SLASH_CLOSE[0].image]);
}
if (Object.keys(content[0].children).length === 0) {
return group([...parts, space, "/>"]);
}
const openTag = group([
...parts,
opts.bracketSameLine ? "" : softline,
START_CLOSE[0].image
]);
const closeTag = group([
SLASH_OPEN[0].image,
END_NAME[0].image,
END[0].image
]);
if (opts.xmlWhitespaceSensitivity === "ignore" &&
isWhitespaceIgnorable(content[0])) {
const nodePath = path;
const fragments = nodePath.call((childrenPath) => {
const children = childrenPath.getValue();
let response = [];
if (children.Comment) {
response = response.concat(childrenPath.map(printIToken, "Comment"));
}
if (children.chardata) {
childrenPath.each((charDataPath) => {
const chardata = charDataPath.getValue();
if (!chardata.children.TEXT) {
return;
}
const content = chardata.children.TEXT[0].image.trim();
const printed = group(content.split(/(\n)/g).map((value) => {
if (value === "\n") {
return literalline;
}
return fill(value
.split(/\b( +)\b/g)
.map((segment, index) => index % 2 === 0 ? segment : line));
}));
const location = chardata.location;
response.push({
offset: location.startOffset,
startLine: location.startLine,
endLine: location.endLine,
printed
});
}, "chardata");
}
if (children.element) {
response = response.concat(childrenPath.map((elementPath) => {
const location = elementPath.getValue().location;
return {
offset: location.startOffset,
startLine: location.startLine,
endLine: location.endLine,
printed: print(elementPath)
};
}, "element"));
}
if (children.PROCESSING_INSTRUCTION) {
response = response.concat(childrenPath.map(printIToken, "PROCESSING_INSTRUCTION"));
}
return response;
}, "children", "content", 0, "children");
fragments.sort((left, right) => left.offset - right.offset);
// If the only content of this tag is chardata, then use a softline so
// that we won't necessarily break (to allow <foo>bar</foo>).
if (fragments.length === 1 &&
(content[0].children.chardata || []).filter((chardata) => chardata.children.TEXT).length === 1) {
return group([
openTag,
indent([softline, fragments[0].printed]),
softline,
closeTag
]);
}
if (fragments.length === 0) {
return group([...parts, space, "/>"]);
}
const docs = [];
let lastLine = fragments[0].startLine;
fragments.forEach((node) => {
if (node.startLine - lastLine >= 2) {
docs.push(hardline, hardline);
}
else {
docs.push(hardline);
}
docs.push(node.printed);
lastLine = node.endLine;
});
return group([openTag, indent(docs), hardline, closeTag]);
}
return group([
openTag,
indent(path.call(print, "children", "content", 0)),
closeTag
]);
}
case "externalID": {
const { Public, PubIDLiteral, System, SystemLiteral } = node.children;
if (System) {
return group([
System[0].image,
indent([line, SystemLiteral[0].image])
]);
}
return group([
group([Public[0].image, indent([line, PubIDLiteral[0].image])]),
indent([line, SystemLiteral[0].image])
]);
}
case "prolog": {
const { XMLDeclOpen, attribute, SPECIAL_CLOSE } = node.children;
const parts = [XMLDeclOpen[0].image];
if (attribute) {
parts.push(indent([
softline,
join(line, path.map(print, "children", "attribute"))
]));
}
const space = opts.xmlSelfClosingSpace ? line : softline;
return group([...parts, space, SPECIAL_CLOSE[0].image]);
}
}
}
};
exports.default = printer;

20
node_modules/@prettier/plugin-xml/dist/types.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
"use strict";
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 });
;
// Reexporting every export from the parser so that the different node types can
// be referenced.
__exportStar(require("@xml-tools/parser"), exports);

69
node_modules/@prettier/plugin-xml/package.json generated vendored Normal file
View file

@ -0,0 +1,69 @@
{
"name": "@prettier/plugin-xml",
"version": "2.2.0",
"description": "prettier plugin for XML",
"main": "dist/plugin.js",
"scripts": {
"lint": "eslint --cache .",
"prepublishOnly": "tsc -p tsconfig.build.json",
"print": "prettier --plugin=.",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/prettier/plugin-xml.git"
},
"author": "Kevin Newton",
"license": "MIT",
"bugs": {
"url": "https://github.com/prettier/plugin-xml/issues"
},
"homepage": "https://github.com/prettier/plugin-xml#readme",
"dependencies": {
"@xml-tools/parser": "^1.0.11",
"prettier": ">=2.4.0"
},
"devDependencies": {
"@types/jest": "^27.5.1",
"@types/node": "^17.0.22",
"@types/prettier": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.0.0",
"jest": "^28.1.0",
"ts-jest": "^28.0.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.2"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"env": {
"es6": true,
"jest": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
},
"eslintIgnore": [
"dist"
],
"jest": {
"preset": "ts-jest",
"testRegex": ".test.ts$"
},
"prettier": {
"plugins": [
"."
],
"trailingComma": "none"
}
}

View file

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["bin", "test"]
}

10
node_modules/@prettier/plugin-xml/tsconfig.json generated vendored Normal file
View file

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es2019",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"outDir": "./dist"
}
}