sveltekit-data-plugin 1.0.0 → 1.0.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.
- package/README.md +2 -2
- package/dist/plugin.js +3 -4
- package/dist/plugin.mjs +3 -4
- package/package.json +1 -1
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
|
|
47
|
+
const data = await import('$data/home.md');
|
|
48
48
|
|
|
49
|
-
return
|
|
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 `
|
|
92
|
-
|
|
93
|
-
|
|
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 `
|
|
91
|
-
|
|
92
|
-
|
|
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
|
};
|