sveltekit-data-plugin 1.3.3 → 1.4.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/dist/plugin.js CHANGED
@@ -9,12 +9,15 @@
9
9
  function oembed(type, url) {
10
10
  switch (type) {
11
11
  case "youtube":
12
- return fetch(`https://youtube.com/oembed?url=${url}&format=json`).then((resp) => resp.json()).catch(() => {
12
+ return fetch(`https://youtube.com/oembed?url=${url}&format=json`).then((resp) => resp.json()).then((data) => ({
13
+ ...data,
14
+ embedType: "youtube"
15
+ })).catch(() => {
13
16
  return {
14
17
  src: url,
15
18
  width: 1280,
16
19
  height: 720,
17
- type: "error"
20
+ embedType: "error"
18
21
  };
19
22
  });
20
23
  default:
@@ -22,7 +25,7 @@
22
25
  src: url,
23
26
  width: 1280,
24
27
  height: 720,
25
- type: "error"
28
+ embedType: "error"
26
29
  });
27
30
  }
28
31
  }
@@ -73,7 +76,10 @@
73
76
  return {
74
77
  attributes: {
75
78
  ...attributes,
76
- id: path.basename(obj)
79
+ _internal: {
80
+ id: path.basename(obj),
81
+ absolute: obj
82
+ }
77
83
  },
78
84
  body: data.body
79
85
  };
package/dist/plugin.mjs CHANGED
@@ -8,12 +8,15 @@ const REGEX = {
8
8
  function oembed(type, url) {
9
9
  switch (type) {
10
10
  case "youtube":
11
- return fetch(`https://youtube.com/oembed?url=${url}&format=json`).then((resp) => resp.json()).catch(() => {
11
+ return fetch(`https://youtube.com/oembed?url=${url}&format=json`).then((resp) => resp.json()).then((data) => ({
12
+ ...data,
13
+ embedType: "youtube"
14
+ })).catch(() => {
12
15
  return {
13
16
  src: url,
14
17
  width: 1280,
15
18
  height: 720,
16
- type: "error"
19
+ embedType: "error"
17
20
  };
18
21
  });
19
22
  default:
@@ -21,7 +24,7 @@ function oembed(type, url) {
21
24
  src: url,
22
25
  width: 1280,
23
26
  height: 720,
24
- type: "error"
27
+ embedType: "error"
25
28
  });
26
29
  }
27
30
  }
@@ -72,7 +75,10 @@ async function convert(opts, obj, { base, relative, depth = 1 } = {}) {
72
75
  return {
73
76
  attributes: {
74
77
  ...attributes,
75
- id: path.basename(obj)
78
+ _internal: {
79
+ id: path.basename(obj),
80
+ absolute: obj
81
+ }
76
82
  },
77
83
  body: data.body
78
84
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveltekit-data-plugin",
3
- "version": "1.3.3",
3
+ "version": "1.4.1",
4
4
  "author": {
5
5
  "name": "Jonny Thaw",
6
6
  "url": "https://jthaw.me"