


/** 
 * @param {import('../types').userSettings} userSettings
 * @returns {import('vite').Plugin[]}
 */
export function needleTransformCode(command, config, userSettings) {

    return [
        {
            name: 'needle-transform-code',
            /**
             * @param {string} src
             * @param {string} id
             */
            transform(src, id) {
                if (id.includes("three__quarks.js") || id.includes("three.quarks")) {
                    const line1 = `console.log('%c Particle system powered by three.quarks. https://quarks.art/', 'font-size: 14px; font-weight: bold;');`
                    const line2 = `console.log("%c Particle system powered by three.quarks. https://quarks.art/", "font-size: 14px; font-weight: bold;");`;
                    const replacement = `setTimeout(()=> console.debug("Particle system powered by three.quarks. https://quarks.art/"), 100);`
                    const content = src
                        .replace(line1, replacement)
                        .replace(line2, replacement);
                    return {
                        code: content,
                        map: null
                    }
                }
            },
        }
    ];
}