@mapled/cli 0.8.0 → 0.10.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 +18 -3
- package/dist/commands.js +8 -6
- package/dist/doctor.d.ts +13 -1
- package/dist/doctor.js +64 -3
- package/dist/html5.d.ts +66 -0
- package/dist/html5.js +8009 -0
- package/dist/licenses/entities.LICENSE +11 -0
- package/dist/licenses/parse5.LICENSE +19 -0
- package/dist/scan.d.ts +1 -1
- package/dist/scan.js +4 -1
- package/dist/scanHtml.d.ts +38 -0
- package/dist/scanHtml.js +519 -0
- package/dist/types.js +2 -2
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ npx @mapled/cli scan
|
|
|
97
97
|
npx @mapled/cli scan --write
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
The scanner reads the site's source and writes down what it reads from Mapled: the pages (from the framework's file layout — Next.js App and Pages Router, Astro, SvelteKit, Nuxt, Remix) and one binding per place a collection or field is used.
|
|
100
|
+
The scanner reads the site's source and writes down what it reads from Mapled: the pages (from the framework's file layout — Next.js App and Pages Router, Astro, SvelteKit, Nuxt, Remix — or a plain HTML site's `.html` files) and one binding per place a collection or field is used.
|
|
101
101
|
|
|
102
102
|
```text
|
|
103
103
|
Scanned 42 files with TypeScript — 3 pages, 14 bindings.
|
|
@@ -113,6 +113,21 @@ No mapled/manifest.json yet — run `mapled scan --write` to create it, then `ma
|
|
|
113
113
|
|
|
114
114
|
It follows `getRecords` / `getRecord` / `getRecordBySlug` / `getSingle` calls through variables, destructuring, `.map()` callbacks and into the components a record is passed to as a prop, and through helpers in `lib/` that return a read. The parser is your repository's own TypeScript; without it the scanner still finds the collections, but not the fields. Source code never leaves your machine — only the manifest does, when you push it.
|
|
115
115
|
|
|
116
|
+
**A plain HTML site** (`framework` is `plain-html` in `mapled.json` — a folder with an `index.html` and no framework in `package.json`) has no reads in code: the scanner reads the `data-mapled-*` attributes of its `.html` files the way the [`@mapled/vanilla`](https://www.npmjs.com/package/@mapled/vanilla) script does, in the tree a browser builds from the file (the CLI carries the standard HTML parser, parse5, inside — nothing to install). Each file is a page where a static host serves it (`index.html` → `/`, `blog/index.html` → `/blog/`, `post.html` → `/post.html`, `public/` from the root); a record read by `data-mapled-slug-param` has its own address with that parameter in the query, so **Preview** in the record's editor opens the right page — and the scan says when Preview can't open an address. The target of a binding is what the attribute renders — `data-mapled-format="markdown"` rich text, an `<img>` an image, `data-mapled-bind-href` a link — and each different way a field is read is a binding of its own, so a field bound where it can't render shows up as a mismatch even when another element reads it well. With the schema at hand it also names the paths nothing in Mapled answers to: on the page, a misspelled field and an empty one look the same.
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
Scanned 2 HTML files — 2 pages, 11 bindings.
|
|
120
|
+
|
|
121
|
+
/ index.html
|
|
122
|
+
home headline, intro, tagline
|
|
123
|
+
posts list • date, slug, title
|
|
124
|
+
/post.html?slug=[slug] post.html
|
|
125
|
+
home headline
|
|
126
|
+
posts by slug • body, title
|
|
127
|
+
|
|
128
|
+
⚠ This path names nothing in the schema: home.tagline (index.html). A misspelled field empties its place on the page, a misspelled single leaves the page's own HTML.
|
|
129
|
+
```
|
|
130
|
+
|
|
116
131
|
`--write` creates or updates `mapled/manifest.json`. Bindings the scan can't see (written by your AI agent, or by hand) are kept and listed; `--prune` drops them. Commit the file.
|
|
117
132
|
|
|
118
133
|
## Validate and push the manifest
|
|
@@ -175,7 +190,7 @@ Mapled doctor — Dolphin Landing
|
|
|
175
190
|
✓ Environment MAPLED_KEY and MAPLED_WEBHOOK_SECRET in .env.local
|
|
176
191
|
✓ Secrets in git No env files or Mapled secrets are tracked.
|
|
177
192
|
✓ @mapled/next 0.8.0 (current)
|
|
178
|
-
✓ mapled CLI 0.
|
|
193
|
+
✓ mapled CLI 0.9.0 (current)
|
|
179
194
|
✓ Revalidation route app/api/mapled/revalidate/route.ts
|
|
180
195
|
⚠ Preview route app/api/mapled/preview/route.ts is missing — mount createPreviewHandler from "@mapled/next/server" so Preview from Mapled works.
|
|
181
196
|
✓ Site reads content Last read 3m ago
|
|
@@ -188,7 +203,7 @@ Mapled doctor — Dolphin Landing
|
|
|
188
203
|
|
|
189
204
|
The repository side: the link, the sign-in, the generated types, the schema pin, the site manifest (and whether it matches what was pushed), the integration hash — one line saying whether the pin and the manifest here describe the same integration Mapled holds, and if not, what moved (the schema, the bindings, or edits made in Mapled) and which command catches up — `MAPLED.md` (and whether it is what Mapled would render now), `MAPLED_KEY` and `MAPLED_WEBHOOK_SECRET` in your env files (names only — values are never read out), env files or Mapled secrets tracked by git, the installed `@mapled/next` and CLI versions, the revalidation and preview routes of a Next.js site. The Mapled side, from the same status the AI agent's `check_integration` tool reads: whether the site has read content with the delivery key, the publish webhook and its last delivery, the preview route on the deployed site, the bindings health.
|
|
190
205
|
|
|
191
|
-
A site rendered in the visitor's browser — a React single-page app (Vite and the like), plain HTML — is checked for what it has: the package line is `@mapled/react
|
|
206
|
+
A site rendered in the visitor's browser — a React single-page app (Vite and the like), plain HTML — is checked for what it has: the package line is `@mapled/react`, Environment wants `VITE_MAPLED_KEY` and no webhook secret, and the routes and the webhook read ○ «Not needed» — such a site shows a publish on its next load and trades Mapled's preview link on the page itself. Plain HTML installs nothing: the line is `@mapled/vanilla`, read from the script tag in the pages (or from a copy of the file next to them) — ⚠ when the address has no version or an older one — and Generated types and Environment read ○: the fields are named in attributes, the delivery key sits in the page. doctor takes the framework from `mapled.json`, or works it out from `package.json` (no `package.json` and an `index.html` is plain HTML). Whatever the framework, a server key or a signing secret under a public prefix (`VITE_…`, `NEXT_PUBLIC_…`) is a ✗: it would ship to every visitor.
|
|
192
207
|
|
|
193
208
|
Exit code 1 when something is marked ✗; `--json` prints the checks for scripts and agents.
|
|
194
209
|
|
package/dist/commands.js
CHANGED
|
@@ -12,6 +12,7 @@ import { formatChecks, GLYPH, paint, summarize, useColor } from "./output.js";
|
|
|
12
12
|
import { diffSchema, formatChanges, pinSchema, readPin, SCHEMA_FILE, summarizeChanges, writePin } from "./pin.js";
|
|
13
13
|
import { checkMapledMd, MD_FILE, mergeMd } from "./md.js";
|
|
14
14
|
import { loadTypeScript, mergeManifest, scanRepository } from "./scan.js";
|
|
15
|
+
import { scanHtml } from "./scanHtml.js";
|
|
15
16
|
import { generateTypes } from "./types.js";
|
|
16
17
|
/** The OAuth client id for this API — registered once per machine, and
|
|
17
18
|
again when the server no longer knows it. */
|
|
@@ -490,8 +491,8 @@ export async function scan(ctx, flags) {
|
|
|
490
491
|
throw new CliError(`The scan needs the schema to name the fields — sign in with \`mapled auth login\` or run \`mapled schema pull\` first.`);
|
|
491
492
|
}
|
|
492
493
|
const framework = found.config.framework ?? (await dr.detectFramework(found.dir)) ?? null;
|
|
493
|
-
|
|
494
|
-
const result = await scanRepository(found.dir, { framework, schema, ts });
|
|
494
|
+
// a plain HTML site declares its reads in attributes, not in code
|
|
495
|
+
const result = framework === "plain-html" ? await scanHtml(found.dir, { schema }) : await scanRepository(found.dir, { framework, schema, ts: loadTypeScript(found.dir) });
|
|
495
496
|
const existing = await loadManifest(found.dir);
|
|
496
497
|
const merged = mergeManifest(existing?.manifest ?? null, result, { prune: Boolean(flags.prune) });
|
|
497
498
|
if (flags.json) {
|
|
@@ -500,7 +501,7 @@ export async function scan(ctx, flags) {
|
|
|
500
501
|
await writeManifestFile(found.dir, merged.manifest);
|
|
501
502
|
return;
|
|
502
503
|
}
|
|
503
|
-
ctx.out(`Scanned ${plural(result.files, "file")} with ${result.parser === "typescript" ? "TypeScript" : "the tokenizer"} — ${plural(result.pages.length, "page")}, ${plural(result.bindings.length, "binding")}.`);
|
|
504
|
+
ctx.out(`${result.parser === "html" ? `Scanned ${plural(result.files, "HTML file")}` : `Scanned ${plural(result.files, "file")} with ${result.parser === "typescript" ? "TypeScript" : "the tokenizer"}`} — ${plural(result.pages.length, "page")}, ${plural(result.bindings.length, "binding")}.`);
|
|
504
505
|
if (result.bindings.length > 0) {
|
|
505
506
|
ctx.out("");
|
|
506
507
|
for (const line of describeScan(result, schema))
|
|
@@ -581,9 +582,10 @@ export async function doctor(ctx, flags) {
|
|
|
581
582
|
const checks = [];
|
|
582
583
|
checks.push(dr.checkLink(found ? { path: path.relative(ctx.cwd, found.path) || CONFIG_FILE } : null, status?.project.name ?? conn?.projectName ?? null));
|
|
583
584
|
checks.push(dr.checkAuth({ conn: conn ?? null, status, error: authError }));
|
|
585
|
+
const framework = found?.config.framework ?? (await dr.detectFramework(dir));
|
|
584
586
|
const typesPath = found?.config.types ?? DEFAULT_TYPES_PATH;
|
|
585
587
|
const existing = await readFile(path.join(dir, typesPath), "utf8").catch(() => null);
|
|
586
|
-
checks.push(dr.checkTypes(existing, schema ? generateTypes(schema, { projectName: status?.project.name, sdk: dr.sdkOf(
|
|
588
|
+
checks.push(dr.checkTypes(existing, schema ? generateTypes(schema, { projectName: status?.project.name, sdk: dr.sdkOf(framework) }) : null, typesPath, framework));
|
|
587
589
|
const pin = found ? await readPin(dir).catch(() => null) : null;
|
|
588
590
|
const livePin = schema && found ? pinSchema(schema, found.config.project) : null;
|
|
589
591
|
const pinChanges = pin && livePin ? diffSchema(pin.pin.collections, livePin.collections) : null;
|
|
@@ -601,13 +603,13 @@ export async function doctor(ctx, flags) {
|
|
|
601
603
|
checks.push(dr.checkManifestFile(localManifest ? { manifest: localManifest.manifest, problems: localManifest.problems } : null, remoteManifest));
|
|
602
604
|
checks.push(dr.checkIntegration({ pin: pin?.pin ?? null, manifest: localManifest?.manifest ?? null }, conn && status ? { integration: status.integration, manifest: remoteManifest } : null));
|
|
603
605
|
checks.push(checkMapledMd(await readFile(path.join(dir, MD_FILE), "utf8").catch(() => null), guide));
|
|
604
|
-
const framework = found?.config.framework ?? (await dr.detectFramework(dir));
|
|
605
606
|
// a site rendered in the browser has no webhook, no routes and no secret to check
|
|
606
607
|
const browser = dr.rendersInBrowser(framework);
|
|
607
608
|
const sdk = dr.sdkOf(framework);
|
|
608
609
|
checks.push(dr.checkEnv(await dr.envNames(dir), ctx.env, framework));
|
|
609
610
|
checks.push(dr.checkSecrets(await dr.gitFacts(dir)));
|
|
610
|
-
|
|
611
|
+
// plain HTML installs nothing: the runtime comes with a script tag
|
|
612
|
+
checks.push(framework === "plain-html" ? dr.checkScriptTag(await dr.findScriptTag(dir), status?.sdk[sdk]) : dr.checkSdk(await dr.installedVersion(dir, sdk), status?.sdk[sdk], sdk));
|
|
611
613
|
checks.push(dr.checkCli(ctx.version, status?.sdk["@mapled/cli"]));
|
|
612
614
|
checks.push(dr.checkRoute("revalidate", await dr.findRoute(dir, "revalidate"), framework));
|
|
613
615
|
checks.push(dr.checkRoute("preview", await dr.findRoute(dir, "preview"), framework));
|
package/dist/doctor.d.ts
CHANGED
|
@@ -100,6 +100,18 @@ export declare function installedVersion(dir: string, pkg: string): Promise<Pack
|
|
|
100
100
|
export declare const rendersInBrowser: (framework: string | null | undefined) => boolean;
|
|
101
101
|
/** The first-party package a site of this framework reads through. */
|
|
102
102
|
export declare const sdkOf: (framework: string | null | undefined) => string;
|
|
103
|
+
/** How a plain HTML site loads "@mapled/vanilla": a script tag in its
|
|
104
|
+
pages — from a CDN, where the version is in the address, or a copy of
|
|
105
|
+
the single file next to the pages, where it is in the file's first
|
|
106
|
+
line. */
|
|
107
|
+
export type ScriptTag = {
|
|
108
|
+
/** the page or the copy the version was read from */
|
|
109
|
+
file: string;
|
|
110
|
+
/** null — a CDN address without a version: it follows every release */
|
|
111
|
+
version: string | null;
|
|
112
|
+
};
|
|
113
|
+
export declare function findScriptTag(dir: string): Promise<ScriptTag | null>;
|
|
114
|
+
export declare function checkScriptTag(tag: ScriptTag | null, latest: string | undefined): Check;
|
|
103
115
|
export declare function detectFramework(dir: string): Promise<string | undefined>;
|
|
104
116
|
/** -1, 0 or 1 comparing dotted numeric versions; anything else compares by number. */
|
|
105
117
|
export declare function compareVersions(a: string, b: string): number;
|
|
@@ -127,7 +139,7 @@ export declare function checkAuth(state: {
|
|
|
127
139
|
status: IntegrationStatus | null;
|
|
128
140
|
error: string | null;
|
|
129
141
|
}): Check;
|
|
130
|
-
export declare function checkTypes(existing: string | null, generated: Generated | null, typesPath: string): Check;
|
|
142
|
+
export declare function checkTypes(existing: string | null, generated: Generated | null, typesPath: string, framework?: string | null): Check;
|
|
131
143
|
export declare function checkEnv(names: Map<string, string>, env: NodeJS.ProcessEnv, framework?: string | null): Check;
|
|
132
144
|
export declare function checkSecrets(facts: GitFacts): Check;
|
|
133
145
|
export declare function checkSdk(pkg: PackageVersion, latest: string | undefined, name?: string): Check;
|
package/dist/doctor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
-
import { access, readFile } from "node:fs/promises";
|
|
2
|
+
import { access, readdir, readFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
import { integrationHash } from "./integrationHash.js";
|
|
@@ -108,7 +108,65 @@ export async function installedVersion(dir, pkg) {
|
|
|
108
108
|
keys are the ones Mapled knows by (lib/siteStack.ts of the API). */
|
|
109
109
|
export const rendersInBrowser = (framework) => framework === "react-spa" || framework === "plain-html";
|
|
110
110
|
/** The first-party package a site of this framework reads through. */
|
|
111
|
-
export const sdkOf = (framework) => !framework || framework === "nextjs" ? "@mapled/next" : framework === "react-spa" ? "@mapled/react" : "@mapled/client";
|
|
111
|
+
export const sdkOf = (framework) => !framework || framework === "nextjs" ? "@mapled/next" : framework === "react-spa" ? "@mapled/react" : framework === "plain-html" ? "@mapled/vanilla" : "@mapled/client";
|
|
112
|
+
const SKIPPED_DIRS = new Set(["node_modules", ".git", ".next", ".vercel", ".netlify", "vendor"]);
|
|
113
|
+
export async function findScriptTag(dir) {
|
|
114
|
+
// pages first, breadth first, and not forever: a site's pages sit near its root
|
|
115
|
+
const queue = [{ abs: dir, rel: "", depth: 0 }];
|
|
116
|
+
const copies = [];
|
|
117
|
+
let unpinned = null;
|
|
118
|
+
let seen = 0;
|
|
119
|
+
while (queue.length > 0 && seen < 2000) {
|
|
120
|
+
const at = queue.shift();
|
|
121
|
+
const entries = await readdir(at.abs, { withFileTypes: true }).catch(() => []);
|
|
122
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
123
|
+
seen += 1;
|
|
124
|
+
const rel = at.rel ? `${at.rel}/${entry.name}` : entry.name;
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
if (at.depth < 3 && !SKIPPED_DIRS.has(entry.name) && !entry.name.startsWith("."))
|
|
127
|
+
queue.push({ abs: path.join(at.abs, entry.name), rel, depth: at.depth + 1 });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (/^mapled(\.min)?\.js$/.test(entry.name))
|
|
131
|
+
copies.push(rel);
|
|
132
|
+
if (!/\.html?$/i.test(entry.name))
|
|
133
|
+
continue;
|
|
134
|
+
const text = await readFile(path.join(at.abs, entry.name), "utf8").catch(() => "");
|
|
135
|
+
const pinned = /@mapled\/vanilla@(\d+\.\d+\.\d+)/.exec(text);
|
|
136
|
+
if (pinned)
|
|
137
|
+
return { file: rel, version: pinned[1] };
|
|
138
|
+
if (unpinned === null && /@mapled\/vanilla(@latest)?\//.test(text))
|
|
139
|
+
unpinned = rel;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (const rel of copies) {
|
|
143
|
+
const head = (await readFile(path.join(dir, rel), "utf8").catch(() => "")).slice(0, 200);
|
|
144
|
+
const banner = /^\/\*! @mapled\/vanilla (\d+\.\d+\.\d+) /.exec(head);
|
|
145
|
+
if (banner)
|
|
146
|
+
return { file: rel, version: banner[1] };
|
|
147
|
+
}
|
|
148
|
+
return unpinned === null ? null : { file: unpinned, version: null };
|
|
149
|
+
}
|
|
150
|
+
export function checkScriptTag(tag, latest) {
|
|
151
|
+
const key = "sdk";
|
|
152
|
+
const label = "@mapled/vanilla";
|
|
153
|
+
const at = latest ?? "x.y.z";
|
|
154
|
+
if (!tag) {
|
|
155
|
+
return {
|
|
156
|
+
key,
|
|
157
|
+
label,
|
|
158
|
+
status: "failed",
|
|
159
|
+
detail: `No page loads it yet. Put <script src="https://cdn.jsdelivr.net/npm/@mapled/vanilla@${at}/dist/mapled.js" data-mapled-key="…" defer></script> into the pages.`,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (tag.version === null) {
|
|
163
|
+
return { key, label, status: "warning", detail: `${tag.file} loads it without a version — that address follows every release. Pin it: @mapled/vanilla@${at}.` };
|
|
164
|
+
}
|
|
165
|
+
if (latest && compareVersions(tag.version, latest) < 0) {
|
|
166
|
+
return { key, label, status: "warning", detail: `${tag.version} in ${tag.file}, ${latest} available — change the version in the script tag.` };
|
|
167
|
+
}
|
|
168
|
+
return { key, label, status: "passed", detail: latest ? `${tag.version} in ${tag.file} (current)` : `${tag.version} in ${tag.file}` };
|
|
169
|
+
}
|
|
112
170
|
export async function detectFramework(dir) {
|
|
113
171
|
const hasIndexHtml = () => access(path.join(dir, "index.html")).then(() => true, () => false);
|
|
114
172
|
let deps;
|
|
@@ -234,8 +292,11 @@ export function checkAuth(state) {
|
|
|
234
292
|
detail: `${state.status.connection.name} • ${state.status.project.name}`,
|
|
235
293
|
};
|
|
236
294
|
}
|
|
237
|
-
export function checkTypes(existing, generated, typesPath) {
|
|
295
|
+
export function checkTypes(existing, generated, typesPath, framework) {
|
|
238
296
|
const label = "Generated types";
|
|
297
|
+
if (framework === "plain-html" && existing === null) {
|
|
298
|
+
return { key: "types", label, status: "skipped", detail: "Not needed: plain HTML names its fields in attributes, not in TypeScript." };
|
|
299
|
+
}
|
|
239
300
|
if (!generated)
|
|
240
301
|
return { key: "types", label, status: "skipped", detail: "Sign in to compare with the schema." };
|
|
241
302
|
if (existing === null) {
|
package/dist/html5.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type Token, type TreeAdapter, type TreeAdapterTypeMap } from "parse5";
|
|
2
|
+
/** The HTML parser of `mapled scan` for a plain HTML site: parse5, the
|
|
3
|
+
WHATWG parsing algorithm — the tree a browser builds, and the one
|
|
4
|
+
jsdom builds for the runtime's tests. Tag soup decides which scope a
|
|
5
|
+
binding lands in (a <p> a <div> closes, a table's foster parent, a
|
|
6
|
+
template an end tag can't leave), so the scan can't read a tree of its
|
|
7
|
+
own. build.mjs bundles parse5 (pinned) into dist/html5.js: the CLI
|
|
8
|
+
still installs without dependencies.
|
|
9
|
+
|
|
10
|
+
What a page can make the parser do is held linear in its size — a
|
|
11
|
+
page is the site's to write, and the scan reads up to 2 MB of it:
|
|
12
|
+
- open elements: at most MAX_OPEN (Guarded.onItemPush). Every start tag
|
|
13
|
+
looks down them for a scope; 100,000 unclosed <div>s cost minutes.
|
|
14
|
+
- a tag's attributes: a set of names (Guarded, _leaveAttrName). parse5
|
|
15
|
+
compared each new one with every earlier one — 64,000 on one <div>: 4 s.
|
|
16
|
+
- the tree: children in linked lists (`linked` below), every operation
|
|
17
|
+
O(1). parse5's own tree keeps arrays, and foster parenting (text
|
|
18
|
+
before a <table>: indexOf), the adoption agency (a misnested </b>:
|
|
19
|
+
splice from the front) and repeated <html>/<body> tags (every
|
|
20
|
+
attribute so far) walk them — 160,000 "a<br>" in a table: 11 s.
|
|
21
|
+
The worst page within the cap is the depth times its start tags. */
|
|
22
|
+
/** How deep elements may be open at once — Chrome's own limit of the tree it builds. */
|
|
23
|
+
export declare const MAX_OPEN = 512;
|
|
24
|
+
export declare class TooDeep extends Error {
|
|
25
|
+
}
|
|
26
|
+
export type Html5Attr = Token.Attribute;
|
|
27
|
+
/** A node of the tree: an element (tagName), text, a comment, a doctype,
|
|
28
|
+
the document or a template's content — children linked both ways. Its
|
|
29
|
+
fields are named as parse5's own tree names them; `childNodes` is made
|
|
30
|
+
when asked for (the parser never asks). */
|
|
31
|
+
export declare class Html5Node {
|
|
32
|
+
readonly nodeName: string;
|
|
33
|
+
tagName?: string;
|
|
34
|
+
namespaceURI?: string;
|
|
35
|
+
attrs?: Html5Attr[];
|
|
36
|
+
/** a <template>'s content: what the page's author wrote inside it */
|
|
37
|
+
content?: Html5Node;
|
|
38
|
+
parentNode: Html5Node | null;
|
|
39
|
+
firstChild: Html5Node | null;
|
|
40
|
+
lastChild: Html5Node | null;
|
|
41
|
+
previousSibling: Html5Node | null;
|
|
42
|
+
nextSibling: Html5Node | null;
|
|
43
|
+
/** a text's */
|
|
44
|
+
value?: string;
|
|
45
|
+
/** a comment's */
|
|
46
|
+
data?: string;
|
|
47
|
+
/** a doctype's */
|
|
48
|
+
name?: string;
|
|
49
|
+
publicId?: string;
|
|
50
|
+
systemId?: string;
|
|
51
|
+
/** the document's */
|
|
52
|
+
mode?: string;
|
|
53
|
+
/** the names an <html> or <body> has, as repeated tags add to them */
|
|
54
|
+
names?: Set<string>;
|
|
55
|
+
location?: Token.ElementLocation | null;
|
|
56
|
+
constructor(nodeName: string, extra?: Partial<Html5Node>);
|
|
57
|
+
/** none on a text, a comment or a doctype, as in parse5's tree */
|
|
58
|
+
get childNodes(): Html5Node[] | undefined;
|
|
59
|
+
}
|
|
60
|
+
type Map_ = TreeAdapterTypeMap<Html5Node, Html5Node, Html5Node, Html5Node, Html5Node, Html5Node, Html5Node, Html5Node, Html5Node, Html5Node>;
|
|
61
|
+
/** parse5's default tree adapter, method for method, on linked children. */
|
|
62
|
+
export declare const linked: TreeAdapter<Map_>;
|
|
63
|
+
/** The document, with scripting on — as the runtime sees it (a <noscript>
|
|
64
|
+
is text). Throws TooDeep past MAX_OPEN open elements. */
|
|
65
|
+
export declare function parseDocument(text: string): Html5Node;
|
|
66
|
+
export {};
|