You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/less/lib/less-node/file-manager.js.map

1 line
10 KiB

{"version":3,"file":"file-manager.js","sourceRoot":"","sources":["../../src/less-node/file-manager.js"],"names":[],"mappings":";;;AAAA,sDAAwB;AACxB,oDAAsB;AACtB,kHAA+E;AAE/E,IAAM,WAAW,GAAG,cAAY,CAAC,CAAA;AACjC,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,kCAAmB,EAAE,EAAE;IAC7D,QAAQ;QACJ,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ,YAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ;QAC/D,IAAI,YAAY,CAAC;QACjB,IAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAM,cAAc,GAAG,EAAE,CAAC;QAC1B,IAAM,IAAI,GAAG,IAAI,CAAC;QAClB,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,IAAM,QAAQ,GAAG,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;QAClD,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,IAAM,SAAS,GAAG,QAAQ,CAAC;QAE3B,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAExB,IAAM,KAAK,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;QAE7D,IAAI,OAAO,CAAC,KAAK,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;SAAE;QAE9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AC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC;CACJ,CAAC,CAAC;AAEH,kBAAe,WAAW,CAAC","sourcesContent":["import path from 'path';\nimport fs from './fs';\nimport AbstractFileManager from '../less/environment/abstract-file-manager.js';\n\nconst FileManager = function() {}\nFileManager.prototype = Object.assign(new AbstractFileManager(), {\n supports() {\n return true;\n },\n\n supportsSync() {\n return true;\n },\n\n loadFile(filename, currentDirectory, options, environment, callback) {\n let fullFilename;\n const isAbsoluteFilename = this.isPathAbsolute(filename);\n const filenamesTried = [];\n const self = this;\n const prefix = filename.slice(0, 1);\n const explicit = prefix === '.' || prefix === '/';\n let result = null;\n let isNodeModule = false;\n const npmPrefix = 'npm://';\n\n options = options || {};\n\n const paths = isAbsoluteFilename ? [''] : [currentDirectory];\n\n if (options.paths) { paths.push.apply(paths, options.paths); }\n\n if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); }\n\n const prefixes = options.prefixes || [''];\n const fileParts = this.extractUrlParts(filename);\n\n if (options.syncImport) {\n getFileData(returnData, returnData);\n if (callback) {\n callback(result.error, result);\n }\n else {\n return result;\n }\n }\n else {\n // promise is guaranteed to be asyncronous\n // which helps as it allows the file handle\n // to be closed before it continues with the next file\n return new Promise(getFileData);\n }\n\n function returnData(data) {\n if (!data.filename) {\n result = { error: data };\n }\n else {\n result = data;\n }\n }\n\n function getFileData(fulfill, reject) {\n (function tryPathIndex(i) {\n function tryWithExtension() {\n const extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename;\n\n if (extFilename !== fullFilename && !explicit && paths[i] === '.') {\n try {\n fullFilename = require.resolve(extFilename);\n isNodeModule = true;\n }\n catch (e) {\n filenamesTried.push(npmPrefix + extFilename);\n fullFilename = extFilename;\n }\n }\n else {\n fullFilename = extFilename;\n }\n }\n if (i < paths.length) {\n (function tryPrefix(j) {\n if (j < prefixes.length) {\n isNodeModule = false;\n fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename;\n\n if (paths[i]) {\n fullFilename = path.join(paths[i], fullFilename);\n }\n\n if (!explicit && paths[i] === '.') {\n try {\n fullFilename = require.resolve(fullFilename);\n isNodeModule = true;\n }\n catch (e) {\n filenamesTried.push(npmPrefix + fullFilename);\n tryWithExtension();\n }\n }\n else {\n tryWithExtension();\n } \n\n const readFileArgs = [fullFilename];\n if (!options.rawBuffer) {\n readFileArgs.push('utf-8');\n }\n if (options.syncImport) {\n try {\n const data = fs.readFileSync.apply(this, readFileArgs);\n fulfill({ contents: data, filename: fullFilename});\n }\n catch (e) {\n filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);\n return tryPrefix(j + 1);\n }\n }\n else {\n readFileArgs.push(function(e, data) {\n if (e) {\n filenamesTried.push(isNodeModule ? npmPrefix + fullFilename : fullFilename);\n return tryPrefix(j + 1);\n } \n fulfill({ contents: data, filename: fullFilename});\n });\n fs.readFile.apply(this, readFileArgs);\n }\n\n }\n else {\n tryPathIndex(i + 1);\n }\n })(0);\n } else {\n reject({ type: 'File', message: `'${filename}' wasn't found. Tried - ${filenamesTried.join(',')}` });\n }\n }(0));\n }\n },\n\n loadFileSync(filename, currentDirectory, options, environment) {\n options.syncImport = true;\n return this.loadFile(filename, currentDirectory, options, environment);\n }\n});\n\nexport default FileManager;\n"]}