@imjp/writenex-astro 1.3.6 → 1.4.0

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.
Files changed (55) hide show
  1. package/dist/{chunk-NSW7AIVF.js → chunk-EEUN46Q2.js} +3 -3
  2. package/dist/chunk-HNS5YKP3.js +241 -0
  3. package/dist/chunk-HNS5YKP3.js.map +1 -0
  4. package/dist/{chunk-YBCPOLMY.js → chunk-P5KMSHFP.js} +2 -1
  5. package/dist/{chunk-YBCPOLMY.js.map → chunk-P5KMSHFP.js.map} +1 -1
  6. package/dist/{chunk-JMNCPNQX.js → chunk-XVQNYPOI.js} +65 -3
  7. package/dist/chunk-XVQNYPOI.js.map +1 -0
  8. package/dist/chunk-YRSIZLHE.js +1 -0
  9. package/dist/{chunk-N37EPLKG.js → chunk-ZWUGHWHD.js} +79 -10
  10. package/dist/chunk-ZWUGHWHD.js.map +1 -0
  11. package/dist/client/index.css +1 -1
  12. package/dist/client/index.css.map +1 -1
  13. package/dist/client/index.js +114 -114
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/config/index.d.ts +3 -2
  16. package/dist/config/index.js +11 -3
  17. package/dist/{config-CliL0CoN.d.ts → config-B7t8CjL1.d.ts} +38 -60
  18. package/dist/{content-TuL3GT66.d.ts → content-CwcgR8P6.d.ts} +1 -1
  19. package/dist/discovery/index.d.ts +2 -2
  20. package/dist/discovery/index.js +2 -2
  21. package/dist/fields/index.d.ts +16 -0
  22. package/dist/fields/index.js +13 -0
  23. package/dist/fields-DUSm13nm.d.ts +223 -0
  24. package/dist/filesystem/index.d.ts +2 -2
  25. package/dist/filesystem/index.js +1 -1
  26. package/dist/index.d.ts +5 -4
  27. package/dist/index.js +13 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/{loader-53VVP2IN.js → loader-B5WZCVBC.js} +3 -3
  30. package/dist/loader-B5WZCVBC.js.map +1 -0
  31. package/dist/{schema-DDJyoVkj.d.ts → schema-nLMfZ9-o.d.ts} +79 -53
  32. package/dist/server/index.d.ts +2 -2
  33. package/dist/server/index.js +3 -3
  34. package/package.json +5 -1
  35. package/src/client/components/FrontmatterForm/FrontmatterForm.css +104 -0
  36. package/src/client/components/FrontmatterForm/FrontmatterForm.tsx +452 -26
  37. package/src/config/defaults.ts +1 -0
  38. package/src/config/index.ts +3 -0
  39. package/src/config/schema.ts +114 -73
  40. package/src/discovery/schema.ts +120 -1
  41. package/src/fields/collection.ts +67 -0
  42. package/src/fields/fields.ts +150 -0
  43. package/src/fields/index.ts +42 -0
  44. package/src/fields/resolve.ts +149 -0
  45. package/src/fields/types.ts +179 -0
  46. package/src/index.ts +3 -0
  47. package/src/types/config.ts +86 -63
  48. package/src/types/index.ts +3 -0
  49. package/dist/chunk-JMNCPNQX.js.map +0 -1
  50. package/dist/chunk-KIKIPIFA.js +0 -1
  51. package/dist/chunk-N37EPLKG.js.map +0 -1
  52. package/dist/client/index.d.ts +0 -19
  53. /package/dist/{chunk-NSW7AIVF.js.map → chunk-EEUN46Q2.js.map} +0 -0
  54. /package/dist/{chunk-KIKIPIFA.js.map → chunk-YRSIZLHE.js.map} +0 -0
  55. /package/dist/{loader-53VVP2IN.js.map → fields/index.js.map} +0 -0
@@ -1,5 +1,6 @@
1
- import { D as DiscoveryConfig, E as EditorConfig, I as ImageConfig, V as VersionHistoryConfig, C as CollectionConfig, c as WritenexConfig } from '../config-CliL0CoN.js';
2
- export { L as LoadConfigResult, c as contentDirectoryExists, d as defineConfig, f as findConfigFile, l as loadConfig, v as validateConfig, w as writenexConfigSchema, a as writenexOptionsSchema } from '../schema-DDJyoVkj.js';
1
+ export { F as FieldDefinition, a as FieldKind, V as ValidationOptions, c as collection, f as fields, s as singleton } from '../fields-DUSm13nm.js';
2
+ import { D as DiscoveryConfig, E as EditorConfig, I as ImageConfig, d as VersionHistoryConfig, C as CollectionConfig, e as WritenexConfig } from '../config-B7t8CjL1.js';
3
+ export { L as LoadConfigResult, c as contentDirectoryExists, d as defineConfig, f as findConfigFile, l as loadConfig, v as validateConfig, w as writenexConfigSchema, a as writenexOptionsSchema } from '../schema-nLMfZ9-o.js';
3
4
  import 'zod';
4
5
 
5
6
  /**
@@ -1,4 +1,9 @@
1
- import "../chunk-KIKIPIFA.js";
1
+ import "../chunk-YRSIZLHE.js";
2
+ import {
3
+ collection,
4
+ fields,
5
+ singleton
6
+ } from "../chunk-HNS5YKP3.js";
2
7
  import {
3
8
  contentDirectoryExists,
4
9
  defineConfig,
@@ -7,7 +12,7 @@ import {
7
12
  validateConfig,
8
13
  writenexConfigSchema,
9
14
  writenexOptionsSchema
10
- } from "../chunk-N37EPLKG.js";
15
+ } from "../chunk-ZWUGHWHD.js";
11
16
  import {
12
17
  DEFAULT_CONTENT_PATH,
13
18
  DEFAULT_DISCOVERY_CONFIG,
@@ -17,7 +22,7 @@ import {
17
22
  DEFAULT_VERSION_HISTORY_CONFIG,
18
23
  applyCollectionDefaults,
19
24
  applyConfigDefaults
20
- } from "../chunk-YBCPOLMY.js";
25
+ } from "../chunk-P5KMSHFP.js";
21
26
  export {
22
27
  DEFAULT_CONTENT_PATH,
23
28
  DEFAULT_DISCOVERY_CONFIG,
@@ -27,10 +32,13 @@ export {
27
32
  DEFAULT_VERSION_HISTORY_CONFIG,
28
33
  applyCollectionDefaults,
29
34
  applyConfigDefaults,
35
+ collection,
30
36
  contentDirectoryExists,
31
37
  defineConfig,
38
+ fields,
32
39
  findConfigFile,
33
40
  loadConfig,
41
+ singleton,
34
42
  validateConfig,
35
43
  writenexConfigSchema,
36
44
  writenexOptionsSchema
@@ -117,104 +117,82 @@ interface RestoreResult extends VersionResult {
117
117
  * @module @writenex/astro/types/config
118
118
  */
