@strapi/strapi 5.0.0-beta.9 → 5.0.0-rc.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.
Files changed (45) hide show
  1. package/LICENSE +18 -3
  2. package/README.md +4 -4
  3. package/dist/cli/commands/build.d.ts.map +1 -1
  4. package/dist/cli/commands/build.js +0 -6
  5. package/dist/cli/commands/build.js.map +1 -1
  6. package/dist/cli/commands/build.mjs +0 -6
  7. package/dist/cli/commands/build.mjs.map +1 -1
  8. package/dist/cli/commands/index.d.ts.map +1 -1
  9. package/dist/cli/commands/index.js +5 -0
  10. package/dist/cli/commands/index.js.map +1 -1
  11. package/dist/cli/commands/index.mjs +5 -0
  12. package/dist/cli/commands/index.mjs.map +1 -1
  13. package/dist/cli/commands/plugin/init/files/typescript.d.ts +9 -0
  14. package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +1 -0
  15. package/dist/cli/index.js +3 -3
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/cli/index.mjs +3 -3
  18. package/dist/cli/index.mjs.map +1 -1
  19. package/dist/cli/types.d.ts +1 -1
  20. package/dist/cli/types.d.ts.map +1 -1
  21. package/dist/cli/utils/logger.d.ts +4 -1
  22. package/dist/cli/utils/logger.d.ts.map +1 -1
  23. package/dist/cli/utils/logger.js +68 -13
  24. package/dist/cli/utils/logger.js.map +1 -1
  25. package/dist/cli/utils/logger.mjs +49 -13
  26. package/dist/cli/utils/logger.mjs.map +1 -1
  27. package/dist/node/core/aliases.d.ts.map +1 -1
  28. package/dist/node/core/aliases.js +1 -0
  29. package/dist/node/core/aliases.js.map +1 -1
  30. package/dist/node/core/aliases.mjs +1 -0
  31. package/dist/node/core/aliases.mjs.map +1 -1
  32. package/dist/node/core/dependencies.d.ts.map +1 -1
  33. package/dist/node/core/dependencies.js +4 -0
  34. package/dist/node/core/dependencies.js.map +1 -1
  35. package/dist/node/core/dependencies.mjs +4 -0
  36. package/dist/node/core/dependencies.mjs.map +1 -1
  37. package/dist/node/create-build-context.js +1 -1
  38. package/dist/node/create-build-context.js.map +1 -1
  39. package/dist/node/create-build-context.mjs +1 -1
  40. package/dist/node/create-build-context.mjs.map +1 -1
  41. package/dist/node/vite/config.js +1 -1
  42. package/dist/node/vite/config.js.map +1 -1
  43. package/dist/node/vite/config.mjs +1 -1
  44. package/dist/node/vite/config.mjs.map +1 -1
  45. package/package.json +25 -22
package/LICENSE CHANGED
@@ -2,7 +2,21 @@ Copyright (c) 2015-present Strapi Solutions SAS
2
2
 
3
3
  Portions of the Strapi software are licensed as follows:
4
4
 
5
- * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined in "ee/LICENSE".
5
+ * All software that resides under an "ee/" directory (the “EE Software”), if that directory exists, is licensed under the license defined below.
6
+
7
+ Enterprise License
8
+
9
+ If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
10
+ https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
11
+ represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
12
+ agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
13
+ Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
14
+
15
+ BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
16
+ IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
17
+ HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
18
+ THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
19
+ IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
6
20
 
7
21
  * All software outside of the above-mentioned directories or restrictions above is available under the "MIT Expat" license as set forth below.
8
22
 
@@ -18,5 +32,6 @@ furnished to do so, subject to the following conditions:
18
32
  The above copyright notice and this permission notice shall be included in all
19
33
  copies or substantial portions of the Software.
20
34
 
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
37
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -59,18 +59,18 @@ Install Strapi with this **Quickstart** command to create a Strapi project insta
59
59
  - (Use **yarn** to install the Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
60
60
 
61
61
  ```bash
62
- yarn create strapi-app my-project --quickstart
62
+ yarn create strapi
63
63
  ```
64
64
 
65
65
  **or**
66
66
 
67
- - (Use npm/npx to install the Strapi project.)
67
+ - (Using npx to install the Strapi project.)
68
68
 
69
69
  ```bash
70
- npx create-strapi-app my-project --quickstart
70
+ npx create-strapi@latest
71
71
  ```
72
72
 
73
- This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload). The **Quickstart** command installs Strapi using a **SQLite** database which is used for prototyping in development.
73
+ This command generates a brand new project with the default features (authentication, permissions, content management, content type builder & file upload).
74
74
 
75
75
  Enjoy 🎉
76
76
 
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAgC9C;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAYd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqB9C;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAYd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -10,12 +10,6 @@ const action = async (options) => {
10
10
  "[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
11
11
  );
12
12
  }
13
- process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
14
- if (process.env.NODE_ENV !== "production") {
15
- options.logger.warn(
16
- "[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior."
17
- );
18
- }
19
13
  await build.build(options);
20
14
  } catch (err) {
21
15
  errors.handleUnexpectedError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n /**\n * ENFORCE NODE_ENV to production when building\n */\n process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';\n\n if (process.env.NODE_ENV !== 'production') {\n options.logger.warn(\n '[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild","handleUnexpectedError","createCommand"],"mappings":";;;;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAKA,YAAQ,IAAI,WAAW,QAAQ,IAAI,YAAY;AAE3C,QAAA,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAAA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZC,WAAA,sBAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;;"}
1
+ {"version":3,"file":"build.js","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild","handleUnexpectedError","createCommand"],"mappings":";;;;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAAA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZC,WAAA,sBAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAOC,UAAAA,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;;"}
@@ -8,12 +8,6 @@ const action = async (options) => {
8
8
  "[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite."
9
9
  );
10
10
  }
11
- process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
12
- if (process.env.NODE_ENV !== "production") {
13
- options.logger.warn(
14
- "[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior."
15
- );
16
- }
17
11
  await build(options);
18
12
  } catch (err) {
19
13
  handleUnexpectedError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"build.mjs","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n /**\n * ENFORCE NODE_ENV to production when building\n */\n process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';\n\n if (process.env.NODE_ENV !== 'production') {\n options.logger.warn(\n '[@strapi/strapi]: The NODE_ENV is not set to production. This may result in unexpected behavior.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild"],"mappings":";;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAKA,YAAQ,IAAI,WAAW,QAAQ,IAAI,YAAY;AAE3C,QAAA,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZ,0BAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAO,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;"}
1
+ {"version":3,"file":"build.mjs","sources":["../../../src/cli/commands/build.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport type { StrapiCommand } from '../types';\n\nimport { build as nodeBuild, BuildOptions } from '../../node/build';\nimport { handleUnexpectedError } from '../../node/core/errors';\n\ntype BuildCLIOptions = BuildOptions;\n\nconst action = async (options: BuildCLIOptions) => {\n try {\n if (options.bundler === 'webpack') {\n options.logger.warn(\n '[@strapi/strapi]: Using webpack as a bundler is deprecated. You should migrate to vite.'\n );\n }\n\n await nodeBuild(options);\n } catch (err) {\n handleUnexpectedError(err);\n }\n};\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ ctx }) => {\n return createCommand('build')\n .option('--bundler [bundler]', 'Bundler to use (webpack or vite)', 'vite')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--minify', 'Minify the output', true)\n .option('--silent', \"Don't log anything\", false)\n .option('--sourcemap', 'Produce sourcemaps', false)\n .option('--stats', 'Print build statistics to the console', false)\n .description('Build the strapi admin app')\n .action(async (options: BuildCLIOptions) => {\n return action({ ...options, ...ctx });\n });\n};\n\nexport { command };\n"],"names":["nodeBuild"],"mappings":";;;AAQA,MAAM,SAAS,OAAO,YAA6B;AAC7C,MAAA;AACE,QAAA,QAAQ,YAAY,WAAW;AACjC,cAAQ,OAAO;AAAA,QACb;AAAA,MAAA;AAAA,IAEJ;AAEA,UAAMA,MAAU,OAAO;AAAA,WAChB,KAAK;AACZ,0BAAsB,GAAG;AAAA,EAC3B;AACF;AAKA,MAAM,UAAyB,CAAC,EAAE,UAAU;AAC1C,SAAO,cAAc,OAAO,EACzB,OAAO,uBAAuB,oCAAoC,MAAM,EACxE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,qBAAqB,IAAI,EAC5C,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,eAAe,sBAAsB,KAAK,EACjD,OAAO,WAAW,yCAAyC,KAAK,EAChE,YAAY,4BAA4B,EACxC,OAAO,OAAO,YAA6B;AAC1C,WAAO,OAAO,EAAE,GAAG,SAAS,GAAG,IAAK,CAAA;AAAA,EAAA,CACrC;AACL;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,EAAE,aAAa,EA2BnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,QAAQ,EAAE,aAAa,EAgCnC,CAAC"}
@@ -53,6 +53,11 @@ const commands = [
53
53
  command,
54
54
  command$1,
55
55
  command$2
56
+ /**
57
+ * Cloud
58
+ */
59
+ // TODO V5: Uncomment when cloud-cli is ready
60
+ // cloudCommands,
56
61
  ];
57
62
  exports.commands = commands;
58
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,WAA4B;AAAA,EACvCA,WAAA;AAAA,EACAC,kBAAA;AAAA,EACAC,KAAA;AAAA,EACAC,KAAA;AAAA,EACAC,QAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,SAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,WAAA;AAAA,EACAC,cAAA;AAAA,EACAC,QAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AACF;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["// import { buildStrapiCloudCommands as cloudCommands } from '@strapi/cloud-cli';\n\nimport { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n /**\n * Cloud\n */\n // TODO V5: Uncomment when cloud-cli is ready\n // cloudCommands,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,WAA4B;AAAA,EACvCA,WAAA;AAAA,EACAC,kBAAA;AAAA,EACAC,KAAA;AAAA,EACAC,KAAA;AAAA,EACAC,QAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,SAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,OAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC,OAAA;AAAA,EACAC,WAAA;AAAA,EACAC,cAAA;AAAA,EACAC,QAAA;AAAA,EACAC,MAAA;AAAA,EACAC,QAAA;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAMF;;"}
@@ -51,6 +51,11 @@ const commands = [
51
51
  command$n,
52
52
  command$o,
53
53
  command$p
54
+ /**
55
+ * Cloud
56
+ */
57
+ // TODO V5: Uncomment when cloud-cli is ready
58
+ // cloudCommands,
54
59
  ];
