mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
1f64715043
* codebases * codebases * foo * foo * foo * foo * fix(frontend): Disable the insert button when required fields are empty strings (#3659) * fix(frontend): use normal password mask for the sensitive fields of the resource editor * handle super admins in password arg input * chore(main): release 1.323.2 (#3660) * chore(main): release 1.323.2 * Apply automatic changes --------- Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com> * foo * all * s3_helpers move * progress * all * progress * progress * progress * progress * codebase final * update without ee * sqlx * all * all * all * all * all * all * all * all * all * all * all * all * all * all * all * update * all * all * all --------- Co-authored-by: Faton Ramadani <faton.ramadani14@gmail.com> Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
const p = {
|
|
name: "windmill-relative-resolver",
|
|
async setup(build) {
|
|
const { writeFileSync, readFileSync, mkdirSync } = await import("fs");
|
|
const { dirname, resolve } = await import("node:path");
|
|
|
|
const base_internal_url = "BASE_INTERNAL_URL".replace(
|
|
"localhost",
|
|
"127.0.0.1"
|
|
);
|
|
const w_id = "W_ID";
|
|
const current_path = "CURRENT_PATH";
|
|
|
|
build.onLoad({ filter: /.*\.url$/ }, async (args) => {
|
|
const url = readFileSync(args.path, "utf8");
|
|
const contents = await (
|
|
await fetch(url, {
|
|
method: "GET",
|
|
headers: { Authorization: "Bearer TOKEN" },
|
|
})
|
|
).text();
|
|
return {
|
|
contents,
|
|
loader: "tsx",
|
|
};
|
|
});
|
|
const cdir = resolve("./");
|
|
const cdirNoPrivate = cdir.replace(/^\/private/, ""); // for macos
|
|
const filter = new RegExp(
|
|
`^(?!\\.\/main\\.ts)(?!${cdir}\/main\\.ts)(?!(?:/private)?${cdirNoPrivate}\/wrapper\\.mjs).*\\.ts$`
|
|
);
|
|
build.onResolve({ filter }, (args) => {
|
|
const file_path =
|
|
args.importer == "./main.ts" || args.importer == resolve("./main.ts")
|
|
? current_path
|
|
: args.importer.replace(cdir + "/", "");
|
|
|
|
const isRelative = !args.path.startsWith("/");
|
|
|
|
const url = isRelative
|
|
? `${base_internal_url}/api/w/${w_id}/scripts/RAW_GET_ENDPOINT/p/${file_path}/../${args.path}`
|
|
: `${base_internal_url}/api/w/${w_id}/scripts/RAW_GET_ENDPOINT/p/${args.path}`;
|
|
const file = isRelative
|
|
? resolve("./" + file_path + "/../" + args.path + ".url")
|
|
: resolve("./" + args.path + ".url");
|
|
mkdirSync(dirname(file), { recursive: true });
|
|
writeFileSync(file, url);
|
|
return {
|
|
path: file,
|
|
};
|
|
});
|
|
},
|
|
};
|