@pitlane/content 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +15 -16
  2. package/README.md +16 -21
  3. package/package.json +92 -94
package/CHANGELOG.md CHANGED
@@ -1,22 +1,21 @@
1
1
  # @pitlane/content
2
2
 
3
+ ## 0.1.1
4
+
5
+ Documentation only. No code changed.
6
+
7
+ - The npm description is one line now: "Schema-validated content collections for Remix." The old one led with `createContent()` and ran well past what a registry listing shows.
8
+ - The README quick start guards the entry it reads. `getEntry()` answers `undefined` when no entry has the requested id, and the sample called `render()` on the result regardless, so a route copied out of it threw on the first unknown slug.
9
+ - The install section states the supported Node range and what each optional peer is for: `remix` for `render()`, `satteri` for compiling Markdown and MDX bodies, `vite` 8 or newer for `contentLayer()`. A collection of JSON or YAML files alone needs no Sätteri setup.
10
+ - Link the content guide, the no-build guide, and the custom-loaders section separately. Replace the unpublished `/guides/content-loaders` URL with `/guides/content#custom-loaders`.
11
+
3
12
  ## 0.1.0
4
13
 
5
14
  Initial release.
6
15
 
7
- - `createContent` returns typed collection handles synchronously without loading
8
- entries. Reads and rendering remain asynchronous; declaration errors throw
9
- synchronously.
10
- - `getCollection`, `getCollection(filter)`, and `getEntry` over entries sorted
11
- by id; `c.reference(collection)` for typed pointers between collections.
12
- - `render()` resolves an entry's Markdown or MDX to a Remix component and its
13
- heading list, parsing nothing until it is called.
14
- - Two loader interfaces: `ContentLoader` resolves a whole collection in one
15
- execution and can be prebuilt, `LiveLoader` answers one query at a time and
16
- runs on every read. `loaders.glob` and `loaders.file` implement the first.
17
- - `contentLayer()` from `@pitlane/content/vite` loads `ContentLoader` collections
18
- after evaluating their declarations and inlines them into the bundle. It waits
19
- for loading and validation before emitting, and watches the loaders' sources
20
- in dev.
21
- - `headings()` from `@pitlane/content/satteri` produces the heading list on both
22
- rendering paths.
16
+ - `createContent` returns typed collection handles synchronously without loading entries. Reads and rendering remain asynchronous; declaration errors throw synchronously.
17
+ - `getCollection`, `getCollection(filter)`, and `getEntry` over entries sorted by id; `c.reference(collection)` for typed pointers between collections.
18
+ - `render()` resolves an entry's Markdown or MDX to a Remix component and its heading list, parsing nothing until it is called.
19
+ - Two loader interfaces: `ContentLoader` resolves a whole collection in one execution and can be prebuilt, `LiveLoader` answers one query at a time and runs on every read. `loaders.glob` and `loaders.file` implement the first.
20
+ - `contentLayer()` from `@pitlane/content/vite` loads `ContentLoader` collections after evaluating their declarations and inlines them into the bundle. It waits for loading and validation before emitting, and watches the loaders' sources in dev.
21
+ - `headings()` from `@pitlane/content/satteri` produces the heading list on both rendering paths.
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # @pitlane/content
2
2
 
