@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.cjs
CHANGED
|
@@ -252,8 +252,8 @@ export default config;
|
|
|
252
252
|
|
|
253
253
|
// src/templates/css-before.ts
|
|
254
254
|
function generateCssBeforeLoader(options) {
|
|
255
|
-
const { remoteUrl, localPath, htmlClass, loadingClass } = options;
|
|
256
|
-
return `<!-- === PATCH-
|
|
255
|
+
const { remoteUrl, localPath, htmlClass, loadingClass, assetVersionUrl } = options;
|
|
256
|
+
return `<!-- === PATCH-ARMS: CSS BEFORE (blocking) === -->
|
|
257
257
|
<style data-pa="css-before-critical">
|
|
258
258
|
/* Critical: Hide content until ready */
|
|
259
259
|
html.${htmlClass}.${loadingClass} body {
|
|
@@ -263,6 +263,19 @@ html.${htmlClass}.${loadingClass} body {
|
|
|
263
263
|
<script data-pa="css-before-loader">
|
|
264
264
|
(function() {
|
|
265
265
|
'use strict';
|
|
266
|
+
// Fetch asset version FIRST \u2014 this is the earliest loader, so it sets window.__pa_v for all others
|
|
267
|
+
if (typeof window.__pa_v === 'undefined') {
|
|
268
|
+
window.__pa_v = '';
|
|
269
|
+
var AVU = "${assetVersionUrl || ""}";
|
|
270
|
+
if (AVU) {
|
|
271
|
+
try {
|
|
272
|
+
var xhr = new XMLHttpRequest();
|
|
273
|
+
xhr.open('GET', AVU, false);
|
|
274
|
+
xhr.send();
|
|
275
|
+
if (xhr.status === 200) { window.__pa_v = JSON.parse(xhr.responseText).v || '1'; }
|
|
276
|
+
} catch(e) { window.__pa_v = '1'; }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
266
279
|
var v = window.__pa_v || '';
|
|
267
280
|
var REMOTE_URL = "${remoteUrl}" + (v ? "?v=" + v : "");
|
|
268
281
|
var LOCAL_PATH = "${localPath}";
|
|
@@ -296,7 +309,8 @@ function buildCssBeforeOptions(config) {
|
|
|
296
309
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.css}/${config.cssBefore.filename}`,
|
|
297
310
|
localPath: `${config.localFolders.css}/${config.cssBefore.filename}`,
|
|
298
311
|
htmlClass: config.htmlClass,
|
|
299
|
-
loadingClass: config.loadingClass
|
|
312
|
+
loadingClass: config.loadingClass,
|
|
313
|
+
assetVersionUrl: config.assetVersionUrl
|
|
300
314
|
};
|
|
301
315
|
}
|
|
302
316
|
|
|
@@ -5308,18 +5322,21 @@ window.pa_patcher = window.pa_patcher || {
|
|
|
5308
5322
|
|
|
5309
5323
|
(function() {
|
|
5310
5324
|
'use strict';
|
|
5311
|
-
//
|
|
5312
|
-
|
|
5313
|
-
window.__pa_v
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5325
|
+
// Cache version \u2014 normally set by version resolver (injected before CSS Before).
|
|
5326
|
+
// Fallback: fetch here if version resolver didn't run (older patched packages).
|
|
5327
|
+
if (typeof window.__pa_v === 'undefined') {
|
|
5328
|
+
var ASSET_VERSION_URL = "${assetVersionUrl || ""}";
|
|
5329
|
+
window.__pa_v = '';
|
|
5330
|
+
if (ASSET_VERSION_URL) {
|
|
5331
|
+
try {
|
|
5332
|
+
var xhr = new XMLHttpRequest();
|
|
5333
|
+
xhr.open('GET', ASSET_VERSION_URL, false);
|
|
5334
|
+
xhr.send();
|
|
5335
|
+
if (xhr.status === 200) {
|
|
5336
|
+
window.__pa_v = JSON.parse(xhr.responseText).v || '1';
|
|
5337
|
+
}
|
|
5338
|
+
} catch(e) { window.__pa_v = '1'; }
|
|
5339
|
+
}
|
|
5323
5340
|
}
|
|
5324
5341
|
|
|
5325
5342
|
var REMOTE_URL = "${remoteUrl}" + (window.__pa_v ? "?v=" + window.__pa_v : "");
|