@strapi/strapi 5.49.0 → 5.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/admin.d.ts +0 -1
  2. package/dist/admin.d.ts.map +1 -1
  3. package/dist/cli/commands/admin/active-user.d.ts.map +1 -1
  4. package/dist/cli/commands/admin/block-user.d.ts.map +1 -1
  5. package/dist/cli/commands/admin/create-user.d.ts.map +1 -1
  6. package/dist/cli/commands/admin/delete-user.d.ts.map +1 -1
  7. package/dist/cli/commands/admin/reset-user-password.d.ts.map +1 -1
  8. package/dist/cli/commands/configuration/dump.d.ts.map +1 -1
  9. package/dist/cli/commands/configuration/restore.d.ts.map +1 -1
  10. package/dist/cli/commands/export/action.d.ts.map +1 -1
  11. package/dist/cli/commands/import/action.d.ts.map +1 -1
  12. package/dist/cli/commands/openapi/generate.d.ts.map +1 -1
  13. package/dist/cli/commands/start.d.ts.map +1 -1
  14. package/dist/cli/commands/transfer/action.d.ts.map +1 -1
  15. package/dist/cli/commands/ts/generate-types.d.ts.map +1 -1
  16. package/dist/cli/index.d.ts.map +1 -1
  17. package/dist/cli/utils/commander.d.ts.map +1 -1
  18. package/dist/cli/utils/data-transfer.d.ts +1 -1
  19. package/dist/cli/utils/data-transfer.d.ts.map +1 -1
  20. package/dist/cli/utils/helpers.d.ts +0 -1
  21. package/dist/cli/utils/helpers.d.ts.map +1 -1
  22. package/dist/cli/utils/logger.d.ts.map +1 -1
  23. package/dist/cli/utils/pkg.d.ts.map +1 -1
  24. package/dist/cli/utils/telemetry.d.ts.map +1 -1
  25. package/dist/cli/utils/try-quick-outdir.d.ts +12 -0
  26. package/dist/cli/utils/try-quick-outdir.d.ts.map +1 -0
  27. package/dist/cli/utils/tsconfig.d.ts +1 -1
  28. package/dist/cli/utils/tsconfig.d.ts.map +1 -1
  29. package/dist/cli.js +18 -7
  30. package/dist/cli.js.map +1 -1
  31. package/dist/cli.mjs +18 -7
  32. package/dist/cli.mjs.map +1 -1
  33. package/dist/load/package-path.d.ts.map +1 -1
  34. package/dist/node/build.d.ts.map +1 -1
  35. package/dist/node/core/admin-customisations.d.ts +1 -1
  36. package/dist/node/core/admin-customisations.d.ts.map +1 -1
  37. package/dist/node/core/admin-vite-alias-modules.d.ts +15 -0
  38. package/dist/node/core/admin-vite-alias-modules.d.ts.map +1 -0
  39. package/dist/node/core/admin-vite-aliases.d.ts +7 -0
  40. package/dist/node/core/admin-vite-aliases.d.ts.map +1 -0
  41. package/dist/node/core/aliases.d.ts.map +1 -1
  42. package/dist/node/core/config.d.ts.map +1 -1
  43. package/dist/node/core/dependencies.d.ts.map +1 -1
  44. package/dist/node/core/ensure-admin-dependencies.d.ts.map +1 -1
  45. package/dist/node/core/env.d.ts.map +1 -1
  46. package/dist/node/core/errors.d.ts.map +1 -1
  47. package/dist/node/core/files.d.ts.map +1 -1
  48. package/dist/node/core/linked-packages.d.ts.map +1 -1
  49. package/dist/node/core/plugins.d.ts +4 -4
  50. package/dist/node/core/plugins.d.ts.map +1 -1
  51. package/dist/node/core/resolve-module.d.ts.map +1 -1
  52. package/dist/node/core/timer.d.ts.map +1 -1
  53. package/dist/node/create-build-context.d.ts.map +1 -1
  54. package/dist/node/develop.d.ts.map +1 -1
  55. package/dist/node/staticFiles.d.ts.map +1 -1
  56. package/dist/node/vite/build.d.ts.map +1 -1
  57. package/dist/node/vite/config.d.ts.map +1 -1
  58. package/dist/node/vite/plugins.d.ts.map +1 -1
  59. package/dist/node/vite/watch.d.ts.map +1 -1
  60. package/dist/node/webpack/build.d.ts.map +1 -1
  61. package/dist/node/webpack/config.d.ts.map +1 -1
  62. package/dist/node/webpack/watch.d.ts.map +1 -1
  63. package/dist/package.json.js +1 -1
  64. package/dist/package.json.mjs +1 -1
  65. package/dist/src/cli/commands/start.js +23 -7
  66. package/dist/src/cli/commands/start.js.map +1 -1
  67. package/dist/src/cli/commands/start.mjs +22 -6
  68. package/dist/src/cli/commands/start.mjs.map +1 -1
  69. package/dist/src/cli/commands/ts/generate-types.js +8 -9
  70. package/dist/src/cli/commands/ts/generate-types.js.map +1 -1
  71. package/dist/src/cli/commands/ts/generate-types.mjs +6 -3
  72. package/dist/src/cli/commands/ts/generate-types.mjs.map +1 -1
  73. package/dist/src/cli/utils/try-quick-outdir.js +80 -0
  74. package/dist/src/cli/utils/try-quick-outdir.js.map +1 -0
  75. package/dist/src/cli/utils/try-quick-outdir.mjs +72 -0
  76. package/dist/src/cli/utils/try-quick-outdir.mjs.map +1 -0
  77. package/dist/src/cli/utils/tsconfig.js +13 -5
  78. package/dist/src/cli/utils/tsconfig.js.map +1 -1
  79. package/dist/src/cli/utils/tsconfig.mjs +13 -4
  80. package/dist/src/cli/utils/tsconfig.mjs.map +1 -1
  81. package/dist/src/node/core/admin-vite-alias-modules.js +23 -0
  82. package/dist/src/node/core/admin-vite-alias-modules.js.map +1 -0
  83. package/dist/src/node/core/admin-vite-alias-modules.mjs +20 -0
  84. package/dist/src/node/core/admin-vite-alias-modules.mjs.map +1 -0
  85. package/dist/src/node/core/admin-vite-aliases.js +16 -0
  86. package/dist/src/node/core/admin-vite-aliases.js.map +1 -0
  87. package/dist/src/node/core/admin-vite-aliases.mjs +14 -0
  88. package/dist/src/node/core/admin-vite-aliases.mjs.map +1 -0
  89. package/dist/src/node/core/resolve-module.js +14 -1
  90. package/dist/src/node/core/resolve-module.js.map +1 -1
  91. package/dist/src/node/core/resolve-module.mjs +13 -1
  92. package/dist/src/node/core/resolve-module.mjs.map +1 -1
  93. package/dist/src/node/vite/config.js +4 -21
  94. package/dist/src/node/vite/config.js.map +1 -1
  95. package/dist/src/node/vite/config.mjs +4 -21
  96. package/dist/src/node/vite/config.mjs.map +1 -1
  97. package/dist/test/mocks/inquirer.d.ts +0 -1
  98. package/dist/test/mocks/inquirer.d.ts.map +1 -1
  99. package/package.json +24 -25
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,QAAA,MAAM,KAAK,QAAe,YAAY,qBAoCrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,QAAA,MAAM,KAAK,GAAU,KAAK,YAAY,qBAoCrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAA4C,MAAM,SAAS,CAAC;AAIlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA+G5D,QAAA,MAAM,wBAAwB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAqDhF,CAAC;AAEF,QAAA,MAAM,uBAAuB,QAAe,YAAY,KAAG,QAAQ,aAAa,CAyC/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,WAAkB,aAAa,OAAO,YAAY,2BAoBhF,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAA4C,MAAM,SAAS,CAAC;AAIlF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA+G5D,QAAA,MAAM,wBAAwB,GAAU,KAAK,YAAY,KAAG,OAAO,CAAC,aAAa,CAqDhF,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAU,KAAK,YAAY,KAAG,OAAO,CAAC,aAAa,CAyC/E,CAAC;AAMF,QAAA,MAAM,yBAAyB,GAAU,QAAQ,aAAa,EAAE,KAAK,YAAY,2BAoBhF,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/watch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,UAAU,cAAc;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,QAAA,MAAM,KAAK,QAAe,YAAY,KAAG,QAAQ,cAAc,CA+F9D,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/node/webpack/watch.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,UAAU,cAAc;IACtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,QAAA,MAAM,KAAK,GAAU,KAAK,YAAY,KAAG,OAAO,CAAC,cAAc,CA+F9D,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "5.49.0";
3
+ var version = "5.50.1";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.js.map
@@ -1,4 +1,4 @@
1
- var version = "5.49.0";
1
+ var version = "5.50.1";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.mjs.map
@@ -2,22 +2,38 @@
2
2
 
