Fix replacers

This commit is contained in:
garronej 2022-09-05 00:08:50 +02:00
parent 042747c7d2
commit c4b985f1a4
2 changed files with 11 additions and 11 deletions

View File

@ -41,10 +41,10 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; build
const { jsCode, buildOptions } = params; const { jsCode, buildOptions } = params;
const getReplaceArgs = (language: "js" | "css"): Parameters<typeof String.prototype.replace> => [ const getReplaceArgs = (language: "js" | "css"): Parameters<typeof String.prototype.replace> => [
new RegExp(`([a-zA-Z]+)\\.([a-zA-Z]+)=function\\(([a-zA-Z]+)\\){return"static\\/${language}\\/"`, "g"), new RegExp(`([a-zA-Z_]+)\\.([a-zA-Z]+)=function\\(([a-zA-Z]+)\\){return"static\\/${language}\\/"`, "g"),
(...[, n, u, e]) => ` (...[, n, u, e]) => `
${n}[(function(){ ${n}[(function(){
var pd= Object.getOwnPropertyDescriptor(n, "p"); var pd= Object.getOwnPropertyDescriptor(${n}, "p");
if( pd === undefined || pd.configurable ){ if( pd === undefined || pd.configurable ){
${ ${
buildOptions.isStandalone buildOptions.isStandalone

View File

@ -19,7 +19,7 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
}[e] + ".chunk.js" }[e] + ".chunk.js"
} }
n.u=function(e){return"static/js/" + e + "." + { __webpack_require__.u=function(e){return"static/js/" + e + "." + {
147: "6c5cee76", 147: "6c5cee76",
787: "8da10fcf", 787: "8da10fcf",
922: "be170a73" 922: "be170a73"
@ -54,10 +54,10 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
}[e] + ".chunk.js" }[e] + ".chunk.js"
} }
n[(function (){ __webpack_require__[(function (){
var pd= Object.getOwnPropertyDescriptor(n, "p"); var pd= Object.getOwnPropertyDescriptor(__webpack_require__, "p");
if( pd === undefined || pd.configurable ){ if( pd === undefined || pd.configurable ){
Object.defineProperty(n, "p", { Object.defineProperty(__webpack_require__, "p", {
get: function() { return window.kcContext.url.resourcesPath; }, get: function() { return window.kcContext.url.resourcesPath; },
set: function (){} set: function (){}
}); });
@ -72,7 +72,7 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
} }
t[(function (){ t[(function (){
var pd= Object.getOwnPropertyDescriptor(n, "p"); var pd= Object.getOwnPropertyDescriptor(t, "p");
if( pd === undefined || pd.configurable ){ if( pd === undefined || pd.configurable ){
Object.defineProperty(t, "p", { Object.defineProperty(t, "p", {
get: function() { return window.kcContext.url.resourcesPath; }, get: function() { return window.kcContext.url.resourcesPath; },
@ -114,11 +114,11 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
}[e] + ".chunk.js" }[e] + ".chunk.js"
} }
n[(function (){ __webpack_require__[(function (){
var pd= Object.getOwnPropertyDescriptor(n, "p"); var pd= Object.getOwnPropertyDescriptor(__webpack_require__, "p");
if( pd === undefined || pd.configurable ){ if( pd === undefined || pd.configurable ){
var p= ""; var p= "";
Object.defineProperty(n, "p", { Object.defineProperty(__webpack_require__, "p", {
get: function() { return ("kcContext" in window ? "https://demo-app.keycloakify.dev" : "") + p; }, get: function() { return ("kcContext" in window ? "https://demo-app.keycloakify.dev" : "") + p; },
set: function (value){ p = value; } set: function (value){ p = value; }
}); });
@ -133,7 +133,7 @@ import { assetIsSameCode } from "../tools/assertIsSameCode";
} }
t[(function (){ t[(function (){
var pd= Object.getOwnPropertyDescriptor(n, "p"); var pd= Object.getOwnPropertyDescriptor(t, "p");
if( pd === undefined || pd.configurable ){ if( pd === undefined || pd.configurable ){
var p= ""; var p= "";
Object.defineProperty(t, "p", { Object.defineProperty(t, "p", {