@d10f/asciidoc-astro-loader 0.0.9 → 0.0.10
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/dist/{chunk-NC6IZHLR.js → chunk-SUQERYPQ.js} +12 -11
- package/dist/{index-DwboxIUQ.d.cts → index-C8nJcG2h.d.cts} +4 -0
- package/dist/{index-DwboxIUQ.d.ts → index-C8nJcG2h.d.ts} +4 -0
- package/dist/index.cjs +20 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -1
- package/dist/lib/asciidoc/converters/index.cjs +12 -11
- package/dist/lib/asciidoc/converters/index.d.cts +1 -1
- package/dist/lib/asciidoc/converters/index.d.ts +1 -1
- package/dist/lib/asciidoc/converters/index.js +1 -1
- package/dist/lib/asciidoc/templates/engines/index.d.cts +1 -1
- package/dist/lib/asciidoc/templates/engines/index.d.ts +1 -1
- package/dist/lib/shiki/transformers/index.d.cts +1 -1
- package/dist/lib/shiki/transformers/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -21,19 +21,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
21
21
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
22
22
|
})
|
|
23
23
|
});
|
|
24
|
-
if (templateEngine
|
|
25
|
-
const { extension } = splitFilenameComponents(
|
|
26
|
-
|
|
27
|
-
extension || ""
|
|
24
|
+
if (templateEngine) {
|
|
25
|
+
const { extension } = splitFilenameComponents(
|
|
26
|
+
template ?? ""
|
|
28
27
|
);
|
|
29
|
-
|
|
28
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
29
|
+
if (template) {
|
|
30
30
|
const templateFile = resolve(process.cwd(), template);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
32
|
+
}
|
|
33
|
+
if (engine) {
|
|
34
|
+
return engine.renderNode(node, {
|
|
35
|
+
content: output,
|
|
36
|
+
lang
|
|
37
|
+
});
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
return output;
|
|
@@ -317,6 +317,10 @@ declare class TemplateEngineRegistry {
|
|
|
317
317
|
* Returns the module that supports the given extension.
|
|
318
318
|
*/
|
|
319
319
|
getEngineByExtension(ext: string): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Returns the first module that supports the given context.
|
|
322
|
+
*/
|
|
323
|
+
getEngineByContext(context: NodeContext): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
324
|
/**
|
|
321
325
|
* Converts the provided node using one of the registered template
|
|
322
326
|
* engine modules. For more granular control, gain access to the
|
|
@@ -317,6 +317,10 @@ declare class TemplateEngineRegistry {
|
|
|
317
317
|
* Returns the module that supports the given extension.
|
|
318
318
|
*/
|
|
319
319
|
getEngineByExtension(ext: string): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Returns the first module that supports the given context.
|
|
322
|
+
*/
|
|
323
|
+
getEngineByContext(context: NodeContext): (AbstractEngine & AsciidocTemplate) | undefined;
|
|
320
324
|
/**
|
|
321
325
|
* Converts the provided node using one of the registered template
|
|
322
326
|
* engine modules. For more granular control, gain access to the
|
package/dist/index.cjs
CHANGED
|
@@ -193,6 +193,14 @@ var TemplateEngineRegistry = class _TemplateEngineRegistry {
|
|
|
193
193
|
(m) => m.extensions.includes(ext)
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Returns the first module that supports the given context.
|
|
198
|
+
*/
|
|
199
|
+
getEngineByContext(context) {
|
|
200
|
+
return _TemplateEngineRegistry.modules.find(
|
|
201
|
+
(m) => m.hasContext(context)
|
|
202
|
+
);
|
|
203
|
+
}
|
|
196
204
|
/**
|
|
197
205
|
* Converts the provided node using one of the registered template
|
|
198
206
|
* engine modules. For more granular control, gain access to the
|
|
@@ -570,19 +578,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
570
578
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
571
579
|
})
|
|
572
580
|
});
|
|
573
|
-
if (templateEngine
|
|
574
|
-
const { extension } = splitFilenameComponents(
|
|
575
|
-
|
|
576
|
-
extension || ""
|
|
581
|
+
if (templateEngine) {
|
|
582
|
+
const { extension } = splitFilenameComponents(
|
|
583
|
+
template ?? ""
|
|
577
584
|
);
|
|
578
|
-
|
|
585
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
586
|
+
if (template) {
|
|
579
587
|
const templateFile = (0, import_node_path2.resolve)(process.cwd(), template);
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
588
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
589
|
+
}
|
|
590
|
+
if (engine) {
|
|
591
|
+
return engine.renderNode(node, {
|
|
592
|
+
content: output,
|
|
593
|
+
lang
|
|
594
|
+
});
|
|
586
595
|
}
|
|
587
596
|
}
|
|
588
597
|
return output;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { A as AsciidocLoader } from './index-
|
|
3
|
-
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
2
|
+
import { A as AsciidocLoader } from './index-C8nJcG2h.cjs';
|
|
3
|
+
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-C8nJcG2h.cjs';
|
|
4
4
|
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.cjs';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LoaderContext } from 'astro/loaders';
|
|
2
|
-
import { A as AsciidocLoader } from './index-
|
|
3
|
-
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-
|
|
2
|
+
import { A as AsciidocLoader } from './index-C8nJcG2h.js';
|
|
3
|
+
export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-C8nJcG2h.js';
|
|
4
4
|
export { transformAsciidocCallout, transformerPrompt } from './lib/shiki/transformers/index.js';
|
|
5
5
|
import 'shiki';
|
|
6
6
|
import 'asciidoctor';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sourceCodeConverter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SUQERYPQ.js";
|
|
4
4
|
import {
|
|
5
5
|
transformAsciidocCallout,
|
|
6
6
|
transformerPrompt
|
|
@@ -155,6 +155,14 @@ var TemplateEngineRegistry = class _TemplateEngineRegistry {
|
|
|
155
155
|
(m) => m.extensions.includes(ext)
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Returns the first module that supports the given context.
|
|
160
|
+
*/
|
|
161
|
+
getEngineByContext(context) {
|
|
162
|
+
return _TemplateEngineRegistry.modules.find(
|
|
163
|
+
(m) => m.hasContext(context)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
158
166
|
/**
|
|
159
167
|
* Converts the provided node using one of the registered template
|
|
160
168
|
* engine modules. For more granular control, gain access to the
|
|
@@ -55,19 +55,20 @@ var sourceCodeConverter = (converterOptions) => {
|
|
|
55
55
|
return typeof transformer === "function" ? transformer(node) : transformer;
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
|
-
if (templateEngine
|
|
59
|
-
const { extension } = splitFilenameComponents(
|
|
60
|
-
|
|
61
|
-
extension || ""
|
|
58
|
+
if (templateEngine) {
|
|
59
|
+
const { extension } = splitFilenameComponents(
|
|
60
|
+
template ?? ""
|
|
62
61
|
);
|
|
63
|
-
|
|
62
|
+
const engine = extension ? templateEngine.getEngineByExtension(extension ?? "") : templateEngine.getEngineByContext(this.nodeContext);
|
|
63
|
+
if (template) {
|
|
64
64
|
const templateFile = (0, import_node_path.resolve)(process.cwd(), template);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
engine?.addContext(this.nodeContext, templateFile);
|
|
66
|
+
}
|
|
67
|
+
if (engine) {
|
|
68
|
+
return engine.renderNode(node, {
|
|
69
|
+
content: output,
|
|
70
|
+
lang
|
|
71
|
+
});
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
return output;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShikiTransformer } from 'shiki';
|
|
2
|
-
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-C8nJcG2h.cjs';
|
|
3
3
|
import 'asciidoctor';
|
|
4
4
|
import 'astro/zod';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ShikiTransformer } from 'shiki';
|
|
2
|
-
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-
|
|
2
|
+
import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-C8nJcG2h.js';
|
|
3
3
|
import 'asciidoctor';
|
|
4
4
|
import 'astro/zod';
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-
|
|
1
|
+
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-C8nJcG2h.cjs';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-
|
|
1
|
+
import { b as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-C8nJcG2h.js';
|
|
2
2
|
import { AbstractBlock } from 'asciidoctor';
|
|
3
3
|
import 'shiki';
|
|
4
4
|
import 'astro/zod';
|