@micacms/editor 0.4.1 → 0.5.0-rc.1

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 CHANGED
@@ -14,7 +14,7 @@ localhost:6422
14
14
  ▼
15
15
  Hono ── /api/* /admin/* /health /ready
16
16
  │ │
17
- connector Vue SPA (from @micacms/editor-ui)
17
+ content files Vue SPA (from @micacms/editor-ui)
18
18
  │
19
19
  your working tree ←— the draft workspace
20
20
  ```
@@ -72,7 +72,7 @@ proxies `/api` to the API; the API still needs
72
72
  ```
73
73
  src/
74
74
  ├── cli.ts the `mica` bin: flags, checks, environment, hand-off
75
- ├── index.ts the composition: local connector + runtime + editor UI
75
+ ├── index.ts the composition: developer policy + runtime + editor UI
76
76
  ├── config.ts the local slice of the environment, and the refusals
77
77
  ├── guards.ts the Host allowlist
78
78
  └── banner.ts what a person sees instead of log lines
@@ -80,7 +80,7 @@ src/
80
80
 
81
81
  Everything of substance is elsewhere: the API and services in
82
82
  `@micacms/runtime`, the SPA in `@micacms/editor-ui`, the content rules in
83
- `@micacms/core` and `@micacms/connectors`. This package is the composition the
83
+ `@micacms/core`. This package is the composition the
84
84
  architecture calls `apps/local-editor`, published under the name the command
85
85
  deserves.
86
86
 
package/dist/config.d.ts CHANGED
@@ -1,16 +1,7 @@
1
1
  /**
2
- * The local editor's configuration.
3
- *
4
- * Small on purpose: the variables the runtime reads, minus everything that
5
- * describes a deployment. There is no `REPOSITORY` — this app *is* the local
6
- * connector against a checkout — no `DATA_DIR`, because it keeps no state,
7
- * and no OIDC or admission variable exists to be set, which is a stronger
8
- * statement than ignoring one.
9
- *
10
- * The refusals are the containment for a server with no authentication:
11
- * production is refused, a non-local public URL is refused, and any listening
12
- * address but loopback is refused, with no override. Remote access is what
13
- * the self-hosted distribution is.
2
+ * The local editor's configuration: the runtime variables minus everything that
3
+ * describes a deployment. The server has no authentication, so it refuses
4
+ * production and any non-loopback URL or address, with no override.
14
5
  */
15
6
  import { type RuntimeConfig } from "@micacms/runtime";
16
7
  export type LocalConfig = RuntimeConfig & {
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAsD1B,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAkD5E"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AA6C1B,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAwC5E"}
package/dist/config.js CHANGED
@@ -1,16 +1,7 @@
1
1
  /**
2
- * The local editor's configuration.
3
- *
4
- * Small on purpose: the variables the runtime reads, minus everything that
5
- * describes a deployment. There is no `REPOSITORY` — this app *is* the local
6
- * connector against a checkout — no `DATA_DIR`, because it keeps no state,
7
- * and no OIDC or admission variable exists to be set, which is a stronger
8
- * statement than ignoring one.
9
- *
10
- * The refusals are the containment for a server with no authentication:
11
- * production is refused, a non-local public URL is refused, and any listening
12
- * address but loopback is refused, with no override. Remote access is what
13
- * the self-hosted distribution is.
2
+ * The local editor's configuration: the runtime variables minus everything that
3
+ * describes a deployment. The server has no authentication, so it refuses
4
+ * production and any non-loopback URL or address, with no override.
14
5
  */
15
6
  import { z } from "zod";
16
7
  import { bool, ConfigError, deriveRuntime, describeConfigIssues, loadEnvFile, LOOPBACK, runtimeEnv, withoutBlanks, } from "@micacms/runtime";
@@ -28,9 +19,8 @@ const schema = z
28
19
  ADMIN_ORIGINS,
29
20
  ADMIN_DIR,
30
21
  /**
31
- * Set by the `mica` bin, and by nothing else. The audience for the
32
- * startup output: a person at a terminal gets one banner, a log collector
33
- * gets the structured lines.
22
+ * Set only by the `mica` bin: a terminal gets one banner, a log collector
23
+ * gets structured lines.
34
24
  */
35
25
  MICA_CLI: bool(false),
