xml-disassembler 1.6.0 → 1.8.0
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/CHANGELOG.md +14 -0
- package/README.md +56 -68
- package/disassemble.log +294 -179
- package/dist/index.cjs +139 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.min.umd.js +1 -1
- package/dist/index.min.umd.js.map +1 -1
- package/dist/index.mjs +145 -14
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +142 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/typings/builders/strategies/grouped-by-tag/buildDisassembledFiles.d.ts +1 -0
- package/dist/typings/builders/strategies/grouped-by-tag/buildGroupNestedFile.d.ts +2 -0
- package/dist/typings/handlers/disassembleXMLFileHandler.d.ts +2 -0
- package/dist/typings/parsers/strategies/grouped-by-tag/parseElement.d.ts +7 -0
- package/dist/typings/transformers/transformers.d.ts +1 -0
- package/dist/typings/types/types.d.ts +1 -1
- package/package.json +6 -2
- /package/dist/typings/builders/{buildDisassembledFiles.d.ts → strategies/uid/buildDisassembledFiles.d.ts} +0 -0
- /package/dist/typings/builders/{buildNestedFiles.d.ts → strategies/uid/buildNestedFiles.d.ts} +0 -0
- /package/dist/typings/parsers/{parseElement.d.ts → strategies/uid/parseElement.d.ts} +0 -0
- /package/dist/typings/parsers/{parseUniqueIdElements.d.ts → strategies/uid/parseUniqueIdElements.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## [1.8.0](https://github.com/mcarvin8/xml-disassembler/compare/v1.7.0...v1.8.0) (2025-04-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add new disassemble strategy ([9f65e31](https://github.com/mcarvin8/xml-disassembler/commit/9f65e319dcd78f4bcb5505f941bbe1358c557740))
|
|
14
|
+
|
|
15
|
+
## [1.7.0](https://github.com/mcarvin8/xml-disassembler/compare/v1.6.0...v1.7.0) (2025-04-12)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add ini as a disassembled format ([de91154](https://github.com/mcarvin8/xml-disassembler/commit/de9115481b3b19e53e5e72339082e63cbd83e337))
|
|
21
|
+
|
|
8
22
|
## [1.6.0](https://github.com/mcarvin8/xml-disassembler/compare/v1.5.1...v1.6.0) (2025-04-12)
|
|
9
23
|
|
|
10
24
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/xml-disassembler) [](https://npmjs.org/package/xml-disassembler)
|
|
4
4
|
|
|
5
|
-
Disassemble XML files into smaller, more manageable files (XML/JSON/JSON5/TOML/YAML) and reassemble the XML when needed.
|
|
5
|
+
Disassemble XML files into smaller, more manageable files (XML/INI/JSON/JSON5/TOML/YAML) and reassemble the XML when needed.
|
|
6
6
|
|
|
7
7
|
This tool simplifies version control, improves diff readability, and streamlines collaboration when dealing with large XML files.
|
|
8
8
|
|
|
@@ -12,12 +12,12 @@ This tool simplifies version control, improves diff readability, and streamlines
|
|
|
12
12
|
|
|
13
13
|
- **Disassemble XML Files** – Break down XML files into structured directories.
|
|
14
14
|
- **Reassemble XML Files** – Recreate the original XML structure from disassembled parts.
|
|
15
|
-
> **NOTE**: The `xml-disassembler` aims to reassemble the original XML 100% element-wise, however, the element sorting will vary. The reassembler will sort elements based on how they are sorted in the disassembled directories.
|
|
15
|
+
> **NOTE**: The `xml-disassembler` aims to reassemble the original XML 100% element-wise, however, the element sorting will vary. The reassembler will sort elements based on how they are sorted in the disassembled directories. "toml" format sorting varies compared to the other formats.
|
|
16
16
|
- **Unique Identifiers** – Use specific XML elements as file names or fallback to SHA-256 hashes.
|
|
17
17
|
- **Ignore Files** – Specify XML files to exclude from disassembly.
|
|
18
18
|
- **Logging** – Enable detailed debugging logs.
|
|
19
19
|
- **Integrations** – Works with tools like Salesforce CLI
|
|
20
|
-
- **Multiple Formats** - The disassembled file format can be XML, JSON, JSON5, TOML, or YAML based on preference. The reassembler will reassemble the original XML structure from these formats.
|
|
20
|
+
- **Multiple Formats** - The disassembled file format can be XML, INI, JSON, JSON5, TOML, or YAML based on preference. The reassembler will reassemble the original XML structure from these formats.
|
|
21
21
|
|
|
22
22
|
<!-- TABLE OF CONTENTS -->
|
|
23
23
|
<details>
|
|
@@ -26,8 +26,8 @@ This tool simplifies version control, improves diff readability, and streamlines
|
|
|
26
26
|
- [Background](#background)
|
|
27
27
|
- [Install](#install)
|
|
28
28
|
- [Disassembling Files](#disassembling-files)
|
|
29
|
+
- [Disassembly Strategies](#disassembly-strategies)
|
|
29
30
|
- [Reassembling Files](#reassembling-files)
|
|
30
|
-
- [Example](#example)
|
|
31
31
|
- [Use Case](#use-case)
|
|
32
32
|
- [Ignore File](#ignore-file)
|
|
33
33
|
- [XML Parser](#xml-parser)
|
|
@@ -53,7 +53,7 @@ npm install xml-disassembler
|
|
|
53
53
|
|
|
54
54
|
## Disassembling Files
|
|
55
55
|
|
|
56
|
-
Disassemble a single XML file or multiple XML files within a directory into smaller files (XML/JSON/JSON5/TOML/YAML).
|
|
56
|
+
Disassemble a single XML file or multiple XML files within a directory into smaller files (XML/INI/JSON/JSON5/TOML/YAML).
|
|
57
57
|
|
|
58
58
|
```typescript
|
|
59
59
|
/*
|
|
@@ -65,8 +65,10 @@ FLAGS
|
|
|
65
65
|
- postPurge: Delete the XML file after disassembling it.
|
|
66
66
|
|
|
67
67
|
- ignorePath: Path to an XML disassembly ignore file.
|
|
68
|
-
- format: File format for the disassembled files ("xml", "json", "json5", "toml", "yaml")
|
|
68
|
+
- format: File format for the disassembled files ("xml", "ini", "json", "json5", "toml", "yaml")
|
|
69
69
|
Defaults to "xml" if the format isn't supported or provided.
|
|
70
|
+
- strategy: Disassemble strategy ("unique-id" or "grouped-by-tag")
|
|
71
|
+
Defaults to "unique-id" if strategy isn't supported or provided.
|
|
70
72
|
*/
|
|
71
73
|
import { DisassembleXMLFileHandler } from "xml-disassembler";
|
|
72
74
|
|
|
@@ -79,12 +81,59 @@ await handler.disassemble({
|
|
|
79
81
|
postPurge: true,
|
|
80
82
|
ignorePath: ".xmldisassemblerignore",
|
|
81
83
|
format: "json",
|
|
84
|
+
strategy: "unique-id",
|
|
82
85
|
});
|
|
83
86
|
```
|
|
84
87
|
|
|
88
|
+
## Disassembly Strategies
|
|
89
|
+
|
|
90
|
+
`xml-disassembler` supports two disassembly strategies to suit different use cases for nested elements. You can choose a strategy by setting the strategy option when calling disassemble().
|
|
91
|
+
|
|
92
|
+
🔹 unique-id (default)
|
|
93
|
+
|
|
94
|
+
> This is the strategy all previous versions of the `xml-disassembler` follow.
|
|
95
|
+
|
|
96
|
+
Disassembles each nested element into its own file under sub-directories.
|
|
97
|
+
|
|
98
|
+
File names are generated using one or more unique identifier elements (uniqueIdElements) or fallback to a SHA-256 hash.
|
|
99
|
+
|
|
100
|
+
Leaf elements remain grouped in a file named after the original XML.
|
|
101
|
+
|
|
102
|
+
Best for maximum diff granularity and precision in version control.
|
|
103
|
+
|
|
104
|
+
**Disassembled Directory Samples for Unique IDs**
|
|
105
|
+
|
|
106
|
+
| Format | Unique ID Elements | SHA-256 Hashes |
|
|
107
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| **XML** | <br> | <br> |
|
|
109
|
+
| **YAML** | <br> | <br> |
|
|
110
|
+
| **JSON** | <br> | <br> |
|
|
111
|
+
| **JSON5** | <br> | <br> |
|
|
112
|
+
| **TOML** | <br> | <br> |
|
|
113
|
+
| **INI** | <br> | <br> |
|
|
114
|
+
|
|
115
|
+
🔸 grouped-by-tag
|
|
116
|
+
|
|
117
|
+
Groups all nested elements by tag name into a single file (e.g., all `<fieldPermissions>` into `fieldPermissions.xml`).
|
|
118
|
+
|
|
119
|
+
Leaf elements remain grouped in a file named after the original XML.
|
|
120
|
+
|
|
121
|
+
Useful for simplifying diff views and reducing file count in large projects.
|
|
122
|
+
|
|
123
|
+
**Disassembled Directory Samples for Grouped by Tag**
|
|
124
|
+
|
|
125
|
+
| Format | Unique ID Elements |
|
|
126
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| **XML** | <br> |
|
|
128
|
+
| **YAML** | <br> |
|
|
129
|
+
| **JSON** | <br> |
|
|
130
|
+
| **JSON5** | <br> |
|
|
131
|
+
| **TOML** | <br> |
|
|
132
|
+
| **INI** | <br> |
|
|
133
|
+
|
|
85
134
|
## Reassembling Files
|
|
86
135
|
|
|
87
|
-
Reassemble a directory of disassembled files (XML/JSON/JSON5/TOML/YAML) into a single XML file.
|
|
136
|
+
Reassemble a directory of disassembled files (XML/INI/JSON/JSON5/TOML/YAML) into a single XML file.
|
|
88
137
|
|
|
89
138
|
```typescript
|
|
90
139
|
/*
|
|
@@ -104,67 +153,6 @@ await handler.reassemble({
|
|
|
104
153
|
});
|
|
105
154
|
```
|
|
106
155
|
|
|
107
|
-
## Example
|
|
108
|
-
|
|
109
|
-
**Input XML file (`HR_Admin.permissionset-meta.xml`)**
|
|
110
|
-
|
|
111
|
-
```xml
|
|
112
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
113
|
-
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
114
|
-
<applicationVisibilities>
|
|
115
|
-
<application>JobApps__Recruiting</application>
|
|
116
|
-
<visible>true</visible>
|
|
117
|
-
</applicationVisibilities>
|
|
118
|
-
<classAccesses>
|
|
119
|
-
<apexClass>Send_Email_Confirmation</apexClass>
|
|
120
|
-
<enabled>true</enabled>
|
|
121
|
-
</classAccesses>
|
|
122
|
-
<fieldPermissions>
|
|
123
|
-
<editable>true</editable>
|
|
124
|
-
<field>Job_Request__c.Salary__c</field>
|
|
125
|
-
<readable>true</readable>
|
|
126
|
-
</fieldPermissions>
|
|
127
|
-
<description>Grants all rights needed for an HR administrator to manage employees.</description>
|
|
128
|
-
<label>HR Administration</label>
|
|
129
|
-
<userLicense>Salesforce</userLicense>
|
|
130
|
-
<objectPermissions>
|
|
131
|
-
<allowCreate>true</allowCreate>
|
|
132
|
-
<allowDelete>true</allowDelete>
|
|
133
|
-
<allowEdit>true</allowEdit>
|
|
134
|
-
<allowRead>true</allowRead>
|
|
135
|
-
<viewAllRecords>true</viewAllRecords>
|
|
136
|
-
<modifyAllRecords>true</modifyAllRecords>
|
|
137
|
-
<object>Job_Request__c</object>
|
|
138
|
-
</objectPermissions>
|
|
139
|
-
<pageAccesses>
|
|
140
|
-
<apexPage>Job_Request_Web_Form</apexPage>
|
|
141
|
-
<enabled>true</enabled>
|
|
142
|
-
</pageAccesses>
|
|
143
|
-
<recordTypeVisibilities>
|
|
144
|
-
<recordType>Recruiting.DevManager</recordType>
|
|
145
|
-
<visible>true</visible>
|
|
146
|
-
</recordTypeVisibilities>
|
|
147
|
-
<tabSettings>
|
|
148
|
-
<tab>Job_Request__c</tab>
|
|
149
|
-
<visibility>Available</visibility>
|
|
150
|
-
</tabSettings>
|
|
151
|
-
<userPermissions>
|
|
152
|
-
<enabled>true</enabled>
|
|
153
|
-
<name>APIEnabled</name>
|
|
154
|
-
</userPermissions>
|
|
155
|
-
</PermissionSet>
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Disassembled Directory Samples**
|
|
159
|
-
|
|
160
|
-
| Format | Unique ID Elements | SHA-256 Hashes |
|
|
161
|
-
| --------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
162
|
-
| **XML** | <br> | <br> |
|
|
163
|
-
| **YAML** | <br> | <br> |
|
|
164
|
-
| **JSON** | <br> | <br> |
|
|
165
|
-
| **JSON5** | <br> | <br> |
|
|
166
|
-
| **TOML** | <br> | <br> |
|
|
167
|
-
|
|
168
156
|
## Use Case
|
|
169
157
|
|
|
170
158
|
See [`sf-decomposer`](https://github.com/mcarvin8/sf-decomposer) for a Salesforce CLI use case:
|