Closed f4ez closed 11 months ago
This seems to be a duplicate of https://github.com/HiDeoo/starlight-blog/issues/10#issuecomment-1715384615 which is a Windows specific issue related to some of the Vite shenanigans and fragile APIs used to customize Starlight.
I did not have yet the opportunity to debug this issue on a Windows machine.
Note that when component customisation will land in Starlight and after updating this integration to use this new feature, this should no longer be an issue.
This seems to be a duplicate of HiDeoo/starlight-blog#10 (comment) which is a Windows specific issue related to some of the Vite shenanigans and fragile APIs used to customize Starlight.
I did not have yet the opportunity to debug this issue on a Windows machine.
Note that when component customisation will land in Starlight and after updating this integration to use this new feature, this should no longer be an issue.
another issue with linux (Ubuntu 22.04) (tested with yarn, npm and pnpm):
nodemodules/.pnpm/starlight-openapi@0.2.0@astrojs+starlight@0.10.2_astro@3.1.4_openapi-types@12.1.3/node_modules/starlight-openapi/components/Route.astro
error Invalid second argument for transform
! Expected Transformer[]
but got object
File:
/home/x/Desktop/doc/node_modules/ultrahtml/dist/index.js:1:4646
Code:
1 | var R=0,k=1,j=2,X=3,V=4;function U(e,t={},...a){let r={type:1,name:typeof e=="function"?e.name:e,attributes:t||{},children:a.map(n=>typeof n=="string"?{type:2,value:y(String(n))}:n),parent:void 0,loc:[]};return typeof e=="function"&&$(r,e),r}var b=Symbol("Fragment"),D=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),x=new Set(["script","style"]),=/([\@.a-z0-9\:-])\s?=?\s?(['"]?)([\s\S]?)\2\s+/gim,o=/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:-])(?:\s([^>]?))?((?:\s\/)?)>|(<!--)([\s\S]?)(-->)|(<!)([\s\S]*?)(>))/gm;function P(e){let t={},a;if(e)for(.lastIndex=0,e=" "+(e||"")+" ";a=.exec(e);)a[0]!==" "&&(t[a[1]]=a[3]);return t}function w(e){let t=typeof e=="string"?e:e.value,a,r,n,i,l,d,g,h,s,c=[];o.lastIndex=0,r=a={type:0,children:[]};let E=0;function m(){i=t.substring(E,o.lastIndex-n[0].length),i&&r.children.push({type:2,value:i,parent:r})}for(;n=o.exec(t);){if(d=n[5]||n[8],g=n[6]||n[9],h=n[7]||n[10],x.has(r.name)&&n[2]!==r.name){l=o.lastIndex-n[0].length,r.children.length>0&&(r.children[0].value+=n[0]);continue}else if(d==="<!--"){if(l=o.lastIndex-n[0].length,x.has(r.name))continue;s={type:3,value:g,parent:r,loc:[{start:l,end:l+d.length},{start:o.lastIndex-h.length,end:o.lastIndex}]},c.push(s),s.parent.children.push(s)}else if(d==="<!")l=o.lastIndex-n[0].length,s={type:4,value:g,parent:r,loc:[{start:l,end:l+d.length},{start:o.lastIndex-h.length,end:o.lastIndex}]},c.push(s),s.parent.children.push(s);else if(n[1]!=="/")if(m(),x.has(r.name)){E=o.lastIndex,m();continue}else s={type:1,name:n[2]+"",attributes:P(n[3]),parent:r,children:[],loc:[{start:o.lastIndex-n[0].length,end:o.lastIndex}]},c.push(s),s.parent.children.push(s),n[4]&&n[4].indexOf("/")>-1||D.has(s.name)?(s.loc[1]=s.loc[0],s.isSelfClosingTag=!0):r=s;else m(),n[2]+""===r.name?(s=r,r=s.parent,s.loc.push({start:o.lastIndex-n[0].length,end:o.lastIndex}),i=t.substring(s.loc[0].end,s.loc[1].start),s.children.length===0&&s.children.push({type:2,value:i,parent:r})):n[2]+""===c[c.length-1].name&&c[c.length-1].isSelfClosingTag===!0&&(s=c[c.length-1],s.loc.push({start:o.lastIndex-n[0].length,end:o.lastIndex}));E=o.lastIndex}return i=t.slice(E),r.children.push({type:2,value:i,parent:r}),a}var T=class{constructor(t){this.callback=t}async visit(t,a,r){if(await this.callback(t,a,r),Array.isArray(t.children)){let n=[];for(let i=0;i<t.children.length;i++){let l=t.children[i];n.push(this.visit(l,t,i))}await Promise.all(n)}}},O=class{constructor(t){this.callback=t}visit(t,a,r){if(this.callback(t,a,r),Array.isArray(t.children))for(let n=0;n<t.children.length;n++){let i=t.children[n];this.visit(i,t,n)}}},N=Symbol("HTMLString"),S=Symbol("AttrString"),u=Symbol("RenderFn");function p(e,t=[N]){let a={value:e};for(let r of t)Object.defineProperty(a,r,{value:!0,enumerable:!1,writable:!1});return a}function Y(e){return p(e)}function $(e,t){return Object.defineProperty(e,u,{value:t,enumerable:!1}),e}var I={"&":"&","<":"<",">":">"};function y(e){return e.replace(/[&<>]/g,t=>I[t]||t)}function f(e){let t="";for(let[a,r]of Object.entries(e))t+=
${a}="${r}"
;return p(t,[N,S])}function F(e,...t){let a="";for(let r=0;r<e.length;r++){a+=e[r];let n=t[r];a.endsWith("...")&&n&&typeof n=="object"?(a=a.slice(0,-3).trimEnd(),a+=f(n).value):n&&n[S]?(a=a.trimEnd(),a+=n.value):n&&n[N]?a+=n.value:typeof n=="string"?a+=y(n):(n||n===0)&&(a+=String(n))}return p(a)}function H(e,t){return new T(t).visit(e)}function z(e,t){return new O(t).visit(e)}function M(e){if(e.children.length===0){let t=e;for(;t=t.parent;)if(t.name==="svg")return!0}return!1}async function A(e){let{name:t,attributes:a={}}=e,r=await Promise.all(e.children.map(i=>v(i))).then(i=>i.join(""));if(u in e){let i=await eu;return i&&i[N]?i.value:y(String(i))}if(t===b)return r;let n=M(e);return n||D.has(t)?<${e.name}${f(a).value}${n?" /":""}>
:<${e.name}${f(a).value}>${r}</${e.name}>
}function L(e){let{name:t,attributes:a={}}=e,r=e.children.map(i=>C(i)).join("");if(u in e){let i=eu;return i&&i[N]?i.value:y(String(i))}if(t===b)return r;let n=M(e);return n||D.has(t)?<${e.name}${f(a).value}${n?" /":""}>
:<${e.name}${f(a).value}>${r}</${e.name}>
}function C(e){switch(e.type){case 0:return e.children.map(t=>C(t)).join("");case 1:return L(e);case 2:return${e.value}
;case 3:return<!--${e.value}-->
;case 4:return<!${e.value}>
}}async function v(e){switch(e.type){case 0:return Promise.all(e.children.map(t=>v(t))).then(t=>t.join(""));case 1:return A(e);case 2:return${e.value}
;case 3:return<!--${e.value}-->
;case 4:return<!${e.value}>
}}async function B(e,t=[]){if(!Array.isArray(t))throw new Error(Invalid second argument for \
transform`! Expected `Transformer[]` but got `${typeof t}`);let r=typeof e=="string"?w(e):e;for(let n of t)r=await n(r);return v(r)}export{X as COMMENT_NODE,V as DOCTYPE_NODE,R as DOCUMENT_NODE,k as ELEMENT_NODE,b as Fragment,u as RenderFn,j as TEXT_NODE,Y as __unsafeHTML,$ as __unsafeRenderFn,f as attrs,U as h,F as html,w as parse,v as render,C as renderSync,B as transform,H as walk,z as walkSync}; ^ Stacktrace: Error: Invalid second argument for
transform! Expected
Transformer[]but got
object` at B (file:///home/x/Desktop/doc/node_modules/ultrahtml/dist/index.js:1:4646) at markdown (file:///home/x/Desktop/doc/dist/chunks/pages/Route_be303568.mjs:501:10) at async file:///home/x/Desktop/doc/dist/chunks/pages/Route_be303568.mjs:522:19
ELIFECYCLE Command failed with exit code 1.
Indeed, this seems to have workaround the Windows issue.
Altho, I cannot repro the new issue on a fresh install. Would you be able to share a small repro on a GitHub repo or something similar?
Indeed, this seems to have workaround the Windows issue.
Altho, I cannot repro the new issue on a fresh install. Would you be able to share a small repro on a GitHub repo or something similar?
https://github.com/faeztgh/starlight-openapi-issue-temp
Everything works fine on dev, but when I want to build I get errors. You can see the setup on the above repo. OS: win10 node version: 18.17.1 yarn version: 1.22.19 npm version: 9.6.7 (I tested both yarn and npm) Thanks for making this useful tool :)
Interesting, even in the repository you linked I can not repro any issue after cloning and installing dependencies. Building works fine.
I would assume from the details you shared this is once again Windows related maybe? I guess we would need to wait for me or someone else with access to a Windows machine to debug this or for this integration to be updated to use component customisation when it lands in Starlight.
Describe the bug
[commonjs--resolver] Missing "./layout/Page.astro" specifier in "@astrojs/starlight" package error Missing "./layout/Page.astro" specifier in "@astrojs/starlight" package
Code:
To Reproduce
"dependencies": { "@astrojs/react": "^3.0.1", "@astrojs/starlight": "^0.10.2", "@astrojs/starlight-tailwind": "^2.0.0", "@astrojs/tailwind": "^5.0.0", "@types/react-dom": "^18.0.6", "astro": "^3.1.4", "react": "^18.0.0", "react-dom": "^18.0.0", "sharp": "^0.32.5", "starlight-openapi": "^0.2.0", "tailwindcss": "^3.0.24" }, "devDependencies": { "@types/react": "^18.0.21" }
as I remove
starlightOpenAPI()
from the config file error will be fixed.Expected behavior
build successfully
How often does this bug happen?
Every time
System Info
windows chrome
Additional Context
No response