barrelize 1.2.2 → 1.3.0
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/README.md +4 -4
- package/lib/index.js +46 -164
- package/lib/src/config/config.d.ts +4 -4
- package/lib/src/generate/generate-barrel.d.ts +2 -2
- package/lib/src/generate/glob-paths.d.ts +2 -2
- package/lib/src/generate/handle-path-order.d.ts +2 -2
- package/lib/src/generate/handle-path-replacement.d.ts +2 -2
- package/lib/src/index.d.ts +0 -1
- package/package.json +1 -1
- package/schema.json +6 -6
- package/lib/src/config/output-config.d.ts +0 -8
package/README.md
CHANGED
|
@@ -80,9 +80,11 @@ Create a `.barrelize` file in your project root. The configuration file uses JSO
|
|
|
80
80
|
"singleQuote": true, // Use single quotes for exports (default: true)
|
|
81
81
|
"semi": true, // Add semicolons after exports (default: true)
|
|
82
82
|
"insertFinalNewline": true, // Add newline at end of file (default: true)
|
|
83
|
-
// Configure multiple
|
|
84
|
-
"
|
|
83
|
+
// Configure multiple barrels to generate barrels for
|
|
84
|
+
"barrels": [
|
|
85
85
|
{
|
|
86
|
+
// Name of the index file (default: "index.ts")
|
|
87
|
+
"name": "index.ts",
|
|
86
88
|
// Root directory to start from (default: "")
|
|
87
89
|
"path": "src",
|
|
88
90
|
// Files to include in the barrel (default: ["**/*.ts"])
|
|
@@ -91,8 +93,6 @@ Create a `.barrelize` file in your project root. The configuration file uses JSO
|
|
|
91
93
|
"exclude": ["**/*.test.ts", "**/*.spec.ts"],
|
|
92
94
|
// Optional ordering of exports (default: [])
|
|
93
95
|
"order": ["types", "constants", "utils"],
|
|
94
|
-
// Name of the index file (default: "index.ts")
|
|
95
|
-
"indexFilePath": "index.ts",
|
|
96
96
|
// Optional string replacements in export paths
|
|
97
97
|
"replace": [
|
|
98
98
|
{
|
package/lib/index.js
CHANGED
|
@@ -591,10 +591,10 @@ class CAC extends EventEmitter {
|
|
|
591
591
|
}
|
|
592
592
|
const cac = (name2 = "") => new CAC(name2);
|
|
593
593
|
const name = "barrelize";
|
|
594
|
-
const version = "1.2.
|
|
594
|
+
const version = "1.2.2";
|
|
595
595
|
function cliInit() {
|
|
596
596
|
const cli = cac(name);
|
|
597
|
-
cli.command("[config path]", `Generate
|
|
597
|
+
cli.command("[config path]", `Generate barrel files`).action(async (config) => {
|
|
598
598
|
await runGenerateCommand({ configPath: config || ".barrelize" });
|
|
599
599
|
});
|
|
600
600
|
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") => {
|
|
@@ -614,12 +614,12 @@ function cliInit() {
|
|
|
614
614
|
}
|
|
615
615
|
const configTemplate = {
|
|
616
616
|
$schema: "node_modules/barrelize/schema.json",
|
|
617
|
-
|
|
617
|
+
barrels: [
|
|
618
618
|
{
|
|
619
|
+
name: "index.ts",
|
|
619
620
|
path: "src",
|
|
620
621
|
include: ["**/*.ts"],
|
|
621
|
-
exclude: ["**/*.test.ts"]
|
|
622
|
-
indexFilePath: "index.ts"
|
|
622
|
+
exclude: ["**/*.test.ts"]
|
|
623
623
|
}
|
|
624
624
|
]
|
|
625
625
|
};
|
|
@@ -959,23 +959,23 @@ const DEFAULT_CONFIG = {
|
|
|
959
959
|
include: ["**/*.ts"],
|
|
960
960
|
exclude: [],
|
|
961
961
|
order: [],
|
|
962
|
-
|
|
962
|
+
name: "index.ts",
|
|
963
963
|
replace: [{ find: "\\.ts$", replacement: "" }],
|
|
964
964
|
singleQuote: true,
|
|
965
965
|
semi: true,
|
|
966
966
|
insertFinalNewline: true
|
|
967
967
|
};
|
|
968
968
|
const validateConfig = (() => {
|
|
969
|
-
const _io0 = (input, _exceptionable = true) => (void 0 === input.$schema || "string" === typeof input.$schema) && (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.
|
|
970
|
-
if (["$schema", "singleQuote", "semi", "insertFinalNewline", "
|
|
969
|
+
const _io0 = (input, _exceptionable = true) => (void 0 === input.$schema || "string" === typeof input.$schema) && (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) => {
|
|
970
|
+
if (["$schema", "singleQuote", "semi", "insertFinalNewline", "barrels"].some((prop) => key2 === prop))
|
|
971
971
|
return true;
|
|
972
972
|
const value = input[key2];
|
|
973
973
|
if (void 0 === value)
|
|
974
974
|
return true;
|
|
975
975
|
return false;
|
|
976
976
|
}));
|
|
977
|
-
const _io1 = (input, _exceptionable = true) => (void 0 === input.path || "string" === typeof input.path) && (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.
|
|
978
|
-
if (["path", "include", "exclude", "order", "
|
|
977
|
+
const _io1 = (input, _exceptionable = true) => (void 0 === input.name || "string" === typeof input.name) && (void 0 === input.path || "string" === typeof input.path) && (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 || Array.isArray(input.replace) && input.replace.every((elem, _index5) => "object" === typeof elem && null !== elem && _io2(elem, _exceptionable))) && (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) => {
|
|
978
|
+
if (["name", "path", "include", "exclude", "order", "replace", "singleQuote", "semi", "insertFinalNewline"].some((prop) => key2 === prop))
|
|
979
979
|
return true;
|
|
980
980
|
const value = input[key2];
|
|
981
981
|
if (void 0 === value)
|
|
@@ -1006,24 +1006,24 @@ const validateConfig = (() => {
|
|
|
1006
1006
|
path: _path + ".insertFinalNewline",
|
|
1007
1007
|
expected: "(boolean | undefined)",
|
|
1008
1008
|
value: input.insertFinalNewline
|
|
1009
|
-
}), (Array.isArray(input.
|
|
1010
|
-
path: _path + ".
|
|
1011
|
-
expected: "Array<
|
|
1012
|
-
value: input.
|
|
1013
|
-
})) && input.
|
|
1014
|
-
path: _path + ".
|
|
1015
|
-
expected: "
|
|
1009
|
+
}), (Array.isArray(input.barrels) || _report(_exceptionable, {
|
|
1010
|
+
path: _path + ".barrels",
|
|
1011
|
+
expected: "Array<BarrelConfig>",
|
|
1012
|
+
value: input.barrels
|
|
1013
|
+
})) && input.barrels.map((elem, _index6) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _report(_exceptionable, {
|
|
1014
|
+
path: _path + ".barrels[" + _index6 + "]",
|
|
1015
|
+
expected: "BarrelConfig",
|
|
1016
1016
|
value: elem
|
|
1017
|
-
})) && _vo1(elem, _path + ".
|
|
1018
|
-
path: _path + ".
|
|
1019
|
-
expected: "
|
|
1017
|
+
})) && _vo1(elem, _path + ".barrels[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
1018
|
+
path: _path + ".barrels[" + _index6 + "]",
|
|
1019
|
+
expected: "BarrelConfig",
|
|
1020
1020
|
value: elem
|
|
1021
1021
|
})).every((flag) => flag) || _report(_exceptionable, {
|
|
1022
|
-
path: _path + ".
|
|
1023
|
-
expected: "Array<
|
|
1024
|
-
value: input.
|
|
1022
|
+
path: _path + ".barrels",
|
|
1023
|
+
expected: "Array<BarrelConfig>",
|
|
1024
|
+
value: input.barrels
|
|
1025
1025
|
}), 1 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
|
|
1026
|
-
if (["$schema", "singleQuote", "semi", "insertFinalNewline", "
|
|
1026
|
+
if (["$schema", "singleQuote", "semi", "insertFinalNewline", "barrels"].some((prop) => key2 === prop))
|
|
1027
1027
|
return true;
|
|
1028
1028
|
const value = input[key2];
|
|
1029
1029
|
if (void 0 === value)
|
|
@@ -1034,7 +1034,11 @@ const validateConfig = (() => {
|
|
|
1034
1034
|
value
|
|
1035
1035
|
});
|
|
1036
1036
|
}).every((flag) => flag))].every((flag) => flag);
|
|
1037
|
-
const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.
|
|
1037
|
+
const _vo1 = (input, _path, _exceptionable = true) => [void 0 === input.name || "string" === typeof input.name || _report(_exceptionable, {
|
|
1038
|
+
path: _path + ".name",
|
|
1039
|
+
expected: "(string | undefined)",
|
|
1040
|
+
value: input.name
|
|
1041
|
+
}), void 0 === input.path || "string" === typeof input.path || _report(_exceptionable, {
|
|
1038
1042
|
path: _path + ".path",
|
|
1039
1043
|
expected: "(string | undefined)",
|
|
1040
1044
|
value: input.path
|
|
@@ -1074,10 +1078,6 @@ const validateConfig = (() => {
|
|
|
1074
1078
|
path: _path + ".order",
|
|
1075
1079
|
expected: "(Array<string> | undefined)",
|
|
1076
1080
|
value: input.order
|
|
1077
|
-
}), void 0 === input.indexFilePath || "string" === typeof input.indexFilePath || _report(_exceptionable, {
|
|
1078
|
-
path: _path + ".indexFilePath",
|
|
1079
|
-
expected: "(string | undefined)",
|
|
1080
|
-
value: input.indexFilePath
|
|
1081
1081
|
}), void 0 === input.replace || (Array.isArray(input.replace) || _report(_exceptionable, {
|
|
1082
1082
|
path: _path + ".replace",
|
|
1083
1083
|
expected: "(Array<__type> | undefined)",
|
|
@@ -1107,7 +1107,7 @@ const validateConfig = (() => {
|
|
|
1107
1107
|
expected: "(boolean | undefined)",
|
|
1108
1108
|
value: input.insertFinalNewline
|
|
1109
1109
|
}), 0 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
|
|
1110
|
-
if (["path", "include", "exclude", "order", "
|
|
1110
|
+
if (["name", "path", "include", "exclude", "order", "replace", "singleQuote", "semi", "insertFinalNewline"].some((prop) => key2 === prop))
|
|
1111
1111
|
return true;
|
|
1112
1112
|
const value = input[key2];
|
|
1113
1113
|
if (void 0 === value)
|
|
@@ -8824,9 +8824,9 @@ const glob = Object.assign(glob_, {
|
|
|
8824
8824
|
unescape
|
|
8825
8825
|
});
|
|
8826
8826
|
glob.glob = glob;
|
|
8827
|
-
async function globPaths(cwd,
|
|
8828
|
-
const ignore = [...
|
|
8829
|
-
let paths = await glob(
|
|
8827
|
+
async function globPaths(cwd, barrelConfig) {
|
|
8828
|
+
const ignore = [...barrelConfig.exclude ?? DEFAULT_CONFIG.exclude, "**/index.ts", "**/index.js"];
|
|
8829
|
+
let paths = await glob(barrelConfig.include ?? DEFAULT_CONFIG.include, {
|
|
8830
8830
|
cwd,
|
|
8831
8831
|
ignore,
|
|
8832
8832
|
nodir: true,
|
|
@@ -8835,134 +8835,17 @@ async function globPaths(cwd, directoryConfig) {
|
|
|
8835
8835
|
paths = paths.map((file) => file.replace(/\\/g, "/"));
|
|
8836
8836
|
return paths;
|
|
8837
8837
|
}
|
|
8838
|
-
|
|
8839
|
-
const
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
if (void 0 === value)
|
|
8844
|
-
return true;
|
|
8845
|
-
return false;
|
|
8846
|
-
}));
|
|
8847
|
-
const _io1 = (input, _exceptionable = true) => Array.isArray(input.files) && input.files.every((elem, _index2) => "string" === typeof elem) && (void 0 === input.order || Array.isArray(input.order) && input.order.every((elem, _index3) => "string" === typeof elem)) && (1 === Object.keys(input).length || Object.keys(input).every((key2) => {
|
|
8848
|
-
if (["files", "order"].some((prop) => key2 === prop))
|
|
8849
|
-
return true;
|
|
8850
|
-
const value = input[key2];
|
|
8851
|
-
if (void 0 === value)
|
|
8852
|
-
return true;
|
|
8853
|
-
return false;
|
|
8854
|
-
}));
|
|
8855
|
-
const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.cwd || _report(_exceptionable, {
|
|
8856
|
-
path: _path + ".cwd",
|
|
8857
|
-
expected: "string",
|
|
8858
|
-
value: input.cwd
|
|
8859
|
-
}), (Array.isArray(input.directories) || _report(_exceptionable, {
|
|
8860
|
-
path: _path + ".directories",
|
|
8861
|
-
expected: "Array<__type>",
|
|
8862
|
-
value: input.directories
|
|
8863
|
-
})) && input.directories.map((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
8864
|
-
path: _path + ".directories[" + _index4 + "]",
|
|
8865
|
-
expected: "__type",
|
|
8866
|
-
value: elem
|
|
8867
|
-
})) && _vo1(elem, _path + ".directories[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
8868
|
-
path: _path + ".directories[" + _index4 + "]",
|
|
8869
|
-
expected: "__type",
|
|
8870
|
-
value: elem
|
|
8871
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
8872
|
-
path: _path + ".directories",
|
|
8873
|
-
expected: "Array<__type>",
|
|
8874
|
-
value: input.directories
|
|
8875
|
-
}), 2 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
|
|
8876
|
-
if (["cwd", "directories"].some((prop) => key2 === prop))
|
|
8877
|
-
return true;
|
|
8878
|
-
const value = input[key2];
|
|
8879
|
-
if (void 0 === value)
|
|
8880
|
-
return true;
|
|
8881
|
-
return _report(_exceptionable, {
|
|
8882
|
-
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
|
|
8883
|
-
expected: "undefined",
|
|
8884
|
-
value
|
|
8885
|
-
});
|
|
8886
|
-
}).every((flag) => flag))].every((flag) => flag);
|
|
8887
|
-
const _vo1 = (input, _path, _exceptionable = true) => [(Array.isArray(input.files) || _report(_exceptionable, {
|
|
8888
|
-
path: _path + ".files",
|
|
8889
|
-
expected: "Array<string>",
|
|
8890
|
-
value: input.files
|
|
8891
|
-
})) && input.files.map((elem, _index5) => "string" === typeof elem || _report(_exceptionable, {
|
|
8892
|
-
path: _path + ".files[" + _index5 + "]",
|
|
8893
|
-
expected: "string",
|
|
8894
|
-
value: elem
|
|
8895
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
8896
|
-
path: _path + ".files",
|
|
8897
|
-
expected: "Array<string>",
|
|
8898
|
-
value: input.files
|
|
8899
|
-
}), void 0 === input.order || (Array.isArray(input.order) || _report(_exceptionable, {
|
|
8900
|
-
path: _path + ".order",
|
|
8901
|
-
expected: "(Array<string> | undefined)",
|
|
8902
|
-
value: input.order
|
|
8903
|
-
})) && input.order.map((elem, _index6) => "string" === typeof elem || _report(_exceptionable, {
|
|
8904
|
-
path: _path + ".order[" + _index6 + "]",
|
|
8905
|
-
expected: "string",
|
|
8906
|
-
value: elem
|
|
8907
|
-
})).every((flag) => flag) || _report(_exceptionable, {
|
|
8908
|
-
path: _path + ".order",
|
|
8909
|
-
expected: "(Array<string> | undefined)",
|
|
8910
|
-
value: input.order
|
|
8911
|
-
}), 1 === Object.keys(input).length || (false === _exceptionable || Object.keys(input).map((key2) => {
|
|
8912
|
-
if (["files", "order"].some((prop) => key2 === prop))
|
|
8913
|
-
return true;
|
|
8914
|
-
const value = input[key2];
|
|
8915
|
-
if (void 0 === value)
|
|
8916
|
-
return true;
|
|
8917
|
-
return _report(_exceptionable, {
|
|
8918
|
-
path: _path + _accessExpressionAsStringExports._accessExpressionAsString(key2),
|
|
8919
|
-
expected: "undefined",
|
|
8920
|
-
value
|
|
8921
|
-
});
|
|
8922
|
-
}).every((flag) => flag))].every((flag) => flag);
|
|
8923
|
-
const __is = (input, _exceptionable = true) => "object" === typeof input && null !== input && _io0(input, true);
|
|
8924
|
-
let errors;
|
|
8925
|
-
let _report;
|
|
8926
|
-
return _createStandardSchemaExports._createStandardSchema((input) => {
|
|
8927
|
-
if (false === __is(input)) {
|
|
8928
|
-
errors = [];
|
|
8929
|
-
_report = _validateReportExports._validateReport(errors);
|
|
8930
|
-
((input2, _path, _exceptionable = true) => ("object" === typeof input2 && null !== input2 || _report(true, {
|
|
8931
|
-
path: _path + "",
|
|
8932
|
-
expected: "OutputConfig",
|
|
8933
|
-
value: input2
|
|
8934
|
-
})) && _vo0(input2, _path + "", true) || _report(true, {
|
|
8935
|
-
path: _path + "",
|
|
8936
|
-
expected: "OutputConfig",
|
|
8937
|
-
value: input2
|
|
8938
|
-
}))(input, "$input", true);
|
|
8939
|
-
const success = 0 === errors.length;
|
|
8940
|
-
return success ? {
|
|
8941
|
-
success,
|
|
8942
|
-
data: input
|
|
8943
|
-
} : {
|
|
8944
|
-
success,
|
|
8945
|
-
errors,
|
|
8946
|
-
data: input
|
|
8947
|
-
};
|
|
8948
|
-
}
|
|
8949
|
-
return {
|
|
8950
|
-
success: true,
|
|
8951
|
-
data: input
|
|
8952
|
-
};
|
|
8953
|
-
});
|
|
8954
|
-
})();
|
|
8955
|
-
async function generateBarrel(rootPath, directoryConfig) {
|
|
8956
|
-
const cwd = resolve(rootPath, directoryConfig.path ?? DEFAULT_CONFIG.path);
|
|
8957
|
-
let paths = await globPaths(cwd, directoryConfig);
|
|
8958
|
-
paths = handlePathOrder(directoryConfig, paths);
|
|
8959
|
-
paths = handlePathReplacement(directoryConfig, paths);
|
|
8838
|
+
async function generateBarrel(rootPath, barrelConfig) {
|
|
8839
|
+
const cwd = resolve(rootPath, barrelConfig.path ?? DEFAULT_CONFIG.path);
|
|
8840
|
+
let paths = await globPaths(cwd, barrelConfig);
|
|
8841
|
+
paths = handlePathOrder(barrelConfig, paths);
|
|
8842
|
+
paths = handlePathReplacement(barrelConfig, paths);
|
|
8960
8843
|
return paths;
|
|
8961
8844
|
}
|
|
8962
8845
|
async function generateBarrels(rootPath, configPath, config) {
|
|
8963
|
-
for (const
|
|
8964
|
-
const indexFileBasePath =
|
|
8965
|
-
const indexFileRelativePath = join(
|
|
8846
|
+
for (const barrel of config.barrels) {
|
|
8847
|
+
const indexFileBasePath = barrel.name ?? DEFAULT_CONFIG.name;
|
|
8848
|
+
const indexFileRelativePath = join(barrel.path ?? DEFAULT_CONFIG.path, indexFileBasePath);
|
|
8966
8849
|
const indexFileAbsolutePath = resolve(rootPath, indexFileRelativePath);
|
|
8967
8850
|
const indexDirectory = dirname(indexFileAbsolutePath);
|
|
8968
8851
|
if (!existsSync(indexDirectory)) {
|
|
@@ -8970,10 +8853,10 @@ async function generateBarrels(rootPath, configPath, config) {
|
|
|
8970
8853
|
console.error(logWarning(` Please verify the directory path in your '${configPath}' configuration`));
|
|
8971
8854
|
continue;
|
|
8972
8855
|
}
|
|
8973
|
-
const paths = await generateBarrel(rootPath,
|
|
8974
|
-
const quote =
|
|
8975
|
-
const semiIfNeeded =
|
|
8976
|
-
const newLineIfNeeded =
|
|
8856
|
+
const paths = await generateBarrel(rootPath, barrel);
|
|
8857
|
+
const quote = barrel.singleQuote ?? config.singleQuote ?? DEFAULT_CONFIG.singleQuote ? "'" : '"';
|
|
8858
|
+
const semiIfNeeded = barrel.semi ?? config.semi ?? DEFAULT_CONFIG.semi ? ";" : "";
|
|
8859
|
+
const newLineIfNeeded = barrel.insertFinalNewline ?? config.insertFinalNewline ?? DEFAULT_CONFIG.insertFinalNewline ? "\n" : "";
|
|
8977
8860
|
const formatExportLine = (path2) => `export * from ${quote}./${path2}${quote}${semiIfNeeded}`;
|
|
8978
8861
|
const content = paths.map(formatExportLine).join("\n") + newLineIfNeeded;
|
|
8979
8862
|
const exportedText = `${paths.length} file${plural(paths)} exported`;
|
|
@@ -9094,6 +8977,5 @@ export {
|
|
|
9094
8977
|
pathsDifferences,
|
|
9095
8978
|
runGenerateCommand,
|
|
9096
8979
|
runInitCommand,
|
|
9097
|
-
validateConfig
|
|
9098
|
-
validateOutputConfig
|
|
8980
|
+
validateConfig
|
|
9099
8981
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type BarrelConfig = {
|
|
2
|
+
name?: string;
|
|
2
3
|
path?: string;
|
|
3
4
|
include?: string[];
|
|
4
5
|
exclude?: string[];
|
|
5
6
|
order?: string[];
|
|
6
|
-
indexFilePath?: string;
|
|
7
7
|
replace?: {
|
|
8
8
|
find: string;
|
|
9
9
|
replacement: string;
|
|
@@ -17,7 +17,7 @@ export type Config = {
|
|
|
17
17
|
singleQuote?: boolean;
|
|
18
18
|
semi?: boolean;
|
|
19
19
|
insertFinalNewline?: boolean;
|
|
20
|
-
|
|
20
|
+
barrels: BarrelConfig[];
|
|
21
21
|
};
|
|
22
|
-
export declare const DEFAULT_CONFIG: Required<
|
|
22
|
+
export declare const DEFAULT_CONFIG: Required<BarrelConfig>;
|
|
23
23
|
export declare const validateConfig: ((input: unknown) => import('typia').IValidation<Config>) & import('@standard-schema/spec').StandardSchemaV1<unknown, Config>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function generateBarrel(rootPath: string,
|
|
1
|
+
import { BarrelConfig } from '../index.ts';
|
|
2
|
+
export declare function generateBarrel(rootPath: string, barrelConfig: BarrelConfig): Promise<string[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function globPaths(cwd: string,
|
|
1
|
+
import { BarrelConfig } from '../index.ts';
|
|
2
|
+
export declare function globPaths(cwd: string, barrelConfig: BarrelConfig): Promise<string[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function handlePathOrder(config:
|
|
1
|
+
import { BarrelConfig } from '../index.ts';
|
|
2
|
+
export declare function handlePathOrder(config: BarrelConfig, paths: string[]): string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function handlePathReplacement(config:
|
|
1
|
+
import { BarrelConfig } from '../index.ts';
|
|
2
|
+
export declare function handlePathReplacement(config: BarrelConfig, files: string[]): string[];
|
package/lib/src/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from './log/log-validation-error';
|
|
|
8
8
|
export * from './config/config';
|
|
9
9
|
export * from './config/parse-config';
|
|
10
10
|
export * from './generate/glob-paths';
|
|
11
|
-
export * from './config/output-config';
|
|
12
11
|
export * from './generate/generate-barrel';
|
|
13
12
|
export * from './generate/generate-barrels';
|
|
14
13
|
export * from './generate/handle-path-order';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -17,11 +17,15 @@
|
|
|
17
17
|
"type": "boolean",
|
|
18
18
|
"default": true
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"barrels": {
|
|
21
21
|
"type": "array",
|
|
22
22
|
"items": {
|
|
23
23
|
"type": "object",
|
|
24
24
|
"properties": {
|
|
25
|
+
"name": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"default": "index.ts"
|
|
28
|
+
},
|
|
25
29
|
"path": {
|
|
26
30
|
"type": "string",
|
|
27
31
|
"default": ""
|
|
@@ -49,10 +53,6 @@
|
|
|
49
53
|
},
|
|
50
54
|
"default": []
|
|
51
55
|
},
|
|
52
|
-
"indexFilePath": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"default": "index.ts"
|
|
55
|
-
},
|
|
56
56
|
"replace": {
|
|
57
57
|
"type": "array",
|
|
58
58
|
"items": {
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"required": [
|
|
98
|
-
"
|
|
98
|
+
"barrels"
|
|
99
99
|
]
|
|
100
100
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type OutputConfig = {
|
|
2
|
-
cwd: string;
|
|
3
|
-
directories: {
|
|
4
|
-
files: string[];
|
|
5
|
-
order?: string[];
|
|
6
|
-
}[];
|
|
7
|
-
};
|
|
8
|
-
export declare const validateOutputConfig: ((input: unknown) => import('typia').IValidation<OutputConfig>) & import('@standard-schema/spec').StandardSchemaV1<unknown, OutputConfig>;
|