@alivault/pico 0.3.1 → 0.4.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/.output/nitro.json +1 -1
- package/.output/public/assets/{index-CksX3NW4.js → index-BiaOlsw0.js} +3 -3
- package/.output/public/assets/routes-C7eqqi44.js +2152 -0
- package/.output/public/assets/styles-4lJzavCj.css +2 -0
- package/.output/public/screenshots/pico-mobile-alt.png +0 -0
- package/.output/public/screenshots/pico-mobile.png +0 -0
- package/.output/public/screenshots/pico-workspace-alt.png +0 -0
- package/.output/public/screenshots/pico-workspace.png +0 -0
- package/.output/server/_libs/@pierre/diffs+[...].mjs +53 -1
- package/.output/server/_libs/entities.mjs +372 -0
- package/.output/server/_libs/hast-util-from-parse5+[...].mjs +741 -0
- package/.output/server/_libs/hast-util-raw+[...].mjs +7897 -0
- package/.output/server/_libs/hast-util-sanitize.mjs +780 -0
- package/.output/server/_libs/hast-util-to-jsx-runtime+[...].mjs +3 -82
- package/.output/server/_libs/mdast-util-find-and-replace.mjs +198 -0
- package/.output/server/_libs/mdast-util-gfm+[...].mjs +4 -288
- package/.output/server/_libs/mdast-util-to-hast+[...].mjs +1 -2
- package/.output/server/_libs/react-markdown+[...].mjs +1 -1
- package/.output/server/_libs/rehype-raw.mjs +37 -0
- package/.output/server/_libs/rehype-sanitize.mjs +27 -0
- package/.output/server/_ssr/{router-Di8B08B6.mjs → router-CgnX-Js0.mjs} +3 -3
- package/.output/server/_ssr/{routes-CRDrPu8Q.mjs → routes-CmLc8G9G.mjs} +223 -176
- package/.output/server/_ssr/{routes-B99MXwvx.mjs → routes-D2MVUd_A.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +2 -2
- package/.output/server/{_tanstack-start-manifest_v-DK9pZs2A.mjs → _tanstack-start-manifest_v-BSXP2b2T.mjs} +4 -4
- package/.output/server/index.mjs +484 -470
- package/README.md +6 -2
- package/package.json +3 -1
- package/public/screenshots/pico-mobile-alt.png +0 -0
- package/public/screenshots/pico-mobile.png +0 -0
- package/public/screenshots/pico-workspace-alt.png +0 -0
- package/public/screenshots/pico-workspace.png +0 -0
- package/.output/public/assets/routes-VohBsBcC.js +0 -2151
- package/.output/public/assets/styles-ej_ltn_F.css +0 -2
- package/.output/server/_libs/mdast-util-find-and-replace+[...].mjs +0 -636
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { i as __toESM, t as __commonJSMin } from "../_runtime.mjs";
|
|
2
|
-
import { a as stringify,
|
|
2
|
+
import { a as stringify$1, d as svg, f as find, p as hastToReact, r as whitespace, s as stringify, u as html } from "./@pierre/diffs+[...].mjs";
|
|
3
3
|
import "./devlop.mjs";
|
|
4
4
|
import { t as name } from "./estree-util-is-identifier-name.mjs";
|
|
5
|
+
import { o as pointStart } from "./hast-util-raw+[...].mjs";
|
|
5
6
|
//#region node_modules/.pnpm/inline-style-parser@0.2.7/node_modules/inline-style-parser/cjs/index.js
|
|
6
7
|
var require_cjs$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7
8
|
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
@@ -305,86 +306,6 @@ var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
305
306
|
module.exports = StyleToJS;
|
|
306
307
|
}));
|
|
307
308
|
//#endregion
|
|
308
|
-
//#region node_modules/.pnpm/unist-util-position@5.0.0/node_modules/unist-util-position/lib/index.js
|
|
309
|
-
/**
|
|
310
|
-
* @typedef {import('unist').Node} Node
|
|
311
|
-
* @typedef {import('unist').Point} Point
|
|
312
|
-
* @typedef {import('unist').Position} Position
|
|
313
|
-
*/
|
|
314
|
-
/**
|
|
315
|
-
* @typedef NodeLike
|
|
316
|
-
* @property {string} type
|
|
317
|
-
* @property {PositionLike | null | undefined} [position]
|
|
318
|
-
*
|
|
319
|
-
* @typedef PositionLike
|
|
320
|
-
* @property {PointLike | null | undefined} [start]
|
|
321
|
-
* @property {PointLike | null | undefined} [end]
|
|
322
|
-
*
|
|
323
|
-
* @typedef PointLike
|
|
324
|
-
* @property {number | null | undefined} [line]
|
|
325
|
-
* @property {number | null | undefined} [column]
|
|
326
|
-
* @property {number | null | undefined} [offset]
|
|
327
|
-
*/
|
|
328
|
-
/**
|
|
329
|
-
* Get the ending point of `node`.
|
|
330
|
-
*
|
|
331
|
-
* @param node
|
|
332
|
-
* Node.
|
|
333
|
-
* @returns
|
|
334
|
-
* Point.
|
|
335
|
-
*/
|
|
336
|
-
var pointEnd = point$1("end");
|
|
337
|
-
/**
|
|
338
|
-
* Get the starting point of `node`.
|
|
339
|
-
*
|
|
340
|
-
* @param node
|
|
341
|
-
* Node.
|
|
342
|
-
* @returns
|
|
343
|
-
* Point.
|
|
344
|
-
*/
|
|
345
|
-
var pointStart = point$1("start");
|
|
346
|
-
/**
|
|
347
|
-
* Get the positional info of `node`.
|
|
348
|
-
*
|
|
349
|
-
* @param {'end' | 'start'} type
|
|
350
|
-
* Side.
|
|
351
|
-
* @returns
|
|
352
|
-
* Getter.
|
|
353
|
-
*/
|
|
354
|
-
function point$1(type) {
|
|
355
|
-
return point;
|
|
356
|
-
/**
|
|
357
|
-
* Get the point info of `node` at a bound side.
|
|
358
|
-
*
|
|
359
|
-
* @param {Node | NodeLike | null | undefined} [node]
|
|
360
|
-
* @returns {Point | undefined}
|
|
361
|
-
*/
|
|
362
|
-
function point(node) {
|
|
363
|
-
const point = node && node.position && node.position[type] || {};
|
|
364
|
-
if (typeof point.line === "number" && point.line > 0 && typeof point.column === "number" && point.column > 0) return {
|
|
365
|
-
line: point.line,
|
|
366
|
-
column: point.column,
|
|
367
|
-
offset: typeof point.offset === "number" && point.offset > -1 ? point.offset : void 0
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Get the positional info of `node`.
|
|
373
|
-
*
|
|
374
|
-
* @param {Node | NodeLike | null | undefined} [node]
|
|
375
|
-
* Node.
|
|
376
|
-
* @returns {Position | undefined}
|
|
377
|
-
* Position.
|
|
378
|
-
*/
|
|
379
|
-
function position$1(node) {
|
|
380
|
-
const start = pointStart(node);
|
|
381
|
-
const end = pointEnd(node);
|
|
382
|
-
if (start && end) return {
|
|
383
|
-
start,
|
|
384
|
-
end
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
//#endregion
|
|
388
309
|
//#region node_modules/.pnpm/unist-util-stringify-position@4.0.0/node_modules/unist-util-stringify-position/lib/index.js
|
|
389
310
|
/**
|
|
390
311
|
* @typedef {import('unist').Node} Node
|
|
@@ -1241,4 +1162,4 @@ function toDash($0) {
|
|
|
1241
1162
|
return "-" + $0.toLowerCase();
|
|
1242
1163
|
}
|
|
1243
1164
|
//#endregion
|
|
1244
|
-
export {
|
|
1165
|
+
export { VFileMessage as n, stringifyPosition as r, toJsxRuntime as t };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { i as convert, r as visitParents } from "./hast-util-raw+[...].mjs";
|
|
2
|
+
import { t as escapeStringRegexp } from "./escape-string-regexp.mjs";
|
|
3
|
+
//#region node_modules/.pnpm/mdast-util-find-and-replace@3.0.2/node_modules/mdast-util-find-and-replace/lib/index.js
|
|
4
|
+
/**
|
|
5
|
+
* @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'
|
|
6
|
+
* @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef RegExpMatchObject
|
|
10
|
+
* Info on the match.
|
|
11
|
+
* @property {number} index
|
|
12
|
+
* The index of the search at which the result was found.
|
|
13
|
+
* @property {string} input
|
|
14
|
+
* A copy of the search string in the text node.
|
|
15
|
+
* @property {[...Array<Parents>, Text]} stack
|
|
16
|
+
* All ancestors of the text node, where the last node is the text itself.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {RegExp | string} Find
|
|
19
|
+
* Pattern to find.
|
|
20
|
+
*
|
|
21
|
+
* Strings are escaped and then turned into global expressions.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
|
|
24
|
+
* Several find and replaces, in array form.
|
|
25
|
+
*
|
|
26
|
+
* @typedef {[Find, Replace?]} FindAndReplaceTuple
|
|
27
|
+
* Find and replace in tuple form.
|
|
28
|
+
*
|
|
29
|
+
* @typedef {ReplaceFunction | string | null | undefined} Replace
|
|
30
|
+
* Thing to replace with.
|
|
31
|
+
*
|
|
32
|
+
* @callback ReplaceFunction
|
|
33
|
+
* Callback called when a search matches.
|
|
34
|
+
* @param {...any} parameters
|
|
35
|
+
* The parameters are the result of corresponding search expression:
|
|
36
|
+
*
|
|
37
|
+
* * `value` (`string`) — whole match
|
|
38
|
+
* * `...capture` (`Array<string>`) — matches from regex capture groups
|
|
39
|
+
* * `match` (`RegExpMatchObject`) — info on the match
|
|
40
|
+
* @returns {Array<PhrasingContent> | PhrasingContent | string | false | null | undefined}
|
|
41
|
+
* Thing to replace with.
|
|
42
|
+
*
|
|
43
|
+
* * when `null`, `undefined`, `''`, remove the match
|
|
44
|
+
* * …or when `false`, do not replace at all
|
|
45
|
+
* * …or when `string`, replace with a text node of that value
|
|
46
|
+
* * …or when `Node` or `Array<Node>`, replace with those nodes
|
|
47
|
+
*
|
|
48
|
+
* @typedef {[RegExp, ReplaceFunction]} Pair
|
|
49
|
+
* Normalized find and replace.
|
|
50
|
+
*
|
|
51
|
+
* @typedef {Array<Pair>} Pairs
|
|
52
|
+
* All find and replaced.
|
|
53
|
+
*
|
|
54
|
+
* @typedef Options
|
|
55
|
+
* Configuration.
|
|
56
|
+
* @property {Test | null | undefined} [ignore]
|
|
57
|
+
* Test for which nodes to ignore (optional).
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Find patterns in a tree and replace them.
|
|
61
|
+
*
|
|
62
|
+
* The algorithm searches the tree in *preorder* for complete values in `Text`
|
|
63
|
+
* nodes.
|
|
64
|
+
* Partial matches are not supported.
|
|
65
|
+
*
|
|
66
|
+
* @param {Nodes} tree
|
|
67
|
+
* Tree to change.
|
|
68
|
+
* @param {FindAndReplaceList | FindAndReplaceTuple} list
|
|
69
|
+
* Patterns to find.
|
|
70
|
+
* @param {Options | null | undefined} [options]
|
|
71
|
+
* Configuration (when `find` is not `Find`).
|
|
72
|
+
* @returns {undefined}
|
|
73
|
+
* Nothing.
|
|
74
|
+
*/
|
|
75
|
+
function findAndReplace(tree, list, options) {
|
|
76
|
+
const ignored = convert((options || {}).ignore || []);
|
|
77
|
+
const pairs = toPairs(list);
|
|
78
|
+
let pairIndex = -1;
|
|
79
|
+
while (++pairIndex < pairs.length) visitParents(tree, "text", visitor);
|
|
80
|
+
/** @type {BuildVisitor<Root, 'text'>} */
|
|
81
|
+
function visitor(node, parents) {
|
|
82
|
+
let index = -1;
|
|
83
|
+
/** @type {Parents | undefined} */
|
|
84
|
+
let grandparent;
|
|
85
|
+
while (++index < parents.length) {
|
|
86
|
+
const parent = parents[index];
|
|
87
|
+
/** @type {Array<Nodes> | undefined} */
|
|
88
|
+
const siblings = grandparent ? grandparent.children : void 0;
|
|
89
|
+
if (ignored(parent, siblings ? siblings.indexOf(parent) : void 0, grandparent)) return;
|
|
90
|
+
grandparent = parent;
|
|
91
|
+
}
|
|
92
|
+
if (grandparent) return handler(node, parents);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Handle a text node which is not in an ignored parent.
|
|
96
|
+
*
|
|
97
|
+
* @param {Text} node
|
|
98
|
+
* Text node.
|
|
99
|
+
* @param {Array<Parents>} parents
|
|
100
|
+
* Parents.
|
|
101
|
+
* @returns {VisitorResult}
|
|
102
|
+
* Result.
|
|
103
|
+
*/
|
|
104
|
+
function handler(node, parents) {
|
|
105
|
+
const parent = parents[parents.length - 1];
|
|
106
|
+
const find = pairs[pairIndex][0];
|
|
107
|
+
const replace = pairs[pairIndex][1];
|
|
108
|
+
let start = 0;
|
|
109
|
+
const index = parent.children.indexOf(node);
|
|
110
|
+
let change = false;
|
|
111
|
+
/** @type {Array<PhrasingContent>} */
|
|
112
|
+
let nodes = [];
|
|
113
|
+
find.lastIndex = 0;
|
|
114
|
+
let match = find.exec(node.value);
|
|
115
|
+
while (match) {
|
|
116
|
+
const position = match.index;
|
|
117
|
+
/** @type {RegExpMatchObject} */
|
|
118
|
+
const matchObject = {
|
|
119
|
+
index: match.index,
|
|
120
|
+
input: match.input,
|
|
121
|
+
stack: [...parents, node]
|
|
122
|
+
};
|
|
123
|
+
let value = replace(...match, matchObject);
|
|
124
|
+
if (typeof value === "string") value = value.length > 0 ? {
|
|
125
|
+
type: "text",
|
|
126
|
+
value
|
|
127
|
+
} : void 0;
|
|
128
|
+
if (value === false) find.lastIndex = position + 1;
|
|
129
|
+
else {
|
|
130
|
+
if (start !== position) nodes.push({
|
|
131
|
+
type: "text",
|
|
132
|
+
value: node.value.slice(start, position)
|
|
133
|
+
});
|
|
134
|
+
if (Array.isArray(value)) nodes.push(...value);
|
|
135
|
+
else if (value) nodes.push(value);
|
|
136
|
+
start = position + match[0].length;
|
|
137
|
+
change = true;
|
|
138
|
+
}
|
|
139
|
+
if (!find.global) break;
|
|
140
|
+
match = find.exec(node.value);
|
|
141
|
+
}
|
|
142
|
+
if (change) {
|
|
143
|
+
if (start < node.value.length) nodes.push({
|
|
144
|
+
type: "text",
|
|
145
|
+
value: node.value.slice(start)
|
|
146
|
+
});
|
|
147
|
+
parent.children.splice(index, 1, ...nodes);
|
|
148
|
+
} else nodes = [node];
|
|
149
|
+
return index + nodes.length;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Turn a tuple or a list of tuples into pairs.
|
|
154
|
+
*
|
|
155
|
+
* @param {FindAndReplaceList | FindAndReplaceTuple} tupleOrList
|
|
156
|
+
* Schema.
|
|
157
|
+
* @returns {Pairs}
|
|
158
|
+
* Clean pairs.
|
|
159
|
+
*/
|
|
160
|
+
function toPairs(tupleOrList) {
|
|
161
|
+
/** @type {Pairs} */
|
|
162
|
+
const result = [];
|
|
163
|
+
if (!Array.isArray(tupleOrList)) throw new TypeError("Expected find and replace tuple or list of tuples");
|
|
164
|
+
/** @type {FindAndReplaceList} */
|
|
165
|
+
const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
|
|
166
|
+
let index = -1;
|
|
167
|
+
while (++index < list.length) {
|
|
168
|
+
const tuple = list[index];
|
|
169
|
+
result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
|
|
170
|
+
}
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Turn a find into an expression.
|
|
175
|
+
*
|
|
176
|
+
* @param {Find} find
|
|
177
|
+
* Find.
|
|
178
|
+
* @returns {RegExp}
|
|
179
|
+
* Expression.
|
|
180
|
+
*/
|
|
181
|
+
function toExpression(find) {
|
|
182
|
+
return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Turn a replace into a function.
|
|
186
|
+
*
|
|
187
|
+
* @param {Replace} replace
|
|
188
|
+
* Replace.
|
|
189
|
+
* @returns {ReplaceFunction}
|
|
190
|
+
* Function.
|
|
191
|
+
*/
|
|
192
|
+
function toFunction(replace) {
|
|
193
|
+
return typeof replace === "function" ? replace : function() {
|
|
194
|
+
return replace;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
export { findAndReplace as t };
|
|
@@ -1,294 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as ccount } from "./@pierre/diffs+[...].mjs";
|
|
2
2
|
import "./devlop.mjs";
|
|
3
|
+
import { i as convert, n as visit } from "./hast-util-raw+[...].mjs";
|
|
3
4
|
import { _ as toString, f as unicodePunctuation, i as classifyCharacter, m as normalizeIdentifier, p as unicodeWhitespace } from "./mdast-util-from-markdown+[...].mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { t as findAndReplace } from "./mdast-util-find-and-replace.mjs";
|
|
5
6
|
import { t as markdownTable } from "./markdown-table.mjs";
|
|
6
7
|
import { t as longestStreak } from "./longest-streak.mjs";
|
|
7
|
-
//#region node_modules/.pnpm/unist-util-visit@5.1.0/node_modules/unist-util-visit/lib/index.js
|
|
8
|
-
/**
|
|
9
|
-
* @import {Node as UnistNode, Parent as UnistParent} from 'unist'
|
|
10
|
-
* @import {VisitorResult} from 'unist-util-visit-parents'
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
|
|
14
|
-
* Test from `unist-util-is`.
|
|
15
|
-
*
|
|
16
|
-
* Note: we have remove and add `undefined`, because otherwise when generating
|
|
17
|
-
* automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
|
|
18
|
-
* which doesn’t work when publishing on npm.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {(
|
|
22
|
-
* Fn extends (value: any) => value is infer Thing
|
|
23
|
-
* ? Thing
|
|
24
|
-
* : Fallback
|
|
25
|
-
* )} Predicate
|
|
26
|
-
* Get the value of a type guard `Fn`.
|
|
27
|
-
* @template Fn
|
|
28
|
-
* Value; typically function that is a type guard (such as `(x): x is Y`).
|
|
29
|
-
* @template Fallback
|
|
30
|
-
* Value to yield if `Fn` is not a type guard.
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {(
|
|
34
|
-
* Check extends null | undefined // No test.
|
|
35
|
-
* ? Value
|
|
36
|
-
* : Value extends {type: Check} // String (type) test.
|
|
37
|
-
* ? Value
|
|
38
|
-
* : Value extends Check // Partial test.
|
|
39
|
-
* ? Value
|
|
40
|
-
* : Check extends Function // Function test.
|
|
41
|
-
* ? Predicate<Check, Value> extends Value
|
|
42
|
-
* ? Predicate<Check, Value>
|
|
43
|
-
* : never
|
|
44
|
-
* : never // Some other test?
|
|
45
|
-
* )} MatchesOne
|
|
46
|
-
* Check whether a node matches a primitive check in the type system.
|
|
47
|
-
* @template Value
|
|
48
|
-
* Value; typically unist `Node`.
|
|
49
|
-
* @template Check
|
|
50
|
-
* Value; typically `unist-util-is`-compatible test, but not arrays.
|
|
51
|
-
*/
|
|
52
|
-
/**
|
|
53
|
-
* @typedef {(
|
|
54
|
-
* Check extends ReadonlyArray<any>
|
|
55
|
-
* ? MatchesOne<Value, Check[number]>
|
|
56
|
-
* : MatchesOne<Value, Check>
|
|
57
|
-
* )} Matches
|
|
58
|
-
* Check whether a node matches a check in the type system.
|
|
59
|
-
* @template Value
|
|
60
|
-
* Value; typically unist `Node`.
|
|
61
|
-
* @template Check
|
|
62
|
-
* Value; typically `unist-util-is`-compatible test.
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint
|
|
66
|
-
* Number; capped reasonably.
|
|
67
|
-
*/
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment
|
|
70
|
-
* Increment a number in the type system.
|
|
71
|
-
* @template {Uint} [I=0]
|
|
72
|
-
* Index.
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* @typedef {(
|
|
76
|
-
* Node extends UnistParent
|
|
77
|
-
* ? Node extends {children: Array<infer Children>}
|
|
78
|
-
* ? Child extends Children ? Node : never
|
|
79
|
-
* : never
|
|
80
|
-
* : never
|
|
81
|
-
* )} InternalParent
|
|
82
|
-
* Collect nodes that can be parents of `Child`.
|
|
83
|
-
* @template {UnistNode} Node
|
|
84
|
-
* All node types in a tree.
|
|
85
|
-
* @template {UnistNode} Child
|
|
86
|
-
* Node to search for.
|
|
87
|
-
*/
|
|
88
|
-
/**
|
|
89
|
-
* @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent
|
|
90
|
-
* Collect nodes in `Tree` that can be parents of `Child`.
|
|
91
|
-
* @template {UnistNode} Tree
|
|
92
|
-
* All node types in a tree.
|
|
93
|
-
* @template {UnistNode} Child
|
|
94
|
-
* Node to search for.
|
|
95
|
-
*/
|
|
96
|
-
/**
|
|
97
|
-
* @typedef {(
|
|
98
|
-
* Depth extends Max
|
|
99
|
-
* ? never
|
|
100
|
-
* :
|
|
101
|
-
* | InternalParent<Node, Child>
|
|
102
|
-
* | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>
|
|
103
|
-
* )} InternalAncestor
|
|
104
|
-
* Collect nodes in `Tree` that can be ancestors of `Child`.
|
|
105
|
-
* @template {UnistNode} Node
|
|
106
|
-
* All node types in a tree.
|
|
107
|
-
* @template {UnistNode} Child
|
|
108
|
-
* Node to search for.
|
|
109
|
-
* @template {Uint} [Max=10]
|
|
110
|
-
* Max; searches up to this depth.
|
|
111
|
-
* @template {Uint} [Depth=0]
|
|
112
|
-
* Current depth.
|
|
113
|
-
*/
|
|
114
|
-
/**
|
|
115
|
-
* @typedef {(
|
|
116
|
-
* Tree extends UnistParent
|
|
117
|
-
* ? Depth extends Max
|
|
118
|
-
* ? Tree
|
|
119
|
-
* : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
|
|
120
|
-
* : Tree
|
|
121
|
-
* )} InclusiveDescendant
|
|
122
|
-
* Collect all (inclusive) descendants of `Tree`.
|
|
123
|
-
*
|
|
124
|
-
* > 👉 **Note**: for performance reasons, this seems to be the fastest way to
|
|
125
|
-
* > recurse without actually running into an infinite loop, which the
|
|
126
|
-
* > previous version did.
|
|
127
|
-
* >
|
|
128
|
-
* > Practically, a max of `2` is typically enough assuming a `Root` is
|
|
129
|
-
* > passed, but it doesn’t improve performance.
|
|
130
|
-
* > It gets higher with `List > ListItem > Table > TableRow > TableCell`.
|
|
131
|
-
* > Using up to `10` doesn’t hurt or help either.
|
|
132
|
-
* @template {UnistNode} Tree
|
|
133
|
-
* Tree type.
|
|
134
|
-
* @template {Uint} [Max=10]
|
|
135
|
-
* Max; searches up to this depth.
|
|
136
|
-
* @template {Uint} [Depth=0]
|
|
137
|
-
* Current depth.
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* @callback Visitor
|
|
141
|
-
* Handle a node (matching `test`, if given).
|
|
142
|
-
*
|
|
143
|
-
* Visitors are free to transform `node`.
|
|
144
|
-
* They can also transform `parent`.
|
|
145
|
-
*
|
|
146
|
-
* Replacing `node` itself, if `SKIP` is not returned, still causes its
|
|
147
|
-
* descendants to be walked (which is a bug).
|
|
148
|
-
*
|
|
149
|
-
* When adding or removing previous siblings of `node` (or next siblings, in
|
|
150
|
-
* case of reverse), the `Visitor` should return a new `Index` to specify the
|
|
151
|
-
* sibling to traverse after `node` is traversed.
|
|
152
|
-
* Adding or removing next siblings of `node` (or previous siblings, in case
|
|
153
|
-
* of reverse) is handled as expected without needing to return a new `Index`.
|
|
154
|
-
*
|
|
155
|
-
* Removing the children property of `parent` still results in them being
|
|
156
|
-
* traversed.
|
|
157
|
-
* @param {Visited} node
|
|
158
|
-
* Found node.
|
|
159
|
-
* @param {Visited extends UnistNode ? number | undefined : never} index
|
|
160
|
-
* Index of `node` in `parent`.
|
|
161
|
-
* @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent
|
|
162
|
-
* Parent of `node`.
|
|
163
|
-
* @returns {VisitorResult}
|
|
164
|
-
* What to do next.
|
|
165
|
-
*
|
|
166
|
-
* An `Index` is treated as a tuple of `[CONTINUE, Index]`.
|
|
167
|
-
* An `Action` is treated as a tuple of `[Action]`.
|
|
168
|
-
*
|
|
169
|
-
* Passing a tuple back only makes sense if the `Action` is `SKIP`.
|
|
170
|
-
* When the `Action` is `EXIT`, that action can be returned.
|
|
171
|
-
* When the `Action` is `CONTINUE`, `Index` can be returned.
|
|
172
|
-
* @template {UnistNode} [Visited=UnistNode]
|
|
173
|
-
* Visited node type.
|
|
174
|
-
* @template {UnistParent} [Ancestor=UnistParent]
|
|
175
|
-
* Ancestor type.
|
|
176
|
-
*/
|
|
177
|
-
/**
|
|
178
|
-
* @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch
|
|
179
|
-
* Build a typed `Visitor` function from a node and all possible parents.
|
|
180
|
-
*
|
|
181
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
182
|
-
* @template {UnistNode} Visited
|
|
183
|
-
* Node type.
|
|
184
|
-
* @template {UnistParent} Ancestor
|
|
185
|
-
* Parent type.
|
|
186
|
-
*/
|
|
187
|
-
/**
|
|
188
|
-
* @typedef {(
|
|
189
|
-
* BuildVisitorFromMatch<
|
|
190
|
-
* Matches<Descendant, Check>,
|
|
191
|
-
* Extract<Descendant, UnistParent>
|
|
192
|
-
* >
|
|
193
|
-
* )} BuildVisitorFromDescendants
|
|
194
|
-
* Build a typed `Visitor` function from a list of descendants and a test.
|
|
195
|
-
*
|
|
196
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
197
|
-
* @template {UnistNode} Descendant
|
|
198
|
-
* Node type.
|
|
199
|
-
* @template {Test} Check
|
|
200
|
-
* Test type.
|
|
201
|
-
*/
|
|
202
|
-
/**
|
|
203
|
-
* @typedef {(
|
|
204
|
-
* BuildVisitorFromDescendants<
|
|
205
|
-
* InclusiveDescendant<Tree>,
|
|
206
|
-
* Check
|
|
207
|
-
* >
|
|
208
|
-
* )} BuildVisitor
|
|
209
|
-
* Build a typed `Visitor` function from a tree and a test.
|
|
210
|
-
*
|
|
211
|
-
* It will infer which values are passed as `node` and which as `parent`.
|
|
212
|
-
* @template {UnistNode} [Tree=UnistNode]
|
|
213
|
-
* Node type.
|
|
214
|
-
* @template {Test} [Check=Test]
|
|
215
|
-
* Test type.
|
|
216
|
-
*/
|
|
217
|
-
/**
|
|
218
|
-
* Visit nodes.
|
|
219
|
-
*
|
|
220
|
-
* This algorithm performs *depth-first* *tree traversal* in *preorder*
|
|
221
|
-
* (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
|
|
222
|
-
*
|
|
223
|
-
* You can choose for which nodes `visitor` is called by passing a `test`.
|
|
224
|
-
* For complex tests, you should test yourself in `visitor`, as it will be
|
|
225
|
-
* faster and will have improved type information.
|
|
226
|
-
*
|
|
227
|
-
* Walking the tree is an intensive task.
|
|
228
|
-
* Make use of the return values of the visitor when possible.
|
|
229
|
-
* Instead of walking a tree multiple times, walk it once, use `unist-util-is`
|
|
230
|
-
* to check if a node matches, and then perform different operations.
|
|
231
|
-
*
|
|
232
|
-
* You can change the tree.
|
|
233
|
-
* See `Visitor` for more info.
|
|
234
|
-
*
|
|
235
|
-
* @overload
|
|
236
|
-
* @param {Tree} tree
|
|
237
|
-
* @param {Check} check
|
|
238
|
-
* @param {BuildVisitor<Tree, Check>} visitor
|
|
239
|
-
* @param {boolean | null | undefined} [reverse]
|
|
240
|
-
* @returns {undefined}
|
|
241
|
-
*
|
|
242
|
-
* @overload
|
|
243
|
-
* @param {Tree} tree
|
|
244
|
-
* @param {BuildVisitor<Tree>} visitor
|
|
245
|
-
* @param {boolean | null | undefined} [reverse]
|
|
246
|
-
* @returns {undefined}
|
|
247
|
-
*
|
|
248
|
-
* @param {UnistNode} tree
|
|
249
|
-
* Tree to traverse.
|
|
250
|
-
* @param {Visitor | Test} testOrVisitor
|
|
251
|
-
* `unist-util-is`-compatible test (optional, omit to pass a visitor).
|
|
252
|
-
* @param {Visitor | boolean | null | undefined} [visitorOrReverse]
|
|
253
|
-
* Handle each node (when test is omitted, pass `reverse`).
|
|
254
|
-
* @param {boolean | null | undefined} [maybeReverse=false]
|
|
255
|
-
* Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
|
|
256
|
-
* @returns {undefined}
|
|
257
|
-
* Nothing.
|
|
258
|
-
*
|
|
259
|
-
* @template {UnistNode} Tree
|
|
260
|
-
* Node type.
|
|
261
|
-
* @template {Test} Check
|
|
262
|
-
* `unist-util-is`-compatible test.
|
|
263
|
-
*/
|
|
264
|
-
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
265
|
-
/** @type {boolean | null | undefined} */
|
|
266
|
-
let reverse;
|
|
267
|
-
/** @type {Test} */
|
|
268
|
-
let test;
|
|
269
|
-
/** @type {Visitor} */
|
|
270
|
-
let visitor;
|
|
271
|
-
if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
|
|
272
|
-
test = void 0;
|
|
273
|
-
visitor = testOrVisitor;
|
|
274
|
-
reverse = visitorOrReverse;
|
|
275
|
-
} else {
|
|
276
|
-
test = testOrVisitor;
|
|
277
|
-
visitor = visitorOrReverse;
|
|
278
|
-
reverse = maybeReverse;
|
|
279
|
-
}
|
|
280
|
-
visitParents(tree, test, overload, reverse);
|
|
281
|
-
/**
|
|
282
|
-
* @param {UnistNode} node
|
|
283
|
-
* @param {Array<UnistParent>} parents
|
|
284
|
-
*/
|
|
285
|
-
function overload(node, parents) {
|
|
286
|
-
const parent = parents[parents.length - 1];
|
|
287
|
-
const index = parent ? parent.children.indexOf(node) : void 0;
|
|
288
|
-
return visitor(node, index, parent);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
//#endregion
|
|
292
8
|
//#region node_modules/.pnpm/mdast-util-gfm-autolink-literal@2.0.1/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
|
|
293
9
|
/**
|
|
294
10
|
* @import {RegExpMatchObject, ReplaceFunction} from 'mdast-util-find-and-replace'
|
|
@@ -2343,4 +2059,4 @@ function gfmToMarkdown(options) {
|
|
|
2343
2059
|
] };
|
|
2344
2060
|
}
|
|
2345
2061
|
//#endregion
|
|
2346
|
-
export { gfmToMarkdown as n,
|
|
2062
|
+
export { gfmToMarkdown as n, gfmFromMarkdown as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "./devlop.mjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as pointEnd, n as visit, o as pointStart, s as position } from "./hast-util-raw+[...].mjs";
|
|
3
3
|
import { s as asciiAlphanumeric } from "./mdast-util-from-markdown+[...].mjs";
|
|
4
4
|
import { t as esm_default } from "./ungap__structured-clone.mjs";
|
|
5
|
-
import { r as visit } from "./mdast-util-gfm+[...].mjs";
|
|
6
5
|
//#region node_modules/.pnpm/micromark-util-sanitize-uri@2.0.1/node_modules/micromark-util-sanitize-uri/index.js
|
|
7
6
|
/**
|
|
8
7
|
* Normalize a URL.
|
|
@@ -2,10 +2,10 @@ import { i as __toESM } from "../_runtime.mjs";
|
|
|
2
2
|
import { X as require_react, Y as require_jsx_runtime } from "./@base-ui/react+[...].mjs";
|
|
3
3
|
import "./devlop.mjs";
|
|
4
4
|
import { n as VFileMessage, t as toJsxRuntime } from "./hast-util-to-jsx-runtime+[...].mjs";
|
|
5
|
+
import { n as visit } from "./hast-util-raw+[...].mjs";
|
|
5
6
|
import { t as urlAttributes } from "./html-url-attributes.mjs";
|
|
6
7
|
import { t as fromMarkdown } from "./mdast-util-from-markdown+[...].mjs";
|
|
7
8
|
import { t as toHast } from "./mdast-util-to-hast+[...].mjs";
|
|
8
|
-
import { r as visit } from "./mdast-util-gfm+[...].mjs";
|
|
9
9
|
import { t as bail } from "./bail.mjs";
|
|
10
10
|
import { t as require_extend } from "./extend.mjs";
|
|
11
11
|
import { t as isPlainObject } from "./is-plain-obj.mjs";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as raw } from "./hast-util-raw+[...].mjs";
|
|
2
|
+
//#region node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('hast').Root} Root
|
|
5
|
+
* @typedef {import('hast-util-raw').Options} RawOptions
|
|
6
|
+
* @typedef {import('vfile').VFile} VFile
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Omit<RawOptions, 'file'>} Options
|
|
10
|
+
* Configuration.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Parse the tree (and raw nodes) again, keeping positional info okay.
|
|
14
|
+
*
|
|
15
|
+
* @param {Options | null | undefined} [options]
|
|
16
|
+
* Configuration (optional).
|
|
17
|
+
* @returns
|
|
18
|
+
* Transform.
|
|
19
|
+
*/
|
|
20
|
+
function rehypeRaw(options) {
|
|
21
|
+
/**
|
|
22
|
+
* @param {Root} tree
|
|
23
|
+
* Tree.
|
|
24
|
+
* @param {VFile} file
|
|
25
|
+
* File.
|
|
26
|
+
* @returns {Root}
|
|
27
|
+
* New tree.
|
|
28
|
+
*/
|
|
29
|
+
return function(tree, file) {
|
|
30
|
+
return raw(tree, {
|
|
31
|
+
...options,
|
|
32
|
+
file
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { rehypeRaw as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as sanitize } from "./hast-util-sanitize.mjs";
|
|
2
|
+
//#region node_modules/.pnpm/rehype-sanitize@6.0.0/node_modules/rehype-sanitize/lib/index.js
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('hast').Root} Root
|
|
5
|
+
* @typedef {import('hast-util-sanitize').Schema} Schema
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sanitize HTML.
|
|
9
|
+
*
|
|
10
|
+
* @param {Schema | null | undefined} [options]
|
|
11
|
+
* Configuration (optional).
|
|
12
|
+
* @returns
|
|
13
|
+
* Transform.
|
|
14
|
+
*/
|
|
15
|
+
function rehypeSanitize(options) {
|
|
16
|
+
/**
|
|
17
|
+
* @param {Root} tree
|
|
18
|
+
* Tree.
|
|
19
|
+
* @returns {Root}
|
|
20
|
+
* New tree.
|
|
21
|
+
*/
|
|
22
|
+
return function(tree) {
|
|
23
|
+
return sanitize(tree, options);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { rehypeSanitize as t };
|