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AAO,MAAM,KACzB,CAdA,QAAQ,kBAAoB,kBAU5B,QAAQ,sBAAwB,sBAKhC,QAAQ,qBAAuB","file":"/npm/swiftcss@3.32.3/dist/main.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/swiftcss@3.32.3/dist/main.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\n\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.stopLoadingAnimation = exports.startLoadingAnimation = exports.generateBaseStyle = exports._CONFIG = exports.baseStyle = exports.screenKeys = exports.darkStyles = exports.lightStyles = exports.dynamicClasses = exports.dynamicStyles = exports.dynamicClassNames = exports.classNames = exports.styleCSS = void 0;\nconst fs_1 = __importDefault(require(\"fs\"));\nconst path_1 = __importDefault(require(\"path\"));\nconst chokidar_1 = __importDefault(require(\"chokidar\"));\nconst funnel_1 = __importDefault(require(\"./src/cli/funnel\"));\n//const cpus = os.cpus()\n//const numThreads = cpus.length;\n//console.log(numThreads) \nconst configFile = path_1.default.join(process.cwd(), 'swiftcss.config.js');\n// Gets all available pre-defined styles/classes that can be used\nexports.styleCSS = fs_1.default.readFileSync(path_1.default.join(__dirname, 'src', 'style.css'), 'utf-8');\nexports.classNames = new Set();\nexports.dynamicClassNames = new Set();\nexports.dynamicStyles = new Set();\nexports.dynamicClasses = new Object;\nexports.lightStyles = new Object;\nexports.darkStyles = new Object;\nexports.screenKeys = new Array;\nexports.baseStyle = new Object;\nconst defaultConfig = {\n    fileExtensions: ['html', 'js', 'jsx', 'ts', 'tsx'],\n    directories: ['./src'],\n    input: [],\n    output: './output.css',\n    variables: {}\n};\n// Create a loading animation\nlet animationInterval;\n// Have the init command recognition in the beginning to allow user to create the config file\n// without triggering errors in the coming steps\nif (process.argv[2] === \"init\") {\n    const configContent = `module.exports = {\n        fileExtensions: [\"html\",\"js\",\"jsx\",\"ts\",\"tsx\"],\n        directories: [\"./src\"], // Specify directories to scan for style changes\n        input: [], // Specify an input file to be appended into the output file\n        output: \"./output.css\", // Specify the path to where the output file will be generated\n        screens: { // specify media query cut-offs\n            sd: {max: 600},\n            md: {min: 600, max: 1200},\n            ld: {min: 1200},\n        },\n        variables: { // Define variables here, variables have to start with \"$\"\n            $green: \"#0ce42c\"\n        } \n    };`;\n    fs_1.default.writeFileSync(configFile, configContent);\n    console.log(`Configuration file created at ${configFile}`);\n    process.exit(0);\n}\n// Load configuration\nlet config;\nconst directories = new Array;\nconst inputs = new Array;\nif (fs_1.default.existsSync(configFile)) {\n    // Since the file exists we assume the type to be of Config\n    config = require(path_1.default.resolve(configFile));\n    if (config.directories.length === 0) {\n        console.error('Configuration file is missing values in directories. Please specify a directory so the CLI can start scanning.');\n        process.exit(1);\n    }\n    else if (!fs_1.default.existsSync(path_1.default.dirname(path_1.default.join(process.cwd(), config.output)))) {\n        console.error('Please specify a valid directory path for your output file in swiftcss.config.js.');\n        process.exit(1);\n    }\n    else if (config.output === \"\") {\n        console.error('Please specify a valid path for your output file in swiftcss.config.js.');\n        process.exit(1);\n    }\n}\nelse {\n    console.error('Configuration file not found. Run \"init\" command first.');\n    process.exit(1);\n}\nlet currentScreens = config.screens;\n// Check if directories exist\nfor (const directory of config.directories) {\n    if (!fs_1.default.existsSync(path_1.default.join(process.cwd(), directory))) {\n        console.error(`Directory not found: ${directory}`);\n        process.exit(1);\n    }\n    else {\n        directories.push(path_1.default.join(process.cwd(), directory));\n    }\n}\nif (config.input.length > 0 && Array.isArray(config.input)) {\n    // Check if directories exist\n    for (const input of config.input) {\n        if (!fs_1.default.existsSync(path_1.default.join(process.cwd(), input))) {\n            console.error(`Input file not found: ${input}`);\n            process.exit(1);\n        }\n        else {\n            inputs.push(path_1.default.join(process.cwd(), input));\n        }\n    }\n}\nelse if (typeof config.input === \"string\" && config.input !== '') {\n    if (!fs_1.default.existsSync(path_1.default.join(process.cwd(), config.input))) {\n        console.error(`Input file not found: ${config.input}`);\n        process.exit(1);\n    }\n    else {\n        inputs.push(path_1.default.join(process.cwd(), config.input));\n    }\n}\n// Update directories & output\nconfig.directories = directories;\nconfig.output = path_1.default.join(process.cwd(), config.output);\nconfig.input = inputs;\nexports._CONFIG = config;\n// We define the commands here and the actions that occurrs for each command\nif (process.argv[2] === 'watch') {\n    console.log('Watching for file changes...');\n    // Generate baseStyle\n    generateBaseStyle(exports.styleCSS, process);\n    const watcher = chokidar_1.default.watch(config.directories, {\n        ignored: /(^|[/\\\\])\\../,\n        persistent: true,\n        // @ts-ignore\n        depth: \"infinity\"\n    });\n    const inputWatcher = chokidar_1.default.watch(config.input, {\n        ignored: /(^|[/\\\\])\\../,\n        persistent: true,\n        // @ts-ignore\n        depth: \"infinity\"\n    });\n    // Watch for changes in config file\n    const configWatcher = chokidar_1.default.watch(configFile, { persistent: true });\n    configWatcher.on('change', () => {\n        const newConfig = require('./swiftcss.config.js');\n        if (JSON.stringify(newConfig.screens) !== JSON.stringify(currentScreens)) {\n            currentScreens = newConfig.screens;\n            console.log(`Current Screens: ${currentScreens}`);\n        }\n        console.log('Compiler stopped due to changes to the config file, please rerun your command once you have finished editing the config file');\n        process.exit();\n    });\n    exports.screenKeys.push(...Object.keys(config.screens));\n    watcher.on('change', (filePath) => {\n        if (config?.fileExtensions.includes(filePath.substring(filePath.lastIndexOf('.'), filePath.length).replace('.', ''))) {\n            console.log(`File changed: ${filePath}`);\n            (0, funnel_1.default)('watch', exports.styleCSS, config, exports.baseStyle);\n            console.log('Changes generated');\n        }\n    });\n    inputWatcher.on('change', (filePath) => {\n        console.log(`File changed: ${filePath}`);\n        (0, funnel_1.default)('watch', exports.styleCSS, config, exports.baseStyle);\n        console.log('Changes generated');\n    });\n    process.on('SIGINT', () => {\n        watcher.close();\n        console.log('Watch process terminated.');\n        process.exit();\n    });\n    (0, funnel_1.default)('watch', exports.styleCSS, config, exports.baseStyle);\n}\nelse if (process.argv[2] === 'build') {\n    generateBaseStyle(exports.styleCSS, process);\n    exports.screenKeys.push(...Object.keys(config.screens));\n    (0, funnel_1.default)('build', exports.styleCSS, config, exports.baseStyle);\n}\nelse if (process.argv[2] === \"dev\") {\n    generateBaseStyle(exports.styleCSS, process);\n    /********************** WATCHER CONFIG **********************/\n    const watcher = chokidar_1.default.watch(config.directories, {\n        ignored: /(^|[/\\\\])\\../,\n        persistent: true,\n        // @ts-ignore\n        depth: \"infinity\"\n    });\n    // Watch for changes in config file\n    const configWatcher = chokidar_1.default.watch(configFile, { persistent: true });\n    configWatcher.on('change', () => {\n        const newConfig = require('./swiftcss.config.js');\n        if (JSON.stringify(newConfig.screens) !== JSON.stringify(currentScreens)) {\n            currentScreens = newConfig.screens;\n            console.log(`Current Screens: ${currentScreens}`);\n        }\n        console.log('Compiler stopped due to changes to the config file, please rerun your command once you have finished editing the config file');\n        process.exit();\n    });\n    exports.screenKeys.push(...Object.keys(config.screens));\n    watcher.on('change', (filePath) => {\n        console.log(`File changed: ${filePath}`);\n        startLoadingAnimation();\n        (0, funnel_1.default)('dev', exports.styleCSS, config, exports.baseStyle);\n        stopLoadingAnimation();\n        console.log('Changes generated');\n    });\n    process.on('SIGINT', () => {\n        watcher.close();\n        console.log('Watch process terminated.');\n        process.exit();\n    });\n    /********************** WATCHER CONFIG **********************/\n    exports.screenKeys.push(...Object.keys(config.screens));\n    (0, funnel_1.default)('dev', exports.styleCSS, config, exports.baseStyle);\n}\nfunction generateBaseStyle(styleCSS, process) {\n    styleCSS.split('}').forEach((styleBlock, i) => {\n        const trimmedStyleBlock = styleBlock.trim();\n        try {\n            const classNameMatch = trimmedStyleBlock.match(/\\.([a-zA-Z0-9_-]+)\\s*\\{/); // Class Name without the leading \".\"\n            if (classNameMatch) {\n                const classAttribute = trimmedStyleBlock\n                    .replace(classNameMatch[0], '')\n                    .trim()\n                    .split('\\n  ');\n                const className = classNameMatch[1];\n                // Append style to baseStyle\n                exports.baseStyle[className] = classAttribute;\n            }\n        }\n        catch (error) {\n            console.error(`An error occurred when generating CSS backbone: ${error}`);\n            process.exit();\n        }\n    });\n}\nexports.generateBaseStyle = generateBaseStyle;\nfunction startLoadingAnimation() {\n    const loadingSymbols = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n    let animationIndex = 0;\n    animationInterval = setInterval(() => {\n        process.stdout.write('\\r'); // Move cursor to the beginning of the line\n        console.log(loadingSymbols[animationIndex]);\n        animationIndex = (animationIndex + 1) % loadingSymbols.length;\n    }, 100);\n}\nexports.startLoadingAnimation = startLoadingAnimation;\nfunction stopLoadingAnimation() {\n    clearInterval(animationInterval);\n    process.stdout.write('\\n'); // Move to the next line\n}\nexports.stopLoadingAnimation = stopLoadingAnimation;\n"]}