@pretextbook/pretext-html 0.1.1 → 0.2.0
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 +62 -1
- package/assets/preview-html.xsl +0 -0
- package/assets/upstream.json +0 -0
- package/assets/xsl/README.md +0 -0
- package/assets/xsl/entities.ent +0 -0
- package/assets/xsl/extract-asymptote.xsl +0 -0
- package/assets/xsl/extract-biblio-csl.xsl +0 -0
- package/assets/xsl/extract-datafile.xsl +0 -0
- package/assets/xsl/extract-dynamic.xsl +0 -0
- package/assets/xsl/extract-identity.xsl +0 -0
- package/assets/xsl/extract-interactive.xsl +0 -0
- package/assets/xsl/extract-latex-image.xsl +0 -0
- package/assets/xsl/extract-mermaid.xsl +0 -0
- package/assets/xsl/extract-mom.xsl +0 -0
- package/assets/xsl/extract-pg.xsl +0 -0
- package/assets/xsl/extract-prefigure.xsl +0 -0
- package/assets/xsl/extract-qrcode.xsl +0 -0
- package/assets/xsl/extract-runestone-page-template.xsl +0 -0
- package/assets/xsl/extract-sageplot.xsl +0 -0
- package/assets/xsl/extract-stack.xsl +0 -0
- package/assets/xsl/extract-trace.xsl +0 -0
- package/assets/xsl/extract-youtube.xsl +0 -0
- package/assets/xsl/html-symbols.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-AIM.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-CLP.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-chaos.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-guide.xsl +0 -0
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +0 -0
- package/assets/xsl/localizations/README.md +0 -0
- package/assets/xsl/localizations/af-ZA.xml +0 -0
- package/assets/xsl/localizations/bg-BG.xml +0 -0
- package/assets/xsl/localizations/ca-ES.xml +0 -0
- package/assets/xsl/localizations/cs-CZ.xml +0 -0
- package/assets/xsl/localizations/de-DE.xml +0 -0
- package/assets/xsl/localizations/en-US.xml +0 -0
- package/assets/xsl/localizations/es-ES.xml +0 -0
- package/assets/xsl/localizations/fi-FI.xml +0 -0
- package/assets/xsl/localizations/fr-CA.xml +0 -0
- package/assets/xsl/localizations/fr-FR.xml +0 -0
- package/assets/xsl/localizations/hu-HU.xml +0 -0
- package/assets/xsl/localizations/it-IT.xml +0 -0
- package/assets/xsl/localizations/ku-CKB.xml +0 -0
- package/assets/xsl/localizations/localizations.xml +0 -0
- package/assets/xsl/localizations/nl-NL.xml +0 -0
- package/assets/xsl/localizations/pt-BR.xml +0 -0
- package/assets/xsl/localizations/pt-PT.xml +0 -0
- package/assets/xsl/localizations/zh-HANS.xml +0 -0
- package/assets/xsl/pretext-assembly.xsl +0 -0
- package/assets/xsl/pretext-basic-html.xsl +0 -0
- package/assets/xsl/pretext-beamer.xsl +0 -0
- package/assets/xsl/pretext-braille-preprint.xsl +0 -0
- package/assets/xsl/pretext-common.xsl +0 -0
- package/assets/xsl/pretext-dynamic.xsl +0 -0
- package/assets/xsl/pretext-epub.xsl +0 -0
- package/assets/xsl/pretext-fo.xsl +0 -0
- package/assets/xsl/pretext-html.xsl +0 -0
- package/assets/xsl/pretext-json-manifest.xsl +0 -0
- package/assets/xsl/pretext-jupyter.xsl +0 -0
- package/assets/xsl/pretext-latex-classic.xsl +0 -0
- package/assets/xsl/pretext-latex-common.xsl +0 -0
- package/assets/xsl/pretext-latex.xsl +0 -0
- package/assets/xsl/pretext-litprog.xsl +0 -0
- package/assets/xsl/pretext-merge.xsl +0 -0
- package/assets/xsl/pretext-numbers.xsl +0 -0
- package/assets/xsl/pretext-revealjs.xsl +0 -0
- package/assets/xsl/pretext-runestone-fitb.xsl +0 -0
- package/assets/xsl/pretext-runestone-static.xsl +0 -0
- package/assets/xsl/pretext-runestone.xsl +0 -0
- package/assets/xsl/pretext-sage-doctest.xsl +0 -0
- package/assets/xsl/pretext-smc.xsl +0 -0
- package/assets/xsl/pretext-solution-manual-latex.xsl +0 -0
- package/assets/xsl/pretext-text-utilities.xsl +0 -0
- package/assets/xsl/pretext-text.xsl +0 -0
- package/assets/xsl/pretext-units.xsl +0 -0
- package/assets/xsl/pretext-view-source.xsl +0 -0
- package/assets/xsl/pretext-ww-problem-sets.xsl +0 -0
- package/assets/xsl/publisher-variables.xsl +0 -0
- package/assets/xsl/support/README.md +0 -0
- package/assets/xsl/support/extract-math.xsl +0 -0
- package/assets/xsl/support/package-math.xsl +0 -0
- package/assets/xsl/support/play-button/README.md +0 -0
- package/assets/xsl/support/play-button/play-button.png +0 -0
- package/assets/xsl/support/play-button/play-button.svg +0 -0
- package/assets/xsl/support/pretext-pg-macros.xsl +0 -0
- package/assets/xsl/support/webpack_static_imports.xml +0 -0
- package/assets/xsl/tests/README.md +0 -0
- package/assets/xsl/tests/null.xml +0 -0
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +0 -0
- package/assets/xsl/utilities/README.md +0 -0
- package/assets/xsl/utilities/author-report.xsl +0 -0
- package/assets/xsl/utilities/deprecate-autoname.sed +0 -0
- package/assets/xsl/utilities/deprecate-index.sed +0 -0
- package/assets/xsl/utilities/fix-deprecations.xsl +0 -0
- package/assets/xsl/utilities/pretext-enhanced-source.xsl +0 -0
- package/assets/xsl/utilities/report-publisher-variables.xsl +0 -0
- package/assets/xsl/xml-to-json.xsl +0 -0
- package/assets/xsl/xml-to-string.xsl +0 -0
- package/assets/xsl-bundle.json +1 -0
- package/dist/{cli-BQizBK0N.js → cli-B2LiKunq.js} +267 -234
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +1 -1
- package/dist/host.browser.d.ts +29 -0
- package/dist/host.d.ts +41 -0
- package/dist/index.browser.d.ts +29 -0
- package/dist/index.browser.js +650 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -12
- package/dist/internal/posix-path.d.ts +59 -0
- package/dist/mounts.d.ts +18 -0
- package/dist/publication.d.ts +0 -0
- package/dist/renderer.d.ts +4 -1
- package/dist/sourcemap.d.ts +0 -0
- package/dist/theme.d.ts +0 -0
- package/dist/theme.js +0 -0
- package/dist/xinclude.d.ts +0 -0
- package/package.json +9 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A posix-only stand-in for `node:path`, substituted for it when this package
|
|
3
|
+
* is built for the browser (see vite.config.ts).
|
|
4
|
+
*
|
|
5
|
+
* This is safe because none of the paths this package computes ever reach a
|
|
6
|
+
* real filesystem: libxslt-wasm is compiled with FILESYSTEM=0, so every path
|
|
7
|
+
* ends up as either a key in the mount table or a segment of a
|
|
8
|
+
* `*.ptx.invalid` URL (see mounts.ts). They are virtual paths, and virtual
|
|
9
|
+
* paths are posix paths — a browser caller passes `sourcePath: "/main.ptx"`
|
|
10
|
+
* and means exactly what it says.
|
|
11
|
+
*
|
|
12
|
+
* Only the handful of functions this package actually uses are implemented.
|
|
13
|
+
*/
|
|
14
|
+
export declare const sep = "/";
|
|
15
|
+
/**
|
|
16
|
+
* Collapse `.` and `..` segments. An absolute path clamps at the root
|
|
17
|
+
* (`/a/../../b` → `/b`), which is what makes the containment checks in
|
|
18
|
+
* mounts.ts and xinclude.ts safe against `..` traversal.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalize(p: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve right-to-left until an absolute path is found. With no absolute
|
|
23
|
+
* segment the result is rooted at `/` rather than at a process cwd — there is
|
|
24
|
+
* no cwd in a browser, and a virtual path is meaningless relative to one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolve(...segments: string[]): string;
|
|
27
|
+
export declare function join(...segments: string[]): string;
|
|
28
|
+
export declare function dirname(p: string): string;
|
|
29
|
+
export declare function relative(from: string, to: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* `path.posix` self-reference: on posix, `path` and `path.posix` are the same
|
|
32
|
+
* thing, and call sites that reach for `path.posix.normalize` to be explicit
|
|
33
|
+
* should keep working.
|
|
34
|
+
*/
|
|
35
|
+
export declare const posix: {
|
|
36
|
+
sep: string;
|
|
37
|
+
normalize: typeof normalize;
|
|
38
|
+
resolve: typeof resolve;
|
|
39
|
+
join: typeof join;
|
|
40
|
+
dirname: typeof dirname;
|
|
41
|
+
relative: typeof relative;
|
|
42
|
+
};
|
|
43
|
+
declare const _default: {
|
|
44
|
+
sep: string;
|
|
45
|
+
normalize: typeof normalize;
|
|
46
|
+
resolve: typeof resolve;
|
|
47
|
+
join: typeof join;
|
|
48
|
+
dirname: typeof dirname;
|
|
49
|
+
relative: typeof relative;
|
|
50
|
+
posix: {
|
|
51
|
+
sep: string;
|
|
52
|
+
normalize: typeof normalize;
|
|
53
|
+
resolve: typeof resolve;
|
|
54
|
+
join: typeof join;
|
|
55
|
+
dirname: typeof dirname;
|
|
56
|
+
relative: typeof relative;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export default _default;
|
package/dist/mounts.d.ts
CHANGED
|
@@ -10,11 +10,29 @@
|
|
|
10
10
|
* reserved `.invalid` TLD and serve them from local directories or in-memory
|
|
11
11
|
* strings. No HTTP server, no real network traffic.
|
|
12
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* Reads `relPath` (posix, leading "/") beneath mount root `root`, or resolves
|
|
15
|
+
* `undefined` when it is missing or escapes the mount. `root` is opaque: a
|
|
16
|
+
* directory under Node, a base URL in a browser, whatever an embedder's own
|
|
17
|
+
* reader wants.
|
|
18
|
+
*/
|
|
19
|
+
export type MountReader = (root: string, relPath: string) => Promise<Uint8Array | string | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Replace how mounted files are read. Lets an embedder serve the stylesheets
|
|
22
|
+
* from somewhere the platform seam does not cover — an in-memory map, a zip,
|
|
23
|
+
* a VS Code webview resource URI — without patching `globalThis.fetch`.
|
|
24
|
+
* Also how scripts/build-xsl-bundle.mjs records which files a render touches.
|
|
25
|
+
*/
|
|
26
|
+
export declare function setMountReader(reader: MountReader): void;
|
|
13
27
|
/** Install the shim (idempotent). Must run before libxslt-wasm loads anything. */
|
|
14
28
|
export declare function installFetchShim(): void;
|
|
15
29
|
/**
|
|
16
30
|
* Serve `dir` under a unique fake origin. Returns the base URL
|
|
17
31
|
* (e.g. `http://mnt1.ptx.invalid`); resource paths append to it.
|
|
32
|
+
*
|
|
33
|
+
* `dir` is stored verbatim and handed back to the {@link MountReader}, which
|
|
34
|
+
* owns its interpretation — under Node a directory path, in a browser a base
|
|
35
|
+
* URL.
|
|
18
36
|
*/
|
|
19
37
|
export declare function mountDirectory(dir: string): string;
|
|
20
38
|
export declare function unmountDirectory(baseUrl: string): void;
|
package/dist/publication.d.ts
CHANGED
|
File without changes
|
package/dist/renderer.d.ts
CHANGED
|
@@ -78,7 +78,10 @@ export interface RenderResult {
|
|
|
78
78
|
/** Present when RenderOptions.sourceMap was set. */
|
|
79
79
|
sourceMap?: PtxSourceMap;
|
|
80
80
|
}
|
|
81
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Vendored stylesheets shipped with this package. A directory under Node, a
|
|
83
|
+
* base URL in the browser build — either way, a mount root (see host.ts).
|
|
84
|
+
*/
|
|
82
85
|
export declare function defaultXslDir(): string;
|
|
83
86
|
export declare function isJspiAvailable(): boolean;
|
|
84
87
|
/** Quote a string as an XPath 1.0 string literal. */
|
package/dist/sourcemap.d.ts
CHANGED
|
File without changes
|
package/dist/theme.d.ts
CHANGED
|
File without changes
|
package/dist/theme.js
CHANGED
|
File without changes
|
package/dist/xinclude.d.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pretextbook/pretext-html",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Convert PreTeXt documents to HTML in pure JavaScript using the official PreTeXt XSLT stylesheets via libxslt-wasm. No Python or PreTeXt installation required.",
|
|
5
5
|
"author": "Oscar Levin",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
+
"browser": {
|
|
32
|
+
"types": "./dist/index.browser.d.ts",
|
|
33
|
+
"default": "./dist/index.browser.js"
|
|
34
|
+
},
|
|
31
35
|
"types": "./dist/index.d.ts",
|
|
32
36
|
"import": "./dist/index.js",
|
|
33
37
|
"default": "./dist/index.js"
|
|
@@ -46,9 +50,11 @@
|
|
|
46
50
|
"cli.mjs"
|
|
47
51
|
],
|
|
48
52
|
"scripts": {
|
|
49
|
-
"build": "vite build",
|
|
53
|
+
"build": "vite build && npm run build:browser && npm run build-xsl-bundle",
|
|
54
|
+
"build:browser": "vite build --mode browser",
|
|
50
55
|
"test": "vitest run",
|
|
51
|
-
"refresh-xsl": "node scripts/refresh-xsl.mjs"
|
|
56
|
+
"refresh-xsl": "node scripts/refresh-xsl.mjs",
|
|
57
|
+
"build-xsl-bundle": "node --experimental-wasm-jspi scripts/build-xsl-bundle.mjs"
|
|
52
58
|
},
|
|
53
59
|
"dependencies": {
|
|
54
60
|
"@pretextbook/libxslt-wasm": "^0.1.1",
|