@art-md/constructs 0.0.4 → 0.0.6

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.
Files changed (133) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +1 -1
  3. package/dist/factories/constructs/Document/factory/createDocument.d.ts +3 -0
  4. package/dist/factories/constructs/Document/factory/types.d.ts +4 -0
  5. package/dist/factories/constructs/Document/index.d.ts +2 -0
  6. package/dist/factories/constructs/FieldBlock/factory/createFieldBlock.d.ts +3 -0
  7. package/dist/factories/constructs/FieldBlock/factory/types.d.ts +7 -0
  8. package/dist/factories/constructs/FieldBlock/index.d.ts +3 -0
  9. package/dist/factories/constructs/FieldBlock/types.d.ts +9 -0
  10. package/dist/factories/constructs/FieldInline/factory/createFieldInline.d.ts +3 -0
  11. package/dist/factories/constructs/FieldInline/factory/types.d.ts +7 -0
  12. package/dist/factories/constructs/FieldInline/index.d.ts +3 -0
  13. package/dist/factories/constructs/FieldInline/types.d.ts +9 -0
  14. package/dist/factories/constructs/NaturalBlock/factory/createNaturalBlock.d.ts +3 -0
  15. package/dist/factories/constructs/NaturalBlock/factory/types.d.ts +11 -0
  16. package/dist/factories/constructs/NaturalBlock/index.d.ts +3 -0
  17. package/dist/factories/constructs/NaturalBlock/types.d.ts +12 -0
  18. package/dist/factories/constructs/NaturalExpression/factory/createNaturalExpression.d.ts +3 -0
  19. package/dist/factories/constructs/NaturalExpression/factory/types.d.ts +7 -0
  20. package/dist/factories/constructs/NaturalExpression/index.d.ts +3 -0
  21. package/dist/factories/constructs/NaturalExpression/types.d.ts +8 -0
  22. package/dist/factories/constructs/SectionBlock/factory/createSectionBlock.d.ts +3 -0
  23. package/dist/factories/constructs/SectionBlock/factory/types.d.ts +8 -0
  24. package/dist/factories/constructs/SectionBlock/index.d.ts +3 -0
  25. package/dist/factories/constructs/SectionBlock/types.d.ts +9 -0
  26. package/dist/factories/constructs/Tag/factory/createTag.d.ts +3 -0
  27. package/dist/factories/constructs/Tag/factory/types.d.ts +3 -0
  28. package/dist/factories/constructs/Tag/index.d.ts +3 -0
  29. package/dist/factories/constructs/Tag/types.d.ts +5 -0
  30. package/dist/factories/index.d.ts +8 -0
  31. package/dist/factories/public.d.ts +36 -0
  32. package/dist/factories/types.d.ts +31 -0
  33. package/dist/index.d.ts +3 -0
  34. package/dist/index.mjs +627 -0
  35. package/dist/index.mjs.map +7 -0
  36. package/dist/parser/constructs/FieldBlock/createFieldBlockParser.d.ts +2 -0
  37. package/dist/parser/constructs/FieldBlock/index.d.ts +1 -0
  38. package/dist/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.d.ts +4 -0
  39. package/dist/parser/constructs/FieldBlock/private/helpers/onBeforeConstruct.d.ts +2 -0
  40. package/dist/parser/constructs/FieldBlock/private/index.d.ts +2 -0
  41. package/dist/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.d.ts +2 -0
  42. package/dist/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.d.ts +2 -0
  43. package/dist/parser/constructs/FieldInline/createFieldInlineParser.d.ts +2 -0
  44. package/dist/parser/constructs/FieldInline/index.d.ts +1 -0
  45. package/dist/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.d.ts +4 -0
  46. package/dist/parser/constructs/FieldInline/private/helpers/trimFieldEdges.d.ts +2 -0
  47. package/dist/parser/constructs/FieldInline/private/index.d.ts +1 -0
  48. package/dist/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.d.ts +2 -0
  49. package/dist/parser/constructs/NaturalBlock/createNaturalBlockParser.d.ts +2 -0
  50. package/dist/parser/constructs/NaturalBlock/index.d.ts +1 -0
  51. package/dist/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.d.ts +4 -0
  52. package/dist/parser/constructs/NaturalBlock/private/index.d.ts +1 -0
  53. package/dist/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.d.ts +2 -0
  54. package/dist/parser/constructs/SectionBlock/createSectionBlockParser.d.ts +2 -0
  55. package/dist/parser/constructs/SectionBlock/index.d.ts +1 -0
  56. package/dist/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.d.ts +4 -0
  57. package/dist/parser/constructs/SectionBlock/private/helpers/findParentSection.d.ts +3 -0
  58. package/dist/parser/constructs/SectionBlock/private/index.d.ts +2 -0
  59. package/dist/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.d.ts +2 -0
  60. package/dist/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.d.ts +2 -0
  61. package/dist/parser/document/createArtDocumentFromNode.d.ts +3 -0
  62. package/dist/parser/document/index.d.ts +1 -0
  63. package/dist/parser/fields/constants.d.ts +1 -0
  64. package/dist/parser/fields/index.d.ts +3 -0
  65. package/dist/parser/fields/isFieldStrong.d.ts +3 -0
  66. package/dist/parser/fields/stripStrong.d.ts +3 -0
  67. package/dist/parser/index.d.ts +6 -0
  68. package/dist/parser/mdast/index.d.ts +1 -0
  69. package/dist/parser/mdast/rawSlice.d.ts +2 -0
  70. package/dist/parser/naturalExpression/createNaturalExpressionFromNode.d.ts +3 -0
  71. package/dist/parser/naturalExpression/index.d.ts +1 -0
  72. package/dist/parser/public.d.ts +5 -0
  73. package/dist/parser/tags/extractTags.d.ts +5 -0
  74. package/dist/parser/tags/index.d.ts +1 -0
  75. package/dist/parser/types.d.ts +14 -0
  76. package/dist/serializer/constructs/Document/createDocumentToMdast.d.ts +2 -0
  77. package/dist/serializer/constructs/Document/index.d.ts +1 -0
  78. package/dist/serializer/constructs/FieldBlock/createFieldBlockToMdast.d.ts +2 -0
  79. package/dist/serializer/constructs/FieldBlock/index.d.ts +1 -0
  80. package/dist/serializer/constructs/FieldInline/createFieldInlineToMdast.d.ts +2 -0
  81. package/dist/serializer/constructs/FieldInline/index.d.ts +1 -0
  82. package/dist/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.d.ts +2 -0
  83. package/dist/serializer/constructs/NaturalBlock/index.d.ts +1 -0
  84. package/dist/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.d.ts +2 -0
  85. package/dist/serializer/constructs/NaturalExpression/index.d.ts +1 -0
  86. package/dist/serializer/constructs/SectionBlock/createSectionBlockToMdast.d.ts +2 -0
  87. package/dist/serializer/constructs/SectionBlock/index.d.ts +1 -0
  88. package/dist/serializer/index.d.ts +7 -0
  89. package/dist/serializer/public.d.ts +3 -0
  90. package/dist/serializer/tags/index.d.ts +2 -0
  91. package/dist/serializer/tags/tagToMdast.d.ts +3 -0
  92. package/dist/serializer/tags/tagsToMdast.d.ts +3 -0
  93. package/dist/serializer/types.d.ts +7 -0
  94. package/dist/test/helpers/constructs/FieldBlock/createFieldBlockFromNodeMock.d.ts +7 -0
  95. package/dist/test/helpers/constructs/FieldBlock/createFieldBlockMock.d.ts +7 -0
  96. package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockFixture.d.ts +9 -0
  97. package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockMock.d.ts +9 -0
  98. package/dist/test/helpers/constructs/FieldInline/createFieldInlineFromNodeMock.d.ts +7 -0
  99. package/dist/test/helpers/constructs/FieldInline/createFieldInlineMock.d.ts +7 -0
  100. package/dist/test/helpers/constructs/FieldInline/makeFieldInlineFixture.d.ts +9 -0
  101. package/dist/test/helpers/constructs/FieldInline/makeFieldInlineMock.d.ts +9 -0
  102. package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockFromNodeMock.d.ts +7 -0
  103. package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockMock.d.ts +7 -0
  104. package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockFixture.d.ts +12 -0
  105. package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockMock.d.ts +12 -0
  106. package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionFixture.d.ts +10 -0
  107. package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionMock.d.ts +10 -0
  108. package/dist/test/helpers/constructs/SectionBlock/createSectionBlockFromNodeMock.d.ts +7 -0
  109. package/dist/test/helpers/constructs/SectionBlock/createSectionBlockMock.d.ts +7 -0
  110. package/dist/test/helpers/constructs/SectionBlock/makeSectionBlockFixture.d.ts +10 -0
  111. package/dist/test/helpers/constructs/Tag/makeTagFixture.d.ts +7 -0
  112. package/dist/test/helpers/constructs/index.d.ts +14 -0
  113. package/dist/test/helpers/index.d.ts +2 -0
  114. package/dist/test/helpers/parsers/fields/stripStrongMock.d.ts +7 -0
  115. package/dist/test/helpers/parsers/index.d.ts +5 -0
  116. package/dist/test/helpers/parsers/mdast/rawSliceMock.d.ts +7 -0
  117. package/dist/test/helpers/parsers/natural-expression/createNaturalExpressionFromNodeMock.d.ts +7 -0
  118. package/dist/test/helpers/parsers/tags/extractTagsMock.d.ts +7 -0
  119. package/dist/test/helpers/parsers/tags/tagToMdastMock.d.ts +7 -0
  120. package/package.json +34 -15
  121. package/src/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.test.ts +1 -1
  122. package/src/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.test.ts +1 -1
  123. package/src/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.test.ts +1 -1
  124. package/src/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.test.ts +1 -1
  125. package/src/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.test.ts +1 -1
  126. package/src/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.test.ts +1 -1
  127. package/src/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.test.ts +1 -1
  128. package/src/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.test.ts +1 -1
  129. package/src/parser/constructs/SectionBlock/private/helpers/findParentSection.test.ts +1 -1
  130. package/src/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.test.ts +1 -1
  131. package/src/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.test.ts +1 -1
  132. package/src/parser/document/createArtDocumentFromNode.test.ts +1 -1
  133. package/src/parser/naturalExpression/createNaturalExpressionFromNode.test.ts +1 -6
