sveltekit-data-plugin 1.0.0 → 1.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/README.md CHANGED
@@ -44,9 +44,9 @@ Then you can import a markdown file in a `page.js`, or whatever, like
44
44
  ```page.js
45
45
  /** @type {import('./$types').PageLoad} */
46
46
  export async function load() {
47
- const d = await import('$data/home.md').then((mod) => mod.default);
47
+ const data = await import('$data/home.md');
48
48
 
49
- return d;
49
+ return data;
50
50
  }
51
51
  ```
52
52
 
package/dist/plugin.js CHANGED
@@ -88,10 +88,9 @@
88
88
  const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
89
89
  const d = fm(src);
90
90
  const attributes = await convert(opts, d.attributes, base2);
91
- return `export default ${JSON.stringify({
92
- attributes,
93
- body: d.body
94
- })}`;
91
+ return `
92
+ ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
93
+ export const body = ${JSON.stringify(d.body)};`;
95
94
  }
96
95
  }
97
96
  };
package/dist/plugin.mjs CHANGED
@@ -87,10 +87,9 @@ function importDataPlugin(imagetools_plugin, { base = "./src/data" } = {}) {
87
87
  const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
88
88
  const d = fm(src);
89
89
  const attributes = await convert(opts, d.attributes, base2);
90
- return `export default ${JSON.stringify({
91
- attributes,
92
- body: d.body
93
- })}`;
90
+ return `
91
+ ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
92
+ export const body = ${JSON.stringify(d.body)};`;
94
93
  }
95
94
  }
96
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-data-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "author": {
5
5
  "name": "Jonny Thaw",
6
6
  "url": "https://jthaw.me"