PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/nx/src/nx-init/react

Просмотр файла: rename-js-to-jsx.js

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renameJsToJsx = void 0;
const fs_extra_1 = require("fs-extra");
const glob_1 = require("glob");
// Vite cannot process JSX like <div> or <Header> unless the file is named .jsx or .tsx
function renameJsToJsx(appName, isStandalone) {
    const files = (0, glob_1.sync)(isStandalone ? 'src/**/*.js' : `apps/${appName}/src/**/*.js`);
    files.forEach((file) => {
        const content = (0, fs_extra_1.readFileSync)(file).toString();
        // Try to detect JSX before renaming to .jsx
        // Files like setupTests.js from CRA should not be renamed
        if (/<[a-zA-Z0-9]+/.test(content)) {
            (0, fs_extra_1.renameSync)(file, `${file}x`);
        }
    });
}
exports.renameJsToJsx = renameJsToJsx;
//# sourceMappingURL=rename-js-to-jsx.js.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!