119
119
 
120
- /**
121
- * Field type definitions for frontmatter schema
122
- */
123
- type FieldType = "string" | "number" | "boolean" | "date" | "array" | "image" | "object";
124
- /**
125
- * Schema field definition for frontmatter
126
- */
120
+ type FieldKind = "text" | "slug" | "url" | "number" | "integer" | "select" | "multiselect" | "checkbox" | "date" | "datetime" | "image" | "file" | "object" | "array" | "blocks" | "relationship" | "path-reference" | "markdoc" | "mdx" | "conditional" | "child" | "cloud-image" | "empty" | "empty-content" | "empty-document" | "ignored";
121
+ type FieldType = "string" | "number" | "boolean" | "date" | "array" | "image" | "object" | "file" | "blocks" | "relationship" | "markdoc" | "mdx" | "child" | "slug" | "url" | "integer" | "select" | "multiselect" | "datetime" | "cloud-image" | "path-reference" | "conditional" | "empty" | "empty-content" | "empty-document" | "ignored" | "checkbox";
122
+ interface ValidationOptions {
123
+ isRequired?: boolean;
124
+ min?: number;
125
+ max?: number;
126
+ minLength?: number;
127
+ maxLength?: number;
128
+ pattern?: string;
129
+ patternDescription?: string;
130
+ }
127
131
  interface SchemaField {
128
- /** The type of the field */
129
132
  type: FieldType;
130
- /** Whether the field is required */
131
133
  required?: boolean;
132
- /** Default value for the field */
133
134
  default?: unknown;
134
- /** For array types, the type of items */
135
135
  items?: string;
136
- /** Description shown in the editor */
137
136
  description?: string;
137
+ label?: string;
138
+ options?: string[];
139
+ directory?: string;
140
+ publicPath?: string;
141
+ validation?: ValidationOptions;
142
+ fields?: Record<string, SchemaField>;
143
+ itemField?: SchemaField;
144
+ blockTypes?: Record<string, SchemaField>;
145
+ collection?: string;
146
+ multiline?: boolean;
147
+ format?: string;
148
+ itemLabel?: string;
149
+ matchField?: string;
150
+ matchValue?: unknown;
151
+ showField?: SchemaField;
152
+ accept?: string;
153
+ allowExternal?: boolean;
154
+ inline?: boolean;
138
155
  }
139
- /**
140
- * Collection schema definition
141
- */
142
156
  type CollectionSchema = Record<string, SchemaField>;
143
- /**
144
- * Image handling strategy
145
- */
146
157
  type ImageStrategy = "colocated" | "public" | "custom";
147
- /**
148
- * Image configuration for a collection
149
- */
150
158
  interface ImageConfig {
151
- /** Where to store uploaded images */
152
159
  strategy: ImageStrategy;
153
- /** URL path prefix for images */
154
160
  publicPath?: string;
155
- /** Filesystem path for storing images (for 'public' and 'custom' strategies) */
156
161
  storagePath?: string;
157
162
  }
158
- /**
159
- * Collection configuration
160
- */
161
163
  interface CollectionConfig {
162
- /** Unique name of the collection */
163
164
  name: string;
164
- /** Filesystem path to the collection (relative to project root) */
165
165
  path: string;
166
- /** File naming pattern using tokens like {slug}, {date}, {year}, etc. */
167
166
  filePattern?: string;
168
- /** URL pattern for preview links */
169
167
  previewUrl?: string;
170
- /** Frontmatter schema definition */
171
168
  schema?: CollectionSchema;
172
- /** Image handling configuration for this collection */
173
169
  images?: ImageConfig;
174
170
  }
175
- /**
176
- * Discovery configuration for auto-detecting collections
177
- */
171
+ interface SingletonConfig {
172
+ name: string;
173
+ path: string;
174
+ previewUrl?: string;
175
+ schema?: CollectionSchema;
176
+ images?: ImageConfig;
177
+ }
178
178
  interface DiscoveryConfig {
179
- /** Whether auto-discovery is enabled */
180
179
  enabled: boolean;
181
- /** Glob patterns to ignore during discovery */
182
180
  ignore?: string[];
183
181
  }
184
- /**
185
- * Editor behavior configuration
186
- */
187
182
  interface EditorConfig {
188
- /** Whether autosave is enabled */
189
183
  autosave?: boolean;
190
- /** Autosave interval in milliseconds */
191
184
  autosaveInterval?: number;
192
185
  }
193
- /**
194
- * Main Writenex configuration
195
- */
196
186
  interface WritenexConfig {
197
- /** Collection definitions */
198
187
  collections?: CollectionConfig[];
199
- /** Global image configuration */
188
+ singletons?: SingletonConfig[];
200
189
  images?: ImageConfig;
201
- /** Editor behavior configuration */
202
190
  editor?: EditorConfig;
203
- /** Auto-discovery configuration */
204
191
  discovery?: DiscoveryConfig;
205
- /** Version history configuration */
206
192
  versionHistory?: VersionHistoryConfig;
207
193
  }
208
- /**
209
- * Options passed to the Writenex integration
210
- */
211
194
  interface WritenexOptions {
212
- /**
213
- * Allow the integration to run in production builds.
214
- * Use with caution - only enable for staging/preview environments.
215
- * @default false
216
- */
217
195
  allowProduction?: boolean;
218
196
  }
219
197
 
220
- export type { CollectionConfig as C, DiscoveryConfig as D, EditorConfig as E, FieldType as F, ImageConfig as I, RestoreVersionOptions as R, SchemaField as S, VersionHistoryConfig as V, WritenexOptions as W, CollectionSchema as a, ImageStrategy as b, WritenexConfig as c, VersionResult as d, Version as e, VersionEntry as f, RestoreResult as g, SaveVersionOptions as h, VersionManifest as i };
198
+ export type { CollectionConfig as C, DiscoveryConfig as D, EditorConfig as E, FieldKind as F, ImageConfig as I, RestoreVersionOptions as R, SchemaField as S, ValidationOptions as V, WritenexOptions as W, CollectionSchema as a, FieldType as b, ImageStrategy as c, VersionHistoryConfig as d, WritenexConfig as e, VersionResult as f, Version as g, VersionEntry as h, RestoreResult as i, SaveVersionOptions as j, VersionManifest as k };
@@ -1,4 +1,4 @@
1
- import { a as CollectionSchema } from './config-CliL0CoN.js';
1
+ import { a as CollectionSchema } from './config-B7t8CjL1.js';
2
2
 
