@firebase/util 1.11.0-firebase-studio-sdk-integration.927daddb8 → 1.11.0-firebase-studio-sdk-integration.fe1264c00
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/index.cjs.js +83 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +83 -43
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +83 -43
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +83 -43
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -671,6 +671,41 @@ class Deferred {
|
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
|
|
674
|
+
/**
|
|
675
|
+
* @license
|
|
676
|
+
* Copyright 2025 Google LLC
|
|
677
|
+
*
|
|
678
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
679
|
+
* you may not use this file except in compliance with the License.
|
|
680
|
+
* You may obtain a copy of the License at
|
|
681
|
+
*
|
|
682
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
683
|
+
*
|
|
684
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
685
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
686
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
687
|
+
* See the License for the specific language governing permissions and
|
|
688
|
+
* limitations under the License.
|
|
689
|
+
*/
|
|
690
|
+
/**
|
|
691
|
+
* Checks whether host is a cloud workstation or not.
|
|
692
|
+
* @public
|
|
693
|
+
*/
|
|
694
|
+
function isCloudWorkstation(host) {
|
|
695
|
+
return host.endsWith('.cloudworkstations.dev');
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Makes a fetch request to the given server.
|
|
699
|
+
* Mostly used for forwarding cookies in Firebase Studio.
|
|
700
|
+
* @public
|
|
701
|
+
*/
|
|
702
|
+
async function pingServer(endpoint) {
|
|
703
|
+
const result = await fetch(endpoint, {
|
|
704
|
+
credentials: 'include'
|
|
705
|
+
});
|
|
706
|
+
return result.ok;
|
|
707
|
+
}
|
|
708
|
+
|
|
674
709
|
/**
|
|
675
710
|
* @license
|
|
676
711
|
* Copyright 2021 Google LLC
|
|
@@ -743,6 +778,7 @@ function getOrCreateEl(id) {
|
|
|
743
778
|
}
|
|
744
779
|
return { created, element: parentDiv };
|
|
745
780
|
}
|
|
781
|
+
let previouslyDismissed = false;
|
|
746
782
|
/**
|
|
747
783
|
* Updates Emulator Banner. Primarily used for Firebase Studio
|
|
748
784
|
* @param name
|
|
@@ -752,10 +788,15 @@ function getOrCreateEl(id) {
|
|
|
752
788
|
function updateEmulatorBanner(name, isRunningEmulator) {
|
|
753
789
|
if (typeof window === 'undefined' ||
|
|
754
790
|
typeof document === 'undefined' ||
|
|
755
|
-
|
|
791
|
+
!isCloudWorkstation(window.location.host) ||
|
|
792
|
+
emulatorStatus[name] === isRunningEmulator ||
|
|
793
|
+
previouslyDismissed) {
|
|
756
794
|
return;
|
|
757
795
|
}
|
|
758
796
|
emulatorStatus[name] = isRunningEmulator;
|
|
797
|
+
function prefixedId(id) {
|
|
798
|
+
return `__firebase__banner__${id}`;
|
|
799
|
+
}
|
|
759
800
|
const bannerId = '__firebase__banner';
|
|
760
801
|
const summary = getEmulatorSummary();
|
|
761
802
|
const showError = summary.prod.length > 0;
|
|
@@ -767,8 +808,14 @@ function updateEmulatorBanner(name, isRunningEmulator) {
|
|
|
767
808
|
}
|
|
768
809
|
function setupDom() {
|
|
769
810
|
const banner = getOrCreateEl(bannerId);
|
|
770
|
-
const
|
|
771
|
-
|
|
811
|
+
const firebaseTextId = prefixedId('text');
|
|
812
|
+
const firebaseText = document.getElementById(firebaseTextId) || document.createElement('span');
|
|
813
|
+
const learnMoreId = prefixedId('learnmore');
|
|
814
|
+
const learnMoreLink = document.getElementById(learnMoreId) ||
|
|
815
|
+
document.createElement('a');
|
|
816
|
+
const prependIconId = prefixedId('preprendIcon');
|
|
817
|
+
const prependIcon = document.getElementById(prependIconId) ||
|
|
818
|
+
document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
772
819
|
if (banner.created) {
|
|
773
820
|
// update styles
|
|
774
821
|
const bannerEl = banner.element;
|
|
@@ -785,20 +832,48 @@ function updateEmulatorBanner(name, isRunningEmulator) {
|
|
|
785
832
|
closeBtn.style.paddingLeft = '5px';
|
|
786
833
|
closeBtn.innerHTML = ' ×';
|
|
787
834
|
closeBtn.onclick = () => {
|
|
835
|
+
previouslyDismissed = true;
|
|
788
836
|
tearDown();
|
|
789
837
|
};
|
|
838
|
+
learnMoreLink.setAttribute('id', learnMoreId);
|
|
839
|
+
learnMoreLink.href =
|
|
840
|
+
'http://firebase.google.com/docs/studio/deploy-app#emulator ';
|
|
841
|
+
bannerEl.appendChild(prependIcon);
|
|
790
842
|
bannerEl.appendChild(firebaseText);
|
|
843
|
+
bannerEl.appendChild(learnMoreLink);
|
|
791
844
|
bannerEl.appendChild(closeBtn);
|
|
845
|
+
prependIcon.setAttribute('width', '24');
|
|
846
|
+
prependIcon.setAttribute('id', prependIconId);
|
|
847
|
+
prependIcon.setAttribute('height', '24');
|
|
848
|
+
prependIcon.setAttribute('viewBox', '0 0 24 24');
|
|
849
|
+
prependIcon.setAttribute('fill', 'none');
|
|
792
850
|
document.body.appendChild(bannerEl);
|
|
793
851
|
}
|
|
794
852
|
if (showError) {
|
|
795
|
-
|
|
796
|
-
|
|
853
|
+
firebaseText.innerText = `Running in Production`;
|
|
854
|
+
prependIcon.innerHTML = `<g clip-path="url(#clip0_6013_33858)">
|
|
855
|
+
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
|
|
856
|
+
</g>
|
|
857
|
+
<defs>
|
|
858
|
+
<clipPath id="clip0_6013_33858">
|
|
859
|
+
<rect width="24" height="24" fill="white"/>
|
|
860
|
+
</clipPath>
|
|
861
|
+
</defs>`;
|
|
797
862
|
}
|
|
798
863
|
else {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
864
|
+
prependIcon.innerHTML = `<g clip-path="url(#clip0_6083_34804)">
|
|
865
|
+
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
|
|
866
|
+
</g>
|
|
867
|
+
<defs>
|
|
868
|
+
<clipPath id="clip0_6083_34804">
|
|
869
|
+
<rect width="24" height="24" fill="white"/>
|
|
870
|
+
</clipPath>
|
|
871
|
+
</defs>`;
|
|
872
|
+
firebaseText.innerText = 'Using emulated backend';
|
|
873
|
+
learnMoreLink.href =
|
|
874
|
+
'https://firebase.google.com/docs/studio/solution-build-with-ai';
|
|
875
|
+
}
|
|
876
|
+
firebaseText.setAttribute('id', firebaseTextId);
|
|
802
877
|
}
|
|
803
878
|
if (document.readyState === 'loading') {
|
|
804
879
|
window.addEventListener('DOMContentLoaded', setupDom);
|
|
@@ -2200,41 +2275,6 @@ function getModularInstance(service) {
|
|
|
2200
2275
|
}
|
|
2201
2276
|
}
|
|
2202
2277
|
|
|
2203
|
-
/**
|
|
2204
|
-
* @license
|
|
2205
|
-
* Copyright 2025 Google LLC
|
|
2206
|
-
*
|
|
2207
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2208
|
-
* you may not use this file except in compliance with the License.
|
|
2209
|
-
* You may obtain a copy of the License at
|
|
2210
|
-
*
|
|
2211
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2212
|
-
*
|
|
2213
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2214
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2215
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2216
|
-
* See the License for the specific language governing permissions and
|
|
2217
|
-
* limitations under the License.
|
|
2218
|
-
*/
|
|
2219
|
-
/**
|
|
2220
|
-
* Checks whether host is a cloud workstation or not.
|
|
2221
|
-
* @public
|
|
2222
|
-
*/
|
|
2223
|
-
function isCloudWorkstation(host) {
|
|
2224
|
-
return host.endsWith('.cloudworkstations.dev');
|
|
2225
|
-
}
|
|
2226
|
-
/**
|
|
2227
|
-
* Makes a fetch request to the given server.
|
|
2228
|
-
* Mostly used for forwarding cookies in Firebase Studio.
|
|
2229
|
-
* @public
|
|
2230
|
-
*/
|
|
2231
|
-
async function pingServer(endpoint) {
|
|
2232
|
-
const result = await fetch(endpoint, {
|
|
2233
|
-
credentials: 'include'
|
|
2234
|
-
});
|
|
2235
|
-
return result.ok;
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
2278
|
exports.CONSTANTS = CONSTANTS;
|
|
2239
2279
|
exports.DecodeBase64StringError = DecodeBase64StringError;
|
|
2240
2280
|
exports.Deferred = Deferred;
|