@art-md/constructs 0.0.3 → 0.0.5
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 +3 -3
- package/dist/factories/constructs/Document/factory/createDocument.d.ts +3 -0
- package/dist/factories/constructs/Document/factory/types.d.ts +4 -0
- package/dist/factories/constructs/Document/index.d.ts +2 -0
- package/dist/factories/constructs/FieldBlock/factory/createFieldBlock.d.ts +3 -0
- package/dist/factories/constructs/FieldBlock/factory/types.d.ts +7 -0
- package/dist/factories/constructs/FieldBlock/index.d.ts +3 -0
- package/dist/factories/constructs/FieldBlock/types.d.ts +9 -0
- package/dist/factories/constructs/FieldInline/factory/createFieldInline.d.ts +3 -0
- package/dist/factories/constructs/FieldInline/factory/types.d.ts +7 -0
- package/dist/factories/constructs/FieldInline/index.d.ts +3 -0
- package/dist/factories/constructs/FieldInline/types.d.ts +9 -0
- package/dist/factories/constructs/NaturalBlock/factory/createNaturalBlock.d.ts +3 -0
- package/dist/factories/constructs/NaturalBlock/factory/types.d.ts +11 -0
- package/dist/factories/constructs/NaturalBlock/index.d.ts +3 -0
- package/dist/factories/constructs/NaturalBlock/types.d.ts +12 -0
- package/dist/factories/constructs/NaturalExpression/factory/createNaturalExpression.d.ts +3 -0
- package/dist/factories/constructs/NaturalExpression/factory/types.d.ts +7 -0
- package/dist/factories/constructs/NaturalExpression/index.d.ts +3 -0
- package/dist/factories/constructs/NaturalExpression/types.d.ts +8 -0
- package/dist/factories/constructs/SectionBlock/factory/createSectionBlock.d.ts +3 -0
- package/dist/factories/constructs/SectionBlock/factory/types.d.ts +8 -0
- package/dist/factories/constructs/SectionBlock/index.d.ts +3 -0
- package/dist/factories/constructs/SectionBlock/types.d.ts +9 -0
- package/dist/factories/constructs/Tag/factory/createTag.d.ts +3 -0
- package/dist/factories/constructs/Tag/factory/types.d.ts +3 -0
- package/dist/factories/constructs/Tag/index.d.ts +3 -0
- package/dist/factories/constructs/Tag/types.d.ts +5 -0
- package/dist/factories/index.d.ts +8 -0
- package/dist/factories/public.d.ts +36 -0
- package/dist/factories/types.d.ts +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +627 -0
- package/dist/index.mjs.map +7 -0
- package/dist/parser/constructs/FieldBlock/createFieldBlockParser.d.ts +2 -0
- package/dist/parser/constructs/FieldBlock/index.d.ts +1 -0
- package/dist/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.d.ts +4 -0
- package/dist/parser/constructs/FieldBlock/private/helpers/onBeforeConstruct.d.ts +2 -0
- package/dist/parser/constructs/FieldBlock/private/index.d.ts +2 -0
- package/dist/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.d.ts +2 -0
- package/dist/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.d.ts +2 -0
- package/dist/parser/constructs/FieldInline/createFieldInlineParser.d.ts +2 -0
- package/dist/parser/constructs/FieldInline/index.d.ts +1 -0
- package/dist/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.d.ts +4 -0
- package/dist/parser/constructs/FieldInline/private/helpers/trimFieldEdges.d.ts +2 -0
- package/dist/parser/constructs/FieldInline/private/index.d.ts +1 -0
- package/dist/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.d.ts +2 -0
- package/dist/parser/constructs/NaturalBlock/createNaturalBlockParser.d.ts +2 -0
- package/dist/parser/constructs/NaturalBlock/index.d.ts +1 -0
- package/dist/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.d.ts +4 -0
- package/dist/parser/constructs/NaturalBlock/private/index.d.ts +1 -0
- package/dist/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.d.ts +2 -0
- package/dist/parser/constructs/SectionBlock/createSectionBlockParser.d.ts +2 -0
- package/dist/parser/constructs/SectionBlock/index.d.ts +1 -0
- package/dist/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.d.ts +4 -0
- package/dist/parser/constructs/SectionBlock/private/helpers/findParentSection.d.ts +3 -0
- package/dist/parser/constructs/SectionBlock/private/index.d.ts +2 -0
- package/dist/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.d.ts +2 -0
- package/dist/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.d.ts +2 -0
- package/dist/parser/document/createArtDocumentFromNode.d.ts +3 -0
- package/dist/parser/document/index.d.ts +1 -0
- package/dist/parser/fields/constants.d.ts +1 -0
- package/dist/parser/fields/index.d.ts +3 -0
- package/dist/parser/fields/isFieldStrong.d.ts +3 -0
- package/dist/parser/fields/stripStrong.d.ts +3 -0
- package/dist/parser/index.d.ts +6 -0
- package/dist/parser/mdast/index.d.ts +1 -0
- package/dist/parser/mdast/rawSlice.d.ts +2 -0
- package/dist/parser/naturalExpression/createNaturalExpressionFromNode.d.ts +3 -0
- package/dist/parser/naturalExpression/index.d.ts +1 -0
- package/dist/parser/public.d.ts +5 -0
- package/dist/parser/tags/extractTags.d.ts +5 -0
- package/dist/parser/tags/index.d.ts +1 -0
- package/dist/parser/types.d.ts +14 -0
- package/dist/serializer/constructs/Document/createDocumentToMdast.d.ts +2 -0
- package/dist/serializer/constructs/Document/index.d.ts +1 -0
- package/dist/serializer/constructs/FieldBlock/createFieldBlockToMdast.d.ts +2 -0
- package/dist/serializer/constructs/FieldBlock/index.d.ts +1 -0
- package/dist/serializer/constructs/FieldInline/createFieldInlineToMdast.d.ts +2 -0
- package/dist/serializer/constructs/FieldInline/index.d.ts +1 -0
- package/dist/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.d.ts +2 -0
- package/dist/serializer/constructs/NaturalBlock/index.d.ts +1 -0
- package/dist/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.d.ts +2 -0
- package/dist/serializer/constructs/NaturalExpression/index.d.ts +1 -0
- package/dist/serializer/constructs/SectionBlock/createSectionBlockToMdast.d.ts +2 -0
- package/dist/serializer/constructs/SectionBlock/index.d.ts +1 -0
- package/dist/serializer/index.d.ts +7 -0
- package/dist/serializer/public.d.ts +3 -0
- package/dist/serializer/tags/index.d.ts +2 -0
- package/dist/serializer/tags/tagToMdast.d.ts +3 -0
- package/dist/serializer/tags/tagsToMdast.d.ts +3 -0
- package/dist/serializer/types.d.ts +7 -0
- package/dist/test/helpers/constructs/FieldBlock/createFieldBlockFromNodeMock.d.ts +7 -0
- package/dist/test/helpers/constructs/FieldBlock/createFieldBlockMock.d.ts +7 -0
- package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockFixture.d.ts +9 -0
- package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockMock.d.ts +9 -0
- package/dist/test/helpers/constructs/FieldInline/createFieldInlineFromNodeMock.d.ts +7 -0
- package/dist/test/helpers/constructs/FieldInline/createFieldInlineMock.d.ts +7 -0
- package/dist/test/helpers/constructs/FieldInline/makeFieldInlineFixture.d.ts +9 -0
- package/dist/test/helpers/constructs/FieldInline/makeFieldInlineMock.d.ts +9 -0
- package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockFromNodeMock.d.ts +7 -0
- package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockMock.d.ts +7 -0
- package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockFixture.d.ts +12 -0
- package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockMock.d.ts +12 -0
- package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionFixture.d.ts +10 -0
- package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionMock.d.ts +10 -0
- package/dist/test/helpers/constructs/SectionBlock/createSectionBlockFromNodeMock.d.ts +7 -0
- package/dist/test/helpers/constructs/SectionBlock/createSectionBlockMock.d.ts +7 -0
- package/dist/test/helpers/constructs/SectionBlock/makeSectionBlockFixture.d.ts +10 -0
- package/dist/test/helpers/constructs/Tag/makeTagFixture.d.ts +7 -0
- package/dist/test/helpers/constructs/index.d.ts +14 -0
- package/dist/test/helpers/index.d.ts +2 -0
- package/dist/test/helpers/parsers/fields/stripStrongMock.d.ts +7 -0
- package/dist/test/helpers/parsers/index.d.ts +5 -0
- package/dist/test/helpers/parsers/mdast/rawSliceMock.d.ts +7 -0
- package/dist/test/helpers/parsers/natural-expression/createNaturalExpressionFromNodeMock.d.ts +7 -0
- package/dist/test/helpers/parsers/tags/extractTagsMock.d.ts +7 -0
- package/dist/test/helpers/parsers/tags/tagToMdastMock.d.ts +7 -0
- package/package.json +22 -4
- package/src/factories/constructs/Document/factory/createDocument.test.ts +2 -2
- package/src/factories/constructs/Document/factory/createDocument.ts +1 -1
- package/src/factories/constructs/Document/factory/types.ts +1 -1
- package/src/factories/constructs/Document/index.ts +2 -2
- package/src/factories/constructs/FieldBlock/factory/createFieldBlock.test.ts +2 -2
- package/src/factories/constructs/FieldBlock/factory/createFieldBlock.ts +2 -2
- package/src/factories/constructs/FieldBlock/factory/types.ts +2 -2
- package/src/factories/constructs/FieldBlock/index.ts +3 -3
- package/src/factories/constructs/FieldBlock/types.ts +2 -2
- package/src/factories/constructs/FieldInline/factory/createFieldInline.test.ts +2 -2
- package/src/factories/constructs/FieldInline/factory/createFieldInline.ts +2 -2
- package/src/factories/constructs/FieldInline/factory/types.ts +2 -2
- package/src/factories/constructs/FieldInline/index.ts +3 -3
- package/src/factories/constructs/FieldInline/types.ts +2 -2
- package/src/factories/constructs/NaturalBlock/factory/createNaturalBlock.test.ts +2 -2
- package/src/factories/constructs/NaturalBlock/factory/createNaturalBlock.ts +2 -2
- package/src/factories/constructs/NaturalBlock/factory/types.ts +1 -1
- package/src/factories/constructs/NaturalBlock/index.ts +3 -3
- package/src/factories/constructs/NaturalBlock/types.ts +1 -1
- package/src/factories/constructs/NaturalExpression/factory/createNaturalExpression.test.ts +2 -2
- package/src/factories/constructs/NaturalExpression/factory/createNaturalExpression.ts +2 -2
- package/src/factories/constructs/NaturalExpression/factory/types.ts +1 -1
- package/src/factories/constructs/NaturalExpression/index.ts +3 -3
- package/src/factories/constructs/SectionBlock/factory/createSectionBlock.test.ts +2 -4
- package/src/factories/constructs/SectionBlock/factory/createSectionBlock.ts +2 -3
- package/src/factories/constructs/SectionBlock/factory/types.ts +1 -2
- package/src/factories/constructs/SectionBlock/index.ts +3 -3
- package/src/factories/constructs/SectionBlock/types.ts +1 -2
- package/src/factories/constructs/Tag/factory/createTag.test.ts +1 -1
- package/src/factories/constructs/Tag/factory/createTag.ts +2 -2
- package/src/factories/constructs/Tag/index.ts +3 -3
- package/src/factories/index.ts +8 -8
- package/src/factories/public.ts +14 -14
- package/src/factories/types.ts +6 -6
- package/src/index.ts +3 -3
- package/src/parser/constructs/FieldBlock/createFieldBlockParser.test.ts +1 -1
- package/src/parser/constructs/FieldBlock/createFieldBlockParser.ts +2 -2
- package/src/parser/constructs/FieldBlock/index.ts +1 -1
- package/src/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.test.ts +4 -4
- package/src/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.ts +4 -4
- package/src/parser/constructs/FieldBlock/private/helpers/onBeforeConstruct.test.ts +1 -1
- package/src/parser/constructs/FieldBlock/private/index.ts +2 -2
- package/src/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.test.ts +4 -4
- package/src/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.ts +3 -3
- package/src/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.test.ts +4 -4
- package/src/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.ts +3 -3
- package/src/parser/constructs/FieldInline/createFieldInlineParser.test.ts +1 -1
- package/src/parser/constructs/FieldInline/createFieldInlineParser.ts +2 -2
- package/src/parser/constructs/FieldInline/index.ts +1 -1
- package/src/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.test.ts +4 -4
- package/src/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.ts +6 -6
- package/src/parser/constructs/FieldInline/private/helpers/trimFieldEdges.test.ts +2 -2
- package/src/parser/constructs/FieldInline/private/helpers/trimFieldEdges.ts +1 -1
- package/src/parser/constructs/FieldInline/private/index.ts +1 -1
- package/src/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.test.ts +4 -4
- package/src/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.ts +3 -3
- package/src/parser/constructs/NaturalBlock/createNaturalBlockParser.test.ts +1 -1
- package/src/parser/constructs/NaturalBlock/createNaturalBlockParser.ts +2 -2
- package/src/parser/constructs/NaturalBlock/index.ts +1 -1
- package/src/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.test.ts +4 -4
- package/src/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.ts +4 -4
- package/src/parser/constructs/NaturalBlock/private/index.ts +1 -1
- package/src/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.test.ts +4 -4
- package/src/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.ts +2 -2
- package/src/parser/constructs/SectionBlock/createSectionBlockParser.test.ts +1 -1
- package/src/parser/constructs/SectionBlock/createSectionBlockParser.ts +2 -2
- package/src/parser/constructs/SectionBlock/index.ts +1 -1
- package/src/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.test.ts +6 -6
- package/src/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.ts +4 -7
- package/src/parser/constructs/SectionBlock/private/helpers/findParentSection.test.ts +9 -3
- package/src/parser/constructs/SectionBlock/private/helpers/findParentSection.ts +1 -1
- package/src/parser/constructs/SectionBlock/private/index.ts +2 -2
- package/src/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.test.ts +6 -3
- package/src/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.ts +3 -3
- package/src/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.test.ts +4 -4
- package/src/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.ts +2 -2
- package/src/parser/document/createArtDocumentFromNode.test.ts +2 -2
- package/src/parser/document/createArtDocumentFromNode.ts +1 -1
- package/src/parser/document/index.ts +1 -1
- package/src/parser/fields/constants.test.ts +1 -1
- package/src/parser/fields/index.ts +3 -3
- package/src/parser/fields/isFieldStrong.test.ts +2 -2
- package/src/parser/fields/isFieldStrong.ts +2 -2
- package/src/parser/fields/stripStrong.test.ts +3 -3
- package/src/parser/fields/stripStrong.ts +1 -1
- package/src/parser/index.ts +6 -6
- package/src/parser/mdast/index.ts +1 -1
- package/src/parser/mdast/rawSlice.test.ts +1 -1
- package/src/parser/naturalExpression/createNaturalExpressionFromNode.test.ts +2 -7
- package/src/parser/naturalExpression/createNaturalExpressionFromNode.ts +2 -3
- package/src/parser/naturalExpression/index.ts +1 -1
- package/src/parser/public.ts +7 -7
- package/src/parser/tags/extractTags.test.ts +1 -1
- package/src/parser/tags/extractTags.ts +1 -1
- package/src/parser/tags/index.ts +1 -1
- package/src/parser/types.ts +1 -1
- package/src/serializer/constructs/Document/createDocumentToMdast.test.ts +1 -1
- package/src/serializer/constructs/Document/createDocumentToMdast.ts +1 -1
- package/src/serializer/constructs/Document/index.ts +1 -1
- package/src/serializer/constructs/FieldBlock/createFieldBlockToMdast.test.ts +2 -2
- package/src/serializer/constructs/FieldBlock/createFieldBlockToMdast.ts +3 -3
- package/src/serializer/constructs/FieldBlock/index.ts +1 -1
- package/src/serializer/constructs/FieldInline/createFieldInlineToMdast.test.ts +2 -2
- package/src/serializer/constructs/FieldInline/createFieldInlineToMdast.ts +3 -3
- package/src/serializer/constructs/FieldInline/index.ts +1 -1
- package/src/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.test.ts +2 -2
- package/src/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.ts +3 -3
- package/src/serializer/constructs/NaturalBlock/index.ts +1 -1
- package/src/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.test.ts +2 -2
- package/src/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.ts +2 -2
- package/src/serializer/constructs/NaturalExpression/index.ts +1 -1
- package/src/serializer/constructs/SectionBlock/createSectionBlockToMdast.test.ts +2 -2
- package/src/serializer/constructs/SectionBlock/createSectionBlockToMdast.ts +3 -3
- package/src/serializer/constructs/SectionBlock/index.ts +1 -1
- package/src/serializer/index.ts +7 -7
- package/src/serializer/public.ts +8 -8
- package/src/serializer/tags/index.ts +2 -2
- package/src/serializer/tags/tagToMdast.test.ts +1 -1
- package/src/serializer/tags/tagToMdast.ts +1 -1
- package/src/serializer/tags/tagsToMdast.test.ts +2 -2
- package/src/serializer/tags/tagsToMdast.ts +2 -2
- package/src/serializer/types.ts +1 -1
- package/src/test/helpers/constructs/FieldBlock/makeFieldBlockFixture.ts +1 -1
- package/src/test/helpers/constructs/FieldBlock/makeFieldBlockMock.ts +1 -1
- package/src/test/helpers/constructs/FieldInline/makeFieldInlineFixture.ts +1 -1
- package/src/test/helpers/constructs/FieldInline/makeFieldInlineMock.ts +1 -1
- package/src/test/helpers/constructs/NaturalBlock/makeNaturalBlockFixture.ts +1 -1
- package/src/test/helpers/constructs/NaturalBlock/makeNaturalBlockMock.ts +1 -1
- package/src/test/helpers/constructs/NaturalExpression/makeNaturalExpressionFixture.ts +1 -1
- package/src/test/helpers/constructs/NaturalExpression/makeNaturalExpressionMock.ts +1 -1
- package/src/test/helpers/constructs/SectionBlock/makeSectionBlockFixture.ts +1 -3
- package/src/test/helpers/constructs/Tag/makeTagFixture.ts +1 -1
- package/src/test/helpers/constructs/index.ts +14 -14
- package/src/test/helpers/index.ts +2 -2
- package/src/test/helpers/parsers/index.ts +5 -5
- package/src/parser/constructs/SectionBlock/private/constants.test.ts +0 -17
- package/src/parser/constructs/SectionBlock/private/constants.ts +0 -1
package/src/parser/public.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createFieldBlockParser } from './constructs/FieldBlock';
|
|
2
|
-
import { createFieldInlineParser } from './constructs/FieldInline';
|
|
3
|
-
import { createNaturalBlockParser } from './constructs/NaturalBlock';
|
|
4
|
-
import { createSectionBlockParser } from './constructs/SectionBlock';
|
|
5
|
-
import type { ConstructParserFactory } from './types';
|
|
1
|
+
import { createFieldBlockParser } from './constructs/FieldBlock/index.js';
|
|
2
|
+
import { createFieldInlineParser } from './constructs/FieldInline/index.js';
|
|
3
|
+
import { createNaturalBlockParser } from './constructs/NaturalBlock/index.js';
|
|
4
|
+
import { createSectionBlockParser } from './constructs/SectionBlock/index.js';
|
|
5
|
+
import type { ConstructParserFactory } from './types.js';
|
|
6
6
|
|
|
7
|
-
export { createArtDocumentFromNode } from './document/createArtDocumentFromNode';
|
|
7
|
+
export { createArtDocumentFromNode } from './document/createArtDocumentFromNode.js';
|
|
8
8
|
|
|
9
9
|
export const CONSTRUCT_PARSERS: ConstructParserFactory[] = [
|
|
10
10
|
createFieldBlockParser,
|
|
@@ -13,4 +13,4 @@ export const CONSTRUCT_PARSERS: ConstructParserFactory[] = [
|
|
|
13
13
|
];
|
|
14
14
|
export const DEFAULT_CONSTRUCT_PARSER = createNaturalBlockParser;
|
|
15
15
|
|
|
16
|
-
export type * from './types';
|
|
16
|
+
export type * from './types.js';
|
package/src/parser/tags/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { extractTags } from './extractTags';
|
|
1
|
+
export { extractTags } from './extractTags.js';
|
package/src/parser/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { MdastNode, ParserVisitContext } from '@art-md/primitives';
|
|
4
4
|
|
|
5
|
-
import type { Construct } from '../factories';
|
|
5
|
+
import type { Construct } from '../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export type ConstructProcessor = {
|
|
8
8
|
captureNode(context: ParserVisitContext, node: MdastNode): Construct | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Heading, Text } from 'mdast';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
3
|
|
|
4
|
-
import { createDocumentToMdast } from './createDocumentToMdast';
|
|
4
|
+
import { createDocumentToMdast } from './createDocumentToMdast.js';
|
|
5
5
|
|
|
6
6
|
describe('createDocumentToMdast', () => {
|
|
7
7
|
it('WHEN wrapping children in a root node', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createDocumentToMdast } from './createDocumentToMdast';
|
|
1
|
+
export { createDocumentToMdast } from './createDocumentToMdast.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Text } from 'mdast';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
3
|
|
|
4
|
-
import { makeFieldBlockFixture, makeTagFixture } from '../../../test/helpers';
|
|
4
|
+
import { makeFieldBlockFixture, makeTagFixture } from '../../../test/helpers/index.js';
|
|
5
5
|
|
|
6
|
-
import { createFieldBlockToMdast } from './createFieldBlockToMdast';
|
|
6
|
+
import { createFieldBlockToMdast } from './createFieldBlockToMdast.js';
|
|
7
7
|
|
|
8
8
|
describe('createFieldBlockToMdast', () => {
|
|
9
9
|
it('WHEN converting a FieldBlock to a label paragraph', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Node } from 'mdast';
|
|
2
2
|
|
|
3
|
-
import type { FieldBlock } from '../../../factories';
|
|
4
|
-
import { tagsToMdast } from '../../tags';
|
|
5
|
-
import type { ConstructSerializer } from '../../types';
|
|
3
|
+
import type { FieldBlock } from '../../../factories/index.js';
|
|
4
|
+
import { tagsToMdast } from '../../tags/index.js';
|
|
5
|
+
import type { ConstructSerializer } from '../../types.js';
|
|
6
6
|
|
|
7
7
|
export function createFieldBlockToMdast(): ConstructSerializer {
|
|
8
8
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createFieldBlockToMdast } from './createFieldBlockToMdast';
|
|
1
|
+
export { createFieldBlockToMdast } from './createFieldBlockToMdast.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { makeFieldInlineFixture, makeTagFixture } from '../../../test/helpers';
|
|
3
|
+
import { makeFieldInlineFixture, makeTagFixture } from '../../../test/helpers/index.js';
|
|
4
4
|
|
|
5
|
-
import { createFieldInlineToMdast } from './createFieldInlineToMdast';
|
|
5
|
+
import { createFieldInlineToMdast } from './createFieldInlineToMdast.js';
|
|
6
6
|
|
|
7
7
|
describe('createFieldInlineToMdast', () => {
|
|
8
8
|
it('WHEN converting a FieldInline to a paragraph with strong label', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Node } from 'mdast';
|
|
2
2
|
|
|
3
|
-
import type { FieldInline } from '../../../factories';
|
|
4
|
-
import { tagsToMdast } from '../../tags';
|
|
5
|
-
import type { ConstructSerializer } from '../../types';
|
|
3
|
+
import type { FieldInline } from '../../../factories/index.js';
|
|
4
|
+
import { tagsToMdast } from '../../tags/index.js';
|
|
5
|
+
import type { ConstructSerializer } from '../../types.js';
|
|
6
6
|
|
|
7
7
|
export function createFieldInlineToMdast(): ConstructSerializer {
|
|
8
8
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createFieldInlineToMdast } from './createFieldInlineToMdast';
|
|
1
|
+
export { createFieldInlineToMdast } from './createFieldInlineToMdast.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { makeNaturalBlockFixture, makeTagFixture } from '../../../test/helpers';
|
|
3
|
+
import { makeNaturalBlockFixture, makeTagFixture } from '../../../test/helpers/index.js';
|
|
4
4
|
|
|
5
|
-
import { createNaturalBlockToMdast } from './createNaturalBlockToMdast';
|
|
5
|
+
import { createNaturalBlockToMdast } from './createNaturalBlockToMdast.js';
|
|
6
6
|
|
|
7
7
|
describe('createNaturalBlockToMdast', () => {
|
|
8
8
|
it('WHEN parsing a text value into a root with paragraph', () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Node } from 'mdast';
|
|
2
2
|
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
3
3
|
|
|
4
|
-
import type { NaturalBlock } from '../../../factories';
|
|
5
|
-
import { tagsToMdast } from '../../tags';
|
|
6
|
-
import type { ConstructSerializer } from '../../types';
|
|
4
|
+
import type { NaturalBlock } from '../../../factories/index.js';
|
|
5
|
+
import { tagsToMdast } from '../../tags/index.js';
|
|
6
|
+
import type { ConstructSerializer } from '../../types.js';
|
|
7
7
|
|
|
8
8
|
export function createNaturalBlockToMdast(): ConstructSerializer {
|
|
9
9
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createNaturalBlockToMdast } from './createNaturalBlockToMdast';
|
|
1
|
+
export { createNaturalBlockToMdast } from './createNaturalBlockToMdast.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { makeNaturalExpressionFixture } from '../../../test/helpers';
|
|
3
|
+
import { makeNaturalExpressionFixture } from '../../../test/helpers/index.js';
|
|
4
4
|
|
|
5
|
-
import { createNaturalExpressionToMdast } from './createNaturalExpressionToMdast';
|
|
5
|
+
import { createNaturalExpressionToMdast } from './createNaturalExpressionToMdast.js';
|
|
6
6
|
|
|
7
7
|
describe('createNaturalExpressionToMdast', () => {
|
|
8
8
|
it('WHEN converting a NaturalExpression to an mdast node', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Node } from 'mdast';
|
|
2
2
|
|
|
3
|
-
import type { NaturalExpression } from '../../../factories';
|
|
4
|
-
import type { ConstructSerializer } from '../../types';
|
|
3
|
+
import type { NaturalExpression } from '../../../factories/index.js';
|
|
4
|
+
import type { ConstructSerializer } from '../../types.js';
|
|
5
5
|
|
|
6
6
|
export function createNaturalExpressionToMdast(): ConstructSerializer {
|
|
7
7
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createNaturalExpressionToMdast } from './createNaturalExpressionToMdast';
|
|
1
|
+
export { createNaturalExpressionToMdast } from './createNaturalExpressionToMdast.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { makeSectionBlockFixture, makeTagFixture } from '../../../test/helpers';
|
|
3
|
+
import { makeSectionBlockFixture, makeTagFixture } from '../../../test/helpers/index.js';
|
|
4
4
|
|
|
5
|
-
import { createSectionBlockToMdast } from './createSectionBlockToMdast';
|
|
5
|
+
import { createSectionBlockToMdast } from './createSectionBlockToMdast.js';
|
|
6
6
|
|
|
7
7
|
function stripPositions(node: unknown): unknown {
|
|
8
8
|
if (node === null || typeof node !== 'object') return node;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Node, RootContent } from 'mdast';
|
|
2
2
|
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
3
3
|
|
|
4
|
-
import type { SectionBlock } from '../../../factories';
|
|
5
|
-
import { tagsToMdast } from '../../tags';
|
|
6
|
-
import type { ConstructSerializer } from '../../types';
|
|
4
|
+
import type { SectionBlock } from '../../../factories/index.js';
|
|
5
|
+
import { tagsToMdast } from '../../tags/index.js';
|
|
6
|
+
import type { ConstructSerializer } from '../../types.js';
|
|
7
7
|
|
|
8
8
|
export function createSectionBlockToMdast(): ConstructSerializer {
|
|
9
9
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createSectionBlockToMdast } from './createSectionBlockToMdast';
|
|
1
|
+
export { createSectionBlockToMdast } from './createSectionBlockToMdast.js';
|
package/src/serializer/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './constructs/Document';
|
|
2
|
-
export * from './constructs/FieldBlock';
|
|
3
|
-
export * from './constructs/FieldInline';
|
|
4
|
-
export * from './constructs/NaturalBlock';
|
|
5
|
-
export * from './constructs/NaturalExpression';
|
|
6
|
-
export * from './constructs/SectionBlock';
|
|
1
|
+
export * from './constructs/Document/index.js';
|
|
2
|
+
export * from './constructs/FieldBlock/index.js';
|
|
3
|
+
export * from './constructs/FieldInline/index.js';
|
|
4
|
+
export * from './constructs/NaturalBlock/index.js';
|
|
5
|
+
export * from './constructs/NaturalExpression/index.js';
|
|
6
|
+
export * from './constructs/SectionBlock/index.js';
|
|
7
7
|
|
|
8
|
-
export type * from './types';
|
|
8
|
+
export type * from './types.js';
|
package/src/serializer/public.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createDocumentToMdast } from './constructs/Document';
|
|
2
|
-
import { createFieldBlockToMdast } from './constructs/FieldBlock';
|
|
3
|
-
import { createFieldInlineToMdast } from './constructs/FieldInline';
|
|
4
|
-
import { createNaturalBlockToMdast } from './constructs/NaturalBlock';
|
|
5
|
-
import { createNaturalExpressionToMdast } from './constructs/NaturalExpression';
|
|
6
|
-
import { createSectionBlockToMdast } from './constructs/SectionBlock';
|
|
7
|
-
import type { ConstructSerializerFactory } from './types';
|
|
1
|
+
import { createDocumentToMdast } from './constructs/Document/index.js';
|
|
2
|
+
import { createFieldBlockToMdast } from './constructs/FieldBlock/index.js';
|
|
3
|
+
import { createFieldInlineToMdast } from './constructs/FieldInline/index.js';
|
|
4
|
+
import { createNaturalBlockToMdast } from './constructs/NaturalBlock/index.js';
|
|
5
|
+
import { createNaturalExpressionToMdast } from './constructs/NaturalExpression/index.js';
|
|
6
|
+
import { createSectionBlockToMdast } from './constructs/SectionBlock/index.js';
|
|
7
|
+
import type { ConstructSerializerFactory } from './types.js';
|
|
8
8
|
|
|
9
9
|
export const CONSTRUCT_SERIALIZERS: ConstructSerializerFactory[] = [
|
|
10
10
|
createDocumentToMdast,
|
|
@@ -15,4 +15,4 @@ export const CONSTRUCT_SERIALIZERS: ConstructSerializerFactory[] = [
|
|
|
15
15
|
createSectionBlockToMdast,
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
-
export type * from './types';
|
|
18
|
+
export type * from './types.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { tagToMdast } from './tagToMdast';
|
|
2
|
-
export { tagsToMdast } from './tagsToMdast';
|
|
1
|
+
export { tagToMdast } from './tagToMdast.js';
|
|
2
|
+
export { tagsToMdast } from './tagsToMdast.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
2
|
|
|
3
|
-
import { tagToMdastMock } from '../../test/helpers';
|
|
3
|
+
import { tagToMdastMock } from '../../test/helpers/index.js';
|
|
4
4
|
|
|
5
|
-
import { tagsToMdast } from './tagsToMdast';
|
|
5
|
+
import { tagsToMdast } from './tagsToMdast.js';
|
|
6
6
|
|
|
7
7
|
vi.mock('./tagToMdast', () => {
|
|
8
8
|
return tagToMdastMock();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Text } from 'mdast';
|
|
2
2
|
|
|
3
|
-
import type { Tag } from '../../factories';
|
|
3
|
+
import type { Tag } from '../../factories/index.js';
|
|
4
4
|
|
|
5
|
-
import { tagToMdast } from './tagToMdast';
|
|
5
|
+
import { tagToMdast } from './tagToMdast.js';
|
|
6
6
|
|
|
7
7
|
export function tagsToMdast(tags: Tag[]): Text {
|
|
8
8
|
const value = tags.map(tag => tagToMdast(tag).value).join(' ');
|
package/src/serializer/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture FieldBlock of factory`libs/constructs/src/constructs/FieldBlock/factory/createFieldBlock.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { FieldBlock, Tag } from '../../../../factories';
|
|
5
|
+
import type { FieldBlock, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeFieldBlockFixture = (options?: {
|
|
8
8
|
name?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture FieldBlock of factory`libs/constructs/src/constructs/FieldBlock/private/factory/createFieldBlock.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { FieldBlock, Tag } from '../../../../factories';
|
|
5
|
+
import type { FieldBlock, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeFieldBlockMock = (options?: {
|
|
8
8
|
name?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture FieldInline of factory`libs/constructs/src/constructs/FieldInline/factory/createFieldInline.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { FieldInline, Tag } from '../../../../factories';
|
|
5
|
+
import type { FieldInline, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeFieldInlineFixture = (options?: {
|
|
8
8
|
name?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture FieldInline of factory`libs/constructs/src/constructs/FieldInline/private/factory/createFieldInline.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { FieldInline, Tag } from '../../../../factories';
|
|
5
|
+
import type { FieldInline, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeFieldInlineMock = (options?: {
|
|
8
8
|
name?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture NaturalBlock of factory`libs/constructs/src/constructs/NaturalBlock/factory/createNaturalBlock.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { NaturalBlock, Tag } from '../../../../factories';
|
|
5
|
+
import type { NaturalBlock, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeNaturalBlockFixture = (options?: {
|
|
8
8
|
value?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture NaturalBlock of factory`libs/constructs/src/constructs/NaturalBlock/private/factory/createNaturalBlock.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { NaturalBlock, Tag } from '../../../../factories';
|
|
5
|
+
import type { NaturalBlock, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeNaturalBlockMock = (options?: {
|
|
8
8
|
value?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture NaturalExpression of factory`libs/constructs/src/constructs/NaturalExpression/factory/createNaturalExpression.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { NaturalExpression } from '../../../../factories';
|
|
5
|
+
import type { NaturalExpression } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeNaturalExpressionFixture = (options?: {
|
|
8
8
|
type?: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture NaturalExpression of factory`libs/constructs/src/constructs/NaturalExpression/private/factory/createNaturalExpression.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { NaturalExpression } from '../../../../factories';
|
|
5
|
+
import type { NaturalExpression } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeNaturalExpressionMock = (options?: {
|
|
8
8
|
type?: string;
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* @fixture SectionBlock of factory`libs/constructs/src/constructs/SectionBlock/factory/createSectionBlock.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { SectionBlock, Tag } from '../../../../factories';
|
|
5
|
+
import type { SectionBlock, Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeSectionBlockFixture = (options?: {
|
|
8
8
|
name?: string;
|
|
9
9
|
depth?: number;
|
|
10
|
-
kind?: string;
|
|
11
10
|
children?: SectionBlock['children'];
|
|
12
11
|
tags?: Tag[];
|
|
13
12
|
}): SectionBlock => ({
|
|
@@ -15,6 +14,5 @@ export const makeSectionBlockFixture = (options?: {
|
|
|
15
14
|
name: options?.name ?? 'Test',
|
|
16
15
|
children: options?.children ?? [],
|
|
17
16
|
...(options?.depth !== undefined ? { depth: options.depth } : {}),
|
|
18
|
-
...(options?.kind !== undefined ? { kind: options.kind } : {}),
|
|
19
17
|
...(options?.tags !== undefined ? { tags: options.tags } : {}),
|
|
20
18
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fixture Tag of factory`libs/constructs/src/constructs/Tag/factory/createTag.ts`
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { Tag } from '../../../../factories';
|
|
5
|
+
import type { Tag } from '../../../../factories/index.js';
|
|
6
6
|
|
|
7
7
|
export const makeTagFixture = (options?: { name?: string }): Tag => ({
|
|
8
8
|
construct: 'Tag',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from './FieldBlock/createFieldBlockFromNodeMock';
|
|
2
|
-
export * from './FieldBlock/createFieldBlockMock';
|
|
3
|
-
export * from './FieldBlock/makeFieldBlockFixture';
|
|
4
|
-
export * from './FieldInline/createFieldInlineFromNodeMock';
|
|
5
|
-
export * from './FieldInline/createFieldInlineMock';
|
|
6
|
-
export * from './FieldInline/makeFieldInlineFixture';
|
|
7
|
-
export * from './NaturalBlock/createNaturalBlockFromNodeMock';
|
|
8
|
-
export * from './NaturalBlock/createNaturalBlockMock';
|
|
9
|
-
export * from './NaturalBlock/makeNaturalBlockFixture';
|
|
10
|
-
export * from './NaturalExpression/makeNaturalExpressionFixture';
|
|
11
|
-
export * from './SectionBlock/createSectionBlockFromNodeMock';
|
|
12
|
-
export * from './SectionBlock/createSectionBlockMock';
|
|
13
|
-
export * from './SectionBlock/makeSectionBlockFixture';
|
|
14
|
-
export * from './Tag/makeTagFixture';
|
|
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';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './constructs';
|
|
2
|
-
export * from './parsers';
|
|
1
|
+
export * from './constructs/index.js';
|
|
2
|
+
export * from './parsers/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './fields/stripStrongMock';
|
|
2
|
-
export * from './mdast/rawSliceMock';
|
|
3
|
-
export * from './natural-expression/createNaturalExpressionFromNodeMock';
|
|
4
|
-
export * from './tags/extractTagsMock';
|
|
5
|
-
export * from './tags/tagToMdastMock';
|
|
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';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { KIND_PATTERN } from './constants';
|
|
4
|
-
|
|
5
|
-
describe('KIND_PATTERN', () => {
|
|
6
|
-
it('WHEN matching a kind pattern', () => {
|
|
7
|
-
const result = 'Module: Hello'.match(KIND_PATTERN);
|
|
8
|
-
|
|
9
|
-
expect(result).toBeTruthy();
|
|
10
|
-
expect(result?.[1]).toBe('Module');
|
|
11
|
-
expect(result?.[2]).toBe('Hello');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('WHEN match text without colon does not', () => {
|
|
15
|
-
expect('Hello World'.match(KIND_PATTERN)).toBeFalsy();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const KIND_PATTERN = /^([\w-]+(?: [\w-]+)*):\s*(.+)$/;
|