sveltekit-data-plugin 1.3.0 → 1.3.2

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/dist/plugin.js CHANGED
@@ -59,7 +59,10 @@
59
59
  if (typeof obj === "string" && /^\S*(.md)$/.test(obj) && depth === 1) {
60
60
  try {
61
61
  const markdownFile = path.resolve(base, obj);
62
- const relativeFolder = path.basename(markdownFile);
62
+ const relativeFolder = obj.replace(
63
+ `/${path.basename(markdownFile)}`,
64
+ ""
65
+ );
63
66
  const contents = await fs.readFile(markdownFile, "utf-8");
64
67
  const data = fm(contents);
65
68
  const attributes = await convert(opts, data.attributes, {
@@ -122,7 +125,7 @@
122
125
  if (/\.(md)$/.test(id)) {
123
126
  const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
124
127
  const d = fm(src);
125
- const attributes = await convert(opts, d.attributes, base2);
128
+ const attributes = await convert(opts, d.attributes, { base: base2 });
126
129
  return `
127
130
  ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
128
131
  export const body = ${JSON.stringify(d.body)};`;
package/dist/plugin.mjs CHANGED
@@ -58,7 +58,10 @@ async function convert(opts, obj, { base, relative, depth = 1 } = {}) {
58
58
  if (typeof obj === "string" && /^\S*(.md)$/.test(obj) && depth === 1) {
59
59
  try {
60
60
  const markdownFile = path.resolve(base, obj);
61
- const relativeFolder = path.basename(markdownFile);
61
+ const relativeFolder = obj.replace(
62
+ `/${path.basename(markdownFile)}`,
63
+ ""
64
+ );
62
65
  const contents = await fs.readFile(markdownFile, "utf-8");
63
66
  const data = fm(contents);
64
67
  const attributes = await convert(opts, data.attributes, {
@@ -121,7 +124,7 @@ function importDataPlugin(imagetools_plugin, { base = "./src/data" } = {}) {
121
124
  if (/\.(md)$/.test(id)) {
122
125
  const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
123
126
  const d = fm(src);
124
- const attributes = await convert(opts, d.attributes, base2);
127
+ const attributes = await convert(opts, d.attributes, { base: base2 });
125
128
  return `
126
129
  ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
127
130
  export const body = ${JSON.stringify(d.body)};`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-data-plugin",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "author": {
5
5
  "name": "Jonny Thaw",
6
6
  "url": "https://jthaw.me"