foundry-dsa41-game/node_modules/@joneff/baka/dist/build-files.js

63 lines
2.4 KiB
JavaScript

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var build_files_exports = {};
__export(build_files_exports, {
buildFiles: () => buildFiles
});
module.exports = __toCommonJS(build_files_exports);
var import_path = __toESM(require("path"));
var import_glob = __toESM(require("glob"));
var import_shared_options = require("./shared-options");
var import_build = require("./build");
var import_templated_path = require("./templated-path");
const merge = Object.assign;
const CWD = process.cwd();
const buildOptions = import_shared_options.sharedOptions;
function buildFiles(fileOrGlob, output, options) {
const opts = merge({}, buildOptions, options);
const cwd = import_path.default.resolve(opts.cwd || CWD);
output = {
path: import_path.default.resolve(cwd, output.path || "dist"),
filename: output.filename || "[name]-flat[ext]"
};
if (!Array.isArray(fileOrGlob)) {
fileOrGlob = [fileOrGlob];
}
fileOrGlob.forEach((entry) => {
const files = import_glob.default.sync(entry, { cwd });
files.forEach((file) => {
file = import_path.default.resolve(cwd, file);
const outFile = import_path.default.resolve(
output.path,
(0, import_templated_path.replacePathVariables)(output.filename, file)
);
(0, import_build.build)(file, outFile, opts);
});
});
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
buildFiles
});