You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The JsDelivrEsmResolver::IMPORT_REGEX regex might be fixed to handle this module properly, by supporting import i,{Headers as a}from"/npm/@supabase/node-fetch@2.6.14/+esm"
- public const IMPORT_REGEX = '#(?:import\s*(?:(?:\{[^}]*\}|\w+|\*\s*as\s+\w+)\s*\bfrom\s*)?|export\s*(?:\{[^}]*\}|\*)\s*from\s*)("/npm/((?:@[^/]+/)?[^@]+?)(?:@([^/]+))?((?:/[^/]+)*?)/\+esm")#';+ public const IMPORT_REGEX = '#(?:import\s*(?:\w+,)?(?:(?:\{[^}]*\}|\w+|\*\s*as\s+\w+)\s*\bfrom\s*)?|export\s*(?:\{[^}]*\}|\*)\s*from\s*)("/npm/((?:@[^/]+/)?[^@]+?)(?:@([^/]+))?((?:/[^/]+)*?)/\+esm")#';
The resulting file currently is:
/** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. * Original file: /npm/@supabase/supabase-js@2.38.4/dist/module/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */import{FunctionsClientase}from"@supabase/functions-js";export{FunctionsError,FunctionsFetchError,FunctionsHttpError,FunctionsRelayError}from"@supabase/functions-js";import{PostgrestClientast}from"@supabase/postgrest-js";import{RealtimeClientass}from"@supabase/realtime-js";export*from"@supabase/realtime-js";import{StorageClientasn}from"@supabase/storage-js";importi,{Headersasa}from"/npm/@supabase/node-fetch@2.6.15/+esm";import{GoTrueClientasr}from"@supabase/gotrue-js";export*from"@supabase/gotrue-js";leto="";o="undefined"!=typeofDeno?"deno":"undefined"!=typeofdocument?"web":"undefined"!=typeofnavigator&&"ReactNative"===navigator.product?"react-native":"node";consth={"X-Client-Info":`supabase-js-${o}/2.38.4`};varu=function(e,t,s,n){returnnew(s||(s=Promise))((function(i,a){functionr(e){try{h(n.next(e))}catch(e){a(e)}}functiono(e){try{h(n.throw(e))}catch(e){a(e)}}functionh(e){vart;e.done?i(e.value):(t=e.value,tinstanceofs?t:news((function(e){e(t)}))).then(r,o)}h((n=n.apply(e,t||[])).next())}))};constl=e=>{lett;returnt=e||("undefined"==typeoffetch?i:fetch),(...e)=>t(...e)},c=(e,t,s)=>{constn=l(s),i="undefined"==typeofHeaders?a:Headers;return(s,a)=>u(void0,void0,void0,(function*(){varr;consto=null!==(r=yieldt())&&void0!==r?r:e;leth=newi(null==a?void0:a.headers);returnh.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${o}`),n(s,Object.assign(Object.assign({},a),{headers:h}))}))};classdextendsr{constructor(e){super(e)}}varp=function(e,t,s,n){returnnew(s||(s=Promise))((function(i,a){functionr(e){try{h(n.next(e))}catch(e){a(e)}}functiono(e){try{h(n.throw(e))}catch(e){a(e)}}functionh(e){vart;e.done?i(e.value):(t=e.value,tinstanceofs?t:news((function(e){e(t)}))).then(r,o)}h((n=n.apply(e,t||[])).next())}))};constm={headers:h},f={schema:"public"},g={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={};classv{constructor(e,s,n){vari,a,r,o,h,u,l,d;if(this.supabaseUrl=e,this.supabaseKey=s,!e)thrownewError("supabaseUrl is required.");if(!s)thrownewError("supabaseKey is required.");constp=e.replace(/\/$/,"");this.realtimeUrl=`${p}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${p}/auth/v1`,this.storageUrl=`${p}/storage/v1`,this.functionsUrl=`${p}/functions/v1`;constv=`sb-${newURL(this.authUrl).hostname.split(".")[0]}-auth-token`,y=function(e,t){const{db:s,auth:n,realtime:i,global:a}=e,{db:r,auth:o,realtime:h,global:u}=t;return{db:Object.assign(Object.assign({},r),s),auth:Object.assign(Object.assign({},o),n),realtime:Object.assign(Object.assign({},h),i),global:Object.assign(Object.assign({},u),a)}}(null!=n?n:{},{db:f,realtime:b,auth:Object.assign(Object.assign({},g),{storageKey:v}),global:m});this.storageKey=null!==(a=null===(i=y.auth)||void0===i?void0:i.storageKey)&&void0!==a?a:"",this.headers=null!==(o=null===(r=y.global)||void0===r?void0:r.headers)&&void0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(h=y.auth)&&void0!==h?h:{},this.headers,null===(u=y.global)||void0===u?void0:u.fetch),this.fetch=c(s,this._getAccessToken.bind(this),null===(l=y.global)||void0===l?void0:l.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},y.realtime)),this.rest=newt(`${p}/rest/v1`,{headers:this.headers,schema:null===(d=y.db)||void0===d?void0:d.schema,fetch:this.fetch}),this._listenForAuthEvents()}getfunctions(){returnnewe(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}getstorage(){returnnewn(this.storageUrl,this.headers,this.fetch)}from(e){returnthis.rest.from(e)}schema(e){returnthis.rest.schema(e)}rpc(e,t={},s){returnthis.rest.rpc(e,t,s)}channel(e,t={config:{}}){returnthis.realtime.channel(e,t)}getChannels(){returnthis.realtime.getChannels()}removeChannel(e){returnthis.realtime.removeChannel(e)}removeAllChannels(){returnthis.realtime.removeAllChannels()}_getAccessToken(){vare,t;returnp(this,void0,void0,(function*(){const{data:s}=yieldthis.auth.getSession();returnnull!==(t=null===(e=s.session)||void0===e?void0:e.access_token)&&void0!==t?t:null}))}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,storageKey:i,flowType:a,debug:r},o,h){constu={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};returnnewd({url:this.authUrl,headers:Object.assign(Object.assign({},u),o),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,flowType:a,debug:r,fetch:h})}_initRealtimeClient(e){returnnews(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void0:e.params)}))}_listenForAuthEvents(){returnthis.auth.onAuthStateChange(((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void0:t.access_token)}))}_handleTokenChanged(e,t,s){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===s?"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void0):(this.realtime.setAuth(null!=s?s:null),this.changedAccessToken=s)}}consty=(e,t,s)=>newv(e,t,s);export{vasSupabaseClient,yascreateClient};exportdefaultnull;
Caution
Note this part:
import i,{Headers as a}from"/npm/@supabase/node-fetch@2.6.15/+esm"
which seems not to be resolved properly and leads to the browser trying to fetch the module from http://localhost:15889/npm/@supabase/node-fetch@2.6.15/+esm
➜ I guess it should have been parsed and transformed to
importi,{Headersasa}from"@supabase/node-fetch"
as for the other imports in this file (but the i,{Headers as a} notation is not handled correctly by the regex).
…rts from modules (ogizanagi)
This PR was merged into the 6.4 branch.
Discussion
----------
[AssetMapper] Fix resolving jsdeliver default + other exports from modules
| Q | A
| ------------- | ---
| Branch? | 6.4 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Issues | Fix#52616
| License | MIT
Fixes resolving:
```js
import i,{Headers as a}from"/npm/`@supabase`/node-fetch@2.6.14/+esm"
```
i.e both default export and other exports in a same `import`.
Commits
-------
916daf0 [AssetMapper] Fix resolving jsdeliver default + other exports from modules
Symfony version(s) affected
6.4-RC1
Description
It seems there is a case that is not resolved properly by the
JsDelivrEsmResolver
resolver, found in a project using@supabase/supabase-js
➜ https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2.38.4/+esmHow to reproduce
In a project using the AssetMapper component:
in your
app.js
:You'll get an error in your browser console:
Possible Solution
The
JsDelivrEsmResolver::IMPORT_REGEX
regex might be fixed to handle this module properly, by supportingimport i,{Headers as a}from"/npm/@supabase/node-fetch@2.6.14/+esm"
The resulting file currently is:
Caution
Note this part:
which seems not to be resolved properly and leads to the browser trying to fetch the module from
http://localhost:15889/npm/@supabase/node-fetch@2.6.15/+esm
➜ I guess it should have been parsed and transformed to
as for the other imports in this file (but the
i,{Headers as a}
notation is not handled correctly by the regex).Additional Context
Here is the generated
importmap.php
file:importmap.php
and the resulting
installed.php
file:installed.php
The text was updated successfully, but these errors were encountered: