@astrojs/markdoc 0.3.2 → 0.3.3

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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import Markdoc from "@markdoc/markdoc";
2
+ import crypto from "node:crypto";
2
3
  import fs from "node:fs";
3
4
  import { fileURLToPath, pathToFileURL } from "node:url";
4
5
  import {
5
- createNameHash,
6
6
  hasContentFlag,
7
7
  isValidUrl,
8
8
  MarkdocError,
@@ -239,6 +239,16 @@ async function emitOptimizedImages(nodeChildren, ctx) {
239
239
  function shouldOptimizeImage(src) {
240
240
  return !isValidUrl(src) && !src.startsWith("/");
241
241
  }
242
+ function createNameHash(baseId, hashIds) {
243
+ const baseName = baseId ? path.parse(baseId).name : "index";
244
+ const hash = crypto.createHash("sha256");
245
+ for (const id of hashIds) {
246
+ hash.update(id, "utf-8");
247
+ }
248
+ const h = hash.digest("hex").slice(0, 8);
249
+ const proposedName = baseName + "." + h;
250
+ return proposedName;
251
+ }
242
252
  export {
243
253
  markdocIntegration as default
244
254
  };
package/dist/utils.d.ts CHANGED
@@ -46,9 +46,4 @@ export declare const PROPAGATED_ASSET_FLAG = "astroPropagatedAssets";
46
46
  * @see 'packages/astro/src/content/utils.ts'
47
47
  */
48
48
  export declare function hasContentFlag(viteId: string, flag: string): boolean;
49
- /**
50
- * Create build hash for manual Rollup chunks.
51
- * @see 'packages/astro/src/core/build/plugins/plugin-css.ts'
52
- */
53
- export declare function createNameHash(baseId: string, hashIds: string[]): string;
54
49
  export {};
package/dist/utils.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import matter from "gray-matter";
2
- import crypto from "node:crypto";
3
- import path from "node:path";
4
2
  function parseFrontmatter(fileContents, filePath) {
5
3
  try {
6
4
  matter.clearCache();
@@ -59,20 +57,9 @@ function hasContentFlag(viteId, flag) {
59
57
  const flags = new URLSearchParams(viteId.split("?")[1] ?? "");
60
58
  return flags.has(flag);
61
59
  }
62
- function createNameHash(baseId, hashIds) {
63
- const baseName = baseId ? path.parse(baseId).name : "index";
64
- const hash = crypto.createHash("sha256");
65
- for (const id of hashIds) {
66
- hash.update(id, "utf-8");
67
- }
68
- const h = hash.digest("hex").slice(0, 8);
69
- const proposedName = baseName + "." + h;
70
- return proposedName;
71
- }
72
60
  export {
73
61
  MarkdocError,
74
62
  PROPAGATED_ASSET_FLAG,
75
- createNameHash,
76
63
  hasContentFlag,
77
64
  isValidUrl,
78
65
  parseFrontmatter,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/markdoc",
3
3
  "description": "Add support for Markdoc in your Astro site",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -21,15 +21,15 @@
21
21
  "exports": {
22
22
  "./prism": {
23
23
  "types": "./dist/extensions/prism.d.ts",
24
- "node": "./dist/extensions/prism.js"
24
+ "default": "./dist/extensions/prism.js"
25
25
  },
26
26
  "./shiki": {
27
27
  "types": "./dist/extensions/shiki.d.ts",
28
- "node": "./dist/extensions/shiki.js"
28
+ "default": "./dist/extensions/shiki.js"
29
29
  },
30
30
  "./config": {
31
31
  "types": "./dist/config.d.ts",
32
- "node": "./dist/config.js"
32
+ "default": "./dist/config.js"
33
33
  },
34
34
  ".": "./dist/index.js",
35
35
  "./components": "./components/index.ts",
@@ -56,17 +56,17 @@
56
56
  "template"
57
57
  ],
58
58
  "dependencies": {
59
- "shiki": "^0.14.1",
60
59
  "@astrojs/prism": "^2.1.2",
61
60
  "@markdoc/markdoc": "^0.3.0",
62
61
  "esbuild": "^0.17.12",
63
62
  "github-slugger": "^2.0.0",
64
63
  "gray-matter": "^4.0.3",
65
64
  "kleur": "^4.1.5",
65
+ "shiki": "^0.14.1",
66
66
  "zod": "^3.17.3"
67
67
  },
68
68
  "peerDependencies": {
69
- "astro": "^2.6.1"
69
+ "astro": "^2.6.3"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@astrojs/markdown-remark": "^2.2.1",
@@ -74,12 +74,12 @@
74
74
  "@types/html-escaper": "^3.0.0",
75
75
  "@types/mocha": "^9.1.1",
76
76
  "chai": "^4.3.6",
77
- "devalue": "^4.2.0",
77
+ "devalue": "^4.3.2",
78
78
  "linkedom": "^0.14.12",
79
79
  "mocha": "^9.2.2",
80
80
  "rollup": "^3.20.1",
81
81
  "vite": "^4.3.1",
82
- "astro": "2.6.1",
82
+ "astro": "2.6.3",
83
83
  "astro-scripts": "0.0.14"
84
84
  },
85
85
  "engines": {