@servlyadmin/runtime-core 0.1.41 → 0.1.43
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.
|
@@ -120,12 +120,15 @@ function waitForTailwind(timeoutMs = 3e3) {
|
|
|
120
120
|
return tailwindReadyPromise;
|
|
121
121
|
}
|
|
122
122
|
function injectTailwind(config = {}) {
|
|
123
|
+
console.log("[Servly Tailwind] injectTailwind called");
|
|
123
124
|
return new Promise((resolve, reject) => {
|
|
124
125
|
if (tailwindInjected && tailwindScript) {
|
|
126
|
+
console.log("[Servly Tailwind] Already injected, skipping");
|
|
125
127
|
resolve();
|
|
126
128
|
return;
|
|
127
129
|
}
|
|
128
130
|
if (typeof document === "undefined") {
|
|
131
|
+
console.log("[Servly Tailwind] Not in browser, skipping");
|
|
129
132
|
resolve();
|
|
130
133
|
return;
|
|
131
134
|
}
|
|
@@ -139,6 +142,7 @@ function injectTailwind(config = {}) {
|
|
|
139
142
|
preventFOUC: shouldPreventFOUC = true,
|
|
140
143
|
enablePreload = true
|
|
141
144
|
} = config;
|
|
145
|
+
console.log("[Servly Tailwind] Config:", { cdnUrl, usePlayCdn, shouldPreventFOUC });
|
|
142
146
|
if (shouldPreventFOUC) {
|
|
143
147
|
preventFOUC();
|
|
144
148
|
}
|
|
@@ -146,25 +150,56 @@ function injectTailwind(config = {}) {
|
|
|
146
150
|
preloadTailwind(cdnUrl, usePlayCdn);
|
|
147
151
|
}
|
|
148
152
|
const existingScript = document.querySelector('script[src*="tailwindcss.com"]');
|
|
153
|
+
console.log("[Servly Tailwind] Existing script check:", { existingScript: !!existingScript, windowTailwind: !!window.tailwind });
|
|
149
154
|
if (existingScript || window.tailwind) {
|
|
155
|
+
console.log("[Servly Tailwind] Tailwind script already exists, waiting for window.tailwind...");
|
|
150
156
|
tailwindInjected = true;
|
|
151
157
|
markTailwindAsLoaded();
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
tailwindReadyResolve
|
|
158
|
+
if (window.tailwind) {
|
|
159
|
+
console.log("[Servly Tailwind] window.tailwind already available");
|
|
160
|
+
if (shouldPreventFOUC) {
|
|
161
|
+
removeFOUCPrevention();
|
|
162
|
+
}
|
|
163
|
+
if (tailwindReadyResolve) {
|
|
164
|
+
tailwindReadyResolve();
|
|
165
|
+
tailwindReadyResolve = null;
|
|
166
|
+
}
|
|
167
|
+
config.onReady?.();
|
|
168
|
+
resolve();
|
|
169
|
+
return;
|
|
158
170
|
}
|
|
159
|
-
|
|
160
|
-
|
|
171
|
+
let pollCount2 = 0;
|
|
172
|
+
const maxPolls2 = 100;
|
|
173
|
+
const pollForTailwind2 = () => {
|
|
174
|
+
pollCount2++;
|
|
175
|
+
if (window.tailwind) {
|
|
176
|
+
console.log("[Servly Tailwind] window.tailwind now available after", pollCount2 * 100, "ms");
|
|
177
|
+
if (shouldPreventFOUC) {
|
|
178
|
+
removeFOUCPrevention();
|
|
179
|
+
}
|
|
180
|
+
if (tailwindReadyResolve) {
|
|
181
|
+
tailwindReadyResolve();
|
|
182
|
+
tailwindReadyResolve = null;
|
|
183
|
+
}
|
|
184
|
+
config.onReady?.();
|
|
185
|
+
resolve();
|
|
186
|
+
} else if (pollCount2 < maxPolls2) {
|
|
187
|
+
setTimeout(pollForTailwind2, 100);
|
|
188
|
+
} else {
|
|
189
|
+
console.warn("[Servly Tailwind] window.tailwind never became available");
|
|
190
|
+
resolve();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
setTimeout(pollForTailwind2, 100);
|
|
161
194
|
return;
|
|
162
195
|
}
|
|
196
|
+
const scriptUrl = usePlayCdn ? `${cdnUrl}?plugins=forms,typography,aspect-ratio` : cdnUrl;
|
|
197
|
+
console.log("[Servly Tailwind] Creating script with URL:", scriptUrl);
|
|
163
198
|
const script = document.createElement("script");
|
|
164
|
-
script.src =
|
|
199
|
+
script.src = scriptUrl;
|
|
165
200
|
script.async = true;
|
|
166
|
-
script.crossOrigin = "anonymous";
|
|
167
201
|
script.onload = () => {
|
|
202
|
+
console.log("[Servly Tailwind] Script loaded successfully!");
|
|
168
203
|
tailwindInjected = true;
|
|
169
204
|
tailwindScript = script;
|
|
170
205
|
markTailwindAsLoaded();
|
|
@@ -185,6 +220,7 @@ function injectTailwind(config = {}) {
|
|
|
185
220
|
}, delay);
|
|
186
221
|
};
|
|
187
222
|
script.onerror = (event) => {
|
|
223
|
+
console.error("[Servly Tailwind] Script failed to load:", event);
|
|
188
224
|
const error = new Error(`Failed to load Tailwind CSS from ${cdnUrl}`);
|
|
189
225
|
if (shouldPreventFOUC) {
|
|
190
226
|
removeFOUCPrevention();
|
|
@@ -196,7 +232,36 @@ function injectTailwind(config = {}) {
|
|
|
196
232
|
onError?.(error);
|
|
197
233
|
reject(error);
|
|
198
234
|
};
|
|
235
|
+
console.log("[Servly Tailwind] Appending script to head");
|
|
199
236
|
document.head.appendChild(script);
|
|
237
|
+
console.log("[Servly Tailwind] Script appended, head now has:", document.head.querySelectorAll("script").length, "scripts");
|
|
238
|
+
let pollCount = 0;
|
|
239
|
+
const maxPolls = 100;
|
|
240
|
+
const pollForTailwind = () => {
|
|
241
|
+
pollCount++;
|
|
242
|
+
if (window.tailwind) {
|
|
243
|
+
console.log("[Servly Tailwind] Tailwind detected via polling after", pollCount * 100, "ms");
|
|
244
|
+
if (!tailwindInjected) {
|
|
245
|
+
tailwindInjected = true;
|
|
246
|
+
tailwindScript = script;
|
|
247
|
+
markTailwindAsLoaded();
|
|
248
|
+
if (shouldPreventFOUC) {
|
|
249
|
+
removeFOUCPrevention();
|
|
250
|
+
}
|
|
251
|
+
if (tailwindReadyResolve) {
|
|
252
|
+
tailwindReadyResolve();
|
|
253
|
+
tailwindReadyResolve = null;
|
|
254
|
+
}
|
|
255
|
+
onReady?.();
|
|
256
|
+
resolve();
|
|
257
|
+
}
|
|
258
|
+
} else if (pollCount < maxPolls) {
|
|
259
|
+
setTimeout(pollForTailwind, 100);
|
|
260
|
+
} else {
|
|
261
|
+
console.warn("[Servly Tailwind] Tailwind not detected after polling, giving up");
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
setTimeout(pollForTailwind, 100);
|
|
200
265
|
});
|
|
201
266
|
}
|
|
202
267
|
function removeTailwind() {
|
package/dist/index.cjs
CHANGED
|
@@ -148,12 +148,15 @@ function waitForTailwind(timeoutMs = 3e3) {
|
|
|
148
148
|
return tailwindReadyPromise;
|
|
149
149
|
}
|
|
150
150
|
function injectTailwind(config = {}) {
|
|
151
|
+
console.log("[Servly Tailwind] injectTailwind called");
|
|
151
152
|
return new Promise((resolve, reject) => {
|
|
152
153
|
if (tailwindInjected && tailwindScript) {
|
|
154
|
+
console.log("[Servly Tailwind] Already injected, skipping");
|
|
153
155
|
resolve();
|
|
154
156
|
return;
|
|
155
157
|
}
|
|
156
158
|
if (typeof document === "undefined") {
|
|
159
|
+
console.log("[Servly Tailwind] Not in browser, skipping");
|
|
157
160
|
resolve();
|
|
158
161
|
return;
|
|
159
162
|
}
|
|
@@ -167,6 +170,7 @@ function injectTailwind(config = {}) {
|
|
|
167
170
|
preventFOUC: shouldPreventFOUC = true,
|
|
168
171
|
enablePreload = true
|
|
169
172
|
} = config;
|
|
173
|
+
console.log("[Servly Tailwind] Config:", { cdnUrl, usePlayCdn, shouldPreventFOUC });
|
|
170
174
|
if (shouldPreventFOUC) {
|
|
171
175
|
preventFOUC();
|
|
172
176
|
}
|
|
@@ -174,25 +178,56 @@ function injectTailwind(config = {}) {
|
|
|
174
178
|
preloadTailwind(cdnUrl, usePlayCdn);
|
|
175
179
|
}
|
|
176
180
|
const existingScript = document.querySelector('script[src*="tailwindcss.com"]');
|
|
181
|
+
console.log("[Servly Tailwind] Existing script check:", { existingScript: !!existingScript, windowTailwind: !!window.tailwind });
|
|
177
182
|
if (existingScript || window.tailwind) {
|
|
183
|
+
console.log("[Servly Tailwind] Tailwind script already exists, waiting for window.tailwind...");
|
|
178
184
|
tailwindInjected = true;
|
|
179
185
|
markTailwindAsLoaded();
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
tailwindReadyResolve
|
|
186
|
+
if (window.tailwind) {
|
|
187
|
+
console.log("[Servly Tailwind] window.tailwind already available");
|
|
188
|
+
if (shouldPreventFOUC) {
|
|
189
|
+
removeFOUCPrevention();
|
|
190
|
+
}
|
|
191
|
+
if (tailwindReadyResolve) {
|
|
192
|
+
tailwindReadyResolve();
|
|
193
|
+
tailwindReadyResolve = null;
|
|
194
|
+
}
|
|
195
|
+
config.onReady?.();
|
|
196
|
+
resolve();
|
|
197
|
+
return;
|
|
186
198
|
}
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
let pollCount2 = 0;
|
|
200
|
+
const maxPolls2 = 100;
|
|
201
|
+
const pollForTailwind2 = () => {
|
|
202
|
+
pollCount2++;
|
|
203
|
+
if (window.tailwind) {
|
|
204
|
+
console.log("[Servly Tailwind] window.tailwind now available after", pollCount2 * 100, "ms");
|
|
205
|
+
if (shouldPreventFOUC) {
|
|
206
|
+
removeFOUCPrevention();
|
|
207
|
+
}
|
|
208
|
+
if (tailwindReadyResolve) {
|
|
209
|
+
tailwindReadyResolve();
|
|
210
|
+
tailwindReadyResolve = null;
|
|
211
|
+
}
|
|
212
|
+
config.onReady?.();
|
|
213
|
+
resolve();
|
|
214
|
+
} else if (pollCount2 < maxPolls2) {
|
|
215
|
+
setTimeout(pollForTailwind2, 100);
|
|
216
|
+
} else {
|
|
217
|
+
console.warn("[Servly Tailwind] window.tailwind never became available");
|
|
218
|
+
resolve();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
setTimeout(pollForTailwind2, 100);
|
|
189
222
|
return;
|
|
190
223
|
}
|
|
224
|
+
const scriptUrl = usePlayCdn ? `${cdnUrl}?plugins=forms,typography,aspect-ratio` : cdnUrl;
|
|
225
|
+
console.log("[Servly Tailwind] Creating script with URL:", scriptUrl);
|
|
191
226
|
const script = document.createElement("script");
|
|
192
|
-
script.src =
|
|
227
|
+
script.src = scriptUrl;
|
|
193
228
|
script.async = true;
|
|
194
|
-
script.crossOrigin = "anonymous";
|
|
195
229
|
script.onload = () => {
|
|
230
|
+
console.log("[Servly Tailwind] Script loaded successfully!");
|
|
196
231
|
tailwindInjected = true;
|
|
197
232
|
tailwindScript = script;
|
|
198
233
|
markTailwindAsLoaded();
|
|
@@ -213,6 +248,7 @@ function injectTailwind(config = {}) {
|
|
|
213
248
|
}, delay);
|
|
214
249
|
};
|
|
215
250
|
script.onerror = (event) => {
|
|
251
|
+
console.error("[Servly Tailwind] Script failed to load:", event);
|
|
216
252
|
const error = new Error(`Failed to load Tailwind CSS from ${cdnUrl}`);
|
|
217
253
|
if (shouldPreventFOUC) {
|
|
218
254
|
removeFOUCPrevention();
|
|
@@ -224,7 +260,36 @@ function injectTailwind(config = {}) {
|
|
|
224
260
|
onError?.(error);
|
|
225
261
|
reject(error);
|
|
226
262
|
};
|
|
263
|
+
console.log("[Servly Tailwind] Appending script to head");
|
|
227
264
|
document.head.appendChild(script);
|
|
265
|
+
console.log("[Servly Tailwind] Script appended, head now has:", document.head.querySelectorAll("script").length, "scripts");
|
|
266
|
+
let pollCount = 0;
|
|
267
|
+
const maxPolls = 100;
|
|
268
|
+
const pollForTailwind = () => {
|
|
269
|
+
pollCount++;
|
|
270
|
+
if (window.tailwind) {
|
|
271
|
+
console.log("[Servly Tailwind] Tailwind detected via polling after", pollCount * 100, "ms");
|
|
272
|
+
if (!tailwindInjected) {
|
|
273
|
+
tailwindInjected = true;
|
|
274
|
+
tailwindScript = script;
|
|
275
|
+
markTailwindAsLoaded();
|
|
276
|
+
if (shouldPreventFOUC) {
|
|
277
|
+
removeFOUCPrevention();
|
|
278
|
+
}
|
|
279
|
+
if (tailwindReadyResolve) {
|
|
280
|
+
tailwindReadyResolve();
|
|
281
|
+
tailwindReadyResolve = null;
|
|
282
|
+
}
|
|
283
|
+
onReady?.();
|
|
284
|
+
resolve();
|
|
285
|
+
}
|
|
286
|
+
} else if (pollCount < maxPolls) {
|
|
287
|
+
setTimeout(pollForTailwind, 100);
|
|
288
|
+
} else {
|
|
289
|
+
console.warn("[Servly Tailwind] Tailwind not detected after polling, giving up");
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
setTimeout(pollForTailwind, 100);
|
|
228
293
|
});
|
|
229
294
|
}
|
|
230
295
|
function removeTailwind() {
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
scheduleRefresh,
|
|
18
18
|
updateTailwindConfig,
|
|
19
19
|
waitForTailwind
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TXHGJYYM.js";
|
|
21
21
|
import {
|
|
22
22
|
buildRegistryFromBundle,
|
|
23
23
|
collectAllDependencies,
|
|
@@ -3613,7 +3613,7 @@ async function createServlyRenderer(options) {
|
|
|
3613
3613
|
container = containerOption;
|
|
3614
3614
|
}
|
|
3615
3615
|
if (shouldInjectTailwind) {
|
|
3616
|
-
const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-
|
|
3616
|
+
const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-GU53TXCZ.js");
|
|
3617
3617
|
await initServlyTailwind2(tailwindConfig);
|
|
3618
3618
|
}
|
|
3619
3619
|
const activeRenders = [];
|