55
60
  export {
56
61
  commands
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,WAA4B;AAAA,EACvCA;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AACF;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["// import { buildStrapiCloudCommands as cloudCommands } from '@strapi/cloud-cli';\n\nimport { command as createAdminUser } from './admin/create-user';\nimport { command as resetAdminUserPassword } from './admin/reset-user-password';\nimport { command as listComponents } from './components/list';\nimport { command as configurationDump } from './configuration/dump';\nimport { command as configurationRestore } from './configuration/restore';\nimport { command as listContentTypes } from './content-types/list';\nimport { command as listControllers } from './controllers/list';\nimport { command as listHooks } from './hooks/list';\nimport { command as listMiddlewares } from './middlewares/list';\nimport { command as listPolicies } from './policies/list';\nimport { command as listRoutes } from './routes/list';\nimport { command as listServices } from './services/list';\nimport { command as disableTelemetry } from './telemetry/disable';\nimport { command as enableTelemetry } from './telemetry/enable';\nimport { command as generateTemplates } from './templates/generate';\nimport { command as generateTsTypes } from './ts/generate-types';\nimport { command as buildCommand } from './build';\nimport { command as consoleCommand } from './console';\nimport { command as developCommand } from './develop';\nimport { command as generateCommand } from './generate';\nimport { command as reportCommand } from './report';\nimport { command as startCommand } from './start';\nimport { command as versionCommand } from './version';\nimport exportCommand from './export/command';\nimport importCommand from './import/command';\nimport transferCommand from './transfer/command';\n\nimport { StrapiCommand } from '../types';\n\nexport const commands: StrapiCommand[] = [\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n listMiddlewares,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n versionCommand,\n buildCommand,\n developCommand,\n exportCommand,\n importCommand,\n transferCommand,\n /**\n * Cloud\n */\n // TODO V5: Uncomment when cloud-cli is ready\n // cloudCommands,\n];\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","listMiddlewares","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","versionCommand","buildCommand","developCommand","exportCommand","importCommand","transferCommand"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,WAA4B;AAAA,EACvCA;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAMF;"}
@@ -0,0 +1,9 @@
1
+ import { TemplateFile } from '@strapi/pack-up';
2
+ interface TsConfigFiles {
3
+ tsconfigFile: TemplateFile;
4
+ tsconfigBuildFile: TemplateFile;
5
+ }
6
+ declare const ADMIN: TsConfigFiles;
7
+ declare const SERVER: TsConfigFiles;
8
+ export { ADMIN as adminTsconfigFiles, SERVER as serverTsconfigFiles };
9
+ //# sourceMappingURL=typescript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/plugin/init/files/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,UAAU,aAAa;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,YAAY,CAAC;CACjC;AAED,QAAA,MAAM,KAAK,EAAE,aA4CZ,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,aA0Cb,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,IAAI,mBAAmB,EAAE,CAAC"}
package/dist/cli/index.js CHANGED
@@ -28,16 +28,16 @@ const createCLI = async (argv, command = new commander.Command()) => {
28
28
  logger: logger$1,
29
29
  tsconfig: tsconfig$1
30
30
  };
31
- index.commands.forEach((commandFactory) => {
31
+ for (const commandFactory of index.commands) {
32
32
  try {
33
- const subCommand = commandFactory({ command, argv, ctx });
33
+ const subCommand = await commandFactory({ command, argv, ctx });
34
34
  if (subCommand) {
35
35
  command.addCommand(subCommand);
36
36
  }
37
37
  } catch (e) {
38
38
  console.error(`Failed to load command`, e);
39
39
  }
40
- });
40
+ }
41
41
  const deprecatedCommands = [
42
42
  { name: "plugin:init", message: "Please use `npx @strapi/sdk-plugin init` instead." },
43
43
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n strapiCommands.forEach((commandFactory) => {\n try {\n const subCommand = commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n });\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["Command","logger","createLogger","tsconfig","loadTsConfig","strapiCommands"],"mappings":";;;;;;AAQA,MAAM,YAAY,OAAO,MAAgB,UAAU,IAAIA,wBAAc;AAEnE,UAAQ,yBAAyB,KAAK,EAAE,mBAAmB,IAAI;AAGvD,UAAA,WAAW,cAAc,0BAA0B;AACnD,UAAA,eAAe,kBAAkB,0BAA0B;AAE3D,UAAA;AAAA;AAAA,IAEN,QAAQ,oBAAoB,EAAE;AAAA,IAC9B;AAAA,IACA;AAAA,EAAA;AAGI,QAAA,MAAM,QAAQ;AAEd,QAAA,WAAW,KAAK,SAAS,SAAS;AAClC,QAAA,YAAY,KAAK,SAAS,UAAU;AAEpC,QAAAC,WAASC,oBAAa,EAAE,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAA,CAAO;AAEpF,QAAMC,aAAWC,SAAAA,aAAa;AAAA,IAC5B;AAAA,IACA,MAAM;AAAA,IAAA,QACNH;AAAAA,EAAA,CACD;AAED,QAAM,MAAM;AAAA,IACV;AAAA,IAAA,QACAA;AAAAA,IAAA,UACAE;AAAAA,EAAA;AAIaE,iBAAA,QAAQ,CAAC,mBAAmB;AACrC,QAAA;AACF,YAAM,aAAa,eAAe,EAAE,SAAS,MAAM,KAAK;AAGxD,UAAI,YAAY;AACd,gBAAQ,WAAW,UAAU;AAAA,MAC/B;AAAA,aACO,GAAG;AACF,cAAA,MAAM,0BAA0B,CAAC;AAAA,IAC3C;AAAA,EAAA,CACD;AAGD,QAAM,qBAAqB;AAAA,IACzB,EAAE,MAAM,eAAe,SAAS,oDAAoD;AAAA,IACpF;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EAAA;AAIF,qBAAmB,QAAQ,CAAC,EAAE,MAAM,cAAc;AAChD,UAAM,aAAa,IAAIL,kBAAQ,IAAI,EAChC,QAAQ,IAAI,EACZ,YAAY,cAAc,EAC1B,OAAO,MAAM;AACJ,cAAA;AAAA,QACN,eAAe,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAIA,UAAAA,cAAc;AACrE,QAAM,WAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAA,SAAS,WAAW,IAAI;AAChC;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["Command","logger","createLogger","tsconfig","loadTsConfig","strapiCommands"],"mappings":";;;;;;AAQA,MAAM,YAAY,OAAO,MAAgB,UAAU,IAAIA,wBAAc;AAEnE,UAAQ,yBAAyB,KAAK,EAAE,mBAAmB,IAAI;AAGvD,UAAA,WAAW,cAAc,0BAA0B;AACnD,UAAA,eAAe,kBAAkB,0BAA0B;AAE3D,UAAA;AAAA;AAAA,IAEN,QAAQ,oBAAoB,EAAE;AAAA,IAC9B;AAAA,IACA;AAAA,EAAA;AAGI,QAAA,MAAM,QAAQ;AAEd,QAAA,WAAW,KAAK,SAAS,SAAS;AAClC,QAAA,YAAY,KAAK,SAAS,UAAU;AAEpC,QAAAC,WAASC,oBAAa,EAAE,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAA,CAAO;AAEpF,QAAMC,aAAWC,SAAAA,aAAa;AAAA,IAC5B;AAAA,IACA,MAAM;AAAA,IAAA,QACNH;AAAAA,EAAA,CACD;AAED,QAAM,MAAM;AAAA,IACV;AAAA,IAAA,QACAA;AAAAA,IAAA,UACAE;AAAAA,EAAA;AAIF,aAAW,kBAAkBE,gBAAgB;AACvC,QAAA;AACF,YAAM,aAAa,MAAM,eAAe,EAAE,SAAS,MAAM,KAAK;AAG9D,UAAI,YAAY;AACd,gBAAQ,WAAW,UAAU;AAAA,MAC/B;AAAA,aACO,GAAG;AACF,cAAA,MAAM,0BAA0B,CAAC;AAAA,IAC3C;AAAA,EACF;AAGA,QAAM,qBAAqB;AAAA,IACzB,EAAE,MAAM,eAAe,SAAS,oDAAoD;AAAA,IACpF;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EAAA;AAIF,qBAAmB,QAAQ,CAAC,EAAE,MAAM,cAAc;AAChD,UAAM,aAAa,IAAIL,kBAAQ,IAAI,EAChC,QAAQ,IAAI,EACZ,YAAY,cAAc,EAC1B,OAAO,MAAM;AACJ,cAAA;AAAA,QACN,eAAe,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAIA,UAAAA,cAAc;AACrE,QAAM,WAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAA,SAAS,WAAW,IAAI;AAChC;;;"}
@@ -26,16 +26,16 @@ const createCLI = async (argv, command = new Command()) => {
26
26
  logger,
27
27
  tsconfig
28
28
  };
29
- commands.forEach((commandFactory) => {
29
+ for (const commandFactory of commands) {
30
30
  try {
31
- const subCommand = commandFactory({ command, argv, ctx });
31
+ const subCommand = await commandFactory({ command, argv, ctx });
32
32
  if (subCommand) {
33
33
  command.addCommand(subCommand);
34
34
  }
35
35
  } catch (e) {
36
36
  console.error(`Failed to load command`, e);
37
37
  }
38
- });
38
+ }
39
39
  const deprecatedCommands = [
40
40
  { name: "plugin:init", message: "Please use `npx @strapi/sdk-plugin init` instead." },
41
41
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n strapiCommands.forEach((commandFactory) => {\n try {\n const subCommand = commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n });\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["str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,YAAY,cAAc,EAC1B,OAAO,MAAM;AACJ,cAAA;AAAA,QACN,eAAe,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAI,cAAc;AACrE,QAAMC,YAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAAA,UAAS,WAAW,IAAI;AAChC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/cli/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport { commands as strapiCommands } from './commands';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst createCLI = async (argv: string[], command = new Command()) => {\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n command.version(\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('../../package.json').version,\n '-v, --version',\n 'Output the version number'\n );\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n for (const commandFactory of strapiCommands) {\n try {\n const subCommand = await commandFactory({ command, argv, ctx });\n\n // Add this command to the Commander command object\n if (subCommand) {\n command.addCommand(subCommand);\n }\n } catch (e) {\n console.error(`Failed to load command`, e);\n }\n }\n\n // TODO v6: remove these deprecation notices\n const deprecatedCommands = [\n { name: 'plugin:init', message: 'Please use `npx @strapi/sdk-plugin init` instead.' },\n {\n name: 'plugin:verify',\n message: 'After migrating your plugin to v5, use `strapi-plugin verify`',\n },\n {\n name: 'plugin:watch',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch`',\n },\n {\n name: 'plugin:watch:link',\n message: 'After migrating your plugin to v5, use `strapi-plugin watch:link`',\n },\n {\n name: 'plugin:build',\n message: 'After migrating your plugin to v5, use `strapi-plugin build`',\n },\n ];\n\n // Add hidden commands for deprecatedCommands that output a warning that the command has been removed.\n deprecatedCommands.forEach(({ name, message }) => {\n const deprecated = new Command(name)\n .command(name)\n .description('(deprecated)')\n .action(() => {\n console.warn(\n `The command ${name} has been deprecated. See the Strapi 5 migration guide for more information.`\n );\n if (message) {\n console.warn(message);\n }\n });\n command.addCommand(deprecated, { hidden: true });\n });\n return command;\n};\n\nconst runCLI = async (argv = process.argv, command = new Command()) => {\n const commands = await createCLI(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runCLI, createCLI };\n"],"names":["strapiCommands","commands"],"mappings":";;;;AAQA,MAAM,YAAY,OAAO,MAAgB,UAAU,IAAI,cAAc;AAEnE,UAAQ,yBAAyB,KAAK,EAAE,mBAAmB,IAAI;AAGvD,UAAA,WAAW,cAAc,0BAA0B;AACnD,UAAA,eAAe,kBAAkB,0BAA0B;AAE3D,UAAA;AAAA;AAAA,IAEN,QAAQ,oBAAoB,EAAE;AAAA,IAC9B;AAAA,IACA;AAAA,EAAA;AAGI,QAAA,MAAM,QAAQ;AAEd,QAAA,WAAW,KAAK,SAAS,SAAS;AAClC,QAAA,YAAY,KAAK,SAAS,UAAU;AAEpC,QAAA,SAAS,aAAa,EAAE,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAA,CAAO;AAEpF,QAAM,WAAW,aAAa;AAAA,IAC5B;AAAA,IACA,MAAM;AAAA,IACN;AAAA,EAAA,CACD;AAED,QAAM,MAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAIF,aAAW,kBAAkBA,UAAgB;AACvC,QAAA;AACF,YAAM,aAAa,MAAM,eAAe,EAAE,SAAS,MAAM,KAAK;AAG9D,UAAI,YAAY;AACd,gBAAQ,WAAW,UAAU;AAAA,MAC/B;AAAA,aACO,GAAG;AACF,cAAA,MAAM,0BAA0B,CAAC;AAAA,IAC3C;AAAA,EACF;AAGA,QAAM,qBAAqB;AAAA,IACzB,EAAE,MAAM,eAAe,SAAS,oDAAoD;AAAA,IACpF;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EAAA;AAIF,qBAAmB,QAAQ,CAAC,EAAE,MAAM,cAAc;AAChD,UAAM,aAAa,IAAI,QAAQ,IAAI,EAChC,QAAQ,IAAI,EACZ,YAAY,cAAc,EAC1B,OAAO,MAAM;AACJ,cAAA;AAAA,QACN,eAAe,IAAI;AAAA,MAAA;AAErB,UAAI,SAAS;AACX,gBAAQ,KAAK,OAAO;AAAA,MACtB;AAAA,IAAA,CACD;AACH,YAAQ,WAAW,YAAY,EAAE,QAAQ,KAAM,CAAA;AAAA,EAAA,CAChD;AACM,SAAA;AACT;AAEM,MAAA,SAAS,OAAO,OAAO,QAAQ,MAAM,UAAU,IAAI,cAAc;AACrE,QAAMC,YAAW,MAAM,UAAU,MAAM,OAAO;AACxC,QAAAA,UAAS,WAAW,IAAI;AAChC;"}
@@ -10,5 +10,5 @@ export type StrapiCommand = (params: {
10
10
  command: Command;
11
11
  argv: string[];
12
12
  ctx: CLIContext;
13
- }) => void | Command;
13
+ }) => void | Command | Promise<void | Command>;
14
14
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;CACjB,KAAK,IAAI,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;CACjB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import ora from 'ora';
2
+ import * as cliProgress from 'cli-progress';
2
3
  export interface LoggerOptions {
3
4
  silent?: boolean;
4
5
  debug?: boolean;
@@ -9,10 +10,12 @@ export interface Logger {
9
10
  errors: number;
10
11
  debug: (...args: unknown[]) => void;
11
12
  info: (...args: unknown[]) => void;
13
+ success: (...args: unknown[]) => void;
12
14
  warn: (...args: unknown[]) => void;
13
15
  error: (...args: unknown[]) => void;
14
16
  log: (...args: unknown[]) => void;
15
- spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;
17
+ spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text' | 'isSpinning'>;
18
+ progressBar: (totalSize: number, text: string) => Pick<cliProgress.SingleBar, 'start' | 'stop' | 'update'>;
16
19
  }
17
20
  declare const createLogger: (options?: LoggerOptions) => Logger;
18
21
  export { createLogger };
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;CACjF;AAED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AAY,aAAa,aAAa,KAAQ,MA2GnD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -2,9 +2,53 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const chalk = require("chalk");
4
4
  const ora = require("ora");
5
+ const cliProgress = require("cli-progress");
5
6
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule)
9
+ return e;
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
6
25
  const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
7
26
  const ora__default = /* @__PURE__ */ _interopDefault(ora);
27
+ const cliProgress__namespace = /* @__PURE__ */ _interopNamespace(cliProgress);
28
+ const silentSpinner = {
29
+ succeed() {
30
+ return this;
31
+ },
32
+ fail() {
33
+ return this;
34
+ },
35
+ start() {
36
+ return this;
37
+ },
38
+ text: "",
39
+ isSpinning: false
40
+ };
41
+ const silentProgressBar = {
42
+ start() {
43
+ return this;
44
+ },
45
+ stop() {
46
+ return this;
47
+ },
48
+ update() {
49
+ return this;
50
+ }
51
+ };
8
52
  const createLogger = (options = {}) => {
9
53
  const { silent = false, debug = false, timestamp = true } = options;
10
54
  const state = { errors: 0, warning: 0 };
@@ -39,6 +83,15 @@ const createLogger = (options = {}) => {
39
83
  }
40
84
  console.info(chalk__default.default.blue(`${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`), ...args);
41
85
  },
86
+ success(...args) {
87
+ if (silent) {
88
+ return;
89
+ }
90
+ console.info(
91
+ chalk__default.default.green(`[SUCCESS]${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`),
92
+ ...args
93
+ );
94
+ },
42
95
  warn(...args) {
43
96
  state.warning += 1;
44
97
  if (silent) {
@@ -59,23 +112,25 @@ const createLogger = (options = {}) => {
59
112
  ...args
60
113
  );
61
114
  },
62
- // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.
63
115
  spinner(text) {
64
116
  if (silent) {
65
- return {
66
- succeed() {
67
- return this;
68
- },
69
- fail() {
70
- return this;
71
- },
72
- start() {
73
- return this;
74
- },
75
- text: ""
76
- };
117
+ return silentSpinner;
77
118
  }
78
119
  return ora__default.default(text);
120
+ },
121
+ progressBar(totalSize, text) {
122
+ if (silent) {
123
+ return silentProgressBar;
124
+ }
125
+ const progressBar = new cliProgress__namespace.SingleBar({
126
+ format: `${text ? `${text} |` : ""}${chalk__default.default.green("{bar}")}| {percentage}%`,
127
+ barCompleteChar: "█",
128
+ barIncompleteChar: "░",
129
+ hideCursor: true,
130
+ forceRedraw: true
131
+ });
132
+ progressBar.start(totalSize, 0);
133
+ return progressBar;
79
134
  }
80
135
  };
81
136
  };
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sources":["../../../src/cli/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora from 'ora';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.\n spinner(text: string) {\n if (silent) {\n return {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n };\n }\n\n return ora(text);\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk","ora"],"mappings":";;;;;;;AAoBA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,KAAK,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACzE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA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import ora, { Ora } from 'ora';\nimport * as cliProgress from 'cli-progress';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n success: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text' | 'isSpinning'>;\n progressBar: (\n totalSize: number,\n text: string\n ) => Pick<cliProgress.SingleBar, 'start' | 'stop' | 'update'>;\n}\n\nconst silentSpinner = {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n isSpinning: false,\n} as Ora;\n\nconst silentProgressBar = {\n start() {\n return this;\n },\n stop() {\n return this;\n },\n update() {\n return this;\n },\n} as unknown as cliProgress.SingleBar;\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n success(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.green(`[SUCCESS]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n spinner(text: string) {\n if (silent) {\n return silentSpinner;\n }\n\n return ora(text);\n },\n\n progressBar(totalSize: number, text: string) {\n if (silent) {\n return silentProgressBar;\n }\n\n const progressBar = new cliProgress.SingleBar({\n format: `${text ? `${text} |` : ''}${chalk.green('{bar}')}| {percentage}%`,\n barCompleteChar: '\\u2588',\n barIncompleteChar: '\\u2591',\n hideCursor: true,\n forceRedraw: true,\n });\n\n progressBar.start(totalSize, 0);\n\n return progressBar;\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk","ora","cliProgress"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AAAA,EACpB,UAAU;AACD,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,MAAM;AAAA,EACN,YAAY;AACd;AAEA,MAAM,oBAAoB;AAAA,EACxB,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,SAAS;AACA,WAAA;AAAA,EACT;AACF;AAEA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,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AA,IAEA,QAAQ,MAAc;AACpB,UAAI,QAAQ;AACH,eAAA;AAAA,MACT;AAEA,aAAOC,aAAAA,QAAI,IAAI;AAAA,IACjB;AAAA,IAEA,YAAY,WAAmB,MAAc;AAC3C,UAAI,QAAQ;AACH,eAAA;AAAA,MACT;AAEM,YAAA,cAAc,IAAIC,uBAAY,UAAU;AAAA,QAC5C,QAAQ,GAAG,OAAO,GAAG,IAAI,OAAO,EAAE,GAAGF,eAAAA,QAAM,MAAM,OAAO,CAAC;AAAA,QACzD,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,QACnB,YAAY;AAAA,QACZ,aAAa;AAAA,MAAA,CACd;AAEW,kBAAA,MAAM,WAAW,CAAC;AAEvB,aAAA;AAAA,IACT;AAAA,EAAA;AAEJ;;"}
@@ -1,5 +1,30 @@
1
1
  import chalk from "chalk";
2
2
  import ora from "ora";
3
+ import * as cliProgress from "cli-progress";
4
+ const silentSpinner = {
5
+ succeed() {
6
+ return this;
7
+ },
8
+ fail() {
9
+ return this;
10
+ },
11
+ start() {
12
+ return this;
13
+ },
14
+ text: "",
15
+ isSpinning: false
16
+ };
17
+ const silentProgressBar = {
18
+ start() {
19
+ return this;
20
+ },
21
+ stop() {
22
+ return this;
23
+ },
24
+ update() {
25
+ return this;
26
+ }
27
+ };
3
28
  const createLogger = (options = {}) => {
4
29
  const { silent = false, debug = false, timestamp = true } = options;
5
30
  const state = { errors: 0, warning: 0 };
@@ -34,6 +59,15 @@ const createLogger = (options = {}) => {
34
59
  }
35
60
  console.info(chalk.blue(`${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`), ...args);
36
61
  },
62
+ success(...args) {
63
+ if (silent) {
64
+ return;
65
+ }
66
+ console.info(
67
+ chalk.green(`[SUCCESS]${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`),
68
+ ...args
69
+ );
70
+ },
37
71
  warn(...args) {
38
72
  state.warning += 1;
39
73
  if (silent) {
@@ -54,23 +88,25 @@ const createLogger = (options = {}) => {
54
88
  ...args
55
89
  );
56
90
  },
57
- // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.
58
91
  spinner(text) {
59
92
  if (silent) {
60
- return {
61
- succeed() {
62
- return this;
63
- },
64
- fail() {
65
- return this;
66
- },
67
- start() {
68
- return this;
69
- },
70
- text: ""
71
- };
93
+ return silentSpinner;
72
94
  }
73
95
  return ora(text);
96
+ },
97
+ progressBar(totalSize, text) {
98
+ if (silent) {
99
+ return silentProgressBar;
100
+ }
101
+ const progressBar = new cliProgress.SingleBar({
102
+ format: `${text ? `${text} |` : ""}${chalk.green("{bar}")}| {percentage}%`,
103
+ barCompleteChar: "█",
104
+ barIncompleteChar: "░",
105
+ hideCursor: true,
106
+ forceRedraw: true
107
+ });
108
+ progressBar.start(totalSize, 0);
109
+ return progressBar;
74
110
  }
75
111
  };
76
112
  };
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","sources":["../../../src/cli/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora from 'ora';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.\n spinner(text: string) {\n if (silent) {\n return {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n };\n }\n\n return ora(text);\n },\n };\n};\n\nexport { createLogger };\n"],"names":[],"mappings":";;AAoBA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,KAAK,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACzE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,QAAQ,MAAM;AACZ,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,KAAK,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,OAAO,MAAM;AACX,UAAI,QAAQ;AACV;AAAA,MACF;AAEA,cAAQ,KAAK,MAAM,KAAK,GAAG,YAAY,MAAU,oBAAA,KAAA,GAAO,YAAa,CAAA,MAAM,EAAE,EAAE,GAAG,GAAG,IAAI;AAAA,IAC3F;AAAA,IAEA,QAAQ,MAAM;AACZ,YAAM,WAAW;AAEjB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,OAAO,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QAC1E,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,SAAS,MAAM;AACb,YAAM,UAAU;AAEhB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,IAAI,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA;AAAA,IAGA,QAAQ,MAAc;AACpB,UAAI,QAAQ;AACH,eAAA;AAAA,UACL,UAAU;AACD,mBAAA;AAAA,UACT;AAAA,UACA,OAAO;AACE,mBAAA;AAAA,UACT;AAAA,UACA,QAAQ;AACC,mBAAA;AAAA,UACT;AAAA,UACA,MAAM;AAAA,QAAA;AAAA,MAEV;AAEA,aAAO,IAAI,IAAI;AAAA,IACjB;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"logger.mjs","sources":["../../../src/cli/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora, { Ora } from 'ora';\nimport * as cliProgress from 'cli-progress';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n success: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text' | 'isSpinning'>;\n progressBar: (\n totalSize: number,\n text: string\n ) => Pick<cliProgress.SingleBar, 'start' | 'stop' | 'update'>;\n}\n\nconst silentSpinner = {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n isSpinning: false,\n} as Ora;\n\nconst silentProgressBar = {\n start() {\n return this;\n },\n stop() {\n return this;\n },\n update() {\n return this;\n },\n} as unknown as cliProgress.SingleBar;\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n success(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.green(`[SUCCESS]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n spinner(text: string) {\n if (silent) {\n return silentSpinner;\n }\n\n return ora(text);\n },\n\n progressBar(totalSize: number, text: string) {\n if (silent) {\n return silentProgressBar;\n }\n\n const progressBar = new cliProgress.SingleBar({\n format: `${text ? `${text} |` : ''}${chalk.green('{bar}')}| {percentage}%`,\n barCompleteChar: '\\u2588',\n barIncompleteChar: '\\u2591',\n hideCursor: true,\n forceRedraw: true,\n });\n\n progressBar.start(totalSize, 0);\n\n return progressBar;\n },\n };\n};\n\nexport { createLogger };\n"],"names":[],"mappings":";;;AA0BA,MAAM,gBAAgB;AAAA,EACpB,UAAU;AACD,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,MAAM;AAAA,EACN,YAAY;AACd;AAEA,MAAM,oBAAoB;AAAA,EACxB,QAAQ;AACC,WAAA;AAAA,EACT;AAAA,EACA,OAAO;AACE,WAAA;AAAA,EACT;AAAA,EACA,SAAS;AACA,WAAA;AAAA,EACT;AACF;AAEA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,KAAK,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACzE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,QAAQ,MAAM;AACZ,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACN,MAAM,KAAK,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AAM,OAAO,CAAC;AAAA,QACzD,iBAAiB;AAAA,QACjB,mBAAmB;AAAA,QACnB,YAAY;AAAA,QACZ,aAAa;AAAA,MAAA,CACd;AAEW,kBAAA,MAAM,WAAW,CAAC;AAEvB,aAAA;AAAA,IACT;AAAA,EAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../../src/node/core/aliases.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA0B5C,QAAA,MAAM,kBAAkB,iBAAkB;IAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;;CAUtE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"aliases.d.ts","sourceRoot":"","sources":["../../../src/node/core/aliases.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2B5C,QAAA,MAAM,kBAAkB,iBAAkB;IAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAE;;CAUtE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -10,6 +10,7 @@ const devAliases = {
10
10
  "@strapi/content-type-builder/strapi-admin": "./packages/core/content-type-builder/admin/src",
11
11
  "@strapi/email/strapi-admin": "./packages/core/email/admin/src",
12
12
  "@strapi/upload/strapi-admin": "./packages/core/upload/admin/src",
13
+ "@strapi/plugin-cloud/strapi-admin": "./packages/plugins/cloud/admin/src",
13
14
  "@strapi/plugin-color-picker/strapi-admin": "./packages/plugins/color-picker/admin/src",
14
15
  "@strapi/plugin-documentation/strapi-admin": "./packages/plugins/documentation/admin/src",
15
16
  "@strapi/plugin-graphql/strapi-admin": "./packages/plugins/graphql/admin/src",
@@ -1 +1 @@
1
- {"version":3,"file":"aliases.js","sources":["../../../src/node/core/aliases.ts"],"sourcesContent":["import path from 'node:path';\nimport { StrapiMonorepo } from './monorepo';\n\n/**\n * The path mappings/aliases used by various tools in the monorepo to map imported modules to\n * source files in order to speed up rebuilding and avoid having a separate watcher process to build\n * from `src` to `lib`.\n *\n * This file is currently read by:\n * - Webpack when running the dev server (only when running in this monorepo)\n */\nconst devAliases: Record<string, string> = {\n '@strapi/admin/strapi-admin': './packages/core/admin/admin/src',\n '@strapi/content-releases/strapi-admin': './packages/core/content-releases/admin/src',\n '@strapi/content-manager/strapi-admin': './packages/core/content-manager/admin/src',\n '@strapi/content-type-builder/strapi-admin': './packages/core/content-type-builder/admin/src',\n '@strapi/email/strapi-admin': './packages/core/email/admin/src',\n '@strapi/upload/strapi-admin': './packages/core/upload/admin/src',\n '@strapi/plugin-color-picker/strapi-admin': './packages/plugins/color-picker/admin/src',\n '@strapi/plugin-documentation/strapi-admin': './packages/plugins/documentation/admin/src',\n '@strapi/plugin-graphql/strapi-admin': './packages/plugins/graphql/admin/src',\n '@strapi/i18n/strapi-admin': './packages/plugins/i18n/admin/src',\n '@strapi/plugin-sentry/strapi-admin': './packages/plugins/sentry/admin/src',\n '@strapi/plugin-users-permissions/strapi-admin': './packages/plugins/users-permissions/admin/src',\n '@strapi/review-workflows/strapi-admin': './packages/core/review-workflows/admin/src',\n};\n\nconst getMonorepoAliases = ({ monorepo }: { monorepo?: StrapiMonorepo }) => {\n if (!monorepo?.path) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(devAliases).map(([key, modulePath]) => {\n return [key, path.join(monorepo.path, modulePath)];\n })\n );\n};\n\nexport { getMonorepoAliases };\n"],"names":["path"],"mappings":";;;;;AAWA,MAAM,aAAqC;AAAA,EACzC,8BAA8B;AAAA,EAC9B,yCAAyC;AAAA,EACzC,wCAAwC;AAAA,EACxC,6CAA6C;AAAA,EAC7C,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,4CAA4C;AAAA,EAC5C,6CAA6C;AAAA,EAC7C,uCAAuC;AAAA,EACvC,6BAA6B;AAAA,EAC7B,sCAAsC;AAAA,EACtC,iDAAiD;AAAA,EACjD,yCAAyC;AAC3C;AAEA,MAAM,qBAAqB,CAAC,EAAE,eAA8C;AACtE,MAAA,CAAC,UAAU,MAAM;AACnB,WAAO;EACT;AAEA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,UAAU,MAAM;AACpD,aAAO,CAAC,KAAKA,sBAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAAA,IAAA,CAClD;AAAA,EAAA;AAEL;;"}
1
+ {"version":3,"file":"aliases.js","sources":["../../../src/node/core/aliases.ts"],"sourcesContent":["import path from 'node:path';\nimport { StrapiMonorepo } from './monorepo';\n\n/**\n * The path mappings/aliases used by various tools in the monorepo to map imported modules to\n * source files in order to speed up rebuilding and avoid having a separate watcher process to build\n * from `src` to `lib`.\n *\n * This file is currently read by:\n * - Webpack when running the dev server (only when running in this monorepo)\n */\nconst devAliases: Record<string, string> = {\n '@strapi/admin/strapi-admin': './packages/core/admin/admin/src',\n '@strapi/content-releases/strapi-admin': './packages/core/content-releases/admin/src',\n '@strapi/content-manager/strapi-admin': './packages/core/content-manager/admin/src',\n '@strapi/content-type-builder/strapi-admin': './packages/core/content-type-builder/admin/src',\n '@strapi/email/strapi-admin': './packages/core/email/admin/src',\n '@strapi/upload/strapi-admin': './packages/core/upload/admin/src',\n '@strapi/plugin-cloud/strapi-admin': './packages/plugins/cloud/admin/src',\n '@strapi/plugin-color-picker/strapi-admin': './packages/plugins/color-picker/admin/src',\n '@strapi/plugin-documentation/strapi-admin': './packages/plugins/documentation/admin/src',\n '@strapi/plugin-graphql/strapi-admin': './packages/plugins/graphql/admin/src',\n '@strapi/i18n/strapi-admin': './packages/plugins/i18n/admin/src',\n '@strapi/plugin-sentry/strapi-admin': './packages/plugins/sentry/admin/src',\n '@strapi/plugin-users-permissions/strapi-admin': './packages/plugins/users-permissions/admin/src',\n '@strapi/review-workflows/strapi-admin': './packages/core/review-workflows/admin/src',\n};\n\nconst getMonorepoAliases = ({ monorepo }: { monorepo?: StrapiMonorepo }) => {\n if (!monorepo?.path) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(devAliases).map(([key, modulePath]) => {\n return [key, path.join(monorepo.path, modulePath)];\n })\n );\n};\n\nexport { getMonorepoAliases };\n"],"names":["path"],"mappings":";;;;;AAWA,MAAM,aAAqC;AAAA,EACzC,8BAA8B;AAAA,EAC9B,yCAAyC;AAAA,EACzC,wCAAwC;AAAA,EACxC,6CAA6C;AAAA,EAC7C,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,qCAAqC;AAAA,EACrC,4CAA4C;AAAA,EAC5C,6CAA6C;AAAA,EAC7C,uCAAuC;AAAA,EACvC,6BAA6B;AAAA,EAC7B,sCAAsC;AAAA,EACtC,iDAAiD;AAAA,EACjD,yCAAyC;AAC3C;AAEA,MAAM,qBAAqB,CAAC,EAAE,eAA8C;AACtE,MAAA,CAAC,UAAU,MAAM;AACnB,WAAO;EACT;AAEA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,UAAU,MAAM;AACpD,aAAO,CAAC,KAAKA,sBAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAAA,IAAA,CAClD;AAAA,EAAA;AAEL;;"}
@@ -6,6 +6,7 @@ const devAliases = {
6
6
  "@strapi/content-type-builder/strapi-admin": "./packages/core/content-type-builder/admin/src",
7
7
  "@strapi/email/strapi-admin": "./packages/core/email/admin/src",
8
8
  "@strapi/upload/strapi-admin": "./packages/core/upload/admin/src",
9
+ "@strapi/plugin-cloud/strapi-admin": "./packages/plugins/cloud/admin/src",
9
10
  "@strapi/plugin-color-picker/strapi-admin": "./packages/plugins/color-picker/admin/src",
10
11
  "@strapi/plugin-documentation/strapi-admin": "./packages/plugins/documentation/admin/src",
11
12
  "@strapi/plugin-graphql/strapi-admin": "./packages/plugins/graphql/admin/src",
@@ -1 +1 @@
1
- {"version":3,"file":"aliases.mjs","sources":["../../../src/node/core/aliases.ts"],"sourcesContent":["import path from 'node:path';\nimport { StrapiMonorepo } from './monorepo';\n\n/**\n * The path mappings/aliases used by various tools in the monorepo to map imported modules to\n * source files in order to speed up rebuilding and avoid having a separate watcher process to build\n * from `src` to `lib`.\n *\n * This file is currently read by:\n * - Webpack when running the dev server (only when running in this monorepo)\n */\nconst devAliases: Record<string, string> = {\n '@strapi/admin/strapi-admin': './packages/core/admin/admin/src',\n '@strapi/content-releases/strapi-admin': './packages/core/content-releases/admin/src',\n '@strapi/content-manager/strapi-admin': './packages/core/content-manager/admin/src',\n '@strapi/content-type-builder/strapi-admin': './packages/core/content-type-builder/admin/src',\n '@strapi/email/strapi-admin': './packages/core/email/admin/src',\n '@strapi/upload/strapi-admin': './packages/core/upload/admin/src',\n '@strapi/plugin-color-picker/strapi-admin': './packages/plugins/color-picker/admin/src',\n '@strapi/plugin-documentation/strapi-admin': './packages/plugins/documentation/admin/src',\n '@strapi/plugin-graphql/strapi-admin': './packages/plugins/graphql/admin/src',\n '@strapi/i18n/strapi-admin': './packages/plugins/i18n/admin/src',\n '@strapi/plugin-sentry/strapi-admin': './packages/plugins/sentry/admin/src',\n '@strapi/plugin-users-permissions/strapi-admin': './packages/plugins/users-permissions/admin/src',\n '@strapi/review-workflows/strapi-admin': './packages/core/review-workflows/admin/src',\n};\n\nconst getMonorepoAliases = ({ monorepo }: { monorepo?: StrapiMonorepo }) => {\n if (!monorepo?.path) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(devAliases).map(([key, modulePath]) => {\n return [key, path.join(monorepo.path, modulePath)];\n })\n );\n};\n\nexport { getMonorepoAliases };\n"],"names":[],"mappings":";AAWA,MAAM,aAAqC;AAAA,EACzC,8BAA8B;AAAA,EAC9B,yCAAyC;AAAA,EACzC,wCAAwC;AAAA,EACxC,6CAA6C;AAAA,EAC7C,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,4CAA4C;AAAA,EAC5C,6CAA6C;AAAA,EAC7C,uCAAuC;AAAA,EACvC,6BAA6B;AAAA,EAC7B,sCAAsC;AAAA,EACtC,iDAAiD;AAAA,EACjD,yCAAyC;AAC3C;AAEA,MAAM,qBAAqB,CAAC,EAAE,eAA8C;AACtE,MAAA,CAAC,UAAU,MAAM;AACnB,WAAO;EACT;AAEA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,UAAU,MAAM;AACpD,aAAO,CAAC,KAAK,KAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAAA,IAAA,CAClD;AAAA,EAAA;AAEL;"}
1
+ {"version":3,"file":"aliases.mjs","sources":["../../../src/node/core/aliases.ts"],"sourcesContent":["import path from 'node:path';\nimport { StrapiMonorepo } from './monorepo';\n\n/**\n * The path mappings/aliases used by various tools in the monorepo to map imported modules to\n * source files in order to speed up rebuilding and avoid having a separate watcher process to build\n * from `src` to `lib`.\n *\n * This file is currently read by:\n * - Webpack when running the dev server (only when running in this monorepo)\n */\nconst devAliases: Record<string, string> = {\n '@strapi/admin/strapi-admin': './packages/core/admin/admin/src',\n '@strapi/content-releases/strapi-admin': './packages/core/content-releases/admin/src',\n '@strapi/content-manager/strapi-admin': './packages/core/content-manager/admin/src',\n '@strapi/content-type-builder/strapi-admin': './packages/core/content-type-builder/admin/src',\n '@strapi/email/strapi-admin': './packages/core/email/admin/src',\n '@strapi/upload/strapi-admin': './packages/core/upload/admin/src',\n '@strapi/plugin-cloud/strapi-admin': './packages/plugins/cloud/admin/src',\n '@strapi/plugin-color-picker/strapi-admin': './packages/plugins/color-picker/admin/src',\n '@strapi/plugin-documentation/strapi-admin': './packages/plugins/documentation/admin/src',\n '@strapi/plugin-graphql/strapi-admin': './packages/plugins/graphql/admin/src',\n '@strapi/i18n/strapi-admin': './packages/plugins/i18n/admin/src',\n '@strapi/plugin-sentry/strapi-admin': './packages/plugins/sentry/admin/src',\n '@strapi/plugin-users-permissions/strapi-admin': './packages/plugins/users-permissions/admin/src',\n '@strapi/review-workflows/strapi-admin': './packages/core/review-workflows/admin/src',\n};\n\nconst getMonorepoAliases = ({ monorepo }: { monorepo?: StrapiMonorepo }) => {\n if (!monorepo?.path) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(devAliases).map(([key, modulePath]) => {\n return [key, path.join(monorepo.path, modulePath)];\n })\n );\n};\n\nexport { getMonorepoAliases };\n"],"names":[],"mappings":";AAWA,MAAM,aAAqC;AAAA,EACzC,8BAA8B;AAAA,EAC9B,yCAAyC;AAAA,EACzC,wCAAwC;AAAA,EACxC,6CAA6C;AAAA,EAC7C,8BAA8B;AAAA,EAC9B,+BAA+B;AAAA,EAC/B,qCAAqC;AAAA,EACrC,4CAA4C;AAAA,EAC5C,6CAA6C;AAAA,EAC7C,uCAAuC;AAAA,EACvC,6BAA6B;AAAA,EAC7B,sCAAsC;AAAA,EACtC,iDAAiD;AAAA,EACjD,yCAAyC;AAC3C;AAEA,MAAM,qBAAqB,CAAC,EAAE,eAA8C;AACtE,MAAA,CAAC,UAAU,MAAM;AACnB,WAAO;EACT;AAEA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,UAAU,EAAE,IAAI,CAAC,CAAC,KAAK,UAAU,MAAM;AACpD,aAAO,CAAC,KAAK,KAAK,KAAK,SAAS,MAAM,UAAU,CAAC;AAAA,IAAA,CAClD;AAAA,EAAA;AAEL;"}
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/node/core/dependencies.ts"],"names":[],"mappings":"AAMA,OAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAa7C,UAAU,+BAA+B;IACvC,UAAU,EAAE,OAAO,CAAC;CACrB;AAQD;;;;;;;;GAQG;AACH,QAAA,MAAM,yBAAyB,qBAG5B,KAAK,YAAY,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAG,QAAQ,+BAA+B,CA+HhF,CAAC;AAEF,QAAA,MAAM,SAAS,SAAgB,MAAM,OAAO,MAAM,KAAG,QAAQ,WAAW,GAAG,IAAI,CAQ9E,CAAC;AAkDF,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC;AAChD,YAAY,EAAE,+BAA+B,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/node/core/dependencies.ts"],"names":[],"mappings":"AAMA,OAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAa7C,UAAU,+BAA+B;IACvC,UAAU,EAAE,OAAO,CAAC;CACrB;AAQD;;;;;;;;GAQG;AACH,QAAA,MAAM,yBAAyB,qBAG5B,KAAK,YAAY,EAAE,KAAK,GAAG,QAAQ,CAAC,KAAG,QAAQ,+BAA+B,CAwIhF,CAAC;AAEF,QAAA,MAAM,SAAS,SAAgB,MAAM,OAAO,MAAM,KAAG,QAAQ,WAAW,GAAG,IAAI,CAQ9E,CAAC;AAkDF,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAAC;AAChD,YAAY,EAAE,+BAA+B,EAAE,WAAW,EAAE,CAAC"}
@@ -26,6 +26,10 @@ const checkRequiredDependencies = async ({
26
26
  cwd,
27
27
  logger
28
28
  }) => {
29
+ if (process.env.USE_EXPERIMENTAL_DEPENDENCIES === "true") {
30
+ logger.warn("You are using experimental dependencies that may not be compatible with Strapi.");
31
+ return { didInstall: false };
32
+ }
29
33
  const pkg = await readPkgUp__default.default({ cwd });
30
34
  if (!pkg) {
31
35
  throw new Error(`Could not find package.json at path: ${cwd}`);
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","sources":["../../../src/node/core/dependencies.ts"],"sourcesContent":["import os from 'node:os';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport semver, { SemVer } from 'semver';\nimport resolveFrom from 'resolve-from';\nimport execa, { CommonOptions, ExecaReturnValue } from 'execa';\nimport readPkgUp, { PackageJson } from 'read-pkg-up';\nimport type { BuildOptions } from '../build';\nimport { getPackageManager } from './managers';\n\n/**\n * From V5 this will be imported from the package.json of `@strapi/strapi`.\n */\nconst PEER_DEPS = {\n react: '^18.0.0',\n 'react-dom': '^18.0.0',\n 'react-router-dom': '^6.0.0',\n 'styled-components': '^6.0.0',\n};\n\ninterface CheckRequiredDependenciesResult {\n didInstall: boolean;\n}\n\ninterface DepToInstall {\n name: string;\n wantedVersion: string;\n declaredVersion?: never;\n}\n\n/**\n * Checks the user's project that it has declared and installed the required dependencies\n * needed by the Strapi admin project. Whilst generally speaking most modules will be\n * declared by the actual packages there are some packages where you only really want one of\n * and thus they are declared as peer dependencies – react / styled-components / etc.\n *\n * If these deps are not installed or declared, then we prompt the user to correct this. In\n * V4 this is not a hard requirement, but in V5 it will be. Might as well get people started now.\n */\nconst checkRequiredDependencies = async ({\n cwd,\n logger,\n}: Pick<BuildOptions, 'cwd' | 'logger'>): Promise<CheckRequiredDependenciesResult> => {\n const pkg = await readPkgUp({ cwd });\n\n if (!pkg) {\n throw new Error(`Could not find package.json at path: ${cwd}`);\n }\n\n logger.debug('Loaded package.json:', os.EOL, pkg.packageJson);\n\n interface DepToReview {\n name: string;\n wantedVersion: string;\n declaredVersion: string;\n }\n\n /**\n * Run through each of the peer deps and figure out if they need to be\n * installed or they need their version checked against.\n */\n const { install, review } = Object.entries(PEER_DEPS).reduce<{\n install: DepToInstall[];\n review: DepToReview[];\n }>(\n (acc, [name, version]) => {\n if (!pkg.packageJson.dependencies) {\n throw new Error(`Could not find dependencies in package.json at path: ${cwd}`);\n }\n\n const declaredVersion = pkg.packageJson.dependencies[name];\n\n if (!declaredVersion) {\n acc.install.push({\n name,\n wantedVersion: version,\n });\n } else {\n acc.review.push({\n name,\n wantedVersion: version,\n declaredVersion,\n });\n }\n\n return acc;\n },\n {\n install: [],\n review: [],\n }\n );\n\n if (install.length > 0) {\n logger.info(\n 'The Strapi admin needs to install the following dependencies:',\n os.EOL,\n install.map(({ name, wantedVersion }) => ` - ${name}@${wantedVersion}`).join(os.EOL)\n );\n\n await installDependencies(install, {\n cwd,\n logger,\n });\n\n const [file, ...args] = process.argv;\n\n /**\n * Re-run the same command after installation e.g. strapi build because the yarn.lock might\n * not be the same and could break installations. It's not the best solution, but it works.\n */\n await execa(file, args, { cwd, stdio: 'inherit' });\n return { didInstall: true };\n }\n\n if (review.length) {\n const errors: string[] = [];\n\n for (const dep of review) {\n // The version specified in package.json could be incorrect, eg `foo`\n let minDeclaredVersion: SemVer | null = null;\n try {\n minDeclaredVersion = semver.minVersion(dep.declaredVersion);\n } catch (err) {\n // Intentional fall-through (variable will be left as null, throwing below)\n }\n\n if (!minDeclaredVersion) {\n errors.push(\n `The declared dependency, ${dep.name} has an invalid version in package.json: ${dep.declaredVersion}`\n );\n } else if (!semver.satisfies(minDeclaredVersion, dep.wantedVersion)) {\n /**\n * The delcared version should be semver compatible with our required version\n * of the dependency. If it's not, we should advise the user to change it.\n */\n logger.warn(\n [\n `Declared version of ${dep.name} (${minDeclaredVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n\n const installedVersion = await getModuleVersion(dep.name, cwd);\n\n if (!installedVersion) {\n /**\n * TODO: when we know the packageManager we can advise the actual install command.\n */\n errors.push(\n `The declared dependency, ${dep.name} is not installed. You should install before re-running this command`\n );\n } else if (!semver.satisfies(installedVersion, dep.wantedVersion)) {\n logger.warn(\n [\n `Declared version of ${dep.name} (${installedVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n }\n\n if (errors.length > 0 && process.env.NODE_ENV === 'development') {\n throw new Error(`${os.EOL}- ${errors.join(`${os.EOL}- `)}`);\n }\n }\n\n return { didInstall: false };\n};\n\nconst getModule = async (name: string, cwd: string): Promise<PackageJson | null> => {\n const modulePackagePath = resolveFrom.silent(cwd, path.join(name, 'package.json'));\n if (!modulePackagePath) {\n return null;\n }\n const file = await fs.readFile(modulePackagePath, 'utf8').then((res) => JSON.parse(res));\n\n return file;\n};\n\nconst getModuleVersion = async (name: string, cwd: string): Promise<string | null> => {\n const pkg = await getModule(name, cwd);\n\n return pkg?.version || null;\n};\n\nconst installDependencies = async (\n install: DepToInstall[],\n { cwd, logger }: Pick<BuildOptions, 'cwd' | 'logger'>\n) => {\n const packageManager = getPackageManager();\n\n if (!packageManager) {\n logger.error(\n 'Could not find a supported package manager, please install the dependencies manually.'\n );\n process.exit(1);\n }\n\n const execOptions: CommonOptions<'utf8'> = {\n encoding: 'utf8',\n cwd,\n stdio: 'inherit',\n };\n\n const packages = install.map(({ name, wantedVersion }) => `${name}@${wantedVersion}`);\n\n let result: ExecaReturnValue<string> | undefined;\n\n if (packageManager === 'npm') {\n const npmArgs = ['install', '--legacy-peer-deps', '--save', ...packages];\n logger.info(`Running 'npm ${npmArgs.join(' ')}'`);\n result = await execa('npm', npmArgs, execOptions);\n } else if (packageManager === 'yarn') {\n const yarnArgs = ['add', ...packages];\n logger.info(`Running 'yarn ${yarnArgs.join(' ')}'`);\n result = await execa('yarn', yarnArgs, execOptions);\n } else if (packageManager === 'pnpm') {\n const pnpmArgs = ['add', '--save-prod', ...packages];\n logger.info(`Running 'pnpm ${pnpmArgs.join(' ')}'`);\n result = await execa('pnpm', pnpmArgs, execOptions);\n }\n\n if (result?.exitCode || result?.failed) {\n throw new Error('Package installation failed');\n }\n};\n\nexport { checkRequiredDependencies, getModule };\nexport type { CheckRequiredDependenciesResult, PackageJson };\n"],"names":["readPkgUp","os","execa","semver","resolveFrom","path","fs","getPackageManager"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAY;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,qBAAqB;AACvB;AAqBA,MAAM,4BAA4B,OAAO;AAAA,EACvC;AAA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ChC,UAAA,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AACF;;;"}
1
+ {"version":3,"file":"dependencies.js","sources":["../../../src/node/core/dependencies.ts"],"sourcesContent":["import os from 'node:os';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport semver, { SemVer } from 'semver';\nimport resolveFrom from 'resolve-from';\nimport execa, { CommonOptions, ExecaReturnValue } from 'execa';\nimport readPkgUp, { PackageJson } from 'read-pkg-up';\nimport type { BuildOptions } from '../build';\nimport { getPackageManager } from './managers';\n\n/**\n * From V5 this will be imported from the package.json of `@strapi/strapi`.\n */\nconst PEER_DEPS = {\n react: '^18.0.0',\n 'react-dom': '^18.0.0',\n 'react-router-dom': '^6.0.0',\n 'styled-components': '^6.0.0',\n};\n\ninterface CheckRequiredDependenciesResult {\n didInstall: boolean;\n}\n\ninterface DepToInstall {\n name: string;\n wantedVersion: string;\n declaredVersion?: never;\n}\n\n/**\n * Checks the user's project that it has declared and installed the required dependencies\n * needed by the Strapi admin project. Whilst generally speaking most modules will be\n * declared by the actual packages there are some packages where you only really want one of\n * and thus they are declared as peer dependencies – react / styled-components / etc.\n *\n * If these deps are not installed or declared, then we prompt the user to correct this. In\n * V4 this is not a hard requirement, but in V5 it will be. Might as well get people started now.\n */\nconst checkRequiredDependencies = async ({\n cwd,\n logger,\n}: Pick<BuildOptions, 'cwd' | 'logger'>): Promise<CheckRequiredDependenciesResult> => {\n /**\n * This enables us to use experimental deps for libraries like\n * react or styled-components. This is useful for testing against.\n */\n if (process.env.USE_EXPERIMENTAL_DEPENDENCIES === 'true') {\n logger.warn('You are using experimental dependencies that may not be compatible with Strapi.');\n return { didInstall: false };\n }\n\n const pkg = await readPkgUp({ cwd });\n\n if (!pkg) {\n throw new Error(`Could not find package.json at path: ${cwd}`);\n }\n\n logger.debug('Loaded package.json:', os.EOL, pkg.packageJson);\n\n interface DepToReview {\n name: string;\n wantedVersion: string;\n declaredVersion: string;\n }\n\n /**\n * Run through each of the peer deps and figure out if they need to be\n * installed or they need their version checked against.\n */\n const { install, review } = Object.entries(PEER_DEPS).reduce<{\n install: DepToInstall[];\n review: DepToReview[];\n }>(\n (acc, [name, version]) => {\n if (!pkg.packageJson.dependencies) {\n throw new Error(`Could not find dependencies in package.json at path: ${cwd}`);\n }\n\n const declaredVersion = pkg.packageJson.dependencies[name];\n\n if (!declaredVersion) {\n acc.install.push({\n name,\n wantedVersion: version,\n });\n } else {\n acc.review.push({\n name,\n wantedVersion: version,\n declaredVersion,\n });\n }\n\n return acc;\n },\n {\n install: [],\n review: [],\n }\n );\n\n if (install.length > 0) {\n logger.info(\n 'The Strapi admin needs to install the following dependencies:',\n os.EOL,\n install.map(({ name, wantedVersion }) => ` - ${name}@${wantedVersion}`).join(os.EOL)\n );\n\n await installDependencies(install, {\n cwd,\n logger,\n });\n\n const [file, ...args] = process.argv;\n\n /**\n * Re-run the same command after installation e.g. strapi build because the yarn.lock might\n * not be the same and could break installations. It's not the best solution, but it works.\n */\n await execa(file, args, { cwd, stdio: 'inherit' });\n return { didInstall: true };\n }\n\n if (review.length) {\n const errors: string[] = [];\n\n for (const dep of review) {\n // The version specified in package.json could be incorrect, eg `foo`\n let minDeclaredVersion: SemVer | null = null;\n try {\n minDeclaredVersion = semver.minVersion(dep.declaredVersion);\n } catch (err) {\n // Intentional fall-through (variable will be left as null, throwing below)\n }\n\n if (!minDeclaredVersion) {\n errors.push(\n `The declared dependency, ${dep.name} has an invalid version in package.json: ${dep.declaredVersion}`\n );\n } else if (!semver.satisfies(minDeclaredVersion, dep.wantedVersion)) {\n /**\n * The delcared version should be semver compatible with our required version\n * of the dependency. If it's not, we should advise the user to change it.\n */\n logger.warn(\n [\n `Declared version of ${dep.name} (${minDeclaredVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n\n const installedVersion = await getModuleVersion(dep.name, cwd);\n\n if (!installedVersion) {\n /**\n * TODO: when we know the packageManager we can advise the actual install command.\n */\n errors.push(\n `The declared dependency, ${dep.name} is not installed. You should install before re-running this command`\n );\n } else if (!semver.satisfies(installedVersion, dep.wantedVersion)) {\n logger.warn(\n [\n `Declared version of ${dep.name} (${installedVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n }\n\n if (errors.length > 0 && process.env.NODE_ENV === 'development') {\n throw new Error(`${os.EOL}- ${errors.join(`${os.EOL}- `)}`);\n }\n }\n\n return { didInstall: false };\n};\n\nconst getModule = async (name: string, cwd: string): Promise<PackageJson | null> => {\n const modulePackagePath = resolveFrom.silent(cwd, path.join(name, 'package.json'));\n if (!modulePackagePath) {\n return null;\n }\n const file = await fs.readFile(modulePackagePath, 'utf8').then((res) => JSON.parse(res));\n\n return file;\n};\n\nconst getModuleVersion = async (name: string, cwd: string): Promise<string | null> => {\n const pkg = await getModule(name, cwd);\n\n return pkg?.version || null;\n};\n\nconst installDependencies = async (\n install: DepToInstall[],\n { cwd, logger }: Pick<BuildOptions, 'cwd' | 'logger'>\n) => {\n const packageManager = getPackageManager();\n\n if (!packageManager) {\n logger.error(\n 'Could not find a supported package manager, please install the dependencies manually.'\n );\n process.exit(1);\n }\n\n const execOptions: CommonOptions<'utf8'> = {\n encoding: 'utf8',\n cwd,\n stdio: 'inherit',\n };\n\n const packages = install.map(({ name, wantedVersion }) => `${name}@${wantedVersion}`);\n\n let result: ExecaReturnValue<string> | undefined;\n\n if (packageManager === 'npm') {\n const npmArgs = ['install', '--legacy-peer-deps', '--save', ...packages];\n logger.info(`Running 'npm ${npmArgs.join(' ')}'`);\n result = await execa('npm', npmArgs, execOptions);\n } else if (packageManager === 'yarn') {\n const yarnArgs = ['add', ...packages];\n logger.info(`Running 'yarn ${yarnArgs.join(' ')}'`);\n result = await execa('yarn', yarnArgs, execOptions);\n } else if (packageManager === 'pnpm') {\n const pnpmArgs = ['add', '--save-prod', ...packages];\n logger.info(`Running 'pnpm ${pnpmArgs.join(' ')}'`);\n result = await execa('pnpm', pnpmArgs, execOptions);\n }\n\n if (result?.exitCode || result?.failed) {\n throw new Error('Package installation failed');\n }\n};\n\nexport { checkRequiredDependencies, getModule };\nexport type { CheckRequiredDependenciesResult, PackageJson };\n"],"names":["readPkgUp","os","execa","semver","resolveFrom","path","fs","getPackageManager"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAY;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,qBAAqB;AACvB;AAqBA,MAAM,4BAA4B,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAAsF;AAKhF,MAAA,QAAQ,IAAI,kCAAkC,QAAQ;AACxD,WAAO,KAAK,iFAAiF;AACtF,WAAA,EAAE,YAAY;EACvB;AAEA,QAAM,MAAM,MAAMA,mBAAAA,QAAU,EAAE,IAAK,CAAA;AAEnC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,wCAAwC,GAAG,EAAE;AAAA,EAC/D;AAEA,SAAO,MAAM,wBAAwBC,YAAAA,QAAG,KAAK,IAAI,WAAW;AAY5D,QAAM,EAAE,SAAS,WAAW,OAAO,QAAQ,SAAS,EAAE;AAAA,IAIpD,CAAC,KAAK,CAAC,MAAM,OAAO,MAAM;AACpB,UAAA,CAAC,IAAI,YAAY,cAAc;AACjC,cAAM,IAAI,MAAM,wDAAwD,GAAG,EAAE;AAAA,MAC/E;AAEA,YAAM,kBAAkB,IAAI,YAAY,aAAa,IAAI;AAEzD,UAAI,CAAC,iBAAiB;AACpB,YAAI,QAAQ,KAAK;AAAA,UACf;AAAA,UACA,eAAe;AAAA,QAAA,CAChB;AAAA,MAAA,OACI;AACL,YAAI,OAAO,KAAK;AAAA,UACd;AAAA,UACA,eAAe;AAAA,UACf;AAAA,QAAA,CACD;AAAA,MACH;AAEO,aAAA;AAAA,IACT;AAAA,IACA;AAAA,MACE,SAAS,CAAC;AAAA,MACV,QAAQ,CAAC;AAA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AAG;AAChD,aAAS,MAAML,eAAA,QAAM,OAAO,SAAS,WAAW;AAAA,EAAA,WACvC,mBAAmB,QAAQ;AACpC,UAAM,WAAW,CAAC,OAAO,GAAG,QAAQ;AACpC,WAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,CAAC,GAAG;AAClD,aAAS,MAAMA,eAAA,QAAM,QAAQ,UAAU,WAAW;AAAA,EAAA,WACzC,mBAAmB,QAAQ;AACpC,UAAM,WAAW,CAAC,OAAO,eAAe,GAAG,QAAQ;AACnD,WAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,CAAC,GAAG;AAClD,aAAS,MAAMA,eAAA,QAAM,QAAQ,UAAU,WAAW;AAAA,EACpD;AAEI,MAAA,QAAQ,YAAY,QAAQ,QAAQ;AAChC,UAAA,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AACF;;;"}
@@ -16,6 +16,10 @@ const checkRequiredDependencies = async ({
16
16
  cwd,
17
17
  logger
18
18
  }) => {
19
+ if (process.env.USE_EXPERIMENTAL_DEPENDENCIES === "true") {
20
+ logger.warn("You are using experimental dependencies that may not be compatible with Strapi.");
21
+ return { didInstall: false };
22
+ }
19
23
  const pkg = await readPkgUp({ cwd });
20
24
  if (!pkg) {
21
25
  throw new Error(`Could not find package.json at path: ${cwd}`);
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.mjs","sources":["../../../src/node/core/dependencies.ts"],"sourcesContent":["import os from 'node:os';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport semver, { SemVer } from 'semver';\nimport resolveFrom from 'resolve-from';\nimport execa, { CommonOptions, ExecaReturnValue } from 'execa';\nimport readPkgUp, { PackageJson } from 'read-pkg-up';\nimport type { BuildOptions } from '../build';\nimport { getPackageManager } from './managers';\n\n/**\n * From V5 this will be imported from the package.json of `@strapi/strapi`.\n */\nconst PEER_DEPS = {\n react: '^18.0.0',\n 'react-dom': '^18.0.0',\n 'react-router-dom': '^6.0.0',\n 'styled-components': '^6.0.0',\n};\n\ninterface CheckRequiredDependenciesResult {\n didInstall: boolean;\n}\n\ninterface DepToInstall {\n name: string;\n wantedVersion: string;\n declaredVersion?: never;\n}\n\n/**\n * Checks the user's project that it has declared and installed the required dependencies\n * needed by the Strapi admin project. Whilst generally speaking most modules will be\n * declared by the actual packages there are some packages where you only really want one of\n * and thus they are declared as peer dependencies – react / styled-components / etc.\n *\n * If these deps are not installed or declared, then we prompt the user to correct this. In\n * V4 this is not a hard requirement, but in V5 it will be. Might as well get people started now.\n */\nconst checkRequiredDependencies = async ({\n cwd,\n logger,\n}: Pick<BuildOptions, 'cwd' | 'logger'>): Promise<CheckRequiredDependenciesResult> => {\n const pkg = await readPkgUp({ cwd });\n\n if (!pkg) {\n throw new Error(`Could not find package.json at path: ${cwd}`);\n }\n\n logger.debug('Loaded package.json:', os.EOL, pkg.packageJson);\n\n interface DepToReview {\n name: string;\n wantedVersion: string;\n declaredVersion: string;\n }\n\n /**\n * Run through each of the peer deps and figure out if they need to be\n * installed or they need their version checked against.\n */\n const { install, review } = Object.entries(PEER_DEPS).reduce<{\n install: DepToInstall[];\n review: DepToReview[];\n }>(\n (acc, [name, version]) => {\n if (!pkg.packageJson.dependencies) {\n throw new Error(`Could not find dependencies in package.json at path: ${cwd}`);\n }\n\n const declaredVersion = pkg.packageJson.dependencies[name];\n\n if (!declaredVersion) {\n acc.install.push({\n name,\n wantedVersion: version,\n });\n } else {\n acc.review.push({\n name,\n wantedVersion: version,\n declaredVersion,\n });\n }\n\n return acc;\n },\n {\n install: [],\n review: [],\n }\n );\n\n if (install.length > 0) {\n logger.info(\n 'The Strapi admin needs to install the following dependencies:',\n os.EOL,\n install.map(({ name, wantedVersion }) => ` - ${name}@${wantedVersion}`).join(os.EOL)\n );\n\n await installDependencies(install, {\n cwd,\n logger,\n });\n\n const [file, ...args] = process.argv;\n\n /**\n * Re-run the same command after installation e.g. strapi build because the yarn.lock might\n * not be the same and could break installations. It's not the best solution, but it works.\n */\n await execa(file, args, { cwd, stdio: 'inherit' });\n return { didInstall: true };\n }\n\n if (review.length) {\n const errors: string[] = [];\n\n for (const dep of review) {\n // The version specified in package.json could be incorrect, eg `foo`\n let minDeclaredVersion: SemVer | null = null;\n try {\n minDeclaredVersion = semver.minVersion(dep.declaredVersion);\n } catch (err) {\n // Intentional fall-through (variable will be left as null, throwing below)\n }\n\n if (!minDeclaredVersion) {\n errors.push(\n `The declared dependency, ${dep.name} has an invalid version in package.json: ${dep.declaredVersion}`\n );\n } else if (!semver.satisfies(minDeclaredVersion, dep.wantedVersion)) {\n /**\n * The delcared version should be semver compatible with our required version\n * of the dependency. If it's not, we should advise the user to change it.\n */\n logger.warn(\n [\n `Declared version of ${dep.name} (${minDeclaredVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n\n const installedVersion = await getModuleVersion(dep.name, cwd);\n\n if (!installedVersion) {\n /**\n * TODO: when we know the packageManager we can advise the actual install command.\n */\n errors.push(\n `The declared dependency, ${dep.name} is not installed. You should install before re-running this command`\n );\n } else if (!semver.satisfies(installedVersion, dep.wantedVersion)) {\n logger.warn(\n [\n `Declared version of ${dep.name} (${installedVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n }\n\n if (errors.length > 0 && process.env.NODE_ENV === 'development') {\n throw new Error(`${os.EOL}- ${errors.join(`${os.EOL}- `)}`);\n }\n }\n\n return { didInstall: false };\n};\n\nconst getModule = async (name: string, cwd: string): Promise<PackageJson | null> => {\n const modulePackagePath = resolveFrom.silent(cwd, path.join(name, 'package.json'));\n if (!modulePackagePath) {\n return null;\n }\n const file = await fs.readFile(modulePackagePath, 'utf8').then((res) => JSON.parse(res));\n\n return file;\n};\n\nconst getModuleVersion = async (name: string, cwd: string): Promise<string | null> => {\n const pkg = await getModule(name, cwd);\n\n return pkg?.version || null;\n};\n\nconst installDependencies = async (\n install: DepToInstall[],\n { cwd, logger }: Pick<BuildOptions, 'cwd' | 'logger'>\n) => {\n const packageManager = getPackageManager();\n\n if (!packageManager) {\n logger.error(\n 'Could not find a supported package manager, please install the dependencies manually.'\n );\n process.exit(1);\n }\n\n const execOptions: CommonOptions<'utf8'> = {\n encoding: 'utf8',\n cwd,\n stdio: 'inherit',\n };\n\n const packages = install.map(({ name, wantedVersion }) => `${name}@${wantedVersion}`);\n\n let result: ExecaReturnValue<string> | undefined;\n\n if (packageManager === 'npm') {\n const npmArgs = ['install', '--legacy-peer-deps', '--save', ...packages];\n logger.info(`Running 'npm ${npmArgs.join(' ')}'`);\n result = await execa('npm', npmArgs, execOptions);\n } else if (packageManager === 'yarn') {\n const yarnArgs = ['add', ...packages];\n logger.info(`Running 'yarn ${yarnArgs.join(' ')}'`);\n result = await execa('yarn', yarnArgs, execOptions);\n } else if (packageManager === 'pnpm') {\n const pnpmArgs = ['add', '--save-prod', ...packages];\n logger.info(`Running 'pnpm ${pnpmArgs.join(' ')}'`);\n result = await execa('pnpm', pnpmArgs, execOptions);\n }\n\n if (result?.exitCode || result?.failed) {\n throw new Error('Package installation failed');\n }\n};\n\nexport { checkRequiredDependencies, getModule };\nexport type { CheckRequiredDependenciesResult, PackageJson };\n"],"names":[],"mappings":";;;;;;;;AAaA,MAAM,YAAY;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,qBAAqB;AACvB;AAqBA,MAAM,4BAA4B,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAAsF;AACpF,QAAM,MAAM,MAAM,UAAU,EAAE,IAAK,CAAA;AAEnC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,wCAAwC,GAAG,EAAE;AAAA,EAC/D;AAEA,SAAO,MAAM,wBAAwB,GAAG,KAAK,IAAI,WAAW;AAY5D,QAAM,EAAE,SAAS,WAAW,OAAO,QAAQ,SAAS,EAAE;AAAA,IAIpD,CAAC,KAAK,CAAC,MAAM,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,CAAC;AAAA,EAChB;AAEA,QAAM,cAAqC;AAAA,IACzC,UAAU;AAAA,IACV;AAAA,IACA,OAAO;AAAA,EAAA;AAGT,QAAM,WAAW,QAAQ,IAAI,CAAC,EAAE,MAAM,oBAAoB,GAAG,IAAI,IAAI,aAAa,EAAE;AAEhF,MAAA;AAEJ,MAAI,mBAAmB,OAAO;AAC5B,UAAM,UAAU,CAAC,WAAW,sBAAsB,UAAU,GAAG,QAAQ;AACvE,WAAO,KAAK,gBAAgB,QAAQ,KAAK,GAAG,CAAC,GAAG;AAChD,aAAS,MAAM,MAAM,OAAO,SAAS,WAAW;AAAA,EAAA,WACvC,mBAAmB,QAAQ;AACpC,UAAM,WAAW,CAAC,OAAO,GAAG,QAAQ;AACpC,WAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,CAAC,GAAG;AAClD,aAAS,MAAM,MAAM,QAAQ,UAAU,WAAW;AAAA,EAAA,WACzC,mBAAmB,QAAQ;AACpC,UAAM,WAAW,CAAC,OAAO,eAAe,GAAG,QAAQ;AACnD,WAAO,KAAK,iBAAiB,SAAS,KAAK,GAAG,CAAC,GAAG;AAClD,aAAS,MAAM,MAAM,QAAQ,UAAU,WAAW;AAAA,EACpD;AAEI,MAAA,QAAQ,YAAY,QAAQ,QAAQ;AAChC,UAAA,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AACF;"}
1
+ {"version":3,"file":"dependencies.mjs","sources":["../../../src/node/core/dependencies.ts"],"sourcesContent":["import os from 'node:os';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport semver, { SemVer } from 'semver';\nimport resolveFrom from 'resolve-from';\nimport execa, { CommonOptions, ExecaReturnValue } from 'execa';\nimport readPkgUp, { PackageJson } from 'read-pkg-up';\nimport type { BuildOptions } from '../build';\nimport { getPackageManager } from './managers';\n\n/**\n * From V5 this will be imported from the package.json of `@strapi/strapi`.\n */\nconst PEER_DEPS = {\n react: '^18.0.0',\n 'react-dom': '^18.0.0',\n 'react-router-dom': '^6.0.0',\n 'styled-components': '^6.0.0',\n};\n\ninterface CheckRequiredDependenciesResult {\n didInstall: boolean;\n}\n\ninterface DepToInstall {\n name: string;\n wantedVersion: string;\n declaredVersion?: never;\n}\n\n/**\n * Checks the user's project that it has declared and installed the required dependencies\n * needed by the Strapi admin project. Whilst generally speaking most modules will be\n * declared by the actual packages there are some packages where you only really want one of\n * and thus they are declared as peer dependencies – react / styled-components / etc.\n *\n * If these deps are not installed or declared, then we prompt the user to correct this. In\n * V4 this is not a hard requirement, but in V5 it will be. Might as well get people started now.\n */\nconst checkRequiredDependencies = async ({\n cwd,\n logger,\n}: Pick<BuildOptions, 'cwd' | 'logger'>): Promise<CheckRequiredDependenciesResult> => {\n /**\n * This enables us to use experimental deps for libraries like\n * react or styled-components. This is useful for testing against.\n */\n if (process.env.USE_EXPERIMENTAL_DEPENDENCIES === 'true') {\n logger.warn('You are using experimental dependencies that may not be compatible with Strapi.');\n return { didInstall: false };\n }\n\n const pkg = await readPkgUp({ cwd });\n\n if (!pkg) {\n throw new Error(`Could not find package.json at path: ${cwd}`);\n }\n\n logger.debug('Loaded package.json:', os.EOL, pkg.packageJson);\n\n interface DepToReview {\n name: string;\n wantedVersion: string;\n declaredVersion: string;\n }\n\n /**\n * Run through each of the peer deps and figure out if they need to be\n * installed or they need their version checked against.\n */\n const { install, review } = Object.entries(PEER_DEPS).reduce<{\n install: DepToInstall[];\n review: DepToReview[];\n }>(\n (acc, [name, version]) => {\n if (!pkg.packageJson.dependencies) {\n throw new Error(`Could not find dependencies in package.json at path: ${cwd}`);\n }\n\n const declaredVersion = pkg.packageJson.dependencies[name];\n\n if (!declaredVersion) {\n acc.install.push({\n name,\n wantedVersion: version,\n });\n } else {\n acc.review.push({\n name,\n wantedVersion: version,\n declaredVersion,\n });\n }\n\n return acc;\n },\n {\n install: [],\n review: [],\n }\n );\n\n if (install.length > 0) {\n logger.info(\n 'The Strapi admin needs to install the following dependencies:',\n os.EOL,\n install.map(({ name, wantedVersion }) => ` - ${name}@${wantedVersion}`).join(os.EOL)\n );\n\n await installDependencies(install, {\n cwd,\n logger,\n });\n\n const [file, ...args] = process.argv;\n\n /**\n * Re-run the same command after installation e.g. strapi build because the yarn.lock might\n * not be the same and could break installations. It's not the best solution, but it works.\n */\n await execa(file, args, { cwd, stdio: 'inherit' });\n return { didInstall: true };\n }\n\n if (review.length) {\n const errors: string[] = [];\n\n for (const dep of review) {\n // The version specified in package.json could be incorrect, eg `foo`\n let minDeclaredVersion: SemVer | null = null;\n try {\n minDeclaredVersion = semver.minVersion(dep.declaredVersion);\n } catch (err) {\n // Intentional fall-through (variable will be left as null, throwing below)\n }\n\n if (!minDeclaredVersion) {\n errors.push(\n `The declared dependency, ${dep.name} has an invalid version in package.json: ${dep.declaredVersion}`\n );\n } else if (!semver.satisfies(minDeclaredVersion, dep.wantedVersion)) {\n /**\n * The delcared version should be semver compatible with our required version\n * of the dependency. If it's not, we should advise the user to change it.\n */\n logger.warn(\n [\n `Declared version of ${dep.name} (${minDeclaredVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n\n const installedVersion = await getModuleVersion(dep.name, cwd);\n\n if (!installedVersion) {\n /**\n * TODO: when we know the packageManager we can advise the actual install command.\n */\n errors.push(\n `The declared dependency, ${dep.name} is not installed. You should install before re-running this command`\n );\n } else if (!semver.satisfies(installedVersion, dep.wantedVersion)) {\n logger.warn(\n [\n `Declared version of ${dep.name} (${installedVersion}) is not compatible with the version required by Strapi (${dep.wantedVersion}).`,\n 'You may experience issues, we recommend you change this.',\n ].join(os.EOL)\n );\n }\n }\n\n if (errors.length > 0 && process.env.NODE_ENV === 'development') {\n throw new Error(`${os.EOL}- ${errors.join(`${os.EOL}- `)}`);\n }\n }\n\n return { didInstall: false };\n};\n\nconst getModule = async (name: string, cwd: string): Promise<PackageJson | null> => {\n const modulePackagePath = resolveFrom.silent(cwd, path.join(name, 'package.json'));\n if (!modulePackagePath) {\n return null;\n }\n const file = await fs.readFile(modulePackagePath, 'utf8').then((res) => JSON.parse(res));\n\n return file;\n};\n\nconst getModuleVersion = async (name: string, cwd: string): Promise<string | null> => {\n const pkg = await getModule(name, cwd);\n\n return pkg?.version || null;\n};\n\nconst installDependencies = async (\n install: DepToInstall[],\n { cwd, logger }: Pick<BuildOptions, 'cwd' | 'logger'>\n) => {\n const packageManager = getPackageManager();\n\n if (!packageManager) {\n logger.error(\n 'Could not find a supported package manager, please install the dependencies manually.'\n );\n process.exit(1);\n }\n\n const execOptions: CommonOptions<'utf8'> = {\n encoding: 'utf8',\n cwd,\n stdio: 'inherit',\n };\n\n const packages = install.map(({ name, wantedVersion }) => `${name}@${wantedVersion}`);\n\n let result: ExecaReturnValue<string> | undefined;\n\n if (packageManager === 'npm') {\n const npmArgs = ['install', '--legacy-peer-deps', '--save', ...packages];\n logger.info(`Running 'npm ${npmArgs.join(' ')}'`);\n result = await execa('npm', npmArgs, execOptions);\n } else if (packageManager === 'yarn') {\n const yarnArgs = ['add', ...packages];\n logger.info(`Running 'yarn ${yarnArgs.join(' ')}'`);\n result = await execa('yarn', yarnArgs, execOptions);\n } else if (packageManager === 'pnpm') {\n const pnpmArgs = ['add', '--save-prod', ...packages];\n logger.info(`Running 'pnpm ${pnpmArgs.join(' ')}'`);\n result = await execa('pnpm', pnpmArgs, execOptions);\n }\n\n if (result?.exitCode || result?.failed) {\n throw new Error('Package installation failed');\n }\n};\n\nexport { checkRequiredDependencies, getModule };\nexport type { CheckRequiredDependenciesResult, PackageJson };\n"],"names":[],"mappings":";;;;;;;;AAaA,MAAM,YAAY;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,qBAAqB;AACvB;AAqBA,MAAM,4BAA4B,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAAsF;AAKhF,MAAA,QAAQ,IAAI,kCAAkC,QAAQ;AACxD,WAAO,KAAK,iFAAiF;AACtF,WAAA,EAAE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
71
71
  const customisations = await adminCustomisations.loadUserAppFile({ appDir, runtimeDir });
72
72
  const features = strapiInstance.config.get("features", void 0);
73
- const { bundler = "webpack", ...restOptions } = options;
73
+ const { bundler = "vite", ...restOptions } = options;
74
74
  const buildContext = {
75
75
  appDir,
76
76
  basePath: `${adminPath}/`,
@@ -1 +1 @@
1
- {"version":3,"file":"create-build-context.js","sources":["../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext<TOptions = unknown> extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions & TOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs<TOptions = unknown> extends CLIContext {\n strapi?: Core.Strapi;\n options?: TOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async <TOptions extends BaseOptions>({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {} as TOptions,\n}: CreateBuildContextArgs<TOptions>): Promise<BuildContext<TOptions>> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverUrl = strapiInstance.config.get<string>('server.url');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPath,\n STRAPI_ADMIN_BACKEND_URL: serverUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n });\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.info(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'webpack', ...restOptions } = options;\n\n const buildContext = {\n appDir,\n basePath: `${adminPath}/`,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions as BaseOptions & TOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n } satisfies BuildContext<TOptions>;\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["createStrapi","loadEnv","env","getStrapiAdminEnvVars","os","path","fs","plugins","getEnabledPlugins","getMapOfPluginsWithAdmin","browserslist","loadUserAppFile"],"mappings":";;;;;;;;;;;;;;;AA+CA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,qBAAqB,OAAqC;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,MAAyE;AAMjE,QAAA,iBACJ,UACAA,kBAAa;AAAA;AAAA,IAEX,QAAQ;AAAA,IACR,SAAS,UAAU,OAAO,QAAQ,UAAU;AAAA;AAAA,IAE5C,YAAY;AAAA,IACZ,iBAAiB;AAAA,EAAA,CAClB;AAEH,QAAM,YAAY,eAAe,OAAO,IAAY,YAAY;AAChE,QAAM,YAAY,eAAe,OAAO,IAAY,YAAY;AAE1D,QAAA,SAAS,eAAe,KAAK,IAAI;AAEvC,QAAMC,IAAAA,QAAQ,GAAG;AAEjB,QAAMC,QAAMC,IAAAA,sBAAsB;AAAA,IAChC,YAAY;AAAA,IACZ,0BAA0B;AAAA,IAC1B,2BAA2B,OAAO,eAAe,UAAU,UAAU;AAAA,EAAA,CACtE;AAEK,QAAA,UAAU,OAAO,KAAKD,KAAG;AAE3B,MAAA,QAAQ,SAAS,GAAG;AACf,WAAA;AAAA,MACL;AAAA,QACE;AAAA,QACA,GAAG,QAAQ,IAAI,CAAC,QAAQ,SAAS,GAAG,EAAE;AAAA,MAAA,EACtC,KAAKE,YAAA,QAAG,GAAG;AAAA,IAAA;AAAA,EAEjB;AAEA,QAAM,WAAWC,cAAK,QAAA,KAAK,eA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import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext<TOptions = unknown> extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions & TOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs<TOptions = unknown> extends CLIContext {\n strapi?: Core.Strapi;\n options?: TOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async <TOptions extends BaseOptions>({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {} as TOptions,\n}: CreateBuildContextArgs<TOptions>): Promise<BuildContext<TOptions>> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverUrl = strapiInstance.config.get<string>('server.url');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPath,\n STRAPI_ADMIN_BACKEND_URL: serverUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n });\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.info(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const buildContext = {\n appDir,\n basePath: `${adminPath}/`,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions as BaseOptions & TOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n } satisfies BuildContext<TOptions>;\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":["createStrapi","loadEnv","env","getStrapiAdminEnvVars","os","path","fs","plugins","getEnabledPlugins","getMapOfPluginsW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;AAAA,EAClD;AAEA,QAAM,aAAaD,cAAAA,QAAK,KAAK,KAAK,WAAW,QAAQ;AAC/C,QAAA,QAAQA,sBAAK,SAAS,KAAKA,sBAAK,KAAK,YAAY,QAAQ,CAAC;AAE1D,QAAAE,YAAU,MAAMC,QAAkB,kBAAA,EAAE,KAAK,QAAQ,YAAY,QAAQ,eAAA,CAAgB;AAE3F,SAAO,MAAM,mBAAmBJ,YAAG,QAAA,KAAKG,SAAO;AAEzC,QAAA,mBAAmBE,iCAAyBF,SAAO;AAEzD,SAAO,MAAM,2BAA2BH,YAAG,QAAA,KAAK,gBAAgB;AAEhE,QAAM,SAASM,sBAAAA,QAAa,WAAW,EAAE,MAAM,IAAA,CAAK,KAAK;AAEzD,QAAM,iBAAiB,MAAMC,oBAAA,gBAAgB,EAAE,QAAQ,WAAY,CAAA;AAEnE,QAAM,WAAW,eAAe,OAAO,IAAI,YAAY,MAAS;AAEhE,QAAM,EAAE,UAAU,QAAQ,GAAG,gBAAgB;AAE7C,QAAM,eAAe;AAAA,IACnB;AAAA,IACA,UAAU,GAAG,SAAS;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAAA,KACAT;AAAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EAAA;AAGK,SAAA;AACT;;"}
@@ -63,7 +63,7 @@ const createBuildContext = async ({
63
63
  const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;
64
64
  const customisations = await loadUserAppFile({ appDir, runtimeDir });
65
65
  const features = strapiInstance.config.get("features", void 0);
66
- const { bundler = "webpack", ...restOptions } = options;
66
+ const { bundler = "vite", ...restOptions } = options;
67
67
  const buildContext = {
68
68
  appDir,
69
69
  basePath: `${adminPath}/`,
@@ -1 +1 @@
1
- {"version":3,"file":"create-build-context.mjs","sources":["../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext<TOptions = unknown> extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions & TOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs<TOptions = unknown> extends CLIContext {\n strapi?: Core.Strapi;\n options?: TOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async <TOptions extends BaseOptions>({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {} as TOptions,\n}: CreateBuildContextArgs<TOptions>): Promise<BuildContext<TOptions>> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverUrl = strapiInstance.config.get<string>('server.url');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPath,\n STRAPI_ADMIN_BACKEND_URL: serverUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n });\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.info(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'webpack', ...restOptions } = options;\n\n const buildContext = {\n appDir,\n basePath: `${adminPath}/`,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions as BaseOptions & TOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n } satisfies BuildContext<TOptions>;\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":[],"mappings":";;;;;;;;AA+CA,MAAM,uBAAuB;AAAA,EAC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;AAE1D,QAAA,UAAU,MAAM,kBAAkB,EAAE,KAAK,QAAQ,YAAY,QAAQ,eAAA,CAAgB;AAE3F,SAAO,MAAM,mBAAmB,GAAG,KAAK,OAAO;AAEzC,QAAA,mBAAmB,yBAAyB,OAAO;AAEzD,SAAO,MAAM,2BAA2B,GAAG,KAAK,gBAAgB;AAEhE,QAAM,SAAS,aAAa,WAAW,EAAE,MAAM,IAAA,CAAK,KAAK;AAEzD,QAAM,iBAAiB,MAAM,gBAAgB,EAAE,QAAQ,WAAY,CAAA;AAEnE,QAAM,WAAW,eAAe,OAAO,IAAI,YAAY,MAAS;AAEhE,QAAM,EAAE,UAAU,WAAW,GAAG,gBAAgB;AAEhD,QAAM,eAAe;AAAA,IACnB;AAAA,IACA,UAAU,GAAG,SAAS;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EAAA;AAGK,SAAA;AACT;"}
1
+ {"version":3,"file":"create-build-context.mjs","sources":["../../src/node/create-build-context.ts"],"sourcesContent":["import os from 'node:os';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\nimport browserslist from 'browserslist';\nimport { createStrapi } from '@strapi/core';\nimport { Core, Modules } from '@strapi/types';\n\nimport type { CLIContext } from '../cli/types';\nimport { getStrapiAdminEnvVars, loadEnv } from './core/env';\n\nimport { PluginMeta, getEnabledPlugins, getMapOfPluginsWithAdmin } from './core/plugins';\nimport { AppFile, loadUserAppFile } from './core/admin-customisations';\nimport type { BaseContext } from './types';\n\ninterface BaseOptions {\n stats?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n bundler?: 'webpack' | 'vite';\n open?: boolean;\n}\n\ninterface BuildContext<TOptions = unknown> extends BaseContext {\n /**\n * The customisations defined by the user in their app.js file\n */\n customisations?: AppFile;\n /**\n * Features object with future flags\n */\n features?: Modules.Features.FeaturesService['config'];\n /**\n * The build options\n */\n options: BaseOptions & TOptions;\n /**\n * The plugins to be included in the JS bundle\n * incl. internal plugins, third party plugins & local plugins\n */\n plugins: PluginMeta[];\n}\n\ninterface CreateBuildContextArgs<TOptions = unknown> extends CLIContext {\n strapi?: Core.Strapi;\n options?: TOptions;\n}\n\nconst DEFAULT_BROWSERSLIST = [\n 'last 3 major versions',\n 'Firefox ESR',\n 'last 2 Opera versions',\n 'not dead',\n];\n\nconst createBuildContext = async <TOptions extends BaseOptions>({\n cwd,\n logger,\n tsconfig,\n strapi,\n options = {} as TOptions,\n}: CreateBuildContextArgs<TOptions>): Promise<BuildContext<TOptions>> => {\n /**\n * If you make a new strapi instance when one already exists,\n * you will overwrite the global and the app will _most likely_\n * crash and die.\n */\n const strapiInstance =\n strapi ??\n createStrapi({\n // Directories\n appDir: cwd,\n distDir: tsconfig?.config.options.outDir ?? '',\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const serverUrl = strapiInstance.config.get<string>('server.url');\n const adminPath = strapiInstance.config.get<string>('admin.path');\n\n const appDir = strapiInstance.dirs.app.root;\n\n await loadEnv(cwd);\n\n const env = getStrapiAdminEnvVars({\n ADMIN_PATH: adminPath,\n STRAPI_ADMIN_BACKEND_URL: serverUrl,\n STRAPI_TELEMETRY_DISABLED: String(strapiInstance.telemetry.isDisabled),\n });\n\n const envKeys = Object.keys(env);\n\n if (envKeys.length > 0) {\n logger.info(\n [\n 'Including the following ENV variables as part of the JS bundle:',\n ...envKeys.map((key) => ` - ${key}`),\n ].join(os.EOL)\n );\n }\n\n const distPath = path.join(strapiInstance.dirs.dist.root, 'build');\n const distDir = path.relative(cwd, distPath);\n\n /**\n * If the distPath already exists, clean it\n */\n try {\n logger.debug(`Cleaning dist folder: ${distPath}`);\n await fs.rm(distPath, { recursive: true, force: true });\n logger.debug('Cleaned dist folder');\n } catch {\n // do nothing, it will fail if the folder does not exist\n logger.debug('There was no dist folder to clean');\n }\n\n const runtimeDir = path.join(cwd, '.strapi', 'client');\n const entry = path.relative(cwd, path.join(runtimeDir, 'app.js'));\n\n const plugins = await getEnabledPlugins({ cwd, logger, runtimeDir, strapi: strapiInstance });\n\n logger.debug('Enabled plugins', os.EOL, plugins);\n\n const pluginsWithFront = getMapOfPluginsWithAdmin(plugins);\n\n logger.debug('Enabled plugins with FE', os.EOL, pluginsWithFront);\n\n const target = browserslist.loadConfig({ path: cwd }) ?? DEFAULT_BROWSERSLIST;\n\n const customisations = await loadUserAppFile({ appDir, runtimeDir });\n\n const features = strapiInstance.config.get('features', undefined);\n\n const { bundler = 'vite', ...restOptions } = options;\n\n const buildContext = {\n appDir,\n basePath: `${adminPath}/`,\n bundler,\n customisations,\n cwd,\n distDir,\n distPath,\n entry,\n env,\n features,\n logger,\n options: restOptions as BaseOptions & TOptions,\n plugins: pluginsWithFront,\n runtimeDir,\n strapi: strapiInstance,\n target,\n tsconfig,\n } satisfies BuildContext<TOptions>;\n\n return buildContext;\n};\n\nexport { createBuildContext };\nexport type { BuildContext, CreateBuildContextArgs };\n"],"names":[],"mappings":";;;;;;;;AA+CA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,qBAAqB,OAAqC;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,MAAyE;AAMjE,QAAA,iBACJ,UACA,aAAa;AAAA;AAAA,IAEX,QAAQ;AAAA,IACR,SAAS,UAAU,OAAO,QAAQ,UAAU;AAAA;AAAA,IAE5C,YAAY;AAAA,IACZ,iBAAiB;AAAA,EAAA,CAClB;AAEH,QAAM,YAAY,eAAe,OAAO,IAAY,YAAY;AAChE,QAAM,YAAY,eAAe,OAAO,IAAY,YAAY;AAE1D,QAAA,SAAS,eAAe,KAAK,IAAI;AAEvC,QAAM,QAAQ,GAAG;AAEjB,QAAM,MAAM,sBAAsB;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S;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,EAAA;AAGK,SAAA;AACT;"}
@@ -83,7 +83,7 @@ const resolveDevelopmentConfig = async (ctx) => {
83
83
  server: {
84
84
  middlewareMode: true,
85
85
  open: ctx.options.open,
86
- hmr: true
86
+ hmr: { server: ctx.strapi.server.httpServer }
87
87
  },
88
88
  appType: "custom"
89
89
  };
@@ -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 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 base: ctx.basePath,\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 middlewareMode: true,\n open: ctx.options.open,\n hmr: true,\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":["browserslistToEsbuild","react","buildFilesPlugin","monorepo","loadStrapiMonorepo","getMonorepoAliases","config","getUserConfig"],"mappings":";;;;;;;;;;;AAUA,MAAM,oBAAoB,OAAO,QAA6C;AACtE,QAAA,SAASA,+BAAAA,QAAsB,IAAI,MAAM;AAExC,SAAA;AAAA,IACL,MAAM,IAAI;AAAA,IACV,OAAO;AAAA,MACL,aAAa;AAAA;AAAA,MACb,QAAQ,IAAI;AAAA,MACZ;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAA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,EAAA;AAEb;AAEA,MAAM,eAAe,CAAC,kBAAkB,mBAAmB,gBAAgB;AAIrE,MAAA,4BAA4B,OAAOG,UAAsB,QAAsB;AACnF,QAAM,aAAa,MAAMC,OAAAA,cAA8B,cAAc,GAAG;AAExE,MAAI,YAAY;AACd,WAAO,WAAWD,QAAM;AAAA,EAC1B;AAEO,SAAAA;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 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 base: ctx.basePath,\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 middlewareMode: true,\n open: ctx.options.open,\n hmr: { server: ctx.strapi.server.httpServer },\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":["browserslistToEsbuild","react","buildFilesPlugin","monorepo","loadStrapiMonorepo","getMonorepoAliases","config","getUserConfig"],"mappings":";;;;;;;;;;;AAUA,MAAM,oBAAoB,OAAO,QAA6C;AACtE,QAAA,SAASA,+BAAAA,QAAsB,IAAI,MAAM;AAExC,SAAA;AAAA,IACL,MAAM,IAAI;AAAA,IACV,OAAO;AAAA,MACL,aAAa;AAAA;AAAA,MACb,QAAQ,IAAI;AAAA,MACZ;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN,eAAe,IAAI;AAAA,IACrB;AAAA,IACA,WAAW;AAAA,IACX,cAAc;AAAA,MACZ,SAAS;AAAA;AAAA;AAAA;AAAA,QAIP;AAAA,QACA;AAAA,QACA;AAAA,QACA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;AACnF,QAAM,aAAa,MAAMC,OAAAA,cAA8B,cAAc,GAAG;AAExE,MAAI,YAAY;AACd,WAAO,WAAWD,QAAM;AAAA,EAC1B;AAEO,SAAAA;AACT;;;;"}
@@ -78,7 +78,7 @@ const resolveDevelopmentConfig = async (ctx) => {
78
78
  server: {
79
79
  middlewareMode: true,
80
80
  open: ctx.options.open,
81
- hmr: true
81
+ hmr: { server: ctx.strapi.server.httpServer }
82
82
  },
83
83
  appType: "custom"
84
84
  };
@@ -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 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 base: ctx.basePath,\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 middlewareMode: true,\n open: ctx.options.open,\n hmr: true,\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":[],"mappings":";;;;;;AAUA,MAAM,oBAAoB,OAAO,QAA6C;AACtE,QAAA,SAAS,sBAAsB,IAAI,MAAM;AAExC,SAAA;AAAA,IACL,MAAM,IAAI;AAAA,IACV,OAAO;AAAA,MACL,aAAa;AAAA;AAAA,MACb,QAAQ,IAAI;AAAA,MACZ;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN,eAAe,IAAI;AAAA,IACrB;AAAA,IACA,WAAW;AAAA,IACX,cAAc;AAAA,MACZ,SAAS;AAAA;AAAA;AAAA;AAAA,QAIP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF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AEO,SAAA;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 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 base: ctx.basePath,\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 middlewareMode: true,\n open: ctx.options.open,\n hmr: { server: ctx.strapi.server.httpServer },\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":[],"mappings":";;;;;;AAUA,MAAM,oBAAoB,OAAO,QAA6C;AACtE,QAAA,SAAS,sBAAsB,IAAI,MAAM;AAExC,SAAA;AAAA,IACL,MAAM,IAAI;AAAA,IACV,OAAO;AAAA,MACL,aAAa;AAAA;AAAA,MACb,QAAQ,IAAI;AAAA,MACZ;AAAA,IACF;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN,eAAe,IAAI;AAAA,IACrB;AAAA,IACA,WAAW;AAAA,IACX,cAAc;AAAA,MACZ,SAAS;AAAA;AAAA;AAAA;AAAA,QAIP;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,SAAS;AAAA;AAAA,MAEP,QAAQ,CAAC,SAAS,aAAa,oBAAoB,mBAAmB;AAAA,IACxE;AAAA,IACA,SAAS,CAAC,MAAA,GAAS,iBAAiB,GAAG,CAAC;AAAA,EAAA;AAE5C;AAEM,MAAA,0BAA0B,OAAO,QAA6C;AAC5E,QAAA;AAAA,IACJ,SAAS,EAAE,QAAQ,WAAW;AAAA,EAC5B,IAAA;AAEE,QAAA,aAAa,MAAM,kBAAkB,GAAG;AAEvC,SAAA;AAAA,IACL,GAAG;AAAA,IACH,MAAM,IAAI;AAAA,IACV,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,MACL,GAAG,WAAW;AAAA,MACd,WAAW;AAAA,MACX;AAAA,MACA,WAAW;AAAA,MACX,eAAe;AAAA,QACb,OAAO;AAAA,UACL,QAAQ,IAAI;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AAEM,MAAA,2BAA2B,OAAO,QAA6C;AACnF,QAAM,WAAW,MAAM,mBAAmB,IAAI,GAAG;AAC3C,QAAA,aAAa,MAAM,kBAAkB,GAAG;AAEvC,SAAA;AAAA,IACL,GAAG;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,MACP,GAAG,WAAW;AAAA,MACd,OAAO;AAAA,QACL,GAAG,WAAW,SAAS;AAAA,QACvB,GAAG,mBAAmB,EAAE,UAAU;AAAA,MACpC;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,gBAAgB;AAAA,MAChB,MAAM,IAAI,QAAQ;AAAA,MAClB,KAAK,EAAE,QAAQ,IAAI,OAAO,OAAO,WAAW;AAAA,IAC9C;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;AAEA,MAAM,eAAe,CAAC,kBAAkB,mBAAmB,gBAAgB;AAIrE,MAAA,4BAA4B,OAAO,QAAsB,QAAsB;AACnF,QAAM,aAAa,MAAM,cAA8B,cAAc,GAAG;AAExE,MAAI,YAAY;AACd,WAAO,WAAW,MAAM;AAAA,EAC1B;AAEO,SAAA;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "5.0.0-beta.9",
3
+ "version": "5.0.0-rc.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",
@@ -109,25 +109,26 @@
109
109
  },
110
110
  "dependencies": {
111
111
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
112
- "@strapi/admin": "5.0.0-beta.9",
113
- "@strapi/content-manager": "5.0.0-beta.9",
114
- "@strapi/content-releases": "5.0.0-beta.9",
115
- "@strapi/content-type-builder": "5.0.0-beta.9",
116
- "@strapi/core": "5.0.0-beta.9",
117
- "@strapi/data-transfer": "5.0.0-beta.9",
118
- "@strapi/database": "5.0.0-beta.9",
119
- "@strapi/email": "5.0.0-beta.9",
120
- "@strapi/generate-new": "5.0.0-beta.9",
121
- "@strapi/generators": "5.0.0-beta.9",
122
- "@strapi/i18n": "5.0.0-beta.9",
123
- "@strapi/logger": "5.0.0-beta.9",
112
+ "@strapi/admin": "5.0.0-rc.0",
113
+ "@strapi/cloud-cli": "5.0.0-rc.0",
114
+ "@strapi/content-manager": "5.0.0-rc.0",
115
+ "@strapi/content-releases": "5.0.0-rc.0",
116
+ "@strapi/content-type-builder": "5.0.0-rc.0",
117
+ "@strapi/core": "5.0.0-rc.0",
118
+ "@strapi/data-transfer": "5.0.0-rc.0",
119
+ "@strapi/database": "5.0.0-rc.0",
120
+ "@strapi/email": "5.0.0-rc.0",
121
+ "@strapi/generate-new": "5.0.0-rc.0",
122
+ "@strapi/generators": "5.0.0-rc.0",
123
+ "@strapi/i18n": "5.0.0-rc.0",
124
+ "@strapi/logger": "5.0.0-rc.0",
124
125
  "@strapi/pack-up": "5.0.0",
125
- "@strapi/permissions": "5.0.0-beta.9",
126
- "@strapi/review-workflows": "5.0.0-beta.9",
127
- "@strapi/types": "5.0.0-beta.9",
128
- "@strapi/typescript-utils": "5.0.0-beta.9",
129
- "@strapi/upload": "5.0.0-beta.9",
130
- "@strapi/utils": "5.0.0-beta.9",
126
+ "@strapi/permissions": "5.0.0-rc.0",
127
+ "@strapi/review-workflows": "5.0.0-rc.0",
128
+ "@strapi/types": "5.0.0-rc.0",
129
+ "@strapi/typescript-utils": "5.0.0-rc.0",
130
+ "@strapi/upload": "5.0.0-rc.0",
131
+ "@strapi/utils": "5.0.0-rc.0",
131
132
  "@types/nodemon": "1.19.6",
132
133
  "@vitejs/plugin-react-swc": "3.6.0",
133
134
  "boxen": "5.1.2",
@@ -135,6 +136,8 @@
135
136
  "browserslist-to-esbuild": "1.2.0",
136
137
  "chalk": "4.1.2",
137
138
  "chokidar": "3.5.3",
139
+ "ci-info": "3.8.0",
140
+ "cli-progress": "3.12.0",
138
141
  "cli-table3": "0.6.2",
139
142
  "commander": "8.3.0",
140
143
  "concurrently": "8.2.2",
@@ -180,10 +183,10 @@
180
183
  "@types/node": "18.19.24",
181
184
  "@types/webpack-bundle-analyzer": "4.7.0",
182
185
  "@types/webpack-hot-middleware": "2.25.9",
183
- "eslint-config-custom": "5.0.0-beta.9",
186
+ "eslint-config-custom": "5.0.0-rc.0",
184
187
  "react": "18.3.1",
185
188
  "react-dom": "18.3.1",
186
- "tsconfig": "5.0.0-beta.9"
189
+ "tsconfig": "5.0.0-rc.0"
187
190
  },
188
191
  "peerDependencies": {
189
192
  "react": "^17.0.0 || ^18.0.0",
@@ -195,5 +198,5 @@
195
198
  "node": ">=18.0.0 <=20.x.x",
196
199
  "npm": ">=6.0.0"
197
200
  },
198
- "gitHead": "0a5a7b91474a18df8a8c6c81613cca1f9c598445"
201
+ "gitHead": "ec0af1ddc1aa1c774e42db971848c6b95517d4ad"
199
202
  }