@strapi/strapi 5.42.0 → 5.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json.js
CHANGED
package/dist/package.json.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commander.js","sources":["../../../../src/cli/utils/commander.ts"],"sourcesContent":["/**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\nimport { getInquirer } from './get-inquirer';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","inquirer","getInquirer","answers","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;IACjB,IAAI;QACF,OAAOA,KAAAA,CAAMC,KAAK,CAAC,GAAA,CAAA,CAAKC,GAAG,CAAC,CAACC,IAAAA,GAASA,IAAAA,CAAKC,IAAI,EAAA,CAAA,CAAA;AACjD,IAAA,CAAA,CAAE,OAAOC,CAAAA,EAAG;AACVC,QAAAA,gBAAAA,CAAS,CAAA,EAAG,CAAC,oBAAoB,EAAEN,KAAAA,CAAAA,CAAO,CAAA;AAC5C,IAAA;AAEA,IAAA,OAAO,EAAE;AACX;AAEA;;AAEC,IACD,MAAMO,uBAAAA,GAA0B,CAACC,OAAAA,EAAmBC,eAAe,kBAAkB,GAAA;AACnF,IAAA,OAAO,CAACT,KAAAA,GAAAA;AACN,QAAA,MAAMU,OAAOX,SAAAA,CAAUC,KAAAA,CAAAA;AACvB,QAAA,MAAMW,OAAAA,GAAUD,IAAAA,CAAKE,MAAM,CAAC,CAACT,IAAAA,GAAAA;YAC3B,OAAO,CAACK,OAAAA,CAAQK,QAAQ,CAACV,IAAAA,CAAAA;AAC3B,QAAA,CAAA,CAAA;QAEA,IAAIQ,OAAAA,CAAQG,MAAM,GAAG,CAAA,EAAG;YACtBR,gBAAAA,CAAS,CAAA,EAAG,GAAGG,YAAAA,CAAa,EAAE,EAAEE,OAAAA,CAAQI,IAAI,CAAC,GAAA,CAAA,CAAA,CAAM,CAAA;AACrD,QAAA;QAEA,OAAOL,IAAAA;AACT,IAAA,CAAA;AACF;AAEA;;IAGA,MAAMM,eAAe,CAAChB,KAAAA,GAAAA;;IAEpB,MAAMiB,WAAAA,GAAcC,SAASlB,KAAAA,EAAO,EAAA,CAAA;AACpC,IAAA,IAAImB,SAAMF,WAAAA,CAAAA,EAAc;AACtB,QAAA,MAAM,IAAIG,oCAAAA,CAA2B,CAAC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**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\nimport { getInquirer } from './get-inquirer';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key: string) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","inquirer","getInquirer","answers","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;IACjB,IAAI;QACF,OAAOA,KAAAA,CAAMC,KAAK,CAAC,GAAA,CAAA,CAAKC,GAAG,CAAC,CAACC,IAAAA,GAASA,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CAAC;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commander.mjs","sources":["../../../../src/cli/utils/commander.ts"],"sourcesContent":["/**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\nimport { getInquirer } from './get-inquirer';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","inquirer","getInquirer","answers","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAA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ChB,IAAI;QACF,MAAMsB,GAAAA,GAAM,IAAIC,GAAAA,CAAIvB,KAAAA,CAAAA;QACpB,IAAI,CAACsB,GAAAA,CAAIE,IAAI,EAAE;AACb,YAAA,MAAM,IAAIJ,0BAAAA,CAA2B,CAAC,oBAAoB,EAAEpB,KAAAA,CAAAA,CAAO,CAAA;AACrE,QAAA;QAEA,OAAOsB,GAAAA;AACT,IAAA,CAAA,CAAE,OAAOjB,CAAAA,EAAG;AACV,QAAA,MAAM,IAAIe,0BAAAA,CAA2B,CAAC,oBAAoB,EAAEpB,KAAAA,CAAAA,CAAO,CAAA;AACrE,IAAA;AACF;AAEA;;IAGA,MAAMyB,sBAAsB,OAAOC,WAAAA,GAAAA;IACjC,MAAMC,IAAAA,GAAOD,YAAYC,IAAI,EAAA;AAE7B,IAAA,IAAI,CAACA,IAAAA,CAAKC,OAAO,IAAID,IAAAA,CAAKE,GAAG,EAAE;AAC7B,QAAA,OAAOvB,SAAS,CAAA,EAAG,kDAAA,CAAA;AACrB,IAAA;;AAGA,IAAA,IAAIqB,IAAAA,CAAKC,OAAO,IAAI,EAAED,IAAAA,CAAKE,GAAG,IAAIF,IAAAA,CAAKE,GAAG,CAACf,MAAM,GAAG,CAAA,CAAA,EAAI;QACtD,IAAI;AACF,YAAA,MAAMgB,WAAW,MAAMC,WAAAA,EAAAA;AACvB,YAAA,MAAMC,OAAAA,GAAU,MAAMF,QAAAA,CAASG,MAAM,CAAC;AACpC,gBAAA;oBACEC,IAAAA,EAAM,UAAA;oBACNC,OAAAA,EAAS,gCAAA;oBACTC,IAAAA,EAAM,KAAA;AACNC,oBAAAA,QAAAA,CAAAA,CAASR,
|
|
1
|
+
{"version":3,"file":"commander.mjs","sources":["../../../../src/cli/utils/commander.ts"],"sourcesContent":["/**\n * This file includes hooks to use for commander.hook and argParsers for commander.argParser\n */\n\nimport { Command, InvalidOptionArgumentError, Option } from 'commander';\nimport chalk from 'chalk';\nimport { isNaN } from 'lodash/fp';\nimport { exitWith } from './helpers';\nimport { getInquirer } from './get-inquirer';\n\n/**\n * argParser: Parse a comma-delimited string as an array\n */\nconst parseList = (value: string) => {\n try {\n return value.split(',').map((item) => item.trim()); // trim shouldn't be necessary but might help catch unexpected whitespace characters\n } catch (e) {\n exitWith(1, `Unrecognized input: ${value}`);\n }\n\n return [];\n};\n\n/**\n * Returns an argParser that returns a list\n */\nconst getParseListWithChoices = (choices: string[], errorMessage = 'Invalid options:') => {\n return (value: string) => {\n const list = parseList(value);\n const invalid = list.filter((item) => {\n return !choices.includes(item);\n });\n\n if (invalid.length > 0) {\n exitWith(1, `${errorMessage}: ${invalid.join(',')}`);\n }\n\n return list;\n };\n};\n\n/**\n * argParser: Parse a string as an integer\n */\nconst parseInteger = (value: string) => {\n // parseInt takes a string and a radix\n const parsedValue = parseInt(value, 10);\n if (isNaN(parsedValue)) {\n throw new InvalidOptionArgumentError(`Not an integer: ${value}`);\n }\n return parsedValue;\n};\n\n/**\n * argParser: Parse a string as a URL object\n */\nconst parseURL = (value: string) => {\n try {\n const url = new URL(value);\n if (!url.host) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n\n return url;\n } catch (e) {\n throw new InvalidOptionArgumentError(`Could not parse url ${value}`);\n }\n};\n\n/**\n * hook: if encrypt==true and key not provided, prompt for it\n */\nconst promptEncryptionKey = async (thisCommand: Command) => {\n const opts = thisCommand.opts();\n\n if (!opts.encrypt && opts.key) {\n return exitWith(1, 'Key may not be present unless encryption is used');\n }\n\n // if encrypt==true but we have no key, prompt for it\n if (opts.encrypt && !(opts.key && opts.key.length > 0)) {\n try {\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter an encryption key',\n name: 'key',\n validate(key: string) {\n if (key.length > 0) return true;\n\n return 'Key must be present when using the encrypt option';\n },\n },\n ]);\n opts.key = answers.key;\n } catch (e) {\n return exitWith(1, 'Failed to get encryption key');\n }\n if (!opts.key) {\n return exitWith(1, 'Failed to get encryption key');\n }\n }\n};\n\n/**\n * hook: require a confirmation message to be accepted unless forceOption (-f,--force) is used\n */\nconst getCommanderConfirmMessage = (\n message: string,\n { failMessage }: { failMessage?: string } = {}\n) => {\n return async (command: Command) => {\n const confirmed = await confirmMessage(message, { force: command.opts().force });\n if (!confirmed) {\n exitWith(1, failMessage);\n }\n };\n};\n\nconst confirmMessage = async (message: string, { force }: { force?: boolean } = {}) => {\n // if we have a force option, respond yes\n if (force === true) {\n // attempt to mimic the inquirer prompt exactly\n console.log(`${chalk.green('?')} ${chalk.bold(message)} ${chalk.cyan('Yes')}`);\n return true;\n }\n\n const inquirer = await getInquirer();\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n message,\n name: `confirm`,\n default: false,\n },\n ]);\n\n return answers.confirm;\n};\n\nconst forceOption = new Option(\n '--force',\n `Automatically answer \"yes\" to all prompts, including potentially destructive requests, and run non-interactively.`\n);\n\nexport {\n getParseListWithChoices,\n parseList,\n parseURL,\n parseInteger,\n promptEncryptionKey,\n getCommanderConfirmMessage,\n confirmMessage,\n forceOption,\n};\n"],"names":["parseList","value","split","map","item","trim","e","exitWith","getParseListWithChoices","choices","errorMessage","list","invalid","filter","includes","length","join","parseInteger","parsedValue","parseInt","isNaN","InvalidOptionArgumentError","parseURL","url","URL","host","promptEncryptionKey","thisCommand","opts","encrypt","key","inquirer","getInquirer","answers","prompt","type","message","name","validate","getCommanderConfirmMessage","failMessage","command","confirmed","confirmMessage","force","console","log","chalk","green","bold","cyan","default","confirm","forceOption","Option"],"mappings":";;;;;;AAUA;;IAGA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;IACjB,IAAI;QACF,OAAOA,KAAAA,CAAMC,KAAK,CAAC,GAAA,CAAA,CAAKC,GAAG,CAAC,CAACC,IAAAA,GAASA,IAAAA,CAAKC,IAAI,EAAA,CAAA,CAAA;AACjD,IAAA,CAAA,CAAE,OAAOC,CAAAA,EAAG;AACVC,QAAAA,QAAAA,CAAS,CAAA,EAAG,CAAC,oBAAoB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|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -109,25 +109,25 @@
|
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
|
|
112
|
-
"@strapi/admin": "5.42.
|
|
113
|
-
"@strapi/cloud-cli": "5.42.
|
|
114
|
-
"@strapi/content-manager": "5.42.
|
|
115
|
-
"@strapi/content-releases": "5.42.
|
|
116
|
-
"@strapi/content-type-builder": "5.42.
|
|
117
|
-
"@strapi/core": "5.42.
|
|
118
|
-
"@strapi/data-transfer": "5.42.
|
|
119
|
-
"@strapi/database": "5.42.
|
|
120
|
-
"@strapi/email": "5.42.
|
|
121
|
-
"@strapi/generators": "5.42.
|
|
122
|
-
"@strapi/i18n": "5.42.
|
|
123
|
-
"@strapi/logger": "5.42.
|
|
124
|
-
"@strapi/openapi": "5.42.
|
|
125
|
-
"@strapi/permissions": "5.42.
|
|
126
|
-
"@strapi/review-workflows": "5.42.
|
|
127
|
-
"@strapi/types": "5.42.
|
|
128
|
-
"@strapi/typescript-utils": "5.42.
|
|
129
|
-
"@strapi/upload": "5.42.
|
|
130
|
-
"@strapi/utils": "5.42.
|
|
112
|
+
"@strapi/admin": "5.42.1",
|
|
113
|
+
"@strapi/cloud-cli": "5.42.1",
|
|
114
|
+
"@strapi/content-manager": "5.42.1",
|
|
115
|
+
"@strapi/content-releases": "5.42.1",
|
|
116
|
+
"@strapi/content-type-builder": "5.42.1",
|
|
117
|
+
"@strapi/core": "5.42.1",
|
|
118
|
+
"@strapi/data-transfer": "5.42.1",
|
|
119
|
+
"@strapi/database": "5.42.1",
|
|
120
|
+
"@strapi/email": "5.42.1",
|
|
121
|
+
"@strapi/generators": "5.42.1",
|
|
122
|
+
"@strapi/i18n": "5.42.1",
|
|
123
|
+
"@strapi/logger": "5.42.1",
|
|
124
|
+
"@strapi/openapi": "5.42.1",
|
|
125
|
+
"@strapi/permissions": "5.42.1",
|
|
126
|
+
"@strapi/review-workflows": "5.42.1",
|
|
127
|
+
"@strapi/types": "5.42.1",
|
|
128
|
+
"@strapi/typescript-utils": "5.42.1",
|
|
129
|
+
"@strapi/upload": "5.42.1",
|
|
130
|
+
"@strapi/utils": "5.42.1",
|
|
131
131
|
"@types/nodemon": "1.19.6",
|
|
132
132
|
"@vitejs/plugin-react-swc": "3.6.0",
|
|
133
133
|
"boxen": "5.1.2",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"git-url-parse": "14.0.0",
|
|
152
152
|
"html-webpack-plugin": "5.6.0",
|
|
153
153
|
"inquirer": "9.3.8",
|
|
154
|
-
"lodash": "4.
|
|
154
|
+
"lodash": "4.18.1",
|
|
155
155
|
"mini-css-extract-plugin": "2.7.7",
|
|
156
156
|
"nodemon": "3.0.2",
|
|
157
157
|
"ora": "5.4.1",
|
|
@@ -180,11 +180,11 @@
|
|
|
180
180
|
"@types/node": "24.10.0",
|
|
181
181
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
182
182
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
183
|
-
"eslint-config-custom": "5.42.
|
|
183
|
+
"eslint-config-custom": "5.42.1",
|
|
184
184
|
"jest": "29.6.0",
|
|
185
185
|
"react": "18.3.1",
|
|
186
186
|
"react-dom": "18.3.1",
|
|
187
|
-
"tsconfig": "5.42.
|
|
187
|
+
"tsconfig": "5.42.1",
|
|
188
188
|
"yalc": "1.0.0-pre.53"
|
|
189
189
|
},
|
|
190
190
|
"peerDependencies": {
|