@storyblok/astro 2.5.2 → 2.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.
@@ -8,7 +8,7 @@
8
8
  export const storyblokApiInstance = storyblokApi;
9
9
  `}}}const x=/[\p{Lu}]/u,R=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,$=/([\p{Alpha}\p{N}_]|$)/u,b=/[_.\- ]+/,O=new RegExp("^"+b.source),v=new RegExp(b.source+$.source,"gu"),I=new RegExp("\\d+"+$.source,"gu"),N=(r,e,t,o)=>{let a=!1,s=!1,n=!1,f=!1;for(let l=0;l<r.length;l++){const i=r[l];f=l>2?r[l-3]==="-":!0,a&&x.test(i)?(r=r.slice(0,l)+"-"+r.slice(l),a=!1,n=s,s=!0,l++):s&&n&&R.test(i)&&(!f||o)?(r=r.slice(0,l-1)+"-"+r.slice(l-1),n=s,s=!1,a=!0):(a=e(i)===i&&t(i)!==i,n=s,s=t(i)===i&&e(i)!==i)}return r},L=(r,e)=>(k.lastIndex=0,r.replace(k,t=>e(t))),M=(r,e)=>(v.lastIndex=0,I.lastIndex=0,r.replace(v,(t,o)=>e(o)).replace(I,t=>e(t)));function w(r,e){if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(r)?r=r.map(s=>s.trim()).filter(s=>s.length).join("-"):r=r.trim(),r.length===0)return"";const t=e.locale===!1?s=>s.toLowerCase():s=>s.toLocaleLowerCase(e.locale),o=e.locale===!1?s=>s.toUpperCase():s=>s.toLocaleUpperCase(e.locale);return r.length===1?b.test(r)?"":e.pascalCase?o(r):t(r):(r!==t(r)&&(r=N(r,t,o,e.preserveConsecutiveUppercase)),r=r.replace(O,""),r=e.preserveConsecutiveUppercase?L(r,t):t(r),e.pascalCase&&(r=o(r.charAt(0))+r.slice(1)),M(r,o))}function P(r,e,t,o){const a="virtual:storyblok-components",s="\0"+a;return{name:"vite-plugin-storyblok-components",async resolveId(n){if(n===a)return s},async load(n){if(n===s){const f=[],l=[];for await(const[c,d]of Object.entries(e)){const p=await this.resolve("/"+r+"/"+d+".astro");if(p)f.push(`import ${w(c)} from "${p.id}"`);else if(t)l.push(c);else throw new Error(`Component could not be found for blok "${c}"! Does "${"/"+r+"/"+d}.astro" exist?`)}let i="";if(t)if(i=",FallbackComponent",o){const c=await this.resolve("/"+r+"/"+o+".astro");if(!c)throw new Error(`Custom fallback component could not be found. Does "${"/"+r+"/"+o}.astro" exist?`);f.push(`import FallbackComponent from "${c.id}"`)}else f.push("import FallbackComponent from '@storyblok/astro/FallbackComponent.astro'");if(Object.values(e).length)return`${f.join(";")};export default {${Object.keys(e).filter(c=>!l.includes(c)).map(c=>w(c)).join(",")}${i}}`;if(t)return`${f[0]}; export default {${i.replace(",","")}}`;throw new Error(`Currently, no Storyblok components are registered in astro.config.mjs.
10
10
  Please register your components or enable the fallback component.
