astro-md-editor 0.0.6 → 0.0.7

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.
@@ -1,5 +1,5 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { u as useCollectionsData, R as Route, c as createSsrRpc } from "./router-dPC3iVPs.mjs";
2
+ import { u as useCollectionsData, R as Route, c as createSsrRpc } from "./router-DU3Hv7p_.mjs";
3
3
  import { t as toast } from "../_libs/sonner.mjs";
4
4
  import { c as cva } from "../_libs/class-variance-authority.mjs";
5
5
  import { c as clsx } from "../_libs/clsx.mjs";
@@ -16,7 +16,7 @@ import { c as createServerFn } from "./index.mjs";
16
16
  import { g } from "../_libs/marked.mjs";
17
17
  import { T as TurndownService } from "../_libs/turndown.mjs";
18
18
  import { g as gfm } from "../_libs/turndown-plugin-gfm.mjs";
19
- import { A as Ajv } from "../_libs/ajv.mjs";
19
+ import { A as Ajv2020 } from "../_libs/ajv.mjs";
20
20
  import { a as addFormats } from "../_libs/ajv-formats.mjs";
21
21
  import { P as PanelLeftClose, a as PanelLeftOpen, L as LoaderCircle, S as Save, b as PanelRightClose, c as PanelRightOpen, d as Trash2, e as LaptopMinimal, M as Moon, f as Sun, g as ChevronDown, h as Check, H as Heading1, i as Heading2, j as List, k as ListOrdered, l as ListChecks, Q as Quote, m as CodeXml, n as Minus, o as Link, p as Image, X, q as CalendarDays, r as Clock3, s as ChevronUp, t as Search, u as ChevronLeft, v as ChevronRight } from "../_libs/lucide-react.mjs";
22
22
  import { c as create } from "../_libs/zustand.mjs";
@@ -3100,7 +3100,7 @@ function applyRevisionFrontmatter(params) {
3100
3100
  };
3101
3101
  }
3102
3102
  const ROOT_VALIDATION_KEY = "_root";
