@mark1russell7/site-pages 0.1.7 → 0.1.9

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 CHANGED
@@ -66,9 +66,10 @@ A view fails for each of these problems:
66
66
  - The page shows no text.
67
67
  - The page writes a console error, or a script throws an exception.
68
68
  - A request to the site fails, or gets a status of 400 or more.
69
+ - A script or a style sheet does not load, from any origin. An example is a module script that imports `node:perf_hooks`.
69
70
  - A check of the probe fails, or the probe makes no check.
70
71
 
71
- The probe is a JavaScript file. Its code is the body of an async function. These functions are available:
72
+ The probe is a JavaScript file or a TypeScript file (`.ts`, `.mts` or `.cts`). Its code is the body of an async function. These functions are available:
72
73
 
73
74
  | Function | Operation |
74
75
  | --- | --- |
@@ -82,6 +83,8 @@ type("#editor", "Utilize the cache.");
82
83
  check("the linter finds a word", await until(() => $$(".finding").length === 1), $$(".finding").length);
83
84
  ```
84
85
 
86
+ For a TypeScript probe, the check removes the types and the line `export {};` before it runs the probe. Thus the typecheck of the site examines the probe, and the site needs no build step for it. Each line stays at its position, so the line of an error is the line of the source. Declare the functions of the table with `declare const`, and add `export {};` at the end, so the file is a module. `probeScript` does the same operation for a script of your own.
87
+
85
88
  The check runs the probe on the first page, in the first scheme, at each width. The folder of `--shots` gets a screenshot of each view, `report.json` and `summary.md`. The exit code is 0 when each view passes, 1 when a view fails, and 2 for an incorrect command line.
86
89
 
87
90
  The check finds a browser in this order: `--browser`, `$SITE_CHECK_BROWSER`, the newest Chromium of Playwright, and then Chrome or Edge. The folder `src/check` imports only Node.js. Thus Node.js 22.18 or later can start `src/check/main.ts` with no install. The workflow `reusable-pages.yml` of the template uses it this way.
@@ -269,6 +272,31 @@ The variables are `--sp-bg`, `--sp-surface`, `--sp-sunken`, `--sp-fg`, `--sp-fg-
269
272
 
270
273
  The pages operate at a width of 390 px without horizontal scroll. The timeline scrolls in its own box. The keyboard operates all controls: the arrow keys, Home and End move between the versions, and Enter or Space selects one. Without JavaScript, the releases page shows all versions.
271
274
 
275
+ ## A cue on a box that scrolls
276
+
277
+ A wide code block or table on a narrow screen scrolls sideways. Without a cue, its text looks cut. The file `scroll-cue.css` of the package gives a cue:
278
+
279
+ - A shade shows at each edge that has more content. At an end of the box, the shade of that end goes.
280
+ - The cue uses only CSS. It needs no JavaScript.
281
+
282
+ Import the file in the site, and give the class `scroll-cue` to the box:
283
+
284
+ ```ts
285
+ import "@mark1russell7/site-pages/scroll-cue.css";
286
+ ```
287
+
288
+ ```html
289
+ <pre class="scroll-cue">pnpm add @mark1russell7/site-pages</pre>
290
+ ```
291
+
292
+ The class sets `overflow-x: auto` and the background color of the box. Set `--scroll-cue-bg` to the background color of the box, and `--scroll-cue-shade` to the color of the shade:
293
+
294
+ ```css
295
+ .code {
296
+ --scroll-cue-bg: var(--code-bg);
297
+ }
298
+ ```
299
+
272
300
  ## A GitHub Pages workflow
273
301
 
274
302
  This workflow builds the site, adds the two pages, and deploys. It also starts every 3 hours, so the status page stays current without a push. A scheduled run builds the newest commit of `main` that passed CI.
@@ -1,3 +1,4 @@
1
+ import { stripTypeScriptTypes } from "node:module";
1
2
  import { execFileSync } from "node:child_process";
2
3
  import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
3
4
  import { basename, dirname, isAbsolute, join, posix, resolve } from "node:path";
@@ -2336,6 +2337,21 @@ function renderStatusPage(data, options) {
2336
2337
  script: STATUS_SCRIPT
2337
2338
  }, options);
2338
2339
  }
