xml-model 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +4 -10
- package/dist/defaults.d.ts +13 -0
- package/dist/defaults.js +45 -9
- package/dist/errors.d.ts +16 -0
- package/dist/errors.js +14 -20
- package/dist/middleware.js +4 -10
- package/dist/model/built-ins.js +0 -3
- package/dist/model/index.d.ts +48 -0
- package/dist/model/index.js +58 -38
- package/dist/model/property.d.ts +12 -0
- package/dist/model/property.js +9 -13
- package/dist/model/registry.js +2 -9
- package/dist/model/types.d.ts +35 -0
- package/dist/node_modules/reflect-metadata/Reflect.js +9 -70
- package/dist/types.d.ts +8 -0
- package/dist/util/is-regexp.js +0 -3
- package/dist/util/kebab-case.js +0 -3
- package/dist/util/merge-maps.js +1 -5
- package/dist/vite/index.d.ts +80 -0
- package/{vite/dist → dist/vite}/index.js +9 -1
- package/dist/xml/index.d.ts +47 -0
- package/dist/xml/index.js +8 -24
- package/package.json +11 -9
- package/dist/model/types.js +0 -2
- package/dist/types.js +0 -2
- package/vite/dist/src/class-names.test.d.ts +0 -9
- package/vite/dist/src/defaults.d.ts +0 -15
- package/vite/dist/src/errors.d.ts +0 -24
- package/vite/dist/src/index.d.ts +0 -8
- package/vite/dist/src/middleware.d.ts +0 -10
- package/vite/dist/src/model/built-ins.d.ts +0 -3
- package/vite/dist/src/model/index.d.ts +0 -21
- package/vite/dist/src/model/property.d.ts +0 -6
- package/vite/dist/src/model/registry.d.ts +0 -9
- package/vite/dist/src/model/types.d.ts +0 -74
- package/vite/dist/src/model.test.d.ts +0 -2
- package/vite/dist/src/types.d.ts +0 -17
- package/vite/dist/src/util/is-regexp.d.ts +0 -12
- package/vite/dist/src/util/kebab-case.d.ts +0 -16
- package/vite/dist/src/util/merge-maps.d.ts +0 -2
- package/vite/dist/src/xml/index.d.ts +0 -33
- package/vite/dist/src/xml/xml-js.d.ts +0 -7
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/common/format.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/common/index.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/api-call-transformer.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/common/class-analyzer.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/common/compile-error.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/common/import-analyzer.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/common/interface-analyzer.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/common/visitor-base.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/declarations-emitter.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/encode-parameter.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/find-relative-path.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/flags.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/forward-ref.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/get-exports-for-symbol.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/index.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/legacy-decorator.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/legacy-type-encoder.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/literal-node.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/metadata-collector.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/metadata-decorator.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/metadata-emitter.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/metadata-encoder.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/rt-helper.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/rtti-visitor-base.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/serialize.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/type-encoder.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/type-literal.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/utils.js +0 -0
- /package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/workarounds.js +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { RollupTypescriptOptions } from '@rollup/plugin-typescript';
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin that preserves class names at build time.
|
|
5
|
+
*
|
|
6
|
+
* When Building, class names are changed but the library relies on them
|
|
7
|
+
* so they need to be preserved.
|
|
8
|
+
*
|
|
9
|
+
* @returns A Vite plugin that rewrites mangled class name expressions and enables `keepNames`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function FixClassNames(): {
|
|
12
|
+
name: string;
|
|
13
|
+
enforce: "post";
|
|
14
|
+
transform(this: import('rollup').TransformPluginContext, code: string, id: string): {
|
|
15
|
+
code: string;
|
|
16
|
+
map: any;
|
|
17
|
+
};
|
|
18
|
+
config(this: import('vite').ConfigPluginContext): {
|
|
19
|
+
esbuild: {
|
|
20
|
+
keepNames: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** Options for the `TypescriptRTTI` and `XMLModelVitePlugin` plugins. */
|
|
25
|
+
export type RTTIPluginOptions = {
|
|
26
|
+
/**
|
|
27
|
+
* Options forwarded to `@rollup/plugin-typescript`.
|
|
28
|
+
*
|
|
29
|
+
* The plugin may not work correctly if you override the `transformers` property,
|
|
30
|
+
* as these options are shallow-merged (not deep-merged).
|
|
31
|
+
*/
|
|
32
|
+
typescript?: RollupTypescriptOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Restrict RTTI transformation to files matching this pattern.
|
|
35
|
+
*
|
|
36
|
+
* When omitted, all files are transformed.
|
|
37
|
+
*/
|
|
38
|
+
include?: RegExp;
|
|
39
|
+
/** Exclude files matching this pattern from RTTI transformation. */
|
|
40
|
+
exclude?: RegExp;
|
|
41
|
+
/** Print debug logs from the RTTI transformer. */
|
|
42
|
+
debug?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Vite plugin that applies the `typescript-rtti` TypeScript transformer.
|
|
46
|
+
*
|
|
47
|
+
* This transformer emits the runtime type metadata that xml-model uses to
|
|
48
|
+
* introspect property types without manual annotations.
|
|
49
|
+
*
|
|
50
|
+
* @param options - Plugin options controlling which files are transformed.
|
|
51
|
+
* @returns A configured `@rollup/plugin-typescript` instance with the RTTI transformer injected.
|
|
52
|
+
*/
|
|
53
|
+
export declare function TypescriptRTTI(options?: RTTIPluginOptions): import('rollup').Plugin<any>;
|
|
54
|
+
/** Alias for `RTTIPluginOptions`. */
|
|
55
|
+
export type XMLModelVitePluginOptions = RTTIPluginOptions;
|
|
56
|
+
/**
|
|
57
|
+
* Main xml-model Vite plugin.
|
|
58
|
+
*
|
|
59
|
+
* Combines `FixClassNames`, `TypescriptRTTI`, and an internal resolver that
|
|
60
|
+
* rewrites the `xml-model/dist/*` import paths emitted by typescript-rtti back
|
|
61
|
+
* to the canonical `xml-model/*` paths exported by the package.
|
|
62
|
+
*
|
|
63
|
+
* @param options - Options forwarded to `TypescriptRTTI`.
|
|
64
|
+
* @returns An array of Vite plugins.
|
|
65
|
+
*/
|
|
66
|
+
export declare function XMLModelVitePlugin(options?: RTTIPluginOptions): (Plugin<any> | import('rollup').Plugin<any> | {
|
|
67
|
+
name: string;
|
|
68
|
+
enforce: "post";
|
|
69
|
+
transform(this: import('rollup').TransformPluginContext, code: string, id: string): {
|
|
70
|
+
code: string;
|
|
71
|
+
map: any;
|
|
72
|
+
};
|
|
73
|
+
config(this: import('vite').ConfigPluginContext): {
|
|
74
|
+
esbuild: {
|
|
75
|
+
keepNames: true;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
})[];
|
|
79
|
+
export default XMLModelVitePlugin;
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -52,7 +52,15 @@ function TypescriptRTTI(options = {}) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function XMLModelVitePlugin(options = {}) {
|
|
55
|
-
|
|
55
|
+
const distResolver = {
|
|
56
|
+
name: "xml-model-resolve-dist",
|
|
57
|
+
enforce: "pre",
|
|
58
|
+
async resolveId(id) {
|
|
59
|
+
const match = id.match(/^xml-model\/dist\/(.*)/);
|
|
60
|
+
if (match) return this.resolve(`xml-model/${match[1]}`);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return [FixClassNames(), TypescriptRTTI(options), distResolver];
|
|
56
64
|
}
|
|
57
65
|
export {
|
|
58
66
|
FixClassNames,
|
package/dist/xml/index.d.ts
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import { XMLElement, XMLRoot } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Parses an XML string into an `XMLRoot` document tree.
|
|
4
|
+
*
|
|
5
|
+
* @param string - A well-formed XML string.
|
|
6
|
+
* @returns The root of the parsed element tree.
|
|
7
|
+
*/
|
|
2
8
|
export declare function parse(string: string): XMLRoot;
|
|
9
|
+
/**
|
|
10
|
+
* Serialises an `XMLRoot` or `XMLElement` back into an XML string.
|
|
11
|
+
* Delegates to xml-js's `js2xml` function.
|
|
12
|
+
*/
|
|
3
13
|
export declare const stringify: typeof import('xml-js').js2xml;
|
|
14
|
+
/**
|
|
15
|
+
* Extracts the text content from an element that has a single text child node.
|
|
16
|
+
*
|
|
17
|
+
* @param xml - An `XMLElement` expected to contain a single text node.
|
|
18
|
+
* @returns The text value, or an empty string when there are no child elements.
|
|
19
|
+
* @throws {TypeError} When the element has multiple or non-text children.
|
|
20
|
+
*/
|
|
4
21
|
export declare function getContent(xml: XMLElement): string | number | boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a minimal element structure wrapping the given text content.
|
|
24
|
+
* When no tag name is provided, returns a fragment with a text child.
|
|
25
|
+
* When a tag name is provided, returns a full element with the given name and optional attributes.
|
|
26
|
+
*
|
|
27
|
+
* @param content - The text content to wrap (defaults to empty string).
|
|
28
|
+
* @param tag - Optional element tag name.
|
|
29
|
+
* @param attributes - Optional attributes; only valid when `tag` is provided.
|
|
30
|
+
* @throws {TypeError} When `attributes` are provided without a `tag`.
|
|
31
|
+
*/
|
|
5
32
|
export declare function fromContent(content: string): {
|
|
6
33
|
elements: [{
|
|
7
34
|
type: "text";
|
|
@@ -17,9 +44,29 @@ export declare function fromContent(content: string, tag: string, attributes?: X
|
|
|
17
44
|
text: string;
|
|
18
45
|
}] | [];
|
|
19
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Appends a child element to `xml`, initialising the `elements` array if needed.
|
|
49
|
+
*
|
|
50
|
+
* @param xml - The parent element to modify.
|
|
51
|
+
* @param element - The child element to append.
|
|
52
|
+
*/
|
|
20
53
|
export declare function addElement(xml: XMLElement, element: XMLElement): void;
|
|
54
|
+
/**
|
|
55
|
+
* Sets an attribute on an element, initialising the `attributes` map if needed.
|
|
56
|
+
*
|
|
57
|
+
* @param xml - The element to modify.
|
|
58
|
+
* @param attribute - The attribute name.
|
|
59
|
+
* @param value - The attribute value.
|
|
60
|
+
*/
|
|
21
61
|
export declare function setAttribute(xml: XMLElement, attribute: string, value: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Removes an attribute from an element. Does nothing if the element has no attributes.
|
|
64
|
+
*
|
|
65
|
+
* @param xml - The element to modify.
|
|
66
|
+
* @param attribute - The attribute name to remove.
|
|
67
|
+
*/
|
|
22
68
|
export declare function deleteAttribute(xml: XMLElement, attribute: string): void;
|
|
69
|
+
/** Namespace object bundling all XML utility functions. */
|
|
23
70
|
declare const XML: {
|
|
24
71
|
parse: typeof parse;
|
|
25
72
|
stringify: typeof import('xml-js').js2xml;
|
package/dist/xml/index.js
CHANGED
|
@@ -1,56 +1,40 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import XMLJS from "./xml-js.js";
|
|
4
2
|
function parse(string) {
|
|
5
3
|
return XMLJS.parse(string);
|
|
6
4
|
}
|
|
7
|
-
__name(parse, "parse");
|
|
8
5
|
const stringify = XMLJS.stringify;
|
|
9
6
|
function getContent(xml) {
|
|
10
7
|
if (xml.elements?.length === 1) {
|
|
11
8
|
const content = xml.elements[0];
|
|
12
|
-
if (content.type === "text")
|
|
13
|
-
return content.text;
|
|
9
|
+
if (content.type === "text") return content.text;
|
|
14
10
|
}
|
|
15
|
-
if (!xml.elements)
|
|
16
|
-
return "";
|
|
11
|
+
if (!xml.elements) return "";
|
|
17
12
|
throw new TypeError(`can't get text from XMLElement: ${JSON.stringify(xml)}`);
|
|
18
13
|
}
|
|
19
|
-
__name(getContent, "getContent");
|
|
20
14
|
function fromContent(content = "", tag, attributes) {
|
|
21
15
|
const el = {
|
|
22
16
|
elements: content ? [{ type: "text", text: String(content) }] : []
|
|
23
17
|
};
|
|
24
|
-
if (tag)
|
|
25
|
-
el.name = tag;
|
|
18
|
+
if (tag) el.name = tag;
|
|
26
19
|
if (attributes) {
|
|
27
|
-
if (!el.name)
|
|
28
|
-
throw new TypeError("please provide a name if you want to provide attributes");
|
|
20
|
+
if (!el.name) throw new TypeError("please provide a name if you want to provide attributes");
|
|
29
21
|
el.attributes = attributes;
|
|
30
22
|
}
|
|
31
|
-
if (el.name)
|
|
32
|
-
el.type = "element";
|
|
23
|
+
if (el.name) el.type = "element";
|
|
33
24
|
return el;
|
|
34
25
|
}
|
|
35
|
-
__name(fromContent, "fromContent");
|
|
36
26
|
function addElement(xml, element) {
|
|
37
|
-
if (!xml.elements)
|
|
38
|
-
xml.elements = [];
|
|
27
|
+
if (!xml.elements) xml.elements = [];
|
|
39
28
|
xml.elements.push(element);
|
|
40
29
|
}
|
|
41
|
-
__name(addElement, "addElement");
|
|
42
30
|
function setAttribute(xml, attribute, value) {
|
|
43
|
-
if (!xml.attributes)
|
|
44
|
-
xml.attributes = {};
|
|
31
|
+
if (!xml.attributes) xml.attributes = {};
|
|
45
32
|
xml.attributes[attribute] = value;
|
|
46
33
|
}
|
|
47
|
-
__name(setAttribute, "setAttribute");
|
|
48
34
|
function deleteAttribute(xml, attribute) {
|
|
49
|
-
if (!xml.attributes)
|
|
50
|
-
return;
|
|
35
|
+
if (!xml.attributes) return;
|
|
51
36
|
delete xml.attributes[attribute];
|
|
52
37
|
}
|
|
53
|
-
__name(deleteAttribute, "deleteAttribute");
|
|
54
38
|
const XML = {
|
|
55
39
|
parse,
|
|
56
40
|
stringify,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xml-model",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "allows transparent XML <-> Object conversion in typescript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "MathisTLD",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./vite": {
|
|
15
|
+
"types": "./dist/vite/index.d.ts",
|
|
16
|
+
"import": "./dist/vite/index.js"
|
|
17
|
+
},
|
|
14
18
|
"./*": {
|
|
15
19
|
"types": "./dist/*.d.ts",
|
|
16
20
|
"import": "./dist/*.js"
|
|
17
|
-
},
|
|
18
|
-
"./vite": {
|
|
19
|
-
"types": "./vite/dist/index.d.ts",
|
|
20
|
-
"import": "./vite/dist/index.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"preversion": "
|
|
24
|
+
"preversion": "vitest run",
|
|
25
25
|
"version": "npm run build",
|
|
26
26
|
"postversion": "git push && git push --tags",
|
|
27
27
|
"build": "vite build",
|
|
@@ -42,16 +42,18 @@
|
|
|
42
42
|
"@types/node": "^24.10.11",
|
|
43
43
|
"husky": "^9.1.7",
|
|
44
44
|
"lint-staged": "^16.2.7",
|
|
45
|
-
"marmotte": "^0.
|
|
46
|
-
"oxfmt": "^0.
|
|
47
|
-
"oxlint": "^1.
|
|
45
|
+
"marmotte": "^0.4.2",
|
|
46
|
+
"oxfmt": "^0.36.0",
|
|
47
|
+
"oxlint": "^1.51.0",
|
|
48
48
|
"reflect-metadata": "^0.1.14",
|
|
49
49
|
"typescript": "*",
|
|
50
50
|
"vite": "*",
|
|
51
|
+
"vitepress": "^2.0.0-alpha.16",
|
|
51
52
|
"vitest": "^4.0.18"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
56
|
+
"tslib": "^2.8.1",
|
|
55
57
|
"typescript": "~5.1.6",
|
|
56
58
|
"vite": "^7.3.1"
|
|
57
59
|
},
|
package/dist/model/types.js
DELETED
package/dist/types.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { fromXMLContext, PropertyFromXMLContext, PropertyToXMLContext, toXMLContext, XMLModelPropertyOptions, XMLModel } from './model/types';
|
|
2
|
-
import { XMLElement, XMLRoot } from './types';
|
|
3
|
-
interface Defaults {
|
|
4
|
-
fromXML<T>(context: fromXMLContext<T>): T;
|
|
5
|
-
propertySourceElementsFilter<T>(...args: Parameters<XMLModelPropertyOptions<T>["isSourceElement"]>): boolean;
|
|
6
|
-
propertyResolveSourceElements<T>(context: Omit<PropertyFromXMLContext<T>, "elements">): XMLElement[];
|
|
7
|
-
propertyFromXML<T>(context: PropertyFromXMLContext<T>): T[keyof T];
|
|
8
|
-
toXML<T>(context: toXMLContext<T>): XMLRoot;
|
|
9
|
-
tagnameFromModel: (model: XMLModel) => string;
|
|
10
|
-
tagnameFromProperty<T>(property: XMLModelPropertyOptions<T>): string;
|
|
11
|
-
propertyToXML<T>(context: PropertyToXMLContext<T>): XMLRoot;
|
|
12
|
-
}
|
|
13
|
-
export declare const defaults: Defaults;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { fromXMLContext, PropertyFromXMLContext, PropertyToXMLContext, toXMLContext } from './model/types';
|
|
2
|
-
export declare class FromXMLConversionError<T> extends Error {
|
|
3
|
-
context: Omit<fromXMLContext<T>, "properties">;
|
|
4
|
-
error: unknown;
|
|
5
|
-
name: string;
|
|
6
|
-
constructor(context: Omit<fromXMLContext<T>, "properties">, error: unknown);
|
|
7
|
-
}
|
|
8
|
-
export declare class PropertyFromXMLConversionError<T> extends FromXMLConversionError<T> {
|
|
9
|
-
propertyContext: PropertyFromXMLContext<T>;
|
|
10
|
-
name: string;
|
|
11
|
-
constructor(context: Omit<fromXMLContext<T>, "properties">, propertyContext: PropertyFromXMLContext<T>, error: unknown);
|
|
12
|
-
}
|
|
13
|
-
export declare class ToXMLConversionError<T> extends Error {
|
|
14
|
-
context: Omit<toXMLContext<T>, "properties">;
|
|
15
|
-
cause: unknown;
|
|
16
|
-
name: string;
|
|
17
|
-
constructor(context: Omit<toXMLContext<T>, "properties">, cause: unknown);
|
|
18
|
-
}
|
|
19
|
-
export declare class PropertyToXMLConversionError<T> extends ToXMLConversionError<T> {
|
|
20
|
-
propertyContext: PropertyToXMLContext<T>;
|
|
21
|
-
name: string;
|
|
22
|
-
constructor(context: Omit<toXMLContext<T>, "properties">, propertyContext: PropertyToXMLContext<T>, cause: unknown);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/vite/dist/src/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { default as XML } from './xml';
|
|
2
|
-
export type { XMLElement, XMLRoot, Constructor } from './types';
|
|
3
|
-
export { defaults } from './defaults';
|
|
4
|
-
export { getModel, createModel, Model, Prop } from './model';
|
|
5
|
-
export * from './errors';
|
|
6
|
-
export * from 'typescript-rtti';
|
|
7
|
-
export { XML };
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type Middleware<C, T> = (context: C, next: () => T) => T;
|
|
2
|
-
interface ChainableOptions<C, T> {
|
|
3
|
-
parent: ChainableOptions<C, T> | null;
|
|
4
|
-
middlewares: Middleware<C, T>[];
|
|
5
|
-
}
|
|
6
|
-
export declare function MiddlewareChain<C, T>(options: ChainableOptions<C, T>): Generator<Middleware<C, T>, void, unknown>;
|
|
7
|
-
type MiddlewareChain<C, T> = Iterator<Middleware<C, T>>;
|
|
8
|
-
export declare function resolve<C, T>(middlewares: MiddlewareChain<C, T>, context: C): T;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Constructor } from 'typescript-rtti';
|
|
2
|
-
import { XMLModelOptions, XMLModelPropertyOptions, CreateXMLModelOptions } from './types';
|
|
3
|
-
import { XMLRoot } from '../types';
|
|
4
|
-
export declare function getParentModel(model: XMLModel<any>): XMLModel<any>;
|
|
5
|
-
export declare class XMLModel<T = any> {
|
|
6
|
-
readonly type: Constructor<T>;
|
|
7
|
-
options: XMLModelOptions<T>;
|
|
8
|
-
constructor(type: Constructor<T>, options: CreateXMLModelOptions<T>);
|
|
9
|
-
fromXML(xml: XMLRoot | string): T;
|
|
10
|
-
toXML(instance: unknown): XMLRoot;
|
|
11
|
-
get reflectedClass(): import('typescript-rtti').ReflectedClass<Constructor<T>>;
|
|
12
|
-
resolveAllProperties(): Map<string, XMLModelPropertyOptions<any> & {
|
|
13
|
-
model: any;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
export declare function createModel<T>(type: Constructor<T>, options: CreateXMLModelOptions<T>): XMLModel<T>;
|
|
17
|
-
declare function ModelDecoratorFactory<T>(options?: CreateXMLModelOptions<T>): (constructor: Constructor<T>) => void;
|
|
18
|
-
export { getModel } from './registry';
|
|
19
|
-
export { ModelDecoratorFactory as Model };
|
|
20
|
-
export { Prop } from './property';
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Constructor } from 'typescript-rtti';
|
|
2
|
-
import { XMLModelProperty, XMLModelPropertyOptions, CreateXMLModelPropertyOptions } from './types';
|
|
3
|
-
export declare function getPropertyConversionOptions<T>(constructor: Constructor<T>, property: XMLModelProperty<T>): XMLModelPropertyOptions<T>;
|
|
4
|
-
declare function PropDecoratorFactory<T = any>(options?: CreateXMLModelPropertyOptions<T>): (prototype: any, property: XMLModelProperty<T>) => void;
|
|
5
|
-
export { PropDecoratorFactory as Prop };
|
|
6
|
-
//# sourceMappingURL=property.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Constructor } from 'typescript-rtti';
|
|
2
|
-
import { XMLModel } from '.';
|
|
3
|
-
type ModelID<T> = Constructor<T>;
|
|
4
|
-
export declare const Models: Map<ModelID<unknown>, XMLModel<unknown>>;
|
|
5
|
-
export declare function registrerModel(model: XMLModel<unknown>): Map<ModelID<unknown>, XMLModel<unknown>>;
|
|
6
|
-
export declare function findModel<T>(id: ModelID<T>): XMLModel<T> | undefined;
|
|
7
|
-
export declare function getModel<T>(id: ModelID<T>): XMLModel<T>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ReflectedProperty } from 'typescript-rtti';
|
|
2
|
-
import { XMLRoot, XMLElement } from '../types';
|
|
3
|
-
import { Middleware } from '../middleware';
|
|
4
|
-
import { XMLModel } from './index';
|
|
5
|
-
export type XMLModelProperty<T> = Extract<keyof T, string>;
|
|
6
|
-
export type PropertiesRecord<T> = {
|
|
7
|
-
[key in keyof T]?: T[key];
|
|
8
|
-
};
|
|
9
|
-
export type XMLPropertiesRecord<T> = {
|
|
10
|
-
[key in keyof T]?: XMLRoot;
|
|
11
|
-
};
|
|
12
|
-
export interface PropertyToXMLContext<T> extends Omit<toXMLContext<T>, "properties"> {
|
|
13
|
-
property: XMLModelPropertyOptions<T>;
|
|
14
|
-
value: T[keyof T];
|
|
15
|
-
}
|
|
16
|
-
export interface PropertyFromXMLContext<T> extends Omit<fromXMLContext<T>, "properties"> {
|
|
17
|
-
property: XMLModelPropertyOptions<T>;
|
|
18
|
-
elements: XMLElement[];
|
|
19
|
-
}
|
|
20
|
-
export interface XMLModelPropertyOptions<T> {
|
|
21
|
-
name: keyof T;
|
|
22
|
-
reflected: ReflectedProperty;
|
|
23
|
-
tagname: string;
|
|
24
|
-
ignored: boolean;
|
|
25
|
-
inline: boolean;
|
|
26
|
-
model?: XMLModel<any>;
|
|
27
|
-
isSourceElement: (element: XMLElement, context: Omit<PropertyFromXMLContext<T>, "elements">) => boolean;
|
|
28
|
-
resolveElements: (context: Omit<PropertyFromXMLContext<T>, "elements">) => XMLElement[];
|
|
29
|
-
fromXML: (context: PropertyFromXMLContext<T>) => T[keyof T];
|
|
30
|
-
toXML: (context: PropertyToXMLContext<T>) => XMLRoot;
|
|
31
|
-
}
|
|
32
|
-
export interface CreateXMLModelPropertyOptions<T> {
|
|
33
|
-
tagname?: string;
|
|
34
|
-
sourceElements?: string | RegExp | XMLModelPropertyOptions<T>["isSourceElement"];
|
|
35
|
-
resolveElements?: XMLModelPropertyOptions<T>["resolveElements"];
|
|
36
|
-
toXML?: XMLModelPropertyOptions<T>["toXML"];
|
|
37
|
-
fromXML?: XMLModelPropertyOptions<T>["fromXML"];
|
|
38
|
-
inline?: boolean;
|
|
39
|
-
ignore?: boolean;
|
|
40
|
-
model?: XMLModelPropertyOptions<T>["model"];
|
|
41
|
-
}
|
|
42
|
-
interface ConversionOptions<C, T> {
|
|
43
|
-
parent: ConversionOptions<C, T> | null;
|
|
44
|
-
middlewares: Middleware<C, T>[];
|
|
45
|
-
}
|
|
46
|
-
export interface fromXMLContext<T> {
|
|
47
|
-
xml: XMLRoot;
|
|
48
|
-
properties: PropertiesRecord<T>;
|
|
49
|
-
model: XMLModel<T>;
|
|
50
|
-
}
|
|
51
|
-
export interface toXMLContext<T> {
|
|
52
|
-
object: T;
|
|
53
|
-
properties: XMLPropertiesRecord<T>;
|
|
54
|
-
model: XMLModel<T>;
|
|
55
|
-
}
|
|
56
|
-
export interface XMLModelOptions<T> {
|
|
57
|
-
parent?: XMLModel<T>;
|
|
58
|
-
properties: {
|
|
59
|
-
fromXML: ConversionOptions<Omit<fromXMLContext<T>, "properties">, PropertiesRecord<T>>;
|
|
60
|
-
toXML: ConversionOptions<Omit<toXMLContext<T>, "properties">, XMLPropertiesRecord<T>>;
|
|
61
|
-
options: Map<XMLModelProperty<T>, XMLModelPropertyOptions<T>>;
|
|
62
|
-
};
|
|
63
|
-
fromXML: ConversionOptions<fromXMLContext<T>, T>;
|
|
64
|
-
toXML: ConversionOptions<toXMLContext<T>, XMLRoot>;
|
|
65
|
-
tagname: string;
|
|
66
|
-
}
|
|
67
|
-
export interface CreateXMLModelOptions<T> {
|
|
68
|
-
parent?: XMLModelOptions<T>["parent"];
|
|
69
|
-
fromXML?: XMLModelOptions<T>["fromXML"]["middlewares"][number];
|
|
70
|
-
toXML?: XMLModelOptions<T>["toXML"]["middlewares"][number];
|
|
71
|
-
tagname?: XMLModelOptions<T>["tagname"];
|
|
72
|
-
}
|
|
73
|
-
export { XMLModel };
|
|
74
|
-
//# sourceMappingURL=types.d.ts.map
|
package/vite/dist/src/types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type { Constructor } from 'typescript-rtti';
|
|
2
|
-
export type UnknownRecord = Record<string | number | symbol, unknown>;
|
|
3
|
-
export type UnknownObject = object;
|
|
4
|
-
export interface XMLAttributes {
|
|
5
|
-
[key: string]: string | number | undefined;
|
|
6
|
-
}
|
|
7
|
-
export interface XMLElement {
|
|
8
|
-
type?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
attributes?: XMLAttributes;
|
|
11
|
-
elements?: Array<XMLElement>;
|
|
12
|
-
text?: string | number | boolean;
|
|
13
|
-
}
|
|
14
|
-
export type XMLRoot = {
|
|
15
|
-
elements: XMLElement[];
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stolen from https://github.com/sindresorhus/is-regexp/blob/main/index.js
|
|
3
|
-
*
|
|
4
|
-
* see https://github.com/sindresorhus/is#why-not-just-use-instanceof-instead-of-this-package
|
|
5
|
-
*
|
|
6
|
-
* could use `import { isRegExp } from "node:util/types"` but I want isomorphic lib
|
|
7
|
-
* @param value
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare function isRegExp(value: unknown): value is RegExp;
|
|
11
|
-
export default isRegExp;
|
|
12
|
-
//# sourceMappingURL=is-regexp.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transforms a string into kebab-case.
|
|
3
|
-
*
|
|
4
|
-
* stolen from https://github.com/joakimbeng/kebab-case/blob/master/index.js
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* kebabCase("helloWorld"); // "hello-world"
|
|
8
|
-
* kebabCase("HelloWorld"); // "-hello-world"
|
|
9
|
-
* kebabCase("HelloWorld", false); // "hello-world"
|
|
10
|
-
*
|
|
11
|
-
* @param str The string to transform
|
|
12
|
-
* @param keepLeadingDash Whether to keep the leading dash in case the string starts with an uppercase letter (default: true)
|
|
13
|
-
* @returns The kebab-cased string
|
|
14
|
-
*/
|
|
15
|
-
export declare function kebabCase(str: string, keepLeadingDash?: boolean): string;
|
|
16
|
-
//# sourceMappingURL=kebab-case.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { XMLElement, XMLRoot } from '../types';
|
|
2
|
-
export declare function parse(string: string): XMLRoot;
|
|
3
|
-
export declare const stringify: typeof import('xml-js').js2xml;
|
|
4
|
-
export declare function getContent(xml: XMLElement): string | number | boolean;
|
|
5
|
-
export declare function fromContent(content: string): {
|
|
6
|
-
elements: [{
|
|
7
|
-
type: "text";
|
|
8
|
-
text: string;
|
|
9
|
-
}] | [];
|
|
10
|
-
};
|
|
11
|
-
export declare function fromContent(content: string, tag: string, attributes?: XMLElement["attributes"]): {
|
|
12
|
-
type: "element";
|
|
13
|
-
name: string;
|
|
14
|
-
attributes?: XMLElement["attributes"];
|
|
15
|
-
elements: [{
|
|
16
|
-
type: "text";
|
|
17
|
-
text: string;
|
|
18
|
-
}] | [];
|
|
19
|
-
};
|
|
20
|
-
export declare function addElement(xml: XMLElement, element: XMLElement): void;
|
|
21
|
-
export declare function setAttribute(xml: XMLElement, attribute: string, value: string): void;
|
|
22
|
-
export declare function deleteAttribute(xml: XMLElement, attribute: string): void;
|
|
23
|
-
declare const XML: {
|
|
24
|
-
parse: typeof parse;
|
|
25
|
-
stringify: typeof import('xml-js').js2xml;
|
|
26
|
-
fromContent: typeof fromContent;
|
|
27
|
-
getContent: typeof getContent;
|
|
28
|
-
addElement: typeof addElement;
|
|
29
|
-
setAttribute: typeof setAttribute;
|
|
30
|
-
deleteAttribute: typeof deleteAttribute;
|
|
31
|
-
};
|
|
32
|
-
export default XML;
|
|
33
|
-
//# sourceMappingURL=index.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/forward-ref.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/literal-node.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/rt-helper.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/{vite/dist → dist/vite}/node_modules/typescript-rtti/dist.esm/transformer/serialize.js
RENAMED
|
File without changes
|