36
26
  /** Whether that front door should open a browser once it is listening. */
@@ -39,14 +29,6 @@ const schema = z
39
29
  .transform((env) => ({
40
30
  ...deriveRuntime({
41
31
  ...env,
42
- // Fixed, not configurable: the local editor edits a checkout. A remote
43
- // repository is the self-hosted app's job.
44
- REPOSITORY: "local",
45
- REPOSITORY_ROOT: "content",
46
- REPOSITORY_BRANCH: "main",
47
- REPOSITORY_TOKEN: undefined,
48
- REPOSITORY_PROJECT: undefined,
49
- REPOSITORY_API_BASE: undefined,
50
32
  // There is no proxy in front of a loopback server to trust.
51
33
  TRUST_PROXY: false,
52
34
  }),
@@ -61,14 +43,7 @@ export function loadConfig(env = process.env) {
61
43
  if (!parsed.success)
62
44
  throw new ConfigError(describeConfigIssues(parsed.error));
63
45
  const config = parsed.data;
64
- /**
65
- * The local editor has no authentication. It must never be reachable.
66
- *
67
- * This is the single most dangerous configuration Mica can be in, so it is
68
- * refused at the three points where it stops being a developer's
69
- * convenience: a production build, a base URL that is not the local
70
- * machine, and a listening address that is not the local machine either.
71
- */
46
+ // The local editor has no authentication, so it must never be reachable from another machine.
72
47
  if (config.isProduction) {
73
48
  throw new ConfigError("The local editor has no authentication, and NODE_ENV=production.\n" +
74
49
  " There is no identity provider and no user: every request is allowed.\n" +
@@ -81,12 +56,9 @@ export function loadConfig(env = process.env) {
81
56
  " It is for a developer's own machine only. Anything reachable by anyone\n" +
82
57
  " else runs @micacms/self-hosted with an identity provider.");
83
58
  }
84
- /**
85
- * The same rule for the socket. A base URL saying `localhost` while the
86
- * process listens on `0.0.0.0` leaves an unauthenticated editor open to the
87
- * whole network. There is deliberately no override.
88
- */
89
- if (!LOOPBACK.has(config.HOST) && config.HOST !== "::1") {
59
+ // A `localhost` URL with a socket on `0.0.0.0` opens the editor to the whole
60
+ // network. No override, on purpose.
61
+ if (!LOOPBACK.has(config.HOST)) {
90
62
  throw new ConfigError(`The local editor has no authentication, but HOST is "${config.HOST}".\n` +
91
63
  " It binds to the loopback address and nothing else. Use HOST=127.0.0.1,\n" +
92
64
  " or run @micacms/self-hosted with an identity provider.");
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,IAAI,EACJ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,GAEd,MAAM,kBAAkB,CAAC;AAE1B,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,SAAS,GACV,GAAG,UAAU,CAAC;AAEf,MAAM,MAAM,GAAG,CAAC;KACb,MAAM,CAAC;IACN,QAAQ;IACR,SAAS;IACT,IAAI;IACJ,IAAI;IACJ,eAAe;IACf,YAAY;IACZ,kBAAkB;IAClB,gBAAgB;IAChB,aAAa;IACb,SAAS;IAET;;;;OAIG;IACH,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC;IACrB,0EAA0E;IAC1E,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;CACvB,CAAC;KACD,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnB,GAAG,aAAa,CAAC;QACf,GAAG,GAAG;QACN,uEAAuE;QACvE,2CAA2C;QAC3C,UAAU,EAA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C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,WAAW,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAE3B,8FAA8F;IAC9F,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,MAAM,IAAI,WAAW,CACnB,oEAAoE;YAClE,0EAA0E;YAC1E,4EAA4E;YAC5E,6BAA6B,CAChC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,WAAW,CACnB,0EAA0E,IAAI,MAAM;YAClF,4EAA4E;YAC5E,6DAA6D,CAChE,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,oCAAoC;IACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,WAAW,CACnB,wDAAwD,MAAM,CAAC,IAAI,MAAM;YACvE,4EAA4E;YAC5E,0DAA0D,CAC7D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/guards.d.ts CHANGED
@@ -1,15 +1,10 @@
1
1
  /**
2
- * The Host allowlist — what replaced the local session's cookie.
2
+ * The Host allowlist.
3
3
  *
4
4
  * Under DNS rebinding, a page re-resolves its own name to `127.0.0.1` and the
5
5
  * browser then treats requests to it as same-origin. Writes still fail on the
6
- * Origin check; *reads* would succeed, and the only thing that used to stop
7
- * them was a session cookie scoped to `localhost` that the rebound name never
8
- * received. The cookie is gone — local mode keeps no session, no token and no
9
- * database — so the rule is stated directly instead: this server answers only
10
- * to names that are this machine.
11
- *
12
- * Smaller than what it replaces, standard for exactly this, and applied in
6
+ * Origin check; *reads* would succeed. Local mode keeps no session or token,
7
+ * so this server answers only to names that are this machine. It applies in
13
8
  * front of everything, the health endpoints included.
14
9
  */
15
10
  import type { MiddlewareHandler } from "hono";
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAa5C,wBAAgB,SAAS,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAgBlD"}
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAa5C,wBAAgB,SAAS,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAgBlD"}
package/dist/guards.js CHANGED
@@ -1,15 +1,10 @@
1
1
  /**
2
- * The Host allowlist — what replaced the local session's cookie.
2
+ * The Host allowlist.
3
3
  *
4
4
  * Under DNS rebinding, a page re-resolves its own name to `127.0.0.1` and the
5
5
  * browser then treats requests to it as same-origin. Writes still fail on the
6
- * Origin check; *reads* would succeed, and the only thing that used to stop
7
- * them was a session cookie scoped to `localhost` that the rebound name never
8
- * received. The cookie is gone — local mode keeps no session, no token and no
9
- * database — so the rule is stated directly instead: this server answers only
10
- * to names that are this machine.
11
- *
12
- * Smaller than what it replaces, standard for exactly this, and applied in
6
+ * Origin check; *reads* would succeed. Local mode keeps no session or token,
7
+ * so this server answers only to names that are this machine. It applies in
13
8
  * front of everything, the health endpoints included.
14
9
  */
15
10
  const ALLOWED = new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
@@ -1 +1 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE,kEAAkE;AAClE,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAExC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,CAAC,IAAI,CACX,kEAAkE;gBAChE,IAAI,IAAI,kBAAkB;gBAC1B,0EAA0E;gBAC1E,4EAA4E,EAC9E,GAAG,CACJ,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE,kEAAkE;AAClE,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAExC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,CAAC,IAAI,CACX,kEAAkE;gBAChE,IAAI,IAAI,kBAAkB;gBAC1B,0EAA0E;gBAC1E,4EAA4E,EAC9E,GAAG,CACJ,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,EAAE,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,7 @@
1
1
  /**
2
- * The local editor's process entry point.
3
- *
4
- * The whole composition, in one page: the local connector, the
5
- * auth-neutral runtime with `allowAll()`, the Host allowlist, and nothing
6
- * else. No session service, no admission policy, no database — `npx
7
- * @micacms/editor` writes nothing outside the content directory, and there is
8
- * no auth code here to misconfigure because none is installed.
2
+ * The local editor's process entry point: the developer's checkout, the
3
+ * auth-neutral runtime and the Host allowlist. It writes nothing outside the
4
+ * content directory and installs no auth code that can be misconfigured.
9
5
  */
10
6
  export {};
11
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/dist/index.js CHANGED
@@ -1,15 +1,10 @@
1
1
  /**
2
- * The local editor's process entry point.
3
- *
4
- * The whole composition, in one page: the local connector, the
5
- * auth-neutral runtime with `allowAll()`, the Host allowlist, and nothing
6
- * else. No session service, no admission policy, no database — `npx
7
- * @micacms/editor` writes nothing outside the content directory, and there is
8
- * no auth code here to misconfigure because none is installed.
2
+ * The local editor's process entry point: the developer's checkout, the
3
+ * auth-neutral runtime and the Host allowlist. It writes nothing outside the
4
+ * content directory and installs no auth code that can be misconfigured.
9
5
  */
10
- import { localConnector } from "@micacms/connectors";
11
6
  import { MANIFEST_PATH } from "@micacms/core";
12
- import { ConfigError, createApp, createLogger, createRuntimeContext, loadSchema, SchemaError, schemaFingerprint, schemaOrigin, startServer, VERSION, } from "@micacms/runtime";
7
+ import { ConfigError, contentFiles, createApp, createLogger, createRuntimeContext, loadSchema, SchemaError, schemaFingerprint, schemaOrigin, startServer, VERSION, } from "@micacms/runtime";
13
8
  import { editorUiDist } from "./admin-dir.js";
14
9
  import { portInUse, startupBanner, supportsColor } from "./banner.js";
15
10
  import { loadConfig } from "./config.js";
@@ -28,13 +23,12 @@ async function main() {
28
23
  throw error;
29
24
  }
30
25
  const logger = createLogger({ level: config.LOG_LEVEL, pretty: true });
31
- // The repository comes first, because the content model is in it. A bad or
32
- // absent model is a project mistake rather than a crash: exit the way a bad
33
- // environment does, with the message on stderr instead of a stack trace.
34
- const connector = localConnector({ root: config.contentRoot });
26
+ // A bad or absent model is a project mistake, not a crash: exit like a bad
27
+ // environment, without a stack trace.
28
+ const files = contentFiles({ root: config.contentRoot });
35
29
  let model;
36
30
  try {
37
- model = await loadSchema(connector);
31
+ model = await loadSchema(files);
38
32
  }
39
33
  catch (error) {
40
34
  if (error instanceof SchemaError) {
@@ -43,16 +37,15 @@ async function main() {
43
37
  }
44
38
  throw error;
45
39
  }
46
- const schemaRevision = await connector.revision(MANIFEST_PATH);
40
+ const schemaRevision = await files.revision(MANIFEST_PATH);
47
41
  const ctx = createRuntimeContext({
48
42
  config,
49
43
  model,
50
- connector,
44
+ files,
51
45
  schemaRevision,
52
46
  logger,
53
47
  operational: () => ({
54
48
  auth: "none — the local editor has no accounts and no sign-in",
55
- database: null,
56
49
  }),
57
50
  });
58
51
  const app = createApp(ctx, {
@@ -66,16 +59,13 @@ async function main() {
66
59
  port: config.PORT,
67
60
  logger,
68
61
  onListening() {
69
- /**
70
- * Two audiences, one event: the person who just typed a command gets an
71
- * address and three facts; a log collector gets every field.
72
- */
62
+ // A person at a terminal gets a short banner; a log collector gets every field.
73
63
  if (config.MICA_CLI) {
74
64
  const useColor = supportsColor(process.stdout, process.env);
75
65
  process.stdout.write(startupBanner({
76
66
  version: VERSION,
77
67
  url: config.MICA_PUBLIC_URL,
78
- contentRoot: connector.origin,
68
+ contentRoot: files.origin,
79
69
  collections: Object.keys(model.collections).length,
80
70
  singletons: Object.keys(model.singletons).length,
81
71
  }, useColor));
@@ -87,8 +77,8 @@ async function main() {
87
77
  url: config.MICA_PUBLIC_URL,
88
78
  listening: `${config.HOST}:${config.PORT}`,
89
79
  auth: "none (local editor; loopback only)",
90
- content: connector.origin,
91
- schema: schemaOrigin(connector),
80
+ content: files.origin,
81
+ schema: schemaOrigin(files),
92
82
  schemaFingerprint: fingerprint,
93
83
  collections: Object.keys(model.collections).length,
94
84
  });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src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C,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micacms/editor",
3
- "version": "0.4.1",
3
+ "version": "0.5.0-rc.1",
4
4
  "type": "module",
5
5
  "description": "The local Mica editor — `npx @micacms/editor` against a checkout on your own machine. No authentication, no database, loopback only.",
6
6
  "license": "MIT",
@@ -23,10 +23,9 @@
23
23
  "dependencies": {
24
24
  "hono": "^4.13.7",
25
25
  "zod": "^4.3.6",
26
- "@micacms/connectors": "0.4.1",
27
- "@micacms/core": "0.4.1",
28
- "@micacms/editor-ui": "0.4.1",
29
- "@micacms/runtime": "0.4.1"
26
+ "@micacms/core": "0.5.0-rc.1",
27
+ "@micacms/editor-ui": "0.5.0-rc.1",
28
+ "@micacms/runtime": "0.5.0-rc.1"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@types/node": "^22.20.1",