@patch-adams/core 1.6.1 → 1.6.3
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/cli.cjs +32 -15
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +32 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +32 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -243,8 +243,8 @@ export default config;
|
|
|
243
243
|
|
|
244
244
|
// src/templates/css-before.ts
|
|
245
245
|
function generateCssBeforeLoader(options) {
|
|
246
|
-
const { remoteUrl, localPath, htmlClass, loadingClass } = options;
|
|
247
|
-
return `<!-- === PATCH-
|
|
246
|
+
const { remoteUrl, localPath, htmlClass, loadingClass, assetVersionUrl } = options;
|
|
247
|
+
return `<!-- === PATCH-ARMS: CSS BEFORE (blocking) === -->
|
|
248
248
|
<style data-pa="css-before-critical">
|
|
249
249
|
/* Critical: Hide content until ready */
|
|
250
250
|
html.${htmlClass}.${loadingClass} body {
|
|
@@ -254,6 +254,19 @@ html.${htmlClass}.${loadingClass} body {
|
|
|
254
254
|
<script data-pa="css-before-loader">
|
|
255
255
|
(function() {
|
|
256
256
|
'use strict';
|
|
257
|
+
// Fetch asset version FIRST \u2014 this is the earliest loader, so it sets window.__pa_v for all others
|
|
258
|
+
if (typeof window.__pa_v === 'undefined') {
|
|
259
|
+
window.__pa_v = '';
|
|
260
|
+
var AVU = "${assetVersionUrl || ""}";
|
|
261
|
+
if (AVU) {
|
|
262
|
+
try {
|
|
263
|
+
var xhr = new XMLHttpRequest();
|
|
264
|
+
xhr.open('GET', AVU, false);
|
|
265
|
+
xhr.send();
|
|
266
|
+
if (xhr.status === 200) { window.__pa_v = JSON.parse(xhr.responseText).v || '1'; }
|
|
267
|
+
} catch(e) { window.__pa_v = '1'; }
|
|
268
|
+
}
|
|
269
|
+
}
|
|
257
270
|
var v = window.__pa_v || '';
|
|
258
271
|
var REMOTE_URL = "${remoteUrl}" + (v ? "?v=" + v : "");
|
|
259
272
|
var LOCAL_PATH = "${localPath}";
|
|
@@ -287,7 +300,8 @@ function buildCssBeforeOptions(config) {
|
|
|
287
300
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.css}/${config.cssBefore.filename}`,
|
|
288
301
|
localPath: `${config.localFolders.css}/${config.cssBefore.filename}`,
|
|
289
302
|
htmlClass: config.htmlClass,
|
|
290
|
-
loadingClass: config.loadingClass
|
|
303
|
+
loadingClass: config.loadingClass,
|
|
304
|
+
assetVersionUrl: config.assetVersionUrl
|
|
291
305
|
};
|
|
292
306
|
}
|
|
293
307
|
|
|
@@ -5299,18 +5313,21 @@ window.pa_patcher = window.pa_patcher || {
|
|
|
5299
5313
|
|
|
5300
5314
|
(function() {
|
|
5301
5315
|
'use strict';
|
|
5302
|
-
//
|
|
5303
|
-
|
|
5304
|
-
window.__pa_v
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5316
|
+
// Cache version \u2014 normally set by version resolver (injected before CSS Before).
|
|
5317
|
+
// Fallback: fetch here if version resolver didn't run (older patched packages).
|
|
5318
|
+
if (typeof window.__pa_v === 'undefined') {
|
|
5319
|
+
var ASSET_VERSION_URL = "${assetVersionUrl || ""}";
|
|
5320
|
+
window.__pa_v = '';
|
|
5321
|
+
if (ASSET_VERSION_URL) {
|
|
5322
|
+
try {
|
|
5323
|
+
var xhr = new XMLHttpRequest();
|
|
5324
|
+
xhr.open('GET', ASSET_VERSION_URL, false);
|
|
5325
|
+
xhr.send();
|
|
5326
|
+
if (xhr.status === 200) {
|
|
5327
|
+
window.__pa_v = JSON.parse(xhr.responseText).v || '1';
|
|
5328
|
+
}
|
|
5329
|
+
} catch(e) { window.__pa_v = '1'; }
|
|
5330
|
+
}
|
|
5314
5331
|
}
|
|
5315
5332
|
|
|
5316
5333
|
var REMOTE_URL = "${remoteUrl}" + (window.__pa_v ? "?v=" + window.__pa_v : "");
|