3
3
  /**
4
4
  * @fileoverview Content and collection type definitions for @writenex/astro
@@ -1,5 +1,5 @@
1
- import { D as DiscoveredCollection } from '../content-TuL3GT66.js';
2
- import { C as CollectionConfig, a as CollectionSchema } from '../config-CliL0CoN.js';
1
+ import { D as DiscoveredCollection } from '../content-CwcgR8P6.js';
2
+ import { C as CollectionConfig, a as CollectionSchema } from '../config-B7t8CjL1.js';
3
3
 
4
4
  /**
5
5
  * @fileoverview Collection discovery for Astro content collections
@@ -6,7 +6,7 @@ import {
6
6
  getCollection,
7
7
  mergeCollections,
8
8
  mergeSchema
9
- } from "../chunk-JMNCPNQX.js";
9
+ } from "../chunk-XVQNYPOI.js";
10
10
  import {
11
11
  detectFilePattern,
12
12
  generatePathFromPattern,
@@ -17,7 +17,7 @@ import {
17
17
  resolvePatternTokens,
18
18
  validatePattern
19
19
  } from "../chunk-GYAFIVVI.js";
20
- import "../chunk-YBCPOLMY.js";
20
+ import "../chunk-P5KMSHFP.js";
21
21
  export {
22
22
  collectionExists,
23
23
  describeSchema,
@@ -0,0 +1,16 @@
1
+ import { F as FieldDefinition } from '../fields-DUSm13nm.js';
2
+ export { A as ArrayFieldConfig, B as BaseFieldConfig, b as BlocksFieldConfig, C as CheckboxFieldConfig, d as ChildFieldConfig, e as CloudImageFieldConfig, g as CollectionSchemaConfig, h as ConditionalFieldConfig, D as DateFieldConfig, i as DatetimeFieldConfig, a as FieldKind, j as Fields, k as FileFieldConfig, I as ImageFieldConfig, l as IntegerFieldConfig, M as MarkdocFieldConfig, m as MdxFieldConfig, n as MultiselectFieldConfig, N as NumberFieldConfig, O as ObjectFieldConfig, P as PathReferenceFieldConfig, R as RelationshipFieldConfig, S as SelectFieldConfig, o as SingletonSchemaConfig, p as SlugFieldConfig, T as TextFieldConfig, U as UrlFieldConfig, V as ValidationOptions, c as collection, f as fields, s as singleton } from '../fields-DUSm13nm.js';
3
+ import { S as SchemaField } from '../config-B7t8CjL1.js';
4
+
5
+ /**
6
+ * @fileoverview FieldDefinition to SchemaField conversion
7
+ *
8
+ * This module converts FieldDefinition objects (from the builder API)
9
+ * to the internal SchemaField format used by the form system.
10
+ *
11
+ * @module @writenex/astro/fields/resolve
12
+ */
13
+
14
+ declare function resolveFieldDefinition(field: FieldDefinition): SchemaField;
15
+
16
+ export { FieldDefinition, resolveFieldDefinition };
@@ -0,0 +1,13 @@
1
+ import {
2
+ collection,
3
+ fields,
4
+ resolveFieldDefinition,
5
+ singleton
6
+ } from "../chunk-HNS5YKP3.js";
7
+ export {
8
+ collection,
9
+ fields,
10
+ resolveFieldDefinition,
11
+ singleton
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,223 @@
1
+ import { I as ImageConfig, C as CollectionConfig, S as SchemaField } from './config-B7t8CjL1.js';
2
+
3
+ /**
4
+ * @fileoverview Field type definitions for the Fields API
5
+ *
6
+ * This module defines the FieldDefinition interface and per-field-type
7
+ * config interfaces for the builder pattern API.
8
+ *
9
+ * @module @writenex/astro/fields/types
10
+ */
11
+ type FieldKind = "text" | "slug" | "url" | "number" | "integer" | "select" | "multiselect" | "checkbox" | "date" | "datetime" | "image" | "file" | "object" | "array" | "blocks" | "relationship" | "path-reference" | "markdoc" | "mdx" | "conditional" | "child" | "cloud-image" | "empty" | "empty-content" | "empty-document" | "ignored";
12
+ interface ValidationOptions {
13
+ isRequired?: boolean;
14
+ min?: number;
15
+ max?: number;
16
+ minLength?: number;
17
+ maxLength?: number;
18
+ pattern?: string;
19
+ patternDescription?: string;
20
+ }
21
+ interface BaseFieldConfig {
22
+ label?: string;
23
+ description?: string;
24
+ validation?: ValidationOptions;
25
+ defaultValue?: unknown;
26
+ }
27
+ interface TextFieldConfig extends BaseFieldConfig {
28
+ multiline?: boolean;
29
+ placeholder?: string;
30
+ }
31
+ interface SlugFieldConfig extends BaseFieldConfig {
32
+ name?: {
33
+ label?: string;
34
+ placeholder?: string;
35
+ };
36
+ pathname?: {
37
+ label?: string;
38
+ placeholder?: string;
39
+ };
40
+ }
41
+ interface UrlFieldConfig extends BaseFieldConfig {
42
+ placeholder?: string;
43
+ }
44
+ interface NumberFieldConfig extends BaseFieldConfig {
45
+ placeholder?: number;
46
+ }
47
+ interface IntegerFieldConfig extends BaseFieldConfig {
48
+ placeholder?: number;
49
+ }
50
+ interface SelectFieldConfig extends BaseFieldConfig {
51
+ options: string[];
52
+ defaultValue?: string;
53
+ }
54
+ interface MultiselectFieldConfig extends BaseFieldConfig {
55
+ options: string[];
56
+ defaultValue?: string[];
57
+ }
58
+ interface CheckboxFieldConfig extends BaseFieldConfig {
59
+ defaultValue?: boolean;
60
+ }
61
+ interface DateFieldConfig extends BaseFieldConfig {
62
+ defaultValue?: string;
63
+ }
64
+ interface DatetimeFieldConfig extends BaseFieldConfig {
65
+ defaultValue?: string;
66
+ }
67
+ interface ImageFieldConfig extends BaseFieldConfig {
68
+ directory?: string;
69
+ publicPath?: string;
70
+ }
71
+ interface FileFieldConfig extends BaseFieldConfig {
72
+ directory?: string;
73
+ publicPath?: string;
74
+ }
75
+ interface ObjectFieldConfig extends BaseFieldConfig {
76
+ fields: Record<string, FieldDefinition>;
77
+ }
78
+ interface ArrayFieldConfig extends BaseFieldConfig {
79
+ itemField: FieldDefinition;
80
+ itemLabel?: string;
81
+ }
82
+ interface BlocksFieldConfig extends BaseFieldConfig {
83
+ blockTypes: Record<string, FieldDefinition>;
84
+ itemLabel?: string;
85
+ }
86
+ interface RelationshipFieldConfig extends BaseFieldConfig {
87
+ collection: string;
88
+ }
89
+ interface PathReferenceFieldConfig extends BaseFieldConfig {
90
+ contentTypes?: string[];
91
+ }
92
+ interface MarkdocFieldConfig extends BaseFieldConfig {
93
+ }
94
+ interface MdxFieldConfig extends BaseFieldConfig {
95
+ }
96
+ interface ConditionalFieldConfig extends BaseFieldConfig {
97
+ matchField: string;
98
+ matchValue: unknown;
99
+ showField: FieldDefinition;
100
+ }
101
+ interface ChildFieldConfig extends BaseFieldConfig {
102
+ }
103
+ interface CloudImageFieldConfig extends BaseFieldConfig {
104
+ provider?: string;
105
+ }
106
+ type FieldDefinition = ({
107
+ fieldKind: "text";
108
+ } & TextFieldConfig) | ({
109
+ fieldKind: "slug";
110
+ } & SlugFieldConfig) | ({
111
+ fieldKind: "url";
112
+ } & UrlFieldConfig) | ({
113
+ fieldKind: "number";
114
+ } & NumberFieldConfig) | ({
115
+ fieldKind: "integer";
116
+ } & IntegerFieldConfig) | ({
117
+ fieldKind: "select";
118
+ } & SelectFieldConfig) | ({
119
+ fieldKind: "multiselect";
120
+ } & MultiselectFieldConfig) | ({
121
+ fieldKind: "checkbox";
122
+ } & CheckboxFieldConfig) | ({
123
+ fieldKind: "date";
124
+ } & DateFieldConfig) | ({
125
+ fieldKind: "datetime";
126
+ } & DatetimeFieldConfig) | ({
127
+ fieldKind: "image";
128
+ } & ImageFieldConfig) | ({
129
+ fieldKind: "file";
130
+ } & FileFieldConfig) | ({
131
+ fieldKind: "object";
132
+ } & ObjectFieldConfig) | ({
133
+ fieldKind: "array";
134
+ } & ArrayFieldConfig) | ({
135
+ fieldKind: "blocks";
136
+ } & BlocksFieldConfig) | ({
137
+ fieldKind: "relationship";
138
+ } & RelationshipFieldConfig) | ({
139
+ fieldKind: "path-reference";
140
+ } & PathReferenceFieldConfig) | ({
141
+ fieldKind: "markdoc";
142
+ } & MarkdocFieldConfig) | ({
143
+ fieldKind: "mdx";
144
+ } & MdxFieldConfig) | ({
145
+ fieldKind: "conditional";
146
+ } & ConditionalFieldConfig) | ({
147
+ fieldKind: "child";
148
+ } & ChildFieldConfig) | ({
149
+ fieldKind: "cloud-image";
150
+ } & CloudImageFieldConfig) | ({
151
+ fieldKind: "empty";
152
+ } & BaseFieldConfig) | ({
153
+ fieldKind: "empty-content";
154
+ } & BaseFieldConfig) | ({
155
+ fieldKind: "empty-document";
156
+ } & BaseFieldConfig) | ({
157
+ fieldKind: "ignored";
158
+ } & BaseFieldConfig);
159
+
160
+ interface CollectionSchemaConfig {
161
+ name: string;
162
+ path: string;
163
+ filePattern?: string;
164
+ previewUrl?: string;
165
+ schema: Record<string, FieldDefinition>;
166
+ images?: ImageConfig;
167
+ }
168
+ interface SingletonSchemaConfig {
169
+ name: string;
170
+ path: string;
171
+ previewUrl?: string;
172
+ schema: Record<string, FieldDefinition>;
173
+ images?: ImageConfig;
174
+ }
175
+ declare function collection(config: CollectionSchemaConfig): CollectionConfig;
176
+ declare function singleton(config: SingletonSchemaConfig): {
177
+ name: string;
178
+ path: string;
179
+ previewUrl?: string;
180
+ schema: Record<string, SchemaField>;
181
+ images?: ImageConfig;
182
+ };
183
+
184
+ /**
185
+ * @fileoverview Fields builder API for @writenex/astro
186
+ *
187
+ * This module provides a TypeScript-first builder pattern for defining
188
+ * content schema fields. Each field type is a method on the `fields` object.
189
+ *
190
+ * @module @writenex/astro/fields/fields
191
+ */
192
+
193
+ declare const fields: {
194
+ text(config?: TextFieldConfig): FieldDefinition;
195
+ slug(config?: SlugFieldConfig): FieldDefinition;
196
+ url(config?: UrlFieldConfig): FieldDefinition;
197
+ number(config?: NumberFieldConfig): FieldDefinition;
198
+ integer(config?: IntegerFieldConfig): FieldDefinition;
199
+ select(config: SelectFieldConfig): FieldDefinition;
200
+ multiselect(config: MultiselectFieldConfig): FieldDefinition;
201
+ checkbox(config?: CheckboxFieldConfig): FieldDefinition;
202
+ date(config?: DateFieldConfig): FieldDefinition;
203
+ datetime(config?: DatetimeFieldConfig): FieldDefinition;
204
+ image(config?: ImageFieldConfig): FieldDefinition;
205
+ file(config?: FileFieldConfig): FieldDefinition;
206
+ object(config: ObjectFieldConfig): FieldDefinition;
207
+ array(config: ArrayFieldConfig): FieldDefinition;
208
+ blocks(config: BlocksFieldConfig): FieldDefinition;
209
+ relationship(config: RelationshipFieldConfig): FieldDefinition;
210
+ pathReference(config?: PathReferenceFieldConfig): FieldDefinition;
211
+ markdoc(config?: MarkdocFieldConfig): FieldDefinition;
212
+ mdx(config?: MdxFieldConfig): FieldDefinition;
213
+ conditional(config: ConditionalFieldConfig): FieldDefinition;
214
+ child(config?: ChildFieldConfig): FieldDefinition;
215
+ cloudImage(config?: CloudImageFieldConfig): FieldDefinition;
216
+ empty(config?: BaseFieldConfig): FieldDefinition;
217
+ emptyContent(config?: BaseFieldConfig): FieldDefinition;
218
+ emptyDocument(config?: BaseFieldConfig): FieldDefinition;
219
+ ignored(config?: BaseFieldConfig): FieldDefinition;
220
+ };
221
+ type Fields = typeof fields;
222
+
223
+ export { type ArrayFieldConfig as A, type BaseFieldConfig as B, type CheckboxFieldConfig as C, type DateFieldConfig as D, type FieldDefinition as F, type ImageFieldConfig as I, type MarkdocFieldConfig as M, type NumberFieldConfig as N, type ObjectFieldConfig as O, type PathReferenceFieldConfig as P, type RelationshipFieldConfig as R, type SelectFieldConfig as S, type TextFieldConfig as T, type UrlFieldConfig as U, type ValidationOptions as V, type FieldKind as a, type BlocksFieldConfig as b, collection as c, type ChildFieldConfig as d, type CloudImageFieldConfig as e, fields as f, type CollectionSchemaConfig as g, type ConditionalFieldConfig as h, type DatetimeFieldConfig as i, type Fields as j, type FileFieldConfig as k, type IntegerFieldConfig as l, type MdxFieldConfig as m, type MultiselectFieldConfig as n, type SingletonSchemaConfig as o, type SlugFieldConfig as p, singleton as s };
@@ -1,6 +1,6 @@
1
- import { I as ImageConfig, V as VersionHistoryConfig, d as VersionResult, e as Version, f as VersionEntry, R as RestoreVersionOptions, g as RestoreResult, h as SaveVersionOptions, i as VersionManifest } from '../config-CliL0CoN.js';
1
+ import { I as ImageConfig, d as VersionHistoryConfig, f as VersionResult, g as Version, h as VersionEntry, R as RestoreVersionOptions, i as RestoreResult, j as SaveVersionOptions, k as VersionManifest } from '../config-B7t8CjL1.js';
2
2
  import { I as ImageDiscoveryOptions, a as ImageDiscoveryResult, D as DiscoveredImage } from '../image-FP7w5ZIs.js';
3
- import { C as ContentItem, a as ContentSummary } from '../content-TuL3GT66.js';
3
+ import { C as ContentItem, a as ContentSummary } from '../content-CwcgR8P6.js';
4
4
  import { C as ContentConflictError } from '../errors-C0iYiDTv.js';
5
5
 
6
6
  /**
@@ -54,7 +54,7 @@ import {
54
54
  } from "../chunk-GYAFIVVI.js";
55
55
  import {
56
56
  DEFAULT_VERSION_HISTORY_CONFIG
57
- } from "../chunk-YBCPOLMY.js";
57
+ } from "../chunk-P5KMSHFP.js";
58
58
 
59
59
  // src/filesystem/version-config.ts
60
60
  function resolveVersionConfig(config) {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { AstroIntegration } from 'astro';
2
- import { W as WritenexOptions } from './config-CliL0CoN.js';
3
- export { C as CollectionConfig, a as CollectionSchema, D as DiscoveryConfig, E as EditorConfig, F as FieldType, I as ImageConfig, b as ImageStrategy, S as SchemaField, V as VersionHistoryConfig, c as WritenexConfig } from './config-CliL0CoN.js';
4
- export { C as ContentItem, a as ContentSummary, D as DiscoveredCollection } from './content-TuL3GT66.js';
5
- export { d as defineConfig, l as loadConfig, v as validateConfig } from './schema-DDJyoVkj.js';
2
+ import { W as WritenexOptions } from './config-B7t8CjL1.js';
3
+ export { C as CollectionConfig, a as CollectionSchema, D as DiscoveryConfig, E as EditorConfig, F as FieldKind, b as FieldType, I as ImageConfig, c as ImageStrategy, S as SchemaField, V as ValidationOptions, d as VersionHistoryConfig, e as WritenexConfig } from './config-B7t8CjL1.js';
4
+ export { c as collection, f as fields, s as singleton } from './fields-DUSm13nm.js';
5
+ export { C as ContentItem, a as ContentSummary, D as DiscoveredCollection } from './content-CwcgR8P6.js';
6
+ export { d as defineConfig, l as loadConfig, v as validateConfig } from './schema-nLMfZ9-o.js';
6
7
  export { W as WritenexError, a as WritenexErrorCode, i as isWritenexError } from './errors-C0iYiDTv.js';
7
8
  import 'zod';
8
9
 
package/dist/index.js CHANGED
@@ -1,24 +1,29 @@
1
- import "./chunk-KIKIPIFA.js";
1
+ import "./chunk-YRSIZLHE.js";
2
2
  import {
3
3
  ContentWatcher
4
4
  } from "./chunk-JFQQJPDF.js";
5
5
  import {
6
6
  createMiddleware,
7
7
  getCache
8
- } from "./chunk-NSW7AIVF.js";
9
- import "./chunk-JMNCPNQX.js";
8
+ } from "./chunk-EEUN46Q2.js";
9
+ import "./chunk-XVQNYPOI.js";
10
10
  import {
11
11
  WritenexError,
12
12
  WritenexErrorCode,
13
13
  isWritenexError
14
14
  } from "./chunk-4H63L4YO.js";
15
15
  import "./chunk-GYAFIVVI.js";
16
+ import {
17
+ collection,
18
+ fields,
19
+ singleton
20
+ } from "./chunk-HNS5YKP3.js";
16
21
  import {
17
22
  defineConfig,
18
23
  loadConfig,
19
24
  validateConfig
20
- } from "./chunk-N37EPLKG.js";
21
- import "./chunk-YBCPOLMY.js";
25
+ } from "./chunk-ZWUGHWHD.js";
26
+ import "./chunk-P5KMSHFP.js";
22
27
 
23
28
  // src/integration.ts
24
29
  var DEFAULT_BASE_PATH = "/_writenex";
@@ -141,10 +146,13 @@ var MAX_IMAGE_SIZE = 10 * 1024 * 1024;
141
146
  export {
142
147
  WritenexError,
143
148
  WritenexErrorCode,
149
+ collection,
144
150
  writenex as default,
145
151
  defineConfig,
152
+ fields,
146
153
  isWritenexError,
147
154
  loadConfig,
155
+ singleton,
148
156
  validateConfig,
149
157
  writenex
150
158
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/integration.ts","../src/core/constants.ts"],"sourcesContent":["/**\n * @fileoverview Astro integration for Writenex visual editor\n *\n * This module provides the main Astro integration that injects the Writenex\n * editor UI and API routes into an Astro project.\n *\n * ## Features:\n * - Injects editor UI at /_writenex\n * - Provides API routes for content CRUD operations\n * - Auto-discovers content collections\n * - Production guard to prevent accidental exposure\n *\n * ## Usage:\n * ```typescript\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import writenex from '@writenex/astro';\n *\n * export default defineConfig({\n * integrations: [writenex()],\n * });\n * ```\n *\n * @module @writenex/astro/integration\n */\n\nimport type { AstroIntegration } from \"astro\";\nimport { loadConfig } from \"@/config/loader\";\nimport { ContentWatcher } from \"@/filesystem/watcher\";\nimport { getCache } from \"@/server/cache\";\nimport { createMiddleware } from \"@/server/middleware\";\nimport type { WritenexConfig, WritenexOptions } from \"@/types\";\n\n/**\n * Default base path for the Writenex editor UI\n */\nconst DEFAULT_BASE_PATH = \"/_writenex\";\n\n/**\n * Package name for logging\n */\nconst PACKAGE_NAME = \"@writenex/astro\";\n\n/**\n * Creates the Writenex Astro integration.\n *\n * This integration injects the Writenex visual editor into your Astro project,\n * providing a WYSIWYG interface for editing content collections.\n *\n * @param options - Integration options\n * @param options.allowProduction - Allow running in production (default: false)\n * @returns Astro integration object\n *\n * @example\n * ```typescript\n * // Basic usage\n * export default defineConfig({\n * integrations: [writenex()],\n * });\n *\n * // With options\n * export default defineConfig({\n * integrations: [\n * writenex({\n * allowProduction: true, // Enable in production (use with caution)\n * }),\n * ],\n * });\n * ```\n */\nexport default function writenex(options?: WritenexOptions): AstroIntegration {\n const { allowProduction = false } = options ?? {};\n\n // Use fixed base path for consistency and branding\n const basePath = DEFAULT_BASE_PATH;\n\n // Track if we should be active\n let isActive = true;\n\n // Store loaded configuration\n let resolvedConfig: Required<WritenexConfig> | null = null;\n\n // Store project root\n let projectRoot = \"\";\n\n // Store Astro's trailingSlash setting\n let astroTrailingSlash: \"always\" | \"never\" | \"ignore\" = \"ignore\";\n\n // File watcher instance\n let watcher: ContentWatcher | null = null;\n\n // Track if editor URL has been logged (to avoid duplicate logs)\n let hasLoggedEditorUrl = false;\n\n return {\n name: PACKAGE_NAME,\n hooks: {\n /**\n * Configuration setup hook\n *\n * This hook runs during Astro's config resolution phase.\n * We use it to:\n * 1. Check if we should run (production guard)\n * 2. Load Writenex configuration\n * 3. Register any necessary Vite plugins\n */\n \"astro:config:setup\": async ({ command, logger, config }) => {\n // Production guard: disable in production unless explicitly allowed\n if (command === \"build\" && !allowProduction) {\n logger.warn(\n \"Disabled in production build. Use allowProduction: true to override.\"\n );\n isActive = false;\n return;\n }\n\n // Store project root\n // On Windows, URL.pathname produces /C:/Users/... with a leading slash\n // before the drive letter which breaks path.join and fs.existsSync.\n // Strip that leading slash so we get a valid Windows path (C:\\Users\\...).\n projectRoot = config.root.pathname.replace(/^\\/([A-Za-z]:)/, \"$1\");\n\n // Capture Astro's trailingSlash setting for preview URLs\n astroTrailingSlash = config.trailingSlash ?? \"ignore\";\n\n // Load Writenex configuration\n const { config: loadedConfig, warnings } =\n await loadConfig(projectRoot);\n resolvedConfig = loadedConfig;\n\n // Log any configuration warnings\n for (const warning of warnings) {\n logger.warn(warning);\n }\n },\n\n /**\n * Server setup hook\n *\n * This hook runs when the Astro dev server starts.\n * We use it to:\n * 1. Inject middleware for API routes\n * 2. Serve the editor UI\n * 3. Start file watcher for cache invalidation\n */\n \"astro:server:setup\": ({ server }) => {\n // Skip if disabled (production guard triggered)\n if (!isActive || !resolvedConfig) {\n return;\n }\n\n // Create and register the middleware\n const middleware = createMiddleware({\n basePath,\n projectRoot,\n config: resolvedConfig,\n trailingSlash: astroTrailingSlash,\n });\n\n server.middlewares.use(middleware);\n\n // Setup cache with file watcher integration\n const cache = getCache({ hasWatcher: true });\n\n // Start file watcher for cache invalidation\n watcher = new ContentWatcher(projectRoot, \"src/content\", {\n onChange: (event) => {\n cache.handleFileChange(event.type, event.collection);\n },\n });\n\n watcher.start();\n },\n\n /**\n * Server start hook\n *\n * This hook runs after the dev server has started and is listening.\n * We use it to log the full editor URL with the actual server address.\n */\n \"astro:server:start\": ({ address, logger }) => {\n if (!isActive || hasLoggedEditorUrl) {\n return;\n }\n\n // Build the full URL from the server address\n // Normalize loopback addresses to \"localhost\" for better readability\n const protocol = \"http\";\n const rawHost = address.address;\n const isLoopback =\n rawHost === \"\" ||\n rawHost === \"::\" ||\n rawHost === \"127.0.0.1\" ||\n rawHost === \"::1\";\n const host = isLoopback ? \"localhost\" : rawHost;\n const port = address.port;\n const editorUrl = `${protocol}://${host}:${port}${basePath}`;\n\n logger.info(`Writenex editor running at: ${editorUrl}`);\n hasLoggedEditorUrl = true;\n },\n\n /**\n * Server done hook\n *\n * This hook runs when the server is shutting down.\n * We use it to clean up the file watcher.\n */\n \"astro:server:done\": async () => {\n if (watcher) {\n await watcher.stop();\n watcher = null;\n }\n },\n\n /**\n * Build done hook\n *\n * This hook runs after the build completes.\n * Currently just logs a warning if production mode is enabled.\n */\n \"astro:build:done\": ({ logger }) => {\n if (allowProduction) {\n logger.warn(\n \"Production mode enabled. Ensure your deployment is secured.\"\n );\n }\n },\n },\n };\n}\n","/**\n * @fileoverview Shared constants for @writenex/astro\n *\n * This module provides centralized constants used across the integration,\n * including version information, default paths, and configuration limits.\n *\n * @module @writenex/astro/core/constants\n */\n\n/**\n * Current version of the @writenex/astro package\n */\nexport const WRITENEX_VERSION = \"1.0.0\";\n\n/**\n * Default base path for the Writenex editor UI\n */\nexport const DEFAULT_BASE_PATH = \"/_writenex\";\n\n/**\n * Default API path for Writenex API endpoints\n */\nexport const DEFAULT_API_PATH = \"/_writenex/api\";\n\n/**\n * Supported image MIME types for upload\n */\nexport const SUPPORTED_IMAGE_TYPES = [\n \"image/jpeg\",\n \"image/png\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n] as const;\n\n/**\n * Maximum allowed image file size in bytes (10MB)\n */\nexport const MAX_IMAGE_SIZE = 10 * 1024 * 1024;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,oBAAoB;AAK1B,IAAM,eAAe;AA6BN,SAAR,SAA0B,SAA6C;AAC5E,QAAM,EAAE,kBAAkB,MAAM,IAAI,WAAW,CAAC;AAGhD,QAAM,WAAW;AAGjB,MAAI,WAAW;AAGf,MAAI,iBAAkD;AAGtD,MAAI,cAAc;AAGlB,MAAI,qBAAoD;AAGxD,MAAI,UAAiC;AAGrC,MAAI,qBAAqB;AAEzB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAUL,sBAAsB,OAAO,EAAE,SAAS,QAAQ,OAAO,MAAM;AAE3D,YAAI,YAAY,WAAW,CAAC,iBAAiB;AAC3C,iBAAO;AAAA,YACL;AAAA,UACF;AACA,qBAAW;AACX;AAAA,QACF;AAMA,sBAAc,OAAO,KAAK,SAAS,QAAQ,kBAAkB,IAAI;AAGjE,6BAAqB,OAAO,iBAAiB;AAG7C,cAAM,EAAE,QAAQ,cAAc,SAAS,IACrC,MAAM,WAAW,WAAW;AAC9B,yBAAiB;AAGjB,mBAAW,WAAW,UAAU;AAC9B,iBAAO,KAAK,OAAO;AAAA,QACrB;AAAA,MACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAWA,sBAAsB,CAAC,EAAE,OAAO,MAAM;AAEpC,YAAI,CAAC,YAAY,CAAC,gBAAgB;AAChC;AAAA,QACF;AAGA,cAAM,aAAa,iBAAiB;AAAA,UAClC;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,eAAe;AAAA,QACjB,CAAC;AAED,eAAO,YAAY,IAAI,UAAU;AAGjC,cAAM,QAAQ,SAAS,EAAE,YAAY,KAAK,CAAC;AAG3C,kBAAU,IAAI,eAAe,aAAa,eAAe;AAAA,UACvD,UAAU,CAAC,UAAU;AACnB,kBAAM,iBAAiB,MAAM,MAAM,MAAM,UAAU;AAAA,UACrD;AAAA,QACF,CAAC;AAED,gBAAQ,MAAM;AAAA,MAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,sBAAsB,CAAC,EAAE,SAAS,OAAO,MAAM;AAC7C,YAAI,CAAC,YAAY,oBAAoB;AACnC;AAAA,QACF;AAIA,cAAM,WAAW;AACjB,cAAM,UAAU,QAAQ;AACxB,cAAM,aACJ,YAAY,MACZ,YAAY,QACZ,YAAY,eACZ,YAAY;AACd,cAAM,OAAO,aAAa,cAAc;AACxC,cAAM,OAAO,QAAQ;AACrB,cAAM,YAAY,GAAG,QAAQ,MAAM,IAAI,IAAI,IAAI,GAAG,QAAQ;AAE1D,eAAO,KAAK,+BAA+B,SAAS,EAAE;AACtD,6BAAqB;AAAA,MACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,qBAAqB,YAAY;AAC/B,YAAI,SAAS;AACX,gBAAM,QAAQ,KAAK;AACnB,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,oBAAoB,CAAC,EAAE,OAAO,MAAM;AAClC,YAAI,iBAAiB;AACnB,iBAAO;AAAA,YACL;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AChMO,IAAM,iBAAiB,KAAK,OAAO;","names":[]}
1
+ {"version":3,"sources":["../src/integration.ts","../src/core/constants.ts"],"sourcesContent":["/**\n * @fileoverview Astro integration for Writenex visual editor\n *\n * This module provides the main Astro integration that injects the Writenex\n * editor UI and API routes into an Astro project.\n *\n * ## Features:\n * - Injects editor UI at /_writenex\n * - Provides API routes for content CRUD operations\n * - Auto-discovers content collections\n * - Production guard to prevent accidental exposure\n *\n * ## Usage:\n * ```typescript\n * // astro.config.mjs\n * import { defineConfig } from 'astro/config';\n * import writenex from '@writenex/astro';\n *\n * export default defineConfig({\n * integrations: [writenex()],\n * });\n * ```\n *\n * @module @writenex/astro/integration\n */\n\nimport type { AstroIntegration } from \"astro\";\nimport { loadConfig } from \"@/config/loader\";\nimport { ContentWatcher } from \"@/filesystem/watcher\";\nimport { getCache } from \"@/server/cache\";\nimport { createMiddleware } from \"@/server/middleware\";\nimport type { WritenexConfig, WritenexOptions } from \"@/types\";\n\n/**\n * Default base path for the Writenex editor UI\n */\nconst DEFAULT_BASE_PATH = \"/_writenex\";\n\n/**\n * Package name for logging\n */\nconst PACKAGE_NAME = \"@writenex/astro\";\n\n/**\n * Creates the Writenex Astro integration.\n *\n * This integration injects the Writenex visual editor into your Astro project,\n * providing a WYSIWYG interface for editing content collections.\n *\n * @param options - Integration options\n * @param options.allowProduction - Allow running in production (default: false)\n * @returns Astro integration object\n *\n * @example\n * ```typescript\n * // Basic usage\n * export default defineConfig({\n * integrations: [writenex()],\n * });\n *\n * // With options\n * export default defineConfig({\n * integrations: [\n * writenex({\n * allowProduction: true, // Enable in production (use with caution)\n * }),\n * ],\n * });\n * ```\n */\nexport default function writenex(options?: WritenexOptions): AstroIntegration {\n const { allowProduction = false } = options ?? {};\n\n // Use fixed base path for consistency and branding\n const basePath = DEFAULT_BASE_PATH;\n\n // Track if we should be active\n let isActive = true;\n\n // Store loaded configuration\n let resolvedConfig: Required<WritenexConfig> | null = null;\n\n // Store project root\n let projectRoot = \"\";\n\n // Store Astro's trailingSlash setting\n let astroTrailingSlash: \"always\" | \"never\" | \"ignore\" = \"ignore\";\n\n // File watcher instance\n let watcher: ContentWatcher | null = null;\n\n // Track if editor URL has been logged (to avoid duplicate logs)\n let hasLoggedEditorUrl = false;\n\n return {\n name: PACKAGE_NAME,\n hooks: {\n /**\n * Configuration setup hook\n *\n * This hook runs during Astro's config resolution phase.\n * We use it to:\n * 1. Check if we should run (production guard)\n * 2. Load Writenex configuration\n * 3. Register any necessary Vite plugins\n */\n \"astro:config:setup\": async ({ command, logger, config }) => {\n // Production guard: disable in production unless explicitly allowed\n if (command === \"build\" && !allowProduction) {\n logger.warn(\n \"Disabled in production build. Use allowProduction: true to override.\"\n );\n isActive = false;\n return;\n }\n\n // Store project root\n // On Windows, URL.pathname produces /C:/Users/... with a leading slash\n // before the drive letter which breaks path.join and fs.existsSync.\n // Strip that leading slash so we get a valid Windows path (C:\\Users\\...).\n projectRoot = config.root.pathname.replace(/^\\/([A-Za-z]:)/, \"$1\");\n\n // Capture Astro's trailingSlash setting for preview URLs\n astroTrailingSlash = config.trailingSlash ?? \"ignore\";\n\n // Load Writenex configuration\n const { config: loadedConfig, warnings } =\n await loadConfig(projectRoot);\n resolvedConfig = loadedConfig;\n\n // Log any configuration warnings\n for (const warning of warnings) {\n logger.warn(warning);\n }\n },\n\n /**\n * Server setup hook\n *\n * This hook runs when the Astro dev server starts.\n * We use it to:\n * 1. Inject middleware for API routes\n * 2. Serve the editor UI\n * 3. Start file watcher for cache invalidation\n */\n \"astro:server:setup\": ({ server }) => {\n // Skip if disabled (production guard triggered)\n if (!isActive || !resolvedConfig) {\n return;\n }\n\n // Create and register the middleware\n const middleware = createMiddleware({\n basePath,\n projectRoot,\n config: resolvedConfig,\n trailingSlash: astroTrailingSlash,\n });\n\n server.middlewares.use(middleware);\n\n // Setup cache with file watcher integration\n const cache = getCache({ hasWatcher: true });\n\n // Start file watcher for cache invalidation\n watcher = new ContentWatcher(projectRoot, \"src/content\", {\n onChange: (event) => {\n cache.handleFileChange(event.type, event.collection);\n },\n });\n\n watcher.start();\n },\n\n /**\n * Server start hook\n *\n * This hook runs after the dev server has started and is listening.\n * We use it to log the full editor URL with the actual server address.\n */\n \"astro:server:start\": ({ address, logger }) => {\n if (!isActive || hasLoggedEditorUrl) {\n return;\n }\n\n // Build the full URL from the server address\n // Normalize loopback addresses to \"localhost\" for better readability\n const protocol = \"http\";\n const rawHost = address.address;\n const isLoopback =\n rawHost === \"\" ||\n rawHost === \"::\" ||\n rawHost === \"127.0.0.1\" ||\n rawHost === \"::1\";\n const host = isLoopback ? \"localhost\" : rawHost;\n const port = address.port;\n const editorUrl = `${protocol}://${host}:${port}${basePath}`;\n\n logger.info(`Writenex editor running at: ${editorUrl}`);\n hasLoggedEditorUrl = true;\n },\n\n /**\n * Server done hook\n *\n * This hook runs when the server is shutting down.\n * We use it to clean up the file watcher.\n */\n \"astro:server:done\": async () => {\n if (watcher) {\n await watcher.stop();\n watcher = null;\n }\n },\n\n /**\n * Build done hook\n *\n * This hook runs after the build completes.\n * Currently just logs a warning if production mode is enabled.\n */\n \"astro:build:done\": ({ logger }) => {\n if (allowProduction) {\n logger.warn(\n \"Production mode enabled. Ensure your deployment is secured.\"\n );\n }\n },\n },\n };\n}\n","/**\n * @fileoverview Shared constants for @writenex/astro\n *\n * This module provides centralized constants used across the integration,\n * including version information, default paths, and configuration limits.\n *\n * @module @writenex/astro/core/constants\n */\n\n/**\n * Current version of the @writenex/astro package\n */\nexport const WRITENEX_VERSION = \"1.0.0\";\n\n/**\n * Default base path for the Writenex editor UI\n */\nexport const DEFAULT_BASE_PATH = \"/_writenex\";\n\n/**\n * Default API path for Writenex API endpoints\n */\nexport const DEFAULT_API_PATH = \"/_writenex/api\";\n\n/**\n * Supported image MIME types for upload\n */\nexport const SUPPORTED_IMAGE_TYPES = [\n \"image/jpeg\",\n \"image/png\",\n \"image/gif\",\n \"image/webp\",\n \"image/svg+xml\",\n] as const;\n\n/**\n * Maximum allowed image file size in bytes (10MB)\n */\nexport const MAX_IMAGE_SIZE = 10 * 1024 * 1024;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAM,oBAAoB;AAK1B,IAAM,eAAe;AA6BN,SAAR,SAA0B,SAA6C;AAC5E,QAAM,EAAE,kBAAkB,MAAM,IAAI,WAAW,CAAC;AAGhD,QAAM,WAAW;AAGjB,MAAI,WAAW;AAGf,MAAI,iBAAkD;AAGtD,MAAI,cAAc;AAGlB,MAAI,qBAAoD;AAGxD,MAAI,UAAiC;AAGrC,MAAI,qBAAqB;AAEzB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAUL,sBAAsB,OAAO,EAAE,SAAS,QAAQ,OAAO,MAAM;AAE3D,YAAI,YAAY,WAAW,CAAC,iBAAiB;AAC3C,iBAAO;AAAA,YACL;AAAA,UACF;AACA,qBAAW;AACX;AAAA,QACF;AAMA,sBAAc,OAAO,KAAK,SAAS,QAAQ,kBAAkB,IAAI;AAGjE,6BAAqB,OAAO,iBAAiB;AAG7C,cAAM,EAAE,QAAQ,cAAc,SAAS,IACrC,MAAM,WAAW,WAAW;AAC9B,yBAAiB;AAGjB,mBAAW,WAAW,UAAU;AAC9B,iBAAO,KAAK,OAAO;AAAA,QACrB;AAAA,MACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAWA,sBAAsB,CAAC,EAAE,OAAO,MAAM;AAEpC,YAAI,CAAC,YAAY,CAAC,gBAAgB;AAChC;AAAA,QACF;AAGA,cAAM,aAAa,iBAAiB;AAAA,UAClC;AAAA,UACA;AAAA,UACA,QAAQ;AAAA,UACR,eAAe;AAAA,QACjB,CAAC;AAED,eAAO,YAAY,IAAI,UAAU;AAGjC,cAAM,QAAQ,SAAS,EAAE,YAAY,KAAK,CAAC;AAG3C,kBAAU,IAAI,eAAe,aAAa,eAAe;AAAA,UACvD,UAAU,CAAC,UAAU;AACnB,kBAAM,iBAAiB,MAAM,MAAM,MAAM,UAAU;AAAA,UACrD;AAAA,QACF,CAAC;AAED,gBAAQ,MAAM;AAAA,MAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,sBAAsB,CAAC,EAAE,SAAS,OAAO,MAAM;AAC7C,YAAI,CAAC,YAAY,oBAAoB;AACnC;AAAA,QACF;AAIA,cAAM,WAAW;AACjB,cAAM,UAAU,QAAQ;AACxB,cAAM,aACJ,YAAY,MACZ,YAAY,QACZ,YAAY,eACZ,YAAY;AACd,cAAM,OAAO,aAAa,cAAc;AACxC,cAAM,OAAO,QAAQ;AACrB,cAAM,YAAY,GAAG,QAAQ,MAAM,IAAI,IAAI,IAAI,GAAG,QAAQ;AAE1D,eAAO,KAAK,+BAA+B,SAAS,EAAE;AACtD,6BAAqB;AAAA,MACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,qBAAqB,YAAY;AAC/B,YAAI,SAAS;AACX,gBAAM,QAAQ,KAAK;AACnB,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQA,oBAAoB,CAAC,EAAE,OAAO,MAAM;AAClC,YAAI,iBAAiB;AACnB,iBAAO;AAAA,YACL;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AChMO,IAAM,iBAAiB,KAAK,OAAO;","names":[]}
@@ -2,11 +2,11 @@ import {
2
2
  contentDirectoryExists,
3
3
  findConfigFile,
4
4
  loadConfig
5
- } from "./chunk-N37EPLKG.js";
6
- import "./chunk-YBCPOLMY.js";
5
+ } from "./chunk-ZWUGHWHD.js";
6
+ import "./chunk-P5KMSHFP.js";
7
7
  export {
8
8
  contentDirectoryExists,
9
9
  findConfigFile,
10
10
  loadConfig
11
11
  };
12
- //# sourceMappingURL=loader-53VVP2IN.js.map
12
+ //# sourceMappingURL=loader-B5WZCVBC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}