barrelize
Version:
Automatically generating index (barrel) files
1,232 lines • 878 kB
JavaScript
import { writeFile, readFile, realpath, readlink, readdir, lstat, stat } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { resolve, dirname, extname, join, win32, posix, relative, sep as sep$1 } from "node:path";
import { realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync, unwatchFile, watchFile, watch as watch$1, stat as stat$2 } from "fs";
import * as actualFS from "node:fs";
import { existsSync } from "node:fs";
import { EventEmitter as EventEmitter$1 } from "node:events";
import Stream, { Readable } from "node:stream";
import { StringDecoder } from "node:string_decoder";
import { realpath as realpath$1, stat as stat$1, lstat as lstat$1, open, readdir as readdir$2 } from "fs/promises";
import { EventEmitter } from "events";
import * as sysPath from "path";
import { type } from "os";
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key2, val, opts) {
var x, old = out[key2], nxt = !!~opts.string.indexOf(key2) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key2) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
out[key2] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
}
function mri2(args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name2, val, out = { _: [] };
var i = 0, j = 0, idx = 0, len = args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults2 = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) {
for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i = 0; i < arr.length; i++) {
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
}
}
for (i = opts.boolean.length; i-- > 0; ) {
arr = opts.alias[opts.boolean[i]] || [];
for (j = arr.length; j-- > 0; ) opts.boolean.push(arr[j]);
}
for (i = opts.string.length; i-- > 0; ) {
arr = opts.alias[opts.string[i]] || [];
for (j = arr.length; j-- > 0; ) opts.string.push(arr[j]);
}
if (defaults2) {
for (k in opts.default) {
name2 = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name2] !== void 0) {
opts[name2].push(k);
for (i = 0; i < arr.length; i++) {
opts[name2].push(arr[i]);
}
}
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i = 0; i < len; i++) {
arg = args[i];
if (arg === "--") {
out._ = out._.concat(args.slice(++i));
break;
}
for (j = 0; j < arg.length; j++) {
if (arg.charCodeAt(j) !== 45) break;
}
if (j === 0) {
out._.push(arg);
} else if (arg.substring(j, j + 3) === "no-") {
name2 = arg.substring(j + 3);
if (strict && !~keys.indexOf(name2)) {
return opts.unknown(arg);
}
out[name2] = false;
} else {
for (idx = j + 1; idx < arg.length; idx++) {
if (arg.charCodeAt(idx) === 61) break;
}
name2 = arg.substring(j, idx);
val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
arr = j === 2 ? [name2] : name2;
for (idx = 0; idx < arr.length; idx++) {
name2 = arr[idx];
if (strict && !~keys.indexOf(name2)) return opts.unknown("-".repeat(j) + name2);
toVal(out, name2, idx + 1 < arr.length || val, opts);
}
}
}
if (defaults2) {
for (k in opts.default) {
if (out[k] === void 0) {
out[k] = opts.default[k];
}
}
}
if (alibi) {
for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) {
out[arr.shift()] = out[k];
}
}
}
return out;
}
const removeBrackets = (v) => v.replace(/[<[].+/, "").trim();
const findAllBrackets = (v) => {
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
const res = [];
const parse3 = (match2) => {
let variadic = false;
let value = match2[1];
if (value.startsWith("...")) {
value = value.slice(3);
variadic = true;
}
return {
required: match2[0].startsWith("<"),
value,
variadic
};
};
let angledMatch;
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) {
res.push(parse3(angledMatch));
}
let squareMatch;
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) {
res.push(parse3(squareMatch));
}
return res;
};
const getMriOptions = (options) => {
const result = { alias: {}, boolean: [] };
for (const [index, option] of options.entries()) {
if (option.names.length > 1) {
result.alias[option.names[0]] = option.names.slice(1);
}
if (option.isBoolean) {
if (option.negated) {
const hasStringTypeOption = options.some((o, i) => {
return i !== index && o.names.some((name2) => option.names.includes(name2)) && typeof o.required === "boolean";
});
if (!hasStringTypeOption) {
result.boolean.push(option.names[0]);
}
} else {
result.boolean.push(option.names[0]);
}
}
}
return result;
};
const findLongest = (arr) => {
return arr.sort((a, b) => {
return a.length > b.length ? -1 : 1;
})[0];
};
const padRight = (str, length) => {
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
};
const camelcase = (input) => {
return input.replace(/([a-z])-([a-z])/g, (_, p1, p2) => {
return p1 + p2.toUpperCase();
});
};
const setDotProp = (obj, keys, val) => {
let i = 0;
let length = keys.length;
let t = obj;
let x;
for (; i < length; ++i) {
x = t[keys[i]];
t = t[keys[i]] = i === length - 1 ? val : x != null ? x : !!~keys[i + 1].indexOf(".") || !(+keys[i + 1] > -1) ? {} : [];
}
};
const setByType = (obj, transforms) => {
for (const key2 of Object.keys(transforms)) {
const transform = transforms[key2];
if (transform.shouldTransform) {
obj[key2] = Array.prototype.concat.call([], obj[key2]);
if (typeof transform.transformFunction === "function") {
obj[key2] = obj[key2].map(transform.transformFunction);
}
}
}
};
const getFileName = (input) => {
const m = /([^\\\/]+)$/.exec(input);
return m ? m[1] : "";
};
const camelcaseOptionName = (name2) => {
return name2.split(".").map((v, i) => {
return i === 0 ? camelcase(v) : v;
}).join(".");
};
class CACError extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error(message).stack;
}
}
}
class Option {
constructor(rawName, description, config) {
this.rawName = rawName;
this.description = description;
this.config = Object.assign({}, config);
rawName = rawName.replace(/\.\*/g, "");
this.negated = false;
this.names = removeBrackets(rawName).split(",").map((v) => {
let name2 = v.trim().replace(/^-{1,2}/, "");
if (name2.startsWith("no-")) {
this.negated = true;
name2 = name2.replace(/^no-/, "");
}
return camelcaseOptionName(name2);
}).sort((a, b) => a.length > b.length ? 1 : -1);
this.name = this.names[this.names.length - 1];
if (this.negated && this.config.default == null) {
this.config.default = true;
}
if (rawName.includes("<")) {
this.required = true;
} else if (rawName.includes("[")) {
this.required = false;
} else {
this.isBoolean = true;
}
}
}
const processArgs = process.argv;
const platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
class Command {
constructor(rawName, description, config = {}, cli) {
this.rawName = rawName;
this.description = description;
this.config = config;
this.cli = cli;
this.options = [];
this.aliasNames = [];
this.name = removeBrackets(rawName);
this.args = findAllBrackets(rawName);
this.examples = [];
}
usage(text) {
this.usageText = text;
return this;
}
allowUnknownOptions() {
this.config.allowUnknownOptions = true;
return this;
}
ignoreOptionDefaultValue() {
this.config.ignoreOptionDefaultValue = true;
return this;
}
version(version2, customFlags = "-v, --version") {
this.versionNumber = version2;
this.option(customFlags, "Display version number");
return this;
}
example(example) {
this.examples.push(example);
return this;
}
option(rawName, description, config) {
const option = new Option(rawName, description, config);
this.options.push(option);
return this;
}
alias(name2) {
this.aliasNames.push(name2);
return this;
}
action(callback) {
this.commandAction = callback;
return this;
}
isMatched(name2) {
return this.name === name2 || this.aliasNames.includes(name2);
}
get isDefaultCommand() {
return this.name === "" || this.aliasNames.includes("!");
}
get isGlobalCommand() {
return this instanceof GlobalCommand;
}
hasOption(name2) {
name2 = name2.split(".")[0];
return this.options.find((option) => {
return option.names.includes(name2);
});
}
outputHelp() {
const { name: name2, commands } = this.cli;
const {
versionNumber,
options: globalOptions,
helpCallback
} = this.cli.globalCommand;
let sections = [
{
body: `${name2}${versionNumber ? `/${versionNumber}` : ""}`
}
];
sections.push({
title: "Usage",
body: ` $ ${name2} ${this.usageText || this.rawName}`
});
const showCommands = (this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0;
if (showCommands) {
const longestCommandName = findLongest(commands.map((command) => command.rawName));
sections.push({
title: "Commands",
body: commands.map((command) => {
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
}).join("\n")
});
sections.push({
title: `For more info, run any command with the \`--help\` flag`,
body: commands.map((command) => ` $ ${name2}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
});
}
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
if (!this.isGlobalCommand && !this.isDefaultCommand) {
options = options.filter((option) => option.name !== "version");
}
if (options.length > 0) {
const longestOptionName = findLongest(options.map((option) => option.rawName));
sections.push({
title: "Options",
body: options.map((option) => {
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
}).join("\n")
});
}
if (this.examples.length > 0) {
sections.push({
title: "Examples",
body: this.examples.map((example) => {
if (typeof example === "function") {
return example(name2);
}
return example;
}).join("\n")
});
}
if (helpCallback) {
sections = helpCallback(sections) || sections;
}
console.log(sections.map((section) => {
return section.title ? `${section.title}:
${section.body}` : section.body;
}).join("\n\n"));
}
outputVersion() {
const { name: name2 } = this.cli;
const { versionNumber } = this.cli.globalCommand;
if (versionNumber) {
console.log(`${name2}/${versionNumber} ${platformInfo}`);
}
}
checkRequiredArgs() {
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
if (this.cli.args.length < minimalArgsCount) {
throw new CACError(`missing required args for command \`${this.rawName}\``);
}
}
checkUnknownOptions() {
const { options, globalCommand } = this.cli;
if (!this.config.allowUnknownOptions) {
for (const name2 of Object.keys(options)) {
if (name2 !== "--" && !this.hasOption(name2) && !globalCommand.hasOption(name2)) {
throw new CACError(`Unknown option \`${name2.length > 1 ? `--${name2}` : `-${name2}`}\``);
}
}
}
}
checkOptionValue() {
const { options: parsedOptions, globalCommand } = this.cli;
const options = [...globalCommand.options, ...this.options];
for (const option of options) {
const value = parsedOptions[option.name.split(".")[0]];
if (option.required) {
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
if (value === true || value === false && !hasNegated) {
throw new CACError(`option \`${option.rawName}\` value is missing`);
}
}
}
}
}
class GlobalCommand extends Command {
constructor(cli) {
super("@@global@@", "", {}, cli);
}
}
var __assign = Object.assign;
class CAC extends EventEmitter {
constructor(name2 = "") {
super();
this.name = name2;
this.commands = [];
this.rawArgs = [];
this.args = [];
this.options = {};
this.globalCommand = new GlobalCommand(this);
this.globalCommand.usage("<command> [options]");
}
usage(text) {
this.globalCommand.usage(text);
return this;
}
command(rawName, description, config) {
const command = new Command(rawName, description || "", config, this);
command.globalCommand = this.globalCommand;
this.commands.push(command);
return command;
}
option(rawName, description, config) {
this.globalCommand.option(rawName, description, config);
return this;
}
help(callback) {
this.globalCommand.option("-h, --help", "Display this message");
this.globalCommand.helpCallback = callback;
this.showHelpOnExit = true;
return this;
}
version(version2, customFlags = "-v, --version") {
this.globalCommand.version(version2, customFlags);
this.showVersionOnExit = true;
return this;
}
example(example) {
this.globalCommand.example(example);
return this;
}
outputHelp() {
if (this.matchedCommand) {
this.matchedCommand.outputHelp();
} else {
this.globalCommand.outputHelp();
}
}
outputVersion() {
this.globalCommand.outputVersion();
}
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
this.args = args;
this.options = options;
if (matchedCommand) {
this.matchedCommand = matchedCommand;
}
if (matchedCommandName) {
this.matchedCommandName = matchedCommandName;
}
return this;
}
unsetMatchedCommand() {
this.matchedCommand = void 0;
this.matchedCommandName = void 0;
}
parse(argv = processArgs, {
run = true
} = {}) {
this.rawArgs = argv;
if (!this.name) {
this.name = argv[1] ? getFileName(argv[1]) : "cli";
}
let shouldParse = true;
for (const command of this.commands) {
const parsed = this.mri(argv.slice(2), command);
const commandName = parsed.args[0];
if (command.isMatched(commandName)) {
shouldParse = false;
const parsedInfo = __assign(__assign({}, parsed), {
args: parsed.args.slice(1)
});
this.setParsedInfo(parsedInfo, command, commandName);
this.emit(`command:${commandName}`, command);
}
}
if (shouldParse) {
for (const command of this.commands) {
if (command.name === "") {
shouldParse = false;
const parsed = this.mri(argv.slice(2), command);
this.setParsedInfo(parsed, command);
this.emit(`command:!`, command);
}
}
}
if (shouldParse) {
const parsed = this.mri(argv.slice(2));
this.setParsedInfo(parsed);
}
if (this.options.help && this.showHelpOnExit) {
this.outputHelp();
run = false;
this.unsetMatchedCommand();
}
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
this.outputVersion();
run = false;
this.unsetMatchedCommand();
}
const parsedArgv = { args: this.args, options: this.options };
if (run) {
this.runMatchedCommand();
}
if (!this.matchedCommand && this.args[0]) {
this.emit("command:*");
}
return parsedArgv;
}
mri(argv, command) {
const cliOptions = [
...this.globalCommand.options,
...command ? command.options : []
];
const mriOptions = getMriOptions(cliOptions);
let argsAfterDoubleDashes = [];
const doubleDashesIndex = argv.indexOf("--");
if (doubleDashesIndex > -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
argv = argv.slice(0, doubleDashesIndex);
}
let parsed = mri2(argv, mriOptions);
parsed = Object.keys(parsed).reduce((res, name2) => {
return __assign(__assign({}, res), {
[camelcaseOptionName(name2)]: parsed[name2]
});
}, { _: [] });
const args = parsed._;
const options = {
"--": argsAfterDoubleDashes
};
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
let transforms = /* @__PURE__ */ Object.create(null);
for (const cliOption of cliOptions) {
if (!ignoreDefault && cliOption.config.default !== void 0) {
for (const name2 of cliOption.names) {
options[name2] = cliOption.config.default;
}
}
if (Array.isArray(cliOption.config.type)) {
if (transforms[cliOption.name] === void 0) {
transforms[cliOption.name] = /* @__PURE__ */ Object.create(null);
transforms[cliOption.name]["shouldTransform"] = true;
transforms[cliOption.name]["transformFunction"] = cliOption.config.type[0];
}
}
}
for (const key2 of Object.keys(parsed)) {
if (key2 !== "_") {
const keys = key2.split(".");
setDotProp(options, keys, parsed[key2]);
setByType(options, transforms);
}
}
return {
args,
options
};
}
runMatchedCommand() {
const { args, options, matchedCommand: command } = this;
if (!command || !command.commandAction)
return;
command.checkUnknownOptions();
command.checkOptionValue();
command.checkRequiredArgs();
const actionArgs = [];
command.args.forEach((arg, index) => {
if (arg.variadic) {
actionArgs.push(args.slice(index));
} else {
actionArgs.push(args[index]);
}
});
actionArgs.push(options);
return command.commandAction.apply(this, actionArgs);
}
}
const cac = (name2 = "") => new CAC(name2);
const name = "barrelize";
const version = "1.6.3";
function cliInit() {
const cli = cac(name);
cli.command("[config path]", `Generate barrel files`).option("-w, --watch", "Watch for changes and regenerate barrel files automatically").action(async (configPath, options) => {
await runGenerateCommand({ configPath: configPath || ".barrelize", watch: !!options.watch });
});
cli.command("init [config path]", "Create .barrelize config file if does not exist").example("barrelize init").example("barrelize init .barrelize").example("barrelize init root/.barrelize").action(async (path2 = ".barrelize") => {
await runInitCommand(path2);
});
cli.help();
cli.version(version);
try {
cli.parse();
} catch (error) {
if (error instanceof Error) {
logError(error.message);
} else {
logError(String(error));
}
}
}
var _accessExpressionAsString = {};
var hasRequired_accessExpressionAsString;
function require_accessExpressionAsString() {
if (hasRequired_accessExpressionAsString) return _accessExpressionAsString;
hasRequired_accessExpressionAsString = 1;
Object.defineProperty(_accessExpressionAsString, "__esModule", { value: true });
_accessExpressionAsString._accessExpressionAsString = void 0;
const _accessExpressionAsString$1 = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
_accessExpressionAsString._accessExpressionAsString = _accessExpressionAsString$1;
const variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
const reserved = (str) => RESERVED.has(str);
const RESERVED = /* @__PURE__ */ new Set([
"break",
"case",
"catch",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"enum",
"export",
"extends",
"false",
"finally",
"for",
"function",
"if",
"import",
"in",
"instanceof",
"new",
"null",
"return",
"super",
"switch",
"this",
"throw",
"true",
"try",
"typeof",
"var",
"void",
"while",
"with"
]);
return _accessExpressionAsString;
}
var _accessExpressionAsStringExports = /* @__PURE__ */ require_accessExpressionAsString();
var _validateReport = {};
var hasRequired_validateReport;
function require_validateReport() {
if (hasRequired_validateReport) return _validateReport;
hasRequired_validateReport = 1;
Object.defineProperty(_validateReport, "__esModule", { value: true });
_validateReport._validateReport = void 0;
const _validateReport$1 = (array) => {
const reportable = (path2) => {
if (array.length === 0)
return true;
const last = array[array.length - 1].path;
return path2.length > last.length || last.substring(0, path2.length) !== path2;
};
return (exceptable, error) => {
var _a;
if (exceptable && reportable(error.path)) {
if (error.value === void 0)
(_a = error.description) !== null && _a !== void 0 ? _a : error.description = [
"The value at this path is `undefined`.",
"",
`Please fill the \`${error.expected}\` typed value next time.`
].join("\n");
array.push(error);
}
return false;
};
};
_validateReport._validateReport = _validateReport$1;
return _validateReport;
}
var _validateReportExports = /* @__PURE__ */ require_validateReport();
var _createStandardSchema = {};
var hasRequired_createStandardSchema;
function require_createStandardSchema() {
if (hasRequired_createStandardSchema) return _createStandardSchema;
hasRequired_createStandardSchema = 1;
Object.defineProperty(_createStandardSchema, "__esModule", { value: true });
_createStandardSchema._createStandardSchema = void 0;
const _createStandardSchema$1 = (fn) => Object.assign(fn, {
"~standard": {
version: 1,
vendor: "typia",
validate: (input) => {
const result = fn(input);
if (result.success) {
return {
value: result.data
};
} else {
return {
issues: result.errors.map((error) => ({
message: `expected ${error.expected}, got ${error.value}`,
path: typiaPathToStandardSchemaPath(error.path)
}))
};
}
}
}
});
_createStandardSchema._createStandardSchema = _createStandardSchema$1;
var PathParserState;
(function(PathParserState2) {
PathParserState2[PathParserState2["Start"] = 0] = "Start";
PathParserState2[PathParserState2["Property"] = 1] = "Property";
PathParserState2[PathParserState2["StringKey"] = 2] = "StringKey";
PathParserState2[PathParserState2["NumberKey"] = 3] = "NumberKey";
})(PathParserState || (PathParserState = {}));
const typiaPathToStandardSchemaPath = (path2) => {
if (!path2.startsWith("$input")) {
throw new Error(`Invalid path: ${JSON.stringify(path2)}`);
}
const segments = [];
let currentSegment = "";
let state = PathParserState.Start;
let index = "$input".length - 1;
while (index < path2.length - 1) {
index++;
const char = path2[index];
if (state === PathParserState.Property) {
if (char === "." || char === "[") {
segments.push({
key: currentSegment
});
state = PathParserState.Start;
} else if (index === path2.length - 1) {
currentSegment += char;
segments.push({
key: currentSegment
});
index++;
state = PathParserState.Start;
} else {
currentSegment += char;
}
} else if (state === PathParserState.StringKey) {
if (char === '"') {
segments.push({
key: JSON.parse(currentSegment + char)
});
index += 2;
state = PathParserState.Start;
} else if (char === "\\") {
currentSegment += path2[index];
index++;
currentSegment += path2[index];
} else {
currentSegment += char;
}
} else if (state === PathParserState.NumberKey) {
if (char === "]") {
segments.push({
key: Number.parseInt(currentSegment)
});
index++;
state = PathParserState.Start;
} else {
currentSegment += char;
}
}
if (state === PathParserState.Start && index < path2.length - 1) {
const newChar = path2[index];
currentSegment = "";
if (newChar === "[") {
if (path2[index + 1] === '"') {
state = PathParserState.StringKey;
index++;
currentSegment = '"';
} else {
state = PathParserState.NumberKey;
}
} else if (newChar === ".") {
state = PathParserState.Property;
} else {
throw new Error("Unreachable: pointer points invalid character");
}
}
}
if (state !== PathParserState.Start) {
throw new Error(`Failed to parse path: ${JSON.stringify(path2)}`);
}
return segments;
};
return _createStandardSchema;
}
var _createStandardSchemaExports = /* @__PURE__ */ require_createStandardSchema();
const validateGenerateOptions = (() => {
const _io0 = (input, _exceptionable = true) => "string" === typeof input.configPath && "boolean" === typeof input.watch && (2 === Object.keys(input).length || Object.keys(input).every((key2) => {
if (["configPath", "watch"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return false;
}));
const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.configPath || _report(_exceptionable, {
path: _path + ".configPath",
expected: "string",
value: input.configPath
}), "boolean" === typeof input.watch || _report(_exceptionable, {
path: _path + ".watch",
expected: "boolean",
value: input.watch
}), 2 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
if (["configPath", "watch"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "undefined",
value,
description: [
`The property \`${key2}\` is not defined in the object type.`,
"",
"Please remove the property next time."
].join("\n")
});
}).every((flag) => flag))].every((flag) => flag);
const __is = (input, _exceptionable = true) => "object" === typeof input && null !== input && _io0(input, true);
let errors;
let _report;
return _createStandardSchemaExports._createStandardSchema((input) => {
if (false === __is(input)) {
errors = [];
_report = _validateReportExports._validateReport(errors);
((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
path: _path + "",
expected: "GenerateCommandOptions",
value: input2
})) && _vo0(input2, _path + "", true) || _report(true, {
path: _path + "",
expected: "GenerateCommandOptions",
value: input2
}))(input, "$input", true);
const success = 0 === errors.length;
return success ? {
success,
data: input
} : {
success,
errors,
data: input
};
}
return {
success: true,
data: input
};
});
})();
async function runGenerateCommand(options) {
const validatedOptions = validateGenerateOptions(options);
if (!validatedOptions.success) {
logValidationError(`Invalid 'generate' command options`, validatedOptions);
return;
}
if (!existsSync(options.configPath)) {
logError(`Couldn't find barrelize config file with path '${options.configPath}'`);
return;
}
const config = await parseConfig(options.configPath);
const validatedConfig = validateConfig(config);
if (!validatedConfig.success) {
logValidationError(`Invalid barrelize config`, validatedConfig);
return;
}
const configDir = resolve(dirname(options.configPath));
if (options.watch) {
watchBarrels(configDir, options.configPath, validatedConfig.data);
} else {
await generateBarrels(configDir, options.configPath, validatedConfig.data);
}
}
async function runInitCommand(baseConfigFilePath) {
const configFilePath = resolve(process.cwd(), baseConfigFilePath);
if (existsSync(configFilePath)) {
logWarning(`Config file '${configFilePath}' already exists`);
return;
}
const configDirectoryPath = dirname(configFilePath);
if (!existsSync(configDirectoryPath)) {
logWarning(`Directory '${configDirectoryPath}' does not exist`);
return;
}
const configTemplateJson = JSON.stringify(INITIAL_CONFIG, null, 2);
await writeFile(configFilePath, configTemplateJson);
console.log(
colorize(baseConfigFilePath, TerminalColor.CYAN),
colorize(`config file created`, TerminalColor.GRAY)
);
console.log(colorize(configTemplateJson, TerminalColor.GREEN));
}
var TerminalColor = /* @__PURE__ */ ((TerminalColor2) => {
TerminalColor2[TerminalColor2["BLACK"] = 0] = "BLACK";
TerminalColor2[TerminalColor2["RED"] = 1] = "RED";
TerminalColor2[TerminalColor2["GREEN"] = 2] = "GREEN";
TerminalColor2[TerminalColor2["YELLOW"] = 3] = "YELLOW";
TerminalColor2[TerminalColor2["BLUE"] = 4] = "BLUE";
TerminalColor2[TerminalColor2["MAGENTA"] = 5] = "MAGENTA";
TerminalColor2[TerminalColor2["CYAN"] = 6] = "CYAN";
TerminalColor2[TerminalColor2["WHITE"] = 7] = "WHITE";
TerminalColor2[TerminalColor2["GRAY"] = 60] = "GRAY";
return TerminalColor2;
})(TerminalColor || {});
function colorize(text, foreground, background) {
if (background == null) {
return `\x1B[${30 + foreground}m${text}\x1B[0m`;
}
return `\x1B[${30 + foreground}m\x1B[${40 + background}m${text}\x1B[0m`;
}
function logValidationError(message, validation) {
const formatError = (e) => {
const property = e.path.replace("$input.", "");
if (e.expected === "undefined") {
return `Property '${property}' is not allowed in configuration`;
}
if (e.value === void 0) {
return `Missing required property '${property}' in configuration`;
}
return `Invalid type for property '${property}', expected '${e.expected}', but ${e.value}`;
};
const errors = validation.errors.map((x) => ` ` + formatError(x)).join("\n");
const text = `${message}:
${errors}`;
logError(text);
}
function logError(message) {
console.log(colorize(message, TerminalColor.RED));
}
function logWarning(message) {
console.log(colorize(message, TerminalColor.YELLOW));
}
function logInfo(message) {
console.log(colorize(message, TerminalColor.BLUE));
}
function logDebug(message) {
if (process.argv.includes("--verbose")) {
console.log(colorize(message, TerminalColor.MAGENTA));
}
}
const INITIAL_CONFIG = {
$schema: "node_modules/barrelize/schema.json",
barrels: [
{
root: "src",
name: "index.ts",
include: ["**/*.ts"],
exclude: ["**/*.test.ts"]
}
]
};
const DEFAULT_CONFIG = {
root: "",
include: ["**/*.ts"],
exclude: [],
order: [],
name: "index.ts",
replace: { "/\\.ts$/": "" },
exports: {},
bracketSpacing: true,
singleQuote: true,
semi: true,
insertFinalNewline: true
};
const validateConfig = (() => {
const _io0 = (input, _exceptionable = true) => (void 0 === input.$schema || "string" === typeof input.$schema) && (void 0 === input.bracketSpacing || "boolean" === typeof input.bracketSpacing) && (void 0 === input.singleQuote || "boolean" === typeof input.singleQuote) && (void 0 === input.semi || "boolean" === typeof input.semi) && (void 0 === input.insertFinalNewline || "boolean" === typeof input.insertFinalNewline) && (Array.isArray(input.barrels) && input.barrels.every((elem, _index1) => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io1(elem, _exceptionable))) && (1 === Object.keys(input).length || Object.keys(input).every((key2) => {
if (["$schema", "bracketSpacing", "singleQuote", "semi", "insertFinalNewline", "barrels"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return false;
}));
const _io1 = (input, _exceptionable = true) => (void 0 === input.root || "string" === typeof input.root) && (void 0 === input.name || "string" === typeof input.name) && (void 0 === input.include || Array.isArray(input.include) && input.include.every((elem, _index2) => "string" === typeof elem)) && (void 0 === input.exclude || Array.isArray(input.exclude) && input.exclude.every((elem, _index3) => "string" === typeof elem)) && (void 0 === input.order || Array.isArray(input.order) && input.order.every((elem, _index4) => "string" === typeof elem)) && (void 0 === input.replace || "object" === typeof input.replace && null !== input.replace && false === Array.isArray(input.replace) && _io2(input.replace, _exceptionable)) && (void 0 === input.exports || "object" === typeof input.exports && null !== input.exports && false === Array.isArray(input.exports) && _io3(input.exports, _exceptionable)) && (void 0 === input.bracketSpacing || "boolean" === typeof input.bracketSpacing) && (void 0 === input.singleQuote || "boolean" === typeof input.singleQuote) && (void 0 === input.semi || "boolean" === typeof input.semi) && (void 0 === input.insertFinalNewline || "boolean" === typeof input.insertFinalNewline) && (0 === Object.keys(input).length || Object.keys(input).every((key2) => {
if (["root", "name", "include", "exclude", "order", "replace", "exports", "bracketSpacing", "singleQuote", "semi", "insertFinalNewline"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return false;
}));
const _io2 = (input, _exceptionable = true) => Object.keys(input).every((key2) => {
const value = input[key2];
if (void 0 === value)
return true;
return "string" === typeof value;
});
const _io3 = (input, _exceptionable = true) => Object.keys(input).every((key2) => {
const value = input[key2];
if (void 0 === value)
return true;
return Array.isArray(value) && value.every((elem, _index5) => "string" === typeof elem);
});
const _vo0 = (input, _path, _exceptionable = true) => [void 0 === input.$schema || "string" === typeof input.$schema || _report(_exceptionable, {
path: _path + ".$schema",
expected: "(string | undefined)",
value: input.$schema
}), void 0 === input.bracketSpacing || "boolean" === typeof input.bracketSpacing || _report(_exceptionable, {
path: _path + ".bracketSpacing",
expected: "(boolean | undefined)",
value: input.bracketSpacing
}), void 0 === input.singleQuote || "boolean" === typeof input.singleQuote || _report(_exceptionable, {
path: _path + ".singleQuote",
expected: "(boolean | undefined)",
value: input.singleQuote
}), void 0 === input.semi || "boolean" === typeof input.semi || _report(_exceptionable, {
path: _path + ".semi",
expected: "(boolean | undefined)",
value: input.semi
}), void 0 === input.insertFinalNewline || "boolean" === typeof input.insertFinalNewline || _report(_exceptionable, {
path: _path + ".insertFinalNewline",
expected: "(boolean | undefined)",
value: input.insertFinalNewline
}), (Array.isArray(input.barrels) || _report(_exceptionable, {
path: _path + ".barrels",
expected: "Array<BarrelConfig>",
value: input.barrels
})) && input.barrels.map((elem, _index6) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
path: _path + ".barrels[" + _index6 + "]",
expected: "BarrelConfig",
value: elem
})) && _vo1(elem, _path + ".barrels[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
path: _path + ".barrels[" + _index6 + "]",
expected: "BarrelConfig",
value: elem
})).every((flag) => flag) || _report(_exceptionable, {
path: _path + ".barrels",
expected: "Array<BarrelConfig>",
value: input.barrels
}), 1 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
if (["$schema", "bracketSpacing", "singleQuote", "semi", "insertFinalNewline", "barrels"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "undefined",
value,
description: [
`The property \`${key2}\` is not defined in the object type.`,
"",
"Please remove the property next time."
].join("\n")
});
}).every((flag) => flag))].every((flag) => flag);
const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.root || "string" === typeof input.root || _report(_exceptionable, {
path: _path + ".root",
expected: "(string | undefined)",
value: input.root
}), void 0 === input.name || "string" === typeof input.name || _report(_exceptionable, {
path: _path + ".name",
expected: "(string | undefined)",
value: input.name
}), void 0 === input.include || (Array.isArray(input.include) || _report(_exceptionable, {
path: _path + ".include",
expected: "(Array<string> | undefined)",
value: input.include
})) && input.include.map((elem, _index7) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".include[" + _index7 + "]",
expected: "string",
value: elem
})).every((flag) => flag) || _report(_exceptionable, {
path: _path + ".include",
expected: "(Array<string> | undefined)",
value: input.include
}), void 0 === input.exclude || (Array.isArray(input.exclude) || _report(_exceptionable, {
path: _path + ".exclude",
expected: "(Array<string> | undefined)",
value: input.exclude
})) && input.exclude.map((elem, _index8) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".exclude[" + _index8 + "]",
expected: "string",
value: elem
})).every((flag) => flag) || _report(_exceptionable, {
path: _path + ".exclude",
expected: "(Array<string> | undefined)",
value: input.exclude
}), void 0 === input.order || (Array.isArray(input.order) || _report(_exceptionable, {
path: _path + ".order",
expected: "(Array<string> | undefined)",
value: input.order
})) && input.order.map((elem, _index9) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".order[" + _index9 + "]",
expected: "string",
value: elem
})).every((flag) => flag) || _report(_exceptionable, {
path: _path + ".order",
expected: "(Array<string> | undefined)",
value: input.order
}), void 0 === input.replace || ("object" === typeof input.replace && null !== input.replace && false === Array.isArray(input.replace) || _report(_exceptionable, {
path: _path + ".replace",
expected: "(__type | undefined)",
value: input.replace
})) && _vo2(input.replace, _path + ".replace", _exceptionable) || _report(_exceptionable, {
path: _path + ".replace",
expected: "(__type | undefined)",
value: input.replace
}), void 0 === input.exports || ("object" === typeof input.exports && null !== input.exports && false === Array.isArray(input.exports) || _report(_exceptionable, {
path: _path + ".exports",
expected: "(__type.o1 | undefined)",
value: input.exports
})) && _vo3(input.exports, _path + ".exports", _exceptionable) || _report(_exceptionable, {
path: _path + ".exports",
expected: "(__type.o1 | undefined)",
value: input.exports
}), void 0 === input.bracketSpacing || "boolean" === typeof input.bracketSpacing || _report(_exceptionable, {
path: _path + ".bracketSpacing",
expected: "(boolean | undefined)",
value: input.bracketSpacing
}), void 0 === input.singleQuote || "boolean" === typeof input.singleQuote || _report(_exceptionable, {
path: _path + ".singleQuote",
expected: "(boolean | undefined)",
value: input.singleQuote
}), void 0 === input.semi || "boolean" === typeof input.semi || _report(_exceptionable, {
path: _path + ".semi",
expected: "(boolean | undefined)",
value: input.semi
}), void 0 === input.insertFinalNewline || "boolean" === typeof input.insertFinalNewline || _report(_exceptionable, {
path: _path + ".insertFinalNewline",
expected: "(boolean | undefined)",
value: input.insertFinalNewline
}), 0 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
if (["root", "name", "include", "exclude", "order", "replace", "exports", "bracketSpacing", "singleQuote", "semi", "insertFinalNewline"].some((prop) => key2 === prop))
return true;
const value = input[key2];
if (void 0 === value)
return true;
return _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "undefined",
value,
description: [
`The property \`${key2}\` is not defined in the object type.`,
"",
"Please remove the property next time."
].join("\n")
});
}).every((flag) => flag))].every((flag) => flag);
const _vo2 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map((key2) => {
const value = input[key2];
if (void 0 === value)
return true;
return "string" === typeof value || _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "string",
value
});
}).every((flag) => flag)].every((flag) => flag);
const _vo3 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map((key2) => {
const value = input[key2];
if (void 0 === value)
return true;
return (Array.isArray(value) || _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "Array<string>",
value
})) && value.map((elem, _index10) => "string" === typeof elem || _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2) + "[" + _index10 + "]",
expected: "string",
value: elem
})).every((flag) => flag) || _report(_exceptionable, {
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
expected: "Array<string>",
value
});
}).every((flag) => flag)].every((flag) => flag);
const __is = (input, _exceptionable = true) => "object" === typeof input && null !== input && _io0(input, true);
let errors;
let _report;
return _createStandardSchemaExports._createStandardSchema((input) => {
if (false === __is(input)) {
errors = [];
_report = _validateReportExports._validateReport(errors);
((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
path: _path + "",
expected: "Config",
value: input2
})) && _vo0(input2, _path + "", true) || _report(true, {
path: _path + "",
expected: "Config",
value: input2
}))(input, "$input", true);
const success = 0 === errors.length;
return success ? {
success,
data: input
} : {
success,
errors,
data: input
};
}
return {
success: true,
data: input
};
});
})();
var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-