%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/node_modules/next/dist/lib/typescript/
Upload File :
Create Path :
Current File : /var/www/html/node_modules/next/dist/lib/typescript/getTypeScriptIntent.js

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.getTypeScriptIntent = getTypeScriptIntent;
var _fs = require("fs");
var _path = _interopRequireDefault(require("path"));
var _fileExists = require("../file-exists");
var _recursiveReaddir = require("../recursive-readdir");
function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
async function getTypeScriptIntent(baseDir, intentDirs, tsconfigPath) {
    const resolvedTsConfigPath = _path.default.join(baseDir, tsconfigPath);
    // The integration turns on if we find a `tsconfig.json` in the user's
    // project.
    const hasTypeScriptConfiguration = await (0, _fileExists).fileExists(resolvedTsConfigPath);
    if (hasTypeScriptConfiguration) {
        const content = await _fs.promises.readFile(resolvedTsConfigPath, {
            encoding: "utf8"
        }).then((txt)=>txt.trim(), ()=>null);
        return {
            firstTimeSetup: content === "" || content === "{}"
        };
    }
    // Next.js also offers a friendly setup mode that bootstraps a TypeScript
    // project for the user when we detect TypeScript files. So, we need to check
    // the `pages/` directory for a TypeScript file.
    // Checking all directories is too slow, so this is a happy medium.
    for (const dir of intentDirs){
        const typescriptFiles = await (0, _recursiveReaddir).recursiveReadDir(dir, /.*\.(ts|tsx)$/, /(node_modules|.*\.d\.ts)/);
        if (typescriptFiles.length) {
            return {
                firstTimeSetup: true
            };
        }
    }
    return false;
}

//# sourceMappingURL=getTypeScriptIntent.js.map

Zerion Mini Shell 1.0