var m=Object.defineProperty;var g=(e,t)=>m(e,"name",{value:t,configurable:!0});import{E as v}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as w}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";var $=Object.defineProperty,u=g((e,t)=>$(e,"name",{value:t,configurable:!0}),"c");const h={docker:".dockerignore",npm:".npmignore",slug:".slugignore",vercel:".vercelignore"},E=[".git",".gitattributes",".gitignore",".editorconfig",".vscode/",".idea/",".DS_Store","*.md","LICENSE*","LICENCE*","CHANGELOG*","CONTRIBUTING*","AUTHORS*","docs/","doc/","examples/","example/",".github/",".gitlab-ci.yml",".circleci/","appveyor.yml",".eslintrc*","eslint.config.*",".prettierrc*","prettier.config.*","*.log","npm-debug.log*","*.d.ts","*.map","*.flow","tsconfig*.json","__tests__/","__mocks__/","test/","tests/","*.test.*","*.spec.*","coverage/",".nyc_output/"],_={docker:["node_modules",".vis/","Dockerfile*",".dockerignore"],npm:[],slug:["node_modules"],vercel:["node_modules",".vercel/"]},y=u(e=>{const t=new Set,o=[];for(const r of[...E,..._[e]])t.has(r)||(t.add(r),o.push(r));return o},"buildIgnorePatterns"),I=u(e=>e.trim(),"normalizeLine"),b="# Added by vis ignore",k=u((e,t)=>{const o=new Set;for(const n of e.split(/\r?\n/u)){const c=I(n);c!==""&&!c.startsWith("#")&&o.add(c)}const r=[];for(const n of t)o.has(n)||(o.add(n),r.push(n));if(r.length===0)return{added:r,content:e};const s=e.includes(`\r
`)?`\r
`:`
`,d=[b,...r].join(s);if(e.trim()==="")return{added:r,content:`${d}${s}`};const i=e.endsWith(`
`)?s:`${s}${s}`;return{added:r,content:`${e}${i}${d}${s}`}},"mergeIgnore");var N=Object.defineProperty,p=g((e,t)=>N(e,"name",{value:t,configurable:!0}),"s");const S=p(e=>e==="docker"||e==="npm"||e==="slug"||e==="vercel","isIgnoreTarget"),O=p(async(e,t)=>{try{return await e.readFile(t,"utf8")}catch{return""}},"readExisting"),C=p(async({fs:e,logger:t,options:o,process:r,workspaceRoot:s})=>{const d=s??r.cwd,i=o.target??"docker";if(!S(i))throw new Error(`Invalid --target "${i}". Expected one of: docker, vercel, npm, slug.`);const n=h[i],c=w(d,n),f=await O(e,c),{added:a,content:l}=k(f,y(i));if(o.json){process.stdout.write(`${JSON.stringify({added:a,file:n,target:i},null,2)}
`);return}if(o.write){if(a.length===0){t.info(`${n} is already up to date (no new patterns).`);return}await e.writeFile(c,l),t.info(`Added ${a.length} pattern(s) to ${n}.`);return}process.stdout.write(l.endsWith(`
`)?l:`${l}
`),t.info(v(`(${a.length} new pattern(s); re-run with --write to save ${n})`))},"execute");export{C as default};
