@gbti/ryker 0.2.2 → 0.2.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/README.md +1 -1
- package/bin/ryker.js +1 -1
- package/drop-in/dist/ryker.js +44 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ it.
|
|
|
78
78
|
Ryker requires Node.js 20 or newer for installation. The resulting HTML and
|
|
79
79
|
classic browser script work offline and from `file://` without Node.js.
|
|
80
80
|
|
|
81
|
-
This repository is at version `0.2.
|
|
81
|
+
This repository is at version `0.2.3`, and the npm `latest` tag serves it, so
|
|
82
82
|
every `npx` command above installs this code.
|
|
83
83
|
|
|
84
84
|
## Privacy
|
package/bin/ryker.js
CHANGED
|
@@ -4,7 +4,7 @@ import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync, writeF
|
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
|
-
const VERSION = '0.2.
|
|
7
|
+
const VERSION = '0.2.3';
|
|
8
8
|
const BEGIN = '<!-- ryker:begin -->';
|
|
9
9
|
const END = '<!-- ryker:end -->';
|
|
10
10
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
package/drop-in/dist/ryker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Ryker 0.2.
|
|
2
|
+
* Ryker 0.2.3
|
|
3
3
|
* A drop-in editing layer for authored HTML reports.
|
|
4
4
|
*
|
|
5
5
|
* Generated bundle. Do not edit. Sources, in load order:
|
|
6
6
|
* utils/dom.js (51 lines)
|
|
7
|
-
* config/config.js (
|
|
7
|
+
* config/config.js (157 lines)
|
|
8
8
|
* security/scan.js (86 lines)
|
|
9
9
|
* editor/sanitize.js (218 lines)
|
|
10
10
|
* editor/blocks.js (596 lines)
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* ui/rail.js (530 lines)
|
|
36
36
|
* instructions/steps.js (592 lines)
|
|
37
37
|
* instructions/moves.js (158 lines)
|
|
38
|
-
* instructions/instructions.js (
|
|
38
|
+
* instructions/instructions.js (517 lines)
|
|
39
39
|
* instructions/merge.js (405 lines)
|
|
40
40
|
* storage/fs.js (336 lines)
|
|
41
41
|
* storage/logger.js (433 lines)
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
(function () {
|
|
51
51
|
'use strict';
|
|
52
52
|
if (window.Ryker && window.Ryker.VERSION) return;
|
|
53
|
-
var Ryker = { VERSION: "0.2.
|
|
53
|
+
var Ryker = { VERSION: "0.2.3", BUILD: "Ryker", SURFACE: "drop-in" };
|
|
54
54
|
window.Ryker = Ryker;
|
|
55
55
|
|
|
56
56
|
/* ---- utils/dom.js ---------------------------------------------- */
|
|
@@ -205,16 +205,41 @@
|
|
|
205
205
|
? extensionDocumentId()
|
|
206
206
|
: slug(document.title || 'untitled');
|
|
207
207
|
}
|
|
208
|
-
if (!cfg.RYKER_DOCUMENT_PATH)
|
|
209
|
-
var last = location.pathname.split('/').pop();
|
|
210
|
-
cfg.RYKER_DOCUMENT_PATH = last ? decodeURIComponent(last) : 'report.html';
|
|
211
|
-
}
|
|
208
|
+
if (!cfg.RYKER_DOCUMENT_PATH) cfg.RYKER_DOCUMENT_PATH = documentPath();
|
|
212
209
|
|
|
213
210
|
cfg._leaked = leaked;
|
|
214
211
|
state = cfg;
|
|
215
212
|
return state;
|
|
216
213
|
}
|
|
217
214
|
|
|
215
|
+
/** The filename this document was loaded from, or null when there is not one.
|
|
216
|
+
*
|
|
217
|
+
* The drop-in is copied next to the file it edits, so the last path segment
|
|
218
|
+
* IS the filename and always has been. The extension is a different case: it
|
|
219
|
+
* runs on whatever page is open, and most pages are application routes with
|
|
220
|
+
* no file behind them. Reporting one anyway is not a cosmetic slip. The
|
|
221
|
+
* export header hands an agent a filename to apply edits to, so a LinkedIn
|
|
222
|
+
* post used to arrive as `File: "report.html"`, naming a file that does not
|
|
223
|
+
* exist, and a route like /app/dashboard used to arrive as
|
|
224
|
+
* `File: "dashboard"`, naming one that never did.
|
|
225
|
+
*
|
|
226
|
+
* Null here is honest rather than lossy: the download name falls back on its
|
|
227
|
+
* own in export/html.js, and instructions.js prints the page address instead
|
|
228
|
+
* of a filename when there is none. */
|
|
229
|
+
function documentPath() {
|
|
230
|
+
return pathFrom(location.pathname, Ryker.SURFACE);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Pure, so every URL shape can be checked without faking window.location. */
|
|
234
|
+
function pathFrom(pathname, surface) {
|
|
235
|
+
var last = String(pathname || '').split('/').pop();
|
|
236
|
+
last = last ? decodeURIComponent(last) : '';
|
|
237
|
+
if (surface !== 'extension') return last || 'report.html';
|
|
238
|
+
// A filename has an extension. Anything else is a route segment, and a
|
|
239
|
+
// route segment is not a file no matter how much it looks like a word.
|
|
240
|
+
return /\.[a-z0-9]{1,8}$/i.test(last) ? last : null;
|
|
241
|
+
}
|
|
242
|
+
|
|
218
243
|
function slug(s) {
|
|
219
244
|
return String(s).toLowerCase().replace(/[^a-z0-9]+/g, '-')
|
|
220
245
|
.replace(/^-+|-+$/g, '').slice(0, 80) || 'untitled';
|
|
@@ -235,7 +260,8 @@
|
|
|
235
260
|
|
|
236
261
|
function isMarkdown() { return format() === 'markdown'; }
|
|
237
262
|
|
|
238
|
-
return { load: load, slug: slug, format: format, isMarkdown: isMarkdown
|
|
263
|
+
return { load: load, slug: slug, format: format, isMarkdown: isMarkdown,
|
|
264
|
+
pathFrom: pathFrom };
|
|
239
265
|
})();
|
|
240
266
|
|
|
241
267
|
|
|
@@ -8444,7 +8470,15 @@
|
|
|
8444
8470
|
out.push('# Document edit instructions');
|
|
8445
8471
|
out.push('');
|
|
8446
8472
|
out.push('Document: ' + quoted(document.title || cfg.RYKER_DOCUMENT_ID));
|
|
8447
|
-
|
|
8473
|
+
// A filename when there is one, the page address when there is not. The
|
|
8474
|
+
// query string and fragment are dropped: they routinely carry signed-preview
|
|
8475
|
+
// and SSO secrets, and this header gets copied into a prompt.
|
|
8476
|
+
if (cfg.RYKER_DOCUMENT_PATH) {
|
|
8477
|
+
out.push('File: ' + quoted(cfg.RYKER_DOCUMENT_PATH));
|
|
8478
|
+
} else {
|
|
8479
|
+
out.push('Page: ' + quoted(String(location.origin || '') +
|
|
8480
|
+
String(location.pathname || '/')));
|
|
8481
|
+
}
|
|
8448
8482
|
out.push('Edits: ' + list.length + ' change(s)' +
|
|
8449
8483
|
(mv.length ? ' and ' + mv.length + ' move(s)' : '') +
|
|
8450
8484
|
' across ' + saves + ' save(s) this session');
|