@@ -0,0 +1,14 @@
1
+ export * from './FieldBlock/createFieldBlockFromNodeMock.js';
2
+ export * from './FieldBlock/createFieldBlockMock.js';
3
+ export * from './FieldBlock/makeFieldBlockFixture.js';
4
+ export * from './FieldInline/createFieldInlineFromNodeMock.js';
5
+ export * from './FieldInline/createFieldInlineMock.js';
6
+ export * from './FieldInline/makeFieldInlineFixture.js';
7
+ export * from './NaturalBlock/createNaturalBlockFromNodeMock.js';
8
+ export * from './NaturalBlock/createNaturalBlockMock.js';
9
+ export * from './NaturalBlock/makeNaturalBlockFixture.js';
10
+ export * from './NaturalExpression/makeNaturalExpressionFixture.js';
11
+ export * from './SectionBlock/createSectionBlockFromNodeMock.js';
12
+ export * from './SectionBlock/createSectionBlockMock.js';
13
+ export * from './SectionBlock/makeSectionBlockFixture.js';
14
+ export * from './Tag/makeTagFixture.js';
@@ -0,0 +1,2 @@
1
+ export * from './constructs/index.js';
2
+ export * from './parsers/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks stripStrong() from `src/parsers/fields`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const stripStrongMock: (returnValue?: string) => {
6
+ stripStrong: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,5 @@
1
+ export * from './fields/stripStrongMock.js';
2
+ export * from './mdast/rawSliceMock.js';
3
+ export * from './natural-expression/createNaturalExpressionFromNodeMock.js';
4
+ export * from './tags/extractTagsMock.js';
5
+ export * from './tags/tagToMdastMock.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks rawSlice() from `src/parsers/mdast`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const rawSliceMock: (returnValue?: string) => {
6
+ rawSlice: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createNaturalExpressionFromNode() from `src/parsers/NaturalExpression/private/helpers`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createNaturalExpressionFromNodeMock: () => {
6
+ createNaturalExpressionFromNode: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks extractTags() from `src/parsers/tags`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const extractTagsMock: (tags?: unknown[], stripped?: string) => {
6
+ extractTags: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks tagToMdast() from `src/serializers/tags`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const tagToMdastMock: () => {
6
+ tagToMdast: ReturnType<typeof vi.fn>;
7
+ };
package/package.json CHANGED
@@ -1,31 +1,48 @@
1
1
  {
2
2
  "name": "@art-md/constructs",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Construct factories for Art parser records.",
5
5
  "keywords": [
6
- "art",
6
+ "library",
7
7
  "constructs",
8
- "parser"
8
+ "art",
9
+ "markdown",
10
+ "ast",
11
+ "structured-data",
12
+ "agent-instructions"
9
13
  ],
10
14
  "author": "Noodlestan Collective",
11
15
  "license": "MIT",
12
- "private": false,
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/noodlestan/art-md",
18
+ "url": "https://github.com/noodlestan/art-md.git",
19
19
  "directory": "libs/constructs/"
20
20
  },
21
- "type": "module",
22
- "sideEffects": false,
23
- "main": "./src/index.ts",
21
+ "private": false,
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
24
25
  "files": [
25
26
  "src",
27
+ "dist",
28
+ "README.md",
26
29
  "LICENSE-MIT",
27
- "README.md"
30
+ "CHANGELOG.md"
28
31
  ],
32
+ "engines": {
33
+ "node": ">=22"
34
+ },
35
+ "type": "module",
36
+ "sideEffects": false,
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.mjs"
41
+ },
42
+ "./test-helpers/*": {
43
+ "import": "./src/test/helpers/*"
44
+ }
45
+ },
29
46
  "scripts": {
30
47
  "dev": "esbuild-cli-watch",
31
48
  "lint": "prettier . -c && eslint . && tsc --noEmit",
@@ -39,10 +56,12 @@
39
56
  },
