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AAM,GACzE,GACD,IA2BJ,OAAO,QAAU","file":"/npm/laravel-find-js-localizations@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/laravel-find-js-localizations@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const t = require('babel-types');\n\nconst { parse } = require('babylon');\nconst { readFile } = require('fs');\nconst { default: traverse } = require('babel-traverse');\n\nconst chunks = [];\nconst stdin = process.stdin;\nstdin.setEncoding('utf8');\nstdin.on('data', chunk => chunks.push(chunk));\nstdin.on('end', () => {\n  const files = chunks.join('').trim().split('\\n');\n\n  if (files.length === 0) {\n    return;\n  }\n\n  Promise.all(\n    files.map(\n      file => new Promise((resolve, reject) => {\n        readFile(file, 'utf-8', (error, content) => {\n          if (error) {\n            console.error(\n              `Could not read file \"${file}\" due to error, skipping.`\n            );\n            return resolve(null);\n          }\n\n          try {\n            const keys = findTranslationKeys(content);\n            if (keys.length > 0) {\n              resolve({\n                file,\n                keys\n              });\n            } else {\n              resolve(null);\n            }\n          } catch (error) {\n            console.error(\n              `Could not parse file \"${file}\" due to error, skipping.`\n            );\n            return resolve(null);\n          }\n        });\n      })\n    )\n  ).then(translations => {\n    console.log(\n      JSON.stringify(translations.filter(translation => !!translation), null, 2)\n    );\n  });\n});\n\nfunction findTranslationKeys(code) {\n  const keys = [];\n  traverse(parse(code), {\n    CallExpression(path) {\n      if (isTranslationCall(path)) {\n        const key = path.get('arguments')[0];\n        if (key.isStringLiteral()) {\n          const { loc, value } = key.node;\n          keys.push({ loc, value });\n        }\n      }\n    }\n  });\n\n  return keys;\n}\n\nfunction isTranslationCall(path) {\n  const callee = path.get('callee');\n  return callee.isMemberExpression() &&\n    callee.get('object').isIdentifier({ name: 'Lang' }) &&\n    callee.get('property').isIdentifier({ name: 'get' });\n}\n\nmodule.exports = findTranslationKeys;\n"]}