3
- Schema-validated, cross-referenced content collections for [Remix 3](https://remix.run).
3
+ Schema-validated, cross-referenced content collections for [Remix](https://remix.run).
4
4
 
5
- Reads Markdown, MDX, JSON, and YAML into collections a controller queries like a
6
- database. Frontmatter is validated against a schema, one entry can reference
7
- another, and the types come from the schema rather than from generated code.
5
+ Reads Markdown, MDX, JSON, and YAML into collections a controller queries like a database. Frontmatter is validated against a schema, one entry can reference another, and the types come from the schema rather than from generated code.
8
6
 
9
7
  ```sh
10
8
  npm install @pitlane/content
11
9
  ```
12
10
 
11
+ Requires Node `^20.19.0 || >=22.12.0`. All three peer dependencies are optional: `remix` for `render()`, `satteri` for compiling Markdown and MDX bodies, and `vite` 8 or newer for `contentLayer()`. With a Vite build, `satteri` and `vite-plugin-satteri` are dev dependencies; without a build, `satteri` is a runtime dependency. A collection of only JSON or YAML files needs no Sätteri setup at all.
12
+
13
13
  ```ts
14
14
  import { createContent } from "@pitlane/content";
15
15
  import * as loaders from "@pitlane/content/loaders";
@@ -35,18 +35,17 @@ export let content = createContent(c => ({
35
35
  ```ts
36
36
  let posts = await content.blog.getCollection();
37
37
  let post = await content.blog.getEntry(params.slug);
38
- let { Content, headings } = await post.render();
39
- let author = await content.authors.getEntry(post.data.author);
38
+ if (post) {
39
+ let { Content, headings } = await post.render();
40
+ let author = await content.authors.getEntry(post.data.author);
41
+ }
40
42
  ```
41
43
 
42
- `createContent()` returns synchronously without loading entries. Import the
43
- returned object wherever you need it; reads and rendering stay asynchronous.
44
+ `getEntry()` returns `undefined` when no entry has the requested ID.
45
+
46
+ `createContent()` returns synchronously without loading entries. Import the returned object wherever you need it; reads and rendering stay asynchronous.
44
47
 
45
- The loaders are ordinary runtime code, which covers Node, Bun, Deno, and
46
- container hosts. For a host with no filesystem, add `contentLayer()` from
47
- `@pitlane/content/vite` and the build resolves the collections ahead of time,
48
- inlining entry data and compiling Markdown bodies into the bundle. The
49
- collection declarations do not change.
48
+ The loaders are ordinary runtime code, which covers Node, Bun, Deno, and container hosts. For a host with no filesystem, add `contentLayer()` from `@pitlane/content/vite` and the build resolves the collections ahead of time, inlining entry data and compiling Markdown bodies into the bundle. The collection declarations do not change.
50
49
 
51
50
  ## Entry points
52
51
 
@@ -59,17 +58,13 @@ collection declarations do not change.
59
58
 
60
59
  ## Without Remix
61
60
 
62
- Every peer dependency is optional. The data path, meaning the loaders, schema
63
- validation, and both query methods, has no static dependency on `remix` and
64
- works with any [Standard Schema](https://standardschema.dev) validator. Only
65
- `render()` needs Remix, because it resolves to a Remix component, and it says
66
- so if you call it without one.
61
+ The loaders, schema validation, and query methods work with any [Standard Schema](https://standardschema.dev) validator without importing Remix. Rendering returns a Remix component, so it requires Remix. Rendering Markdown or MDX also needs `satteri` unless `contentLayer()` compiled the collection during the build.
67
62
 
68
63
  ## Documentation
69
64
 
70
- - [Content](https://pitlane.tools/guides/content), whose toggle also serves
71
- [an application that runs without a build](https://pitlane.tools/guides/content-no-build)
72
- - [Creating a content loader](https://pitlane.tools/guides/content-loaders)
65
+ - [Content](https://pitlane.tools/guides/content), for an application with a Vite build
66
+ - [Content (No Build)](https://pitlane.tools/guides/content-no-build), for an application that runs without one
67
+ - [Custom loaders](https://pitlane.tools/guides/content#custom-loaders)
73
68
  - [API reference](https://pitlane.tools/package/content/)
74
69
 
75
70
  ## License
package/package.json CHANGED
@@ -1,104 +1,102 @@
1
1
  {
2
- "name": "@pitlane/content",
3
- "version": "0.1.0",
4
- "description": "createContent() — schema-validated, cross-referenced Markdown, MDX, and data collections for Remix 3, queryable at runtime and prebuildable into the bundle.",
5
- "keywords": [
6
- "content",
7
- "content-collections",
8
- "markdown",
9
- "mdx",
10
- "pitlane",
11
- "remix",
12
- "satteri"
13
- ],
14
- "homepage": "https://pitlane.tools/package/content/",
15
- "bugs": {
16
- "url": "https://github.com/pitlane-tools/pitlane/issues"
2
+ "name": "@pitlane/content",
3
+ "version": "0.1.1",
4
+ "description": "Schema-validated content collections for Remix.",
5
+ "keywords": [
6
+ "content",
7
+ "content-collections",
8
+ "markdown",
9
+ "mdx",
10
+ "pitlane",
11
+ "remix",
12
+ "satteri"
13
+ ],
14
+ "homepage": "https://pitlane.tools/package/content/",
15
+ "bugs": {
16
+ "url": "https://github.com/pitlane-tools/pitlane/issues"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Mark Malstrom <mark@malstrom.me>",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/pitlane-tools/pitlane.git",
23
+ "directory": "packages/content"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "CHANGELOG.md"
28
+ ],
29
+ "type": "module",
30
+ "types": "./dist/index.d.mts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.mts",
34
+ "import": "./dist/index.mjs"
17
35
  },
18
- "license": "MIT",
19
- "author": "Mark Malstrom <mark@malstrom.me>",
20
- "repository": {
21
- "type": "git",
22
- "url": "git+https://github.com/pitlane-tools/pitlane.git",
23
- "directory": "packages/content"
36
+ "./loaders": {
37
+ "types": "./dist/loaders.d.mts",
38
+ "import": "./dist/loaders.mjs"
24
39
  },
25
- "files": [
26
- "dist",
27
- "CHANGELOG.md"
28
- ],
29
- "type": "module",
30
- "types": "./dist/index.d.mts",
31
- "exports": {
32
- ".": {
33
- "types": "./dist/index.d.mts",
34
- "import": "./dist/index.mjs"
35
- },
36
- "./loaders": {
37
- "types": "./dist/loaders.d.mts",
38
- "import": "./dist/loaders.mjs"
39
- },
40
- "./satteri": {
41
- "types": "./dist/satteri.d.mts",
42
- "import": "./dist/satteri.mjs"
43
- },
44
- "./vite": {
45
- "types": "./dist/vite.d.mts",
46
- "import": "./dist/vite.mjs"
47
- },
48
- "./hot": {
49
- "types": "./dist/hot.d.mts",
50
- "import": "./dist/hot.mjs"
51
- },
52
- "./internal/manifest": {
53
- "types": "./dist/manifest.d.mts",
54
- "import": "./dist/manifest.mjs"
55
- },
56
- "./internal/prebuild": {
57
- "types": "./dist/prebuild.d.mts",
58
- "import": "./dist/prebuild.mjs"
59
- },
60
- "./internal/codegen": {
61
- "types": "./dist/codegen.d.mts",
62
- "import": "./dist/codegen.mjs"
63
- },
64
- "./internal/mdx": {
65
- "types": "./dist/mdx.d.mts",
66
- "import": "./dist/mdx.mjs"
67
- }
40
+ "./satteri": {
41
+ "types": "./dist/satteri.d.mts",
42
+ "import": "./dist/satteri.mjs"
68
43
  },
69
- "scripts": {
70
- "prepublishOnly": "vp run build"
44
+ "./vite": {
45
+ "types": "./dist/vite.d.mts",
46
+ "import": "./dist/vite.mjs"
71
47
  },
72
- "dependencies": {
73
- "es-module-lexer": "^2.3.1",
74
- "yaml": "^2.8.1"
48
+ "./hot": {
49
+ "types": "./dist/hot.d.mts",
50
+ "import": "./dist/hot.mjs"
75
51
  },
76
- "devDependencies": {
77
- "@types/node": "^25.5.0",
78
- "remix": "3.0.0-rc.2",
79
- "satteri": "^0.10.5",
80
- "typescript": "^7.0.2",
81
- "vite": "^8.1.5",
82
- "vite-plugin-satteri": "^0.3.5",
83
- "vite-plus": "^0.2.6"
52
+ "./internal/manifest": {
53
+ "types": "./dist/manifest.d.mts",
54
+ "import": "./dist/manifest.mjs"
84
55
  },
85
- "peerDependencies": {
86
- "remix": "^3.0.0-rc.1",
87
- "satteri": "^0.10.5",
88
- "vite": ">=8.0.0"
56
+ "./internal/prebuild": {
57
+ "types": "./dist/prebuild.d.mts",
58
+ "import": "./dist/prebuild.mjs"
89
59
  },
90
- "peerDependenciesMeta": {
91
- "remix": {
92
- "optional": true
93
- },
94
- "satteri": {
95
- "optional": true
96
- },
97
- "vite": {
98
- "optional": true
99
- }
60
+ "./internal/codegen": {
61
+ "types": "./dist/codegen.d.mts",
62
+ "import": "./dist/codegen.mjs"
100
63
  },
101
- "engines": {
102
- "node": "^20.19.0 || >=22.12.0"
64
+ "./internal/mdx": {
65
+ "types": "./dist/mdx.d.mts",
66
+ "import": "./dist/mdx.mjs"
103
67
  }
104
- }
68
+ },
69
+ "dependencies": {
70
+ "es-module-lexer": "^2.3.1",
71
+ "yaml": "^2.8.1"
72
+ },
73
+ "devDependencies": {
74
+ "@types/node": "^25.5.0",
75
+ "remix": "3.0.0-rc.2",
76
+ "satteri": "^0.10.5",
77
+ "typescript": "^7.0.2",
78
+ "vite": "^8.1.5",
79
+ "vite-plugin-satteri": "^0.3.5",
80
+ "vite-plus": "^0.2.6"
81
+ },
82
+ "peerDependencies": {
83
+ "remix": "^3.0.0-rc.1",
84
+ "satteri": "^0.10.5",
85
+ "vite": ">=8.0.0"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "remix": {
89
+ "optional": true
90
+ },
91
+ "satteri": {
92
+ "optional": true
93
+ },
94
+ "vite": {
95
+ "optional": true
96
+ }
97
+ },
98
+ "engines": {
99
+ "node": "^20.19.0 || >=22.12.0"
100
+ },
101
+ "scripts": {}
102
+ }