40
57
  "dependencies": {
41
58
  "@art-md/primitives": "*",
42
- "mdast-util-from-markdown": "^2.0.0",
43
- "mdast-util-phrasing": "^4.1.0"
59
+ "mdast-util-from-markdown": "2.1.0",
60
+ "mdast-util-phrasing": "4.1.0"
44
61
  },
45
62
  "devDependencies": {
46
- "vitest": "4.1.8"
63
+ "@types/mdast": "4.0.4",
64
+ "@types/unist": "3.0.3",
65
+ "vitest": "5.0.5"
47
66
  }
48
67
  }
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import type { Paragraph } from 'mdast';
3
3
  import { fromMarkdown } from 'mdast-util-from-markdown';
4
4
  import { describe, expect, it, vi } from 'vitest';
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { makeFieldBlockFixture } from '../../../../../test/helpers/index.js';
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { fromMarkdown } from 'mdast-util-from-markdown';
3
3
  import { describe, expect, it, vi } from 'vitest';
4
4
 
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { fromMarkdown } from 'mdast-util-from-markdown';
3
3
  import { describe, expect, it, vi } from 'vitest';
4
4
 
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { fromMarkdown } from 'mdast-util-from-markdown';
3
3
  import { describe, expect, it, vi } from 'vitest';
4
4
 
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import type { Node } from 'mdast';
3
3
  import { fromMarkdown } from 'mdast-util-from-markdown';
4
4
  import { describe, expect, it, vi } from 'vitest';
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { createNaturalBlockFromNodeMock } from '../../../../../test/helpers/index.js';
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import type { Heading } from 'mdast';
3
3
  import { fromMarkdown } from 'mdast-util-from-markdown';
4
4
  import { describe, expect, it, vi } from 'vitest';
@@ -2,7 +2,7 @@ import type { ParserVisitContext } from '@art-md/primitives';
2
2
  import {
3
3
  makeDocumentMock,
4
4
  makeParserVisitContextMock,
5
- } from '@art-md/primitives/src/test/helpers/index.js';
5
+ } from '@art-md/primitives/test-helpers/index.js';
6
6
  import { describe, expect, it } from 'vitest';
7
7
 
8
8
  import {
@@ -2,7 +2,7 @@ import { createParserVisitContext } from '@art-md/primitives';
2
2
  import {
3
3
  makeDocumentMock,
4
4
  makeParserVisitContextMock,
5
- } from '@art-md/primitives/src/test/helpers/index.js';
5
+ } from '@art-md/primitives/test-helpers/index.js';
6
6
  import type { Heading } from 'mdast';
7
7
  import { fromMarkdown } from 'mdast-util-from-markdown';
8
8
  import { describe, expect, it, vi } from 'vitest';
@@ -1,4 +1,4 @@
1
- import { makeParserVisitContextMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { makeParserVisitContextMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { createSectionBlockFromNodeMock } from '../../../../../test/helpers/index.js';
@@ -1,4 +1,4 @@
1
- import { nodePositionMock } from '@art-md/primitives/src/test/helpers/index.js';
1
+ import { nodePositionMock } from '@art-md/primitives/test-helpers/index.js';
2
2
  import { describe, expect, it, vi } from 'vitest';
3
3
 
4
4
  import { createArtDocumentFromNode } from './createArtDocumentFromNode.js';
@@ -1,13 +1,8 @@
1
1
  import type { MdastNode } from '@art-md/primitives';
2
- import { nodePositionMock } from '@art-md/primitives/src/test/helpers/index.js';
3
- import { describe, expect, it, vi } from 'vitest';
2
+ import { describe, expect, it } from 'vitest';
4
3
 
5
4
  import { createNaturalExpressionFromNode } from './createNaturalExpressionFromNode.js';
6
5
 
7
- vi.mock('@art-md/primitives/src/parser/helpers', () => {
8
- return nodePositionMock();
9
- });
10
-
11
6
  describe('createNaturalExpressionFronNode', () => {
12
7
  it('WHEN creating a NaturalExpression from a node', async () => {
13
8
  const node = {