@patch-adams/core 1.4.14 → 1.4.16
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 +7 -59
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7 -59
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +7 -59
- 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 +7 -59
- 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
|
|
|
@@ -4205,7 +4204,11 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
4205
4204
|
trackQuizzes: lrsBridgeConfig.trackQuizzes ?? true,
|
|
4206
4205
|
trackInteractions: lrsBridgeConfig.trackInteractions ?? true,
|
|
4207
4206
|
customStatements: lrsBridgeConfig.customStatements ?? true,
|
|
4208
|
-
debug: lrsBridgeConfig.debug ?? false
|
|
4207
|
+
debug: lrsBridgeConfig.debug ?? false,
|
|
4208
|
+
lrsEndpoint: lrsBridgeConfig.lrsEndpoint,
|
|
4209
|
+
lrsWithCredentials: lrsBridgeConfig.lrsWithCredentials,
|
|
4210
|
+
courseHomepage: lrsBridgeConfig.courseHomepage,
|
|
4211
|
+
autoDetectLrs: lrsBridgeConfig.autoDetectLrs
|
|
4209
4212
|
};
|
|
4210
4213
|
return {
|
|
4211
4214
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|
|
@@ -4711,26 +4714,12 @@ ${loader}`);
|
|
|
4711
4714
|
</body>`);
|
|
4712
4715
|
}
|
|
4713
4716
|
};
|
|
4717
|
+
|
|
4718
|
+
// src/patcher/manifest-updater.ts
|
|
4714
4719
|
var ManifestUpdater = class {
|
|
4715
4720
|
config;
|
|
4716
|
-
parser;
|
|
4717
|
-
builder;
|
|
4718
4721
|
constructor(config) {
|
|
4719
4722
|
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
4723
|
}
|
|
4735
4724
|
/**
|
|
4736
4725
|
* Update manifest files based on package format
|
|
@@ -4797,47 +4786,6 @@ $1</resource>`
|
|
|
4797
4786
|
return [];
|
|
4798
4787
|
}
|
|
4799
4788
|
}
|
|
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
4789
|
/**
|
|
4842
4790
|
* Get the file paths that will be added to the package
|
|
4843
4791
|
*/
|