@isdk/util 0.1.1
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 +6 -0
- package/dist/chunk-3TCMKKX2.mjs +1 -0
- package/dist/chunk-46TT3NZV.mjs +1 -0
- package/dist/chunk-7APJBRA7.mjs +1 -0
- package/dist/chunk-7AQU3PBW.mjs +1 -0
- package/dist/chunk-D3BCI5SM.mjs +1 -0
- package/dist/chunk-FXF2KJLF.mjs +1 -0
- package/dist/chunk-GGOKSJK4.mjs +1 -0
- package/dist/chunk-JTTOXXPG.mjs +1 -0
- package/dist/chunk-LOMQZH4U.mjs +292 -0
- package/dist/chunk-OTEAFARC.mjs +1 -0
- package/dist/chunk-UJZVJIGI.mjs +1 -0
- package/dist/config-file.d.mts +75 -0
- package/dist/config-file.d.ts +75 -0
- package/dist/config-file.js +1 -0
- package/dist/config-file.mjs +1 -0
- package/dist/config-file.test.d.mts +2 -0
- package/dist/config-file.test.d.ts +2 -0
- package/dist/config-file.test.js +292 -0
- package/dist/config-file.test.mjs +1 -0
- package/dist/front-matter.d.mts +6 -0
- package/dist/front-matter.d.ts +6 -0
- package/dist/front-matter.js +1 -0
- package/dist/front-matter.mjs +1 -0
- package/dist/front-matter.test.d.mts +2 -0
- package/dist/front-matter.test.d.ts +2 -0
- package/dist/front-matter.test.js +1 -0
- package/dist/front-matter.test.mjs +1 -0
- package/dist/get-multi-level-extname.d.mts +9 -0
- package/dist/get-multi-level-extname.d.ts +9 -0
- package/dist/get-multi-level-extname.js +1 -0
- package/dist/get-multi-level-extname.mjs +1 -0
- package/dist/glob.d.mts +28 -0
- package/dist/glob.d.ts +28 -0
- package/dist/glob.js +1 -0
- package/dist/glob.mjs +1 -0
- package/dist/glob.test.d.mts +2 -0
- package/dist/glob.test.d.ts +2 -0
- package/dist/glob.test.js +292 -0
- package/dist/glob.test.mjs +1 -0
- package/dist/include-files.d.mts +31 -0
- package/dist/include-files.d.ts +31 -0
- package/dist/include-files.js +1 -0
- package/dist/include-files.mjs +1 -0
- package/dist/include-files.test.d.mts +2 -0
- package/dist/include-files.test.d.ts +2 -0
- package/dist/include-files.test.js +292 -0
- package/dist/include-files.test.mjs +1 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/is-string-in.d.mts +19 -0
- package/dist/is-string-in.d.ts +19 -0
- package/dist/is-string-in.js +1 -0
- package/dist/is-string-in.mjs +1 -0
- package/dist/magic-string.es-TUA2PMWY.mjs +1 -0
- package/dist/remove-leading-empty-lines.d.mts +18 -0
- package/dist/remove-leading-empty-lines.d.ts +18 -0
- package/dist/remove-leading-empty-lines.js +1 -0
- package/dist/remove-leading-empty-lines.mjs +1 -0
- package/dist/remove-leading-empty-lines.test.d.mts +2 -0
- package/dist/remove-leading-empty-lines.test.d.ts +2 -0
- package/dist/remove-leading-empty-lines.test.js +1 -0
- package/dist/remove-leading-empty-lines.test.mjs +1 -0
- package/dist/traverse-folder.d.mts +56 -0
- package/dist/traverse-folder.d.ts +56 -0
- package/dist/traverse-folder.js +1 -0
- package/dist/traverse-folder.mjs +1 -0
- package/dist/traverse-folder.test.d.mts +2 -0
- package/dist/traverse-folder.test.d.ts +2 -0
- package/dist/traverse-folder.test.js +292 -0
- package/dist/traverse-folder.test.mjs +1 -0
- package/dist/yaml.d.mts +59 -0
- package/dist/yaml.d.ts +59 -0
- package/dist/yaml.js +1 -0
- package/dist/yaml.mjs +1 -0
- package/docs/README.md +10 -0
- package/docs/classes/ConfigFile.md +169 -0
- package/docs/functions/getMultiLevelExtname.md +33 -0
- package/docs/functions/glob.md +56 -0
- package/docs/functions/isStringIn.md +43 -0
- package/docs/functions/normalizeIncludeFiles.md +49 -0
- package/docs/functions/parseFrontMatter.md +33 -0
- package/docs/functions/parseYaml.md +45 -0
- package/docs/functions/registerYamlTag.md +37 -0
- package/docs/functions/removeLeadingEmptyLines.md +39 -0
- package/docs/functions/stringifyYaml.md +45 -0
- package/docs/functions/traverseFolder.md +44 -0
- package/docs/functions/traverseFolderSync.md +44 -0
- package/docs/globals.md +36 -0
- package/docs/interfaces/IncludeFiles.md +25 -0
- package/docs/type-aliases/TraverseFolderHandler.md +33 -0
- package/docs/type-aliases/TraverseFolderSyncHandler.md +33 -0
- package/docs/variables/DefaultAllTextFiles.md +11 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{glob as t}from"./chunk-7APJBRA7.mjs";import{describe as s,globalExpect as e,it as o}from"./chunk-LOMQZH4U.mjs";import{init_esm_shims as r}from"./chunk-UJZVJIGI.mjs";r();import c from"path";s("glob function",(()=>{const s="/home/user/project";o("should match a simple glob pattern",(()=>{const o=t("/home/user/project/src/index.ts",["**/*.ts"],s);e(o).toBe(!0)})),o("should not match an excluded pattern",(()=>{const o=t("/home/user/project/src/test.ts",["**/*.ts","!**/test.ts"],s);e(o).toBe(!1)})),o("should handle relative paths correctly when rootDir is provided",(()=>{const o=t("/home/user/project/src/utils/helper.ts",["src/utils/*.ts"],s);e(o).toBe(!0)})),o("should work without a rootDir",(()=>{const s=t("/home/user/project/src/index.ts",["/home/user/project/**/*.ts"]);e(s).toBe(!0)})),o("should return false for non-matching patterns",(()=>{const o=t("/home/user/project/src/index.js",["**/*.ts"],s);e(o).toBeFalsy()})),o("should handle empty patterns array",(()=>{const o=t("/home/user/project/src/index.ts",[],s);e(o).toBeFalsy()})),o("should handle absolute file paths correctly",(()=>{const s=c.resolve("/home/user/project/src/index.ts"),o=[c.resolve("/home/user/project/**/*.ts")],r=t(s,o);e(r).toBe(!0)}))}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const DefaultAllTextFiles: string[];
|
|
2
|
+
interface IncludeFiles {
|
|
3
|
+
include?: string[];
|
|
4
|
+
exclude?: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a list of file patterns for glob matching.
|
|
8
|
+
*
|
|
9
|
+
* This function takes either an array of file patterns or an object containing `include` and `exclude` arrays,
|
|
10
|
+
* and returns a normalized array of file patterns. If no patterns are provided, it defaults to including
|
|
11
|
+
* all text-based files as defined in `DefaultAllTextFiles`.
|
|
12
|
+
*
|
|
13
|
+
* @param files - Either an array of file patterns or an object with `include` and `exclude` properties.
|
|
14
|
+
* @param defaultFiles - An optional array of default file patterns to use if no include patterns are specified.
|
|
15
|
+
* Defaults to `DefaultAllTextFiles`.
|
|
16
|
+
* @returns A normalized array of file patterns, with excluded patterns prefixed by `!`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = normalizeIncludeFiles({
|
|
22
|
+
* include: ['*.ts', '*.js'],
|
|
23
|
+
* exclude: ['node_modules/**']
|
|
24
|
+
* });
|
|
25
|
+
* console.log(result);
|
|
26
|
+
* // Output: ['*.ts', '*.js', '!node_modules/**']
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?: string[]): string[];
|
|
30
|
+
|
|
31
|
+
export { DefaultAllTextFiles, type IncludeFiles, normalizeIncludeFiles };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare const DefaultAllTextFiles: string[];
|
|
2
|
+
interface IncludeFiles {
|
|
3
|
+
include?: string[];
|
|
4
|
+
exclude?: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a list of file patterns for glob matching.
|
|
8
|
+
*
|
|
9
|
+
* This function takes either an array of file patterns or an object containing `include` and `exclude` arrays,
|
|
10
|
+
* and returns a normalized array of file patterns. If no patterns are provided, it defaults to including
|
|
11
|
+
* all text-based files as defined in `DefaultAllTextFiles`.
|
|
12
|
+
*
|
|
13
|
+
* @param files - Either an array of file patterns or an object with `include` and `exclude` properties.
|
|
14
|
+
* @param defaultFiles - An optional array of default file patterns to use if no include patterns are specified.
|
|
15
|
+
* Defaults to `DefaultAllTextFiles`.
|
|
16
|
+
* @returns A normalized array of file patterns, with excluded patterns prefixed by `!`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = normalizeIncludeFiles({
|
|
22
|
+
* include: ['*.ts', '*.js'],
|
|
23
|
+
* exclude: ['node_modules/**']
|
|
24
|
+
* });
|
|
25
|
+
* console.log(result);
|
|
26
|
+
* // Output: ['*.ts', '*.js', '!node_modules/**']
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function normalizeIncludeFiles(files?: string[] | IncludeFiles, defaultFiles?: string[]): string[];
|
|
30
|
+
|
|
31
|
+
export { DefaultAllTextFiles, type IncludeFiles, normalizeIncludeFiles };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,s=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((e,s)=>{for(var l in s)t(e,l,{get:s[l],enumerable:!0})})(o,{DefaultAllTextFiles:()=>a,normalizeIncludeFiles:()=>n}),module.exports=(e=o,((e,o,a,n)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of l(o))r.call(e,c)||c===a||t(e,c,{get:()=>o[c],enumerable:!(n=s(o,c))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=["**/*.((j|t)s?(x)|m(j|t)s)?(x)","**/*.(md|markdown|txt|?(x)htm?(l)|yaml|yml|xml|json|bat|sh|bash|zsh|ini|css|scss|less|sass|py|rb|php|go|java|c|cpp|h|hpp|hxx|rust|zig)"];function n(e,t=a){if(e)if(Array.isArray(e))e=[...e];else{const s=e.include||[],l=e.exclude||[];0===s.length&&s.push(...t),e=[...s];for(const t of l)e.push(`!${t}`)}else e=[...t];return 0===e.length&&e.push(...t),e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DefaultAllTextFiles as m,normalizeIncludeFiles as o}from"./chunk-GGOKSJK4.mjs";import"./chunk-UJZVJIGI.mjs";export{m as DefaultAllTextFiles,o as normalizeIncludeFiles};
|