@longform/async 0.1.1 → 0.2.1
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 +9 -3
- package/dist/api-metadata.json +1202 -0
- package/dist/async.d.ts +626 -0
- package/dist/longform.cjs +11 -9
- package/dist/longform.cjs.map +1 -1
- package/dist/longform.d.ts +5 -5
- package/dist/longform.js +11 -9
- package/dist/longform.js.br +0 -0
- package/dist/longform.js.gz +0 -0
- package/dist/longform.js.map +1 -1
- package/dist/longform.min.js +1 -1
- package/dist/longform.min.js.br +0 -0
- package/dist/longform.min.js.gz +0 -0
- package/dist/longform.min.js.map +1 -1
- package/dist/mod.d.ts +563 -2
- package/dist/types.d.ts +29 -6
- package/lib/longform.ts +13 -10
- package/lib/types.ts +33 -6
- package/package.json +13 -4
package/lib/types.ts
CHANGED
|
@@ -67,7 +67,7 @@ export type WorkingFragment = {
|
|
|
67
67
|
html: string;
|
|
68
68
|
refs: FragmentRef[];
|
|
69
69
|
els: WorkingElement[];
|
|
70
|
-
|
|
70
|
+
mountpoints?: MountPoint[];
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -346,7 +346,7 @@ export type Directive = {
|
|
|
346
346
|
/**
|
|
347
347
|
* The global hook is not implemented.
|
|
348
348
|
*
|
|
349
|
-
* @internal
|
|
349
|
+
* @internal
|
|
350
350
|
*/
|
|
351
351
|
global?: (ctx: GlobalCtx) => void;
|
|
352
352
|
|
|
@@ -428,12 +428,12 @@ export type Annotation =
|
|
|
428
428
|
*
|
|
429
429
|
* `doc` Outputs all fragments normally.
|
|
430
430
|
*
|
|
431
|
-
* `head` Parses the
|
|
431
|
+
* `head` Parses the `\@id`, `\@type`, `\@lang`, `\@dir` and any directives
|
|
432
432
|
* implementing the `meta` directive hook. It exits as soon as it hits
|
|
433
433
|
* another directive type or fragment declaration.
|
|
434
434
|
*
|
|
435
|
-
* `mountable` Supports use of the
|
|
436
|
-
* into mountpoints. This output mode populates the `
|
|
435
|
+
* `mountable` Supports use of the `\@mount` directive for turning elements
|
|
436
|
+
* into mountpoints. This output mode populates the `mountpoints` array
|
|
437
437
|
* in the parse result. This array can be looped over and data from another
|
|
438
438
|
* rendering tool can mount its output into the named mount points. Once all
|
|
439
439
|
* mountpoint entries have been populated the `tail` property in the parsed
|
|
@@ -443,7 +443,7 @@ export type Annotation =
|
|
|
443
443
|
* supports documents implementing a single root element.
|
|
444
444
|
*
|
|
445
445
|
* `templates` parses every fragment as though it was a template even
|
|
446
|
-
* if the
|
|
446
|
+
* if the `\@template` directive is not used. This is useful for creating
|
|
447
447
|
* directives which use the block args to define a Longform template.
|
|
448
448
|
*/
|
|
449
449
|
export type OutputMode =
|
|
@@ -669,3 +669,30 @@ export type ParsedLongform = {
|
|
|
669
669
|
tail?: string;
|
|
670
670
|
};
|
|
671
671
|
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* An object containing a parsed Longform template.
|
|
675
|
+
*/
|
|
676
|
+
export type TemplateOutput = {
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* The Longform identifier for the element.
|
|
680
|
+
*/
|
|
681
|
+
id?: string;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* The fragment type.
|
|
685
|
+
*
|
|
686
|
+
* `root` indicates the template is a root fragments
|
|
687
|
+
* `embed` indicates the fragment has a unique embedded HTML id.
|
|
688
|
+
* `bare` indicates the fragment has no embedded HTML id.
|
|
689
|
+
* `range` indicates the fragment is a range of elements, instead of having a single top level element.
|
|
690
|
+
* `text` indicates the fragment is text only can can be used in situations where HTML might be invalid.
|
|
691
|
+
*/
|
|
692
|
+
type: 'root' | FragmentType;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* The fragment output as a string.
|
|
696
|
+
*/
|
|
697
|
+
html: string;
|
|
698
|
+
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Matthew Quinn",
|
|
5
5
|
"homepage": "https://github.com/occultist-dev/longform",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.2.1",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"HTML",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"types": "./dist/mod.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
+
"types": "./dist/mod.d.ts",
|
|
19
20
|
"import": "./dist/longform.js",
|
|
20
21
|
"require": "./dist/longform.cjs"
|
|
21
22
|
}
|
|
@@ -33,18 +34,24 @@
|
|
|
33
34
|
"licenses": [
|
|
34
35
|
{
|
|
35
36
|
"type": "MIT",
|
|
36
|
-
"url": "https://
|
|
37
|
+
"url": "https://codeberg.org/occultist/longform/blob/main/LICENSE"
|
|
37
38
|
}
|
|
38
39
|
],
|
|
39
40
|
"devDependencies": {
|
|
41
|
+
"@microsoft/api-extractor": "^7.58.10",
|
|
40
42
|
"@rollup/plugin-terser": "^1.0.0",
|
|
41
43
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
42
44
|
"@types/commonmark": "^0.27.10",
|
|
43
45
|
"@types/deno": "^2.5.0",
|
|
44
46
|
"@types/jsdom": "^27.0.0",
|
|
45
47
|
"@types/node": "^24.8.1",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
|
49
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
46
50
|
"commonmark": "^0.31.2",
|
|
47
51
|
"dompurify": "^3.4.1",
|
|
52
|
+
"eslint": "^10.7.0",
|
|
53
|
+
"eslint-plugin-tsdoc": "^0.5.2",
|
|
54
|
+
"eslint-watch": "^8.0.0",
|
|
48
55
|
"jsdom": "^27.0.1",
|
|
49
56
|
"marked": "^16.4.1",
|
|
50
57
|
"prettier": "^3.6.2",
|
|
@@ -64,7 +71,9 @@
|
|
|
64
71
|
"build": "node build.ts",
|
|
65
72
|
"bench": "deno bench --no-check --allow-read ./bench/longform.bench.ts",
|
|
66
73
|
"test": "node --test test/**/*.test.ts",
|
|
67
|
-
"serve": "node
|
|
68
|
-
"spec": "node
|
|
74
|
+
"serve": "node serve.ts",
|
|
75
|
+
"spec": "node spec.ts",
|
|
76
|
+
"tsdoc": "node --watch --watch-path=lib lint.ts",
|
|
77
|
+
"release": "./release.sh"
|
|
69
78
|
}
|
|
70
79
|
}
|