11
- Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function _(r){const e="virtual:storyblok-options",t="\0"+e;return{name:"vite-plugin-storyblok-options",async resolveId(o){if(o===e)return t},async load(o){if(o===t)return`export default ${JSON.stringify(r)}`}}}let T=!1;const E=[],z=r=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=a=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}T?a():E.push(a)},document.getElementById("storyblok-javascript-bridge")))return;const o=document.createElement("script");o.async=!0,o.src=r,o.id="storyblok-javascript-bridge",o.onerror=a=>t(a),o.onload=a=>{E.forEach(s=>s()),T=!0,e(a)},document.getElementsByTagName("head")[0].appendChild(o)});var D=Object.defineProperty,U=(r,e,t)=>e in r?D(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C=(r,e,t)=>(U(r,typeof e!="symbol"?e+"":e,t),t);const q=function(r,e){const t={};for(const o in r){const a=r[o];e.indexOf(o)>-1&&a!==null&&(t[o]=a)}return t},B=r=>r==="email",F=()=>({singleTag:"hr"}),J=()=>({tag:"blockquote"}),K=()=>({tag:"ul"}),V=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),G=()=>({singleTag:"br"}),W=r=>({tag:`h${r.attrs.level}`}),H=r=>({singleTag:[{tag:"img",attrs:q(r.attrs,["src","alt","title"])}]}),Y=()=>({tag:"li"}),Q=()=>({tag:"ol"}),X=()=>({tag:"p"}),Z=r=>({tag:[{tag:"span",attrs:{["data-type"]:"emoji",["data-name"]:r.attrs.name,emoji:r.attrs.emoji}}]}),ee=()=>({tag:"b"}),te=()=>({tag:"strike"}),re=()=>({tag:"u"}),oe=()=>({tag:"strong"}),se=()=>({tag:"code"}),ae=()=>({tag:"i"}),ne=r=>{const e={...r.attrs},{linktype:t="url"}=r.attrs;if(B(t)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),e.custom){for(const o in e.custom)e[o]=e.custom[o];delete e.custom}return{tag:[{tag:"a",attrs:e}]}},le=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ie=()=>({tag:"sub"}),ce=()=>({tag:"sup"}),ge=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ue=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${r.attrs.color};`}}]}:{tag:""}},fe=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${r.attrs.color}`}}]}:{tag:""}},S={nodes:{horizontal_rule:F,blockquote:J,bullet_list:K,code_block:V,hard_break:G,heading:W,image:H,list_item:Y,ordered_list:Q,paragraph:X,emoji:Z},marks:{bold:ee,strike:te,underline:re,strong:oe,code:se,italic:ae,link:ne,styled:le,subscript:ie,superscript:ce,anchor:ge,highlight:ue,textStyle:fe}},de=function(r){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,o=RegExp(t.source);return r&&o.test(r)?r.replace(t,a=>e[a]):r};class A{constructor(e){C(this,"marks"),C(this,"nodes"),e||(e=S),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1}){if(e&&e.content&&Array.isArray(e.content)){let o="";return e.content.forEach(a=>{o+=this.renderNode(a)}),t.optimizeImages?this.optimizeImages(o,t.optimizeImages):o}return console.warn(`The render method must receive an Object with a "content" field.
11
+ Detailed information can be found here: https://github.com/storyblok/storyblok-astro`)}}}}function _(r){const e="virtual:storyblok-options",t="\0"+e;return{name:"vite-plugin-storyblok-options",async resolveId(o){if(o===e)return t},async load(o){if(o===t)return`export default ${JSON.stringify(r)}`}}}let T=!1;const E=[],z=r=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=a=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}T?a():E.push(a)},document.getElementById("storyblok-javascript-bridge")))return;const o=document.createElement("script");o.async=!0,o.src=r,o.id="storyblok-javascript-bridge",o.onerror=a=>t(a),o.onload=a=>{E.forEach(s=>s()),T=!0,e(a)},document.getElementsByTagName("head")[0].appendChild(o)});var D=Object.defineProperty,U=(r,e,t)=>e in r?D(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C=(r,e,t)=>(U(r,typeof e!="symbol"?e+"":e,t),t);const q=function(r,e){const t={};for(const o in r){const a=r[o];e.indexOf(o)>-1&&a!==null&&(t[o]=a)}return t},B=r=>r==="email",F=()=>({singleTag:"hr"}),J=()=>({tag:"blockquote"}),K=()=>({tag:"ul"}),V=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),G=()=>({singleTag:"br"}),W=r=>({tag:`h${r.attrs.level}`}),H=r=>({singleTag:[{tag:"img",attrs:q(r.attrs,["src","alt","title"])}]}),Y=()=>({tag:"li"}),Q=()=>({tag:"ol"}),X=()=>({tag:"p"}),Z=r=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":r.attrs.name,emoji:r.attrs.emoji}}]}),ee=()=>({tag:"b"}),te=()=>({tag:"strike"}),re=()=>({tag:"u"}),oe=()=>({tag:"strong"}),se=()=>({tag:"code"}),ae=()=>({tag:"i"}),ne=r=>{const e={...r.attrs},{linktype:t="url"}=r.attrs;if(B(t)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),e.custom){for(const o in e.custom)e[o]=e.custom[o];delete e.custom}return{tag:[{tag:"a",attrs:e}]}},le=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ie=()=>({tag:"sub"}),ce=()=>({tag:"sup"}),ge=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ue=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${r.attrs.color};`}}]}:{tag:""}},fe=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${r.attrs.color}`}}]}:{tag:""}},S={nodes:{horizontal_rule:F,blockquote:J,bullet_list:K,code_block:V,hard_break:G,heading:W,image:H,list_item:Y,ordered_list:Q,paragraph:X,emoji:Z},marks:{bold:ee,strike:te,underline:re,strong:oe,code:se,italic:ae,link:ne,styled:le,subscript:ie,superscript:ce,anchor:ge,highlight:ue,textStyle:fe}},de=function(r){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,o=RegExp(t.source);return r&&o.test(r)?r.replace(t,a=>e[a]):r};class A{constructor(e){C(this,"marks"),C(this,"nodes"),e||(e=S),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1}){if(e&&e.content&&Array.isArray(e.content)){let o="";return e.content.forEach(a=>{o+=this.renderNode(a)}),t.optimizeImages?this.optimizeImages(o,t.optimizeImages):o}return console.warn(`The render method must receive an Object with a "content" field.
12
12
  The "content" field must be an array of nodes as the type ISbRichtext.
