@patch-adams/core 1.4.14 → 1.4.15
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/cli.cjs +2 -58
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -58
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +2 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +2 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var url = require('url');
|
|
|
7
7
|
var AdmZip = require('adm-zip');
|
|
8
8
|
var archiver = require('archiver');
|
|
9
9
|
var stream = require('stream');
|
|
10
|
-
var fastXmlParser = require('fast-xml-parser');
|
|
11
10
|
var crypto = require('crypto');
|
|
12
11
|
var chalk = require('chalk');
|
|
13
12
|
|
|
@@ -4711,26 +4710,12 @@ ${loader}`);
|
|
|
4711
4710
|
</body>`);
|
|
4712
4711
|
}
|
|
4713
4712
|
};
|
|
4713
|
+
|
|
4714
|
+
// src/patcher/manifest-updater.ts
|
|
4714
4715
|
var ManifestUpdater = class {
|
|
4715
4716
|
config;
|
|
4716
|
-
parser;
|
|
4717
|
-
builder;
|
|
4718
4717
|
constructor(config) {
|
|
4719
4718
|
this.config = config;
|
|
4720
|
-
this.parser = new fastXmlParser.XMLParser({
|
|
4721
|
-
ignoreAttributes: false,
|
|
4722
|
-
attributeNamePrefix: "@_",
|
|
4723
|
-
preserveOrder: false,
|
|
4724
|
-
parseAttributeValue: false,
|
|
4725
|
-
trimValues: true
|
|
4726
|
-
});
|
|
4727
|
-
this.builder = new fastXmlParser.XMLBuilder({
|
|
4728
|
-
ignoreAttributes: false,
|
|
4729
|
-
attributeNamePrefix: "@_",
|
|
4730
|
-
format: true,
|
|
4731
|
-
indentBy: " ",
|
|
4732
|
-
suppressEmptyNode: true
|
|
4733
|
-
});
|
|
4734
4719
|
}
|
|
4735
4720
|
/**
|
|
4736
4721
|
* Update manifest files based on package format
|
|
@@ -4797,47 +4782,6 @@ $1</resource>`
|
|
|
4797
4782
|
return [];
|
|
4798
4783
|
}
|
|
4799
4784
|
}
|
|
4800
|
-
/**
|
|
4801
|
-
* Extract XML declaration from original content
|
|
4802
|
-
*/
|
|
4803
|
-
extractXmlDeclaration(xml) {
|
|
4804
|
-
const match = xml.match(/<\?xml[^?]*\?>/);
|
|
4805
|
-
return match ? match[0] + "\n" : '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
4806
|
-
}
|
|
4807
|
-
/**
|
|
4808
|
-
* Add file entries to the manifest
|
|
4809
|
-
*/
|
|
4810
|
-
addFilesToManifest(parsed, paths) {
|
|
4811
|
-
const manifest = parsed.manifest;
|
|
4812
|
-
if (!manifest) return;
|
|
4813
|
-
const resources = manifest.resources;
|
|
4814
|
-
if (!resources) return;
|
|
4815
|
-
let resource = resources.resource;
|
|
4816
|
-
if (!resource) return;
|
|
4817
|
-
if (Array.isArray(resource)) {
|
|
4818
|
-
resource = resource[0];
|
|
4819
|
-
}
|
|
4820
|
-
if (!resource.file) {
|
|
4821
|
-
resource.file = [];
|
|
4822
|
-
}
|
|
4823
|
-
let files = resource.file;
|
|
4824
|
-
if (!Array.isArray(files)) {
|
|
4825
|
-
files = [files];
|
|
4826
|
-
resource.file = files;
|
|
4827
|
-
}
|
|
4828
|
-
const filesToAdd = [
|
|
4829
|
-
paths.cssBefore,
|
|
4830
|
-
paths.cssAfter,
|
|
4831
|
-
paths.jsBefore,
|
|
4832
|
-
paths.jsAfter
|
|
4833
|
-
].filter(Boolean);
|
|
4834
|
-
for (const filePath of filesToAdd) {
|
|
4835
|
-
const exists = files.some((f) => f["@_href"] === filePath);
|
|
4836
|
-
if (!exists) {
|
|
4837
|
-
files.push({ "@_href": filePath });
|
|
4838
|
-
}
|
|
4839
|
-
}
|
|
4840
|
-
}
|
|
4841
4785
|
/**
|
|
4842
4786
|
* Get the file paths that will be added to the package
|
|
4843
4787
|
*/
|