@gravito/monolith 1.0.0-alpha.2 → 1.0.0-alpha.5
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.zh-TW.md +35 -0
- package/dist/index.js +1 -0
- package/dist/src/index.js +32 -4
- package/ion/src/index.js +4631 -0
- package/package.json +2 -2
- package/signal/src/index.js +101809 -0
- package/src/ContentManager.ts +23 -7
- package/src/index.ts +1 -0
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @gravito/monolith
|
|
2
|
+
|
|
3
|
+
> Gravito 的檔案式 CMS,將 Markdown 內容轉成 API。
|
|
4
|
+
|
|
5
|
+
## 安裝
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @gravito/monolith
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速開始
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { PlanetCore } from 'gravito-core'
|
|
15
|
+
import { OrbitContent } from '@gravito/monolith'
|
|
16
|
+
|
|
17
|
+
const core = new PlanetCore()
|
|
18
|
+
|
|
19
|
+
core.boot({
|
|
20
|
+
orbits: [OrbitContent],
|
|
21
|
+
config: {
|
|
22
|
+
content: {
|
|
23
|
+
root: './content',
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
app.get('/blog/:slug', async (c) => {
|
|
31
|
+
const content = c.get('content')
|
|
32
|
+
const post = await content.collection('blog').slug(c.req.param('slug')).fetch()
|
|
33
|
+
return c.json(post)
|
|
34
|
+
})
|
|
35
|
+
```
|
package/dist/index.js
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -4,6 +4,23 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __reExport = (target, mod, secondTarget) => {
|
|
8
|
+
for (let key of __getOwnPropNames(mod))
|
|
9
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
10
|
+
__defProp(target, key, {
|
|
11
|
+
get: () => mod[key],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (secondTarget) {
|
|
15
|
+
for (let key of __getOwnPropNames(mod))
|
|
16
|
+
if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
|
|
17
|
+
__defProp(secondTarget, key, {
|
|
18
|
+
get: () => mod[key],
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
return secondTarget;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
7
24
|
var __toESM = (mod, isNodeMode, target) => {
|
|
8
25
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
26
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
@@ -16,6 +33,16 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
16
33
|
return to;
|
|
17
34
|
};
|
|
18
35
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, {
|
|
39
|
+
get: all[name],
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
set: (newValue) => all[name] = () => newValue
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
19
46
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
47
|
|
|
21
48
|
// ../../node_modules/.bun/kind-of@6.0.3/node_modules/kind-of/index.js
|
|
@@ -5570,7 +5597,7 @@ class ContentManager {
|
|
|
5570
5597
|
}
|
|
5571
5598
|
|
|
5572
5599
|
// src/index.ts
|
|
5573
|
-
class
|
|
5600
|
+
class OrbitMonolith {
|
|
5574
5601
|
config;
|
|
5575
5602
|
constructor(config = {}) {
|
|
5576
5603
|
this.config = config;
|
|
@@ -5583,14 +5610,15 @@ class ContentOrbit {
|
|
|
5583
5610
|
manager.defineCollection(name, config);
|
|
5584
5611
|
}
|
|
5585
5612
|
}
|
|
5586
|
-
core.
|
|
5613
|
+
core.adapter.use("*", async (c, next) => {
|
|
5587
5614
|
c.set("content", manager);
|
|
5588
5615
|
await next();
|
|
5616
|
+
return;
|
|
5589
5617
|
});
|
|
5590
|
-
core.logger.info("
|
|
5618
|
+
core.logger.info("Orbit Monolith installed ⬛️");
|
|
5591
5619
|
}
|
|
5592
5620
|
}
|
|
5593
5621
|
export {
|
|
5594
|
-
|
|
5622
|
+
OrbitMonolith,
|
|
5595
5623
|
ContentManager
|
|
5596
5624
|
};
|