@raketa-builder/builder 0.11.0 → 0.12.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/builder",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -70,11 +70,18 @@ const videoType = (url) => {
70
70
  };
71
71
 
72
72
  const youtubeId = (url) => {
73
- const matches = url.match(
73
+ let matches = url.match(
74
74
  /(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
75
- );
76
- return matches !== "" && matches !== null ? matches[5] : "";
77
- };
75
+ )
76
+
77
+ if (matches && matches[5]) {
78
+ return matches[5]
79
+ }
80
+
81
+ matches = url.match(/youtu\.be\/|youtube\.com\/shorts\/(?<id>.*)(\?.*)?/)
82
+
83
+ return matches?.groups?.id || ''
84
+ }
78
85
 
79
86
  const vimeoId = (url) => {
80
87
  const matches = url.match(/http(s?):\/\/(www\.)?vimeo\.com\/(\d+)($|\/)/);