lite-matter 0.0.1 → 0.1.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.
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "lite-matter",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Ultra lightweight, zero-bloat frontmatter extractor.",
5
5
  "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
6
9
  "main": "dist/index.js",
7
10
  "types": "dist/index.d.ts",
8
11
  "scripts": {
@@ -32,11 +35,11 @@
32
35
  },
33
36
  "repository": {
34
37
  "type": "git",
35
- "url": "git+https://github.com/docmd-io/docmd.git",
38
+ "url": "git+https://github.com/docmd-io/lite-matter.git",
36
39
  "directory": "lite-matter"
37
40
  },
38
41
  "bugs": {
39
- "url": "https://github.com/docmd-io/docmd/issues"
42
+ "url": "https://github.com/docmd-io/lite-matter/issues"
40
43
  },
41
44
  "homepage": "https://docmd.io",
42
45
  "funding": "https://github.com/sponsors/mgks",
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
@@ -1,32 +0,0 @@
1
- name: Publish to NPM
2
- on:
3
- release:
4
- types: [published]
5
- workflow_dispatch:
6
-
7
- permissions:
8
- contents: read
9
- id-token: write
10
-
11
- jobs:
12
- publish:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v6
16
-
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v6
19
- with:
20
- node-version: '22'
21
- registry-url: 'https://registry.npmjs.org'
22
-
23
- - name: Install dependencies
24
- run: npm install
25
-
26
- - name: Build package
27
- run: npm run build
28
-
29
- - name: Publish to npm
30
- run: npm publish --access public
31
- env:
32
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/src/index.ts DELETED
@@ -1,34 +0,0 @@
1
- import { parse } from 'yaml';
2
-
3
- export interface MatterResult {
4
- data: Record<string, any>;
5
- content: string;
6
- }
7
-
8
- /**
9
- * Extracts and parses YAML frontmatter from a string.
10
- * Mimics the API of `gray-matter` for easy drop-in replacement.
11
- */
12
- export function matter(str: string): MatterResult {
13
- // Regex matches frontmatter bounded by --- only at the very start of the string
14
- const regex = /^(?:---[\r\n]+)([\s\S]*?)(?:[\r\n]+---(?:[\r\n]+|$))/;
15
- const match = str.match(regex);
16
-
17
- if (!match) {
18
- return { data: {}, content: str };
19
- }
20
-
21
- const yamlStr = match[1];
22
- const content = str.slice(match[0].length);
23
-
24
- try {
25
- const data = parse(yamlStr) || {};
26
- return { data, content };
27
- } catch (err) {
28
- // Return empty data but successfully parse the rest of the text if YAML fails
29
- return { data: {}, content: str };
30
- }
31
- }
32
-
33
- // Fallback default export for total compatibility
34
- export default matter;
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "Node16",
5
- "moduleResolution": "node16",
6
- "strict": true,
7
- "declaration": true,
8
- "outDir": "dist",
9
- "esModuleInterop": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "skipLibCheck": true
12
- },
13
- "include": ["src/**/*"]
14
- }