3103
- const ajv = new Ajv({
3103
+ const ajv = new Ajv2020({
3104
3104
  allErrors: true,
3105
3105
  strict: false
3106
3106
  });
@@ -3150,7 +3150,18 @@ function mapAjvErrors(errors) {
3150
3150
  return mapped;
3151
3151
  }
3152
3152
  function validateFrontmatterDraft(schema, draft) {
3153
- const validator = getSchemaValidator(schema);
3153
+ let validator;
3154
+ try {
3155
+ validator = getSchemaValidator(schema);
3156
+ } catch (error) {
3157
+ const message = error instanceof Error ? error.message : String(error);
3158
+ return {
3159
+ valid: false,
3160
+ errors: {
3161
+ [ROOT_VALIDATION_KEY]: [`schema compile failed: ${message}`]
3162
+ }
3163
+ };
3164
+ }
3154
3165
  const valid = validator(draft);
3155
3166
  return {
3156
3167
  valid: Boolean(valid),
@@ -440,7 +440,7 @@ function getResponse() {
440
440
  return event.res;
441
441
  }
442
442
  async function getStartManifest(matchedRoutes) {
443
- const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-Da8tuNDH.mjs");
443
+ const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-BdKE8Xjm.mjs");
444
444
  const startManifest = tsrStartManifest();
445
445
  const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes[rootRouteId] || {};
446
446
  rootRoute.assets = rootRoute.assets || [];
@@ -618,15 +618,15 @@ const manifest = { "e3ae5ae6db5120d43fecff71cd0258cb4a93807a1a382949ccd189596d19
618
618
  }, "c9dff6ed7373b505d6aeeb84c63f87a0d0c205051d9d817929a5b500e5e79e03": {
619
619
  functionName: "listCollectionIconsServerFn_createServerFn_handler",
620
620
  importer: () => import("./IconPickerPopover-fNUx2jAc.mjs")
621
- }, "8346edc0b9da2addd68ca674ed9b2030f439d40deb713c45ef88393f5bdb91b9": {
622
- functionName: "getLocalImagePreviewServerFn_createServerFn_handler",
623
- importer: () => import("./image-preview.api-pcN5PQhH.mjs")
624
621
  }, "dcd3839820feeaed3b1a4f86186dd05c2e7e26ffaacdeaba309f44d121c95ad1": {
625
622
  functionName: "listFileHistoryServerFn_createServerFn_handler",
626
623
  importer: () => import("./file-history.api-oydnxFVV.mjs")
627
624
  }, "02ba027930daf730cf535415a08fab7365d58edddcc678dbcb19c72f990c25b5": {
628
625
  functionName: "readFileRevisionServerFn_createServerFn_handler",
629
626
  importer: () => import("./file-history.api-oydnxFVV.mjs")
627
+ }, "8346edc0b9da2addd68ca674ed9b2030f439d40deb713c45ef88393f5bdb91b9": {
628
+ functionName: "getLocalImagePreviewServerFn_createServerFn_handler",
629
+ importer: () => import("./image-preview.api-pcN5PQhH.mjs")
630
630
  } };
631
631
  async function getServerFnById(id) {
632
632
  const serverFnInfo = manifest[id];
@@ -1049,7 +1049,7 @@ let entriesPromise;
1049
1049
  let baseManifestPromise;
1050
1050
  let cachedFinalManifestPromise;
1051
1051
  async function loadEntries() {
1052
- const routerEntry = await import("./router-dPC3iVPs.mjs").then((n) => n.r);
1052
+ const routerEntry = await import("./router-DU3Hv7p_.mjs").then((n) => n.r);
1053
1053
  const startEntry = await import("./start-HYkvq4Ni.mjs");
1054
1054
  return { startEntry, routerEntry };
1055
1055
  }
@@ -144,7 +144,7 @@ function RootDocument({
144
144
  ] })
145
145
  ] });
146
146
  }
147
- const $$splitComponentImporter = () => import("./index-Bn1uKwTu.mjs");
147
+ const $$splitComponentImporter = () => import("./index-qpTkRHX1.mjs");
148
148
  const Route = createFileRoute("/")({
149
149
  validateSearch: (search) => {
150
150
  const record = search;
@@ -1,4 +1,4 @@
1
- const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "/Users/bimsina/Desktop/Development/Personal/astro-md-editor/src/routes/__root.tsx", "children": ["/"], "preloads": ["/assets/main-DzXOjsqg.js"], "assets": [] }, "/": { "filePath": "/Users/bimsina/Desktop/Development/Personal/astro-md-editor/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-UQt6zCrS.js"] } }, "clientEntry": "/assets/main-DzXOjsqg.js" });
1
+ const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "/Users/bimsina/Desktop/Development/Personal/astro-md-editor/src/routes/__root.tsx", "children": ["/"], "preloads": ["/assets/main-BrRIwdKE.js"], "assets": [] }, "/": { "filePath": "/Users/bimsina/Desktop/Development/Personal/astro-md-editor/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-CBGDT9fi.js"] } }, "clientEntry": "/assets/main-BrRIwdKE.js" });
2
2
  export {
3
3
  tsrStartManifest
4
4
  };
