sveltekit-data-plugin 1.3.4 → 1.4.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 +9 -2
- package/dist/plugin.mjs +9 -2
- package/package.json +3 -2
package/dist/plugin.js
CHANGED
|
@@ -76,7 +76,10 @@
|
|
|
76
76
|
return {
|
|
77
77
|
attributes: {
|
|
78
78
|
...attributes,
|
|
79
|
-
|
|
79
|
+
_internal: {
|
|
80
|
+
id: path.basename(obj),
|
|
81
|
+
absolute: obj
|
|
82
|
+
}
|
|
80
83
|
},
|
|
81
84
|
body: data.body
|
|
82
85
|
};
|
|
@@ -127,8 +130,12 @@
|
|
|
127
130
|
var _a;
|
|
128
131
|
if (/\.(md)$/.test(id)) {
|
|
129
132
|
const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
|
|
133
|
+
const relativeFolder = id.replace(`/${path.basename(id)}`, "");
|
|
130
134
|
const d = fm(src);
|
|
131
|
-
const attributes = await convert(opts, d.attributes, {
|
|
135
|
+
const attributes = await convert(opts, d.attributes, {
|
|
136
|
+
base: base2,
|
|
137
|
+
relative: relativeFolder
|
|
138
|
+
});
|
|
132
139
|
return `
|
|
133
140
|
${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
|
|
134
141
|
export const body = ${JSON.stringify(d.body)};`;
|
package/dist/plugin.mjs
CHANGED
|
@@ -75,7 +75,10 @@ async function convert(opts, obj, { base, relative, depth = 1 } = {}) {
|
|
|
75
75
|
return {
|
|
76
76
|
attributes: {
|
|
77
77
|
...attributes,
|
|
78
|
-
|
|
78
|
+
_internal: {
|
|
79
|
+
id: path.basename(obj),
|
|
80
|
+
absolute: obj
|
|
81
|
+
}
|
|
79
82
|
},
|
|
80
83
|
body: data.body
|
|
81
84
|
};
|
|
@@ -126,8 +129,12 @@ function importDataPlugin(imagetools_plugin, { base = "./src/data" } = {}) {
|
|
|
126
129
|
var _a;
|
|
127
130
|
if (/\.(md)$/.test(id)) {
|
|
128
131
|
const base2 = path.resolve(((_a = opts.vite_config) == null ? void 0 : _a.root) ?? "", opts.base);
|
|
132
|
+
const relativeFolder = id.replace(`/${path.basename(id)}`, "");
|
|
129
133
|
const d = fm(src);
|
|
130
|
-
const attributes = await convert(opts, d.attributes, {
|
|
134
|
+
const attributes = await convert(opts, d.attributes, {
|
|
135
|
+
base: base2,
|
|
136
|
+
relative: relativeFolder
|
|
137
|
+
});
|
|
131
138
|
return `
|
|
132
139
|
${Object.entries(attributes).map(([key, value]) => `export const ${key} = ${JSON.stringify(value)};`).join("\n")}
|
|
133
140
|
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
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Jonny Thaw",
|
|
6
6
|
"url": "https://jthaw.me"
|
|
@@ -29,5 +29,6 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"front-matter": "^4.0.2"
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
33
34
|
}
|