2340
+ // src/check/probe.ts
2341
+ /**
2342
+ * The probe of `site-pages check` in TypeScript. A probe source can be TypeScript, so the typecheck of the site examines it.
2343
+ * The check removes its types before it runs the probe, so a site needs no build step for its probe.
2344
+ */
2345
+ /** A probe file in TypeScript: `.ts`, `.mts` or `.cts`. */
2346
+ const TYPESCRIPT_PROBE = /\.[cm]?ts$/i;
2347
+ /**
2348
+ * This function gives the JavaScript of a probe in TypeScript. It removes the types, and the line `export {};` that makes the
2349
+ * file a module for the typecheck. Each line stays at its position, so the line of an error is the line of the source. Syntax
2350
+ * that is not only types (an `enum`, a `namespace`) causes an error.
2351
+ */
2352
+ function probeScript(source) {
2353
+ return stripTypeScriptTypes(source, { mode: "strip" }).replace(/^export \{\s*\};?[ \t]*$/m, "");
2354
+ }
2339
2355
  // src/build.ts
2340
2356
  /**
2341
2357
  * The `site-pages build` command. It reads the sources. Then it writes the JSON data and the two
@@ -2532,6 +2548,6 @@ async function runCli(argv, io) {
2532
2548
  throw error;
2533
2549
  }
2534
2550
  }
2535
- export { npmPublishTimes as $, RoadmapParseError as A, statusClassOf as B, longDate as C, inlineMarkdown as D, escapeHtml as E, parseRoadmap as F, readReleases as G, ReleaseDataError as H, plainText as I, headCommit as J, globFiles as K, readStatusBoard as L, buildStatusBoard as M, linksOf as N, safeUrl as O, markdownTables as P, NPM_REGISTRY as Q, roadmapItems as R, dayRange as S, utcDay as T, mergeReleases as U, DEFAULT_CHANGELOGS as V, readChangelogs as W, isShallow as X, headingDate as Y, originRepository as Z, oldestFirst as _, runCli as a, firstSentence as at, BASE_CSS as b, openGroups as c, releaseBodyEntries as ct, slugOf as d, parseVersion as dt, GITHUB_API as et, statusLead as f, versionOfTag as ft, laneCenter as g, renderReleasesPage as h, parseBuildArgs as i, githubReleases as it, STATUS_CLASSES as j, OPEN_CLASSES as k, renderStatusPage as l, compareVersions as lt, releasesLead as m, UsageError as n, checkStateOf as nt, STATUS_SCRIPT as o, headingAnchor as ot, RELEASES_SCRIPT as p, gitTagDates as q, build as r, githubOpenWork as rt, classCounts as s, parseChangelog as st, HELP as t, GITHUB_GRAPHQL as tt, sectionsOf as u, kindOf as ut, releaseSummary as v, shortDate as w, pageShell as x, timelineLayout as y, splitRow as z };
2551
+ export { originRepository as $, safeUrl as A, roadmapItems as B, pageShell as C, utcDay as D, shortDate as E, linksOf as F, mergeReleases as G, statusClassOf as H, markdownTables as I, globFiles as J, readChangelogs as K, parseRoadmap as L, RoadmapParseError as M, STATUS_CLASSES as N, escapeHtml as O, buildStatusBoard as P, isShallow as Q, plainText as R, BASE_CSS as S, longDate as T, DEFAULT_CHANGELOGS as U, splitRow as V, ReleaseDataError as W, headCommit as X, gitTagDates as Y, headingDate as Z, renderReleasesPage as _, runCli as a, githubOpenWork as at, releaseSummary as b, STATUS_SCRIPT as c, headingAnchor as ct, renderStatusPage as d, compareVersions as dt, NPM_REGISTRY as et, sectionsOf as f, kindOf as ft, releasesLead as g, RELEASES_SCRIPT as h, parseBuildArgs as i, checkStateOf as it, OPEN_CLASSES as j, inlineMarkdown as k, classCounts as l, parseChangelog as lt, statusLead as m, versionOfTag as mt, UsageError as n, GITHUB_API as nt, TYPESCRIPT_PROBE as o, githubReleases as ot, slugOf as p, parseVersion as pt, readReleases as q, build as r, GITHUB_GRAPHQL as rt, probeScript as s, firstSentence as st, HELP as t, npmPublishTimes as tt, openGroups as u, releaseBodyEntries as ut, laneCenter as v, dayRange as w, timelineLayout as x, oldestFirst as y, readStatusBoard as z };
2536
2552
 
2537
- //# sourceMappingURL=build-CD2wc7Yl.js.map
2553
+ //# sourceMappingURL=build-xJqNIzdO.js.map