3
3
  var commander = require('commander');
4
4
  var fs = require('fs');
5
- var tsUtils = require('@strapi/typescript-utils');
5
+ var path = require('path');
6
6
  var core = require('@strapi/core');
7
7
  var helpers = require('../utils/helpers.js');
8
+ var tryQuickOutdir = require('../utils/try-quick-outdir.js');
8
9
 
9
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
11
 
11
12
  var fs__default = /*#__PURE__*/_interopDefault(fs);
12
- var tsUtils__default = /*#__PURE__*/_interopDefault(tsUtils);
13
+ var path__default = /*#__PURE__*/_interopDefault(path);
13
14
 
14
15
  const action = async ()=>{
15
16
  const appDir = process.cwd();
16
- const isTSProject = await tsUtils__default.default.isUsingTypeScript(appDir);
17
- const outDir = await tsUtils__default.default.resolveOutDir(appDir);
18
- const distDir = isTSProject ? outDir : appDir;
19
- const buildDirExists = fs__default.default.existsSync(outDir);
20
- if (isTSProject && !buildDirExists) throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
17
+ const tsconfigPath = path__default.default.join(appDir, 'tsconfig.json');
18
+ let distDir;
19
+ if (!fs__default.default.existsSync(tsconfigPath)) {
20
+ distDir = appDir;
21
+ } else {
22
+ const quickOutDir = tryQuickOutdir.tryQuickOutDir(appDir, tsconfigPath);
23
+ if (quickOutDir && fs__default.default.existsSync(path__default.default.join(quickOutDir, 'src', 'index.js'))) {
24
+ // Built output at configured outDir — skip loading `@strapi/typescript-utils`
25
+ distDir = quickOutDir;
26
+ } else {
27
+ // Custom/extended tsconfig or unbuilt project — fall back to the slow correct path
28
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
29
+ const tsUtils = require('@strapi/typescript-utils');
30
+ const outDir = await tsUtils.resolveOutDir(appDir);
31
+ if (!fs__default.default.existsSync(outDir)) {
32
+ throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
33
+ }
34
+ distDir = outDir;
35
+ }
36
+ }
21
37
  core.createStrapi({
22
38
  appDir,
23
39
  distDir
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n const buildDirExists = fs.existsSync(outDir);\n if (isTSProject && !buildDirExists)\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","isTSProject","tsUtils","isUsingTypeScript","outDir","resolveOutDir","distDir","buildDirExists","fs","existsSync","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;;;;;;;;AAQA,MAAMA,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAAA,GAAc,MAAMC,wBAAAA,CAAQC,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAAA,GAAS,MAAMF,wBAAAA,CAAQG,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAAAA,GAASN,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,mBAAAA,CAAGC,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,KAAAA,CACR,CAAA,EAAGN,MAAAA,CAAO,mFAAmF,CAAC,CAAA;IAGlGO,iBAAAA,CAAa;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,kBAAU,OAAA,EAASnB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"start.js","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\nimport { tryQuickOutDir } from '../utils/try-quick-outdir';\n\nconst action = async () => {\n const appDir = process.cwd();\n const tsconfigPath = path.join(appDir, 'tsconfig.json');\n\n let distDir: string;\n\n if (!fs.existsSync(tsconfigPath)) {\n distDir = appDir;\n } else {\n const quickOutDir = tryQuickOutDir(appDir, tsconfigPath);\n\n if (quickOutDir && fs.existsSync(path.join(quickOutDir, 'src', 'index.js'))) {\n // Built output at configured outDir skip loading `@strapi/typescript-utils`\n distDir = quickOutDir;\n } else {\n // Custom/extended tsconfig or unbuilt project — fall back to the slow correct path\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsUtils = require('@strapi/typescript-utils');\n const outDir = await tsUtils.resolveOutDir(appDir);\n\n if (!fs.existsSync(outDir)) {\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n }\n\n distDir = outDir;\n }\n }\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","tsconfigPath","path","join","distDir","fs","existsSync","quickOutDir","tryQuickOutDir","tsUtils","require","outDir","resolveOutDir","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;;;;;;;;;AASA,MAAMA,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAC1B,IAAA,MAAMC,YAAAA,GAAeC,qBAAAA,CAAKC,IAAI,CAACL,MAAAA,EAAQ,eAAA,CAAA;IAEvC,IAAIM,OAAAA;AAEJ,IAAA,IAAI,CAACC,mBAAAA,CAAGC,UAAU,CAACL,YAAAA,CAAAA,EAAe;QAChCG,OAAAA,GAAUN,MAAAA;IACZ,CAAA,MAAO;QACL,MAAMS,WAAAA,GAAcC,8BAAeV,MAAAA,EAAQG,YAAAA,CAAAA;QAE3C,IAAIM,WAAAA,IAAeF,oBAAGC,UAAU,CAACJ,sBAAKC,IAAI,CAACI,WAAAA,EAAa,KAAA,EAAO,UAAA,CAAA,CAAA,EAAc;;YAE3EH,OAAAA,GAAUG,WAAAA;QACZ,CAAA,MAAO;;;AAGL,YAAA,MAAME,UAAUC,OAAAA,CAAQ,0BAAA,CAAA;AACxB,YAAA,MAAMC,MAAAA,GAAS,MAAMF,OAAAA,CAAQG,aAAa,CAACd,MAAAA,CAAAA;AAE3C,YAAA,IAAI,CAACO,mBAAAA,CAAGC,UAAU,CAACK,MAAAA,CAAAA,EAAS;AAC1B,gBAAA,MAAM,IAAIE,KAAAA,CACR,CAAA,EAAGF,MAAAA,CAAO,mFAAmF,CAAC,CAAA;AAElG,YAAA;YAEAP,OAAAA,GAAUO,MAAAA;AACZ,QAAA;AACF,IAAA;IAEAG,iBAAAA,CAAa;AAAEhB,QAAAA,MAAAA;AAAQM,QAAAA;AAAQ,KAAA,CAAA,CAAGW,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,uBAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZrB,MAAM,CAACsB,kBAAU,OAAA,EAAStB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
@@ -1,16 +1,32 @@
1
1
  import { createCommand } from 'commander';
2
2
  import fs from 'fs';
3
- import tsUtils__default from '@strapi/typescript-utils';
3
+ import path from 'path';
4
4
  import { createStrapi } from '@strapi/core';
5
5
  import { runAction } from '../utils/helpers.mjs';
6
+ import { tryQuickOutDir } from '../utils/try-quick-outdir.mjs';
6
7
 
7
8
  const action = async ()=>{
8
9
  const appDir = process.cwd();
9
- const isTSProject = await tsUtils__default.isUsingTypeScript(appDir);
10
- const outDir = await tsUtils__default.resolveOutDir(appDir);
11
- const distDir = isTSProject ? outDir : appDir;
12
- const buildDirExists = fs.existsSync(outDir);
13
- if (isTSProject && !buildDirExists) throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
10
+ const tsconfigPath = path.join(appDir, 'tsconfig.json');
11
+ let distDir;
12
+ if (!fs.existsSync(tsconfigPath)) {
13
+ distDir = appDir;
14
+ } else {
15
+ const quickOutDir = tryQuickOutDir(appDir, tsconfigPath);
16
+ if (quickOutDir && fs.existsSync(path.join(quickOutDir, 'src', 'index.js'))) {
17
+ // Built output at configured outDir — skip loading `@strapi/typescript-utils`
18
+ distDir = quickOutDir;
19
+ } else {
20
+ // Custom/extended tsconfig or unbuilt project — fall back to the slow correct path
21
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
22
+ const tsUtils = require('@strapi/typescript-utils');
23
+ const outDir = await tsUtils.resolveOutDir(appDir);
24
+ if (!fs.existsSync(outDir)) {
25
+ throw new Error(`${outDir} directory not found. Please run the build command before starting your application`);
26
+ }
27
+ distDir = outDir;
28
+ }
29
+ }
14
30
  createStrapi({
15
31
  appDir,
16
32
  distDir
@@ -1 +1 @@
1
- {"version":3,"file":"start.mjs","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\nconst action = async () => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n const buildDirExists = fs.existsSync(outDir);\n if (isTSProject && !buildDirExists)\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","isTSProject","tsUtils","isUsingTypeScript","outDir","resolveOutDir","distDir","buildDirExists","fs","existsSync","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;AAQA,MAAMA,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAE1B,IAAA,MAAMC,WAAAA,GAAc,MAAMC,gBAAAA,CAAQC,iBAAiB,CAACL,MAAAA,CAAAA;AAEpD,IAAA,MAAMM,MAAAA,GAAS,MAAMF,gBAAAA,CAAQG,aAAa,CAACP,MAAAA,CAAAA;IAC3C,MAAMQ,OAAAA,GAAUL,cAAcG,MAAAA,GAASN,MAAAA;IAEvC,MAAMS,cAAAA,GAAiBC,EAAAA,CAAGC,UAAU,CAACL,MAAAA,CAAAA;IACrC,IAAIH,WAAAA,IAAe,CAACM,cAAAA,EAClB,MAAM,IAAIG,KAAAA,CACR,CAAA,EAAGN,MAAAA,CAAO,mFAAmF,CAAC,CAAA;IAGlGO,YAAAA,CAAa;AAAEb,QAAAA,MAAAA;AAAQQ,QAAAA;AAAQ,KAAA,CAAA,CAAGM,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZlB,MAAM,CAACmB,UAAU,OAAA,EAASnB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"start.mjs","sources":["../../../../src/cli/commands/start.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport fs from 'fs';\nimport path from 'path';\nimport { createStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\nimport { tryQuickOutDir } from '../utils/try-quick-outdir';\n\nconst action = async () => {\n const appDir = process.cwd();\n const tsconfigPath = path.join(appDir, 'tsconfig.json');\n\n let distDir: string;\n\n if (!fs.existsSync(tsconfigPath)) {\n distDir = appDir;\n } else {\n const quickOutDir = tryQuickOutDir(appDir, tsconfigPath);\n\n if (quickOutDir && fs.existsSync(path.join(quickOutDir, 'src', 'index.js'))) {\n // Built output at configured outDir skip loading `@strapi/typescript-utils`\n distDir = quickOutDir;\n } else {\n // Custom/extended tsconfig or unbuilt project — fall back to the slow correct path\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsUtils = require('@strapi/typescript-utils');\n const outDir = await tsUtils.resolveOutDir(appDir);\n\n if (!fs.existsSync(outDir)) {\n throw new Error(\n `${outDir} directory not found. Please run the build command before starting your application`\n );\n }\n\n distDir = outDir;\n }\n }\n\n createStrapi({ appDir, distDir }).start();\n};\n\n/**\n * `$ strapi start`\n */\nconst command: StrapiCommand = () => {\n return createCommand('start')\n .description('Start your Strapi application')\n .action(runAction('start', action));\n};\n\nexport { command };\n"],"names":["action","appDir","process","cwd","tsconfigPath","path","join","distDir","fs","existsSync","quickOutDir","tryQuickOutDir","tsUtils","require","outDir","resolveOutDir","Error","createStrapi","start","command","createCommand","description","runAction"],"mappings":";;;;;;;AASA,MAAMA,MAAAA,GAAS,UAAA;IACb,MAAMC,MAAAA,GAASC,QAAQC,GAAG,EAAA;AAC1B,IAAA,MAAMC,YAAAA,GAAeC,IAAAA,CAAKC,IAAI,CAACL,MAAAA,EAAQ,eAAA,CAAA;IAEvC,IAAIM,OAAAA;AAEJ,IAAA,IAAI,CAACC,EAAAA,CAAGC,UAAU,CAACL,YAAAA,CAAAA,EAAe;QAChCG,OAAAA,GAAUN,MAAAA;IACZ,CAAA,MAAO;QACL,MAAMS,WAAAA,GAAcC,eAAeV,MAAAA,EAAQG,YAAAA,CAAAA;QAE3C,IAAIM,WAAAA,IAAeF,GAAGC,UAAU,CAACJ,KAAKC,IAAI,CAACI,WAAAA,EAAa,KAAA,EAAO,UAAA,CAAA,CAAA,EAAc;;YAE3EH,OAAAA,GAAUG,WAAAA;QACZ,CAAA,MAAO;;;AAGL,YAAA,MAAME,UAAUC,OAAAA,CAAQ,0BAAA,CAAA;AACxB,YAAA,MAAMC,MAAAA,GAAS,MAAMF,OAAAA,CAAQG,aAAa,CAACd,MAAAA,CAAAA;AAE3C,YAAA,IAAI,CAACO,EAAAA,CAAGC,UAAU,CAACK,MAAAA,CAAAA,EAAS;AAC1B,gBAAA,MAAM,IAAIE,KAAAA,CACR,CAAA,EAAGF,MAAAA,CAAO,mFAAmF,CAAC,CAAA;AAElG,YAAA;YAEAP,OAAAA,GAAUO,MAAAA;AACZ,QAAA;AACF,IAAA;IAEAG,YAAAA,CAAa;AAAEhB,QAAAA,MAAAA;AAAQM,QAAAA;AAAQ,KAAA,CAAA,CAAGW,KAAK,EAAA;AACzC,CAAA;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;IAC7B,OAAOC,aAAAA,CAAc,SAClBC,WAAW,CAAC,iCACZrB,MAAM,CAACsB,UAAU,OAAA,EAAStB,MAAAA,CAAAA,CAAAA;AAC/B;;;;"}
@@ -1,24 +1,23 @@
1
1
  'use strict';
2
2
 
3
3
  var commander = require('commander');
4
- var tsUtils = require('@strapi/typescript-utils');
5
- var core = require('@strapi/core');
6
4
  var helpers = require('../../utils/helpers.js');
7
5
 
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
-
10
- var tsUtils__default = /*#__PURE__*/_interopDefault(tsUtils);
11
-
12
6
  const action = async ({ debug, silent, verbose, outDir })=>{
13
7
  if ((debug || verbose) && silent) {
14
8
  console.error('Flags conflict: both silent and debug mode are enabled, exiting...');
15
9
  process.exit(1);
16
10
  }
17
- const appContext = await core.compileStrapi({
11
+ // Defer heavy requires until the command actually runs
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
13
+ const tsUtils = require('@strapi/typescript-utils');
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
15
+ const { createStrapi, compileStrapi } = require('@strapi/core');
16
+ const appContext = await compileStrapi({
18
17
  ignoreDiagnostics: true
19
18
  });
20
- const app = await core.createStrapi(appContext).register();
21
- await tsUtils__default.default.generators.generate({
19
+ const app = await createStrapi(appContext).register();
20
+ await tsUtils.generators.generate({
22
21
  strapi: app,
23
22
  pwd: appContext.appDir,
24
23
  rootDir: outDir ?? undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"generate-types.js","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","appContext","compileStrapi","ignoreDiagnostics","app","createStrapi","register","tsUtils","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;;;;;;;AAcA,MAAMA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAAAA,IAASE,OAAM,KAAMD,MAAAA,EAAQ;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;IAEA,MAAMC,UAAAA,GAAa,MAAMC,kBAAAA,CAAc;QAAEC,iBAAAA,EAAmB;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAAA,GAAM,MAAMC,iBAAAA,CAAaJ,UAAAA,CAAAA,CAAYK,QAAQ,EAAA;AAEnD,IAAA,MAAMC,wBAAAA,CAAQC,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAAA,EAAQN,GAAAA;AACRO,QAAAA,GAAAA,EAAKV,WAAWW,MAAM;AACtBC,QAAAA,OAAAA,EAASjB,MAAAA,IAAUkB,SAAAA;QACnBC,MAAAA,EAAQ;AACNrB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAuB,SAAAA,EAAW;YAAEC,YAAAA,EAAc,IAAA;YAAMC,UAAAA,EAAY;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMd,IAAIe,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;AAC7B,IAAA,OAAOC,uBAAAA,CAAc,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAA,EAAe,CAAC,sCAAsC,CAAC,EAAE,KAAA,CAAA,CAChEA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBAAA,EACA,uKAAA,CAAA,CAED/B,MAAM,CAACgC,kBAAU,mBAAA,EAAqBhC,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
1
+ {"version":3,"file":"generate-types.js","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n // Defer heavy requires until the command actually runs\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsUtils = require('@strapi/typescript-utils');\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { createStrapi, compileStrapi } = require('@strapi/core');\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","tsUtils","require","createStrapi","compileStrapi","appContext","ignoreDiagnostics","app","register","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;AAYA,MAAMA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAAAA,IAASE,OAAM,KAAMD,MAAAA,EAAQ;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;;;AAIA,IAAA,MAAMC,UAAUC,OAAAA,CAAQ,0BAAA,CAAA;;AAExB,IAAA,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAE,GAAGF,OAAAA,CAAQ,cAAA,CAAA;IAEhD,MAAMG,UAAAA,GAAa,MAAMD,aAAAA,CAAc;QAAEE,iBAAAA,EAAmB;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAAA,GAAM,MAAMJ,YAAAA,CAAaE,UAAAA,CAAAA,CAAYG,QAAQ,EAAA;AAEnD,IAAA,MAAMP,OAAAA,CAAQQ,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAAA,EAAQJ,GAAAA;AACRK,QAAAA,GAAAA,EAAKP,WAAWQ,MAAM;AACtBC,QAAAA,OAAAA,EAASlB,MAAAA,IAAUmB,SAAAA;QACnBC,MAAAA,EAAQ;AACNtB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAwB,SAAAA,EAAW;YAAEC,YAAAA,EAAc,IAAA;YAAMC,UAAAA,EAAY;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMZ,IAAIa,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;AAC7B,IAAA,OAAOC,uBAAAA,CAAc,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAA,EAAe,CAAC,sCAAsC,CAAC,EAAE,KAAA,CAAA,CAChEA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBAAA,EACA,uKAAA,CAAA,CAEDhC,MAAM,CAACiC,kBAAU,mBAAA,EAAqBjC,MAAAA,CAAAA,CAAAA;AAC3C;;;;;"}
@@ -1,6 +1,4 @@
1
1
  import { createCommand } from 'commander';
2
- import tsUtils__default from '@strapi/typescript-utils';
3
- import { compileStrapi, createStrapi } from '@strapi/core';
4
2
  import { runAction } from '../../utils/helpers.mjs';
5
3
 
6
4
  const action = async ({ debug, silent, verbose, outDir })=>{
@@ -8,11 +6,16 @@ const action = async ({ debug, silent, verbose, outDir })=>{
8
6
  console.error('Flags conflict: both silent and debug mode are enabled, exiting...');
9
7
  process.exit(1);
10
8
  }
9
+ // Defer heavy requires until the command actually runs
10
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
11
+ const tsUtils = require('@strapi/typescript-utils');
12
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
13
+ const { createStrapi, compileStrapi } = require('@strapi/core');
11
14
  const appContext = await compileStrapi({
12
15
  ignoreDiagnostics: true
13
16
  });
14
17
  const app = await createStrapi(appContext).register();
15
- await tsUtils__default.generators.generate({
18
+ await tsUtils.generators.generate({
16
19
  strapi: app,
17
20
  pwd: appContext.appDir,
18
21
  rootDir: outDir ?? undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"generate-types.mjs","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport tsUtils from '@strapi/typescript-utils';\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","appContext","compileStrapi","ignoreDiagnostics","app","createStrapi","register","tsUtils","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;AAcA,MAAMA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAAAA,IAASE,OAAM,KAAMD,MAAAA,EAAQ;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;IAEA,MAAMC,UAAAA,GAAa,MAAMC,aAAAA,CAAc;QAAEC,iBAAAA,EAAmB;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAAA,GAAM,MAAMC,YAAAA,CAAaJ,UAAAA,CAAAA,CAAYK,QAAQ,EAAA;AAEnD,IAAA,MAAMC,gBAAAA,CAAQC,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAAA,EAAQN,GAAAA;AACRO,QAAAA,GAAAA,EAAKV,WAAWW,MAAM;AACtBC,QAAAA,OAAAA,EAASjB,MAAAA,IAAUkB,SAAAA;QACnBC,MAAAA,EAAQ;AACNrB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAuB,SAAAA,EAAW;YAAEC,YAAAA,EAAc,IAAA;YAAMC,UAAAA,EAAY;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMd,IAAIe,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;AAC7B,IAAA,OAAOC,aAAAA,CAAc,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAA,EAAe,CAAC,sCAAsC,CAAC,EAAE,KAAA,CAAA,CAChEA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBAAA,EACA,uKAAA,CAAA,CAED/B,MAAM,CAACgC,UAAU,mBAAA,EAAqBhC,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
1
+ {"version":3,"file":"generate-types.mjs","sources":["../../../../../src/cli/commands/ts/generate-types.ts"],"sourcesContent":["import { createCommand } from 'commander';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\ninterface CmdOptions {\n debug?: boolean;\n silent?: boolean;\n verbose?: boolean;\n outDir?: string;\n}\n\nconst action = async ({ debug, silent, verbose, outDir }: CmdOptions) => {\n if ((debug || verbose) && silent) {\n console.error('Flags conflict: both silent and debug mode are enabled, exiting...');\n process.exit(1);\n }\n\n // Defer heavy requires until the command actually runs\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tsUtils = require('@strapi/typescript-utils');\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { createStrapi, compileStrapi } = require('@strapi/core');\n\n const appContext = await compileStrapi({ ignoreDiagnostics: true });\n const app = await createStrapi(appContext).register();\n\n await tsUtils.generators.generate({\n strapi: app,\n pwd: appContext.appDir,\n rootDir: outDir ?? undefined,\n logger: {\n silent,\n debug,\n },\n artifacts: { contentTypes: true, components: true },\n });\n\n await app.destroy();\n};\n\n/**\n * `$ strapi ts:generate-types`\n */\nconst command: StrapiCommand = () => {\n return createCommand('ts:generate-types')\n .description(`Generate TypeScript typings for your schemas`)\n .option('-d, --debug', `Run the generation with debug messages`, false)\n .option('-s, --silent', `Run the generation silently, without any output`, false)\n .option(\n '-o, --out-dir <outDir>',\n 'Specify a relative root directory in which the definitions will be generated. Changing this value might break types exposed by Strapi that relies on generated types.'\n )\n .action(runAction('ts:generate-types', action));\n};\n\nexport { action, command };\n"],"names":["action","debug","silent","verbose","outDir","console","error","process","exit","tsUtils","require","createStrapi","compileStrapi","appContext","ignoreDiagnostics","app","register","generators","generate","strapi","pwd","appDir","rootDir","undefined","logger","artifacts","contentTypes","components","destroy","command","createCommand","description","option","runAction"],"mappings":";;;AAYA,MAAMA,MAAAA,GAAS,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAc,GAAA;AAClE,IAAA,IAAI,CAACH,KAAAA,IAASE,OAAM,KAAMD,MAAAA,EAAQ;AAChCG,QAAAA,OAAAA,CAAQC,KAAK,CAAC,oEAAA,CAAA;AACdC,QAAAA,OAAAA,CAAQC,IAAI,CAAC,CAAA,CAAA;AACf,IAAA;;;AAIA,IAAA,MAAMC,UAAUC,OAAAA,CAAQ,0BAAA,CAAA;;AAExB,IAAA,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAE,GAAGF,OAAAA,CAAQ,cAAA,CAAA;IAEhD,MAAMG,UAAAA,GAAa,MAAMD,aAAAA,CAAc;QAAEE,iBAAAA,EAAmB;AAAK,KAAA,CAAA;AACjE,IAAA,MAAMC,GAAAA,GAAM,MAAMJ,YAAAA,CAAaE,UAAAA,CAAAA,CAAYG,QAAQ,EAAA;AAEnD,IAAA,MAAMP,OAAAA,CAAQQ,UAAU,CAACC,QAAQ,CAAC;QAChCC,MAAAA,EAAQJ,GAAAA;AACRK,QAAAA,GAAAA,EAAKP,WAAWQ,MAAM;AACtBC,QAAAA,OAAAA,EAASlB,MAAAA,IAAUmB,SAAAA;QACnBC,MAAAA,EAAQ;AACNtB,YAAAA,MAAAA;AACAD,YAAAA;AACF,SAAA;QACAwB,SAAAA,EAAW;YAAEC,YAAAA,EAAc,IAAA;YAAMC,UAAAA,EAAY;AAAK;AACpD,KAAA,CAAA;AAEA,IAAA,MAAMZ,IAAIa,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAAA,GAAyB,IAAA;AAC7B,IAAA,OAAOC,aAAAA,CAAc,mBAAA,CAAA,CAClBC,WAAW,CAAC,CAAC,4CAA4C,CAAC,CAAA,CAC1DC,MAAM,CAAC,aAAA,EAAe,CAAC,sCAAsC,CAAC,EAAE,KAAA,CAAA,CAChEA,MAAM,CAAC,cAAA,EAAgB,CAAC,+CAA+C,CAAC,EAAE,KAAA,CAAA,CAC1EA,MAAM,CACL,wBAAA,EACA,uKAAA,CAAA,CAEDhC,MAAM,CAACiC,UAAU,mBAAA,EAAqBjC,MAAAA,CAAAA,CAAAA;AAC3C;;;;"}
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
9
+ var path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ const DEFAULT_OUT_DIR = 'dist';
12
+ /**
13
+ * Strip `//` and `/* *\/` comments from JSON-like text without loading `typescript`.
14
+ */ const stripJsonComments = (input)=>{
15
+ let result = '';
16
+ let inString = false;
17
+ let stringChar = '';
18
+ let i = 0;
19
+ while(i < input.length){
20
+ const char = input[i];
21
+ const next = input[i + 1];
22
+ if (inString) {
23
+ result += char;
24
+ if (char === '\\') {
25
+ result += input[i + 1] ?? '';
26
+ i += 2;
27
+ } else if (char === stringChar) {
28
+ inString = false;
29
+ i += 1;
30
+ } else {
31
+ i += 1;
32
+ }
33
+ } else if (char === '"' || char === "'") {
34
+ inString = true;
35
+ stringChar = char;
36
+ result += char;
37
+ i += 1;
38
+ } else if (char === '/' && next === '/') {
39
+ while(i < input.length && input[i] !== '\n'){
40
+ i += 1;
41
+ }
42
+ } else if (char === '/' && next === '*') {
43
+ i += 2;
44
+ while(i < input.length && !(input[i] === '*' && input[i + 1] === '/')){
45
+ i += 1;
46
+ }
47
+ i += 2;
48
+ } else {
49
+ result += char;
50
+ i += 1;
51
+ }
52
+ }
53
+ return result;
54
+ };
55
+ /**
56
+ * Read `compilerOptions.outDir` from tsconfig.json without loading `typescript` or
57
+ * `@strapi/typescript-utils`. Returns null when the file cannot be parsed or when
58
+ * `extends` may define outDir (fall back to resolveOutDir).
59
+ */ const tryQuickOutDir = (appDir, tsconfigPath)=>{
60
+ let raw;
61
+ try {
62
+ const contents = fs__default.default.readFileSync(tsconfigPath, 'utf8');
63
+ raw = JSON.parse(stripJsonComments(contents));
64
+ } catch {
65
+ return null;
66
+ }
67
+ if (!raw || typeof raw !== 'object') {
68
+ return null;
69
+ }
70
+ const config = raw;
71
+ const localOutDir = config.compilerOptions?.outDir;
72
+ if (config.extends && localOutDir === undefined) {
73
+ return null;
74
+ }
75
+ return path__default.default.resolve(appDir, localOutDir ?? DEFAULT_OUT_DIR);
76
+ };
77
+
78
+ exports.stripJsonComments = stripJsonComments;
79
+ exports.tryQuickOutDir = tryQuickOutDir;
80
+ //# sourceMappingURL=try-quick-outdir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"try-quick-outdir.js","sources":["../../../../src/cli/utils/try-quick-outdir.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nconst DEFAULT_OUT_DIR = 'dist';\n\n/**\n * Strip `//` and `/* *\\/` comments from JSON-like text without loading `typescript`.\n */\nconst stripJsonComments = (input: string): string => {\n let result = '';\n let inString = false;\n let stringChar = '';\n let i = 0;\n\n while (i < input.length) {\n const char = input[i];\n const next = input[i + 1];\n\n if (inString) {\n result += char;\n\n if (char === '\\\\') {\n result += input[i + 1] ?? '';\n i += 2;\n } else if (char === stringChar) {\n inString = false;\n i += 1;\n } else {\n i += 1;\n }\n } else if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n result += char;\n i += 1;\n } else if (char === '/' && next === '/') {\n while (i < input.length && input[i] !== '\\n') {\n i += 1;\n }\n } else if (char === '/' && next === '*') {\n i += 2;\n while (i < input.length && !(input[i] === '*' && input[i + 1] === '/')) {\n i += 1;\n }\n i += 2;\n } else {\n result += char;\n i += 1;\n }\n }\n\n return result;\n};\n\n/**\n * Read `compilerOptions.outDir` from tsconfig.json without loading `typescript` or\n * `@strapi/typescript-utils`. Returns null when the file cannot be parsed or when\n * `extends` may define outDir (fall back to resolveOutDir).\n */\nconst tryQuickOutDir = (appDir: string, tsconfigPath: string): string | null => {\n let raw: unknown;\n\n try {\n const contents = fs.readFileSync(tsconfigPath, 'utf8');\n raw = JSON.parse(stripJsonComments(contents));\n } catch {\n return null;\n }\n\n if (!raw || typeof raw !== 'object') {\n return null;\n }\n\n const config = raw as { extends?: string; compilerOptions?: { outDir?: string } };\n const localOutDir = config.compilerOptions?.outDir;\n\n if (config.extends && localOutDir === undefined) {\n return null;\n }\n\n return path.resolve(appDir, localOutDir ?? DEFAULT_OUT_DIR);\n};\n\nexport { tryQuickOutDir, stripJsonComments };\n"],"names":["DEFAULT_OUT_DIR","stripJsonComments","input","result","inString","stringChar","i","length","char","next","tryQuickOutDir","appDir","tsconfigPath","raw","contents","fs","readFileSync","JSON","parse","config","localOutDir","compilerOptions","outDir","extends","undefined","path","resolve"],"mappings":"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"}
@@ -0,0 +1,72 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ const DEFAULT_OUT_DIR = 'dist';
5
+ /**
6
+ * Strip `//` and `/* *\/` comments from JSON-like text without loading `typescript`.
7
+ */ const stripJsonComments = (input)=>{
8
+ let result = '';
9
+ let inString = false;
10
+ let stringChar = '';
11
+ let i = 0;
12
+ while(i < input.length){
13
+ const char = input[i];
14
+ const next = input[i + 1];
15
+ if (inString) {
16
+ result += char;
17
+ if (char === '\\') {
18
+ result += input[i + 1] ?? '';
19
+ i += 2;
20
+ } else if (char === stringChar) {
21
+ inString = false;
22
+ i += 1;
23
+ } else {
24
+ i += 1;
25
+ }
26
+ } else if (char === '"' || char === "'") {
27
+ inString = true;
28
+ stringChar = char;
29
+ result += char;
30
+ i += 1;
31
+ } else if (char === '/' && next === '/') {
32
+ while(i < input.length && input[i] !== '\n'){
33
+ i += 1;
34
+ }
35
+ } else if (char === '/' && next === '*') {
36
+ i += 2;
37
+ while(i < input.length && !(input[i] === '*' && input[i + 1] === '/')){
38
+ i += 1;
39
+ }
40
+ i += 2;
41
+ } else {
42
+ result += char;
43
+ i += 1;
44
+ }
45
+ }
46
+ return result;
47
+ };
48
+ /**
49
+ * Read `compilerOptions.outDir` from tsconfig.json without loading `typescript` or
50
+ * `@strapi/typescript-utils`. Returns null when the file cannot be parsed or when
51
+ * `extends` may define outDir (fall back to resolveOutDir).
52
+ */ const tryQuickOutDir = (appDir, tsconfigPath)=>{
53
+ let raw;
54
+ try {
55
+ const contents = fs.readFileSync(tsconfigPath, 'utf8');
56
+ raw = JSON.parse(stripJsonComments(contents));
57
+ } catch {
58
+ return null;
59
+ }
60
+ if (!raw || typeof raw !== 'object') {
61
+ return null;
62
+ }
63
+ const config = raw;
64
+ const localOutDir = config.compilerOptions?.outDir;
65
+ if (config.extends && localOutDir === undefined) {
66
+ return null;
67
+ }
68
+ return path.resolve(appDir, localOutDir ?? DEFAULT_OUT_DIR);
69
+ };
70
+
71
+ export { stripJsonComments, tryQuickOutDir };
72
+ //# sourceMappingURL=try-quick-outdir.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"try-quick-outdir.mjs","sources":["../../../../src/cli/utils/try-quick-outdir.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nconst DEFAULT_OUT_DIR = 'dist';\n\n/**\n * Strip `//` and `/* *\\/` comments from JSON-like text without loading `typescript`.\n */\nconst stripJsonComments = (input: string): string => {\n let result = '';\n let inString = false;\n let stringChar = '';\n let i = 0;\n\n while (i < input.length) {\n const char = input[i];\n const next = input[i + 1];\n\n if (inString) {\n result += char;\n\n if (char === '\\\\') {\n result += input[i + 1] ?? '';\n i += 2;\n } else if (char === stringChar) {\n inString = false;\n i += 1;\n } else {\n i += 1;\n }\n } else if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n result += char;\n i += 1;\n } else if (char === '/' && next === '/') {\n while (i < input.length && input[i] !== '\\n') {\n i += 1;\n }\n } else if (char === '/' && next === '*') {\n i += 2;\n while (i < input.length && !(input[i] === '*' && input[i + 1] === '/')) {\n i += 1;\n }\n i += 2;\n } else {\n result += char;\n i += 1;\n }\n }\n\n return result;\n};\n\n/**\n * Read `compilerOptions.outDir` from tsconfig.json without loading `typescript` or\n * `@strapi/typescript-utils`. Returns null when the file cannot be parsed or when\n * `extends` may define outDir (fall back to resolveOutDir).\n */\nconst tryQuickOutDir = (appDir: string, tsconfigPath: string): string | null => {\n let raw: unknown;\n\n try {\n const contents = fs.readFileSync(tsconfigPath, 'utf8');\n raw = JSON.parse(stripJsonComments(contents));\n } catch {\n return null;\n }\n\n if (!raw || typeof raw !== 'object') {\n return null;\n }\n\n const config = raw as { extends?: string; compilerOptions?: { outDir?: string } };\n const localOutDir = config.compilerOptions?.outDir;\n\n if (config.extends && localOutDir === undefined) {\n return null;\n }\n\n return path.resolve(appDir, localOutDir ?? DEFAULT_OUT_DIR);\n};\n\nexport { tryQuickOutDir, stripJsonComments };\n"],"names":["DEFAULT_OUT_DIR","stripJsonComments","input","result","inString","stringChar","i","length","char","next","tryQuickOutDir","appDir","tsconfigPath","raw","contents","fs","readFileSync","JSON","parse","config","localOutDir","compilerOptions","outDir","extends","undefined","path","resolve"],"mappings":"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"}
@@ -1,24 +1,32 @@
1
1
  'use strict';
2
2
 
3
3
  var os = require('os');
4
- var ts = require('typescript');
5
4
 
6
5
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
6
 
8
7
  var os__default = /*#__PURE__*/_interopDefault(os);
9
- var ts__default = /*#__PURE__*/_interopDefault(ts);
10
8
 
9
+ // Lazy: defer `typescript` (~115 ms) until a CLI command actually loads tsconfig
10
+ let lazyTs;
11
+ const tsLib = ()=>{
12
+ if (!lazyTs) {
13
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
14
+ lazyTs = require('typescript');
15
+ }
16
+ return lazyTs;
17
+ };
11
18
  /**
12
19
  * @description Load a tsconfig.json file and return the parsed config.
13
20
  *
14
21
  * @internal
15
22
  */ const loadTsConfig = ({ cwd, path, logger })=>{
16
- const configPath = ts__default.default.findConfigFile(cwd, ts__default.default.sys.fileExists, path);
23
+ const tsApi = tsLib();
24
+ const configPath = tsApi.findConfigFile(cwd, tsApi.sys.fileExists, path);
17
25
  if (!configPath) {
18
26
  return undefined;
19
27
  }
20
- const configFile = ts__default.default.readConfigFile(configPath, ts__default.default.sys.readFile);
21
- const parsedConfig = ts__default.default.parseJsonConfigFileContent(configFile.config, ts__default.default.sys, cwd);
28
+ const configFile = tsApi.readConfigFile(configPath, tsApi.sys.readFile);
29
+ const parsedConfig = tsApi.parseJsonConfigFileContent(configFile.config, tsApi.sys, cwd);
22
30
  logger.debug(`Loaded user TS config:`, os__default.default.EOL, parsedConfig);
23
31
  return {
24
32
  config: parsedConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.js","sources":["../../../../src/cli/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport ts from 'typescript';\nimport type { Logger } from './logger';\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n\n const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["loadTsConfig","cwd","path","logger","configPath","ts","findConfigFile","sys","fileExists","undefined","configFile","readConfigFile","readFile","parsedConfig","parseJsonConfigFileContent","config","debug","os","EOL"],"mappings":";;;;;;;;;;AASA;;;;IAKA,MAAMA,eAAe,CAAC,EACpBC,GAAG,EACHC,IAAI,EACJC,MAAM,EAKP,GAAA;IACC,MAAMC,UAAAA,GAAaC,oBAAGC,cAAc,CAACL,KAAKI,mBAAAA,CAAGE,GAAG,CAACC,UAAU,EAAEN,IAAAA,CAAAA;AAE7D,IAAA,IAAI,CAACE,UAAAA,EAAY;QACf,OAAOK,SAAAA;AACT,IAAA;IAEA,MAAMC,UAAAA,GAAaL,oBAAGM,cAAc,CAACP,YAAYC,mBAAAA,CAAGE,GAAG,CAACK,QAAQ,CAAA;IAEhE,MAAMC,YAAAA,GAAeR,oBAAGS,0BAA0B,CAACJ,WAAWK,MAAM,EAAEV,mBAAAA,CAAGE,GAAG,EAAEN,GAAAA,CAAAA;IAE9EE,MAAAA,CAAOa,KAAK,CAAC,CAAC,sBAAsB,CAAC,EAAEC,mBAAAA,CAAGC,GAAG,EAAEL,YAAAA,CAAAA;IAE/C,OAAO;QACLE,MAAAA,EAAQF,YAAAA;QACRX,IAAAA,EAAME;AACR,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"tsconfig.js","sources":["../../../../src/cli/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport type ts from 'typescript';\nimport type { Logger } from './logger';\n\n// Lazy: defer `typescript` (~115 ms) until a CLI command actually loads tsconfig\nlet lazyTs: typeof ts | undefined;\nconst tsLib = (): typeof ts => {\n if (!lazyTs) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n lazyTs = require('typescript');\n }\n return lazyTs as typeof ts;\n};\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const tsApi = tsLib();\n const configPath = tsApi.findConfigFile(cwd, tsApi.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = tsApi.readConfigFile(configPath, tsApi.sys.readFile);\n\n const parsedConfig = tsApi.parseJsonConfigFileContent(configFile.config, tsApi.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["lazyTs","tsLib","require","loadTsConfig","cwd","path","logger","tsApi","configPath","findConfigFile","sys","fileExists","undefined","configFile","readConfigFile","readFile","parsedConfig","parseJsonConfigFileContent","config","debug","os","EOL"],"mappings":";;;;;;;;AAIA;AACA,IAAIA,MAAAA;AACJ,MAAMC,KAAAA,GAAQ,IAAA;AACZ,IAAA,IAAI,CAACD,MAAAA,EAAQ;;AAEXA,QAAAA,MAAAA,GAASE,OAAAA,CAAQ,YAAA,CAAA;AACnB,IAAA;IACA,OAAOF,MAAAA;AACT,CAAA;AAOA;;;;IAKA,MAAMG,eAAe,CAAC,EACpBC,GAAG,EACHC,IAAI,EACJC,MAAM,EAKP,GAAA;AACC,IAAA,MAAMC,KAAAA,GAAQN,KAAAA,EAAAA;IACd,MAAMO,UAAAA,GAAaD,MAAME,cAAc,CAACL,KAAKG,KAAAA,CAAMG,GAAG,CAACC,UAAU,EAAEN,IAAAA,CAAAA;AAEnE,IAAA,IAAI,CAACG,UAAAA,EAAY;QACf,OAAOI,SAAAA;AACT,IAAA;IAEA,MAAMC,UAAAA,GAAaN,MAAMO,cAAc,CAACN,YAAYD,KAAAA,CAAMG,GAAG,CAACK,QAAQ,CAAA;IAEtE,MAAMC,YAAAA,GAAeT,MAAMU,0BAA0B,CAACJ,WAAWK,MAAM,EAAEX,KAAAA,CAAMG,GAAG,EAAEN,GAAAA,CAAAA;IAEpFE,MAAAA,CAAOa,KAAK,CAAC,CAAC,sBAAsB,CAAC,EAAEC,mBAAAA,CAAGC,GAAG,EAAEL,YAAAA,CAAAA;IAE/C,OAAO;QACLE,MAAAA,EAAQF,YAAAA;QACRX,IAAAA,EAAMG;AACR,KAAA;AACF;;;;"}
@@ -1,17 +1,26 @@
1
1
  import os from 'os';
2
- import ts from 'typescript';
3
2
 
3
+ // Lazy: defer `typescript` (~115 ms) until a CLI command actually loads tsconfig
4
+ let lazyTs;
5
+ const tsLib = ()=>{
6
+ if (!lazyTs) {
7
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8
+ lazyTs = require('typescript');
9
+ }
10
+ return lazyTs;
11
+ };
4
12
  /**
5
13
  * @description Load a tsconfig.json file and return the parsed config.
6
14
  *
7
15
  * @internal
8
16
  */ const loadTsConfig = ({ cwd, path, logger })=>{
9
- const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);
17
+ const tsApi = tsLib();
18
+ const configPath = tsApi.findConfigFile(cwd, tsApi.sys.fileExists, path);
10
19
  if (!configPath) {
11
20
  return undefined;
12
21
  }
13
- const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
14
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);
22
+ const configFile = tsApi.readConfigFile(configPath, tsApi.sys.readFile);
23
+ const parsedConfig = tsApi.parseJsonConfigFileContent(configFile.config, tsApi.sys, cwd);
15
24
  logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);
16
25
  return {
17
26
  config: parsedConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.mjs","sources":["../../../../src/cli/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport ts from 'typescript';\nimport type { Logger } from './logger';\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n\n const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["loadTsConfig","cwd","path","logger","configPath","ts","findConfigFile","sys","fileExists","undefined","configFile","readConfigFile","readFile","parsedConfig","parseJsonConfigFileContent","config","debug","os","EOL"],"mappings":";;;AASA;;;;IAKA,MAAMA,eAAe,CAAC,EACpBC,GAAG,EACHC,IAAI,EACJC,MAAM,EAKP,GAAA;IACC,MAAMC,UAAAA,GAAaC,GAAGC,cAAc,CAACL,KAAKI,EAAAA,CAAGE,GAAG,CAACC,UAAU,EAAEN,IAAAA,CAAAA;AAE7D,IAAA,IAAI,CAACE,UAAAA,EAAY;QACf,OAAOK,SAAAA;AACT,IAAA;IAEA,MAAMC,UAAAA,GAAaL,GAAGM,cAAc,CAACP,YAAYC,EAAAA,CAAGE,GAAG,CAACK,QAAQ,CAAA;IAEhE,MAAMC,YAAAA,GAAeR,GAAGS,0BAA0B,CAACJ,WAAWK,MAAM,EAAEV,EAAAA,CAAGE,GAAG,EAAEN,GAAAA,CAAAA;IAE9EE,MAAAA,CAAOa,KAAK,CAAC,CAAC,sBAAsB,CAAC,EAAEC,EAAAA,CAAGC,GAAG,EAAEL,YAAAA,CAAAA;IAE/C,OAAO;QACLE,MAAAA,EAAQF,YAAAA;QACRX,IAAAA,EAAME;AACR,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"tsconfig.mjs","sources":["../../../../src/cli/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport type ts from 'typescript';\nimport type { Logger } from './logger';\n\n// Lazy: defer `typescript` (~115 ms) until a CLI command actually loads tsconfig\nlet lazyTs: typeof ts | undefined;\nconst tsLib = (): typeof ts => {\n if (!lazyTs) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n lazyTs = require('typescript');\n }\n return lazyTs as typeof ts;\n};\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const tsApi = tsLib();\n const configPath = tsApi.findConfigFile(cwd, tsApi.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = tsApi.readConfigFile(configPath, tsApi.sys.readFile);\n\n const parsedConfig = tsApi.parseJsonConfigFileContent(configFile.config, tsApi.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["lazyTs","tsLib","require","loadTsConfig","cwd","path","logger","tsApi","configPath","findConfigFile","sys","fileExists","undefined","configFile","readConfigFile","readFile","parsedConfig","parseJsonConfigFileContent","config","debug","os","EOL"],"mappings":";;AAIA;AACA,IAAIA,MAAAA;AACJ,MAAMC,KAAAA,GAAQ,IAAA;AACZ,IAAA,IAAI,CAACD,MAAAA,EAAQ;;AAEXA,QAAAA,MAAAA,GAASE,OAAAA,CAAQ,YAAA,CAAA;AACnB,IAAA;IACA,OAAOF,MAAAA;AACT,CAAA;AAOA;;;;IAKA,MAAMG,eAAe,CAAC,EACpBC,GAAG,EACHC,IAAI,EACJC,MAAM,EAKP,GAAA;AACC,IAAA,MAAMC,KAAAA,GAAQN,KAAAA,EAAAA;IACd,MAAMO,UAAAA,GAAaD,MAAME,cAAc,CAACL,KAAKG,KAAAA,CAAMG,GAAG,CAACC,UAAU,EAAEN,IAAAA,CAAAA;AAEnE,IAAA,IAAI,CAACG,UAAAA,EAAY;QACf,OAAOI,SAAAA;AACT,IAAA;IAEA,MAAMC,UAAAA,GAAaN,MAAMO,cAAc,CAACN,YAAYD,KAAAA,CAAMG,GAAG,CAACK,QAAQ,CAAA;IAEtE,MAAMC,YAAAA,GAAeT,MAAMU,0BAA0B,CAACJ,WAAWK,MAAM,EAAEX,KAAAA,CAAMG,GAAG,EAAEN,GAAAA,CAAAA;IAEpFE,MAAAA,CAAOa,KAAK,CAAC,CAAC,sBAAsB,CAAC,EAAEC,EAAAA,CAAGC,GAAG,EAAEL,YAAAA,CAAAA;IAE/C,OAAO;QACLE,MAAAA,EAAQF,YAAAA;QACRX,IAAAA,EAAMG;AACR,KAAA;AACF;;;;"}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Modules given explicit Vite resolve aliases (and included in resolve.dedupe) for the admin bundle.
5
+ * Single source of truth for resolution contract tests.
6
+ *
7
+ * @internal
8
+ */ const ADMIN_VITE_ALIAS_MODULES = [
9
+ 'react',
10
+ 'react-dom',
11
+ 'react-router-dom',
12
+ 'styled-components',
13
+ 'react-redux',
14
+ '@reduxjs/toolkit',
15
+ '@strapi/design-system',
16
+ '@radix-ui/react-tooltip',
17
+ 'lodash'
18
+ ];
19
+ /** Same modules passed to Vite resolve.dedupe */ const ADMIN_VITE_DEDUPE_MODULES = ADMIN_VITE_ALIAS_MODULES;
20
+
21
+ exports.ADMIN_VITE_ALIAS_MODULES = ADMIN_VITE_ALIAS_MODULES;
22
+ exports.ADMIN_VITE_DEDUPE_MODULES = ADMIN_VITE_DEDUPE_MODULES;
23
+ //# sourceMappingURL=admin-vite-alias-modules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-vite-alias-modules.js","sources":["../../../../src/node/core/admin-vite-alias-modules.ts"],"sourcesContent":["/**\n * Modules given explicit Vite resolve aliases (and included in resolve.dedupe) for the admin bundle.\n * Single source of truth for resolution contract tests.\n *\n * @internal\n */\nexport const ADMIN_VITE_ALIAS_MODULES = [\n 'react',\n 'react-dom',\n 'react-router-dom',\n 'styled-components',\n 'react-redux',\n '@reduxjs/toolkit',\n '@strapi/design-system',\n '@radix-ui/react-tooltip',\n 'lodash',\n] as const;\n\nexport type AdminViteAliasModule = (typeof ADMIN_VITE_ALIAS_MODULES)[number];\n\n/** Same modules passed to Vite resolve.dedupe */\nexport const ADMIN_VITE_DEDUPE_MODULES = ADMIN_VITE_ALIAS_MODULES;\n\n/**\n * Alias modules with exact versions declared in @strapi/admin dependencies (not peers).\n */\nexport const ADMIN_PINNED_ALIAS_MODULES = [\n '@reduxjs/toolkit',\n 'react-redux',\n '@strapi/design-system',\n 'lodash',\n] as const satisfies readonly AdminViteAliasModule[];\n"],"names":["ADMIN_VITE_ALIAS_MODULES","ADMIN_VITE_DEDUPE_MODULES"],"mappings":";;AAAA;;;;;UAMaA,wBAAAA,GAA2B;AACtC,IAAA,OAAA;AACA,IAAA,WAAA;AACA,IAAA,kBAAA;AACA,IAAA,mBAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,uBAAA;AACA,IAAA,yBAAA;AACA,IAAA;;AAKF,kDACO,MAAMC,yBAAAA,GAA4BD;;;;;"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Modules given explicit Vite resolve aliases (and included in resolve.dedupe) for the admin bundle.
3
+ * Single source of truth for resolution contract tests.
4
+ *
5
+ * @internal
6
+ */ const ADMIN_VITE_ALIAS_MODULES = [
7
+ 'react',
8
+ 'react-dom',
9
+ 'react-router-dom',
10
+ 'styled-components',
11
+ 'react-redux',
12
+ '@reduxjs/toolkit',
13
+ '@strapi/design-system',
14
+ '@radix-ui/react-tooltip',
15
+ 'lodash'
16
+ ];
17
+ /** Same modules passed to Vite resolve.dedupe */ const ADMIN_VITE_DEDUPE_MODULES = ADMIN_VITE_ALIAS_MODULES;
18
+
19
+ export { ADMIN_VITE_ALIAS_MODULES, ADMIN_VITE_DEDUPE_MODULES };
20
+ //# sourceMappingURL=admin-vite-alias-modules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-vite-alias-modules.mjs","sources":["../../../../src/node/core/admin-vite-alias-modules.ts"],"sourcesContent":["/**\n * Modules given explicit Vite resolve aliases (and included in resolve.dedupe) for the admin bundle.\n * Single source of truth for resolution contract tests.\n *\n * @internal\n */\nexport const ADMIN_VITE_ALIAS_MODULES = [\n 'react',\n 'react-dom',\n 'react-router-dom',\n 'styled-components',\n 'react-redux',\n '@reduxjs/toolkit',\n '@strapi/design-system',\n '@radix-ui/react-tooltip',\n 'lodash',\n] as const;\n\nexport type AdminViteAliasModule = (typeof ADMIN_VITE_ALIAS_MODULES)[number];\n\n/** Same modules passed to Vite resolve.dedupe */\nexport const ADMIN_VITE_DEDUPE_MODULES = ADMIN_VITE_ALIAS_MODULES;\n\n/**\n * Alias modules with exact versions declared in @strapi/admin dependencies (not peers).\n */\nexport const ADMIN_PINNED_ALIAS_MODULES = [\n '@reduxjs/toolkit',\n 'react-redux',\n '@strapi/design-system',\n 'lodash',\n] as const satisfies readonly AdminViteAliasModule[];\n"],"names":["ADMIN_VITE_ALIAS_MODULES","ADMIN_VITE_DEDUPE_MODULES"],"mappings":"AAAA;;;;;UAMaA,wBAAAA,GAA2B;AACtC,IAAA,OAAA;AACA,IAAA,WAAA;AACA,IAAA,kBAAA;AACA,IAAA,mBAAA;AACA,IAAA,aAAA;AACA,IAAA,kBAAA;AACA,IAAA,uBAAA;AACA,IAAA,yBAAA;AACA,IAAA;;AAKF,kDACO,MAAMC,yBAAAA,GAA4BD;;;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var adminViteAliasModules = require('./admin-vite-alias-modules.js');
4
+ var resolveModule = require('./resolve-module.js');
5
+
6
+ /**
7
+ * Vite resolve.alias entries for the admin bundle — every path comes from @strapi/admin's closure.
8
+ *
9
+ * @internal
10
+ */ const buildAdminViteResolveAliases = ()=>Object.fromEntries(adminViteAliasModules.ADMIN_VITE_ALIAS_MODULES.map((mod)=>[
11
+ mod,
12
+ resolveModule.getModulePath(mod)
13
+ ]));
14
+
15
+ exports.buildAdminViteResolveAliases = buildAdminViteResolveAliases;
16
+ //# sourceMappingURL=admin-vite-aliases.js.map