@riebeckite/plugin-bases 0.0.13 → 0.0.15
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 +8 -17
- package/dist/src/runtime.d.ts +1 -7
- package/package.json +2 -2
package/README.md
CHANGED
package/README_ja.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -465,9 +465,6 @@ function formatError(error) {
|
|
|
465
465
|
return error instanceof Error ? error.message : String(error);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
// src/runtime.ts
|
|
469
|
-
import { isPublished } from "@riebeckite/core";
|
|
470
|
-
|
|
471
468
|
// src/render.ts
|
|
472
469
|
import {
|
|
473
470
|
escapeHtml,
|
|
@@ -799,22 +796,14 @@ function formatDate(value) {
|
|
|
799
796
|
|
|
800
797
|
// src/runtime.ts
|
|
801
798
|
function createBasesRuntime(options) {
|
|
802
|
-
const tracked = /* @__PURE__ */ new Map();
|
|
803
799
|
return {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
resolve(manifest, diagnostics, config) {
|
|
808
|
-
const entries = config ? manifest.entries.filter(
|
|
809
|
-
(entry) => isPublished(config, entry.frontmatter)
|
|
810
|
-
) : manifest.entries;
|
|
811
|
-
for (const entry of entries) {
|
|
800
|
+
resolve(manifest, diagnostics, _config) {
|
|
801
|
+
const entries = manifest.discoverableEntries;
|
|
802
|
+
for (const entry of manifest.publicEntries) {
|
|
812
803
|
if (!entry.html.includes(BASES_ATTRIBUTE)) continue;
|
|
813
804
|
const html = replacePlaceholders(entry, entries, options, diagnostics);
|
|
814
805
|
if (html === entry.html) continue;
|
|
815
806
|
entry.html = html;
|
|
816
|
-
const content = tracked.get(entry.slug);
|
|
817
|
-
if (content) content.html = html;
|
|
818
807
|
}
|
|
819
808
|
}
|
|
820
809
|
};
|
|
@@ -856,15 +845,17 @@ function bases(options = {}) {
|
|
|
856
845
|
const runtime = createBasesRuntime(options);
|
|
857
846
|
return definePlugin({
|
|
858
847
|
name: "bases",
|
|
848
|
+
outputDependencies: [{ type: "global" }],
|
|
849
|
+
processedContentCache: {
|
|
850
|
+
version: "bases-v1",
|
|
851
|
+
dependencyMode: "none"
|
|
852
|
+
},
|
|
859
853
|
options,
|
|
860
854
|
provides: ["content.bases"],
|
|
861
855
|
validateOptions: validateBasesOptions,
|
|
862
856
|
extendMarkdownPipeline: (pipeline) => {
|
|
863
857
|
pipeline.use(remarkBases, { language });
|
|
864
858
|
},
|
|
865
|
-
onPostProcessed: (context) => {
|
|
866
|
-
runtime.track(context.slug, context.content);
|
|
867
|
-
},
|
|
868
859
|
onManifestCreated: (context) => {
|
|
869
860
|
runtime.resolve(context.manifest, context.diagnostics, context.config);
|
|
870
861
|
},
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import type { ContentManifest, Diagnostic,
|
|
1
|
+
import type { ContentManifest, Diagnostic, ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
2
2
|
import type { BasesOptions } from "./types.js";
|
|
3
3
|
export type BasesRuntime = {
|
|
4
|
-
/**
|
|
5
|
-
* Remembers the processed content object for a slug. `ContentManager` caches
|
|
6
|
-
* and reuses this exact object, so replacing its `html` here is what makes the
|
|
7
|
-
* rewrite visible to consumers that render `getProcessedContent()`.
|
|
8
|
-
*/
|
|
9
|
-
track(slug: string, content: PostContent): void;
|
|
10
4
|
/** Replaces every Base placeholder in the manifest with rendered output. */
|
|
11
5
|
resolve(manifest: ContentManifest, diagnostics: Diagnostic[], config?: ResolvedRiebeckiteConfig): void;
|
|
12
6
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-bases",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@types/mdast": "^4.0.4",
|
|
19
19
|
"unist-util-visit": "^5.1.0",
|
|
20
20
|
"vfile-matter": "^5.0.1",
|
|
21
|
-
"@riebeckite/core": "0.0.
|
|
21
|
+
"@riebeckite/core": "0.0.15"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|