sveltekit-data-plugin 1.5.2 → 1.5.4
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 +6 -3
- package/dist/plugin.mjs +6 -3
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const REGEX = {
|
|
6
6
|
IMAGE: new RegExp(/^\S*(jpg|png|webp|avif|jpeg)$/, "i"),
|
|
7
7
|
YOUTUBE: new RegExp(
|
|
8
|
-
/^(https
|
|
8
|
+
/^(https?:\/\/)?(www\.)?(youtube\.com\/(watch\?v=|embed\/)|youtu\.be\/)[\w-]{11}(\S+)?$/,
|
|
9
9
|
"i"
|
|
10
10
|
)
|
|
11
11
|
};
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function stampURL(src, base) {
|
|
36
|
-
return `${path.resolve(base, src)}?enhanced`;
|
|
36
|
+
return `${path.resolve(base, src.toLowerCase())}?enhanced`;
|
|
37
37
|
}
|
|
38
38
|
function parseObject(str) {
|
|
39
39
|
const updated = str.replaceAll(/{(\n\s*)?/gm, '{"').replaceAll(":", '":').replaceAll(/,(\n\s*)?([^ ])/g, ',"$2');
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
opts.plugin_context,
|
|
52
52
|
stampURL(obj, obj.startsWith("./") && relative ? relative : base)
|
|
53
53
|
);
|
|
54
|
-
return
|
|
54
|
+
return {
|
|
55
|
+
...parseObject(img.slice("export default".length, -1)),
|
|
56
|
+
_filename: obj
|
|
57
|
+
};
|
|
55
58
|
} catch (e) {
|
|
56
59
|
return {
|
|
57
60
|
src: null
|
package/dist/plugin.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import fs from "fs/promises";
|
|
|
4
4
|
const REGEX = {
|
|
5
5
|
IMAGE: new RegExp(/^\S*(jpg|png|webp|avif|jpeg)$/, "i"),
|
|
6
6
|
YOUTUBE: new RegExp(
|
|
7
|
-
/^(https
|
|
7
|
+
/^(https?:\/\/)?(www\.)?(youtube\.com\/(watch\?v=|embed\/)|youtu\.be\/)[\w-]{11}(\S+)?$/,
|
|
8
8
|
"i"
|
|
9
9
|
)
|
|
10
10
|
};
|
|
@@ -32,7 +32,7 @@ function oembed(type, url) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function stampURL(src, base) {
|
|
35
|
-
return `${path.resolve(base, src)}?enhanced`;
|
|
35
|
+
return `${path.resolve(base, src.toLowerCase())}?enhanced`;
|
|
36
36
|
}
|
|
37
37
|
function parseObject(str) {
|
|
38
38
|
const updated = str.replaceAll(/{(\n\s*)?/gm, '{"').replaceAll(":", '":').replaceAll(/,(\n\s*)?([^ ])/g, ',"$2');
|
|
@@ -50,7 +50,10 @@ async function convert(opts, obj, { base, relative, depth = 1 } = {}) {
|
|
|
50
50
|
opts.plugin_context,
|
|
51
51
|
stampURL(obj, obj.startsWith("./") && relative ? relative : base)
|
|
52
52
|
);
|
|
53
|
-
return
|
|
53
|
+
return {
|
|
54
|
+
...parseObject(img.slice("export default".length, -1)),
|
|
55
|
+
_filename: obj
|
|
56
|
+
};
|
|
54
57
|
} catch (e) {
|
|
55
58
|
return {
|
|
56
59
|
src: null
|