single-file-core 1.5.16 → 1.5.17

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.
@@ -16953,7 +16953,9 @@ async function evalTemplate(template = "", options, content, doc, context = {})
16953
16953
  "bookmark-pathname-flat": { getter: () => bookmarkFolder, dontReplaceSlash: false },
16954
16954
  "profile-name": { getter: () => options.profileName },
16955
16955
  "filename-extension": { getter: () => getFilenameExtension(options) },
16956
- "save-action": { getter: () => options.selected ? "selection" : "page" }
16956
+ "save-action": { getter: () => options.selected ? "selection" : "page" },
16957
+ "options-json": { getter: () => JSON.stringify(getFilteredOptions(options)) },
16958
+ "options-text": { getter: () => optionsToText(getFilteredOptions(options)) }
16957
16959
  };
16958
16960
  if (content) {
16959
16961
  variables["digest-sha-256"] = { getter: async () => digest("SHA-256", content) };
@@ -17050,6 +17052,14 @@ async function evalTemplate(template = "", options, content, doc, context = {})
17050
17052
  options[name] = value;
17051
17053
  }
17052
17054
  }
17055
+ },
17056
+ "option-value": key => {
17057
+ const filteredValue = getFilteredOptions(options)[key];
17058
+ if (filteredValue === undefined || filteredValue === null) {
17059
+ return "";
17060
+ } else {
17061
+ return JSON.stringify(filteredValue);
17062
+ }
17053
17063
  }
17054
17064
  };
17055
17065
  functions["date-locale"].dontReplaceSlash = true;
@@ -17251,4 +17261,52 @@ function getFilenameExtension(options) {
17251
17261
  } else {
17252
17262
  return "html";
17253
17263
  }
17264
+ }
17265
+
17266
+ function getFilteredOptions(options) {
17267
+ const filteredOptions = Object.assign({}, options);
17268
+ delete filteredOptions.content;
17269
+ delete filteredOptions.usedFonts;
17270
+ delete filteredOptions.extensionScriptFiles;
17271
+ delete filteredOptions.taskId;
17272
+ delete filteredOptions.updatedResources;
17273
+ delete filteredOptions.visitDate;
17274
+ delete filteredOptions.keepFilename;
17275
+ delete filteredOptions.insertCanonicalLink;
17276
+ delete filteredOptions.frames;
17277
+ delete filteredOptions.win;
17278
+ delete filteredOptions.doc;
17279
+ delete filteredOptions.url;
17280
+ delete filteredOptions.resourceReferrer;
17281
+ delete filteredOptions.baseURI;
17282
+ delete filteredOptions.rootDocument;
17283
+ delete filteredOptions.fontTests;
17284
+ delete filteredOptions.canvases;
17285
+ delete filteredOptions.fonts;
17286
+ delete filteredOptions.worklets;
17287
+ delete filteredOptions.stylesheets;
17288
+ delete filteredOptions.images;
17289
+ delete filteredOptions.posters;
17290
+ delete filteredOptions.videos;
17291
+ delete filteredOptions.shadowRoots;
17292
+ delete filteredOptions.referrer;
17293
+ delete filteredOptions.adoptedStyleSheets;
17294
+ delete filteredOptions.tabId;
17295
+ delete filteredOptions.tabIndex;
17296
+ delete filteredOptions.saveDate;
17297
+ delete filteredOptions.saveUrl;
17298
+ delete filteredOptions.title;
17299
+ delete filteredOptions.info;
17300
+ return filteredOptions;
17301
+ }
17302
+
17303
+ function optionsToText(options) {
17304
+ const csv = [];
17305
+ for (const key in options) {
17306
+ const value = options[key];
17307
+ if (typeof value != "function" && value !== undefined && value !== null && value !== "") {
17308
+ csv.push(key + ": " + JSON.stringify(value));
17309
+ }
17310
+ }
17311
+ return csv.join("\n");
17254
17312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.16",
3
+ "version": "1.5.17",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",