/** * Minified by jsDelivr using Terser v5.39.0. * Original file: /npm/eleventy-plugin-copy-local-assets@1.0.1/.eleventy.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ const path=require("path"),fs=require("fs"),glob=require("glob");module.exports=(t,o)=>{const e={verbose:!1};t.addTransform("copyLocalAssets",(function(t,n){const s=this;if(!s.dataCache.copyLocalAssets)return t;const a={...e,...o},i=path.dirname(n),r=path.dirname(s.inputPath).replace(/^\.\//,""),c=(path.basename(s.inputPath),"string"==typeof s.dataCache.copyLocalAssets?s.dataCache.copyLocalAssets:"*"),p=s._config.templateFormats.join(","),l=path.join(r,`**/*.{${p}}`),h=path.join(r,`**/_index.{${p}}`);if(glob.sync(l,{nodir:!0,ignore:h}).length>1)return console.info(`Skipping copying over files from: ${r} as multiple templates found in directory!`),t;const u=path.join(r,`**/${c}`),f=path.join(r,`**/*.{${p}}`),d=glob.sync(u,{nodir:!0,ignore:f});a.verbose&&console.info(`# copy-local-assets - input: ${s.inputPath}, output: ${n}, with ${d.length} asset${1!==d.length?"s":""} matching "${c}"`);for(let t of d){const o=path.join(i,t.substr(r.length)),e=path.dirname(o);fs.mkdirSync(e,{recursive:!0}),fs.copyFileSync(t,o)}return t}))}; //# sourceMappingURL=/sm/302f45ecd1a0edb749aede728fe0be3146f142e7f60796be37c8fa1da20b2d7d.map