vite-plugin-norg 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Drake Bott
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # vite-plugin-norg
2
+
3
+ A Vite plugin that enables importing and processing `.norg` files (Neorg markup format) in your Vite projects with support for HTML, Svelte, and React output targets.
4
+
5
+ - Built on top of the [rust-norg](https://github.com/nvim-neorg/rust-norg) parser
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install vite-plugin-norg
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Basic Setup
16
+
17
+ Add the plugin to your `vite.config.js`:
18
+
19
+ ```js
20
+ import { norgPlugin } from 'vite-plugin-norg';
21
+ import { defineConfig } from 'vite';
22
+
23
+ export default defineConfig({
24
+ plugins: [norgPlugin({ mode: 'html', include: ['/**/*.norg'] })],
25
+ });
26
+ ```
@@ -0,0 +1,2 @@
1
+ import { NorgParseResult } from '../wasm';
2
+ export declare const generateHtmlOutput: ({ html, metadata }: NorgParseResult) => string;
@@ -0,0 +1,2 @@
1
+ import { NorgParseResult } from '../wasm';
2
+ export declare function generateReactOutput({ html, metadata }: NorgParseResult): string;
@@ -0,0 +1,2 @@
1
+ import { NorgParseResult } from '../wasm';
2
+ export declare function generateSvelteOutput({ html, metadata }: NorgParseResult): string;
@@ -0,0 +1,32 @@
1
+ import { norgPlugin } from './plugin';
2
+ import { NorgMetadata } from './wasm';
3
+ export { norgPlugin } from './plugin';
4
+ export type { NorgMetadata, NorgParseResult, TocEntry } from './wasm';
5
+ export default norgPlugin;
6
+ /**
7
+ * Module type for .norg files processed by the HTML generator
8
+ */
9
+ export interface HtmlModule {
10
+ metadata: NorgMetadata;
11
+ html: string;
12
+ }
13
+ /**
14
+ * Module type for .norg files processed by the React generator
15
+ */
16
+ export interface ReactModule {
17
+ metadata: NorgMetadata;
18
+ Component: () => unknown;
19
+ }
20
+ /**
21
+ * Module type for .norg files processed by the Svelte generator
22
+ */
23
+ export interface SvelteModule {
24
+ metadata: NorgMetadata;
25
+ default: new (options: {
26
+ target: unknown;
27
+ props?: Record<string, unknown>;
28
+ }) => {
29
+ $destroy(): void;
30
+ $set(props: Record<string, unknown>): void;
31
+ };
32
+ }