@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
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Utility Functions
|
|
2
|
+
|
|
3
|
+
This package provides a set of utility functions.
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.org/package/@isdk/util)
|
|
6
|
+
[](https://npmjs.org/package/@isdk/util)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseFrontMatter as t}from"./chunk-JTTOXXPG.mjs";import{parseYaml as r,stringifyYaml as o}from"./chunk-OTEAFARC.mjs";import{getMultiLevelExtname as n}from"./chunk-7AQU3PBW.mjs";import{init_esm_shims as e}from"./chunk-UJZVJIGI.mjs";e();import{existsSync as i,mkdirSync as m,readFileSync as s,writeFileSync as f}from"fs";import c from"path";import{Config as u}from"load-config-file";var l=class{static register(t,r,o){u.register(t,r),"string"==typeof t&&(t=[t]);for(const r of t)this.stringifys[r]=o}static load(r,o){return function(r,{extLevel:o=1,externalFile:e}={}){"."===r[0]&&o++;const m=n(r,o);m&&m.split(".").length>1&&(r=r.slice(0,-m.length));let f=u.loadSync(r);if(!f&&e){if(!c.isAbsolute(e)){const t=c.dirname(r);e=c.join(t,e)}if(i(e)){const r=t(s(e,"utf8")).data;Object.keys(r).length&&(f=r)}}return f}(r,o)}static save(t,r,o){return function(t,r,{extLevel:o=1}={}){"."===t[0]&&o++;let e=n(t,o);(!e||e.split(".").length<=1)&&(t+=".yaml",e=".yaml");const s=l.stringifys[e];if(!s)throw new Error(`${t} unsupported mime type: ${e}`);r=s(r);const u=c.dirname(t);i(u)||m(u,{recursive:!0});return f(t,r,{encoding:"utf8"}),t}(t,r,o)}};l.stringifys={},l.register([".yml",".yaml"],r,o),l.register([".json"],(function(t){return JSON.parse(t)}),(t=>JSON.stringify(t,null,2)));export{l as ConfigFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as o}from"./chunk-UJZVJIGI.mjs";o();import{readdir as r}from"fs/promises";import{readdirSync as i}from"fs";import t from"path";async function s(o,i){const s=await r(o,{withFileTypes:!0,recursive:!0});for(const r of s){const s=t.join(o,r.name);if(!0===await i(s,r))break}}function f(o,r){const s=i(o,{withFileTypes:!0,recursive:!0});for(const i of s){if(!0===r(t.join(o,i.name),i))break}}export{s as traverseFolder,f as traverseFolderSync};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as o}from"./chunk-UJZVJIGI.mjs";o();import{globMatch as r}from"@isdk/glob";import m from"path";function t(o,t,i){return i&&(o=m.relative(i,o)),r(o,t)}export{t as glob};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as r}from"./chunk-UJZVJIGI.mjs";r();import o from"path";function t(r,t=1){let f="";for(;t--;){const t=o.extname(r);if(!t)break;f=t+f,r=o.basename(r,t)}return f}export{t as getMultiLevelExtname};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as n}from"./chunk-UJZVJIGI.mjs";function r(n){const r=/^\s*(#[^\r\n]*)?[\r\n]+/;let o;for(;null!==(o=r.exec(n))&&((n=n.substring(o[0].length)).startsWith("\n")||n.startsWith("\r")||n.trimStart().startsWith("#")););return n}n();export{r as removeLeadingEmptyLines};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as r}from"./chunk-UJZVJIGI.mjs";function t(r,t){return"string"==typeof t&&(t=[t]),-1!==t.indexOf(r)}r();export{t as isStringIn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{init_esm_shims as s}from"./chunk-UJZVJIGI.mjs";s();var t=["**/*.((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 r(s,r=t){if(s)if(Array.isArray(s))s=[...s];else{const t=s.include||[],o=s.exclude||[];0===t.length&&t.push(...r),s=[...t];for(const t of o)s.push(`!${t}`)}else s=[...r];return 0===s.length&&s.push(...r),s}export{t as DefaultAllTextFiles,r as normalizeIncludeFiles};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{removeLeadingEmptyLines as n}from"./chunk-D3BCI5SM.mjs";import{parseYaml as t}from"./chunk-OTEAFARC.mjs";import{init_esm_shims as o}from"./chunk-UJZVJIGI.mjs";o();function r(o,r="---"){const c=r.length,m=n(o);if(m.startsWith(r)&&("\n"===m[r.length]||"\r"===m[r.length])){let n=m.indexOf("\n"+r,c);if(-1!==n){const o=m.slice(c,n);for(n+=r.length+1;"\n"===m[n]||"\r"===m[n];)n++;const f=m.slice(n);return{data:t(o)||{},content:f}}}return{data:{},content:o}}export{r as parseFrontMatter};
|