UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 2.95 kB
{"version":3,"file":"setup-plugin-modernjs.cjs","sources":["../../../../src/cli/commands/plugins/setup-plugin-modernjs.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport cjson from \"comment-json\";\nimport { pluginName, pluginPath } from \"../../consts\";\nimport { addPluginToConfig } from \"../../utils/add-plugin-to-config\";\nimport { joinNormalizedPath } from \"../../utils/normalize-path\";\n\nexport async function setupPluginModernjs(configPath: string) {\n await addPluginToConfig({\n configKey: \"plugins\",\n configPath,\n pluginImportPath: joinNormalizedPath(pluginPath, \"modernjs\"),\n pluginName,\n });\n\n // TODO: remove when `node/node10` moduleResolution is fixed in the build process\n // update `tsconfig.json` compilerOptions `module` and `moduleResolution`\n const tsConfigFile = \"tsconfig.json\";\n\n try {\n const content = await fs.readFile(tsConfigFile, \"utf-8\");\n const parsedContent: { compilerOptions?: Record<string, unknown> } = cjson.parse(content) as typeof parsedContent;\n\n const defaultTsConfig = {\n module: \"ESNext\",\n moduleResolution: \"bundler\",\n };\n\n if (\n parsedContent.compilerOptions?.module !== defaultTsConfig.module ||\n parsedContent.compilerOptions?.moduleResolution !== defaultTsConfig.moduleResolution\n ) {\n parsedContent.compilerOptions ||= {};\n parsedContent.compilerOptions.module = \"ESNext\";\n parsedContent.compilerOptions.moduleResolution = \"bundler\";\n\n console.log(`Updating ${tsConfigFile} file with flowbite-react configuration...`);\n await fs.writeFile(tsConfigFile, cjson.stringify(parsedContent, null, 2), \"utf-8\");\n }\n } catch (error) {\n console.error(`Failed to update ${tsConfigFile} file...`, error);\n }\n}\n"],"names":["addPluginToConfig","joinNormalizedPath","pluginPath","pluginName"],"mappings":";;;;;;;;AAMO,eAAe,mBAAmB,CAAC,UAAU,EAAE;AACtD,EAAE,MAAMA,mCAAiB,CAAC;AAC1B,IAAI,SAAS,EAAE,SAAS;AACxB,IAAI,UAAU;AACd,IAAI,gBAAgB,EAAEC,gCAAkB,CAACC,iB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