@strapi/strapi 5.13.0 → 5.14.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/transfer/command.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,QAAA,MAAM,OAAO,mCAiGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/transfer/command.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,QAAA,MAAM,OAAO,mCAiOZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAwC5D,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAuB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAyB/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAOrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAwC5D,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,YAAY,CAuB9E,CAAC;AAEF,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,YAAY,CA0B/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,YAAY,OAAO,YAAY,wBAQ/E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "5.12.7";
3
+ var version = "5.13.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
@@ -1,4 +1,4 @@
1
- var version = "5.12.7";
1
+ var version = "5.13.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -10,7 +10,117 @@ var action = require('./action.js');
10
10
  /**
11
11
  * `$ strapi transfer`
12
12
  */ const command = ()=>{
13
- return commander.createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new commander.Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(commander$1.parseURL)).addOption(new commander.Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new commander.Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(commander$1.parseURL)).addOption(new commander.Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new commander.Option('--verbose', 'Enable verbose logs')).addOption(commander$1.forceOption).addOption(dataTransfer.excludeOption).addOption(dataTransfer.onlyOption).addOption(dataTransfer.throttleOption).hook('preAction', dataTransfer.validateExcludeOnly).hook('preAction', helpers.ifOptions((opts)=>!(opts.from || opts.to) || opts.from && opts.to, async ()=>helpers.exitWith(1, 'Exactly one remote source (from) or destination (to) option must be provided')))// If --from is used, validate the URL and token
13
+ return commander.createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new commander.Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(commander$1.parseURL)).addOption(new commander.Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new commander.Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(commander$1.parseURL)).addOption(new commander.Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new commander.Option('--verbose', 'Enable verbose logs')).addOption(commander$1.forceOption).addOption(dataTransfer.excludeOption).addOption(dataTransfer.onlyOption).addOption(dataTransfer.throttleOption).hook('preAction', dataTransfer.validateExcludeOnly).hook('preAction', helpers.ifOptions((opts)=>opts.from && opts.to || opts.from && opts.toToken || opts.to && opts.fromToken, async ()=>helpers.exitWith(1, 'Only one remote source (from) or destination (to) option may be provided'))).hook('preAction', async (thisCommand)=>{
14
+ const opts = thisCommand.opts();
15
+ const hasEnvUrl = process.env.STRAPI_TRANSFER_URL;
16
+ const hasEnvToken = process.env.STRAPI_TRANSFER_TOKEN;
17
+ const logDocumentation = ()=>{
18
+ console.info('ℹ️ Data transfer documentation: https://docs.strapi.io/dev-docs/data-management/transfer');
19
+ };
20
+ const logEnvironmentVariables = ()=>{
21
+ if (!hasEnvUrl && !hasEnvToken) {
22
+ console.info('ℹ️ No transfer configuration found in environment variables');
23
+ console.info(' → Add STRAPI_TRANSFER_URL and STRAPI_TRANSFER_TOKEN environment variables to make the transfer process faster for future runs');
24
+ return;
25
+ }
26
+ console.info('ℹ️ Found transfer configuration in your environment:');
27
+ if (hasEnvUrl) {
28
+ console.info(` → Environment STRAPI_TRANSFER_URL (${hasEnvUrl}) will be used as the transfer URL`);
29
+ }
30
+ if (hasEnvToken) {
31
+ console.info(' → Environment STRAPI_TRANSFER_TOKEN value will be used as the transfer token');
32
+ }
33
+ console.info(); // Empty line for better readability
34
+ };
35
+ const determineDirection = async ()=>{
36
+ // If user has not provided a direction from CLI, log the documentation
37
+ if (!opts.from && !opts.to) {
38
+ logDocumentation();
39
+ }
40
+ logEnvironmentVariables();
41
+ if (opts.from) {
42
+ return opts.from;
43
+ }
44
+ if (opts.to) {
45
+ return opts.to;
46
+ }
47
+ const { dir } = await inquirer.prompt([
48
+ {
49
+ type: 'list',
50
+ name: 'dir',
51
+ message: 'Choose transfer direction:',
52
+ choices: [
53
+ {
54
+ name: 'Pull data from remote Strapi to local',
55
+ value: 'from'
56
+ },
57
+ {
58
+ name: 'Push local data to remote Strapi',
59
+ value: 'to'
60
+ }
61
+ ]
62
+ }
63
+ ]);
64
+ return dir;
65
+ };
66
+ const determineUrl = async (direction)=>{
67
+ if (opts[direction]) {
68
+ return new URL(opts[direction]);
69
+ }
70
+ if (process.env.STRAPI_TRANSFER_URL) {
71
+ return new URL(process.env.STRAPI_TRANSFER_URL);
72
+ }
73
+ const answer = await inquirer.prompt([
74
+ {
75
+ type: 'input',
76
+ name: 'remoteUrl',
77
+ message: `Enter the URL of the remote Strapi instance to ${direction === 'from' ? 'get data from' : 'send data to'}:`,
78
+ default: process.env.STRAPI_TRANSFER_URL,
79
+ validate (input) {
80
+ try {
81
+ const url = new URL(input);
82
+ if (![
83
+ 'http:',
84
+ 'https:'
85
+ ].includes(url.protocol)) {
86
+ return 'URL must use http: or https: protocol';
87
+ }
88
+ return true;
89
+ } catch (error) {
90
+ return 'Please enter a valid URL (e.g., http://localhost:1337/admin or https://example.com/admin)';
91
+ }
92
+ }
93
+ }
94
+ ]);
95
+ return new URL(answer.remoteUrl);
96
+ };
97
+ const determineToken = async (direction)=>{
98
+ if (opts[`${direction}Token`]) {
99
+ return opts[`${direction}Token`];
100
+ }
101
+ if (process.env.STRAPI_TRANSFER_TOKEN) {
102
+ return process.env.STRAPI_TRANSFER_TOKEN;
103
+ }
104
+ const answer = await inquirer.prompt([
105
+ {
106
+ type: 'password',
107
+ name: 'token',
108
+ message: `Enter the transfer token for the remote Strapi ${direction === 'from' ? 'source' : 'destination'}:`,
109
+ default: process.env.STRAPI_TRANSFER_TOKEN,
110
+ validate (input) {
111
+ if (!input?.length) {
112
+ return 'Transfer token is required';
113
+ }
114
+ return true;
115
+ }
116
+ }
117
+ ]);
118
+ return answer.token;
119
+ };
120
+ const direction = await determineDirection();
121
+ opts[direction] = await determineUrl(direction);
122
+ opts[`${direction}Token`] = await determineToken(direction);
123
+ })// If --from is used, validate the URL and token
14
124
  .hook('preAction', helpers.ifOptions((opts)=>opts.from, async (thisCommand)=>{
15
125
  helpers.assertUrlHasProtocol(thisCommand.opts().from, [
16
126
  'https:',
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) => !(opts.from || opts.to) || (opts.from && opts.to),\n async () =>\n exitWith(\n 1,\n 'Exactly one remote source (from) or destination (to) option must be provided'\n )\n )\n )\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","exitWith","thisCommand","assertUrlHasProtocol","fromToken","answers","inquirer","prompt","type","message","name","length","getCommanderConfirmMessage","failMessage","toToken","action"],"mappings":";;;;;;;;;AAaA;;AAEC,UACKA,OAAU,GAAA,IAAA;IACd,OACEC,uBAAAA,CAAc,YACXC,WAAW,CAAC,4CACZC,oBAAoB,CAAC,OACrBC,SAAS,CACR,IAAIC,gBACF,CAAA,oBAAA,EACA,CAAC,kDAAkD,CAAC,EACpDC,SAAS,CAACC,oBAEbH,CAAAA,CAAAA,CAAAA,SAAS,CAAC,IAAIC,iBAAO,sBAAwB,EAAA,CAAC,2CAA2C,CAAC,CAAA,CAAA,CAC1FD,SAAS,CACR,IAAIC,iBACF,uBACA,EAAA,C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AACAC,YAAAA,WAAAA,CAAYJ,IAAI,EAAA,CAAGM,SAAS,GAAGC,QAAQD,SAAS;AAClD;AAEA,QAAA,MAAMQ,uCACJ,0GACA,EAAA;YAAEC,WAAa,EAAA;SACfX,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAGJ;KACCP,IAAI,CACH,aACAE,iBACE,CAAA,CAACC,OAASA,IAAKE,CAAAA,EAAE,EACjB,OAAOE,WAAAA,GAAAA;AACLC,QAAAA,4BAAAA,CAAqBD,WAAYJ,CAAAA,IAAI,EAAGE,CAAAA,EAAE,EAAE;AAAC,YAAA,QAAA;AAAU,YAAA;AAAQ,SAAA,CAAA;AAC/D,QAAA,IAAI,CAACE,WAAAA,CAAYJ,IAAI,EAAA,CAAGgB,OAAO,EAAE;AAC/B,YAAA,MAAMT,OAAU,GAAA,MAAMC,QAASC,CAAAA,MAAM,CAAC;AACpC,gBAAA;oBACEC,IAAM,EAAA,UAAA;oBACNC,OAAS,EAAA,oEAAA;oBACTC,IAAM,EAAA;AACR;AACD,aAAA,CAAA;AACD,YAAA,IAAI,CAACL,OAAAA,CAAQS,OAAO,EAAEH,MAAQ,EAAA;AAC5BV,gBAAAA,gBAAAA,CAAS,CAAG,EAAA,8DAAA,CAAA;AACd;AACAC,YAAAA,WAAAA,CAAYJ,IAAI,EAAA,CAAGgB,OAAO,GAAGT,QAAQS,OAAO;AAC9C;AAEA,QAAA,MAAMF,uCACJ,kGACA,EAAA;YAAEC,WAAa,EAAA;SACfX,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAAA,CAGHa,MAAM,CAACA,MAAAA,CAAAA;AAEd;;;;"}
1
+ {"version":3,"file":"command.js","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) =>\n (opts.from && opts.to) || (opts.from && opts.toToken) || (opts.to && opts.fromToken),\n async () =>\n exitWith(1, 'Only one remote source (from) or destination (to) option may be provided')\n )\n )\n .hook('preAction', async (thisCommand) => {\n const opts = thisCommand.opts();\n const hasEnvUrl = process.env.STRAPI_TRANSFER_URL;\n const hasEnvToken = process.env.STRAPI_TRANSFER_TOKEN;\n\n const logDocumentation = () => {\n console.info(\n 'ℹ️ Data transfer documentation: https://docs.strapi.io/dev-docs/data-management/transfer'\n );\n };\n\n const logEnvironmentVariables = () => {\n if (!hasEnvUrl && !hasEnvToken) {\n console.info('ℹ️ No transfer configuration found in environment variables');\n console.info(\n ' → Add STRAPI_TRANSFER_URL and STRAPI_TRANSFER_TOKEN environment variables to make the transfer process faster for future runs'\n );\n return;\n }\n\n console.info('ℹ️ Found transfer configuration in your environment:');\n\n if (hasEnvUrl) {\n console.info(\n ` → Environment STRAPI_TRANSFER_URL (${hasEnvUrl}) will be used as the transfer URL`\n );\n }\n\n if (hasEnvToken) {\n console.info(\n ' → Environment STRAPI_TRANSFER_TOKEN value will be used as the transfer token'\n );\n }\n\n console.info(); // Empty line for better readability\n };\n\n const determineDirection = async () => {\n // If user has not provided a direction from CLI, log the documentation\n if (!opts.from && !opts.to) {\n logDocumentation();\n }\n\n logEnvironmentVariables();\n\n if (opts.from) {\n return opts.from;\n }\n if (opts.to) {\n return opts.to;\n }\n\n const { dir } = await inquirer.prompt([\n {\n type: 'list',\n name: 'dir',\n message: 'Choose transfer direction:',\n choices: [\n { name: 'Pull data from remote Strapi to local', value: 'from' },\n { name: 'Push local data to remote Strapi', value: 'to' },\n ],\n },\n ]);\n\n return dir;\n };\n\n const determineUrl = async (direction: 'from' | 'to') => {\n if (opts[direction]) {\n return new URL(opts[direction]);\n }\n\n if (process.env.STRAPI_TRANSFER_URL) {\n return new URL(process.env.STRAPI_TRANSFER_URL);\n }\n\n const answer = await inquirer.prompt([\n {\n type: 'input',\n name: 'remoteUrl',\n message: `Enter the URL of the remote Strapi instance to ${direction === 'from' ? 'get data from' : 'send data to'}:`,\n default: process.env.STRAPI_TRANSFER_URL,\n validate(input: string) {\n try {\n const url = new URL(input);\n if (!['http:', 'https:'].includes(url.protocol)) {\n return 'URL must use http: or https: protocol';\n }\n return true;\n } catch (error) {\n return 'Please enter a valid URL (e.g., http://localhost:1337/admin or https://example.com/admin)';\n }\n },\n },\n ]);\n\n return new URL(answer.remoteUrl);\n };\n\n const determineToken = async (direction: 'from' | 'to') => {\n if (opts[`${direction}Token`]) {\n return opts[`${direction}Token`];\n }\n\n if (process.env.STRAPI_TRANSFER_TOKEN) {\n return process.env.STRAPI_TRANSFER_TOKEN;\n }\n\n const answer = await inquirer.prompt([\n {\n type: 'password',\n name: 'token',\n message: `Enter the transfer token for the remote Strapi ${direction === 'from' ? 'source' : 'destination'}:`,\n default: process.env.STRAPI_TRANSFER_TOKEN,\n validate(input: string) {\n if (!input?.length) {\n return 'Transfer token is required';\n }\n return true;\n },\n },\n ]);\n\n return answer.token;\n };\n\n const direction = await determineDirection();\n opts[direction] = await determineUrl(direction);\n opts[`${direction}Token`] = await determineToken(direction);\n })\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","toToken","fromToken","exitWith","thisCommand","hasEnvUrl","process","env","STRAPI_TRANSFER_URL","hasEnvToken","STRAPI_TRANSFER_TOKEN","logDocumentation","console","info","logEnvironmentVariables","determineDirection","dir","inquirer","prompt","type","name","message","choices","value","determineUrl","direction","URL","answer","default","validate","input","url","includes","protocol","error","remoteUrl","determineToken","length","token","assertUrlHasProtocol","answers","getCommanderConfirmMessage","failMessage","action"],"mappings":";;;;;;;;;AAaA;;AAEC,UACKA,OAAU,GAAA,IAAA;IACd,OACEC,uBAAAA,CAAc,YACXC,WAAW,CAAC,4CACZC,oBAAoB,CAAC,KACrBC,CAAAA,CAAAA,SAAS,CACR,IAAIC,iBACF,oBACA,EAAA,CAAC,kDAAkD,CAAC,CACpDC,CAAAA,SAAS,CAACC,oBAEbH,CAAAA,CAAAA,CAAAA,SAAS,CAAC,IAAIC,gBAAO,CAAA,sBAAA,EAAwB,CAAC,2CAA2C,CAAC,GAC1FD,SAAS,CACR,IAAIC,gBACF,CAAA,uBAAA,EACA,CAAC,iDAAiD,CAAC,CAAA,CACnDC,SAAS,CAACC,oBAAAA,CAAAA,CAAAA,CAGbH,SAAS,CACR,IAAIC,gBAAAA,CAAO,sBAAsB,CAAC,gDAAgD,CAAC,CAAA,CAAA,CAEpFD,SAAS,CAAC,IAAIC,gBAAO,CAAA,WAAA,EAAa,wBAClCD,SAAS,CAACI,yBACVJ,SAAS,CAACK,0BACVL,CAAAA,CAAAA,SAAS,CAACM,uBAAAA,CAAAA,CACVN,SAAS,CAACO,2BAAAA,CAAAA,CACVC,IAAI,CAAC,WAAaC,EAAAA,gCAAAA,CAAAA,CAClBD,IAAI,CACH,WAAA,EACAE,iBACE,CAAA,CAACC,IACC,GAACA,KAAKC,IAAI,IAAID,KAAKE,EAAE,IAAMF,KAAKC,IAAI,IAAID,IAAKG,CAAAA,OAAO,IAAMH,IAAAA,CAAKE,EAAE,IAAIF,IAAAA,CAAKI,SAAS,EACrF,UACEC,gBAAAA,CAAS,GAAG,0EAGjBR,CAAAA,CAAAA,CAAAA,CAAAA,IAAI,CAAC,WAAA,EAAa,OAAOS,WAAAA,GAAAA;QACxB,MAAMN,IAAAA,GAAOM,YAAYN,IAAI,EAAA;AAC7B,QAAA,MAAMO,SAAYC,GAAAA,OAAAA,CAAQC,GAAG,CAACC,mB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BAAAA,gBAAAA,CAAS,CAAG,EAAA,8DAAA,CAAA;AACd;AACAC,YAAAA,WAAAA,CAAYN,IAAI,EAAA,CAAGG,OAAO,GAAGuC,QAAQvC,OAAO;AAC9C;AAEA,QAAA,MAAMwC,uCACJ,kGACA,EAAA;YAAEC,WAAa,EAAA;SACftC,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAAA,CAGHuC,MAAM,CAACA,MAAAA,CAAAA;AAEd;;;;"}
@@ -8,7 +8,117 @@ import action from './action.mjs';
8
8
  /**
9
9
  * `$ strapi transfer`
10
10
  */ const command = ()=>{
11
- return createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(parseURL)).addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(parseURL)).addOption(new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new Option('--verbose', 'Enable verbose logs')).addOption(forceOption).addOption(excludeOption).addOption(onlyOption).addOption(throttleOption).hook('preAction', validateExcludeOnly).hook('preAction', ifOptions((opts)=>!(opts.from || opts.to) || opts.from && opts.to, async ()=>exitWith(1, 'Exactly one remote source (from) or destination (to) option must be provided')))// If --from is used, validate the URL and token
11
+ return createCommand('transfer').description('Transfer data from one source to another').allowExcessArguments(false).addOption(new Option('--from <sourceURL>', `URL of the remote Strapi instance to get data from`).argParser(parseURL)).addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`)).addOption(new Option('--to <destinationURL>', `URL of the remote Strapi instance to send data to`).argParser(parseURL)).addOption(new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)).addOption(new Option('--verbose', 'Enable verbose logs')).addOption(forceOption).addOption(excludeOption).addOption(onlyOption).addOption(throttleOption).hook('preAction', validateExcludeOnly).hook('preAction', ifOptions((opts)=>opts.from && opts.to || opts.from && opts.toToken || opts.to && opts.fromToken, async ()=>exitWith(1, 'Only one remote source (from) or destination (to) option may be provided'))).hook('preAction', async (thisCommand)=>{
12
+ const opts = thisCommand.opts();
13
+ const hasEnvUrl = process.env.STRAPI_TRANSFER_URL;
14
+ const hasEnvToken = process.env.STRAPI_TRANSFER_TOKEN;
15
+ const logDocumentation = ()=>{
16
+ console.info('ℹ️ Data transfer documentation: https://docs.strapi.io/dev-docs/data-management/transfer');
17
+ };
18
+ const logEnvironmentVariables = ()=>{
19
+ if (!hasEnvUrl && !hasEnvToken) {
20
+ console.info('ℹ️ No transfer configuration found in environment variables');
21
+ console.info(' → Add STRAPI_TRANSFER_URL and STRAPI_TRANSFER_TOKEN environment variables to make the transfer process faster for future runs');
22
+ return;
23
+ }
24
+ console.info('ℹ️ Found transfer configuration in your environment:');
25
+ if (hasEnvUrl) {
26
+ console.info(` → Environment STRAPI_TRANSFER_URL (${hasEnvUrl}) will be used as the transfer URL`);
27
+ }
28
+ if (hasEnvToken) {
29
+ console.info(' → Environment STRAPI_TRANSFER_TOKEN value will be used as the transfer token');
30
+ }
31
+ console.info(); // Empty line for better readability
32
+ };
33
+ const determineDirection = async ()=>{
34
+ // If user has not provided a direction from CLI, log the documentation
35
+ if (!opts.from && !opts.to) {
36
+ logDocumentation();
37
+ }
38
+ logEnvironmentVariables();
39
+ if (opts.from) {
40
+ return opts.from;
41
+ }
42
+ if (opts.to) {
43
+ return opts.to;
44
+ }
45
+ const { dir } = await inquirer.prompt([
46
+ {
47
+ type: 'list',
48
+ name: 'dir',
49
+ message: 'Choose transfer direction:',
50
+ choices: [
51
+ {
52
+ name: 'Pull data from remote Strapi to local',
53
+ value: 'from'
54
+ },
55
+ {
56
+ name: 'Push local data to remote Strapi',
57
+ value: 'to'
58
+ }
59
+ ]
60
+ }
61
+ ]);
62
+ return dir;
63
+ };
64
+ const determineUrl = async (direction)=>{
65
+ if (opts[direction]) {
66
+ return new URL(opts[direction]);
67
+ }
68
+ if (process.env.STRAPI_TRANSFER_URL) {
69
+ return new URL(process.env.STRAPI_TRANSFER_URL);
70
+ }
71
+ const answer = await inquirer.prompt([
72
+ {
73
+ type: 'input',
74
+ name: 'remoteUrl',
75
+ message: `Enter the URL of the remote Strapi instance to ${direction === 'from' ? 'get data from' : 'send data to'}:`,
76
+ default: process.env.STRAPI_TRANSFER_URL,
77
+ validate (input) {
78
+ try {
79
+ const url = new URL(input);
80
+ if (![
81
+ 'http:',
82
+ 'https:'
83
+ ].includes(url.protocol)) {
84
+ return 'URL must use http: or https: protocol';
85
+ }
86
+ return true;
87
+ } catch (error) {
88
+ return 'Please enter a valid URL (e.g., http://localhost:1337/admin or https://example.com/admin)';
89
+ }
90
+ }
91
+ }
92
+ ]);
93
+ return new URL(answer.remoteUrl);
94
+ };
95
+ const determineToken = async (direction)=>{
96
+ if (opts[`${direction}Token`]) {
97
+ return opts[`${direction}Token`];
98
+ }
99
+ if (process.env.STRAPI_TRANSFER_TOKEN) {
100
+ return process.env.STRAPI_TRANSFER_TOKEN;
101
+ }
102
+ const answer = await inquirer.prompt([
103
+ {
104
+ type: 'password',
105
+ name: 'token',
106
+ message: `Enter the transfer token for the remote Strapi ${direction === 'from' ? 'source' : 'destination'}:`,
107
+ default: process.env.STRAPI_TRANSFER_TOKEN,
108
+ validate (input) {
109
+ if (!input?.length) {
110
+ return 'Transfer token is required';
111
+ }
112
+ return true;
113
+ }
114
+ }
115
+ ]);
116
+ return answer.token;
117
+ };
118
+ const direction = await determineDirection();
119
+ opts[direction] = await determineUrl(direction);
120
+ opts[`${direction}Token`] = await determineToken(direction);
121
+ })// If --from is used, validate the URL and token
12
122
  .hook('preAction', ifOptions((opts)=>opts.from, async (thisCommand)=>{
13
123
  assertUrlHasProtocol(thisCommand.opts().from, [
14
124
  'https:',
@@ -1 +1 @@
1
- {"version":3,"file":"command.mjs","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) => !(opts.from || opts.to) || (opts.from && opts.to),\n async () =>\n exitWith(\n 1,\n 'Exactly one remote source (from) or destination (to) option must be provided'\n )\n )\n )\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","exitWith","thisCommand","assertUrlHasProtocol","fromToken","answers","inquirer","prompt","type","message","name","length","getCommanderConfirmMessage","failMessage","toToken","action"],"mappings":";;;;;;;AAaA;;AAEC,UACKA,OAAU,GAAA,IAAA;IACd,OACEC,aAAAA,CAAc,YACXC,WAAW,CAAC,4CACZC,oBAAoB,CAAC,OACrBC,SAAS,CACR,IAAIC,MACF,CAAA,oBAAA,EACA,CAAC,kDAAkD,CAAC,EACpDC,SAAS,CAACC,QAEbH,CAAAA,CAAAA,CAAAA,SAAS,CAAC,IAAIC,OAAO,sBAAwB,EAAA,CAAC,2CAA2C,CAAC,CAAA,CAAA,CAC1FD,SAAS,CACR,IAAIC,OACF,uBACA,EAAA,CAAC,iDAAiD,CAAC,CAAA,CACnDC,SAAS,CAACC,QAAAA,CAAAA,CAAAA,CAGbH,SAAS,CACR,IAAIC,MAAO,CAAA,oBAAA,EAAsB,CAAC,gDAAgD,CAAC,CAEpFD,CAAAA,CAAAA,SAAS,CAAC,IAAIC,MAAAA,CAAO,aAAa,qBAClCD,CAAAA,CAAAA,CAAAA,SAAS,CAACI,WACVJ,CAAAA,CAAAA,SAAS,CAACK,aACVL,CAAAA,CAAAA,S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AAA,CAAqBD,WAAYJ,CAAAA,IAAI,EAAGE,CAAAA,EAAE,EAAE;AAAC,YAAA,QAAA;AAAU,YAAA;AAAQ,SAAA,CAAA;AAC/D,QAAA,IAAI,CAACE,WAAAA,CAAYJ,IAAI,EAAA,CAAGgB,OAAO,EAAE;AAC/B,YAAA,MAAMT,OAAU,GAAA,MAAMC,QAASC,CAAAA,MAAM,CAAC;AACpC,gBAAA;oBACEC,IAAM,EAAA,UAAA;oBACNC,OAAS,EAAA,oEAAA;oBACTC,IAAM,EAAA;AACR;AACD,aAAA,CAAA;AACD,YAAA,IAAI,CAACL,OAAAA,CAAQS,OAAO,EAAEH,MAAQ,EAAA;AAC5BV,gBAAAA,QAAAA,CAAS,CAAG,EAAA,8DAAA,CAAA;AACd;AACAC,YAAAA,WAAAA,CAAYJ,IAAI,EAAA,CAAGgB,OAAO,GAAGT,QAAQS,OAAO;AAC9C;AAEA,QAAA,MAAMF,2BACJ,kGACA,EAAA;YAAEC,WAAa,EAAA;SACfX,CAAAA,CAAAA,WAAAA,CAAAA;AACJ,KAAA,CAAA,CAAA,CAGHa,MAAM,CAACA,MAAAA,CAAAA;AAEd;;;;"}
1
+ {"version":3,"file":"command.mjs","sources":["../../../../../src/cli/commands/transfer/command.ts"],"sourcesContent":["import inquirer from 'inquirer';\nimport { createCommand, Option } from 'commander';\nimport { getCommanderConfirmMessage, forceOption, parseURL } from '../../utils/commander';\nimport { exitWith, assertUrlHasProtocol, ifOptions } from '../../utils/helpers';\nimport {\n excludeOption,\n onlyOption,\n throttleOption,\n validateExcludeOnly,\n} from '../../utils/data-transfer';\n\nimport action from './action';\n\n/**\n * `$ strapi transfer`\n */\nconst command = () => {\n return (\n createCommand('transfer')\n .description('Transfer data from one source to another')\n .allowExcessArguments(false)\n .addOption(\n new Option(\n '--from <sourceURL>',\n `URL of the remote Strapi instance to get data from`\n ).argParser(parseURL)\n )\n .addOption(new Option('--from-token <token>', `Transfer token for the remote Strapi source`))\n .addOption(\n new Option(\n '--to <destinationURL>',\n `URL of the remote Strapi instance to send data to`\n ).argParser(parseURL)\n )\n\n .addOption(\n new Option('--to-token <token>', `Transfer token for the remote Strapi destination`)\n )\n .addOption(new Option('--verbose', 'Enable verbose logs'))\n .addOption(forceOption)\n .addOption(excludeOption)\n .addOption(onlyOption)\n .addOption(throttleOption)\n .hook('preAction', validateExcludeOnly)\n .hook(\n 'preAction',\n ifOptions(\n (opts) =>\n (opts.from && opts.to) || (opts.from && opts.toToken) || (opts.to && opts.fromToken),\n async () =>\n exitWith(1, 'Only one remote source (from) or destination (to) option may be provided')\n )\n )\n .hook('preAction', async (thisCommand) => {\n const opts = thisCommand.opts();\n const hasEnvUrl = process.env.STRAPI_TRANSFER_URL;\n const hasEnvToken = process.env.STRAPI_TRANSFER_TOKEN;\n\n const logDocumentation = () => {\n console.info(\n 'ℹ️ Data transfer documentation: https://docs.strapi.io/dev-docs/data-management/transfer'\n );\n };\n\n const logEnvironmentVariables = () => {\n if (!hasEnvUrl && !hasEnvToken) {\n console.info('ℹ️ No transfer configuration found in environment variables');\n console.info(\n ' → Add STRAPI_TRANSFER_URL and STRAPI_TRANSFER_TOKEN environment variables to make the transfer process faster for future runs'\n );\n return;\n }\n\n console.info('ℹ️ Found transfer configuration in your environment:');\n\n if (hasEnvUrl) {\n console.info(\n ` → Environment STRAPI_TRANSFER_URL (${hasEnvUrl}) will be used as the transfer URL`\n );\n }\n\n if (hasEnvToken) {\n console.info(\n ' → Environment STRAPI_TRANSFER_TOKEN value will be used as the transfer token'\n );\n }\n\n console.info(); // Empty line for better readability\n };\n\n const determineDirection = async () => {\n // If user has not provided a direction from CLI, log the documentation\n if (!opts.from && !opts.to) {\n logDocumentation();\n }\n\n logEnvironmentVariables();\n\n if (opts.from) {\n return opts.from;\n }\n if (opts.to) {\n return opts.to;\n }\n\n const { dir } = await inquirer.prompt([\n {\n type: 'list',\n name: 'dir',\n message: 'Choose transfer direction:',\n choices: [\n { name: 'Pull data from remote Strapi to local', value: 'from' },\n { name: 'Push local data to remote Strapi', value: 'to' },\n ],\n },\n ]);\n\n return dir;\n };\n\n const determineUrl = async (direction: 'from' | 'to') => {\n if (opts[direction]) {\n return new URL(opts[direction]);\n }\n\n if (process.env.STRAPI_TRANSFER_URL) {\n return new URL(process.env.STRAPI_TRANSFER_URL);\n }\n\n const answer = await inquirer.prompt([\n {\n type: 'input',\n name: 'remoteUrl',\n message: `Enter the URL of the remote Strapi instance to ${direction === 'from' ? 'get data from' : 'send data to'}:`,\n default: process.env.STRAPI_TRANSFER_URL,\n validate(input: string) {\n try {\n const url = new URL(input);\n if (!['http:', 'https:'].includes(url.protocol)) {\n return 'URL must use http: or https: protocol';\n }\n return true;\n } catch (error) {\n return 'Please enter a valid URL (e.g., http://localhost:1337/admin or https://example.com/admin)';\n }\n },\n },\n ]);\n\n return new URL(answer.remoteUrl);\n };\n\n const determineToken = async (direction: 'from' | 'to') => {\n if (opts[`${direction}Token`]) {\n return opts[`${direction}Token`];\n }\n\n if (process.env.STRAPI_TRANSFER_TOKEN) {\n return process.env.STRAPI_TRANSFER_TOKEN;\n }\n\n const answer = await inquirer.prompt([\n {\n type: 'password',\n name: 'token',\n message: `Enter the transfer token for the remote Strapi ${direction === 'from' ? 'source' : 'destination'}:`,\n default: process.env.STRAPI_TRANSFER_TOKEN,\n validate(input: string) {\n if (!input?.length) {\n return 'Transfer token is required';\n }\n return true;\n },\n },\n ]);\n\n return answer.token;\n };\n\n const direction = await determineDirection();\n opts[direction] = await determineUrl(direction);\n opts[`${direction}Token`] = await determineToken(direction);\n })\n // If --from is used, validate the URL and token\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.from,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().from, ['https:', 'http:']);\n if (!thisCommand.opts().fromToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi source',\n name: 'fromToken',\n },\n ]);\n if (!answers.fromToken?.length) {\n exitWith(1, 'No token provided for remote source, aborting transfer.');\n }\n thisCommand.opts().fromToken = answers.fromToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete all the local Strapi assets and its database. Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n // If --to is used, validate the URL, token, and confirm restore\n .hook(\n 'preAction',\n ifOptions(\n (opts) => opts.to,\n async (thisCommand) => {\n assertUrlHasProtocol(thisCommand.opts().to, ['https:', 'http:']);\n if (!thisCommand.opts().toToken) {\n const answers = await inquirer.prompt([\n {\n type: 'password',\n message: 'Please enter your transfer token for the remote Strapi destination',\n name: 'toToken',\n },\n ]);\n if (!answers.toToken?.length) {\n exitWith(1, 'No token provided for remote destination, aborting transfer.');\n }\n thisCommand.opts().toToken = answers.toToken;\n }\n\n await getCommanderConfirmMessage(\n 'The transfer will delete existing data from the remote Strapi! Are you sure you want to proceed?',\n { failMessage: 'Transfer process aborted' }\n )(thisCommand);\n }\n )\n )\n .action(action)\n );\n};\n\nexport default command;\n"],"names":["command","createCommand","description","allowExcessArguments","addOption","Option","argParser","parseURL","forceOption","excludeOption","onlyOption","throttleOption","hook","validateExcludeOnly","ifOptions","opts","from","to","toToken","fromToken","exitWith","thisCommand","hasEnvUrl","process","env","STRAPI_TRANSFER_URL","hasEnvToken","STRAPI_TRANSFER_TOKEN","logDocumentation","console","info","logEnvironmentVariables","determineDirection","dir","inquirer","prompt","type","name","message","choices","value","determineUrl","direction","URL","answer","default","validate","input","url","includes","protocol","error","remoteUrl","determineToken","length","token","assertUrlHasProtocol","answers","getCommanderConfirmMessage","failMessage","action"],"mappings":";;;;;;;AAaA;;AAEC,UACKA,OAAU,GAAA,IAAA;IACd,OACEC,aAAAA,CAAc,YACXC,WAAW,CAAC,4CACZC,oBAAoB,CAAC,KACrBC,CAAAA,CAAAA,SAAS,CACR,IAAIC,OACF,oBACA,EAAA,CAAC,kDAAkD,CAAC,CACpDC,CAAAA,SAAS,CAACC,QAEbH,CAAAA,CAAAA,CAAA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ig = async (ctx)=>{
90
90
  middlewareMode: true,
91
91
  open: ctx.options.open,
92
92
  hmr: {
93
+ overlay: false,
93
94
  server: ctx.options.hmrServer,
94
95
  clientPort: ctx.options.hmrClientPort
95
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport { getMonorepoAliases } from '../core/aliases';\nimport type { BuildContext } from '../create-build-context';\nimport { buildFilesPlugin } from './plugins';\n\nconst resolveBaseConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n 'process.env': ctx.env,\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n include: [\n // pre-bundle React dependencies to avoid React duplicates,\n // even if React dependencies are not direct dependencies\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n 'react',\n `react/jsx-runtime`,\n 'react-dom/client',\n 'styled-components',\n 'react-router-dom',\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n dedupe: ['react', 'react-dom', 'react-router-dom', 'styled-components'],\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","env","envPrefix","optimizeDeps","include","resolve","dedupe","plugins","react","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","strapi","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","alias","getMonorepoAliases","server","cors","middlewareMode","open","hmr","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;AAUA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAsBF,CAAAA,GAAAA,CAAIC,MAAM,CAAA;IAE/C,OAAO;AACLE,QAAAA,IAAAA,EAAMH,IAAII,GAAG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AA,GAAAA;AACtC,IAAA,MAAMqC,UAAW,GAAA,MAAMC,2BAAmBtC,CAAAA,GAAAA,CAAII,GAAG,CAAA;IACjD,MAAMuB,UAAAA,GAAa,MAAM5B,iBAAkBC,CAAAA,GAAAA,CAAAA;IAE3C,OAAO;AACL,QAAA,GAAG2B,UAAU;QACbE,IAAM,EAAA,aAAA;QACNX,OAAS,EAAA;AACP,YAAA,GAAGS,WAAWT,OAAO;YACrBqB,KAAO,EAAA;gBACL,GAAGZ,UAAAA,CAAWT,OAAO,EAAEqB,KAAK;AAC5B,gBAAA,GAAGC,0BAAmB,CAAA;AAAEH,8BAAAA;iBAAW;AACrC;AACF,SAAA;QACAI,MAAQ,EAAA;YACNC,IAAM,EAAA,KAAA;YACNC,cAAgB,EAAA,IAAA;YAChBC,IAAM5C,EAAAA,GAAAA,CAAIwB,OAAO,CAACoB,IAAI;YACtBC,GAAK,EAAA;gBACHJ,MAAQzC,EAAAA,GAAAA,CAAIwB,OAAO,CAACsB,SAAS;gBAC7BC,UAAY/C,EAAAA,GAAAA,CAAIwB,OAAO,CAACwB;AAC1B;AACF,SAAA;QACAC,OAAS,EAAA;AACX,KAAA;AACF;AAEA,MAAMC,YAAe,GAAA;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA;AAAiB,CAAA;AAItEC,MAAAA,yBAAAA,GAA4B,OAAOC,QAAsBpD,EAAAA,GAAAA,GAAAA;IAC7D,MAAMqD,UAAAA,GAAa,MAAMC,oBAAAA,CAA8BJ,YAAclD,EAAAA,GAAAA,CAAAA;AAErE,IAAA,IAAIqD,UAAY,EAAA;AACd,QAAA,OAAOA,UAAWD,CAAAA,QAAAA,CAAAA;AACpB;IAEA,OAAOA,QAAAA;AACT;;;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport { getMonorepoAliases } from '../core/aliases';\nimport type { BuildContext } from '../create-build-context';\nimport { buildFilesPlugin } from './plugins';\n\nconst resolveBaseConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n 'process.env': ctx.env,\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n include: [\n // pre-bundle React dependencies to avoid React duplicates,\n // even if React dependencies are not direct dependencies\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n 'react',\n `react/jsx-runtime`,\n 'react-dom/client',\n 'styled-components',\n 'react-router-dom',\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n dedupe: ['react', 'react-dom', 'react-router-dom', 'styled-components'],\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","env","envPrefix","optimizeDeps","include","resolve","dedupe","plugins","react","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","strapi","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","alias","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;;;AAUA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAsBF,CAAAA,GAAAA,CAAIC,MAAM,CAAA;IAE/C,OAAO;AACLE,QAAAA,IAAAA,EAAMH,IAAII,GAAG;AACbC,QAAAA,IAAAA,EAAML,IAAIM,QAAQ;QAClBC,KAAO,EAAA;YACLC,WAAa,EAAA,KAAA;AACbC,YAAAA,MAAAA,EAAQT,IAAIU,OAAO;AACnBT,YAAAA;AACF,SAAA;QACAU,QAAU,EAAA,2BAAA;QACVC,UAAY,EAAA,KAAA;QACZC,MAAQ,EAAA;AACN,YAAA,aAAA,EAAeb,IAAIc;AACrB,SAAA;QACAC,SAAW,EA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qB,KAAO,EAAA;gBACL,GAAGZ,UAAAA,CAAWT,OAAO,EAAEqB,KAAK;AAC5B,gBAAA,GAAGC,0BAAmB,CAAA;AAAEH,8BAAAA;iBAAW;AACrC;AACF,SAAA;QACAI,MAAQ,EAAA;YACNC,IAAM,EAAA,KAAA;YACNC,cAAgB,EAAA,IAAA;YAChBC,IAAM5C,EAAAA,GAAAA,CAAIwB,OAAO,CAACoB,IAAI;YACtBC,GAAK,EAAA;gBACHC,OAAS,EAAA,KAAA;gBACTL,MAAQzC,EAAAA,GAAAA,CAAIwB,OAAO,CAACuB,SAAS;gBAC7BC,UAAYhD,EAAAA,GAAAA,CAAIwB,OAAO,CAACyB;AAC1B;AACF,SAAA;QACAC,OAAS,EAAA;AACX,KAAA;AACF;AAEA,MAAMC,YAAe,GAAA;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA;AAAiB,CAAA;AAItEC,MAAAA,yBAAAA,GAA4B,OAAOC,QAAsBrD,EAAAA,GAAAA,GAAAA;IAC7D,MAAMsD,UAAAA,GAAa,MAAMC,oBAAAA,CAA8BJ,YAAcnD,EAAAA,GAAAA,CAAAA;AAErE,IAAA,IAAIsD,UAAY,EAAA;AACd,QAAA,OAAOA,UAAWD,CAAAA,QAAAA,CAAAA;AACpB;IAEA,OAAOA,QAAAA;AACT;;;;;;"}
@@ -88,6 +88,7 @@ const resolveDevelopmentConfig = async (ctx)=>{
88
88
  middlewareMode: true,
89
89
  open: ctx.options.open,
90
90
  hmr: {
91
+ overlay: false,
91
92
  server: ctx.options.hmrServer,
92
93
  clientPort: ctx.options.hmrClientPort
93
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport { getMonorepoAliases } from '../core/aliases';\nimport type { BuildContext } from '../create-build-context';\nimport { buildFilesPlugin } from './plugins';\n\nconst resolveBaseConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n 'process.env': ctx.env,\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n include: [\n // pre-bundle React dependencies to avoid React duplicates,\n // even if React dependencies are not direct dependencies\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n 'react',\n `react/jsx-runtime`,\n 'react-dom/client',\n 'styled-components',\n 'react-router-dom',\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n dedupe: ['react', 'react-dom', 'react-router-dom', 'styled-components'],\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","env","envPrefix","optimizeDeps","include","resolve","dedupe","plugins","react","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","strapi","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","alias","getMonorepoAliases","server","cors","middlewareMode","open","hmr","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;AAUA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAsBF,CAAAA,GAAAA,CAAIC,MAAM,CAAA;IAE/C,OAAO;AACLE,QAAAA,IAAAA,EAAMH,IAAII,GAAG;AACbC,QAAAA,IAAAA,EAAML,IAAIM,QAAQ;QAClBC,KAAO,EAAA;YACLC,WAAa,EAAA,KAAA;AACbC,YAAAA,MAAAA,EAAQT,IAAIU,OAAO;AACnBT,YAAAA;AACF,SAAA;QACAU,QAAU,EAAA,2BAAA;QACVC,UAAY,EAAA,KAAA;QACZC,MAAQ,EAAA;AACN,YAAA,aAAA,EAAeb,IAAIc;AACrB,SAAA;QACAC,SAAW,EAAA,eAAA;QACXC,YAAc,EAAA;YACZC,OAAS,EAAA;;;;AAIP,gBAAA,OAAA;AACA,gBAAA,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AAGC,kBAAmB,CAAA;AAAEH,oBAAAA;iBAAW;AACrC;AACF,SAAA;QACAI,MAAQ,EAAA;YACNC,IAAM,EAAA,KAAA;YACNC,cAAgB,EAAA,IAAA;YAChBC,IAAM5C,EAAAA,GAAAA,CAAIwB,OAAO,CAACoB,IAAI;YACtBC,GAAK,EAAA;gBACHJ,MAAQzC,EAAAA,GAAAA,CAAIwB,OAAO,CAACsB,SAAS;gBAC7BC,UAAY/C,EAAAA,GAAAA,CAAIwB,OAAO,CAACwB;AAC1B;AACF,SAAA;QACAC,OAAS,EAAA;AACX,KAAA;AACF;AAEA,MAAMC,YAAe,GAAA;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA;AAAiB,CAAA;AAItEC,MAAAA,yBAAAA,GAA4B,OAAOC,MAAsBpD,EAAAA,GAAAA,GAAAA;IAC7D,MAAMqD,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAclD,EAAAA,GAAAA,CAAAA;AAErE,IAAA,IAAIqD,UAAY,EAAA;AACd,QAAA,OAAOA,UAAWD,CAAAA,MAAAA,CAAAA;AACpB;IAEA,OAAOA,MAAAA;AACT;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../../src/node/vite/config.ts"],"sourcesContent":["import type { InlineConfig, UserConfig } from 'vite';\nimport browserslistToEsbuild from 'browserslist-to-esbuild';\nimport react from '@vitejs/plugin-react-swc';\n\nimport { getUserConfig } from '../core/config';\nimport { loadStrapiMonorepo } from '../core/monorepo';\nimport { getMonorepoAliases } from '../core/aliases';\nimport type { BuildContext } from '../create-build-context';\nimport { buildFilesPlugin } from './plugins';\n\nconst resolveBaseConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const target = browserslistToEsbuild(ctx.target);\n\n return {\n root: ctx.cwd,\n base: ctx.basePath,\n build: {\n emptyOutDir: false, // Rely on CLI to do this\n outDir: ctx.distDir,\n target,\n },\n cacheDir: 'node_modules/.strapi/vite',\n configFile: false,\n define: {\n 'process.env': ctx.env,\n },\n envPrefix: 'STRAPI_ADMIN_',\n optimizeDeps: {\n include: [\n // pre-bundle React dependencies to avoid React duplicates,\n // even if React dependencies are not direct dependencies\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n 'react',\n `react/jsx-runtime`,\n 'react-dom/client',\n 'styled-components',\n 'react-router-dom',\n ],\n },\n resolve: {\n // https://react.dev/warnings/invalid-hook-call-warning#duplicate-react\n dedupe: ['react', 'react-dom', 'react-router-dom', 'styled-components'],\n },\n plugins: [react(), buildFilesPlugin(ctx)],\n };\n};\n\nconst resolveProductionConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const {\n options: { minify, sourcemaps },\n } = ctx;\n\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n logLevel: 'silent',\n mode: 'production',\n build: {\n ...baseConfig.build,\n assetsDir: '',\n minify,\n sourcemap: sourcemaps,\n rollupOptions: {\n input: {\n strapi: ctx.entry,\n },\n },\n },\n };\n};\n\nconst resolveDevelopmentConfig = async (ctx: BuildContext): Promise<InlineConfig> => {\n const monorepo = await loadStrapiMonorepo(ctx.cwd);\n const baseConfig = await resolveBaseConfig(ctx);\n\n return {\n ...baseConfig,\n mode: 'development',\n resolve: {\n ...baseConfig.resolve,\n alias: {\n ...baseConfig.resolve?.alias,\n ...getMonorepoAliases({ monorepo }),\n },\n },\n server: {\n cors: false,\n middlewareMode: true,\n open: ctx.options.open,\n hmr: {\n overlay: false,\n server: ctx.options.hmrServer,\n clientPort: ctx.options.hmrClientPort,\n },\n },\n appType: 'custom',\n };\n};\n\nconst USER_CONFIGS = ['vite.config.js', 'vite.config.mjs', 'vite.config.ts'];\n\ntype UserViteConfig = (config: UserConfig) => UserConfig;\n\nconst mergeConfigWithUserConfig = async (config: InlineConfig, ctx: BuildContext) => {\n const userConfig = await getUserConfig<UserViteConfig>(USER_CONFIGS, ctx);\n\n if (userConfig) {\n return userConfig(config);\n }\n\n return config;\n};\n\nexport { mergeConfigWithUserConfig, resolveProductionConfig, resolveDevelopmentConfig };\n"],"names":["resolveBaseConfig","ctx","target","browserslistToEsbuild","root","cwd","base","basePath","build","emptyOutDir","outDir","distDir","cacheDir","configFile","define","env","envPrefix","optimizeDeps","include","resolve","dedupe","plugins","react","buildFilesPlugin","resolveProductionConfig","options","minify","sourcemaps","baseConfig","logLevel","mode","assetsDir","sourcemap","rollupOptions","input","strapi","entry","resolveDevelopmentConfig","monorepo","loadStrapiMonorepo","alias","getMonorepoAliases","server","cors","middlewareMode","open","hmr","overlay","hmrServer","clientPort","hmrClientPort","appType","USER_CONFIGS","mergeConfigWithUserConfig","config","userConfig","getUserConfig"],"mappings":";;;;;;;AAUA,MAAMA,oBAAoB,OAAOC,GAAAA,GAAAA;IAC/B,MAAMC,MAAAA,GAASC,qBAAsBF,CAAAA,GAAAA,CAAIC,MAAM,CAAA;IAE/C,OAAO;AACLE,QAAAA,IAAAA,EAAMH,IAAII,GAAG;AACbC,QAAAA,IAAAA,EAAML,IAAIM,QAAQ;QAClBC,KAAO,EAAA;YACLC,WAAa,EAAA,KAAA;AACbC,YAAAA,MAAAA,EAAQT,IAAIU,OAAO;AACnBT,YAAAA;AACF,SAAA;QACAU,QAAU,EAAA,2BAAA;QACVC,UAAY,EAAA,KAAA;QACZC,MAAQ,EAAA;AACN,YAAA,aAAA,EAAeb,IAAIc;AACrB,SAAA;QACAC,SAAW,EAAA,eAAA;QACXC,YAAc,EAAA;YACZC,OAAS,EAAA;;;;AAIP,gBAAA,OAAA;AACA,gBAAA,CAAC,iBAAiB,CAAC;AACnB,gBAAA,kBAAA;AACA,gBAAA,mBAAA;AACA,gBAAA;AACD;AACH,SAAA;QACAC,OAAS,EAAA;;YAEPC,MAAQ,EAAA;AAAC,gBAAA,OAAA;AAAS,gBAAA,WAAA;AAAa,gBAAA,kBAAA;AAAoB,gBAAA;AAAoB;AACzE,SAAA;QACAC,OAAS,EAAA;AAACC,YAAAA,KAAAA,EAAAA;YAASC,gBAAiBtB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,SAAS;gBAC7BC,UAAYhD,EAAAA,GAAAA,CAAIwB,OAAO,CAACyB;AAC1B;AACF,SAAA;QACAC,OAAS,EAAA;AACX,KAAA;AACF;AAEA,MAAMC,YAAe,GAAA;AAAC,IAAA,gBAAA;AAAkB,IAAA,iBAAA;AAAmB,IAAA;AAAiB,CAAA;AAItEC,MAAAA,yBAAAA,GAA4B,OAAOC,MAAsBrD,EAAAA,GAAAA,GAAAA;IAC7D,MAAMsD,UAAAA,GAAa,MAAMC,aAAAA,CAA8BJ,YAAcnD,EAAAA,GAAAA,CAAAA;AAErE,IAAA,IAAIsD,UAAY,EAAA;AACd,QAAA,OAAOA,UAAWD,CAAAA,MAAAA,CAAAA;AACpB;IAEA,OAAOA,MAAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "5.13.0",
3
+ "version": "5.14.0",
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",
@@ -110,24 +110,24 @@
110
110
  },
111
111
  "dependencies": {
112
112
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
113
- "@strapi/admin": "5.13.0",
114
- "@strapi/cloud-cli": "5.13.0",
115
- "@strapi/content-manager": "5.13.0",
116
- "@strapi/content-releases": "5.13.0",
117
- "@strapi/content-type-builder": "5.13.0",
118
- "@strapi/core": "5.13.0",
119
- "@strapi/data-transfer": "5.13.0",
120
- "@strapi/database": "5.13.0",
121
- "@strapi/email": "5.13.0",
122
- "@strapi/generators": "5.13.0",
123
- "@strapi/i18n": "5.13.0",
124
- "@strapi/logger": "5.13.0",
125
- "@strapi/permissions": "5.13.0",
126
- "@strapi/review-workflows": "5.13.0",
127
- "@strapi/types": "5.13.0",
128
- "@strapi/typescript-utils": "5.13.0",
129
- "@strapi/upload": "5.13.0",
130
- "@strapi/utils": "5.13.0",
113
+ "@strapi/admin": "5.14.0",
114
+ "@strapi/cloud-cli": "5.14.0",
115
+ "@strapi/content-manager": "5.14.0",
116
+ "@strapi/content-releases": "5.14.0",
117
+ "@strapi/content-type-builder": "5.14.0",
118
+ "@strapi/core": "5.14.0",
119
+ "@strapi/data-transfer": "5.14.0",
120
+ "@strapi/database": "5.14.0",
121
+ "@strapi/email": "5.14.0",
122
+ "@strapi/generators": "5.14.0",
123
+ "@strapi/i18n": "5.14.0",
124
+ "@strapi/logger": "5.14.0",
125
+ "@strapi/permissions": "5.14.0",
126
+ "@strapi/review-workflows": "5.14.0",
127
+ "@strapi/types": "5.14.0",
128
+ "@strapi/typescript-utils": "5.14.0",
129
+ "@strapi/upload": "5.14.0",
130
+ "@strapi/utils": "5.14.0",
131
131
  "@types/nodemon": "1.19.6",
132
132
  "@vitejs/plugin-react-swc": "3.6.0",
133
133
  "boxen": "5.1.2",
@@ -181,11 +181,11 @@
181
181
  "@types/node": "18.19.24",
182
182
  "@types/webpack-bundle-analyzer": "4.7.0",
183
183
  "@types/webpack-hot-middleware": "2.25.9",
184
- "eslint-config-custom": "5.13.0",
184
+ "eslint-config-custom": "5.14.0",
185
185
  "jest": "29.6.0",
186
186
  "react": "18.3.1",
187
187
  "react-dom": "18.3.1",
188
- "tsconfig": "5.13.0"
188
+ "tsconfig": "5.14.0"
189
189
  },
190
190
  "peerDependencies": {
191
191
  "react": "^17.0.0 || ^18.0.0",