@riebeckite/plugin-flashcards 0.0.14 → 0.0.16
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 +2 -1
- package/README_ja.md +2 -1
- package/dist/index.js +4 -9
- package/dist/src/runtime.d.ts +1 -2
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -158,19 +158,13 @@ function renderFallbackItem(card, className) {
|
|
|
158
158
|
// src/runtime.ts
|
|
159
159
|
function createFlashcardsRuntime(options) {
|
|
160
160
|
const resolved = resolveFlashcardsOptions(options);
|
|
161
|
-
const tracked = /* @__PURE__ */ new Map();
|
|
162
161
|
return {
|
|
163
|
-
track(slug, content) {
|
|
164
|
-
tracked.set(slug, content);
|
|
165
|
-
},
|
|
166
162
|
resolve(manifest, diagnostics) {
|
|
167
163
|
for (const entry of manifest.entries) {
|
|
168
164
|
if (!entry.html.includes(FLASHCARDS_ATTRIBUTE)) continue;
|
|
169
165
|
const html = replacePlaceholders(entry, resolved, diagnostics);
|
|
170
166
|
if (html === entry.html) continue;
|
|
171
167
|
entry.html = html;
|
|
172
|
-
const content = tracked.get(entry.slug);
|
|
173
|
-
if (content) content.html = html;
|
|
174
168
|
}
|
|
175
169
|
}
|
|
176
170
|
};
|
|
@@ -400,14 +394,15 @@ function flashcards(options = {}) {
|
|
|
400
394
|
const runtime = createFlashcardsRuntime(options);
|
|
401
395
|
return definePlugin({
|
|
402
396
|
name: "flashcards",
|
|
397
|
+
processedContentCache: {
|
|
398
|
+
version: "flashcards-v1",
|
|
399
|
+
dependencyMode: "none"
|
|
400
|
+
},
|
|
403
401
|
options,
|
|
404
402
|
validateOptions: validateFlashcardsOptions,
|
|
405
403
|
extendMarkdownPipeline: (pipeline) => {
|
|
406
404
|
pipeline.use(remarkFlashcards, { language: resolved.language });
|
|
407
405
|
},
|
|
408
|
-
onPostProcessed: (context) => {
|
|
409
|
-
runtime.track(context.slug, context.content);
|
|
410
|
-
},
|
|
411
406
|
onManifestCreated: (context) => {
|
|
412
407
|
runtime.resolve(context.manifest, context.diagnostics);
|
|
413
408
|
},
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type ContentManifest, type Diagnostic
|
|
1
|
+
import { type ContentManifest, type Diagnostic } from "@riebeckite/core";
|
|
2
2
|
import type { FlashcardsOptions } from "./types.js";
|
|
3
3
|
export type FlashcardsRuntime = {
|
|
4
|
-
track(slug: string, content: PostContent): void;
|
|
5
4
|
resolve(manifest: ContentManifest, diagnostics: Diagnostic[]): void;
|
|
6
5
|
};
|
|
7
6
|
export declare function createFlashcardsRuntime(options: FlashcardsOptions): FlashcardsRuntime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-flashcards",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@types/mdast": "^4.0.4",
|
|
25
25
|
"unist-util-visit": "^5.1.0",
|
|
26
|
-
"@riebeckite/core": "0.0.
|
|
26
|
+
"@riebeckite/core": "0.0.16"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|