sveltekit-data-plugin 1.2.2 → 1.2.3

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
@@ -110,19 +110,15 @@
110
110
  buildStart() {
111
111
  opts.plugin_context = this;
112
112
  },
113
- async transformFile(src) {
114
- var _a;
115
- const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
116
- const d = fm(src);
117
- const attributes = await convert(opts, d.attributes, base2);
118
- return { attributes, body: d.body };
119
- },
120
113
  async transform(src, id) {
114
+ var _a;
121
115
  if (/\.(md)$/.test(id)) {
122
- const { attributes, body } = await this.transformFile(src);
116
+ const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
117
+ const d = fm(src);
118
+ const attributes = await convert(opts, d.attributes, base2);
123
119
  return `
124
120
  ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
125
- export const body = ${JSON.stringify(body)};`;
121
+ export const body = ${JSON.stringify(d.body)};`;
126
122
  }
127
123
  }
128
124
  };
package/dist/plugin.mjs CHANGED
@@ -109,19 +109,15 @@ function importDataPlugin(imagetools_plugin, { base = "./src/data" } = {}) {
109
109
  buildStart() {
110
110
  opts.plugin_context = this;
111
111
  },
112
- async transformFile(src) {
113
- var _a;
114
- const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
115
- const d = fm(src);
116
- const attributes = await convert(opts, d.attributes, base2);
117
- return { attributes, body: d.body };
118
- },
119
112
  async transform(src, id) {
113
+ var _a;
120
114
  if (/\.(md)$/.test(id)) {
121
- const { attributes, body } = await this.transformFile(src);
115
+ const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
116
+ const d = fm(src);
117
+ const attributes = await convert(opts, d.attributes, base2);
122
118
  return `
123
119
  ${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
124
- export const body = ${JSON.stringify(body)};`;
120
+ export const body = ${JSON.stringify(d.body)};`;
125
121
  }
126
122
  }
127
123
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-data-plugin",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "author": {
5
5
  "name": "Jonny Thaw",
6
6
  "url": "https://jthaw.me"