@@ -100,107 +100,107 @@ const assets = {
100
100
  "/favicon.ico": {
101
101
  "type": "image/vnd.microsoft.icon",
102
102
  "etag": '"f1e-ESBTjHetHyiokkO0tT/irBbMO8Y"',
103
- "mtime": "2026-03-08T06:14:29.202Z",
103
+ "mtime": "2026-03-14T15:44:03.429Z",
104
104
  "size": 3870,
105
105
  "path": "../public/favicon.ico"
106
106
  },
107
107
  "/logo192.png": {
108
108
  "type": "image/png",
109
109
  "etag": '"14e3-f08taHgqf6/O2oRVTsq5tImHdQA"',
110
- "mtime": "2026-03-08T06:14:29.203Z",
110
+ "mtime": "2026-03-14T15:44:03.429Z",
111
111
  "size": 5347,
112
112
  "path": "../public/logo192.png"
113
113
  },
114
- "/logo512.png": {
115
- "type": "image/png",
116
- "etag": '"25c0-RpFfnQJpTtSb/HqVNJR2hBA9w/4"',
117
- "mtime": "2026-03-08T06:14:29.202Z",
118
- "size": 9664,
119
- "path": "../public/logo512.png"
120
- },
121
114
  "/robots.txt": {
122
115
  "type": "text/plain; charset=utf-8",
123
116
  "etag": '"43-BEzmj4PuhUNHX+oW9uOnPSihxtU"',
124
- "mtime": "2026-03-08T06:14:29.203Z",
117
+ "mtime": "2026-03-14T15:44:03.429Z",
125
118
  "size": 67,
126
119
  "path": "../public/robots.txt"
127
120
  },
128
- "/manifest.json": {
129
- "type": "application/json",
130
- "etag": '"1f2-Oqn/x1R1hBTtEjA8nFhpBeFJJNg"',
131
- "mtime": "2026-03-08T06:14:29.202Z",
132
- "size": 498,
133
- "path": "../public/manifest.json"
121
+ "/logo512.png": {
122
+ "type": "image/png",
123
+ "etag": '"25c0-RpFfnQJpTtSb/HqVNJR2hBA9w/4"',
124
+ "mtime": "2026-03-14T15:44:03.429Z",
125
+ "size": 9664,
126
+ "path": "../public/logo512.png"
134
127
  },
135
128
  "/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2": {
136
129
  "type": "font/woff2",
137
130
  "etag": '"6568-cF1iUGbboMFZ8TfnP5HiMgl9II0"',
138
- "mtime": "2026-03-08T06:14:28.718Z",
131
+ "mtime": "2026-03-14T15:44:02.940Z",
139
132
  "size": 25960,
140
133
  "path": "../public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2"
141
134
  },
142
- "/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2": {
143
- "type": "font/woff2",
144
- "etag": '"493c-n3Oy9D6jvzfMjpClqox+Zo7ERQQ"',
145
- "mtime": "2026-03-08T06:14:28.718Z",
146
- "size": 18748,
147
- "path": "../public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2"
135
+ "/manifest.json": {
136
+ "type": "application/json",
137
+ "etag": '"1f2-Oqn/x1R1hBTtEjA8nFhpBeFJJNg"',
138
+ "mtime": "2026-03-14T15:44:03.429Z",
139
+ "size": 498,
140
+ "path": "../public/manifest.json"
148
141
  },
149
142
  "/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2": {
150
143
  "type": "font/woff2",
151
144
  "etag": '"2be0-BP5iTzJeB8nLqYAgKpWNi5o1Zm8"',
152
- "mtime": "2026-03-08T06:14:28.718Z",
145
+ "mtime": "2026-03-14T15:44:02.940Z",
153
146
  "size": 11232,
154
147
  "path": "../public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2"
155
148
  },
156
149
  "/assets/inter-greek-wght-normal-CkhJZR-_.woff2": {
157
150
  "type": "font/woff2",
158
151
  "etag": '"4a34-xor/hj4YNqI52zFecXnUbzQ4Xs4"',
159
- "mtime": "2026-03-08T06:14:28.718Z",
152
+ "mtime": "2026-03-14T15:44:02.939Z",
160
153
  "size": 18996,
161
154
  "path": "../public/assets/inter-greek-wght-normal-CkhJZR-_.woff2"
162
155
  },
163
- "/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2": {
156
+ "/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2": {
164
157
  "type": "font/woff2",
165
- "etag": '"280c-nBythjoDQ0+5wVAendJ6wU7Xz2M"',
166
- "mtime": "2026-03-08T06:14:28.718Z",
167
- "size": 10252,
168
- "path": "../public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2"
158
+ "etag": '"493c-n3Oy9D6jvzfMjpClqox+Zo7ERQQ"',
159
+ "mtime": "2026-03-14T15:44:02.940Z",
160
+ "size": 18748,
161
+ "path": "../public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2"
169
162
  },
170
163
  "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": {
171
164
  "type": "font/woff2",
172
165
  "etag": '"14c4c-zz61D7IQFMB9QxHvTAOk/Vh4ibQ"',
173
- "mtime": "2026-03-08T06:14:28.718Z",
166
+ "mtime": "2026-03-14T15:44:02.940Z",
174
167
  "size": 85068,
175
168
  "path": "../public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2"
176
169
  },
177
170
  "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": {
178
171
  "type": "font/woff2",
179
172
  "etag": '"bc80-8R1ym7Ck2DUNLqPQ/AYs9u8tUpg"',
180
- "mtime": "2026-03-08T06:14:28.718Z",
173
+ "mtime": "2026-03-14T15:44:02.940Z",
181
174
  "size": 48256,
182
175
  "path": "../public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2"
183
176
  },
184
177
  "/assets/styles-CezfLgHY.css": {
185
178
  "type": "text/css; charset=utf-8",
186
179
  "etag": '"16c03-6spcY0zAbMWYIfx4MkgUIWefXb0"',
187
- "mtime": "2026-03-08T06:14:28.718Z",
180
+ "mtime": "2026-03-14T15:44:02.940Z",
188
181
  "size": 93187,
189
182
  "path": "../public/assets/styles-CezfLgHY.css"
190
183
  },
191
- "/assets/main-DzXOjsqg.js": {
184
+ "/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2": {
185
+ "type": "font/woff2",
186
+ "etag": '"280c-nBythjoDQ0+5wVAendJ6wU7Xz2M"',
187
+ "mtime": "2026-03-14T15:44:02.940Z",
188
+ "size": 10252,
189
+ "path": "../public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2"
190
+ },
191
+ "/assets/main-BrRIwdKE.js": {
192
192
  "type": "text/javascript; charset=utf-8",
193
- "etag": '"59339-tSYXNZ6CNL1Zt0KVnL8TeohfAog"',
194
- "mtime": "2026-03-08T06:14:28.718Z",
193
+ "etag": '"59339-C2r9gJOVqY5b3mo3vdkDOOlHT+o"',
194
+ "mtime": "2026-03-14T15:44:02.940Z",
195
195
  "size": 365369,
196
- "path": "../public/assets/main-DzXOjsqg.js"
196
+ "path": "../public/assets/main-BrRIwdKE.js"
197
197
  },
198
- "/assets/index-UQt6zCrS.js": {
198
+ "/assets/index-CBGDT9fi.js": {
199
199
  "type": "text/javascript; charset=utf-8",
200
- "etag": '"fd680-MTEy4A2zDMKeSP7AuzGHvXOYiSs"',
201
- "mtime": "2026-03-08T06:14:28.718Z",
202
- "size": 1037952,
203
- "path": "../public/assets/index-UQt6zCrS.js"
200
+ "etag": '"1011aa-sc3efTI1UWHQsOk43D/xxczKDnA"',
201
+ "mtime": "2026-03-14T15:44:02.940Z",
202
+ "size": 1053098,
203
+ "path": "../public/assets/index-CBGDT9fi.js"
204
204
  }
205
205
  };
206
206
  function readAsset(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-md-editor",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Schema-aware editor for Astro content collections.",
5
5
  "author": "Bibek Timsina",
6
6
  "license": "MIT",
@@ -10,14 +10,20 @@ const ROOT_ENV_KEY = 'APP_ROOT_PATH';
10
10
  const DEFAULT_ROOT_PATH = '.';
11
11
  const COLLECTIONS_RELATIVE_PATH_PREFIX = '.astro/collections/';
12
12
  const CONTENT_RELATIVE_PATH_PREFIX = 'src/content/';
13
- const CONTENT_CONFIG_CANDIDATES = [
13
+ const MODERN_CONTENT_CONFIG_CANDIDATES = [
14
14
  'src/content.config.ts',
15
15
  'src/content.config.mjs',
16
16
  'src/content.config.js',
17
+ ];
18
+ const LEGACY_CONTENT_CONFIG_CANDIDATES = [
17
19
  'src/content/config.ts',
18
20
  'src/content/config.mjs',
19
21
  'src/content/config.js',
20
22
  ];
23
+ const CONTENT_CONFIG_CANDIDATES = [
24
+ ...MODERN_CONTENT_CONFIG_CANDIDATES,
25
+ ...LEGACY_CONTENT_CONFIG_CANDIDATES,
26
+ ];
21
27
  const FIELD_OVERRIDES_FILE = 'astro-md-editor.fields.json';
22
28
  const ASTRO_DEFINITION_PREFIX = '#/definitions/';
23
29
  const CONTENT_FILE_EXTENSIONS = new Set(['.md', '.mdx', '.markdown']);
@@ -657,6 +663,17 @@ async function fileExists(filePath) {
657
663
  }
658
664
  }
659
665
 
666
+ async function resolveFirstExistingPath(rootDir, candidates) {
667
+ for (const candidate of candidates) {
668
+ const fullPath = resolve(rootDir, candidate);
669
+ if (await fileExists(fullPath)) {
670
+ return fullPath;
671
+ }
672
+ }
673
+
674
+ return undefined;
675
+ }
676
+
660
677
  async function resolveAstroCliPath(rootDir) {
661
678
  const candidatePaths =
662
679
  process.platform === 'win32'
@@ -676,6 +693,11 @@ async function resolveAstroCliPath(rootDir) {
676
693
  }
677
694
 
678
695
  async function runAstroSync(rootDir, env = process.env) {
696
+ const legacyConfigPath = await resolveFirstExistingPath(
697
+ rootDir,
698
+ LEGACY_CONTENT_CONFIG_CANDIDATES,
699
+ );
700
+
679
701
  const astroCliPath = await resolveAstroCliPath(rootDir);
680
702
  if (!astroCliPath) {
681
703
  throw new Error(
@@ -687,16 +709,40 @@ async function runAstroSync(rootDir, env = process.env) {
687
709
  }
688
710
 
689
711
  await new Promise((resolveSync, rejectSync) => {
712
+ let commandOutput = '';
690
713
  const child = spawn(astroCliPath, ['sync'], {
691
714
  cwd: rootDir,
692
- stdio: 'inherit',
715
+ stdio: ['ignore', 'pipe', 'pipe'],
693
716
  env,
694
717
  shell: process.platform === 'win32',
695
718
  });
696
719
 
720
+ child.stdout?.on('data', (chunk) => {
721
+ const text = String(chunk);
722
+ commandOutput += text;
723
+ process.stdout.write(chunk);
724
+ });
725
+
726
+ child.stderr?.on('data', (chunk) => {
727
+ const text = String(chunk);
728
+ commandOutput += text;
729
+ process.stderr.write(chunk);
730
+ });
731
+
697
732
  child.on('error', rejectSync);
698
733
  child.on('exit', (code, signal) => {
699
734
  if (signal || code !== 0) {
735
+ if (
736
+ legacyConfigPath &&
737
+ commandOutput.includes('LegacyContentConfigError')
738
+ ) {
739
+ console.warn(
740
+ `[bootstrap] Continuing without Astro schema sync due to legacy config at ${relative(rootDir, legacyConfigPath)}.`,
741
+ );
742
+ resolveSync();
743
+ return;
744
+ }
745
+
700
746
  rejectSync(
701
747
  new Error(
702
748
  `astro sync failed in ${rootDir} with exit code ${code ?? 'unknown'}.`,