@longzai-intelligence-git/gitignore-formatter 0.1.4 → 0.1.5

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/dist/index.d.ts CHANGED
@@ -119,15 +119,15 @@ declare function normalizeGitignore(content: string, dedupe?: boolean): string;
119
119
  * .gitignore 格式化引擎(presets + inject + 分组编排)。
120
120
  *
121
121
  * 流程:
122
- * 1. 归一化现有内容 → 现有模式集合 P
123
- * 2. 解析启用的 preset → 期望模式集合 S + preset 分组定义
124
- * 3. inject(默认仅根文件,见 options.injectMode):S 中不在 P 的模式 → 补充进对应 preset 分组(只增不删)
125
- * 4. 合并 P ∪(inject 时 S),按"preset 分组 → 自定义 groups → misc"顺序编排输出
122
+ * 1. 归一化现有内容 → 现有模式集合 P
123
+ * 2. 解析启用的 preset → 期望模式集合 S + preset 分组定义
124
+ * 3. inject(默认仅根文件,见 options.injectMode):S 中不在 P 的模式 → 补充进对应 preset 分组(只增不删)
125
+ * 4. 合并 P ∪(inject 时 S),按"preset 分组 → 自定义 groups → misc"顺序编排输出
126
126
  *
127
127
  * 输出约定:
128
- * - 分组头自动补 `# ` 前缀(comment 为纯文本,不含 #)
129
- * - 组间按 blankLinesBetweenGroups 插入空行
130
- * - 未匹配任何分组的模式归入 misc 组(尾部)
128
+ * - 分组头自动补 `# ` 前缀(comment 为纯文本,不含 #)
129
+ * - 组间按 blankLinesBetweenGroups 插入空行
130
+ * - 未匹配任何分组的模式归入 misc 组(尾部)
131
131
  */
132
132
  /**
133
133
  * 解析用户 Partial 选项,未提供字段回退到 DEFAULT_GITIGNORE_OPTIONS。
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import{DEFAULT_GITIGNORE_OPTIONS as e,GITIGNORE_PRESETS as t}from"@longzai-intel
2
2
  `).replace(/\r/g,`
3
3
  `).split(`
4
4
  `).map(e=>c(e))}function u(e,t){if(!t)return e;let i=/* @__PURE__ */ new Set,a=[];for(let t of e){if(n(t)||r(t)){a.push(t);continue}i.has(t)||(i.add(t),a.push(t))}return a}function d(e){let t=[];for(let r of e){if(n(r)){t.length>0&&!n(t[t.length-1]??``)&&t.push(``);continue}t.push(r)}for(;t.length>0&&n(t[t.length-1]??``);)t.pop();return t}function f(e,t=!0){let n=d(u(l(e),t));return n.length===0?``:`${n.join(`
5
- `)}\n`}function p(t){return{...e,...t}}function m(e,t){let n=i(e)?a(e):e,r=i(t)?a(t):t;if(n!==r)return n<r?-1:1;let o=i(e);return o===i(t)?e<t?-1:+(e>t):o?1:-1}function h(e){let t=f(e,!0);return t===``?[]:t.split(`
5
+ `)}\n`}function p(t){return{...e,...t}}function m(e,t){let n=i(e),r=i(t);if(n!==r)return n?1:-1;let o=n?a(e):e,s=r?a(t):t;return o===s?e<t?-1:+(e>t):o<s?-1:1}function h(e){let t=f(e,!0);return t===``?[]:t.split(`
6
6
  `).filter(e=>!n(e)&&!r(e))}function g(e){let t=e.trim();return t.startsWith(`#`)?t:`# ${t}`}function _(e){if(e===void 0)return[];let n=Object.keys(t),r=[];for(let i of n){let n=t[i];n!==void 0&&(e[i]??n.default)&&r.push({comment:n.comment,patterns:[...n.patterns]})}return r}function v(e,t){return t===void 0||t.length===0?e:[...e,...t]}function y(e,t,n,r){let i=`
7
7
  `.repeat(Math.max(0,n.blankLinesBetweenGroups)+1),a=[],s=/* @__PURE__ */ new Set;for(let i of t){if(i===void 0)continue;let t=[];for(let n of e)s.has(n)||i.patterns.some(e=>o(n,e))&&(t.push(n),s.add(n));if(r)for(let n of i.patterns)e.some(e=>o(e,n))||t.push(n);if(t.length===0){r&&a.push(g(i.comment));continue}n.sortWithinGroup&&t.sort(m),a.push([g(i.comment),...t].join(`
8
8
  `))}let c=e.filter(e=>!s.has(e));return c.length>0&&(n.sortWithinGroup&&c.sort(m),a.push([g(n.miscGroupComment),...c].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-git/gitignore-formatter",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Longzai Intelligence Git - .gitignore 格式化业务逻辑",
5
5
  "files": [
6
6
  "dist"
@@ -30,7 +30,7 @@
30
30
  "clean": "lzi-dev-cli clean"
31
31
  },
32
32
  "dependencies": {
33
- "@longzai-intelligence-git/config": "0.1.4"
33
+ "@longzai-intelligence-git/config": "0.1.5"
34
34
  },
35
35
  "devDependencies": {},
36
36
  "peerDependencies": {}