@d10f/asciidoc-astro-loader 0.0.5 → 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.
package/README.md CHANGED
@@ -19,7 +19,7 @@ This package will allow you to load Asciidoc files (with either an `.asciidoc` o
19
19
 
20
20
  Install the package from `npm`:
21
21
 
22
- ```console
22
+ ```
23
23
  npm install @d10f/asciidoc-astro-loader
24
24
  ```
25
25
 
@@ -151,7 +151,7 @@ const blog = defineCollection({
151
151
  base: ".src/content/blog",
152
152
  syntaxHighlighting: {
153
153
  transformers: [
154
- transformerAsciidocSomethign({
154
+ transformerAsciidocSomething({
155
155
  cssClasses: 'text-red-500'
156
156
  }),
157
157
  ],
@@ -125,8 +125,29 @@ var NunjucksEngine = class extends AbstractEngine {
125
125
  }
126
126
  };
127
127
 
128
+ // src/lib/asciidoc/templates/engines/TemplateStr.ts
129
+ var TemplateStr = class extends AbstractEngine {
130
+ renderMap;
131
+ constructor(name = "templateStr", extensions = ["ts", "js"]) {
132
+ super(name, extensions);
133
+ this.renderMap = /* @__PURE__ */ new Map();
134
+ }
135
+ async load() {
136
+ for (const [context, path] of this.templateList.entries()) {
137
+ const templateFn = await import(path);
138
+ this.renderMap.set(context, templateFn.default);
139
+ }
140
+ }
141
+ renderNode(node, options) {
142
+ const context = node.getNodeName();
143
+ const renderFn = this.renderMap.get(context);
144
+ return renderFn ? renderFn(node, options) : "";
145
+ }
146
+ };
147
+
128
148
  export {
129
149
  AbstractEngine,
130
150
  HandlebarsEngine,
131
- NunjucksEngine
151
+ NunjucksEngine,
152
+ TemplateStr
132
153
  };
@@ -542,4 +542,4 @@ interface RawTemplate {
542
542
  renderString(content: string, options?: Record<string, unknown>): string;
543
543
  }
544
544
 
545
- export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactory as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactoryFn as b, AbstractEngine as c };
545
+ export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactoryFn as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactory as b, AbstractEngine as c };
@@ -542,4 +542,4 @@ interface RawTemplate {
542
542
  renderString(content: string, options?: Record<string, unknown>): string;
543
543
  }
544
544
 
545
- export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactory as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactoryFn as b, AbstractEngine as c };
545
+ export { type AsciidocLoader as A, type CustomConverterFactoryFn as C, type FilesystemTemplate as F, type NodeContext as N, type RawTemplate as R, type ShikiTransformerFactoryFn as S, type TemplateModule as T, type AsciidocTemplate as a, type ShikiTransformerFactory as b, AbstractEngine as c };
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LoaderContext } from 'astro/loaders';
2
- import { A as AsciidocLoader } from './index-R3g0cYiE.cjs';
3
- export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-R3g0cYiE.cjs';
2
+ import { A as AsciidocLoader } from './index-CS3PBqxf.cjs';
3
+ export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-CS3PBqxf.cjs';
4
4
  import 'shiki';
5
5
  import 'asciidoctor';
6
6
  import 'astro/zod';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LoaderContext } from 'astro/loaders';
2
- import { A as AsciidocLoader } from './index-R3g0cYiE.js';
3
- export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-R3g0cYiE.js';
2
+ import { A as AsciidocLoader } from './index-CS3PBqxf.js';
3
+ export { a as AsciidocTemplate, C as CustomConverterFactoryFn, F as FilesystemTemplate, N as NodeContext, R as RawTemplate } from './index-CS3PBqxf.js';
4
4
  import 'shiki';
5
5
  import 'asciidoctor';
6
6
  import 'astro/zod';
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import {
2
- transformAsciidocCallout
3
- } from "./chunk-5P6LDJGO.js";
4
1
  import {
5
2
  sourceCodeConverter
6
3
  } from "./chunk-NC6IZHLR.js";
4
+ import {
5
+ transformAsciidocCallout
6
+ } from "./chunk-5P6LDJGO.js";
7
7
  import {
8
8
  slugify,
9
9
  splitFilenameComponents
10
10
  } from "./chunk-2UGTFP4R.js";
11
11
  import {
12
- AbstractEngine,
13
12
  HandlebarsEngine,
14
- NunjucksEngine
15
- } from "./chunk-2F52PMNV.js";
13
+ NunjucksEngine,
14
+ TemplateStr
15
+ } from "./chunk-HVA4AVUD.js";
16
16
 
17
17
  // src/loader.ts
18
18
  import { readdirSync as readdirSync2, realpathSync } from "fs";
@@ -259,26 +259,6 @@ var AsciidocDocument = class {
259
259
  }
260
260
  };
261
261
 
262
- // src/lib/asciidoc/templates/engines/TemplateStr.ts
263
- var TemplateStr = class extends AbstractEngine {
264
- renderMap;
265
- constructor(name = "templateStr", extensions = ["ts", "js"]) {
266
- super(name, extensions);
267
- this.renderMap = /* @__PURE__ */ new Map();
268
- }
269
- async load() {
270
- for (const [context, path] of this.templateList.entries()) {
271
- const templateFn = await import(path);
272
- this.renderMap.set(context, templateFn.default);
273
- }
274
- }
275
- renderNode(node, options) {
276
- const context = node.getNodeName();
277
- const renderFn = this.renderMap.get(context);
278
- return renderFn ? renderFn(node, options) : "";
279
- }
280
- };
281
-
282
262
  // src/schemas/index.ts
283
263
  import { z as z3 } from "astro/zod";
284
264
 
@@ -1,5 +1,5 @@
1
1
  import { ShikiTransformer } from 'shiki';
2
- import { C as CustomConverterFactoryFn, b as ShikiTransformerFactoryFn } from '../../../index-R3g0cYiE.cjs';
2
+ import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-CS3PBqxf.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, b as ShikiTransformerFactoryFn } from '../../../index-R3g0cYiE.js';
2
+ import { C as CustomConverterFactoryFn, S as ShikiTransformerFactoryFn } from '../../../index-CS3PBqxf.js';
3
3
  import 'asciidoctor';
4
4
  import 'astro/zod';
5
5
 
@@ -32,7 +32,8 @@ var engines_exports = {};
32
32
  __export(engines_exports, {
33
33
  AbstractEngine: () => AbstractEngine,
34
34
  HandlebarsEngine: () => HandlebarsEngine,
35
- NunjucksEngine: () => NunjucksEngine
35
+ NunjucksEngine: () => NunjucksEngine,
36
+ TemplateStr: () => TemplateStr
36
37
  });
37
38
  module.exports = __toCommonJS(engines_exports);
38
39
 
@@ -162,9 +163,30 @@ var NunjucksEngine = class extends AbstractEngine {
162
163
  return this.render(str, options);
163
164
  }
164
165
  };
166
+
167
+ // src/lib/asciidoc/templates/engines/TemplateStr.ts
168
+ var TemplateStr = class extends AbstractEngine {
169
+ renderMap;
170
+ constructor(name = "templateStr", extensions = ["ts", "js"]) {
171
+ super(name, extensions);
172
+ this.renderMap = /* @__PURE__ */ new Map();
173
+ }
174
+ async load() {
175
+ for (const [context, path] of this.templateList.entries()) {
176
+ const templateFn = await import(path);
177
+ this.renderMap.set(context, templateFn.default);
178
+ }
179
+ }
180
+ renderNode(node, options) {
181
+ const context = node.getNodeName();
182
+ const renderFn = this.renderMap.get(context);
183
+ return renderFn ? renderFn(node, options) : "";
184
+ }
185
+ };
165
186
  // Annotate the CommonJS export names for ESM import in node:
166
187
  0 && (module.exports = {
167
188
  AbstractEngine,
168
189
  HandlebarsEngine,
169
- NunjucksEngine
190
+ NunjucksEngine,
191
+ TemplateStr
170
192
  });
@@ -1,4 +1,4 @@
1
- import { c as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-R3g0cYiE.cjs';
1
+ import { c as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-CS3PBqxf.cjs';
2
2
  import { AbstractBlock } from 'asciidoctor';
3
3
  import 'shiki';
4
4
  import 'astro/zod';
@@ -21,4 +21,11 @@ declare class NunjucksEngine extends AbstractEngine implements AsciidocTemplate,
21
21
  renderString(str: string, options?: Record<string, unknown>): string;
22
22
  }
23
23
 
24
- export { AbstractEngine, HandlebarsEngine, NunjucksEngine };
24
+ declare class TemplateStr extends AbstractEngine implements AsciidocTemplate, TemplateModule {
25
+ private renderMap;
26
+ constructor(name?: string, extensions?: string[]);
27
+ load(): Promise<void>;
28
+ renderNode(node: AbstractBlock, options: Record<string, unknown>): string;
29
+ }
30
+
31
+ export { AbstractEngine, HandlebarsEngine, NunjucksEngine, TemplateStr };
@@ -1,4 +1,4 @@
1
- import { c as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-R3g0cYiE.js';
1
+ import { c as AbstractEngine, a as AsciidocTemplate, T as TemplateModule, F as FilesystemTemplate, R as RawTemplate } from '../../../../index-CS3PBqxf.js';
2
2
  import { AbstractBlock } from 'asciidoctor';
3
3
  import 'shiki';
4
4
  import 'astro/zod';
@@ -21,4 +21,11 @@ declare class NunjucksEngine extends AbstractEngine implements AsciidocTemplate,
21
21
  renderString(str: string, options?: Record<string, unknown>): string;
22
22
  }
23
23
 
24
- export { AbstractEngine, HandlebarsEngine, NunjucksEngine };
24
+ declare class TemplateStr extends AbstractEngine implements AsciidocTemplate, TemplateModule {
25
+ private renderMap;
26
+ constructor(name?: string, extensions?: string[]);
27
+ load(): Promise<void>;
28
+ renderNode(node: AbstractBlock, options: Record<string, unknown>): string;
29
+ }
30
+
31
+ export { AbstractEngine, HandlebarsEngine, NunjucksEngine, TemplateStr };
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  AbstractEngine,
3
3
  HandlebarsEngine,
4
- NunjucksEngine
5
- } from "../../../../chunk-2F52PMNV.js";
4
+ NunjucksEngine,
5
+ TemplateStr
6
+ } from "../../../../chunk-HVA4AVUD.js";
6
7
  export {
7
8
  AbstractEngine,
8
9
  HandlebarsEngine,
9
- NunjucksEngine
10
+ NunjucksEngine,
11
+ TemplateStr
10
12
  };
@@ -1,4 +1,4 @@
1
- import { S as ShikiTransformerFactory } from '../../../index-R3g0cYiE.cjs';
1
+ import { b as ShikiTransformerFactory } from '../../../index-CS3PBqxf.cjs';
2
2
  import { BundledLanguage } from 'shiki/types';
3
3
  import 'shiki';
4
4
  import 'asciidoctor';
@@ -1,4 +1,4 @@
1
- import { S as ShikiTransformerFactory } from '../../../index-R3g0cYiE.js';
1
+ import { b as ShikiTransformerFactory } from '../../../index-CS3PBqxf.js';
2
2
  import { BundledLanguage } from 'shiki/types';
3
3
  import 'shiki';
4
4
  import 'asciidoctor';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d10f/asciidoc-astro-loader",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "An Astro collections loader for Asciidoc files",
5
5
  "author": "D10f",
6
6
  "license": "MIT",