13
13
  ISbRichtext:
14
14
  content?: ISbRichtext[]
@@ -167,8 +167,8 @@ const _ = function(r, e) {
167
167
  {
168
168
  tag: "span",
169
169
  attrs: {
170
- ["data-type"]: "emoji",
171
- ["data-name"]: r.attrs.name,
170
+ "data-type": "emoji",
171
+ "data-name": r.attrs.name,
172
172
  emoji: r.attrs.emoji
173
173
  }
174
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/astro",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "Official Astro integration for the Storyblok Headless CMS",
5
5
  "main": "./dist/storyblok-astro.js",
6
6
  "module": "./dist/storyblok-astro.mjs",
@@ -33,20 +33,20 @@
33
33
  "prepublishOnly": "npm run build && cp ../README.md ./"
34
34
  },
35
35
  "dependencies": {
36
- "@storyblok/js": "^2.2.1",
36
+ "@storyblok/js": "^2.2.2",
37
37
  "camelcase": "^7.0.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@cypress/vite-dev-server": "^5.0.5",
41
41
  "@rollup/plugin-dynamic-import-vars": "^2.0.3",
42
- "@types/node": "20.3.3",
43
- "astro": "2.7.3",
42
+ "@types/node": "20.4.0",
43
+ "astro": "2.8.0",
44
44
  "cypress": "^12.16.0",
45
45
  "eslint-plugin-cypress": "^2.13.3",
46
46
  "start-server-and-test": "^2.0.0",
47
47
  "typescript": "5.1.6",
48
- "vite": "^4.3.9",
49
- "vite-plugin-dts": "^3.0.3"
48
+ "vite": "^4.4.1",
49
+ "vite-plugin-dts": "^3.1.0"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",
@@ -1,2 +0,0 @@
1
- declare const _default: import("vite").UserConfigExport;
2
- export default _default;
File without changes
File without changes